Guest User

Untitled

a guest
May 26th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.42 KB | None | 0 0
  1. h1 "Customer Ledger for Accounting"
  2. p.filter_description { filters_applied }
  3.  
  4. p {' '}
  5.  
  6. unless ledgers_by_division.blank?
  7.  
  8. ledgers_by_division.each do |division, ledgers|
  9. unless ledgers.blank?
  10. p(:class => 'main_header_title'){"DIVISION: #{division.description}"}
  11. ledgers.each do |customer, forwarded_balance, ledger|
  12. unless ledger.blank?
  13. p(:class => 'sub_header_title'){"CUSTOMER: #{customer.name}"}
  14. #---------
  15. table (:class => 'sortable list') do
  16. tr do
  17. th 'source document'; th 'date'; th 'debit'; th 'credit'; th 'balance'
  18. end
  19.  
  20. tr do
  21. td 'Balance Forwarded'
  22. td display_date(Date.parse(params[:filter][:from_date]) - 1)
  23. if forwarded_balance > 0
  24. td display_amount(forwarded_balance.to_f), :style => "text-align:right"; td ''
  25. elsif forwarded_balance < 0
  26. td ''; td display_amount(forwarded_balance.to_f), :style => "text-align:right"
  27. else
  28. td ''; td ''
  29. end
  30. td ''
  31. end
  32.  
  33. odd_even_rows ledger do |si_or|
  34. td si_or.description_for_customer_ledger
  35. td display_date(si_or.date)
  36. td display_amount(si_or.debit? ? si_or.total.to_f : ''), :style => "text-align:right"
  37. td display_amount(si_or.credit? ? si_or.total.to_f : ''), :style => "text-align:right"
  38. td ''
  39. end
  40.  
  41. tr(:class => 'sub_total') do
  42. td 'TOTAL'; td ''
  43. td display_amount(debit_total = ledger.select(&:debit?).map(&:total).sum + forwarded_balance), :style => "text-align:right"
  44. td display_amount(credit_total = ledger.select(&:credit?).map(&:total).sum), :style => "text-align:right"
  45. td display_amount(debit_total - credit_total), :style => "text-align:right"
  46. end
  47. end
  48. #---------
  49. end
  50. end
  51. end
  52. end
  53. else
  54. p {'No Records Found'}
  55. end
Add Comment
Please, Sign In to add comment