br_danfe 0.16.0 → 0.17.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +5 -7
- data/br_danfe.gemspec +1 -1
- data/lib/br_danfe/danfe_lib/nfce.rb +2 -2
- data/lib/br_danfe/danfe_lib/nfce_lib/document.rb +1 -1
- data/lib/br_danfe/danfe_lib/nfce_lib/footer.rb +2 -2
- data/lib/br_danfe/danfe_lib/nfce_lib/header.rb +24 -10
- data/lib/br_danfe/danfe_lib/nfce_lib/key.rb +3 -3
- data/lib/br_danfe/danfe_lib/nfce_lib/nfce_identification.rb +3 -3
- data/lib/br_danfe/danfe_lib/nfce_lib/product_list.rb +44 -53
- data/lib/br_danfe/danfe_lib/nfce_lib/recipient.rb +1 -1
- data/lib/br_danfe/danfe_lib/nfce_lib/total_list.rb +16 -15
- data/lib/br_danfe/version.rb +1 -1
- data/spec/br_danfe/danfe_lib/nfce_lib/header_spec.rb +1 -1
- data/spec/fixtures/nfce/lib/document#render.pdf +12 -23
- data/spec/fixtures/nfce/lib/footer#render-with_additional_information.pdf +0 -0
- data/spec/fixtures/nfce/lib/footer#render.pdf +0 -0
- 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/lib/key#render.pdf +0 -0
- data/spec/fixtures/nfce/lib/nfce_identification#render.pdf +0 -0
- data/spec/fixtures/nfce/lib/product_list#render-with_many_products.pdf +0 -0
- data/spec/fixtures/nfce/lib/product_list#render-with_many_products_and_long_names.pdf +0 -0
- data/spec/fixtures/nfce/lib/product_list#render-with_single_product.pdf +0 -0
- data/spec/fixtures/nfce/lib/product_list#render-with_single_product_and_long_name.pdf +0 -0
- data/spec/fixtures/nfce/lib/product_list_with_many_products_and_long_names.xml +2 -2
- data/spec/fixtures/nfce/lib/product_list_with_single_product_and_long_name.xml +1 -1
- data/spec/fixtures/nfce/lib/recipient#render-company.pdf +0 -0
- data/spec/fixtures/nfce/lib/recipient#render-consumer_without_document.pdf +0 -0
- data/spec/fixtures/nfce/lib/recipient#render-foreign.pdf +0 -0
- data/spec/fixtures/nfce/lib/recipient#render-individual.pdf +0 -0
- data/spec/fixtures/nfce/lib/recipient#render-unidentified_consumer.pdf +0 -0
- data/spec/fixtures/nfce/lib/total_list#does_not_render-payment_methods.pdf +0 -0
- data/spec/fixtures/nfce/lib/total_list#render-grouped_payment_methods.pdf +0 -0
- data/spec/fixtures/nfce/lib/total_list#render-totals.pdf +0 -0
- data/spec/fixtures/nfce/lib/total_list#render-without_payment.pdf +0 -0
- data/spec/fixtures/nfce/lib/total_list#render.pdf +0 -0
- data/spec/fixtures/nfce/v4.00/multiples_xmls_on_the_same_pdf.pdf +568 -447
- 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 +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8ddb33657303d50b425d475e7c493dde5272ed1d4e4bd7d96f9eab45a8f5c600
|
4
|
+
data.tar.gz: 67ba29fde1351c27b7ff6479a6bfd5d803cc843b4a756f9594bc53c82f44a3a0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e99eb16d42eff7bf889afa5d697f75bdba24ebcc091b8713d55fa83e6950f5b2bc4269d7401292594dbcd5585b1698cd2fbfa3ec45fb96dadb94d0f117da4bfb
|
7
|
+
data.tar.gz: cf348dbad5f7117cda63a7e3d88226c35900a99cfe3ae3dca13e9fab3b093a195c0e7a5331877275b9580ade584422fcb9a63f6b120f7f279eaaf9b647b1ae79
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
br_danfe (0.
|
4
|
+
br_danfe (0.17.0)
|
5
5
|
barby (= 0.6.8)
|
6
6
|
br_documents (>= 0.1.3)
|
7
7
|
i18n (>= 0.8.6)
|
@@ -25,7 +25,7 @@ GEM
|
|
25
25
|
afm (0.2.2)
|
26
26
|
ast (2.4.2)
|
27
27
|
barby (0.6.8)
|
28
|
-
br_documents (0.2.
|
28
|
+
br_documents (0.2.1)
|
29
29
|
activemodel (>= 4.0.0)
|
30
30
|
i18n (>= 0.6.5)
|
31
31
|
byebug (11.1.3)
|
@@ -60,11 +60,9 @@ GEM
|
|
60
60
|
rb-inotify (~> 0.9, >= 0.9.10)
|
61
61
|
lumberjack (1.2.8)
|
62
62
|
method_source (1.0.0)
|
63
|
-
mini_portile2 (2.5.3)
|
64
63
|
minitest (5.14.4)
|
65
64
|
nenv (0.3.0)
|
66
|
-
nokogiri (1.11.7)
|
67
|
-
mini_portile2 (~> 2.5.0)
|
65
|
+
nokogiri (1.11.7-x86_64-linux)
|
68
66
|
racc (~> 1.4)
|
69
67
|
notiffany (0.1.3)
|
70
68
|
nenv (~> 0.1)
|
@@ -92,7 +90,7 @@ GEM
|
|
92
90
|
psych (4.0.1)
|
93
91
|
racc (1.5.2)
|
94
92
|
rainbow (3.0.0)
|
95
|
-
rake (13.0.
|
93
|
+
rake (13.0.6)
|
96
94
|
rb-fsevent (0.11.0)
|
97
95
|
rb-inotify (0.10.1)
|
98
96
|
ffi (~> 1.0)
|
@@ -147,7 +145,7 @@ DEPENDENCIES
|
|
147
145
|
guard (~> 2.16.2)
|
148
146
|
guard-rspec
|
149
147
|
pdf-inspector (~> 1.3.0)
|
150
|
-
rake (= 13.0.
|
148
|
+
rake (= 13.0.6)
|
151
149
|
rspec (= 3.10.0)
|
152
150
|
rubocop (= 0.67.0)
|
153
151
|
rubocop-performance (~> 1.1.0)
|
data/br_danfe.gemspec
CHANGED
@@ -28,7 +28,7 @@ Gem::Specification.new do |spec|
|
|
28
28
|
spec.add_development_dependency 'guard', '~> 2.16.2'
|
29
29
|
spec.add_development_dependency 'guard-rspec'
|
30
30
|
spec.add_development_dependency 'pdf-inspector', '~> 1.3.0'
|
31
|
-
spec.add_development_dependency 'rake', '13.0.
|
31
|
+
spec.add_development_dependency 'rake', '13.0.6'
|
32
32
|
spec.add_development_dependency 'rspec', '3.10.0'
|
33
33
|
spec.add_development_dependency 'rubocop', '0.67.0'
|
34
34
|
spec.add_development_dependency 'rubocop-performance', '~> 1.1.0'
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module BrDanfe
|
2
2
|
module DanfeLib
|
3
3
|
class Nfce < Base
|
4
|
-
PAGE_WIDTH =
|
4
|
+
PAGE_WIDTH = 7.cm
|
5
5
|
PAGE_HEIGHT = 100.cm
|
6
6
|
|
7
7
|
private
|
@@ -31,7 +31,7 @@ module BrDanfe
|
|
31
31
|
NfceLib::Key.new(@document, xml).render
|
32
32
|
NfceLib::Recipient.new(@document, xml).render
|
33
33
|
NfceLib::NfceIdentification.new(@document, xml).render
|
34
|
-
BrDanfe::QrCode.new(pdf: @document, xml: xml, qr_code_tag: xml['qrCode'], box_size:
|
34
|
+
BrDanfe::QrCode.new(pdf: @document, xml: xml, qr_code_tag: xml['qrCode'], box_size: 4.5.cm).render
|
35
35
|
NfceLib::Footer.new(@document, xml).render(footer_info)
|
36
36
|
|
37
37
|
render_no_fiscal_value(xml)
|
@@ -9,11 +9,11 @@ module BrDanfe
|
|
9
9
|
|
10
10
|
def render(info = '')
|
11
11
|
tot_trib = @xml['ICMSTot/vTotTrib'].present? ? BrDanfe::Helper.numerify(@xml['ICMSTot/vTotTrib']) : '0,00'
|
12
|
-
@pdf.text "Tributos Totais Incidentes (Lei Federal 12.741/2012): R$ #{tot_trib}", size:
|
12
|
+
@pdf.text "Tributos Totais Incidentes (Lei Federal 12.741/2012): R$ #{tot_trib}", size: 8, align: :center
|
13
13
|
|
14
14
|
if info.present?
|
15
15
|
@pdf.render_blank_line
|
16
|
-
@pdf.text info, size:
|
16
|
+
@pdf.text info, size: 8, align: :center
|
17
17
|
end
|
18
18
|
end
|
19
19
|
end
|
@@ -14,6 +14,7 @@ module BrDanfe
|
|
14
14
|
|
15
15
|
render_company_info(cursor)
|
16
16
|
render_logo(cursor) if @logo.present?
|
17
|
+
render_doc
|
17
18
|
|
18
19
|
render_homologation if BrDanfe::Helper.homologation?(@xml)
|
19
20
|
end
|
@@ -23,21 +24,20 @@ module BrDanfe
|
|
23
24
|
def render_company_info(cursor)
|
24
25
|
one_line = 1
|
25
26
|
|
26
|
-
@pdf.bounding_box([x_position, cursor], width: width_box, height:
|
27
|
-
@pdf.text (@xml['emit/xNome']).to_s, size:
|
28
|
-
@pdf.text cnpj(@xml['emit/CNPJ']), size:
|
29
|
-
@pdf.text BrDanfe::DanfeLib::NfceLib::Helper.address(@xml.css('enderEmit')), size:
|
27
|
+
@pdf.bounding_box([x_position, cursor], width: width_box, height: 65) do
|
28
|
+
@pdf.text (@xml['emit/xNome']).to_s, size: 10, align: :left, style: :bold
|
29
|
+
@pdf.text cnpj(@xml['emit/CNPJ']), size: 9, align: :left
|
30
|
+
@pdf.text BrDanfe::DanfeLib::NfceLib::Helper.address(@xml.css('enderEmit')), size: 9, align: :left
|
30
31
|
@pdf.render_blank_line if count_name_lines(@xml['emit/xNome']) == one_line
|
31
|
-
@pdf.text 'Documento Auxiliar da Nota Fiscal de Consumidor Eletrônica', size: 6, align: :left
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
35
|
def x_position
|
36
|
-
@logo.present? ?
|
36
|
+
@logo.present? ? 2.2.cm : 0
|
37
37
|
end
|
38
38
|
|
39
39
|
def width_box
|
40
|
-
@logo.present? ? 5.
|
40
|
+
@logo.present? ? 4.5.cm : 6.7.cm
|
41
41
|
end
|
42
42
|
|
43
43
|
def cnpj(info)
|
@@ -51,7 +51,7 @@ module BrDanfe
|
|
51
51
|
end
|
52
52
|
|
53
53
|
def render_logo(cursor)
|
54
|
-
box_size =
|
54
|
+
box_size = 60
|
55
55
|
logo_options = BrDanfe::Logo::Options.new(box_size, @logo_dimensions).options
|
56
56
|
|
57
57
|
@pdf.bounding_box([0, cursor], width: box_size, height: box_size) do
|
@@ -59,9 +59,23 @@ module BrDanfe
|
|
59
59
|
end
|
60
60
|
end
|
61
61
|
|
62
|
-
def
|
62
|
+
def render_doc
|
63
63
|
@pdf.render_blank_line
|
64
|
-
@pdf.
|
64
|
+
cursor = @pdf.cursor
|
65
|
+
|
66
|
+
@pdf.bounding_box([0, cursor], width: 6.7.cm, height: 20) do
|
67
|
+
@pdf.text 'Documento Auxiliar da Nota Fiscal de Consumidor Eletrônica', size: 9, align: :center
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
def render_homologation
|
72
|
+
2.times { @pdf.render_blank_line }
|
73
|
+
|
74
|
+
cursor = @pdf.cursor
|
75
|
+
@pdf.bounding_box([0, cursor], width: 6.7.cm, height: 20) do
|
76
|
+
@pdf.text 'EMITIDA EM AMBIENTE DE HOMOLOGAÇÃO', size: 8, align: :center, style: :bold
|
77
|
+
@pdf.text 'SEM VALOR FISCAL', size: 8, align: :center, style: :bold
|
78
|
+
end
|
65
79
|
end
|
66
80
|
end
|
67
81
|
end
|
@@ -10,9 +10,9 @@ module BrDanfe
|
|
10
10
|
def render
|
11
11
|
@pdf.render_blank_line
|
12
12
|
|
13
|
-
@pdf.text 'Consulte pela Chave de Acesso em', size:
|
14
|
-
@pdf.text @xml['urlChave'], size:
|
15
|
-
@pdf.text @xml['chNFe'].gsub(/(\d)(?=(\d\d\d\d)+(?!\d))/, '\\1 '), size:
|
13
|
+
@pdf.text 'Consulte pela Chave de Acesso em', size: 9, align: :center, style: :bold
|
14
|
+
@pdf.text @xml['urlChave'], size: 9, align: :center
|
15
|
+
@pdf.text @xml['chNFe'].gsub(/(\d)(?=(\d\d\d\d)+(?!\d))/, '\\1 '), size: 8, align: :center
|
16
16
|
end
|
17
17
|
end
|
18
18
|
end
|
@@ -12,9 +12,9 @@ module BrDanfe
|
|
12
12
|
identification = "NFC-e nº #{@xml['ide/nNF']} Série #{@xml['ide/serie']} #{emitted_at}"
|
13
13
|
|
14
14
|
@pdf.render_blank_line
|
15
|
-
@pdf.text identification, size:
|
16
|
-
@pdf.text "<b>Protocolo de autorização:</b> #{@xml['infProt/nProt']}", size:
|
17
|
-
@pdf.text "<b>Data de autorização: </b> #{BrDanfe::Helper.format_datetime(@xml['infProt/dhRecbto'])}", size:
|
15
|
+
@pdf.text identification, size: 9, align: :center, style: :bold
|
16
|
+
@pdf.text "<b>Protocolo de autorização:</b> #{@xml['infProt/nProt']}", size: 9, align: :center, inline_format: true
|
17
|
+
@pdf.text "<b>Data de autorização: </b> #{BrDanfe::Helper.format_datetime(@xml['infProt/dhRecbto'])}", size: 9, align: :center, inline_format: true
|
18
18
|
end
|
19
19
|
end
|
20
20
|
end
|
@@ -14,19 +14,54 @@ module BrDanfe
|
|
14
14
|
|
15
15
|
private
|
16
16
|
|
17
|
+
def render_headers(headers)
|
18
|
+
2.times { @pdf.render_blank_line }
|
19
|
+
cursor = @pdf.cursor
|
20
|
+
headers.each_with_index do |header, index|
|
21
|
+
cursor -= 10 if index == 1
|
22
|
+
@pdf.bounding_box [columns[index][:position], cursor], width: columns[index][:width], height: 0.3.cm do
|
23
|
+
@pdf.text header[:content], header[:options]
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
17
28
|
def headers
|
18
29
|
[
|
19
|
-
header_column('
|
20
|
-
header_column('
|
21
|
-
header_column('Qtde', :right),
|
30
|
+
header_column('CÓDIGO - DESCRIÇÃO', :left),
|
31
|
+
header_column('QTD', :left),
|
22
32
|
header_column('UN', :right),
|
23
|
-
header_column('
|
24
|
-
header_column('
|
33
|
+
header_column('VL UNIT', :right),
|
34
|
+
header_column('TOTAL', :right)
|
25
35
|
]
|
26
36
|
end
|
27
37
|
|
28
38
|
def header_column(title, align)
|
29
|
-
{ content: title, options: { align: align, size:
|
39
|
+
{ content: title, options: { align: align, size: 9, style: :bold } }
|
40
|
+
end
|
41
|
+
|
42
|
+
def columns
|
43
|
+
[
|
44
|
+
{ width: 6.7.cm, position: 0 },
|
45
|
+
{ width: 1.7.cm, position: 0.cm },
|
46
|
+
{ width: 1.cm, position: 1.7.cm },
|
47
|
+
{ width: 1.7.cm, position: 2.7.cm },
|
48
|
+
{ width: 2.3.cm, position: 4.4.cm }
|
49
|
+
]
|
50
|
+
end
|
51
|
+
|
52
|
+
def render_products
|
53
|
+
@pdf.render_blank_line
|
54
|
+
products.each do |product|
|
55
|
+
cursor = @pdf.cursor
|
56
|
+
|
57
|
+
product.each_with_index do |cell, index|
|
58
|
+
cursor -= 10 if index == 1
|
59
|
+
@pdf.bounding_box [columns[index][:position], cursor], width: columns[index][:width], height: 0.3.cm do
|
60
|
+
options = cell[:options].merge(overflow: :truncate)
|
61
|
+
@pdf.text_box cell[:content], options
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
30
65
|
end
|
31
66
|
|
32
67
|
def products
|
@@ -35,9 +70,8 @@ module BrDanfe
|
|
35
70
|
|
36
71
|
def product(det)
|
37
72
|
[
|
38
|
-
cell_text(det.css('prod/cProd').text),
|
39
|
-
cell_text(det.css('prod/
|
40
|
-
cell_number(BrDanfe::Helper.numerify(det.css('prod/qCom').text)),
|
73
|
+
cell_text("#{det.css('prod/cProd').text} - #{det.css('prod/xProd').text}"),
|
74
|
+
cell_text(BrDanfe::Helper.numerify(det.css('prod/qCom').text), align: :left),
|
41
75
|
cell_text(det.css('prod/uCom').text, align: :right),
|
42
76
|
cell_number(BrDanfe::Helper.numerify(det.css('prod/vUnCom').text)),
|
43
77
|
cell_number(BrDanfe::Helper.numerify(det.css('prod/vProd').text))
|
@@ -45,7 +79,7 @@ module BrDanfe
|
|
45
79
|
end
|
46
80
|
|
47
81
|
def cell_text(text, options = {})
|
48
|
-
cell = { content: text, options: { border_width: 0, size:
|
82
|
+
cell = { content: text, options: { border_width: 0, size: 9 } }
|
49
83
|
cell[:options].merge!(options)
|
50
84
|
cell
|
51
85
|
end
|
@@ -53,49 +87,6 @@ module BrDanfe
|
|
53
87
|
def cell_number(text)
|
54
88
|
cell_text(text, align: :right)
|
55
89
|
end
|
56
|
-
|
57
|
-
def columns
|
58
|
-
[
|
59
|
-
{ width: 0.9.cm, position: 0 },
|
60
|
-
{ width: 2.6.cm, position: 0.9.cm },
|
61
|
-
{ width: 1.1.cm, position: 3.5.cm },
|
62
|
-
{ width: 0.4.cm, position: 4.6.cm },
|
63
|
-
{ width: 1.2.cm, position: 5.cm },
|
64
|
-
{ width: 1.2.cm, position: 6.2.cm }
|
65
|
-
]
|
66
|
-
end
|
67
|
-
|
68
|
-
def render_headers(headers)
|
69
|
-
2.times { @pdf.render_blank_line }
|
70
|
-
cursor = @pdf.cursor
|
71
|
-
headers.each_with_index do |header, index|
|
72
|
-
@pdf.bounding_box [columns[index][:position], cursor], width: columns[index][:width], height: 0.2.cm do
|
73
|
-
@pdf.text header[:content], header[:options]
|
74
|
-
end
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
|
-
def render_products
|
79
|
-
@pdf.render_blank_line
|
80
|
-
index_of_product_name = 1
|
81
|
-
products.each do |product|
|
82
|
-
box_height = box_height(product[index_of_product_name][:content])
|
83
|
-
cursor = @pdf.cursor
|
84
|
-
|
85
|
-
product.each_with_index do |cell, index|
|
86
|
-
@pdf.bounding_box [columns[index][:position], cursor], width: columns[index][:width], height: box_height do
|
87
|
-
@pdf.text cell[:content], cell[:options]
|
88
|
-
end
|
89
|
-
end
|
90
|
-
end
|
91
|
-
end
|
92
|
-
|
93
|
-
def box_height(content)
|
94
|
-
line_height_base = 0.23.cm
|
95
|
-
|
96
|
-
lines = content.scan(/[\s\S]{1,20}( |$)/).length
|
97
|
-
line_height_base * lines
|
98
|
-
end
|
99
90
|
end
|
100
91
|
end
|
101
92
|
end
|
@@ -18,12 +18,13 @@ module BrDanfe
|
|
18
18
|
private
|
19
19
|
|
20
20
|
def subtotal
|
21
|
+
@pdf.render_blank_line
|
21
22
|
cursor = @pdf.cursor
|
22
|
-
@pdf.bounding_box [
|
23
|
-
@pdf.text 'Subtotal R$', size:
|
23
|
+
@pdf.bounding_box [3.5.cm, cursor], width: 1.6.cm, height: 0.4.cm do
|
24
|
+
@pdf.text 'Subtotal R$', size: 9, align: :left
|
24
25
|
end
|
25
|
-
@pdf.bounding_box [
|
26
|
-
@pdf.text BrDanfe::Helper.numerify(@xml['ICMSTot > vProd'].to_f), size:
|
26
|
+
@pdf.bounding_box [5.1.cm, cursor], width: 1.6.cm, height: 0.4.cm do
|
27
|
+
@pdf.text BrDanfe::Helper.numerify(@xml['ICMSTot > vProd'].to_f), size: 9, align: :right
|
27
28
|
end
|
28
29
|
end
|
29
30
|
|
@@ -31,16 +32,16 @@ module BrDanfe
|
|
31
32
|
@pdf.render_blank_line
|
32
33
|
|
33
34
|
cursor = @pdf.cursor
|
34
|
-
print_text('
|
35
|
-
print_text(@xml.css('det').count.to_s, cursor, size:
|
35
|
+
print_text('QTD. TOTAL DE ITENS', cursor, size: 10, align: :left)
|
36
|
+
print_text(@xml.css('det').count.to_s, cursor, size: 10, align: :right)
|
36
37
|
|
37
38
|
cursor = @pdf.cursor
|
38
|
-
print_text('
|
39
|
-
print_text(BrDanfe::Helper.numerify(@xml['ICMSTot > vDesc'].to_f), cursor, size:
|
39
|
+
print_text('DESCONTO R$', cursor, size: 10, align: :left)
|
40
|
+
print_text(BrDanfe::Helper.numerify(@xml['ICMSTot > vDesc'].to_f), cursor, size: 10, align: :right)
|
40
41
|
|
41
42
|
cursor = @pdf.cursor
|
42
|
-
print_text('
|
43
|
-
print_text(BrDanfe::Helper.numerify(@xml['ICMSTot > vNF'].to_f), cursor, size:
|
43
|
+
print_text('VALOR TOTAL R$', cursor, size: 10, align: :left, style: :bold)
|
44
|
+
print_text(BrDanfe::Helper.numerify(@xml['ICMSTot > vNF'].to_f), cursor, size: 10, align: :right, style: :bold)
|
44
45
|
end
|
45
46
|
|
46
47
|
def payment_methods
|
@@ -59,19 +60,19 @@ module BrDanfe
|
|
59
60
|
@pdf.render_blank_line
|
60
61
|
|
61
62
|
cursor = @pdf.cursor
|
62
|
-
print_text('
|
63
|
-
print_text('
|
63
|
+
print_text('FORMA PAGTO.', cursor, size: 9, align: :left, style: :bold)
|
64
|
+
print_text('VLR PAGO R$', cursor, size: 9, align: :right, style: :bold)
|
64
65
|
|
65
66
|
payments.each do |key, value|
|
66
67
|
cursor = @pdf.cursor
|
67
|
-
print_text(I18n.t("nfce.payment_methods.#{key}"), cursor, size:
|
68
|
-
print_text(BrDanfe::Helper.numerify(value.to_f), cursor, size:
|
68
|
+
print_text(I18n.t("nfce.payment_methods.#{key}"), cursor, size: 9, align: :left)
|
69
|
+
print_text(BrDanfe::Helper.numerify(value.to_f), cursor, size: 9, align: :right)
|
69
70
|
end
|
70
71
|
end
|
71
72
|
end
|
72
73
|
|
73
74
|
def print_text(text, cursor, options)
|
74
|
-
@pdf.bounding_box [0, cursor], width: 7.
|
75
|
+
@pdf.bounding_box [0, cursor], width: 6.7.cm, height: 0.35.cm do
|
75
76
|
@pdf.text text, options
|
76
77
|
end
|
77
78
|
end
|
data/lib/br_danfe/version.rb
CHANGED
@@ -42,7 +42,7 @@ describe BrDanfe::DanfeLib::NfceLib::Header do
|
|
42
42
|
BrDanfe::XML.new(xml)
|
43
43
|
end
|
44
44
|
|
45
|
-
let(:pdf) { BrDanfe::DanfeLib::NfceLib::Document.new(8.cm,
|
45
|
+
let(:pdf) { BrDanfe::DanfeLib::NfceLib::Document.new(8.cm, 6.cm) }
|
46
46
|
|
47
47
|
subject { described_class.new pdf, xml, logo, logo_options }
|
48
48
|
|
@@ -13,20 +13,18 @@ endobj
|
|
13
13
|
3 0 obj
|
14
14
|
<< /Type /Pages
|
15
15
|
/Count 2
|
16
|
-
/Kids [5 0 R
|
16
|
+
/Kids [5 0 R 7 0 R]
|
17
17
|
>>
|
18
18
|
endobj
|
19
19
|
4 0 obj
|
20
|
-
<< /Length
|
20
|
+
<< /Length 38
|
21
21
|
>>
|
22
22
|
stream
|
23
23
|
q
|
24
24
|
0.3 w
|
25
25
|
|
26
26
|
BT
|
27
|
-
8.50394 38.
|
28
|
-
/F1.0 6 Tf
|
29
|
-
<> Tj
|
27
|
+
8.50394 38.36169 Td
|
30
28
|
ET
|
31
29
|
|
32
30
|
Q
|
@@ -43,19 +41,11 @@ endobj
|
|
43
41
|
/ArtBox [0 0 226.77165 51.02362]
|
44
42
|
/Contents 4 0 R
|
45
43
|
/Resources << /ProcSet [/PDF /Text /ImageB /ImageC /ImageI]
|
46
|
-
/Font <<
|
47
|
-
>>
|
44
|
+
/Font << >>
|
48
45
|
>>
|
49
46
|
>>
|
50
47
|
endobj
|
51
48
|
6 0 obj
|
52
|
-
<< /Type /Font
|
53
|
-
/Subtype /Type1
|
54
|
-
/BaseFont /Courier
|
55
|
-
/Encoding /WinAnsiEncoding
|
56
|
-
>>
|
57
|
-
endobj
|
58
|
-
7 0 obj
|
59
49
|
<< /Length 10
|
60
50
|
>>
|
61
51
|
stream
|
@@ -65,7 +55,7 @@ Q
|
|
65
55
|
|
66
56
|
endstream
|
67
57
|
endobj
|
68
|
-
|
58
|
+
7 0 obj
|
69
59
|
<< /Type /Page
|
70
60
|
/Parent 3 0 R
|
71
61
|
/MediaBox [0 0 226.77165 51.02362]
|
@@ -73,27 +63,26 @@ endobj
|
|
73
63
|
/BleedBox [0 0 226.77165 51.02362]
|
74
64
|
/TrimBox [0 0 226.77165 51.02362]
|
75
65
|
/ArtBox [0 0 226.77165 51.02362]
|
76
|
-
/Contents
|
66
|
+
/Contents 6 0 R
|
77
67
|
/Resources << /ProcSet [/PDF /Text /ImageB /ImageC /ImageI]
|
78
68
|
>>
|
79
69
|
>>
|
80
70
|
endobj
|
81
71
|
xref
|
82
|
-
0
|
72
|
+
0 8
|
83
73
|
0000000000 65535 f
|
84
74
|
0000000015 00000 n
|
85
75
|
0000000109 00000 n
|
86
76
|
0000000158 00000 n
|
87
77
|
0000000221 00000 n
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
0000000802 00000 n
|
78
|
+
0000000309 00000 n
|
79
|
+
0000000618 00000 n
|
80
|
+
0000000678 00000 n
|
92
81
|
trailer
|
93
|
-
<< /Size
|
82
|
+
<< /Size 8
|
94
83
|
/Root 2 0 R
|
95
84
|
/Info 1 0 R
|
96
85
|
>>
|
97
86
|
startxref
|
98
|
-
|
87
|
+
975
|
99
88
|
%%EOF
|