vfwcash 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +17 -0
  3. data/Gemfile +4 -0
  4. data/LICENSE.txt +22 -0
  5. data/README.md +107 -0
  6. data/Rakefile +2 -0
  7. data/bin/vfwcash +5 -0
  8. data/lib/models/audit.rb +228 -0
  9. data/lib/models/balance.rb +95 -0
  10. data/lib/models/between.rb +100 -0
  11. data/lib/models/cash_account.rb +69 -0
  12. data/lib/models/gcash.rb +189 -0
  13. data/lib/models/ledger.rb +109 -0
  14. data/lib/models/register.rb +54 -0
  15. data/lib/models/split.rb +26 -0
  16. data/lib/models/split_ledger.rb +69 -0
  17. data/lib/models/sqlite_base.rb +10 -0
  18. data/lib/models/summary.rb +98 -0
  19. data/lib/models/tran.rb +12 -0
  20. data/lib/templates/vfw-gray.png +0 -0
  21. data/lib/templates/vfwcash.gnucash +0 -0
  22. data/lib/templates/vfwcash.yml +95 -0
  23. data/lib/vfwcash/api.rb +48 -0
  24. data/lib/vfwcash/cli.rb +195 -0
  25. data/lib/vfwcash/controller.rb +83 -0
  26. data/lib/vfwcash/version.rb +3 -0
  27. data/lib/vfwcash.rb +90 -0
  28. data/pdf_examples/audit_201507.pdf +2826 -0
  29. data/pdf_examples/balance_201508.pdf +2283 -0
  30. data/pdf_examples/controllers/checkbooks_controller.rb +99 -0
  31. data/pdf_examples/ledger_201504.pdf +5758 -0
  32. data/pdf_examples/ledger_summary.pdf +5719 -0
  33. data/pdf_examples/register_201508.pdf +1157 -0
  34. data/pdf_examples/split_201508.pdf +4930 -0
  35. data/pdf_examples/views/checkbooks/balance.html.slim +53 -0
  36. data/pdf_examples/views/checkbooks/between.html.slim +53 -0
  37. data/pdf_examples/views/checkbooks/index.html.slim +57 -0
  38. data/pdf_examples/views/checkbooks/ledger.html.slim +58 -0
  39. data/pdf_examples/views/checkbooks/register.html.slim +44 -0
  40. data/pdf_examples/views/checkbooks/split.html.slim +45 -0
  41. data/pdf_examples/views/checkbooks/summary.html.slim +56 -0
  42. data/vfwcash.gemspec +31 -0
  43. metadata +198 -0
@@ -0,0 +1,99 @@
1
+
2
+
3
+ class CheckbooksController < ApplicationController
4
+ layout 'print'
5
+ before_action :set_cash
6
+
7
+ def index
8
+ end
9
+
10
+ def ledger
11
+ @cash.get_fund_balances(@bom,@bom.end_of_month)
12
+ @response = @cash.month_ledger_api(@bom)
13
+ end
14
+
15
+ def balance
16
+ @cash.get_fund_balances(@bom,@bom.end_of_month)
17
+ end
18
+
19
+ def split
20
+ @cash.get_fund_balances(@bom,@bom.end_of_month)
21
+ @response = @cash.split_ledger_api(@bom)
22
+ end
23
+
24
+ def register
25
+ @cash.get_fund_balances(@bom,@bom.end_of_month)
26
+ @response = @cash.split_ledger_api(@bom)
27
+ end
28
+
29
+ def summary
30
+ @cash.get_all_balances
31
+ end
32
+
33
+ def ledger_pdf
34
+ pdf = Vfwcash::Api.new(@bom).ledger
35
+ send_data pdf.render, filename: "GeneralLedger-#{@bom}",
36
+ type: "application/pdf",
37
+ disposition: "inline"
38
+ end
39
+
40
+ def summary_pdf
41
+ pdf = Vfwcash::Api.new(@bom).summary
42
+ send_data pdf.render, filename: "LedgerSummary-#{@bom}",
43
+ type: "application/pdf",
44
+ disposition: "inline"
45
+ end
46
+
47
+
48
+ def split_pdf
49
+ pdf = Vfwcash::Api.new(@bom).split
50
+ send_data pdf.render, filename: "SplitRegister-#{@bom}",
51
+ type: "application/pdf",
52
+ disposition: "inline"
53
+ end
54
+
55
+ def register_pdf
56
+ pdf = Vfwcash::Api.new(@bom).register
57
+ send_data pdf.render, filename: "CheckingRegister-#{@bom}",
58
+ type: "application/pdf",
59
+ disposition: "inline"
60
+ end
61
+
62
+ def audit_pdf
63
+ pdf = Vfwcash::Api.new(@bom).audit
64
+ send_data pdf.render, filename: "Audit-#{@bom}",
65
+ type: "application/pdf",
66
+ disposition: "inline"
67
+ end
68
+
69
+ def between
70
+ @from = Date.parse(params[:from])
71
+ @to = Date.parse(params[:to])
72
+ @cash.get_fund_balances(@from,@to)
73
+ end
74
+
75
+ def between_pdf
76
+ @from = Date.parse(params[:from])
77
+ @to = Date.parse(params[:to])
78
+ pdf = Vfwcash::Api.new(@bom).between(@from,@to)
79
+ send_data pdf.render, filename: "Between-#{@from}_#{@to}",
80
+ type: "application/pdf",
81
+ disposition: "inline"
82
+
83
+ end
84
+
85
+
86
+ private
87
+
88
+ def set_cash
89
+ if params[:id].present?
90
+ params[:id] += "01" if params[:id].length == 6
91
+ @date = Date.parse(params[:id])
92
+ else
93
+ @date = Date.today
94
+ end
95
+ @bom = @date.beginning_of_month
96
+ @cash = Vfwcash::Api.new(@bom).cash
97
+ end
98
+
99
+ end