br_invoices_pdf 0.2.6.alpha.19 → 0.2.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +0 -1
- data/CHANGELOG.md +0 -1
- data/Gemfile +0 -2
- data/Rakefile +0 -2
- data/bin/console +0 -1
- data/br_invoices_pdf.gemspec +0 -1
- data/lib/br_invoices_pdf.rb +0 -12
- data/lib/br_invoices_pdf/cfe.rb +1 -2
- data/lib/br_invoices_pdf/cfe/parser.rb +3 -5
- data/lib/br_invoices_pdf/cfe/parser/access_key.rb +1 -3
- data/lib/br_invoices_pdf/cfe/parser/base_parser.rb +19 -0
- data/lib/br_invoices_pdf/cfe/parser/cnpj.rb +1 -3
- data/lib/br_invoices_pdf/cfe/parser/company_attributes.rb +1 -3
- data/lib/br_invoices_pdf/cfe/parser/cpf.rb +1 -3
- data/lib/br_invoices_pdf/cfe/parser/document_number.rb +1 -3
- data/lib/br_invoices_pdf/cfe/parser/fisco_obs.rb +1 -3
- data/lib/br_invoices_pdf/cfe/parser/payment.rb +1 -3
- data/lib/br_invoices_pdf/cfe/parser/payments.rb +16 -6
- data/lib/br_invoices_pdf/cfe/parser/products_data.rb +2 -4
- data/lib/br_invoices_pdf/cfe/parser/sat.rb +1 -3
- data/lib/br_invoices_pdf/cfe/renderer.rb +18 -4
- data/lib/br_invoices_pdf/cfe/renderer/base_renderer.rb +62 -5
- data/lib/br_invoices_pdf/cfe/renderer/company_identification.rb +0 -3
- data/lib/br_invoices_pdf/cfe/renderer/fisco_info.rb +0 -3
- data/lib/br_invoices_pdf/cfe/renderer/header.rb +0 -3
- data/lib/br_invoices_pdf/cfe/renderer/payment_forms.rb +12 -6
- data/lib/br_invoices_pdf/cfe/renderer/product_table.rb +48 -4
- data/lib/br_invoices_pdf/cfe/renderer/qr_code.rb +9 -5
- data/lib/br_invoices_pdf/cfe/renderer/taxes_info.rb +2 -5
- data/lib/br_invoices_pdf/cfe/renderer/totals.rb +24 -3
- data/lib/br_invoices_pdf/errors/invalid_document_type.rb +0 -2
- data/lib/br_invoices_pdf/generator.rb +0 -2
- data/lib/br_invoices_pdf/version.rb +1 -3
- metadata +6 -34
- data/.codeclimate.yml +0 -17
- data/lib/br_invoices_pdf/nfce.rb +0 -11
- data/lib/br_invoices_pdf/nfce/parser.rb +0 -33
- data/lib/br_invoices_pdf/nfce/parser/additional_info.rb +0 -17
- data/lib/br_invoices_pdf/nfce/parser/company.rb +0 -25
- data/lib/br_invoices_pdf/nfce/parser/customer.rb +0 -32
- data/lib/br_invoices_pdf/nfce/parser/emission_details.rb +0 -51
- data/lib/br_invoices_pdf/nfce/parser/payments.rb +0 -30
- data/lib/br_invoices_pdf/nfce/parser/products.rb +0 -39
- data/lib/br_invoices_pdf/nfce/parser/totals.rb +0 -25
- data/lib/br_invoices_pdf/nfce/renderer.rb +0 -37
- data/lib/br_invoices_pdf/nfce/renderer/base_renderer.rb +0 -22
- data/lib/br_invoices_pdf/nfce/renderer/company_identification.rb +0 -37
- data/lib/br_invoices_pdf/nfce/renderer/customer_identification.rb +0 -47
- data/lib/br_invoices_pdf/nfce/renderer/fiscal_message.rb +0 -46
- data/lib/br_invoices_pdf/nfce/renderer/header.rb +0 -32
- data/lib/br_invoices_pdf/nfce/renderer/payment_forms.rb +0 -73
- data/lib/br_invoices_pdf/nfce/renderer/product_table.rb +0 -23
- data/lib/br_invoices_pdf/nfce/renderer/qr_code.rb +0 -56
- data/lib/br_invoices_pdf/nfce/renderer/taxes_info.rb +0 -28
- data/lib/br_invoices_pdf/nfce/renderer/totals.rb +0 -30
- data/lib/br_invoices_pdf/util/base_renderer.rb +0 -121
- data/lib/br_invoices_pdf/util/enum.rb +0 -20
- data/lib/br_invoices_pdf/util/mount_params.rb +0 -26
- data/lib/br_invoices_pdf/util/nfce_check_urls.rb +0 -102
- data/lib/br_invoices_pdf/util/pdf_renderer.rb +0 -33
- data/lib/br_invoices_pdf/util/product_table.rb +0 -57
- data/lib/br_invoices_pdf/util/xml_locate.rb +0 -21
- data/nfce.xml +0 -160
@@ -1,23 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module BrInvoicesPdf
|
4
|
-
module Nfce
|
5
|
-
module Renderer
|
6
|
-
module ProductTable
|
7
|
-
extend Util::BaseRenderer
|
8
|
-
extend Util::ProductTable
|
9
|
-
extend BaseRenderer
|
10
|
-
|
11
|
-
module_function
|
12
|
-
|
13
|
-
def execute(pdf, data)
|
14
|
-
table_data = product_table_data(data)
|
15
|
-
|
16
|
-
pdf.font_size(6) do
|
17
|
-
format_table(pdf, table_data)
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
@@ -1,56 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module BrInvoicesPdf
|
4
|
-
module Nfce
|
5
|
-
module Renderer
|
6
|
-
module QrCode
|
7
|
-
extend Util::BaseRenderer
|
8
|
-
extend BaseRenderer
|
9
|
-
|
10
|
-
module_function
|
11
|
-
|
12
|
-
def execute(pdf, data)
|
13
|
-
render_box(pdf) do
|
14
|
-
options = pdf_options(page_paper_width(pdf.page.size))
|
15
|
-
|
16
|
-
generate_qr_code(pdf, data, options)
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
# :reek:FeatureEnvy
|
21
|
-
def render_box(pdf)
|
22
|
-
box(pdf, [0, pdf.cursor], page_content_width(pdf)) do
|
23
|
-
pdf.text('QR Code', style: :italic)
|
24
|
-
yield
|
25
|
-
end
|
26
|
-
end
|
27
|
-
private_class_method :render_box
|
28
|
-
|
29
|
-
def pdf_options(page_width)
|
30
|
-
qrcode_size = page_width * 0.65
|
31
|
-
|
32
|
-
{ qrcode_size: qrcode_size, page_width: page_width }
|
33
|
-
end
|
34
|
-
private_class_method :pdf_options
|
35
|
-
|
36
|
-
# :reek:FeatureEnvy
|
37
|
-
def generate_qr_code(pdf, data, options)
|
38
|
-
qrcode_size = options[:qrcode_size]
|
39
|
-
opts = {
|
40
|
-
at: [(options[:page_width] - qrcode_size) / 2, pdf.cursor],
|
41
|
-
width: qrcode_size,
|
42
|
-
height: qrcode_size
|
43
|
-
}
|
44
|
-
insert_image(pdf, generate_qr_code_data(data[:emission_details][:qrcode_url], qrcode_size), opts)
|
45
|
-
end
|
46
|
-
private_class_method :generate_qr_code
|
47
|
-
|
48
|
-
def insert_image(pdf, image, options)
|
49
|
-
pdf.image(image, options)
|
50
|
-
pdf.move_down(options[:height])
|
51
|
-
end
|
52
|
-
private_class_method :insert_image
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module BrInvoicesPdf
|
4
|
-
module Nfce
|
5
|
-
module Renderer
|
6
|
-
module TaxesInfo
|
7
|
-
extend Util::BaseRenderer
|
8
|
-
extend BaseRenderer
|
9
|
-
|
10
|
-
module_function
|
11
|
-
|
12
|
-
def execute(pdf, data)
|
13
|
-
box(pdf, [0, pdf.cursor], page_content_width(pdf)) do
|
14
|
-
tribute_values(pdf, data[:additional_info])
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
# :reek:FeatureEnvy
|
19
|
-
def tribute_values(pdf, taxes)
|
20
|
-
pdf.text("Tributos\n\n", style: :italic)
|
21
|
-
text = "#{taxes}\n\n"
|
22
|
-
pdf.text(text, align: :center)
|
23
|
-
end
|
24
|
-
private_class_method :tribute_values
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
@@ -1,30 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module BrInvoicesPdf
|
4
|
-
module Nfce
|
5
|
-
module Renderer
|
6
|
-
module Totals
|
7
|
-
extend Util::BaseRenderer
|
8
|
-
extend BaseRenderer
|
9
|
-
|
10
|
-
module_function
|
11
|
-
|
12
|
-
def execute(pdf, data)
|
13
|
-
insert_box_info(pdf, data)
|
14
|
-
|
15
|
-
pdf.move_down(5)
|
16
|
-
end
|
17
|
-
|
18
|
-
def box_info(data_payment)
|
19
|
-
[
|
20
|
-
['Items', format_currency(data_payment[:items])],
|
21
|
-
['Total bruto', format_currency(data_payment[:subtotal])],
|
22
|
-
['Desconto', format_currency(data_payment[:discounts])],
|
23
|
-
['Total', format_currency(data_payment[:total])]
|
24
|
-
]
|
25
|
-
end
|
26
|
-
private_class_method :box_info
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
@@ -1,121 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module BrInvoicesPdf
|
4
|
-
module Util
|
5
|
-
module BaseRenderer
|
6
|
-
module_function
|
7
|
-
|
8
|
-
def box(pdf, position, width)
|
9
|
-
pdf.bounding_box(position, width: width) do
|
10
|
-
pdf.pad(2) do
|
11
|
-
pdf.indent(2, 2) do
|
12
|
-
yield
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
pdf.stroke_bounds
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
def insert_box_info(pdf, data, xpos = 0)
|
21
|
-
third_width = page_content_width(pdf) * 0.333333333
|
22
|
-
ypos = pdf.cursor
|
23
|
-
box_info(data[:totals]).each do |(title, value)|
|
24
|
-
insert_box(pdf, title: title, value: value, xpos: xpos, ypos: ypos, third_width: third_width)
|
25
|
-
xpos += third_width
|
26
|
-
end
|
27
|
-
end
|
28
|
-
private_class_method :insert_box_info
|
29
|
-
|
30
|
-
# :reek:FeatureEnvy
|
31
|
-
def insert_box(pdf, params)
|
32
|
-
box(pdf, [params[:xpos], params[:ypos]], params[:third_width]) do
|
33
|
-
insert_texts(pdf, params[:title], params[:value])
|
34
|
-
end
|
35
|
-
end
|
36
|
-
private_class_method :insert_box
|
37
|
-
|
38
|
-
def insert_texts(pdf, title, value)
|
39
|
-
pdf.text(title, style: :italic)
|
40
|
-
pdf.text(value, align: :right)
|
41
|
-
end
|
42
|
-
private_class_method :insert_texts
|
43
|
-
|
44
|
-
# :reek:FeatureEnvy
|
45
|
-
def pdf_setup(pdf)
|
46
|
-
pdf.bounding_box([0, pdf.cursor], width: page_content_width(pdf)) do
|
47
|
-
pdf.pad(10) do
|
48
|
-
pdf.indent(10, 10) do
|
49
|
-
yield
|
50
|
-
end
|
51
|
-
end
|
52
|
-
pdf.stroke_bounds
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
PAYMENTS_TABLE_BASE_DATA = [['FORMA DE PAGAMENTO', 'VALOR']].freeze
|
57
|
-
# :reek:FeatureEnvy
|
58
|
-
def mount_payment_data(data)
|
59
|
-
data[:payments].reduce(PAYMENTS_TABLE_BASE_DATA) do |result, cur|
|
60
|
-
result + [[cur[:type], format_currency(cur[:amount])]]
|
61
|
-
end
|
62
|
-
end
|
63
|
-
private_class_method :mount_payment_data
|
64
|
-
|
65
|
-
def generate_qr_code_data(qr_code_string, qrcode_size)
|
66
|
-
qrcode = RQRCode::QRCode.new(qr_code_string)
|
67
|
-
blob = qrcode.as_png(size: qrcode_size.to_i, border_modules: 0).to_blob
|
68
|
-
StringIO.new(blob)
|
69
|
-
end
|
70
|
-
private_class_method :generate_qr_code_data
|
71
|
-
|
72
|
-
def execute_payment_form(pdf, date_from_table)
|
73
|
-
pdf.font_size(6) do
|
74
|
-
width = page_content_width(pdf)
|
75
|
-
table_data = date_from_table
|
76
|
-
render_table(pdf, table_data, width)
|
77
|
-
end
|
78
|
-
|
79
|
-
pdf.move_down(5)
|
80
|
-
end
|
81
|
-
private_class_method :execute_payment_form
|
82
|
-
|
83
|
-
CNPJ_FORMAT = '%02d.%03d.%03d/%04d-%02d'
|
84
|
-
# :reek:FeatureEnvy
|
85
|
-
def format_cnpj(cnpj)
|
86
|
-
format(CNPJ_FORMAT, cnpj[0, 2].to_i, cnpj[2, 3].to_i, cnpj[5, 3].to_i,
|
87
|
-
cnpj[8, 4].to_i, cnpj[12, 2].to_i)
|
88
|
-
end
|
89
|
-
|
90
|
-
CPF_FORMAT = '%d.%d.%d-%d'
|
91
|
-
# :reek:FeatureEnvy
|
92
|
-
def format_cpf(cpf)
|
93
|
-
format(CPF_FORMAT, cpf[0, 3], cpf[3, 3], cpf[6, 3], cpf[9, 2])
|
94
|
-
end
|
95
|
-
|
96
|
-
# :reek:FeatureEnvy
|
97
|
-
def format_currency(number_string)
|
98
|
-
number = BigDecimal(number_string)
|
99
|
-
format('%.2f', number.truncate(2)).tr('.', ',')
|
100
|
-
end
|
101
|
-
|
102
|
-
# :reek:FeatureEnvy
|
103
|
-
def format_number(number_string, prec: 4)
|
104
|
-
number = BigDecimal(number_string)
|
105
|
-
format("%.#{prec}f", number.truncate(prec)).tr('.', ',')
|
106
|
-
end
|
107
|
-
|
108
|
-
# :reek:FeatureEnvy
|
109
|
-
def page_paper_width(name)
|
110
|
-
(name.is_a?(Array) ? name : PDF::Core::PageGeometry::SIZES[name]).first
|
111
|
-
end
|
112
|
-
|
113
|
-
# :reek:FeatureEnvy
|
114
|
-
def page_content_width(pdf)
|
115
|
-
page = pdf.page
|
116
|
-
margins = page.margins
|
117
|
-
page_paper_width(page.size) - margins[:left] - margins[:right]
|
118
|
-
end
|
119
|
-
end
|
120
|
-
end
|
121
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module BrInvoicesPdf
|
4
|
-
module Util
|
5
|
-
module Enum
|
6
|
-
PAYMENT_TYPES = {
|
7
|
-
'01' => 'Dinheiro',
|
8
|
-
'02' => 'Cheque',
|
9
|
-
'03' => 'Cartão de Crédito',
|
10
|
-
'04' => 'Cartão de Débito',
|
11
|
-
'05' => 'Crédito Loja',
|
12
|
-
'10' => 'Vale Alimentação',
|
13
|
-
'11' => 'Vale Refeição',
|
14
|
-
'12' => 'Vale Presente',
|
15
|
-
'13' => 'Vale Combustível',
|
16
|
-
'99' => 'Outros'
|
17
|
-
}.freeze
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module BrInvoicesPdf
|
4
|
-
module Util
|
5
|
-
module MountParams
|
6
|
-
module_function
|
7
|
-
|
8
|
-
def mount(xml, params)
|
9
|
-
params.reduce({}) do |response, (param, path)|
|
10
|
-
{ **response, param => locate_element(xml, path) }
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
def address_params(root_path, local)
|
15
|
-
{
|
16
|
-
streetname: "#{root_path}/ender#{local}/xLgr",
|
17
|
-
number: "#{root_path}/ender#{local}/nro",
|
18
|
-
district: "#{root_path}/ender#{local}/xBairro",
|
19
|
-
city: "#{root_path}/ender#{local}/xMun",
|
20
|
-
state: "#{root_path}/ender#{local}/UF"
|
21
|
-
}.freeze
|
22
|
-
end
|
23
|
-
private_class_method :address_params
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
@@ -1,102 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module BrInvoicesPdf
|
4
|
-
module Util
|
5
|
-
module NfceCheckUrls
|
6
|
-
URLS = {
|
7
|
-
'12': {
|
8
|
-
'1': 'http://www.sefaznet.ac.gov.br/nfce/consulta',
|
9
|
-
'2': 'http://hml.sefaznet.ac.gov.br/nfce/consulta'
|
10
|
-
},
|
11
|
-
'27': {
|
12
|
-
'1': 'http://nfce.sefaz.al.gov.br/consultaNFCe.htm',
|
13
|
-
'2': 'http://nfce.sefaz.al.gov.br/consultaNFCe.htm'
|
14
|
-
},
|
15
|
-
'16': {
|
16
|
-
'1': 'https://www.sefaz.ap.gov.br/sate/seg/SEGf_AcessarFuncao.jsp?cdFuncao=FIS_1261',
|
17
|
-
'2': 'https://www.sefaz.ap.gov.br/sate1/seg/SEGf_AcessarFuncao.jsp?cdFuncao=FIS_1261'
|
18
|
-
},
|
19
|
-
'13': {
|
20
|
-
'1': 'http://sistemas.sefaz.am.gov.br/nfceweb/formConsulta.do',
|
21
|
-
'2': 'http://homnfce.sefaz.am.gov.br/nfceweb/formConsulta.do'
|
22
|
-
},
|
23
|
-
'29': {
|
24
|
-
'1': 'http://nfe.sefaz.ba.gov.br/servicos/nfce/default.aspx',
|
25
|
-
'2': 'http://hnfe.sefaz.ba.gov.br/servicos/nfce/default.aspx'
|
26
|
-
},
|
27
|
-
'23': {
|
28
|
-
'1': 'http://nfceh.sefaz.ce.gov.br/pages/consultaNota.jsf',
|
29
|
-
'2': 'http://nfceh.sefaz.ce.gov.br/pages/consultaNota.jsf'
|
30
|
-
},
|
31
|
-
'53': {
|
32
|
-
'1': 'http://dec.fazenda.df.gov.br/NFCE/',
|
33
|
-
'2': 'http://dec.fazenda.df.gov.br/NFCE/'
|
34
|
-
},
|
35
|
-
'32': {
|
36
|
-
'1': 'http://app.sefaz.es.gov.br/ConsultaNFCe',
|
37
|
-
'2': 'http://homologacao.sefaz.es.gov.br/ConsultaNFCe'
|
38
|
-
},
|
39
|
-
'21': {
|
40
|
-
'1': 'http://www.nfce.sefaz.ma.gov.br/portal/consultaNFe.do?method=preFilterCupom&',
|
41
|
-
'2': 'http://www.hom.nfce.sefaz.ma.gov.br/portal/consultarNFCe.jsp'
|
42
|
-
},
|
43
|
-
'51': {
|
44
|
-
'1': 'http://www.sefaz.mt.gov.br/nfce/consultanfce',
|
45
|
-
'2': 'http://homologacao.sefaz.mt.gov.br/nfce/consultanfce'
|
46
|
-
},
|
47
|
-
'50': {
|
48
|
-
'1': 'http://www.dfe.ms.gov.br/nfce',
|
49
|
-
'2': 'http://www.dfe.ms.gov.br/nfce'
|
50
|
-
},
|
51
|
-
'15': {
|
52
|
-
'1': 'https://appnfc.sefa.pa.gov.br/portal/view/consultas/nfce/consultanfce.seam',
|
53
|
-
'2': 'https://appnfc.sefa.pa.gov.br/portal-homologacao/view/consultas/nfce/consultanfce.seam'
|
54
|
-
},
|
55
|
-
'25': {
|
56
|
-
'1': 'http://www.receita.pb.gov.br/nfce',
|
57
|
-
'2': 'http://www.receita.pb.gov.br/nfcehom'
|
58
|
-
},
|
59
|
-
'41': {
|
60
|
-
'1': 'http://www.fazenda.pr.gov.br/',
|
61
|
-
'2': 'http://www.fazenda.pr.gov.br/'
|
62
|
-
},
|
63
|
-
'22': {
|
64
|
-
'1': 'http://webas.sefaz.pi.gov.br/nfceweb/consultarNFCe.jsf',
|
65
|
-
'2': 'http://webas.sefaz.pi.gov.br/nfceweb-homologacao/consultarNFCe.jsf'
|
66
|
-
},
|
67
|
-
'33': {
|
68
|
-
'1': 'http://www.nfce.fazenda.rj.gov.br/consulta',
|
69
|
-
'2': 'http://www.nfce.fazenda.rj.gov.br/consulta'
|
70
|
-
},
|
71
|
-
'24': {
|
72
|
-
'1': 'http://nfce.set.rn.gov.br/consultarNFCe.aspx',
|
73
|
-
'2': 'http://nfce.set.rn.gov.br/consultarNFCe.aspx'
|
74
|
-
},
|
75
|
-
'43': {
|
76
|
-
'1': 'https://www.sefaz.rs.gov.br/NFCE/NFCE-COM.aspx',
|
77
|
-
'2': 'https://www.sefaz.rs.gov.br/NFCE/NFCE-COM.aspx'
|
78
|
-
},
|
79
|
-
'11': {
|
80
|
-
'1': 'http://www.nfce.sefin.ro.gov.br/',
|
81
|
-
'2': 'http://www.nfce.sefin.ro.gov.br/'
|
82
|
-
},
|
83
|
-
'14': {
|
84
|
-
'1': 'https://www.sefaz.rr.gov.br/nfce/servlet/wp_consulta_nfce',
|
85
|
-
'2': 'http://200.174.88.103:8080/nfce/servlet/wp_consulta_nfce'
|
86
|
-
},
|
87
|
-
'35': {
|
88
|
-
'1': 'https://www.nfce.fazenda.sp.gov.br/NFCeConsultaPublica/Paginas/ConsultaPublica.aspx',
|
89
|
-
'2': 'https://www.homologacao.nfce.fazenda.sp.gov.br/NFCeConsultaPublica/Paginas/ConsultaPublica.aspx'
|
90
|
-
},
|
91
|
-
'28': {
|
92
|
-
'1': 'http://www.nfce.se.gov.br/portal/portalNoticias.jsp',
|
93
|
-
'2': 'http://www.hom.nfe.se.gov.br/portal/portalNoticias.jsp'
|
94
|
-
},
|
95
|
-
'17': {
|
96
|
-
'1': 'http://apps.sefaz.to.gov.br/portal-nfce/consultarNFCe.jsf',
|
97
|
-
'2': 'http://apps.sefaz.to.gov.br/portal-nfce-homologacao/consultarNFCe.jsf'
|
98
|
-
}
|
99
|
-
}.freeze
|
100
|
-
end
|
101
|
-
end
|
102
|
-
end
|
@@ -1,33 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module BrInvoicesPdf
|
4
|
-
module Util
|
5
|
-
module PdfRenderer
|
6
|
-
extend Util::BaseRenderer
|
7
|
-
|
8
|
-
module_function
|
9
|
-
|
10
|
-
AUTO_HEIGHT_MOCK = 2000
|
11
|
-
|
12
|
-
# :reek:FeatureEnvy
|
13
|
-
def generate_pdf(data, options, renderers)
|
14
|
-
page_width = Util::BaseRenderer.page_paper_width(options[:page_size])
|
15
|
-
|
16
|
-
Prawn::Document.new(options.merge(page_size: [page_width, AUTO_HEIGHT_MOCK])) do |pdf|
|
17
|
-
pdf_content(pdf, data, page_width: page_width, renderers: renderers)
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
def pdf_content(pdf, data, options)
|
22
|
-
pdf.font_size(7) do
|
23
|
-
options[:renderers].each do |renderer|
|
24
|
-
renderer.execute(pdf, data)
|
25
|
-
end
|
26
|
-
|
27
|
-
page = pdf.page
|
28
|
-
page.dictionary.data[:MediaBox] = [0, pdf.y - page.margins[:bottom], options[:page_width], AUTO_HEIGHT_MOCK]
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|