Completed
Pull Request — master (#272)
by Roberto
08:17
created
src/NFe/Danfe.php 3 patches
Doc Comments   +22 added lines, -16 removed lines patch added patch discarded remove patch
@@ -267,8 +267,6 @@  discard block
 block discarded – undo
267 267
      * __construct
268 268
      *
269 269
      * @name  __construct
270
-     * @param string  $docXML      Conteúdo XML da NF-e (com ou sem a tag nfeProc)
271
-     * @param string  $logoimage   Caminho para o arquivo do logo
272 270
      */
273 271
     public function __construct(
274 272
         $xml
@@ -854,8 +852,8 @@  discard block
 block discarded – undo
854 852
      *header
855 853
      * Monta o cabelhalho da DANFE (retrato e paisagem)
856 854
      *
857
-     * @param  number $x      Posição horizontal inicial, canto esquerdo
858
-     * @param  number $y      Posição vertical inicial, canto superior
855
+     * @param  integer $x      Posição horizontal inicial, canto esquerdo
856
+     * @param  integer $y      Posição vertical inicial, canto superior
859 857
      * @param  number $pag    Número da Página
860 858
      * @param  number $totPag Total de páginas
861 859
      * @return number Posição vertical final
@@ -1321,8 +1319,8 @@  discard block
 block discarded – undo
1321 1319
      * Monta o campo com os dados do destinatário na DANFE. (retrato e paisagem)
1322 1320
      *
1323 1321
      * @name   destinatarioDANFE
1324
-     * @param  number $x Posição horizontal canto esquerdo
1325
-     * @param  number $y Posição vertical canto superior
1322
+     * @param  integer $x Posição horizontal canto esquerdo
1323
+     * @param  integer $y Posição vertical canto superior
1326 1324
      * @return number Posição vertical final
1327 1325
      */
1328 1326
     protected function destinatarioDANFE($x = 0, $y = 0)
@@ -1522,7 +1520,7 @@  discard block
 block discarded – undo
1522 1520
      * Gera a String do Texto da Fatura
1523 1521
       *
1524 1522
      * @name   getTextoFatura
1525
-     * @return uma String com o texto ou "";
1523
+     * @return string String com o texto ou "";
1526 1524
      */
1527 1525
     protected function getTextoFatura()
1528 1526
     {
@@ -1576,8 +1574,8 @@  discard block
 block discarded – undo
1576 1574
      * Monta o campo de duplicatas da DANFE (retrato e paisagem)
1577 1575
      *
1578 1576
      * @name   fatura
1579
-     * @param  number $x Posição horizontal canto esquerdo
1580
-     * @param  number $y Posição vertical canto superior
1577
+     * @param  integer $x Posição horizontal canto esquerdo
1578
+     * @param  double $y Posição vertical canto superior
1581 1579
      * @return number Posição vertical final
1582 1580
      */
1583 1581
     protected function fatura($x, $y)
@@ -1696,8 +1694,8 @@  discard block
 block discarded – undo
1696 1694
      * Monta o campo de pagamentos da DANFE (retrato e paisagem) (foi baseada na fatura)
1697 1695
      *
1698 1696
      * @name   pagamento
1699
-     * @param  number $x Posição horizontal canto esquerdo
1700
-     * @param  number $y Posição vertical canto superior
1697
+     * @param  integer $x Posição horizontal canto esquerdo
1698
+     * @param  double $y Posição vertical canto superior
1701 1699
      * @return number Posição vertical final
1702 1700
      */
1703 1701
     protected function pagamento($x, $y)
@@ -1803,6 +1801,8 @@  discard block
 block discarded – undo
1803 1801
      * @param  float $h Altura do campo
1804 1802
      * @param  float $h Título do campo
1805 1803
      * @param  float $h Valor do imposto
1804
+     * @param string $titulo
1805
+     * @param string $campoImposto
1806 1806
      * @return float Sugestão do $x do próximo imposto
1807 1807
      */
1808 1808
     protected function impostoHelper($x, $y, $w, $h, $titulo, $campoImposto)
@@ -1829,9 +1829,9 @@  discard block
 block discarded – undo
1829 1829
      * imposto
1830 1830
      * Monta o campo de impostos e totais da DANFE (retrato e paisagem)
1831 1831
      *
1832
-     * @param  number $x Posição horizontal canto esquerdo
1833
-     * @param  number $y Posição vertical canto superior
1834
-     * @return number Posição vertical final
1832
+     * @param  integer $x Posição horizontal canto esquerdo
1833
+     * @param  double $y Posição vertical canto superior
1834
+     * @return double Posição vertical final
1835 1835
      */
1836 1836
     protected function imposto($x, $y)
1837 1837
     {
@@ -2213,6 +2213,10 @@  discard block
 block discarded – undo
2213 2213
 
2214 2214
 
2215 2215
 
2216
+    /**
2217
+     * @param string $campo
2218
+     * @param string $formato
2219
+     */
2216 2220
     protected function descricaoProdutoHelper($origem, $campo, $formato)
2217 2221
     {
2218 2222
         $valor_original = $origem->getElementsByTagName($campo)->item(0);
@@ -2316,7 +2320,6 @@  discard block
 block discarded – undo
2316 2320
      * @param  float $x       Posição horizontal canto esquerdo
2317 2321
      * @param  float $y       Posição vertical canto superior
2318 2322
      * @param  float $nInicio Número do item inicial
2319
-     * @param  float $max     Número do item final
2320 2323
      * @param  float $hmax    Altura máxima do campo de itens em mm
2321 2324
      * @return float Posição vertical final
2322 2325
      */
@@ -2982,7 +2985,7 @@  discard block
 block discarded – undo
2982 2985
      * Monta o canhoto da DANFE (retrato e paisagem)
2983 2986
      *
2984 2987
      * @name   canhotoDANFE
2985
-     * @param  number $x Posição horizontal canto esquerdo
2988
+     * @param  integer $x Posição horizontal canto esquerdo
2986 2989
      * @param  number $y Posição vertical canto superior
2987 2990
      * @return number Posição vertical final
2988 2991
      *
@@ -3314,6 +3317,9 @@  discard block
 block discarded – undo
3314 3317
         }
3315 3318
     }
3316 3319
     
3320
+    /**
3321
+     * @param string $original
3322
+     */
3317 3323
     private function imagePNGtoJPG($original)
3318 3324
     {
3319 3325
         $image = imagecreatefrompng($original);
Please login to merge, or discard this patch.
Indentation   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -27,10 +27,10 @@  discard block
 block discarded – undo
27 27
      * @var string
28 28
      */
29 29
     protected $numero_registro_dpec = '';
30
-     /**
31
-     * Parâmetro para exibir ou ocultar os valores do PIS/COFINS.
32
-     * @var boolean
33
-     */
30
+        /**
31
+         * Parâmetro para exibir ou ocultar os valores do PIS/COFINS.
32
+         * @var boolean
33
+         */
34 34
     protected $exibirPIS = true;
35 35
     /**
36 36
      * Parâmetro para exibir ou ocultar os valores do ICMS Interestadual e Valor Total dos Impostos.
@@ -464,7 +464,7 @@  discard block
 block discarded – undo
464 464
                 $this->textoAdic .= ". \r\n";
465 465
             }
466 466
             $this->textoAdic .= "LOCAL DE ENTREGA : ".$txRetCNPJ.'-'.$txRetxLgr.', '.$txRetnro.' '.$txRetxCpl.
467
-               ' - '.$txRetxBairro.' '.$txRetxMun.' - '.$txRetUF."\r\n";
467
+                ' - '.$txRetxBairro.' '.$txRetxMun.' - '.$txRetUF."\r\n";
468 468
         }
469 469
         //informações adicionais
470 470
         $this->textoAdic .= $this->geraInformacoesDasNotasReferenciadas();
@@ -865,7 +865,7 @@  discard block
 block discarded – undo
865 865
         $oldX = $x;
866 866
         $oldY = $y;
867 867
         if ($this->orientacao == 'P') {
868
-              $maxW = $this->wPrint;
868
+                $maxW = $this->wPrint;
869 869
         } else {
870 870
             if ($pag == 1) { // primeira página
871 871
                 $maxW = $this->wPrint - $this->wCanhoto;
@@ -1223,8 +1223,8 @@  discard block
 block discarded – undo
1223 1223
             $w = $maxW-(2*$x);
1224 1224
             $this->pdf->SetTextColor(200, 200, 200);
1225 1225
             $texto = "DANFE impresso em contingência -\n".
1226
-                     "DPEC regularmente recebido pela Receita\n".
1227
-                     "Federal do Brasil";
1226
+                        "DPEC regularmente recebido pela Receita\n".
1227
+                        "Federal do Brasil";
1228 1228
             $aFont = ['font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B'];
1229 1229
             $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1230 1230
             $this->pdf->SetTextColor(0, 0, 0);
@@ -1517,13 +1517,13 @@  discard block
 block discarded – undo
1517 1517
         return ($y + $h);
1518 1518
     } //fim da função destinatarioDANFE
1519 1519
 
1520
-     /**
1521
-     * getTextoFatura
1522
-     * Gera a String do Texto da Fatura
1523
-      *
1524
-     * @name   getTextoFatura
1525
-     * @return uma String com o texto ou "";
1526
-     */
1520
+        /**
1521
+         * getTextoFatura
1522
+         * Gera a String do Texto da Fatura
1523
+         *
1524
+         * @name   getTextoFatura
1525
+         * @return uma String com o texto ou "";
1526
+         */
1527 1527
     protected function getTextoFatura()
1528 1528
     {
1529 1529
         if (isset($this->cobr)) {
@@ -1554,13 +1554,13 @@  discard block
 block discarded – undo
1554 1554
         return "";
1555 1555
     }
1556 1556
 
1557
-     /**
1558
-     * sizeExtraTextoFatura
1559
-     * Calcula o espaço ocupado pelo texto da fatura. Este espaço só é utilizado quando não houver duplicata.
1560
-      *
1561
-     * @name   sizeExtraTextoFatura
1562
-     * @return integer
1563
-     */
1557
+        /**
1558
+         * sizeExtraTextoFatura
1559
+         * Calcula o espaço ocupado pelo texto da fatura. Este espaço só é utilizado quando não houver duplicata.
1560
+         *
1561
+         * @name   sizeExtraTextoFatura
1562
+         * @return integer
1563
+         */
1564 1564
     protected function sizeExtraTextoFatura()
1565 1565
     {
1566 1566
         $textoFatura = $this->getTextoFatura();
@@ -1737,7 +1737,7 @@  discard block
 block discarded – undo
1737 1737
                                     '11'=>'Vale Refeição','12'=>'Vale Presente','13'=>'Vale Combustível',
1738 1738
                                     '14'=>'Duplicata Mercantil','15'=>'Boleto','90'=>'Sem pagamento','99'=>'Outros'];
1739 1739
             $bandeira = ['01'=>'Visa','02'=>'Mastercard','03'=>'American','04'=>'Sorocred','05'=>'Diners',
1740
-                              '06'=>'Elo','07'=>'Hipercard','08'=>'Aura','09'=>'Cabal','99'=>'Outros'];
1740
+                                '06'=>'Elo','07'=>'Hipercard','08'=>'Aura','09'=>'Cabal','99'=>'Outros'];
1741 1741
             foreach ($this->detPag as $k => $d) {
1742 1742
                 $fPag = !empty($this->detPag->item($k)->getElementsByTagName('tPag')->item(0)->nodeValue)
1743 1743
                     ? $this->detPag->item($k)->getElementsByTagName('tPag')->item(0)->nodeValue : '0';
@@ -2373,7 +2373,7 @@  discard block
 block discarded – undo
2373 2373
         $w4 = round($w*0.05, 0);
2374 2374
         $texto = 'O/CSOSN';//Regime do Simples CRT = 1 ou CRT = 2
2375 2375
         if ($this->getTagValue($this->emit, 'CRT') == '3') {
2376
-             $texto = 'O/CST';//Regime Normal
2376
+                $texto = 'O/CST';//Regime Normal
2377 2377
         }
2378 2378
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2379 2379
         $this->pdf->textBox($x, $y, $w4, $h, $texto, $aFont, 'C', 'C', 0, '', false);
@@ -2748,7 +2748,7 @@  discard block
 block discarded – undo
2748 2748
         $this->pdf->textBox($x, $yVeic, $w1+40, $h, $texto, $aFont, 'T', 'L', 0, '');
2749 2749
         $yVeic += $h;
2750 2750
         $texto = 'Tipo.................: ' . ($renavamTiposVeiculos[intval($veiculoTipo)] ?? $veiculoTipo);
2751
-         $this->pdf->textBox($x, $yVeic, $w1+40, $h, $texto, $aFont, 'T', 'L', 0, '');
2751
+            $this->pdf->textBox($x, $yVeic, $w1+40, $h, $texto, $aFont, 'T', 'L', 0, '');
2752 2752
         $yVeic = $y + $h;
2753 2753
         $xVeic = $x + 65;
2754 2754
         $texto = 'Nº Motor: .........: ' . $veiculoMotor;
@@ -2882,9 +2882,9 @@  discard block
 block discarded – undo
2882 2882
         //DADOS ADICIONAIS
2883 2883
         $texto = "DADOS ADICIONAIS";
2884 2884
         if ($this->orientacao == 'P') {
2885
-              $w = $this->wPrint;
2885
+                $w = $this->wPrint;
2886 2886
         } else {
2887
-              $w = $this->wPrint-$this->wCanhoto;
2887
+                $w = $this->wPrint-$this->wCanhoto;
2888 2888
         }
2889 2889
         $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
2890 2890
         $this->pdf->textBox($x, $y, $w, 8, $texto, $aFont, 'T', 'L', 0, '');
@@ -2965,10 +2965,10 @@  discard block
 block discarded – undo
2965 2965
         
2966 2966
         $y = $this->maxH - 4;
2967 2967
         if ($this->orientacao == 'P') {
2968
-              $w = $this->wPrint;
2968
+                $w = $this->wPrint;
2969 2969
         } else {
2970
-              $w = $this->wPrint-$this->wCanhoto;
2971
-              $x = $this->wCanhoto;
2970
+                $w = $this->wPrint-$this->wCanhoto;
2971
+                $x = $this->wCanhoto;
2972 2972
         }
2973 2973
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>'I'];
2974 2974
         $texto = "Impresso em ". date('d/m/Y') . " as " . date('H:i:s');
Please login to merge, or discard this patch.
Spacing   +314 added lines, -315 removed lines patch added patch discarded remove patch
@@ -380,10 +380,10 @@  discard block
 block discarded – undo
380 380
         //total inicial de paginas
381 381
         $totPag = 1;
382 382
         //largura imprimivel em mm: largura da folha menos as margens esq/direita
383
-        $this->wPrint = $this->maxW-($margEsq * 2);
383
+        $this->wPrint = $this->maxW - ($margEsq * 2);
384 384
         //comprimento (altura) imprimivel em mm: altura da folha menos as margens
385 385
         //superior e inferior
386
-        $this->hPrint = $this->maxH-$margSup-$margInf;
386
+        $this->hPrint = $this->maxH - $margSup - $margInf;
387 387
         // estabelece contagem de paginas
388 388
         $this->pdf->aliasNbPages();
389 389
         // fixa as margens
@@ -421,9 +421,9 @@  discard block
 block discarded – undo
421 421
         }
422 422
         //calcular a altura necessária para os dados adicionais
423 423
         if ($this->orientacao == 'P') {
424
-            $this->wAdic = round($this->wPrint*0.66, 0);
424
+            $this->wAdic = round($this->wPrint * 0.66, 0);
425 425
         } else {
426
-            $this->wAdic = round(($this->wPrint-$this->wCanhoto)*0.5, 0);
426
+            $this->wAdic = round(($this->wPrint - $this->wCanhoto) * 0.5, 0);
427 427
         }
428 428
         $fontProduto = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>''];
429 429
         $this->textoAdic = '';
@@ -435,8 +435,8 @@  discard block
 block discarded – undo
435 435
             $txRetxBairro = $this->getTagValue($this->retirada, "xBairro");
436 436
             $txRetxMun = $this->getTagValue($this->retirada, "xMun");
437 437
             $txRetUF = $this->getTagValue($this->retirada, "UF");
438
-            $this->textoAdic .= "LOCAL DE RETIRADA : ".
439
-                    $txRetCNPJ.
438
+            $this->textoAdic .= "LOCAL DE RETIRADA : " .
439
+                    $txRetCNPJ .
440 440
                     '-' .
441 441
                     $txRetxLgr .
442 442
                     ', ' .
@@ -463,8 +463,8 @@  discard block
 block discarded – undo
463 463
             if ($this->textoAdic != '') {
464 464
                 $this->textoAdic .= ". \r\n";
465 465
             }
466
-            $this->textoAdic .= "LOCAL DE ENTREGA : ".$txRetCNPJ.'-'.$txRetxLgr.', '.$txRetnro.' '.$txRetxCpl.
467
-               ' - '.$txRetxBairro.' '.$txRetxMun.' - '.$txRetUF."\r\n";
466
+            $this->textoAdic .= "LOCAL DE ENTREGA : " . $txRetCNPJ . '-' . $txRetxLgr . ', ' . $txRetnro . ' ' . $txRetxCpl .
467
+               ' - ' . $txRetxBairro . ' ' . $txRetxMun . ' - ' . $txRetUF . "\r\n";
468 468
         }
469 469
         //informações adicionais
470 470
         $this->textoAdic .= $this->geraInformacoesDasNotasReferenciadas();
@@ -473,7 +473,7 @@  discard block
 block discarded – undo
473 473
             if ($this->textoAdic != '') {
474 474
                 $this->textoAdic .= ". \r\n";
475 475
             }
476
-            $this->textoAdic .= ! empty($this->getTagValue($this->infAdic, "infCpl")) ?
476
+            $this->textoAdic .= !empty($this->getTagValue($this->infAdic, "infCpl")) ?
477 477
                 'Inf. Contribuinte: ' .
478 478
                 $this->anfaveaDANFE($this->getTagValue($this->infAdic, "infCpl")) : '';
479 479
             $infPedido = $this->geraInformacoesDaTagCompra();
@@ -481,14 +481,14 @@  discard block
 block discarded – undo
481 481
                 $this->textoAdic .= $infPedido;
482 482
             }
483 483
             $this->textoAdic .= $this->getTagValue($this->dest, "email", ' Email do Destinatário: ');
484
-            $this->textoAdic .= ! empty($this->getTagValue($this->infAdic, "infAdFisco")) ?
484
+            $this->textoAdic .= !empty($this->getTagValue($this->infAdic, "infAdFisco")) ?
485 485
                 "\r\n Inf. fisco: " .
486 486
                 $this->getTagValue($this->infAdic, "infAdFisco") : '';
487 487
             $obsCont = $this->infAdic->getElementsByTagName("obsCont");
488 488
             if (isset($obsCont)) {
489 489
                 foreach ($obsCont as $obs) {
490
-                    $campo =  $obsCont->item($i)->getAttribute("xCampo");
491
-                    $xTexto = ! empty($obsCont->item($i)->getElementsByTagName("xTexto")->item(0)->nodeValue) ?
490
+                    $campo = $obsCont->item($i)->getAttribute("xCampo");
491
+                    $xTexto = !empty($obsCont->item($i)->getElementsByTagName("xTexto")->item(0)->nodeValue) ?
492 492
                         $obsCont->item($i)->getElementsByTagName("xTexto")->item(0)->nodeValue : '';
493 493
                     $this->textoAdic .= "\r\n" . $campo . ':  ' . trim($xTexto);
494 494
                     $i++;
@@ -516,37 +516,37 @@  discard block
 block discarded – undo
516 516
         foreach ($alinhas as $linha) {
517 517
             $numlinhasdados += $this->pdf->getNumLines($linha, $this->wAdic, $fontProduto);
518 518
         }
519
-        $hdadosadic = round(($numlinhasdados+3) * $this->pdf->fontSize, 0);
519
+        $hdadosadic = round(($numlinhasdados + 3) * $this->pdf->fontSize, 0);
520 520
         if ($hdadosadic < 10) {
521 521
             $hdadosadic = 10;
522 522
         }
523 523
         //altura disponivel para os campos da DANFE
524
-        $hcabecalho = 47;//para cabeçalho
525
-        $hdestinatario = 25;//para destinatario
526
-        $hduplicatas = 12;//para cada grupo de 7 duplicatas
527
-        $himposto = 18;// para imposto
528
-        $htransporte = 25;// para transporte
529
-        $hissqn = 11;// para issqn
530
-        $hfooter = 5;// para rodape
531
-        $hCabecItens = 4;//cabeçalho dos itens
524
+        $hcabecalho = 47; //para cabeçalho
525
+        $hdestinatario = 25; //para destinatario
526
+        $hduplicatas = 12; //para cada grupo de 7 duplicatas
527
+        $himposto = 18; // para imposto
528
+        $htransporte = 25; // para transporte
529
+        $hissqn = 11; // para issqn
530
+        $hfooter = 5; // para rodape
531
+        $hCabecItens = 4; //cabeçalho dos itens
532 532
         //alturas disponiveis para os dados
533 533
         $hDispo1 = $this->hPrint - 10 - ($hcabecalho +
534 534
             $hdestinatario + ($linhasDup * $hduplicatas) + $himposto + $htransporte +
535 535
             ($linhaISSQN * $hissqn) + $hdadosadic + $hfooter + $hCabecItens +
536 536
             $this->sizeExtraTextoFatura());
537 537
         if ($this->orientacao == 'P') {
538
-            $hDispo1 -= 24 * $this->qCanhoto;//para canhoto
538
+            $hDispo1 -= 24 * $this->qCanhoto; //para canhoto
539 539
             $w = $this->wPrint;
540 540
         } else {
541
-            $hcanhoto = $this->hPrint;//para canhoto
541
+            $hcanhoto = $this->hPrint; //para canhoto
542 542
             $w = $this->wPrint - $this->wCanhoto;
543 543
         }
544
-        $hDispo2 = $this->hPrint - 10 - ($hcabecalho + $hfooter + $hCabecItens)-4;
544
+        $hDispo2 = $this->hPrint - 10 - ($hcabecalho + $hfooter + $hCabecItens) - 4;
545 545
         //Contagem da altura ocupada para impressão dos itens
546 546
         $fontProduto = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>''];
547 547
         $numlinhas = 0;
548 548
         $hUsado = $hCabecItens;
549
-        $w2 = round($w*0.28, 0);
549
+        $w2 = round($w * 0.28, 0);
550 550
         $hDispo = $hDispo1;
551 551
         $totPag = 1;
552 552
         $i = 0;
@@ -559,7 +559,7 @@  discard block
 block discarded – undo
559 559
                 $hDispo = $hDispo2;
560 560
                 $hUsado = $hCabecItens;
561 561
                 // Remove canhoto para páginas secundárias em modo paisagem ('L')
562
-                $w2 = round($this->wPrint*0.28, 0);
562
+                $w2 = round($this->wPrint * 0.28, 0);
563 563
                 $i--; // decrementa para readicionar o item que não coube nessa pagina na outra.
564 564
             }
565 565
             $i++;
@@ -583,7 +583,7 @@  discard block
 block discarded – undo
583 583
         //coloca o cabeçalho
584 584
         $y = $this->header($x, $y, $pag, $totPag);
585 585
         //coloca os dados do destinatário
586
-        $y = $this->destinatarioDANFE($x, $y+1);
586
+        $y = $this->destinatarioDANFE($x, $y + 1);
587 587
         
588 588
         
589 589
         //Verifica as formas de pagamento da nota fiscal
@@ -597,29 +597,29 @@  discard block
 block discarded – undo
597 597
         }
598 598
         //caso tenha boleto imprimir fatura
599 599
         if ($this->dup->length > 0) {
600
-            $y = $this->fatura($x, $y+1);
600
+            $y = $this->fatura($x, $y + 1);
601 601
         } else {
602 602
             //Se somente tiver a forma de pagamento sem pagamento ou outros não imprimir nada
603
-            if (count($formaPag)=='1' && (isset($formaPag[90]) || isset($formaPag[99]))) {
603
+            if (count($formaPag) == '1' && (isset($formaPag[90]) || isset($formaPag[99]))) {
604 604
                 $y = $y;
605 605
             } else {
606 606
                 //caso tenha mais de uma forma de pagamento ou seja diferente de boleto exibe a
607 607
                 //forma de pagamento e o valor
608
-                $y = $this->pagamento($x, $y+1);
608
+                $y = $this->pagamento($x, $y + 1);
609 609
             }
610 610
         }
611 611
         //coloca os dados dos impostos e totais da NFe
612
-        $y = $this->imposto($x, $y+1);
612
+        $y = $this->imposto($x, $y + 1);
613 613
         //coloca os dados do trasnporte
614
-        $y = $this->transporte($x, $y+1);
614
+        $y = $this->transporte($x, $y + 1);
615 615
         //itens da DANFE
616 616
         $nInicial = 0;
617 617
 
618
-        $y = $this->itens($x, $y+1, $nInicial, $hDispo1, $pag, $totPag, $hCabecItens);
618
+        $y = $this->itens($x, $y + 1, $nInicial, $hDispo1, $pag, $totPag, $hCabecItens);
619 619
 
620 620
         //coloca os dados do ISSQN
621 621
         if ($linhaISSQN == 1) {
622
-            $y = $this->issqn($x, $y+4);
622
+            $y = $this->issqn($x, $y + 4);
623 623
         } else {
624 624
             $y += 4;
625 625
         }
@@ -648,7 +648,7 @@  discard block
 block discarded – undo
648 648
             //coloca o cabeçalho na página adicional
649 649
             $y = $this->header($x, $y, $n, $totPag);
650 650
             //coloca os itens na página adicional
651
-            $y = $this->itens($x, $y+1, $nInicial, $hDispo2, $n, $totPag, $hCabecItens);
651
+            $y = $this->itens($x, $y + 1, $nInicial, $hDispo2, $n, $totPag, $hCabecItens);
652 652
             //coloca o rodapé da página
653 653
             if ($this->orientacao == 'P') {
654 654
                 $this->rodape($xInic);
@@ -685,7 +685,7 @@  discard block
 block discarded – undo
685 685
         if ($startPos === false) {
686 686
             return $cdata;
687 687
         }
688
-        for ($x=$len; $x>0; $x--) {
688
+        for ($x = $len; $x > 0; $x--) {
689 689
             if (substr($cdata, $x, 1) == '>') {
690 690
                 $endPos = $x;
691 691
                 break;
@@ -696,15 +696,15 @@  discard block
 block discarded – undo
696 696
         } else {
697 697
             $parte1 = '';
698 698
         }
699
-        $parte2 = substr($cdata, $startPos, $endPos-$startPos+1);
699
+        $parte2 = substr($cdata, $startPos, $endPos - $startPos + 1);
700 700
         if ($endPos < $len) {
701 701
             $parte3 = substr($cdata, $endPos + 1, $len - $endPos - 1);
702 702
         } else {
703 703
             $parte3 = '';
704 704
         }
705
-        $texto = trim($parte1).' '.trim($parte3);
705
+        $texto = trim($parte1) . ' ' . trim($parte3);
706 706
         if (strpos($parte2, '<CDATA>') === false) {
707
-            $cdata = '<CDATA>'.$parte2.'</CDATA>';
707
+            $cdata = '<CDATA>' . $parte2 . '</CDATA>';
708 708
         } else {
709 709
             $cdata = $parte2;
710 710
         }
@@ -778,15 +778,15 @@  discard block
 block discarded – undo
778 778
         //grupo CADATA infCpl
779 779
         $t = $dom->getElementsByTagName('transmissor')->item(0);
780 780
         $r = $dom->getElementsByTagName('receptor')->item(0);
781
-        $versao = ! empty($dom->getElementsByTagName('versao')->item(0)->nodeValue) ?
782
-            'Versao:'.$dom->getElementsByTagName('versao')->item(0)->nodeValue.' ' : '';
783
-        $especieNF = ! empty($dom->getElementsByTagName('especieNF')->item(0)->nodeValue) ?
784
-            'Especie:'.$dom->getElementsByTagName('especieNF')->item(0)->nodeValue.' ' : '';
785
-        $fabEntrega = ! empty($dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue) ?
786
-            'Entrega:'.$dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue.' ' : '';
787
-        $dca = ! empty($dom->getElementsByTagName('dca')->item(0)->nodeValue) ?
788
-            'dca:'.$dom->getElementsByTagName('dca')->item(0)->nodeValue.' ' : '';
789
-        $texto .= "".$versao.$especieNF.$fabEntrega.$dca;
781
+        $versao = !empty($dom->getElementsByTagName('versao')->item(0)->nodeValue) ?
782
+            'Versao:' . $dom->getElementsByTagName('versao')->item(0)->nodeValue . ' ' : '';
783
+        $especieNF = !empty($dom->getElementsByTagName('especieNF')->item(0)->nodeValue) ?
784
+            'Especie:' . $dom->getElementsByTagName('especieNF')->item(0)->nodeValue . ' ' : '';
785
+        $fabEntrega = !empty($dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue) ?
786
+            'Entrega:' . $dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue . ' ' : '';
787
+        $dca = !empty($dom->getElementsByTagName('dca')->item(0)->nodeValue) ?
788
+            'dca:' . $dom->getElementsByTagName('dca')->item(0)->nodeValue . ' ' : '';
789
+        $texto .= "" . $versao . $especieNF . $fabEntrega . $dca;
790 790
         if (isset($t)) {
791 791
             if ($t->hasAttributes()) {
792 792
                 $texto .= " Transmissor ";
@@ -875,14 +875,14 @@  discard block
 block discarded – undo
875 875
         }
876 876
         //####################################################################################
877 877
         //coluna esquerda identificação do emitente
878
-        $w = round($maxW*0.41, 0);
878
+        $w = round($maxW * 0.41, 0);
879 879
         if ($this->orientacao == 'P') {
880 880
             $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>'I'];
881 881
         } else {
882 882
             $aFont = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B'];
883 883
         }
884 884
         $w1 = $w;
885
-        $h=32;
885
+        $h = 32;
886 886
         $oldY += $h;
887 887
         $this->pdf->textBox($x, $y, $w, $h);
888 888
         $texto = 'IDENTIFICAÇÃO DO EMITENTE';
@@ -903,39 +903,39 @@  discard block
 block discarded – undo
903 903
                 $type == 'jpg';
904 904
             }
905 905
             //largura da imagem em mm
906
-            $logoWmm = ($logoInfo[0]/72)*25.4;
906
+            $logoWmm = ($logoInfo[0] / 72) * 25.4;
907 907
             //altura da imagem em mm
908
-            $logoHmm = ($logoInfo[1]/72)*25.4;
909
-            if ($this->logoAlign=='L') {
910
-                $nImgW = round($w/3, 0);
911
-                $nImgH = round($logoHmm * ($nImgW/$logoWmm), 0);
912
-                $xImg = $x+1;
913
-                $yImg = round(($h-$nImgH)/2, 0)+$y;
908
+            $logoHmm = ($logoInfo[1] / 72) * 25.4;
909
+            if ($this->logoAlign == 'L') {
910
+                $nImgW = round($w / 3, 0);
911
+                $nImgH = round($logoHmm * ($nImgW / $logoWmm), 0);
912
+                $xImg = $x + 1;
913
+                $yImg = round(($h - $nImgH) / 2, 0) + $y;
914 914
                 //estabelecer posições do texto
915
-                $x1 = round($xImg + $nImgW +1, 0);
916
-                $y1 = round($h/3+$y, 0);
917
-                $tw = round(2*$w/3, 0);
918
-            } elseif ($this->logoAlign=='C') {
919
-                $nImgH = round($h/3, 0);
920
-                $nImgW = round($logoWmm * ($nImgH/$logoHmm), 0);
921
-                $xImg = round(($w-$nImgW)/2+$x, 0);
922
-                $yImg = $y+3;
915
+                $x1 = round($xImg + $nImgW + 1, 0);
916
+                $y1 = round($h / 3 + $y, 0);
917
+                $tw = round(2 * $w / 3, 0);
918
+            } elseif ($this->logoAlign == 'C') {
919
+                $nImgH = round($h / 3, 0);
920
+                $nImgW = round($logoWmm * ($nImgH / $logoHmm), 0);
921
+                $xImg = round(($w - $nImgW) / 2 + $x, 0);
922
+                $yImg = $y + 3;
923 923
                 $x1 = $x;
924 924
                 $y1 = round($yImg + $nImgH + 1, 0);
925 925
                 $tw = $w;
926
-            } elseif ($this->logoAlign=='R') {
927
-                $nImgW = round($w/3, 0);
928
-                $nImgH = round($logoHmm * ($nImgW/$logoWmm), 0);
929
-                $xImg = round($x+($w-(1+$nImgW)), 0);
930
-                $yImg = round(($h-$nImgH)/2, 0)+$y;
926
+            } elseif ($this->logoAlign == 'R') {
927
+                $nImgW = round($w / 3, 0);
928
+                $nImgH = round($logoHmm * ($nImgW / $logoWmm), 0);
929
+                $xImg = round($x + ($w - (1 + $nImgW)), 0);
930
+                $yImg = round(($h - $nImgH) / 2, 0) + $y;
931 931
                 $x1 = $x;
932
-                $y1 = round($h/3+$y, 0);
933
-                $tw = round(2*$w/3, 0);
934
-            } elseif ($this->logoAlign=='F') {
935
-                $nImgH = round($h-5, 0);
936
-                $nImgW = round($logoWmm * ($nImgH/$logoHmm), 0);
937
-                $xImg = round(($w-$nImgW)/2+$x, 0);
938
-                $yImg = $y+3;
932
+                $y1 = round($h / 3 + $y, 0);
933
+                $tw = round(2 * $w / 3, 0);
934
+            } elseif ($this->logoAlign == 'F') {
935
+                $nImgH = round($h - 5, 0);
936
+                $nImgW = round($logoWmm * ($nImgH / $logoHmm), 0);
937
+                $xImg = round(($w - $nImgW) / 2 + $x, 0);
938
+                $yImg = $y + 3;
939 939
                 $x1 = $x;
940 940
                 $y1 = round($yImg + $nImgH + 1, 0);
941 941
                 $tw = $w;
@@ -944,7 +944,7 @@  discard block
 block discarded – undo
944 944
             $this->pdf->Image($this->logomarca, $xImg, $yImg, $nImgW, $nImgH, $type);
945 945
         } else {
946 946
             $x1 = $x;
947
-            $y1 = round($h/3+$y, 0);
947
+            $y1 = round($h / 3 + $y, 0);
948 948
             $tw = $w;
949 949
         }
950 950
         // monta as informações apenas se diferente de full logo
@@ -954,9 +954,9 @@  discard block
 block discarded – undo
954 954
             $texto = $this->emit->getElementsByTagName("xNome")->item(0)->nodeValue;
955 955
             $this->pdf->textBox($x1, $y1, $tw, 8, $texto, $aFont, 'T', 'C', 0, '');
956 956
             //endereço
957
-            $y1 = $y1+5;
957
+            $y1 = $y1 + 5;
958 958
             $aFont = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>''];
959
-            $fone = ! empty($this->enderEmit->getElementsByTagName("fone")->item(0)->nodeValue)
959
+            $fone = !empty($this->enderEmit->getElementsByTagName("fone")->item(0)->nodeValue)
960 960
                  ? $this->enderEmit->getElementsByTagName("fone")->item(0)->nodeValue
961 961
                  : '';
962 962
             $lgr = $this->getTagValue($this->enderEmit, "xLgr");
@@ -976,34 +976,34 @@  discard block
 block discarded – undo
976 976
         //####################################################################################
977 977
         //coluna central Danfe
978 978
         $x += $w;
979
-        $w=round($maxW * 0.17, 0);//35;
979
+        $w = round($maxW * 0.17, 0); //35;
980 980
         $w2 = $w;
981 981
         $h = 32;
982 982
         $this->pdf->textBox($x, $y, $w, $h);
983 983
   
984 984
         $texto = "DANFE";
985 985
         $aFont = ['font'=>$this->fontePadrao, 'size'=>14, 'style'=>'B'];
986
-        $this->pdf->textBox($x, $y+1, $w, $h, $texto, $aFont, 'T', 'C', 0, '');
986
+        $this->pdf->textBox($x, $y + 1, $w, $h, $texto, $aFont, 'T', 'C', 0, '');
987 987
         $aFont = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>''];
988 988
         $texto = 'Documento Auxiliar da Nota Fiscal Eletrônica';
989 989
         $h = 20;
990
-        $this->pdf->textBox($x, $y+6, $w, $h, $texto, $aFont, 'T', 'C', 0, '', false);
990
+        $this->pdf->textBox($x, $y + 6, $w, $h, $texto, $aFont, 'T', 'C', 0, '', false);
991 991
         
992 992
 
993 993
         $aFont = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>''];
994 994
         $texto = '0 - ENTRADA';
995 995
         $y1 = $y + 14;
996 996
         $h = 8;
997
-        $this->pdf->textBox($x+2, $y1, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
997
+        $this->pdf->textBox($x + 2, $y1, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
998 998
         $texto = '1 - SAÍDA';
999 999
         $y1 = $y + 17;
1000
-        $this->pdf->textBox($x+2, $y1, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1000
+        $this->pdf->textBox($x + 2, $y1, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1001 1001
         //tipo de nF
1002 1002
         $aFont = ['font'=>$this->fontePadrao, 'size'=>12, 'style'=>'B'];
1003 1003
         $y1 = $y + 13;
1004 1004
         $h = 7;
1005 1005
         $texto = $this->ide->getElementsByTagName('tpNF')->item(0)->nodeValue;
1006
-        $this->pdf->textBox($x+27, $y1, 5, $h, $texto, $aFont, 'C', 'C', 1, '');
1006
+        $this->pdf->textBox($x + 27, $y1, 5, $h, $texto, $aFont, 'C', 'C', 1, '');
1007 1007
         //numero da NF
1008 1008
         $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'];
1009 1009
         $y1 = $y + 20;
@@ -1025,7 +1025,7 @@  discard block
 block discarded – undo
1025 1025
         //####################################################################################
1026 1026
         //coluna codigo de barras
1027 1027
         $x += $w;
1028
-        $w = ($maxW-$w1-$w2);//85;
1028
+        $w = ($maxW - $w1 - $w2); //85;
1029 1029
         $w3 = $w;
1030 1030
         $h = 32;
1031 1031
         $this->pdf->textBox($x, $y, $w, $h);
@@ -1034,22 +1034,22 @@  discard block
 block discarded – undo
1034 1034
         $bW = 75;
1035 1035
         $bH = 12;
1036 1036
         //codigo de barras
1037
-        $this->pdf->code128($x+(($w-$bW)/2), $y+2, $chave_acesso, $bW, $bH);
1037
+        $this->pdf->code128($x + (($w - $bW) / 2), $y + 2, $chave_acesso, $bW, $bH);
1038 1038
         //linhas divisorias
1039
-        $this->pdf->line($x, $y+4+$bH, $x+$w, $y+4+$bH);
1040
-        $this->pdf->line($x, $y+12+$bH, $x+$w, $y+12+$bH);
1039
+        $this->pdf->line($x, $y + 4 + $bH, $x + $w, $y + 4 + $bH);
1040
+        $this->pdf->line($x, $y + 12 + $bH, $x + $w, $y + 12 + $bH);
1041 1041
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1042
-        $y1 = $y+4+$bH;
1042
+        $y1 = $y + 4 + $bH;
1043 1043
         $h = 7;
1044 1044
         $texto = 'CHAVE DE ACESSO';
1045 1045
         $this->pdf->textBox($x, $y1, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1046 1046
         $aFont = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B'];
1047
-        $y1 = $y+8+$bH;
1047
+        $y1 = $y + 8 + $bH;
1048 1048
         $texto = $this->formatField($chave_acesso, $this->formatoChave);
1049
-        $this->pdf->textBox($x+2, $y1, $w-2, $h, $texto, $aFont, 'T', 'C', 0, '');
1050
-        $y1 = $y+12+$bH;
1049
+        $this->pdf->textBox($x + 2, $y1, $w - 2, $h, $texto, $aFont, 'T', 'C', 0, '');
1050
+        $y1 = $y + 12 + $bH;
1051 1051
         $aFont = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>''];
1052
-        $chaveContingencia="";
1052
+        $chaveContingencia = "";
1053 1053
         if ($this->notaDpec()) {
1054 1054
             $cabecalhoProtoAutorizacao = 'NÚMERO DE REGISTRO DPEC';
1055 1055
         } else {
@@ -1060,16 +1060,16 @@  discard block
 block discarded – undo
1060 1060
             $chaveContingencia = $this->geraChaveAdicionalDeContingencia();
1061 1061
             $this->pdf->setFillColor(0, 0, 0);
1062 1062
             //codigo de barras
1063
-            $this->pdf->code128($x+11, $y1+1, $chaveContingencia, $bW*.9, $bH/2);
1063
+            $this->pdf->code128($x + 11, $y1 + 1, $chaveContingencia, $bW * .9, $bH / 2);
1064 1064
         } else {
1065 1065
             $texto = 'Consulta de autenticidade no portal nacional da NF-e';
1066
-            $this->pdf->textBox($x+2, $y1, $w-2, $h, $texto, $aFont, 'T', 'C', 0, '');
1067
-            $y1 = $y+16+$bH;
1066
+            $this->pdf->textBox($x + 2, $y1, $w - 2, $h, $texto, $aFont, 'T', 'C', 0, '');
1067
+            $y1 = $y + 16 + $bH;
1068 1068
             $texto = 'www.nfe.fazenda.gov.br/portal ou no site da Sefaz Autorizadora';
1069 1069
             $this->pdf->textBox(
1070
-                $x+2,
1070
+                $x + 2,
1071 1071
                 $y1,
1072
-                $w-2,
1072
+                $w - 2,
1073 1073
                 $h,
1074 1074
                 $texto,
1075 1075
                 $aFont,
@@ -1085,7 +1085,7 @@  discard block
 block discarded – undo
1085 1085
         //natureza da operação
1086 1086
         $texto = 'NATUREZA DA OPERAÇÃO';
1087 1087
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1088
-        $w = $w1+$w2;
1088
+        $w = $w1 + $w2;
1089 1089
         $y = $oldY;
1090 1090
         $oldY += $h;
1091 1091
         $x = $oldX;
@@ -1115,7 +1115,7 @@  discard block
 block discarded – undo
1115 1115
                 $cStat = '';
1116 1116
             } else {
1117 1117
                 if (isset($this->nfeProc)) {
1118
-                    $texto = ! empty($this->nfeProc->getElementsByTagName("nProt")->item(0)->nodeValue) ?
1118
+                    $texto = !empty($this->nfeProc->getElementsByTagName("nProt")->item(0)->nodeValue) ?
1119 1119
                             $this->nfeProc->getElementsByTagName("nProt")->item(0)->nodeValue : '';
1120 1120
                     $tsHora = $this->convertTime($this->nfeProc->getElementsByTagName("dhRecbto")->item(0)->nodeValue);
1121 1121
                     if ($texto != '') {
@@ -1146,25 +1146,25 @@  discard block
 block discarded – undo
1146 1146
         $texto = 'INSCRIÇÃO ESTADUAL DO SUBST. TRIBUT.';
1147 1147
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1148 1148
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1149
-        $texto = ! empty($this->emit->getElementsByTagName("IEST")->item(0)->nodeValue)
1149
+        $texto = !empty($this->emit->getElementsByTagName("IEST")->item(0)->nodeValue)
1150 1150
              ? $this->emit->getElementsByTagName("IEST")->item(0)->nodeValue
1151 1151
              : '';
1152 1152
         $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'];
1153 1153
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1154 1154
         //CNPJ
1155 1155
         $x += $w;
1156
-        $w = ($maxW-(2*$w));
1156
+        $w = ($maxW - (2 * $w));
1157 1157
         $texto = 'CNPJ / CPF';
1158 1158
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1159 1159
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1160 1160
         //Pegando valor do CPF/CNPJ
1161
-        if (! empty($this->emit->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1161
+        if (!empty($this->emit->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1162 1162
             $texto = $this->formatField(
1163 1163
                 $this->emit->getElementsByTagName("CNPJ")->item(0)->nodeValue,
1164 1164
                 "###.###.###/####-##"
1165 1165
             );
1166 1166
         } else {
1167
-            $texto = ! empty($this->emit->getElementsByTagName("CPF")->item(0)->nodeValue) ?
1167
+            $texto = !empty($this->emit->getElementsByTagName("CPF")->item(0)->nodeValue) ?
1168 1168
                 $this->formatField(
1169 1169
                     $this->emit->getElementsByTagName("CPF")->item(0)->nodeValue,
1170 1170
                     "###.###.###-##"
@@ -1180,22 +1180,22 @@  discard block
 block discarded – undo
1180 1180
         $resp = $this->statusNFe();
1181 1181
         if (!$resp['status']) {
1182 1182
             $x = 10;
1183
-            $y = $this->hPrint-130;
1183
+            $y = $this->hPrint - 130;
1184 1184
             $h = 25;
1185
-            $w = $maxW-(2*$x);
1185
+            $w = $maxW - (2 * $x);
1186 1186
             $this->pdf->setTextColor(90, 90, 90);
1187 1187
             $texto = $resp['message'];
1188 1188
             $aFont = ['font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B'];
1189 1189
             $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1190 1190
             $y += $h;
1191 1191
             $h = 5;
1192
-            $w = $maxW-(2*$x);
1192
+            $w = $maxW - (2 * $x);
1193 1193
             if (isset($this->infProt) && $resp['status']) {
1194 1194
                 $xMotivo = $this->infProt->getElementsByTagName("xMotivo")->item(0)->nodeValue;
1195 1195
             } else {
1196 1196
                 $xMotivo = '';
1197 1197
             }
1198
-            $texto = "SEM VALOR FISCAL\n".$xMotivo;
1198
+            $texto = "SEM VALOR FISCAL\n" . $xMotivo;
1199 1199
             $aFont = ['font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B'];
1200 1200
             $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1201 1201
             $this->pdf->setTextColor(0, 0, 0);
@@ -1218,12 +1218,12 @@  discard block
 block discarded – undo
1218 1218
         if ($this->notaDpec() || $this->tpEmis == 4) {
1219 1219
             //DPEC
1220 1220
             $x = 10;
1221
-            $y = $this->hPrint-130;
1221
+            $y = $this->hPrint - 130;
1222 1222
             $h = 25;
1223
-            $w = $maxW-(2*$x);
1223
+            $w = $maxW - (2 * $x);
1224 1224
             $this->pdf->SetTextColor(200, 200, 200);
1225
-            $texto = "DANFE impresso em contingência -\n".
1226
-                     "DPEC regularmente recebido pela Receita\n".
1225
+            $texto = "DANFE impresso em contingência -\n" .
1226
+                     "DPEC regularmente recebido pela Receita\n" .
1227 1227
                      "Federal do Brasil";
1228 1228
             $aFont = ['font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B'];
1229 1229
             $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
@@ -1342,7 +1342,7 @@  discard block
 block discarded – undo
1342 1342
         $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
1343 1343
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1344 1344
         //NOME / RAZÃO SOCIAL
1345
-        $w = round($maxW*0.61, 0);
1345
+        $w = round($maxW * 0.61, 0);
1346 1346
         $w1 = $w;
1347 1347
         $y += 3;
1348 1348
         $texto = 'NOME / RAZÃO SOCIAL';
@@ -1357,19 +1357,19 @@  discard block
 block discarded – undo
1357 1357
         }
1358 1358
         //CNPJ / CPF
1359 1359
         $x += $w;
1360
-        $w = round($maxW*0.23, 0);
1360
+        $w = round($maxW * 0.23, 0);
1361 1361
         $w2 = $w;
1362 1362
         $texto = 'CNPJ / CPF';
1363 1363
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1364 1364
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1365 1365
         //Pegando valor do CPF/CNPJ
1366
-        if (! empty($this->dest->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1366
+        if (!empty($this->dest->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1367 1367
             $texto = $this->formatField(
1368 1368
                 $this->dest->getElementsByTagName("CNPJ")->item(0)->nodeValue,
1369 1369
                 "###.###.###/####-##"
1370 1370
             );
1371 1371
         } else {
1372
-            $texto = ! empty($this->dest->getElementsByTagName("CPF")->item(0)->nodeValue) ?
1372
+            $texto = !empty($this->dest->getElementsByTagName("CPF")->item(0)->nodeValue) ?
1373 1373
                     $this->formatField(
1374 1374
                         $this->dest->getElementsByTagName("CPF")->item(0)->nodeValue,
1375 1375
                         "###.###.###-##"
@@ -1379,15 +1379,15 @@  discard block
 block discarded – undo
1379 1379
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1380 1380
         //DATA DA EMISSÃO
1381 1381
         $x += $w;
1382
-        $w = $maxW-($w1+$w2);
1382
+        $w = $maxW - ($w1 + $w2);
1383 1383
         $wx = $w;
1384 1384
         $texto = 'DATA DA EMISSÃO';
1385 1385
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1386 1386
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1387
-        $dEmi = ! empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
1387
+        $dEmi = !empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
1388 1388
                 $this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue : '';
1389 1389
         if ($dEmi == '') {
1390
-            $dEmi = ! empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
1390
+            $dEmi = !empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
1391 1391
                     $this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue : '';
1392 1392
             $aDemi = explode('T', $dEmi);
1393 1393
             $dEmi = $aDemi[0];
@@ -1400,7 +1400,7 @@  discard block
 block discarded – undo
1400 1400
             $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 1, '');
1401 1401
         }
1402 1402
         //ENDEREÇO
1403
-        $w = round($maxW*0.47, 0);
1403
+        $w = round($maxW * 0.47, 0);
1404 1404
         $w1 = $w;
1405 1405
         $y += $h;
1406 1406
         $x = $oldX;
@@ -1415,7 +1415,7 @@  discard block
 block discarded – undo
1415 1415
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 0, '', true);
1416 1416
         //BAIRRO / DISTRITO
1417 1417
         $x += $w;
1418
-        $w = round($maxW*0.21, 0);
1418
+        $w = round($maxW * 0.21, 0);
1419 1419
         $w2 = $w;
1420 1420
         $texto = 'BAIRRO / DISTRITO';
1421 1421
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
@@ -1425,12 +1425,12 @@  discard block
 block discarded – undo
1425 1425
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1426 1426
         //CEP
1427 1427
         $x += $w;
1428
-        $w = $maxW-$w1-$w2-$wx;
1428
+        $w = $maxW - $w1 - $w2 - $wx;
1429 1429
         $w2 = $w;
1430 1430
         $texto = 'CEP';
1431 1431
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1432 1432
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1433
-        $texto = ! empty($this->dest->getElementsByTagName("CEP")->item(0)->nodeValue) ?
1433
+        $texto = !empty($this->dest->getElementsByTagName("CEP")->item(0)->nodeValue) ?
1434 1434
                 $this->dest->getElementsByTagName("CEP")->item(0)->nodeValue : '';
1435 1435
         $texto = $this->formatField($texto, "#####-###");
1436 1436
         $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'];
@@ -1441,10 +1441,10 @@  discard block
 block discarded – undo
1441 1441
         $texto = 'DATA DA SAÍDA/ENTRADA';
1442 1442
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1443 1443
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1444
-        $dSaiEnt = ! empty($this->ide->getElementsByTagName("dSaiEnt")->item(0)->nodeValue) ?
1444
+        $dSaiEnt = !empty($this->ide->getElementsByTagName("dSaiEnt")->item(0)->nodeValue) ?
1445 1445
                 $this->ide->getElementsByTagName("dSaiEnt")->item(0)->nodeValue : '';
1446 1446
         if ($dSaiEnt == '') {
1447
-            $dSaiEnt = ! empty($this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue) ?
1447
+            $dSaiEnt = !empty($this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue) ?
1448 1448
                     $this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue : '';
1449 1449
             $aDsaient = explode('T', $dSaiEnt);
1450 1450
             $dSaiEnt = $aDsaient[0];
@@ -1461,7 +1461,7 @@  discard block
 block discarded – undo
1461 1461
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1462 1462
         $texto = $this->dest->getElementsByTagName("xMun")->item(0)->nodeValue;
1463 1463
         if (strtoupper(trim($texto)) == "EXTERIOR" && $this->dest->getElementsByTagName("xPais")->length > 0) {
1464
-            $texto .= " - " .  $this->dest->getElementsByTagName("xPais")->item(0)->nodeValue;
1464
+            $texto .= " - " . $this->dest->getElementsByTagName("xPais")->item(0)->nodeValue;
1465 1465
         }
1466 1466
         $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'];
1467 1467
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 0, '');
@@ -1476,18 +1476,18 @@  discard block
 block discarded – undo
1476 1476
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1477 1477
         //FONE / FAX
1478 1478
         $x += $w;
1479
-        $w = round(($maxW -$w1-$wx-8)/2, 0);
1479
+        $w = round(($maxW - $w1 - $wx - 8) / 2, 0);
1480 1480
         $w3 = $w;
1481 1481
         $texto = 'FONE / FAX';
1482 1482
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1483 1483
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1484
-        $texto = ! empty($this->dest->getElementsByTagName("fone")->item(0)->nodeValue) ?
1484
+        $texto = !empty($this->dest->getElementsByTagName("fone")->item(0)->nodeValue) ?
1485 1485
                 $this->dest->getElementsByTagName("fone")->item(0)->nodeValue : '';
1486 1486
         $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'];
1487 1487
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1488 1488
         //INSCRIÇÃO ESTADUAL
1489 1489
         $x += $w;
1490
-        $w = $maxW -$w1-$wx-8-$w3;
1490
+        $w = $maxW - $w1 - $wx - 8 - $w3;
1491 1491
         $texto = 'INSCRIÇÃO ESTADUAL';
1492 1492
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1493 1493
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -1501,10 +1501,10 @@  discard block
 block discarded – undo
1501 1501
         $texto = 'HORA DA SAÍDA/ENTRADA';
1502 1502
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1503 1503
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1504
-        $hSaiEnt = ! empty($this->ide->getElementsByTagName("hSaiEnt")->item(0)->nodeValue) ?
1504
+        $hSaiEnt = !empty($this->ide->getElementsByTagName("hSaiEnt")->item(0)->nodeValue) ?
1505 1505
                 $this->ide->getElementsByTagName("hSaiEnt")->item(0)->nodeValue : '';
1506 1506
         if ($hSaiEnt == '') {
1507
-            $dhSaiEnt = ! empty($this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue) ?
1507
+            $dhSaiEnt = !empty($this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue) ?
1508 1508
                     $this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue : '';
1509 1509
             $tsDhSaiEnt = $this->convertTime($dhSaiEnt);
1510 1510
             if ($tsDhSaiEnt != '') {
@@ -1583,7 +1583,7 @@  discard block
 block discarded – undo
1583 1583
     protected function fatura($x, $y)
1584 1584
     {
1585 1585
         $linha = 1;
1586
-        $h = 8+3;
1586
+        $h = 8 + 3;
1587 1587
         $oldx = $x;
1588 1588
         $textoFatura = $this->getTextoFatura();
1589 1589
         //verificar se existem duplicatas
@@ -1616,27 +1616,27 @@  discard block
 block discarded – undo
1616 1616
                 return ($y + $h - 3);
1617 1617
             }
1618 1618
             if ($textoFatura !== "" && $this->exibirTextoFatura) {
1619
-                $myH=6;
1619
+                $myH = 6;
1620 1620
                 $myW = $this->wPrint;
1621 1621
                 if ($this->orientacao == 'L') {
1622 1622
                     $myW -= $this->wCanhoto;
1623 1623
                 }
1624 1624
                 $aFont = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>''];
1625 1625
                 $this->pdf->textBox($x, $y, $myW, $myH, $textoFatura, $aFont, 'C', 'L', 1, '');
1626
-                $y+=$myH+1;
1626
+                $y += $myH + 1;
1627 1627
             }
1628 1628
             if ($this->orientacao == 'P') {
1629
-                $w = round($this->wPrint/7.018, 0)-1;
1629
+                $w = round($this->wPrint / 7.018, 0) - 1;
1630 1630
             } else {
1631 1631
                 $w = 28;
1632 1632
             }
1633 1633
             $increm = 1;
1634 1634
             foreach ($this->dup as $k => $d) {
1635
-                $nDup = ! empty($this->dup->item($k)->getElementsByTagName('nDup')->item(0)->nodeValue) ?
1635
+                $nDup = !empty($this->dup->item($k)->getElementsByTagName('nDup')->item(0)->nodeValue) ?
1636 1636
                         $this->dup->item($k)->getElementsByTagName('nDup')->item(0)->nodeValue : '';
1637
-                $dDup = ! empty($this->dup->item($k)->getElementsByTagName('dVenc')->item(0)->nodeValue) ?
1637
+                $dDup = !empty($this->dup->item($k)->getElementsByTagName('dVenc')->item(0)->nodeValue) ?
1638 1638
                         $this->ymdTodmy($this->dup->item($k)->getElementsByTagName('dVenc')->item(0)->nodeValue) : '';
1639
-                $vDup = ! empty($this->dup->item($k)->getElementsByTagName('vDup')->item(0)->nodeValue) ?
1639
+                $vDup = !empty($this->dup->item($k)->getElementsByTagName('vDup')->item(0)->nodeValue) ?
1640 1640
                         'R$ ' . number_format(
1641 1641
                             $this->dup->item($k)->getElementsByTagName('vDup')->item(0)->nodeValue,
1642 1642
                             2,
@@ -1645,14 +1645,14 @@  discard block
 block discarded – undo
1645 1645
                         ) : '';
1646 1646
                 $h = 8;
1647 1647
                 $texto = '';
1648
-                if ($nDup!='0' && $nDup!='') {
1648
+                if ($nDup != '0' && $nDup != '') {
1649 1649
                     $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1650 1650
                     $this->pdf->textBox($x, $y, $w, $h, 'Num.', $aFont, 'T', 'L', 1, '');
1651 1651
                     $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
1652 1652
                     $this->pdf->textBox($x, $y, $w, $h, $nDup, $aFont, 'T', 'R', 0, '');
1653 1653
                 } else {
1654 1654
                     $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1655
-                    $this->pdf->textBox($x, $y, $w, $h, ($dupcont+1)."", $aFont, 'T', 'L', 1, '');
1655
+                    $this->pdf->textBox($x, $y, $w, $h, ($dupcont + 1) . "", $aFont, 'T', 'L', 1, '');
1656 1656
                 }
1657 1657
                 $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1658 1658
                 $this->pdf->textBox($x, $y, $w, $h, 'Venc.', $aFont, 'C', 'L', 0, '');
@@ -1662,7 +1662,7 @@  discard block
 block discarded – undo
1662 1662
                 $this->pdf->textBox($x, $y, $w, $h, 'Valor', $aFont, 'B', 'L', 0, '');
1663 1663
                 $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
1664 1664
                 $this->pdf->textBox($x, $y, $w, $h, $vDup, $aFont, 'B', 'R', 0, '');
1665
-                $x += $w+$increm;
1665
+                $x += $w + $increm;
1666 1666
                 $dupcont += 1;
1667 1667
                 if ($this->orientacao == 'P') {
1668 1668
                     $maxDupCont = 6;
@@ -1684,10 +1684,10 @@  discard block
 block discarded – undo
1684 1684
                 $y -= 9;
1685 1685
                 $linha--;
1686 1686
             }
1687
-            return ($y+$h);
1687
+            return ($y + $h);
1688 1688
         } else {
1689 1689
             $linha = 0;
1690
-            return ($y-2);
1690
+            return ($y - 2);
1691 1691
         }
1692 1692
     }
1693 1693
 
@@ -1703,7 +1703,7 @@  discard block
 block discarded – undo
1703 1703
     protected function pagamento($x, $y)
1704 1704
     {
1705 1705
         $linha = 1;
1706
-        $h = 8+3;
1706
+        $h = 8 + 3;
1707 1707
         $oldx = $x;
1708 1708
         //verificar se existem cobranças definidas
1709 1709
         if (isset($this->detPag) && $this->detPag->length > 0) {
@@ -1722,7 +1722,7 @@  discard block
 block discarded – undo
1722 1722
             $dups = "";
1723 1723
             $dupcont = 0;
1724 1724
             if ($this->orientacao == 'P') {
1725
-                $w = round($this->wPrint/7.018, 0)-1;
1725
+                $w = round($this->wPrint / 7.018, 0) - 1;
1726 1726
             } else {
1727 1727
                 $w = 28;
1728 1728
             }
@@ -1732,16 +1732,16 @@  discard block
 block discarded – undo
1732 1732
                 $maxDupCont = 8;
1733 1733
             }
1734 1734
             $increm = 1;
1735
-            $formaPagamento = ['01'=>'Dinheiro','02'=>'Cheque','03'=>'Cartão de Crédito',
1736
-                                    '04'=>'Cartão de Débito','05'=>'Crédito Loja','10'=>'Vale Alimentação',
1737
-                                    '11'=>'Vale Refeição','12'=>'Vale Presente','13'=>'Vale Combustível',
1738
-                                    '14'=>'Duplicata Mercantil','15'=>'Boleto','90'=>'Sem pagamento','99'=>'Outros'];
1739
-            $bandeira = ['01'=>'Visa','02'=>'Mastercard','03'=>'American','04'=>'Sorocred','05'=>'Diners',
1740
-                              '06'=>'Elo','07'=>'Hipercard','08'=>'Aura','09'=>'Cabal','99'=>'Outros'];
1735
+            $formaPagamento = ['01'=>'Dinheiro', '02'=>'Cheque', '03'=>'Cartão de Crédito',
1736
+                                    '04'=>'Cartão de Débito', '05'=>'Crédito Loja', '10'=>'Vale Alimentação',
1737
+                                    '11'=>'Vale Refeição', '12'=>'Vale Presente', '13'=>'Vale Combustível',
1738
+                                    '14'=>'Duplicata Mercantil', '15'=>'Boleto', '90'=>'Sem pagamento', '99'=>'Outros'];
1739
+            $bandeira = ['01'=>'Visa', '02'=>'Mastercard', '03'=>'American', '04'=>'Sorocred', '05'=>'Diners',
1740
+                              '06'=>'Elo', '07'=>'Hipercard', '08'=>'Aura', '09'=>'Cabal', '99'=>'Outros'];
1741 1741
             foreach ($this->detPag as $k => $d) {
1742 1742
                 $fPag = !empty($this->detPag->item($k)->getElementsByTagName('tPag')->item(0)->nodeValue)
1743 1743
                     ? $this->detPag->item($k)->getElementsByTagName('tPag')->item(0)->nodeValue : '0';
1744
-                $vPag = ! empty($this->detPag->item($k)->getElementsByTagName('vPag')->item(0)->nodeValue)
1744
+                $vPag = !empty($this->detPag->item($k)->getElementsByTagName('vPag')->item(0)->nodeValue)
1745 1745
                     ? 'R$ ' . number_format(
1746 1746
                         $this->detPag->item($k)->getElementsByTagName('vPag')->item(0)->nodeValue,
1747 1747
                         2,
@@ -1752,7 +1752,7 @@  discard block
 block discarded – undo
1752 1752
                 $texto = '';
1753 1753
                 if (isset($formaPagamento[$fPag])) {
1754 1754
                     /*Exibir Item sem pagamento ou outros?*/
1755
-                    if ($fPag=='90' || $fPag=='99') {
1755
+                    if ($fPag == '90' || $fPag == '99') {
1756 1756
                         continue;
1757 1757
                     }
1758 1758
                     $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
@@ -1761,16 +1761,16 @@  discard block
 block discarded – undo
1761 1761
                     $this->pdf->textBox($x, $y, $w, $h, $formaPagamento[$fPag], $aFont, 'T', 'R', 0, '');
1762 1762
                 } else {
1763 1763
                     $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>''];
1764
-                    $this->pdf->textBox($x, $y, $w, $h, "Forma ".$fPag." não encontrado", $aFont, 'T', 'L', 1, '');
1764
+                    $this->pdf->textBox($x, $y, $w, $h, "Forma " . $fPag . " não encontrado", $aFont, 'T', 'L', 1, '');
1765 1765
                 }
1766 1766
                 $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1767 1767
                 $this->pdf->textBox($x, $y, $w, $h, 'Valor', $aFont, 'B', 'L', 0, '');
1768 1768
                 $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
1769 1769
                 $this->pdf->textBox($x, $y, $w, $h, $vPag, $aFont, 'B', 'R', 0, '');
1770
-                $x += $w+$increm;
1770
+                $x += $w + $increm;
1771 1771
                 $dupcont += 1;
1772 1772
 
1773
-                if ($dupcont>$maxDupCont) {
1773
+                if ($dupcont > $maxDupCont) {
1774 1774
                     $y += 9;
1775 1775
                     $x = $oldx;
1776 1776
                     $dupcont = 0;
@@ -1785,10 +1785,10 @@  discard block
 block discarded – undo
1785 1785
                 $y -= 9;
1786 1786
                 $linha--;
1787 1787
             }
1788
-            return ($y+$h);
1788
+            return ($y + $h);
1789 1789
         } else {
1790 1790
             $linha = 0;
1791
-            return ($y-2);
1791
+            return ($y - 2);
1792 1792
         }
1793 1793
     } //fim da função pagamento
1794 1794
     
@@ -1900,7 +1900,7 @@  discard block
 block discarded – undo
1900 1900
         }
1901 1901
         $x = $this->impostoHelper($x, $y, $w, $h, "V. TOTAL DA NOTA", "vNF");
1902 1902
 
1903
-        return ($y+$h);
1903
+        return ($y + $h);
1904 1904
     } //fim imposto
1905 1905
 
1906 1906
     /**
@@ -1928,13 +1928,13 @@  discard block
 block discarded – undo
1928 1928
         $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
1929 1929
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1930 1930
         //NOME / RAZÃO SOCIAL
1931
-        $w1 = $maxW*0.29;
1931
+        $w1 = $maxW * 0.29;
1932 1932
         $y += 3;
1933 1933
         $texto = 'NOME / RAZÃO SOCIAL';
1934 1934
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1935 1935
         $this->pdf->textBox($x, $y, $w1, $h, $texto, $aFont, 'T', 'L', 1, '');
1936 1936
         if (isset($this->transporta)) {
1937
-            $texto = ! empty($this->transporta->getElementsByTagName("xNome")->item(0)->nodeValue) ?
1937
+            $texto = !empty($this->transporta->getElementsByTagName("xNome")->item(0)->nodeValue) ?
1938 1938
                     $this->transporta->getElementsByTagName("xNome")->item(0)->nodeValue : '';
1939 1939
         } else {
1940 1940
             $texto = '';
@@ -1943,11 +1943,11 @@  discard block
 block discarded – undo
1943 1943
         $this->pdf->textBox($x, $y, $w1, $h, $texto, $aFont, 'B', 'L', 0, '');
1944 1944
         //FRETE POR CONTA
1945 1945
         $x += $w1;
1946
-        $w2 = $maxW*0.15;
1946
+        $w2 = $maxW * 0.15;
1947 1947
         $texto = 'FRETE';
1948 1948
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1949 1949
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
1950
-        $tipoFrete = ! empty($this->transp->getElementsByTagName("modFrete")->item(0)->nodeValue) ?
1950
+        $tipoFrete = !empty($this->transp->getElementsByTagName("modFrete")->item(0)->nodeValue) ?
1951 1951
                 $this->transp->getElementsByTagName("modFrete")->item(0)->nodeValue : '0';
1952 1952
         switch ($tipoFrete) {
1953 1953
             case 0:
@@ -1977,7 +1977,7 @@  discard block
 block discarded – undo
1977 1977
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1978 1978
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
1979 1979
         if (isset($this->veicTransp)) {
1980
-            $texto = ! empty($this->veicTransp->getElementsByTagName("RNTC")->item(0)->nodeValue) ?
1980
+            $texto = !empty($this->veicTransp->getElementsByTagName("RNTC")->item(0)->nodeValue) ?
1981 1981
                     $this->veicTransp->getElementsByTagName("RNTC")->item(0)->nodeValue : '';
1982 1982
         } else {
1983 1983
             $texto = '';
@@ -1990,10 +1990,10 @@  discard block
 block discarded – undo
1990 1990
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1991 1991
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
1992 1992
         if (isset($this->veicTransp)) {
1993
-            $texto = ! empty($this->veicTransp->getElementsByTagName("placa")->item(0)->nodeValue) ?
1993
+            $texto = !empty($this->veicTransp->getElementsByTagName("placa")->item(0)->nodeValue) ?
1994 1994
                     $this->veicTransp->getElementsByTagName("placa")->item(0)->nodeValue : '';
1995 1995
         } elseif (isset($this->reboque)) {
1996
-            $texto = ! empty($this->reboque->getElementsByTagName("placa")->item(0)->nodeValue) ?
1996
+            $texto = !empty($this->reboque->getElementsByTagName("placa")->item(0)->nodeValue) ?
1997 1997
                     $this->reboque->getElementsByTagName("placa")->item(0)->nodeValue : '';
1998 1998
         } else {
1999 1999
             $texto = '';
@@ -2002,15 +2002,15 @@  discard block
 block discarded – undo
2002 2002
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'B', 'C', 0, '');
2003 2003
         //UF
2004 2004
         $x += $w2;
2005
-        $w3 = round($maxW*0.04, 0);
2005
+        $w3 = round($maxW * 0.04, 0);
2006 2006
         $texto = 'UF';
2007 2007
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2008 2008
         $this->pdf->textBox($x, $y, $w3, $h, $texto, $aFont, 'T', 'L', 1, '');
2009 2009
         if (isset($this->veicTransp)) {
2010
-            $texto = ! empty($this->veicTransp->getElementsByTagName("UF")->item(0)->nodeValue) ?
2010
+            $texto = !empty($this->veicTransp->getElementsByTagName("UF")->item(0)->nodeValue) ?
2011 2011
                     $this->veicTransp->getElementsByTagName("UF")->item(0)->nodeValue : '';
2012 2012
         } elseif (isset($this->reboque)) {
2013
-            $texto = ! empty($this->reboque->getElementsByTagName("UF")->item(0)->nodeValue) ?
2013
+            $texto = !empty($this->reboque->getElementsByTagName("UF")->item(0)->nodeValue) ?
2014 2014
                     $this->reboque->getElementsByTagName("UF")->item(0)->nodeValue : '';
2015 2015
         } else {
2016 2016
             $texto = '';
@@ -2019,18 +2019,18 @@  discard block
 block discarded – undo
2019 2019
         $this->pdf->textBox($x, $y, $w3, $h, $texto, $aFont, 'B', 'C', 0, '');
2020 2020
         //CNPJ / CPF
2021 2021
         $x += $w3;
2022
-        $w = $maxW-($w1+3*$w2+$w3);
2022
+        $w = $maxW - ($w1 + 3 * $w2 + $w3);
2023 2023
         $texto = 'CNPJ / CPF';
2024 2024
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2025 2025
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
2026 2026
         if (isset($this->transporta)) {
2027
-            $texto = ! empty($this->transporta->getElementsByTagName("CNPJ")->item(0)->nodeValue) ?
2027
+            $texto = !empty($this->transporta->getElementsByTagName("CNPJ")->item(0)->nodeValue) ?
2028 2028
                     $this->formatField(
2029 2029
                         $this->transporta->getElementsByTagName("CNPJ")->item(0)->nodeValue,
2030 2030
                         "##.###.###/####-##"
2031 2031
                     ) : '';
2032 2032
             if ($texto == '') {
2033
-                $texto = ! empty($this->transporta->getElementsByTagName("CPF")->item(0)->nodeValue) ?
2033
+                $texto = !empty($this->transporta->getElementsByTagName("CPF")->item(0)->nodeValue) ?
2034 2034
                         $this->formatField(
2035 2035
                             $this->transporta->getElementsByTagName("CPF")->item(0)->nodeValue,
2036 2036
                             "###.###.###-##"
@@ -2046,12 +2046,12 @@  discard block
 block discarded – undo
2046 2046
         $y += $h;
2047 2047
         $x = $oldX;
2048 2048
         $h = 7;
2049
-        $w1 = $maxW*0.44;
2049
+        $w1 = $maxW * 0.44;
2050 2050
         $texto = 'ENDEREÇO';
2051 2051
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2052 2052
         $this->pdf->textBox($x, $y, $w1, $h, $texto, $aFont, 'T', 'L', 1, '');
2053 2053
         if (isset($this->transporta)) {
2054
-            $texto = ! empty($this->transporta->getElementsByTagName("xEnder")->item(0)->nodeValue) ?
2054
+            $texto = !empty($this->transporta->getElementsByTagName("xEnder")->item(0)->nodeValue) ?
2055 2055
                     $this->transporta->getElementsByTagName("xEnder")->item(0)->nodeValue : '';
2056 2056
         } else {
2057 2057
             $texto = '';
@@ -2060,12 +2060,12 @@  discard block
 block discarded – undo
2060 2060
         $this->pdf->textBox($x, $y, $w1, $h, $texto, $aFont, 'B', 'L', 0, '');
2061 2061
         //MUNICÍPIO
2062 2062
         $x += $w1;
2063
-        $w2 = round($maxW*0.30, 0);
2063
+        $w2 = round($maxW * 0.30, 0);
2064 2064
         $texto = 'MUNICÍPIO';
2065 2065
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2066 2066
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
2067 2067
         if (isset($this->transporta)) {
2068
-            $texto = ! empty($this->transporta->getElementsByTagName("xMun")->item(0)->nodeValue) ?
2068
+            $texto = !empty($this->transporta->getElementsByTagName("xMun")->item(0)->nodeValue) ?
2069 2069
                     $this->transporta->getElementsByTagName("xMun")->item(0)->nodeValue : '';
2070 2070
         } else {
2071 2071
             $texto = '';
@@ -2074,12 +2074,12 @@  discard block
 block discarded – undo
2074 2074
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'B', 'C', 0, '');
2075 2075
         //UF
2076 2076
         $x += $w2;
2077
-        $w3 = round($maxW*0.04, 0);
2077
+        $w3 = round($maxW * 0.04, 0);
2078 2078
         $texto = 'UF';
2079 2079
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2080 2080
         $this->pdf->textBox($x, $y, $w3, $h, $texto, $aFont, 'T', 'L', 1, '');
2081 2081
         if (isset($this->transporta)) {
2082
-            $texto = ! empty($this->transporta->getElementsByTagName("UF")->item(0)->nodeValue) ?
2082
+            $texto = !empty($this->transporta->getElementsByTagName("UF")->item(0)->nodeValue) ?
2083 2083
                     $this->transporta->getElementsByTagName("UF")->item(0)->nodeValue : '';
2084 2084
         } else {
2085 2085
             $texto = '';
@@ -2088,13 +2088,13 @@  discard block
 block discarded – undo
2088 2088
         $this->pdf->textBox($x, $y, $w3, $h, $texto, $aFont, 'B', 'C', 0, '');
2089 2089
         //INSCRIÇÃO ESTADUAL
2090 2090
         $x += $w3;
2091
-        $w = $maxW-($w1+$w2+$w3);
2091
+        $w = $maxW - ($w1 + $w2 + $w3);
2092 2092
         $texto = 'INSCRIÇÃO ESTADUAL';
2093 2093
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2094 2094
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
2095 2095
         $texto = '';
2096 2096
         if (isset($this->transporta)) {
2097
-            if (! empty($this->transporta->getElementsByTagName("IE")->item(0)->nodeValue)) {
2097
+            if (!empty($this->transporta->getElementsByTagName("IE")->item(0)->nodeValue)) {
2098 2098
                 $texto = $this->transporta->getElementsByTagName("IE")->item(0)->nodeValue;
2099 2099
             }
2100 2100
         }
@@ -2107,16 +2107,16 @@  discard block
 block discarded – undo
2107 2107
         $marca = '';
2108 2108
         $numero = '';
2109 2109
         $texto = '';
2110
-        $pesoBruto=0;
2111
-        $pesoLiquido=0;
2110
+        $pesoBruto = 0;
2111
+        $pesoLiquido = 0;
2112 2112
         foreach ($volumes as $volume) {
2113
-            $quantidade += ! empty($volume->getElementsByTagName("qVol")->item(0)->nodeValue) ?
2113
+            $quantidade += !empty($volume->getElementsByTagName("qVol")->item(0)->nodeValue) ?
2114 2114
                     $volume->getElementsByTagName("qVol")->item(0)->nodeValue : 0;
2115
-            $pesoBruto += ! empty($volume->getElementsByTagName("pesoB")->item(0)->nodeValue) ?
2115
+            $pesoBruto += !empty($volume->getElementsByTagName("pesoB")->item(0)->nodeValue) ?
2116 2116
                     $volume->getElementsByTagName("pesoB")->item(0)->nodeValue : 0;
2117
-            $pesoLiquido += ! empty($volume->getElementsByTagName("pesoL")->item(0)->nodeValue) ?
2117
+            $pesoLiquido += !empty($volume->getElementsByTagName("pesoL")->item(0)->nodeValue) ?
2118 2118
                     $volume->getElementsByTagName("pesoL")->item(0)->nodeValue : 0;
2119
-            $texto = ! empty($this->transp->getElementsByTagName("esp")->item(0)->nodeValue) ?
2119
+            $texto = !empty($this->transp->getElementsByTagName("esp")->item(0)->nodeValue) ?
2120 2120
                     $this->transp->getElementsByTagName("esp")->item(0)->nodeValue : '';
2121 2121
             if ($texto != $especie && $especie != '') {
2122 2122
                 //tem várias especies
@@ -2124,7 +2124,7 @@  discard block
 block discarded – undo
2124 2124
             } else {
2125 2125
                 $especie = $texto;
2126 2126
             }
2127
-            $texto = ! empty($this->transp->getElementsByTagName("marca")->item(0)->nodeValue) ?
2127
+            $texto = !empty($this->transp->getElementsByTagName("marca")->item(0)->nodeValue) ?
2128 2128
                     $this->transp->getElementsByTagName("marca")->item(0)->nodeValue : '';
2129 2129
             if ($texto != $marca && $marca != '') {
2130 2130
                 //tem várias especies
@@ -2132,7 +2132,7 @@  discard block
 block discarded – undo
2132 2132
             } else {
2133 2133
                 $marca = $texto;
2134 2134
             }
2135
-            $texto = ! empty($this->transp->getElementsByTagName("nVol")->item(0)->nodeValue) ?
2135
+            $texto = !empty($this->transp->getElementsByTagName("nVol")->item(0)->nodeValue) ?
2136 2136
                     $this->transp->getElementsByTagName("nVol")->item(0)->nodeValue : '';
2137 2137
             if ($texto != $numero && $numero != '') {
2138 2138
                 //tem várias especies
@@ -2147,7 +2147,7 @@  discard block
 block discarded – undo
2147 2147
         $y += $h;
2148 2148
         $x = $oldX;
2149 2149
         $h = 7;
2150
-        $w1 = round($maxW*0.10, 0);
2150
+        $w1 = round($maxW * 0.10, 0);
2151 2151
         $texto = 'QUANTIDADE';
2152 2152
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2153 2153
         $this->pdf->textBox($x, $y, $w1, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -2158,7 +2158,7 @@  discard block
 block discarded – undo
2158 2158
         }
2159 2159
         //ESPÉCIE
2160 2160
         $x += $w1;
2161
-        $w2 = round($maxW*0.17, 0);
2161
+        $w2 = round($maxW * 0.17, 0);
2162 2162
         $texto = 'ESPÉCIE';
2163 2163
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2164 2164
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -2170,7 +2170,7 @@  discard block
 block discarded – undo
2170 2170
         $texto = 'MARCA';
2171 2171
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2172 2172
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
2173
-        $texto = ! empty($this->transp->getElementsByTagName("marca")->item(0)->nodeValue) ?
2173
+        $texto = !empty($this->transp->getElementsByTagName("marca")->item(0)->nodeValue) ?
2174 2174
                 $this->transp->getElementsByTagName("marca")->item(0)->nodeValue : '';
2175 2175
         $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'];
2176 2176
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'B', 'C', 0, '');
@@ -2184,7 +2184,7 @@  discard block
 block discarded – undo
2184 2184
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'B', 'C', 0, '');
2185 2185
         //PESO BRUTO
2186 2186
         $x += $w2;
2187
-        $w3 = round($maxW*0.20, 0);
2187
+        $w3 = round($maxW * 0.20, 0);
2188 2188
         $texto = 'PESO BRUTO';
2189 2189
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2190 2190
         $this->pdf->textBox($x, $y, $w3, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -2197,7 +2197,7 @@  discard block
 block discarded – undo
2197 2197
         $this->pdf->textBox($x, $y, $w3, $h, $texto, $aFont, 'B', 'R', 0, '');
2198 2198
         //PESO LÍQUIDO
2199 2199
         $x += $w3;
2200
-        $w = $maxW -($w1+3*$w2+$w3);
2200
+        $w = $maxW - ($w1 + 3 * $w2 + $w3);
2201 2201
         $texto = 'PESO LÍQUIDO';
2202 2202
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2203 2203
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -2208,7 +2208,7 @@  discard block
 block discarded – undo
2208 2208
         }
2209 2209
         $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'];
2210 2210
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'R', 0, '');
2211
-        return ($y+$h);
2211
+        return ($y + $h);
2212 2212
     } //fim transporte
2213 2213
 
2214 2214
 
@@ -2220,7 +2220,7 @@  discard block
 block discarded – undo
2220 2220
             return "";
2221 2221
         }
2222 2222
         $valor_original = $valor_original->nodeValue;
2223
-        $valor = ! empty($valor_original) ? number_format($valor_original, 2, ",", ".") : '';
2223
+        $valor = !empty($valor_original) ? number_format($valor_original, 2, ",", ".") : '';
2224 2224
 
2225 2225
         if ($valor != "") {
2226 2226
             return sprintf($formato, $valor);
@@ -2267,18 +2267,18 @@  discard block
 block discarded – undo
2267 2267
             $impostos .= $this->descricaoProdutoHelper($ICMSUFDest, "vICMSUFDest", " vICMSUFDest=%s");
2268 2268
             $impostos .= $this->descricaoProdutoHelper($ICMSUFDest, "vICMSUFRemet", " vICMSUFRemet=%s");
2269 2269
         }
2270
-        $infAdProd = ! empty($itemProd->getElementsByTagName('infAdProd')->item(0)->nodeValue)
2270
+        $infAdProd = !empty($itemProd->getElementsByTagName('infAdProd')->item(0)->nodeValue)
2271 2271
             ? substr(
2272 2272
                 $this->anfaveaDANFE($itemProd->getElementsByTagName('infAdProd')->item(0)->nodeValue),
2273 2273
                 0,
2274 2274
                 500
2275 2275
             )
2276 2276
             : '';
2277
-        if (! empty($infAdProd)) {
2277
+        if (!empty($infAdProd)) {
2278 2278
             $infAdProd = trim($infAdProd);
2279 2279
             $infAdProd .= ' ';
2280 2280
         }
2281
-        $loteTxt ='';
2281
+        $loteTxt = '';
2282 2282
         $rastro = $prod->getElementsByTagName("med");
2283 2283
         if (!empty($prod->getElementsByTagName("rastro"))) {
2284 2284
             $rastro = $prod->getElementsByTagName("rastro");
@@ -2292,14 +2292,14 @@  discard block
 block discarded – undo
2292 2292
                 $i++;
2293 2293
             }
2294 2294
             if ($loteTxt != '') {
2295
-                $loteTxt.= ' ';
2295
+                $loteTxt .= ' ';
2296 2296
             }
2297 2297
         }
2298 2298
         //NT2013.006 FCI
2299
-        $nFCI = (! empty($itemProd->getElementsByTagName('nFCI')->item(0)->nodeValue)) ?
2300
-                ' FCI:'.$itemProd->getElementsByTagName('nFCI')->item(0)->nodeValue : '';
2301
-        $tmp_ad=$infAdProd . ($this->descProdInfoComplemento ? $loteTxt . $impostos . $nFCI : '');
2302
-        $texto = $prod->getElementsByTagName("xProd")->item(0)->nodeValue . (strlen($tmp_ad)!=0?"\n    ".$tmp_ad:'');
2299
+        $nFCI = (!empty($itemProd->getElementsByTagName('nFCI')->item(0)->nodeValue)) ?
2300
+                ' FCI:' . $itemProd->getElementsByTagName('nFCI')->item(0)->nodeValue : '';
2301
+        $tmp_ad = $infAdProd . ($this->descProdInfoComplemento ? $loteTxt . $impostos . $nFCI : '');
2302
+        $texto = $prod->getElementsByTagName("xProd")->item(0)->nodeValue . (strlen($tmp_ad) != 0 ? "\n    " . $tmp_ad : '');
2303 2303
         //decodifica os caracteres html no xml
2304 2304
         $texto = html_entity_decode($texto);
2305 2305
         if ($this->descProdQuebraLinha) {
@@ -2349,104 +2349,104 @@  discard block
 block discarded – undo
2349 2349
         // cabecalho LOOP COM OS DADOS DOS PRODUTOS
2350 2350
         //CÓDIGO PRODUTO
2351 2351
         $texto = "CÓDIGO PRODUTO";
2352
-        $w1 = round($w*0.09, 0);
2352
+        $w1 = round($w * 0.09, 0);
2353 2353
         $h = 4;
2354 2354
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2355 2355
         $this->pdf->textBox($x, $y, $w1, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2356
-        $this->pdf->line($x+$w1, $y, $x+$w1, $y+$hmax);
2356
+        $this->pdf->line($x + $w1, $y, $x + $w1, $y + $hmax);
2357 2357
         //DESCRIÇÃO DO PRODUTO / SERVIÇO
2358 2358
         $x += $w1;
2359
-        $w2 = round($w*0.28, 0);
2359
+        $w2 = round($w * 0.28, 0);
2360 2360
         $texto = 'DESCRIÇÃO DO PRODUTO / SERVIÇO';
2361 2361
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2362 2362
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2363
-        $this->pdf->line($x+$w2, $y, $x+$w2, $y+$hmax);
2363
+        $this->pdf->line($x + $w2, $y, $x + $w2, $y + $hmax);
2364 2364
         //NCM/SH
2365 2365
         $x += $w2;
2366
-        $w3 = round($w*0.06, 0);
2366
+        $w3 = round($w * 0.06, 0);
2367 2367
         $texto = 'NCM/SH';
2368 2368
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2369 2369
         $this->pdf->textBox($x, $y, $w3, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2370
-        $this->pdf->line($x+$w3, $y, $x+$w3, $y+$hmax);
2370
+        $this->pdf->line($x + $w3, $y, $x + $w3, $y + $hmax);
2371 2371
         //O/CST ou O/CSOSN
2372 2372
         $x += $w3;
2373
-        $w4 = round($w*0.05, 0);
2374
-        $texto = 'O/CSOSN';//Regime do Simples CRT = 1 ou CRT = 2
2373
+        $w4 = round($w * 0.05, 0);
2374
+        $texto = 'O/CSOSN'; //Regime do Simples CRT = 1 ou CRT = 2
2375 2375
         if ($this->getTagValue($this->emit, 'CRT') == '3') {
2376
-             $texto = 'O/CST';//Regime Normal
2376
+             $texto = 'O/CST'; //Regime Normal
2377 2377
         }
2378 2378
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2379 2379
         $this->pdf->textBox($x, $y, $w4, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2380
-        $this->pdf->line($x+$w4, $y, $x+$w4, $y+$hmax);
2380
+        $this->pdf->line($x + $w4, $y, $x + $w4, $y + $hmax);
2381 2381
         //CFOP
2382 2382
         $x += $w4;
2383
-        $w5 = round($w*0.04, 0);
2383
+        $w5 = round($w * 0.04, 0);
2384 2384
         $texto = 'CFOP';
2385 2385
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2386 2386
         $this->pdf->textBox($x, $y, $w5, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2387
-        $this->pdf->line($x+$w5, $y, $x+$w5, $y+$hmax);
2387
+        $this->pdf->line($x + $w5, $y, $x + $w5, $y + $hmax);
2388 2388
         //UN
2389 2389
         $x += $w5;
2390
-        $w6 = round($w*0.03, 0);
2390
+        $w6 = round($w * 0.03, 0);
2391 2391
         $texto = 'UN';
2392 2392
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2393 2393
         $this->pdf->textBox($x, $y, $w6, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2394
-        $this->pdf->line($x+$w6, $y, $x+$w6, $y+$hmax);
2394
+        $this->pdf->line($x + $w6, $y, $x + $w6, $y + $hmax);
2395 2395
         //QUANT
2396 2396
         $x += $w6;
2397
-        $w7 = round($w*0.07, 0);
2397
+        $w7 = round($w * 0.07, 0);
2398 2398
         $texto = 'QUANT';
2399 2399
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2400 2400
         $this->pdf->textBox($x, $y, $w7, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2401
-        $this->pdf->line($x+$w7, $y, $x+$w7, $y+$hmax);
2401
+        $this->pdf->line($x + $w7, $y, $x + $w7, $y + $hmax);
2402 2402
         //VALOR UNIT
2403 2403
         $x += $w7;
2404
-        $w8 = round($w*0.06, 0);
2404
+        $w8 = round($w * 0.06, 0);
2405 2405
         $texto = 'VALOR UNIT';
2406 2406
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2407 2407
         $this->pdf->textBox($x, $y, $w8, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2408
-        $this->pdf->line($x+$w8, $y, $x+$w8, $y+$hmax);
2408
+        $this->pdf->line($x + $w8, $y, $x + $w8, $y + $hmax);
2409 2409
         //VALOR TOTAL
2410 2410
         $x += $w8;
2411
-        $w9 = round($w*0.06, 0);
2411
+        $w9 = round($w * 0.06, 0);
2412 2412
         $texto = 'VALOR TOTAL';
2413 2413
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2414 2414
         $this->pdf->textBox($x, $y, $w9, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2415
-        $this->pdf->line($x+$w9, $y, $x+$w9, $y+$hmax);
2415
+        $this->pdf->line($x + $w9, $y, $x + $w9, $y + $hmax);
2416 2416
         //B.CÁLC ICMS
2417 2417
         $x += $w9;
2418
-        $w10 = round($w*0.06, 0);
2418
+        $w10 = round($w * 0.06, 0);
2419 2419
         $texto = 'B.CÁLC ICMS';
2420 2420
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2421 2421
         $this->pdf->textBox($x, $y, $w10, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2422
-        $this->pdf->line($x+$w10, $y, $x+$w10, $y+$hmax);
2422
+        $this->pdf->line($x + $w10, $y, $x + $w10, $y + $hmax);
2423 2423
         //VALOR ICMS
2424 2424
         $x += $w10;
2425
-        $w11 = round($w*0.06, 0);
2425
+        $w11 = round($w * 0.06, 0);
2426 2426
         $texto = 'VALOR ICMS';
2427 2427
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2428 2428
         $this->pdf->textBox($x, $y, $w11, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2429
-        $this->pdf->line($x+$w11, $y, $x+$w11, $y+$hmax);
2429
+        $this->pdf->line($x + $w11, $y, $x + $w11, $y + $hmax);
2430 2430
         //VALOR IPI
2431 2431
         $x += $w11;
2432
-        $w12 = round($w*0.05, 0);
2432
+        $w12 = round($w * 0.05, 0);
2433 2433
         $texto = 'VALOR IPI';
2434 2434
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2435 2435
         $this->pdf->textBox($x, $y, $w12, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2436
-        $this->pdf->line($x+$w12, $y, $x+$w12, $y+$hmax);
2436
+        $this->pdf->line($x + $w12, $y, $x + $w12, $y + $hmax);
2437 2437
         //ALÍQ. ICMS
2438 2438
         $x += $w12;
2439
-        $w13 = round($w*0.035, 0);
2439
+        $w13 = round($w * 0.035, 0);
2440 2440
         $texto = 'ALÍQ. ICMS';
2441 2441
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2442 2442
         $this->pdf->textBox($x, $y, $w13, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2443
-        $this->pdf->line($x+$w13, $y, $x+$w13, $y+$hmax);
2443
+        $this->pdf->line($x + $w13, $y, $x + $w13, $y + $hmax);
2444 2444
         //ALÍQ. IPI
2445 2445
         $x += $w13;
2446
-        $w14 = $w-($w1+$w2+$w3+$w4+$w5+$w6+$w7+$w8+$w9+$w10+$w11+$w12+$w13);
2446
+        $w14 = $w - ($w1 + $w2 + $w3 + $w4 + $w5 + $w6 + $w7 + $w8 + $w9 + $w10 + $w11 + $w12 + $w13);
2447 2447
         $texto = 'ALÍQ. IPI';
2448 2448
         $this->pdf->textBox($x, $y, $w14, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2449
-        $this->pdf->line($oldX, $y+$h+1, $oldX + $w, $y+$h+1);
2449
+        $this->pdf->line($oldX, $y + $h + 1, $oldX + $w, $y + $h + 1);
2450 2450
         $y += 5;
2451 2451
         //##################################################################################
2452 2452
         // LOOP COM OS DADOS DOS PRODUTOS
@@ -2464,7 +2464,7 @@  discard block
 block discarded – undo
2464 2464
                 $textoProduto = trim($this->descricaoProduto($thisItem));
2465 2465
 
2466 2466
                 $linhaDescr = $this->pdf->getNumLines($textoProduto, $w2, $aFont);
2467
-                $h = round(($linhaDescr * $this->pdf->fontSize)+ ($linhaDescr * 0.5), 2);
2467
+                $h = round(($linhaDescr * $this->pdf->fontSize) + ($linhaDescr * 0.5), 2);
2468 2468
                 $hUsado += $h;
2469 2469
 
2470 2470
                 $diffH = $hmax - $hUsado;
@@ -2477,11 +2477,11 @@  discard block
 block discarded – undo
2477 2477
                         break;
2478 2478
                     }
2479 2479
                 }
2480
-                $y_linha=$y+$h;
2480
+                $y_linha = $y + $h;
2481 2481
                 // linha entre itens
2482 2482
                 $this->pdf->dashedHLine($oldX, $y_linha, $w, 0.1, 120);
2483 2483
                 //corrige o x
2484
-                $x=$oldX;
2484
+                $x = $oldX;
2485 2485
                 //codigo do produto
2486 2486
                 $texto = $prod->getElementsByTagName("cProd")->item(0)->nodeValue;
2487 2487
                 $this->pdf->textBox($x, $y, $w1, $h, $texto, $aFont, 'T', 'C', 0, '');
@@ -2494,16 +2494,16 @@  discard block
 block discarded – undo
2494 2494
                 }
2495 2495
                 $x += $w2;
2496 2496
                 //NCM
2497
-                $texto = ! empty($prod->getElementsByTagName("NCM")->item(0)->nodeValue) ?
2497
+                $texto = !empty($prod->getElementsByTagName("NCM")->item(0)->nodeValue) ?
2498 2498
                         $prod->getElementsByTagName("NCM")->item(0)->nodeValue : '';
2499 2499
                 $this->pdf->textBox($x, $y, $w3, $h, $texto, $aFont, 'T', 'C', 0, '');
2500 2500
                 $x += $w3;
2501 2501
                 //CST
2502 2502
                 if (isset($ICMS)) {
2503
-                    $origem =  $this->getTagValue($ICMS, "orig");
2504
-                    $cst =  $this->getTagValue($ICMS, "CST");
2505
-                    $csosn =  $this->getTagValue($ICMS, "CSOSN");
2506
-                    $texto = $origem.$cst.$csosn;
2503
+                    $origem = $this->getTagValue($ICMS, "orig");
2504
+                    $cst = $this->getTagValue($ICMS, "CST");
2505
+                    $csosn = $this->getTagValue($ICMS, "CSOSN");
2506
+                    $texto = $origem . $cst . $csosn;
2507 2507
                     $this->pdf->textBox($x, $y, $w4, $h, $texto, $aFont, 'T', 'C', 0, '');
2508 2508
                 }
2509 2509
                 //CFOP
@@ -2537,7 +2537,7 @@  discard block
 block discarded – undo
2537 2537
                 //Valor da Base de calculo
2538 2538
                 $x += $w9;
2539 2539
                 if (isset($ICMS)) {
2540
-                    $texto = ! empty($ICMS->getElementsByTagName("vBC")->item(0)->nodeValue) ?
2540
+                    $texto = !empty($ICMS->getElementsByTagName("vBC")->item(0)->nodeValue) ?
2541 2541
                             number_format(
2542 2542
                                 $ICMS->getElementsByTagName("vBC")->item(0)->nodeValue,
2543 2543
                                 2,
@@ -2549,7 +2549,7 @@  discard block
 block discarded – undo
2549 2549
                 //Valor do ICMS
2550 2550
                 $x += $w10;
2551 2551
                 if (isset($ICMS)) {
2552
-                    $texto = ! empty($ICMS->getElementsByTagName("vICMS")->item(0)->nodeValue) ?
2552
+                    $texto = !empty($ICMS->getElementsByTagName("vICMS")->item(0)->nodeValue) ?
2553 2553
                             number_format(
2554 2554
                                 $ICMS->getElementsByTagName("vICMS")->item(0)->nodeValue,
2555 2555
                                 2,
@@ -2561,8 +2561,8 @@  discard block
 block discarded – undo
2561 2561
                 //Valor do IPI
2562 2562
                 $x += $w11;
2563 2563
                 if (isset($IPI)) {
2564
-                    $texto = ! empty($IPI->getElementsByTagName("vIPI")->item(0)->nodeValue) ?
2565
-                            number_format($IPI->getElementsByTagName("vIPI")->item(0)->nodeValue, 2, ",", ".") :'';
2564
+                    $texto = !empty($IPI->getElementsByTagName("vIPI")->item(0)->nodeValue) ?
2565
+                            number_format($IPI->getElementsByTagName("vIPI")->item(0)->nodeValue, 2, ",", ".") : '';
2566 2566
                 } else {
2567 2567
                     $texto = '';
2568 2568
                 }
@@ -2570,7 +2570,7 @@  discard block
 block discarded – undo
2570 2570
                 // %ICMS
2571 2571
                 $x += $w12;
2572 2572
                 if (isset($ICMS)) {
2573
-                    $texto = ! empty($ICMS->getElementsByTagName("pICMS")->item(0)->nodeValue) ?
2573
+                    $texto = !empty($ICMS->getElementsByTagName("pICMS")->item(0)->nodeValue) ?
2574 2574
                             number_format(
2575 2575
                                 $ICMS->getElementsByTagName("pICMS")->item(0)->nodeValue,
2576 2576
                                 2,
@@ -2582,7 +2582,7 @@  discard block
 block discarded – undo
2582 2582
                 //%IPI
2583 2583
                 $x += $w13;
2584 2584
                 if (isset($IPI)) {
2585
-                    $texto = ! empty($IPI->getElementsByTagName("pIPI")->item(0)->nodeValue) ?
2585
+                    $texto = !empty($IPI->getElementsByTagName("pIPI")->item(0)->nodeValue) ?
2586 2586
                             number_format($IPI->getElementsByTagName("pIPI")->item(0)->nodeValue, 2, ",", ".") : '';
2587 2587
                 } else {
2588 2588
                     $texto = '';
@@ -2607,7 +2607,7 @@  discard block
 block discarded – undo
2607 2607
                 $i++;
2608 2608
             }
2609 2609
         }
2610
-        return $oldY+$hmax;
2610
+        return $oldY + $hmax;
2611 2611
     }
2612 2612
 
2613 2613
 
@@ -2641,7 +2641,7 @@  discard block
 block discarded – undo
2641 2641
 
2642 2642
         $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>''];
2643 2643
 
2644
-        $w1 = round($w*0.09, 0);
2644
+        $w1 = round($w * 0.09, 0);
2645 2645
 
2646 2646
         // Tabela Renavam Combustivel
2647 2647
         $renavamCombustivel = [
@@ -2736,54 +2736,54 @@  discard block
 block discarded – undo
2736 2736
 
2737 2737
         $yVeic = $y + $h;
2738 2738
         $texto = 'Chassi: ............: ' . $veiculoChassi;
2739
-        $this->pdf->textBox($x, $yVeic, $w1+40, $h, $texto, $aFont, 'T', 'L', 0, '');
2739
+        $this->pdf->textBox($x, $yVeic, $w1 + 40, $h, $texto, $aFont, 'T', 'L', 0, '');
2740 2740
         $yVeic += $h;
2741 2741
         $texto = 'Cor...................: ' . $veiculoCor;
2742
-        $this->pdf->textBox($x, $yVeic, $w1+40, $h, $texto, $aFont, 'T', 'L', 0, '');
2742
+        $this->pdf->textBox($x, $yVeic, $w1 + 40, $h, $texto, $aFont, 'T', 'L', 0, '');
2743 2743
         $yVeic += $h;
2744 2744
         $texto = 'Cilindrada........: ' . $veiculoCilindrada;
2745
-        $this->pdf->textBox($x, $yVeic, $w1+40, $h, $texto, $aFont, 'T', 'L', 0, '');
2745
+        $this->pdf->textBox($x, $yVeic, $w1 + 40, $h, $texto, $aFont, 'T', 'L', 0, '');
2746 2746
         $yVeic += $h;
2747 2747
         $texto = 'Cmkg...............: ' . $veiculoCmkg;
2748
-        $this->pdf->textBox($x, $yVeic, $w1+40, $h, $texto, $aFont, 'T', 'L', 0, '');
2748
+        $this->pdf->textBox($x, $yVeic, $w1 + 40, $h, $texto, $aFont, 'T', 'L', 0, '');
2749 2749
         $yVeic += $h;
2750 2750
         $texto = 'Tipo.................: ' . ($renavamTiposVeiculos[intval($veiculoTipo)] ?? $veiculoTipo);
2751
-         $this->pdf->textBox($x, $yVeic, $w1+40, $h, $texto, $aFont, 'T', 'L', 0, '');
2751
+         $this->pdf->textBox($x, $yVeic, $w1 + 40, $h, $texto, $aFont, 'T', 'L', 0, '');
2752 2752
         $yVeic = $y + $h;
2753 2753
         $xVeic = $x + 65;
2754 2754
         $texto = 'Nº Motor: .........: ' . $veiculoMotor;
2755
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
2755
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
2756 2756
         $yVeic += $h;
2757 2757
         $texto = 'Renavam...........: ' . $veiculoRenavam;
2758
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
2758
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
2759 2759
         $yVeic += $h;
2760 2760
         $texto = 'HP.....................: ' . $veiculoHp;
2761
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
2761
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
2762 2762
         $yVeic += $h;
2763 2763
         $texto = 'Placa.................: ' . $veiculoPlaca;
2764
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
2764
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
2765 2765
         $yVeic += $h;
2766 2766
         $texto = 'Tipo Pintura......: ' . ($renavamEspecie[intval($veiculoTipoPintura)] ?? $veiculoTipoPintura);
2767
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
2767
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
2768 2768
         $yVeic = $y + $h;
2769 2769
         $xVeic = $xVeic + 55;
2770 2770
         $texto = 'Marca / Modelo.....: ' . $veiculoMarcaModelo;
2771
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
2771
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
2772 2772
         $yVeic += $h;
2773 2773
         $texto = 'Especie..................: ' . ($renavamEspecie[intval($veiculoEspecie)] ?? $veiculoEspecie);
2774
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
2774
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
2775 2775
         $yVeic += $h;
2776 2776
         $texto = 'Combustivel..........: ' . ($renavamCombustivel[intval($veiculoCombustivel)] ?? $veiculoCombustivel);
2777
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
2777
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
2778 2778
         $yVeic += $h;
2779 2779
         $texto = 'Serial.....................: ' . $veiculoSerial;
2780
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
2780
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
2781 2781
         $yVeic += $h;
2782
-        $texto = 'Ano Fab/Mod........: '. $veiculoFabricacao . '/' . $veiculoModelo;
2783
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
2782
+        $texto = 'Ano Fab/Mod........: ' . $veiculoFabricacao . '/' . $veiculoModelo;
2783
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
2784 2784
         $yVeic += $h;
2785
-        $texto = 'Distancia Entre Eixos(mm)..: '. $veiculoDistancia;
2786
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
2785
+        $texto = 'Distancia Entre Eixos(mm)..: ' . $veiculoDistancia;
2786
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
2787 2787
     }
2788 2788
 
2789 2789
     /**
@@ -2807,12 +2807,12 @@  discard block
 block discarded – undo
2807 2807
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
2808 2808
         //INSCRIÇÃO MUNICIPAL
2809 2809
         $y += 3;
2810
-        $w = round($this->wPrint*0.23, 0);
2810
+        $w = round($this->wPrint * 0.23, 0);
2811 2811
         $texto = 'INSCRIÇÃO MUNICIPAL';
2812 2812
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2813 2813
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
2814 2814
         //inscrição municipal
2815
-        $texto = ! empty($this->emit->getElementsByTagName("IM")->item(0)->nodeValue) ?
2815
+        $texto = !empty($this->emit->getElementsByTagName("IM")->item(0)->nodeValue) ?
2816 2816
                 $this->emit->getElementsByTagName("IM")->item(0)->nodeValue : '';
2817 2817
         $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'];
2818 2818
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 0, '');
@@ -2822,7 +2822,7 @@  discard block
 block discarded – undo
2822 2822
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2823 2823
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
2824 2824
         if (isset($this->ISSQNtot)) {
2825
-            $texto = ! empty($this->ISSQNtot->getElementsByTagName("vServ")->item(0)->nodeValue) ?
2825
+            $texto = !empty($this->ISSQNtot->getElementsByTagName("vServ")->item(0)->nodeValue) ?
2826 2826
                     $this->ISSQNtot->getElementsByTagName("vServ")->item(0)->nodeValue : '';
2827 2827
             $texto = number_format($texto, 2, ",", ".");
2828 2828
         } else {
@@ -2836,9 +2836,9 @@  discard block
 block discarded – undo
2836 2836
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2837 2837
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
2838 2838
         if (isset($this->ISSQNtot)) {
2839
-            $texto = ! empty($this->ISSQNtot->getElementsByTagName("vBC")->item(0)->nodeValue) ?
2839
+            $texto = !empty($this->ISSQNtot->getElementsByTagName("vBC")->item(0)->nodeValue) ?
2840 2840
                     $this->ISSQNtot->getElementsByTagName("vBC")->item(0)->nodeValue : '';
2841
-            $texto = ! empty($texto) ? number_format($texto, 2, ",", ".") : '';
2841
+            $texto = !empty($texto) ? number_format($texto, 2, ",", ".") : '';
2842 2842
         } else {
2843 2843
             $texto = '';
2844 2844
         }
@@ -2849,21 +2849,21 @@  discard block
 block discarded – undo
2849 2849
         if ($this->orientacao == 'P') {
2850 2850
             $w = $this->wPrint - (3 * $w);
2851 2851
         } else {
2852
-            $w = $this->wPrint - (3 * $w)-$this->wCanhoto;
2852
+            $w = $this->wPrint - (3 * $w) - $this->wCanhoto;
2853 2853
         }
2854 2854
         $texto = 'VALOR TOTAL DO ISSQN';
2855 2855
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2856 2856
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
2857 2857
         if (isset($this->ISSQNtot)) {
2858
-            $texto = ! empty($this->ISSQNtot->getElementsByTagName("vISS")->item(0)->nodeValue) ?
2858
+            $texto = !empty($this->ISSQNtot->getElementsByTagName("vISS")->item(0)->nodeValue) ?
2859 2859
                     $this->ISSQNtot->getElementsByTagName("vISS")->item(0)->nodeValue : '';
2860
-            $texto = ! empty($texto) ? number_format($texto, 2, ",", ".") : '';
2860
+            $texto = !empty($texto) ? number_format($texto, 2, ",", ".") : '';
2861 2861
         } else {
2862 2862
             $texto = '';
2863 2863
         }
2864 2864
         $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'];
2865 2865
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'R', 0, '');
2866
-        return ($y+$h+1);
2866
+        return ($y + $h + 1);
2867 2867
     }
2868 2868
 
2869 2869
     /**
@@ -2884,7 +2884,7 @@  discard block
 block discarded – undo
2884 2884
         if ($this->orientacao == 'P') {
2885 2885
               $w = $this->wPrint;
2886 2886
         } else {
2887
-              $w = $this->wPrint-$this->wCanhoto;
2887
+              $w = $this->wPrint - $this->wCanhoto;
2888 2888
         }
2889 2889
         $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
2890 2890
         $this->pdf->textBox($x, $y, $w, 8, $texto, $aFont, 'T', 'L', 0, '');
@@ -2900,15 +2900,15 @@  discard block
 block discarded – undo
2900 2900
         //$this->textoAdic com o texto completo do campo
2901 2901
         $y += 1;
2902 2902
         $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>''];
2903
-        $this->pdf->textBox($x, $y+2, $w-2, $h-3, $this->textoAdic, $aFont, 'T', 'L', 0, '', false);
2903
+        $this->pdf->textBox($x, $y + 2, $w - 2, $h - 3, $this->textoAdic, $aFont, 'T', 'L', 0, '', false);
2904 2904
         //RESERVADO AO FISCO
2905 2905
         $texto = "RESERVADO AO FISCO";
2906 2906
         $x += $w;
2907 2907
         $y -= 1;
2908 2908
         if ($this->orientacao == 'P') {
2909
-            $w = $this->wPrint-$w;
2909
+            $w = $this->wPrint - $w;
2910 2910
         } else {
2911
-            $w = $this->wPrint-$w-$this->wCanhoto;
2911
+            $w = $this->wPrint - $w - $this->wCanhoto;
2912 2912
         }
2913 2913
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>'B'];
2914 2914
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -2947,8 +2947,8 @@  discard block
 block discarded – undo
2947 2947
         }
2948 2948
         $y += 2;
2949 2949
         $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>''];
2950
-        $this->pdf->textBox($x, $y, $w-2, $h-3, $texto, $aFont, 'T', 'L', 0, '', false);
2951
-        return $y+$h;
2950
+        $this->pdf->textBox($x, $y, $w - 2, $h - 3, $texto, $aFont, 'T', 'L', 0, '', false);
2951
+        return $y + $h;
2952 2952
     }
2953 2953
 
2954 2954
     /**
@@ -2967,13 +2967,13 @@  discard block
 block discarded – undo
2967 2967
         if ($this->orientacao == 'P') {
2968 2968
               $w = $this->wPrint;
2969 2969
         } else {
2970
-              $w = $this->wPrint-$this->wCanhoto;
2970
+              $w = $this->wPrint - $this->wCanhoto;
2971 2971
               $x = $this->wCanhoto;
2972 2972
         }
2973 2973
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>'I'];
2974
-        $texto = "Impresso em ". date('d/m/Y') . " as " . date('H:i:s');
2974
+        $texto = "Impresso em " . date('d/m/Y') . " as " . date('H:i:s');
2975 2975
         $this->pdf->textBox($x, $y, $w, 0, $texto, $aFont, 'T', 'L', false);
2976
-        $texto = $this->creditos .  "  Powered by NFePHP®";
2976
+        $texto = $this->creditos . "  Powered by NFePHP®";
2977 2977
         $this->pdf->textBox($x, $y, $w, 0, $texto, $aFont, 'T', 'R', false, '');
2978 2978
     }
2979 2979
 
@@ -3026,9 +3026,9 @@  discard block
 block discarded – undo
3026 3026
         } else {
3027 3027
             //linha separadora do canhoto - 238
3028 3028
             //posicao altura
3029
-            $y = $this->wPrint-85;
3029
+            $y = $this->wPrint - 85;
3030 3030
             //altura
3031
-            $w = $this->wPrint-85-24;
3031
+            $w = $this->wPrint - 85 - 24;
3032 3032
         }
3033 3033
         $h = 10;
3034 3034
         //desenha caixa
@@ -3051,21 +3051,21 @@  discard block
 block discarded – undo
3051 3051
             $texto .= "AO LADO";
3052 3052
         }
3053 3053
         $texto .= ". EMISSÃO: ";
3054
-        $dEmi = ! empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
3054
+        $dEmi = !empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
3055 3055
                 $this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue : '';
3056 3056
         if ($dEmi == '') {
3057
-            $dEmi = ! empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
3057
+            $dEmi = !empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
3058 3058
                     $this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue : '';
3059 3059
             $aDemi = explode('T', $dEmi);
3060 3060
             $dEmi = $aDemi[0];
3061 3061
         }
3062
-        $texto .= $this->ymdTodmy($dEmi) ." ";
3062
+        $texto .= $this->ymdTodmy($dEmi) . " ";
3063 3063
         $texto .= "VALOR TOTAL: R$ ";
3064 3064
         $texto .= number_format($this->ICMSTot->getElementsByTagName("vNF")->item(0)->nodeValue, 2, ",", ".") . " ";
3065 3065
         $texto .= "DESTINATÁRIO: ";
3066 3066
         $texto .= $destinatario;
3067 3067
         if ($this->orientacao == 'P') {
3068
-            $this->pdf->textBox($x, $y, $w-1, $h, $texto, $aFont, 'C', 'L', 0, '', false);
3068
+            $this->pdf->textBox($x, $y, $w - 1, $h, $texto, $aFont, 'C', 'L', 0, '', false);
3069 3069
             $x1 = $x + $w;
3070 3070
             $w1 = $this->wPrint - $w;
3071 3071
             $texto = "NF-e";
@@ -3078,12 +3078,12 @@  discard block
 block discarded – undo
3078 3078
             //DATA DE RECEBIMENTO
3079 3079
             $texto = "DATA DE RECEBIMENTO";
3080 3080
             $y += $h;
3081
-            $w2 = round($this->wPrint*0.17, 0); //35;
3081
+            $w2 = round($this->wPrint * 0.17, 0); //35;
3082 3082
             $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
3083 3083
             $this->pdf->textBox($x, $y, $w2, 8, $texto, $aFont, 'T', 'L', 1, '');
3084 3084
             //IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR
3085 3085
             $x += $w2;
3086
-            $w3 = $w-$w2;
3086
+            $w3 = $w - $w2;
3087 3087
             $texto = "IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR";
3088 3088
             $this->pdf->textBox($x, $y, $w3, 8, $texto, $aFont, 'T', 'L', 1, '');
3089 3089
             $x = $oldX;
@@ -3093,7 +3093,7 @@  discard block
 block discarded – undo
3093 3093
             return $y;
3094 3094
         } else {
3095 3095
             $x--;
3096
-            $x = $this->pdf->textBox90($x, $y, $w-1, $h, $texto, $aFontSmall, 'C', 'L', 0, '', false);
3096
+            $x = $this->pdf->textBox90($x, $y, $w - 1, $h, $texto, $aFontSmall, 'C', 'L', 0, '', false);
3097 3097
             //NUMERO DA NOTA FISCAL LOGO NFE
3098 3098
             $w1 = 18;
3099 3099
             $x1 = $oldX;
@@ -3107,18 +3107,18 @@  discard block
 block discarded – undo
3107 3107
             $this->pdf->textBox($x1, $y, $w1, 18, $texto, $aFont, 'C', 'C', 1, '');
3108 3108
             //DATA DO RECEBIMENTO
3109 3109
             $texto = "DATA DO RECEBIMENTO";
3110
-            $y = $this->wPrint-85;
3110
+            $y = $this->wPrint - 85;
3111 3111
             $x = 12;
3112
-            $w2 = round($this->wPrint*0.17, 0); //35;
3112
+            $w2 = round($this->wPrint * 0.17, 0); //35;
3113 3113
             $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
3114 3114
             $this->pdf->textBox90($x, $y, $w2, 8, $texto, $aFont, 'T', 'L', 1, '');
3115 3115
             //IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR
3116 3116
             $y -= $w2;
3117
-            $w3 = $w-$w2;
3117
+            $w3 = $w - $w2;
3118 3118
             $texto = "IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR";
3119 3119
             $aFont = ['font'=>$this->fontePadrao, 'size'=>5.7, 'style'=>''];
3120 3120
             $x = $this->pdf->textBox90($x, $y, $w3, 8, $texto, $aFont, 'T', 'L', 1, '');
3121
-            $this->pdf->DashedVLine(23, $oldY, 0.1, $this->wPrint-20, 67);
3121
+            $this->pdf->DashedVLine(23, $oldY, 0.1, $this->wPrint - 20, 67);
3122 3122
             return $x;
3123 3123
         }
3124 3124
     }
@@ -3135,13 +3135,13 @@  discard block
 block discarded – undo
3135 3135
     {
3136 3136
         $saida = "";
3137 3137
         if (isset($this->compra)) {
3138
-            if (! empty($this->compra->getElementsByTagName("xNEmp")->item(0)->nodeValue)) {
3138
+            if (!empty($this->compra->getElementsByTagName("xNEmp")->item(0)->nodeValue)) {
3139 3139
                 $saida .= " Nota de Empenho: " . $this->compra->getElementsByTagName("xNEmp")->item(0)->nodeValue;
3140 3140
             }
3141
-            if (! empty($this->compra->getElementsByTagName("xPed")->item(0)->nodeValue)) {
3141
+            if (!empty($this->compra->getElementsByTagName("xPed")->item(0)->nodeValue)) {
3142 3142
                 $saida .= " Pedido: " . $this->compra->getElementsByTagName("xPed")->item(0)->nodeValue;
3143 3143
             }
3144
-            if (! empty($this->compra->getElementsByTagName("xCont")->item(0)->nodeValue)) {
3144
+            if (!empty($this->compra->getElementsByTagName("xCont")->item(0)->nodeValue)) {
3145 3145
                 $saida .= " Contrato: " . $this->compra->getElementsByTagName("xCont")->item(0)->nodeValue;
3146 3146
             }
3147 3147
         }
@@ -3167,21 +3167,21 @@  discard block
 block discarded – undo
3167 3167
         if ($vICMS > 0) {
3168 3168
             $vICMS = 1;
3169 3169
         }
3170
-        $icmss  = $this->ICMSTot->getElementsByTagName("vBC")->item(0)->nodeValue;
3170
+        $icmss = $this->ICMSTot->getElementsByTagName("vBC")->item(0)->nodeValue;
3171 3171
         if ($icmss > 0) {
3172 3172
             $icmss = 1;
3173 3173
         }
3174
-        $dEmi = ! empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
3174
+        $dEmi = !empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
3175 3175
                 $this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue : '';
3176 3176
         if ($dEmi == '') {
3177
-            $dEmi = ! empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
3177
+            $dEmi = !empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
3178 3178
                     $this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue : '';
3179 3179
             $aDemi = explode('T', $dEmi);
3180 3180
             $dEmi = $aDemi[0];
3181 3181
         }
3182 3182
         $dd  = $dEmi;
3183 3183
         $rpos = strrpos($dd, '-');
3184
-        $dd  = substr($dd, $rpos +1);
3184
+        $dd  = substr($dd, $rpos + 1);
3185 3185
         $chave = sprintf($forma, $cUF, $this->tpEmis, $CNPJ, $vNF, $vICMS, $icmss, $dd);
3186 3186
         $chave = $chave . $this->modulo11($chave);
3187 3187
         return $chave;
@@ -3202,7 +3202,7 @@  discard block
 block discarded – undo
3202 3202
         $formaNfRef = "\r\nNF  Ref.: série:%d numero:%d emit:%s em %s modelo: %d";
3203 3203
         $formaECFRef = "\r\nECF Ref.: modelo: %s ECF:%d COO:%d";
3204 3204
         $formaNfpRef = "\r\nNFP Ref.: série:%d número:%d emit:%s em %s modelo: %d IE:%s";
3205
-        $saida='';
3205
+        $saida = '';
3206 3206
         $nfRefs = $this->ide->getElementsByTagName('NFref');
3207 3207
         if (0 === $nfRefs->length) {
3208 3208
             return $saida;
@@ -3218,7 +3218,7 @@  discard block
 block discarded – undo
3218 3218
             foreach ($refNFe as $chave_acessoRef) {
3219 3219
                 $chave_acesso = $chave_acessoRef->nodeValue;
3220 3220
                 $chave_acessoF = $this->formatField($chave_acesso, $this->formatoChave);
3221
-                $data = substr($chave_acesso, 4, 2)."/20".substr($chave_acesso, 2, 2);
3221
+                $data = substr($chave_acesso, 4, 2) . "/20" . substr($chave_acesso, 2, 2);
3222 3222
                 $cnpj = $this->formatField(substr($chave_acesso, 6, 14), "##.###.###/####-##");
3223 3223
                 $serie  = substr($chave_acesso, 22, 3);
3224 3224
                 $numero = substr($chave_acesso, 25, 9);
@@ -3239,7 +3239,7 @@  discard block
 block discarded – undo
3239 3239
             foreach ($refCTe as $chave_acessoRef) {
3240 3240
                 $chave_acesso = $chave_acessoRef->nodeValue;
3241 3241
                 $chave_acessoF = $this->formatField($chave_acesso, $this->formatoChave);
3242
-                $data = substr($chave_acesso, 4, 2)."/20".substr($chave_acesso, 2, 2);
3242
+                $data = substr($chave_acesso, 4, 2) . "/20" . substr($chave_acesso, 2, 2);
3243 3243
                 $cnpj = $this->formatField(substr($chave_acesso, 6, 14), "##.###.###/####-##");
3244 3244
                 $serie  = substr($chave_acesso, 22, 3);
3245 3245
                 $numero = substr($chave_acesso, 25, 9);
@@ -3255,10 +3255,9 @@  discard block
 block discarded – undo
3255 3255
             $refNFP = $nfRef->getElementsByTagName('refNFP');
3256 3256
             foreach ($refNFP as $umaRefNFe) {
3257 3257
                 $data = $umaRefNFe->getElementsByTagName('AAMM')->item(0)->nodeValue;
3258
-                $cnpj = ! empty($umaRefNFe->getElementsByTagName('CNPJ')->item(0)->nodeValue) ?
3259
-                    $umaRefNFe->getElementsByTagName('CNPJ')->item(0)->nodeValue :
3260
-                    '';
3261
-                $cpf = ! empty($umaRefNFe->getElementsByTagName('CPF')->item(0)->nodeValue) ?
3258
+                $cnpj = !empty($umaRefNFe->getElementsByTagName('CNPJ')->item(0)->nodeValue) ?
3259
+                    $umaRefNFe->getElementsByTagName('CNPJ')->item(0)->nodeValue : '';
3260
+                $cpf = !empty($umaRefNFe->getElementsByTagName('CPF')->item(0)->nodeValue) ?
3262 3261
                         $umaRefNFe->getElementsByTagName('CPF')->item(0)->nodeValue : '';
3263 3262
                 $mod = $umaRefNFe->getElementsByTagName('mod')->item(0)->nodeValue;
3264 3263
                 $serie = $umaRefNFe->getElementsByTagName('serie')->item(0)->nodeValue;
@@ -3322,6 +3321,6 @@  discard block
 block discarded – undo
3322 3321
         imagedestroy($image);
3323 3322
         $stringdata = ob_get_contents(); // read from buffer
3324 3323
         ob_end_clean();
3325
-        return 'data://text/plain;base64,'.base64_encode($stringdata);
3324
+        return 'data://text/plain;base64,' . base64_encode($stringdata);
3326 3325
     }
3327 3326
 }
Please login to merge, or discard this patch.
src/Common/DaCommon.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -48,10 +48,10 @@
 block discarded – undo
48 48
     }
49 49
     
50 50
         /**
51
-     * Renderiza o pdf e retorna como raw
52
-     *
53
-     * @return string
54
-     */
51
+         * Renderiza o pdf e retorna como raw
52
+         *
53
+         * @return string
54
+         */
55 55
     public function render()
56 56
     {
57 57
         if (empty($this->pdf)) {
Please login to merge, or discard this patch.