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
|
|
View Code Duplication |
class E116 extends Element implements ElementInterface |
|
|
|
|
10
|
|
|
{ |
11
|
|
|
const REG = 'E116'; |
12
|
|
|
const LEVEL = 4; |
13
|
|
|
const PARENT = 'E110'; |
14
|
|
|
|
15
|
|
|
protected $parameters = [ |
16
|
|
|
'COD_OR' => [ |
17
|
|
|
'type' => 'string', |
18
|
|
|
'regex' => '^[000|003|004|005|006|090]+$', |
19
|
|
|
'required' => true, |
20
|
|
|
'info' => 'Código da obrigação a recolher, conforme a Tabela 5.4', |
21
|
|
|
'format' => '' |
22
|
|
|
], |
23
|
|
|
'VL_OR' => [ |
24
|
|
|
'type' => 'numeric', |
25
|
|
|
'regex' => '^\d+(\.\d*)?|\.\d+$', |
26
|
|
|
'required' => true, |
27
|
|
|
'info' => 'Valor da obrigação a recolher', |
28
|
|
|
'format' => '15v2' |
29
|
|
|
], |
30
|
|
|
'DT_VCTO' => [ |
31
|
|
|
'type' => 'numeric', |
32
|
|
|
'regex' => '^(0[1-9]|[1-2][0-9]|31(?!(?:0[2469]|11))|30(?!02))(0[1-9]|1[0-2])([12]\d{3})$', |
33
|
|
|
'required' => true, |
34
|
|
|
'info' => 'Data de vencimento da obrigação', |
35
|
|
|
'format' => '' |
36
|
|
|
], |
37
|
|
|
'COD_REC' => [ |
38
|
|
|
'type' => 'string', |
39
|
|
|
'regex' => '^.*$', |
40
|
|
|
'required' => true, |
41
|
|
|
'info' => 'Código de receita referente à obrigação, próprio ' |
42
|
|
|
.'da unidade da federação, conforme legislação estadual.', |
43
|
|
|
'format' => '' |
44
|
|
|
], |
45
|
|
|
'NUM_PROC' => [ |
46
|
|
|
'type' => 'string', |
47
|
|
|
'regex' => '^.{1,15}$', |
48
|
|
|
'required' => false, |
49
|
|
|
'info' => 'Número do processo ou auto de infração ao qual a obrigação está vinculada, se houver.', |
50
|
|
|
'format' => '' |
51
|
|
|
], |
52
|
|
|
'IND_PROC' => [ |
53
|
|
|
'type' => 'string', |
54
|
|
|
'regex' => '^[0|1|2|9]$', |
55
|
|
|
'required' => false, |
56
|
|
|
'info' => 'Indicador da origem do processo: ' |
57
|
|
|
.'0- SEFAZ;' |
58
|
|
|
.'1- Justiça Federal;' |
59
|
|
|
.'2- Justiça Estadual;' |
60
|
|
|
.'9- Outros', |
61
|
|
|
'format' => '' |
62
|
|
|
], |
63
|
|
|
'PROC' => [ |
64
|
|
|
'type' => 'string', |
65
|
|
|
'regex' => '^.*$', |
66
|
|
|
'required' => false, |
67
|
|
|
'info' => 'Descrição resumida do processo que embasou o lançamento', |
68
|
|
|
'format' => '' |
69
|
|
|
], |
70
|
|
|
'TXT_COMPL' => [ |
71
|
|
|
'type' => 'string', |
72
|
|
|
'regex' => '^.*$', |
73
|
|
|
'required' => false, |
74
|
|
|
'info' => 'Descrição complementar das obrigações a recolher.', |
75
|
|
|
'format' => '' |
76
|
|
|
], |
77
|
|
|
'MES_REF' => [ |
78
|
|
|
'type' => 'numeric', |
79
|
|
|
'regex' => '^((?!(13^))|30(?!02))(0[1-9]|1[0-2])([12]\d{3})$', |
80
|
|
|
'required' => true, |
81
|
|
|
'info' => 'Informe o mês de referência no formato “mmaaaa”', |
82
|
|
|
'format' => '' |
83
|
|
|
] |
84
|
|
|
]; |
85
|
|
|
|
86
|
|
|
/** |
87
|
|
|
* Constructor |
88
|
|
|
* @param \stdClass $std |
89
|
|
|
*/ |
90
|
|
|
public function __construct(\stdClass $std) |
91
|
|
|
{ |
92
|
|
|
parent::__construct(self::REG); |
93
|
|
|
$this->std = $this->standarize($std); |
94
|
|
|
$this->postValidation(); |
95
|
|
|
} |
96
|
|
|
|
97
|
|
|
public function postValidation() |
98
|
|
|
{ |
99
|
|
|
/* |
100
|
|
|
* Campo 06 (NUM_PROC) Validação: se este campo estiver preenchido, os campos |
101
|
|
|
* IND_PROC e PROC também devem estar preenchidos. |
102
|
|
|
*/ |
103
|
|
|
if (!empty($this->std->num_proc) && (empty($this->std->ind_proc) || empty($this->std->proc))) { |
104
|
|
|
throw new \InvalidArgumentException("[" . self::REG . "] Se o campo NUM_PROC estiver preenchido, " |
105
|
|
|
."os campos IND_PROC e PROC também devem estar preenchidos."); |
106
|
|
|
} |
107
|
|
|
} |
108
|
|
|
} |
109
|
|
|
|
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.