|
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 E240 extends Element implements ElementInterface |
|
|
|
|
|
|
10
|
|
|
{ |
|
11
|
|
|
const REG = 'E240'; |
|
12
|
|
|
const LEVEL = 5; |
|
13
|
|
|
const PARENT = 'E220'; |
|
14
|
|
|
|
|
15
|
|
|
protected $parameters = [ |
|
16
|
|
|
'COD_PART' => [ |
|
17
|
|
|
'type' => 'string', |
|
18
|
|
|
'regex' => '^.{1,60}$', |
|
19
|
|
|
'required' => true, |
|
20
|
|
|
'info' => 'Código do participante (campo 02 do Registro 0150): ' |
|
21
|
|
|
.'- do emitente do documento ou do remetente das mercadorias, no caso de entradas; ' |
|
22
|
|
|
.'- do adquirente, no caso de saídas', |
|
23
|
|
|
'format' => '' |
|
24
|
|
|
], |
|
25
|
|
|
'COD_MOD' => [ |
|
26
|
|
|
'type' => 'string', |
|
27
|
|
|
'regex' => '^.{2}$', |
|
28
|
|
|
'required' => true, |
|
29
|
|
|
'info' => 'Código do modelo do documento fiscal, conforme a Tabela 4.1.1', |
|
30
|
|
|
'format' => '' |
|
31
|
|
|
], |
|
32
|
|
|
'SER' => [ |
|
33
|
|
|
'type' => 'string', |
|
34
|
|
|
'regex' => '^.{1,4}$', |
|
35
|
|
|
'required' => false, |
|
36
|
|
|
'info' => 'Série do documento fiscal', |
|
37
|
|
|
'format' => '' |
|
38
|
|
|
], |
|
39
|
|
|
'SUB' => [ |
|
40
|
|
|
'type' => 'integer', |
|
41
|
|
|
'regex' => '^.{1,3}$', |
|
42
|
|
|
'required' => false, |
|
43
|
|
|
'info' => 'Subsérie do documento fiscal', |
|
44
|
|
|
'format' => '' |
|
45
|
|
|
], |
|
46
|
|
|
'NUM_DOC' => [ |
|
47
|
|
|
'type' => 'integer', |
|
48
|
|
|
'regex' => '^([1-9])([0-9]{1,8}|)$', |
|
49
|
|
|
'required' => true, |
|
50
|
|
|
'info' => 'Número do documento fiscal', |
|
51
|
|
|
'format' => '' |
|
52
|
|
|
], |
|
53
|
|
|
'DT_DOC' => [ |
|
54
|
|
|
'type' => 'integer', |
|
55
|
|
|
'regex' => '^(0[1-9]|[1-2][0-9]|31(?!(?:0[2469]|11))|30(?!02))(0[1-9]|1[0-2])([12]\d{3})$', |
|
56
|
|
|
'required' => true, |
|
57
|
|
|
'info' => 'Data da emissão do documento fiscal', |
|
58
|
|
|
'format' => '' |
|
59
|
|
|
], |
|
60
|
|
|
'COD_ITEM' => [ |
|
61
|
|
|
'type' => 'string', |
|
62
|
|
|
'regex' => '^.{1,60}$', |
|
63
|
|
|
'required' => false, |
|
64
|
|
|
'info' => 'Código do item (campo 02 do Registro 0200)', |
|
65
|
|
|
'format' => '' |
|
66
|
|
|
], |
|
67
|
|
|
'VL_AJ_ITEM' => [ |
|
68
|
|
|
'type' => 'numeric', |
|
69
|
|
|
'regex' => '^\d+(\.\d*)?|\.\d+$', |
|
70
|
|
|
'required' => true, |
|
71
|
|
|
'info' => 'Valor do ajuste para a operação/item', |
|
72
|
|
|
'format' => '15v2' |
|
73
|
|
|
], |
|
74
|
|
|
'CHV_DOCE' => [ |
|
75
|
|
|
'type' => 'string', |
|
76
|
|
|
'regex' => '^.{44}$', |
|
77
|
|
|
'required' => false, |
|
78
|
|
|
'info' => 'Chave do Documento Eletrônico', |
|
79
|
|
|
'format' => '' |
|
80
|
|
|
] |
|
81
|
|
|
]; |
|
82
|
|
|
|
|
83
|
|
|
/** |
|
84
|
|
|
* Constructor |
|
85
|
|
|
* @param \stdClass $std |
|
86
|
|
|
*/ |
|
87
|
|
|
public function __construct(\stdClass $std) |
|
88
|
|
|
{ |
|
89
|
|
|
parent::__construct(self::REG); |
|
90
|
|
|
$this->std = $this->standarize($std); |
|
91
|
|
|
} |
|
92
|
|
|
} |
|
93
|
|
|
|
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.