br_danfe 0.7.5 → 0.7.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/Gemfile.lock +1 -1
- data/config/locales/pt-BR.yml +1 -0
- data/lib/br_danfe/danfe_lib/xprod.rb +28 -15
- data/lib/br_danfe/version.rb +1 -1
- data/spec/lib/danfe_lib/xprod_spec.rb +38 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: e797a591ec546eec11cfbc4c29dbfa70150e923f9bac9783fa780208627534b5
|
4
|
+
data.tar.gz: 7e7874ef1ecab1a069a94776ca52f3f716e8b94c1ecb9a16198dfaf7557dccf0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 445cd9a8904be6c4af9b646554541f6ac4d4b3f7a848c923ec32c1d758512a9c5cff528b16fb23e6832aaa35db0f2e7a6824d03019c9cc0b4de3a2cb74392292
|
7
|
+
data.tar.gz: 740084d68b2a60cac9258cd5d070ff64db8ec050936daa900d078812dfd468981d46c362ccea5b51114cbceaea7f0662f03f6501f9e77ba8050de1357b912dac
|
data/Gemfile.lock
CHANGED
data/config/locales/pt-BR.yml
CHANGED
@@ -9,39 +9,52 @@ module BrDanfe
|
|
9
9
|
xprod = "#{@det.css('prod/xProd').text}"
|
10
10
|
|
11
11
|
xprod += infAdProd if has_infAdProd?
|
12
|
-
xprod += fci if
|
13
|
-
xprod += st if
|
12
|
+
xprod += fci if fci?
|
13
|
+
xprod += st if st?
|
14
|
+
xprod += fcp if fcp?
|
14
15
|
|
15
16
|
xprod
|
16
17
|
end
|
17
18
|
|
18
19
|
private
|
19
|
-
def has_infAdProd?
|
20
|
-
!@det.css("infAdProd").text.empty?
|
21
|
-
end
|
22
20
|
|
23
|
-
def
|
24
|
-
|
21
|
+
def infAdProd
|
22
|
+
"\n#{@det.css('infAdProd').text}"
|
25
23
|
end
|
26
24
|
|
27
|
-
def
|
28
|
-
|
25
|
+
def has_infAdProd?
|
26
|
+
!@det.css("infAdProd").text.empty?
|
29
27
|
end
|
30
28
|
|
31
|
-
def
|
32
|
-
"\n
|
29
|
+
def fci
|
30
|
+
"\n#{I18n.t('danfe.det.prod.xProdFCI',
|
31
|
+
nFCI: @det.css('prod/nFCI').text)}"
|
33
32
|
end
|
34
33
|
|
35
|
-
def fci
|
36
|
-
|
34
|
+
def fci?
|
35
|
+
!@det.css('prod/nFCI').text.empty?
|
37
36
|
end
|
38
37
|
|
39
38
|
def st
|
40
|
-
"\n
|
39
|
+
"\n#{I18n.t('danfe.det.prod.xProdST',
|
41
40
|
pMVAST: Helper.numerify(@det.css('ICMS/*/pMVAST').text),
|
42
41
|
pICMSST: Helper.numerify(@det.css('ICMS/*/pICMSST').text),
|
43
42
|
vBCST: Helper.numerify(@det.css('ICMS/*/vBCST').text),
|
44
|
-
vICMSST: Helper.numerify(@det.css('ICMS/*/vICMSST').text))
|
43
|
+
vICMSST: Helper.numerify(@det.css('ICMS/*/vICMSST').text))}"
|
44
|
+
end
|
45
|
+
|
46
|
+
def st?
|
47
|
+
@det.css("ICMS/*/vBCST").text.to_i > 0
|
48
|
+
end
|
49
|
+
|
50
|
+
def fcp
|
51
|
+
"\n#{I18n.t('danfe.det.prod.xProdFCP',
|
52
|
+
vFCP: Helper.numerify(@det.css('ICMS00/vFCP').text),
|
53
|
+
pFCP: Helper.numerify(@det.css('ICMS00/pFCP').text))}"
|
54
|
+
end
|
55
|
+
|
56
|
+
def fcp?
|
57
|
+
@det.css("ICMS00/vFCP").text.to_i > 0
|
45
58
|
end
|
46
59
|
end
|
47
60
|
end
|
data/lib/br_danfe/version.rb
CHANGED
@@ -88,7 +88,38 @@ describe BrDanfe::DanfeLib::Xprod do
|
|
88
88
|
end
|
89
89
|
end
|
90
90
|
|
91
|
-
context "when have
|
91
|
+
context "when have FCP" do
|
92
|
+
let(:xml_fcp) do
|
93
|
+
xml = <<-eos
|
94
|
+
<det nItem="1">
|
95
|
+
<prod>
|
96
|
+
<xProd>MONITOR DE ARCO ELETRICO</xProd>
|
97
|
+
</prod>
|
98
|
+
<imposto>
|
99
|
+
<vTotTrib>23.56</vTotTrib>
|
100
|
+
<ICMS00>
|
101
|
+
<vFCP>4.71</vFCP>
|
102
|
+
<pFCP>2.00</pFCP>
|
103
|
+
</ICMS>
|
104
|
+
</imposto>
|
105
|
+
</det>
|
106
|
+
eos
|
107
|
+
|
108
|
+
Nokogiri::XML(xml)
|
109
|
+
end
|
110
|
+
|
111
|
+
subject { BrDanfe::DanfeLib::Xprod.new(xml_fcp) }
|
112
|
+
|
113
|
+
it "returns product + FCP" do
|
114
|
+
expected = "MONITOR DE ARCO ELETRICO"
|
115
|
+
expected += "\n"
|
116
|
+
expected += "FCP: Alíq: 2,00% * Vlr: 4,71"
|
117
|
+
|
118
|
+
expect(subject.render).to eq expected
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
context "when have FCI + ST + infAdProd + FCP" do
|
92
123
|
let(:xml_IFC_ST_infAdProd) do
|
93
124
|
xml = <<-eos
|
94
125
|
<det nItem="1">
|
@@ -106,6 +137,10 @@ describe BrDanfe::DanfeLib::Xprod do
|
|
106
137
|
<vICMSST>29.28</vICMSST>
|
107
138
|
</ICMSSN202>
|
108
139
|
</ICMS>
|
140
|
+
<ICMS00>
|
141
|
+
<vFCP>4.71</vFCP>
|
142
|
+
<pFCP>2.00</pFCP>
|
143
|
+
</ICMS>
|
109
144
|
</imposto>
|
110
145
|
<infAdProd>Informações adicionais do produto</infAdProd>
|
111
146
|
</det>
|
@@ -124,6 +159,8 @@ describe BrDanfe::DanfeLib::Xprod do
|
|
124
159
|
expected +="FCI: 12232531-74B2-4FDD-87A6-CF0AD3E55386"
|
125
160
|
expected += "\n"
|
126
161
|
expected += "ST: MVA: 56,00% * Alíq: 17,00% * BC: 479,82 * Vlr: 29,28"
|
162
|
+
expected += "\n"
|
163
|
+
expected += "FCP: Alíq: 2,00% * Vlr: 4,71"
|
127
164
|
|
128
165
|
expect(subject.render).to eq expected
|
129
166
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: br_danfe
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ASSEINFO
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-09-
|
11
|
+
date: 2018-09-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: barby
|
@@ -368,7 +368,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
368
368
|
version: '0'
|
369
369
|
requirements: []
|
370
370
|
rubyforge_project:
|
371
|
-
rubygems_version: 2.
|
371
|
+
rubygems_version: 2.7.6
|
372
372
|
signing_key:
|
373
373
|
specification_version: 4
|
374
374
|
summary: DANFE pdf generator for Brazilian invoices.
|