forked from edsonbernar/nfe_utils
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4ca2939
commit ae18543
Showing
12 changed files
with
2,340 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from .config import ( | ||
DacteConfig, | ||
DecimalConfig, | ||
FontType, | ||
Margins, | ||
ReceiptPosition, | ||
) | ||
from .dacte import Dacte | ||
|
||
__all__ = [ | ||
"Dacte", | ||
"DacteConfig", | ||
"DecimalConfig", | ||
"FontType", | ||
"Margins", | ||
"ReceiptPosition", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
from dataclasses import dataclass, field | ||
from enum import Enum | ||
from io import BytesIO | ||
from numbers import Number | ||
from typing import Union | ||
|
||
|
||
class FontType(Enum): | ||
COURIER = "Courier" | ||
TIMES = "Times" | ||
|
||
|
||
@dataclass | ||
class Margins: | ||
top: Number = 2 | ||
right: Number = 2 | ||
bottom: Number = 2 | ||
left: Number = 2 | ||
|
||
|
||
@dataclass | ||
class DecimalConfig: | ||
price_precision: int = 4 | ||
quantity_precision: int = 4 | ||
|
||
|
||
class ReceiptPosition(Enum): | ||
TOP = "top" | ||
BOTTOM = "bottom" | ||
LEFT = "left" | ||
|
||
|
||
@dataclass | ||
class DacteConfig: | ||
logo: Union[str, BytesIO, bytes] = None | ||
margins: Margins = field(default_factory=Margins) | ||
receipt_pos: ReceiptPosition = ReceiptPosition.TOP | ||
decimal_config: DecimalConfig = field(default_factory=DecimalConfig) | ||
font_type: FontType = FontType.TIMES |
Oops, something went wrong.