|
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 C600 extends Element implements ElementInterface |
|
10
|
|
|
{ |
|
11
|
|
|
const REG = 'C600'; |
|
12
|
|
|
const LEVEL = 2; |
|
13
|
|
|
const PARENT = 'C001'; |
|
14
|
|
|
|
|
15
|
|
|
protected $parameters = [ |
|
16
|
|
|
'COD_MOD' => [ |
|
17
|
|
|
'type' => 'string', |
|
18
|
|
|
'regex' => '^(06|28|29)$', |
|
19
|
|
|
'required' => true, |
|
20
|
|
|
'info' => 'Código do modelo do documento fiscal', |
|
21
|
|
|
'format' => '' |
|
22
|
|
|
], |
|
23
|
|
|
'COD_MUN' => [ |
|
24
|
|
|
'type' => 'numeric', |
|
25
|
|
|
'regex' => '^(\d{7})$', |
|
26
|
|
|
'required' => true, |
|
27
|
|
|
'info' => 'Código do município dos pontos de consumo,', |
|
28
|
|
|
'format' => '' |
|
29
|
|
|
], |
|
30
|
|
|
'SER' => [ |
|
31
|
|
|
'type' => 'string', |
|
32
|
|
|
'regex' => '^.{0,4}$', |
|
33
|
|
|
'required' => false, |
|
34
|
|
|
'info' => 'Série do documento fiscal', |
|
35
|
|
|
'format' => '' |
|
36
|
|
|
], |
|
37
|
|
|
'SUB' => [ |
|
38
|
|
|
'type' => 'numeric', |
|
39
|
|
|
'regex' => '^(\d{0,3})$', |
|
40
|
|
|
'required' => false, |
|
41
|
|
|
'info' => 'Subsérie do documento fiscal', |
|
42
|
|
|
'format' => '' |
|
43
|
|
|
], |
|
44
|
|
|
'COD_CONS' => [ |
|
45
|
|
|
'type' => 'string', |
|
46
|
|
|
'regex' => '^.{2}$', |
|
47
|
|
|
'required' => true, |
|
48
|
|
|
'info' => 'Código de classe de consumo de energia elétrica ou gás', |
|
49
|
|
|
'format' => '' |
|
50
|
|
|
], |
|
51
|
|
|
'QTD_CONS' => [ |
|
52
|
|
|
'type' => 'numeric', |
|
53
|
|
|
'regex' => '^([0-9]+)$', |
|
54
|
|
|
'required' => true, |
|
55
|
|
|
'info' => 'Quantidade de documentos consolidados neste registro', |
|
56
|
|
|
'format' => '' |
|
57
|
|
|
], |
|
58
|
|
|
'QTD_CANC' => [ |
|
59
|
|
|
'type' => 'numeric', |
|
60
|
|
|
'regex' => '^([0-9]+)$', |
|
61
|
|
|
'required' => false, |
|
62
|
|
|
'info' => 'Quantidade de documentos cancelados', |
|
63
|
|
|
'format' => '' |
|
64
|
|
|
], |
|
65
|
|
|
'DT_DOC' => [ |
|
66
|
|
|
'type' => 'string', |
|
67
|
|
|
'regex' => '^(0[1-9]|[1-2][0-9]|31(?!(?:0[2469]|11))|30(?!02))(0[1-9]|1[0-2])([12]\d{3})$', |
|
68
|
|
|
'required' => true, |
|
69
|
|
|
'info' => 'Data dos documentos consolidados', |
|
70
|
|
|
'format' => '' |
|
71
|
|
|
], |
|
72
|
|
|
'VL_DOC' => [ |
|
73
|
|
|
'type' => 'numeric', |
|
74
|
|
|
'regex' => '^\d+(\.\d*)?|\.\d+$', |
|
75
|
|
|
'required' => true, |
|
76
|
|
|
'info' => 'Valor total dos documentos', |
|
77
|
|
|
'format' => '15v2' |
|
78
|
|
|
], |
|
79
|
|
|
'VL_DESC' => [ |
|
80
|
|
|
'type' => 'numeric', |
|
81
|
|
|
'regex' => '^\d+(\.\d*)?|\.\d+$', |
|
82
|
|
|
'required' => false, |
|
83
|
|
|
'info' => 'Valor acumulado dos descontos', |
|
84
|
|
|
'format' => '15v2' |
|
85
|
|
|
], |
|
86
|
|
|
'CONS' => [ |
|
87
|
|
|
'type' => 'numeric', |
|
88
|
|
|
'regex' => '^([0-9]+)$', |
|
89
|
|
|
'required' => false, |
|
90
|
|
|
'info' => 'Consumo total acumulado, em kWh (Código 06)', |
|
91
|
|
|
'format' => '' |
|
92
|
|
|
], |
|
93
|
|
|
'VL_FORN' => [ |
|
94
|
|
|
'type' => 'numeric', |
|
95
|
|
|
'regex' => '^\d+(\.\d*)?|\.\d+$', |
|
96
|
|
|
'required' => false, |
|
97
|
|
|
'info' => 'Valor acumulado do fornecimento', |
|
98
|
|
|
'format' => '15v2' |
|
99
|
|
|
], |
|
100
|
|
|
'VL_SERV_NT' => [ |
|
101
|
|
|
'type' => 'numeric', |
|
102
|
|
|
'regex' => '^\d+(\.\d*)?|\.\d+$', |
|
103
|
|
|
'required' => false, |
|
104
|
|
|
'info' => 'Valor acumulado dos serviços não-tributados pelo ICMS', |
|
105
|
|
|
'format' => '15v2' |
|
106
|
|
|
], |
|
107
|
|
|
'VL_TERC' => [ |
|
108
|
|
|
'type' => 'numeric', |
|
109
|
|
|
'regex' => '^\d+(\.\d*)?|\.\d+$', |
|
110
|
|
|
'required' => false, |
|
111
|
|
|
'info' => 'Valores cobrados em nome de terceiros', |
|
112
|
|
|
'format' => '15v2' |
|
113
|
|
|
], |
|
114
|
|
|
'VL_DA' => [ |
|
115
|
|
|
'type' => 'numeric', |
|
116
|
|
|
'regex' => '^\d+(\.\d*)?|\.\d+$', |
|
117
|
|
|
'required' => false, |
|
118
|
|
|
'info' => 'Valor acumulado das despesas acessórias', |
|
119
|
|
|
'format' => '15v2' |
|
120
|
|
|
], |
|
121
|
|
|
'VL_BC_ICMS' => [ |
|
122
|
|
|
'type' => 'numeric', |
|
123
|
|
|
'regex' => '^\d+(\.\d*)?|\.\d+$', |
|
124
|
|
|
'required' => false, |
|
125
|
|
|
'info' => 'Valor acumulado da base de cálculo do ICMS', |
|
126
|
|
|
'format' => '15v2' |
|
127
|
|
|
], |
|
128
|
|
|
'VL_ICMS' => [ |
|
129
|
|
|
'type' => 'numeric', |
|
130
|
|
|
'regex' => '^\d+(\.\d*)?|\.\d+$', |
|
131
|
|
|
'required' => false, |
|
132
|
|
|
'info' => 'Valor acumulado do ICMS', |
|
133
|
|
|
'format' => '15v2' |
|
134
|
|
|
], |
|
135
|
|
|
'VL_BC_ICMS_ST' => [ |
|
136
|
|
|
'type' => 'numeric', |
|
137
|
|
|
'regex' => '^\d+(\.\d*)?|\.\d+$', |
|
138
|
|
|
'required' => false, |
|
139
|
|
|
'info' => 'Valor acumulado da base de cálculo do ICMS substituição tributária', |
|
140
|
|
|
'format' => '15v2' |
|
141
|
|
|
], |
|
142
|
|
|
'VL_ICMS_ST' => [ |
|
143
|
|
|
'type' => 'numeric', |
|
144
|
|
|
'regex' => '^\d+(\.\d*)?|\.\d+$', |
|
145
|
|
|
'required' => false, |
|
146
|
|
|
'info' => 'Valor acumulado do ICMS retido por substituição tributária', |
|
147
|
|
|
'format' => '15v2' |
|
148
|
|
|
], |
|
149
|
|
|
'VL_PIS' => [ |
|
150
|
|
|
'type' => 'numeric', |
|
151
|
|
|
'regex' => '^\d+(\.\d*)?|\.\d+$', |
|
152
|
|
|
'required' => false, |
|
153
|
|
|
'info' => 'Valor acumulado do PIS', |
|
154
|
|
|
'format' => '15v2' |
|
155
|
|
|
], |
|
156
|
|
|
'VL_COFINS' => [ |
|
157
|
|
|
'type' => 'numeric', |
|
158
|
|
|
'regex' => '^\d+(\.\d*)?|\.\d+$', |
|
159
|
|
|
'required' => false, |
|
160
|
|
|
'info' => 'Valor acumulado COFINS', |
|
161
|
|
|
'format' => '15v2' |
|
162
|
|
|
], |
|
163
|
|
|
|
|
164
|
|
|
]; |
|
165
|
|
|
|
|
166
|
|
|
/** |
|
167
|
|
|
* Constructor |
|
168
|
|
|
* @param \stdClass $std |
|
169
|
|
|
*/ |
|
170
|
|
|
public function __construct(\stdClass $std) |
|
171
|
|
|
{ |
|
172
|
|
|
parent::__construct(self::REG); |
|
173
|
|
|
$this->std = $this->standarize($std); |
|
174
|
|
|
} |
|
175
|
|
|
|
|
176
|
|
|
public function postValidation() |
|
177
|
|
|
{ |
|
178
|
|
|
if ($this->std->cod_mod == '06' or $this->std->cod_mod == '28') { |
|
179
|
|
|
if (!in_array($this->std->cod_cons, ['01', '02', '03', '04', '05', '06', '07', '08'])) { |
|
180
|
|
|
throw new \InvalidArgumentException("[" . self::REG . "] " . |
|
181
|
|
|
" Se o campo COD_MOD for igual a 06 ou 28, então o campo " . |
|
182
|
|
|
"o campo COD_CONS deve ser igual a " . |
|
183
|
|
|
"'01', '02', '03', '04', '05', '06', '07' ou '08'"); |
|
184
|
|
|
} |
|
185
|
|
|
} |
|
186
|
|
|
} |
|
187
|
|
|
} |
|
188
|
|
|
|