def GET(self): pdata = web.input(order_id = None) orlist = get_order(pdata.order_id) items = menu.get_menu_items() tags = db.select('Categories').list() page = render.customer_banner(items, pdata.order_id, orlist, tags) return render_page(page)
def POST(self): data = web.input(category=None, order_id=None) orlist = get_order(data.order_id) items = menu.get_menu_items_category(data.category) tags = db.select('Categories').list() page = render.customer_banner(items, data.order_id, orlist, tags) return render_page(page)
def POST(self): item = web.input(item_id=None, order_id=None, qty=None) update_quantity(item.order_id, item.item_id, item.qty) orlist = get_order(item.order_id) items = menu.get_menu_items() tags = db.select('Categories').list() page = render.customer_banner(items, item.order_id, orlist, tags) return render_page(page)
def update_ingredients(order): olist = get_order(order) print olist; # item_ids = db.select('OrderedItems join MenuItems', vars=args, where='order_id = $order').list() for item in olist: print item.item_id ingredients = get_ingredients(item.item_id) for ingredient in ingredients: update_qty(ingredient.ingredient, ingredient.qty)
def main(): menu = { ' Burger Spam': 4.50, ' Burger Spam': 4.50, ' Burger Spam': 4.50, } orders.print_menu(menu) orders = orders.get_order(menu) total = orders.bill_total(orders, menu) print('You ordered:', order, 'Total:', total)
def POST(self): #if (web.config._session.roleid != 4): # raise web.seeother('/') pdata = web.input(item=None, order_id=None, action=None) if pdata.action == "order": add_item(pdata.order_id, pdata.item, 1) elif pdata.action == "remove": delete_item(pdata.order_id, pdata.item) orlist = get_order(pdata.order_id) tags = db.select('Categories').list() items = menu.get_menu_items() page = render.customer_banner(items, pdata.order_id, orlist, tags) return render_page(page)
def pdf(hostname, order_id): installation = get_installation(hostname) order = get_order(installation, order_id) filename = order_id + '.pdf' html_to_render = render_template('order_document.html', order=order) pdfkit.from_string( html_to_render, filename, configuration=pdfkit.configuration(wkhtmltopdf="./bin/wkhtmltopdf")) pdffile = open(filename, "rb") response = Response(pdffile.read(), mimetype='application/pdf') pdffile.close() os.remove(filename) return response
def make_receipt(order_no): args = dict(order_no=order_no) if get_receipt(order_no).order_id == int(order_no): delete_receipt(order_no) rec_message = "Receipt for Order "+str(order_no)+" has been generated." items = get_order(order_no) total_price = 0 for i in items: if isinstance(i.qty, int): total_price += i.price*int(i.qty) total_price = 1.1*total_price add_receipt(order_no, total_price) return rec_message
def main(): menu = {'Knackered Spam': 0.5, 'Pip pip Spam': 1.5, 'Squidgy Spam': 2.5, 'Smashing Spam': 3.5} orders.print_menu(menu) order = orders.get_order(menu) print("You ordered:", order) print("Your total is", orders.total_bill(orders, menu))
def print_receipt(order_no): orlist = get_order(order_no) receipt = get_receipt(order_no) page = render.receipt(order_no, orlist, receipt) return render_page(page)