Esempio n. 1
0
def edit_customer(cst):
    form = EnterForms.CustomersForm(request.form)
    data = InvoicesAPI.GetAllCustomers()
    data1 = InvoicesAPI.GetOneCustomer(session['username'],
                                       session['password'], cst)
    if request.method == 'POST':
        if request.form['submit'] == 'Submit' and form.validate():
            try:
                InvoicesAPI.UpdateCustomer(
                    session['username'], session['password'], cst,
                    request.form['name'], request.form['address'],
                    request.form['phone1'], request.form['phone2'],
                    request.form['email'], request.form['pobox'],
                    request.form['description'])
                flash('Provider updated successfully', category='success')
                return redirect(url_for('invoices.Customers'))
            except Exception as e:
                flash(str(e), category='fail')
                return redirect(url_for('invoices.Customers'))
    return render_template('invoices/edit_customer.html',
                           username=session['username'],
                           role=session['role'],
                           form=form,
                           data=data,
                           data1=data1)
Esempio n. 2
0
def EditRefundInvoice(invcode):
    customers = InvoicesAPI.GetAllCustomers()
    currencies = AccountingAPI.GetAllCurrencies()
    itms = EnterpriseAPI.ItemPicker()
    pkgs = EnterpriseAPI.PackagePicker()
    invs = InvoicesAPI.GetInvoices('refund')
    srvs = InvoicesAPI.GetServicesByType('Revenue')
    data1, data2 = InvoicesAPI.GetInvoice(session['username'],
                                          session['password'], invcode)
    if request.method == 'POST':
        if request.form['submit'] == 'Submit':
            try:
                InvoicesAPI.EditInvoice(
                    session['username'], session['password'], invcode,
                    'refund', request.form['Customer'],
                    request.form['SheetDate'], request.form['currency'],
                    request.form['terms'], request.form.getlist('description'),
                    request.form.getlist('unitprice'),
                    request.form.getlist('quantity'),
                    request.form.getlist('amount'),
                    request.form['totalamount'], request.form['discount'],
                    request.form['tax'], request.form['invamount'],
                    request.form['pay_method'],
                    request.form['billing_account'], request.form['comments'])

                flash('Invoices updated successfully', category='success')
                return redirect(url_for('invoices.RefundInvoice'))
            except Exception as e:
                flash(str(e), category='fail')
                return redirect(url_for('invoices.RefundInvoice'))
    return render_template('invoices/edit_refund_invoice.html',
                           username=session['username'],
                           role=session['role'],
                           itms=itms,
                           pkgs=pkgs,
                           customers=customers,
                           currencies=currencies,
                           invs=invs,
                           data1=data1,
                           data2=data2,
                           invcode=invcode,
                           srvs=srvs)