def imprimir_cupom_cancelamento(): # mini-impressora Epson TM-T20 conectada à porta serial COM1 conn = SerialSettings.as_from('COM1:9600,8,1,N').get_connection() impressora = TMT20(conn) impressora.init() with open('CFe_1.xml', 'r') as fvenda, open('CFeCanc_1.xml', 'r') as fcanc: extrato = ExtratoCFeCancelamento(fvenda, fcanc, impressora) extrato.imprimir()
def imprimir_cupom_venda(): # mini-impressora Epson TM-T20 conectada à porta serial COM1 conn = SerialSettings.as_from('COM1:9600,8,1,N').get_connection() impressora = TMT20(conn) impressora.init() # abre o arquivo do CF-e e emite o extrato with open(r'C:\CFe545090.xml', 'r') as fp: extrato = ExtratoCFeVenda(fp, impressora) extrato.imprimir()
def _init_printer(self): from escpos.serial import SerialSettings if self.impressora == 'epson-tm-t20': _logger.info(u'SAT Impressao: Epson TM-T20') from escpos.impl.epson import TMT20 as Printer elif self.impressora == 'bematech-mp4200th': _logger.info(u'SAT Impressao: Bematech MP4200TH') from escpos.impl.bematech import MP4200TH as Printer elif self.impressora == 'daruma-dr700': _logger.info(u'SAT Impressao: Daruma Dr700') from escpos.impl.daruma import DR700 as Printer elif self.impressora == 'elgin-i9': _logger.info(u'SAT Impressao: Elgin I9') from escpos.impl.elgin import ElginI9 as Printer else: self.printer = False conn = SerialSettings.as_from(self.printer_params).get_connection() printer = Printer(conn) printer.init() return printer
def printer(): return TMT20(pytest.FakeDevice())
from satcfe.entidades import Imposto from satcfe.entidades import ICMSSN102 from satcfe.entidades import PISSN from satcfe.entidades import COFINSSN from satcfe.entidades import MeioPagamento from satcfe.entidades import CFeVenda from satcfe.entidades import CFeCancelamento from satcfe.excecoes import ErroRespostaSATInvalida from satcfe.excecoes import ExcecaoRespostaSAT cliente = ClienteSATLocal( BibliotecaSAT('/usr/lib/libbemasat.so'), codigo_ativacao='bema1234' ) print cliente resposta = cliente.consultar_sat() print resposta.mensagem from escpos.serial import SerialSettings from escpos.impl.epson import TMT20 from satextrato import ExtratoCFeVenda conn = SerialSettings.as_from('/dev/ttyS0:115200,8,1,N').get_connection() impressora = TMT20(conn) impressora.init() with open(r'test/pos_order_1.xml', 'r') as fp: extrato = ExtratoCFeVenda(fp, impressora) extrato.imprimir()