update bill ticket
This commit is contained in:
parent
7b695b1fda
commit
5ac871dcb5
37
api.py
37
api.py
@ -24,34 +24,52 @@ def print_bill(data, address):
|
||||
#printer = Network(str(address))
|
||||
#printer.open()
|
||||
printer = Dummy()
|
||||
|
||||
|
||||
# Imprime el encabezado
|
||||
printer.set(align='center', bold=False, height=1, width=1)
|
||||
printer.text(d["shop_name"]+'\n')
|
||||
printer.text(d["shop_address"]+'\n')
|
||||
printer.text('========================\n')
|
||||
printer.text('\n')
|
||||
printer.set(align='right', bold=False, height=1, width=1)
|
||||
printer.textln('========================')
|
||||
if d['invoice']:
|
||||
text = "Resolucion de Facturacion # "+str(d['invoice']['resolution']['resolution_number']) \
|
||||
+ "\nValida desde "+d['invoice']['resolution']['valid_date_time_from']+ \
|
||||
" hasta "+str(d['invoice']['resolution']['valid_date_time_to'])
|
||||
printer.textln(text)
|
||||
printer.ln()
|
||||
text = "Factura #: "+d['invoice']['invoice_number']
|
||||
printer.textln(text)
|
||||
#printer.text('\n')
|
||||
printer.text("Cliente: "+d["party"]+'\n')
|
||||
printer.text("CC/NIT: "+d["tax_identifier_code"]+'\n')
|
||||
printer.text("Direccion: "+d["address"]+'\n')
|
||||
printer.text('========================\n')
|
||||
|
||||
printer.ln()
|
||||
for line in d["lines"]:
|
||||
if line['type'] != 'title':
|
||||
text = line['product']
|
||||
printer.text(text)
|
||||
printer.text('\n')
|
||||
printer.ln()
|
||||
text = "cant: " + str(line['quantity']) +" "+ line["uom"] + " $" + line["unit_price"] +"\n"
|
||||
printer.text(text)
|
||||
|
||||
printer.text('========================\n\n')
|
||||
printer.set(align='right', bold=False, height=1, width=1)
|
||||
printer.text('========================\n')
|
||||
text = "Total (sin impuestos): "+str(d["untaxed_amount"])+"\n"
|
||||
printer.text(text)
|
||||
text = "Impuestos: "+str(d["tax_amount"])+"\n"
|
||||
text = "Impuestos (INC): "+str(d["tax_amount"])+"\n"
|
||||
printer.text(text)
|
||||
text = "Total: "+str(d["total"])+"\n"
|
||||
printer.text(text)
|
||||
printer.text('\n')
|
||||
printer.ln()
|
||||
#printer.text('\n')
|
||||
if d['payments']:
|
||||
printer.textln("Pagos: ")
|
||||
printer.text('------------------------\n')
|
||||
for payment in d['payments']:
|
||||
text = str(payment["statement"])+" $"+str(payment["amount"])
|
||||
printer.textln(text)
|
||||
|
||||
printer.set(align='center', bold=False, height=1, width=1)
|
||||
printer.text('------------------------\n\n')
|
||||
printer.text("Sigue nuestras redes sociales\n")
|
||||
@ -109,7 +127,8 @@ def print_customer_order(data, address):
|
||||
text = line['product'] +" "+str(line['quantity'])+"\n"
|
||||
printer.text(text)
|
||||
if pizza == 2:
|
||||
printer.text('\n')
|
||||
printer.ln()
|
||||
#printer.text('\n')
|
||||
pizza = 0
|
||||
combination_pizza = False
|
||||
else:
|
||||
|
Loading…
Reference in New Issue
Block a user