Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
MatCRL committed Jan 6, 2025
1 parent 335cbdc commit 0f8ee00
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 16 deletions.
5 changes: 2 additions & 3 deletions lib/br_danfe/danfe_lib/nfe_lib/dup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,8 @@ def render
if det_count < 6
y = @y_position - 0.015
else
if det_count == 6
x = 0.75
end
x = 0.75 unless det_count == 6

y = @y_position + 0.185
end

Expand Down
12 changes: 2 additions & 10 deletions lib/br_danfe/danfe_lib/nfe_lib/infadic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def render(volumes_number)
render_title
render_subtitle
render_volumes if volumes_number > 1
render_additional_data generate_y_position(volumes_number) if additional_data?
render_additional_data generate_y_position(volumes_number) if complementary? || address? || difal? || fisco? || dup_content.to_s.present?
render_reserved_fisco
end

Expand Down Expand Up @@ -44,7 +44,7 @@ def generate_additional_data
additional_data.push(address_content) if address?
additional_data.push(difal_content) if difal?
additional_data.push(fisco_content) if fisco?
additional_data.push(dup_content) if dup?
additional_data.push(dup_content) if dup_content.to_s.present?
additional_data.join(' * ')
end

Expand Down Expand Up @@ -113,10 +113,6 @@ def dup_content
value_dups
end

def dup?
dup_content.to_s.present?
end

def generate_y_position(volumes_number)
if volumes_number > 1
return Y_POSITION + 0.30 + volumes_number * 0.15 + 0.2
Expand All @@ -125,10 +121,6 @@ def generate_y_position(volumes_number)
Y_POSITION + 0.30
end

def additional_data?
complementary? || address? || difal? || fisco? || dup?
end

def render_reserved_fisco
@pdf.ibox 2.65, 7.15, 13.20, @y_position, I18n.t('danfe.infAdic.reserved')
end
Expand Down
56 changes: 53 additions & 3 deletions spec/br_danfe/danfe_lib/nfe_lib/dup_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,67 @@
<infNFe Id="NFe25111012345678901234550020000134151000134151" versao="2.00">
<cobr>
<dup>
<nDup>1</nDup>
<nDup>001</nDup>
<dVenc>2015-02-13</dVenc>
<vDup>25.56</vDup>
</dup>
<dup>
<nDup>2</nDup>
<nDup>002</nDup>
<dVenc>2015-03-15</dVenc>
<vDup>25.56</vDup>
</dup>
<dup>
<nDup>3</nDup>
<nDup>003</nDup>
<dVenc>2015-04-14</dVenc>
<vDup>25.55</vDup>
</dup>
<dup>
<nDup>004</nDup>
<dVenc>2015-02-13</dVenc>
<vDup>25.56</vDup>
</dup>
<dup>
<nDup>005</nDup>
<dVenc>2015-03-15</dVenc>
<vDup>25.56</vDup>
</dup>
<dup>
<nDup>006</nDup>
<dVenc>2015-04-14</dVenc>
<vDup>25.55</vDup>
</dup>
<dup>
<nDup>007</nDup>
<dVenc>2015-02-13</dVenc>
<vDup>25.56</vDup>
</dup>
<dup>
<nDup>008</nDup>
<dVenc>2015-03-15</dVenc>
<vDup>25.56</vDup>
</dup>
<dup>
<nDup>009</nDup>
<dVenc>2015-04-14</dVenc>
<vDup>25.55</vDup>
</dup>
<dup>
<nDup>010</nDup>
<dVenc>2015-02-13</dVenc>
<vDup>25.56</vDup>
</dup>
<dup>
<nDup>011</nDup>
<dVenc>2015-03-15</dVenc>
<vDup>25.56</vDup>
</dup>
<dup>
<nDup>012</nDup>
<dVenc>2015-04-14</dVenc>
<vDup>25.55</vDup>
</dup>
<dup>
<nDup>013</nDup>
<dVenc>2015-04-14</dVenc>
<vDup>25.55</vDup>
</dup>
Expand Down
Binary file modified spec/fixtures/nfe/lib/dup#render-with_entrega.pdf
Binary file not shown.

0 comments on commit 0f8ee00

Please sign in to comment.