Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- journals = [
- ]
- mbs_classes = [
- {:name => "new", :method => :mbs_new, :account => "9110"},
- {:name => "used", :method => :mbs_used, :account => "9120"},
- {:name => "coursepack", :method => :mbs_coursepack, :account => "9710"},
- {:name => "reference", :method => :mbs_reference, :account => "9130"},
- {:name => "office", :method => :mbs_report_office, :account => "9150"},
- {:name => "food", :method => :mbs_food, :account => "9160"},
- {:name => "shipping", :method => :report_shipping, :account => "8120"},
- {:name => "gift", :method => :mbs_gift, :account => "9180"},
- {:name => "insignia", :method => :mbs_insignia, :account => "9140"},
- {:name => "greek", :method => :mbs_greek, :account => "9170"},
- {:name => "h/s", :method => :mbs_hs, :account => "9140"},
- {:name => "taxes", :method => :mbs_tax, :account => "9001"},
- ]
- jcc_classes = [
- {:name => "med uniform", :method => :mbs_uniform, :account => "9930"},
- {:name => "medical ref", :method => :mbs_medref, :account => "9920"},
- {:name => "medical supply", :method => :mbs_med_sup, :account => "9910"},
- {:name => "st francis new", :method => :mbs_st_fran_new, :account => "9310"},
- {:name => "st francis used", :method => :mbs_st_fran_used, :account => "9320"},
- {:name => "st fran uniform", :method => :mbs_st_fran_uniform, :account => "9340"},
- {:name => "taxes", :method => :mbs_tax, :account => "9001"},
- ]
- classes = [
- {:name => "new", :method => :newbook_total, :account => "9110"},
- {:name => "used", :method => :usedbook_total, :account => "9120"},
- {:name => "coursepack", :method => :coursepack_total, :account => "9710"},
- {:name => "reference", :method => :reference_total, :account => "9130"},
- {:name => "insignia", :method => :insignia_total, :account => "9140"},
- {:name => "food", :method => :food_total, :account => "9160"},
- {:name => "office", :method => :office_total, :account => "9150"},
- {:name => "greek", :method => :greek_total, :account => "9170"},
- {:name => "medical ref", :method => :medref_total, :account => "9920"},
- {:name => "medical supply", :method => :medsup_total, :account => "9910"},
- {:name => "shipping", :method => :shipping_total, :account => "8120"},
- {:name => "taxes", :method => :tax_total, :account => "9001"},
- {:name => "wholesale", :method => :wholesales, :account => "9510"},
- {:name => "advertising", :method => :advertisings, :account => "5000"},
- {:name => "credit bal ref", :method => :credit_bal_refunds, :account => "7110"},
- {:name => "pmt bad ck redep", :method => :bad_check_redeposits, :account => "1510"},
- {:name => "misc cash", :method => :misc_cashes, :account => "1070"},
- {:name => "settlement", :method => :settlements, :account => "7120"},
- {:name => "commissions", :method => :commissions, :account => "5040"},
- {:name => "eagle card checks", :method => :eagle_checks, :account => "1531"},
- ]
- if @business_day.cash_sales > 0
- journals << [@business_day.made_for.strftime("%m/%d/%y"), "Cash Sales", "#{@business_day.school.prefix}-1030", report_formatted_money(@business_day.cash_sales), "" ]
- journals << ["", " Deposits in Transit", "#{@business_day.school.prefix}-9000", "", report_formatted_money(@business_day.cash_sales) ]
- else
- journals << [@business_day.made_for.strftime("%m/%d/%y"), "Deposits in Transit", "#{@business_day.school.prefix}-9000", report_formatted_money(@business_day.cash_sales), "" ]
- journals << ["", " Cash Sales", "#{@business_day.school.prefix}-1030", "", report_formatted_money(@business_day.cash_sales) ]
- end
- if @business_day.accounting_credit > 0
- journals << [@business_day.made_for.strftime("%m/%d/%y"), "MC/VISA/DISCOVER", "#{@business_day.school.prefix}-1030", report_formatted_money(@business_day.accounting_credit), "" ]
- journals << ["", " Deposits in Transit", "#{@business_day.school.prefix}-9000", "", report_formatted_money(@business_day.accounting_credit) ]
- else
- journals << [@business_day.made_for.strftime("%m/%d/%y"), "Deposits in Transit", "#{@business_day.school.prefix}-9000", report_formatted_money(@business_day.accounting_credit), "" ]
- journals << ["", " MC/VISA/DISCOVER", "#{@business_day.school.prefix}-1030", "", report_formatted_money(@business_day.accounting_credit) ]
- end
- if @business_day.amex_total > 0
- journals << [@business_day.made_for.strftime("%m/%d/%y"), "AMEX", "#{@business_day.school.prefix}-1030", report_formatted_money(@business_day.amex_total), "" ]
- journals << ["", " Deposits in Transit", "#{@business_day.school.prefix}-9000", "", report_formatted_money(@business_day.amex_total) ]
- else
- journals << [@business_day.made_for.strftime("%m/%d/%y"), "Deposits in Transit", "#{@business_day.school.prefix}-9000", report_formatted_money(@business_day.amex_total), "" ]
- journals << ["", " AMEX", "#{@business_day.school.prefix}-1030", "", report_formatted_money(@business_day.amex_total) ]
- end
- journals << [" ", "", "", "", "" ]
- journals << [" ", "", "", "", "" ]
- if @business_day.deposits_in_transit > 0
- 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), "" ]
- else
- 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) ]
- end
- def sales_classes(amount)
- amount >= 0 ? ["", report_formatted_money(amount)] : [report_formatted_money(amount.abs), ""]
- end
- if @business_day.school.is_mbs
- mbs_classes.each do |a|
- line = []
- line << ""
- line << a[:name].titleize
- line << "#{@business_day.school.prefix}-" + a[:account]
- line += sales_classes(@business_day.send(a[:method]))
- journals << line
- end
- if @business_day.school.school_name == "jcc"
- jcc_classes.each do |a|
- line = []
- line << ""
- line << a[:name].titleize
- line << "#{@business_day.school.prefix}-" + a[:account]
- line += sales_classes(@business_day.send(a[:method]))
- journals << line
- end
- end
- else
- classes.each do |a|
- line = []
- line << ""
- line << a[:name].titleize
- line << "#{@business_day.school.prefix}-" + a[:account]
- line += sales_classes(@business_day.send(a[:method]))
- journals << line
- end
- end
- if @business_day.giftcard_total > 0
- journals << ["", "Cost of Sales Adj", "#{@business_day.school.prefix}-7120", "", report_formatted_money(@business_day.giftcard_total.abs) ]
- else
- journals << ["", "Cost of Sales Adj", "#{@business_day.school.prefix}-7120", report_formatted_money(@business_day.giftcard_total.abs), "" ]
- end
- if @business_day.petty_cash_adj > 0
- journals << ["", "Petty Cash Adj", "#{@business_day.school.prefix}-1070", "", report_formatted_money(@business_day.petty_cash_adj)]
- else
- journals << ["", "Petty Cash Adj", "#{@business_day.school.prefix}-1070", report_formatted_money(@business_day.petty_cash_adj.abs), "" ]
- end
- if @business_day.net_on_account > 0
- journals << ["", "On Account", "#{@business_day.school.prefix}-1530", report_formatted_money(@business_day.net_on_account), "" ]
- else
- journals << ["", "On Account", "#{@business_day.school.prefix}-1530", "", report_formatted_money(@business_day.net_on_account.abs) ]
- end
- if @business_day.paid_outs > 0
- journals << ["", "Paid Outs", "#{@business_day.school.prefix}-7121", report_formatted_money(@business_day.paid_outs), ""]
- else
- journals << ["", "Paid Outs", "#{@business_day.school.prefix}-7121", "", report_formatted_money(@business_day.paid_outs.abs)]
- end
- pdf.text "Journal Entries for #{@business_day.school.school_name.upcase}: #{@business_day.made_for.strftime("%b %e, %Y")}"
- pdf.bounding_box [0,700], :width => 1000 do
- pdf.table journals,
- :headers => ["Date", "Description", "Account", "Debit", "Credit"],
- :header_color => @business_day.school.color,
- :column_widths => { 0 => 75, 1 => 200, 2 => 75, 3 => 75, 4 => 75 },
- :row_colors => ["FFFFFF", "CCCCCC"],
- :font_size => 9,
- :border_style => :none,
- :align => { 0 => :left, 1 => :left, 2 => :center , 3 => :right, 4 => :right}
- end
Add Comment
Please, Sign In to add comment