コード例 #1
0
def packages():
    itms = EnterpriseAPI.ItemPicker()
    pkg = EnterpriseAPI.GetPackages()
    if request.method == 'POST':
        if request.form['submit'] == 'Submit':
            try:
                EnterpriseAPI.CreatePackage(session['username'],
                                            session['password'],
                                            request.form['packagename'],
                                            request.form.getlist('code'),
                                            request.form.getlist('Name'),
                                            request.form.getlist('unit'),
                                            request.form.getlist('unitprice'),
                                            request.form.getlist('unitcost'),
                                            request.form.getlist('quantity'),
                                            request.form['description'])
                flash('Package Created Successcully', category='success')
                return redirect(url_for('invoices.packages'))
            except Exception as e:
                i = str(request.form.getlist('unit'))
                flash(str(e), category='fail')
                return redirect(url_for('invoices.packages'))

    return render_template('invoices/packages.html',
                           username=session['username'],
                           role=session['role'],
                           itms=itms,
                           pkg=pkg)
コード例 #2
0
def items():
    form = EnterForms.ItemsForm(request.form)
    data = EnterpriseAPI.GetItems()
    form.Group.choices = EnterpriseAPI.Groups()
    form.SecondaryUnit.choices = EnterpriseAPI.SecondaryUnits()
    form.Provider.choices = EnterpriseAPI.ProvidersList()
    if request.method == 'POST':
        if request.form['submit'] == 'Submit' and form.validate():
            try:
                EnterpriseAPI.CreateItem(
                    session['username'], session['password'],
                    request.form['ItemName'], request.form['Brand'],
                    request.form['Provider'], request.form['Unit'],
                    request.form['UnitPrice'], request.form['UnitCost'],
                    request.form['Description'], request.form['Size'],
                    request.form['Color'], request.form['SKU'],
                    request.form['PartNumber'], request.form['IEME'],
                    request.form['Length'], request.form['Width'],
                    request.form['Height'], request.form['Diameter'],
                    request.form['LengthUnit'], request.form['WidthUnit'],
                    request.form['HeightUnit'], request.form['DiamaterUnit'],
                    request.form['Group'], request.form['Category'],
                    request.form['SecondaryUnit'])
                flash('Item added successfully', category='success')
                return redirect(url_for('invoices.items'))
            except Exception as e:
                flash(str(e), category='fail')
                return redirect(url_for('invoices.items'))
    return render_template('invoices/items.html',
                           username=session['username'],
                           role=session['role'],
                           form=form,
                           data=data)
コード例 #3
0
ファイル: logistics.py プロジェクト: abbddos/Enterprise_1
def edit_warehouse(code):
    form = EnterForms.BinsForm(request.form)
    whh = EnterpriseAPI.FetchWarehouse(code)
    wh = EnterpriseAPI.GetWareHouses()
    bins = EnterpriseAPI.GetBins(code)
    if request.method == 'POST':
        if request.form['submit'] == 'Submit':
            try:
                EnterpriseAPI.UpdateWarehouse(session['username'],
                                              session['password'], code,
                                              request.form['Name'],
                                              request.form['Location'],
                                              request.form['Description'])
                flash('Warehouse Updated Successfully', category='success')
                return redirect(url_for('logistics.create_warehouse'))
            except Exception as e:
                flash(str(e), category='fail')
                return redirect(url_for('logistics.create_warehouse'))
    return render_template('logistics/edit_warehouse.html',
                           whh=whh,
                           wh=wh,
                           bins=bins,
                           username=session['username'],
                           role=session['role'],
                           form=form,
                           code=code)
コード例 #4
0
def edit_package(pkg):
    pks, itms = EnterpriseAPI.FetchPackage(pkg)
    pkk = EnterpriseAPI.GetPackages()
    itt = EnterpriseAPI.ItemPicker()
    if request.method == 'POST':
        if request.form['submit'] == 'Submit':
            try:
                EnterpriseAPI.UpdatePackage(session['username'],
                                            session['password'], pkg,
                                            request.form['packagename'],
                                            request.form.getlist('code'),
                                            request.form.getlist('Name'),
                                            request.form.getlist('unit'),
                                            request.form.getlist('unitprice'),
                                            request.form.getlist('unitcost'),
                                            request.form.getlist('quantity'),
                                            request.form['description'])
                flash('Package Updated Successfully', category='success')
                return redirect(url_for('invoices.packages'))
            except Exception as e:
                flash(str(e), category='fail')
                return redirect(url_for('invoices.packages'))
    return render_template('invoices/edit_package.html',
                           username=session['username'],
                           role=session['role'],
                           pks=pks,
                           itms=itms,
                           pkk=pkk,
                           itt=itt)
コード例 #5
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)
コード例 #6
0
def create_user():
    form = EnterForms.CreateUser(request.form)
    data = EnterpriseAPI.GetUsers()
    if request.method == 'POST':
        if request.form['submit'] == 'Submit' and form.validate():
            try:
                usrname, pswd = EnterpriseAPI.CreateUser(
                    session['username'], session['password'],
                    request.form['firstname'], request.form['lastname'],
                    request.form['company'], request.form['position'],
                    request.form['department'], request.form['email'],
                    request.form['phone1'], request.form['phone2'],
                    request.form.getlist('role-check'),
                    request.form.getlist('appr-check'))
                msg = Message('New Enterprise Account',
                              recipients=[str(request.form['email'])])
                msg.body = "Dear {}, \n Thank you for using Enterprise. please note that your username is: {} and your password is {}. \n It is highly recommended that you change your password as soon as possible. \n Thank you for using Enterprise.".format(
                    str(request.form['firstname']), str(usrname), str(pswd))
                app.mail.send(msg)
                flash('User Created Successfully', category='success')
                return redirect(url_for('users.create_user'))
            except Exception as e:
                flash(str(e), category='fail')
                return render_template('users/create_user.html',
                                       username=session['username'],
                                       role=session['role'],
                                       data=data,
                                       form=form)
    return render_template('users/create_user.html',
                           username=session['username'],
                           role=session['role'],
                           data=data,
                           form=form)
コード例 #7
0
ファイル: logistics.py プロジェクト: abbddos/Enterprise_1
def transactions_report():
    wh = EnterpriseAPI.GetWareHouses()
    cmp = EnterpriseAPI.GetCompanyProfile()
    if request.method == 'POST':
        if request.form['submit'] == 'Submit':
            if request.form['file-type'] == 'csv':
                file = EnterpriseAPI.Transactions_Report_to_CSV(
                    session['username'], session['password'])
                response = make_response(file)
                response.headers['Content-type'] = 'text/csv'
                response.headers[
                    'Content-Disposition'] = 'attachement; filename = items-packs_inventory_report.csv'
                return response
            elif request.form['file-type'] == 'pdf':
                data1 = EnterpriseAPI.Transactions_Report_to_PDF(
                    session['username'], session['password'])
                reportdate = datetime.datetime.now()
                rendered = render_template(
                    'logistics/transactions_report.html',
                    reportdate=reportdate,
                    data1=data1,
                    cmp=cmp)
                pdf = pdfkit.from_string(rendered, False)
                response = make_response(pdf)
                response.headers['Content-type'] = 'application/pdf'
                response.headers[
                    'Content-Disposition'] = 'attachement; filename = transactions-report.pdf'
                return response
    return render_template('logistics/transactions-report.html',
                           username=session['username'],
                           role=session['role'],
                           wh=wh)
コード例 #8
0
def edit_user(id):
    data1 = EnterpriseAPI.GetUsers()
    data2 = EnterpriseAPI.GetUserInfo(id)
    data3 = EnterpriseAPI.GetApprovals(data2[0][3])
    if request.method == 'POST':
        if request.form['submit'] == 'Submit':
            try:
                EnterpriseAPI.UpdateUser(
                    session['username'], session['password'], id,
                    request.form['firstname'], request.form['lastname'],
                    request.form['company'], request.form['position'],
                    request.form['department'], request.form['email'],
                    request.form['phone1'], request.form['phone2'],
                    request.form.getlist('role-check'), request.form['status'],
                    request.form.getlist('appr-check'), data2[0][3])
                flash('User Updated Successfully', category='success')
                return redirect(url_for('users.create_user'))
            except Exception as e:
                flash(str(e), category='fail')
                return redirect(url_for('users.create_user'))
    return render_template('users/edit_user.html',
                           username=session['username'],
                           role=session['role'],
                           data1=data1,
                           data2=data2,
                           data3=data3)
コード例 #9
0
def TrialSheet():
    data = AccountingAPI.GetCategories()
    data1 = AccountingAPI.GetAllAccounts()
    cmp = EnterpriseAPI.GetCompanyProfile()
    if request.method == 'POST':
        if request.form['submit'] == 'Submit':
            if request.form['SheetFormat'] == 'pdf':
                trial1, trial2 = AccountingAPI.TrialBalancePDF(session['username'],session['password'],
                request.form['StartDate'],
                request.form['EndDate'],
                request.form.getlist('act_check'))
                rendered = render_template('accounting/trial_balance_sheet.html', data = trial1, sums = trial2, date1 = request.form['StartDate'], date2 = request.form['EndDate'], cmp = cmp)
                pdf = pdfkit.from_string(rendered, False)
                response = make_response(pdf)
                response.headers['Content-type'] = 'application/pdf'
                response.headers['Content-Disposition'] = 'attachement; filename = trial_balance_statement.pdf'
                return response
            elif request.form['SheetFormat'] == 'csv':
                file = AccountingAPI.TrialBalanceCSV(session['username'],session['password'],
                request.form['StartDate'],
                request.form['EndDate'],
                request.form.getlist('act_check'))
                response = make_response(file)
                response.headers['Content-type'] = 'text/csv'
                response.headers['Content-Disposition'] = 'attachement; filename = Trial_Balance_Statement.csv'
                return response
    return render_template('accounting/get_trial_sheet.html', username = session['username'], role = session['role'], data = data, data1 = data1)
コード例 #10
0
def InvoiceView(code):
    SentData, InvoiceData, ItmData = InvoicesAPI.GetPrintedInvoice(code)
    cmp = EnterpriseAPI.GetCompanyProfile()
    return render_template('invoices/printed_invoice.html',
                           SentData=SentData,
                           InvoiceData=InvoiceData,
                           ItmData=ItmData,
                           cmp=cmp)
コード例 #11
0
def groups():
    data = EnterpriseAPI.GroupList()
    if request.method == 'POST':
        if request.form['submit'] == 'Submit':
            try:
                EnterpriseAPI.AddGroup(session['username'],
                                       session['password'],
                                       request.form['Name'],
                                       request.form['description'])
                flash('Group added successfully', category='success')
                return redirect(url_for('invoices.groups'))
            except Exception as e:
                flash(str(e), category='fail')
                return redirect(url_for('invoices.groups'))
    return render_template('invoices/groups.html',
                           username=session['username'],
                           role=session['role'],
                           data=data)
コード例 #12
0
ファイル: profile.py プロジェクト: abbddos/Enterprise_1
def user_profile(user):
    if user == 'admin':
        return redirect(url_for('profile.change_password', user = user))
    else:
        data = EnterpriseAPI.GetUser(user)
        if request.method == 'POST':
            if request.form['submit'] == 'Submit':
                try:
                    EnterpriseAPI.UpdateProfile(request.form['firstname'],
                    request.form['lastname'],
                    request.form['email'],
                    request.form['phone1'],
                    request.form['phone2'], user)
                    flash('Profile Updated Successfully', category = 'success')
                    return redirect(url_for('profile.user_profile', user = user))
                except Exception as e:
                    flash(str(e), category = 'fail')
        return render_template('profile/user_profile.html', user = user, username = session['username'], role = session['role'], data = data)
コード例 #13
0
def SecondaryUnits():
    data = EnterpriseAPI.GetSecondaryUnits()
    if request.method == 'POST':
        if request.form['submit'] == 'Submit':
            try:
                EnterpriseAPI.CreateSecondaryUnit(
                    session['username'], session['password'],
                    request.form['secuntname'], request.form['secuntcode'],
                    request.form['unit'], request.form['secuntmeasure'])
                flash('Secondary unit created successfully...',
                      category='success')
                return redirect(url_for('invoices.SecondaryUnits'))
            except Exception as e:
                flash(str(e), category='fail')
                return redirect(url_for('invoices.SecondaryUnits'))
    return render_template('invoices/Secondary_units.html',
                           username=session['username'],
                           role=session['role'],
                           data=data)
コード例 #14
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)
コード例 #15
0
ファイル: logistics.py プロジェクト: abbddos/Enterprise_1
def warehouse_inventory():
    wh = EnterpriseAPI.GetWareHouses()
    cmp = EnterpriseAPI.GetCompanyProfile()
    if request.method == 'POST':
        if request.form['submit'] == 'Submit':
            if request.form['to-date'] < request.form['from-date']:
                flash('Error: To date must be later than from date',
                      category='fail')
                return redirect(url_for('logistics.warehouse_inventory'))
            else:
                if request.form['file-type'] == 'csv':
                    file = EnterpriseAPI.Warehouse_Inventory_to_CSV(
                        session['username'], session['password'],
                        request.form['from-date'], request.form['to-date'],
                        request.form.getlist('wh_check'))
                    response = make_response(file)
                    response.headers['Content-type'] = 'text/csv'
                    response.headers[
                        'Content-Disposition'] = 'attachement; filename = warehouse_inventory_report.csv'
                    return response
                elif request.form['file-type'] == 'pdf':
                    data = EnterpriseAPI.Warehouse_Inventory_to_PDF(
                        session['username'], session['password'],
                        request.form['from-date'], request.form['to-date'],
                        request.form.getlist('wh_check'))
                    reportdate = datetime.datetime.now()
                    rendered = render_template(
                        '/logistics/warehouse_inventory.html',
                        reportdate=reportdate,
                        whs=request.form.getlist('wh_check'),
                        data=data,
                        cmp=cmp)
                    pdf = pdfkit.from_string(rendered, False)
                    response = make_response(pdf)
                    response.headers['Content-type'] = 'application/pdf'
                    response.headers[
                        'Content-Disposition'] = 'attachement; filename = warehouse-inventory-report.pdf'
                    return response
    return render_template('logistics/warehouse-inventory-report.html',
                           username=session['username'],
                           role=session['role'],
                           wh=wh)
コード例 #16
0
def edit_group(id):
    data = EnterpriseAPI.GetGroup(id)
    data1 = EnterpriseAPI.GroupList()
    if request.method == 'POST':
        if request.form['submit'] == 'Submit':
            try:
                EnterpriseAPI.UpdateGroup(session['username'],
                                          session['password'], id,
                                          request.form['Name'],
                                          request.form['description'])
                flash('Group Updated Successfully', category='success')
                return redirect(url_for('invoices.groups'))
            except Exception as e:
                flash(str(e), category='fail')
                return redirect(url_for('invoices.groups'))
    return render_template('invoices/edit_group.html',
                           data=data,
                           data1=data1,
                           username=session['username'],
                           role=session['role'])
コード例 #17
0
ファイル: logistics.py プロジェクト: abbddos/Enterprise_1
def print_invoice(transid, transby, transtype, transtatus, wh):
    data, cmnt = EnterpriseAPI.TransInvoice(transid)
    transdate = str(datetime.datetime.now())
    cmp = EnterpriseAPI.GetCompanyProfile()
    rendered = render_template('logistics/transaction-invoice.html',
                               transid=transid,
                               transdate=cmnt[0],
                               transtype=transtype,
                               transby=transby,
                               transtatus=transtatus,
                               wh=wh,
                               data=data,
                               cmnt=cmnt,
                               cmp=cmp)
    pdf = pdfkit.from_string(rendered, False)
    response = make_response(pdf)
    response.headers['Content-type'] = 'application/pdf'
    response.headers[
        'Content-Disposition'] = 'attachement; filename = transaction-invoice.pdf'
    return response
コード例 #18
0
ファイル: logistics.py プロジェクト: abbddos/Enterprise_1
def transactions():
    itms = EnterpriseAPI.ItemPicker()
    pkgs = EnterpriseAPI.PackagePicker()
    wh = EnterpriseAPI.GetWareHouses()
    warehouse = EnterpriseAPI.GetWareHouses()
    trans = EnterpriseAPI.GetTrans()
    rqst = EnterpriseAPI.ApprRequests()
    if request.method == 'POST':
        if request.form['submit'] == 'Submit':
            try:
                if request.form['transaction-type'] == 'Inbound':
                    transid = EnterpriseAPI.InboundTransaction(
                        session['username'], session['password'],
                        request.form.getlist('Name'),
                        request.form.getlist('code'),
                        request.form['warehouse'],
                        request.form.getlist('bins'),
                        request.form.getlist('unit'),
                        request.form.getlist('quantity'),
                        request.form['transaction-status'],
                        request.form['comments'])
                    flash('Inbound transaction recorded...',
                          category='success')
                    return redirect(url_for('logistics.transactions'))

                elif request.form['transaction-type'] == 'Outbound':
                    transid = EnterpriseAPI.OutboundTransaction(
                        session['username'], session['password'],
                        request.form.getlist('Name'),
                        request.form.getlist('code'),
                        request.form['warehouse'],
                        request.form.getlist('bins'),
                        request.form.getlist('unit'),
                        request.form.getlist('quantity'),
                        request.form['transaction-status'],
                        request.form['comments'])
                    flash('Outbound transaction recorded...',
                          category='success')
                    return redirect(url_for('logistics.transactions'))
            except Exception as e:
                flash(str(e), category='fail')
                return redirect(url_for('logistics.transactions'))
    return render_template('logistics/transactions.html',
                           username=session['username'],
                           role=session['role'],
                           itms=itms,
                           pkgs=pkgs,
                           warehouse=warehouse,
                           wh=wh,
                           trans=trans,
                           rqst=rqst)
コード例 #19
0
ファイル: logistics.py プロジェクト: abbddos/Enterprise_1
def edit_transaction(transid):
    wh = EnterpriseAPI.GetWareHouses()
    warehouse = EnterpriseAPI.GetWareHouses()
    trans = EnterpriseAPI.GetTrans()
    head, details = EnterpriseAPI.TransInfo(transid)
    rqst = EnterpriseAPI.ApprRequests()
    if request.method == 'POST':
        if request.form['submit'] == 'Submit':
            try:
                EnterpriseAPI.UpdateTransaction(
                    session['username'], session['password'], transid,
                    request.form['transaction-status'],
                    request.form['comments'])
                flash('Transaction updated...', category='success')
                return redirect(url_for('logistics.transactions'))
            except Exception as e:
                flash('Cannot to update a Complete or Canceled transacction.',
                      category='fail')
                return redirect(
                    url_for('logistics.edit_transaction', transid=transid))
    return render_template('logistics/edit-transaction.html',
                           username=session['username'],
                           role=session['role'],
                           warehouse=warehouse,
                           wh=wh,
                           trans=trans,
                           head=head,
                           details=details,
                           rqst=rqst)
コード例 #20
0
ファイル: logistics.py プロジェクト: abbddos/Enterprise_1
def create_warehouse():
    form = EnterForms.WarehouseForm(request.form)
    wh = EnterpriseAPI.GetWareHouses()
    if request.method == 'POST':
        if request.form['submit'] == 'Submit':
            try:
                EnterpriseAPI.CreateWarehouse(session['username'],
                                              session['password'],
                                              request.form['Name'],
                                              request.form['Code'],
                                              request.form['Location'],
                                              request.form['Description'])
                flash('Warehouse Created Successfully', category='success')
                return redirect(url_for('logistics.create_warehouse'))
            except Exception as e:
                flash(str(e), category='fail')
                return redirect(url_for('logistics.create_warehouse'))
    return render_template('logistics/create_warehouse.html',
                           form=form,
                           wh=wh,
                           username=session['username'],
                           role=session['role'])
コード例 #21
0
def CompanyProfile():
    profile = EnterpriseAPI.GetCompanyProfile()
    if request.method == 'POST':
        if request.form['submit'] == 'Submit':
            try:
                EnterpriseAPI.UpdateCompanyProfile(
                    session['username'], session['password'],
                    request.form['companyname'],
                    request.form['companyaddress'], request.form['phone1'],
                    request.form['phone2'], request.form['email'],
                    request.form['pobox'], request.form['registration'],
                    request.form['description'])
                flash('Company profile updated succcessfully',
                      category='success')
                return redirect(url_for('users.CompanyProfile'))
            except Exception as e:
                flash(str(e), category='fail')
                return redirect(url_for('users.CompanyProfile'))
    return render_template('users/company_profile.html',
                           username=session['username'],
                           role=session['role'],
                           pro=profile)
コード例 #22
0
def reset_password(user):
    try:
        NewPass, Name = EnterpriseAPI.ResetPassword(session['username'],
                                                    session['password'], user)
        flash('User Password was reset', category='success')
        msg = Message('Enterprise password reset', recipients=[str(Name[2])])
        msg.body = "Dear {}, \n Please note that your password has been reset into {} . \n Please note it is highly adviised that you change your password soon. \n Thank you for using Enterprise.".format(
            Name[0], NewPass)
        app.mail.send(msg)
        return redirect(url_for('users.create_user'))
    except Exception as e:
        flash(str(e), category='fail')
        return redirect(url_for('users.create_user'))
コード例 #23
0
ファイル: logistics.py プロジェクト: abbddos/Enterprise_1
def EditSecondaryUnit(code):
    data = EnterpriseAPI.GetSecondaryUnits()
    data1 = EnterpriseAPI.GrabSecondaryUnit(code)
    wh = EnterpriseAPI.GetWareHouses()
    if request.method == 'POST':
        if request.form['submit'] == 'Submit':
            try:
                EnterpriseAPI.UpdateSecondaryUnit(
                    session['username'], session['password'],
                    request.form['secuntname'], code, request.form['unit'],
                    request.form['secuntmeasure'])
                flash('Secondary Unit updated successfully...',
                      category='success')
                return redirect(url_for('logistics.SecondaryUnits'))
            except Exception as e:
                flash(str(e), category='fail')
                return redirect(url_for('logistics.SecondaryUnits'))
    return render_template('logistics/Edit_secondary_unit.html',
                           username=session['username'],
                           role=session['role'],
                           data=data,
                           data1=data1,
                           wh=wh)
コード例 #24
0
def PrintInvoice(code):
    SentData, InvoiceData, ItmData = InvoicesAPI.GetPrintedInvoice(code)
    cmp = EnterpriseAPI.GetCompanyProfile()
    rendered = render_template('invoices/printed_invoice.html',
                               SentData=SentData,
                               InvoiceData=InvoiceData,
                               ItmData=ItmData,
                               cmp=cmp)
    pdf = pdfkit.from_string(rendered, False)
    response = make_response(pdf)
    response.headers['Content-type'] = 'application/pdf'
    response.headers[
        'Content-Disposition'] = 'attachement; filename = invoice.pdf'
    return response
コード例 #25
0
ファイル: profile.py プロジェクト: abbddos/Enterprise_1
def change_password(user):
    form = EnterForms.ChangePassword(request.form)
    if request.method == 'POST':
        if request.form['submit'] == 'Submit' and form.validate():
            try:
                EnterpriseAPI.ChangePassword(user, request.form['currentpswd'], request.form['newpswd'])
                flash('Password changed successfully', category = 'success')
                return redirect(url_for('profile.change_password', user = user))
            except Exception as e:
                flash(str(e), category = 'fail')
        else:
            flash('Passwords must match', category = 'fail')
            return render_template('profile/change_password.html', username = session['username'], role = session['role'], user = user, form = form)
    return render_template('profile/change_password.html', username = session['username'], role = session['role'], user = user, form = form)
コード例 #26
0
def ProcurementInvoice():
    providers = EnterpriseAPI.GetProviders()
    currencies = AccountingAPI.GetAllCurrencies()
    itms = EnterpriseAPI.ItemPicker()
    pkgs = EnterpriseAPI.PackagePicker()
    invs = InvoicesAPI.GetInvoices('procurement')
    srvs = InvoicesAPI.GetServicesByType('Expense')
    if request.method == 'POST':
        if request.form['submit'] == 'Submit':
            try:
                invcode = InvoicesAPI.AddInvoice(
                    session['username'], session['password'], 'procurement',
                    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 created successfully', category='success')
                return redirect(url_for('invoices.ProcurementInvoice'))
            except Exception as e:
                flash(str(e), category='fail')
                return redirect(url_for('invoices.ProcurementInvoice'))
    return render_template('invoices/procurement_invoice.html',
                           username=session['username'],
                           role=session['role'],
                           itms=itms,
                           pkgs=pkgs,
                           providers=providers,
                           currencies=currencies,
                           invs=invs,
                           srvs=srvs)
コード例 #27
0
ファイル: logistics.py プロジェクト: abbddos/Enterprise_1
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)
コード例 #28
0
ファイル: logistics.py プロジェクト: abbddos/Enterprise_1
def add_bin(wh):
    if request.method == 'POST':
        if request.form['submit'] == 'Submit':
            try:
                EnterpriseAPI.CreateBin(session['username'],
                                        session['password'],
                                        request.form['name'],
                                        request.form['code'], wh,
                                        request.form['status'],
                                        request.form['description'])
                flash('Bin successfully added', category='success')
                return redirect(url_for('logistics.edit_warehouse', code=wh))
            except Exception as e:
                flash(str(e), category='fail')
                return redirect(url_for('logistics.edit_warehouse', code=wh))
    return redirect(url_for('logistis/edit_warehouse', code=wh))
コード例 #29
0
ファイル: logistics.py プロジェクト: abbddos/Enterprise_1
def edit_bin(whcode):
    if request.method == 'POST':
        if request.form['submit'] == 'Submit':
            try:
                EnterpriseAPI.UpdateBin(session['username'],
                                        session['password'],
                                        request.form['Bcode'],
                                        request.form['Bname'],
                                        request.form['Bstatus'],
                                        request.form['Bdesc'])
                flash('Bin updated successfully', category='success')
                return redirect(
                    url_for('logistics.edit_warehouse', code=whcode))
            except Exception as e:
                flash(str(e), category='fail')
                return redirect(
                    url_for('logistics.edit_warehouse', code=whcode))
    return redirect(url_for('logistis/edit_warehouse', code=whcode))
コード例 #30
0
def BalanceSheet():
    data = AccountingAPI.GetCategories()
    cmp = EnterpriseAPI.GetCompanyProfile()
    if request.method == 'POST':
        if request.form['submit'] == 'Submit':
            if request.form['SheetFormat'] == 'pdf':
                data1, data2 = AccountingAPI.GetBalanceSheetPDF(session['username'], session['password'], request.form['SheetDate'])
                rendered = render_template('accounting/balance_sheet.html', data1 = data1, data2 = data2, date = request.form['SheetDate'], cmp = cmp)
                pdf = pdfkit.from_string(rendered, False)
                response = make_response(pdf)
                response.headers['Content-type'] = 'application/pdf'
                response.headers['Content-Disposition'] = 'attachement; filename = balance-sheet.pdf'
                return response
            elif request.form['SheetFormat'] == 'csv':
                file = AccountingAPI.BalanceSheetCSV(session['username'], session['password'], request.form['SheetDate'])
                response = make_response(file)
                response.headers['Content-type'] = 'text/csv'
                response.headers['Content-Disposition'] = 'attachement; filename = Balance_Sheet.csv'
                return response

    return render_template('accounting/get_balancesheet.html', username = session['username'], role = session['role'], data = data)