br_danfe 2.1.0 → 3.1.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/.github/workflows/config.yml +19 -10
- data/.octocov.yml +18 -0
- data/Gemfile +0 -1
- data/Gemfile.lock +23 -24
- data/config/locales/pt-BR.yml +4 -3
- data/fonts/Arimo-LICENSE.txt +118 -0
- data/fonts/arimo.ttf +0 -0
- data/fonts/arimo_bold.ttf +0 -0
- data/fonts/arimo_bold_italic.ttf +0 -0
- data/fonts/arimo_italic.ttf +0 -0
- data/lib/br_danfe/danfe_lib/nfce_lib/header.rb +1 -5
- data/lib/br_danfe/danfe_lib/nfce_lib/recipient.rb +1 -1
- data/lib/br_danfe/danfe_lib/nfe_lib/consts.rb +7 -0
- data/lib/br_danfe/danfe_lib/nfe_lib/dest.rb +3 -3
- data/lib/br_danfe/danfe_lib/nfe_lib/det_body.rb +12 -4
- data/lib/br_danfe/danfe_lib/nfe_lib/document.rb +27 -14
- data/lib/br_danfe/danfe_lib/nfe_lib/dup.rb +34 -20
- data/lib/br_danfe/danfe_lib/nfe_lib/emit_header.rb +34 -17
- data/lib/br_danfe/danfe_lib/nfe_lib/entrega.rb +3 -3
- data/lib/br_danfe/danfe_lib/nfe_lib/helper.rb +8 -0
- data/lib/br_danfe/danfe_lib/nfe_lib/infadic.rb +4 -4
- data/lib/br_danfe/danfe_lib/nfe_lib/ticket.rb +30 -6
- data/lib/br_danfe/danfe_lib/nfe_lib/transp.rb +2 -2
- data/lib/br_danfe/danfe_lib/nfe_lib/vol.rb +1 -1
- data/lib/br_danfe/document_builder.rb +7 -0
- data/lib/br_danfe/helper.rb +4 -0
- data/lib/br_danfe/version.rb +1 -1
- data/spec/br_danfe/cce_lib/document_spec.rb +12 -0
- data/spec/br_danfe/danfe_lib/nfce_lib/document_spec.rb +12 -0
- data/spec/br_danfe/danfe_lib/nfe_lib/document_spec.rb +12 -0
- data/spec/br_danfe/helper_spec.rb +25 -0
- data/spec/fixtures/nfe/lib/dest#render-v2.00.pdf +0 -0
- data/spec/fixtures/nfe/lib/dest#render-v3.10.pdf +0 -0
- data/spec/fixtures/nfe/lib/dest#render-v4.00.pdf +0 -0
- data/spec/fixtures/nfe/lib/dest#render-with-address-bigger.pdf +0 -0
- data/spec/fixtures/nfe/lib/dest#render-with_cnpj.pdf +0 -0
- data/spec/fixtures/nfe/lib/dest#render-with_cpf.pdf +0 -0
- data/spec/fixtures/nfe/lib/dest#render-with_ie.pdf +0 -0
- data/spec/fixtures/nfe/lib/dest#render-without-address-complement.pdf +0 -0
- data/spec/fixtures/nfe/lib/det_body#render-csosn.pdf +1234 -1223
- data/spec/fixtures/nfe/lib/det_body#render-cst.pdf +836 -771
- data/spec/fixtures/nfe/lib/det_body#render-fci.pdf +613 -527
- data/spec/fixtures/nfe/lib/det_body#render-icms_st.pdf +619 -534
- data/spec/fixtures/nfe/lib/det_body#render-quantity_with_custom_precision.pdf +609 -522
- data/spec/fixtures/nfe/lib/det_body#render-three_pages.pdf +10032 -11157
- data/spec/fixtures/nfe/lib/det_body#render-two_pages.pdf +9834 -10928
- data/spec/fixtures/nfe/lib/det_body#render-unit_price_with_custom_precision.pdf +609 -522
- data/spec/fixtures/nfe/lib/det_body#render-with_entrega.pdf +620 -527
- data/spec/fixtures/nfe/lib/det_body#render-with_infadprod.pdf +614 -539
- data/spec/fixtures/nfe/lib/det_body#render-with_issqn.pdf +4812 -5222
- data/spec/fixtures/nfe/lib/det_body#render-without_issqn.pdf +4454 -5414
- data/spec/fixtures/nfe/lib/document#lcnpj_cpf-blank.pdf +0 -0
- data/spec/fixtures/nfe/lib/document#lcnpj_cpf-invalid.pdf +0 -0
- data/spec/fixtures/nfe/lib/document#lcnpj_cpf-valid.pdf +0 -0
- data/spec/fixtures/nfe/lib/document#lie-blank-uf-invalid.pdf +0 -0
- data/spec/fixtures/nfe/lib/document#lie-blank.pdf +0 -0
- data/spec/fixtures/nfe/lib/document#lie-invalid.pdf +0 -0
- data/spec/fixtures/nfe/lib/document#lie-valid.pdf +0 -0
- data/spec/fixtures/nfe/lib/dup#render-with_entrega.pdf +0 -0
- data/spec/fixtures/nfe/lib/dup#render.pdf +0 -0
- data/spec/fixtures/nfe/lib/emit_header#render-nfe_key.pdf +225 -251
- data/spec/fixtures/nfe/lib/emit_header#render-second_page.pdf +225 -251
- data/spec/fixtures/nfe/lib/emit_header#render-with_cpf.pdf +222 -249
- data/spec/fixtures/nfe/lib/emit_header#render-with_logo.pdf +225 -251
- data/spec/fixtures/nfe/lib/emit_header#render-without_logo.pdf +223 -249
- data/spec/fixtures/nfe/lib/entrega#render-v2.00.pdf +0 -0
- data/spec/fixtures/nfe/lib/entrega#render-with-address-bigger.pdf +0 -0
- data/spec/fixtures/nfe/lib/entrega#render-with_cpf.pdf +0 -0
- data/spec/fixtures/nfe/lib/icmstot#render-with_entrega.pdf +0 -0
- data/spec/fixtures/nfe/lib/icmstot#render.pdf +0 -0
- data/spec/fixtures/nfe/lib/infadic#render-all_the_informations.pdf +0 -0
- data/spec/fixtures/nfe/lib/infadic#render-difal.pdf +0 -0
- data/spec/fixtures/nfe/lib/infadic#render-extra_volume.pdf +0 -0
- data/spec/fixtures/nfe/lib/infadic#render-with_complementary_information.pdf +0 -0
- data/spec/fixtures/nfe/lib/infadic#render-with_dup_additional_information.pdf +0 -0
- data/spec/fixtures/nfe/lib/infadic#render-with_fisco_additional_information.pdf +0 -0
- data/spec/fixtures/nfe/lib/infadic#render-with_street_data.pdf +0 -0
- data/spec/fixtures/nfe/lib/infadic#render-without_dup_additional_information.pdf +0 -0
- data/spec/fixtures/nfe/lib/infadic#render.pdf +0 -0
- data/spec/fixtures/nfe/lib/infadic_vol#render-extra_volume.pdf +0 -0
- data/spec/fixtures/nfe/lib/issqn#render-with_entrega.pdf +0 -0
- data/spec/fixtures/nfe/lib/issqn#render-with_issqn.pdf +0 -0
- data/spec/fixtures/nfe/lib/issqn#render-with_one_issqn_value.pdf +0 -0
- data/spec/fixtures/nfe/lib/issqn#render-without_issqn.pdf +4 -4
- data/spec/fixtures/nfe/lib/ticket#render.pdf +0 -0
- data/spec/fixtures/nfe/lib/ticket#render_with_dEmit.pdf +0 -0
- data/spec/fixtures/nfe/lib/ticket#render_with_dhEmit.pdf +0 -0
- data/spec/fixtures/nfe/lib/transp#render-modfrete_0.pdf +0 -0
- data/spec/fixtures/nfe/lib/transp#render-modfrete_1.pdf +0 -0
- data/spec/fixtures/nfe/lib/transp#render-modfrete_2.pdf +0 -0
- data/spec/fixtures/nfe/lib/transp#render-modfrete_3.pdf +0 -0
- data/spec/fixtures/nfe/lib/transp#render-modfrete_4.pdf +0 -0
- data/spec/fixtures/nfe/lib/transp#render-modfrete_9.pdf +0 -0
- data/spec/fixtures/nfe/lib/transp#render-with_entrega.pdf +0 -0
- data/spec/fixtures/nfe/lib/transp#render.pdf +0 -0
- data/spec/fixtures/nfe/lib/vol#render-blank-boxes.pdf +0 -0
- data/spec/fixtures/nfe/lib/vol#render-with_entrega.pdf +0 -0
- data/spec/fixtures/nfe/lib/vol#render.pdf +0 -0
- data/spec/fixtures/nfe/v2.00/custom_options.fixture.pdf +1484 -1417
- data/spec/fixtures/nfe/v2.00/nfe_simples_nacional.xml.fixture.pdf +1481 -1407
- data/spec/fixtures/nfe/v2.00/nfe_with_entrega.xml.fixture.pdf +1544 -1451
- data/spec/fixtures/nfe/v2.00/nfe_with_extra_volumes.xml.fixture.pdf +4604 -6164
- data/spec/fixtures/nfe/v2.00/nfe_with_fci.xml.fixture.pdf +1091 -1005
- data/spec/fixtures/nfe/v2.00/nfe_with_ns.xml.fixture.pdf +4657 -6185
- data/spec/fixtures/nfe/v2.00/nfe_without_ns.xml.fixture.pdf +1492 -1449
- data/spec/fixtures/nfe/v3.10/multiples.xmls.on.the.same.pdf.pdf +5190 -5309
- data/spec/fixtures/nfe/v3.10/nfe_simples_nacional.xml.fixture.pdf +2684 -2771
- data/spec/fixtures/nfe/v3.10/with_footer.fixture.pdf +4095 -5042
- data/spec/fixtures/nfe/v3.10/with_issqn.fixture.pdf +3704 -3901
- data/spec/fixtures/nfe/v3.10/with_three_pages.fixture.pdf +11692 -13493
- data/spec/fixtures/nfe/v3.10/without_issqn.fixture.pdf +4569 -5591
- data/spec/spec_helper.rb +6 -6
- metadata +13 -9
- data/lib/br_danfe/danfe_lib/nfce_lib/helper.rb +0 -11
- data/spec/br_danfe/danfe_lib/nfce_lib/helper_spec.rb +0 -28
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a35847dcbae6504c66476c8d5f59dd87816e0dc16b292300b18ebd2f1914ffb7
|
|
4
|
+
data.tar.gz: 2b00c692e871d8c0aa4007d08e5e388d6ca1201aafc52a965402046ea5126661
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 45acd64522683cf03b6d12cb5e590bd1dd4e6c9fff12719e14a066985e3304ada0b21e69f052cced74d855f2471b724b72af024d8d5e2e3a27a701a1642b6612
|
|
7
|
+
data.tar.gz: 76889322d06ca78f1913e8a1883f97a71ca8720895b004aee58806c7b002aee40389d03e6d66500a641acfb4774777fda3dc7a4610b573e603e72dc0a9dc2148
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
name: Tests
|
|
2
2
|
|
|
3
|
-
on:
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [master]
|
|
6
|
+
pull_request:
|
|
4
7
|
|
|
5
8
|
jobs:
|
|
6
9
|
linter:
|
|
7
10
|
strategy:
|
|
8
11
|
fail-fast: false # I understand this is to run on all versions.
|
|
9
12
|
matrix:
|
|
10
|
-
ruby: ['
|
|
13
|
+
ruby: ['4.0']
|
|
11
14
|
|
|
12
15
|
runs-on: ubuntu-latest
|
|
13
16
|
|
|
@@ -25,10 +28,15 @@ jobs:
|
|
|
25
28
|
strategy:
|
|
26
29
|
fail-fast: false # I understand this is to run on all versions.
|
|
27
30
|
matrix:
|
|
28
|
-
ruby: ['
|
|
31
|
+
ruby: ['4.0']
|
|
29
32
|
|
|
30
33
|
runs-on: ubuntu-latest
|
|
31
34
|
|
|
35
|
+
permissions:
|
|
36
|
+
contents: read
|
|
37
|
+
pull-requests: write
|
|
38
|
+
actions: read
|
|
39
|
+
|
|
32
40
|
steps:
|
|
33
41
|
- uses: actions/checkout@v3
|
|
34
42
|
|
|
@@ -37,11 +45,12 @@ jobs:
|
|
|
37
45
|
ruby-version: ${{ matrix.ruby }}
|
|
38
46
|
bundler-cache: true
|
|
39
47
|
|
|
40
|
-
- run:
|
|
41
|
-
|
|
48
|
+
- run: bundle exec rspec
|
|
49
|
+
|
|
50
|
+
- uses: actions/upload-artifact@v4
|
|
51
|
+
with:
|
|
52
|
+
name: coverage-html
|
|
53
|
+
path: coverage/
|
|
42
54
|
|
|
43
|
-
-
|
|
44
|
-
|
|
45
|
-
~/.qlty/bin/qlty coverage publish coverage/coverage.json
|
|
46
|
-
env:
|
|
47
|
-
QLTY_COVERAGE_TOKEN: ${{secrets.QLTY_COVERAGE_TOKEN}}
|
|
55
|
+
- uses: k1LoW/octocov-action@v1
|
|
56
|
+
if: ${{ !github.event.pull_request.head.repo.fork }}
|
data/.octocov.yml
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
coverage:
|
|
2
|
+
paths:
|
|
3
|
+
- coverage/.resultset.json
|
|
4
|
+
|
|
5
|
+
comment:
|
|
6
|
+
if: is_pull_request
|
|
7
|
+
|
|
8
|
+
summary:
|
|
9
|
+
if: is_pull_request
|
|
10
|
+
|
|
11
|
+
report:
|
|
12
|
+
if: is_default_branch
|
|
13
|
+
datastores:
|
|
14
|
+
- artifact://${GITHUB_REPOSITORY}
|
|
15
|
+
|
|
16
|
+
diff:
|
|
17
|
+
datastores:
|
|
18
|
+
- artifact://${GITHUB_REPOSITORY}
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
br_danfe (
|
|
4
|
+
br_danfe (3.1.0)
|
|
5
5
|
barby (= 0.6.9)
|
|
6
6
|
br_documents (>= 0.1.3)
|
|
7
7
|
i18n (>= 0.8.6)
|
|
@@ -14,35 +14,37 @@ GEM
|
|
|
14
14
|
remote: https://rubygems.org/
|
|
15
15
|
specs:
|
|
16
16
|
Ascii85 (1.1.0)
|
|
17
|
-
activemodel (
|
|
18
|
-
activesupport (=
|
|
19
|
-
activesupport (
|
|
17
|
+
activemodel (8.1.4.1)
|
|
18
|
+
activesupport (= 8.1.4.1)
|
|
19
|
+
activesupport (8.1.4.1)
|
|
20
20
|
base64
|
|
21
21
|
bigdecimal
|
|
22
|
-
concurrent-ruby (~> 1.0, >= 1.
|
|
22
|
+
concurrent-ruby (~> 1.0, >= 1.3.1)
|
|
23
23
|
connection_pool (>= 2.2.5)
|
|
24
24
|
drb
|
|
25
25
|
i18n (>= 1.6, < 2)
|
|
26
|
+
json
|
|
27
|
+
logger (>= 1.4.2)
|
|
26
28
|
minitest (>= 5.1)
|
|
27
|
-
|
|
28
|
-
tzinfo (~> 2.0)
|
|
29
|
+
securerandom (>= 0.3)
|
|
30
|
+
tzinfo (~> 2.0, >= 2.0.5)
|
|
31
|
+
uri (>= 0.13.1)
|
|
29
32
|
afm (0.2.2)
|
|
30
33
|
ast (2.4.3)
|
|
31
34
|
barby (0.6.9)
|
|
32
|
-
base64 (0.
|
|
33
|
-
bigdecimal (3.1
|
|
35
|
+
base64 (0.3.0)
|
|
36
|
+
bigdecimal (3.3.1)
|
|
34
37
|
br_documents (0.2.5)
|
|
35
38
|
activemodel (>= 4.0.0)
|
|
36
39
|
i18n (>= 0.6.5)
|
|
37
40
|
byebug (11.1.3)
|
|
38
41
|
chunky_png (1.4.0)
|
|
39
42
|
coderay (1.1.3)
|
|
40
|
-
concurrent-ruby (1.3.
|
|
41
|
-
connection_pool (
|
|
43
|
+
concurrent-ruby (1.3.8)
|
|
44
|
+
connection_pool (3.0.3)
|
|
42
45
|
diff-lcs (1.5.1)
|
|
43
46
|
docile (1.4.1)
|
|
44
|
-
drb (2.2.
|
|
45
|
-
ruby2_keywords
|
|
47
|
+
drb (2.2.3)
|
|
46
48
|
ffi (1.17.0)
|
|
47
49
|
formatador (1.1.0)
|
|
48
50
|
guard (2.19.0)
|
|
@@ -60,7 +62,7 @@ GEM
|
|
|
60
62
|
guard-compat (~> 1.1)
|
|
61
63
|
rspec (>= 2.99.0, < 4.0)
|
|
62
64
|
hashery (2.1.2)
|
|
63
|
-
i18n (1.
|
|
65
|
+
i18n (1.15.2)
|
|
64
66
|
concurrent-ruby (~> 1.0)
|
|
65
67
|
json (2.11.3)
|
|
66
68
|
language_server-protocol (3.17.0.4)
|
|
@@ -68,12 +70,12 @@ GEM
|
|
|
68
70
|
listen (3.9.0)
|
|
69
71
|
rb-fsevent (~> 0.10, >= 0.10.3)
|
|
70
72
|
rb-inotify (~> 0.9, >= 0.9.10)
|
|
73
|
+
logger (1.7.0)
|
|
71
74
|
lumberjack (1.2.10)
|
|
72
75
|
matrix (0.4.2)
|
|
73
76
|
method_source (1.1.0)
|
|
74
77
|
mini_portile2 (2.8.7)
|
|
75
|
-
minitest (5.
|
|
76
|
-
mutex_m (0.2.0)
|
|
78
|
+
minitest (5.27.0)
|
|
77
79
|
nenv (0.3.0)
|
|
78
80
|
nokogiri (1.16.7)
|
|
79
81
|
mini_portile2 (~> 2.8.2)
|
|
@@ -157,25 +159,23 @@ GEM
|
|
|
157
159
|
rubocop-factory_bot (~> 2.22)
|
|
158
160
|
ruby-progressbar (1.13.0)
|
|
159
161
|
ruby-rc4 (0.1.5)
|
|
160
|
-
|
|
162
|
+
securerandom (0.4.1)
|
|
161
163
|
shellany (0.0.1)
|
|
162
164
|
simplecov (0.22.0)
|
|
163
165
|
docile (~> 1.1)
|
|
164
166
|
simplecov-html (~> 0.11)
|
|
165
167
|
simplecov_json_formatter (~> 0.1)
|
|
166
168
|
simplecov-html (0.13.1)
|
|
167
|
-
simplecov-json (0.2.3)
|
|
168
|
-
json
|
|
169
|
-
simplecov
|
|
170
169
|
simplecov_json_formatter (0.1.4)
|
|
171
170
|
thor (1.3.2)
|
|
172
171
|
ttfunk (1.8.0)
|
|
173
172
|
bigdecimal (~> 3.1)
|
|
174
173
|
tzinfo (2.0.6)
|
|
175
174
|
concurrent-ruby (~> 1.0)
|
|
176
|
-
unicode-display_width (3.
|
|
177
|
-
unicode-emoji (~> 4.
|
|
178
|
-
unicode-emoji (4.0
|
|
175
|
+
unicode-display_width (3.3.0)
|
|
176
|
+
unicode-emoji (~> 4.3)
|
|
177
|
+
unicode-emoji (4.3.0)
|
|
178
|
+
uri (1.1.2)
|
|
179
179
|
|
|
180
180
|
PLATFORMS
|
|
181
181
|
ruby
|
|
@@ -193,7 +193,6 @@ DEPENDENCIES
|
|
|
193
193
|
rubocop-rspec (~> 2.25.0)
|
|
194
194
|
simplecov (= 0.22.0)
|
|
195
195
|
simplecov-html (= 0.13.1)
|
|
196
|
-
simplecov-json (= 0.2.3)
|
|
197
196
|
|
|
198
197
|
BUNDLED WITH
|
|
199
198
|
2.5.5
|
data/config/locales/pt-BR.yml
CHANGED
|
@@ -18,7 +18,7 @@ pt-BR:
|
|
|
18
18
|
infProt: "PROTOCOLO DE AUTORIZAÇÃO DE USO"
|
|
19
19
|
others:
|
|
20
20
|
has_no_fiscal_value: "SEM VALOR FISCAL"
|
|
21
|
-
page: "FOLHA %{current}
|
|
21
|
+
page: "FOLHA %{current}/%{total}"
|
|
22
22
|
danfe: "DOCUMENTO AUXILIAR DA NOTA FISCAL ELETRÔNICA"
|
|
23
23
|
sefaz: "Consulta de autenticidade no portal nacional da NF-e www.nfe.fazenda.gov.br/portal ou no site da Sefaz Autorizadora"
|
|
24
24
|
ide:
|
|
@@ -28,7 +28,8 @@ pt-BR:
|
|
|
28
28
|
tpNF:
|
|
29
29
|
entry: "ENTRADA"
|
|
30
30
|
departure: "SAÍDA"
|
|
31
|
-
|
|
31
|
+
nNF: "Nº %{nNF}"
|
|
32
|
+
serie: "SÉRIE %{serie}"
|
|
32
33
|
natOp: "NATUREZA DA OPERAÇÃO"
|
|
33
34
|
dest:
|
|
34
35
|
title: "DESTINATÁRIO / REMETENTE"
|
|
@@ -144,7 +145,7 @@ pt-BR:
|
|
|
144
145
|
xNome: "RECEBEMOS DE %{xNome} OS PRODUTOS/SERVIÇOS CONSTANTES DA NOTA FISCAL INDICADA AO LADO"
|
|
145
146
|
received_at: "DATA DE RECEBIMENTO"
|
|
146
147
|
receiver: "IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR"
|
|
147
|
-
|
|
148
|
+
title: "NF-e"
|
|
148
149
|
entrega:
|
|
149
150
|
title: "INFORMAÇÕES DO LOCAL DE ENTREGA"
|
|
150
151
|
CNPJ: "CNPJ/CPF"
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
Copyright 2010-2020 Google Inc. / Google LLC.
|
|
2
|
+
|
|
3
|
+
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
|
4
|
+
|
|
5
|
+
PREAMBLE
|
|
6
|
+
|
|
7
|
+
The goals of the Open Font License (OFL) are to stimulate
|
|
8
|
+
worldwide development of collaborative font projects,
|
|
9
|
+
to support the font creation efforts
|
|
10
|
+
of academic and linguistic communities,
|
|
11
|
+
and to provide a free and open framework
|
|
12
|
+
in which fonts may be shared and improved
|
|
13
|
+
in partnership with others.
|
|
14
|
+
|
|
15
|
+
The OFL allows the licensed fonts to be used, studied,
|
|
16
|
+
modified and redistributed freely
|
|
17
|
+
as long as they are not sold by themselves.
|
|
18
|
+
The fonts, including any derivative works,
|
|
19
|
+
can be bundled, embedded,
|
|
20
|
+
redistributed and/or sold with any software
|
|
21
|
+
provided that any reserved names are not used
|
|
22
|
+
by derivative works.
|
|
23
|
+
The fonts and derivatives, however,
|
|
24
|
+
cannot be released under any other type of license.
|
|
25
|
+
The requirement for fonts to remain under this license
|
|
26
|
+
does not apply to any document
|
|
27
|
+
created using the fonts or their derivatives.
|
|
28
|
+
|
|
29
|
+
DEFINITIONS
|
|
30
|
+
|
|
31
|
+
"Font Software" refers to the set of files
|
|
32
|
+
released by the Copyright Holder(s) under this license
|
|
33
|
+
and clearly marked as such.
|
|
34
|
+
This may include source files, build scripts and documentation.
|
|
35
|
+
|
|
36
|
+
"Reserved Font Name" refers to any names specified as such
|
|
37
|
+
after the copyright statement(s).
|
|
38
|
+
|
|
39
|
+
"Original Version" refers to the collection
|
|
40
|
+
of Font Software components
|
|
41
|
+
as distributed by the Copyright Holder(s).
|
|
42
|
+
|
|
43
|
+
"Modified Version" refers to any derivative
|
|
44
|
+
made by adding to, deleting, or substituting --
|
|
45
|
+
in part or in whole --
|
|
46
|
+
any of the components of the Original Version,
|
|
47
|
+
by changing formats
|
|
48
|
+
or by porting the Font Software to a new environment.
|
|
49
|
+
|
|
50
|
+
"Author" refers to any designer, engineer, programmer,
|
|
51
|
+
technical writer or other person
|
|
52
|
+
who contributed to the Font Software.
|
|
53
|
+
|
|
54
|
+
PERMISSION & CONDITIONS
|
|
55
|
+
|
|
56
|
+
Permission is hereby granted, free of charge,
|
|
57
|
+
to any person obtaining a copy of the Font Software,
|
|
58
|
+
to use, study, copy, merge, embed, modify, redistribute,
|
|
59
|
+
and sell modified and unmodified copies of the Font Software,
|
|
60
|
+
subject to the following conditions:
|
|
61
|
+
|
|
62
|
+
1) Neither the Font Software nor any of its individual components,
|
|
63
|
+
in Original or Modified Versions,
|
|
64
|
+
may be sold by itself.
|
|
65
|
+
|
|
66
|
+
2) Original or Modified Versions of the Font Software
|
|
67
|
+
may be bundled, redistributed and/or sold with any software,
|
|
68
|
+
provided that each copy contains the above copyright notice
|
|
69
|
+
and this license.
|
|
70
|
+
These can be included either as stand-alone text files,
|
|
71
|
+
human-readable headers or in the appropriate
|
|
72
|
+
machine-readable metadata fields within text or binary files
|
|
73
|
+
as long as those fields can be easily viewed by the user.
|
|
74
|
+
|
|
75
|
+
3) No Modified Version of the Font Software may use
|
|
76
|
+
the Reserved Font Name(s)
|
|
77
|
+
unless explicit written permission is granted
|
|
78
|
+
by the corresponding Copyright Holder.
|
|
79
|
+
This restriction only applies to the primary font name
|
|
80
|
+
as presented to the users.
|
|
81
|
+
|
|
82
|
+
4) The name(s) of the Copyright Holder(s)
|
|
83
|
+
or the Author(s) of the Font Software
|
|
84
|
+
shall not be used to promote,
|
|
85
|
+
endorse or advertise any Modified Version,
|
|
86
|
+
except to acknowledge the contribution(s)
|
|
87
|
+
of the Copyright Holder(s) and the Author(s)
|
|
88
|
+
or with their explicit written permission.
|
|
89
|
+
|
|
90
|
+
5) The Font Software,
|
|
91
|
+
modified or unmodified, in part or in whole,
|
|
92
|
+
must be distributed entirely under this license,
|
|
93
|
+
and must not be distributed under any other license.
|
|
94
|
+
The requirement for fonts to remain under this license
|
|
95
|
+
does not apply to any document
|
|
96
|
+
created using the Font Software.
|
|
97
|
+
|
|
98
|
+
TERMINATION
|
|
99
|
+
|
|
100
|
+
This license becomes null and void
|
|
101
|
+
if any of the above conditions are not met.
|
|
102
|
+
|
|
103
|
+
DISCLAIMER
|
|
104
|
+
|
|
105
|
+
THE FONT SOFTWARE IS PROVIDED "AS IS",
|
|
106
|
+
WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
|
107
|
+
INCLUDING BUT NOT LIMITED TO
|
|
108
|
+
ANY WARRANTIES OF MERCHANTABILITY,
|
|
109
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
|
110
|
+
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT.
|
|
111
|
+
IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE
|
|
112
|
+
FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
113
|
+
INCLUDING ANY GENERAL, SPECIAL, INDIRECT,
|
|
114
|
+
INCIDENTAL, OR CONSEQUENTIAL DAMAGES,
|
|
115
|
+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
|
116
|
+
ARISING FROM, OUT OF THE USE OR INABILITY TO USE
|
|
117
|
+
THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE.
|
|
118
|
+
|
data/fonts/arimo.ttf
ADDED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -30,7 +30,7 @@ module BrDanfe
|
|
|
30
30
|
@pdf.text_box cnpj(@xml['emit/CNPJ']), at: [x_position, @pdf.cursor], height: 9, size: 9, align: :left, overflow: :shrink_to_fit
|
|
31
31
|
@pdf.move_down 9
|
|
32
32
|
|
|
33
|
-
@pdf.text_box BrDanfe::
|
|
33
|
+
@pdf.text_box BrDanfe::Helper.address(@xml.css('enderEmit')), at: [x_position, @pdf.cursor], height: 20, size: 9, align: :left, overflow: :shrink_to_fit
|
|
34
34
|
@pdf.move_down 20
|
|
35
35
|
@pdf.render_blank_line if count_name_lines(@xml['emit/xNome']) == one_line
|
|
36
36
|
end
|
|
@@ -39,10 +39,6 @@ module BrDanfe
|
|
|
39
39
|
@logo.present? ? 2.2.cm : 0
|
|
40
40
|
end
|
|
41
41
|
|
|
42
|
-
def width_box
|
|
43
|
-
@logo.present? ? 4.5.cm : 6.7.cm
|
|
44
|
-
end
|
|
45
|
-
|
|
46
42
|
def cnpj(info)
|
|
47
43
|
cnpj = BrDocuments::CnpjCpf::Cnpj.new info
|
|
48
44
|
"CNPJ: #{cnpj.valid? ? cnpj.formatted : ''}"
|
|
@@ -14,7 +14,7 @@ module BrDanfe
|
|
|
14
14
|
render_document
|
|
15
15
|
|
|
16
16
|
@pdf.text @xml['dest/xNome'], options
|
|
17
|
-
@pdf.text BrDanfe::
|
|
17
|
+
@pdf.text BrDanfe::Helper.address(@xml.css('enderDest')), options
|
|
18
18
|
else
|
|
19
19
|
@pdf.text 'CONSUMIDOR NÃO IDENTIFICADO', options
|
|
20
20
|
end
|
|
@@ -3,6 +3,13 @@ module BrDanfe
|
|
|
3
3
|
module NfeLib
|
|
4
4
|
LINE_HEIGHT = 0.80
|
|
5
5
|
SPACE_BETWEEN_GROUPS = 0.52
|
|
6
|
+
LINE_WIDTH = 0.24
|
|
7
|
+
CELL_PADDING = 3
|
|
8
|
+
TITLE_HEIGHT = 0.325
|
|
9
|
+
CONTENT_WIDTH = 19.56
|
|
10
|
+
TITLE_BACKGROUND_COLOR = 'EFEFEF'.freeze
|
|
11
|
+
LABEL_COLOR = '595959'.freeze
|
|
12
|
+
TEXT_COLOR = '000000'.freeze
|
|
6
13
|
end
|
|
7
14
|
end
|
|
8
15
|
end
|
|
@@ -74,9 +74,9 @@ module BrDanfe
|
|
|
74
74
|
end
|
|
75
75
|
|
|
76
76
|
def render_dates(emitted_at_date_and_hour, exited_at_date, exited_at_hour)
|
|
77
|
-
@pdf.ldate LINE_HEIGHT, 2.
|
|
78
|
-
@pdf.ldate LINE_HEIGHT, 2.
|
|
79
|
-
@pdf.ltime LINE_HEIGHT, 2.
|
|
77
|
+
@pdf.ldate LINE_HEIGHT, 2.91, 17.40, @l1, 'ide.dEmi', @xml[emitted_at_date_and_hour], align: :right
|
|
78
|
+
@pdf.ldate LINE_HEIGHT, 2.91, 17.40, @l2, 'ide.dSaiEnt', @xml[exited_at_date], align: :right
|
|
79
|
+
@pdf.ltime LINE_HEIGHT, 2.91, 17.40, @l3, 'ide.hSaiEnt', @xml[exited_at_hour], align: :right
|
|
80
80
|
end
|
|
81
81
|
|
|
82
82
|
def render_dates_for_older_nfes
|
|
@@ -2,6 +2,8 @@ module BrDanfe
|
|
|
2
2
|
module DanfeLib
|
|
3
3
|
module NfeLib
|
|
4
4
|
class DetBody
|
|
5
|
+
TABLE_CELL_PADDING = 2
|
|
6
|
+
|
|
5
7
|
attr_reader :y_position_with_entrega
|
|
6
8
|
|
|
7
9
|
def initialize(pdf, xml)
|
|
@@ -43,11 +45,17 @@ module BrDanfe
|
|
|
43
45
|
end
|
|
44
46
|
|
|
45
47
|
def header_column(title)
|
|
46
|
-
{
|
|
48
|
+
{
|
|
49
|
+
content: I18n.t("danfe.det.#{title}"), align: :center, size: 5, valign: :top, font_style: :bold,
|
|
50
|
+
background_color: TITLE_BACKGROUND_COLOR, padding: [4, TABLE_CELL_PADDING, 3.5, TABLE_CELL_PADDING]
|
|
51
|
+
}
|
|
47
52
|
end
|
|
48
53
|
|
|
49
54
|
def options
|
|
50
|
-
{
|
|
55
|
+
{
|
|
56
|
+
column_widths: column_widths,
|
|
57
|
+
cell_style: { padding: [0.5, TABLE_CELL_PADDING, 1.5, TABLE_CELL_PADDING], border_width: LINE_WIDTH }
|
|
58
|
+
}
|
|
51
59
|
end
|
|
52
60
|
|
|
53
61
|
def column_widths
|
|
@@ -91,7 +99,7 @@ module BrDanfe
|
|
|
91
99
|
end
|
|
92
100
|
|
|
93
101
|
def cell_text(text, options = {})
|
|
94
|
-
cell = { content: text, border_lines: [:solid], size:
|
|
102
|
+
cell = { content: text, border_lines: [:solid], size: 5 }
|
|
95
103
|
cell.merge!(options)
|
|
96
104
|
cell
|
|
97
105
|
end
|
|
@@ -121,7 +129,7 @@ module BrDanfe
|
|
|
121
129
|
def render_table(data, start_position, height)
|
|
122
130
|
@pdf.y = start_position
|
|
123
131
|
@pdf.bounding_box [0.75.cm, @pdf.cursor], width: 19.56.cm, height: height do
|
|
124
|
-
@pdf.table data.map { |item| [item] }, header: true
|
|
132
|
+
@pdf.table data.map { |item| [item] }, header: true, cell_style: { border_width: 0 }
|
|
125
133
|
end
|
|
126
134
|
end
|
|
127
135
|
|
|
@@ -12,9 +12,9 @@ module BrDanfe
|
|
|
12
12
|
botton_margin: 0
|
|
13
13
|
)
|
|
14
14
|
|
|
15
|
-
@document.font '
|
|
15
|
+
@document.font 'arimo'
|
|
16
16
|
|
|
17
|
-
@document.line_width =
|
|
17
|
+
@document.line_width = LINE_WIDTH
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
def method_missing(method_name, ...)
|
|
@@ -33,7 +33,13 @@ module BrDanfe
|
|
|
33
33
|
title = ''
|
|
34
34
|
title = I18n.t("danfe.#{i18n}") if i18n != ''
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
at = [x.cm, Helper.invert((y + h - TITLE_HEIGHT).cm)]
|
|
37
|
+
fill_color TITLE_BACKGROUND_COLOR
|
|
38
|
+
fill_and_stroke_rectangle at, CONTENT_WIDTH.cm, TITLE_HEIGHT.cm
|
|
39
|
+
fill_color TEXT_COLOR
|
|
40
|
+
|
|
41
|
+
text_box title, size: 6.5, at: [at[0] + CELL_PADDING, at[1]], width: w.cm, height: TITLE_HEIGHT.cm,
|
|
42
|
+
style: :bold, valign: :center
|
|
37
43
|
end
|
|
38
44
|
|
|
39
45
|
def ibarcode(h, w, x, y, info)
|
|
@@ -116,26 +122,33 @@ module BrDanfe
|
|
|
116
122
|
def box(at, w, h, title = '', info = '', options = {})
|
|
117
123
|
options = {
|
|
118
124
|
align: :left,
|
|
119
|
-
size:
|
|
125
|
+
size: 6,
|
|
120
126
|
style: nil,
|
|
121
127
|
valign: :top,
|
|
122
|
-
border: 1
|
|
128
|
+
border: 1,
|
|
129
|
+
label_size: 5.5,
|
|
130
|
+
label_offset: 1.9,
|
|
131
|
+
value_offset: 11.2,
|
|
132
|
+
leading: 0
|
|
123
133
|
}.merge(options)
|
|
124
134
|
|
|
125
135
|
stroke_rectangle at, w, h if options[:border] == 1
|
|
126
136
|
|
|
127
|
-
at[0] +=
|
|
137
|
+
at[0] += CELL_PADDING
|
|
128
138
|
|
|
129
|
-
if title != ''
|
|
130
|
-
title_coord = Array.new(at)
|
|
131
|
-
title_coord[1] -= 2
|
|
132
|
-
text_box title, size: 6, at: title_coord, width: w - 4, height: 8
|
|
133
|
-
end
|
|
139
|
+
label(at, w, title, options) if title != ''
|
|
134
140
|
|
|
135
|
-
title_adjustment = title == '' ?
|
|
141
|
+
title_adjustment = title == '' ? 2 : options[:value_offset]
|
|
136
142
|
at[1] -= title_adjustment
|
|
137
|
-
text_box info, size: options[:size], at: at, width: w -
|
|
138
|
-
style: options[:style], valign: options[:valign]
|
|
143
|
+
text_box info, size: options[:size], at: at, width: w - (CELL_PADDING * 2), height: h - title_adjustment,
|
|
144
|
+
align: options[:align], style: options[:style], valign: options[:valign], leading: options[:leading]
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
def label(at, w, title, options)
|
|
148
|
+
fill_color LABEL_COLOR
|
|
149
|
+
text_box title, size: options[:label_size], at: [at[0], at[1] - options[:label_offset]],
|
|
150
|
+
width: w - (CELL_PADDING * 2), height: 7
|
|
151
|
+
fill_color TEXT_COLOR
|
|
139
152
|
end
|
|
140
153
|
end
|
|
141
154
|
end
|
|
@@ -6,6 +6,11 @@ module BrDanfe
|
|
|
6
6
|
|
|
7
7
|
Y_POSITION = 12.92
|
|
8
8
|
DUP_MAX_QUANTITY = 12
|
|
9
|
+
DUPS_PER_ROW = DUP_MAX_QUANTITY / 2
|
|
10
|
+
LABEL_ROW_HEIGHT = 0.30
|
|
11
|
+
VALUE_ROW_HEIGHT = 0.60
|
|
12
|
+
DUP_WIDTH = CONTENT_WIDTH / DUPS_PER_ROW
|
|
13
|
+
UNTITLED_TEXT_OFFSET = 0.07
|
|
9
14
|
|
|
10
15
|
def initialize(pdf, xml)
|
|
11
16
|
@pdf = pdf
|
|
@@ -24,37 +29,42 @@ module BrDanfe
|
|
|
24
29
|
|
|
25
30
|
render_titles_and_box(x, y)
|
|
26
31
|
|
|
27
|
-
@xml.collect('xmlns', 'dup') { _1 }[..(DUP_MAX_QUANTITY - 1)]
|
|
28
|
-
|
|
32
|
+
dups = @xml.collect('xmlns', 'dup') { _1 }[..(DUP_MAX_QUANTITY - 1)]
|
|
33
|
+
line_height = VALUE_ROW_HEIGHT / dups.each_slice(DUPS_PER_ROW).count
|
|
29
34
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
else
|
|
33
|
-
@y_position + 0.185
|
|
34
|
-
end
|
|
35
|
+
dups.each_with_index do |det, index|
|
|
36
|
+
x = 0.75 if index == DUPS_PER_ROW
|
|
35
37
|
|
|
36
|
-
|
|
37
|
-
x
|
|
38
|
+
line = index / DUPS_PER_ROW
|
|
39
|
+
render_dup(det, x, y + LABEL_ROW_HEIGHT + (line * line_height), line_height)
|
|
40
|
+
x += DUP_WIDTH
|
|
38
41
|
end
|
|
39
42
|
end
|
|
40
43
|
|
|
41
44
|
private
|
|
42
45
|
|
|
43
46
|
def render_titles_and_box(x, y)
|
|
44
|
-
|
|
45
|
-
@pdf.ibox
|
|
46
|
-
@pdf.ibox
|
|
47
|
-
@pdf.
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
x
|
|
47
|
+
DUPS_PER_ROW.times do
|
|
48
|
+
@pdf.ibox LABEL_ROW_HEIGHT, DUP_WIDTH, x, y
|
|
49
|
+
@pdf.ibox VALUE_ROW_HEIGHT, DUP_WIDTH, x, y + LABEL_ROW_HEIGHT
|
|
50
|
+
@pdf.fill_color LABEL_COLOR
|
|
51
|
+
centered_text LABEL_ROW_HEIGHT, 1.80, x, y, I18n.t('danfe.dup.nDup'), label
|
|
52
|
+
centered_text LABEL_ROW_HEIGHT, 1.80, x + 0.87, y, I18n.t('danfe.dup.dVenc'), label
|
|
53
|
+
centered_text LABEL_ROW_HEIGHT, 1.80, x + 2.35, y, I18n.t('danfe.dup.vDup'), label
|
|
54
|
+
@pdf.fill_color TEXT_COLOR
|
|
55
|
+
x += DUP_WIDTH
|
|
51
56
|
end
|
|
52
57
|
end
|
|
53
58
|
|
|
54
|
-
def render_dup(det, x, y)
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
59
|
+
def render_dup(det, x, y, height)
|
|
60
|
+
centered_text height, 2.12, x + 0.1, y, det.css('nDup').text, normal
|
|
61
|
+
centered_text height, 2.12, x + 0.75, y, dtduplicata(det), normal
|
|
62
|
+
centered_text height, 2.12, x + 1.1, y, BrDanfe::Helper.numerify(det.css('vDup').text), normal.merge(align: :right)
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def centered_text(height, width, x, y, text, style)
|
|
66
|
+
@pdf.ibox height + UNTITLED_TEXT_OFFSET, width, x, y - UNTITLED_TEXT_OFFSET, '', text,
|
|
67
|
+
style.merge(valign: :center)
|
|
58
68
|
end
|
|
59
69
|
|
|
60
70
|
def dtduplicata(det)
|
|
@@ -65,6 +75,10 @@ module BrDanfe
|
|
|
65
75
|
def normal
|
|
66
76
|
{ size: 6, border: 0 }
|
|
67
77
|
end
|
|
78
|
+
|
|
79
|
+
def label
|
|
80
|
+
{ size: 5.5, border: 0 }
|
|
81
|
+
end
|
|
68
82
|
end
|
|
69
83
|
end
|
|
70
84
|
end
|