Files
openfoodnetwork/app/views/admin/account/show.html.haml
2017-05-04 21:33:17 +02:00

71 lines
2.4 KiB
Plaintext

- content_for :page_title do
= t(:account)
- if @invoices.empty?
%h4= t(:no_invoices_to_display)
- @invoices.order('year DESC, month DESC').each do |invoice|
.row.invoice_title
.two.columns.alpha
%h4= invoice_description_for(invoice)
.two.columns.text-right
%h5
- if invoice.order.andand.complete?
%a{ href: print_admin_order_url(invoice.order), :target => "_blank"}
%i.icon-print
= t(:print)
- else
 
.ten.columns
 
.two.columns.omega.text-right
%h4.balance= invoice_total_for(invoice)
%table.invoice_summary
%col{ width: '25%' }
%col{ width: '62.5%' }
%col{ width: '12.5%' }
%thead
%th= t('admin.date')
%th= t(:description)
%th= t(:charge)
- if order = invoice.order
- invoice.billable_periods.select{ |bp| bp.adjustment.andand.amount.andand > 0}.each do |billable_period|
%tr
%td.text-center= "#{billable_period.begins_at.strftime("%d/%m/%Y")}"
%td= billable_period.label
-# Using amount from the actual adjustment on the order here so that we avoid recalculating the bill
-# at a future date with different settings to those used at the time the invoice was finalized
%td.text-right= billable_period.adjustment.display_amount
- order.adjustments.where('source_type <> (?)', "BillablePeriod").reject{ |a| a.amount == 0 }.each do |adjustment|
%tr
%td.text-center &nbsp;
%td= adjustment.label
%td.text-right= adjustment.display_amount
%tr.total
%td.text-center &nbsp;
%td= t(:total).upcase
%td.text-right= invoice_total_for(invoice)
-# - if @enterprises.empty?
-# %h4 No enterprises to display
-#
-# - @enterprises.each do |enterprise|
-# %h2= enterprise.name
-# %table
-# %thead
-# %th Begins
-# %th Ends
-# %th Sells
-# %th Trial?
-# %th Turnover
-# %th Bill
-# - enterprise.billable_periods.each do |billable_period|
-# %tr
-# %td= billable_period.begins_at.in_time_zone.strftime("%F %T")
-# %td= billable_period.ends_at.in_time_zone.strftime("%F %T")
-# %td= billable_period.sells
-# %td= billable_period.trial?
-# %td= billable_period.display_turnover
-# %td= billable_period.display_bill