fix print commmand grouped by category

This commit is contained in:
Wilson Gomez 2023-09-08 07:11:50 -05:00
parent e3663085e8
commit 53189db00f
1 changed files with 25 additions and 13 deletions

View File

@ -999,20 +999,32 @@ class Receipt(object):
self.print_horinzontal_double_line()
self.print_enter()
for line in order['lines']:
if self.order_kind == 'command':
self._printer.set(custom_size=True, width=1, height=2)
qty = ' ' + str(int(Decimal(line['quantity'])))
self.print_col(qty, self.order_col_1)
self.print_col(line['name'], col_width_name)
if line['note']:
self.print_enter()
for msg_note in line['note'].split('\n'):
self._printer.text(f' NOTA -> {msg_note}')
def print_lines_order(lines, group=False):
for line in lines:
if self.order_kind == 'command':
self._printer.set(custom_size=True, width=1, height=2)
qty = ' ' + str(int(Decimal(line['quantity'])))
name = line['name']
if group:
name = ' ' + name
self.print_col(qty, self.order_col_1)
self.print_col(name, col_width_name)
if line['note']:
self.print_enter()
self.print_enter()
print('este es el camino de la comanda')
self.print_enter()
for msg_note in line['note'].split('\n'):
self._printer.text(f' NOTA -> {msg_note}')
self.print_enter()
self.print_enter()
print('este es el camino de la comanda')
self.print_enter()
if isinstance(order['lines'], list):
print_lines_order(order['lines'])
else:
for cat in order['lines'].values():
self._printer.text(cat['name'])
print_lines_order(cat['lines'], group=True)
self._printer.ln(2)
self.print_enter()
self.print_horinzontal_double_line()