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