def bill_invoice(request, bill_id, itemized=False, template="hqbilling/reports/monthly_bill.html", partial="hqbilling/partials/invoice.html"): range_fmt = "%B %d, %Y" bill = HQMonthlyBill.get(bill_id) from hqbilling.reports.details import MonthlyBillReport parent_link = '<a href="%s">%s<a>' % (MonthlyBillReport.get_url(), MonthlyBillReport.name) billing_range = "%s to %s" % (bill.billing_period_start.strftime(range_fmt), bill.billing_period_end.strftime(range_fmt)) view_title = "%s %s for %s" % (bill.billing_period_start.strftime("%B %Y"), "Itemized Statement" if itemized else "Invoice", bill.domain) if itemized: printable_url = reverse("billing_itemized_print", kwargs=dict(bill_id=bill_id)) else: printable_url = reverse("billing_invoice_print", kwargs=dict(bill_id=bill_id)) return render(request, template, dict( slug=MonthlyBillReport.slug, partial=partial, parent_link=parent_link, bill=bill, view_title=view_title, billing_range=billing_range, printable_url=printable_url ))
def default_billing_report(request): from hqbilling.reports.details import MonthlyBillReport return HttpResponseRedirect(MonthlyBillReport.get_url())