def invoice_index(): """发票列表 不再编写模板,请参考 Person 相关的模板 有必要掌握 Bootstrap3 """ """个人列表 """ rank = request.args.get("rank", "id") search = request.args.get("search", "") order = request.args.get("order", "asc") page, per_page, offset = get_page_items() invoices = Invoice.find(search=search, order=order, rank=rank) for inv in invoices: print inv.invoice_date pagination = get_pagination(page=page, total=invoices.count()) return render_template( "/invoice/index.html", invoices=invoices.offset(offset).limit(per_page), pagination=pagination, search=search, order=order, )
def chioce_account(id): """显示与添加的发票可能会发生关联的帐目 """ rank = request.args.get("rank", "enter_date") search = request.args.get("search", "") order = request.args.get("order", "asc") invoice = Invoice.query.get(id) page, per_page, offset = get_page_items() accounts = Account.search(date=invoice.invoice_date, money=invoice.amount, order=order, rank=rank) pagination = get_pagination(page=page, total=accounts.count()) if request.method == "POST": acc_id = Account.autoadd_bill_save(invoice) if acc_id != 0: return redirect("/invoice/%d/%d" % (id, acc_id)) flash(u"匹配失败", "error") return redirect("/invoice/") return render_template( "/invoice/chioce.html", accounts=accounts.offset(offset).limit(per_page), pagination=pagination, search=search, order=order, id=id, chioce=0, title=u"选择关联账目", )
def subject_index(): """个人列表 """ rank = request.args.get('rank', 'id') search = request.args.get('search', '') order = request.args.get('order', 'asc') page, per_page, offset = get_page_items() subjects = Subject.find(search=search, order=order, rank=rank) pagination = get_pagination(page=page, total=subjects.count()) return render_template('/subject/index.html', subjects=subjects.offset(offset).limit(per_page), pagination=pagination , search=search,order=order)
def person_index(): """个人列表 """ rank = request.args.get('rank', 'id') search = request.args.get('search', '') order = request.args.get('order', 'asc') page, per_page, offset = get_page_items() people = Person.find(search=search, order=order, rank=rank) pagination = get_pagination(page=page, total=people.count()) return render_template('/person/index.html', people=people.offset(offset).limit(per_page), pagination=pagination , search=search,order=order)
def fund_index(): """发票列表 不再编写模板,请参考 Person 相关的模板 有必要掌握 Bootstrap3 """ rank = request.args.get('rank', 'id') search = request.args.get('search', '') order = request.args.get('order', 'asc') page, per_page, offset = get_page_items() funds = Fund.find(search=search, order=order, rank=rank) pagination = get_pagination(page=page, total=funds.count()) return render_template('/fund/index.html', funds=funds.offset(offset).limit(per_page), pagination=pagination, search=search, order=order)
def approval_index(): """审批单列表 不再编写模板,请参考 Person 相关的模板 有必要掌握 Bootstrap3 """ rank = request.args.get('rank', 'id') search = request.args.get('search', '') order = request.args.get('order', 'asc') page, per_page, offset = get_page_items() approvals = Approval.find(search=search, order=order, rank=rank) pagination = get_pagination(page=page, total=approvals.count()) return render_template('/approval/index.html', approvals=approvals.offset(offset).limit(per_page), pagination=pagination, search=search, order=order)
def approval_chioce(id, invoices): """选择发票到审批单 """ invoices_list = request.args.get('radiobutton') page, per_page, offset = get_page_items() pagination = get_pagination(page=page, total=invoices[2].count()) if request.method == 'POST' and form.validate(): for i in invoices_list: allocation = Allocation(approve_paper_id = id, invoice_id = i) db.session.add(allocation) db.session.commit() approval = Approval.query.get(id) approval.invoice_count = invoices[1]+invoices_list.length approval.save() return redirect('/approval/%d' % id) return render_template('/approval/chioce.html', approvals=invoices[2].offset(offset).limit(per_page), pagination=pagination, content_list = [invoices[0],invoices[1]] )
不再编写模板,请参考 Person 相关的模板 有必要掌握 Bootstrap3 """ rank = request.args.get('rank', 'id') search = request.args.get('search', '') order = request.args.get('order', 'asc') <<<<<<< HEAD ======= >>>>>>> 797deb1d9a238a9098207cfc01bab6963414987f page, per_page, offset = get_page_items() approvals = Approval.find(search=search, order=order, rank=rank) pagination = get_pagination(page=page, total=approvals.count()) return render_template('/approval/index.html', approvals=approvals.offset(offset).limit(per_page), pagination=pagination, search=search, order=order) @approval.route('/<int:id>') def approval_info(id): """显示单个审批单信息 """ approval = Approval.query.get(id) aget = Person.query.get(approval.agent_id) payee = Person.query.get(approval.payee_id) info_list = [aget.name, payee.name] return render_template('/approval/info.html', approval = approval,info_list = info_list)