Example #1
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)
Example #2
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