br_danfe 0.8.0 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/Gemfile.lock +8 -8
- data/README.md +8 -4
- data/config/locales/pt-BR.yml +3 -0
- data/lib/br_danfe/danfe_lib/transp.rb +4 -0
- data/lib/br_danfe/danfe_lib/xprod.rb +20 -0
- data/lib/br_danfe/version.rb +1 -1
- data/spec/fixtures/nfe/lib/transp#render-modfrete_3.pdf +176 -0
- data/spec/fixtures/nfe/lib/transp#render-modfrete_4.pdf +176 -0
- data/spec/lib/danfe_lib/transp_spec.rb +44 -0
- data/spec/lib/danfe_lib/xprod_spec.rb +107 -19
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: d74a6a961fcb024dea137182dbd9d2f486801811
|
4
|
+
data.tar.gz: 7df4378fa399985ba762a9df90b01019432e61ab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b6a725ee44eab65ee84a975643d4f06861077c792fd90dadbd5a977f70ff2ee658f657edb8a321ddbb93357845e785cd624720c35c364752023f1572fcdb3488
|
7
|
+
data.tar.gz: 53694c1b9b4f53754f8113575815426bd87eb822a062bcab2476e05a26b0e9edd26f03166237398e26b94121986e874743129e622838f1e7b5787eea68f56b89
|
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.10.0)
|
5
5
|
barby (= 0.5.1)
|
6
6
|
br_documents (>= 0.0.15)
|
7
7
|
i18n (= 0.8.6)
|
@@ -12,15 +12,15 @@ PATH
|
|
12
12
|
GEM
|
13
13
|
remote: https://rubygems.org/
|
14
14
|
specs:
|
15
|
-
activemodel (5.2.
|
16
|
-
activesupport (= 5.2.
|
17
|
-
activesupport (5.2.
|
15
|
+
activemodel (5.2.3)
|
16
|
+
activesupport (= 5.2.3)
|
17
|
+
activesupport (5.2.3)
|
18
18
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
19
19
|
i18n (>= 0.7, < 2)
|
20
20
|
minitest (~> 5.1)
|
21
21
|
tzinfo (~> 1.1)
|
22
22
|
barby (0.5.1)
|
23
|
-
br_documents (0.
|
23
|
+
br_documents (0.1.2)
|
24
24
|
activemodel (>= 4.0.0)
|
25
25
|
i18n (>= 0.6.5)
|
26
26
|
byebug (3.5.1)
|
@@ -30,7 +30,7 @@ GEM
|
|
30
30
|
codeclimate-test-reporter (1.0.8)
|
31
31
|
simplecov (<= 0.13)
|
32
32
|
columnize (0.9.0)
|
33
|
-
concurrent-ruby (1.1.
|
33
|
+
concurrent-ruby (1.1.5)
|
34
34
|
debugger-linecache (1.2.0)
|
35
35
|
diff-lcs (1.3)
|
36
36
|
docile (1.1.5)
|
@@ -38,7 +38,7 @@ GEM
|
|
38
38
|
json (1.8.6)
|
39
39
|
mini_portile2 (2.4.0)
|
40
40
|
minitest (5.11.3)
|
41
|
-
nokogiri (1.10.
|
41
|
+
nokogiri (1.10.3)
|
42
42
|
mini_portile2 (~> 2.4.0)
|
43
43
|
pdf-core (0.6.1)
|
44
44
|
prawn (2.1.0)
|
@@ -84,4 +84,4 @@ DEPENDENCIES
|
|
84
84
|
simplecov-html (= 0.10.1)
|
85
85
|
|
86
86
|
BUNDLED WITH
|
87
|
-
1.
|
87
|
+
1.17.3
|
data/README.md
CHANGED
@@ -186,14 +186,18 @@ IE | 964.508.990.089
|
|
186
186
|
|
187
187
|
You can generate new data using [4devs generators](http://www.4devs.com.br).
|
188
188
|
|
189
|
-
## Deploy
|
189
|
+
## Deploy to Rubygems
|
190
190
|
|
191
|
-
|
191
|
+
$ bundle exec rake release # Create tag vX.X.X, build and push br_danfe-X.X.X.gem to Rubygems
|
192
192
|
|
193
193
|
You can build or install using one of the above tasks
|
194
194
|
|
195
|
-
|
196
|
-
|
195
|
+
$ bundle exec rake build # Build br_danfe-X.X.X.gem into the pkg directory
|
196
|
+
$ bundle exec rake install # Build and install br_danfe-X.X.X.gem into system gems
|
197
|
+
|
198
|
+
#### Login
|
199
|
+
$ gem signin
|
200
|
+
$ gem signout
|
197
201
|
|
198
202
|
## Contributing
|
199
203
|
|
data/config/locales/pt-BR.yml
CHANGED
@@ -80,6 +80,8 @@ pt-BR:
|
|
80
80
|
emitter: "0-Emitente"
|
81
81
|
recipient: "1-Destinatário"
|
82
82
|
third_party: "2-Terceiros"
|
83
|
+
own_emitter: "3-Prop/Rem"
|
84
|
+
own_recipient: "4-Prop/Dest"
|
83
85
|
no_freight: "9-Sem Frete"
|
84
86
|
veicTransp:
|
85
87
|
RNTC: "CODIGO ANTT"
|
@@ -104,6 +106,7 @@ pt-BR:
|
|
104
106
|
vUnCom: "VL UNIT"
|
105
107
|
vProd: "VL TOTAL"
|
106
108
|
xProdST: "ST: MVA: %{pMVAST}% * Alíq: %{pICMSST}% * BC: %{vBCST} * Vlr: %{vICMSST}"
|
109
|
+
xProdSTRet: "ST Retido: Base: %{vBCSTRet} * Alíq: %{pST}% * Vlr: %{vICMSSTRet}"
|
107
110
|
xProdFCI: "FCI: %{nFCI}"
|
108
111
|
xProdFCP: "FCP: Base: %{vBCFCP} * Alíq: %{pFCP}% * Vlr: %{vFCP}"
|
109
112
|
xProdFCPICMS00: "FCP: Alíq: %{pFCP}% * Vlr: %{vFCP}"
|
@@ -13,6 +13,7 @@ module BrDanfe
|
|
13
13
|
xprod += icms_st if icms_st?
|
14
14
|
xprod += fcp if fcp?
|
15
15
|
xprod += fcp_st if fcp_st?
|
16
|
+
xprod += add_icms_st_ret_to_product
|
16
17
|
|
17
18
|
xprod
|
18
19
|
end
|
@@ -83,6 +84,25 @@ module BrDanfe
|
|
83
84
|
pFCPST: Helper.numerify(@det.css('ICMS/*/pFCPST').text),
|
84
85
|
vFCPST: Helper.numerify(@det.css('ICMS/*/vFCPST').text))}"
|
85
86
|
end
|
87
|
+
|
88
|
+
def add_icms_st_ret_to_product
|
89
|
+
icms_st_ret? ? icms_st_ret : ''
|
90
|
+
end
|
91
|
+
|
92
|
+
def icms_st_ret?
|
93
|
+
@det.css('ICMS/*/vBCSTRet').text.to_i > 0 ||
|
94
|
+
@det.css('ICMS/*/vICMSSTRet').text.to_i > 0 ||
|
95
|
+
@det.css('ICMS/*/pST').text.to_i > 0
|
96
|
+
end
|
97
|
+
|
98
|
+
def icms_st_ret
|
99
|
+
"\n#{I18n.t(
|
100
|
+
'danfe.det.prod.xProdSTRet',
|
101
|
+
vBCSTRet: Helper.numerify(@det.css('ICMS/*/vBCSTRet').text),
|
102
|
+
vICMSSTRet: Helper.numerify(@det.css('ICMS/*/vICMSSTRet').text),
|
103
|
+
pST: Helper.numerify(@det.css('ICMS/*/pST').text)
|
104
|
+
)}"
|
105
|
+
end
|
86
106
|
end
|
87
107
|
end
|
88
108
|
end
|
data/lib/br_danfe/version.rb
CHANGED
@@ -0,0 +1,176 @@
|
|
1
|
+
%PDF-1.3
|
2
|
+
%����
|
3
|
+
1 0 obj
|
4
|
+
<< /Creator <feff0050007200610077006e>
|
5
|
+
/Producer <feff0050007200610077006e>
|
6
|
+
>>
|
7
|
+
endobj
|
8
|
+
2 0 obj
|
9
|
+
<< /Type /Catalog
|
10
|
+
/Pages 3 0 R
|
11
|
+
>>
|
12
|
+
endobj
|
13
|
+
3 0 obj
|
14
|
+
<< /Type /Pages
|
15
|
+
/Count 1
|
16
|
+
/Kids [5 0 R]
|
17
|
+
>>
|
18
|
+
endobj
|
19
|
+
4 0 obj
|
20
|
+
<< /Length 1335
|
21
|
+
>>
|
22
|
+
stream
|
23
|
+
q
|
24
|
+
0.3 w
|
25
|
+
|
26
|
+
BT
|
27
|
+
21.2598 415.1659 Td
|
28
|
+
/F2.0 8 Tf
|
29
|
+
[<5452414e53504f52> 40 <54> 90 <41444f52202f2056> 45 <4f4c554d4553205452414e53504f52> 40 <54> 90 <41444f53>] TJ
|
30
|
+
ET
|
31
|
+
|
32
|
+
21.2598 390.0472 241.5118 22.6772 re
|
33
|
+
S
|
34
|
+
|
35
|
+
BT
|
36
|
+
23.2598 406.6264 Td
|
37
|
+
/F1.0 6 Tf
|
38
|
+
[<52415ac3> 55 <4f20534f4349414c>] TJ
|
39
|
+
ET
|
40
|
+
|
41
|
+
262.7717 390.0472 79.0866 22.6772 re
|
42
|
+
S
|
43
|
+
|
44
|
+
BT
|
45
|
+
264.7717 406.6264 Td
|
46
|
+
/F1.0 6 Tf
|
47
|
+
[<465245544520504f5220434f4e54> 93 <41>] TJ
|
48
|
+
ET
|
49
|
+
|
50
|
+
|
51
|
+
BT
|
52
|
+
264.7717 392.8944 Td
|
53
|
+
/F1.0 10 Tf
|
54
|
+
[<332d50726f702f52656d>] TJ
|
55
|
+
ET
|
56
|
+
|
57
|
+
341.8583 390.0472 50.4567 22.6772 re
|
58
|
+
S
|
59
|
+
|
60
|
+
BT
|
61
|
+
343.8583 406.6264 Td
|
62
|
+
/F1.0 6 Tf
|
63
|
+
[<434f4449474f20414e5454>] TJ
|
64
|
+
ET
|
65
|
+
|
66
|
+
392.315 390.0472 64.9134 22.6772 re
|
67
|
+
S
|
68
|
+
|
69
|
+
BT
|
70
|
+
394.315 406.6264 Td
|
71
|
+
/F1.0 6 Tf
|
72
|
+
[<504c41> 40 <434120444f205645cd43554c4f>] TJ
|
73
|
+
ET
|
74
|
+
|
75
|
+
457.2283 390.0472 21.5433 22.6772 re
|
76
|
+
S
|
77
|
+
|
78
|
+
BT
|
79
|
+
459.2283 406.6264 Td
|
80
|
+
/F1.0 6 Tf
|
81
|
+
[<5546>] TJ
|
82
|
+
ET
|
83
|
+
|
84
|
+
478.7717 390.0472 97.5118 22.6772 re
|
85
|
+
S
|
86
|
+
|
87
|
+
BT
|
88
|
+
480.7717 406.6264 Td
|
89
|
+
/F1.0 6 Tf
|
90
|
+
[<434e504a2f435046>] TJ
|
91
|
+
ET
|
92
|
+
|
93
|
+
21.2598 367.3701 241.5118 22.6772 re
|
94
|
+
S
|
95
|
+
|
96
|
+
BT
|
97
|
+
23.2598 383.9492 Td
|
98
|
+
/F1.0 6 Tf
|
99
|
+
[<454e44455245c74f>] TJ
|
100
|
+
ET
|
101
|
+
|
102
|
+
262.7717 367.3701 194.4567 22.6772 re
|
103
|
+
S
|
104
|
+
|
105
|
+
BT
|
106
|
+
264.7717 383.9492 Td
|
107
|
+
/F1.0 6 Tf
|
108
|
+
[<4d554e4943cd50494f>] TJ
|
109
|
+
ET
|
110
|
+
|
111
|
+
457.2283 367.3701 21.5433 22.6772 re
|
112
|
+
S
|
113
|
+
|
114
|
+
BT
|
115
|
+
459.2283 383.9492 Td
|
116
|
+
/F1.0 6 Tf
|
117
|
+
[<5546>] TJ
|
118
|
+
ET
|
119
|
+
|
120
|
+
478.7717 367.3701 97.5118 22.6772 re
|
121
|
+
S
|
122
|
+
|
123
|
+
BT
|
124
|
+
480.7717 383.9492 Td
|
125
|
+
/F1.0 6 Tf
|
126
|
+
[<494e53435249c7c2> 55 <4f20455354> 93 <414455> 40 <414c>] TJ
|
127
|
+
ET
|
128
|
+
|
129
|
+
Q
|
130
|
+
|
131
|
+
endstream
|
132
|
+
endobj
|
133
|
+
5 0 obj
|
134
|
+
<< /Type /Page
|
135
|
+
/Parent 3 0 R
|
136
|
+
/MediaBox [0 0 595.28 841.89]
|
137
|
+
/Contents 4 0 R
|
138
|
+
/Resources << /ProcSet [/PDF /Text /ImageB /ImageC /ImageI]
|
139
|
+
/Font << /F2.0 6 0 R
|
140
|
+
/F1.0 7 0 R
|
141
|
+
>>
|
142
|
+
>>
|
143
|
+
>>
|
144
|
+
endobj
|
145
|
+
6 0 obj
|
146
|
+
<< /Type /Font
|
147
|
+
/Subtype /Type1
|
148
|
+
/BaseFont /Times-Bold
|
149
|
+
/Encoding /WinAnsiEncoding
|
150
|
+
>>
|
151
|
+
endobj
|
152
|
+
7 0 obj
|
153
|
+
<< /Type /Font
|
154
|
+
/Subtype /Type1
|
155
|
+
/BaseFont /Times-Roman
|
156
|
+
/Encoding /WinAnsiEncoding
|
157
|
+
>>
|
158
|
+
endobj
|
159
|
+
xref
|
160
|
+
0 8
|
161
|
+
0000000000 65535 f
|
162
|
+
0000000015 00000 n
|
163
|
+
0000000109 00000 n
|
164
|
+
0000000158 00000 n
|
165
|
+
0000000215 00000 n
|
166
|
+
0000001602 00000 n
|
167
|
+
0000001794 00000 n
|
168
|
+
0000001892 00000 n
|
169
|
+
trailer
|
170
|
+
<< /Size 8
|
171
|
+
/Root 2 0 R
|
172
|
+
/Info 1 0 R
|
173
|
+
>>
|
174
|
+
startxref
|
175
|
+
1991
|
176
|
+
%%EOF
|
@@ -0,0 +1,176 @@
|
|
1
|
+
%PDF-1.3
|
2
|
+
%����
|
3
|
+
1 0 obj
|
4
|
+
<< /Creator <feff0050007200610077006e>
|
5
|
+
/Producer <feff0050007200610077006e>
|
6
|
+
>>
|
7
|
+
endobj
|
8
|
+
2 0 obj
|
9
|
+
<< /Type /Catalog
|
10
|
+
/Pages 3 0 R
|
11
|
+
>>
|
12
|
+
endobj
|
13
|
+
3 0 obj
|
14
|
+
<< /Type /Pages
|
15
|
+
/Count 1
|
16
|
+
/Kids [5 0 R]
|
17
|
+
>>
|
18
|
+
endobj
|
19
|
+
4 0 obj
|
20
|
+
<< /Length 1337
|
21
|
+
>>
|
22
|
+
stream
|
23
|
+
q
|
24
|
+
0.3 w
|
25
|
+
|
26
|
+
BT
|
27
|
+
21.2598 415.1659 Td
|
28
|
+
/F2.0 8 Tf
|
29
|
+
[<5452414e53504f52> 40 <54> 90 <41444f52202f2056> 45 <4f4c554d4553205452414e53504f52> 40 <54> 90 <41444f53>] TJ
|
30
|
+
ET
|
31
|
+
|
32
|
+
21.2598 390.0472 241.5118 22.6772 re
|
33
|
+
S
|
34
|
+
|
35
|
+
BT
|
36
|
+
23.2598 406.6264 Td
|
37
|
+
/F1.0 6 Tf
|
38
|
+
[<52415ac3> 55 <4f20534f4349414c>] TJ
|
39
|
+
ET
|
40
|
+
|
41
|
+
262.7717 390.0472 79.0866 22.6772 re
|
42
|
+
S
|
43
|
+
|
44
|
+
BT
|
45
|
+
264.7717 406.6264 Td
|
46
|
+
/F1.0 6 Tf
|
47
|
+
[<465245544520504f5220434f4e54> 93 <41>] TJ
|
48
|
+
ET
|
49
|
+
|
50
|
+
|
51
|
+
BT
|
52
|
+
264.7717 392.8944 Td
|
53
|
+
/F1.0 10 Tf
|
54
|
+
[<342d50726f702f44657374>] TJ
|
55
|
+
ET
|
56
|
+
|
57
|
+
341.8583 390.0472 50.4567 22.6772 re
|
58
|
+
S
|
59
|
+
|
60
|
+
BT
|
61
|
+
343.8583 406.6264 Td
|
62
|
+
/F1.0 6 Tf
|
63
|
+
[<434f4449474f20414e5454>] TJ
|
64
|
+
ET
|
65
|
+
|
66
|
+
392.315 390.0472 64.9134 22.6772 re
|
67
|
+
S
|
68
|
+
|
69
|
+
BT
|
70
|
+
394.315 406.6264 Td
|
71
|
+
/F1.0 6 Tf
|
72
|
+
[<504c41> 40 <434120444f205645cd43554c4f>] TJ
|
73
|
+
ET
|
74
|
+
|
75
|
+
457.2283 390.0472 21.5433 22.6772 re
|
76
|
+
S
|
77
|
+
|
78
|
+
BT
|
79
|
+
459.2283 406.6264 Td
|
80
|
+
/F1.0 6 Tf
|
81
|
+
[<5546>] TJ
|
82
|
+
ET
|
83
|
+
|
84
|
+
478.7717 390.0472 97.5118 22.6772 re
|
85
|
+
S
|
86
|
+
|
87
|
+
BT
|
88
|
+
480.7717 406.6264 Td
|
89
|
+
/F1.0 6 Tf
|
90
|
+
[<434e504a2f435046>] TJ
|
91
|
+
ET
|
92
|
+
|
93
|
+
21.2598 367.3701 241.5118 22.6772 re
|
94
|
+
S
|
95
|
+
|
96
|
+
BT
|
97
|
+
23.2598 383.9492 Td
|
98
|
+
/F1.0 6 Tf
|
99
|
+
[<454e44455245c74f>] TJ
|
100
|
+
ET
|
101
|
+
|
102
|
+
262.7717 367.3701 194.4567 22.6772 re
|
103
|
+
S
|
104
|
+
|
105
|
+
BT
|
106
|
+
264.7717 383.9492 Td
|
107
|
+
/F1.0 6 Tf
|
108
|
+
[<4d554e4943cd50494f>] TJ
|
109
|
+
ET
|
110
|
+
|
111
|
+
457.2283 367.3701 21.5433 22.6772 re
|
112
|
+
S
|
113
|
+
|
114
|
+
BT
|
115
|
+
459.2283 383.9492 Td
|
116
|
+
/F1.0 6 Tf
|
117
|
+
[<5546>] TJ
|
118
|
+
ET
|
119
|
+
|
120
|
+
478.7717 367.3701 97.5118 22.6772 re
|
121
|
+
S
|
122
|
+
|
123
|
+
BT
|
124
|
+
480.7717 383.9492 Td
|
125
|
+
/F1.0 6 Tf
|
126
|
+
[<494e53435249c7c2> 55 <4f20455354> 93 <414455> 40 <414c>] TJ
|
127
|
+
ET
|
128
|
+
|
129
|
+
Q
|
130
|
+
|
131
|
+
endstream
|
132
|
+
endobj
|
133
|
+
5 0 obj
|
134
|
+
<< /Type /Page
|
135
|
+
/Parent 3 0 R
|
136
|
+
/MediaBox [0 0 595.28 841.89]
|
137
|
+
/Contents 4 0 R
|
138
|
+
/Resources << /ProcSet [/PDF /Text /ImageB /ImageC /ImageI]
|
139
|
+
/Font << /F2.0 6 0 R
|
140
|
+
/F1.0 7 0 R
|
141
|
+
>>
|
142
|
+
>>
|
143
|
+
>>
|
144
|
+
endobj
|
145
|
+
6 0 obj
|
146
|
+
<< /Type /Font
|
147
|
+
/Subtype /Type1
|
148
|
+
/BaseFont /Times-Bold
|
149
|
+
/Encoding /WinAnsiEncoding
|
150
|
+
>>
|
151
|
+
endobj
|
152
|
+
7 0 obj
|
153
|
+
<< /Type /Font
|
154
|
+
/Subtype /Type1
|
155
|
+
/BaseFont /Times-Roman
|
156
|
+
/Encoding /WinAnsiEncoding
|
157
|
+
>>
|
158
|
+
endobj
|
159
|
+
xref
|
160
|
+
0 8
|
161
|
+
0000000000 65535 f
|
162
|
+
0000000015 00000 n
|
163
|
+
0000000109 00000 n
|
164
|
+
0000000158 00000 n
|
165
|
+
0000000215 00000 n
|
166
|
+
0000001604 00000 n
|
167
|
+
0000001796 00000 n
|
168
|
+
0000001894 00000 n
|
169
|
+
trailer
|
170
|
+
<< /Size 8
|
171
|
+
/Root 2 0 R
|
172
|
+
/Info 1 0 R
|
173
|
+
>>
|
174
|
+
startxref
|
175
|
+
1993
|
176
|
+
%%EOF
|
@@ -114,6 +114,50 @@ describe BrDanfe::DanfeLib::Transp do
|
|
114
114
|
end
|
115
115
|
end
|
116
116
|
|
117
|
+
context "when modFrete is 3" do
|
118
|
+
let(:xml_as_string) do
|
119
|
+
<<-eos
|
120
|
+
<NFe xmlns="http://www.portalfiscal.inf.br/nfe">
|
121
|
+
<infNFe Id="NFe25111012345678901234550020000134151000134151" versao="2.00">
|
122
|
+
<transp>
|
123
|
+
<modFrete>3</modFrete>
|
124
|
+
</transp>
|
125
|
+
</infNFe>
|
126
|
+
</NFe>
|
127
|
+
eos
|
128
|
+
end
|
129
|
+
|
130
|
+
it "renders '3-Prop/Rem' to the pdf" do
|
131
|
+
expect(File.exist?(output_pdf)).to be_falsey
|
132
|
+
|
133
|
+
pdf.render_file output_pdf
|
134
|
+
|
135
|
+
expect("#{base_dir}transp#render-modfrete_3.pdf").to have_same_content_of file: output_pdf
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
context "when modFrete is 4" do
|
140
|
+
let(:xml_as_string) do
|
141
|
+
<<-eos
|
142
|
+
<NFe xmlns="http://www.portalfiscal.inf.br/nfe">
|
143
|
+
<infNFe Id="NFe25111012345678901234550020000134151000134151" versao="2.00">
|
144
|
+
<transp>
|
145
|
+
<modFrete>4</modFrete>
|
146
|
+
</transp>
|
147
|
+
</infNFe>
|
148
|
+
</NFe>
|
149
|
+
eos
|
150
|
+
end
|
151
|
+
|
152
|
+
it "renders '4-Prop/Dest' to the pdf" do
|
153
|
+
expect(File.exist?(output_pdf)).to be_falsey
|
154
|
+
|
155
|
+
pdf.render_file output_pdf
|
156
|
+
|
157
|
+
expect("#{base_dir}transp#render-modfrete_4.pdf").to have_same_content_of file: output_pdf
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
117
161
|
context "when modFrete is 9" do
|
118
162
|
let(:xml_as_string) do
|
119
163
|
<<-eos
|
@@ -4,7 +4,7 @@ require "spec_helper"
|
|
4
4
|
|
5
5
|
describe BrDanfe::DanfeLib::Xprod do
|
6
6
|
describe "#render" do
|
7
|
-
context "when
|
7
|
+
context "when has FCI" do
|
8
8
|
let(:xml_fci) do
|
9
9
|
xml = <<-eos
|
10
10
|
<det nItem="1">
|
@@ -23,14 +23,101 @@ describe BrDanfe::DanfeLib::Xprod do
|
|
23
23
|
it "returns product + FCI" do
|
24
24
|
expected = "MONITOR DE ARCO ELETRICO"
|
25
25
|
expected += "\n"
|
26
|
-
expected +="FCI: 12232531-74B2-4FDD-87A6-CF0AD3E55386"
|
26
|
+
expected += "FCI: 12232531-74B2-4FDD-87A6-CF0AD3E55386"
|
27
27
|
expect(subject.render).to eq expected
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
|
-
context "when
|
32
|
-
|
33
|
-
|
31
|
+
context "when has ST" do
|
32
|
+
context "when is Retido" do
|
33
|
+
let(:vBCSTRet) { 0.00 }
|
34
|
+
let(:pST) { 0.00 }
|
35
|
+
let(:vICMSSTRet) { 0.00 }
|
36
|
+
let(:xml) do
|
37
|
+
xml = <<-eos
|
38
|
+
<det nItem="1">
|
39
|
+
<prod>
|
40
|
+
<xProd>MONITOR DE ARCO ELETRICO</xProd>
|
41
|
+
</prod>
|
42
|
+
<imposto>
|
43
|
+
<ICMS>
|
44
|
+
<ICMSST>
|
45
|
+
<orig>0</orig>
|
46
|
+
<CST>60</CST>
|
47
|
+
<pST>#{pST}</pST>
|
48
|
+
<vBCSTRet>#{vBCSTRet}</vBCSTRet>
|
49
|
+
<vICMSSTRet>#{vICMSSTRet}</vICMSSTRet>
|
50
|
+
<vBCSTDest>0.00</vBCSTDest>
|
51
|
+
<vICMSSTDest>0.00</vICMSSTDest>
|
52
|
+
</ICMSST>
|
53
|
+
</ICMS>
|
54
|
+
<PIS>
|
55
|
+
<PISNT>
|
56
|
+
<CST>04</CST>
|
57
|
+
</PISNT>
|
58
|
+
</PIS>
|
59
|
+
<COFINS>
|
60
|
+
<COFINSNT>
|
61
|
+
<CST>04</CST>
|
62
|
+
</COFINSNT>
|
63
|
+
</COFINS>
|
64
|
+
</imposto>
|
65
|
+
</det>
|
66
|
+
eos
|
67
|
+
|
68
|
+
Nokogiri::XML(xml)
|
69
|
+
end
|
70
|
+
|
71
|
+
subject { BrDanfe::DanfeLib::Xprod.new(xml) }
|
72
|
+
|
73
|
+
context "when has vBCSTRet" do
|
74
|
+
let(:vBCSTRet) { 50.00 }
|
75
|
+
|
76
|
+
it "returns product + ST Retido" do
|
77
|
+
expected = "MONITOR DE ARCO ELETRICO"
|
78
|
+
expected += "\n"
|
79
|
+
expected += "ST Retido: Base: 50,00 * Alíq: 0,00% * Vlr: 0,00"
|
80
|
+
|
81
|
+
expect(subject.render).to eq expected
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
context "when has vICMSSTRet" do
|
86
|
+
let(:vICMSSTRet) { 50.00 }
|
87
|
+
|
88
|
+
it "returns product + ST Retido" do
|
89
|
+
expected = "MONITOR DE ARCO ELETRICO"
|
90
|
+
expected += "\n"
|
91
|
+
expected += "ST Retido: Base: 0,00 * Alíq: 0,00% * Vlr: 50,00"
|
92
|
+
|
93
|
+
expect(subject.render).to eq expected
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
context "when has pST" do
|
98
|
+
let(:pST) { 50.00 }
|
99
|
+
|
100
|
+
it "returns product + ST Retido" do
|
101
|
+
expected = "MONITOR DE ARCO ELETRICO"
|
102
|
+
expected += "\n"
|
103
|
+
expected += "ST Retido: Base: 0,00 * Alíq: 50,00% * Vlr: 0,00"
|
104
|
+
|
105
|
+
expect(subject.render).to eq expected
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
context "when doesn't have any fields" do
|
110
|
+
it "returns product" do
|
111
|
+
expected = "MONITOR DE ARCO ELETRICO"
|
112
|
+
|
113
|
+
expect(subject.render).to eq expected
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
context "when isn't Retido" do
|
119
|
+
let(:xml_st) do
|
120
|
+
xml = <<-eos
|
34
121
|
<det nItem="1">
|
35
122
|
<prod>
|
36
123
|
<xProd>MONITOR DE ARCO ELETRICO</xProd>
|
@@ -47,23 +134,24 @@ describe BrDanfe::DanfeLib::Xprod do
|
|
47
134
|
</ICMS>
|
48
135
|
</imposto>
|
49
136
|
</det>
|
50
|
-
|
137
|
+
eos
|
51
138
|
|
52
|
-
|
53
|
-
|
139
|
+
Nokogiri::XML(xml)
|
140
|
+
end
|
54
141
|
|
55
|
-
|
142
|
+
subject { BrDanfe::DanfeLib::Xprod.new(xml_st) }
|
56
143
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
144
|
+
it "returns product + ST" do
|
145
|
+
expected = "MONITOR DE ARCO ELETRICO"
|
146
|
+
expected += "\n"
|
147
|
+
expected += "ST: MVA: 56,00% * Alíq: 17,00% * BC: 479,82 * Vlr: 29,28"
|
61
148
|
|
62
|
-
|
149
|
+
expect(subject.render).to eq expected
|
150
|
+
end
|
63
151
|
end
|
64
152
|
end
|
65
153
|
|
66
|
-
context "when
|
154
|
+
context "when has infAdProd" do
|
67
155
|
let(:xml_infAdProd) do
|
68
156
|
xml = <<-eos
|
69
157
|
<det nItem="1">
|
@@ -88,7 +176,7 @@ describe BrDanfe::DanfeLib::Xprod do
|
|
88
176
|
end
|
89
177
|
end
|
90
178
|
|
91
|
-
context "when
|
179
|
+
context "when has FCP on ICMS00 tag" do
|
92
180
|
let(:xml_fcp) do
|
93
181
|
xml = <<-eos
|
94
182
|
<det nItem="1">
|
@@ -121,7 +209,7 @@ describe BrDanfe::DanfeLib::Xprod do
|
|
121
209
|
end
|
122
210
|
end
|
123
211
|
|
124
|
-
context "when
|
212
|
+
context "when has FCI + ST + infAdProd + FCP" do
|
125
213
|
let(:xml_IFC_ST_infAdProd) do
|
126
214
|
xml = <<-eos
|
127
215
|
<det nItem="1">
|
@@ -158,7 +246,7 @@ describe BrDanfe::DanfeLib::Xprod do
|
|
158
246
|
expected += "\n"
|
159
247
|
expected += "Informações adicionais do produto"
|
160
248
|
expected += "\n"
|
161
|
-
expected +="FCI: 12232531-74B2-4FDD-87A6-CF0AD3E55386"
|
249
|
+
expected += "FCI: 12232531-74B2-4FDD-87A6-CF0AD3E55386"
|
162
250
|
expected += "\n"
|
163
251
|
expected += "ST: MVA: 56,00% * Alíq: 17,00% * BC: 479,82 * Vlr: 29,28"
|
164
252
|
expected += "\n"
|
@@ -202,7 +290,7 @@ describe BrDanfe::DanfeLib::Xprod do
|
|
202
290
|
end
|
203
291
|
end
|
204
292
|
|
205
|
-
context "when
|
293
|
+
context "when has FCP ST" do
|
206
294
|
let(:xml_fcp) do
|
207
295
|
xml = <<-eos
|
208
296
|
<det nItem="1">
|
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.
|
4
|
+
version: 0.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ASSEINFO
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-07-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: barby
|
@@ -291,6 +291,8 @@ files:
|
|
291
291
|
- spec/fixtures/nfe/lib/transp#render-modfrete_0.pdf
|
292
292
|
- spec/fixtures/nfe/lib/transp#render-modfrete_1.pdf
|
293
293
|
- spec/fixtures/nfe/lib/transp#render-modfrete_2.pdf
|
294
|
+
- spec/fixtures/nfe/lib/transp#render-modfrete_3.pdf
|
295
|
+
- spec/fixtures/nfe/lib/transp#render-modfrete_4.pdf
|
294
296
|
- spec/fixtures/nfe/lib/transp#render-modfrete_9.pdf
|
295
297
|
- spec/fixtures/nfe/lib/transp#render.pdf
|
296
298
|
- spec/fixtures/nfe/lib/vol#render-blank-boxes.pdf
|
@@ -368,7 +370,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
368
370
|
version: '0'
|
369
371
|
requirements: []
|
370
372
|
rubyforge_project:
|
371
|
-
rubygems_version: 2.
|
373
|
+
rubygems_version: 2.6.14.1
|
372
374
|
signing_key:
|
373
375
|
specification_version: 4
|
374
376
|
summary: DANFE pdf generator for Brazilian invoices.
|