rock_books 0.7.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/{manual.md → MANUAL.md} +26 -26
- data/README.md +20 -12
- data/RELEASE_NOTES.md +55 -10
- data/REPORTS.md +81 -0
- data/assets/doc-images/sample-index-html.png +0 -0
- data/lib/rock_books/cmd_line/command_line_interface.rb +12 -21
- data/lib/rock_books/documents/book_set.rb +4 -1
- data/lib/rock_books/documents/journal.rb +2 -3
- data/lib/rock_books/reports/balance_sheet.rb +2 -2
- data/lib/rock_books/reports/book_set_reporter.rb +69 -55
- data/lib/rock_books/reports/data/bs_is_section_data.rb +3 -1
- data/lib/rock_books/reports/data/journal_data.rb +1 -0
- data/lib/rock_books/reports/data/multidoc_txn_by_account_data.rb +1 -1
- data/lib/rock_books/reports/data/tx_one_account_data.rb +1 -1
- data/lib/rock_books/reports/helpers/erb_helper.rb +1 -6
- data/lib/rock_books/reports/helpers/receipts_hyperlink_converter.rb +59 -0
- data/lib/rock_books/reports/helpers/{reporter.rb → text_report_helper.rb} +11 -1
- data/lib/rock_books/reports/income_statement.rb +2 -2
- data/lib/rock_books/reports/index_html_page.rb +27 -0
- data/lib/rock_books/reports/journal_report.rb +18 -8
- data/lib/rock_books/reports/multidoc_txn_by_account_report.rb +2 -2
- data/lib/rock_books/reports/multidoc_txn_report.rb +2 -2
- data/lib/rock_books/reports/receipts_report.rb +1 -1
- data/lib/rock_books/reports/templates/html/index.html.erb +45 -6
- data/lib/rock_books/reports/templates/html/report_page.html.erb +14 -1
- data/lib/rock_books/reports/templates/text/balance_sheet.txt.erb +2 -0
- data/lib/rock_books/reports/templates/text/income_statement.txt.erb +3 -1
- data/lib/rock_books/reports/templates/text/journal.txt.erb +5 -2
- data/lib/rock_books/reports/templates/text/multidoc_txn_by_account_report.txt.erb +3 -0
- data/lib/rock_books/reports/templates/text/multidoc_txn_report.txt.erb +3 -0
- data/lib/rock_books/reports/templates/text/receipts_report.txt.erb +3 -0
- data/lib/rock_books/reports/templates/text/tx_one_account.txt.erb +3 -0
- data/lib/rock_books/reports/tx_one_account.rb +2 -2
- data/lib/rock_books/version.rb +2 -1
- data/rock_books.gemspec +1 -0
- metadata +22 -5
- data/lib/rock_books/helpers/html_helper.rb +0 -35
@@ -2,7 +2,7 @@ require_relative '../../documents/journal_entry'
|
|
2
2
|
require_relative 'erb_helper'
|
3
3
|
|
4
4
|
module RockBooks
|
5
|
-
module
|
5
|
+
module TextReportHelper
|
6
6
|
|
7
7
|
SHORT_NAME_MAX_LENGTH = 16
|
8
8
|
|
@@ -110,8 +110,17 @@ module Reporter
|
|
110
110
|
end
|
111
111
|
|
112
112
|
|
113
|
+
# e.g. "Generated at 2021-01-09 18:22:18 by RockBooks version 0.7.1"
|
114
|
+
def generation_info_display_string
|
115
|
+
now = Time.now
|
116
|
+
timestamp = "#{now} (#{now.utc})"
|
117
|
+
center("Generated at #{timestamp}") + "\n" + center("by RockBooks version #{RockBooks::VERSION}")
|
118
|
+
end
|
119
|
+
|
120
|
+
|
113
121
|
def template_presentation_context
|
114
122
|
{
|
123
|
+
accounting_period: "#{start_date} to #{end_date}",
|
115
124
|
banner_line: banner_line,
|
116
125
|
end_date: end_date,
|
117
126
|
entity: context.entity,
|
@@ -123,6 +132,7 @@ module Reporter
|
|
123
132
|
fn_format_multidoc_entry: method(:format_multidoc_entry),
|
124
133
|
fn_section_heading: method(:section_heading),
|
125
134
|
fn_total_with_ok_or_discrepancy: method(:total_with_ok_or_discrepancy),
|
135
|
+
generated: generation_info_display_string,
|
126
136
|
line_item_format_string: line_item_format_string,
|
127
137
|
short_name_format_string: SHORT_NAME_FORMAT_STRING,
|
128
138
|
start_date: start_date,
|
@@ -1,12 +1,12 @@
|
|
1
1
|
require_relative 'helpers/erb_helper'
|
2
|
-
require_relative 'helpers/
|
2
|
+
require_relative 'helpers/text_report_helper'
|
3
3
|
|
4
4
|
module RockBooks
|
5
5
|
|
6
6
|
|
7
7
|
class IncomeStatement
|
8
8
|
|
9
|
-
include
|
9
|
+
include TextReportHelper
|
10
10
|
include ErbHelper
|
11
11
|
|
12
12
|
attr_reader :data, :context
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require_relative 'report_context'
|
2
|
+
|
3
|
+
|
4
|
+
module RockBooks
|
5
|
+
class IndexHtmlPage
|
6
|
+
|
7
|
+
include TextReportHelper
|
8
|
+
|
9
|
+
attr_reader :context, :data
|
10
|
+
|
11
|
+
def initialize(report_context, metadata, run_options)
|
12
|
+
@context = report_context
|
13
|
+
@data = {
|
14
|
+
metadata: metadata,
|
15
|
+
journals: context.journals,
|
16
|
+
chart_of_accounts: context.chart_of_accounts,
|
17
|
+
run_options: run_options,
|
18
|
+
}
|
19
|
+
end
|
20
|
+
|
21
|
+
def generate
|
22
|
+
webized_generate_message_lines = template_presentation_context[:generated].split("\n")
|
23
|
+
presentation_context = template_presentation_context.merge( { generated: webized_generate_message_lines})
|
24
|
+
ErbHelper.render_hashes('html/index.html.erb', data, presentation_context)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -1,12 +1,12 @@
|
|
1
1
|
require_relative 'data/journal_data'
|
2
2
|
require_relative 'helpers/erb_helper'
|
3
|
-
require_relative 'helpers/
|
3
|
+
require_relative 'helpers/text_report_helper'
|
4
4
|
|
5
5
|
module RockBooks
|
6
6
|
|
7
7
|
class JournalReport
|
8
8
|
|
9
|
-
include
|
9
|
+
include TextReportHelper
|
10
10
|
include ErbHelper
|
11
11
|
|
12
12
|
attr_accessor :context, :report_data
|
@@ -24,18 +24,25 @@ class JournalReport
|
|
24
24
|
end
|
25
25
|
|
26
26
|
|
27
|
+
private def format_date_and_account_amount(date, acct_amount)
|
28
|
+
"#{date} #{format_acct_amount(acct_amount)}\n"
|
29
|
+
end
|
30
|
+
|
31
|
+
|
27
32
|
private def format_entry_first_acct_amount(entry)
|
28
|
-
entry.date.
|
29
|
-
|
30
|
-
|
31
|
-
|
33
|
+
format_date_and_account_amount(entry.date, entry.acct_amounts.first)
|
34
|
+
end
|
35
|
+
|
36
|
+
|
37
|
+
private def format_entry_last_acct_amount(entry)
|
38
|
+
format_date_and_account_amount(entry.date, entry.acct_amounts.last)
|
32
39
|
end
|
33
40
|
|
34
41
|
|
35
42
|
# Formats an entry like this, with entry description added on additional line(s) if it exists:
|
36
43
|
# 2018-05-21 $120.00 701 Office Supplies
|
37
44
|
private def format_entry_no_split(entry)
|
38
|
-
output =
|
45
|
+
output = format_entry_last_acct_amount(entry)
|
39
46
|
|
40
47
|
if entry.description && entry.description.length > 0
|
41
48
|
output += entry.description
|
@@ -48,7 +55,8 @@ class JournalReport
|
|
48
55
|
# 2018-05-21 $120.00 95.00 701 Office Supplies
|
49
56
|
# 25.00 751 Gift to Customer
|
50
57
|
private def format_entry_with_split(entry)
|
51
|
-
output =
|
58
|
+
output = StringIO.new
|
59
|
+
output << format_entry_first_acct_amount(entry)
|
52
60
|
indent = ' ' * 12
|
53
61
|
|
54
62
|
entry.acct_amounts[1..-1].each do |acct_amount|
|
@@ -58,6 +66,8 @@ class JournalReport
|
|
58
66
|
if entry.description && entry.description.length > 0
|
59
67
|
output << entry.description
|
60
68
|
end
|
69
|
+
|
70
|
+
output.string
|
61
71
|
end
|
62
72
|
|
63
73
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require_relative '../documents/chart_of_accounts'
|
2
2
|
require_relative 'helpers/erb_helper'
|
3
|
-
require_relative 'helpers/
|
3
|
+
require_relative 'helpers/text_report_helper'
|
4
4
|
require_relative 'report_context'
|
5
5
|
require_relative 'data/multidoc_txn_by_account_data'
|
6
6
|
|
@@ -8,7 +8,7 @@ module RockBooks
|
|
8
8
|
|
9
9
|
class MultidocTransactionByAccountReport
|
10
10
|
|
11
|
-
include
|
11
|
+
include TextReportHelper
|
12
12
|
include ErbHelper
|
13
13
|
|
14
14
|
attr_reader :context, :data
|
@@ -1,14 +1,14 @@
|
|
1
1
|
require_relative 'data/multidoc_txn_report_data'
|
2
2
|
require_relative '../documents/journal'
|
3
3
|
require_relative 'helpers/erb_helper'
|
4
|
-
require_relative 'helpers/
|
4
|
+
require_relative 'helpers/text_report_helper'
|
5
5
|
require_relative 'report_context'
|
6
6
|
|
7
7
|
module RockBooks
|
8
8
|
|
9
9
|
class MultidocTransactionReport
|
10
10
|
|
11
|
-
include
|
11
|
+
include TextReportHelper
|
12
12
|
include ErbHelper
|
13
13
|
|
14
14
|
attr_reader :context, :data
|
@@ -1,5 +1,6 @@
|
|
1
1
|
<!DOCTYPE html>
|
2
2
|
<html lang="en">
|
3
|
+
<!-- <%= metadata %> -->
|
3
4
|
<head>
|
4
5
|
|
5
6
|
<meta charset="utf-8">
|
@@ -14,6 +15,13 @@
|
|
14
15
|
padding: 36px;
|
15
16
|
background-color: #88c1f7;
|
16
17
|
color: #01182d;
|
18
|
+
max-width: 1024px;
|
19
|
+
float: none !important;
|
20
|
+
margin: 0 auto !important;
|
21
|
+
}
|
22
|
+
|
23
|
+
.top_heading {
|
24
|
+
text-align: center;
|
17
25
|
}
|
18
26
|
|
19
27
|
h2 {
|
@@ -26,13 +34,25 @@
|
|
26
34
|
color: #01182d;
|
27
35
|
border: 0px;
|
28
36
|
}
|
37
|
+
|
38
|
+
.lower_button_width {
|
39
|
+
min-width: 100px;
|
40
|
+
}
|
29
41
|
</style>
|
30
42
|
</head>
|
31
43
|
|
32
44
|
<body>
|
33
45
|
|
34
|
-
<h1><%=
|
35
|
-
<
|
46
|
+
<h1 class="top_heading"><%= entity %></h1>
|
47
|
+
<h1 class="top_heading">Financial Statements, Reports, and Source Data</h1>
|
48
|
+
<h1 class="top_heading"><%= accounting_period %></h1>
|
49
|
+
<br />
|
50
|
+
<br />
|
51
|
+
<h4 class="top_heading"><%= generated[0] %></h4>
|
52
|
+
<h4 class="top_heading"><%= generated[1] %> (<a href="https://github.com/keithrbennett/rock_books">https://github.com/keithrbennett/rock_books</a>)</h4>
|
53
|
+
<h4 class="top_heading">Open Source Software Provided by <a href="https://www.bbs-software.com/">Bennett Business Solutions, Inc.</a></h4>
|
54
|
+
<br />
|
55
|
+
<br />
|
36
56
|
|
37
57
|
<h2>Financial Statements</h2>
|
38
58
|
<div id="financial-statements">
|
@@ -45,9 +65,10 @@
|
|
45
65
|
<div id="supporting-documents" style="display: inline ">
|
46
66
|
<%
|
47
67
|
subdir_link = ->(name, caption) do
|
48
|
-
|
49
|
-
|
50
|
-
|
68
|
+
link_dir_name = File.join('..', '..', name)
|
69
|
+
test_dir_name = name
|
70
|
+
if Dir.exist?(test_dir_name)
|
71
|
+
%Q{<a href=#{link_dir_name} class="btn btn-primary">#{caption}</a>}
|
51
72
|
end
|
52
73
|
end
|
53
74
|
%>
|
@@ -55,6 +76,7 @@
|
|
55
76
|
<%= subdir_link.('receipts', 'Receipts') %>
|
56
77
|
<%= subdir_link.('statements', 'Statements') %>
|
57
78
|
<%= subdir_link.('worksheets', 'Worksheets') %>
|
79
|
+
<%= subdir_link.('rockbooks-inputs', 'Original Input Documents') %>
|
58
80
|
</div>
|
59
81
|
|
60
82
|
|
@@ -72,7 +94,7 @@
|
|
72
94
|
<div class="row">
|
73
95
|
|
74
96
|
<div class="col-sm2" style="margin-right: 12px;">
|
75
|
-
<a class="btn btn-primary" data-toggle="collapse" href="#{href}" role="button" aria-expanded="false" aria-controls="collapseExample">
|
97
|
+
<a class="btn btn-primary lower_button_width" data-toggle="collapse" href="#{href}" role="button" aria-expanded="false" aria-controls="collapseExample">
|
76
98
|
+/-
|
77
99
|
</a>
|
78
100
|
</div>
|
@@ -137,5 +159,22 @@
|
|
137
159
|
</div>
|
138
160
|
</div>
|
139
161
|
|
162
|
+
|
163
|
+
<br /><br />
|
164
|
+
|
165
|
+
<div class="container-fluid">
|
166
|
+
<div class="row">
|
167
|
+
|
168
|
+
<div class="col-sm2" style="margin-right: 12px;">
|
169
|
+
<a class="btn btn-primary lower_button_width" href="../..">
|
170
|
+
Browse
|
171
|
+
</a>
|
172
|
+
</div>
|
173
|
+
|
174
|
+
<div class="col-sm10">
|
175
|
+
<h2 style="margin: 0px;">Browse All Data Files</h2>
|
176
|
+
</div>
|
177
|
+
</div>
|
178
|
+
</div>
|
140
179
|
</body>
|
141
180
|
</html>
|
@@ -1,8 +1,21 @@
|
|
1
1
|
<!DOCTYPE html>
|
2
2
|
<html lang="en">
|
3
|
+
<!-- <%= metadata_comment %> -->
|
3
4
|
<head>
|
4
|
-
<title
|
5
|
+
<title><%= title %></title>
|
5
6
|
<meta name="generator" content="RockBooks Accounting"/>
|
7
|
+
<style>
|
8
|
+
body {
|
9
|
+
padding: 36px;
|
10
|
+
background-color: #d5f3fb;
|
11
|
+
color: #01182d;
|
12
|
+
max-width: 1024px;
|
13
|
+
float: none !important;
|
14
|
+
margin: 0 auto !important;
|
15
|
+
border: 0px;
|
16
|
+
font-size: 15px !important;
|
17
|
+
}
|
18
|
+
</style>
|
6
19
|
</head>
|
7
20
|
<body>
|
8
21
|
<pre>
|
@@ -1,6 +1,8 @@
|
|
1
1
|
<%= banner_line %>
|
2
2
|
<%= fn_center.(entity || 'Unspecified Entity') %>
|
3
|
-
<%= fn_center.("Income Statement -- #{
|
3
|
+
<%= fn_center.("Income Statement -- #{accounting_period}") %>
|
4
|
+
|
5
|
+
<%= fn_center.(generated) %>
|
4
6
|
<%= banner_line %>
|
5
7
|
|
6
8
|
<% %i(income expense).each do |section_type| -%>
|
@@ -1,14 +1,17 @@
|
|
1
1
|
<%= banner_line %>
|
2
2
|
<%= fn_center.(entity || 'Unspecified Entity') %>
|
3
3
|
<%= fn_center.(title) %>
|
4
|
+
<%= fn_center.(accounting_period) %>
|
5
|
+
|
4
6
|
<% if code && name -%>
|
5
7
|
<%= fn_center.("Account: #{name} (#{code})") %>
|
6
8
|
<% end -%>
|
7
9
|
<% if short_name -%>
|
8
10
|
<%= fn_center.("Journal Short Name: #{short_name}") %>
|
11
|
+
<%= fn_center.("Amounts shown are #{debit_or_credit}s to specified accounts (negate for #{short_name})") %>
|
9
12
|
<% end -%>
|
10
|
-
|
11
|
-
) %>
|
13
|
+
|
14
|
+
<%= fn_center.(generated) %>
|
12
15
|
<%= banner_line %>
|
13
16
|
|
14
17
|
|
@@ -4,6 +4,9 @@ end -%>
|
|
4
4
|
<%= banner_line %>
|
5
5
|
<%= fn_center.(entity || 'Unspecified Entity') %>
|
6
6
|
<%= fn_center.('Receipts Report') %>
|
7
|
+
<%= fn_center.(accounting_period) %>
|
8
|
+
|
9
|
+
<%= fn_center.(generated) %>
|
7
10
|
<%= banner_line %>
|
8
11
|
|
9
12
|
<% # Unlike existing and missing, which arrays of hashes with keys :receipt and :journal, unused is an array of receipt filespecs %>
|
@@ -2,6 +2,9 @@
|
|
2
2
|
<%= fn_center.(entity || 'Unspecified Entity') %>
|
3
3
|
<%= fn_center.("Transactions for Account #{account_string}") %>
|
4
4
|
<%= fn_center.(sprintf("Total: %.2f", total)) %>
|
5
|
+
<%= fn_center.(accounting_period) %>
|
6
|
+
|
7
|
+
<%= fn_center.(generated) %>
|
5
8
|
<%= banner_line %>
|
6
9
|
|
7
10
|
|
@@ -2,14 +2,14 @@ require_relative 'data/tx_one_account_data'
|
|
2
2
|
require_relative '../documents/chart_of_accounts'
|
3
3
|
require_relative '../documents/journal'
|
4
4
|
require_relative 'helpers/erb_helper'
|
5
|
-
require_relative 'helpers/
|
5
|
+
require_relative 'helpers/text_report_helper'
|
6
6
|
require_relative 'report_context'
|
7
7
|
|
8
8
|
module RockBooks
|
9
9
|
|
10
10
|
class TxOneAccount
|
11
11
|
|
12
|
-
include
|
12
|
+
include TextReportHelper
|
13
13
|
include ErbHelper
|
14
14
|
|
15
15
|
attr_reader :context, :account_code, :data
|
data/lib/rock_books/version.rb
CHANGED
data/rock_books.gemspec
CHANGED
@@ -34,6 +34,7 @@ Gem::Specification.new do |spec|
|
|
34
34
|
spec.add_dependency 'os', '> 1.0.0'
|
35
35
|
spec.add_dependency 'pry', '> 0.0.0'
|
36
36
|
spec.add_dependency 'prawn', '>= 2.1'
|
37
|
+
spec.add_dependency 'tty-progressbar'
|
37
38
|
|
38
39
|
spec.add_development_dependency "bundler", "~> 2.0"
|
39
40
|
spec.add_development_dependency "rake", ">= 12.3.3"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rock_books
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Keith Bennett
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-01-
|
11
|
+
date: 2021-01-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: amazing_print
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '2.1'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: tty-progressbar
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: bundler
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -122,9 +136,12 @@ files:
|
|
122
136
|
- ".travis.yml"
|
123
137
|
- Gemfile
|
124
138
|
- LICENSE.txt
|
139
|
+
- MANUAL.md
|
125
140
|
- README.md
|
126
141
|
- RELEASE_NOTES.md
|
142
|
+
- REPORTS.md
|
127
143
|
- Rakefile
|
144
|
+
- assets/doc-images/sample-index-html.png
|
128
145
|
- assets/fonts/JetBrainsMono-Medium.ttf
|
129
146
|
- bin/console
|
130
147
|
- bin/setup
|
@@ -145,7 +162,6 @@ files:
|
|
145
162
|
- lib/rock_books/filters/acct_amount_filters.rb
|
146
163
|
- lib/rock_books/filters/journal_entry_filters.rb
|
147
164
|
- lib/rock_books/helpers/book_set_loader.rb
|
148
|
-
- lib/rock_books/helpers/html_helper.rb
|
149
165
|
- lib/rock_books/helpers/parse_helper.rb
|
150
166
|
- lib/rock_books/reports/balance_sheet.rb
|
151
167
|
- lib/rock_books/reports/book_set_reporter.rb
|
@@ -157,8 +173,10 @@ files:
|
|
157
173
|
- lib/rock_books/reports/data/receipts_report_data.rb
|
158
174
|
- lib/rock_books/reports/data/tx_one_account_data.rb
|
159
175
|
- lib/rock_books/reports/helpers/erb_helper.rb
|
160
|
-
- lib/rock_books/reports/helpers/
|
176
|
+
- lib/rock_books/reports/helpers/receipts_hyperlink_converter.rb
|
177
|
+
- lib/rock_books/reports/helpers/text_report_helper.rb
|
161
178
|
- lib/rock_books/reports/income_statement.rb
|
179
|
+
- lib/rock_books/reports/index_html_page.rb
|
162
180
|
- lib/rock_books/reports/journal_report.rb
|
163
181
|
- lib/rock_books/reports/multidoc_txn_by_account_report.rb
|
164
182
|
- lib/rock_books/reports/multidoc_txn_report.rb
|
@@ -181,7 +199,6 @@ files:
|
|
181
199
|
- lib/rock_books/types/acct_amount.rb
|
182
200
|
- lib/rock_books/types/journal_entry_context.rb
|
183
201
|
- lib/rock_books/version.rb
|
184
|
-
- manual.md
|
185
202
|
- rock_books.gemspec
|
186
203
|
- sample_data/minimal/receipts/01/2018-01-01-sample-receipt.jpg
|
187
204
|
- sample_data/minimal/rockbooks-inputs/2018-xyz-chart-of-accounts.txt
|