rock_books 0.1.6 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/README.md +62 -144
- data/RELEASE_NOTES.md +8 -0
- data/lib/rock_books/cmd_line/command_line_interface.rb +11 -2
- data/lib/rock_books/documents/book_set.rb +53 -21
- data/lib/rock_books/documents/chart_of_accounts.rb +27 -5
- data/lib/rock_books/documents/index.html.erb +156 -0
- data/lib/rock_books/documents/journal_entry_builder.rb +11 -5
- data/lib/rock_books/documents/receipts.html.erb +54 -0
- data/lib/rock_books/errors/date_range_error.rb +20 -0
- data/lib/rock_books/reports/balance_sheet.rb +2 -2
- data/lib/rock_books/reports/income_statement.rb +2 -2
- data/lib/rock_books/reports/report_context.rb +0 -2
- data/lib/rock_books/version.rb +1 -1
- data/manual.md +251 -0
- data/sample_data/minimal/receipts/01/2018-01-01-sample-receipt.jpg +0 -0
- data/sample_data/minimal/rockbooks-inputs/{2017-xyz-chart-of-accounts.txt → 2018-xyz-chart-of-accounts.txt} +3 -1
- data/sample_data/minimal/rockbooks-inputs/{2017-xyz-checking-journal.txt → 2018-xyz-checking-journal.txt} +3 -6
- data/sample_data/minimal/rockbooks-inputs/{2017-xyz-general-journal.txt → 2018-xyz-general-journal.txt} +3 -3
- data/sample_data/minimal/rockbooks-inputs/2018-xyz-visa-journal.txt +32 -0
- data/sample_data/minimal/rockbooks-reports/html/all_txns_by_acct.html +467 -454
- data/sample_data/minimal/rockbooks-reports/html/all_txns_by_amount.html +90 -84
- data/sample_data/minimal/rockbooks-reports/html/all_txns_by_date.html +89 -83
- data/sample_data/minimal/rockbooks-reports/html/balance_sheet.html +35 -35
- data/sample_data/minimal/rockbooks-reports/html/ck.hsbc.disb.html +27 -27
- data/sample_data/minimal/rockbooks-reports/html/general.html +28 -28
- data/sample_data/minimal/rockbooks-reports/html/hsbc_visa.html +45 -40
- data/sample_data/minimal/rockbooks-reports/html/income_statement.html +33 -32
- data/sample_data/minimal/rockbooks-reports/html/receipts.html +28 -27
- data/sample_data/minimal/rockbooks-reports/html/single-account/acct_accts.rec.html +14 -14
- data/sample_data/minimal/rockbooks-reports/html/single-account/acct_bank.fees.html +14 -14
- data/sample_data/minimal/rockbooks-reports/html/single-account/acct_books.refs.html +14 -14
- data/sample_data/minimal/rockbooks-reports/html/single-account/acct_cc.hsbc.visa.html +61 -54
- data/sample_data/minimal/rockbooks-reports/html/single-account/acct_cc.proc.html +14 -14
- data/sample_data/minimal/rockbooks-reports/html/single-account/acct_ck.hsbc.html +32 -32
- data/sample_data/minimal/rockbooks-reports/html/single-account/acct_conf.fees.html +23 -23
- data/sample_data/minimal/rockbooks-reports/html/single-account/acct_cowork.fees.html +29 -29
- data/sample_data/minimal/rockbooks-reports/html/single-account/acct_govt.fees.html +14 -14
- data/sample_data/minimal/rockbooks-reports/html/single-account/acct_inet.fees.html +14 -14
- data/sample_data/minimal/rockbooks-reports/html/single-account/acct_insurance.html +23 -23
- data/sample_data/minimal/rockbooks-reports/html/single-account/acct_int.exp.html +14 -14
- data/sample_data/minimal/rockbooks-reports/html/single-account/acct_loan.to.sh.html +34 -34
- data/sample_data/minimal/rockbooks-reports/html/single-account/acct_meals.ent.html +14 -14
- data/sample_data/minimal/rockbooks-reports/html/single-account/acct_misc.exp.html +14 -14
- data/sample_data/minimal/rockbooks-reports/html/single-account/acct_mktng.exp.html +14 -14
- data/sample_data/minimal/rockbooks-reports/html/single-account/acct_own.equity.html +22 -22
- data/sample_data/minimal/rockbooks-reports/html/single-account/acct_paypal.html +14 -14
- data/sample_data/minimal/rockbooks-reports/html/single-account/acct_prof.fees.html +14 -14
- data/sample_data/minimal/rockbooks-reports/html/single-account/acct_repair.maint.html +14 -14
- data/sample_data/minimal/rockbooks-reports/html/single-account/acct_ret.earn.html +14 -14
- data/sample_data/minimal/rockbooks-reports/html/single-account/acct_ship.exp.html +14 -14
- data/sample_data/minimal/rockbooks-reports/html/single-account/acct_sls.cons.html +22 -22
- data/sample_data/minimal/rockbooks-reports/html/single-account/acct_supplies.html +23 -14
- data/sample_data/minimal/rockbooks-reports/html/single-account/acct_sw.exp.html +14 -14
- data/sample_data/minimal/rockbooks-reports/html/single-account/acct_tr.airfare.html +22 -22
- data/sample_data/minimal/rockbooks-reports/html/single-account/acct_tr.autorent.html +14 -14
- data/sample_data/minimal/rockbooks-reports/html/single-account/acct_tr.gas.etc.html +14 -14
- data/sample_data/minimal/rockbooks-reports/html/single-account/acct_tr.govt.html +14 -14
- data/sample_data/minimal/rockbooks-reports/html/single-account/acct_tr.lodging.html +23 -23
- data/sample_data/minimal/rockbooks-reports/html/single-account/acct_tr.m.e.html +14 -14
- data/sample_data/minimal/rockbooks-reports/html/single-account/acct_tr.m.i.html +14 -14
- data/sample_data/minimal/rockbooks-reports/html/single-account/acct_tr.mileage.html +22 -22
- data/sample_data/minimal/rockbooks-reports/html/single-account/acct_tr.misc.html +14 -14
- data/sample_data/minimal/rockbooks-reports/html/single-account/acct_tr.parking.html +14 -14
- data/sample_data/minimal/rockbooks-reports/html/single-account/acct_tr.perdiem.mi.html +22 -22
- data/sample_data/minimal/rockbooks-reports/html/single-account/acct_tr.taxi.html +14 -14
- data/sample_data/minimal/rockbooks-reports/html/single-account/acct_tr.trainfare.html +14 -14
- data/sample_data/minimal/rockbooks-reports/html/single-account/acct_tr.unclass.html +14 -14
- data/sample_data/minimal/rockbooks-reports/pdf/all_txns_by_acct.pdf +0 -0
- data/sample_data/minimal/rockbooks-reports/pdf/all_txns_by_amount.pdf +0 -0
- data/sample_data/minimal/rockbooks-reports/pdf/all_txns_by_date.pdf +0 -0
- data/sample_data/minimal/rockbooks-reports/pdf/balance_sheet.pdf +0 -0
- data/sample_data/minimal/rockbooks-reports/pdf/ck.hsbc.disb.pdf +0 -0
- data/sample_data/minimal/rockbooks-reports/pdf/general.pdf +0 -0
- data/sample_data/minimal/rockbooks-reports/pdf/hsbc_visa.pdf +0 -0
- data/sample_data/minimal/rockbooks-reports/pdf/income_statement.pdf +0 -0
- data/sample_data/minimal/rockbooks-reports/pdf/receipts.pdf +0 -0
- data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_accts.rec.pdf +0 -0
- data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_bank.fees.pdf +0 -0
- data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_books.refs.pdf +0 -0
- data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_cc.hsbc.visa.pdf +0 -0
- data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_cc.proc.pdf +0 -0
- data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_ck.hsbc.pdf +0 -0
- data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_conf.fees.pdf +0 -0
- data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_cowork.fees.pdf +0 -0
- data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_govt.fees.pdf +0 -0
- data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_inet.fees.pdf +0 -0
- data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_insurance.pdf +0 -0
- data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_int.exp.pdf +0 -0
- data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_loan.to.sh.pdf +0 -0
- data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_meals.ent.pdf +0 -0
- data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_misc.exp.pdf +0 -0
- data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_mktng.exp.pdf +0 -0
- data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_own.equity.pdf +0 -0
- data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_paypal.pdf +0 -0
- data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_prof.fees.pdf +0 -0
- data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_repair.maint.pdf +0 -0
- data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_ret.earn.pdf +0 -0
- data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_ship.exp.pdf +0 -0
- data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_sls.cons.pdf +0 -0
- data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_supplies.pdf +0 -0
- data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_sw.exp.pdf +0 -0
- data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_tr.airfare.pdf +0 -0
- data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_tr.autorent.pdf +0 -0
- data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_tr.gas.etc.pdf +0 -0
- data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_tr.govt.pdf +0 -0
- data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_tr.lodging.pdf +0 -0
- data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_tr.m.e.pdf +0 -0
- data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_tr.m.i.pdf +0 -0
- data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_tr.mileage.pdf +0 -0
- data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_tr.misc.pdf +0 -0
- data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_tr.parking.pdf +0 -0
- data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_tr.perdiem.mi.pdf +0 -0
- data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_tr.taxi.pdf +0 -0
- data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_tr.trainfare.pdf +0 -0
- data/sample_data/minimal/rockbooks-reports/pdf/single-account/acct_tr.unclass.pdf +0 -0
- data/sample_data/minimal/rockbooks-reports/txt/all_txns_by_acct.txt +56 -43
- data/sample_data/minimal/rockbooks-reports/txt/all_txns_by_amount.txt +29 -23
- data/sample_data/minimal/rockbooks-reports/txt/all_txns_by_date.txt +29 -23
- data/sample_data/minimal/rockbooks-reports/txt/balance_sheet.txt +4 -4
- data/sample_data/minimal/rockbooks-reports/txt/ck.hsbc.disb.txt +5 -5
- data/sample_data/minimal/rockbooks-reports/txt/general.txt +5 -5
- data/sample_data/minimal/rockbooks-reports/txt/hsbc_visa.txt +18 -13
- data/sample_data/minimal/rockbooks-reports/txt/income_statement.txt +4 -3
- data/sample_data/minimal/rockbooks-reports/txt/receipts.txt +6 -5
- data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_cc.hsbc.visa.txt +21 -14
- data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_ck.hsbc.txt +4 -4
- data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_conf.fees.txt +2 -2
- data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_cowork.fees.txt +4 -4
- data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_insurance.txt +3 -3
- data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_loan.to.sh.txt +4 -4
- data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_own.equity.txt +1 -1
- data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_sls.cons.txt +2 -2
- data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_supplies.txt +11 -2
- data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_tr.airfare.txt +1 -1
- data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_tr.lodging.txt +2 -2
- data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_tr.mileage.txt +2 -2
- data/sample_data/minimal/rockbooks-reports/txt/single-account/acct_tr.perdiem.mi.txt +1 -1
- metadata +11 -7
- data/sample_data/minimal/receipts/01/2017-01-20-phoenix-hampton.pdf +0 -0
- data/sample_data/minimal/rockbooks-inputs/2017-xyz-visa-journal.txt +0 -27
@@ -0,0 +1,156 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
|
4
|
+
<html>
|
5
|
+
|
6
|
+
<head>
|
7
|
+
|
8
|
+
<!--Bootstrap:-->
|
9
|
+
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" integrity="sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS" crossorigin="anonymous">
|
10
|
+
|
11
|
+
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
|
12
|
+
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/js/bootstrap.min.js" integrity="sha384-B0UglyR+jN6CkvvICOB2joaf5I4l3gm9GU6Hc1og6Ls7i6U/mkkaduKaBhlAXv9k" crossorigin="anonymous"></script>
|
13
|
+
|
14
|
+
<style>
|
15
|
+
body {
|
16
|
+
padding: 18px;
|
17
|
+
background-color: #e7f7cd;
|
18
|
+
color: darkgreen;
|
19
|
+
}
|
20
|
+
|
21
|
+
h2 {
|
22
|
+
margin-top: 32px;
|
23
|
+
margin-bottom: 12px;
|
24
|
+
}
|
25
|
+
|
26
|
+
.this_page_style {
|
27
|
+
background-color: #e7f7cd;
|
28
|
+
color: darkgreen;
|
29
|
+
border: 0px;
|
30
|
+
}
|
31
|
+
|
32
|
+
|
33
|
+
|
34
|
+
</style>
|
35
|
+
|
36
|
+
</head>
|
37
|
+
|
38
|
+
<body>
|
39
|
+
|
40
|
+
<h1><%= chart_of_accounts.entity %></h1>
|
41
|
+
<p class="muted">Reports Generated at <%= DateTime.now.strftime('%Y-%m-%d %H:%M:%S') %> by RockBooks version <%=RockBooks::VERSION %></p>
|
42
|
+
|
43
|
+
|
44
|
+
<h2>Financial Statements</h2>
|
45
|
+
<div id="financial-statements">
|
46
|
+
<a href='balance_sheet.html' class="btn btn-success">Balance Sheet</a>
|
47
|
+
<a href='income_statement.html' class="btn btn-success">Income Statement</a>
|
48
|
+
</div>
|
49
|
+
|
50
|
+
|
51
|
+
<h2>Supporting Documents</h2>
|
52
|
+
<div id="supporting-documents" style="display: inline ">
|
53
|
+
<%
|
54
|
+
subdir_link = ->(name, caption) do
|
55
|
+
dir_name = File.expand_path(File.join(Dir.pwd, name))
|
56
|
+
if Dir.exist?(dir_name)
|
57
|
+
%Q{<a href=#{dir_name} class="btn btn-success">#{caption}</a>}
|
58
|
+
end
|
59
|
+
end
|
60
|
+
%>
|
61
|
+
<%= subdir_link.('invoices', 'Invoices') %>
|
62
|
+
<%= subdir_link.('receipts', 'Receipts') %>
|
63
|
+
<%= subdir_link.('statements', 'Statements') %>
|
64
|
+
<%= subdir_link.('worksheets', 'Worksheets') %>
|
65
|
+
</div>
|
66
|
+
|
67
|
+
|
68
|
+
<h2>All Transactions Reports</h2>
|
69
|
+
<div id="all-transactions">
|
70
|
+
<a href="all_txns_by_acct.html" class="btn btn-success">By Account</a>
|
71
|
+
<a href="all_txns_by_amount.html" class="btn btn-success">By Amount</a>
|
72
|
+
<a href="all_txns_by_date.html" class="btn btn-success">By Date</a>
|
73
|
+
</div>
|
74
|
+
|
75
|
+
<% collapsible_heading = ->(caption, href) do
|
76
|
+
%Q{<br /><br />
|
77
|
+
<div class="collapsible-heading">
|
78
|
+
<div class="container-fluid">
|
79
|
+
<div class="row">
|
80
|
+
|
81
|
+
<div class="col-sm2" style="margin-right: 12px;">
|
82
|
+
<a class="btn btn-success" data-toggle="collapse" href="#{href}" role="button" aria-expanded="false" aria-controls="collapseExample">
|
83
|
+
+/-
|
84
|
+
</a>
|
85
|
+
</div>
|
86
|
+
|
87
|
+
<div class="col-sm10">
|
88
|
+
<h2 style="margin: 0px;">#{caption}</h2>
|
89
|
+
</div>
|
90
|
+
</div>
|
91
|
+
</div>
|
92
|
+
</div>
|
93
|
+
}
|
94
|
+
end
|
95
|
+
%>
|
96
|
+
|
97
|
+
<%= collapsible_heading.('Journal Reports', '#journal-reports') %>
|
98
|
+
|
99
|
+
</div>
|
100
|
+
<div class="collapse" id="journal-reports">
|
101
|
+
<div class="card card-body this_page_style">
|
102
|
+
<ul>
|
103
|
+
<% journals.each do |journal|
|
104
|
+
filespec = journal.short_name + '.html'
|
105
|
+
caption = "#{journal.title} -- #{journal.short_name} -- #{journal.account_code}"%>
|
106
|
+
<li><a href="<%= filespec %>" class="this_page_style" target="_blank"><%= caption %></a></li>
|
107
|
+
<% end %>
|
108
|
+
</ul>
|
109
|
+
</div>
|
110
|
+
</div>
|
111
|
+
|
112
|
+
|
113
|
+
<%= collapsible_heading.('Individual Accounts', '#individual-accounts') %>
|
114
|
+
|
115
|
+
<div class="collapse" id="individual-accounts">
|
116
|
+
<div class="card card-body this_page_style">
|
117
|
+
<ul>
|
118
|
+
|
119
|
+
<%
|
120
|
+
chart_of_accounts.accounts.each do |account|
|
121
|
+
filespec = File.join('single-account', "acct_#{account.code}.html")
|
122
|
+
caption = "#{account.name} (#{account.code})"
|
123
|
+
%>
|
124
|
+
<li><a href="<%= filespec %>" class="this_page_style"><%= caption %></a></li>
|
125
|
+
<% end %>
|
126
|
+
</ul>
|
127
|
+
</div>
|
128
|
+
</div>
|
129
|
+
</div>
|
130
|
+
|
131
|
+
|
132
|
+
<%= collapsible_heading.('Other', '#other') %>
|
133
|
+
|
134
|
+
<div class="collapse" id="other">
|
135
|
+
<div class="card card-body this_page_style">
|
136
|
+
<ul>
|
137
|
+
<% if run_options.do_receipts %>
|
138
|
+
<li><a href="receipts.html" class="this_page_style">Missing and Existing Receipts</a></li>
|
139
|
+
<% end %>
|
140
|
+
</ul>
|
141
|
+
</div>
|
142
|
+
</div>
|
143
|
+
|
144
|
+
<%= collapsible_heading.('Reports in PDF and Text Formats', '#other-formats') %>
|
145
|
+
|
146
|
+
<div class="collapse" id="other-formats">
|
147
|
+
<div class="card card-body this_page_style">
|
148
|
+
<ul>
|
149
|
+
<li><a href="../pdf" class="this_page_style" target="_blank">PDF Format</a></li>
|
150
|
+
<li><a href="../txt" class="this_page_style" target="_blank">Text Format</a></li>
|
151
|
+
</ul>
|
152
|
+
</div>
|
153
|
+
</div>
|
154
|
+
|
155
|
+
</body>
|
156
|
+
</html>
|
@@ -136,17 +136,23 @@ class JournalEntryBuilder < Struct.new(:journal_entry_context)
|
|
136
136
|
tokens = line.split
|
137
137
|
acct_amount_tokens = tokens[1..-1]
|
138
138
|
date_string = journal.date_prefix + tokens[0]
|
139
|
-
|
140
|
-
|
141
|
-
|
139
|
+
|
140
|
+
raise_date_format_error = -> do
|
141
|
+
raise Error.new("Date string was '#{date_string}' but should be a valid date in the form YYYY-MM-DD in " + \
|
142
|
+
"journal '#{journal_entry_context[:journal].title}', line #{journal_entry_context[:linenum]}.")
|
142
143
|
end
|
143
144
|
|
144
|
-
|
145
|
+
raise_date_format_error.() if date_string.length != 10
|
145
146
|
|
146
147
|
begin
|
147
148
|
date = Date.iso8601(date_string)
|
148
149
|
rescue ArgumentError
|
149
|
-
|
150
|
+
raise_date_format_error.()
|
151
|
+
end
|
152
|
+
|
153
|
+
unless chart_of_accounts.included_in_period?(date)
|
154
|
+
raise DateRangeError.new(date, chart_of_accounts.start_date,
|
155
|
+
chart_of_accounts.end_date, journal_entry_context)
|
150
156
|
end
|
151
157
|
|
152
158
|
acct_amounts = build_acct_amount_array(date, acct_amount_tokens)
|
@@ -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>
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module RockBooks
|
2
|
+
class DateRangeError < RuntimeError
|
3
|
+
|
4
|
+
attr_reader :date, :start_date, :end_date, :extra_string
|
5
|
+
|
6
|
+
def initialize(date, start_date, end_date, extra_string = nil)
|
7
|
+
@date = date
|
8
|
+
@start_date = start_date
|
9
|
+
@end_date = end_date
|
10
|
+
@extra_string = extra_string
|
11
|
+
end
|
12
|
+
|
13
|
+
def to_s
|
14
|
+
s = "#{date} is not within this data set's period of #{start_date} to #{end_date}"
|
15
|
+
s << " (#{extra_string})" if extra_string
|
16
|
+
s << '.'
|
17
|
+
s
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -19,14 +19,14 @@ class BalanceSheet
|
|
19
19
|
|
20
20
|
|
21
21
|
def end_date
|
22
|
-
context.end_date
|
22
|
+
context.chart_of_accounts.end_date
|
23
23
|
end
|
24
24
|
|
25
25
|
|
26
26
|
def generate_header
|
27
27
|
lines = [banner_line]
|
28
28
|
lines << center(context.entity || 'Unspecified Entity')
|
29
|
-
lines << center("Balance Sheet
|
29
|
+
lines << center("Balance Sheet for Period Ending #{end_date}")
|
30
30
|
lines << banner_line
|
31
31
|
lines << ''
|
32
32
|
lines << ''
|
@@ -17,12 +17,12 @@ module RockBooks
|
|
17
17
|
|
18
18
|
|
19
19
|
def start_date
|
20
|
-
context.start_date
|
20
|
+
context.chart_of_accounts.start_date
|
21
21
|
end
|
22
22
|
|
23
23
|
|
24
24
|
def end_date
|
25
|
-
context.end_date
|
25
|
+
context.chart_of_accounts.end_date
|
26
26
|
end
|
27
27
|
|
28
28
|
|
data/lib/rock_books/version.rb
CHANGED
data/manual.md
ADDED
@@ -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
|
+
|