1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace NFePHP\ECD\Elements; |
4
|
|
|
|
5
|
|
|
use NFePHP\ECD\Common\Element; |
6
|
|
|
use NFePHP\ECD\Common\ElementInterface; |
7
|
|
|
use \stdClass; |
8
|
|
|
|
9
|
|
|
/** |
10
|
|
|
* Elemento I200 do Bloco I OBRIGATÓRIO [1:1] |
11
|
|
|
* REGISTRO I200: ABERTURA DO ARQUIVO DIGITAL E IDENTIFICAÇÃO DO EMPRESÁRIO OU DA SOCIEDADE EMPRESÁRIA |
12
|
|
|
*/ |
13
|
|
View Code Duplication |
class I200 extends Element implements ElementInterface |
|
|
|
|
14
|
|
|
{ |
15
|
|
|
const REG = 'I200'; |
16
|
|
|
const LEVEL = 3; |
17
|
|
|
const PARENT = ''; |
18
|
|
|
|
19
|
|
|
protected $parameters = [ |
20
|
|
|
'num_lcto' => [ |
21
|
|
|
'type' => 'string', |
22
|
|
|
'regex' => '^[0-9]$', |
23
|
|
|
'required' => true, |
24
|
|
|
'info' => 'Número ou Código de identificação único do lançamento contábil.', |
25
|
|
|
'format' => '' |
26
|
|
|
], |
27
|
|
|
'dt_lcto' => [ |
28
|
|
|
'type' => 'string', |
29
|
|
|
'regex' => '^(0[1-9]|[1-2][0-9]|31(?!(?:0[2469]|11))|30(?!02))(0[1-9]|1[0-2])([12]\d{3})$', |
30
|
|
|
'required' => true, |
31
|
|
|
'info' => 'Data do lançamento.', |
32
|
|
|
'format' => '' |
33
|
|
|
], |
34
|
|
|
'vl_lcto' => [ |
35
|
|
|
'type' => 'string', |
36
|
|
|
'regex' => '^[0-9]{19}$', |
37
|
|
|
'required' => true, |
38
|
|
|
'info' => 'Data final das informações contidas no arquivo.', |
39
|
|
|
'format' => '' |
40
|
|
|
], |
41
|
|
|
'ind_lcto' => [ |
42
|
|
|
'type' => 'string', |
43
|
|
|
'regex' => '^(N|E)$', |
44
|
|
|
'required' => true, |
45
|
|
|
'info' => 'Indicador do tipo de lançamento: |
46
|
|
|
N - Lançamento normal (todos os lançamentos, exceto os de encerramento das contas de resultado); |
47
|
|
|
E - Lançamento de encerramento de contas de resultado. |
48
|
|
|
X – Lançamento extemporâneo.', |
49
|
|
|
'format' => '' |
50
|
|
|
], |
51
|
|
|
'dt_lcto_ext' => [ |
52
|
|
|
'type' => 'string', |
53
|
|
|
'regex' => '^(0[1-9]|[1-2][0-9]|31(?!(?:0[2469]|11))|30(?!02))(0[1-9]|1[0-2])([12]\d{3})$', |
54
|
|
|
'required' => false, |
55
|
|
|
'info' => 'Data de ocorrência dos fatos objeto do lançamento extemporâneo.', |
56
|
|
|
'format' => '' |
57
|
|
|
], |
58
|
|
|
'vl_lcto_mf' => [ |
59
|
|
|
'type' => 'string', |
60
|
|
|
'regex' => '^[0-9]{19}$', |
61
|
|
|
'required' => false, |
62
|
|
|
'info' => 'Valor do lançamento em moeda funcional, convertido para reais.', |
63
|
|
|
'format' => '' |
64
|
|
|
] |
65
|
|
|
]; |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* Constructor |
69
|
|
|
* @param \stdClass $std |
70
|
|
|
*/ |
71
|
|
|
public function __construct(\stdClass $std) |
72
|
|
|
{ |
73
|
|
|
parent::__construct(self::REG); |
74
|
|
|
$this->std = $this->standarize($std); |
75
|
|
|
$this->postValidation(); |
|
|
|
|
76
|
|
|
} |
77
|
|
|
} |
78
|
|
|
|
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.