@@ -7,7 +7,7 @@ |
||
| 7 | 7 | |
| 8 | 8 | class NFeService extends NFePHP |
| 9 | 9 | { |
| 10 | - public function createNfe(Order $order, $model, $version = '4.0') |
|
| 10 | + public function createNfe(Order $order, $model, $version = '4.0') |
|
| 11 | 11 | { |
| 12 | 12 | |
| 13 | 13 | $this->model = $model; |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | //prod OBRIGATÓRIA |
| 134 | 134 | protected function makeProds(Order $order) |
| 135 | 135 | { |
| 136 | - $orderProducts = $order->getOrderProducts(); |
|
| 136 | + $orderProducts = $order->getOrderProducts(); |
|
| 137 | 137 | $item = 1; |
| 138 | 138 | foreach ($orderProducts as $orderProducts) { |
| 139 | 139 | $product = $orderProducts->getProduct(); |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | //infNFe OBRIGATÓRIA |
| 197 | 197 | $std = new \stdClass(); |
| 198 | 198 | $std->Id = ''; |
| 199 | - $std->versao = $version; |
|
| 199 | + $std->versao = $version; |
|
| 200 | 200 | $this->make->taginfNFe($std); |
| 201 | 201 | } |
| 202 | 202 | |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | |
| 62 | 62 | |
| 63 | 63 | |
| 64 | - $certPath = $this->appKernel->getProjectDir() . $dacteKey->getConfigValue(); |
|
| 64 | + $certPath = $this->appKernel->getProjectDir().$dacteKey->getConfigValue(); |
|
| 65 | 65 | if (!is_file($certPath)) |
| 66 | 66 | throw new \Exception("DACTE key cert path is invalid", 1); |
| 67 | 67 | |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | $infCte->versao = "3.00"; |
| 125 | 125 | $cte->taginfCTe($infCte); |
| 126 | 126 | |
| 127 | - $cDV = substr($chave, -1); //Digito Verificador |
|
| 127 | + $cDV = substr($chave, -1); //Digito Verificador |
|
| 128 | 128 | |
| 129 | 129 | |
| 130 | 130 | /** |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | $ide->xDetRetira = ''; // Detalhes do retira |
| 185 | 185 | $ide->indIEToma = '1'; |
| 186 | 186 | $ide->dhCont = ''; // Data e Hora da entrada em contingência; no formato AAAAMM-DDTHH:MM:SS |
| 187 | - $ide->xJust = ''; // Justificativa da entrada em contingência |
|
| 187 | + $ide->xJust = ''; // Justificativa da entrada em contingência |
|
| 188 | 188 | |
| 189 | 189 | $cte->tagide($ide); |
| 190 | 190 | |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | $enderToma->CEP = '95720000'; // CEP |
| 221 | 221 | $enderToma->UF = $arr['siglaUF']; // Sigla UF (Informar EX para operações com o exterior.) |
| 222 | 222 | $enderToma->cPais = '1058'; // Codigo do país ( Utilizar a tabela do BACEN ) |
| 223 | - $enderToma->xPais = 'Brasil'; // Nome do pais |
|
| 223 | + $enderToma->xPais = 'Brasil'; // Nome do pais |
|
| 224 | 224 | $cte->tagenderToma($enderToma); |
| 225 | 225 | |
| 226 | 226 | |
@@ -241,9 +241,9 @@ discard block |
||
| 241 | 241 | $enderEmit->xBairro = $providerAddress->getStreet()->getDistrict()->getDistrict(); // Bairro |
| 242 | 242 | $enderEmit->xMun = $providerAddress->getStreet()->getDistrict()->getCity()->getCity(); // Nome do municipio |
| 243 | 243 | $enderEmit->CEP = $providerAddress->getStreet()->getCep()->getCep(); // CEP |
| 244 | - $enderEmit->UF = $providerAddress->getStreet()->getDistrict()->getCity()->getState()->getUf(); // Sigla UF |
|
| 244 | + $enderEmit->UF = $providerAddress->getStreet()->getDistrict()->getCity()->getState()->getUf(); // Sigla UF |
|
| 245 | 245 | $enderEmit->cMun = $this->getCodMunicipio($enderEmit->xMun, $enderEmit->UF); // Código do município (utilizar a tabela do IBGE) |
| 246 | - $enderEmit->fone = $provider->getPhone()[0]->getDdd() . $provider->getPhone()[0]->getPhone(); // Fone |
|
| 246 | + $enderEmit->fone = $provider->getPhone()[0]->getDdd().$provider->getPhone()[0]->getPhone(); // Fone |
|
| 247 | 247 | $cte->tagenderEmit($enderEmit); |
| 248 | 248 | |
| 249 | 249 | |
@@ -319,13 +319,13 @@ discard block |
||
| 319 | 319 | |
| 320 | 320 | $vPrest = new \stdClass(); |
| 321 | 321 | $vPrest->vTPrest = $data->getPrice(); // Valor total da prestacao do servico |
| 322 | - $vPrest->vRec = $data->getPrice(); // Valor a receber |
|
| 322 | + $vPrest->vRec = $data->getPrice(); // Valor a receber |
|
| 323 | 323 | $cte->tagvPrest($vPrest); |
| 324 | 324 | |
| 325 | 325 | |
| 326 | 326 | $comp = new \stdClass(); |
| 327 | 327 | $comp->xNome = 'FRETE VALOR'; // Nome do componente |
| 328 | - $comp->vComp = '3334.32'; // Valor do componente |
|
| 328 | + $comp->vComp = '3334.32'; // Valor do componente |
|
| 329 | 329 | $cte->tagComp($comp); |
| 330 | 330 | |
| 331 | 331 | $icms = new \stdClass(); |
@@ -339,14 +339,14 @@ discard block |
||
| 339 | 339 | $icms->pICMSSTRet = ''; // Alíquota do ICMS |
| 340 | 340 | $icms->vCred = ''; // Valor do Crédito Outorgado/Presumido |
| 341 | 341 | $icms->vTotTrib = 754.38; // Valor de tributos federais; estaduais e municipais |
| 342 | - $icms->outraUF = false; // ICMS devido à UF de origem da prestação; quando diferente da UF do emitente |
|
| 342 | + $icms->outraUF = false; // ICMS devido à UF de origem da prestação; quando diferente da UF do emitente |
|
| 343 | 343 | $icms->vICMSUFIni = 0; |
| 344 | 344 | $icms->vICMSUFFim = 0; |
| 345 | 345 | $icms->infAdFisco = 'Informações ao fisco'; |
| 346 | 346 | $cte->tagicms($icms); |
| 347 | 347 | |
| 348 | 348 | |
| 349 | - $cte->taginfCTeNorm(); // Grupo de informações do CT-e Normal e Substituto |
|
| 349 | + $cte->taginfCTeNorm(); // Grupo de informações do CT-e Normal e Substituto |
|
| 350 | 350 | |
| 351 | 351 | |
| 352 | 352 | $infCarga = new \stdClass(); |
@@ -360,18 +360,18 @@ discard block |
||
| 360 | 360 | $infQ->cUnid = '01'; // Código da Unidade de Medida: ( 00-M3; 01-KG; 02-TON; 03-UNIDADE; 04-LITROS; 05-MMBTU |
| 361 | 361 | $infQ->tpMed = 'ESTRADO'; // Tipo de Medida |
| 362 | 362 | // ( PESO BRUTO; PESO DECLARADO; PESO CUBADO; PESO AFORADO; PESO AFERIDO; LITRAGEM; CAIXAS e etc) |
| 363 | - $infQ->qCarga = 18145.0000; // Quantidade (15 posições; sendo 11 inteiras e 4 decimais.) |
|
| 363 | + $infQ->qCarga = 18145.0000; // Quantidade (15 posições; sendo 11 inteiras e 4 decimais.) |
|
| 364 | 364 | $cte->taginfQ($infQ); |
| 365 | 365 | $infQ->cUnid = '02'; // Código da Unidade de Medida: ( 00-M3; 01-KG; 02-TON; 03-UNIDADE; 04-LITROS; 05-MMBTU |
| 366 | 366 | $infQ->tpMed = 'OUTROS'; // Tipo de Medida |
| 367 | 367 | // ( PESO BRUTO; PESO DECLARADO; PESO CUBADO; PESO AFORADO; PESO AFERIDO; LITRAGEM; CAIXAS e etc) |
| 368 | - $infQ->qCarga = 31145.0000; // Quantidade (15 posições; sendo 11 inteiras e 4 decimais.) |
|
| 368 | + $infQ->qCarga = 31145.0000; // Quantidade (15 posições; sendo 11 inteiras e 4 decimais.) |
|
| 369 | 369 | $cte->taginfQ($infQ); |
| 370 | 370 | |
| 371 | 371 | $infNFe = new \stdClass(); |
| 372 | 372 | $infNFe->chave = '43160472202112000136550000000010571048440722'; // Chave de acesso da NF-e |
| 373 | 373 | $infNFe->PIN = ''; // PIN SUFRAMA |
| 374 | - $infNFe->dPrev = '2016-10-30'; // Data prevista de entrega |
|
| 374 | + $infNFe->dPrev = '2016-10-30'; // Data prevista de entrega |
|
| 375 | 375 | $cte->taginfNFe($infNFe); |
| 376 | 376 | |
| 377 | 377 | $infModal = new \stdClass(); |
@@ -476,7 +476,7 @@ discard block |
||
| 476 | 476 | $tpEmis, |
| 477 | 477 | $codigo |
| 478 | 478 | ); |
| 479 | - return $chave . $this->calculaDV($chave); |
|
| 479 | + return $chave.$this->calculaDV($chave); |
|
| 480 | 480 | } |
| 481 | 481 | |
| 482 | 482 | protected function sign($xml) |
@@ -56,14 +56,16 @@ |
||
| 56 | 56 | 'people' => $provider, |
| 57 | 57 | 'config_key' => 'dacte-key-pass' |
| 58 | 58 | ]); |
| 59 | - if (!$dacteKey || !$dacteKeyPass) |
|
| 60 | - throw new \Exception("DACTE key cert is required", 1); |
|
| 59 | + if (!$dacteKey || !$dacteKeyPass) { |
|
| 60 | + throw new \Exception("DACTE key cert is required", 1); |
|
| 61 | + } |
|
| 61 | 62 | |
| 62 | 63 | |
| 63 | 64 | |
| 64 | 65 | $certPath = $this->appKernel->getProjectDir() . $dacteKey->getConfigValue(); |
| 65 | - if (!is_file($certPath)) |
|
| 66 | - throw new \Exception("DACTE key cert path is invalid", 1); |
|
| 66 | + if (!is_file($certPath)) { |
|
| 67 | + throw new \Exception("DACTE key cert path is invalid", 1); |
|
| 68 | + } |
|
| 67 | 69 | |
| 68 | 70 | |
| 69 | 71 | /** |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | |
| 45 | 45 | public function downloadNf(InvoiceTax $invoiceTax, $format = 'pdf') |
| 46 | 46 | { |
| 47 | - $method = 'get' . ucfirst(strtolower($format)); |
|
| 47 | + $method = 'get'.ucfirst(strtolower($format)); |
|
| 48 | 48 | if (method_exists($this, $method) === false) |
| 49 | 49 | throw new InvalidValueException( |
| 50 | 50 | sprintf('Format "%s" is not available', $format) |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | if (($content = $this->$method($invoiceTax)) === null) |
| 54 | 54 | throw new InvalidValueException('File content is empty'); |
| 55 | 55 | |
| 56 | - $response = new StreamedResponse(function () use ($content) { |
|
| 56 | + $response = new StreamedResponse(function() use ($content) { |
|
| 57 | 57 | fputs(fopen('php://output', 'wb'), $content); |
| 58 | 58 | }); |
| 59 | 59 | |
@@ -114,10 +114,10 @@ discard block |
||
| 114 | 114 | return $pixel; |
| 115 | 115 | |
| 116 | 116 | if (($file = $people->getFile()) !== null) { |
| 117 | - $path = $root . '/' . $file->getPath(); |
|
| 117 | + $path = $root.'/'.$file->getPath(); |
|
| 118 | 118 | |
| 119 | 119 | if (strpos($file->getPath(), 'data/') !== false) |
| 120 | - $path = $root . '/' . str_replace('data/', 'public/', $file->getPath()); |
|
| 120 | + $path = $root.'/'.str_replace('data/', 'public/', $file->getPath()); |
|
| 121 | 121 | |
| 122 | 122 | $parts = pathinfo($path); |
| 123 | 123 | if ($parts['extension'] != 'jpg') |
@@ -45,13 +45,15 @@ discard block |
||
| 45 | 45 | public function downloadNf(InvoiceTax $invoiceTax, $format = 'pdf') |
| 46 | 46 | { |
| 47 | 47 | $method = 'get' . ucfirst(strtolower($format)); |
| 48 | - if (method_exists($this, $method) === false) |
|
| 49 | - throw new InvalidValueException( |
|
| 48 | + if (method_exists($this, $method) === false) { |
|
| 49 | + throw new InvalidValueException( |
|
| 50 | 50 | sprintf('Format "%s" is not available', $format) |
| 51 | 51 | ); |
| 52 | + } |
|
| 52 | 53 | |
| 53 | - if (($content = $this->$method($invoiceTax)) === null) |
|
| 54 | - throw new InvalidValueException('File content is empty'); |
|
| 54 | + if (($content = $this->$method($invoiceTax)) === null) { |
|
| 55 | + throw new InvalidValueException('File content is empty'); |
|
| 56 | + } |
|
| 55 | 57 | |
| 56 | 58 | $response = new StreamedResponse(function () use ($content) { |
| 57 | 59 | fputs(fopen('php://output', 'wb'), $content); |
@@ -110,18 +112,21 @@ discard block |
||
| 110 | 112 | $pixel = sprintf('%s/data/files/users/white-pixel.jpg', $root); |
| 111 | 113 | $path = $pixel; |
| 112 | 114 | |
| 113 | - if ($people === null) |
|
| 114 | - return $pixel; |
|
| 115 | + if ($people === null) { |
|
| 116 | + return $pixel; |
|
| 117 | + } |
|
| 115 | 118 | |
| 116 | 119 | if (($file = $people->getFile()) !== null) { |
| 117 | 120 | $path = $root . '/' . $file->getPath(); |
| 118 | 121 | |
| 119 | - if (strpos($file->getPath(), 'data/') !== false) |
|
| 120 | - $path = $root . '/' . str_replace('data/', 'public/', $file->getPath()); |
|
| 122 | + if (strpos($file->getPath(), 'data/') !== false) { |
|
| 123 | + $path = $root . '/' . str_replace('data/', 'public/', $file->getPath()); |
|
| 124 | + } |
|
| 121 | 125 | |
| 122 | 126 | $parts = pathinfo($path); |
| 123 | - if ($parts['extension'] != 'jpg') |
|
| 124 | - return $pixel; |
|
| 127 | + if ($parts['extension'] != 'jpg') { |
|
| 128 | + return $pixel; |
|
| 129 | + } |
|
| 125 | 130 | } |
| 126 | 131 | |
| 127 | 132 | return $path; |