Skip to content
Snippets Groups Projects
Commit ffd4ac28 authored by sandeepsajan0's avatar sandeepsajan0
Browse files

Show invoices in seperate table to finance for their review and sage intacct

parent 58cfea37
No related branches found
No related tags found
No related merge requests found
......@@ -26,6 +26,21 @@
{% endif %}
</div>
{% if invoices_for_approval.count %}
<div id="invoices-awaiting-approval" class="wrapper wrapper--bottom-space">
<h4 class="heading heading--normal">{% trans "Invoices for my review" %}</h4>
{% render_table invoices_for_approval.table %}
</div>
{% endif %}
{% if invoices_to_convert.count %}
<div id="invoices-to-convert" class="wrapper wrapper--bottom-space">
<h4 class="heading heading--normal">{% trans "Invoices for entry to Sage IntAcct" %}</h4>
{% render_table invoices_to_convert.table %}
</div>
{% endif %}
{% if waiting_for_approval.count %}
<div id="paf-awaiting-approval" class="wrapper wrapper--bottom-space">
<h4 class="heading heading--normal">{% trans "PAF awaiting approval" %}</h4>
......
......@@ -160,6 +160,8 @@ class FinanceDashboardView(MyFlaggedMixin, TemplateView):
context.update({
'active_invoices': self.active_invoices(),
'invoices_for_approval': self.invoices_for_approval(),
'invoices_to_convert': self.invoices_to_convert(),
'waiting_for_approval': self.waiting_for_approval(),
})
......@@ -176,6 +178,24 @@ class FinanceDashboardView(MyFlaggedMixin, TemplateView):
'table': InvoiceDashboardTable(invoices),
}
def invoices_for_approval(self):
if self.request.user.is_finance_level_2:
invoices = Invoice.objects.approved_by_finance_1()
else:
invoices = Invoice.objects.approved_by_staff()
return {
'count': invoices.count(),
'table': InvoiceDashboardTable(invoices)
}
def invoices_to_convert(self):
invoices = Invoice.objects.waiting_to_convert()
return {
'count': invoices.count(),
'table': InvoiceDashboardTable(invoices),
}
def waiting_for_approval(self):
if not self.request.user.is_finance:
return {
......
......@@ -79,6 +79,14 @@ class InvoiceQueryset(models.QuerySet):
def approved_by_finance_1(self):
return self.filter(status=APPROVED_BY_FINANCE_1)
def approved_by_finance_2(self):
return self.filter(status=APPROVED_BY_FINANCE_2)
def waiting_to_convert(self):
if settings.INVOICE_EXTENDED_WORKFLOW:
return self.filter(status=APPROVED_BY_FINANCE_2)
return self.filter(status=APPROVED_BY_FINANCE_1)
def for_finance_1(self):
if settings.INVOICE_EXTENDED_WORKFLOW:
return self.filter(status__in=[APPROVED_BY_STAFF, CHANGES_REQUESTED_BY_FINANCE_2])
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment