sunat_books 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +5 -1
- data/lib/sunat_books.rb +1 -0
- data/lib/sunat_books/errors/invalid_layout_error.rb +8 -0
- data/lib/sunat_books/pdf/base.rb +1 -1
- data/lib/sunat_books/pdf/pages_utils.rb +2 -3
- data/lib/sunat_books/pdf/utils.rb +1 -1
- data/lib/sunat_books/ple/base.rb +2 -0
- data/lib/sunat_books/ple/layouts/buys-8.1.yml +18 -18
- data/lib/sunat_books/ple/layouts/buys-8.2.yml +14 -14
- data/lib/sunat_books/ple/layouts/buys-8.3.yml +9 -9
- data/lib/sunat_books/ple/layouts/sales-14.1.yml +9 -8
- data/lib/sunat_books/ple/layouts/sales-14.2.yml +8 -8
- data/sunat_books.gemspec +4 -2
- data/test/helper.rb +1 -1
- data/test/ple/base_test.rb +14 -0
- metadata +9 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1d074f71e576ad2528da91297e05d1acfd14480829e7b77db8c27b3a13bd3943
|
4
|
+
data.tar.gz: cdc8de2ebedfe75f5e9169d82530b4c7d1b50c37909c1e2c8aae2f1f4d29104d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f5f87bcfa3ff0da39d7885cd8ddb5ab3d4aa2c607905e589f2c0ae2d9022f3dd7955deeae45bdc11c045f92719a3e4e4b17174059ee9d520916f6dbb6d6ccfeb
|
7
|
+
data.tar.gz: a42ef020ec2668c7bdbc674e44bbcc8bbfbed4240cfb27a591de483c61c2749d5cebbc26180d1dea3eb71de81a3bf0ca343982b1bfdecc06e89551ce995d8103
|
data/.rubocop.yml
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
AllCops:
|
2
|
-
TargetRubyVersion: 2.
|
2
|
+
TargetRubyVersion: 2.5
|
3
|
+
NewCops: enable
|
3
4
|
Style/Documentation:
|
4
5
|
Enabled: false
|
5
6
|
Style/StringLiterals:
|
@@ -26,3 +27,6 @@ Style/HashTransformKeys:
|
|
26
27
|
|
27
28
|
Style/HashTransformValues:
|
28
29
|
Enabled: true
|
30
|
+
|
31
|
+
Lint/MissingSuper:
|
32
|
+
Enabled: false
|
data/lib/sunat_books.rb
CHANGED
data/lib/sunat_books/pdf/base.rb
CHANGED
@@ -9,8 +9,7 @@ module PagesUtils
|
|
9
9
|
last_page
|
10
10
|
else
|
11
11
|
yield if block
|
12
|
-
|
13
|
-
new_page
|
12
|
+
setup_new_page(pages, last_page, 2)
|
14
13
|
end
|
15
14
|
end
|
16
15
|
|
@@ -37,7 +36,7 @@ module PagesUtils
|
|
37
36
|
end
|
38
37
|
|
39
38
|
def not_moviment_page(data)
|
40
|
-
data << [content: "SIN MOVIMIENTO EN EL PERIODO", colspan: 5]
|
39
|
+
data << [{ content: "SIN MOVIMIENTO EN EL PERIODO", colspan: 5 }]
|
41
40
|
end
|
42
41
|
|
43
42
|
def setup_final_row_data(page, ticket, data)
|
data/lib/sunat_books/ple/base.rb
CHANGED
@@ -24,6 +24,8 @@ module SunatBooks
|
|
24
24
|
def initialize(ruc, tickets, month, year, options = {})
|
25
25
|
@book_format = options[:book_format]
|
26
26
|
yml_path = options[:yml] || default_yml(book_format)
|
27
|
+
raise SunatBooks::Errors::InvalidLayoutError unless File.exist?(yml_path)
|
28
|
+
|
27
29
|
fields = YAML.load_file(yml_path)
|
28
30
|
check_layout(options, fields)
|
29
31
|
content = !tickets.empty? ? 1 : 0
|
@@ -2,25 +2,25 @@
|
|
2
2
|
- cuo # Código Unico de Operación, software (max 40)
|
3
3
|
- correlative # 2 ..10
|
4
4
|
- operation_date # 'dd/mm/yyyy'
|
5
|
-
-
|
5
|
+
- payment_date # 'dd/mm/yyyy'
|
6
6
|
- document_type # 2
|
7
7
|
- document_serial # max 20
|
8
|
-
-
|
8
|
+
- dua_year
|
9
9
|
- document_number # max 20
|
10
10
|
- total_diary_operation_non_credit # max 20
|
11
11
|
- provider_document_type
|
12
12
|
- provider_document_number # max 15
|
13
13
|
- provider_name # max 100
|
14
|
-
-
|
15
|
-
-
|
16
|
-
-
|
17
|
-
-
|
18
|
-
-
|
19
|
-
-
|
20
|
-
-
|
21
|
-
-
|
22
|
-
-
|
23
|
-
-
|
14
|
+
- bi_exported_only
|
15
|
+
- igv_exported_only
|
16
|
+
- bi_exported_non_taxable
|
17
|
+
- igv_exported_non_taxable
|
18
|
+
- bi_non_taxable_only
|
19
|
+
- igv_non_taxable_only
|
20
|
+
- non_taxable
|
21
|
+
- isc_tax
|
22
|
+
- other_tax
|
23
|
+
- total_operation
|
24
24
|
- currency_code
|
25
25
|
- exchange_rate # 1 entero, 3 decimales
|
26
26
|
- modified_document_date
|
@@ -31,11 +31,11 @@
|
|
31
31
|
- detraction_date
|
32
32
|
- detraction_number
|
33
33
|
- apply_retention? # retention ? '1'
|
34
|
-
-
|
35
|
-
-
|
36
|
-
-
|
37
|
-
-
|
38
|
-
-
|
39
|
-
-
|
34
|
+
- adquired_clasification
|
35
|
+
- contract_uid
|
36
|
+
- exchange_rate_error
|
37
|
+
- provider_inactive_error
|
38
|
+
- provider_exoneration_error
|
39
|
+
- provider_document_number_error # dni en liquidaciones compra
|
40
40
|
- payment_method
|
41
41
|
- anotation_oportunity
|
@@ -5,23 +5,23 @@
|
|
5
5
|
- document_type
|
6
6
|
- document_serial
|
7
7
|
- document_number
|
8
|
-
-
|
9
|
-
-
|
10
|
-
-
|
11
|
-
-
|
12
|
-
-
|
13
|
-
-
|
14
|
-
-
|
8
|
+
- bi
|
9
|
+
- other_concept
|
10
|
+
- total_operation
|
11
|
+
- document_type
|
12
|
+
- document_serial
|
13
|
+
- dua_year
|
14
|
+
- document_number
|
15
15
|
- retention_amount
|
16
16
|
- currency_code
|
17
17
|
- exchange_rate
|
18
|
-
-
|
19
|
-
-
|
20
|
-
-
|
21
|
-
-
|
22
|
-
-
|
23
|
-
-
|
24
|
-
-
|
18
|
+
- provider_country_code
|
19
|
+
- provider_name
|
20
|
+
- provider_address
|
21
|
+
- provider_document_number
|
22
|
+
- beneficiary_document_number
|
23
|
+
- beneficiary_name
|
24
|
+
- beneficiary_country_code
|
25
25
|
- economic_link_type
|
26
26
|
- gross_income
|
27
27
|
- deduction
|
@@ -2,7 +2,7 @@
|
|
2
2
|
- cuo
|
3
3
|
- correlative
|
4
4
|
- operation_date
|
5
|
-
-
|
5
|
+
- payment_date
|
6
6
|
- document_type
|
7
7
|
- document_serial
|
8
8
|
- document_number
|
@@ -10,10 +10,10 @@
|
|
10
10
|
- provider_document_type
|
11
11
|
- provider_document_number
|
12
12
|
- provider_name
|
13
|
-
-
|
14
|
-
-
|
15
|
-
-
|
16
|
-
-
|
13
|
+
- bi
|
14
|
+
- igv
|
15
|
+
- other_concept
|
16
|
+
- total_operation
|
17
17
|
- currency_code
|
18
18
|
- exchange_rate
|
19
19
|
- modified_document_date
|
@@ -23,9 +23,9 @@
|
|
23
23
|
- detraction_date
|
24
24
|
- detraction_number
|
25
25
|
- apply_retention?
|
26
|
-
-
|
27
|
-
-
|
28
|
-
-
|
29
|
-
-
|
26
|
+
- adquired_clasification
|
27
|
+
- exchange_rate_error
|
28
|
+
- provider_inactive_error
|
29
|
+
- provider_exoneration_error
|
30
30
|
- payment_method
|
31
31
|
- anotation_oportunity
|
@@ -2,7 +2,7 @@
|
|
2
2
|
- cuo
|
3
3
|
- correlative
|
4
4
|
- operation_date
|
5
|
-
-
|
5
|
+
- payment_date
|
6
6
|
- document_type
|
7
7
|
- document_serial
|
8
8
|
- initial_document_number
|
@@ -10,8 +10,8 @@
|
|
10
10
|
- client_document_type
|
11
11
|
- client_document_number
|
12
12
|
- client_name
|
13
|
-
-
|
14
|
-
-
|
13
|
+
- bi_exported
|
14
|
+
- bi_taxable
|
15
15
|
- bi_discount
|
16
16
|
- igv_tax
|
17
17
|
- igv_discount
|
@@ -24,10 +24,11 @@
|
|
24
24
|
- total_operation
|
25
25
|
- currency_code
|
26
26
|
- exchange_rate
|
27
|
-
-
|
28
|
-
-
|
29
|
-
-
|
30
|
-
-
|
27
|
+
- modified_document_date
|
28
|
+
- modified_document_type
|
29
|
+
- modified_document_serial
|
30
|
+
- modified_document_number
|
31
31
|
- contract_uid
|
32
|
-
-
|
32
|
+
- exchange_rate_error
|
33
|
+
- payment_method
|
33
34
|
- anotation_oportunity
|
@@ -2,7 +2,7 @@
|
|
2
2
|
- cuo
|
3
3
|
- correlative
|
4
4
|
- operation_date
|
5
|
-
-
|
5
|
+
- payment_date
|
6
6
|
- document_type
|
7
7
|
- document_serial
|
8
8
|
- initial_document_number
|
@@ -10,16 +10,16 @@
|
|
10
10
|
- client_document_type
|
11
11
|
- client_document_number
|
12
12
|
- client_name
|
13
|
-
-
|
13
|
+
- bi_taxable
|
14
14
|
- igv_tax
|
15
|
-
-
|
15
|
+
- other_concept
|
16
16
|
- total_operation
|
17
17
|
- currency_code
|
18
18
|
- exchange_rate
|
19
|
-
-
|
20
|
-
-
|
21
|
-
-
|
22
|
-
-
|
19
|
+
- modified_document_date
|
20
|
+
- modified_document_type
|
21
|
+
- modified_document_serial
|
22
|
+
- modified_document_number
|
23
23
|
- exchange_rate_error
|
24
|
-
-
|
24
|
+
- payment_method
|
25
25
|
- anotation_oportunity
|
data/sunat_books.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = "sunat_books"
|
5
|
-
s.version = "0.1.
|
5
|
+
s.version = "0.1.1"
|
6
6
|
s.summary = "A ruby gem to get accounting books for SUNAT"
|
7
7
|
s.description = s.summary
|
8
8
|
s.authors = ["César Carruitero"]
|
@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
|
|
12
12
|
|
13
13
|
s.files = `git ls-files`.split("\n")
|
14
14
|
|
15
|
-
s.add_runtime_dependency("activesupport"
|
15
|
+
s.add_runtime_dependency("activesupport")
|
16
16
|
s.add_runtime_dependency("i18n", "~> 1.8")
|
17
17
|
s.add_runtime_dependency("prawn", "~> 2.0")
|
18
18
|
s.add_runtime_dependency("prawn-table", "~> 0.2")
|
@@ -22,4 +22,6 @@ Gem::Specification.new do |s|
|
|
22
22
|
s.add_development_dependency("pdf-inspector", "~> 1.3.0")
|
23
23
|
s.add_development_dependency("pry", "~> 0.10")
|
24
24
|
s.add_development_dependency("rubocop", "~> 0.48")
|
25
|
+
|
26
|
+
s.required_ruby_version = ">= 2.5.0"
|
25
27
|
end
|
data/test/helper.rb
CHANGED
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "../helper"
|
4
|
+
|
5
|
+
setup do
|
6
|
+
@tickets = [{}]
|
7
|
+
@ruc = "102392839213"
|
8
|
+
end
|
9
|
+
|
10
|
+
test "raise error when layout file doesnt exist" do
|
11
|
+
assert_raise SunatBooks::Errors::InvalidLayoutError do
|
12
|
+
SunatBooks::Ple::Base.new(@ruc, @tickets, 10, 2013, { yml: "not-file" })
|
13
|
+
end
|
14
|
+
end
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sunat_books
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
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: 2020-
|
11
|
+
date: 2020-11-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: i18n
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -154,6 +154,7 @@ files:
|
|
154
154
|
- lib/sunat_books/common_utils.rb
|
155
155
|
- lib/sunat_books/csv/base.rb
|
156
156
|
- lib/sunat_books/csv/option_error.rb
|
157
|
+
- lib/sunat_books/errors/invalid_layout_error.rb
|
157
158
|
- lib/sunat_books/pdf/base.rb
|
158
159
|
- lib/sunat_books/pdf/buys.rb
|
159
160
|
- lib/sunat_books/pdf/count_sum.rb
|
@@ -191,6 +192,7 @@ files:
|
|
191
192
|
- test/pdf/pages_utils_test.rb
|
192
193
|
- test/pdf/sales_test.rb
|
193
194
|
- test/pdf/utils_test.rb
|
195
|
+
- test/ple/base_test.rb
|
194
196
|
- test/ple/buys_test.rb
|
195
197
|
- test/ple/sales_test.rb
|
196
198
|
- test/ple/utils_test.rb
|
@@ -206,7 +208,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
206
208
|
requirements:
|
207
209
|
- - ">="
|
208
210
|
- !ruby/object:Gem::Version
|
209
|
-
version:
|
211
|
+
version: 2.5.0
|
210
212
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
211
213
|
requirements:
|
212
214
|
- - ">="
|