|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace NFePHP\EFD\Elements\ICMSIPI; |
|
4
|
|
|
|
|
5
|
|
|
use NFePHP\EFD\Common\Element; |
|
6
|
|
|
use NFePHP\EFD\Common\ElementInterface; |
|
7
|
|
|
use \stdClass; |
|
8
|
|
|
|
|
9
|
|
|
class Z1500 extends Element implements ElementInterface |
|
10
|
|
|
{ |
|
11
|
|
|
const REG = '1500'; |
|
12
|
|
|
const LEVEL = 2; |
|
13
|
|
|
const PARENT = '1001'; |
|
14
|
|
|
|
|
15
|
|
|
protected $parameters = [ |
|
16
|
|
|
'IND_OPER' => [ |
|
17
|
|
|
'type' => 'string', |
|
18
|
|
|
'regex' => '^.{1}$', |
|
19
|
|
|
'required' => true, |
|
20
|
|
|
'info' => 'Indicador do tipo de operação: ' |
|
21
|
|
|
.'1- Saída', |
|
22
|
|
|
'format' => '' |
|
23
|
|
|
], |
|
24
|
|
|
'IND_EMIT' => [ |
|
25
|
|
|
'type' => 'string', |
|
26
|
|
|
'regex' => '^.{1}$', |
|
27
|
|
|
'required' => true, |
|
28
|
|
|
'info' => 'Indicador do emitente do documento fiscal: ' |
|
29
|
|
|
.'0- Emissão própria;', |
|
30
|
|
|
'format' => '' |
|
31
|
|
|
], |
|
32
|
|
|
'COD_PART' => [ |
|
33
|
|
|
'type' => 'string', |
|
34
|
|
|
'regex' => '^.{1,60}$', |
|
35
|
|
|
'required' => true, |
|
36
|
|
|
'info' => 'Código do participante (campo 02 do Registro 0150): - do adquirente, no caso das saídas.', |
|
37
|
|
|
'format' => '' |
|
38
|
|
|
], |
|
39
|
|
|
'COD_MOD' => [ |
|
40
|
|
|
'type' => 'string', |
|
41
|
|
|
'regex' => '^.{2}$', |
|
42
|
|
|
'required' => true, |
|
43
|
|
|
'info' => 'Código do modelo do documento fiscal, conforme a Tabela 4.1.1', |
|
44
|
|
|
'format' => '' |
|
45
|
|
|
], |
|
46
|
|
|
'COD_SIT' => [ |
|
47
|
|
|
'type' => 'string', |
|
48
|
|
|
'regex' => '^0[0|1|6|7|8]$', |
|
49
|
|
|
'required' => true, |
|
50
|
|
|
'info' => 'Código da situação do documento fiscal, conforme a Tabela 4.1.2', |
|
51
|
|
|
'format' => '' |
|
52
|
|
|
], |
|
53
|
|
|
'SER' => [ |
|
54
|
|
|
'type' => 'string', |
|
55
|
|
|
'regex' => '^.{1,4}$', |
|
56
|
|
|
'required' => false, |
|
57
|
|
|
'info' => 'Série do documento fiscal', |
|
58
|
|
|
'format' => '' |
|
59
|
|
|
], |
|
60
|
|
|
'SUB' => [ |
|
61
|
|
|
'type' => 'integer', |
|
62
|
|
|
'regex' => '^\d{1,3}$', |
|
63
|
|
|
'required' => false, |
|
64
|
|
|
'info' => 'Subsérie do documento fiscal', |
|
65
|
|
|
'format' => '' |
|
66
|
|
|
], |
|
67
|
|
|
'COD_CONS' => [ |
|
68
|
|
|
'type' => 'string', |
|
69
|
|
|
'regex' => '^0[1|2|3|4|5|6|7|8]$', |
|
70
|
|
|
'required' => true, |
|
71
|
|
|
'info' => 'Código de classe de consumo de energia elétrica: ' |
|
72
|
|
|
.'01 - Comercial ' |
|
73
|
|
|
.'02 - Consumo Próprio ' |
|
74
|
|
|
.'03 - Iluminação Pública ' |
|
75
|
|
|
.'04 - Industrial ' |
|
76
|
|
|
.'05 - Poder Público ' |
|
77
|
|
|
.'06 - Residencial ' |
|
78
|
|
|
.'07 - Rural ' |
|
79
|
|
|
.'08 -Serviço Público', |
|
80
|
|
|
'format' => '' |
|
81
|
|
|
], |
|
82
|
|
|
'NUM_DOC' => [ |
|
83
|
|
|
'type' => 'integer', |
|
84
|
|
|
'regex' => '^\d{1,9}$', |
|
85
|
|
|
'required' => true, |
|
86
|
|
|
'info' => 'Número do documento fiscal', |
|
87
|
|
|
'format' => '' |
|
88
|
|
|
], |
|
89
|
|
|
'DT_DOC' => [ |
|
90
|
|
|
'type' => 'integer', |
|
91
|
|
|
'regex' => '^(0[1-9]|[1-2][0-9]|31(?!(?:0[2469]|11))|30(?!02))(0[1-9]|1[0-2])([12]\d{3})$', |
|
92
|
|
|
'required' => true, |
|
93
|
|
|
'info' => 'Data da emissão do documento fiscal', |
|
94
|
|
|
'format' => '' |
|
95
|
|
|
], |
|
96
|
|
|
'DT_E_S' => [ |
|
97
|
|
|
'type' => 'integer', |
|
98
|
|
|
'regex' => '^(0[1-9]|[1-2][0-9]|31(?!(?:0[2469]|11))|30(?!02))(0[1-9]|1[0-2])([12]\d{3})$', |
|
99
|
|
|
'required' => true, |
|
100
|
|
|
'info' => 'Data da entrada ou da saída', |
|
101
|
|
|
'format' => '' |
|
102
|
|
|
], |
|
103
|
|
|
'VL_DOC' => [ |
|
104
|
|
|
'type' => 'numeric', |
|
105
|
|
|
'regex' => '^\d+(\.\d*)?|\.\d+$', |
|
106
|
|
|
'required' => true, |
|
107
|
|
|
'info' => 'Valor total do documento fiscal', |
|
108
|
|
|
'format' => '15v2' |
|
109
|
|
|
], |
|
110
|
|
|
'VL_DESC' => [ |
|
111
|
|
|
'type' => 'numeric', |
|
112
|
|
|
'regex' => '^\d+(\.\d*)?|\.\d+$', |
|
113
|
|
|
'required' => false, |
|
114
|
|
|
'info' => 'Valor total do desconto', |
|
115
|
|
|
'format' => '15v2' |
|
116
|
|
|
], |
|
117
|
|
|
'VL_FORN' => [ |
|
118
|
|
|
'type' => 'numeric', |
|
119
|
|
|
'regex' => '^\d+(\.\d*)?|\.\d+$', |
|
120
|
|
|
'required' => true, |
|
121
|
|
|
'info' => 'Valor total fornecido/consumido', |
|
122
|
|
|
'format' => '15v2' |
|
123
|
|
|
], |
|
124
|
|
|
'VL_SERV_NT' => [ |
|
125
|
|
|
'type' => 'numeric', |
|
126
|
|
|
'regex' => '^\d+(\.\d*)?|\.\d+$', |
|
127
|
|
|
'required' => false, |
|
128
|
|
|
'info' => 'Valor total dos serviços não-tributados pelo ICMS', |
|
129
|
|
|
'format' => '15v2' |
|
130
|
|
|
], |
|
131
|
|
|
'VL_TERC' => [ |
|
132
|
|
|
'type' => 'numeric', |
|
133
|
|
|
'regex' => '^\d+(\.\d*)?|\.\d+$', |
|
134
|
|
|
'required' => false, |
|
135
|
|
|
'info' => 'Valor total cobrado em nome de terceiros', |
|
136
|
|
|
'format' => '15v2' |
|
137
|
|
|
], |
|
138
|
|
|
'VL_DA' => [ |
|
139
|
|
|
'type' => 'numeric', |
|
140
|
|
|
'regex' => '^\d+(\.\d*)?|\.\d+$', |
|
141
|
|
|
'required' => false, |
|
142
|
|
|
'info' => 'Valor total de despesas acessórias indicadas no documento fiscal', |
|
143
|
|
|
'format' => '15v2' |
|
144
|
|
|
], |
|
145
|
|
|
'VL_BC_ICMS' => [ |
|
146
|
|
|
'type' => 'numeric', |
|
147
|
|
|
'regex' => '^\d+(\.\d*)?|\.\d+$', |
|
148
|
|
|
'required' => false, |
|
149
|
|
|
'info' => 'Valor acumulado da base de cálculo do ICMS', |
|
150
|
|
|
'format' => '15v2' |
|
151
|
|
|
], |
|
152
|
|
|
'VL_ICMS' => [ |
|
153
|
|
|
'type' => 'numeric', |
|
154
|
|
|
'regex' => '^\d+(\.\d*)?|\.\d+$', |
|
155
|
|
|
'required' => false, |
|
156
|
|
|
'info' => 'Valor acumulado do ICMS', |
|
157
|
|
|
'format' => '15v2' |
|
158
|
|
|
], |
|
159
|
|
|
'VL_BC_ICMS_ST' => [ |
|
160
|
|
|
'type' => 'numeric', |
|
161
|
|
|
'regex' => '^\d+(\.\d*)?|\.\d+$', |
|
162
|
|
|
'required' => false, |
|
163
|
|
|
'info' => 'Valor acumulado da base de cálculo do ICMS substituição tributária', |
|
164
|
|
|
'format' => '15v2' |
|
165
|
|
|
], |
|
166
|
|
|
'VL_ICMS_ST' => [ |
|
167
|
|
|
'type' => 'numeric', |
|
168
|
|
|
'regex' => '^\d+(\.\d*)?|\.\d+$', |
|
169
|
|
|
'required' => false, |
|
170
|
|
|
'info' => 'Valor acumulado do ICMS retido por substituição tributária', |
|
171
|
|
|
'format' => '15v2' |
|
172
|
|
|
], |
|
173
|
|
|
'COD_INF' => [ |
|
174
|
|
|
'type' => 'string', |
|
175
|
|
|
'regex' => '^.{1,6}$', |
|
176
|
|
|
'required' => false, |
|
177
|
|
|
'info' => 'Código da informação complementar do documento fiscal (campo 02 do Registro 0450)', |
|
178
|
|
|
'format' => '' |
|
179
|
|
|
], |
|
180
|
|
|
'VL_PIS' => [ |
|
181
|
|
|
'type' => 'numeric', |
|
182
|
|
|
'regex' => '^\d+(\.\d*)?|\.\d+$', |
|
183
|
|
|
'required' => false, |
|
184
|
|
|
'info' => 'Valor do PIS', |
|
185
|
|
|
'format' => '15v2' |
|
186
|
|
|
], |
|
187
|
|
|
'VL_COFINS' => [ |
|
188
|
|
|
'type' => 'numeric', |
|
189
|
|
|
'regex' => '^\d+(\.\d*)?|\.\d+$', |
|
190
|
|
|
'required' => false, |
|
191
|
|
|
'info' => 'Valor da COFINS', |
|
192
|
|
|
'format' => '15v2' |
|
193
|
|
|
], |
|
194
|
|
|
'TP_LIGACAO' => [ |
|
195
|
|
|
'type' => 'integer', |
|
196
|
|
|
'regex' => '^[1|2|3]$', |
|
197
|
|
|
'required' => false, |
|
198
|
|
|
'info' => 'Código de tipo de Ligação ' |
|
199
|
|
|
.'1 - Monofásico ' |
|
200
|
|
|
.'2 - Bifásico ' |
|
201
|
|
|
.'3 - Trifásico', |
|
202
|
|
|
'format' => '' |
|
203
|
|
|
], |
|
204
|
|
|
'COD_GRUPO_TENSAO' => [ |
|
205
|
|
|
'type' => 'string', |
|
206
|
|
|
'regex' => '^0[1-9]|1[0-4]$', |
|
207
|
|
|
'required' => false, |
|
208
|
|
|
'info' => 'Código de grupo de tensão: ' |
|
209
|
|
|
.'01 - A1 - Alta Tensão (230kV ou mais) ' |
|
210
|
|
|
.'02 - A2 - Alta Tensão (88 a 138kV) ' |
|
211
|
|
|
.'03 - A3 - Alta Tensão (69kV) ' |
|
212
|
|
|
.'04 - A3a - Alta Tensão (30kV a 44kV) ' |
|
213
|
|
|
.'05 - A4 - Alta Tensão (2,3kV a 25kV) ' |
|
214
|
|
|
.'06 - AS - Alta Tensão Subterrâneo 06 ' |
|
215
|
|
|
.'07 - B1 - Residencial 07 ' |
|
216
|
|
|
.'08 - B1 - Residencial Baixa Renda 08 ' |
|
217
|
|
|
.'09 - B2 - Rural 09 ' |
|
218
|
|
|
.'10 - B2 - Cooperativa de Eletrificação Rural ' |
|
219
|
|
|
.'11 - B2 - Serviço Público de Irrigação ' |
|
220
|
|
|
.'12 - B3 - Demais Classes ' |
|
221
|
|
|
.'13 - B4a - Iluminação Pública - rede de distribuição ' |
|
222
|
|
|
.'14 - B4b - Iluminação Pública - bulbo de lâmpada', |
|
223
|
|
|
'format' => '' |
|
224
|
|
|
] |
|
225
|
|
|
]; |
|
226
|
|
|
|
|
227
|
|
|
/** |
|
228
|
|
|
* Constructor |
|
229
|
|
|
* @param \stdClass $std |
|
230
|
|
|
*/ |
|
231
|
|
|
public function __construct(\stdClass $std) |
|
232
|
|
|
{ |
|
233
|
|
|
parent::__construct(self::REG); |
|
234
|
|
|
$this->std = $this->standarize($std); |
|
235
|
|
|
$this->postValidation(); |
|
236
|
|
|
} |
|
237
|
|
|
|
|
238
|
|
|
public function postValidation() |
|
239
|
|
|
{ |
|
240
|
|
|
/* |
|
241
|
|
|
* Campo 10 (NUM_DOC) Validação: o valor informado no campo deve ser maior que “0” (zero). |
|
242
|
|
|
*/ |
|
243
|
|
|
if ($this->std->num_doc <= 0) { |
|
244
|
|
|
throw new \InvalidArgumentException("[" . self::REG . "] O valor informado no campo " |
|
245
|
|
|
."NUM_DOC deve ser maior que “0” (zero)."); |
|
246
|
|
|
} |
|
247
|
|
|
|
|
248
|
|
|
/* |
|
249
|
|
|
* Campo 13 (VL_DOC) Validação: o valor informado no campo deve ser maior que “0” (zero). |
|
250
|
|
|
*/ |
|
251
|
|
|
if ($this->std->vl_doc <= 0) { |
|
252
|
|
|
throw new \InvalidArgumentException("[" . self::REG . "] O valor informado no campo " |
|
253
|
|
|
."VL_DOC deve ser maior que “0” (zero)."); |
|
254
|
|
|
} |
|
255
|
|
|
|
|
256
|
|
|
/* |
|
257
|
|
|
* Campo 15 (VL_FORN) Validação: o valor informado no campo deve ser maior que “0” (zero). |
|
258
|
|
|
*/ |
|
259
|
|
|
if ($this->std->vl_forn <= 0) { |
|
260
|
|
|
throw new \InvalidArgumentException("[" . self::REG . "] O valor informado no campo " |
|
261
|
|
|
."VL_FORN deve ser maior que “0” (zero)."); |
|
262
|
|
|
} |
|
263
|
|
|
} |
|
264
|
|
|
} |
|
265
|
|
|
|