br_danfe 3.1.0 → 3.1.1

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.
Files changed (99) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/lib/br_danfe/danfe_lib/nfe_lib/consts.rb +1 -1
  4. data/lib/br_danfe/danfe_lib/nfe_lib/dest.rb +3 -3
  5. data/lib/br_danfe/danfe_lib/nfe_lib/det_body.rb +1 -1
  6. data/lib/br_danfe/danfe_lib/nfe_lib/document.rb +5 -5
  7. data/lib/br_danfe/danfe_lib/nfe_lib/dup.rb +1 -1
  8. data/lib/br_danfe/danfe_lib/nfe_lib/emit_header.rb +29 -28
  9. data/lib/br_danfe/danfe_lib/nfe_lib/helper.rb +1 -1
  10. data/lib/br_danfe/danfe_lib/nfe_lib/infadic.rb +3 -3
  11. data/lib/br_danfe/danfe_lib/nfe_lib/ticket.rb +9 -9
  12. data/lib/br_danfe/document_builder.rb +0 -7
  13. data/lib/br_danfe/version.rb +1 -1
  14. data/spec/br_danfe/danfe_lib/nfe_lib/helper_spec.rb +16 -0
  15. data/spec/fixtures/nfe/lib/dest#render-v2.00.pdf +0 -0
  16. data/spec/fixtures/nfe/lib/dest#render-v3.10.pdf +0 -0
  17. data/spec/fixtures/nfe/lib/dest#render-v4.00.pdf +0 -0
  18. data/spec/fixtures/nfe/lib/dest#render-with-address-bigger.pdf +0 -0
  19. data/spec/fixtures/nfe/lib/dest#render-with_cnpj.pdf +0 -0
  20. data/spec/fixtures/nfe/lib/dest#render-with_cpf.pdf +0 -0
  21. data/spec/fixtures/nfe/lib/dest#render-with_ie.pdf +0 -0
  22. data/spec/fixtures/nfe/lib/dest#render-without-address-complement.pdf +0 -0
  23. data/spec/fixtures/nfe/lib/det_body#render-csosn.pdf +749 -714
  24. data/spec/fixtures/nfe/lib/det_body#render-cst.pdf +485 -457
  25. data/spec/fixtures/nfe/lib/det_body#render-fci.pdf +336 -307
  26. data/spec/fixtures/nfe/lib/det_body#render-icms_st.pdf +346 -312
  27. data/spec/fixtures/nfe/lib/det_body#render-quantity_with_custom_precision.pdf +332 -303
  28. data/spec/fixtures/nfe/lib/det_body#render-three_pages.pdf +6690 -6497
  29. data/spec/fixtures/nfe/lib/det_body#render-two_pages.pdf +6508 -6322
  30. data/spec/fixtures/nfe/lib/det_body#render-unit_price_with_custom_precision.pdf +332 -303
  31. data/spec/fixtures/nfe/lib/det_body#render-with_entrega.pdf +338 -314
  32. data/spec/fixtures/nfe/lib/det_body#render-with_infadprod.pdf +350 -311
  33. data/spec/fixtures/nfe/lib/det_body#render-with_issqn.pdf +3186 -3084
  34. data/spec/fixtures/nfe/lib/det_body#render-without_issqn.pdf +3459 -2807
  35. data/spec/fixtures/nfe/lib/document#lcnpj_cpf-blank.pdf +0 -0
  36. data/spec/fixtures/nfe/lib/document#lcnpj_cpf-invalid.pdf +0 -0
  37. data/spec/fixtures/nfe/lib/document#lcnpj_cpf-valid.pdf +0 -0
  38. data/spec/fixtures/nfe/lib/document#lie-blank-uf-invalid.pdf +0 -0
  39. data/spec/fixtures/nfe/lib/document#lie-blank.pdf +0 -0
  40. data/spec/fixtures/nfe/lib/document#lie-invalid.pdf +0 -0
  41. data/spec/fixtures/nfe/lib/document#lie-valid.pdf +0 -0
  42. data/spec/fixtures/nfe/lib/dup#render-with_entrega.pdf +0 -0
  43. data/spec/fixtures/nfe/lib/dup#render.pdf +0 -0
  44. data/spec/fixtures/nfe/lib/emit_header#render-nfe_key.pdf +316 -222
  45. data/spec/fixtures/nfe/lib/emit_header#render-second_page.pdf +316 -222
  46. data/spec/fixtures/nfe/lib/emit_header#render-with_cpf.pdf +317 -218
  47. data/spec/fixtures/nfe/lib/emit_header#render-with_logo.pdf +316 -222
  48. data/spec/fixtures/nfe/lib/emit_header#render-without_logo.pdf +300 -206
  49. data/spec/fixtures/nfe/lib/entrega#render-v2.00.pdf +0 -0
  50. data/spec/fixtures/nfe/lib/entrega#render-with-address-bigger.pdf +0 -0
  51. data/spec/fixtures/nfe/lib/entrega#render-with_cpf.pdf +0 -0
  52. data/spec/fixtures/nfe/lib/icmstot#render-with_entrega.pdf +0 -0
  53. data/spec/fixtures/nfe/lib/icmstot#render.pdf +0 -0
  54. data/spec/fixtures/nfe/lib/infadic#render-all_the_informations.pdf +0 -0
  55. data/spec/fixtures/nfe/lib/infadic#render-difal.pdf +0 -0
  56. data/spec/fixtures/nfe/lib/infadic#render-extra_volume.pdf +0 -0
  57. data/spec/fixtures/nfe/lib/infadic#render-with_complementary_information.pdf +0 -0
  58. data/spec/fixtures/nfe/lib/infadic#render-with_dup_additional_information.pdf +0 -0
  59. data/spec/fixtures/nfe/lib/infadic#render-with_fisco_additional_information.pdf +0 -0
  60. data/spec/fixtures/nfe/lib/infadic#render-with_street_data.pdf +0 -0
  61. data/spec/fixtures/nfe/lib/infadic#render-without_dup_additional_information.pdf +0 -0
  62. data/spec/fixtures/nfe/lib/infadic#render.pdf +0 -0
  63. data/spec/fixtures/nfe/lib/infadic_vol#render-extra_volume.pdf +0 -0
  64. data/spec/fixtures/nfe/lib/issqn#render-with_entrega.pdf +0 -0
  65. data/spec/fixtures/nfe/lib/issqn#render-with_issqn.pdf +0 -0
  66. data/spec/fixtures/nfe/lib/issqn#render-with_one_issqn_value.pdf +0 -0
  67. data/spec/fixtures/nfe/lib/ticket#render.pdf +0 -0
  68. data/spec/fixtures/nfe/lib/ticket#render_with_dEmit.pdf +0 -0
  69. data/spec/fixtures/nfe/lib/ticket#render_with_dhEmit.pdf +0 -0
  70. data/spec/fixtures/nfe/lib/transp#render-modfrete_0.pdf +0 -0
  71. data/spec/fixtures/nfe/lib/transp#render-modfrete_1.pdf +0 -0
  72. data/spec/fixtures/nfe/lib/transp#render-modfrete_2.pdf +0 -0
  73. data/spec/fixtures/nfe/lib/transp#render-modfrete_3.pdf +0 -0
  74. data/spec/fixtures/nfe/lib/transp#render-modfrete_4.pdf +0 -0
  75. data/spec/fixtures/nfe/lib/transp#render-modfrete_9.pdf +0 -0
  76. data/spec/fixtures/nfe/lib/transp#render-with_entrega.pdf +0 -0
  77. data/spec/fixtures/nfe/lib/transp#render.pdf +0 -0
  78. data/spec/fixtures/nfe/lib/vol#render-blank-boxes.pdf +0 -0
  79. data/spec/fixtures/nfe/lib/vol#render-with_entrega.pdf +0 -0
  80. data/spec/fixtures/nfe/lib/vol#render.pdf +0 -0
  81. data/spec/fixtures/nfe/v2.00/custom_options.fixture.pdf +1006 -918
  82. data/spec/fixtures/nfe/v2.00/nfe_simples_nacional.xml.fixture.pdf +997 -916
  83. data/spec/fixtures/nfe/v2.00/nfe_with_entrega.xml.fixture.pdf +1034 -953
  84. data/spec/fixtures/nfe/v2.00/nfe_with_extra_volumes.xml.fixture.pdf +2764 -2638
  85. data/spec/fixtures/nfe/v2.00/nfe_with_fci.xml.fixture.pdf +749 -673
  86. data/spec/fixtures/nfe/v2.00/nfe_with_ns.xml.fixture.pdf +2647 -2565
  87. data/spec/fixtures/nfe/v2.00/nfe_without_ns.xml.fixture.pdf +1014 -935
  88. data/spec/fixtures/nfe/v3.10/multiples.xmls.on.the.same.pdf.pdf +3321 -3235
  89. data/spec/fixtures/nfe/v3.10/nfe_simples_nacional.xml.fixture.pdf +1780 -1702
  90. data/spec/fixtures/nfe/v3.10/with_footer.fixture.pdf +2550 -2475
  91. data/spec/fixtures/nfe/v3.10/with_issqn.fixture.pdf +2425 -2347
  92. data/spec/fixtures/nfe/v3.10/with_three_pages.fixture.pdf +7821 -7658
  93. data/spec/fixtures/nfe/v3.10/without_issqn.fixture.pdf +2914 -2836
  94. metadata +1 -6
  95. data/fonts/Arimo-LICENSE.txt +0 -118
  96. data/fonts/arimo.ttf +0 -0
  97. data/fonts/arimo_bold.ttf +0 -0
  98. data/fonts/arimo_bold_italic.ttf +0 -0
  99. data/fonts/arimo_italic.ttf +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a35847dcbae6504c66476c8d5f59dd87816e0dc16b292300b18ebd2f1914ffb7
4
- data.tar.gz: 2b00c692e871d8c0aa4007d08e5e388d6ca1201aafc52a965402046ea5126661
3
+ metadata.gz: 1ff19b20871262acd4e02135c7e7d237b5052aef8666a83d6e921cc0e3a4930b
4
+ data.tar.gz: 4410d226e4eaa0123a5180db9d2e33328caacc46105b23aff0715cb605d08e50
5
5
  SHA512:
6
- metadata.gz: 45acd64522683cf03b6d12cb5e590bd1dd4e6c9fff12719e14a066985e3304ada0b21e69f052cced74d855f2471b724b72af024d8d5e2e3a27a701a1642b6612
7
- data.tar.gz: 76889322d06ca78f1913e8a1883f97a71ca8720895b004aee58806c7b002aee40389d03e6d66500a641acfb4774777fda3dc7a4610b573e603e72dc0a9dc2148
6
+ metadata.gz: d562723a34053ba2e2b8e541fceb2e73357995d7ac173cb73e3ccfa02fa88b127376da1b146930ba5145bed36d8909b0823146811b7662e8e66f8d4b47e612ab
7
+ data.tar.gz: a2966067515c05e32f12f464d13ec16c0184827e1175e2a3e774d9af9fa06b1768d3ba850dbfde4f78d2b0945a21ae3f793973eb07a545eb2920394d290ae7ce
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- br_danfe (3.1.0)
4
+ br_danfe (3.1.1)
5
5
  barby (= 0.6.9)
6
6
  br_documents (>= 0.1.3)
7
7
  i18n (>= 0.8.6)
@@ -4,7 +4,7 @@ module BrDanfe
4
4
  LINE_HEIGHT = 0.80
5
5
  SPACE_BETWEEN_GROUPS = 0.52
6
6
  LINE_WIDTH = 0.24
7
- CELL_PADDING = 3
7
+ CELL_PADDING = 2
8
8
  TITLE_HEIGHT = 0.325
9
9
  CONTENT_WIDTH = 19.56
10
10
  TITLE_BACKGROUND_COLOR = 'EFEFEF'.freeze
@@ -35,13 +35,13 @@ module BrDanfe
35
35
 
36
36
  def render_cnpj_cpf
37
37
  xpath = @xml['dest/CNPJ'].present? ? 'dest/CNPJ' : 'dest/CPF'
38
- @pdf.lcnpj_cpf LINE_HEIGHT, 4.37, 12.57, @l1, @xml, xpath
38
+ @pdf.lcnpj_cpf LINE_HEIGHT, 4.83, 12.57, @l1, @xml, xpath
39
39
  end
40
40
 
41
41
  def render_line2
42
42
  @pdf.i18n_lbox LINE_HEIGHT, 9.66, 0.75, @l2, 'enderDest.xLgr', address
43
43
  @pdf.lbox LINE_HEIGHT, 4.33, 10.41, @l2, @xml, 'enderDest/xBairro'
44
- @pdf.i18n_lbox LINE_HEIGHT, 2.20, 14.74, @l2, 'enderDest.CEP', cep
44
+ @pdf.i18n_lbox LINE_HEIGHT, 2.66, 14.74, @l2, 'enderDest.CEP', cep
45
45
  end
46
46
 
47
47
  def address
@@ -62,7 +62,7 @@ module BrDanfe
62
62
  @pdf.lbox LINE_HEIGHT, 6.61, 0.75, @l3, @xml, 'enderDest/xMun'
63
63
  @pdf.i18n_lbox LINE_HEIGHT, 4.06, 7.36, @l3, 'enderDest.fone', phone
64
64
  @pdf.lbox LINE_HEIGHT, 1.14, 11.42, @l3, @xml, 'enderDest/UF'
65
- @pdf.lie LINE_HEIGHT, 4.38, 12.56, @l3, @xml, 'enderDest/UF', 'dest/IE'
65
+ @pdf.lie LINE_HEIGHT, 4.84, 12.56, @l3, @xml, 'enderDest/UF', 'dest/IE'
66
66
  end
67
67
 
68
68
  def phone
@@ -99,7 +99,7 @@ module BrDanfe
99
99
  end
100
100
 
101
101
  def cell_text(text, options = {})
102
- cell = { content: text, border_lines: [:solid], size: 5 }
102
+ cell = { content: text, border_lines: [:solid], size: 6 }
103
103
  cell.merge!(options)
104
104
  cell
105
105
  end
@@ -12,7 +12,7 @@ module BrDanfe
12
12
  botton_margin: 0
13
13
  )
14
14
 
15
- @document.font 'arimo'
15
+ @document.font 'tinos'
16
16
 
17
17
  @document.line_width = LINE_WIDTH
18
18
  end
@@ -122,13 +122,13 @@ module BrDanfe
122
122
  def box(at, w, h, title = '', info = '', options = {})
123
123
  options = {
124
124
  align: :left,
125
- size: 6,
125
+ size: 10,
126
126
  style: nil,
127
127
  valign: :top,
128
128
  border: 1,
129
- label_size: 5.5,
129
+ label_size: 6,
130
130
  label_offset: 1.9,
131
- value_offset: 11.2,
131
+ value_offset: 10,
132
132
  leading: 0
133
133
  }.merge(options)
134
134
 
@@ -147,7 +147,7 @@ module BrDanfe
147
147
  def label(at, w, title, options)
148
148
  fill_color LABEL_COLOR
149
149
  text_box title, size: options[:label_size], at: [at[0], at[1] - options[:label_offset]],
150
- width: w - (CELL_PADDING * 2), height: 7
150
+ width: w - (CELL_PADDING * 2), height: 8
151
151
  fill_color TEXT_COLOR
152
152
  end
153
153
  end
@@ -77,7 +77,7 @@ module BrDanfe
77
77
  end
78
78
 
79
79
  def label
80
- { size: 5.5, border: 0 }
80
+ { size: 6, border: 0 }
81
81
  end
82
82
  end
83
83
  end
@@ -2,7 +2,8 @@ module BrDanfe
2
2
  module DanfeLib
3
3
  module NfeLib
4
4
  class EmitHeader
5
- OPERATION_TYPE_BOX_LINE_WIDTH = 0.75
5
+ IDENTIFICATION_SIZE = 10
6
+ DESCRIPTION_SIZE = 8
6
7
 
7
8
  def initialize(pdf, xml, logo, logo_dimensions)
8
9
  @pdf = pdf
@@ -25,20 +26,24 @@ module BrDanfe
25
26
  def company_box
26
27
  @pdf.ibox 3.92, 7.46, 0.75, @y_position
27
28
  @pdf.ibox 3.92, 7.46, 0.75, @y_position, '', @xml['emit/xNome'],
28
- size: 8, align: :center, border: 0, style: :bold
29
+ size: 12, align: :center, border: 0, style: :bold
29
30
 
30
31
  address_company
31
32
  end
32
33
 
33
34
  def address_company
34
35
  if @logo.blank?
35
- @pdf.ibox 3.92, 7.46, 0.75, @y_position + 1.46, '', address, align: :center, border: 0, leading: 2
36
+ @pdf.ibox 3.92, 7.46, 0.75, @y_position + 1.46, '', address, address_style.merge(align: :center)
36
37
  else
37
- @pdf.ibox 3.92, 4.7, 3.65, @y_position + 1.46, '', address, align: :left, border: 0, leading: 2
38
+ @pdf.ibox 3.92, 4.7, 3.65, @y_position + 1.46, '', address, address_style.merge(align: :left)
38
39
  logo
39
40
  end
40
41
  end
41
42
 
43
+ def address_style
44
+ { size: DESCRIPTION_SIZE, style: :bold, border: 0, leading: 2 }
45
+ end
46
+
42
47
  def address
43
48
  "#{@xml['enderEmit/xLgr']}, #{@xml['enderEmit/nro']}\n" \
44
49
  "#{@xml['enderEmit/xBairro']} - #{cep}\n" \
@@ -69,49 +74,45 @@ module BrDanfe
69
74
  @pdf.ibox 3.92, 2.08, 8.21, @y_position
70
75
 
71
76
  @pdf.ibox 0.60, 2.08, 8.21, @y_position, '', 'DANFE',
72
- size: 8, align: :center, border: 0, style: :bold
77
+ size: 12, align: :center, border: 0, style: :bold
73
78
 
74
- @pdf.fill_color LABEL_COLOR
75
- @pdf.ibox 1.20, 2.08, 8.21, @y_position + 0.60, '', I18n.t('danfe.others.danfe'),
76
- size: 4.5, align: :center, border: 0
77
- @pdf.fill_color TEXT_COLOR
79
+ @pdf.ibox 1.40, 2.08, 8.21, @y_position + 0.52, '', I18n.t('danfe.others.danfe'),
80
+ size: DESCRIPTION_SIZE, align: :center, border: 0
78
81
 
79
82
  operation_type_box
80
83
 
81
- @pdf.ibox 0.32, 2.08, 8.21, @y_position + 2.55, '',
82
- I18n.t('danfe.ide.nNF', nNF: Helper.format_number(@xml['ide/nNF'])),
83
- size: 5.5, align: :center, border: 0
84
- @pdf.ibox 0.32, 2.08, 8.21, @y_position + 2.80, '',
85
- I18n.t('danfe.ide.serie', serie: Helper.format_serie(@xml['ide/serie'])),
86
- size: 5, align: :center, border: 0
84
+ identification_line 2.45, I18n.t('danfe.ide.nNF', nNF: Helper.format_number(@xml['ide/nNF']))
85
+ identification_line 2.88, I18n.t('danfe.ide.serie', serie: Helper.format_serie(@xml['ide/serie']))
86
+ identification_line 3.31, I18n.t('danfe.others.page', current: page, total: total)
87
+ end
87
88
 
88
- @pdf.ibox 1.00, 2.08, 8.21, @y_position + 3.00, '',
89
- I18n.t('danfe.others.page', current: page, total: total),
90
- size: 5, align: :center, valign: :center, border: 0
89
+ def identification_line(y_offset, text)
90
+ @pdf.ibox 0.45, 2.08, 8.21, @y_position + y_offset, '', text,
91
+ size: IDENTIFICATION_SIZE, align: :center, border: 0, style: :bold
91
92
  end
92
93
 
93
94
  def operation_type_box
94
- @pdf.ibox 0.60, 1.50, 8.21, @y_position + 1.80, '',
95
- "0 - #{I18n.t('danfe.ide.tpNF.entry')}\n1 - #{I18n.t('danfe.ide.tpNF.departure')}",
96
- size: 5, valign: :center, border: 0
97
- @pdf.line_width OPERATION_TYPE_BOX_LINE_WIDTH
98
- @pdf.ibox 0.55, 0.55, 9.66, @y_position + 1.83, '', @xml['ide/tpNF'],
99
- size: 6.5, align: :center, valign: :center
100
- @pdf.line_width LINE_WIDTH
95
+ operation = @xml['ide/tpNF'] == '0' ? I18n.t('danfe.ide.tpNF.entry') : I18n.t('danfe.ide.tpNF.departure')
96
+
97
+ @pdf.formatted_text_box(
98
+ [{ text: @xml['ide/tpNF'], size: IDENTIFICATION_SIZE, styles: [:bold] },
99
+ { text: " - #{operation}", size: DESCRIPTION_SIZE }],
100
+ at: [8.21.cm, Helper.invert((@y_position + 1.92).cm)], width: 2.08.cm, height: 0.50.cm,
101
+ align: :center, valign: :center
102
+ )
101
103
  end
102
104
 
103
105
  def access_key_box
104
106
  @pdf.ibox 2.22, 10.02, 10.29, @y_position
105
107
  @pdf.ibarcode 1.50, 8.00, 10.4010, @y_position + 1.90, @xml['infProt > chNFe']
106
108
  @pdf.ibox 0.85, 10.02, 10.29, @y_position + 2.22, I18n.t('danfe.chNFe'),
107
- @xml['infProt > chNFe'].gsub(/(\d)(?=(\d\d\d\d)+(?!\d))/, '\\1 '), size: 6.5, style: :bold,
108
- align: :center
109
+ @xml['infProt > chNFe'].gsub(/(\d)(?=(\d\d\d\d)+(?!\d))/, '\\1 '), style: :bold, align: :center
109
110
  end
110
111
 
111
112
  def sefaz_box
112
113
  @pdf.fill_color LABEL_COLOR
113
114
  @pdf.ibox 0.85, 10.02, 10.29, @y_position + 3.07, '', I18n.t('danfe.others.sefaz'),
114
- valign: :center, size: 4.5
115
+ valign: :center, size: DESCRIPTION_SIZE
115
116
  @pdf.fill_color TEXT_COLOR
116
117
  end
117
118
 
@@ -7,7 +7,7 @@ module BrDanfe
7
7
  end
8
8
 
9
9
  def self.format_number(number)
10
- number.to_s.rjust(9, '0').scan(/\d{3}/).join('.')
10
+ number.to_i.to_s.reverse.scan(/\d{1,3}/).join('.').reverse
11
11
  end
12
12
 
13
13
  def self.format_serie(serie)
@@ -26,7 +26,7 @@ module BrDanfe
26
26
  end
27
27
 
28
28
  def render_subtitle
29
- @pdf.ibox 2.65, 12.45, 0.75, @y_position, I18n.t('danfe.infAdic.infCpl'), '', label_size: 4.5
29
+ @pdf.ibox 2.65, 12.45, 0.75, @y_position, I18n.t('danfe.infAdic.infCpl'), ''
30
30
  end
31
31
 
32
32
  def render_volumes
@@ -35,7 +35,7 @@ module BrDanfe
35
35
 
36
36
  def render_additional_data(y_position)
37
37
  data = generate_additional_data
38
- @pdf.ibox 2.65, 12.45, 0.75, y_position, '', data, size: 5, valign: :top, border: 0
38
+ @pdf.ibox 2.65, 12.45, 0.75, y_position, '', data, size: 6, valign: :top, border: 0
39
39
  end
40
40
 
41
41
  def generate_additional_data
@@ -120,7 +120,7 @@ module BrDanfe
120
120
  end
121
121
 
122
122
  def render_reserved_fisco
123
- @pdf.ibox 2.65, 7.11, 13.20, @y_position, I18n.t('danfe.infAdic.reserved'), '', label_size: 4.5
123
+ @pdf.ibox 2.65, 7.11, 13.20, @y_position, I18n.t('danfe.infAdic.reserved'), ''
124
124
  end
125
125
  end
126
126
  end
@@ -13,25 +13,25 @@ module BrDanfe
13
13
 
14
14
  def render
15
15
  render_additional_data
16
- @pdf.ibox 0.85, 3.85, 0.75, 2.7, I18n.t('danfe.ticket.received_at'), '', label_size: 5
17
- @pdf.ibox 0.85, 11.75, 4.60, 2.7, I18n.t('danfe.ticket.receiver'), '', label_size: 5
16
+ @pdf.ibox 0.85, 3.85, 0.75, 2.7, I18n.t('danfe.ticket.received_at'), ''
17
+ @pdf.ibox 0.85, 11.75, 4.60, 2.7, I18n.t('danfe.ticket.receiver'), ''
18
18
  render_document
19
19
  render_cut_line
20
20
  end
21
21
 
22
22
  def render_additional_data
23
23
  data = generate_additional_data
24
- @pdf.ibox 0.85, 15.60, 0.75, 1.85, '', data, size: 5.5, style: :bold, valign: :center
24
+ @pdf.ibox 0.85, 15.60, 0.75, 1.85, '', data, size: 6, style: :bold, valign: :center
25
25
  end
26
26
 
27
27
  def render_document
28
28
  @pdf.ibox 1.70, 3.96, 16.35, 1.85
29
- @pdf.ibox 0.40, 3.96, 16.35, 2.30, '', I18n.t('danfe.ticket.title'),
30
- size: 8, align: :center, border: 0, style: :bold
31
- @pdf.ibox 0.32, 3.96, 16.35, 2.68, '', I18n.t('danfe.ide.nNF', nNF: Helper.format_number(@xml['ide/nNF'])),
32
- size: 5.5, align: :center, border: 0
33
- @pdf.ibox 0.32, 3.96, 16.35, 2.90, '', I18n.t('danfe.ide.serie', serie: Helper.format_serie(@xml['ide/serie'])),
34
- size: 5.5, align: :center, border: 0
29
+ @pdf.ibox 0.55, 3.96, 16.35, 1.95, '', I18n.t('danfe.ticket.title'),
30
+ size: 12, align: :center, border: 0, style: :bold
31
+ @pdf.ibox 0.45, 3.96, 16.35, 2.45, '', I18n.t('danfe.ide.nNF', nNF: Helper.format_number(@xml['ide/nNF'])),
32
+ size: 10, align: :center, border: 0, style: :bold
33
+ @pdf.ibox 0.45, 3.96, 16.35, 2.88, '', I18n.t('danfe.ide.serie', serie: Helper.format_serie(@xml['ide/serie'])),
34
+ size: 10, align: :center, border: 0, style: :bold
35
35
  end
36
36
 
37
37
  def render_cut_line
@@ -10,13 +10,6 @@ module BrDanfe
10
10
  normal: "#{BrDanfe.root_path}/fonts/tinos.ttf"
11
11
  }
12
12
 
13
- document.font_families['arimo'] = {
14
- bold: "#{BrDanfe.root_path}/fonts/arimo_bold.ttf",
15
- italic: "#{BrDanfe.root_path}/fonts/arimo_italic.ttf",
16
- bold_italic: "#{BrDanfe.root_path}/fonts/arimo_bold_italic.ttf",
17
- normal: "#{BrDanfe.root_path}/fonts/arimo.ttf"
18
- }
19
-
20
13
  document
21
14
  end
22
15
  end
@@ -1,3 +1,3 @@
1
1
  module BrDanfe
2
- VERSION = '3.1.0'.freeze
2
+ VERSION = '3.1.1'.freeze
3
3
  end
@@ -40,6 +40,22 @@ describe BrDanfe::DanfeLib::NfeLib::Helper do
40
40
  end
41
41
  end
42
42
 
43
+ describe '.format_number' do
44
+ it 'groups the thousands with dots' do
45
+ expect(described_class.format_number('1234567')).to eq '1.234.567'
46
+ end
47
+
48
+ it 'drops the leading zeros' do
49
+ expect(described_class.format_number('000001')).to eq '1'
50
+ end
51
+ end
52
+
53
+ describe '.format_serie' do
54
+ it 'pads the serie with zeros up to three digits' do
55
+ expect(described_class.format_serie('1')).to eq '001'
56
+ end
57
+ end
58
+
43
59
  describe '.address_is_too_big' do
44
60
  let(:pdf) { BrDanfe::DanfeLib::NfeLib::Document.new }
45
61