Minor template refactor and cli.py user interface enhancement #6

Closed
subnixr wants to merge 15 commits from subnixr/macao-pos:cosettine into master
Showing only changes of commit 1871221f04 - Show all commits

13
web.py
View File

@ -119,23 +119,28 @@ def sell_page():
title='Sell', event=event, products=products) title='Sell', event=event, products=products)
def print_orders(event, orders): def print_orders(transaction, cat, orders):
printer.open() printer.open()
printer.set(align='CENTER') printer.set(align='CENTER')
printer.image('static/img/macao-logo-printer.png', impl='bitImageColumn') printer.image('static/img/macao-logo-printer.png', impl='bitImageColumn')
printer.set(align='CENTER', text_type='B') printer.set(align='CENTER', text_type='B')
printer.text(event.name.upper()) printer.text(transaction.event.name.upper())
printer.text("\n\n") printer.text("\n\n")
for o in orders: for o in orders:
printer.set(align='LEFT', width=2, height=2) printer.set(align='LEFT', width=2, height=2)
printer.text("{} x {}".format(o.quantity, o.product.name.upper())) printer.text("{} x {}".format(o.quantity, o.product.name.upper()))
printer.text("\n") printer.text("\n")
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.cut()
printer.close() printer.close()
sleep(0.7) sleep(0.7)
@ -153,7 +158,7 @@ def print_transaction(transaction):
categorized_orders[uid].append(o) categorized_orders[uid].append(o)
for cat, orders in categorized_orders.items(): for cat, orders in categorized_orders.items():
print_orders(transaction.event, orders) print_orders(transaction, cat, orders)
@app.route('/sell', methods=['POST']) @app.route('/sell', methods=['POST'])