sunat_books 0.0.2 → 0.0.3
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/.rvmrc +1 -0
- data/.travis.yml +2 -5
- data/README.mkd +9 -3
- data/lib/sunat_books.rb +6 -6
- data/lib/sunat_books/common_utils.rb +9 -0
- data/lib/sunat_books/csv/base.rb +63 -0
- data/lib/sunat_books/csv/option_error.rb +8 -0
- data/lib/sunat_books/pdf/base.rb +134 -0
- data/lib/sunat_books/pdf/buys.rb +36 -0
- data/lib/sunat_books/pdf/count_sum.rb +24 -0
- data/lib/{books → sunat_books/pdf}/diary_entries.rb +1 -3
- data/lib/{books → sunat_books/pdf}/layouts/buys.yml +0 -0
- data/lib/{books → sunat_books/pdf}/layouts/sales.yml +0 -0
- data/lib/{books → sunat_books/pdf}/locale.rb +0 -0
- data/lib/{books → sunat_books/pdf}/locales/es.yml +0 -0
- data/lib/sunat_books/pdf/page.rb +48 -0
- data/lib/{books → sunat_books/pdf}/pages_utils.rb +1 -1
- data/lib/sunat_books/pdf/sales.rb +35 -0
- data/lib/sunat_books/pdf/simplified_diary.rb +94 -0
- data/lib/sunat_books/pdf/trading_book.rb +50 -0
- data/lib/{books → sunat_books/pdf}/utils.rb +4 -6
- data/lib/sunat_books/ple/base.rb +76 -0
- data/lib/sunat_books/ple/buys.rb +38 -0
- data/lib/{ple_books → sunat_books/ple}/layouts/buys.yml +0 -0
- data/lib/{ple_books → sunat_books/ple}/layouts/sales.yml +0 -0
- data/lib/sunat_books/ple/sales.rb +22 -0
- data/sunat_books.gemspec +2 -2
- data/test/{csv_books → csv}/base_test.rb +8 -5
- data/test/{books → pdf}/base_test.rb +0 -0
- data/test/pdf/buys_test.rb +27 -0
- data/test/{books → pdf}/page_test.rb +4 -4
- data/test/{books → pdf}/pages_utils_test.rb +32 -2
- data/test/pdf/sales_test.rb +15 -0
- data/test/{books → pdf}/utils_test.rb +7 -1
- data/test/{ple_books_test.rb → ple/base_test.rb} +2 -2
- data/test/{ple_books → ple}/buys_test.rb +8 -8
- metadata +38 -35
- data/Gemfile.lock +0 -83
- data/lib/books/base.rb +0 -132
- data/lib/books/buys.rb +0 -72
- data/lib/books/count_sum.rb +0 -22
- data/lib/books/page.rb +0 -44
- data/lib/books/sales.rb +0 -73
- data/lib/books/simplified_diary.rb +0 -97
- data/lib/csv_books/base.rb +0 -67
- data/lib/csv_books/option_error.rb +0 -6
- data/lib/ple_books/base.rb +0 -75
- data/lib/ple_books/buys.rb +0 -36
- data/lib/ple_books/sales.rb +0 -20
- data/test/books/buys_test.rb +0 -57
@@ -1,10 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative "../helper"
|
4
|
-
|
4
|
+
require "sunat_books/pdf/page"
|
5
5
|
|
6
6
|
setup do
|
7
|
-
@page =
|
7
|
+
@page = SunatBooks::Pdf::Page.new(1, 1)
|
8
8
|
end
|
9
9
|
|
10
10
|
test "#update_data" do
|
@@ -15,8 +15,8 @@ test "#update_fields should return nil if not source is provided" do
|
|
15
15
|
end
|
16
16
|
|
17
17
|
test "#update_fields should handle if undefined method" do
|
18
|
-
other_page =
|
19
|
-
|
18
|
+
other_page = SunatBooks::Pdf::Page.new(2, 1)
|
19
|
+
@page.update_fields([:foo], other_page)
|
20
20
|
|
21
21
|
other_page.bi_sum += BigDecimal(10)
|
22
22
|
@page.update_fields([:bi_sum], other_page)
|
@@ -1,11 +1,41 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative "../helper"
|
4
|
-
|
5
|
-
|
4
|
+
require "sunat_books/pdf/pages_utils"
|
5
|
+
require "sunat_books/pdf/page"
|
6
6
|
|
7
7
|
include PagesUtils
|
8
8
|
|
9
|
+
test "#page_not_full return a page" do
|
10
|
+
pages = []
|
11
|
+
setup_pages(pages, 20, 5)
|
12
|
+
first = pages.at(1)
|
13
|
+
page = page_not_full(first, pages, 20)
|
14
|
+
assert_equal page.class, SunatBooks::Pdf::Page
|
15
|
+
end
|
16
|
+
|
17
|
+
test "#page_not_full return last page when length is less than page_max" do
|
18
|
+
pages = []
|
19
|
+
setup_pages(pages, 20, 5)
|
20
|
+
first_page = pages.at(1)
|
21
|
+
page = page_not_full(first_page, pages, 5)
|
22
|
+
assert_equal page, first_page
|
23
|
+
end
|
24
|
+
|
25
|
+
test "#page_not_full return new page when last page is full" do
|
26
|
+
pages = []
|
27
|
+
setup_pages(pages, 20, 5)
|
28
|
+
first_page = pages.at(1)
|
29
|
+
first_page.length += 5
|
30
|
+
current_page = pages.at(2)
|
31
|
+
page = page_not_full(first_page, pages, 5)
|
32
|
+
assert_equal page, current_page
|
33
|
+
assert_equal page.page_number, 2
|
34
|
+
end
|
35
|
+
|
36
|
+
test "#row_data prepare data that will be include in table's rows" do
|
37
|
+
end
|
38
|
+
|
9
39
|
test "#setup_pages generate new pages to fill all elements" do
|
10
40
|
pages = []
|
11
41
|
setup_pages(pages, 20, 10)
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "../helper"
|
4
|
+
|
5
|
+
setup do
|
6
|
+
@company = Company.new(ruc: Faker::Number.number(11), name: Faker::Name.name)
|
7
|
+
end
|
8
|
+
|
9
|
+
test "render pdf, have a parseable pdf" do
|
10
|
+
tickets = []
|
11
|
+
pdf = SunatBooks::Pdf::Sales.new(@company, tickets, 2, 3015)
|
12
|
+
page_counter = PDF::Inspector::Page.analyze(pdf.render)
|
13
|
+
assert pdf.page_count == 1
|
14
|
+
assert page_counter.pages.size == 1
|
15
|
+
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative "../helper"
|
4
|
-
|
4
|
+
require "sunat_books/pdf/utils"
|
5
5
|
|
6
6
|
include Utils
|
7
7
|
|
@@ -32,6 +32,12 @@ test "#add_widths set cell width in options" do
|
|
32
32
|
assert opt[:cell_style][:width] == 15
|
33
33
|
end
|
34
34
|
|
35
|
+
test "#field_value return a value for a given attribute" do
|
36
|
+
ticket = Ticket.new(foo: "bar")
|
37
|
+
assert_equal field_value(ticket, "foo"), "bar"
|
38
|
+
assert_equal field_value(ticket, "bar"), ""
|
39
|
+
end
|
40
|
+
|
35
41
|
test "#sum_count" do
|
36
42
|
end
|
37
43
|
|
@@ -5,7 +5,7 @@ require_relative "../helper"
|
|
5
5
|
setup do
|
6
6
|
tickets = [{}]
|
7
7
|
ruc = "102392839213"
|
8
|
-
@ple_buys =
|
8
|
+
@ple_buys = SunatBooks::Ple::Buys.new(ruc, tickets, 10, 2013)
|
9
9
|
end
|
10
10
|
|
11
11
|
test "generate txt file" do
|
@@ -13,7 +13,7 @@ test "generate txt file" do
|
|
13
13
|
end
|
14
14
|
|
15
15
|
test "tickets empty" do
|
16
|
-
ple_buys =
|
16
|
+
ple_buys = SunatBooks::Ple::Buys.new("10293827481", {}, 10, 2011)
|
17
17
|
assert File.exist?(ple_buys.file)
|
18
18
|
end
|
19
19
|
|
@@ -24,8 +24,8 @@ scope "custom layout" do
|
|
24
24
|
tickets = []
|
25
25
|
field_value = SecureRandom.hex(10)
|
26
26
|
tickets << Ticket.new(custom_field: field_value)
|
27
|
-
ple_buys =
|
28
|
-
|
27
|
+
ple_buys = SunatBooks::Ple::Buys.new("10293827481", tickets, 10, 2011,
|
28
|
+
yml: yml)
|
29
29
|
file = ple_buys.file
|
30
30
|
assert File.exist?(file)
|
31
31
|
|
@@ -36,10 +36,10 @@ scope "custom layout" do
|
|
36
36
|
test "allow change individual field" do
|
37
37
|
tickets = []
|
38
38
|
tickets << Ticket.new(period: "20151000", operation_day: "20/10/2015")
|
39
|
-
ple_buys =
|
40
|
-
|
41
|
-
|
42
|
-
|
39
|
+
ple_buys = SunatBooks::Ple::Buys.new("10293827481", tickets, 10, 2015,
|
40
|
+
layout: {
|
41
|
+
operation_date: "operation_day"
|
42
|
+
})
|
43
43
|
file = ple_buys.file
|
44
44
|
assert File.exist?(file)
|
45
45
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sunat_books
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- César Carruitero
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-10-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: prawn
|
@@ -136,7 +136,7 @@ dependencies:
|
|
136
136
|
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '1.7'
|
139
|
-
description:
|
139
|
+
description: A ruby gem to get accounting books for SUNAT
|
140
140
|
email:
|
141
141
|
- cesar@mozilla.pe
|
142
142
|
executables: []
|
@@ -145,47 +145,50 @@ extra_rdoc_files: []
|
|
145
145
|
files:
|
146
146
|
- ".gitignore"
|
147
147
|
- ".rubocop.yml"
|
148
|
+
- ".rvmrc"
|
148
149
|
- ".travis.yml"
|
149
150
|
- Gemfile
|
150
|
-
- Gemfile.lock
|
151
151
|
- Makefile
|
152
152
|
- README.mkd
|
153
|
-
- lib/books/base.rb
|
154
|
-
- lib/books/buys.rb
|
155
|
-
- lib/books/count_sum.rb
|
156
|
-
- lib/books/diary_entries.rb
|
157
|
-
- lib/books/layouts/buys.yml
|
158
|
-
- lib/books/layouts/sales.yml
|
159
|
-
- lib/books/locale.rb
|
160
|
-
- lib/books/locales/es.yml
|
161
|
-
- lib/books/page.rb
|
162
|
-
- lib/books/pages_utils.rb
|
163
|
-
- lib/books/sales.rb
|
164
|
-
- lib/books/simplified_diary.rb
|
165
|
-
- lib/books/utils.rb
|
166
|
-
- lib/csv_books/base.rb
|
167
|
-
- lib/csv_books/option_error.rb
|
168
|
-
- lib/ple_books/base.rb
|
169
|
-
- lib/ple_books/book_codes.csv
|
170
|
-
- lib/ple_books/buys.rb
|
171
|
-
- lib/ple_books/layouts/buys.yml
|
172
|
-
- lib/ple_books/layouts/sales.yml
|
173
|
-
- lib/ple_books/sales.rb
|
174
153
|
- lib/sunat_books.rb
|
154
|
+
- lib/sunat_books/common_utils.rb
|
155
|
+
- lib/sunat_books/csv/base.rb
|
156
|
+
- lib/sunat_books/csv/option_error.rb
|
157
|
+
- lib/sunat_books/pdf/base.rb
|
158
|
+
- lib/sunat_books/pdf/buys.rb
|
159
|
+
- lib/sunat_books/pdf/count_sum.rb
|
160
|
+
- lib/sunat_books/pdf/diary_entries.rb
|
161
|
+
- lib/sunat_books/pdf/layouts/buys.yml
|
162
|
+
- lib/sunat_books/pdf/layouts/sales.yml
|
163
|
+
- lib/sunat_books/pdf/locale.rb
|
164
|
+
- lib/sunat_books/pdf/locales/es.yml
|
165
|
+
- lib/sunat_books/pdf/page.rb
|
166
|
+
- lib/sunat_books/pdf/pages_utils.rb
|
167
|
+
- lib/sunat_books/pdf/sales.rb
|
168
|
+
- lib/sunat_books/pdf/simplified_diary.rb
|
169
|
+
- lib/sunat_books/pdf/trading_book.rb
|
170
|
+
- lib/sunat_books/pdf/utils.rb
|
171
|
+
- lib/sunat_books/ple/base.rb
|
172
|
+
- lib/sunat_books/ple/book_codes.csv
|
173
|
+
- lib/sunat_books/ple/buys.rb
|
174
|
+
- lib/sunat_books/ple/layouts/buys.yml
|
175
|
+
- lib/sunat_books/ple/layouts/sales.yml
|
176
|
+
- lib/sunat_books/ple/sales.rb
|
175
177
|
- sunat_books.gemspec
|
176
|
-
- test/
|
177
|
-
- test/books/buys_test.rb
|
178
|
-
- test/books/page_test.rb
|
179
|
-
- test/books/pages_utils_test.rb
|
180
|
-
- test/books/utils_test.rb
|
181
|
-
- test/csv_books/base_test.rb
|
178
|
+
- test/csv/base_test.rb
|
182
179
|
- test/fixtures/base.rb
|
183
180
|
- test/fixtures/company.rb
|
184
181
|
- test/fixtures/custom_layout.yml
|
185
182
|
- test/fixtures/ticket.rb
|
186
183
|
- test/helper.rb
|
187
|
-
- test/
|
188
|
-
- test/
|
184
|
+
- test/pdf/base_test.rb
|
185
|
+
- test/pdf/buys_test.rb
|
186
|
+
- test/pdf/page_test.rb
|
187
|
+
- test/pdf/pages_utils_test.rb
|
188
|
+
- test/pdf/sales_test.rb
|
189
|
+
- test/pdf/utils_test.rb
|
190
|
+
- test/ple/base_test.rb
|
191
|
+
- test/ple/buys_test.rb
|
189
192
|
homepage: https://github.com/ccarruitero/sunat_books
|
190
193
|
licenses:
|
191
194
|
- MPL
|
@@ -206,8 +209,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
206
209
|
version: '0'
|
207
210
|
requirements: []
|
208
211
|
rubyforge_project:
|
209
|
-
rubygems_version: 2.6.
|
212
|
+
rubygems_version: 2.6.13
|
210
213
|
signing_key:
|
211
214
|
specification_version: 4
|
212
|
-
summary:
|
215
|
+
summary: A ruby gem to get accounting books for SUNAT
|
213
216
|
test_files: []
|
data/Gemfile.lock
DELETED
@@ -1,83 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
sunat_books (0.0.1)
|
5
|
-
activesupport (> 4.1)
|
6
|
-
i18n (~> 0.7)
|
7
|
-
prawn (~> 2.0)
|
8
|
-
prawn-table (~> 0.2)
|
9
|
-
|
10
|
-
GEM
|
11
|
-
remote: https://rubygems.org/
|
12
|
-
specs:
|
13
|
-
Ascii85 (1.0.2)
|
14
|
-
activesupport (5.0.2)
|
15
|
-
concurrent-ruby (~> 1.0, >= 1.0.2)
|
16
|
-
i18n (~> 0.7)
|
17
|
-
minitest (~> 5.1)
|
18
|
-
tzinfo (~> 1.1)
|
19
|
-
afm (0.2.2)
|
20
|
-
ast (2.3.0)
|
21
|
-
clap (1.0.0)
|
22
|
-
coderay (1.1.1)
|
23
|
-
concurrent-ruby (1.0.5)
|
24
|
-
cutest (1.2.3)
|
25
|
-
clap
|
26
|
-
faker (1.7.3)
|
27
|
-
i18n (~> 0.5)
|
28
|
-
hashery (2.1.2)
|
29
|
-
i18n (0.8.1)
|
30
|
-
method_source (0.8.2)
|
31
|
-
minitest (5.10.1)
|
32
|
-
parser (2.4.0.0)
|
33
|
-
ast (~> 2.2)
|
34
|
-
pdf-core (0.7.0)
|
35
|
-
pdf-inspector (1.2.1)
|
36
|
-
pdf-reader (~> 1.0)
|
37
|
-
pdf-reader (1.4.1)
|
38
|
-
Ascii85 (~> 1.0.0)
|
39
|
-
afm (~> 0.2.1)
|
40
|
-
hashery (~> 2.0)
|
41
|
-
ruby-rc4
|
42
|
-
ttfunk
|
43
|
-
powerpack (0.1.1)
|
44
|
-
prawn (2.2.2)
|
45
|
-
pdf-core (~> 0.7.0)
|
46
|
-
ttfunk (~> 1.5)
|
47
|
-
prawn-table (0.2.2)
|
48
|
-
prawn (>= 1.3.0, < 3.0.0)
|
49
|
-
pry (0.10.4)
|
50
|
-
coderay (~> 1.1.0)
|
51
|
-
method_source (~> 0.8.1)
|
52
|
-
slop (~> 3.4)
|
53
|
-
rainbow (2.2.2)
|
54
|
-
rake
|
55
|
-
rake (12.0.0)
|
56
|
-
rubocop (0.48.1)
|
57
|
-
parser (>= 2.3.3.1, < 3.0)
|
58
|
-
powerpack (~> 0.1)
|
59
|
-
rainbow (>= 1.99.1, < 3.0)
|
60
|
-
ruby-progressbar (~> 1.7)
|
61
|
-
unicode-display_width (~> 1.0, >= 1.0.1)
|
62
|
-
ruby-progressbar (1.8.1)
|
63
|
-
ruby-rc4 (0.1.5)
|
64
|
-
slop (3.6.0)
|
65
|
-
thread_safe (0.3.6)
|
66
|
-
ttfunk (1.5.0)
|
67
|
-
tzinfo (1.2.2)
|
68
|
-
thread_safe (~> 0.1)
|
69
|
-
unicode-display_width (1.2.1)
|
70
|
-
|
71
|
-
PLATFORMS
|
72
|
-
ruby
|
73
|
-
|
74
|
-
DEPENDENCIES
|
75
|
-
cutest (~> 1.2)
|
76
|
-
faker (~> 1.7)
|
77
|
-
pdf-inspector (~> 1.2.0)
|
78
|
-
pry (~> 0.10)
|
79
|
-
rubocop (~> 0.48)
|
80
|
-
sunat_books!
|
81
|
-
|
82
|
-
BUNDLED WITH
|
83
|
-
1.14.6
|
data/lib/books/base.rb
DELETED
@@ -1,132 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "prawn"
|
4
|
-
require "prawn/table"
|
5
|
-
require "yaml"
|
6
|
-
require_relative "utils"
|
7
|
-
require_relative "locale"
|
8
|
-
|
9
|
-
module Books
|
10
|
-
class Base < Prawn::Document
|
11
|
-
include Utils
|
12
|
-
include Prawn::Table::Interface
|
13
|
-
|
14
|
-
def sub_head(hash, book_name, blayout)
|
15
|
-
arr, current_key = nil
|
16
|
-
hash.each do |key, value|
|
17
|
-
k = I18n.t("books.#{book_name}.#{key}").mb_chars.upcase.to_s
|
18
|
-
v = value.collect do |s|
|
19
|
-
I18n.t("books.#{book_name}.#{s}").mb_chars.upcase.to_s
|
20
|
-
end
|
21
|
-
arr = [[{ content: k, colspan: value.length }], v]
|
22
|
-
current_key = key
|
23
|
-
end
|
24
|
-
|
25
|
-
sub_head_table(blayout["widths"], arr, current_key)
|
26
|
-
end
|
27
|
-
|
28
|
-
def sub_head_table(widths, arr, key)
|
29
|
-
column_widths = get_column_widths(widths, key)
|
30
|
-
options = sub_head_options(column_widths)
|
31
|
-
make_table(arr, options)
|
32
|
-
end
|
33
|
-
|
34
|
-
def sub_head_options(column_widths)
|
35
|
-
options = { cell_style: {
|
36
|
-
borders: [], size: 5, align: :center, padding: 1
|
37
|
-
} }
|
38
|
-
add_widths(column_widths, options, 22)
|
39
|
-
options
|
40
|
-
end
|
41
|
-
|
42
|
-
def book_title(title)
|
43
|
-
text title, align: :center, size: 8
|
44
|
-
end
|
45
|
-
|
46
|
-
def book_header(period, ruc, name, title = nil)
|
47
|
-
move_down 5
|
48
|
-
txt name.to_s.upcase
|
49
|
-
txt "RUC: #{ruc}"
|
50
|
-
book_title("#{title} - #{period}")
|
51
|
-
move_down 5
|
52
|
-
end
|
53
|
-
|
54
|
-
def prawn_header(title, period, company)
|
55
|
-
repeat(:all) do
|
56
|
-
canvas do
|
57
|
-
bounding_box([bounds.left + 10, bounds.top - 10], width: 800) do
|
58
|
-
book_header period, company.ruc, company.name, title
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
def table_head(fields, book_name, layout)
|
65
|
-
thead = []
|
66
|
-
fields.each do |h|
|
67
|
-
if h.class == Hash
|
68
|
-
r = sub_head(h, book_name, layout)
|
69
|
-
thead << r
|
70
|
-
else
|
71
|
-
thead << I18n.t("books.#{book_name}.#{h}").mb_chars.upcase.to_s
|
72
|
-
end
|
73
|
-
end
|
74
|
-
thead
|
75
|
-
end
|
76
|
-
|
77
|
-
def table_body(fields, ticket, widths, aligns)
|
78
|
-
tbody = []
|
79
|
-
fields.each do |f|
|
80
|
-
if f.is_a? Hash
|
81
|
-
table_hash(f, ticket, tbody, widths, aligns)
|
82
|
-
else
|
83
|
-
tbody << field_value(ticket, f)
|
84
|
-
end
|
85
|
-
end
|
86
|
-
tbody
|
87
|
-
end
|
88
|
-
|
89
|
-
def table_hash(f, ticket, tbody, widths, aligns)
|
90
|
-
options = { cell_style: { borders: [], size: 5 } }
|
91
|
-
|
92
|
-
f.each do |key, value|
|
93
|
-
v = value.collect do |s|
|
94
|
-
value = field_value(ticket, s)
|
95
|
-
end
|
96
|
-
|
97
|
-
column_widths = get_column_widths(widths, key)
|
98
|
-
add_widths(column_widths, options, 28)
|
99
|
-
add_align(aligns, options, key) unless aligns.nil?
|
100
|
-
tbody << make_table([v], options)
|
101
|
-
end
|
102
|
-
end
|
103
|
-
|
104
|
-
# diary
|
105
|
-
def get_counts(tickets)
|
106
|
-
tickets.map(&:uniq_counts).flatten.uniq.sort
|
107
|
-
end
|
108
|
-
|
109
|
-
def get_mother_counts(tickets)
|
110
|
-
tickets.map(&:uniq_mother_counts).flatten.uniq.sort
|
111
|
-
end
|
112
|
-
|
113
|
-
def get_value(ticket, count)
|
114
|
-
# active_amount = ticket.get_amount_by_position(count)
|
115
|
-
# pasive_amount = ticket.get_amount_by_position(count, false)
|
116
|
-
active_amount = ticket.get_amount_by_mother_count(count)
|
117
|
-
pasive_amount = ticket.get_amount_by_mother_count(count, false)
|
118
|
-
# if count === '401' && ticket.operation_type == 'compras'
|
119
|
-
# amount = amount * (-1)
|
120
|
-
# end
|
121
|
-
active_amount - pasive_amount
|
122
|
-
end
|
123
|
-
|
124
|
-
def make_sub_table(content, width = nil)
|
125
|
-
options = { cell_style: { width: width, size: 5, borders: [],
|
126
|
-
align: :right } }
|
127
|
-
content_row = []
|
128
|
-
content.each { |c| content_row << formated_number(c) }
|
129
|
-
make_table([content_row], options)
|
130
|
-
end
|
131
|
-
end
|
132
|
-
end
|