Guest User

Untitled

a guest
Jul 18th, 2018
249
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.43 KB | None | 0 0
  1. journals = [
  2.  
  3. ]
  4.  
  5. mbs_classes = [
  6. {:name => "new", :method => :mbs_new, :account => "9110"},
  7. {:name => "used", :method => :mbs_used, :account => "9120"},
  8. {:name => "coursepack", :method => :mbs_coursepack, :account => "9710"},
  9. {:name => "reference", :method => :mbs_reference, :account => "9130"},
  10. {:name => "office", :method => :mbs_report_office, :account => "9150"},
  11. {:name => "food", :method => :mbs_food, :account => "9160"},
  12. {:name => "shipping", :method => :report_shipping, :account => "8120"},
  13. {:name => "gift", :method => :mbs_gift, :account => "9180"},
  14. {:name => "insignia", :method => :mbs_insignia, :account => "9140"},
  15. {:name => "greek", :method => :mbs_greek, :account => "9170"},
  16. {:name => "h/s", :method => :mbs_hs, :account => "9140"},
  17. {:name => "taxes", :method => :mbs_tax, :account => "9001"},
  18. ]
  19.  
  20. jcc_classes = [
  21. {:name => "med uniform", :method => :mbs_uniform, :account => "9930"},
  22. {:name => "medical ref", :method => :mbs_medref, :account => "9920"},
  23. {:name => "medical supply", :method => :mbs_med_sup, :account => "9910"},
  24. {:name => "st francis new", :method => :mbs_st_fran_new, :account => "9310"},
  25. {:name => "st francis used", :method => :mbs_st_fran_used, :account => "9320"},
  26. {:name => "st fran uniform", :method => :mbs_st_fran_uniform, :account => "9340"},
  27. {:name => "taxes", :method => :mbs_tax, :account => "9001"},
  28. ]
  29.  
  30. classes = [
  31. {:name => "new", :method => :newbook_total, :account => "9110"},
  32. {:name => "used", :method => :usedbook_total, :account => "9120"},
  33. {:name => "coursepack", :method => :coursepack_total, :account => "9710"},
  34. {:name => "reference", :method => :reference_total, :account => "9130"},
  35. {:name => "insignia", :method => :insignia_total, :account => "9140"},
  36. {:name => "food", :method => :food_total, :account => "9160"},
  37. {:name => "office", :method => :office_total, :account => "9150"},
  38. {:name => "greek", :method => :greek_total, :account => "9170"},
  39. {:name => "medical ref", :method => :medref_total, :account => "9920"},
  40. {:name => "medical supply", :method => :medsup_total, :account => "9910"},
  41. {:name => "shipping", :method => :shipping_total, :account => "8120"},
  42. {:name => "taxes", :method => :tax_total, :account => "9001"},
  43. {:name => "wholesale", :method => :wholesales, :account => "9510"},
  44. {:name => "advertising", :method => :advertisings, :account => "5000"},
  45. {:name => "credit bal ref", :method => :credit_bal_refunds, :account => "7110"},
  46. {:name => "pmt bad ck redep", :method => :bad_check_redeposits, :account => "1510"},
  47. {:name => "misc cash", :method => :misc_cashes, :account => "1070"},
  48. {:name => "settlement", :method => :settlements, :account => "7120"},
  49. {:name => "commissions", :method => :commissions, :account => "5040"},
  50. {:name => "eagle card checks", :method => :eagle_checks, :account => "1531"},
  51. ]
  52.  
  53. if @business_day.cash_sales > 0
  54. journals << [@business_day.made_for.strftime("%m/%d/%y"), "Cash Sales", "#{@business_day.school.prefix}-1030", report_formatted_money(@business_day.cash_sales), "" ]
  55. journals << ["", " Deposits in Transit", "#{@business_day.school.prefix}-9000", "", report_formatted_money(@business_day.cash_sales) ]
  56. else
  57. journals << [@business_day.made_for.strftime("%m/%d/%y"), "Deposits in Transit", "#{@business_day.school.prefix}-9000", report_formatted_money(@business_day.cash_sales), "" ]
  58. journals << ["", " Cash Sales", "#{@business_day.school.prefix}-1030", "", report_formatted_money(@business_day.cash_sales) ]
  59. end
  60.  
  61. if @business_day.accounting_credit > 0
  62. journals << [@business_day.made_for.strftime("%m/%d/%y"), "MC/VISA/DISCOVER", "#{@business_day.school.prefix}-1030", report_formatted_money(@business_day.accounting_credit), "" ]
  63. journals << ["", " Deposits in Transit", "#{@business_day.school.prefix}-9000", "", report_formatted_money(@business_day.accounting_credit) ]
  64. else
  65. journals << [@business_day.made_for.strftime("%m/%d/%y"), "Deposits in Transit", "#{@business_day.school.prefix}-9000", report_formatted_money(@business_day.accounting_credit), "" ]
  66. journals << ["", " MC/VISA/DISCOVER", "#{@business_day.school.prefix}-1030", "", report_formatted_money(@business_day.accounting_credit) ]
  67. end
  68.  
  69. if @business_day.amex_total > 0
  70. journals << [@business_day.made_for.strftime("%m/%d/%y"), "AMEX", "#{@business_day.school.prefix}-1030", report_formatted_money(@business_day.amex_total), "" ]
  71. journals << ["", " Deposits in Transit", "#{@business_day.school.prefix}-9000", "", report_formatted_money(@business_day.amex_total) ]
  72. else
  73. journals << [@business_day.made_for.strftime("%m/%d/%y"), "Deposits in Transit", "#{@business_day.school.prefix}-9000", report_formatted_money(@business_day.amex_total), "" ]
  74. journals << ["", " AMEX", "#{@business_day.school.prefix}-1030", "", report_formatted_money(@business_day.amex_total) ]
  75. end
  76.  
  77. journals << [" ", "", "", "", "" ]
  78. journals << [" ", "", "", "", "" ]
  79.  
  80. if @business_day.deposits_in_transit > 0
  81. journals << [@business_day.made_for.strftime("%m/%d/%y"), "Deposits in Transit", "#{@business_day.school.prefix}-9000", report_formatted_money(@business_day.deposits_in_transit), "" ]
  82. else
  83. journals << [@business_day.made_for.strftime("%m/%d/%y"), " Deposits in Transit", "#{@business_day.school.prefix}-9000", "", report_formatted_money(@business_day.deposits_in_transit) ]
  84. end
  85.  
  86. def sales_classes(amount)
  87. amount >= 0 ? ["", report_formatted_money(amount)] : [report_formatted_money(amount.abs), ""]
  88. end
  89.  
  90. if @business_day.school.is_mbs
  91. mbs_classes.each do |a|
  92. line = []
  93. line << ""
  94. line << a[:name].titleize
  95. line << "#{@business_day.school.prefix}-" + a[:account]
  96. line += sales_classes(@business_day.send(a[:method]))
  97. journals << line
  98. end
  99. if @business_day.school.school_name == "jcc"
  100. jcc_classes.each do |a|
  101. line = []
  102. line << ""
  103. line << a[:name].titleize
  104. line << "#{@business_day.school.prefix}-" + a[:account]
  105. line += sales_classes(@business_day.send(a[:method]))
  106. journals << line
  107. end
  108. end
  109. else
  110. classes.each do |a|
  111. line = []
  112. line << ""
  113. line << a[:name].titleize
  114. line << "#{@business_day.school.prefix}-" + a[:account]
  115. line += sales_classes(@business_day.send(a[:method]))
  116. journals << line
  117. end
  118. end
  119.  
  120. if @business_day.giftcard_total > 0
  121. journals << ["", "Cost of Sales Adj", "#{@business_day.school.prefix}-7120", "", report_formatted_money(@business_day.giftcard_total.abs) ]
  122. else
  123. journals << ["", "Cost of Sales Adj", "#{@business_day.school.prefix}-7120", report_formatted_money(@business_day.giftcard_total.abs), "" ]
  124. end
  125.  
  126. if @business_day.petty_cash_adj > 0
  127. journals << ["", "Petty Cash Adj", "#{@business_day.school.prefix}-1070", "", report_formatted_money(@business_day.petty_cash_adj)]
  128. else
  129. journals << ["", "Petty Cash Adj", "#{@business_day.school.prefix}-1070", report_formatted_money(@business_day.petty_cash_adj.abs), "" ]
  130. end
  131.  
  132. if @business_day.net_on_account > 0
  133. journals << ["", "On Account", "#{@business_day.school.prefix}-1530", report_formatted_money(@business_day.net_on_account), "" ]
  134. else
  135. journals << ["", "On Account", "#{@business_day.school.prefix}-1530", "", report_formatted_money(@business_day.net_on_account.abs) ]
  136. end
  137.  
  138. if @business_day.paid_outs > 0
  139. journals << ["", "Paid Outs", "#{@business_day.school.prefix}-7121", report_formatted_money(@business_day.paid_outs), ""]
  140. else
  141. journals << ["", "Paid Outs", "#{@business_day.school.prefix}-7121", "", report_formatted_money(@business_day.paid_outs.abs)]
  142. end
  143.  
  144. pdf.text "Journal Entries for #{@business_day.school.school_name.upcase}: #{@business_day.made_for.strftime("%b %e, %Y")}"
  145.  
  146. pdf.bounding_box [0,700], :width => 1000 do
  147. pdf.table journals,
  148. :headers => ["Date", "Description", "Account", "Debit", "Credit"],
  149. :header_color => @business_day.school.color,
  150. :column_widths => { 0 => 75, 1 => 200, 2 => 75, 3 => 75, 4 => 75 },
  151. :row_colors => ["FFFFFF", "CCCCCC"],
  152. :font_size => 9,
  153. :border_style => :none,
  154. :align => { 0 => :left, 1 => :left, 2 => :center , 3 => :right, 4 => :right}
  155.  
  156. end
Add Comment
Please, Sign In to add comment