BonPrinter v1.2.0
Thermal Printer tool
Loading...
Searching...
No Matches
Source.Model.report Namespace Reference

Classes

class  Item
 properties of printed article More...
class  ItemReport
 properties of logged article More...
class  Report
 Report class to log and create sales articles. More...

Functions

Item create_item (int count, str name, int pos, int group, float price, float price_total, str|None user, datetime date, bool port)
 Create Item to write to log.

Variables

bool B_POWERSHELL_COPY = False
dict D_GROUP_SUMMARY
 log = logging.getLogger(__title__)
str S_COMBINE_FOLDER_NAME = "CombinedReport"
str S_PRINT_FILE = f"{S_PRINT_LOG_NAME}.csv"
str S_PRINT_LOG_NAME = "PrintLog"
str S_REPORT_FOLDER_NAME = "PrintReport"
str S_REPORT_NAME = "Report"
str SALES_KEY = "sales"
str SUM_KEY = "sum"

Detailed Description


Function Documentation

◆ create_item()

Item create_item ( int count,
str name,
int pos,
int group,
float price,
float price_total,
str | None user,
datetime date,
bool port )

Create Item to write to log.

Parameters
count: number of items
name: name of item
pos: article position
group: group number
price: single article prince
price_total: total article price
user: user name who print the article
date: datetime of item print
port: status if item print or only save (if print use COM port name)
Returns
item

Definition at line 77 of file report.py.

77def create_item(count: int, name: str, pos: int, group: int, price: float, price_total: float, user: str | None, date: datetime, port: bool) -> Item:
78 """!
79 @brief Create Item to write to log
80 @param count : number of items
81 @param name : name of item
82 @param pos : article position
83 @param group : group number
84 @param price : single article prince
85 @param price_total : total article price
86 @param user : user name who print the article
87 @param date : datetime of item print
88 @param port : status if item print or only save (if print use COM port name)
89 @return item
90 """
91 s_datetime = date.strftime(S_DATE_PRINT_FORMAT) if (date is not None) else None
92 assert (user is not None), "None user will print"
93 return Item(count, name, pos, group, f"{price:.2f}", f"{price_total:.2f}", user, s_datetime, port)
94
95

Variable Documentation

◆ B_POWERSHELL_COPY

bool B_POWERSHELL_COPY = False

Definition at line 28 of file report.py.

◆ D_GROUP_SUMMARY

dict D_GROUP_SUMMARY
Initial value:
1= {I_GROUP_1: {SUM_KEY: 0, SALES_KEY: {}},
2 I_GROUP_2: {SUM_KEY: 0, SALES_KEY: {}},
3 I_GROUP_3: {SUM_KEY: 0, SALES_KEY: {}}}

Definition at line 42 of file report.py.

◆ log

log = logging.getLogger(__title__)

Definition at line 26 of file report.py.

◆ S_COMBINE_FOLDER_NAME

str S_COMBINE_FOLDER_NAME = "CombinedReport"

Definition at line 36 of file report.py.

◆ S_PRINT_FILE

str S_PRINT_FILE = f"{S_PRINT_LOG_NAME}.csv"

Definition at line 32 of file report.py.

◆ S_PRINT_LOG_NAME

str S_PRINT_LOG_NAME = "PrintLog"

Definition at line 30 of file report.py.

◆ S_REPORT_FOLDER_NAME

str S_REPORT_FOLDER_NAME = "PrintReport"

Definition at line 35 of file report.py.

◆ S_REPORT_NAME

str S_REPORT_NAME = "Report"

Definition at line 34 of file report.py.

◆ SALES_KEY

str SALES_KEY = "sales"

Definition at line 39 of file report.py.

◆ SUM_KEY

str SUM_KEY = "sum"

Definition at line 40 of file report.py.