Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- h1 "Customer Ledger for Accounting"
- p.filter_description { filters_applied }
- p {' '}
- unless ledgers_by_division.blank?
- ledgers_by_division.each do |division, ledgers|
- unless ledgers.blank?
- p(:class => 'main_header_title'){"DIVISION: #{division.description}"}
- ledgers.each do |customer, forwarded_balance, ledger|
- unless ledger.blank?
- p(:class => 'sub_header_title'){"CUSTOMER: #{customer.name}"}
- #---------
- table (:class => 'sortable list') do
- tr do
- th 'source document'; th 'date'; th 'debit'; th 'credit'; th 'balance'
- end
- tr do
- td 'Balance Forwarded'
- td display_date(Date.parse(params[:filter][:from_date]) - 1)
- if forwarded_balance > 0
- td display_amount(forwarded_balance.to_f), :style => "text-align:right"; td ''
- elsif forwarded_balance < 0
- td ''; td display_amount(forwarded_balance.to_f), :style => "text-align:right"
- else
- td ''; td ''
- end
- td ''
- end
- odd_even_rows ledger do |si_or|
- td si_or.description_for_customer_ledger
- td display_date(si_or.date)
- td display_amount(si_or.debit? ? si_or.total.to_f : ''), :style => "text-align:right"
- td display_amount(si_or.credit? ? si_or.total.to_f : ''), :style => "text-align:right"
- td ''
- end
- tr(:class => 'sub_total') do
- td 'TOTAL'; td ''
- td display_amount(debit_total = ledger.select(&:debit?).map(&:total).sum + forwarded_balance), :style => "text-align:right"
- td display_amount(credit_total = ledger.select(&:credit?).map(&:total).sum), :style => "text-align:right"
- td display_amount(debit_total - credit_total), :style => "text-align:right"
- end
- end
- #---------
- end
- end
- end
- end
- else
- p {'No Records Found'}
- end
Add Comment
Please, Sign In to add comment