br_danfe 0.17.1 → 0.17.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/br_danfe/danfe_lib/nfce_lib/header.rb +13 -12
- data/lib/br_danfe/version.rb +1 -1
- data/spec/br_danfe/danfe_lib/nfce_lib/header_spec.rb +3 -1
- data/spec/br_danfe/danfe_lib/nfce_spec.rb +2 -1
- data/spec/fixtures/nfce/lib/header#render-homologation.pdf +0 -0
- data/spec/fixtures/nfce/lib/header#render-long_name_with_logo.pdf +0 -0
- data/spec/fixtures/nfce/lib/header#render-long_name_without_logo.pdf +0 -0
- data/spec/fixtures/nfce/lib/header#render-short_name_with_logo.pdf +0 -0
- data/spec/fixtures/nfce/lib/header#render-short_name_without_logo.pdf +0 -0
- data/spec/fixtures/nfce/v4.00/multiples_xmls_on_the_same_pdf.pdf +172 -172
- data/spec/fixtures/nfce/v4.00/nfce-unauthorized-hom.fixture.pdf +0 -0
- data/spec/fixtures/nfce/v4.00/nfce-unauthorized-prod.fixture.pdf +0 -0
- data/spec/fixtures/nfce/v4.00/rendered_nfce.fixture.pdf +0 -0
- data/spec/fixtures/nfce/v4.00/saved_nfce.fixture.pdf +0 -0
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7d7ff47128c1eb8696ae40615a70cda26ce2a79e78e9e08ca4b87022a05e80a0
|
4
|
+
data.tar.gz: a69988df12809c67c14fd780c9f9863511113f954c4e1e18743eefd6c92e1bd7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2b7bb8b7db6a30564905827ee2c89e427db7d9ad6b771740f9c90f36140ef8705266f42dacc2dcf60981d828846f60ad2cf7064364f7688955b7fa8871218589
|
7
|
+
data.tar.gz: f473cd9b67ad5c62e21a1d0f152e8c951f4158c4a13ac17bb4f7f0df87734c924171d56f2504f81a48038fd76355b0e22d0c3931491855f110d5adf0fc24d277
|
data/Gemfile.lock
CHANGED
@@ -12,7 +12,7 @@ module BrDanfe
|
|
12
12
|
def render
|
13
13
|
cursor = @pdf.cursor
|
14
14
|
|
15
|
-
render_company_info
|
15
|
+
render_company_info
|
16
16
|
render_logo(cursor) if @logo.present?
|
17
17
|
render_doc
|
18
18
|
|
@@ -21,15 +21,18 @@ module BrDanfe
|
|
21
21
|
|
22
22
|
private
|
23
23
|
|
24
|
-
def render_company_info
|
24
|
+
def render_company_info
|
25
25
|
one_line = 1
|
26
26
|
|
27
|
-
@pdf.
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
27
|
+
@pdf.text_box (@xml['emit/xNome']).to_s, at: [x_position, @pdf.cursor], height: 36, size: 9, align: :left, style: :bold, overflow: :shrink_to_fit
|
28
|
+
@pdf.move_down 36
|
29
|
+
|
30
|
+
@pdf.text_box cnpj(@xml['emit/CNPJ']), at: [x_position, @pdf.cursor], height: 9, size: 9, align: :left, overflow: :shrink_to_fit
|
31
|
+
@pdf.move_down 9
|
32
|
+
|
33
|
+
@pdf.text_box BrDanfe::DanfeLib::NfceLib::Helper.address(@xml.css('enderEmit')), at: [x_position, @pdf.cursor], height: 20, size: 9, align: :left, overflow: :shrink_to_fit
|
34
|
+
@pdf.move_down 20
|
35
|
+
@pdf.render_blank_line if count_name_lines(@xml['emit/xNome']) == one_line
|
33
36
|
end
|
34
37
|
|
35
38
|
def x_position
|
@@ -60,9 +63,8 @@ module BrDanfe
|
|
60
63
|
|
61
64
|
def render_doc
|
62
65
|
@pdf.render_blank_line
|
63
|
-
cursor = @pdf.cursor
|
64
66
|
|
65
|
-
@pdf.bounding_box([0, cursor], width: 6.7.cm, height: 20) do
|
67
|
+
@pdf.bounding_box([0, @pdf.cursor], width: 6.7.cm, height: 20) do
|
66
68
|
@pdf.text 'Documento Auxiliar da Nota Fiscal de Consumidor Eletrônica', size: 9, align: :center
|
67
69
|
end
|
68
70
|
end
|
@@ -70,8 +72,7 @@ module BrDanfe
|
|
70
72
|
def render_homologation
|
71
73
|
2.times { @pdf.render_blank_line }
|
72
74
|
|
73
|
-
|
74
|
-
@pdf.bounding_box([0, cursor], width: 6.7.cm, height: 20) do
|
75
|
+
@pdf.bounding_box([0, @pdf.cursor], width: 6.7.cm, height: 20) do
|
75
76
|
@pdf.text 'EMITIDA EM AMBIENTE DE HOMOLOGAÇÃO', size: 8, align: :center, style: :bold
|
76
77
|
@pdf.text 'SEM VALOR FISCAL', size: 8, align: :center, style: :bold
|
77
78
|
end
|
data/lib/br_danfe/version.rb
CHANGED
@@ -52,6 +52,8 @@ describe BrDanfe::DanfeLib::NfceLib::Header do
|
|
52
52
|
File.delete(output_pdf) if File.exist?(output_pdf)
|
53
53
|
end
|
54
54
|
|
55
|
+
after { File.delete(output_pdf) if File.exist?(output_pdf) }
|
56
|
+
|
55
57
|
context 'when has a short name' do
|
56
58
|
let(:company_name) { 'Test company' }
|
57
59
|
|
@@ -81,7 +83,7 @@ describe BrDanfe::DanfeLib::NfceLib::Header do
|
|
81
83
|
let(:company_name) { 'Test company with some very long name to do a line break' }
|
82
84
|
|
83
85
|
context 'when has a logo' do
|
84
|
-
it 'renders the header with company name line breaked' do
|
86
|
+
it 'renders the header with company name line breaked and shrinked to fit' do
|
85
87
|
expect(File.exist?(output_pdf)).to be_falsey
|
86
88
|
pdf.render_file output_pdf
|
87
89
|
|
@@ -1,8 +1,8 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe BrDanfe::DanfeLib::Nfce do
|
4
|
-
let(:output_pdf) { "#{base_dir}output.pdf" }
|
5
4
|
let(:base_dir) { './spec/fixtures/nfce/v4.00/' }
|
5
|
+
let(:output_pdf) { "#{base_dir}output.pdf" }
|
6
6
|
let(:xml) { BrDanfe::XML.new(File.read("#{base_dir}nfce.xml")) }
|
7
7
|
|
8
8
|
subject { described_class.new [xml] }
|
@@ -15,6 +15,7 @@ describe BrDanfe::DanfeLib::Nfce do
|
|
15
15
|
describe '#render_pdf' do
|
16
16
|
it 'renders the NFC-e pdf' do
|
17
17
|
expected = IO.binread("#{base_dir}rendered_nfce.fixture.pdf")
|
18
|
+
|
18
19
|
expect(subject.render_pdf).to eq expected
|
19
20
|
end
|
20
21
|
end
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|