rock_books 0.2.1 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (137) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +4 -0
  3. data/LICENSE.txt +201 -21
  4. data/RELEASE_NOTES.md +16 -0
  5. data/lib/rock_books/cmd_line/command_line_interface.rb +18 -7
  6. data/lib/rock_books/documents/book_set.rb +14 -9
  7. data/lib/rock_books/documents/chart_of_accounts.rb +45 -30
  8. data/lib/rock_books/documents/journal.rb +45 -40
  9. data/lib/rock_books/reports/receipts_report.rb +23 -10
  10. data/lib/rock_books/reports/report_context.rb +1 -4
  11. data/lib/rock_books/reports/reporter.rb +1 -1
  12. data/lib/rock_books/reports/transaction_report.rb +4 -2
  13. data/lib/rock_books/version.rb +1 -1
  14. data/sample_data/minimal/rockbooks-reports/html/ck_hsbc_disb.html +40 -0
  15. data/sample_data/minimal/rockbooks-reports/html/index.html +271 -0
  16. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_accts_rec.html +27 -0
  17. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_bank_fees.html +27 -0
  18. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_books_refs.html +27 -0
  19. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_cc_hsbc_visa.html +74 -0
  20. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_cc_proc.html +27 -0
  21. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_ck_hsbc.html +45 -0
  22. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_conf_fees.html +36 -0
  23. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_cowork_fees.html +42 -0
  24. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_govt_fees.html +27 -0
  25. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_inet_fees.html +27 -0
  26. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_int_exp.html +27 -0
  27. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_loan_to_sh.html +47 -0
  28. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_meals_ent.html +27 -0
  29. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_misc_exp.html +27 -0
  30. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_mktng_exp.html +27 -0
  31. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_own_equity.html +35 -0
  32. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_prof_fees.html +27 -0
  33. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_repair_maint.html +27 -0
  34. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_ret_earn.html +27 -0
  35. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_ship_exp.html +27 -0
  36. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_sls_cons.html +35 -0
  37. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_sw_exp.html +27 -0
  38. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_tr_airfare.html +35 -0
  39. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_tr_autorent.html +27 -0
  40. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_tr_gas_etc.html +27 -0
  41. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_tr_govt.html +27 -0
  42. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_tr_lodging.html +36 -0
  43. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_tr_m_e.html +27 -0
  44. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_tr_m_i.html +27 -0
  45. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_tr_mileage.html +35 -0
  46. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_tr_misc.html +27 -0
  47. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_tr_parking.html +27 -0
  48. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_tr_perdiem_mi.html +35 -0
  49. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_tr_taxi.html +27 -0
  50. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_tr_trainfare.html +27 -0
  51. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_tr_unclass.html +27 -0
  52. data/sample_data/minimal/rockbooks-reports/pdf/all_txns_by_acct.pdf +0 -0
  53. data/sample_data/minimal/rockbooks-reports/pdf/all_txns_by_amount.pdf +0 -0
  54. data/sample_data/minimal/rockbooks-reports/pdf/all_txns_by_date.pdf +0 -0
  55. data/sample_data/minimal/rockbooks-reports/pdf/balance_sheet.pdf +0 -0
  56. data/sample_data/minimal/rockbooks-reports/pdf/ck_hsbc_disb.pdf +0 -0
  57. data/sample_data/minimal/rockbooks-reports/pdf/general.pdf +0 -0
  58. data/sample_data/minimal/rockbooks-reports/pdf/hsbc_visa.pdf +0 -0
  59. data/sample_data/minimal/rockbooks-reports/pdf/income_statement.pdf +0 -0
  60. data/sample_data/minimal/rockbooks-reports/pdf/receipts.pdf +0 -0
  61. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_accts_rec.pdf +0 -0
  62. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_bank_fees.pdf +0 -0
  63. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_books_refs.pdf +0 -0
  64. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_cc_hsbc_visa.pdf +0 -0
  65. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_cc_proc.pdf +0 -0
  66. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_ck_hsbc.pdf +0 -0
  67. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_conf_fees.pdf +0 -0
  68. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_cowork_fees.pdf +0 -0
  69. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_govt_fees.pdf +0 -0
  70. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_inet_fees.pdf +0 -0
  71. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_insurance.pdf +0 -0
  72. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_int_exp.pdf +0 -0
  73. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_loan_to_sh.pdf +0 -0
  74. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_meals_ent.pdf +0 -0
  75. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_misc_exp.pdf +0 -0
  76. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_mktng_exp.pdf +0 -0
  77. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_own_equity.pdf +0 -0
  78. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_paypal.pdf +0 -0
  79. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_prof_fees.pdf +0 -0
  80. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_repair_maint.pdf +0 -0
  81. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_ret_earn.pdf +0 -0
  82. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_ship_exp.pdf +0 -0
  83. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_sls_cons.pdf +0 -0
  84. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_supplies.pdf +0 -0
  85. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_sw_exp.pdf +0 -0
  86. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_tr_airfare.pdf +0 -0
  87. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_tr_autorent.pdf +0 -0
  88. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_tr_gas_etc.pdf +0 -0
  89. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_tr_govt.pdf +0 -0
  90. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_tr_lodging.pdf +0 -0
  91. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_tr_m_e.pdf +0 -0
  92. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_tr_m_i.pdf +0 -0
  93. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_tr_mileage.pdf +0 -0
  94. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_tr_misc.pdf +0 -0
  95. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_tr_parking.pdf +0 -0
  96. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_tr_perdiem_mi.pdf +0 -0
  97. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_tr_taxi.pdf +0 -0
  98. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_tr_trainfare.pdf +0 -0
  99. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_tr_unclass.pdf +0 -0
  100. data/sample_data/minimal/rockbooks-reports/txt/ck_hsbc_disb.txt +24 -0
  101. data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_accts_rec.txt +11 -0
  102. data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_bank_fees.txt +11 -0
  103. data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_books_refs.txt +11 -0
  104. data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_cc_hsbc_visa.txt +58 -0
  105. data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_cc_proc.txt +11 -0
  106. data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_ck_hsbc.txt +29 -0
  107. data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_conf_fees.txt +20 -0
  108. data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_cowork_fees.txt +26 -0
  109. data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_govt_fees.txt +11 -0
  110. data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_inet_fees.txt +11 -0
  111. data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_int_exp.txt +11 -0
  112. data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_loan_to_sh.txt +31 -0
  113. data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_meals_ent.txt +11 -0
  114. data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_misc_exp.txt +11 -0
  115. data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_mktng_exp.txt +11 -0
  116. data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_own_equity.txt +19 -0
  117. data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_prof_fees.txt +11 -0
  118. data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_repair_maint.txt +11 -0
  119. data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_ret_earn.txt +11 -0
  120. data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_ship_exp.txt +11 -0
  121. data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_sls_cons.txt +19 -0
  122. data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_sw_exp.txt +11 -0
  123. data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_tr_airfare.txt +19 -0
  124. data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_tr_autorent.txt +11 -0
  125. data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_tr_gas_etc.txt +11 -0
  126. data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_tr_govt.txt +11 -0
  127. data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_tr_lodging.txt +20 -0
  128. data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_tr_m_e.txt +11 -0
  129. data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_tr_m_i.txt +11 -0
  130. data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_tr_mileage.txt +19 -0
  131. data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_tr_misc.txt +11 -0
  132. data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_tr_parking.txt +11 -0
  133. data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_tr_perdiem_mi.txt +19 -0
  134. data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_tr_taxi.txt +11 -0
  135. data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_tr_trainfare.txt +11 -0
  136. data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_tr_unclass.txt +11 -0
  137. metadata +115 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 88be3c166ad253939496c416a3fe7fde2e8b9e1054622332cb80dbed50f810da
4
- data.tar.gz: 4c50a67abb70676e51004c7da9a2e01135a292e1de6009d0723f257d97dd207a
3
+ metadata.gz: ce2a320fd7ced495ee7c8ab111413b0b368928c5da80dcb0885d6d1b4bbb22a3
4
+ data.tar.gz: 607db6692e994e1a4f3a3400cb56a6827e176c707f917e81cb065cf6655cfc8f
5
5
  SHA512:
6
- metadata.gz: 9aae80ffcb3e9dd87e0e0d8df80e1b58b2e8b7bb9d4cd8fb5a77d7f5421bf961bbc89a50395599b1a061f10d9c2ac442b52ce33fb3bbfc67d47cb8e3f77ee0dc
7
- data.tar.gz: a281b5dba15773df5a34a38fc029c36487c638585bfc44a38aa83ecced12ecb1d610ecdb173ea54f3cbb6d58920425a4ed62c5c88aabf0329dabe11ff903e0c0
6
+ metadata.gz: d29c0671a29843c0dbaeb4521e0d4b1fd61427476cd96ae726a651693975bedd129e82ddd51c1486318878b22fac199733cd2d7fc984d602a9abd682dc652c04
7
+ data.tar.gz: 6cb2feaf8126241c2211f8188a500cadc6e88302b0671c495060a408075dadf34a3820370348417a5bc2c9d72537c9a0301a77b05f89c392af51b35ad1661bea
data/.gitignore CHANGED
@@ -11,3 +11,7 @@
11
11
 
12
12
  # rspec failure tracking
13
13
  .rspec_status
14
+
15
+ Gemfile.lock
16
+ projectFilesBackup
17
+ *.gem
data/LICENSE.txt CHANGED
@@ -1,21 +1,201 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2018 Keith Bennett
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2019 Bennett Business Solutions, Inc.
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
data/RELEASE_NOTES.md CHANGED
@@ -1,3 +1,19 @@
1
+ ## v0.4.0
2
+
3
+ * Sort unused receipts alphanumerically.
4
+ * Add 'x' receipts option for reporting both missing and unused receipts.
5
+ * Fix: journals were showing journal account instead of the other account in each transaction.
6
+ * Improve Receipts report.
7
+
8
+
9
+ ## v0.3.0
10
+
11
+ * Added ability to report unused receipts.
12
+ * Errors now include more context information.
13
+ * Improved chart of accounts validation.
14
+ * Change license from MIT to Apache 2.
15
+
16
+
1
17
  ## v0.2.1
2
18
 
3
19
  * Add help text to readme.
@@ -49,7 +49,7 @@ Command Line Switches: [rock-books version #{RockBooks::VERSI
49
49
 
50
50
  Commands:
51
51
 
52
- rec[eipts] - receipts: a/:a all, m/:m missing, e/:e existing
52
+ rec[eipts] - receipts: a/:a all, m/:m missing, e/:e existing, u/:u unused
53
53
  rep[orts] - return an OpenStruct containing all reports (interactive shell mode only)
54
54
  d[isplay_reports] - display all reports on stdout
55
55
  w[rite_reports] - write all reports to the output directory (see -o option)
@@ -317,17 +317,20 @@ When in interactive shell mode:
317
317
  raise Error.new("Receipt processing was requested but has been disabled with --no-receipts.")
318
318
  end
319
319
 
320
- missing, existing = book_set.missing_and_existing_receipts
320
+ missing, existing, unused = book_set.missing_existing_unused_receipts
321
321
 
322
- print_missing = -> { puts "Missing Receipts:"; ap missing }
323
- print_existing = -> { puts "Existing Receipts:"; ap existing }
322
+ print_missing = -> { puts "\n\nMissing Receipts:"; ap missing }
323
+ print_existing = -> { puts "\n\nExisting Receipts:"; ap existing }
324
+ print_unused = -> { puts "\n\nUnused Receipts:"; ap unused }
324
325
 
325
326
  case options.first.to_s
326
327
  when 'a' # all
327
328
  if run_options.interactive_mode
328
- { missing: missing, existing: existing }
329
+ { missing: missing, existing: existing, unused: unused }
329
330
  else
330
- print_missing.(); print_existing.()
331
+ print_missing.()
332
+ print_existing.()
333
+ print_unused.()
331
334
  end
332
335
 
333
336
  when 'm'
@@ -336,8 +339,16 @@ When in interactive shell mode:
336
339
  when 'e'
337
340
  run_options.interactive_mode ? existing : print_existing.()
338
341
 
342
+ when 'u'
343
+ run_options.interactive_mode ? unused : print_unused.()
344
+
345
+ when 'x'
346
+ run_options.interactive_mode ? missing : print_missing.()
347
+ run_options.interactive_mode ? unused : print_unused.()
348
+
339
349
  else
340
- message = "Invalid option for receipts. Must be 'a' for all, 'm' for missing, or 'e' for existing."
350
+ message = "Invalid option for receipts." + \
351
+ " Must be 'a' for all, 'm' for missing, 'e' for existing, 'u' for unused, or 'x' for errors (missing/unused)."
341
352
  if run_options.interactive_mode
342
353
  puts message
343
354
  else
@@ -35,11 +35,9 @@ module RockBooks
35
35
 
36
36
  def all_reports(filter = nil)
37
37
 
38
- periods_to_underscores = ->(string) { string.gsub('.', '_') }
39
-
40
38
  context = report_context
41
39
  report_hash = context.journals.each_with_object({}) do |journal, report_hash|
42
- key = periods_to_underscores.(journal.short_name).to_sym
40
+ key = journal.short_name.to_sym
43
41
  report_hash[key] = TransactionReport.new(journal, context).call(filter)
44
42
  end
45
43
  report_hash[:all_txns_by_date] = MultidocTransactionReport.new(context).call(filter)
@@ -49,14 +47,15 @@ module RockBooks
49
47
  report_hash[:income_statement] = IncomeStatement.new(context).call
50
48
 
51
49
  if run_options.do_receipts
52
- report_hash[:receipts] = ReceiptsReport.new(context, *missing_and_existing_receipts).call
50
+ report_hash[:receipts] = ReceiptsReport.new(context, *missing_existing_unused_receipts).call
53
51
  end
54
52
 
55
53
  chart_of_accounts.accounts.each do |account|
56
- key = ('acct_' + periods_to_underscores.(account.code)).to_sym
54
+ key = ('acct_' + account.code).to_sym
57
55
  report = TxOneAccount.new(context, account.code).call
58
56
  report_hash[key] = report
59
57
  end
58
+
60
59
  report_hash
61
60
  end
62
61
 
@@ -146,16 +145,22 @@ module RockBooks
146
145
  end
147
146
 
148
147
 
149
- def missing_and_existing_receipts
150
- missing = []; existing = []
148
+ def missing_existing_unused_receipts
149
+ missing = []
150
+ existing = []
151
+ unused = Dir['receipts/**/*'].select { |s| File.file?(s) }.sort # Remove files as they are found
152
+ unused.map! { |s| "./" + s } # Prepend './' to match the data
153
+
151
154
  all_entries.each do |entry|
152
155
  entry.receipts.each do |receipt|
153
- file_exists = File.file?(receipt_full_filespec(receipt))
156
+ filespec = receipt_full_filespec(receipt)
157
+ unused.delete(filespec)
158
+ file_exists = File.file?(filespec)
154
159
  list = (file_exists ? existing : missing)
155
160
  list << { receipt: receipt, journal: entry.doc_short_name }
156
161
  end
157
162
  end
158
- [missing, existing]
163
+ [missing, existing, unused]
159
164
  end
160
165
 
161
166
  def index_html_content
@@ -6,7 +6,8 @@ require_relative '../errors/date_range_error'
6
6
  module RockBooks
7
7
  class ChartOfAccounts
8
8
 
9
- attr_reader :doc_type, :title, :accounts, :entity, :start_date, :end_date
9
+ REQUIRED_FIELDS = %i(doc_type title accounts entity start_date end_date)
10
+ REQUIRED_FIELDS.each { |field| attr_reader(field) }
10
11
 
11
12
 
12
13
  def self.from_file(file)
@@ -23,6 +24,14 @@ class ChartOfAccounts
23
24
  @accounts = []
24
25
  input_lines.each { |line| parse_line(line) }
25
26
  # TODO: Add validation for required fields.
27
+
28
+ missing_fields = REQUIRED_FIELDS.select do |field|
29
+ instance_variable_get("@#{field}").nil?
30
+ end
31
+
32
+ unless missing_fields.empty?
33
+ raise Error.new("Chart of accounts lacks required fields: #{missing_fields.join(', ')}")
34
+ end
26
35
  end
27
36
 
28
37
 
@@ -36,36 +45,42 @@ class ChartOfAccounts
36
45
  end
37
46
 
38
47
  def parse_line(line)
39
- case line.strip
40
- when /^@doc_type:/
41
- @doc_type = line.split('@doc_type:').last.strip
42
- when /^@entity:/
43
- @entity ||= line.split('@entity:').last.strip
44
- when /^@title:/
45
- @title = line.split('@title:').last.strip
46
- when /^@start_date:/
47
- @start_date = parse_date(line.split('@start_date:').last.strip)
48
- when /^@end_date:/
49
- @end_date = parse_date(line.split('@end_date:').last.strip)
50
- when /^$/
51
- # ignore empty line
52
- when /^#/
53
- # ignore comment line
54
- else
55
- # this is an account line in the form: 101 Asset First National City Bank
56
- # The regex below gets everything before the first whitespace in token 1, and the rest in token 2.
57
- matcher = line.match(/^(\S+)\s+(.*)$/)
58
- code = matcher[1]
59
- rest = matcher[2]
60
-
61
- matcher = rest.match(/^(\S+)\s+(.*)$/)
62
- account_type_token = matcher[1]
63
- account_type = AccountType.to_type(account_type_token).symbol
64
-
65
- name = matcher[2]
66
-
67
- accounts << Account.new(code, account_type, name)
48
+ begin
49
+ case line.strip
50
+ when /^@doc_type:/
51
+ @doc_type = line.split('@doc_type:').last.strip
52
+ when /^@entity:/
53
+ @entity ||= line.split('@entity:').last.strip
54
+ when /^@title:/
55
+ @title = line.split('@title:').last.strip
56
+ when /^@start_date:/
57
+ @start_date = parse_date(line.split('@start_date:').last.strip)
58
+ when /^@end_date:/
59
+ @end_date = parse_date(line.split('@end_date:').last.strip)
60
+ when /^$/
61
+ # ignore empty line
62
+ when /^#/
63
+ # ignore comment line
64
+ else
65
+ # this is an account line in the form: 101 Asset First National City Bank
66
+ # The regex below gets everything before the first whitespace in token 1, and the rest in token 2.
67
+ matcher = line.match(/^(\S+)\s+(.*)$/)
68
+ code = matcher[1]
69
+ rest = matcher[2]
70
+
71
+ matcher = rest.match(/^(\S+)\s+(.*)$/)
72
+ account_type_token = matcher[1]
73
+ account_type = AccountType.to_type(account_type_token).symbol
74
+
75
+ name = matcher[2]
76
+
77
+ accounts << Account.new(code, account_type, name)
78
+ end
79
+ rescue => e
80
+ puts "Error parsing chart of accounts. Line text is:\n#{line}\n\n"
81
+ raise
68
82
  end
83
+
69
84
  end
70
85
 
71
86