Пример #1
0
def edit_provider(prv):
    form = EnterForms.ProvidersForm(request.form)
    data = EnterpriseAPI.GetProviders()
    data1 = EnterpriseAPI.FetchProvider(session['username'],
                                        session['password'], prv)
    if request.method == 'POST':
        if request.form['submit'] == 'Submit' and form.validate():
            try:
                EnterpriseAPI.UpdateProvider(
                    session['username'], session['password'], prv,
                    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.Providers'))
            except Exception as e:
                flash(str(e), category='fail')
                return redirect(url_for('invoices.Providers'))
    return render_template('invoices/edit_provider.html',
                           username=session['username'],
                           role=session['role'],
                           form=form,
                           data=data,
                           data1=data1)
Пример #2
0
def EditReturnInvoice(invcode):
    providers = EnterpriseAPI.GetProviders()
    currencies = AccountingAPI.GetAllCurrencies()
    itms = EnterpriseAPI.ItemPicker()
    pkgs = EnterpriseAPI.PackagePicker()
    invs = InvoicesAPI.GetInvoices('return')
    srvs = InvoicesAPI.GetServicesByType('Expense')
    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,
                    'return', 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.ReturnInvoice'))
            except Exception as e:
                flash(str(e), category='fail')
                return redirect(url_for('invoices.ReturnInvoice'))
    return render_template('invoices/edit_return_invoice.html',
                           username=session['username'],
                           role=session['role'],
                           itms=itms,
                           pkgs=pkgs,
                           providers=providers,
                           currencies=currencies,
                           invs=invs,
                           data1=data1,
                           data2=data2,
                           invcode=invcode,
                           srvs=srvs)
Пример #3
0
def Providers():
    form = EnterForms.ProvidersForm(request.form)
    data = EnterpriseAPI.GetProviders()
    wh = EnterpriseAPI.GetWareHouses()
    if request.method == 'POST':
        if request.form['submit'] == 'Submit' and form.validate():
            try:
                EnterpriseAPI.CreateProvider(
                    session['username'], session['password'],
                    request.form['name'], request.form['address'],
                    request.form['phone1'], request.form['phone2'],
                    request.form['email'], request.form['pobox'],
                    request.form['description'])
                flash('Provider added Successfully', category='success')
                return redirect(url_for('logistics.Providers'))
            except Exception as e:
                flash(str(e), category='fail')
                return redirect(url_for('logistics.Providers'))
    return render_template('logistics/providers.html',
                           username=session['username'],
                           role=session['role'],
                           form=form,
                           data=data,
                           wh=wh)