def create_invoice(): if Security.is_login(SK): item = Item() employee = Employee() return render_template('invoice/create_invoice.html', title='Create Invoice', items=item.get_items(), employees=employee.get_employees()) return redirect(url_for('login', callback=stack()[0][3]))
def change_pending_status(): if Security.is_login(SK): callback = request.form['callback'] try: Invoice.change_pending_status(request.form['pending_id']) except Exception as e: print(e) return 'Failed' return redirect(url_for(callback)) return redirect(url_for('login', callback=stack()[0][3]))
def print_invoice(): if Security.is_login(SK): id = request.args.get('id') costumer = request.args.get('costumer') # CONVERT STRING TO DATETIME AND DATETIME BACK TO A FORMATED STRING date = datetime.strftime(datetime.strptime(request.args.get('date'), '%Y-%m-%d'), '%m/%d/%Y') seller = request.args.get('seller') items = prepare_items(request.args.get('items')) total = request.args.get('total') pending = request.args.get('pending') return render_template('invoice/invoice_print.html', id=id, costumer=costumer, date=date, seller=seller, items=items, total=total, pending=pending, title=costumer + ' - Invoice') return redirect(url_for('login', callback=stack()[0][3]))
def invoice(): if Security.is_login(SK): return render_template('invoice/invoice.html', title='Invoice') return redirect(url_for('login', callback=stack()[0][3]))
def login(): if not Security.is_login(SK): return render_template('settings/auth_admin.html') return redirect(url_for('home'))
def home(): if Security.is_login(SK): return render_template('misc/home.html', title='Home') return redirect(url_for('login', callback=stack()[0][3]))
def create_admin(): admin = Admin() if admin.check_if_admin_exist(): if not Security.is_login(SK): return redirect(url_for('login', callback='create_admin')) return render_template('settings/create_admin.html', title="Create Administrator")
def settings(): if Security.is_login(SK): return render_template('settings/settings.html', title='Settings') return redirect(url_for('login', callback=stack()[0][3]))
def create_employee(): if Security.is_login(SK): return render_template('employees/create_employee.html', title="Create Employee") return redirect(url_for('login', callback=stack()[0][3]))
def employees(): if Security.is_login(SK): return render_template('employees/employees.html', title='Employees') return redirect(url_for('login', callback=stack()[0][3]))
def costumer(): if Security.is_login(SK): return render_template('costumers/costumer.html', title='Costumers') return redirect(url_for('login', callback=stack()[0][3]))
def view_pending(): if Security.is_login(SK): return render_template('pending/select_pending.html', callback='view_pending', title='View Pending', pending=Invoice.get_pending_invoices()) return redirect(url_for('login', callback=stack()[0][3]))
def pending(): if Security.is_login(SK): return render_template('pending/pending.html', title='Pending') return redirect(url_for('login', callback=stack()[0][3]))
def select_invoice(): if Security.is_login(SK): return render_template('invoice/select_invoice.html', title='Select Invoice', invoices=Invoice.get_ten_invoices(), boxes_sold=Invoice.number_of_boxes_sold()) return redirect(url_for('login', callback=stack()[0][3]))