| @@ 9-61 (lines=53) @@ | ||
| 6 | use NFePHP\EFD\Common\ElementInterface; |
|
| 7 | use \stdClass; |
|
| 8 | ||
| 9 | class E220 extends Element implements ElementInterface |
|
| 10 | { |
|
| 11 | const REG = 'E220'; |
|
| 12 | const LEVEL = 4; |
|
| 13 | const PARENT = 'E210'; |
|
| 14 | ||
| 15 | protected $parameters = [ |
|
| 16 | 'COD_AJ_APUR' => [ |
|
| 17 | 'type' => 'string', |
|
| 18 | 'regex' => '^.{8}$', |
|
| 19 | 'required' => true, |
|
| 20 | 'info' => 'Código do ajuste da apuração e dedução, ' |
|
| 21 | .'conforme a Tabela indicada no item 5.1.1', |
|
| 22 | 'format' => '' |
|
| 23 | ], |
|
| 24 | 'DESCR_COMPL_AJ' => [ |
|
| 25 | 'type' => 'string', |
|
| 26 | 'regex' => '^.*$', |
|
| 27 | 'required' => false, |
|
| 28 | 'info' => 'Descrição complementar do ajuste da apuração', |
|
| 29 | 'format' => '' |
|
| 30 | ], |
|
| 31 | 'VL_AJ_APUR' => [ |
|
| 32 | 'type' => 'numeric', |
|
| 33 | 'regex' => '^\d+(\.\d*)?|\.\d+$', |
|
| 34 | 'required' => true, |
|
| 35 | 'info' => 'Valor do ajuste da apuração', |
|
| 36 | 'format' => '15v2' |
|
| 37 | ] |
|
| 38 | ]; |
|
| 39 | ||
| 40 | /** |
|
| 41 | * Constructor |
|
| 42 | * @param \stdClass $std |
|
| 43 | */ |
|
| 44 | public function __construct(\stdClass $std) |
|
| 45 | { |
|
| 46 | parent::__construct(self::REG); |
|
| 47 | $this->std = $this->standarize($std); |
|
| 48 | $this->postValidation(); |
|
| 49 | } |
|
| 50 | ||
| 51 | public function postValidation() |
|
| 52 | { |
|
| 53 | /* |
|
| 54 | * Campo 04 (VL_AJ_APUR) Validação: o valor informado no campo deve ser maior que “0” (zero). |
|
| 55 | */ |
|
| 56 | if ($this->values->vl_aj_apur <= 0) { |
|
| 57 | throw new \InvalidArgumentException("[" . self::REG . "] O valor informado no campo deve " |
|
| 58 | ."ser maior que “0” (zero)."); |
|
| 59 | } |
|
| 60 | } |
|
| 61 | } |
|
| 62 | ||
| @@ 9-60 (lines=52) @@ | ||
| 6 | use NFePHP\EFD\Common\ElementInterface; |
|
| 7 | use \stdClass; |
|
| 8 | ||
| 9 | class E311 extends Element implements ElementInterface |
|
| 10 | { |
|
| 11 | const REG = 'E311'; |
|
| 12 | const LEVEL = 4; |
|
| 13 | const PARENT = 'E310'; |
|
| 14 | ||
| 15 | protected $parameters = [ |
|
| 16 | 'COD_AJ_APUR' => [ |
|
| 17 | 'type' => 'string', |
|
| 18 | 'regex' => '^.{1,8}$', |
|
| 19 | 'required' => true, |
|
| 20 | 'info' => 'Código do ajuste da apuração e dedução, conforme a Tabela indicada no item 5.1.1', |
|
| 21 | 'format' => '' |
|
| 22 | ], |
|
| 23 | 'DESCR_COMPL_AJ' => [ |
|
| 24 | 'type' => 'string', |
|
| 25 | 'regex' => '^.*$', |
|
| 26 | 'required' => false, |
|
| 27 | 'info' => 'Descrição complementar do ajuste da apuração', |
|
| 28 | 'format' => '' |
|
| 29 | ], |
|
| 30 | 'VL_AJ_APUR' => [ |
|
| 31 | 'type' => 'numeric', |
|
| 32 | 'regex' => '^\d+(\.\d*)?|\.\d+$', |
|
| 33 | 'required' => true, |
|
| 34 | 'info' => 'Valor do ajuste da apuração', |
|
| 35 | 'format' => '15v2' |
|
| 36 | ] |
|
| 37 | ]; |
|
| 38 | ||
| 39 | /** |
|
| 40 | * Constructor |
|
| 41 | * @param \stdClass $std |
|
| 42 | */ |
|
| 43 | public function __construct(\stdClass $std) |
|
| 44 | { |
|
| 45 | parent::__construct(self::REG); |
|
| 46 | $this->std = $this->standarize($std); |
|
| 47 | $this->postValidation(); |
|
| 48 | } |
|
| 49 | ||
| 50 | public function postValidation() |
|
| 51 | { |
|
| 52 | /* |
|
| 53 | * Campo 04 (VL_AJ_APUR) Validação: o valor informado no campo deve ser maior que “0” (zero). |
|
| 54 | */ |
|
| 55 | if ($this->values->vl_aj_apur <= 0) { |
|
| 56 | throw new \InvalidArgumentException("[" . self::REG . "] O valor informado no campo deve ser " |
|
| 57 | ."maior que “0” (zero)."); |
|
| 58 | } |
|
| 59 | } |
|
| 60 | } |
|
| 61 | ||
| @@ 9-63 (lines=55) @@ | ||
| 6 | use NFePHP\EFD\Common\ElementInterface; |
|
| 7 | use \stdClass; |
|
| 8 | ||
| 9 | class Z1400 extends Element implements ElementInterface |
|
| 10 | { |
|
| 11 | const REG = '1400'; |
|
| 12 | const LEVEL = 2; |
|
| 13 | const PARENT = '1001'; |
|
| 14 | ||
| 15 | protected $parameters = [ |
|
| 16 | 'COD_ITEM_IPM' => [ |
|
| 17 | 'type' => 'string', |
|
| 18 | 'regex' => '^.{1,60}$', |
|
| 19 | 'required' => true, |
|
| 20 | 'info' => 'Código do item (Tabela própria da unidade da federação ' |
|
| 21 | .'(Tabela de Itens UF Índice de Participação dos Municípios) ' |
|
| 22 | .'ou campo 02 do Registro 0200', |
|
| 23 | 'format' => '' |
|
| 24 | ], |
|
| 25 | 'MUN' => [ |
|
| 26 | 'type' => 'integer', |
|
| 27 | 'regex' => '^\d{7}$', |
|
| 28 | 'required' => true, |
|
| 29 | 'info' => 'Código do Município de origem/destino', |
|
| 30 | 'format' => '' |
|
| 31 | ], |
|
| 32 | 'VALOR' => [ |
|
| 33 | 'type' => 'numeric', |
|
| 34 | 'regex' => '^\d+(\.\d*)?|\.\d+$', |
|
| 35 | 'required' => true, |
|
| 36 | 'info' => 'Valor mensal correspondente ao município', |
|
| 37 | 'format' => '15v2' |
|
| 38 | ] |
|
| 39 | ]; |
|
| 40 | ||
| 41 | /** |
|
| 42 | * Constructor |
|
| 43 | * @param \stdClass $std |
|
| 44 | */ |
|
| 45 | public function __construct(\stdClass $std) |
|
| 46 | { |
|
| 47 | parent::__construct(self::REG); |
|
| 48 | $this->std = $this->standarize($std); |
|
| 49 | $this->postValidation(); |
|
| 50 | } |
|
| 51 | ||
| 52 | public function postValidation() |
|
| 53 | { |
|
| 54 | /* |
|
| 55 | * Campo 04 (VALOR) Validação: o valor informado no campo deve ser maior que “0” (zero). |
|
| 56 | * Se o valor for negativo ou zero, o contribuinte não deve prestar a informação no mês. |
|
| 57 | */ |
|
| 58 | if ($this->values->valor <= 0) { |
|
| 59 | throw new \InvalidArgumentException("[" . self::REG . "] Se o valor for negativo ou " |
|
| 60 | ."zero, o contribuinte não deve prestar a informação no mês."); |
|
| 61 | } |
|
| 62 | } |
|
| 63 | } |
|
| 64 | ||