From 8dab5b7ab27ffb8e99ef6485a823094f4a7cf639 Mon Sep 17 00:00:00 2001 From: crudo Date: Sat, 25 Mar 2017 02:57:22 +0100 Subject: [PATCH] Include UID in ticket. --- web.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/web.py b/web.py index 6457edb..39bd095 100644 --- a/web.py +++ b/web.py @@ -119,23 +119,28 @@ def sell_page(): title='Sell', event=event, products=products) -def print_orders(event, orders): +def print_orders(transaction, cat, orders): printer.open() printer.set(align='CENTER') printer.image('static/img/macao-logo-printer.png', impl='bitImageColumn') printer.set(align='CENTER', text_type='B') - printer.text(event.name.upper()) + printer.text(transaction.event.name.upper()) printer.text("\n\n") for o in orders: printer.set(align='LEFT', width=2, height=2) printer.text("{} x {}".format(o.quantity, o.product.name.upper())) printer.text("\n") - printer.text("\n") + printer.set(align='RIGHT') + printer.text("{} #{}-{}-{}" + .format(datetime.strftime(transaction.created_at, + "%Y-%m-%d %H:%M"), + transaction.event.uid, transaction.uid, cat)) + printer.cut() printer.close() sleep(0.7) @@ -153,7 +158,7 @@ def print_transaction(transaction): categorized_orders[uid].append(o) for cat, orders in categorized_orders.items(): - print_orders(transaction.event, orders) + print_orders(transaction, cat, orders) @app.route('/sell', methods=['POST'])