Passed
Pull Request — master (#149)
by Roberto
04:13
created
src/NFe/Danfe.php 2 patches
Doc Comments   +21 added lines, -14 removed lines patch added patch discarded remove patch
@@ -988,8 +988,8 @@  discard block
 block discarded – undo
988 988
      *cabecalhoDANFE
989 989
      * Monta o cabelhalho da DANFE (retrato e paisagem)
990 990
      *
991
-     * @param  number $x      Posição horizontal inicial, canto esquerdo
992
-     * @param  number $y      Posição vertical inicial, canto superior
991
+     * @param  integer $x      Posição horizontal inicial, canto esquerdo
992
+     * @param  integer $y      Posição vertical inicial, canto superior
993 993
      * @param  number $pag    Número da Página
994 994
      * @param  number $totPag Total de páginas
995 995
      * @return number Posição vertical final
@@ -1427,8 +1427,8 @@  discard block
 block discarded – undo
1427 1427
      * Monta o campo com os dados do destinatário na DANFE. (retrato e paisagem)
1428 1428
      *
1429 1429
      * @name   destinatarioDANFE
1430
-     * @param  number $x Posição horizontal canto esquerdo
1431
-     * @param  number $y Posição vertical canto superior
1430
+     * @param  integer $x Posição horizontal canto esquerdo
1431
+     * @param  integer $y Posição vertical canto superior
1432 1432
      * @return number Posição vertical final
1433 1433
      */
1434 1434
     protected function pDestinatarioDANFE($x = 0, $y = 0)
@@ -1628,7 +1628,7 @@  discard block
 block discarded – undo
1628 1628
      * Gera a String do Texto da Fatura
1629 1629
       *
1630 1630
      * @name   getTextoFatura
1631
-     * @return uma String com o texto ou "";
1631
+     * @return string String com o texto ou "";
1632 1632
      */
1633 1633
     protected function pGetTextoFatura()
1634 1634
     {
@@ -1682,8 +1682,8 @@  discard block
 block discarded – undo
1682 1682
      * Monta o campo de duplicatas da DANFE (retrato e paisagem)
1683 1683
      *
1684 1684
      * @name   faturaDANFE
1685
-     * @param  number $x Posição horizontal canto esquerdo
1686
-     * @param  number $y Posição vertical canto superior
1685
+     * @param  integer $x Posição horizontal canto esquerdo
1686
+     * @param  double $y Posição vertical canto superior
1687 1687
      * @return number Posição vertical final
1688 1688
      */
1689 1689
     protected function pFaturaDANFE($x, $y)
@@ -1796,6 +1796,8 @@  discard block
 block discarded – undo
1796 1796
      * @param  float $h Altura do campo
1797 1797
      * @param  float $h Título do campo
1798 1798
      * @param  float $h Valor do imposto
1799
+     * @param string $titulo
1800
+     * @param string $campoImposto
1799 1801
      * @return float Sugestão do $x do próximo imposto
1800 1802
      */
1801 1803
     protected function pImpostoDanfeHelper($x, $y, $w, $h, $titulo, $campoImposto)
@@ -1822,9 +1824,9 @@  discard block
 block discarded – undo
1822 1824
      * impostoDANFE
1823 1825
      * Monta o campo de impostos e totais da DANFE (retrato e paisagem)
1824 1826
      *
1825
-     * @param  number $x Posição horizontal canto esquerdo
1826
-     * @param  number $y Posição vertical canto superior
1827
-     * @return number Posição vertical final
1827
+     * @param  integer $x Posição horizontal canto esquerdo
1828
+     * @param  double $y Posição vertical canto superior
1829
+     * @return double Posição vertical final
1828 1830
      */
1829 1831
     protected function pImpostoDANFE($x, $y)
1830 1832
     {
@@ -2206,6 +2208,10 @@  discard block
 block discarded – undo
2206 2208
 
2207 2209
 
2208 2210
 
2211
+    /**
2212
+     * @param string $campo
2213
+     * @param string $formato
2214
+     */
2209 2215
     protected function pDescricaoProdutoHelper($origem, $campo, $formato)
2210 2216
     {
2211 2217
         $valor_original = $origem->getElementsByTagName($campo)->item(0);
@@ -2295,7 +2301,6 @@  discard block
 block discarded – undo
2295 2301
      * @param  float $x       Posição horizontal canto esquerdo
2296 2302
      * @param  float $y       Posição vertical canto superior
2297 2303
      * @param  float $nInicio Número do item inicial
2298
-     * @param  float $max     Número do item final
2299 2304
      * @param  float $hmax    Altura máxima do campo de itens em mm
2300 2305
      * @return float Posição vertical final
2301 2306
      */
@@ -2745,8 +2750,7 @@  discard block
 block discarded – undo
2745 2750
      * sobre a API NfePHP
2746 2751
      *
2747 2752
      * @name   pRodape
2748
-     * @param  float $xInic  Posição horizontal canto esquerdo
2749
-     * @param  float $yFinal Posição vertical final para impressão
2753
+     * @param integer $x
2750 2754
      * @return void
2751 2755
      */
2752 2756
     protected function pRodape($x, $y)
@@ -2769,7 +2773,7 @@  discard block
 block discarded – undo
2769 2773
      * Monta o canhoto da DANFE (retrato e paisagem)
2770 2774
      *
2771 2775
      * @name   canhotoDANFE
2772
-     * @param  number $x Posição horizontal canto esquerdo
2776
+     * @param  integer $x Posição horizontal canto esquerdo
2773 2777
      * @param  number $y Posição vertical canto superior
2774 2778
      * @return number Posição vertical final
2775 2779
      *
@@ -3060,6 +3064,9 @@  discard block
 block discarded – undo
3060 3064
         return $saida;
3061 3065
     }
3062 3066
     
3067
+    /**
3068
+     * @param string $original
3069
+     */
3063 3070
     private function imagePNGtoJPG($original)
3064 3071
     {
3065 3072
         $image = imagecreatefrompng($original);
Please login to merge, or discard this patch.
Spacing   +313 added lines, -320 removed lines patch added patch discarded remove patch
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
      * ativa ou desativa o modo de debug
298 298
      * @var integer
299 299
      */
300
-    protected $debugMode=2;
300
+    protected $debugMode = 2;
301 301
     /**
302 302
      * Creditos para integrador
303 303
      * @var string
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
             $this->fontePadrao = $fonteDANFE;
356 356
         }
357 357
         //se for passado o xml
358
-        if (! empty($this->xml)) {
358
+        if (!empty($this->xml)) {
359 359
             $this->dom = new Dom();
360 360
             $this->dom->loadXML($this->xml);
361 361
             $this->nfeProc    = $this->dom->getElementsByTagName("nfeProc")->item(0);
@@ -511,10 +511,10 @@  discard block
 block discarded – undo
511 511
         //total inicial de paginas
512 512
         $totPag = 1;
513 513
         //largura imprimivel em mm: largura da folha menos as margens esq/direita
514
-        $this->wPrint = $maxW-($margEsq*2);
514
+        $this->wPrint = $maxW - ($margEsq * 2);
515 515
         //comprimento (altura) imprimivel em mm: altura da folha menos as margens
516 516
         //superior e inferior
517
-        $this->hPrint = $maxH-$margSup-$margInf;
517
+        $this->hPrint = $maxH - $margSup - $margInf;
518 518
         // estabelece contagem de paginas
519 519
         $this->pdf->aliasNbPages();
520 520
         // fixa as margens
@@ -552,34 +552,28 @@  discard block
 block discarded – undo
552 552
         }
553 553
         //calcular a altura necessária para os dados adicionais
554 554
         if ($this->orientacao == 'P') {
555
-            $this->wAdic = round($this->wPrint*0.66, 0);
555
+            $this->wAdic = round($this->wPrint * 0.66, 0);
556 556
         } else {
557
-            $this->wAdic = round(($this->wPrint-$this->wCanhoto)*0.5, 0);
557
+            $this->wAdic = round(($this->wPrint - $this->wCanhoto) * 0.5, 0);
558 558
         }
559 559
         $fontProduto = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'');
560 560
         $this->textoAdic = '';
561 561
         if (isset($this->retirada)) {
562
-            $txRetCNPJ = ! empty($this->retirada->getElementsByTagName("CNPJ")->item(0)->nodeValue) ?
563
-                $this->retirada->getElementsByTagName("CNPJ")->item(0)->nodeValue :
564
-                '';
565
-            $txRetxLgr = ! empty($this->retirada->getElementsByTagName("xLgr")->item(0)->nodeValue) ?
566
-                $this->retirada->getElementsByTagName("xLgr")->item(0)->nodeValue :
567
-                '';
568
-            $txRetnro = ! empty($this->retirada->getElementsByTagName("nro")->item(0)->nodeValue) ?
569
-                $this->retirada->getElementsByTagName("nro")->item(0)->nodeValue :
570
-                's/n';
562
+            $txRetCNPJ = !empty($this->retirada->getElementsByTagName("CNPJ")->item(0)->nodeValue) ?
563
+                $this->retirada->getElementsByTagName("CNPJ")->item(0)->nodeValue : '';
564
+            $txRetxLgr = !empty($this->retirada->getElementsByTagName("xLgr")->item(0)->nodeValue) ?
565
+                $this->retirada->getElementsByTagName("xLgr")->item(0)->nodeValue : '';
566
+            $txRetnro = !empty($this->retirada->getElementsByTagName("nro")->item(0)->nodeValue) ?
567
+                $this->retirada->getElementsByTagName("nro")->item(0)->nodeValue : 's/n';
571 568
             $txRetxCpl = $this->pSimpleGetValue($this->retirada, "xCpl", " - ");
572
-            $txRetxBairro = ! empty($this->retirada->getElementsByTagName("xBairro")->item(0)->nodeValue) ?
573
-                $this->retirada->getElementsByTagName("xBairro")->item(0)->nodeValue :
574
-                '';
575
-            $txRetxMun = ! empty($this->retirada->getElementsByTagName("xMun")->item(0)->nodeValue) ?
576
-                $this->retirada->getElementsByTagName("xMun")->item(0)->nodeValue :
577
-                '';
578
-            $txRetUF = ! empty($this->retirada->getElementsByTagName("UF")->item(0)->nodeValue) ?
579
-                $this->retirada->getElementsByTagName("UF")->item(0)->nodeValue :
580
-                '';
581
-            $this->textoAdic .= "LOCAL DE RETIRADA : ".
582
-                    $txRetCNPJ.
569
+            $txRetxBairro = !empty($this->retirada->getElementsByTagName("xBairro")->item(0)->nodeValue) ?
570
+                $this->retirada->getElementsByTagName("xBairro")->item(0)->nodeValue : '';
571
+            $txRetxMun = !empty($this->retirada->getElementsByTagName("xMun")->item(0)->nodeValue) ?
572
+                $this->retirada->getElementsByTagName("xMun")->item(0)->nodeValue : '';
573
+            $txRetUF = !empty($this->retirada->getElementsByTagName("UF")->item(0)->nodeValue) ?
574
+                $this->retirada->getElementsByTagName("UF")->item(0)->nodeValue : '';
575
+            $this->textoAdic .= "LOCAL DE RETIRADA : " .
576
+                    $txRetCNPJ .
583 577
                     '-' .
584 578
                     $txRetxLgr .
585 579
                     ', ' .
@@ -596,24 +590,24 @@  discard block
 block discarded – undo
596 590
         }
597 591
         //dados do local de entrega da mercadoria
598 592
         if (isset($this->entrega)) {
599
-            $txRetCNPJ = ! empty($this->entrega->getElementsByTagName("CNPJ")->item(0)->nodeValue) ?
593
+            $txRetCNPJ = !empty($this->entrega->getElementsByTagName("CNPJ")->item(0)->nodeValue) ?
600 594
                 $this->entrega->getElementsByTagName("CNPJ")->item(0)->nodeValue : '';
601
-            $txRetxLgr = ! empty($this->entrega->getElementsByTagName("xLgr")->item(0)->nodeValue) ?
595
+            $txRetxLgr = !empty($this->entrega->getElementsByTagName("xLgr")->item(0)->nodeValue) ?
602 596
                 $this->entrega->getElementsByTagName("xLgr")->item(0)->nodeValue : '';
603
-            $txRetnro = ! empty($this->entrega->getElementsByTagName("nro")->item(0)->nodeValue) ?
597
+            $txRetnro = !empty($this->entrega->getElementsByTagName("nro")->item(0)->nodeValue) ?
604 598
                 $this->entrega->getElementsByTagName("nro")->item(0)->nodeValue : 's/n';
605 599
             $txRetxCpl = $this->pSimpleGetValue($this->entrega, "xCpl", " - ");
606
-            $txRetxBairro = ! empty($this->entrega->getElementsByTagName("xBairro")->item(0)->nodeValue) ?
600
+            $txRetxBairro = !empty($this->entrega->getElementsByTagName("xBairro")->item(0)->nodeValue) ?
607 601
                 $this->entrega->getElementsByTagName("xBairro")->item(0)->nodeValue : '';
608
-            $txRetxMun = ! empty($this->entrega->getElementsByTagName("xMun")->item(0)->nodeValue) ?
602
+            $txRetxMun = !empty($this->entrega->getElementsByTagName("xMun")->item(0)->nodeValue) ?
609 603
                 $this->entrega->getElementsByTagName("xMun")->item(0)->nodeValue : '';
610
-            $txRetUF = ! empty($this->entrega->getElementsByTagName("UF")->item(0)->nodeValue) ?
604
+            $txRetUF = !empty($this->entrega->getElementsByTagName("UF")->item(0)->nodeValue) ?
611 605
                 $this->entrega->getElementsByTagName("UF")->item(0)->nodeValue : '';
612 606
             if ($this->textoAdic != '') {
613 607
                 $this->textoAdic .= ". \r\n";
614 608
             }
615
-            $this->textoAdic .= "LOCAL DE ENTREGA : ".$txRetCNPJ.'-'.$txRetxLgr.', '.$txRetnro.' '.$txRetxCpl.
616
-               ' - '.$txRetxBairro.' '.$txRetxMun.' - '.$txRetUF."\r\n";
609
+            $this->textoAdic .= "LOCAL DE ENTREGA : " . $txRetCNPJ . '-' . $txRetxLgr . ', ' . $txRetnro . ' ' . $txRetxCpl .
610
+               ' - ' . $txRetxBairro . ' ' . $txRetxMun . ' - ' . $txRetUF . "\r\n";
617 611
         }
618 612
         //informações adicionais
619 613
         $this->textoAdic .= $this->pGeraInformacoesDasNotasReferenciadas();
@@ -622,7 +616,7 @@  discard block
 block discarded – undo
622 616
             if ($this->textoAdic != '') {
623 617
                 $this->textoAdic .= ". \r\n";
624 618
             }
625
-            $this->textoAdic .= ! empty($this->infAdic->getElementsByTagName("infCpl")->item(0)->nodeValue) ?
619
+            $this->textoAdic .= !empty($this->infAdic->getElementsByTagName("infCpl")->item(0)->nodeValue) ?
626 620
                 'Inf. Contribuinte: ' .
627 621
                 trim($this->pAnfavea($this->infAdic->getElementsByTagName("infCpl")->item(0)->nodeValue)) : '';
628 622
             $infPedido = $this->pGeraInformacoesDaTagCompra();
@@ -630,14 +624,14 @@  discard block
 block discarded – undo
630 624
                 $this->textoAdic .= $infPedido;
631 625
             }
632 626
             $this->textoAdic .= $this->pSimpleGetValue($this->dest, "email", ' Email do Destinatário: ');
633
-            $this->textoAdic .= ! empty($this->infAdic->getElementsByTagName("infAdFisco")->item(0)->nodeValue) ?
627
+            $this->textoAdic .= !empty($this->infAdic->getElementsByTagName("infAdFisco")->item(0)->nodeValue) ?
634 628
                 "\r\n Inf. fisco: " .
635 629
                 trim($this->infAdic->getElementsByTagName("infAdFisco")->item(0)->nodeValue) : '';
636 630
             $obsCont = $this->infAdic->getElementsByTagName("obsCont");
637 631
             if (isset($obsCont)) {
638 632
                 foreach ($obsCont as $obs) {
639
-                    $campo =  $obsCont->item($i)->getAttribute("xCampo");
640
-                    $xTexto = ! empty($obsCont->item($i)->getElementsByTagName("xTexto")->item(0)->nodeValue) ?
633
+                    $campo = $obsCont->item($i)->getAttribute("xCampo");
634
+                    $xTexto = !empty($obsCont->item($i)->getElementsByTagName("xTexto")->item(0)->nodeValue) ?
641 635
                         $obsCont->item($i)->getElementsByTagName("xTexto")->item(0)->nodeValue : '';
642 636
                     $this->textoAdic .= "\r\n" . $campo . ':  ' . trim($xTexto);
643 637
                     $i++;
@@ -665,38 +659,38 @@  discard block
 block discarded – undo
665 659
         foreach ($alinhas as $linha) {
666 660
             $numlinhasdados += $this->pGetNumLines($linha, $this->wAdic, $fontProduto);
667 661
         }
668
-        $hdadosadic = round(($numlinhasdados+3) * $this->pdf->fontSize, 0);
662
+        $hdadosadic = round(($numlinhasdados + 3) * $this->pdf->fontSize, 0);
669 663
         if ($hdadosadic < 10) {
670 664
             $hdadosadic = 10;
671 665
         }
672 666
         //altura disponivel para os campos da DANFE
673
-        $hcabecalho = 47;//para cabeçalho
674
-        $hdestinatario = 25;//para destinatario
675
-        $hduplicatas = 12;//para cada grupo de 7 duplicatas
676
-        $himposto = 18;// para imposto
677
-        $htransporte = 25;// para transporte
678
-        $hissqn = 11;// para issqn
679
-        $hfooter = 5;// para rodape
680
-        $hCabecItens = 4;//cabeçalho dos itens
667
+        $hcabecalho = 47; //para cabeçalho
668
+        $hdestinatario = 25; //para destinatario
669
+        $hduplicatas = 12; //para cada grupo de 7 duplicatas
670
+        $himposto = 18; // para imposto
671
+        $htransporte = 25; // para transporte
672
+        $hissqn = 11; // para issqn
673
+        $hfooter = 5; // para rodape
674
+        $hCabecItens = 4; //cabeçalho dos itens
681 675
         //alturas disponiveis para os dados
682 676
         $hDispo1 = $this->hPrint - 10 - ($hcabecalho +
683 677
             $hdestinatario + ($linhasDup * $hduplicatas) + $himposto + $htransporte +
684 678
             ($linhaISSQN * $hissqn) + $hdadosadic + $hfooter + $hCabecItens +
685 679
             $this->pSizeExtraTextoFatura());
686 680
         if ($this->orientacao == 'P') {
687
-            $hDispo1 -= 23 * $this->qCanhoto;//para canhoto
681
+            $hDispo1 -= 23 * $this->qCanhoto; //para canhoto
688 682
             $w = $this->wPrint;
689 683
         } else {
690
-            $hcanhoto = $this->hPrint;//para canhoto
684
+            $hcanhoto = $this->hPrint; //para canhoto
691 685
             $w = $this->wPrint - $this->wCanhoto;
692 686
         }
693
-        $hDispo2 = $this->hPrint - 10 - ($hcabecalho + $hfooter + $hCabecItens)-4;
687
+        $hDispo2 = $this->hPrint - 10 - ($hcabecalho + $hfooter + $hCabecItens) - 4;
694 688
         //Contagem da altura ocupada para impressão dos itens
695 689
         $fontProduto = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'');
696 690
         $i = 0;
697 691
         $numlinhas = 0;
698 692
         $hUsado = $hCabecItens;
699
-        $w2 = round($w*0.28, 0);
693
+        $w2 = round($w * 0.28, 0);
700 694
         $hDispo = $hDispo1;
701 695
         $totPag = 1;
702 696
         while ($i < $this->det->length) {
@@ -708,7 +702,7 @@  discard block
 block discarded – undo
708 702
                 $hDispo = $hDispo2;
709 703
                 $hUsado = $hCabecItens;
710 704
                 // Remove canhoto para páginas secundárias em modo paisagem ('L')
711
-                $w2 = round($this->wPrint*0.28, 0);
705
+                $w2 = round($this->wPrint * 0.28, 0);
712 706
                 $i--; // decrementa para readicionar o item que não coube nessa pagina na outra.
713 707
             }
714 708
             $i++;
@@ -732,19 +726,19 @@  discard block
 block discarded – undo
732 726
         //coloca o cabeçalho
733 727
         $y = $this->pCabecalhoDANFE($x, $y, $pag, $totPag);
734 728
         //coloca os dados do destinatário
735
-        $y = $this->pDestinatarioDANFE($x, $y+1);
729
+        $y = $this->pDestinatarioDANFE($x, $y + 1);
736 730
         //coloca os dados das faturas
737
-        $y = $this->pFaturaDANFE($x, $y+1);
731
+        $y = $this->pFaturaDANFE($x, $y + 1);
738 732
         //coloca os dados dos impostos e totais da NFe
739
-        $y = $this->pImpostoDANFE($x, $y+1);
733
+        $y = $this->pImpostoDANFE($x, $y + 1);
740 734
         //coloca os dados do trasnporte
741
-        $y = $this->pTransporteDANFE($x, $y+1);
735
+        $y = $this->pTransporteDANFE($x, $y + 1);
742 736
         //itens da DANFE
743 737
         $nInicial = 0;
744
-        $y = $this->pItensDANFE($x, $y+1, $nInicial, $hDispo1, $pag, $totPag, $hCabecItens);
738
+        $y = $this->pItensDANFE($x, $y + 1, $nInicial, $hDispo1, $pag, $totPag, $hCabecItens);
745 739
         //coloca os dados do ISSQN
746 740
         if ($linhaISSQN == 1) {
747
-            $y = $this->pIssqnDANFE($x, $y+4);
741
+            $y = $this->pIssqnDANFE($x, $y + 4);
748 742
         } else {
749 743
             $y += 4;
750 744
         }
@@ -752,7 +746,7 @@  discard block
 block discarded – undo
752 746
         $y = $this->pDadosAdicionaisDANFE($x, $y, $hdadosadic);
753 747
         //coloca o rodapé da página
754 748
         if ($this->orientacao == 'P') {
755
-            $this->pRodape($xInic, $y-1);
749
+            $this->pRodape($xInic, $y - 1);
756 750
         } else {
757 751
             $this->pRodape($xInic, $this->hPrint + 1);
758 752
         }
@@ -772,7 +766,7 @@  discard block
 block discarded – undo
772 766
             //coloca o cabeçalho na página adicional
773 767
             $y = $this->pCabecalhoDANFE($x, $y, $n, $totPag);
774 768
             //coloca os itens na página adicional
775
-            $y = $this->pItensDANFE($x, $y+1, $nInicial, $hDispo2, $n, $totPag, $hCabecItens);
769
+            $y = $this->pItensDANFE($x, $y + 1, $nInicial, $hDispo2, $n, $totPag, $hCabecItens);
776 770
             //coloca o rodapé da página
777 771
             if ($this->orientacao == 'P') {
778 772
                 $this->pRodape($xInic, $y + 4);
@@ -785,7 +779,7 @@  discard block
 block discarded – undo
785 779
             }
786 780
         }
787 781
         //retorna o ID na NFe
788
-        if ($classPdf!==false) {
782
+        if ($classPdf !== false) {
789 783
             $aR = array(
790 784
              'id'=>str_replace('NFe', '', $this->infNFe->getAttribute("Id")),
791 785
              'classe_PDF'=>$this->pdf);
@@ -818,7 +812,7 @@  discard block
 block discarded – undo
818 812
         if ($startPos === false) {
819 813
             return $cdata;
820 814
         }
821
-        for ($x=$len; $x>0; $x--) {
815
+        for ($x = $len; $x > 0; $x--) {
822 816
             if (substr($cdata, $x, 1) == '>') {
823 817
                 $endPos = $x;
824 818
                 break;
@@ -829,15 +823,15 @@  discard block
 block discarded – undo
829 823
         } else {
830 824
             $parte1 = '';
831 825
         }
832
-        $parte2 = substr($cdata, $startPos, $endPos-$startPos+1);
826
+        $parte2 = substr($cdata, $startPos, $endPos - $startPos + 1);
833 827
         if ($endPos < $len) {
834 828
             $parte3 = substr($cdata, $endPos + 1, $len - $endPos - 1);
835 829
         } else {
836 830
             $parte3 = '';
837 831
         }
838
-        $texto = trim($parte1).' '.trim($parte3);
832
+        $texto = trim($parte1) . ' ' . trim($parte3);
839 833
         if (strpos($parte2, '<CDATA>') === false) {
840
-            $cdata = '<CDATA>'.$parte2.'</CDATA>';
834
+            $cdata = '<CDATA>' . $parte2 . '</CDATA>';
841 835
         } else {
842 836
             $cdata = $parte2;
843 837
         }
@@ -911,15 +905,15 @@  discard block
 block discarded – undo
911 905
         //grupo CADATA infCpl
912 906
         $t = $dom->getElementsByTagName('transmissor')->item(0);
913 907
         $r = $dom->getElementsByTagName('receptor')->item(0);
914
-        $versao = ! empty($dom->getElementsByTagName('versao')->item(0)->nodeValue) ?
915
-            'Versao:'.$dom->getElementsByTagName('versao')->item(0)->nodeValue.' ' : '';
916
-        $especieNF = ! empty($dom->getElementsByTagName('especieNF')->item(0)->nodeValue) ?
917
-            'Especie:'.$dom->getElementsByTagName('especieNF')->item(0)->nodeValue.' ' : '';
918
-        $fabEntrega = ! empty($dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue) ?
919
-            'Entrega:'.$dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue.' ' : '';
920
-        $dca = ! empty($dom->getElementsByTagName('dca')->item(0)->nodeValue) ?
921
-            'dca:'.$dom->getElementsByTagName('dca')->item(0)->nodeValue.' ' : '';
922
-        $texto .= "".$versao.$especieNF.$fabEntrega.$dca;
908
+        $versao = !empty($dom->getElementsByTagName('versao')->item(0)->nodeValue) ?
909
+            'Versao:' . $dom->getElementsByTagName('versao')->item(0)->nodeValue . ' ' : '';
910
+        $especieNF = !empty($dom->getElementsByTagName('especieNF')->item(0)->nodeValue) ?
911
+            'Especie:' . $dom->getElementsByTagName('especieNF')->item(0)->nodeValue . ' ' : '';
912
+        $fabEntrega = !empty($dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue) ?
913
+            'Entrega:' . $dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue . ' ' : '';
914
+        $dca = !empty($dom->getElementsByTagName('dca')->item(0)->nodeValue) ?
915
+            'dca:' . $dom->getElementsByTagName('dca')->item(0)->nodeValue . ' ' : '';
916
+        $texto .= "" . $versao . $especieNF . $fabEntrega . $dca;
923 917
         if (isset($t)) {
924 918
             if ($t->hasAttributes()) {
925 919
                 $texto .= " Transmissor ";
@@ -1009,14 +1003,14 @@  discard block
 block discarded – undo
1009 1003
         }
1010 1004
         //####################################################################################
1011 1005
         //coluna esquerda identificação do emitente
1012
-        $w = round($maxW*0.41, 0);
1006
+        $w = round($maxW * 0.41, 0);
1013 1007
         if ($this->orientacao == 'P') {
1014 1008
             $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'I');
1015 1009
         } else {
1016 1010
             $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B');
1017 1011
         }
1018 1012
         $w1 = $w;
1019
-        $h=32;
1013
+        $h = 32;
1020 1014
         $oldY += $h;
1021 1015
         $this->pTextBox($x, $y, $w, $h);
1022 1016
         $texto = 'IDENTIFICAÇÃO DO EMITENTE';
@@ -1037,39 +1031,39 @@  discard block
 block discarded – undo
1037 1031
                 $type == 'jpg';
1038 1032
             }
1039 1033
             //largura da imagem em mm
1040
-            $logoWmm = ($logoInfo[0]/72)*25.4;
1034
+            $logoWmm = ($logoInfo[0] / 72) * 25.4;
1041 1035
             //altura da imagem em mm
1042
-            $logoHmm = ($logoInfo[1]/72)*25.4;
1043
-            if ($this->logoAlign=='L') {
1044
-                $nImgW = round($w/3, 0);
1045
-                $nImgH = round($logoHmm * ($nImgW/$logoWmm), 0);
1046
-                $xImg = $x+1;
1047
-                $yImg = round(($h-$nImgH)/2, 0)+$y;
1036
+            $logoHmm = ($logoInfo[1] / 72) * 25.4;
1037
+            if ($this->logoAlign == 'L') {
1038
+                $nImgW = round($w / 3, 0);
1039
+                $nImgH = round($logoHmm * ($nImgW / $logoWmm), 0);
1040
+                $xImg = $x + 1;
1041
+                $yImg = round(($h - $nImgH) / 2, 0) + $y;
1048 1042
                 //estabelecer posições do texto
1049
-                $x1 = round($xImg + $nImgW +1, 0);
1050
-                $y1 = round($h/3+$y, 0);
1051
-                $tw = round(2*$w/3, 0);
1052
-            } elseif ($this->logoAlign=='C') {
1053
-                $nImgH = round($h/3, 0);
1054
-                $nImgW = round($logoWmm * ($nImgH/$logoHmm), 0);
1055
-                $xImg = round(($w-$nImgW)/2+$x, 0);
1056
-                $yImg = $y+3;
1043
+                $x1 = round($xImg + $nImgW + 1, 0);
1044
+                $y1 = round($h / 3 + $y, 0);
1045
+                $tw = round(2 * $w / 3, 0);
1046
+            } elseif ($this->logoAlign == 'C') {
1047
+                $nImgH = round($h / 3, 0);
1048
+                $nImgW = round($logoWmm * ($nImgH / $logoHmm), 0);
1049
+                $xImg = round(($w - $nImgW) / 2 + $x, 0);
1050
+                $yImg = $y + 3;
1057 1051
                 $x1 = $x;
1058 1052
                 $y1 = round($yImg + $nImgH + 1, 0);
1059 1053
                 $tw = $w;
1060
-            } elseif ($this->logoAlign=='R') {
1061
-                $nImgW = round($w/3, 0);
1062
-                $nImgH = round($logoHmm * ($nImgW/$logoWmm), 0);
1063
-                $xImg = round($x+($w-(1+$nImgW)), 0);
1064
-                $yImg = round(($h-$nImgH)/2, 0)+$y;
1054
+            } elseif ($this->logoAlign == 'R') {
1055
+                $nImgW = round($w / 3, 0);
1056
+                $nImgH = round($logoHmm * ($nImgW / $logoWmm), 0);
1057
+                $xImg = round($x + ($w - (1 + $nImgW)), 0);
1058
+                $yImg = round(($h - $nImgH) / 2, 0) + $y;
1065 1059
                 $x1 = $x;
1066
-                $y1 = round($h/3+$y, 0);
1067
-                $tw = round(2*$w/3, 0);
1068
-            } elseif ($this->logoAlign=='F') {
1069
-                $nImgH = round($h-5, 0);
1070
-                $nImgW = round($logoWmm * ($nImgH/$logoHmm), 0);
1071
-                $xImg = round(($w-$nImgW)/2+$x, 0);
1072
-                $yImg = $y+3;
1060
+                $y1 = round($h / 3 + $y, 0);
1061
+                $tw = round(2 * $w / 3, 0);
1062
+            } elseif ($this->logoAlign == 'F') {
1063
+                $nImgH = round($h - 5, 0);
1064
+                $nImgW = round($logoWmm * ($nImgH / $logoHmm), 0);
1065
+                $xImg = round(($w - $nImgW) / 2 + $x, 0);
1066
+                $yImg = $y + 3;
1073 1067
                 $x1 = $x;
1074 1068
                 $y1 = round($yImg + $nImgH + 1, 0);
1075 1069
                 $tw = $w;
@@ -1078,7 +1072,7 @@  discard block
 block discarded – undo
1078 1072
             $this->pdf->Image($this->logomarca, $xImg, $yImg, $nImgW, $nImgH, $type);
1079 1073
         } else {
1080 1074
             $x1 = $x;
1081
-            $y1 = round($h/3+$y, 0);
1075
+            $y1 = round($h / 3 + $y, 0);
1082 1076
             $tw = $w;
1083 1077
         }
1084 1078
         // monta as informações apenas se diferente de full logo
@@ -1088,9 +1082,9 @@  discard block
 block discarded – undo
1088 1082
             $texto = $this->emit->getElementsByTagName("xNome")->item(0)->nodeValue;
1089 1083
             $this->pTextBox($x1, $y1, $tw, 8, $texto, $aFont, 'T', 'C', 0, '');
1090 1084
             //endereço
1091
-            $y1 = $y1+5;
1085
+            $y1 = $y1 + 5;
1092 1086
             $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'');
1093
-            $fone = ! empty($this->enderEmit->getElementsByTagName("fone")->item(0)->nodeValue)
1087
+            $fone = !empty($this->enderEmit->getElementsByTagName("fone")->item(0)->nodeValue)
1094 1088
                  ? $this->enderEmit->getElementsByTagName("fone")->item(0)->nodeValue
1095 1089
                  : '';
1096 1090
             $lgr = $this->pSimpleGetValue($this->enderEmit, "xLgr");
@@ -1110,37 +1104,37 @@  discard block
 block discarded – undo
1110 1104
         //####################################################################################
1111 1105
         //coluna central Danfe
1112 1106
         $x += $w;
1113
-        $w=round($maxW * 0.17, 0);//35;
1107
+        $w = round($maxW * 0.17, 0); //35;
1114 1108
         $w2 = $w;
1115 1109
         $h = 32;
1116 1110
         $this->pTextBox($x, $y, $w, $h);
1117 1111
 
1118
-        if (! $this->pNotaCancelada()) {
1112
+        if (!$this->pNotaCancelada()) {
1119 1113
             // A PRINCIPIO NÃO PRECISAVA, POIS A NFE ESTÁ AUTORIZADA,
1120 1114
             // SÓ SE RETIRA O DANFE PARA NOTAS NÃO AUTORIZADAS
1121 1115
             $texto = "DANFE";
1122 1116
             $aFont = array('font'=>$this->fontePadrao, 'size'=>14, 'style'=>'B');
1123
-            $this->pTextBox($x, $y+1, $w, $h, $texto, $aFont, 'T', 'C', 0, '');
1117
+            $this->pTextBox($x, $y + 1, $w, $h, $texto, $aFont, 'T', 'C', 0, '');
1124 1118
             $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'');
1125 1119
             $texto = 'Documento Auxiliar da Nota Fiscal Eletrônica';
1126 1120
             $h = 20;
1127
-            $this->pTextBox($x, $y+6, $w, $h, $texto, $aFont, 'T', 'C', 0, '', false);
1121
+            $this->pTextBox($x, $y + 6, $w, $h, $texto, $aFont, 'T', 'C', 0, '', false);
1128 1122
         }
1129 1123
 
1130 1124
         $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'');
1131 1125
         $texto = '0 - ENTRADA';
1132 1126
         $y1 = $y + 14;
1133 1127
         $h = 8;
1134
-        $this->pTextBox($x+2, $y1, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1128
+        $this->pTextBox($x + 2, $y1, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1135 1129
         $texto = '1 - SAÍDA';
1136 1130
         $y1 = $y + 17;
1137
-        $this->pTextBox($x+2, $y1, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1131
+        $this->pTextBox($x + 2, $y1, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1138 1132
         //tipo de nF
1139 1133
         $aFont = array('font'=>$this->fontePadrao, 'size'=>12, 'style'=>'B');
1140 1134
         $y1 = $y + 13;
1141 1135
         $h = 7;
1142 1136
         $texto = $this->ide->getElementsByTagName('tpNF')->item(0)->nodeValue;
1143
-        $this->pTextBox($x+27, $y1, 5, $h, $texto, $aFont, 'C', 'C', 1, '');
1137
+        $this->pTextBox($x + 27, $y1, 5, $h, $texto, $aFont, 'C', 'C', 1, '');
1144 1138
         //numero da NF
1145 1139
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
1146 1140
         $y1 = $y + 20;
@@ -1162,7 +1156,7 @@  discard block
 block discarded – undo
1162 1156
         //####################################################################################
1163 1157
         //coluna codigo de barras
1164 1158
         $x += $w;
1165
-        $w = ($maxW-$w1-$w2);//85;
1159
+        $w = ($maxW - $w1 - $w2); //85;
1166 1160
         $w3 = $w;
1167 1161
         $h = 32;
1168 1162
         $this->pTextBox($x, $y, $w, $h);
@@ -1171,22 +1165,22 @@  discard block
 block discarded – undo
1171 1165
         $bW = 75;
1172 1166
         $bH = 12;
1173 1167
         //codigo de barras
1174
-        $this->pdf->Code128($x+(($w-$bW)/2), $y+2, $chave_acesso, $bW, $bH);
1168
+        $this->pdf->Code128($x + (($w - $bW) / 2), $y + 2, $chave_acesso, $bW, $bH);
1175 1169
         //linhas divisorias
1176
-        $this->pdf->Line($x, $y+4+$bH, $x+$w, $y+4+$bH);
1177
-        $this->pdf->Line($x, $y+12+$bH, $x+$w, $y+12+$bH);
1170
+        $this->pdf->Line($x, $y + 4 + $bH, $x + $w, $y + 4 + $bH);
1171
+        $this->pdf->Line($x, $y + 12 + $bH, $x + $w, $y + 12 + $bH);
1178 1172
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1179
-        $y1 = $y+4+$bH;
1173
+        $y1 = $y + 4 + $bH;
1180 1174
         $h = 7;
1181 1175
         $texto = 'CHAVE DE ACESSO';
1182 1176
         $this->pTextBox($x, $y1, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1183 1177
         $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B');
1184
-        $y1 = $y+8+$bH;
1178
+        $y1 = $y + 8 + $bH;
1185 1179
         $texto = $this->pFormat($chave_acesso, $this->formatoChave);
1186
-        $this->pTextBox($x+2, $y1, $w-2, $h, $texto, $aFont, 'T', 'C', 0, '');
1187
-        $y1 = $y+12+$bH;
1180
+        $this->pTextBox($x + 2, $y1, $w - 2, $h, $texto, $aFont, 'T', 'C', 0, '');
1181
+        $y1 = $y + 12 + $bH;
1188 1182
         $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'');
1189
-        $chaveContingencia="";
1183
+        $chaveContingencia = "";
1190 1184
         if ($this->pNotaDPEC()) {
1191 1185
             $cabecalhoProtoAutorizacao = 'NÚMERO DE REGISTRO DPEC';
1192 1186
         } else {
@@ -1197,16 +1191,16 @@  discard block
 block discarded – undo
1197 1191
             $chaveContingencia = $this->pGeraChaveAdicionalDeContingencia();
1198 1192
             $this->pdf->SetFillColor(0, 0, 0);
1199 1193
             //codigo de barras
1200
-            $this->pdf->Code128($x+11, $y1+1, $chaveContingencia, $bW*.9, $bH/2);
1194
+            $this->pdf->Code128($x + 11, $y1 + 1, $chaveContingencia, $bW * .9, $bH / 2);
1201 1195
         } else {
1202 1196
             $texto = 'Consulta de autenticidade no portal nacional da NF-e';
1203
-            $this->pTextBox($x+2, $y1, $w-2, $h, $texto, $aFont, 'T', 'C', 0, '');
1204
-            $y1 = $y+16+$bH;
1197
+            $this->pTextBox($x + 2, $y1, $w - 2, $h, $texto, $aFont, 'T', 'C', 0, '');
1198
+            $y1 = $y + 16 + $bH;
1205 1199
             $texto = 'www.nfe.fazenda.gov.br/portal ou no site da Sefaz Autorizadora';
1206 1200
             $this->pTextBox(
1207
-                $x+2,
1201
+                $x + 2,
1208 1202
                 $y1,
1209
-                $w-2,
1203
+                $w - 2,
1210 1204
                 $h,
1211 1205
                 $texto,
1212 1206
                 $aFont,
@@ -1222,7 +1216,7 @@  discard block
 block discarded – undo
1222 1216
         //natureza da operação
1223 1217
         $texto = 'NATUREZA DA OPERAÇÃO';
1224 1218
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1225
-        $w = $w1+$w2;
1219
+        $w = $w1 + $w2;
1226 1220
         $y = $oldY;
1227 1221
         $oldY += $h;
1228 1222
         $x = $oldX;
@@ -1252,7 +1246,7 @@  discard block
 block discarded – undo
1252 1246
                 $cStat = '';
1253 1247
             } else {
1254 1248
                 if (isset($this->nfeProc)) {
1255
-                    $texto = ! empty($this->nfeProc->getElementsByTagName("nProt")->item(0)->nodeValue) ?
1249
+                    $texto = !empty($this->nfeProc->getElementsByTagName("nProt")->item(0)->nodeValue) ?
1256 1250
                             $this->nfeProc->getElementsByTagName("nProt")->item(0)->nodeValue : '';
1257 1251
                     $tsHora = $this->pConvertTime($this->nfeProc->getElementsByTagName("dhRecbto")->item(0)->nodeValue);
1258 1252
                     if ($texto != '') {
@@ -1283,25 +1277,25 @@  discard block
 block discarded – undo
1283 1277
         $texto = 'INSCRIÇÃO ESTADUAL DO SUBST. TRIBUT.';
1284 1278
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1285 1279
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1286
-        $texto = ! empty($this->emit->getElementsByTagName("IEST")->item(0)->nodeValue)
1280
+        $texto = !empty($this->emit->getElementsByTagName("IEST")->item(0)->nodeValue)
1287 1281
              ? $this->emit->getElementsByTagName("IEST")->item(0)->nodeValue
1288 1282
              : '';
1289 1283
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
1290 1284
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1291 1285
         //CNPJ
1292 1286
         $x += $w;
1293
-        $w = ($maxW-(2*$w));
1287
+        $w = ($maxW - (2 * $w));
1294 1288
         $texto = 'CNPJ / CPF';
1295 1289
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1296 1290
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1297 1291
         //Pegando valor do CPF/CNPJ
1298
-        if (! empty($this->emit->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1292
+        if (!empty($this->emit->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1299 1293
             $texto = $this->pFormat(
1300 1294
                 $this->emit->getElementsByTagName("CNPJ")->item(0)->nodeValue,
1301 1295
                 "###.###.###/####-##"
1302 1296
             );
1303 1297
         } else {
1304
-            $texto = ! empty($this->emit->getElementsByTagName("CPF")->item(0)->nodeValue) ?
1298
+            $texto = !empty($this->emit->getElementsByTagName("CPF")->item(0)->nodeValue) ?
1305 1299
                 $this->pFormat(
1306 1300
                     $this->emit->getElementsByTagName("CPF")->item(0)->nodeValue,
1307 1301
                     "###.###.###-##"
@@ -1317,9 +1311,9 @@  discard block
 block discarded – undo
1317 1311
         if ($this->pNotaCancelada()) {
1318 1312
             //101 Cancelamento
1319 1313
             $x = 10;
1320
-            $y = $this->hPrint-130;
1314
+            $y = $this->hPrint - 130;
1321 1315
             $h = 25;
1322
-            $w = $maxW-(2*$x);
1316
+            $w = $maxW - (2 * $x);
1323 1317
             $this->pdf->SetTextColor(90, 90, 90);
1324 1318
             $texto = "NFe CANCELADA";
1325 1319
             $aFont = array('font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B');
@@ -1330,12 +1324,12 @@  discard block
 block discarded – undo
1330 1324
         if ($this->pNotaDPEC() || $this->tpEmis == 4) {
1331 1325
             //DPEC
1332 1326
             $x = 10;
1333
-            $y = $this->hPrint-130;
1327
+            $y = $this->hPrint - 130;
1334 1328
             $h = 25;
1335
-            $w = $maxW-(2*$x);
1329
+            $w = $maxW - (2 * $x);
1336 1330
             $this->pdf->SetTextColor(200, 200, 200);
1337
-            $texto = "DANFE impresso em contingência -\n".
1338
-                     "DPEC regularmente recebido pela Receita\n".
1331
+            $texto = "DANFE impresso em contingência -\n" .
1332
+                     "DPEC regularmente recebido pela Receita\n" .
1339 1333
                      "Federal do Brasil";
1340 1334
             $aFont = array('font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B');
1341 1335
             $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
@@ -1344,22 +1338,22 @@  discard block
 block discarded – undo
1344 1338
         if ($this->pNotaDenegada()) {
1345 1339
             //110 301 302 Denegada
1346 1340
             $x = 10;
1347
-            $y = $this->hPrint-130;
1341
+            $y = $this->hPrint - 130;
1348 1342
             $h = 25;
1349
-            $w = $maxW-(2*$x);
1343
+            $w = $maxW - (2 * $x);
1350 1344
             $this->pdf->SetTextColor(90, 90, 90);
1351 1345
             $texto = "NFe USO DENEGADO";
1352 1346
             $aFont = array('font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B');
1353 1347
             $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1354 1348
             $y += $h;
1355 1349
             $h = 5;
1356
-            $w = $maxW-(2*$x);
1350
+            $w = $maxW - (2 * $x);
1357 1351
             if (isset($this->infProt)) {
1358 1352
                 $xMotivo = $this->infProt->getElementsByTagName("xMotivo")->item(0)->nodeValue;
1359 1353
             } else {
1360 1354
                 $xMotivo = '';
1361 1355
             }
1362
-            $texto = "SEM VALOR FISCAL\n".$xMotivo;
1356
+            $texto = "SEM VALOR FISCAL\n" . $xMotivo;
1363 1357
             $aFont = array('font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B');
1364 1358
             $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1365 1359
             $this->pdf->SetTextColor(0, 0, 0);
@@ -1368,29 +1362,29 @@  discard block
 block discarded – undo
1368 1362
         if ($tpAmb != 1) {
1369 1363
             $x = 10;
1370 1364
             if ($this->orientacao == 'P') {
1371
-                $y = round($this->hPrint*2/3, 0);
1365
+                $y = round($this->hPrint * 2 / 3, 0);
1372 1366
             } else {
1373
-                $y = round($this->hPrint/2, 0);
1367
+                $y = round($this->hPrint / 2, 0);
1374 1368
             }
1375 1369
             $h = 5;
1376
-            $w = $maxW-(2*$x);
1370
+            $w = $maxW - (2 * $x);
1377 1371
             $this->pdf->SetTextColor(90, 90, 90);
1378 1372
             $texto = "SEM VALOR FISCAL";
1379 1373
             $aFont = array('font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B');
1380 1374
             $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1381 1375
             $aFont = array('font'=>$this->fontePadrao, 'size'=>30, 'style'=>'B');
1382 1376
             $texto = "AMBIENTE DE HOMOLOGAÇÃO";
1383
-            $this->pTextBox($x, $y+14, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1377
+            $this->pTextBox($x, $y + 14, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1384 1378
             $this->pdf->SetTextColor(0, 0, 0);
1385 1379
         } else {
1386 1380
             $x = 10;
1387 1381
             if ($this->orientacao == 'P') {
1388
-                $y = round($this->hPrint*2/3, 0);
1382
+                $y = round($this->hPrint * 2 / 3, 0);
1389 1383
             } else {
1390
-                $y = round($this->hPrint/2, 0);
1384
+                $y = round($this->hPrint / 2, 0);
1391 1385
             }//fim orientacao
1392 1386
             $h = 5;
1393
-            $w = $maxW-(2*$x);
1387
+            $w = $maxW - (2 * $x);
1394 1388
             $this->pdf->SetTextColor(90, 90, 90);
1395 1389
             //indicar FALTA DO PROTOCOLO se NFe não for em contingência
1396 1390
             if (($this->tpEmis == 2 || $this->tpEmis == 5) && !$this->pNotaDPEC()) {
@@ -1400,7 +1394,7 @@  discard block
 block discarded – undo
1400 1394
                 $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1401 1395
                 $aFont = array('font'=>$this->fontePadrao, 'size'=>30, 'style'=>'B');
1402 1396
                 $texto = "devido à problemas técnicos";
1403
-                $this->pTextBox($x, $y+12, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1397
+                $this->pTextBox($x, $y + 12, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1404 1398
             } else {
1405 1399
                 if (!isset($this->nfeProc)) {
1406 1400
                     if (!$this->pNotaDPEC()) {
@@ -1411,9 +1405,9 @@  discard block
 block discarded – undo
1411 1405
                     $aFont = array('font'=>$this->fontePadrao, 'size'=>30, 'style'=>'B');
1412 1406
                     $texto = "FALTA PROTOCOLO DE APROVAÇÃO DA SEFAZ";
1413 1407
                     if (!$this->pNotaDPEC()) {
1414
-                        $this->pTextBox($x, $y+12, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1408
+                        $this->pTextBox($x, $y + 12, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1415 1409
                     } else {
1416
-                        $this->pTextBox($x, $y+25, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1410
+                        $this->pTextBox($x, $y + 25, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1417 1411
                     }
1418 1412
                 }//fim nefProc
1419 1413
             }//fim tpEmis
@@ -1448,7 +1442,7 @@  discard block
 block discarded – undo
1448 1442
         $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
1449 1443
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1450 1444
         //NOME / RAZÃO SOCIAL
1451
-        $w = round($maxW*0.61, 0);
1445
+        $w = round($maxW * 0.61, 0);
1452 1446
         $w1 = $w;
1453 1447
         $y += 3;
1454 1448
         $texto = 'NOME / RAZÃO SOCIAL';
@@ -1463,19 +1457,19 @@  discard block
 block discarded – undo
1463 1457
         }
1464 1458
         //CNPJ / CPF
1465 1459
         $x += $w;
1466
-        $w = round($maxW*0.23, 0);
1460
+        $w = round($maxW * 0.23, 0);
1467 1461
         $w2 = $w;
1468 1462
         $texto = 'CNPJ / CPF';
1469 1463
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1470 1464
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1471 1465
         //Pegando valor do CPF/CNPJ
1472
-        if (! empty($this->dest->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1466
+        if (!empty($this->dest->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1473 1467
             $texto = $this->pFormat(
1474 1468
                 $this->dest->getElementsByTagName("CNPJ")->item(0)->nodeValue,
1475 1469
                 "###.###.###/####-##"
1476 1470
             );
1477 1471
         } else {
1478
-            $texto = ! empty($this->dest->getElementsByTagName("CPF")->item(0)->nodeValue) ?
1472
+            $texto = !empty($this->dest->getElementsByTagName("CPF")->item(0)->nodeValue) ?
1479 1473
                     $this->pFormat(
1480 1474
                         $this->dest->getElementsByTagName("CPF")->item(0)->nodeValue,
1481 1475
                         "###.###.###-##"
@@ -1485,15 +1479,15 @@  discard block
 block discarded – undo
1485 1479
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1486 1480
         //DATA DA EMISSÃO
1487 1481
         $x += $w;
1488
-        $w = $maxW-($w1+$w2);
1482
+        $w = $maxW - ($w1 + $w2);
1489 1483
         $wx = $w;
1490 1484
         $texto = 'DATA DA EMISSÃO';
1491 1485
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1492 1486
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1493
-        $dEmi = ! empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
1487
+        $dEmi = !empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
1494 1488
                 $this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue : '';
1495 1489
         if ($dEmi == '') {
1496
-            $dEmi = ! empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
1490
+            $dEmi = !empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
1497 1491
                     $this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue : '';
1498 1492
             $aDemi = explode('T', $dEmi);
1499 1493
             $dEmi = $aDemi[0];
@@ -1506,7 +1500,7 @@  discard block
 block discarded – undo
1506 1500
             $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 1, '');
1507 1501
         }
1508 1502
         //ENDEREÇO
1509
-        $w = round($maxW*0.47, 0);
1503
+        $w = round($maxW * 0.47, 0);
1510 1504
         $w1 = $w;
1511 1505
         $y += $h;
1512 1506
         $x = $oldX;
@@ -1521,7 +1515,7 @@  discard block
 block discarded – undo
1521 1515
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 0, '', true);
1522 1516
         //BAIRRO / DISTRITO
1523 1517
         $x += $w;
1524
-        $w = round($maxW*0.21, 0);
1518
+        $w = round($maxW * 0.21, 0);
1525 1519
         $w2 = $w;
1526 1520
         $texto = 'BAIRRO / DISTRITO';
1527 1521
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
@@ -1531,12 +1525,12 @@  discard block
 block discarded – undo
1531 1525
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1532 1526
         //CEP
1533 1527
         $x += $w;
1534
-        $w = $maxW-$w1-$w2-$wx;
1528
+        $w = $maxW - $w1 - $w2 - $wx;
1535 1529
         $w2 = $w;
1536 1530
         $texto = 'CEP';
1537 1531
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1538 1532
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1539
-        $texto = ! empty($this->dest->getElementsByTagName("CEP")->item(0)->nodeValue) ?
1533
+        $texto = !empty($this->dest->getElementsByTagName("CEP")->item(0)->nodeValue) ?
1540 1534
                 $this->dest->getElementsByTagName("CEP")->item(0)->nodeValue : '';
1541 1535
         $texto = $this->pFormat($texto, "#####-###");
1542 1536
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
@@ -1547,10 +1541,10 @@  discard block
 block discarded – undo
1547 1541
         $texto = 'DATA DA SAÍDA/ENTRADA';
1548 1542
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1549 1543
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1550
-        $dSaiEnt = ! empty($this->ide->getElementsByTagName("dSaiEnt")->item(0)->nodeValue) ?
1544
+        $dSaiEnt = !empty($this->ide->getElementsByTagName("dSaiEnt")->item(0)->nodeValue) ?
1551 1545
                 $this->ide->getElementsByTagName("dSaiEnt")->item(0)->nodeValue : '';
1552 1546
         if ($dSaiEnt == '') {
1553
-            $dSaiEnt = ! empty($this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue) ?
1547
+            $dSaiEnt = !empty($this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue) ?
1554 1548
                     $this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue : '';
1555 1549
             $aDsaient = explode('T', $dSaiEnt);
1556 1550
             $dSaiEnt = $aDsaient[0];
@@ -1567,7 +1561,7 @@  discard block
 block discarded – undo
1567 1561
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1568 1562
         $texto = $this->dest->getElementsByTagName("xMun")->item(0)->nodeValue;
1569 1563
         if (strtoupper(trim($texto)) == "EXTERIOR" && $this->dest->getElementsByTagName("xPais")->length > 0) {
1570
-            $texto .= " - " .  $this->dest->getElementsByTagName("xPais")->item(0)->nodeValue;
1564
+            $texto .= " - " . $this->dest->getElementsByTagName("xPais")->item(0)->nodeValue;
1571 1565
         }
1572 1566
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
1573 1567
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 0, '');
@@ -1582,18 +1576,18 @@  discard block
 block discarded – undo
1582 1576
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1583 1577
         //FONE / FAX
1584 1578
         $x += $w;
1585
-        $w = round(($maxW -$w1-$wx-8)/2, 0);
1579
+        $w = round(($maxW - $w1 - $wx - 8) / 2, 0);
1586 1580
         $w3 = $w;
1587 1581
         $texto = 'FONE / FAX';
1588 1582
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1589 1583
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1590
-        $texto = ! empty($this->dest->getElementsByTagName("fone")->item(0)->nodeValue) ?
1584
+        $texto = !empty($this->dest->getElementsByTagName("fone")->item(0)->nodeValue) ?
1591 1585
                 $this->dest->getElementsByTagName("fone")->item(0)->nodeValue : '';
1592 1586
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
1593 1587
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1594 1588
         //INSCRIÇÃO ESTADUAL
1595 1589
         $x += $w;
1596
-        $w = $maxW -$w1-$wx-8-$w3;
1590
+        $w = $maxW - $w1 - $wx - 8 - $w3;
1597 1591
         $texto = 'INSCRIÇÃO ESTADUAL';
1598 1592
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1599 1593
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -1607,10 +1601,10 @@  discard block
 block discarded – undo
1607 1601
         $texto = 'HORA DA SAÍDA/ENTRADA';
1608 1602
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1609 1603
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1610
-        $hSaiEnt = ! empty($this->ide->getElementsByTagName("hSaiEnt")->item(0)->nodeValue) ?
1604
+        $hSaiEnt = !empty($this->ide->getElementsByTagName("hSaiEnt")->item(0)->nodeValue) ?
1611 1605
                 $this->ide->getElementsByTagName("hSaiEnt")->item(0)->nodeValue : '';
1612 1606
         if ($hSaiEnt == '') {
1613
-            $dhSaiEnt = ! empty($this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue) ?
1607
+            $dhSaiEnt = !empty($this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue) ?
1614 1608
                     $this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue : '';
1615 1609
             $tsDhSaiEnt = $this->pConvertTime($dhSaiEnt);
1616 1610
             if ($tsDhSaiEnt != '') {
@@ -1689,7 +1683,7 @@  discard block
 block discarded – undo
1689 1683
     protected function pFaturaDANFE($x, $y)
1690 1684
     {
1691 1685
         $linha = 1;
1692
-        $h = 8+3;
1686
+        $h = 8 + 3;
1693 1687
         $oldx = $x;
1694 1688
         $textoFatura = $this->pGetTextoFatura();
1695 1689
         //verificar se existem duplicatas
@@ -1710,27 +1704,27 @@  discard block
 block discarded – undo
1710 1704
             $dupcont = 0;
1711 1705
             $nFat = $this->dup->length;
1712 1706
             if ($textoFatura !== "" && $this->exibirTextoFatura) {
1713
-                $myH=6;
1707
+                $myH = 6;
1714 1708
                 $myW = $this->wPrint;
1715 1709
                 if ($this->orientacao == 'L') {
1716 1710
                     $myW -= $this->wCanhoto;
1717 1711
                 }
1718 1712
                 $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'');
1719 1713
                 $this->pTextBox($x, $y, $myW, $myH, $textoFatura, $aFont, 'C', 'L', 1, '');
1720
-                $y+=$myH+1;
1714
+                $y += $myH + 1;
1721 1715
             }
1722 1716
             if ($this->orientacao == 'P') {
1723
-                $w = round($this->wPrint/7.018, 0)-1;
1717
+                $w = round($this->wPrint / 7.018, 0) - 1;
1724 1718
             } else {
1725 1719
                 $w = 28;
1726 1720
             }
1727 1721
             $increm = 1;
1728 1722
             foreach ($this->dup as $k => $d) {
1729
-                $nDup = ! empty($this->dup->item($k)->getElementsByTagName('nDup')->item(0)->nodeValue) ?
1723
+                $nDup = !empty($this->dup->item($k)->getElementsByTagName('nDup')->item(0)->nodeValue) ?
1730 1724
                         $this->dup->item($k)->getElementsByTagName('nDup')->item(0)->nodeValue : '';
1731
-                $dDup = ! empty($this->dup->item($k)->getElementsByTagName('dVenc')->item(0)->nodeValue) ?
1725
+                $dDup = !empty($this->dup->item($k)->getElementsByTagName('dVenc')->item(0)->nodeValue) ?
1732 1726
                         $this->pYmd2dmy($this->dup->item($k)->getElementsByTagName('dVenc')->item(0)->nodeValue) : '';
1733
-                $vDup = ! empty($this->dup->item($k)->getElementsByTagName('vDup')->item(0)->nodeValue) ?
1727
+                $vDup = !empty($this->dup->item($k)->getElementsByTagName('vDup')->item(0)->nodeValue) ?
1734 1728
                         'R$ ' . number_format(
1735 1729
                             $this->dup->item($k)->getElementsByTagName('vDup')->item(0)->nodeValue,
1736 1730
                             2,
@@ -1739,14 +1733,14 @@  discard block
 block discarded – undo
1739 1733
                         ) : '';
1740 1734
                 $h = 8;
1741 1735
                 $texto = '';
1742
-                if ($nDup!='0' && $nDup!='') {
1736
+                if ($nDup != '0' && $nDup != '') {
1743 1737
                     $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1744 1738
                     $this->pTextBox($x, $y, $w, $h, 'Num.', $aFont, 'T', 'L', 1, '');
1745 1739
                     $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
1746 1740
                     $this->pTextBox($x, $y, $w, $h, $nDup, $aFont, 'T', 'R', 0, '');
1747 1741
                 } else {
1748 1742
                     $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1749
-                    $this->pTextBox($x, $y, $w, $h, ($dupcont+1)."", $aFont, 'T', 'L', 1, '');
1743
+                    $this->pTextBox($x, $y, $w, $h, ($dupcont + 1) . "", $aFont, 'T', 'L', 1, '');
1750 1744
                 }
1751 1745
                 $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1752 1746
                 $this->pTextBox($x, $y, $w, $h, 'Venc.', $aFont, 'C', 'L', 0, '');
@@ -1756,7 +1750,7 @@  discard block
 block discarded – undo
1756 1750
                 $this->pTextBox($x, $y, $w, $h, 'Valor', $aFont, 'B', 'L', 0, '');
1757 1751
                 $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
1758 1752
                 $this->pTextBox($x, $y, $w, $h, $vDup, $aFont, 'B', 'R', 0, '');
1759
-                $x += $w+$increm;
1753
+                $x += $w + $increm;
1760 1754
                 $dupcont += 1;
1761 1755
                 if ($this->orientacao == 'P') {
1762 1756
                     $maxDupCont = 6;
@@ -1778,10 +1772,10 @@  discard block
 block discarded – undo
1778 1772
                 $y -= 9;
1779 1773
                 $linha--;
1780 1774
             }
1781
-            return ($y+$h);
1775
+            return ($y + $h);
1782 1776
         } else {
1783 1777
             $linha = 0;
1784
-            return ($y-2);
1778
+            return ($y - 2);
1785 1779
         }
1786 1780
     } //fim da função faturaDANFE
1787 1781
 
@@ -1893,7 +1887,7 @@  discard block
 block discarded – undo
1893 1887
         }
1894 1888
         $x = $this->pImpostoDanfeHelper($x, $y, $w, $h, "V. TOTAL DA NOTA", "vNF");
1895 1889
 
1896
-        return ($y+$h);
1890
+        return ($y + $h);
1897 1891
     } //fim impostoDANFE
1898 1892
 
1899 1893
     /**
@@ -1921,13 +1915,13 @@  discard block
 block discarded – undo
1921 1915
         $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
1922 1916
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1923 1917
         //NOME / RAZÃO SOCIAL
1924
-        $w1 = $maxW*0.29;
1918
+        $w1 = $maxW * 0.29;
1925 1919
         $y += 3;
1926 1920
         $texto = 'NOME / RAZÃO SOCIAL';
1927 1921
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1928 1922
         $this->pTextBox($x, $y, $w1, $h, $texto, $aFont, 'T', 'L', 1, '');
1929 1923
         if (isset($this->transporta)) {
1930
-            $texto = ! empty($this->transporta->getElementsByTagName("xNome")->item(0)->nodeValue) ?
1924
+            $texto = !empty($this->transporta->getElementsByTagName("xNome")->item(0)->nodeValue) ?
1931 1925
                     $this->transporta->getElementsByTagName("xNome")->item(0)->nodeValue : '';
1932 1926
         } else {
1933 1927
             $texto = '';
@@ -1936,11 +1930,11 @@  discard block
 block discarded – undo
1936 1930
         $this->pTextBox($x, $y, $w1, $h, $texto, $aFont, 'B', 'L', 0, '');
1937 1931
         //FRETE POR CONTA
1938 1932
         $x += $w1;
1939
-        $w2 = $maxW*0.15;
1933
+        $w2 = $maxW * 0.15;
1940 1934
         $texto = 'FRETE';
1941 1935
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1942 1936
         $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
1943
-        $tipoFrete = ! empty($this->transp->getElementsByTagName("modFrete")->item(0)->nodeValue) ?
1937
+        $tipoFrete = !empty($this->transp->getElementsByTagName("modFrete")->item(0)->nodeValue) ?
1944 1938
                 $this->transp->getElementsByTagName("modFrete")->item(0)->nodeValue : '0';
1945 1939
         switch ($tipoFrete) {
1946 1940
             case 0:
@@ -1970,7 +1964,7 @@  discard block
 block discarded – undo
1970 1964
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1971 1965
         $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
1972 1966
         if (isset($this->veicTransp)) {
1973
-            $texto = ! empty($this->veicTransp->getElementsByTagName("RNTC")->item(0)->nodeValue) ?
1967
+            $texto = !empty($this->veicTransp->getElementsByTagName("RNTC")->item(0)->nodeValue) ?
1974 1968
                     $this->veicTransp->getElementsByTagName("RNTC")->item(0)->nodeValue : '';
1975 1969
         } else {
1976 1970
             $texto = '';
@@ -1983,10 +1977,10 @@  discard block
 block discarded – undo
1983 1977
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1984 1978
         $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
1985 1979
         if (isset($this->veicTransp)) {
1986
-            $texto = ! empty($this->veicTransp->getElementsByTagName("placa")->item(0)->nodeValue) ?
1980
+            $texto = !empty($this->veicTransp->getElementsByTagName("placa")->item(0)->nodeValue) ?
1987 1981
                     $this->veicTransp->getElementsByTagName("placa")->item(0)->nodeValue : '';
1988 1982
         } elseif (isset($this->reboque)) {
1989
-            $texto = ! empty($this->reboque->getElementsByTagName("placa")->item(0)->nodeValue) ?
1983
+            $texto = !empty($this->reboque->getElementsByTagName("placa")->item(0)->nodeValue) ?
1990 1984
                     $this->reboque->getElementsByTagName("placa")->item(0)->nodeValue : '';
1991 1985
         } else {
1992 1986
             $texto = '';
@@ -1995,15 +1989,15 @@  discard block
 block discarded – undo
1995 1989
         $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'B', 'C', 0, '');
1996 1990
         //UF
1997 1991
         $x += $w2;
1998
-        $w3 = round($maxW*0.04, 0);
1992
+        $w3 = round($maxW * 0.04, 0);
1999 1993
         $texto = 'UF';
2000 1994
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2001 1995
         $this->pTextBox($x, $y, $w3, $h, $texto, $aFont, 'T', 'L', 1, '');
2002 1996
         if (isset($this->veicTransp)) {
2003
-            $texto = ! empty($this->veicTransp->getElementsByTagName("UF")->item(0)->nodeValue) ?
1997
+            $texto = !empty($this->veicTransp->getElementsByTagName("UF")->item(0)->nodeValue) ?
2004 1998
                     $this->veicTransp->getElementsByTagName("UF")->item(0)->nodeValue : '';
2005 1999
         } elseif (isset($this->reboque)) {
2006
-            $texto = ! empty($this->reboque->getElementsByTagName("UF")->item(0)->nodeValue) ?
2000
+            $texto = !empty($this->reboque->getElementsByTagName("UF")->item(0)->nodeValue) ?
2007 2001
                     $this->reboque->getElementsByTagName("UF")->item(0)->nodeValue : '';
2008 2002
         } else {
2009 2003
             $texto = '';
@@ -2012,18 +2006,18 @@  discard block
 block discarded – undo
2012 2006
         $this->pTextBox($x, $y, $w3, $h, $texto, $aFont, 'B', 'C', 0, '');
2013 2007
         //CNPJ / CPF
2014 2008
         $x += $w3;
2015
-        $w = $maxW-($w1+3*$w2+$w3);
2009
+        $w = $maxW - ($w1 + 3 * $w2 + $w3);
2016 2010
         $texto = 'CNPJ / CPF';
2017 2011
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2018 2012
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
2019 2013
         if (isset($this->transporta)) {
2020
-            $texto = ! empty($this->transporta->getElementsByTagName("CNPJ")->item(0)->nodeValue) ?
2014
+            $texto = !empty($this->transporta->getElementsByTagName("CNPJ")->item(0)->nodeValue) ?
2021 2015
                     $this->pFormat(
2022 2016
                         $this->transporta->getElementsByTagName("CNPJ")->item(0)->nodeValue,
2023 2017
                         "##.###.###/####-##"
2024 2018
                     ) : '';
2025 2019
             if ($texto == '') {
2026
-                $texto = ! empty($this->transporta->getElementsByTagName("CPF")->item(0)->nodeValue) ?
2020
+                $texto = !empty($this->transporta->getElementsByTagName("CPF")->item(0)->nodeValue) ?
2027 2021
                         $this->pFormat(
2028 2022
                             $this->transporta->getElementsByTagName("CPF")->item(0)->nodeValue,
2029 2023
                             "###.###.###-##"
@@ -2039,12 +2033,12 @@  discard block
 block discarded – undo
2039 2033
         $y += $h;
2040 2034
         $x = $oldX;
2041 2035
         $h = 7;
2042
-        $w1 = $maxW*0.44;
2036
+        $w1 = $maxW * 0.44;
2043 2037
         $texto = 'ENDEREÇO';
2044 2038
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2045 2039
         $this->pTextBox($x, $y, $w1, $h, $texto, $aFont, 'T', 'L', 1, '');
2046 2040
         if (isset($this->transporta)) {
2047
-            $texto = ! empty($this->transporta->getElementsByTagName("xEnder")->item(0)->nodeValue) ?
2041
+            $texto = !empty($this->transporta->getElementsByTagName("xEnder")->item(0)->nodeValue) ?
2048 2042
                     $this->transporta->getElementsByTagName("xEnder")->item(0)->nodeValue : '';
2049 2043
         } else {
2050 2044
             $texto = '';
@@ -2053,12 +2047,12 @@  discard block
 block discarded – undo
2053 2047
         $this->pTextBox($x, $y, $w1, $h, $texto, $aFont, 'B', 'L', 0, '');
2054 2048
         //MUNICÍPIO
2055 2049
         $x += $w1;
2056
-        $w2 = round($maxW*0.30, 0);
2050
+        $w2 = round($maxW * 0.30, 0);
2057 2051
         $texto = 'MUNICÍPIO';
2058 2052
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2059 2053
         $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
2060 2054
         if (isset($this->transporta)) {
2061
-            $texto = ! empty($this->transporta->getElementsByTagName("xMun")->item(0)->nodeValue) ?
2055
+            $texto = !empty($this->transporta->getElementsByTagName("xMun")->item(0)->nodeValue) ?
2062 2056
                     $this->transporta->getElementsByTagName("xMun")->item(0)->nodeValue : '';
2063 2057
         } else {
2064 2058
             $texto = '';
@@ -2067,12 +2061,12 @@  discard block
 block discarded – undo
2067 2061
         $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'B', 'C', 0, '');
2068 2062
         //UF
2069 2063
         $x += $w2;
2070
-        $w3 = round($maxW*0.04, 0);
2064
+        $w3 = round($maxW * 0.04, 0);
2071 2065
         $texto = 'UF';
2072 2066
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2073 2067
         $this->pTextBox($x, $y, $w3, $h, $texto, $aFont, 'T', 'L', 1, '');
2074 2068
         if (isset($this->transporta)) {
2075
-            $texto = ! empty($this->transporta->getElementsByTagName("UF")->item(0)->nodeValue) ?
2069
+            $texto = !empty($this->transporta->getElementsByTagName("UF")->item(0)->nodeValue) ?
2076 2070
                     $this->transporta->getElementsByTagName("UF")->item(0)->nodeValue : '';
2077 2071
         } else {
2078 2072
             $texto = '';
@@ -2081,13 +2075,13 @@  discard block
 block discarded – undo
2081 2075
         $this->pTextBox($x, $y, $w3, $h, $texto, $aFont, 'B', 'C', 0, '');
2082 2076
         //INSCRIÇÃO ESTADUAL
2083 2077
         $x += $w3;
2084
-        $w = $maxW-($w1+$w2+$w3);
2078
+        $w = $maxW - ($w1 + $w2 + $w3);
2085 2079
         $texto = 'INSCRIÇÃO ESTADUAL';
2086 2080
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2087 2081
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
2088 2082
         $texto = '';
2089 2083
         if (isset($this->transporta)) {
2090
-            if (! empty($this->transporta->getElementsByTagName("IE")->item(0)->nodeValue)) {
2084
+            if (!empty($this->transporta->getElementsByTagName("IE")->item(0)->nodeValue)) {
2091 2085
                 $texto = $this->transporta->getElementsByTagName("IE")->item(0)->nodeValue;
2092 2086
             }
2093 2087
         }
@@ -2100,16 +2094,16 @@  discard block
 block discarded – undo
2100 2094
         $marca = '';
2101 2095
         $numero = '';
2102 2096
         $texto = '';
2103
-        $pesoBruto=0;
2104
-        $pesoLiquido=0;
2097
+        $pesoBruto = 0;
2098
+        $pesoLiquido = 0;
2105 2099
         foreach ($volumes as $volume) {
2106
-            $quantidade += ! empty($volume->getElementsByTagName("qVol")->item(0)->nodeValue) ?
2100
+            $quantidade += !empty($volume->getElementsByTagName("qVol")->item(0)->nodeValue) ?
2107 2101
                     $volume->getElementsByTagName("qVol")->item(0)->nodeValue : 0;
2108
-            $pesoBruto += ! empty($volume->getElementsByTagName("pesoB")->item(0)->nodeValue) ?
2102
+            $pesoBruto += !empty($volume->getElementsByTagName("pesoB")->item(0)->nodeValue) ?
2109 2103
                     $volume->getElementsByTagName("pesoB")->item(0)->nodeValue : 0;
2110
-            $pesoLiquido += ! empty($volume->getElementsByTagName("pesoL")->item(0)->nodeValue) ?
2104
+            $pesoLiquido += !empty($volume->getElementsByTagName("pesoL")->item(0)->nodeValue) ?
2111 2105
                     $volume->getElementsByTagName("pesoL")->item(0)->nodeValue : 0;
2112
-            $texto = ! empty($this->transp->getElementsByTagName("esp")->item(0)->nodeValue) ?
2106
+            $texto = !empty($this->transp->getElementsByTagName("esp")->item(0)->nodeValue) ?
2113 2107
                     $this->transp->getElementsByTagName("esp")->item(0)->nodeValue : '';
2114 2108
             if ($texto != $especie && $especie != '') {
2115 2109
                 //tem várias especies
@@ -2117,7 +2111,7 @@  discard block
 block discarded – undo
2117 2111
             } else {
2118 2112
                 $especie = $texto;
2119 2113
             }
2120
-            $texto = ! empty($this->transp->getElementsByTagName("marca")->item(0)->nodeValue) ?
2114
+            $texto = !empty($this->transp->getElementsByTagName("marca")->item(0)->nodeValue) ?
2121 2115
                     $this->transp->getElementsByTagName("marca")->item(0)->nodeValue : '';
2122 2116
             if ($texto != $marca && $marca != '') {
2123 2117
                 //tem várias especies
@@ -2125,7 +2119,7 @@  discard block
 block discarded – undo
2125 2119
             } else {
2126 2120
                 $marca = $texto;
2127 2121
             }
2128
-            $texto = ! empty($this->transp->getElementsByTagName("nVol")->item(0)->nodeValue) ?
2122
+            $texto = !empty($this->transp->getElementsByTagName("nVol")->item(0)->nodeValue) ?
2129 2123
                     $this->transp->getElementsByTagName("nVol")->item(0)->nodeValue : '';
2130 2124
             if ($texto != $numero && $numero != '') {
2131 2125
                 //tem várias especies
@@ -2140,7 +2134,7 @@  discard block
 block discarded – undo
2140 2134
         $y += $h;
2141 2135
         $x = $oldX;
2142 2136
         $h = 7;
2143
-        $w1 = round($maxW*0.10, 0);
2137
+        $w1 = round($maxW * 0.10, 0);
2144 2138
         $texto = 'QUANTIDADE';
2145 2139
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2146 2140
         $this->pTextBox($x, $y, $w1, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -2151,7 +2145,7 @@  discard block
 block discarded – undo
2151 2145
         }
2152 2146
         //ESPÉCIE
2153 2147
         $x += $w1;
2154
-        $w2 = round($maxW*0.17, 0);
2148
+        $w2 = round($maxW * 0.17, 0);
2155 2149
         $texto = 'ESPÉCIE';
2156 2150
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2157 2151
         $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -2163,7 +2157,7 @@  discard block
 block discarded – undo
2163 2157
         $texto = 'MARCA';
2164 2158
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2165 2159
         $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
2166
-        $texto = ! empty($this->transp->getElementsByTagName("marca")->item(0)->nodeValue) ?
2160
+        $texto = !empty($this->transp->getElementsByTagName("marca")->item(0)->nodeValue) ?
2167 2161
                 $this->transp->getElementsByTagName("marca")->item(0)->nodeValue : '';
2168 2162
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
2169 2163
         $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'B', 'C', 0, '');
@@ -2177,7 +2171,7 @@  discard block
 block discarded – undo
2177 2171
         $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'B', 'C', 0, '');
2178 2172
         //PESO BRUTO
2179 2173
         $x += $w2;
2180
-        $w3 = round($maxW*0.20, 0);
2174
+        $w3 = round($maxW * 0.20, 0);
2181 2175
         $texto = 'PESO BRUTO';
2182 2176
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2183 2177
         $this->pTextBox($x, $y, $w3, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -2190,7 +2184,7 @@  discard block
 block discarded – undo
2190 2184
         $this->pTextBox($x, $y, $w3, $h, $texto, $aFont, 'B', 'R', 0, '');
2191 2185
         //PESO LÍQUIDO
2192 2186
         $x += $w3;
2193
-        $w = $maxW -($w1+3*$w2+$w3);
2187
+        $w = $maxW - ($w1 + 3 * $w2 + $w3);
2194 2188
         $texto = 'PESO LÍQUIDO';
2195 2189
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2196 2190
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -2201,7 +2195,7 @@  discard block
 block discarded – undo
2201 2195
         }
2202 2196
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
2203 2197
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'R', 0, '');
2204
-        return ($y+$h);
2198
+        return ($y + $h);
2205 2199
     } //fim transporteDANFE
2206 2200
 
2207 2201
 
@@ -2213,7 +2207,7 @@  discard block
 block discarded – undo
2213 2207
             return "";
2214 2208
         }
2215 2209
         $valor_original = $valor_original->nodeValue;
2216
-        $valor = ! empty($valor_original) ? number_format($valor_original, 2, ",", ".") : '';
2210
+        $valor = !empty($valor_original) ? number_format($valor_original, 2, ",", ".") : '';
2217 2211
 
2218 2212
         if ($valor != "") {
2219 2213
             return sprintf($formato, $valor);
@@ -2251,13 +2245,13 @@  discard block
 block discarded – undo
2251 2245
             $impostos .= $this->pDescricaoProdutoHelper($ICMSUFDest, "vICMSUFDest", " vICMSUFDest=%s");
2252 2246
             $impostos .= $this->pDescricaoProdutoHelper($ICMSUFDest, "vICMSUFRemet", " vICMSUFRemet=%s");
2253 2247
         }
2254
-        $infAdProd = ! empty($itemProd->getElementsByTagName('infAdProd')->item(0)->nodeValue) ?
2248
+        $infAdProd = !empty($itemProd->getElementsByTagName('infAdProd')->item(0)->nodeValue) ?
2255 2249
                 substr($this->pAnfavea($itemProd->getElementsByTagName('infAdProd')->item(0)->nodeValue), 0, 500) : '';
2256
-        if (! empty($infAdProd)) {
2250
+        if (!empty($infAdProd)) {
2257 2251
             $infAdProd = trim($infAdProd);
2258 2252
             $infAdProd .= ' ';
2259 2253
         }
2260
-        $loteTxt ='';
2254
+        $loteTxt = '';
2261 2255
         $rastro = $prod->getElementsByTagName("med");
2262 2256
         if (!isset($rastro)) {
2263 2257
             $rastro = $prod->getElementsByTagName("rastro");
@@ -2273,14 +2267,14 @@  discard block
 block discarded – undo
2273 2267
                 $i++;
2274 2268
             }
2275 2269
             if ($loteTxt != '') {
2276
-                $loteTxt.= ' ';
2270
+                $loteTxt .= ' ';
2277 2271
             }
2278 2272
         }
2279 2273
         //NT2013.006 FCI
2280
-        $nFCI = (! empty($itemProd->getElementsByTagName('nFCI')->item(0)->nodeValue)) ?
2281
-                ' FCI:'.$itemProd->getElementsByTagName('nFCI')->item(0)->nodeValue : '';
2282
-        $tmp_ad=$infAdProd . ($this->descProdInfoComplemento ? $loteTxt . $impostos . $nFCI : '');
2283
-        $texto = $prod->getElementsByTagName("xProd")->item(0)->nodeValue . (strlen($tmp_ad)!=0?"\n    ".$tmp_ad:'');
2274
+        $nFCI = (!empty($itemProd->getElementsByTagName('nFCI')->item(0)->nodeValue)) ?
2275
+                ' FCI:' . $itemProd->getElementsByTagName('nFCI')->item(0)->nodeValue : '';
2276
+        $tmp_ad = $infAdProd . ($this->descProdInfoComplemento ? $loteTxt . $impostos . $nFCI : '');
2277
+        $texto = $prod->getElementsByTagName("xProd")->item(0)->nodeValue . (strlen($tmp_ad) != 0 ? "\n    " . $tmp_ad : '');
2284 2278
         if ($this->descProdQuebraLinha) {
2285 2279
             $texto = str_replace(";", "\n", $texto);
2286 2280
         }
@@ -2328,104 +2322,104 @@  discard block
 block discarded – undo
2328 2322
         // cabecalho LOOP COM OS DADOS DOS PRODUTOS
2329 2323
         //CÓDIGO PRODUTO
2330 2324
         $texto = "CÓDIGO PRODUTO";
2331
-        $w1 = round($w*0.09, 0);
2325
+        $w1 = round($w * 0.09, 0);
2332 2326
         $h = 4;
2333 2327
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2334 2328
         $this->pTextBox($x, $y, $w1, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2335
-        $this->pdf->Line($x+$w1, $y, $x+$w1, $y+$hmax);
2329
+        $this->pdf->Line($x + $w1, $y, $x + $w1, $y + $hmax);
2336 2330
         //DESCRIÇÃO DO PRODUTO / SERVIÇO
2337 2331
         $x += $w1;
2338
-        $w2 = round($w*0.28, 0);
2332
+        $w2 = round($w * 0.28, 0);
2339 2333
         $texto = 'DESCRIÇÃO DO PRODUTO / SERVIÇO';
2340 2334
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2341 2335
         $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2342
-        $this->pdf->Line($x+$w2, $y, $x+$w2, $y+$hmax);
2336
+        $this->pdf->Line($x + $w2, $y, $x + $w2, $y + $hmax);
2343 2337
         //NCM/SH
2344 2338
         $x += $w2;
2345
-        $w3 = round($w*0.06, 0);
2339
+        $w3 = round($w * 0.06, 0);
2346 2340
         $texto = 'NCM/SH';
2347 2341
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2348 2342
         $this->pTextBox($x, $y, $w3, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2349
-        $this->pdf->Line($x+$w3, $y, $x+$w3, $y+$hmax);
2343
+        $this->pdf->Line($x + $w3, $y, $x + $w3, $y + $hmax);
2350 2344
         //O/CST ou O/CSOSN
2351 2345
         $x += $w3;
2352
-        $w4 = round($w*0.05, 0);
2353
-        $texto = 'O/CSOSN';//Regime do Simples CRT = 1 ou CRT = 2
2346
+        $w4 = round($w * 0.05, 0);
2347
+        $texto = 'O/CSOSN'; //Regime do Simples CRT = 1 ou CRT = 2
2354 2348
         if ($this->pSimpleGetValue($this->emit, 'CRT') == '3') {
2355
-             $texto = 'O/CST';//Regime Normal
2349
+             $texto = 'O/CST'; //Regime Normal
2356 2350
         }
2357 2351
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2358 2352
         $this->pTextBox($x, $y, $w4, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2359
-        $this->pdf->Line($x+$w4, $y, $x+$w4, $y+$hmax);
2353
+        $this->pdf->Line($x + $w4, $y, $x + $w4, $y + $hmax);
2360 2354
         //CFOP
2361 2355
         $x += $w4;
2362
-        $w5 = round($w*0.04, 0);
2356
+        $w5 = round($w * 0.04, 0);
2363 2357
         $texto = 'CFOP';
2364 2358
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2365 2359
         $this->pTextBox($x, $y, $w5, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2366
-        $this->pdf->Line($x+$w5, $y, $x+$w5, $y+$hmax);
2360
+        $this->pdf->Line($x + $w5, $y, $x + $w5, $y + $hmax);
2367 2361
         //UN
2368 2362
         $x += $w5;
2369
-        $w6 = round($w*0.03, 0);
2363
+        $w6 = round($w * 0.03, 0);
2370 2364
         $texto = 'UN';
2371 2365
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2372 2366
         $this->pTextBox($x, $y, $w6, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2373
-        $this->pdf->Line($x+$w6, $y, $x+$w6, $y+$hmax);
2367
+        $this->pdf->Line($x + $w6, $y, $x + $w6, $y + $hmax);
2374 2368
         //QUANT
2375 2369
         $x += $w6;
2376
-        $w7 = round($w*0.07, 0);
2370
+        $w7 = round($w * 0.07, 0);
2377 2371
         $texto = 'QUANT';
2378 2372
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2379 2373
         $this->pTextBox($x, $y, $w7, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2380
-        $this->pdf->Line($x+$w7, $y, $x+$w7, $y+$hmax);
2374
+        $this->pdf->Line($x + $w7, $y, $x + $w7, $y + $hmax);
2381 2375
         //VALOR UNIT
2382 2376
         $x += $w7;
2383
-        $w8 = round($w*0.06, 0);
2377
+        $w8 = round($w * 0.06, 0);
2384 2378
         $texto = 'VALOR UNIT';
2385 2379
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2386 2380
         $this->pTextBox($x, $y, $w8, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2387
-        $this->pdf->Line($x+$w8, $y, $x+$w8, $y+$hmax);
2381
+        $this->pdf->Line($x + $w8, $y, $x + $w8, $y + $hmax);
2388 2382
         //VALOR TOTAL
2389 2383
         $x += $w8;
2390
-        $w9 = round($w*0.06, 0);
2384
+        $w9 = round($w * 0.06, 0);
2391 2385
         $texto = 'VALOR TOTAL';
2392 2386
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2393 2387
         $this->pTextBox($x, $y, $w9, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2394
-        $this->pdf->Line($x+$w9, $y, $x+$w9, $y+$hmax);
2388
+        $this->pdf->Line($x + $w9, $y, $x + $w9, $y + $hmax);
2395 2389
         //B.CÁLC ICMS
2396 2390
         $x += $w9;
2397
-        $w10 = round($w*0.06, 0);
2391
+        $w10 = round($w * 0.06, 0);
2398 2392
         $texto = 'B.CÁLC ICMS';
2399 2393
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2400 2394
         $this->pTextBox($x, $y, $w10, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2401
-        $this->pdf->Line($x+$w10, $y, $x+$w10, $y+$hmax);
2395
+        $this->pdf->Line($x + $w10, $y, $x + $w10, $y + $hmax);
2402 2396
         //VALOR ICMS
2403 2397
         $x += $w10;
2404
-        $w11 = round($w*0.06, 0);
2398
+        $w11 = round($w * 0.06, 0);
2405 2399
         $texto = 'VALOR ICMS';
2406 2400
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2407 2401
         $this->pTextBox($x, $y, $w11, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2408
-        $this->pdf->Line($x+$w11, $y, $x+$w11, $y+$hmax);
2402
+        $this->pdf->Line($x + $w11, $y, $x + $w11, $y + $hmax);
2409 2403
         //VALOR IPI
2410 2404
         $x += $w11;
2411
-        $w12 = round($w*0.05, 0);
2405
+        $w12 = round($w * 0.05, 0);
2412 2406
         $texto = 'VALOR IPI';
2413 2407
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2414 2408
         $this->pTextBox($x, $y, $w12, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2415
-        $this->pdf->Line($x+$w12, $y, $x+$w12, $y+$hmax);
2409
+        $this->pdf->Line($x + $w12, $y, $x + $w12, $y + $hmax);
2416 2410
         //ALÍQ. ICMS
2417 2411
         $x += $w12;
2418
-        $w13 = round($w*0.035, 0);
2412
+        $w13 = round($w * 0.035, 0);
2419 2413
         $texto = 'ALÍQ. ICMS';
2420 2414
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2421 2415
         $this->pTextBox($x, $y, $w13, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2422
-        $this->pdf->Line($x+$w13, $y, $x+$w13, $y+$hmax);
2416
+        $this->pdf->Line($x + $w13, $y, $x + $w13, $y + $hmax);
2423 2417
         //ALÍQ. IPI
2424 2418
         $x += $w13;
2425
-        $w14 = $w-($w1+$w2+$w3+$w4+$w5+$w6+$w7+$w8+$w9+$w10+$w11+$w12+$w13);
2419
+        $w14 = $w - ($w1 + $w2 + $w3 + $w4 + $w5 + $w6 + $w7 + $w8 + $w9 + $w10 + $w11 + $w12 + $w13);
2426 2420
         $texto = 'ALÍQ. IPI';
2427 2421
         $this->pTextBox($x, $y, $w14, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2428
-        $this->pdf->Line($oldX, $y+$h+1, $oldX + $w, $y+$h+1);
2422
+        $this->pdf->Line($oldX, $y + $h + 1, $oldX + $w, $y + $h + 1);
2429 2423
         $y += 5;
2430 2424
         //##################################################################################
2431 2425
         // LOOP COM OS DADOS DOS PRODUTOS
@@ -2442,7 +2436,7 @@  discard block
 block discarded – undo
2442 2436
                 $IPI  = $imposto->getElementsByTagName("IPI")->item(0);
2443 2437
                 $textoProduto = $this->pDescricaoProduto($thisItem);
2444 2438
                 $linhaDescr = $this->pGetNumLines($textoProduto, $w2, $aFont);
2445
-                $h = round(($linhaDescr * $this->pdf->fontSize)+ ($linhaDescr * 0.5), 2);
2439
+                $h = round(($linhaDescr * $this->pdf->fontSize) + ($linhaDescr * 0.5), 2);
2446 2440
                 $hUsado += $h;
2447 2441
                 if ($pag != $totpag) {
2448 2442
                     if ($hUsado >= $hmax && $i < $totItens) {
@@ -2452,11 +2446,11 @@  discard block
 block discarded – undo
2452 2446
                         break;
2453 2447
                     }
2454 2448
                 }
2455
-                $y_linha=$y+$h;
2449
+                $y_linha = $y + $h;
2456 2450
                 // linha entre itens
2457 2451
                 $this->pdf->DashedHLine($oldX, $y_linha, $w, 0.1, 120);
2458 2452
                 //corrige o x
2459
-                $x=$oldX;
2453
+                $x = $oldX;
2460 2454
                 //codigo do produto
2461 2455
                 $texto = $prod->getElementsByTagName("cProd")->item(0)->nodeValue;
2462 2456
                 $this->pTextBox($x, $y, $w1, $h, $texto, $aFont, 'T', 'C', 0, '');
@@ -2469,16 +2463,16 @@  discard block
 block discarded – undo
2469 2463
                 }
2470 2464
                 $x += $w2;
2471 2465
                 //NCM
2472
-                $texto = ! empty($prod->getElementsByTagName("NCM")->item(0)->nodeValue) ?
2466
+                $texto = !empty($prod->getElementsByTagName("NCM")->item(0)->nodeValue) ?
2473 2467
                         $prod->getElementsByTagName("NCM")->item(0)->nodeValue : '';
2474 2468
                 $this->pTextBox($x, $y, $w3, $h, $texto, $aFont, 'T', 'C', 0, '');
2475 2469
                 $x += $w3;
2476 2470
                 //CST
2477 2471
                 if (isset($ICMS)) {
2478
-                    $origem =  $this->pSimpleGetValue($ICMS, "orig");
2479
-                    $cst =  $this->pSimpleGetValue($ICMS, "CST");
2480
-                    $csosn =  $this->pSimpleGetValue($ICMS, "CSOSN");
2481
-                    $texto = $origem.$cst.$csosn;
2472
+                    $origem = $this->pSimpleGetValue($ICMS, "orig");
2473
+                    $cst = $this->pSimpleGetValue($ICMS, "CST");
2474
+                    $csosn = $this->pSimpleGetValue($ICMS, "CSOSN");
2475
+                    $texto = $origem . $cst . $csosn;
2482 2476
                     $this->pTextBox($x, $y, $w4, $h, $texto, $aFont, 'T', 'C', 0, '');
2483 2477
                 }
2484 2478
                 //CFOP
@@ -2512,7 +2506,7 @@  discard block
 block discarded – undo
2512 2506
                 //Valor da Base de calculo
2513 2507
                 $x += $w9;
2514 2508
                 if (isset($ICMS)) {
2515
-                    $texto = ! empty($ICMS->getElementsByTagName("vBC")->item(0)->nodeValue) ?
2509
+                    $texto = !empty($ICMS->getElementsByTagName("vBC")->item(0)->nodeValue) ?
2516 2510
                             number_format(
2517 2511
                                 $ICMS->getElementsByTagName("vBC")->item(0)->nodeValue,
2518 2512
                                 2,
@@ -2524,7 +2518,7 @@  discard block
 block discarded – undo
2524 2518
                 //Valor do ICMS
2525 2519
                 $x += $w10;
2526 2520
                 if (isset($ICMS)) {
2527
-                    $texto = ! empty($ICMS->getElementsByTagName("vICMS")->item(0)->nodeValue) ?
2521
+                    $texto = !empty($ICMS->getElementsByTagName("vICMS")->item(0)->nodeValue) ?
2528 2522
                             number_format(
2529 2523
                                 $ICMS->getElementsByTagName("vICMS")->item(0)->nodeValue,
2530 2524
                                 2,
@@ -2536,8 +2530,8 @@  discard block
 block discarded – undo
2536 2530
                 //Valor do IPI
2537 2531
                 $x += $w11;
2538 2532
                 if (isset($IPI)) {
2539
-                    $texto = ! empty($IPI->getElementsByTagName("vIPI")->item(0)->nodeValue) ?
2540
-                            number_format($IPI->getElementsByTagName("vIPI")->item(0)->nodeValue, 2, ",", ".") :'';
2533
+                    $texto = !empty($IPI->getElementsByTagName("vIPI")->item(0)->nodeValue) ?
2534
+                            number_format($IPI->getElementsByTagName("vIPI")->item(0)->nodeValue, 2, ",", ".") : '';
2541 2535
                 } else {
2542 2536
                     $texto = '';
2543 2537
                 }
@@ -2545,7 +2539,7 @@  discard block
 block discarded – undo
2545 2539
                 // %ICMS
2546 2540
                 $x += $w12;
2547 2541
                 if (isset($ICMS)) {
2548
-                    $texto = ! empty($ICMS->getElementsByTagName("pICMS")->item(0)->nodeValue) ?
2542
+                    $texto = !empty($ICMS->getElementsByTagName("pICMS")->item(0)->nodeValue) ?
2549 2543
                             number_format(
2550 2544
                                 $ICMS->getElementsByTagName("pICMS")->item(0)->nodeValue,
2551 2545
                                 2,
@@ -2557,7 +2551,7 @@  discard block
 block discarded – undo
2557 2551
                 //%IPI
2558 2552
                 $x += $w13;
2559 2553
                 if (isset($IPI)) {
2560
-                    $texto = ! empty($IPI->getElementsByTagName("pIPI")->item(0)->nodeValue) ?
2554
+                    $texto = !empty($IPI->getElementsByTagName("pIPI")->item(0)->nodeValue) ?
2561 2555
                             number_format($IPI->getElementsByTagName("pIPI")->item(0)->nodeValue, 2, ",", ".") : '';
2562 2556
                 } else {
2563 2557
                     $texto = '';
@@ -2571,7 +2565,7 @@  discard block
 block discarded – undo
2571 2565
                 $i++;
2572 2566
             }
2573 2567
         }
2574
-        return $oldY+$hmax;
2568
+        return $oldY + $hmax;
2575 2569
     }
2576 2570
 
2577 2571
     /**
@@ -2595,12 +2589,12 @@  discard block
 block discarded – undo
2595 2589
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
2596 2590
         //INSCRIÇÃO MUNICIPAL
2597 2591
         $y += 3;
2598
-        $w = round($this->wPrint*0.23, 0);
2592
+        $w = round($this->wPrint * 0.23, 0);
2599 2593
         $texto = 'INSCRIÇÃO MUNICIPAL';
2600 2594
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2601 2595
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
2602 2596
         //inscrição municipal
2603
-        $texto = ! empty($this->emit->getElementsByTagName("IM")->item(0)->nodeValue) ?
2597
+        $texto = !empty($this->emit->getElementsByTagName("IM")->item(0)->nodeValue) ?
2604 2598
                 $this->emit->getElementsByTagName("IM")->item(0)->nodeValue : '';
2605 2599
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
2606 2600
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 0, '');
@@ -2610,7 +2604,7 @@  discard block
 block discarded – undo
2610 2604
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2611 2605
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
2612 2606
         if (isset($this->ISSQNtot)) {
2613
-            $texto = ! empty($this->ISSQNtot->getElementsByTagName("vServ")->item(0)->nodeValue) ?
2607
+            $texto = !empty($this->ISSQNtot->getElementsByTagName("vServ")->item(0)->nodeValue) ?
2614 2608
                     $this->ISSQNtot->getElementsByTagName("vServ")->item(0)->nodeValue : '';
2615 2609
             $texto = number_format($texto, 2, ",", ".");
2616 2610
         } else {
@@ -2624,9 +2618,9 @@  discard block
 block discarded – undo
2624 2618
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2625 2619
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
2626 2620
         if (isset($this->ISSQNtot)) {
2627
-            $texto = ! empty($this->ISSQNtot->getElementsByTagName("vBC")->item(0)->nodeValue) ?
2621
+            $texto = !empty($this->ISSQNtot->getElementsByTagName("vBC")->item(0)->nodeValue) ?
2628 2622
                     $this->ISSQNtot->getElementsByTagName("vBC")->item(0)->nodeValue : '';
2629
-            $texto = ! empty($texto) ? number_format($texto, 2, ",", ".") : '';
2623
+            $texto = !empty($texto) ? number_format($texto, 2, ",", ".") : '';
2630 2624
         } else {
2631 2625
             $texto = '';
2632 2626
         }
@@ -2637,21 +2631,21 @@  discard block
 block discarded – undo
2637 2631
         if ($this->orientacao == 'P') {
2638 2632
             $w = $this->wPrint - (3 * $w);
2639 2633
         } else {
2640
-            $w = $this->wPrint - (3 * $w)-$this->wCanhoto;
2634
+            $w = $this->wPrint - (3 * $w) - $this->wCanhoto;
2641 2635
         }
2642 2636
         $texto = 'VALOR TOTAL DO ISSQN';
2643 2637
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2644 2638
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
2645 2639
         if (isset($this->ISSQNtot)) {
2646
-            $texto = ! empty($this->ISSQNtot->getElementsByTagName("vISS")->item(0)->nodeValue) ?
2640
+            $texto = !empty($this->ISSQNtot->getElementsByTagName("vISS")->item(0)->nodeValue) ?
2647 2641
                     $this->ISSQNtot->getElementsByTagName("vISS")->item(0)->nodeValue : '';
2648
-            $texto = ! empty($texto) ? number_format($texto, 2, ",", ".") : '';
2642
+            $texto = !empty($texto) ? number_format($texto, 2, ",", ".") : '';
2649 2643
         } else {
2650 2644
             $texto = '';
2651 2645
         }
2652 2646
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
2653 2647
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'R', 0, '');
2654
-        return ($y+$h+1);
2648
+        return ($y + $h + 1);
2655 2649
     }
2656 2650
 
2657 2651
     /**
@@ -2672,7 +2666,7 @@  discard block
 block discarded – undo
2672 2666
         if ($this->orientacao == 'P') {
2673 2667
               $w = $this->wPrint;
2674 2668
         } else {
2675
-              $w = $this->wPrint-$this->wCanhoto;
2669
+              $w = $this->wPrint - $this->wCanhoto;
2676 2670
         }
2677 2671
         $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
2678 2672
         $this->pTextBox($x, $y, $w, 8, $texto, $aFont, 'T', 'L', 0, '');
@@ -2688,15 +2682,15 @@  discard block
 block discarded – undo
2688 2682
         //$this->textoAdic com o texto completo do campo
2689 2683
         $y += 1;
2690 2684
         $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'');
2691
-        $this->pTextBox($x, $y+2, $w-2, $h-3, $this->textoAdic, $aFont, 'T', 'L', 0, '', false);
2685
+        $this->pTextBox($x, $y + 2, $w - 2, $h - 3, $this->textoAdic, $aFont, 'T', 'L', 0, '', false);
2692 2686
         //RESERVADO AO FISCO
2693 2687
         $texto = "RESERVADO AO FISCO";
2694 2688
         $x += $w;
2695 2689
         $y -= 1;
2696 2690
         if ($this->orientacao == 'P') {
2697
-            $w = $this->wPrint-$w;
2691
+            $w = $this->wPrint - $w;
2698 2692
         } else {
2699
-            $w = $this->wPrint-$w-$this->wCanhoto;
2693
+            $w = $this->wPrint - $w - $this->wCanhoto;
2700 2694
         }
2701 2695
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'B');
2702 2696
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -2735,8 +2729,8 @@  discard block
 block discarded – undo
2735 2729
         }
2736 2730
         $y += 2;
2737 2731
         $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'');
2738
-        $this->pTextBox($x, $y, $w-2, $h-3, $texto, $aFont, 'T', 'L', 0, '', false);
2739
-        return $y+$h;
2732
+        $this->pTextBox($x, $y, $w - 2, $h - 3, $texto, $aFont, 'T', 'L', 0, '', false);
2733
+        return $y + $h;
2740 2734
     }
2741 2735
 
2742 2736
     /**
@@ -2754,13 +2748,13 @@  discard block
 block discarded – undo
2754 2748
         if ($this->orientacao == 'P') {
2755 2749
               $w = $this->wPrint;
2756 2750
         } else {
2757
-              $w = $this->wPrint-$this->wCanhoto;
2751
+              $w = $this->wPrint - $this->wCanhoto;
2758 2752
               $x = $this->wCanhoto;
2759 2753
         }
2760 2754
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'I');
2761
-        $texto = "Impresso em ". date('d/m/Y') . " as " . date('H:i:s');
2755
+        $texto = "Impresso em " . date('d/m/Y') . " as " . date('H:i:s');
2762 2756
         $this->pTextBox($x, $y, $w, 0, $texto, $aFont, 'T', 'L', false);
2763
-        $texto = $this->creditos .  "  Powered by NFePHP";
2757
+        $texto = $this->creditos . "  Powered by NFePHP";
2764 2758
         $this->pTextBox($x, $y, $w, 0, $texto, $aFont, 'T', 'R', false, '');
2765 2759
     }
2766 2760
 
@@ -2813,9 +2807,9 @@  discard block
 block discarded – undo
2813 2807
         } else {
2814 2808
             //linha separadora do canhoto - 238
2815 2809
             //posicao altura
2816
-            $y = $this->wPrint-85;
2810
+            $y = $this->wPrint - 85;
2817 2811
             //altura
2818
-            $w = $this->wPrint-85-24;
2812
+            $w = $this->wPrint - 85 - 24;
2819 2813
         }
2820 2814
         $h = 10;
2821 2815
         //desenha caixa
@@ -2838,21 +2832,21 @@  discard block
 block discarded – undo
2838 2832
             $texto .= "AO LADO";
2839 2833
         }
2840 2834
         $texto .= ". EMISSÃO: ";
2841
-        $dEmi = ! empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
2835
+        $dEmi = !empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
2842 2836
                 $this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue : '';
2843 2837
         if ($dEmi == '') {
2844
-            $dEmi = ! empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
2838
+            $dEmi = !empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
2845 2839
                     $this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue : '';
2846 2840
             $aDemi = explode('T', $dEmi);
2847 2841
             $dEmi = $aDemi[0];
2848 2842
         }
2849
-        $texto .= $this->pYmd2dmy($dEmi) ." ";
2843
+        $texto .= $this->pYmd2dmy($dEmi) . " ";
2850 2844
         $texto .= "VALOR TOTAL: R$ ";
2851 2845
         $texto .= number_format($this->ICMSTot->getElementsByTagName("vNF")->item(0)->nodeValue, 2, ",", ".") . " ";
2852 2846
         $texto .= "DESTINATÁRIO: ";
2853 2847
         $texto .= $destinatario;
2854 2848
         if ($this->orientacao == 'P') {
2855
-            $this->pTextBox($x, $y, $w-1, $h, $texto, $aFont, 'C', 'L', 0, '', false);
2849
+            $this->pTextBox($x, $y, $w - 1, $h, $texto, $aFont, 'C', 'L', 0, '', false);
2856 2850
             $x1 = $x + $w;
2857 2851
             $w1 = $this->wPrint - $w;
2858 2852
             $texto = "NF-e";
@@ -2865,12 +2859,12 @@  discard block
 block discarded – undo
2865 2859
             //DATA DE RECEBIMENTO
2866 2860
             $texto = "DATA DE RECEBIMENTO";
2867 2861
             $y += $h;
2868
-            $w2 = round($this->wPrint*0.17, 0); //35;
2862
+            $w2 = round($this->wPrint * 0.17, 0); //35;
2869 2863
             $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2870 2864
             $this->pTextBox($x, $y, $w2, 8, $texto, $aFont, 'T', 'L', 1, '');
2871 2865
             //IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR
2872 2866
             $x += $w2;
2873
-            $w3 = $w-$w2;
2867
+            $w3 = $w - $w2;
2874 2868
             $texto = "IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR";
2875 2869
             $this->pTextBox($x, $y, $w3, 8, $texto, $aFont, 'T', 'L', 1, '');
2876 2870
             $x = $oldX;
@@ -2880,7 +2874,7 @@  discard block
 block discarded – undo
2880 2874
             return $y;
2881 2875
         } else {
2882 2876
             $x--;
2883
-            $x = $this->pTextBox90($x, $y, $w-1, $h, $texto, $aFontSmall, 'C', 'L', 0, '', false);
2877
+            $x = $this->pTextBox90($x, $y, $w - 1, $h, $texto, $aFontSmall, 'C', 'L', 0, '', false);
2884 2878
             //NUMERO DA NOTA FISCAL LOGO NFE
2885 2879
             $w1 = 16;
2886 2880
             $x1 = $oldX;
@@ -2894,18 +2888,18 @@  discard block
 block discarded – undo
2894 2888
             $this->pTextBox($x1, $y, $w1, 18, $texto, $aFont, 'C', 'C', 1, '');
2895 2889
             //DATA DO RECEBIMENTO
2896 2890
             $texto = "DATA DO RECEBIMENTO";
2897
-            $y = $this->wPrint-85;
2891
+            $y = $this->wPrint - 85;
2898 2892
             $x = 12;
2899
-            $w2 = round($this->wPrint*0.17, 0); //35;
2893
+            $w2 = round($this->wPrint * 0.17, 0); //35;
2900 2894
             $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2901 2895
             $this->pTextBox90($x, $y, $w2, 8, $texto, $aFont, 'T', 'L', 1, '');
2902 2896
             //IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR
2903 2897
             $y -= $w2;
2904
-            $w3 = $w-$w2;
2898
+            $w3 = $w - $w2;
2905 2899
             $texto = "IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR";
2906 2900
             $aFont = array('font'=>$this->fontePadrao, 'size'=>5.7, 'style'=>'');
2907 2901
             $x = $this->pTextBox90($x, $y, $w3, 8, $texto, $aFont, 'T', 'L', 1, '');
2908
-            $this->pdf->DashedVLine(23, $oldY, 0.1, $this->wPrint-20, 67);
2902
+            $this->pdf->DashedVLine(23, $oldY, 0.1, $this->wPrint - 20, 67);
2909 2903
             return $x;
2910 2904
         }
2911 2905
     }
@@ -2922,13 +2916,13 @@  discard block
 block discarded – undo
2922 2916
     {
2923 2917
         $saida = "";
2924 2918
         if (isset($this->compra)) {
2925
-            if (! empty($this->compra->getElementsByTagName("xNEmp")->item(0)->nodeValue)) {
2919
+            if (!empty($this->compra->getElementsByTagName("xNEmp")->item(0)->nodeValue)) {
2926 2920
                 $saida .= " Nota de Empenho: " . $this->compra->getElementsByTagName("xNEmp")->item(0)->nodeValue;
2927 2921
             }
2928
-            if (! empty($this->compra->getElementsByTagName("xPed")->item(0)->nodeValue)) {
2922
+            if (!empty($this->compra->getElementsByTagName("xPed")->item(0)->nodeValue)) {
2929 2923
                 $saida .= " Pedido: " . $this->compra->getElementsByTagName("xPed")->item(0)->nodeValue;
2930 2924
             }
2931
-            if (! empty($this->compra->getElementsByTagName("xCont")->item(0)->nodeValue)) {
2925
+            if (!empty($this->compra->getElementsByTagName("xCont")->item(0)->nodeValue)) {
2932 2926
                 $saida .= " Contrato: " . $this->compra->getElementsByTagName("xCont")->item(0)->nodeValue;
2933 2927
             }
2934 2928
         }
@@ -2954,21 +2948,21 @@  discard block
 block discarded – undo
2954 2948
         if ($vICMS > 0) {
2955 2949
             $vICMS = 1;
2956 2950
         }
2957
-        $icmss  = $this->ICMSTot->getElementsByTagName("vBC")->item(0)->nodeValue;
2951
+        $icmss = $this->ICMSTot->getElementsByTagName("vBC")->item(0)->nodeValue;
2958 2952
         if ($icmss > 0) {
2959 2953
             $icmss = 1;
2960 2954
         }
2961
-        $dEmi = ! empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
2955
+        $dEmi = !empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
2962 2956
                 $this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue : '';
2963 2957
         if ($dEmi == '') {
2964
-            $dEmi = ! empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
2958
+            $dEmi = !empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
2965 2959
                     $this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue : '';
2966 2960
             $aDemi = explode('T', $dEmi);
2967 2961
             $dEmi = $aDemi[0];
2968 2962
         }
2969 2963
         $dd  = $dEmi;
2970 2964
         $rpos = strrpos($dd, '-');
2971
-        $dd  = substr($dd, $rpos +1);
2965
+        $dd  = substr($dd, $rpos + 1);
2972 2966
         $chave = sprintf($forma, $cUF, $this->tpEmis, $CNPJ, $vNF, $vICMS, $icmss, $dd);
2973 2967
         $chave = $chave . $this->pModulo11($chave);
2974 2968
         return $chave;
@@ -2989,7 +2983,7 @@  discard block
 block discarded – undo
2989 2983
         $formaNfRef = "\r\nNF  Ref.: série:%d numero:%d emit:%s em %s modelo: %d";
2990 2984
         $formaECFRef = "\r\nECF Ref.: modelo: %s ECF:%d COO:%d";
2991 2985
         $formaNfpRef = "\r\nNFP Ref.: série:%d número:%d emit:%s em %s modelo: %d IE:%s";
2992
-        $saida='';
2986
+        $saida = '';
2993 2987
         $nfRefs = $this->ide->getElementsByTagName('NFref');
2994 2988
         if (0 === $nfRefs->length) {
2995 2989
             return $saida;
@@ -3002,7 +2996,7 @@  discard block
 block discarded – undo
3002 2996
             foreach ($refNFe as $chave_acessoRef) {
3003 2997
                 $chave_acesso = $chave_acessoRef->nodeValue;
3004 2998
                 $chave_acessoF = $this->pFormat($chave_acesso, $this->formatoChave);
3005
-                $data = substr($chave_acesso, 4, 2)."/20".substr($chave_acesso, 2, 2);
2999
+                $data = substr($chave_acesso, 4, 2) . "/20" . substr($chave_acesso, 2, 2);
3006 3000
                 $cnpj = $this->pFormat(substr($chave_acesso, 6, 14), "##.###.###/####-##");
3007 3001
                 $serie  = substr($chave_acesso, 22, 3);
3008 3002
                 $numero = substr($chave_acesso, 25, 9);
@@ -3023,7 +3017,7 @@  discard block
 block discarded – undo
3023 3017
             foreach ($refCTe as $chave_acessoRef) {
3024 3018
                 $chave_acesso = $chave_acessoRef->nodeValue;
3025 3019
                 $chave_acessoF = $this->pFormat($chave_acesso, $this->formatoChave);
3026
-                $data = substr($chave_acesso, 4, 2)."/20".substr($chave_acesso, 2, 2);
3020
+                $data = substr($chave_acesso, 4, 2) . "/20" . substr($chave_acesso, 2, 2);
3027 3021
                 $cnpj = $this->pFormat(substr($chave_acesso, 6, 14), "##.###.###/####-##");
3028 3022
                 $serie  = substr($chave_acesso, 22, 3);
3029 3023
                 $numero = substr($chave_acesso, 25, 9);
@@ -3039,10 +3033,9 @@  discard block
 block discarded – undo
3039 3033
             $refNFP = $nfRef->getElementsByTagName('refNFP');
3040 3034
             foreach ($refNFP as $umaRefNFe) {
3041 3035
                 $data = $umaRefNFe->getElementsByTagName('AAMM')->item(0)->nodeValue;
3042
-                $cnpj = ! empty($umaRefNFe->getElementsByTagName('CNPJ')->item(0)->nodeValue) ?
3043
-                    $umaRefNFe->getElementsByTagName('CNPJ')->item(0)->nodeValue :
3044
-                    '';
3045
-                $cpf = ! empty($umaRefNFe->getElementsByTagName('CPF')->item(0)->nodeValue) ?
3036
+                $cnpj = !empty($umaRefNFe->getElementsByTagName('CNPJ')->item(0)->nodeValue) ?
3037
+                    $umaRefNFe->getElementsByTagName('CNPJ')->item(0)->nodeValue : '';
3038
+                $cpf = !empty($umaRefNFe->getElementsByTagName('CPF')->item(0)->nodeValue) ?
3046 3039
                         $umaRefNFe->getElementsByTagName('CPF')->item(0)->nodeValue : '';
3047 3040
                 $mod = $umaRefNFe->getElementsByTagName('mod')->item(0)->nodeValue;
3048 3041
                 $serie = $umaRefNFe->getElementsByTagName('serie')->item(0)->nodeValue;
@@ -3068,6 +3061,6 @@  discard block
 block discarded – undo
3068 3061
         imagedestroy($image);
3069 3062
         $stringdata = ob_get_contents(); // read from buffer
3070 3063
         ob_end_clean();
3071
-        return 'data://text/plain;base64,'.base64_encode($stringdata);
3064
+        return 'data://text/plain;base64,' . base64_encode($stringdata);
3072 3065
     }
3073 3066
 }
Please login to merge, or discard this patch.