| 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 |  |  | use function Safe\substr; | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 9 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 10 |  |  | class C170 extends Element implements ElementInterface | 
            
                                                                        
                            
            
                                    
            
            
                | 11 |  |  | { | 
            
                                                                        
                            
            
                                    
            
            
                | 12 |  |  |     const REG = 'C170'; | 
            
                                                                        
                            
            
                                    
            
            
                | 13 |  |  |     const LEVEL = 3; | 
            
                                                                        
                            
            
                                    
            
            
                | 14 |  |  |     const PARENT = 'C100'; | 
            
                                                                        
                            
            
                                    
            
            
                | 15 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 16 |  |  |     protected $parameters = [ | 
            
                                                                        
                            
            
                                    
            
            
                | 17 |  |  |         'NUM_ITEM' => [ | 
            
                                                                        
                            
            
                                    
            
            
                | 18 |  |  |             'type' => 'numeric', | 
            
                                                                        
                            
            
                                    
            
            
                | 19 |  |  |             'regex' => '^([1-9]{1})(\d{0,2})?$', | 
            
                                                                        
                            
            
                                    
            
            
                | 20 |  |  |             'required' => false, | 
            
                                                                        
                            
            
                                    
            
            
                | 21 |  |  |             'info' => 'Número seqüencial do item no documento fiscal', | 
            
                                                                        
                            
            
                                    
            
            
                | 22 |  |  |             'format' => '' | 
            
                                                                        
                            
            
                                    
            
            
                | 23 |  |  |         ], | 
            
                                                                        
                            
            
                                    
            
            
                | 24 |  |  |         'COD_ITEM' => [ | 
            
                                                                        
                            
            
                                    
            
            
                | 25 |  |  |             'type' => 'string', | 
            
                                                                        
                            
            
                                    
            
            
                | 26 |  |  |             'regex' => '^.{0,60}$', | 
            
                                                                        
                            
            
                                    
            
            
                | 27 |  |  |             'required' => false, | 
            
                                                                        
                            
            
                                    
            
            
                | 28 |  |  |             'info' => 'Código do item (campo 02 do Registro 0200)', | 
            
                                                                        
                            
            
                                    
            
            
                | 29 |  |  |             'format' => '' | 
            
                                                                        
                            
            
                                    
            
            
                | 30 |  |  |         ], | 
            
                                                                        
                            
            
                                    
            
            
                | 31 |  |  |         'DESCR_COMPL' => [ | 
            
                                                                        
                            
            
                                    
            
            
                | 32 |  |  |             'type' => 'string', | 
            
                                                                        
                            
            
                                    
            
            
                | 33 |  |  |             'regex' => '^(.*)$', | 
            
                                                                        
                            
            
                                    
            
            
                | 34 |  |  |             'required' => false, | 
            
                                                                        
                            
            
                                    
            
            
                | 35 |  |  |             'info' => 'Descrição complementar documento fiscal', | 
            
                                                                        
                            
            
                                    
            
            
                | 36 |  |  |             'format' => '' | 
            
                                                                        
                            
            
                                    
            
            
                | 37 |  |  |         ], | 
            
                                                                        
                            
            
                                    
            
            
                | 38 |  |  |         'QTD' => [ | 
            
                                                                        
                            
            
                                    
            
            
                | 39 |  |  |             'type' => 'numeric', | 
            
                                                                        
                            
            
                                    
            
            
                | 40 |  |  |             'regex' => '^\d+(\.\d*)?|\.\d+$', | 
            
                                                                        
                            
            
                                    
            
            
                | 41 |  |  |             'required' => false, | 
            
                                                                        
                            
            
                                    
            
            
                | 42 |  |  |             'info' => 'Quantidade do item', | 
            
                                                                        
                            
            
                                    
            
            
                | 43 |  |  |             'format' => '15v5' | 
            
                                                                        
                            
            
                                    
            
            
                | 44 |  |  |         ], | 
            
                                                                        
                            
            
                                    
            
            
                | 45 |  |  |         'UNID' => [ | 
            
                                                                        
                            
            
                                    
            
            
                | 46 |  |  |             'type' => 'string', | 
            
                                                                        
                            
            
                                    
            
            
                | 47 |  |  |             'regex' => '^.{0,6}$', | 
            
                                                                        
                            
            
                                    
            
            
                | 48 |  |  |             'required' => false, | 
            
                                                                        
                            
            
                                    
            
            
                | 49 |  |  |             'info' => 'Unidade do item (Campo 02 do registro 0190)', | 
            
                                                                        
                            
            
                                    
            
            
                | 50 |  |  |             'format' => '' | 
            
                                                                        
                            
            
                                    
            
            
                | 51 |  |  |         ], | 
            
                                                                        
                            
            
                                    
            
            
                | 52 |  |  |         'VL_ITEM' => [ | 
            
                                                                        
                            
            
                                    
            
            
                | 53 |  |  |             'type' => 'numeric', | 
            
                                                                        
                            
            
                                    
            
            
                | 54 |  |  |             'regex' => '^\d+(\.\d*)?|\.\d+$', | 
            
                                                                        
                            
            
                                    
            
            
                | 55 |  |  |             'required' => false, | 
            
                                                                        
                            
            
                                    
            
            
                | 56 |  |  |             'info' => 'Valor total do item (mercadorias ou serviços)', | 
            
                                                                        
                            
            
                                    
            
            
                | 57 |  |  |             'format' => '15v2' | 
            
                                                                        
                            
            
                                    
            
            
                | 58 |  |  |         ], | 
            
                                                                        
                            
            
                                    
            
            
                | 59 |  |  |         'VL_DESC' => [ | 
            
                                                                        
                            
            
                                    
            
            
                | 60 |  |  |             'type' => 'numeric', | 
            
                                                                        
                            
            
                                    
            
            
                | 61 |  |  |             'regex' => '^\d+(\.\d*)?|\.\d+$', | 
            
                                                                        
                            
            
                                    
            
            
                | 62 |  |  |             'required' => false, | 
            
                                                                        
                            
            
                                    
            
            
                | 63 |  |  |             'info' => 'Valor do desconto comercial / exclusão da base de cálculo do PIS/PASEP e da COFINS', | 
            
                                                                        
                            
            
                                    
            
            
                | 64 |  |  |             'format' => '15v2' | 
            
                                                                        
                            
            
                                    
            
            
                | 65 |  |  |         ], | 
            
                                                                        
                            
            
                                    
            
            
                | 66 |  |  |         'IND_MOV' => [ | 
            
                                                                        
                            
            
                                    
            
            
                | 67 |  |  |             'type' => 'string', | 
            
                                                                        
                            
            
                                    
            
            
                | 68 |  |  |             'regex' => '^(0|1)$', | 
            
                                                                        
                            
            
                                    
            
            
                | 69 |  |  |             'required' => false, | 
            
                                                                        
                            
            
                                    
            
            
                | 70 |  |  |             'info' => 'Movimentação física do ITEM/PRODUTO: 0. SIM 1. NÃO', | 
            
                                                                        
                            
            
                                    
            
            
                | 71 |  |  |             'format' => '' | 
            
                                                                        
                            
            
                                    
            
            
                | 72 |  |  |         ], | 
            
                                                                        
                            
            
                                    
            
            
                | 73 |  |  |         'CST_ICMS' => [ | 
            
                                                                        
                            
            
                                    
            
            
                | 74 |  |  |             'type' => 'numeric', | 
            
                                                                        
                            
            
                                    
            
            
                | 75 |  |  |             'regex' => '^(\d{3})$', | 
            
                                                                        
                            
            
                                    
            
            
                | 76 |  |  |             'required' => false, | 
            
                                                                        
                            
            
                                    
            
            
                | 77 |  |  |             'info' => 'Código da Situação Tributária referente ao ICMS, conforme a Tabela indicada no item 4.3.1', | 
            
                                                                        
                            
            
                                    
            
            
                | 78 |  |  |             'format' => '' | 
            
                                                                        
                            
            
                                    
            
            
                | 79 |  |  |         ], | 
            
                                                                        
                            
            
                                    
            
            
                | 80 |  |  |         'CFOP' => [ | 
            
                                                                        
                            
            
                                    
            
            
                | 81 |  |  |             'type' => 'numeric', | 
            
                                                                        
                            
            
                                    
            
            
                | 82 |  |  |             'regex' => '^(\d{4})$', | 
            
                                                                        
                            
            
                                    
            
            
                | 83 |  |  |             'required' => false, | 
            
                                                                        
                            
            
                                    
            
            
                | 84 |  |  |             'info' => 'Código Fiscal de Operação e Prestação', | 
            
                                                                        
                            
            
                                    
            
            
                | 85 |  |  |             'format' => '' | 
            
                                                                        
                            
            
                                    
            
            
                | 86 |  |  |         ], | 
            
                                                                        
                            
            
                                    
            
            
                | 87 |  |  |         'COD_NAT' => [ | 
            
                                                                        
                            
            
                                    
            
            
                | 88 |  |  |             'type' => 'string', | 
            
                                                                        
                            
            
                                    
            
            
                | 89 |  |  |             'regex' => '^.{0,10}$', | 
            
                                                                        
                            
            
                                    
            
            
                | 90 |  |  |             'required' => false, | 
            
                                                                        
                            
            
                                    
            
            
                | 91 |  |  |             'info' => 'Código da natureza da operação (campo 02 do Registro 0400)', | 
            
                                                                        
                            
            
                                    
            
            
                | 92 |  |  |             'format' => '' | 
            
                                                                        
                            
            
                                    
            
            
                | 93 |  |  |         ], | 
            
                                                                        
                            
            
                                    
            
            
                | 94 |  |  |         'VL_BC_ICMS' => [ | 
            
                                                                        
                            
            
                                    
            
            
                | 95 |  |  |             'type' => 'numeric', | 
            
                                                                        
                            
            
                                    
            
            
                | 96 |  |  |             'regex' => '^\d+(\.\d*)?|\.\d+$', | 
            
                                                                        
                            
            
                                    
            
            
                | 97 |  |  |             'required' => false, | 
            
                                                                        
                            
            
                                    
            
            
                | 98 |  |  |             'info' => 'Valor da base de cálculo do ICMS', | 
            
                                                                        
                            
            
                                    
            
            
                | 99 |  |  |             'format' => '15v2' | 
            
                                                                        
                            
            
                                    
            
            
                | 100 |  |  |         ], | 
            
                                                                        
                            
            
                                    
            
            
                | 101 |  |  |         'ALIQ_ICMS' => [ | 
            
                                                                        
                            
            
                                    
            
            
                | 102 |  |  |             'type' => 'numeric', | 
            
                                                                        
                            
            
                                    
            
            
                | 103 |  |  |             'regex' => '^\d+(\.\d*)?|\.\d+$', | 
            
                                                                        
                            
            
                                    
            
            
                | 104 |  |  |             'required' => false, | 
            
                                                                        
                            
            
                                    
            
            
                | 105 |  |  |             'info' => 'Alíquota do ICMS', | 
            
                                                                        
                            
            
                                    
            
            
                | 106 |  |  |             'format' => '6v2' | 
            
                                                                        
                            
            
                                    
            
            
                | 107 |  |  |         ], | 
            
                                                                        
                            
            
                                    
            
            
                | 108 |  |  |         'VL_ICMS' => [ | 
            
                                                                        
                            
            
                                    
            
            
                | 109 |  |  |             'type' => 'numeric', | 
            
                                                                        
                            
            
                                    
            
            
                | 110 |  |  |             'regex' => '^\d+(\.\d*)?|\.\d+$', | 
            
                                                                        
                            
            
                                    
            
            
                | 111 |  |  |             'required' => false, | 
            
                                                                        
                            
            
                                    
            
            
                | 112 |  |  |             'info' => 'Valor do ICMS creditado/debitado', | 
            
                                                                        
                            
            
                                    
            
            
                | 113 |  |  |             'format' => '15v2' | 
            
                                                                        
                            
            
                                    
            
            
                | 114 |  |  |         ], | 
            
                                                                        
                            
            
                                    
            
            
                | 115 |  |  |         'VL_BC_ICMS_ST' => [ | 
            
                                                                        
                            
            
                                    
            
            
                | 116 |  |  |             'type' => 'numeric', | 
            
                                                                        
                            
            
                                    
            
            
                | 117 |  |  |             'regex' => '^\d+(\.\d*)?|\.\d+$', | 
            
                                                                        
                            
            
                                    
            
            
                | 118 |  |  |             'required' => false, | 
            
                                                                        
                            
            
                                    
            
            
                | 119 |  |  |             'info' => 'Valor da base de cálculo referente à substituição tributária', | 
            
                                                                        
                            
            
                                    
            
            
                | 120 |  |  |             'format' => '15v2' | 
            
                                                                        
                            
            
                                    
            
            
                | 121 |  |  |         ], | 
            
                                                                        
                            
            
                                    
            
            
                | 122 |  |  |         'ALIQ_ST' => [ | 
            
                                                                        
                            
            
                                    
            
            
                | 123 |  |  |             'type' => 'numeric', | 
            
                                                                        
                            
            
                                    
            
            
                | 124 |  |  |             'regex' => '^\d+(\.\d*)?|\.\d+$', | 
            
                                                                        
                            
            
                                    
            
            
                | 125 |  |  |             'required' => false, | 
            
                                                                        
                            
            
                                    
            
            
                | 126 |  |  |             'info' => 'Alíquota do ICMS da substituição tributária na unidade da federação de destino', | 
            
                                                                        
                            
            
                                    
            
            
                | 127 |  |  |             'format' => '6v2' | 
            
                                                                        
                            
            
                                    
            
            
                | 128 |  |  |         ], | 
            
                                                                        
                            
            
                                    
            
            
                | 129 |  |  |         'VL_ICMS_ST' => [ | 
            
                                                                        
                            
            
                                    
            
            
                | 130 |  |  |             'type' => 'numeric', | 
            
                                                                        
                            
            
                                    
            
            
                | 131 |  |  |             'regex' => '^\d+(\.\d*)?|\.\d+$', | 
            
                                                                        
                            
            
                                    
            
            
                | 132 |  |  |             'required' => false, | 
            
                                                                        
                            
            
                                    
            
            
                | 133 |  |  |             'info' => 'Valor do ICMS referente à substituição tributária', | 
            
                                                                        
                            
            
                                    
            
            
                | 134 |  |  |             'format' => '15v2' | 
            
                                                                        
                            
            
                                    
            
            
                | 135 |  |  |         ], | 
            
                                                                        
                            
            
                                    
            
            
                | 136 |  |  |         'IND_APUR' => [ | 
            
                                                                        
                            
            
                                    
            
            
                | 137 |  |  |             'type' => 'string', | 
            
                                                                        
                            
            
                                    
            
            
                | 138 |  |  |             'regex' => '^(0|1)$', | 
            
                                                                        
                            
            
                                    
            
            
                | 139 |  |  |             'required' => false, | 
            
                                                                        
                            
            
                                    
            
            
                | 140 |  |  |             'info' => 'Indicador de período de apuração do IPI: 0 - Mensal;', | 
            
                                                                        
                            
            
                                    
            
            
                | 141 |  |  |             'format' => '' | 
            
                                                                        
                            
            
                                    
            
            
                | 142 |  |  |         ], | 
            
                                                                        
                            
            
                                    
            
            
                | 143 |  |  |         'CST_IPI' => [ | 
            
                                                                        
                            
            
                                    
            
            
                | 144 |  |  |             'type' => 'string', | 
            
                                                                        
                            
            
                                    
            
            
                | 145 |  |  |             'regex' => '^[0-9]{2}$', | 
            
                                                                        
                            
            
                                    
            
            
                | 146 |  |  |             'required' => false, | 
            
                                                                        
                            
            
                                    
            
            
                | 147 |  |  |             'info' => 'Código da Situação Tributária referente ao IPI, conforme a Tabela indicada no item 4.3.2.', | 
            
                                                                        
                            
            
                                    
            
            
                | 148 |  |  |             'format' => '' | 
            
                                                                        
                            
            
                                    
            
            
                | 149 |  |  |         ], | 
            
                                                                        
                            
            
                                    
            
            
                | 150 |  |  |         'COD_ENQ' => [ | 
            
                                                                        
                            
            
                                    
            
            
                | 151 |  |  |             'type' => 'string', | 
            
                                                                        
                            
            
                                    
            
            
                | 152 |  |  |             'regex' => '^.{3}$', | 
            
                                                                        
                            
            
                                    
            
            
                | 153 |  |  |             'required' => false, | 
            
                                                                        
                            
            
                                    
            
            
                | 154 |  |  |             'info' => 'Código de enquadramento legal do IPI, conforme tabela indicada no item 4.5.3.', | 
            
                                                                        
                            
            
                                    
            
            
                | 155 |  |  |             'format' => '' | 
            
                                                                        
                            
            
                                    
            
            
                | 156 |  |  |         ], | 
            
                                                                        
                            
            
                                    
            
            
                | 157 |  |  |         'VL_BC_IPI' => [ | 
            
                                                                        
                            
            
                                    
            
            
                | 158 |  |  |             'type' => 'numeric', | 
            
                                                                        
                            
            
                                    
            
            
                | 159 |  |  |             'regex' => '^\d+(\.\d*)?|\.\d+$', | 
            
                                                                        
                            
            
                                    
            
            
                | 160 |  |  |             'required' => false, | 
            
                                                                        
                            
            
                                    
            
            
                | 161 |  |  |             'info' => 'Valor da base de cálculo do IPI', | 
            
                                                                        
                            
            
                                    
            
            
                | 162 |  |  |             'format' => '15v2' | 
            
                                                                        
                            
            
                                    
            
            
                | 163 |  |  |         ], | 
            
                                                                        
                            
            
                                    
            
            
                | 164 |  |  |         'ALIQ_IPI' => [ | 
            
                                                                        
                            
            
                                    
            
            
                | 165 |  |  |             'type' => 'numeric', | 
            
                                                                        
                            
            
                                    
            
            
                | 166 |  |  |             'regex' => '^\d+(\.\d*)?|\.\d+$', | 
            
                                                                        
                            
            
                                    
            
            
                | 167 |  |  |             'required' => false, | 
            
                                                                        
                            
            
                                    
            
            
                | 168 |  |  |             'info' => 'Alíquota do IPI', | 
            
                                                                        
                            
            
                                    
            
            
                | 169 |  |  |             'format' => '6v2' | 
            
                                                                        
                            
            
                                    
            
            
                | 170 |  |  |         ], | 
            
                                                                        
                            
            
                                    
            
            
                | 171 |  |  |         'VL_IPI' => [ | 
            
                                                                        
                            
            
                                    
            
            
                | 172 |  |  |             'type' => 'numeric', | 
            
                                                                        
                            
            
                                    
            
            
                | 173 |  |  |             'regex' => '^\d+(\.\d*)?|\.\d+$', | 
            
                                                                        
                            
            
                                    
            
            
                | 174 |  |  |             'required' => false, | 
            
                                                                        
                            
            
                                    
            
            
                | 175 |  |  |             'info' => 'Valor do IPI creditado/debitado', | 
            
                                                                        
                            
            
                                    
            
            
                | 176 |  |  |             'format' => '15v2' | 
            
                                                                        
                            
            
                                    
            
            
                | 177 |  |  |         ], | 
            
                                                                        
                            
            
                                    
            
            
                | 178 |  |  |         'CST_PIS' => [ | 
            
                                                                        
                            
            
                                    
            
            
                | 179 |  |  |             'type' => 'numeric', | 
            
                                                                        
                            
            
                                    
            
            
                | 180 |  |  |             'regex' => '^(\d{2})$', | 
            
                                                                        
                            
            
                                    
            
            
                | 181 |  |  |             'required' => false, | 
            
                                                                        
                            
            
                                    
            
            
                | 182 |  |  |             'info' => 'Código da Situação Tributária referente ao PIS.', | 
            
                                                                        
                            
            
                                    
            
            
                | 183 |  |  |             'format' => '' | 
            
                                                                        
                            
            
                                    
            
            
                | 184 |  |  |         ], | 
            
                                                                        
                            
            
                                    
            
            
                | 185 |  |  |         'VL_BC_PIS' => [ | 
            
                                                                        
                            
            
                                    
            
            
                | 186 |  |  |             'type' => 'numeric', | 
            
                                                                        
                            
            
                                    
            
            
                | 187 |  |  |             'regex' => '^\d+(\.\d*)?|\.\d+$', | 
            
                                                                        
                            
            
                                    
            
            
                | 188 |  |  |             'required' => false, | 
            
                                                                        
                            
            
                                    
            
            
                | 189 |  |  |             'info' => 'Valor da base de cálculo do PIS/PASEP', | 
            
                                                                        
                            
            
                                    
            
            
                | 190 |  |  |             'format' => '15v2' | 
            
                                                                        
                            
            
                                    
            
            
                | 191 |  |  |         ], | 
            
                                                                        
                            
            
                                    
            
            
                | 192 |  |  |         'ALIQ_PIS' => [ | 
            
                                                                        
                            
            
                                    
            
            
                | 193 |  |  |             'type' => 'numeric', | 
            
                                                                        
                            
            
                                    
            
            
                | 194 |  |  |             'regex' => '^\d+(\.\d*)?|\.\d+$', | 
            
                                                                        
                            
            
                                    
            
            
                | 195 |  |  |             'required' => false, | 
            
                                                                        
                            
            
                                    
            
            
                | 196 |  |  |             'info' => 'Alíquota do PIS (em percentual)', | 
            
                                                                        
                            
            
                                    
            
            
                | 197 |  |  |             'format' => '8v4' | 
            
                                                                        
                            
            
                                    
            
            
                | 198 |  |  |         ], | 
            
                                                                        
                            
            
                                    
            
            
                | 199 |  |  |         'QUANT_BC_PIS' => [ | 
            
                                                                        
                            
            
                                    
            
            
                | 200 |  |  |             'type' => 'numeric', | 
            
                                                                        
                            
            
                                    
            
            
                | 201 |  |  |             'regex' => '^\d+(\.\d*)?|\.\d+$', | 
            
                                                                        
                            
            
                                    
            
            
                | 202 |  |  |             'required' => false, | 
            
                                                                        
                            
            
                                    
            
            
                | 203 |  |  |             'info' => 'Quantidade – Base de cálculo PIS/PASEP', | 
            
                                                                        
                            
            
                                    
            
            
                | 204 |  |  |             'format' => '15v3' | 
            
                                                                        
                            
            
                                    
            
            
                | 205 |  |  |         ], | 
            
                                                                        
                            
            
                                    
            
            
                | 206 |  |  |         'ALIQ_PIS_QUANT' => [ | 
            
                                                                        
                            
            
                                    
            
            
                | 207 |  |  |             'type' => 'numeric', | 
            
                                                                        
                            
            
                                    
            
            
                | 208 |  |  |             'regex' => '^\d+(\.\d*)?|\.\d+$', | 
            
                                                                        
                            
            
                                    
            
            
                | 209 |  |  |             'required' => false, | 
            
                                                                        
                            
            
                                    
            
            
                | 210 |  |  |             'info' => 'Alíquota do PIS/PASEP (em reais)', | 
            
                                                                        
                            
            
                                    
            
            
                | 211 |  |  |             'format' => '15v4' | 
            
                                                                        
                            
            
                                    
            
            
                | 212 |  |  |         ], | 
            
                                                                        
                            
            
                                    
            
            
                | 213 |  |  |         'VL_PIS' => [ | 
            
                                                                        
                            
            
                                    
            
            
                | 214 |  |  |             'type' => 'numeric', | 
            
                                                                        
                            
            
                                    
            
            
                | 215 |  |  |             'regex' => '^\d+(\.\d*)?|\.\d+$', | 
            
                                                                        
                            
            
                                    
            
            
                | 216 |  |  |             'required' => false, | 
            
                                                                        
                            
            
                                    
            
            
                | 217 |  |  |             'info' => 'Valor do PIS/PASEP', | 
            
                                                                        
                            
            
                                    
            
            
                | 218 |  |  |             'format' => '15v2' | 
            
                                                                        
                            
            
                                    
            
            
                | 219 |  |  |         ], | 
            
                                                                        
                            
            
                                    
            
            
                | 220 |  |  |         'CST_COFINS' => [ | 
            
                                                                        
                            
            
                                    
            
            
                | 221 |  |  |             'type' => 'numeric', | 
            
                                                                        
                            
            
                                    
            
            
                | 222 |  |  |             'regex' => '^(\d{2})$', | 
            
                                                                        
                            
            
                                    
            
            
                | 223 |  |  |             'required' => false, | 
            
                                                                        
                            
            
                                    
            
            
                | 224 |  |  |             'info' => 'Código da Situação Tributária referente ao COFINS.', | 
            
                                                                        
                            
            
                                    
            
            
                | 225 |  |  |             'format' => '' | 
            
                                                                        
                            
            
                                    
            
            
                | 226 |  |  |         ], | 
            
                                                                        
                            
            
                                    
            
            
                | 227 |  |  |         'VL_BC_COFINS' => [ | 
            
                                                                        
                            
            
                                    
            
            
                | 228 |  |  |             'type' => 'numeric', | 
            
                                                                        
                            
            
                                    
            
            
                | 229 |  |  |             'regex' => '^\d+(\.\d*)?|\.\d+$', | 
            
                                                                        
                            
            
                                    
            
            
                | 230 |  |  |             'required' => false, | 
            
                                                                        
                            
            
                                    
            
            
                | 231 |  |  |             'info' => 'Valor da base de cálculo da COFINS', | 
            
                                                                        
                            
            
                                    
            
            
                | 232 |  |  |             'format' => '15v2' | 
            
                                                                        
                            
            
                                    
            
            
                | 233 |  |  |         ], | 
            
                                                                        
                            
            
                                    
            
            
                | 234 |  |  |         'ALIQ_COFINS' => [ | 
            
                                                                        
                            
            
                                    
            
            
                | 235 |  |  |             'type' => 'numeric', | 
            
                                                                        
                            
            
                                    
            
            
                | 236 |  |  |             'regex' => '^\d+(\.\d*)?|\.\d+$', | 
            
                                                                        
                            
            
                                    
            
            
                | 237 |  |  |             'required' => false, | 
            
                                                                        
                            
            
                                    
            
            
                | 238 |  |  |             'info' => 'Alíquota do COFINS (em percentual)', | 
            
                                                                        
                            
            
                                    
            
            
                | 239 |  |  |             'format' => '8v4' | 
            
                                                                        
                            
            
                                    
            
            
                | 240 |  |  |         ], | 
            
                                                                        
                            
            
                                    
            
            
                | 241 |  |  |         'QUANT_BC_COFINS' => [ | 
            
                                                                        
                            
            
                                    
            
            
                | 242 |  |  |             'type' => 'numeric', | 
            
                                                                        
                            
            
                                    
            
            
                | 243 |  |  |             'regex' => '^\d+(\.\d*)?|\.\d+$', | 
            
                                                                        
                            
            
                                    
            
            
                | 244 |  |  |             'required' => false, | 
            
                                                                        
                            
            
                                    
            
            
                | 245 |  |  |             'info' => 'Quantidade – Base de cálculo COFINS', | 
            
                                                                        
                            
            
                                    
            
            
                | 246 |  |  |             'format' => '15v3' | 
            
                                                                        
                            
            
                                    
            
            
                | 247 |  |  |         ], | 
            
                                                                        
                            
            
                                    
            
            
                | 248 |  |  |         'ALIQ_COFINS_QUANT' => [ | 
            
                                                                        
                            
            
                                    
            
            
                | 249 |  |  |             'type' => 'numeric', | 
            
                                                                        
                            
            
                                    
            
            
                | 250 |  |  |             'regex' => '^\d+(\.\d*)?|\.\d+$', | 
            
                                                                        
                            
            
                                    
            
            
                | 251 |  |  |             'required' => false, | 
            
                                                                        
                            
            
                                    
            
            
                | 252 |  |  |             'info' => 'Alíquota da COFINS (em reais)', | 
            
                                                                        
                            
            
                                    
            
            
                | 253 |  |  |             'format' => '15v4' | 
            
                                                                        
                            
            
                                    
            
            
                | 254 |  |  |         ], | 
            
                                                                        
                            
            
                                    
            
            
                | 255 |  |  |         'VL_COFINS' => [ | 
            
                                                                        
                            
            
                                    
            
            
                | 256 |  |  |             'type' => 'numeric', | 
            
                                                                        
                            
            
                                    
            
            
                | 257 |  |  |             'regex' => '^\d+(\.\d*)?|\.\d+$', | 
            
                                                                        
                            
            
                                    
            
            
                | 258 |  |  |             'required' => false, | 
            
                                                                        
                            
            
                                    
            
            
                | 259 |  |  |             'info' => 'Valor da COFINS', | 
            
                                                                        
                            
            
                                    
            
            
                | 260 |  |  |             'format' => '15v2' | 
            
                                                                        
                            
            
                                    
            
            
                | 261 |  |  |         ], | 
            
                                                                        
                            
            
                                    
            
            
                | 262 |  |  |         'COD_CTA' => [ | 
            
                                                                        
                            
            
                                    
            
            
                | 263 |  |  |             'type' => 'string', | 
            
                                                                        
                            
            
                                    
            
            
                | 264 |  |  |             'regex' => '^.{0,255}$', | 
            
                                                                        
                            
            
                                    
            
            
                | 265 |  |  |             'required' => false, | 
            
                                                                        
                            
            
                                    
            
            
                | 266 |  |  |             'info' => 'Código da conta analítica contábil debitada/creditada', | 
            
                                                                        
                            
            
                                    
            
            
                | 267 |  |  |             'format' => '' | 
            
                                                                        
                            
            
                                    
            
            
                | 268 |  |  |         ], | 
            
                                                                        
                            
            
                                    
            
            
                | 269 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 270 |  |  |     ]; | 
            
                                                                        
                            
            
                                    
            
            
                | 271 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 272 |  |  |     /** | 
            
                                                                        
                            
            
                                    
            
            
                | 273 |  |  |      * Constructor | 
            
                                                                        
                            
            
                                    
            
            
                | 274 |  |  |      * @param \stdClass $std | 
            
                                                                        
                            
            
                                    
            
            
                | 275 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 276 |  |  |     public function __construct(\stdClass $std) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 277 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 278 |  |  |         parent::__construct(self::REG); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 279 |  |  |         $this->std = $this->standarize($std); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 280 |  |  |         $this->postValidation(); | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 281 |  |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 282 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 283 |  |  |     public function postValidation() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 284 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 285 |  |  |         $multiplicacao = $this->values->vl_bc_cofins * $this->values->aliq_cofins / 100; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 286 |  |  |         if (isset($this->values->quant_bc_cofins) && $this->values->quant_bc_cofins > 0) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 287 |  |  |             $multiplicacao = $this->values->quant_bc_cofins * $this->values->aliq_cofins_quant; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 288 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 289 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 290 |  |  |         if (number_format($this->values->vl_cofins, 2) != number_format($multiplicacao, 2)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 291 |  |  |             $message = 'vl_cofins: '.$this->values->vl_cofins.'<br>'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 292 |  |  |             $message .= 'multiplicacao: '.$multiplicacao.'<br>'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 293 |  |  |             echo $message; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 294 |  |  |             throw new \InvalidArgumentException("[" . self::REG . "] " . | 
            
                                                                                                            
                            
            
                                    
            
            
                | 295 |  |  |                 "O campo VL_COFINS deve de ser o calculo da multiplicacao " . | 
            
                                                                                                            
                            
            
                                    
            
            
                | 296 |  |  |                 "da base de calculo do cofins com a aliquota do cofins"); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 297 |  |  |         } | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 298 |  |  |     } | 
            
                                                        
            
                                    
            
            
                | 299 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 300 |  |  |  |