finish ticket
This commit is contained in:
parent
e1c9bcac88
commit
c7a3feee1c
13
api.py
13
api.py
@ -4,8 +4,9 @@ import sys
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
from time import sleep
|
||||
from datetime import datetime
|
||||
|
||||
app = FastAPI(
|
||||
title="Print Server FastAPI",
|
||||
description="Server that receive request for printing",
|
||||
@ -25,6 +26,9 @@ def imprimir_ticket_de_prueba(data, address):
|
||||
#printer = Dummy()
|
||||
|
||||
# Imprime el encabezado
|
||||
printer.set(align='center', bold=False, height=1, width=1)
|
||||
printer.text("Pedido Por: " + str(d['user'])+ '\n')
|
||||
printer.text(str(datetime.now())+'\n')
|
||||
printer.set(align='center', bold=False, height=2, width=2, custom_size=True)
|
||||
printer.text('========================\n')
|
||||
text = 'MESA: ' + str(d['table'] + "\n")
|
||||
@ -38,16 +42,19 @@ def imprimir_ticket_de_prueba(data, address):
|
||||
if combination_pizza and pizza < 2:
|
||||
printer.set(align='center', bold=False, height=2, width=2, custom_size=True)
|
||||
pizza += 1
|
||||
if pizza == 2:
|
||||
printer.text('\n')
|
||||
elif pizza >=2:
|
||||
combination_pizza = False
|
||||
printer.set(align='left', bold=False, height=2, width=2, custom_size=True)
|
||||
else:
|
||||
printer.set(align='left', bold=False, height=2, width=2, custom_size=True)
|
||||
|
||||
|
||||
text = line['product'] +" "+str(line['quantity'])+"\n"
|
||||
printer.text(text)
|
||||
if pizza == 2:
|
||||
printer.text('\n')
|
||||
pizza = 0
|
||||
combination_pizza = False
|
||||
else:
|
||||
printer.set(align='left', bold=True, height=2, width=2, custom_size=True)
|
||||
printer.text("\nPIZZA COMBINADA\n")
|
||||
|
Loading…
Reference in New Issue
Block a user