Example #1
0
def invoice(facility_name, year, month, org_name = None):
    org_list = []
    if org_name:
        org_list.append(org_name)
    ic = InvoiceCollection(year, month, org_list)
    ic.populate_template_data()
    return render_template('invoice_base.html',
            module_name = 'billing',
            invoices=ic.invoices)
Example #2
0
def generate_invoices(facility_name, year, month):
    orgs = []
    if request.data:
        post_params = request.get_json()
        if 'orgs' in post_params:
            orgs = post_params['orgs']
    ic = InvoiceCollection(year, month, orgs) # defaults to last complete
    ic.populate_template_data()
    # can't update the pdf name in db after generation because pdf generation
    # borks the db_session for the request
    ic.update_pdf_names()
    generated = ic.generate_pdfs()
    if generated:
        flash('Successfully generated: ' + ', '.join(generated))
    return json.dumps({'generated':generated})