rock_books 0.1.6 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (262) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +5 -0
  3. data/LICENSE.txt +201 -21
  4. data/README.md +64 -142
  5. data/RELEASE_NOTES.md +38 -0
  6. data/lib/rock_books/cmd_line/command_line_interface.rb +30 -10
  7. data/lib/rock_books/documents/book_set.rb +5 -99
  8. data/lib/rock_books/documents/chart_of_accounts.rb +66 -29
  9. data/lib/rock_books/documents/journal.rb +45 -40
  10. data/lib/rock_books/documents/journal_entry_builder.rb +11 -5
  11. data/lib/rock_books/errors/date_range_error.rb +20 -0
  12. data/lib/rock_books/helpers/html_helper.rb +29 -0
  13. data/lib/rock_books/reports/balance_sheet.rb +2 -2
  14. data/lib/rock_books/reports/book_set_reporter.rb +201 -0
  15. data/lib/rock_books/reports/income_statement.rb +2 -2
  16. data/lib/rock_books/reports/index.html.erb +156 -0
  17. data/lib/rock_books/reports/receipts.html.erb +54 -0
  18. data/lib/rock_books/reports/receipts_report.rb +23 -10
  19. data/lib/rock_books/reports/report_context.rb +1 -6
  20. data/lib/rock_books/reports/reporter.rb +1 -1
  21. data/lib/rock_books/reports/transaction_report.rb +4 -2
  22. data/lib/rock_books/version.rb +1 -1
  23. data/manual.md +251 -0
  24. data/rock_books.gemspec +4 -3
  25. data/sample_data/minimal/receipts/01/2018-01-01-sample-receipt.jpg +0 -0
  26. data/sample_data/minimal/rockbooks-inputs/{2017-xyz-chart-of-accounts.txt → 2018-xyz-chart-of-accounts.txt} +3 -1
  27. data/sample_data/minimal/rockbooks-inputs/{2017-xyz-checking-journal.txt → 2018-xyz-checking-journal.txt} +3 -6
  28. data/sample_data/minimal/rockbooks-inputs/{2017-xyz-general-journal.txt → 2018-xyz-general-journal.txt} +3 -3
  29. data/sample_data/minimal/rockbooks-inputs/2018-xyz-visa-journal.txt +32 -0
  30. data/sample_data/minimal/rockbooks-reports/html/all_txns_by_acct.html +467 -454
  31. data/sample_data/minimal/rockbooks-reports/html/all_txns_by_amount.html +90 -84
  32. data/sample_data/minimal/rockbooks-reports/html/all_txns_by_date.html +89 -83
  33. data/sample_data/minimal/rockbooks-reports/html/balance_sheet.html +35 -35
  34. data/sample_data/minimal/rockbooks-reports/html/ck.hsbc.disb.html +27 -27
  35. data/sample_data/minimal/rockbooks-reports/html/ck_hsbc_disb.html +40 -0
  36. data/sample_data/minimal/rockbooks-reports/html/general.html +28 -28
  37. data/sample_data/minimal/rockbooks-reports/html/hsbc_visa.html +45 -40
  38. data/sample_data/minimal/rockbooks-reports/html/income_statement.html +33 -32
  39. data/sample_data/minimal/rockbooks-reports/html/index.html +271 -0
  40. data/sample_data/minimal/rockbooks-reports/html/receipts.html +28 -27
  41. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_accts.rec.html +14 -14
  42. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_accts_rec.html +27 -0
  43. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_bank.fees.html +14 -14
  44. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_bank_fees.html +27 -0
  45. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_books.refs.html +14 -14
  46. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_books_refs.html +27 -0
  47. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_cc.hsbc.visa.html +61 -54
  48. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_cc.proc.html +14 -14
  49. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_cc_hsbc_visa.html +74 -0
  50. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_cc_proc.html +27 -0
  51. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_ck.hsbc.html +32 -32
  52. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_ck_hsbc.html +45 -0
  53. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_conf.fees.html +23 -23
  54. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_conf_fees.html +36 -0
  55. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_cowork.fees.html +29 -29
  56. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_cowork_fees.html +42 -0
  57. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_govt.fees.html +14 -14
  58. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_govt_fees.html +27 -0
  59. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_inet.fees.html +14 -14
  60. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_inet_fees.html +27 -0
  61. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_insurance.html +23 -23
  62. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_int.exp.html +14 -14
  63. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_int_exp.html +27 -0
  64. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_loan.to.sh.html +34 -34
  65. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_loan_to_sh.html +47 -0
  66. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_meals.ent.html +14 -14
  67. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_meals_ent.html +27 -0
  68. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_misc.exp.html +14 -14
  69. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_misc_exp.html +27 -0
  70. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_mktng.exp.html +14 -14
  71. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_mktng_exp.html +27 -0
  72. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_own.equity.html +22 -22
  73. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_own_equity.html +35 -0
  74. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_paypal.html +14 -14
  75. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_prof.fees.html +14 -14
  76. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_prof_fees.html +27 -0
  77. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_repair.maint.html +14 -14
  78. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_repair_maint.html +27 -0
  79. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_ret.earn.html +14 -14
  80. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_ret_earn.html +27 -0
  81. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_ship.exp.html +14 -14
  82. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_ship_exp.html +27 -0
  83. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_sls.cons.html +22 -22
  84. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_sls_cons.html +35 -0
  85. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_supplies.html +23 -14
  86. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_sw.exp.html +14 -14
  87. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_sw_exp.html +27 -0
  88. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_tr.airfare.html +22 -22
  89. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_tr.autorent.html +14 -14
  90. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_tr.gas.etc.html +14 -14
  91. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_tr.govt.html +14 -14
  92. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_tr.lodging.html +23 -23
  93. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_tr.m.e.html +14 -14
  94. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_tr.m.i.html +14 -14
  95. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_tr.mileage.html +22 -22
  96. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_tr.misc.html +14 -14
  97. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_tr.parking.html +14 -14
  98. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_tr.perdiem.mi.html +22 -22
  99. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_tr.taxi.html +14 -14
  100. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_tr.trainfare.html +14 -14
  101. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_tr.unclass.html +14 -14
  102. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_tr_airfare.html +35 -0
  103. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_tr_autorent.html +27 -0
  104. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_tr_gas_etc.html +27 -0
  105. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_tr_govt.html +27 -0
  106. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_tr_lodging.html +36 -0
  107. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_tr_m_e.html +27 -0
  108. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_tr_m_i.html +27 -0
  109. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_tr_mileage.html +35 -0
  110. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_tr_misc.html +27 -0
  111. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_tr_parking.html +27 -0
  112. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_tr_perdiem_mi.html +35 -0
  113. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_tr_taxi.html +27 -0
  114. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_tr_trainfare.html +27 -0
  115. data/sample_data/minimal/rockbooks-reports/html/single-account/acct_tr_unclass.html +27 -0
  116. data/sample_data/minimal/rockbooks-reports/pdf/all_txns_by_acct.pdf +0 -0
  117. data/sample_data/minimal/rockbooks-reports/pdf/all_txns_by_amount.pdf +0 -0
  118. data/sample_data/minimal/rockbooks-reports/pdf/all_txns_by_date.pdf +0 -0
  119. data/sample_data/minimal/rockbooks-reports/pdf/balance_sheet.pdf +0 -0
  120. data/sample_data/minimal/rockbooks-reports/pdf/ck.hsbc.disb.pdf +0 -0
  121. data/sample_data/minimal/rockbooks-reports/pdf/ck_hsbc_disb.pdf +0 -0
  122. data/sample_data/minimal/rockbooks-reports/pdf/general.pdf +0 -0
  123. data/sample_data/minimal/rockbooks-reports/pdf/hsbc_visa.pdf +0 -0
  124. data/sample_data/minimal/rockbooks-reports/pdf/income_statement.pdf +0 -0
  125. data/sample_data/minimal/rockbooks-reports/pdf/receipts.pdf +0 -0
  126. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_accts.rec.pdf +0 -0
  127. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_accts_rec.pdf +0 -0
  128. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_bank.fees.pdf +0 -0
  129. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_bank_fees.pdf +0 -0
  130. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_books.refs.pdf +0 -0
  131. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_books_refs.pdf +0 -0
  132. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_cc.hsbc.visa.pdf +0 -0
  133. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_cc.proc.pdf +0 -0
  134. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_cc_hsbc_visa.pdf +0 -0
  135. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_cc_proc.pdf +0 -0
  136. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_ck.hsbc.pdf +0 -0
  137. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_ck_hsbc.pdf +0 -0
  138. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_conf.fees.pdf +0 -0
  139. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_conf_fees.pdf +0 -0
  140. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_cowork.fees.pdf +0 -0
  141. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_cowork_fees.pdf +0 -0
  142. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_govt.fees.pdf +0 -0
  143. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_govt_fees.pdf +0 -0
  144. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_inet.fees.pdf +0 -0
  145. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_inet_fees.pdf +0 -0
  146. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_insurance.pdf +0 -0
  147. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_int.exp.pdf +0 -0
  148. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_int_exp.pdf +0 -0
  149. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_loan.to.sh.pdf +0 -0
  150. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_loan_to_sh.pdf +0 -0
  151. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_meals.ent.pdf +0 -0
  152. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_meals_ent.pdf +0 -0
  153. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_misc.exp.pdf +0 -0
  154. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_misc_exp.pdf +0 -0
  155. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_mktng.exp.pdf +0 -0
  156. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_mktng_exp.pdf +0 -0
  157. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_own.equity.pdf +0 -0
  158. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_own_equity.pdf +0 -0
  159. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_paypal.pdf +0 -0
  160. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_prof.fees.pdf +0 -0
  161. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_prof_fees.pdf +0 -0
  162. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_repair.maint.pdf +0 -0
  163. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_repair_maint.pdf +0 -0
  164. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_ret.earn.pdf +0 -0
  165. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_ret_earn.pdf +0 -0
  166. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_ship.exp.pdf +0 -0
  167. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_ship_exp.pdf +0 -0
  168. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_sls.cons.pdf +0 -0
  169. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_sls_cons.pdf +0 -0
  170. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_supplies.pdf +0 -0
  171. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_sw.exp.pdf +0 -0
  172. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_sw_exp.pdf +0 -0
  173. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_tr.airfare.pdf +0 -0
  174. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_tr.autorent.pdf +0 -0
  175. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_tr.gas.etc.pdf +0 -0
  176. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_tr.govt.pdf +0 -0
  177. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_tr.lodging.pdf +0 -0
  178. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_tr.m.e.pdf +0 -0
  179. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_tr.m.i.pdf +0 -0
  180. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_tr.mileage.pdf +0 -0
  181. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_tr.misc.pdf +0 -0
  182. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_tr.parking.pdf +0 -0
  183. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_tr.perdiem.mi.pdf +0 -0
  184. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_tr.taxi.pdf +0 -0
  185. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_tr.trainfare.pdf +0 -0
  186. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_tr.unclass.pdf +0 -0
  187. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_tr_airfare.pdf +0 -0
  188. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_tr_autorent.pdf +0 -0
  189. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_tr_gas_etc.pdf +0 -0
  190. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_tr_govt.pdf +0 -0
  191. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_tr_lodging.pdf +0 -0
  192. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_tr_m_e.pdf +0 -0
  193. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_tr_m_i.pdf +0 -0
  194. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_tr_mileage.pdf +0 -0
  195. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_tr_misc.pdf +0 -0
  196. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_tr_parking.pdf +0 -0
  197. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_tr_perdiem_mi.pdf +0 -0
  198. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_tr_taxi.pdf +0 -0
  199. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_tr_trainfare.pdf +0 -0
  200. data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_tr_unclass.pdf +0 -0
  201. data/sample_data/minimal/rockbooks-reports/txt/all_txns_by_acct.txt +56 -43
  202. data/sample_data/minimal/rockbooks-reports/txt/all_txns_by_amount.txt +29 -23
  203. data/sample_data/minimal/rockbooks-reports/txt/all_txns_by_date.txt +29 -23
  204. data/sample_data/minimal/rockbooks-reports/txt/balance_sheet.txt +4 -4
  205. data/sample_data/minimal/rockbooks-reports/txt/ck.hsbc.disb.txt +5 -5
  206. data/sample_data/minimal/rockbooks-reports/txt/ck_hsbc_disb.txt +24 -0
  207. data/sample_data/minimal/rockbooks-reports/txt/general.txt +5 -5
  208. data/sample_data/minimal/rockbooks-reports/txt/hsbc_visa.txt +18 -13
  209. data/sample_data/minimal/rockbooks-reports/txt/income_statement.txt +4 -3
  210. data/sample_data/minimal/rockbooks-reports/txt/receipts.txt +6 -5
  211. data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_accts_rec.txt +11 -0
  212. data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_bank_fees.txt +11 -0
  213. data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_books_refs.txt +11 -0
  214. data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_cc.hsbc.visa.txt +21 -14
  215. data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_cc_hsbc_visa.txt +58 -0
  216. data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_cc_proc.txt +11 -0
  217. data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_ck.hsbc.txt +4 -4
  218. data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_ck_hsbc.txt +29 -0
  219. data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_conf.fees.txt +2 -2
  220. data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_conf_fees.txt +20 -0
  221. data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_cowork.fees.txt +4 -4
  222. data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_cowork_fees.txt +26 -0
  223. data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_govt_fees.txt +11 -0
  224. data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_inet_fees.txt +11 -0
  225. data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_insurance.txt +3 -3
  226. data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_int_exp.txt +11 -0
  227. data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_loan.to.sh.txt +4 -4
  228. data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_loan_to_sh.txt +31 -0
  229. data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_meals_ent.txt +11 -0
  230. data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_misc_exp.txt +11 -0
  231. data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_mktng_exp.txt +11 -0
  232. data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_own.equity.txt +1 -1
  233. data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_own_equity.txt +19 -0
  234. data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_prof_fees.txt +11 -0
  235. data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_repair_maint.txt +11 -0
  236. data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_ret_earn.txt +11 -0
  237. data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_ship_exp.txt +11 -0
  238. data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_sls.cons.txt +2 -2
  239. data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_sls_cons.txt +19 -0
  240. data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_supplies.txt +11 -2
  241. data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_sw_exp.txt +11 -0
  242. data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_tr.airfare.txt +1 -1
  243. data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_tr.lodging.txt +2 -2
  244. data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_tr.mileage.txt +2 -2
  245. data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_tr.perdiem.mi.txt +1 -1
  246. data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_tr_airfare.txt +19 -0
  247. data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_tr_autorent.txt +11 -0
  248. data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_tr_gas_etc.txt +11 -0
  249. data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_tr_govt.txt +11 -0
  250. data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_tr_lodging.txt +20 -0
  251. data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_tr_m_e.txt +11 -0
  252. data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_tr_m_i.txt +11 -0
  253. data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_tr_mileage.txt +19 -0
  254. data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_tr_misc.txt +11 -0
  255. data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_tr_parking.txt +11 -0
  256. data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_tr_perdiem_mi.txt +19 -0
  257. data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_tr_taxi.txt +11 -0
  258. data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_tr_trainfare.txt +11 -0
  259. data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_tr_unclass.txt +11 -0
  260. metadata +147 -15
  261. data/sample_data/minimal/receipts/01/2017-01-20-phoenix-hampton.pdf +0 -0
  262. data/sample_data/minimal/rockbooks-inputs/2017-xyz-visa-journal.txt +0 -27
@@ -0,0 +1,54 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <body>
4
+
5
+ <h1><%= chart_of_accounts.entity %> -- Receipts</h1>
6
+ <p>Reports Generated at <%= DateTime.now.strftime('%Y-%m-%d_%H-%M-%S') %> by RockBooks version <%=RockBooks::VERSION %></p>
7
+ <br />
8
+
9
+ <% receipts.each %>
10
+ <h2>Financial Statements</h2>
11
+ <ul>
12
+ <li><a href='balance_sheet.html'>Balance Sheet</a></li>
13
+ <li><a href='income_statement.html'>Income Statement</a></li>
14
+ </ul>
15
+
16
+ <h2>All Transactions</h2>
17
+ <ul>
18
+ <li><a href="all_txns_by_acct.html">By Account</a></li>
19
+ <li><a href="all_txns_by_amount.html">By Amount</a></li>
20
+ <li><a href="all_txns_by_date.html">By Date</a></li>
21
+ </ul>
22
+
23
+ <h2>Journals</h2>
24
+ <ul>
25
+ <% journals.each do |journal|
26
+ filespec = journal.short_name + '.html'
27
+ caption = "#{journal.title} -- #{journal.short_name} -- #{journal.account_code}"
28
+ %>
29
+ <li><a href="<%= filespec %>"><%= caption %></a></li>
30
+ <% end %>
31
+ </ul>
32
+
33
+ <h2>Individual Accounts</h2>
34
+ <ul>
35
+
36
+ <%
37
+ chart_of_accounts.accounts.each do |account|
38
+ filespec = File.join('single-account', "acct_#{account.code}.html")
39
+ caption = "#{account.name} (#{account.code})"
40
+ %>
41
+ <li><a href="<%= filespec %>"><%= caption %></a></li>
42
+ <% end %>
43
+ </ul>
44
+
45
+
46
+ <h2>Receipts</h2>
47
+ <ul>
48
+ <% if run_options.do_receipts %>
49
+ <li><a href="receipts.html">Missing and Existing Receipts</a></li>
50
+ <% end %>
51
+ </ul>
52
+
53
+ </body>
54
+ </html>
@@ -6,13 +6,14 @@ class ReceiptsReport
6
6
 
7
7
  include Reporter
8
8
 
9
- attr_reader :context, :missing, :existing
9
+ attr_reader :context, :missing, :existing, :unused
10
10
 
11
11
 
12
- def initialize(report_context, missing, existing)
12
+ def initialize(report_context, missing, existing, unused)
13
13
  @context = report_context
14
14
  @missing = missing
15
15
  @existing = existing
16
+ @unused = unused
16
17
  end
17
18
 
18
19
 
@@ -21,9 +22,6 @@ class ReceiptsReport
21
22
  lines << center(context.entity || 'Unspecified Entity')
22
23
  lines << "#{center("Receipts Report")}"
23
24
  lines << banner_line
24
- lines << ''
25
- lines << ''
26
- lines << ''
27
25
  lines.join("\n")
28
26
  end
29
27
 
@@ -39,15 +37,30 @@ class ReceiptsReport
39
37
  end
40
38
 
41
39
 
40
+ def report_one_section(name, list)
41
+ output = ''
42
+ output << "\n\n\n#{name} Receipts:\n\n" << column_headings
43
+ if list.empty?
44
+ output << "[None]\n\n\n"
45
+ else
46
+ list.each { |receipt| output << receipt_info_line(receipt) }
47
+ end
48
+ output
49
+ end
50
+
51
+
42
52
  def generate_report
43
53
  output = generate_header
54
+ output << report_one_section('Missing', missing)
44
55
 
45
- output << "Missing Receipts:\n\n" << column_headings
46
- missing.each { |info| output << receipt_info_line(info) }
47
-
48
- output << "\n\n\nExisting Receipts:\n\n" << column_headings
49
- existing.each { |info| output << receipt_info_line(info) }
56
+ output << "\n\n\nUnused Receipts:\n\n"
57
+ if unused.empty?
58
+ output << "[None]\n\n\n"
59
+ else
60
+ unused.each { |filespec| output << filespec << "\n" }
61
+ end
50
62
 
63
+ output << report_one_section('Existing', existing)
51
64
  output
52
65
  end
53
66
 
@@ -1,11 +1,6 @@
1
1
  module RockBooks
2
2
 
3
- class ReportContext < Struct.new(
4
- :chart_of_accounts,
5
- :journals,
6
- :start_date,
7
- :end_date,
8
- :page_width)
3
+ class ReportContext < Struct.new(:chart_of_accounts, :journals, :page_width)
9
4
 
10
5
  def entity
11
6
  chart_of_accounts.entity
@@ -95,7 +95,7 @@ module Reporter
95
95
  acct_amounts = entry.acct_amounts
96
96
 
97
97
  # "2017-10-29 hsbc_visa":
98
- output = entry.date.to_s << ' ' << (SHORT_NAME_FORMAT_STRING % entry.doc_short_name)
98
+ output = entry.date.to_s << ' ' << (SHORT_NAME_FORMAT_STRING % entry.doc_short_name) << ' '
99
99
 
100
100
  indent = ' ' * output.length
101
101
 
@@ -37,7 +37,7 @@ class TransactionReport
37
37
  def format_entry_first_acct_amount(entry)
38
38
  entry.date.to_s \
39
39
  << ' ' \
40
- << format_acct_amount(entry.acct_amounts.first) \
40
+ << format_acct_amount(entry.acct_amounts.last) \
41
41
  << "\n"
42
42
  end
43
43
 
@@ -89,7 +89,9 @@ class TransactionReport
89
89
  entries = entries.select { |entry| filter.(entry) }
90
90
  end
91
91
 
92
- entries.each { |entry| sio << format_entry(entry) << "\n" }
92
+ entries.each do |entry|
93
+ sio << format_entry(entry) << "\n"
94
+ end
93
95
  totals = AcctAmount.aggregate_amounts_by_account(JournalEntry.entries_acct_amounts(entries))
94
96
  sio << generate_and_format_totals('Totals', totals)
95
97
  sio.string
@@ -1,3 +1,3 @@
1
1
  module RockBooks
2
- VERSION = "0.1.6"
2
+ VERSION = "0.6.0"
3
3
  end
@@ -0,0 +1,251 @@
1
+ # RockBooks Manual
2
+
3
+
4
+ | Note: |
5
+ | ---- |
6
+ | See also the [README.md file](README.md) for an overview of high level concepts. |
7
+
8
+
9
+ ### Getting Started
10
+
11
+ Install the RockBooks software:
12
+
13
+ `gem install rock_books`
14
+
15
+ It is recommended that you create a directory structure such as this:
16
+
17
+ ```.
18
+ ├── 2018-xyz-inc
19
+ │   ├── invoices
20
+ │   ├── receipts
21
+ │   ├── references
22
+ │   ├── rockbooks-inputs
23
+ │   ├── rockbooks-reports
24
+ │   ├── statements
25
+ │   └── worksheets
26
+ ```
27
+
28
+ The top level is a directory containing your data for a given entity for a single reporting period (probably a year).
29
+
30
+ Here are the subdirectories:
31
+
32
+ * `rockbooks-inputs` - all input documents (chart of accounts, journals)
33
+ * `rockbooks-reports` - all generated reports and web content
34
+ * `receipts`
35
+ * `invoices`
36
+ * `references`
37
+ * `statements`
38
+ * `worksheets`
39
+
40
+ The last five can contain your non-RockBooks specific files that you would normally keep anyway. These directories will be offered by the reports home page web interface merely to navigate the filesystem, with links to view the files using the default application for that file type. Receipts are handled specially though -- you can specify a receipt in a journal and it will be checked for existence in the Receipts report. In the future we hope to generate hyperlinks to both receipts and invoices in the journal reports.
41
+
42
+ Feel free to organize your files in subdirectories of these directories in whatever way makes sense to you. I have subdirectories of `receipts` for each month (`01`, `02` ... `12`).
43
+
44
+
45
+ ### Version Control
46
+
47
+ Tracking this directory tree with version control software such as `git` in a private repository is _highly_ recommended because it provides:
48
+
49
+ * free cloud backup with Github, Gitlab, and/or Bitbucket
50
+ * an audit trail with human readable diffs
51
+ * manageable collaboration
52
+
53
+
54
+ ### Chart of Accounts
55
+
56
+ You will need a chart of accounts in the `rockbooks-inputs` directory. A sample chart of accounts is provided in the sample data (see [sample_data/minimal/rockbooks-inputs/2018-xyz-chart-of-accounts.txt](sample_data/minimal/rockbooks-inputs/2018-xyz-chart-of-accounts.txt)).
57
+
58
+
59
+ ### Journals
60
+
61
+ You will need journals. Usually there would be one journal per external financial institution accounts, such as checking and credit card accounts. Samples have been provided in the sample_data/minimal/rockbooks-inputs directory of the gem:
62
+
63
+ * [Checking](sample_data/minimal/rockbooks-inputs/2018-xyz-checking-journal.txt)
64
+ * [Credit Card](sample_data/minimal/rockbooks-inputs/2018-xyz-visa-journal.txt)
65
+
66
+
67
+ ### General Journal
68
+
69
+ The general journal is a special journal that is not associated with any particular account. One use of the general journal is for entering the balances of the assets, liabilities, and equity accounts at the beginning of the reporting period (usually a year). A sample general journal is at [sample_data/minimal/rockbooks-inputs/2018-xyz-general-journal.txt](sample_data/minimal/rockbooks-inputs/2018-xyz-general-journal.txt).
70
+
71
+ The general journal is a special case of journal because transactions in it do not have an implied account (e.g. the checking account for a checking account journal); both sides of the transaction need to be explicitly specified. This is its strength and purpose; it is intended to be used where a transaction would not fit in a regular journal.
72
+
73
+
74
+ ### Terminology Usage
75
+
76
+ * _data file_ - a RockBooks input data file, which is a text file with the extension `.txt`
77
+
78
+ * _document_ - a RockBooks logical document such as a chart of accounts, a journal, etc., usually containing information parsed from a data file
79
+
80
+ * _input records_ - repeating records appropriate to the document type, i.e. accounts for the chart of accounts and transactions for journals
81
+
82
+ * _document properties_ - per document properties such as title, account; property names are preceded by `@` and initialized like this: `@account: ck_abc`.
83
+
84
+
85
+ ### Input Data File Format
86
+
87
+ #### Plain Text
88
+
89
+ Input data files are plain text files. We recommend using a text editor and _not_ a word processor for them. If you don't already have a favorite text editor, some excellent graphical text editors are [VS Code](https://code.visualstudio.com/), [Atom](https://atom.io/), and [Brackets](http://brackets.io/).
90
+
91
+ Fields are space separated; any number of spaces can be used.
92
+
93
+ #### Comment Lines
94
+
95
+ Lines beginning with `#` will be ignored when the input data is parsed. Comment lines are useful for:
96
+
97
+ * explanations of the input itself
98
+ * information that you would like to be available for deeper research or examination but not printed in the reports
99
+
100
+ #### Document Properties
101
+
102
+ Data lines that contain the value of document properties,
103
+ as opposed to input records, will be expressed as lines beginning with `@`:
104
+
105
+ ```
106
+ @doc_type: journal
107
+ @title: "ABC Bank Checking Account Disbursements Journal"
108
+ @account: ck_abc
109
+ ```
110
+
111
+ #### Input Records
112
+
113
+ Input records are multiple records for the type appropriate to the document:
114
+
115
+ * chart of accounts - each account
116
+ * journals - each transaction
117
+
118
+ Input records are, in general, entered into the text files after all properties. One exception is that the `@date_prefix` is often specified in multiple places in the journal, usually with a new month (e.g. `@date_prefix: 2018-11`).
119
+
120
+
121
+
122
+ Data lines will contain fields that an be separated with an arbitrary number of spaces, e.g.:
123
+
124
+ ```
125
+ 2018-05-18 123.45 supplies
126
+ ```
127
+
128
+ In journals, all entries will begin with dates, and all dates begin with numerals, so the
129
+ presence of a numeral in the first column will be interpreted as the beginning of a new
130
+ transaction (entry). Any lines following it not beginning with a `#` or number will be
131
+ assumed to be the textual description of the transaction, and will be saved along with
132
+ its other data and included in reports.
133
+
134
+ In order to make the entry of dates more convenient, many documents will support
135
+ a `@date_prefix` property that will be prepended to dates. For example, if this prefix
136
+ contains `2018-`, then subsequent dates must exclude that prefix since it will be
137
+ automatically prepended. So, for example, a journal might contain the following lines:
138
+
139
+ ```
140
+ @date_prefix: 2018-
141
+ # ...more lines...
142
+ 05-29 37.50 ofc.spls
143
+ 05-30 22.20 tr.taxi
144
+ ```
145
+
146
+ All date strings must use the format `YYYY-MM-DD`, because that's what will be expected
147
+ by the application when it converts the date strings into numeric dates.
148
+
149
+
150
+
151
+ ### Chart of Accounts
152
+
153
+ Pretty much everything in this application assumes the presence of a chart of accounts
154
+ listing the accounts, including their codes, types, and names.
155
+
156
+ You'll need to provide a chart of accounts file that includes the following line in the header:
157
+
158
+ `@document_type: chart_of_accounts`
159
+
160
+ This file should contain the accounts
161
+ that will be used. Each account should contain the following fields:
162
+
163
+ | Property Name | Description |
164
+ | ------------- | ------------- |
165
+ | code | a short string with which to identify an account, e.g. `ret.earn` for retained earnings
166
+ | type | 'A' for asset, 'L' for liability, 'O' for (owners) equity, 'I' for income, and 'E' for expenses.
167
+ | name | a longer more descriptive name, used in reports, so no more than 30 or so characters long is recommended
168
+
169
+
170
+ So, the chart of accounts data might include something like this:
171
+
172
+ ```
173
+ ck.xyz A XYZ Bank Checking Account
174
+ loan.owner L Loan Payable to Owner
175
+ o.equity O Owner's Equity
176
+ sls.cons I Consulting Sales
177
+ tr.airfare E Travel - Air Fare
178
+ ```
179
+
180
+ Although hyphens and underscores are typically used to logically separate string fragments,
181
+ we recommend periods; they're much easier to type, and you'll be doing a _lot_ of typing.
182
+
183
+ There is no maximum length for account codes, and reports will automatically align based
184
+ on the longest account code. However, keep in mind that you will need to type these codes,
185
+ and they will consume space in reports.
186
+
187
+ For clarity, it is recommended that all accounts for each of the five account types be grouped together. That is, list all the assets first, then all the liabilities, etc.
188
+
189
+
190
+ ### Journals
191
+
192
+ There is no particular restriction on what journals should be used, or which transactions should go in which journal. Do whatever makes the most sense in the context of your entity's financial activities. Each journal is merely an entry point for data into the ultimate list of transactions used to arrive at account balances. You could even (theoretically) have multiple journals for the same bank account, such as one per quarter or month, if that made them more manageable for you.
193
+
194
+ Here are some examples of possible journals:
195
+
196
+ * a checking account
197
+ * a credit card account
198
+ * a Paypal account
199
+ * sales (all sales, or 1 journal per client)
200
+ * a loan to/from shareholder/owner account
201
+
202
+ Each journal data file needs to contain:
203
+
204
+ `@doc_type: journal`
205
+
206
+ Also, it needs to identify the code of the account the journal is representing.
207
+ So for example, if it is a journal of a PayPal account, and the PayPal
208
+ account's code is `paypal`, then you'll need a line like this in your journal file:
209
+
210
+ `@account_code: paypal`
211
+
212
+ For your convenience, when entering transactions in a journal (but _not_ a _general_ journal),
213
+ you may enter all numbers going in the direction natural for that journal as positive numbers.
214
+
215
+ For example, a _Cash Disbursements Journal_ (something like a
216
+ check register) for an account that has more outgoing than incoming transactions, may contain a transaction like this:
217
+
218
+ ```
219
+ 05-29 37.50 ofc.spls
220
+ ```
221
+
222
+ There may be many transactions in your journal, and it would be cumbersome to have to
223
+ type minus signs in front of all of them if they were credits.
224
+
225
+ Because of this, the program allows you to configure each journal as to the direction
226
+ (debit or credit) of the transaction. This is done with the `@debit_or_credit` property.
227
+
228
+ For an asset journal whose numbers will be crediting the main account
229
+ (e.g. a cash disbursements journal whose entries will primarily be crediting
230
+ the cash account), you would set the property to `debit`:
231
+
232
+ ```
233
+ @debit_or_credit: debit
234
+ ```
235
+
236
+
237
+ #### General Journal
238
+
239
+ The general journal is a special form of journal that does not have a primary account.
240
+
241
+ In this journal, debits and credits need to be specified literally as account code/amount
242
+ pairs, where positive numbers will result in debits, and negative numbers will result in credits, e.g.:
243
+
244
+ ```
245
+ 03-10 tr.perdiem.mi 495.00 loan.to.sh -495.00
246
+ Per Diem allowance for conference trip
247
+ ```
248
+
249
+
250
+
251
+
@@ -30,10 +30,11 @@ Gem::Specification.new do |spec|
30
30
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
31
31
  spec.require_paths = ["lib"]
32
32
 
33
- spec.add_dependency 'awesome_print', '> 0'
33
+ spec.add_dependency 'amazing_print', '> 0'
34
+ spec.add_dependency 'os', '> 1.0.0'
34
35
  spec.add_dependency 'pry', '> 0.0.0'
35
36
 
36
- spec.add_development_dependency "bundler", "~> 1.16"
37
- spec.add_development_dependency "rake", "~> 10.0"
37
+ spec.add_development_dependency "bundler", "~> 2.0"
38
+ spec.add_development_dependency "rake", ">= 12.3.3"
38
39
  spec.add_development_dependency "rspec", "~> 3.0"
39
40
  end
@@ -1,6 +1,8 @@
1
1
  @doc_type: chart_of_accounts
2
- @title: Chart of Accounts - 2017
2
+ @title: Chart of Accounts - 2018
3
3
  @entity: XYZ Consulting, Inc.
4
+ @start_date: 2018-01-01
5
+ @end_date: 2018-12-31
4
6
 
5
7
 
6
8
  # Assets
@@ -1,9 +1,9 @@
1
1
  @doc_type: journal
2
- @title: HSBC Checking Disbursements Journal - 2017
2
+ @title: HSBC Checking Disbursements Journal - 2018
3
3
  @account_code: ck.hsbc
4
4
  @debit_or_credit: debit
5
5
  @short_name: ck.hsbc.disb
6
- @date_prefix: 2017-
6
+ @date_prefix: 2018-
7
7
 
8
8
  01-01 -5000.00 own.equity
9
9
  Initial Deposit from Shareholder
@@ -11,7 +11,4 @@ Initial Deposit from Shareholder
11
11
  01-05 2000.00 cc.hsbc.visa
12
12
 
13
13
  01-07 -10000.00 sls.cons
14
- Invoice #437, Dec. 2016 work, ABC, Inc.
15
-
16
-
17
-
14
+ Invoice #437, Dec. 2017 work, ABC, Inc.