-
Notifications
You must be signed in to change notification settings - Fork 0
/
S1PrinterData.py
188 lines (143 loc) · 6.6 KB
/
S1PrinterData.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
import datetime
from .Util import Util
class S1PrinterData(object):
_cashierNumber = 0
_totalDailySales = 0
_lastInvoiceNumber = 0
_quantityOfInvoicesToday = 0
_lastDebtNoteNumber = 0
_quantityDebtNoteToday = 0
_lastNCNumber = 0
_quantityOfNCToday = 0
_numberNonFiscalDocuments = 0
_quantityNonFiscalDocuments = 0
_auditReportsCounter = 0
_fiscalReportsCounter = 0
_dailyClosureCounter = 0
_rif = ""
_registeredMachineNumber = ""
_currentPrinterDate = ""
_currentPrinterTime = ""
def __init__(self, trama):
if(trama!=None):
if (len(trama)>100): # and len(trama)<116): #116
try:
_arrayParameter=str(trama[1:-1]).split(chr(0X0A))
if len(_arrayParameter)<=15:
self._setCashierNumber(_arrayParameter[0][2:])
self._setTotalDailySales(Util().DoValueDouble(_arrayParameter[1]))
self._setLastInvoiceNumber(int(_arrayParameter[2]))
self._setQuantityOfInvoicesToday(int(_arrayParameter[3]))
self._setNumberNonFiscalDocuments(int(_arrayParameter[4]))
self._setQuantityNonFiscalDocuments(int(_arrayParameter[5]))
self._setDailyClosureCounter(int(_arrayParameter[6]))
self._setFiscalReportsCounter(int(_arrayParameter[7]))
self._setRif(_arrayParameter[8])
self._setRegisteredMachineNumber(_arrayParameter[9])
_hr = _arrayParameter[10][0:2]
_mn = _arrayParameter[10][2:4]
_sg = _arrayParameter[10][4:6]
_dd = _arrayParameter[11][0:2]
_mm = _arrayParameter[11][2:4]
_aa = int(_arrayParameter[11][4:6])+2000
_printerDate = str(_dd) + "-" + str(_mm) + "-" + str(_aa)
_printerTime = str(_hr) +":"+ str(_mn) +":"+ str(_sg)
self._setCurrentPrinterTime(_printerTime)
self._setCurrentPrinterDate(_printerDate)
self._setLastNCNumber(int(_arrayParameter[12]))
self._setQuantityOfNCToday(int(_arrayParameter[13]))
else:
self._setCashierNumber(_arrayParameter[0][2:])
self._setTotalDailySales(Util().DoValueDouble(_arrayParameter[1]))
self._setLastInvoiceNumber(int(_arrayParameter[2]))
self._setQuantityOfInvoicesToday(int(_arrayParameter[3]))
self._setLastDebtNoteNumber(int(_arrayParameter[4]))
self._setQuantityDebtNoteToday(int(_arrayParameter[5]))
self._setLastNCNumber(int(_arrayParameter[6]))
self._setQuantityOfNCToday(int(_arrayParameter[7]))
self._setNumberNonFiscalDocuments(int(_arrayParameter[8]))
self._setQuantityNonFiscalDocuments(int(_arrayParameter[9]))
self._setAuditReportsCounter(int(_arrayParameter[10]))
self._setDailyClosureCounter(int(_arrayParameter[11]))
self._setRif(_arrayParameter[12])
self._setRegisteredMachineNumber(_arrayParameter[13])
_hr = _arrayParameter[14][0:2]
_mn = _arrayParameter[14][2:4]
_sg = _arrayParameter[14][4:6]
_dd = _arrayParameter[15][0:2]
_mm = _arrayParameter[15][2:4]
_aa = int(_arrayParameter[15][4:6])+2000
_printerDate = str(_dd) + "-" + str(_mm) + "-" + str(_aa)
_printerTime = str(_hr) +":"+ str(_mn) +":"+ str(_sg)
self._setCurrentPrinterTime(_printerTime)
self._setCurrentPrinterDate(_printerDate)
except (ValueError):
return
def CashierNumber(self):
return self._cashierNumber
def _setCashierNumber(self, cashierNumber):
self._cashierNumber = cashierNumber
def TotalDailySales(self):
return self._totalDailySales
def _setTotalDailySales(self, totalDailySales):
self._totalDailySales = totalDailySales
def LastInvoiceNumber(self):
return self._lastInvoiceNumber
def _setLastInvoiceNumber(self, lastInvoiceNumber):
self._lastInvoiceNumber = lastInvoiceNumber
def QuantityOfInvoicesToday(self):
return self._quantityOfInvoicesToday
def _setQuantityOfInvoicesToday(self, quantityOfInvoicesToday):
self._quantityOfInvoicesToday = quantityOfInvoicesToday
def LastDebtNoteNumber(self):
return self._lastDebtNoteNumber
def _setLastDebtNoteNumber(self, lastDebtNoteNumber):
self._lastDebtNoteNumber = lastDebtNoteNumber
def QuantityDebtNoteToday(self):
return self._quantityDebtNoteToday
def _setQuantityDebtNoteToday(self, quantityDebtNoteToday):
self._quantityDebtNoteToday = quantityDebtNoteToday
def NumberNonFiscalDocuments(self):
return self._numberNonFiscalDocuments
def _setNumberNonFiscalDocuments(self, numberNonFiscalDocuments):
self._numberNonFiscalDocuments = numberNonFiscalDocuments
def QuantityNonFiscalDocuments(self):
return self._quantityNonFiscalDocuments
def _setQuantityNonFiscalDocuments(self, quantityNonFiscalDocuments):
self._quantityNonFiscalDocuments = quantityNonFiscalDocuments
def DailyClosureCounter(self):
return self._dailyClosureCounter
def _setDailyClosureCounter(self, dailyClosureCounter):
self._dailyClosureCounter = dailyClosureCounter
def AuditReportsCounter(self):
return self._auditReportsCounter
def _setAuditReportsCounter(self, auditReportsCounter):
self._auditReportsCounter = auditReportsCounter
def FiscalReportsCounter(self):
return self._fiscalReportsCounter
def _setFiscalReportsCounter(self, fiscalReportsCounter):
self._fiscalReportsCounter = fiscalReportsCounter
def Rif(self):
return self._rif
def _setRif(self, rif):
self._rif = rif
def RegisteredMachineNumber(self):
return self._registeredMachineNumber
def _setRegisteredMachineNumber(self, registeredMachineNumber):
self._registeredMachineNumber= registeredMachineNumber
def CurrentPrinterDate(self):
return self._currentPrinterDate
def _setCurrentPrinterDate(self, currentPrinterDate):
self._currentPrinterDate = currentPrinterDate
def CurrentPrinterTime(self):
return self._currentPrinterTime
def _setCurrentPrinterTime(self, currentPrinterTime):
self._currentPrinterTime = currentPrinterTime
def LastNCNumber(self):
return self._lastNCNumber
def _setLastNCNumber(self, lastNCNumber):
self._lastNCNumber = lastNCNumber
def QuantityOfNCToday(self):
return self._quantityOfNCToday
def _setQuantityOfNCToday (self, quantityOfNCToday):
self._quantityOfNCToday = quantityOfNCToday