Preventing double creation of invoices by recognising completed invoices within the specifed period

This commit is contained in:
Rob Harrington
2015-07-10 11:17:51 +08:00
parent 11c3cf5f71
commit 6cc403cd92
7 changed files with 127 additions and 55 deletions

View File

@@ -8,8 +8,6 @@
- @invoices.order('created_at DESC').each do |invoice|
- month = (invoice.created_at.localtime - 1.day)
- range = "#{month.beginning_of_month.strftime("%d/%m/%y")}"
- range += " - #{[month.end_of_month, Time.now].min.strftime("%d/%m/%y")}"
.row.invoice_title
.eight.columns.alpha
%h4= "#{month.strftime("%b %Y")}#{( invoice.completed_at ? '' : '*' )}"
@@ -32,11 +30,11 @@
%td= adjustment.display_amount
- invoice.adjustments.where('source_type <> (?)', "BillablePeriod").each do |adjustment|
%tr
%td= range
%td &nbsp;
%td= adjustment.label
%td= adjustment.display_amount
%tr.total
%td= range
%td &nbsp;
%td TOTAL
%td= invoice.display_total