Beispiel #1
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)
Beispiel #2
0
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)
Beispiel #3
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)
Beispiel #4
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
Beispiel #5
0
def items_packages_inventory():
    wh = EnterpriseAPI.GetWareHouses()
    itms = EnterpriseAPI.ItemPicker()
    pkgs = EnterpriseAPI.PackagePicker()
    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.Items_Packs_Inventory_to_CSV(
                        session['username'], session['password'],
                        request.form['from-date'], request.form['to-date'],
                        request.form.getlist('itm_check'),
                        request.form.getlist('pkg_check'))
                    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':
                    data = EnterpriseAPI.Items_Packs_Inventory_to_PDF(
                        session['username'], session['password'],
                        request.form['from-date'], request.form['to-date'],
                        request.form.getlist('itm_check'),
                        request.form.getlist('pkg_check'))
                    reportdate = datetime.datetime.now()
                    rendered = render_template(
                        '/logistics/item-pack-inventory-report.html',
                        reportdate=reportdate,
                        itm=request.form.getlist('itm_check'),
                        pkg=request.form.getlist('pkg_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 = item-pack-inventory-report.pdf'
                    return response
    return render_template('logistics/item-package-inventory-report.html',
                           username=session['username'],
                           role=session['role'],
                           wh=wh,
                           itms=itms,
                           pkgs=pkgs)
Beispiel #6
0
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
Beispiel #7
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)
Beispiel #8
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)