Class: Audit
- Inherits:
-
Prawn::Document
- Object
- Prawn::Document
- Audit
- Defined in:
- lib/models/audit.rb
Instance Attribute Summary collapse
-
#balances ⇒ Object
Returns the value of attribute balances.
-
#config ⇒ Object
Returns the value of attribute config.
-
#cur ⇒ Object
Returns the value of attribute cur.
Instance Method Summary collapse
- #bonding ⇒ Object
- #certify ⇒ Object
- #commander ⇒ Object
- #funds ⇒ Object
- #header ⇒ Object
-
#initialize(date, cash) ⇒ Audit
constructor
A new instance of Audit.
- #make_pdf ⇒ Object
- #money(int) ⇒ Object
- #operations ⇒ Object
- #quartermaster ⇒ Object
- #reconcile ⇒ Object
- #report ⇒ Object
- #trustees ⇒ Object
- #verify ⇒ Object
Constructor Details
#initialize(date, cash) ⇒ Audit
Returns a new instance of Audit.
3 4 5 6 7 8 9 10 11 |
# File 'lib/models/audit.rb', line 3 def initialize(date,cash) super( top_margin: 35) @date = Vfwcash.set_date(date).beginning_of_month @layout = {top:bounds.height.to_i,right:bounds.width.to_i,left:0,bottom:0,cursor:cursor} @config = cash.config # cash.get_balances @balances = cash.audit_api(@date) make_pdf end |
Instance Attribute Details
#balances ⇒ Object
Returns the value of attribute balances.
2 3 4 |
# File 'lib/models/audit.rb', line 2 def balances @balances end |
#config ⇒ Object
Returns the value of attribute config.
2 3 4 |
# File 'lib/models/audit.rb', line 2 def config @config end |
#cur ⇒ Object
Returns the value of attribute cur.
2 3 4 |
# File 'lib/models/audit.rb', line 2 def cur @cur end |
Instance Method Details
#bonding ⇒ Object
202 203 204 205 206 207 208 209 210 211 212 |
# File 'lib/models/audit.rb', line 202 def bonding bounding_box([0, @cur], :width => @layout[:right], :height => 50) do move_down 10 text "#{Prawn::Text::NBSP * 5}This is to certify that the Office of the Quartermaster is Bonded with"+ " <strong><u> #{@config[:bond][:name]} </u></strong> "+ "in the amount of <strong><u> #{'$'+money(@config[:bond][:amount])} </u></strong> until <strong><u> #{@config[:bond][:to]} </u></strong>, "+ "and that this Audit is correctly made out to the best of my knowledge and belief.", inline_format:true end @cur -= 52 end |
#certify ⇒ Object
150 151 152 153 154 155 156 157 158 159 160 |
# File 'lib/models/audit.rb', line 150 def certify bounding_box([@layout[:right]/2, @cur], :width => @layout[:right]/2, :height => 40) do draw_text "18.", at:[5,30] draw_text "TRUSTEEs' and COMMANDER's", at:[40,30], style: :bold, size:10 draw_text "CERTIFICATE OF AUDIT", at:[55,20], style: :bold, size:10 move_down 30 text "<strong>Date: <u> #{@config[:date]} </u></strong>", inline_format:true, indent_paragraphs:35 end @cur -= 46 end |
#commander ⇒ Object
214 215 216 217 218 219 220 |
# File 'lib/models/audit.rb', line 214 def commander bounding_box([@layout[:right]/2, @cur], :width => @layout[:right]/2, :height => 30) do move_down 20 text "Signed _____________________________________ Commander" end end |
#funds ⇒ Object
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/models/audit.rb', line 54 def funds bounding_box([0, @cur], :width => @layout[:right], :height => 180) do rows = [] h = [ "FUNDS", "10. Net Cash Balances at Beginning of Quarter", "11. Receipts During Quarter", "12. Expenditures During Quarter", "13. Net Cash Balances at End of Quarter"] rows << h bb = @eb = cr = db = 0 @config[:funds].each do |f,v| bal = @balances[v[:fund]] if bal.present? bb += bal[:bbalance] @eb += bal[:ebalance] db += bal[:debits] cr += bal[:credits] rows << [v[:text], money(bal[:bbalance]),money(bal[:debits]),money(bal[:credits]),money(bal[:ebalance])] end end rows << [' ',nil,nil,nil,nil] rows << ['10. Total',money(bb),money(db),money(cr),"(15) " + money(@eb)] font_size 8 e = make_table rows,:cell_style => {:padding => [1, 2, 2, 1] ,border_color:"000000"}, :column_widths => [268, 68,68,68,68] do row(0).column(0).font_style = :bold row(0).column(0).size = 10 row(0).column(1..4).size = 5 row(0).column(1..4).font_style = :bold row(-1).font_style = :bold column(1..4).align = :right row(-1).align = :right end e.draw end @cur -= 182 end |
#header ⇒ Object
32 33 34 35 36 37 38 39 40 41 |
# File 'lib/models/audit.rb', line 32 def header bounding_box([0,@cur], width: 80, height:80) do image "#{Vfwcash::LibPath}/templates/vfw-gray.png",height:50 end bounding_box([0, @cur], :width => @layout[:right], :height => 30) do draw_text "TRUSTEES' REPORT OF AUDIT of", at:[100,15], style: :bold, size:12 end @cur -= 32 end |
#make_pdf ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/models/audit.rb', line 13 def make_pdf @cur = @layout[:top] font_size 9 # get_config header report funds operations reconcile certify verify quartermaster trustees bonding commander number_pages "VFW Post 8600 Form - Page <page> of <total>", { :start_count_at => 0, :page_filter => :all, :at => [bounds.right - 100, 0], :align => :right, :size => 6 } end |
#money(int) ⇒ Object
222 223 224 |
# File 'lib/models/audit.rb', line 222 def money(int) Vfwcash.money(int) end |
#operations ⇒ Object
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/models/audit.rb', line 93 def operations bounding_box([0, @cur], :width => @layout[:right]/2, :height => 180) do stroke_bounds move_down 5 text "16. OPERATIONS", size:10, style: :bold stroke_horizontal_rule rows = [] @config[:operations].each do |k,v| rows << [v[:ques], (v[:answ].is_a?(Numeric) ? money(v[:answ]) : v[:answ])] end move_down(2) indent 3,3 do e = make_table rows,row_colors: ["F8F8F8", "FFFFFF"],:cell_style => {:padding => [3, 2, 2, 3] ,border_color:"FFFFFF", border_widths: [0,0,0,0]}, :column_widths => [190, 60] do column(1).align = :right end e.draw end end end |
#quartermaster ⇒ Object
175 176 177 178 179 180 181 182 183 184 185 |
# File 'lib/models/audit.rb', line 175 def quartermaster bounding_box([0, @cur], :width => @layout[:right]/2, :height => 80) do draw_text "Post Quartermaster:", at:[5,65], style: :bold draw_text "Name and Address", at:[120,65], size: 6 draw_text @config[:qm][:name], at:[120,50] draw_text @config[:qm][:address], at:[120,35] draw_text @config[:qm][:city], at:[120,25] end end |
#reconcile ⇒ Object
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 |
# File 'lib/models/audit.rb', line 115 def reconcile bounding_box([@layout[:right]/2, @cur], :width => @layout[:right]/2, :height => 140) do stroke_bounds move_down 5 text "17. RECONCILIATION OF FUND BALANCES", size:10, style: :bold stroke_horizontal_rule move_down(2) rows = [] rows << ['Checking Account Balance',{content:money(@config[:checking][:balance]),align: :right},nil] rows << ['Less Outstand Checks',{content:money(@config[:checking][:outstanding]), align: :right},nil] ab = @config[:checking][:balance] - @config[:checking][:outstanding] save = 0 cash = 100000 t1 = ab+save+cash bond = @balances[:savings][:ebalance] t2 = t1 + bond rows << [{content:'Actual Balance', align: :right, colspan: 2},{content:money(ab),align: :right}] rows << [{content:'Savings Account Balance', align: :right, colspan: 2},{content:money(0),align: :right}] rows << [{content:'Cash on Hand', align: :right, colspan: 2},{content:money(cash),align: :right}] rows << [{content:'Total', align: :right, colspan: 2},{content:money(t1),align: :right}] rows << [{content:'Bonds and Investments (cost value)', align: :right, colspan: 2},{content:money(bond),align: :right}] rows << [{content:'Total', align: :right, colspan: 2},{content:money(t2),align: :right, text_color: (t2 != @eb ? 'FF0000' : '000000')}] indent 2,2 do e = make_table rows,row_colors: ["F8F8F8", "FFFFFF"],:cell_style => {:padding => [3, 2, 2, 3] ,border_color:"FFFFFF", border_widths: [0,0,0,0]}, :column_widths => [120, 60, 60] do row(-1).font_style = :bold end e.draw end end @cur -= 140 end |
#report ⇒ Object
43 44 45 46 47 48 49 50 51 52 |
# File 'lib/models/audit.rb', line 43 def report bounding_box([70, @cur], :width => @layout[:right] - 70, :height => 50) do text_box "The Books and Records of the Quartermaster and Adjutant of: <strong><u>#{@config[:post][:name]} - #{@config[:post][:post]}</u></strong>", at:[30,50], inline_format:true text_box "Department of <strong><u> #{@config[:post][:department]} </u></strong> for Fiscal Quarter ending: <strong><u>#{@balances[:dates][:eoq]}</u></strong>", at:[30,35], inline_format:true text_box "Fiscal Quarter <strong><u>#{@balances[:dates][:boq]} to #{@balances[:dates][:eoq]}</u></strong>", at:[30,20], inline_format:true end @cur -= 52 end |
#trustees ⇒ Object
187 188 189 190 191 192 193 194 195 196 197 198 199 200 |
# File 'lib/models/audit.rb', line 187 def trustees bounding_box([@layout[:right]/2, @cur], :width => @layout[:right]/2, :height => 80) do move_down 14 text "Signed _____________________________________ Trustee" move_down 14 text "Signed _____________________________________ Trustee" move_down 14 text "Signed _____________________________________ Trustee" end @cur -= 82 end |
#verify ⇒ Object
162 163 164 165 166 167 168 169 170 171 172 173 |
# File 'lib/models/audit.rb', line 162 def verify bounding_box([0, @cur], :width => @layout[:right], :height => 60) do move_down 5 text "#{Prawn::Text::NBSP * 5}This is to certify that we (or qualified accountants) have audited the books and records of the Adjutant & Quartermaster of"+ " \n<strong><u> #{@config[:post][:post]} </u></strong> (District/County Council/Post No.)"+ " For the Fiscal Quarter ending <strong><u> #{@balances[:dates][:eoq]} </u></strong> in accordance of the National By-Laws and this Report"+ " is a true and correct statement thereof to the best of our knowledge and belief. All Vouchers and checks have been examined"+ " and found to be properly approved and checks properly signed.", inline_format:true end @cur -= 62 end |