@@ -45,11 +45,7 @@ def close(self):
4545 pass
4646
4747 def sendCommand (self , commandNumber , parameters , skipStatusErrors ):
48- ##raise RuntimeError("saraza1")
49- ## if commandNumber in EpsonPrinter.CMD_CLOSE_FISCAL_RECEIPT:
50- ## #raise RuntimeError("saraza")
51- ## else:
52- ## pass
48+
5349 return ["00" , "00" , "" , "" , str (self .number ), "" , str (self .number )] + [str (self .number )] * 11
5450
5551
@@ -58,7 +54,7 @@ class EpsonPrinter(PrinterInterface):
5854
5955 CMD_OPEN_FISCAL_RECEIPT = 0x40
6056 CMD_OPEN_BILL_TICKET = 0x60
61- ## CMD_PRINT_TEXT_IN_FISCAL = (0x41, 0x61)
57+ # CMD_PRINT_TEXT_IN_FISCAL = (0x41, 0x61)
6258 CMD_PRINT_TEXT_IN_FISCAL = 0x41
6359 CMD_PRINT_LINE_ITEM = (0x42 , 0x62 )
6460 CMD_PRINT_SUBTOTAL = (0x43 , 0x63 )
@@ -91,8 +87,7 @@ def __init__(self, deviceFile=None, speed=9600, host=None, port=None, dummy=Fals
9187 else :
9288 deviceFile = deviceFile or 0
9389 self .driver = driver .EpsonFiscalDriver (deviceFile , speed )
94- #self.driver = FileDriver( "/home/gnarvaja/Desktop/fiscal.txt" )
95- except Exception , e :
90+ except Exception as e :
9691 raise FiscalPrinterError ("Imposible establecer comunicación." , e )
9792 if not model :
9893 self .model = "tickeadoras"
@@ -355,7 +350,8 @@ def dailyClose(self, type):
355350 def getLastNumber (self , letter ):
356351 reply = self ._sendCommand (self .CMD_STATUS_REQUEST , ["A" ], True )
357352 if len (reply ) < 3 :
358- # La respuesta no es válida. Vuelvo a hacer el pedido y si hay algún error que se reporte como excepción
353+ # La respuesta no es válida. Vuelvo a hacer el pedido y si hay
354+ # algún error que se reporte como excepción
359355 reply = self ._sendCommand (self .CMD_STATUS_REQUEST , ["A" ], False )
360356 if letter == "A" :
361357 return int (reply [6 ])
@@ -365,7 +361,8 @@ def getLastNumber(self, letter):
365361 def getLastCreditNoteNumber (self , letter ):
366362 reply = self ._sendCommand (self .CMD_STATUS_REQUEST , ["A" ], True )
367363 if len (reply ) < 3 :
368- # La respuesta no es válida. Vuelvo a hacer el pedido y si hay algún error que se reporte como excepción
364+ # La respuesta no es válida. Vuelvo a hacer el pedido y si hay algún
365+ # error que se reporte como excepción
369366 reply = self ._sendCommand (self .CMD_STATUS_REQUEST , ["A" ], False )
370367 if letter == "A" :
371368 return int (reply [10 ])
@@ -390,6 +387,15 @@ def cancelAnyDocument(self):
390387 pass
391388 return False
392389
390+ def getSubtotal (self ):
391+ reply = self ._sendCommand (self .CMD_PRINT_SUBTOTAL , ["P" , "0" , "0" ], True )
392+
393+ if len (reply ) < 3 :
394+ # La respuesta no es válida. Vuelvo a hacer el pedido y
395+ # si hay algún error que se reporte como excepción
396+ reply = self ._sendCommand (self .CMD_PRINT_SUBTOTAL , [], False )
397+ return reply
398+
393399 def getWarnings (self ):
394400 ret = []
395401 reply = self ._sendCommand (self .CMD_STATUS_REQUEST , ["N" ], True )
0 commit comments