|
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
|
|
View Code Duplication |
class C380 extends Element implements ElementInterface |
|
|
|
|
|
|
10
|
|
|
{ |
|
11
|
|
|
const REG = 'C380'; |
|
12
|
|
|
const LEVEL = 3; |
|
13
|
|
|
const PARENT = 'C100'; |
|
14
|
|
|
|
|
15
|
|
|
protected $parameters = [ |
|
16
|
|
|
'COD_MOD' => [ |
|
17
|
|
|
'type' => 'string', |
|
18
|
|
|
'regex' => '^(02)$', |
|
19
|
|
|
'required' => false, |
|
20
|
|
|
'info' => 'Código do modelo do documento fiscal, conforme a |
|
21
|
|
|
Tabela 4.1.1 (Código 02 – Nota Fiscal de Venda a Consumidor)', |
|
22
|
|
|
'format' => '' |
|
23
|
|
|
], |
|
24
|
|
|
'DT_DOC_INI' => [ |
|
25
|
|
|
'type' => 'string', |
|
26
|
|
|
'regex' => '^(0[1-9]|[1-2][0-9]|31(?!(?:0[2469]|11))|30(?!02))(0[1-9]|1[0-2])([12]\d{3})$', |
|
27
|
|
|
'required' => false, |
|
28
|
|
|
'info' => 'Data de Emissão Inicial dos Documentos', |
|
29
|
|
|
'format' => '' |
|
30
|
|
|
], |
|
31
|
|
|
'DT_DOC_FIN' => [ |
|
32
|
|
|
'type' => 'string', |
|
33
|
|
|
'regex' => '^(0[1-9]|[1-2][0-9]|31(?!(?:0[2469]|11))|30(?!02))(0[1-9]|1[0-2])([12]\d{3})$', |
|
34
|
|
|
'required' => false, |
|
35
|
|
|
'info' => 'Data de Emissão Final dos Documentos', |
|
36
|
|
|
'format' => '' |
|
37
|
|
|
], |
|
38
|
|
|
'NUM_DOC_INI' => [ |
|
39
|
|
|
'type' => 'numeric', |
|
40
|
|
|
'regex' => '^(\d{0,6})$', |
|
41
|
|
|
'required' => false, |
|
42
|
|
|
'info' => 'Número do documento fiscal inicial', |
|
43
|
|
|
'format' => '' |
|
44
|
|
|
], |
|
45
|
|
|
'NUM_DOC_FIN' => [ |
|
46
|
|
|
'type' => 'numeric', |
|
47
|
|
|
'regex' => '^(\d{0,6})$', |
|
48
|
|
|
'required' => false, |
|
49
|
|
|
'info' => 'Número do documento fiscal final', |
|
50
|
|
|
'format' => '' |
|
51
|
|
|
], |
|
52
|
|
|
'VL_DOC' => [ |
|
53
|
|
|
'type' => 'numeric', |
|
54
|
|
|
'regex' => '^\d+(\.\d*)?|\.\d+$', |
|
55
|
|
|
'required' => false, |
|
56
|
|
|
'info' => 'Valor total dos documentos emitidos', |
|
57
|
|
|
'format' => '15v2' |
|
58
|
|
|
], |
|
59
|
|
|
'VL_DOC_CANC' => [ |
|
60
|
|
|
'type' => 'numeric', |
|
61
|
|
|
'regex' => '^\d+(\.\d*)?|\.\d+$', |
|
62
|
|
|
'required' => false, |
|
63
|
|
|
'info' => 'Valor total dos documentos cancelados', |
|
64
|
|
|
'format' => '15v2' |
|
65
|
|
|
], |
|
66
|
|
|
|
|
67
|
|
|
]; |
|
68
|
|
|
|
|
69
|
|
|
/** |
|
70
|
|
|
* Constructor |
|
71
|
|
|
* @param \stdClass $std |
|
72
|
|
|
*/ |
|
73
|
|
|
public function __construct(\stdClass $std) |
|
74
|
|
|
{ |
|
75
|
|
|
parent::__construct(self::REG); |
|
76
|
|
|
$this->std = $this->standarize($std); |
|
77
|
|
|
} |
|
78
|
|
|
} |
|
79
|
|
|
|
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.