def __init__(self, brand=None, model=None, device=None, config_file=None, *args, **kwargs): if config_file != None: config = ParseConfigFile(config_file) device, brand, model = config.get_config() FiscalPrinter.__init__(self, brand, model, device, config_file, *args, **kwargs) self._invoice_dict = {}
def __init__(self, brand=None, model=None, device=None, config_file=None, *args, **kwargs): if config_file != None: config = ParseConfigFile(config_file) device, brand, model = config.get_config() FiscalPrinter.__init__(self, brand, model, device, config_file, *args, **kwargs) self._invoice_dict = {}
def get_fiscal_driver(self): if self.brand == 'virtual': port = VirtualPort() else: port = SerialPort(device=self.device_name, baudrate=self.baudrate) return FiscalPrinter(brand=self.brand, model=self.model, port=port)
def get_virtual_printer(): from stoqdrivers.printers.fiscal import FiscalPrinter return FiscalPrinter(brand='virtual', model='Simple')
def example(): printer = FiscalPrinter() printer.identify_customer('Henrique Romano', 'Async', '1234567890') while True: try: printer.open() break except PendingReduceZ: printer.close_till() return except PendingReadX: printer.summarize() return except CouponOpenError: printer.cancel() item1_id = printer.add_item("123456", u"Hollywóód", Decimal("2.00"), TaxType.SUBSTITUTION, unit=UnitType.CUSTOM, unit_desc=u"mç") item2_id = printer.add_item("654321", u"Heineken Beer", Decimal("1.53"), TaxType.NONE, items_quantity=Decimal("5"), unit=UnitType.LITERS) printer.cancel_item(item1_id) coupon_total = printer.totalize(discount=Decimal('1.0')) printer.add_payment(PaymentMethodType.MONEY, Decimal('2.00')) printer.add_payment(PaymentMethodType.MONEY, Decimal('11.00')) coupon_id = printer.close() print "+++ coupon %d created." % coupon_id