Completed
Pull Request — master (#178)
by Vinícius
07:16
created
src/NFe/Danfe.php 1 patch
Spacing   +349 added lines, -356 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 -= 24 * $this->qCanhoto;//para canhoto
681
+            $hDispo1 -= 24 * $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,7 +726,7 @@  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
         
737 731
         
738 732
         //Verifica as formas de pagamento da nota fiscal
@@ -746,29 +740,29 @@  discard block
 block discarded – undo
746 740
         }
747 741
         //caso tenha boleto imprimir fatura
748 742
         if ($this->dup->length > 0) {
749
-            $y = $this->pFaturaDANFE($x, $y+1);
743
+            $y = $this->pFaturaDANFE($x, $y + 1);
750 744
         } else {
751 745
             //Se somente tiver a forma de pagamento sem pagamento ou outros não imprimir nada
752
-            if (count($formaPag)=='1' && (isset($formaPag[90]) || isset($formaPag[99]))) {
746
+            if (count($formaPag) == '1' && (isset($formaPag[90]) || isset($formaPag[99]))) {
753 747
                 $y = $y;
754 748
             } else {
755 749
                 //caso tenha mais de uma forma de pagamento ou seja diferente de boleto exibe a
756 750
                 //forma de pagamento e o valor
757
-                $y = $this->pagamentoDANFE($x, $y+1);
751
+                $y = $this->pagamentoDANFE($x, $y + 1);
758 752
             }
759 753
         }
760 754
         //coloca os dados dos impostos e totais da NFe
761
-        $y = $this->pImpostoDANFE($x, $y+1);
755
+        $y = $this->pImpostoDANFE($x, $y + 1);
762 756
         //coloca os dados do trasnporte
763
-        $y = $this->pTransporteDANFE($x, $y+1);
757
+        $y = $this->pTransporteDANFE($x, $y + 1);
764 758
         //itens da DANFE
765 759
         $nInicial = 0;
766 760
 
767
-        $y = $this->pItensDANFE($x, $y+1, $nInicial, $hDispo1, $pag, $totPag, $hCabecItens);
761
+        $y = $this->pItensDANFE($x, $y + 1, $nInicial, $hDispo1, $pag, $totPag, $hCabecItens);
768 762
 
769 763
         //coloca os dados do ISSQN
770 764
         if ($linhaISSQN == 1) {
771
-            $y = $this->pIssqnDANFE($x, $y+4);
765
+            $y = $this->pIssqnDANFE($x, $y + 4);
772 766
         } else {
773 767
             $y += 4;
774 768
         }
@@ -776,7 +770,7 @@  discard block
 block discarded – undo
776 770
         $y = $this->pDadosAdicionaisDANFE($x, $y, $hdadosadic);
777 771
         //coloca o rodapé da página
778 772
         if ($this->orientacao == 'P') {
779
-            $this->pRodape($xInic, $y-1);
773
+            $this->pRodape($xInic, $y - 1);
780 774
         } else {
781 775
             $this->pRodape($xInic, $this->hPrint + 1);
782 776
         }
@@ -797,7 +791,7 @@  discard block
 block discarded – undo
797 791
             //coloca o cabeçalho na página adicional
798 792
             $y = $this->pCabecalhoDANFE($x, $y, $n, $totPag);
799 793
             //coloca os itens na página adicional
800
-            $y = $this->pItensDANFE($x, $y+1, $nInicial, $hDispo2, $n, $totPag, $hCabecItens);
794
+            $y = $this->pItensDANFE($x, $y + 1, $nInicial, $hDispo2, $n, $totPag, $hCabecItens);
801 795
             //coloca o rodapé da página
802 796
             if ($this->orientacao == 'P') {
803 797
                 $this->pRodape($xInic, $y + 4);
@@ -810,7 +804,7 @@  discard block
 block discarded – undo
810 804
             }
811 805
         }
812 806
         //retorna o ID na NFe
813
-        if ($classPdf!==false) {
807
+        if ($classPdf !== false) {
814 808
             $aR = array(
815 809
              'id'=>str_replace('NFe', '', $this->infNFe->getAttribute("Id")),
816 810
              'classe_PDF'=>$this->pdf);
@@ -843,7 +837,7 @@  discard block
 block discarded – undo
843 837
         if ($startPos === false) {
844 838
             return $cdata;
845 839
         }
846
-        for ($x=$len; $x>0; $x--) {
840
+        for ($x = $len; $x > 0; $x--) {
847 841
             if (substr($cdata, $x, 1) == '>') {
848 842
                 $endPos = $x;
849 843
                 break;
@@ -854,15 +848,15 @@  discard block
 block discarded – undo
854 848
         } else {
855 849
             $parte1 = '';
856 850
         }
857
-        $parte2 = substr($cdata, $startPos, $endPos-$startPos+1);
851
+        $parte2 = substr($cdata, $startPos, $endPos - $startPos + 1);
858 852
         if ($endPos < $len) {
859 853
             $parte3 = substr($cdata, $endPos + 1, $len - $endPos - 1);
860 854
         } else {
861 855
             $parte3 = '';
862 856
         }
863
-        $texto = trim($parte1).' '.trim($parte3);
857
+        $texto = trim($parte1) . ' ' . trim($parte3);
864 858
         if (strpos($parte2, '<CDATA>') === false) {
865
-            $cdata = '<CDATA>'.$parte2.'</CDATA>';
859
+            $cdata = '<CDATA>' . $parte2 . '</CDATA>';
866 860
         } else {
867 861
             $cdata = $parte2;
868 862
         }
@@ -936,15 +930,15 @@  discard block
 block discarded – undo
936 930
         //grupo CADATA infCpl
937 931
         $t = $dom->getElementsByTagName('transmissor')->item(0);
938 932
         $r = $dom->getElementsByTagName('receptor')->item(0);
939
-        $versao = ! empty($dom->getElementsByTagName('versao')->item(0)->nodeValue) ?
940
-            'Versao:'.$dom->getElementsByTagName('versao')->item(0)->nodeValue.' ' : '';
941
-        $especieNF = ! empty($dom->getElementsByTagName('especieNF')->item(0)->nodeValue) ?
942
-            'Especie:'.$dom->getElementsByTagName('especieNF')->item(0)->nodeValue.' ' : '';
943
-        $fabEntrega = ! empty($dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue) ?
944
-            'Entrega:'.$dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue.' ' : '';
945
-        $dca = ! empty($dom->getElementsByTagName('dca')->item(0)->nodeValue) ?
946
-            'dca:'.$dom->getElementsByTagName('dca')->item(0)->nodeValue.' ' : '';
947
-        $texto .= "".$versao.$especieNF.$fabEntrega.$dca;
933
+        $versao = !empty($dom->getElementsByTagName('versao')->item(0)->nodeValue) ?
934
+            'Versao:' . $dom->getElementsByTagName('versao')->item(0)->nodeValue . ' ' : '';
935
+        $especieNF = !empty($dom->getElementsByTagName('especieNF')->item(0)->nodeValue) ?
936
+            'Especie:' . $dom->getElementsByTagName('especieNF')->item(0)->nodeValue . ' ' : '';
937
+        $fabEntrega = !empty($dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue) ?
938
+            'Entrega:' . $dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue . ' ' : '';
939
+        $dca = !empty($dom->getElementsByTagName('dca')->item(0)->nodeValue) ?
940
+            'dca:' . $dom->getElementsByTagName('dca')->item(0)->nodeValue . ' ' : '';
941
+        $texto .= "" . $versao . $especieNF . $fabEntrega . $dca;
948 942
         if (isset($t)) {
949 943
             if ($t->hasAttributes()) {
950 944
                 $texto .= " Transmissor ";
@@ -1034,14 +1028,14 @@  discard block
 block discarded – undo
1034 1028
         }
1035 1029
         //####################################################################################
1036 1030
         //coluna esquerda identificação do emitente
1037
-        $w = round($maxW*0.41, 0);
1031
+        $w = round($maxW * 0.41, 0);
1038 1032
         if ($this->orientacao == 'P') {
1039 1033
             $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'I');
1040 1034
         } else {
1041 1035
             $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B');
1042 1036
         }
1043 1037
         $w1 = $w;
1044
-        $h=32;
1038
+        $h = 32;
1045 1039
         $oldY += $h;
1046 1040
         $this->pTextBox($x, $y, $w, $h);
1047 1041
         $texto = 'IDENTIFICAÇÃO DO EMITENTE';
@@ -1062,39 +1056,39 @@  discard block
 block discarded – undo
1062 1056
                 $type == 'jpg';
1063 1057
             }
1064 1058
             //largura da imagem em mm
1065
-            $logoWmm = ($logoInfo[0]/72)*25.4;
1059
+            $logoWmm = ($logoInfo[0] / 72) * 25.4;
1066 1060
             //altura da imagem em mm
1067
-            $logoHmm = ($logoInfo[1]/72)*25.4;
1068
-            if ($this->logoAlign=='L') {
1069
-                $nImgW = round($w/3, 0);
1070
-                $nImgH = round($logoHmm * ($nImgW/$logoWmm), 0);
1071
-                $xImg = $x+1;
1072
-                $yImg = round(($h-$nImgH)/2, 0)+$y;
1061
+            $logoHmm = ($logoInfo[1] / 72) * 25.4;
1062
+            if ($this->logoAlign == 'L') {
1063
+                $nImgW = round($w / 3, 0);
1064
+                $nImgH = round($logoHmm * ($nImgW / $logoWmm), 0);
1065
+                $xImg = $x + 1;
1066
+                $yImg = round(($h - $nImgH) / 2, 0) + $y;
1073 1067
                 //estabelecer posições do texto
1074
-                $x1 = round($xImg + $nImgW +1, 0);
1075
-                $y1 = round($h/3+$y, 0);
1076
-                $tw = round(2*$w/3, 0);
1077
-            } elseif ($this->logoAlign=='C') {
1078
-                $nImgH = round($h/3, 0);
1079
-                $nImgW = round($logoWmm * ($nImgH/$logoHmm), 0);
1080
-                $xImg = round(($w-$nImgW)/2+$x, 0);
1081
-                $yImg = $y+3;
1068
+                $x1 = round($xImg + $nImgW + 1, 0);
1069
+                $y1 = round($h / 3 + $y, 0);
1070
+                $tw = round(2 * $w / 3, 0);
1071
+            } elseif ($this->logoAlign == 'C') {
1072
+                $nImgH = round($h / 3, 0);
1073
+                $nImgW = round($logoWmm * ($nImgH / $logoHmm), 0);
1074
+                $xImg = round(($w - $nImgW) / 2 + $x, 0);
1075
+                $yImg = $y + 3;
1082 1076
                 $x1 = $x;
1083 1077
                 $y1 = round($yImg + $nImgH + 1, 0);
1084 1078
                 $tw = $w;
1085
-            } elseif ($this->logoAlign=='R') {
1086
-                $nImgW = round($w/3, 0);
1087
-                $nImgH = round($logoHmm * ($nImgW/$logoWmm), 0);
1088
-                $xImg = round($x+($w-(1+$nImgW)), 0);
1089
-                $yImg = round(($h-$nImgH)/2, 0)+$y;
1079
+            } elseif ($this->logoAlign == 'R') {
1080
+                $nImgW = round($w / 3, 0);
1081
+                $nImgH = round($logoHmm * ($nImgW / $logoWmm), 0);
1082
+                $xImg = round($x + ($w - (1 + $nImgW)), 0);
1083
+                $yImg = round(($h - $nImgH) / 2, 0) + $y;
1090 1084
                 $x1 = $x;
1091
-                $y1 = round($h/3+$y, 0);
1092
-                $tw = round(2*$w/3, 0);
1093
-            } elseif ($this->logoAlign=='F') {
1094
-                $nImgH = round($h-5, 0);
1095
-                $nImgW = round($logoWmm * ($nImgH/$logoHmm), 0);
1096
-                $xImg = round(($w-$nImgW)/2+$x, 0);
1097
-                $yImg = $y+3;
1085
+                $y1 = round($h / 3 + $y, 0);
1086
+                $tw = round(2 * $w / 3, 0);
1087
+            } elseif ($this->logoAlign == 'F') {
1088
+                $nImgH = round($h - 5, 0);
1089
+                $nImgW = round($logoWmm * ($nImgH / $logoHmm), 0);
1090
+                $xImg = round(($w - $nImgW) / 2 + $x, 0);
1091
+                $yImg = $y + 3;
1098 1092
                 $x1 = $x;
1099 1093
                 $y1 = round($yImg + $nImgH + 1, 0);
1100 1094
                 $tw = $w;
@@ -1103,7 +1097,7 @@  discard block
 block discarded – undo
1103 1097
             $this->pdf->Image($this->logomarca, $xImg, $yImg, $nImgW, $nImgH, $type);
1104 1098
         } else {
1105 1099
             $x1 = $x;
1106
-            $y1 = round($h/3+$y, 0);
1100
+            $y1 = round($h / 3 + $y, 0);
1107 1101
             $tw = $w;
1108 1102
         }
1109 1103
         // monta as informações apenas se diferente de full logo
@@ -1113,9 +1107,9 @@  discard block
 block discarded – undo
1113 1107
             $texto = $this->emit->getElementsByTagName("xNome")->item(0)->nodeValue;
1114 1108
             $this->pTextBox($x1, $y1, $tw, 8, $texto, $aFont, 'T', 'C', 0, '');
1115 1109
             //endereço
1116
-            $y1 = $y1+5;
1110
+            $y1 = $y1 + 5;
1117 1111
             $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'');
1118
-            $fone = ! empty($this->enderEmit->getElementsByTagName("fone")->item(0)->nodeValue)
1112
+            $fone = !empty($this->enderEmit->getElementsByTagName("fone")->item(0)->nodeValue)
1119 1113
                  ? $this->enderEmit->getElementsByTagName("fone")->item(0)->nodeValue
1120 1114
                  : '';
1121 1115
             $lgr = $this->pSimpleGetValue($this->enderEmit, "xLgr");
@@ -1135,37 +1129,37 @@  discard block
 block discarded – undo
1135 1129
         //####################################################################################
1136 1130
         //coluna central Danfe
1137 1131
         $x += $w;
1138
-        $w=round($maxW * 0.17, 0);//35;
1132
+        $w = round($maxW * 0.17, 0); //35;
1139 1133
         $w2 = $w;
1140 1134
         $h = 32;
1141 1135
         $this->pTextBox($x, $y, $w, $h);
1142 1136
 
1143
-        if (! $this->pNotaCancelada()) {
1137
+        if (!$this->pNotaCancelada()) {
1144 1138
             // A PRINCIPIO NÃO PRECISAVA, POIS A NFE ESTÁ AUTORIZADA,
1145 1139
             // SÓ SE RETIRA O DANFE PARA NOTAS NÃO AUTORIZADAS
1146 1140
             $texto = "DANFE";
1147 1141
             $aFont = array('font'=>$this->fontePadrao, 'size'=>14, 'style'=>'B');
1148
-            $this->pTextBox($x, $y+1, $w, $h, $texto, $aFont, 'T', 'C', 0, '');
1142
+            $this->pTextBox($x, $y + 1, $w, $h, $texto, $aFont, 'T', 'C', 0, '');
1149 1143
             $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'');
1150 1144
             $texto = 'Documento Auxiliar da Nota Fiscal Eletrônica';
1151 1145
             $h = 20;
1152
-            $this->pTextBox($x, $y+6, $w, $h, $texto, $aFont, 'T', 'C', 0, '', false);
1146
+            $this->pTextBox($x, $y + 6, $w, $h, $texto, $aFont, 'T', 'C', 0, '', false);
1153 1147
         }
1154 1148
 
1155 1149
         $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'');
1156 1150
         $texto = '0 - ENTRADA';
1157 1151
         $y1 = $y + 14;
1158 1152
         $h = 8;
1159
-        $this->pTextBox($x+2, $y1, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1153
+        $this->pTextBox($x + 2, $y1, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1160 1154
         $texto = '1 - SAÍDA';
1161 1155
         $y1 = $y + 17;
1162
-        $this->pTextBox($x+2, $y1, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1156
+        $this->pTextBox($x + 2, $y1, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1163 1157
         //tipo de nF
1164 1158
         $aFont = array('font'=>$this->fontePadrao, 'size'=>12, 'style'=>'B');
1165 1159
         $y1 = $y + 13;
1166 1160
         $h = 7;
1167 1161
         $texto = $this->ide->getElementsByTagName('tpNF')->item(0)->nodeValue;
1168
-        $this->pTextBox($x+27, $y1, 5, $h, $texto, $aFont, 'C', 'C', 1, '');
1162
+        $this->pTextBox($x + 27, $y1, 5, $h, $texto, $aFont, 'C', 'C', 1, '');
1169 1163
         //numero da NF
1170 1164
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
1171 1165
         $y1 = $y + 20;
@@ -1187,7 +1181,7 @@  discard block
 block discarded – undo
1187 1181
         //####################################################################################
1188 1182
         //coluna codigo de barras
1189 1183
         $x += $w;
1190
-        $w = ($maxW-$w1-$w2);//85;
1184
+        $w = ($maxW - $w1 - $w2); //85;
1191 1185
         $w3 = $w;
1192 1186
         $h = 32;
1193 1187
         $this->pTextBox($x, $y, $w, $h);
@@ -1196,22 +1190,22 @@  discard block
 block discarded – undo
1196 1190
         $bW = 75;
1197 1191
         $bH = 12;
1198 1192
         //codigo de barras
1199
-        $this->pdf->Code128($x+(($w-$bW)/2), $y+2, $chave_acesso, $bW, $bH);
1193
+        $this->pdf->Code128($x + (($w - $bW) / 2), $y + 2, $chave_acesso, $bW, $bH);
1200 1194
         //linhas divisorias
1201
-        $this->pdf->Line($x, $y+4+$bH, $x+$w, $y+4+$bH);
1202
-        $this->pdf->Line($x, $y+12+$bH, $x+$w, $y+12+$bH);
1195
+        $this->pdf->Line($x, $y + 4 + $bH, $x + $w, $y + 4 + $bH);
1196
+        $this->pdf->Line($x, $y + 12 + $bH, $x + $w, $y + 12 + $bH);
1203 1197
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1204
-        $y1 = $y+4+$bH;
1198
+        $y1 = $y + 4 + $bH;
1205 1199
         $h = 7;
1206 1200
         $texto = 'CHAVE DE ACESSO';
1207 1201
         $this->pTextBox($x, $y1, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1208 1202
         $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B');
1209
-        $y1 = $y+8+$bH;
1203
+        $y1 = $y + 8 + $bH;
1210 1204
         $texto = $this->pFormat($chave_acesso, $this->formatoChave);
1211
-        $this->pTextBox($x+2, $y1, $w-2, $h, $texto, $aFont, 'T', 'C', 0, '');
1212
-        $y1 = $y+12+$bH;
1205
+        $this->pTextBox($x + 2, $y1, $w - 2, $h, $texto, $aFont, 'T', 'C', 0, '');
1206
+        $y1 = $y + 12 + $bH;
1213 1207
         $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'');
1214
-        $chaveContingencia="";
1208
+        $chaveContingencia = "";
1215 1209
         if ($this->pNotaDPEC()) {
1216 1210
             $cabecalhoProtoAutorizacao = 'NÚMERO DE REGISTRO DPEC';
1217 1211
         } else {
@@ -1222,16 +1216,16 @@  discard block
 block discarded – undo
1222 1216
             $chaveContingencia = $this->pGeraChaveAdicionalDeContingencia();
1223 1217
             $this->pdf->SetFillColor(0, 0, 0);
1224 1218
             //codigo de barras
1225
-            $this->pdf->Code128($x+11, $y1+1, $chaveContingencia, $bW*.9, $bH/2);
1219
+            $this->pdf->Code128($x + 11, $y1 + 1, $chaveContingencia, $bW * .9, $bH / 2);
1226 1220
         } else {
1227 1221
             $texto = 'Consulta de autenticidade no portal nacional da NF-e';
1228
-            $this->pTextBox($x+2, $y1, $w-2, $h, $texto, $aFont, 'T', 'C', 0, '');
1229
-            $y1 = $y+16+$bH;
1222
+            $this->pTextBox($x + 2, $y1, $w - 2, $h, $texto, $aFont, 'T', 'C', 0, '');
1223
+            $y1 = $y + 16 + $bH;
1230 1224
             $texto = 'www.nfe.fazenda.gov.br/portal ou no site da Sefaz Autorizadora';
1231 1225
             $this->pTextBox(
1232
-                $x+2,
1226
+                $x + 2,
1233 1227
                 $y1,
1234
-                $w-2,
1228
+                $w - 2,
1235 1229
                 $h,
1236 1230
                 $texto,
1237 1231
                 $aFont,
@@ -1247,7 +1241,7 @@  discard block
 block discarded – undo
1247 1241
         //natureza da operação
1248 1242
         $texto = 'NATUREZA DA OPERAÇÃO';
1249 1243
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1250
-        $w = $w1+$w2;
1244
+        $w = $w1 + $w2;
1251 1245
         $y = $oldY;
1252 1246
         $oldY += $h;
1253 1247
         $x = $oldX;
@@ -1277,7 +1271,7 @@  discard block
 block discarded – undo
1277 1271
                 $cStat = '';
1278 1272
             } else {
1279 1273
                 if (isset($this->nfeProc)) {
1280
-                    $texto = ! empty($this->nfeProc->getElementsByTagName("nProt")->item(0)->nodeValue) ?
1274
+                    $texto = !empty($this->nfeProc->getElementsByTagName("nProt")->item(0)->nodeValue) ?
1281 1275
                             $this->nfeProc->getElementsByTagName("nProt")->item(0)->nodeValue : '';
1282 1276
                     $tsHora = $this->pConvertTime($this->nfeProc->getElementsByTagName("dhRecbto")->item(0)->nodeValue);
1283 1277
                     if ($texto != '') {
@@ -1308,25 +1302,25 @@  discard block
 block discarded – undo
1308 1302
         $texto = 'INSCRIÇÃO ESTADUAL DO SUBST. TRIBUT.';
1309 1303
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1310 1304
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1311
-        $texto = ! empty($this->emit->getElementsByTagName("IEST")->item(0)->nodeValue)
1305
+        $texto = !empty($this->emit->getElementsByTagName("IEST")->item(0)->nodeValue)
1312 1306
              ? $this->emit->getElementsByTagName("IEST")->item(0)->nodeValue
1313 1307
              : '';
1314 1308
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
1315 1309
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1316 1310
         //CNPJ
1317 1311
         $x += $w;
1318
-        $w = ($maxW-(2*$w));
1312
+        $w = ($maxW - (2 * $w));
1319 1313
         $texto = 'CNPJ / CPF';
1320 1314
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1321 1315
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1322 1316
         //Pegando valor do CPF/CNPJ
1323
-        if (! empty($this->emit->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1317
+        if (!empty($this->emit->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1324 1318
             $texto = $this->pFormat(
1325 1319
                 $this->emit->getElementsByTagName("CNPJ")->item(0)->nodeValue,
1326 1320
                 "###.###.###/####-##"
1327 1321
             );
1328 1322
         } else {
1329
-            $texto = ! empty($this->emit->getElementsByTagName("CPF")->item(0)->nodeValue) ?
1323
+            $texto = !empty($this->emit->getElementsByTagName("CPF")->item(0)->nodeValue) ?
1330 1324
                 $this->pFormat(
1331 1325
                     $this->emit->getElementsByTagName("CPF")->item(0)->nodeValue,
1332 1326
                     "###.###.###-##"
@@ -1342,9 +1336,9 @@  discard block
 block discarded – undo
1342 1336
         if ($this->pNotaCancelada()) {
1343 1337
             //101 Cancelamento
1344 1338
             $x = 10;
1345
-            $y = $this->hPrint-130;
1339
+            $y = $this->hPrint - 130;
1346 1340
             $h = 25;
1347
-            $w = $maxW-(2*$x);
1341
+            $w = $maxW - (2 * $x);
1348 1342
             $this->pdf->SetTextColor(90, 90, 90);
1349 1343
             $texto = "NFe CANCELADA";
1350 1344
             $aFont = array('font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B');
@@ -1355,12 +1349,12 @@  discard block
 block discarded – undo
1355 1349
         if ($this->pNotaDPEC() || $this->tpEmis == 4) {
1356 1350
             //DPEC
1357 1351
             $x = 10;
1358
-            $y = $this->hPrint-130;
1352
+            $y = $this->hPrint - 130;
1359 1353
             $h = 25;
1360
-            $w = $maxW-(2*$x);
1354
+            $w = $maxW - (2 * $x);
1361 1355
             $this->pdf->SetTextColor(200, 200, 200);
1362
-            $texto = "DANFE impresso em contingência -\n".
1363
-                     "DPEC regularmente recebido pela Receita\n".
1356
+            $texto = "DANFE impresso em contingência -\n" .
1357
+                     "DPEC regularmente recebido pela Receita\n" .
1364 1358
                      "Federal do Brasil";
1365 1359
             $aFont = array('font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B');
1366 1360
             $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
@@ -1369,22 +1363,22 @@  discard block
 block discarded – undo
1369 1363
         if ($this->pNotaDenegada()) {
1370 1364
             //110 301 302 Denegada
1371 1365
             $x = 10;
1372
-            $y = $this->hPrint-130;
1366
+            $y = $this->hPrint - 130;
1373 1367
             $h = 25;
1374
-            $w = $maxW-(2*$x);
1368
+            $w = $maxW - (2 * $x);
1375 1369
             $this->pdf->SetTextColor(90, 90, 90);
1376 1370
             $texto = "NFe USO DENEGADO";
1377 1371
             $aFont = array('font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B');
1378 1372
             $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1379 1373
             $y += $h;
1380 1374
             $h = 5;
1381
-            $w = $maxW-(2*$x);
1375
+            $w = $maxW - (2 * $x);
1382 1376
             if (isset($this->infProt)) {
1383 1377
                 $xMotivo = $this->infProt->getElementsByTagName("xMotivo")->item(0)->nodeValue;
1384 1378
             } else {
1385 1379
                 $xMotivo = '';
1386 1380
             }
1387
-            $texto = "SEM VALOR FISCAL\n".$xMotivo;
1381
+            $texto = "SEM VALOR FISCAL\n" . $xMotivo;
1388 1382
             $aFont = array('font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B');
1389 1383
             $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1390 1384
             $this->pdf->SetTextColor(0, 0, 0);
@@ -1393,29 +1387,29 @@  discard block
 block discarded – undo
1393 1387
         if ($tpAmb != 1) {
1394 1388
             $x = 10;
1395 1389
             if ($this->orientacao == 'P') {
1396
-                $y = round($this->hPrint*2/3, 0);
1390
+                $y = round($this->hPrint * 2 / 3, 0);
1397 1391
             } else {
1398
-                $y = round($this->hPrint/2, 0);
1392
+                $y = round($this->hPrint / 2, 0);
1399 1393
             }
1400 1394
             $h = 5;
1401
-            $w = $maxW-(2*$x);
1395
+            $w = $maxW - (2 * $x);
1402 1396
             $this->pdf->SetTextColor(90, 90, 90);
1403 1397
             $texto = "SEM VALOR FISCAL";
1404 1398
             $aFont = array('font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B');
1405 1399
             $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1406 1400
             $aFont = array('font'=>$this->fontePadrao, 'size'=>30, 'style'=>'B');
1407 1401
             $texto = "AMBIENTE DE HOMOLOGAÇÃO";
1408
-            $this->pTextBox($x, $y+14, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1402
+            $this->pTextBox($x, $y + 14, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1409 1403
             $this->pdf->SetTextColor(0, 0, 0);
1410 1404
         } else {
1411 1405
             $x = 10;
1412 1406
             if ($this->orientacao == 'P') {
1413
-                $y = round($this->hPrint*2/3, 0);
1407
+                $y = round($this->hPrint * 2 / 3, 0);
1414 1408
             } else {
1415
-                $y = round($this->hPrint/2, 0);
1409
+                $y = round($this->hPrint / 2, 0);
1416 1410
             }//fim orientacao
1417 1411
             $h = 5;
1418
-            $w = $maxW-(2*$x);
1412
+            $w = $maxW - (2 * $x);
1419 1413
             $this->pdf->SetTextColor(90, 90, 90);
1420 1414
             //indicar FALTA DO PROTOCOLO se NFe não for em contingência
1421 1415
             if (($this->tpEmis == 2 || $this->tpEmis == 5) && !$this->pNotaDPEC()) {
@@ -1425,7 +1419,7 @@  discard block
 block discarded – undo
1425 1419
                 $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1426 1420
                 $aFont = array('font'=>$this->fontePadrao, 'size'=>30, 'style'=>'B');
1427 1421
                 $texto = "devido à problemas técnicos";
1428
-                $this->pTextBox($x, $y+12, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1422
+                $this->pTextBox($x, $y + 12, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1429 1423
             } else {
1430 1424
                 if (!isset($this->nfeProc)) {
1431 1425
                     if (!$this->pNotaDPEC()) {
@@ -1436,9 +1430,9 @@  discard block
 block discarded – undo
1436 1430
                     $aFont = array('font'=>$this->fontePadrao, 'size'=>30, 'style'=>'B');
1437 1431
                     $texto = "FALTA PROTOCOLO DE APROVAÇÃO DA SEFAZ";
1438 1432
                     if (!$this->pNotaDPEC()) {
1439
-                        $this->pTextBox($x, $y+12, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1433
+                        $this->pTextBox($x, $y + 12, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1440 1434
                     } else {
1441
-                        $this->pTextBox($x, $y+25, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1435
+                        $this->pTextBox($x, $y + 25, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1442 1436
                     }
1443 1437
                 }//fim nefProc
1444 1438
             }//fim tpEmis
@@ -1473,7 +1467,7 @@  discard block
 block discarded – undo
1473 1467
         $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
1474 1468
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1475 1469
         //NOME / RAZÃO SOCIAL
1476
-        $w = round($maxW*0.61, 0);
1470
+        $w = round($maxW * 0.61, 0);
1477 1471
         $w1 = $w;
1478 1472
         $y += 3;
1479 1473
         $texto = 'NOME / RAZÃO SOCIAL';
@@ -1488,19 +1482,19 @@  discard block
 block discarded – undo
1488 1482
         }
1489 1483
         //CNPJ / CPF
1490 1484
         $x += $w;
1491
-        $w = round($maxW*0.23, 0);
1485
+        $w = round($maxW * 0.23, 0);
1492 1486
         $w2 = $w;
1493 1487
         $texto = 'CNPJ / CPF';
1494 1488
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1495 1489
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1496 1490
         //Pegando valor do CPF/CNPJ
1497
-        if (! empty($this->dest->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1491
+        if (!empty($this->dest->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1498 1492
             $texto = $this->pFormat(
1499 1493
                 $this->dest->getElementsByTagName("CNPJ")->item(0)->nodeValue,
1500 1494
                 "###.###.###/####-##"
1501 1495
             );
1502 1496
         } else {
1503
-            $texto = ! empty($this->dest->getElementsByTagName("CPF")->item(0)->nodeValue) ?
1497
+            $texto = !empty($this->dest->getElementsByTagName("CPF")->item(0)->nodeValue) ?
1504 1498
                     $this->pFormat(
1505 1499
                         $this->dest->getElementsByTagName("CPF")->item(0)->nodeValue,
1506 1500
                         "###.###.###-##"
@@ -1510,15 +1504,15 @@  discard block
 block discarded – undo
1510 1504
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1511 1505
         //DATA DA EMISSÃO
1512 1506
         $x += $w;
1513
-        $w = $maxW-($w1+$w2);
1507
+        $w = $maxW - ($w1 + $w2);
1514 1508
         $wx = $w;
1515 1509
         $texto = 'DATA DA EMISSÃO';
1516 1510
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1517 1511
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1518
-        $dEmi = ! empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
1512
+        $dEmi = !empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
1519 1513
                 $this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue : '';
1520 1514
         if ($dEmi == '') {
1521
-            $dEmi = ! empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
1515
+            $dEmi = !empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
1522 1516
                     $this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue : '';
1523 1517
             $aDemi = explode('T', $dEmi);
1524 1518
             $dEmi = $aDemi[0];
@@ -1531,7 +1525,7 @@  discard block
 block discarded – undo
1531 1525
             $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 1, '');
1532 1526
         }
1533 1527
         //ENDEREÇO
1534
-        $w = round($maxW*0.47, 0);
1528
+        $w = round($maxW * 0.47, 0);
1535 1529
         $w1 = $w;
1536 1530
         $y += $h;
1537 1531
         $x = $oldX;
@@ -1546,7 +1540,7 @@  discard block
 block discarded – undo
1546 1540
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 0, '', true);
1547 1541
         //BAIRRO / DISTRITO
1548 1542
         $x += $w;
1549
-        $w = round($maxW*0.21, 0);
1543
+        $w = round($maxW * 0.21, 0);
1550 1544
         $w2 = $w;
1551 1545
         $texto = 'BAIRRO / DISTRITO';
1552 1546
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
@@ -1556,12 +1550,12 @@  discard block
 block discarded – undo
1556 1550
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1557 1551
         //CEP
1558 1552
         $x += $w;
1559
-        $w = $maxW-$w1-$w2-$wx;
1553
+        $w = $maxW - $w1 - $w2 - $wx;
1560 1554
         $w2 = $w;
1561 1555
         $texto = 'CEP';
1562 1556
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1563 1557
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1564
-        $texto = ! empty($this->dest->getElementsByTagName("CEP")->item(0)->nodeValue) ?
1558
+        $texto = !empty($this->dest->getElementsByTagName("CEP")->item(0)->nodeValue) ?
1565 1559
                 $this->dest->getElementsByTagName("CEP")->item(0)->nodeValue : '';
1566 1560
         $texto = $this->pFormat($texto, "#####-###");
1567 1561
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
@@ -1572,10 +1566,10 @@  discard block
 block discarded – undo
1572 1566
         $texto = 'DATA DA SAÍDA/ENTRADA';
1573 1567
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1574 1568
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1575
-        $dSaiEnt = ! empty($this->ide->getElementsByTagName("dSaiEnt")->item(0)->nodeValue) ?
1569
+        $dSaiEnt = !empty($this->ide->getElementsByTagName("dSaiEnt")->item(0)->nodeValue) ?
1576 1570
                 $this->ide->getElementsByTagName("dSaiEnt")->item(0)->nodeValue : '';
1577 1571
         if ($dSaiEnt == '') {
1578
-            $dSaiEnt = ! empty($this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue) ?
1572
+            $dSaiEnt = !empty($this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue) ?
1579 1573
                     $this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue : '';
1580 1574
             $aDsaient = explode('T', $dSaiEnt);
1581 1575
             $dSaiEnt = $aDsaient[0];
@@ -1592,7 +1586,7 @@  discard block
 block discarded – undo
1592 1586
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1593 1587
         $texto = $this->dest->getElementsByTagName("xMun")->item(0)->nodeValue;
1594 1588
         if (strtoupper(trim($texto)) == "EXTERIOR" && $this->dest->getElementsByTagName("xPais")->length > 0) {
1595
-            $texto .= " - " .  $this->dest->getElementsByTagName("xPais")->item(0)->nodeValue;
1589
+            $texto .= " - " . $this->dest->getElementsByTagName("xPais")->item(0)->nodeValue;
1596 1590
         }
1597 1591
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
1598 1592
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 0, '');
@@ -1607,18 +1601,18 @@  discard block
 block discarded – undo
1607 1601
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1608 1602
         //FONE / FAX
1609 1603
         $x += $w;
1610
-        $w = round(($maxW -$w1-$wx-8)/2, 0);
1604
+        $w = round(($maxW - $w1 - $wx - 8) / 2, 0);
1611 1605
         $w3 = $w;
1612 1606
         $texto = 'FONE / FAX';
1613 1607
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1614 1608
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1615
-        $texto = ! empty($this->dest->getElementsByTagName("fone")->item(0)->nodeValue) ?
1609
+        $texto = !empty($this->dest->getElementsByTagName("fone")->item(0)->nodeValue) ?
1616 1610
                 $this->dest->getElementsByTagName("fone")->item(0)->nodeValue : '';
1617 1611
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
1618 1612
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1619 1613
         //INSCRIÇÃO ESTADUAL
1620 1614
         $x += $w;
1621
-        $w = $maxW -$w1-$wx-8-$w3;
1615
+        $w = $maxW - $w1 - $wx - 8 - $w3;
1622 1616
         $texto = 'INSCRIÇÃO ESTADUAL';
1623 1617
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1624 1618
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -1632,10 +1626,10 @@  discard block
 block discarded – undo
1632 1626
         $texto = 'HORA DA SAÍDA/ENTRADA';
1633 1627
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1634 1628
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1635
-        $hSaiEnt = ! empty($this->ide->getElementsByTagName("hSaiEnt")->item(0)->nodeValue) ?
1629
+        $hSaiEnt = !empty($this->ide->getElementsByTagName("hSaiEnt")->item(0)->nodeValue) ?
1636 1630
                 $this->ide->getElementsByTagName("hSaiEnt")->item(0)->nodeValue : '';
1637 1631
         if ($hSaiEnt == '') {
1638
-            $dhSaiEnt = ! empty($this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue) ?
1632
+            $dhSaiEnt = !empty($this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue) ?
1639 1633
                     $this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue : '';
1640 1634
             $tsDhSaiEnt = $this->pConvertTime($dhSaiEnt);
1641 1635
             if ($tsDhSaiEnt != '') {
@@ -1714,7 +1708,7 @@  discard block
 block discarded – undo
1714 1708
     protected function pFaturaDANFE($x, $y)
1715 1709
     {
1716 1710
         $linha = 1;
1717
-        $h = 8+3;
1711
+        $h = 8 + 3;
1718 1712
         $oldx = $x;
1719 1713
         $textoFatura = $this->pGetTextoFatura();
1720 1714
         //verificar se existem duplicatas
@@ -1735,27 +1729,27 @@  discard block
 block discarded – undo
1735 1729
             $dupcont = 0;
1736 1730
             $nFat = $this->dup->length;
1737 1731
             if ($textoFatura !== "" && $this->exibirTextoFatura) {
1738
-                $myH=6;
1732
+                $myH = 6;
1739 1733
                 $myW = $this->wPrint;
1740 1734
                 if ($this->orientacao == 'L') {
1741 1735
                     $myW -= $this->wCanhoto;
1742 1736
                 }
1743 1737
                 $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'');
1744 1738
                 $this->pTextBox($x, $y, $myW, $myH, $textoFatura, $aFont, 'C', 'L', 1, '');
1745
-                $y+=$myH+1;
1739
+                $y += $myH + 1;
1746 1740
             }
1747 1741
             if ($this->orientacao == 'P') {
1748
-                $w = round($this->wPrint/7.018, 0)-1;
1742
+                $w = round($this->wPrint / 7.018, 0) - 1;
1749 1743
             } else {
1750 1744
                 $w = 28;
1751 1745
             }
1752 1746
             $increm = 1;
1753 1747
             foreach ($this->dup as $k => $d) {
1754
-                $nDup = ! empty($this->dup->item($k)->getElementsByTagName('nDup')->item(0)->nodeValue) ?
1748
+                $nDup = !empty($this->dup->item($k)->getElementsByTagName('nDup')->item(0)->nodeValue) ?
1755 1749
                         $this->dup->item($k)->getElementsByTagName('nDup')->item(0)->nodeValue : '';
1756
-                $dDup = ! empty($this->dup->item($k)->getElementsByTagName('dVenc')->item(0)->nodeValue) ?
1750
+                $dDup = !empty($this->dup->item($k)->getElementsByTagName('dVenc')->item(0)->nodeValue) ?
1757 1751
                         $this->pYmd2dmy($this->dup->item($k)->getElementsByTagName('dVenc')->item(0)->nodeValue) : '';
1758
-                $vDup = ! empty($this->dup->item($k)->getElementsByTagName('vDup')->item(0)->nodeValue) ?
1752
+                $vDup = !empty($this->dup->item($k)->getElementsByTagName('vDup')->item(0)->nodeValue) ?
1759 1753
                         'R$ ' . number_format(
1760 1754
                             $this->dup->item($k)->getElementsByTagName('vDup')->item(0)->nodeValue,
1761 1755
                             2,
@@ -1764,14 +1758,14 @@  discard block
 block discarded – undo
1764 1758
                         ) : '';
1765 1759
                 $h = 8;
1766 1760
                 $texto = '';
1767
-                if ($nDup!='0' && $nDup!='') {
1761
+                if ($nDup != '0' && $nDup != '') {
1768 1762
                     $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1769 1763
                     $this->pTextBox($x, $y, $w, $h, 'Num.', $aFont, 'T', 'L', 1, '');
1770 1764
                     $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
1771 1765
                     $this->pTextBox($x, $y, $w, $h, $nDup, $aFont, 'T', 'R', 0, '');
1772 1766
                 } else {
1773 1767
                     $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1774
-                    $this->pTextBox($x, $y, $w, $h, ($dupcont+1)."", $aFont, 'T', 'L', 1, '');
1768
+                    $this->pTextBox($x, $y, $w, $h, ($dupcont + 1) . "", $aFont, 'T', 'L', 1, '');
1775 1769
                 }
1776 1770
                 $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1777 1771
                 $this->pTextBox($x, $y, $w, $h, 'Venc.', $aFont, 'C', 'L', 0, '');
@@ -1781,7 +1775,7 @@  discard block
 block discarded – undo
1781 1775
                 $this->pTextBox($x, $y, $w, $h, 'Valor', $aFont, 'B', 'L', 0, '');
1782 1776
                 $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
1783 1777
                 $this->pTextBox($x, $y, $w, $h, $vDup, $aFont, 'B', 'R', 0, '');
1784
-                $x += $w+$increm;
1778
+                $x += $w + $increm;
1785 1779
                 $dupcont += 1;
1786 1780
                 if ($this->orientacao == 'P') {
1787 1781
                     $maxDupCont = 6;
@@ -1803,10 +1797,10 @@  discard block
 block discarded – undo
1803 1797
                 $y -= 9;
1804 1798
                 $linha--;
1805 1799
             }
1806
-            return ($y+$h);
1800
+            return ($y + $h);
1807 1801
         } else {
1808 1802
             $linha = 0;
1809
-            return ($y-2);
1803
+            return ($y - 2);
1810 1804
         }
1811 1805
     } //fim da função faturaDANFE
1812 1806
 
@@ -1822,7 +1816,7 @@  discard block
 block discarded – undo
1822 1816
     protected function pagamentoDANFE($x, $y)
1823 1817
     {
1824 1818
         $linha = 1;
1825
-        $h = 8+3;
1819
+        $h = 8 + 3;
1826 1820
         $oldx = $x;
1827 1821
         //verificar se existem cobranças definidas
1828 1822
         if (isset($this->detPag) && $this->detPag->length > 0) {
@@ -1841,7 +1835,7 @@  discard block
 block discarded – undo
1841 1835
             $dups = "";
1842 1836
             $dupcont = 0;
1843 1837
             if ($this->orientacao == 'P') {
1844
-                $w = round($this->wPrint/7.018, 0)-1;
1838
+                $w = round($this->wPrint / 7.018, 0) - 1;
1845 1839
             } else {
1846 1840
                 $w = 28;
1847 1841
             }
@@ -1851,16 +1845,16 @@  discard block
 block discarded – undo
1851 1845
                 $maxDupCont = 8;
1852 1846
             }
1853 1847
             $increm = 1;
1854
-            $formaPagamento = array('01'=>'Dinheiro','02'=>'Cheque','03'=>'Cartão de Crédito',
1855
-                                    '04'=>'Cartão de Débito','05'=>'Crédito Loja','10'=>'Vale Alimentação',
1856
-                                    '11'=>'Vale Refeição','12'=>'Vale Presente','13'=>'Vale Combustível',
1857
-                                    '14'=>'Duplicata Mercantil','15'=>'Boleto','90'=>'Sem pagamento','99'=>'Outros');
1858
-            $bandeira = array('01'=>'Visa','02'=>'Mastercard','03'=>'American','04'=>'Sorocred','05'=>'Diners',
1859
-                              '06'=>'Elo','07'=>'Hipercard','08'=>'Aura','09'=>'Cabal','99'=>'Outros');
1848
+            $formaPagamento = array('01'=>'Dinheiro', '02'=>'Cheque', '03'=>'Cartão de Crédito',
1849
+                                    '04'=>'Cartão de Débito', '05'=>'Crédito Loja', '10'=>'Vale Alimentação',
1850
+                                    '11'=>'Vale Refeição', '12'=>'Vale Presente', '13'=>'Vale Combustível',
1851
+                                    '14'=>'Duplicata Mercantil', '15'=>'Boleto', '90'=>'Sem pagamento', '99'=>'Outros');
1852
+            $bandeira = array('01'=>'Visa', '02'=>'Mastercard', '03'=>'American', '04'=>'Sorocred', '05'=>'Diners',
1853
+                              '06'=>'Elo', '07'=>'Hipercard', '08'=>'Aura', '09'=>'Cabal', '99'=>'Outros');
1860 1854
             foreach ($this->detPag as $k => $d) {
1861 1855
                 $fPag = !empty($this->detPag->item($k)->getElementsByTagName('tPag')->item(0)->nodeValue)
1862 1856
                     ? $this->detPag->item($k)->getElementsByTagName('tPag')->item(0)->nodeValue : '0';
1863
-                $vPag = ! empty($this->detPag->item($k)->getElementsByTagName('vPag')->item(0)->nodeValue)
1857
+                $vPag = !empty($this->detPag->item($k)->getElementsByTagName('vPag')->item(0)->nodeValue)
1864 1858
                     ? 'R$ ' . number_format(
1865 1859
                         $this->detPag->item($k)->getElementsByTagName('vPag')->item(0)->nodeValue,
1866 1860
                         2,
@@ -1871,7 +1865,7 @@  discard block
 block discarded – undo
1871 1865
                 $texto = '';
1872 1866
                 if (isset($formaPagamento[$fPag])) {
1873 1867
                     /*Exibir Item sem pagamento ou outros?*/
1874
-                    if ($fPag=='90' || $fPag=='99') {
1868
+                    if ($fPag == '90' || $fPag == '99') {
1875 1869
                         continue;
1876 1870
                     }
1877 1871
                     $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
@@ -1880,16 +1874,16 @@  discard block
 block discarded – undo
1880 1874
                     $this->pTextBox($x, $y, $w, $h, $formaPagamento[$fPag], $aFont, 'T', 'R', 0, '');
1881 1875
                 } else {
1882 1876
                     $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'');
1883
-                    $this->pTextBox($x, $y, $w, $h, "Forma ".$fPag." não encontrado", $aFont, 'T', 'L', 1, '');
1877
+                    $this->pTextBox($x, $y, $w, $h, "Forma " . $fPag . " não encontrado", $aFont, 'T', 'L', 1, '');
1884 1878
                 }
1885 1879
                 $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1886 1880
                 $this->pTextBox($x, $y, $w, $h, 'Valor', $aFont, 'B', 'L', 0, '');
1887 1881
                 $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
1888 1882
                 $this->pTextBox($x, $y, $w, $h, $vPag, $aFont, 'B', 'R', 0, '');
1889
-                $x += $w+$increm;
1883
+                $x += $w + $increm;
1890 1884
                 $dupcont += 1;
1891 1885
 
1892
-                if ($dupcont>$maxDupCont) {
1886
+                if ($dupcont > $maxDupCont) {
1893 1887
                     $y += 9;
1894 1888
                     $x = $oldx;
1895 1889
                     $dupcont = 0;
@@ -1904,10 +1898,10 @@  discard block
 block discarded – undo
1904 1898
                 $y -= 9;
1905 1899
                 $linha--;
1906 1900
             }
1907
-            return ($y+$h);
1901
+            return ($y + $h);
1908 1902
         } else {
1909 1903
             $linha = 0;
1910
-            return ($y-2);
1904
+            return ($y - 2);
1911 1905
         }
1912 1906
     } //fim da função pagamentoDANFE
1913 1907
     
@@ -2019,7 +2013,7 @@  discard block
 block discarded – undo
2019 2013
         }
2020 2014
         $x = $this->pImpostoDanfeHelper($x, $y, $w, $h, "V. TOTAL DA NOTA", "vNF");
2021 2015
 
2022
-        return ($y+$h);
2016
+        return ($y + $h);
2023 2017
     } //fim impostoDANFE
2024 2018
 
2025 2019
     /**
@@ -2047,13 +2041,13 @@  discard block
 block discarded – undo
2047 2041
         $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
2048 2042
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
2049 2043
         //NOME / RAZÃO SOCIAL
2050
-        $w1 = $maxW*0.29;
2044
+        $w1 = $maxW * 0.29;
2051 2045
         $y += 3;
2052 2046
         $texto = 'NOME / RAZÃO SOCIAL';
2053 2047
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2054 2048
         $this->pTextBox($x, $y, $w1, $h, $texto, $aFont, 'T', 'L', 1, '');
2055 2049
         if (isset($this->transporta)) {
2056
-            $texto = ! empty($this->transporta->getElementsByTagName("xNome")->item(0)->nodeValue) ?
2050
+            $texto = !empty($this->transporta->getElementsByTagName("xNome")->item(0)->nodeValue) ?
2057 2051
                     $this->transporta->getElementsByTagName("xNome")->item(0)->nodeValue : '';
2058 2052
         } else {
2059 2053
             $texto = '';
@@ -2062,11 +2056,11 @@  discard block
 block discarded – undo
2062 2056
         $this->pTextBox($x, $y, $w1, $h, $texto, $aFont, 'B', 'L', 0, '');
2063 2057
         //FRETE POR CONTA
2064 2058
         $x += $w1;
2065
-        $w2 = $maxW*0.15;
2059
+        $w2 = $maxW * 0.15;
2066 2060
         $texto = 'FRETE';
2067 2061
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2068 2062
         $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
2069
-        $tipoFrete = ! empty($this->transp->getElementsByTagName("modFrete")->item(0)->nodeValue) ?
2063
+        $tipoFrete = !empty($this->transp->getElementsByTagName("modFrete")->item(0)->nodeValue) ?
2070 2064
                 $this->transp->getElementsByTagName("modFrete")->item(0)->nodeValue : '0';
2071 2065
         switch ($tipoFrete) {
2072 2066
             case 0:
@@ -2096,7 +2090,7 @@  discard block
 block discarded – undo
2096 2090
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2097 2091
         $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
2098 2092
         if (isset($this->veicTransp)) {
2099
-            $texto = ! empty($this->veicTransp->getElementsByTagName("RNTC")->item(0)->nodeValue) ?
2093
+            $texto = !empty($this->veicTransp->getElementsByTagName("RNTC")->item(0)->nodeValue) ?
2100 2094
                     $this->veicTransp->getElementsByTagName("RNTC")->item(0)->nodeValue : '';
2101 2095
         } else {
2102 2096
             $texto = '';
@@ -2109,10 +2103,10 @@  discard block
 block discarded – undo
2109 2103
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2110 2104
         $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
2111 2105
         if (isset($this->veicTransp)) {
2112
-            $texto = ! empty($this->veicTransp->getElementsByTagName("placa")->item(0)->nodeValue) ?
2106
+            $texto = !empty($this->veicTransp->getElementsByTagName("placa")->item(0)->nodeValue) ?
2113 2107
                     $this->veicTransp->getElementsByTagName("placa")->item(0)->nodeValue : '';
2114 2108
         } elseif (isset($this->reboque)) {
2115
-            $texto = ! empty($this->reboque->getElementsByTagName("placa")->item(0)->nodeValue) ?
2109
+            $texto = !empty($this->reboque->getElementsByTagName("placa")->item(0)->nodeValue) ?
2116 2110
                     $this->reboque->getElementsByTagName("placa")->item(0)->nodeValue : '';
2117 2111
         } else {
2118 2112
             $texto = '';
@@ -2121,15 +2115,15 @@  discard block
 block discarded – undo
2121 2115
         $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'B', 'C', 0, '');
2122 2116
         //UF
2123 2117
         $x += $w2;
2124
-        $w3 = round($maxW*0.04, 0);
2118
+        $w3 = round($maxW * 0.04, 0);
2125 2119
         $texto = 'UF';
2126 2120
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2127 2121
         $this->pTextBox($x, $y, $w3, $h, $texto, $aFont, 'T', 'L', 1, '');
2128 2122
         if (isset($this->veicTransp)) {
2129
-            $texto = ! empty($this->veicTransp->getElementsByTagName("UF")->item(0)->nodeValue) ?
2123
+            $texto = !empty($this->veicTransp->getElementsByTagName("UF")->item(0)->nodeValue) ?
2130 2124
                     $this->veicTransp->getElementsByTagName("UF")->item(0)->nodeValue : '';
2131 2125
         } elseif (isset($this->reboque)) {
2132
-            $texto = ! empty($this->reboque->getElementsByTagName("UF")->item(0)->nodeValue) ?
2126
+            $texto = !empty($this->reboque->getElementsByTagName("UF")->item(0)->nodeValue) ?
2133 2127
                     $this->reboque->getElementsByTagName("UF")->item(0)->nodeValue : '';
2134 2128
         } else {
2135 2129
             $texto = '';
@@ -2138,18 +2132,18 @@  discard block
 block discarded – undo
2138 2132
         $this->pTextBox($x, $y, $w3, $h, $texto, $aFont, 'B', 'C', 0, '');
2139 2133
         //CNPJ / CPF
2140 2134
         $x += $w3;
2141
-        $w = $maxW-($w1+3*$w2+$w3);
2135
+        $w = $maxW - ($w1 + 3 * $w2 + $w3);
2142 2136
         $texto = 'CNPJ / CPF';
2143 2137
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2144 2138
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
2145 2139
         if (isset($this->transporta)) {
2146
-            $texto = ! empty($this->transporta->getElementsByTagName("CNPJ")->item(0)->nodeValue) ?
2140
+            $texto = !empty($this->transporta->getElementsByTagName("CNPJ")->item(0)->nodeValue) ?
2147 2141
                     $this->pFormat(
2148 2142
                         $this->transporta->getElementsByTagName("CNPJ")->item(0)->nodeValue,
2149 2143
                         "##.###.###/####-##"
2150 2144
                     ) : '';
2151 2145
             if ($texto == '') {
2152
-                $texto = ! empty($this->transporta->getElementsByTagName("CPF")->item(0)->nodeValue) ?
2146
+                $texto = !empty($this->transporta->getElementsByTagName("CPF")->item(0)->nodeValue) ?
2153 2147
                         $this->pFormat(
2154 2148
                             $this->transporta->getElementsByTagName("CPF")->item(0)->nodeValue,
2155 2149
                             "###.###.###-##"
@@ -2165,12 +2159,12 @@  discard block
 block discarded – undo
2165 2159
         $y += $h;
2166 2160
         $x = $oldX;
2167 2161
         $h = 7;
2168
-        $w1 = $maxW*0.44;
2162
+        $w1 = $maxW * 0.44;
2169 2163
         $texto = 'ENDEREÇO';
2170 2164
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2171 2165
         $this->pTextBox($x, $y, $w1, $h, $texto, $aFont, 'T', 'L', 1, '');
2172 2166
         if (isset($this->transporta)) {
2173
-            $texto = ! empty($this->transporta->getElementsByTagName("xEnder")->item(0)->nodeValue) ?
2167
+            $texto = !empty($this->transporta->getElementsByTagName("xEnder")->item(0)->nodeValue) ?
2174 2168
                     $this->transporta->getElementsByTagName("xEnder")->item(0)->nodeValue : '';
2175 2169
         } else {
2176 2170
             $texto = '';
@@ -2179,12 +2173,12 @@  discard block
 block discarded – undo
2179 2173
         $this->pTextBox($x, $y, $w1, $h, $texto, $aFont, 'B', 'L', 0, '');
2180 2174
         //MUNICÍPIO
2181 2175
         $x += $w1;
2182
-        $w2 = round($maxW*0.30, 0);
2176
+        $w2 = round($maxW * 0.30, 0);
2183 2177
         $texto = 'MUNICÍPIO';
2184 2178
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2185 2179
         $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
2186 2180
         if (isset($this->transporta)) {
2187
-            $texto = ! empty($this->transporta->getElementsByTagName("xMun")->item(0)->nodeValue) ?
2181
+            $texto = !empty($this->transporta->getElementsByTagName("xMun")->item(0)->nodeValue) ?
2188 2182
                     $this->transporta->getElementsByTagName("xMun")->item(0)->nodeValue : '';
2189 2183
         } else {
2190 2184
             $texto = '';
@@ -2193,12 +2187,12 @@  discard block
 block discarded – undo
2193 2187
         $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'B', 'C', 0, '');
2194 2188
         //UF
2195 2189
         $x += $w2;
2196
-        $w3 = round($maxW*0.04, 0);
2190
+        $w3 = round($maxW * 0.04, 0);
2197 2191
         $texto = 'UF';
2198 2192
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2199 2193
         $this->pTextBox($x, $y, $w3, $h, $texto, $aFont, 'T', 'L', 1, '');
2200 2194
         if (isset($this->transporta)) {
2201
-            $texto = ! empty($this->transporta->getElementsByTagName("UF")->item(0)->nodeValue) ?
2195
+            $texto = !empty($this->transporta->getElementsByTagName("UF")->item(0)->nodeValue) ?
2202 2196
                     $this->transporta->getElementsByTagName("UF")->item(0)->nodeValue : '';
2203 2197
         } else {
2204 2198
             $texto = '';
@@ -2207,13 +2201,13 @@  discard block
 block discarded – undo
2207 2201
         $this->pTextBox($x, $y, $w3, $h, $texto, $aFont, 'B', 'C', 0, '');
2208 2202
         //INSCRIÇÃO ESTADUAL
2209 2203
         $x += $w3;
2210
-        $w = $maxW-($w1+$w2+$w3);
2204
+        $w = $maxW - ($w1 + $w2 + $w3);
2211 2205
         $texto = 'INSCRIÇÃO ESTADUAL';
2212 2206
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2213 2207
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
2214 2208
         $texto = '';
2215 2209
         if (isset($this->transporta)) {
2216
-            if (! empty($this->transporta->getElementsByTagName("IE")->item(0)->nodeValue)) {
2210
+            if (!empty($this->transporta->getElementsByTagName("IE")->item(0)->nodeValue)) {
2217 2211
                 $texto = $this->transporta->getElementsByTagName("IE")->item(0)->nodeValue;
2218 2212
             }
2219 2213
         }
@@ -2226,16 +2220,16 @@  discard block
 block discarded – undo
2226 2220
         $marca = '';
2227 2221
         $numero = '';
2228 2222
         $texto = '';
2229
-        $pesoBruto=0;
2230
-        $pesoLiquido=0;
2223
+        $pesoBruto = 0;
2224
+        $pesoLiquido = 0;
2231 2225
         foreach ($volumes as $volume) {
2232
-            $quantidade += ! empty($volume->getElementsByTagName("qVol")->item(0)->nodeValue) ?
2226
+            $quantidade += !empty($volume->getElementsByTagName("qVol")->item(0)->nodeValue) ?
2233 2227
                     $volume->getElementsByTagName("qVol")->item(0)->nodeValue : 0;
2234
-            $pesoBruto += ! empty($volume->getElementsByTagName("pesoB")->item(0)->nodeValue) ?
2228
+            $pesoBruto += !empty($volume->getElementsByTagName("pesoB")->item(0)->nodeValue) ?
2235 2229
                     $volume->getElementsByTagName("pesoB")->item(0)->nodeValue : 0;
2236
-            $pesoLiquido += ! empty($volume->getElementsByTagName("pesoL")->item(0)->nodeValue) ?
2230
+            $pesoLiquido += !empty($volume->getElementsByTagName("pesoL")->item(0)->nodeValue) ?
2237 2231
                     $volume->getElementsByTagName("pesoL")->item(0)->nodeValue : 0;
2238
-            $texto = ! empty($this->transp->getElementsByTagName("esp")->item(0)->nodeValue) ?
2232
+            $texto = !empty($this->transp->getElementsByTagName("esp")->item(0)->nodeValue) ?
2239 2233
                     $this->transp->getElementsByTagName("esp")->item(0)->nodeValue : '';
2240 2234
             if ($texto != $especie && $especie != '') {
2241 2235
                 //tem várias especies
@@ -2243,7 +2237,7 @@  discard block
 block discarded – undo
2243 2237
             } else {
2244 2238
                 $especie = $texto;
2245 2239
             }
2246
-            $texto = ! empty($this->transp->getElementsByTagName("marca")->item(0)->nodeValue) ?
2240
+            $texto = !empty($this->transp->getElementsByTagName("marca")->item(0)->nodeValue) ?
2247 2241
                     $this->transp->getElementsByTagName("marca")->item(0)->nodeValue : '';
2248 2242
             if ($texto != $marca && $marca != '') {
2249 2243
                 //tem várias especies
@@ -2251,7 +2245,7 @@  discard block
 block discarded – undo
2251 2245
             } else {
2252 2246
                 $marca = $texto;
2253 2247
             }
2254
-            $texto = ! empty($this->transp->getElementsByTagName("nVol")->item(0)->nodeValue) ?
2248
+            $texto = !empty($this->transp->getElementsByTagName("nVol")->item(0)->nodeValue) ?
2255 2249
                     $this->transp->getElementsByTagName("nVol")->item(0)->nodeValue : '';
2256 2250
             if ($texto != $numero && $numero != '') {
2257 2251
                 //tem várias especies
@@ -2266,7 +2260,7 @@  discard block
 block discarded – undo
2266 2260
         $y += $h;
2267 2261
         $x = $oldX;
2268 2262
         $h = 7;
2269
-        $w1 = round($maxW*0.10, 0);
2263
+        $w1 = round($maxW * 0.10, 0);
2270 2264
         $texto = 'QUANTIDADE';
2271 2265
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2272 2266
         $this->pTextBox($x, $y, $w1, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -2277,7 +2271,7 @@  discard block
 block discarded – undo
2277 2271
         }
2278 2272
         //ESPÉCIE
2279 2273
         $x += $w1;
2280
-        $w2 = round($maxW*0.17, 0);
2274
+        $w2 = round($maxW * 0.17, 0);
2281 2275
         $texto = 'ESPÉCIE';
2282 2276
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2283 2277
         $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -2289,7 +2283,7 @@  discard block
 block discarded – undo
2289 2283
         $texto = 'MARCA';
2290 2284
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2291 2285
         $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
2292
-        $texto = ! empty($this->transp->getElementsByTagName("marca")->item(0)->nodeValue) ?
2286
+        $texto = !empty($this->transp->getElementsByTagName("marca")->item(0)->nodeValue) ?
2293 2287
                 $this->transp->getElementsByTagName("marca")->item(0)->nodeValue : '';
2294 2288
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
2295 2289
         $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'B', 'C', 0, '');
@@ -2303,7 +2297,7 @@  discard block
 block discarded – undo
2303 2297
         $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'B', 'C', 0, '');
2304 2298
         //PESO BRUTO
2305 2299
         $x += $w2;
2306
-        $w3 = round($maxW*0.20, 0);
2300
+        $w3 = round($maxW * 0.20, 0);
2307 2301
         $texto = 'PESO BRUTO';
2308 2302
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2309 2303
         $this->pTextBox($x, $y, $w3, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -2316,7 +2310,7 @@  discard block
 block discarded – undo
2316 2310
         $this->pTextBox($x, $y, $w3, $h, $texto, $aFont, 'B', 'R', 0, '');
2317 2311
         //PESO LÍQUIDO
2318 2312
         $x += $w3;
2319
-        $w = $maxW -($w1+3*$w2+$w3);
2313
+        $w = $maxW - ($w1 + 3 * $w2 + $w3);
2320 2314
         $texto = 'PESO LÍQUIDO';
2321 2315
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2322 2316
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -2327,7 +2321,7 @@  discard block
 block discarded – undo
2327 2321
         }
2328 2322
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
2329 2323
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'R', 0, '');
2330
-        return ($y+$h);
2324
+        return ($y + $h);
2331 2325
     } //fim transporteDANFE
2332 2326
 
2333 2327
 
@@ -2339,7 +2333,7 @@  discard block
 block discarded – undo
2339 2333
             return "";
2340 2334
         }
2341 2335
         $valor_original = $valor_original->nodeValue;
2342
-        $valor = ! empty($valor_original) ? number_format($valor_original, 2, ",", ".") : '';
2336
+        $valor = !empty($valor_original) ? number_format($valor_original, 2, ",", ".") : '';
2343 2337
 
2344 2338
         if ($valor != "") {
2345 2339
             return sprintf($formato, $valor);
@@ -2383,13 +2377,13 @@  discard block
 block discarded – undo
2383 2377
             $impostos .= $this->pDescricaoProdutoHelper($ICMSUFDest, "vICMSUFDest", " vICMSUFDest=%s");
2384 2378
             $impostos .= $this->pDescricaoProdutoHelper($ICMSUFDest, "vICMSUFRemet", " vICMSUFRemet=%s");
2385 2379
         }
2386
-        $infAdProd = ! empty($itemProd->getElementsByTagName('infAdProd')->item(0)->nodeValue) ?
2380
+        $infAdProd = !empty($itemProd->getElementsByTagName('infAdProd')->item(0)->nodeValue) ?
2387 2381
                 substr($this->pAnfavea($itemProd->getElementsByTagName('infAdProd')->item(0)->nodeValue), 0, 500) : '';
2388
-        if (! empty($infAdProd)) {
2382
+        if (!empty($infAdProd)) {
2389 2383
             $infAdProd = trim($infAdProd);
2390 2384
             $infAdProd .= ' ';
2391 2385
         }
2392
-        $loteTxt ='';
2386
+        $loteTxt = '';
2393 2387
         $rastro = $prod->getElementsByTagName("med");
2394 2388
         if (!isset($rastro)) {
2395 2389
             $rastro = $prod->getElementsByTagName("rastro");
@@ -2405,14 +2399,14 @@  discard block
 block discarded – undo
2405 2399
                 $i++;
2406 2400
             }
2407 2401
             if ($loteTxt != '') {
2408
-                $loteTxt.= ' ';
2402
+                $loteTxt .= ' ';
2409 2403
             }
2410 2404
         }
2411 2405
         //NT2013.006 FCI
2412
-        $nFCI = (! empty($itemProd->getElementsByTagName('nFCI')->item(0)->nodeValue)) ?
2413
-                ' FCI:'.$itemProd->getElementsByTagName('nFCI')->item(0)->nodeValue : '';
2414
-        $tmp_ad=$infAdProd . ($this->descProdInfoComplemento ? $loteTxt . $impostos . $nFCI : '');
2415
-        $texto = $prod->getElementsByTagName("xProd")->item(0)->nodeValue . (strlen($tmp_ad)!=0?"\n    ".$tmp_ad:'');
2406
+        $nFCI = (!empty($itemProd->getElementsByTagName('nFCI')->item(0)->nodeValue)) ?
2407
+                ' FCI:' . $itemProd->getElementsByTagName('nFCI')->item(0)->nodeValue : '';
2408
+        $tmp_ad = $infAdProd . ($this->descProdInfoComplemento ? $loteTxt . $impostos . $nFCI : '');
2409
+        $texto = $prod->getElementsByTagName("xProd")->item(0)->nodeValue . (strlen($tmp_ad) != 0 ? "\n    " . $tmp_ad : '');
2416 2410
         if ($this->descProdQuebraLinha) {
2417 2411
             $texto = str_replace(";", "\n", $texto);
2418 2412
         }
@@ -2460,104 +2454,104 @@  discard block
 block discarded – undo
2460 2454
         // cabecalho LOOP COM OS DADOS DOS PRODUTOS
2461 2455
         //CÓDIGO PRODUTO
2462 2456
         $texto = "CÓDIGO PRODUTO";
2463
-        $w1 = round($w*0.09, 0);
2457
+        $w1 = round($w * 0.09, 0);
2464 2458
         $h = 4;
2465 2459
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2466 2460
         $this->pTextBox($x, $y, $w1, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2467
-        $this->pdf->Line($x+$w1, $y, $x+$w1, $y+$hmax);
2461
+        $this->pdf->Line($x + $w1, $y, $x + $w1, $y + $hmax);
2468 2462
         //DESCRIÇÃO DO PRODUTO / SERVIÇO
2469 2463
         $x += $w1;
2470
-        $w2 = round($w*0.28, 0);
2464
+        $w2 = round($w * 0.28, 0);
2471 2465
         $texto = 'DESCRIÇÃO DO PRODUTO / SERVIÇO';
2472 2466
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2473 2467
         $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2474
-        $this->pdf->Line($x+$w2, $y, $x+$w2, $y+$hmax);
2468
+        $this->pdf->Line($x + $w2, $y, $x + $w2, $y + $hmax);
2475 2469
         //NCM/SH
2476 2470
         $x += $w2;
2477
-        $w3 = round($w*0.06, 0);
2471
+        $w3 = round($w * 0.06, 0);
2478 2472
         $texto = 'NCM/SH';
2479 2473
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2480 2474
         $this->pTextBox($x, $y, $w3, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2481
-        $this->pdf->Line($x+$w3, $y, $x+$w3, $y+$hmax);
2475
+        $this->pdf->Line($x + $w3, $y, $x + $w3, $y + $hmax);
2482 2476
         //O/CST ou O/CSOSN
2483 2477
         $x += $w3;
2484
-        $w4 = round($w*0.05, 0);
2485
-        $texto = 'O/CSOSN';//Regime do Simples CRT = 1 ou CRT = 2
2478
+        $w4 = round($w * 0.05, 0);
2479
+        $texto = 'O/CSOSN'; //Regime do Simples CRT = 1 ou CRT = 2
2486 2480
         if ($this->pSimpleGetValue($this->emit, 'CRT') == '3') {
2487
-             $texto = 'O/CST';//Regime Normal
2481
+             $texto = 'O/CST'; //Regime Normal
2488 2482
         }
2489 2483
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2490 2484
         $this->pTextBox($x, $y, $w4, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2491
-        $this->pdf->Line($x+$w4, $y, $x+$w4, $y+$hmax);
2485
+        $this->pdf->Line($x + $w4, $y, $x + $w4, $y + $hmax);
2492 2486
         //CFOP
2493 2487
         $x += $w4;
2494
-        $w5 = round($w*0.04, 0);
2488
+        $w5 = round($w * 0.04, 0);
2495 2489
         $texto = 'CFOP';
2496 2490
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2497 2491
         $this->pTextBox($x, $y, $w5, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2498
-        $this->pdf->Line($x+$w5, $y, $x+$w5, $y+$hmax);
2492
+        $this->pdf->Line($x + $w5, $y, $x + $w5, $y + $hmax);
2499 2493
         //UN
2500 2494
         $x += $w5;
2501
-        $w6 = round($w*0.03, 0);
2495
+        $w6 = round($w * 0.03, 0);
2502 2496
         $texto = 'UN';
2503 2497
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2504 2498
         $this->pTextBox($x, $y, $w6, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2505
-        $this->pdf->Line($x+$w6, $y, $x+$w6, $y+$hmax);
2499
+        $this->pdf->Line($x + $w6, $y, $x + $w6, $y + $hmax);
2506 2500
         //QUANT
2507 2501
         $x += $w6;
2508
-        $w7 = round($w*0.07, 0);
2502
+        $w7 = round($w * 0.07, 0);
2509 2503
         $texto = 'QUANT';
2510 2504
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2511 2505
         $this->pTextBox($x, $y, $w7, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2512
-        $this->pdf->Line($x+$w7, $y, $x+$w7, $y+$hmax);
2506
+        $this->pdf->Line($x + $w7, $y, $x + $w7, $y + $hmax);
2513 2507
         //VALOR UNIT
2514 2508
         $x += $w7;
2515
-        $w8 = round($w*0.06, 0);
2509
+        $w8 = round($w * 0.06, 0);
2516 2510
         $texto = 'VALOR UNIT';
2517 2511
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2518 2512
         $this->pTextBox($x, $y, $w8, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2519
-        $this->pdf->Line($x+$w8, $y, $x+$w8, $y+$hmax);
2513
+        $this->pdf->Line($x + $w8, $y, $x + $w8, $y + $hmax);
2520 2514
         //VALOR TOTAL
2521 2515
         $x += $w8;
2522
-        $w9 = round($w*0.06, 0);
2516
+        $w9 = round($w * 0.06, 0);
2523 2517
         $texto = 'VALOR TOTAL';
2524 2518
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2525 2519
         $this->pTextBox($x, $y, $w9, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2526
-        $this->pdf->Line($x+$w9, $y, $x+$w9, $y+$hmax);
2520
+        $this->pdf->Line($x + $w9, $y, $x + $w9, $y + $hmax);
2527 2521
         //B.CÁLC ICMS
2528 2522
         $x += $w9;
2529
-        $w10 = round($w*0.06, 0);
2523
+        $w10 = round($w * 0.06, 0);
2530 2524
         $texto = 'B.CÁLC ICMS';
2531 2525
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2532 2526
         $this->pTextBox($x, $y, $w10, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2533
-        $this->pdf->Line($x+$w10, $y, $x+$w10, $y+$hmax);
2527
+        $this->pdf->Line($x + $w10, $y, $x + $w10, $y + $hmax);
2534 2528
         //VALOR ICMS
2535 2529
         $x += $w10;
2536
-        $w11 = round($w*0.06, 0);
2530
+        $w11 = round($w * 0.06, 0);
2537 2531
         $texto = 'VALOR ICMS';
2538 2532
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2539 2533
         $this->pTextBox($x, $y, $w11, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2540
-        $this->pdf->Line($x+$w11, $y, $x+$w11, $y+$hmax);
2534
+        $this->pdf->Line($x + $w11, $y, $x + $w11, $y + $hmax);
2541 2535
         //VALOR IPI
2542 2536
         $x += $w11;
2543
-        $w12 = round($w*0.05, 0);
2537
+        $w12 = round($w * 0.05, 0);
2544 2538
         $texto = 'VALOR IPI';
2545 2539
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2546 2540
         $this->pTextBox($x, $y, $w12, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2547
-        $this->pdf->Line($x+$w12, $y, $x+$w12, $y+$hmax);
2541
+        $this->pdf->Line($x + $w12, $y, $x + $w12, $y + $hmax);
2548 2542
         //ALÍQ. ICMS
2549 2543
         $x += $w12;
2550
-        $w13 = round($w*0.035, 0);
2544
+        $w13 = round($w * 0.035, 0);
2551 2545
         $texto = 'ALÍQ. ICMS';
2552 2546
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2553 2547
         $this->pTextBox($x, $y, $w13, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2554
-        $this->pdf->Line($x+$w13, $y, $x+$w13, $y+$hmax);
2548
+        $this->pdf->Line($x + $w13, $y, $x + $w13, $y + $hmax);
2555 2549
         //ALÍQ. IPI
2556 2550
         $x += $w13;
2557
-        $w14 = $w-($w1+$w2+$w3+$w4+$w5+$w6+$w7+$w8+$w9+$w10+$w11+$w12+$w13);
2551
+        $w14 = $w - ($w1 + $w2 + $w3 + $w4 + $w5 + $w6 + $w7 + $w8 + $w9 + $w10 + $w11 + $w12 + $w13);
2558 2552
         $texto = 'ALÍQ. IPI';
2559 2553
         $this->pTextBox($x, $y, $w14, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2560
-        $this->pdf->Line($oldX, $y+$h+1, $oldX + $w, $y+$h+1);
2554
+        $this->pdf->Line($oldX, $y + $h + 1, $oldX + $w, $y + $h + 1);
2561 2555
         $y += 5;
2562 2556
         //##################################################################################
2563 2557
         // LOOP COM OS DADOS DOS PRODUTOS
@@ -2575,7 +2569,7 @@  discard block
 block discarded – undo
2575 2569
                 $textoProduto = trim($this->pDescricaoProduto($thisItem));
2576 2570
 
2577 2571
                 $linhaDescr = $this->pGetNumLines($textoProduto, $w2, $aFont);
2578
-                $h = round(($linhaDescr * $this->pdf->fontSize)+ ($linhaDescr * 0.5), 2);
2572
+                $h = round(($linhaDescr * $this->pdf->fontSize) + ($linhaDescr * 0.5), 2);
2579 2573
                 $hUsado += $h;
2580 2574
 
2581 2575
                 $diffH = $hmax - $hUsado;
@@ -2588,11 +2582,11 @@  discard block
 block discarded – undo
2588 2582
                         break;
2589 2583
                     }
2590 2584
                 }
2591
-                $y_linha=$y+$h;
2585
+                $y_linha = $y + $h;
2592 2586
                 // linha entre itens
2593 2587
                 $this->pdf->DashedHLine($oldX, $y_linha, $w, 0.1, 120);
2594 2588
                 //corrige o x
2595
-                $x=$oldX;
2589
+                $x = $oldX;
2596 2590
                 //codigo do produto
2597 2591
                 $texto = $prod->getElementsByTagName("cProd")->item(0)->nodeValue;
2598 2592
                 $this->pTextBox($x, $y, $w1, $h, $texto, $aFont, 'T', 'C', 0, '');
@@ -2605,16 +2599,16 @@  discard block
 block discarded – undo
2605 2599
                 }
2606 2600
                 $x += $w2;
2607 2601
                 //NCM
2608
-                $texto = ! empty($prod->getElementsByTagName("NCM")->item(0)->nodeValue) ?
2602
+                $texto = !empty($prod->getElementsByTagName("NCM")->item(0)->nodeValue) ?
2609 2603
                         $prod->getElementsByTagName("NCM")->item(0)->nodeValue : '';
2610 2604
                 $this->pTextBox($x, $y, $w3, $h, $texto, $aFont, 'T', 'C', 0, '');
2611 2605
                 $x += $w3;
2612 2606
                 //CST
2613 2607
                 if (isset($ICMS)) {
2614
-                    $origem =  $this->pSimpleGetValue($ICMS, "orig");
2615
-                    $cst =  $this->pSimpleGetValue($ICMS, "CST");
2616
-                    $csosn =  $this->pSimpleGetValue($ICMS, "CSOSN");
2617
-                    $texto = $origem.$cst.$csosn;
2608
+                    $origem = $this->pSimpleGetValue($ICMS, "orig");
2609
+                    $cst = $this->pSimpleGetValue($ICMS, "CST");
2610
+                    $csosn = $this->pSimpleGetValue($ICMS, "CSOSN");
2611
+                    $texto = $origem . $cst . $csosn;
2618 2612
                     $this->pTextBox($x, $y, $w4, $h, $texto, $aFont, 'T', 'C', 0, '');
2619 2613
                 }
2620 2614
                 //CFOP
@@ -2648,7 +2642,7 @@  discard block
 block discarded – undo
2648 2642
                 //Valor da Base de calculo
2649 2643
                 $x += $w9;
2650 2644
                 if (isset($ICMS)) {
2651
-                    $texto = ! empty($ICMS->getElementsByTagName("vBC")->item(0)->nodeValue) ?
2645
+                    $texto = !empty($ICMS->getElementsByTagName("vBC")->item(0)->nodeValue) ?
2652 2646
                             number_format(
2653 2647
                                 $ICMS->getElementsByTagName("vBC")->item(0)->nodeValue,
2654 2648
                                 2,
@@ -2660,7 +2654,7 @@  discard block
 block discarded – undo
2660 2654
                 //Valor do ICMS
2661 2655
                 $x += $w10;
2662 2656
                 if (isset($ICMS)) {
2663
-                    $texto = ! empty($ICMS->getElementsByTagName("vICMS")->item(0)->nodeValue) ?
2657
+                    $texto = !empty($ICMS->getElementsByTagName("vICMS")->item(0)->nodeValue) ?
2664 2658
                             number_format(
2665 2659
                                 $ICMS->getElementsByTagName("vICMS")->item(0)->nodeValue,
2666 2660
                                 2,
@@ -2672,8 +2666,8 @@  discard block
 block discarded – undo
2672 2666
                 //Valor do IPI
2673 2667
                 $x += $w11;
2674 2668
                 if (isset($IPI)) {
2675
-                    $texto = ! empty($IPI->getElementsByTagName("vIPI")->item(0)->nodeValue) ?
2676
-                            number_format($IPI->getElementsByTagName("vIPI")->item(0)->nodeValue, 2, ",", ".") :'';
2669
+                    $texto = !empty($IPI->getElementsByTagName("vIPI")->item(0)->nodeValue) ?
2670
+                            number_format($IPI->getElementsByTagName("vIPI")->item(0)->nodeValue, 2, ",", ".") : '';
2677 2671
                 } else {
2678 2672
                     $texto = '';
2679 2673
                 }
@@ -2681,7 +2675,7 @@  discard block
 block discarded – undo
2681 2675
                 // %ICMS
2682 2676
                 $x += $w12;
2683 2677
                 if (isset($ICMS)) {
2684
-                    $texto = ! empty($ICMS->getElementsByTagName("pICMS")->item(0)->nodeValue) ?
2678
+                    $texto = !empty($ICMS->getElementsByTagName("pICMS")->item(0)->nodeValue) ?
2685 2679
                             number_format(
2686 2680
                                 $ICMS->getElementsByTagName("pICMS")->item(0)->nodeValue,
2687 2681
                                 2,
@@ -2693,7 +2687,7 @@  discard block
 block discarded – undo
2693 2687
                 //%IPI
2694 2688
                 $x += $w13;
2695 2689
                 if (isset($IPI)) {
2696
-                    $texto = ! empty($IPI->getElementsByTagName("pIPI")->item(0)->nodeValue) ?
2690
+                    $texto = !empty($IPI->getElementsByTagName("pIPI")->item(0)->nodeValue) ?
2697 2691
                             number_format($IPI->getElementsByTagName("pIPI")->item(0)->nodeValue, 2, ",", ".") : '';
2698 2692
                 } else {
2699 2693
                     $texto = '';
@@ -2718,7 +2712,7 @@  discard block
 block discarded – undo
2718 2712
                 $i++;
2719 2713
             }
2720 2714
         }
2721
-        return $oldY+$hmax;
2715
+        return $oldY + $hmax;
2722 2716
     }
2723 2717
 
2724 2718
 
@@ -2752,7 +2746,7 @@  discard block
 block discarded – undo
2752 2746
 
2753 2747
         $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'');
2754 2748
 
2755
-        $w1 = round($w*0.09, 0);
2749
+        $w1 = round($w * 0.09, 0);
2756 2750
 
2757 2751
         // Tabela Renavam Combustivel
2758 2752
         $renavamCombustivel = array(
@@ -2850,54 +2844,54 @@  discard block
 block discarded – undo
2850 2844
 
2851 2845
         $yVeic = $y + $h;
2852 2846
         $texto = 'Chassi: ............: ' . $veiculoChassi;
2853
-        $this->pTextBox($x, $yVeic, $w1+40, $h, $texto, $aFont, 'T', 'L', 0, '');
2847
+        $this->pTextBox($x, $yVeic, $w1 + 40, $h, $texto, $aFont, 'T', 'L', 0, '');
2854 2848
         $yVeic += $h;
2855 2849
         $texto = 'Cor...................: ' . $veiculoCor;
2856
-        $this->pTextBox($x, $yVeic, $w1+40, $h, $texto, $aFont, 'T', 'L', 0, '');
2850
+        $this->pTextBox($x, $yVeic, $w1 + 40, $h, $texto, $aFont, 'T', 'L', 0, '');
2857 2851
         $yVeic += $h;
2858 2852
         $texto = 'Cilindrada........: ' . $veiculoCilindrada;
2859
-        $this->pTextBox($x, $yVeic, $w1+40, $h, $texto, $aFont, 'T', 'L', 0, '');
2853
+        $this->pTextBox($x, $yVeic, $w1 + 40, $h, $texto, $aFont, 'T', 'L', 0, '');
2860 2854
         $yVeic += $h;
2861 2855
         $texto = 'Cmkg...............: ' . $veiculoCmkg;
2862
-        $this->pTextBox($x, $yVeic, $w1+40, $h, $texto, $aFont, 'T', 'L', 0, '');
2856
+        $this->pTextBox($x, $yVeic, $w1 + 40, $h, $texto, $aFont, 'T', 'L', 0, '');
2863 2857
         $yVeic += $h;
2864 2858
         $texto = 'Tipo.................: ' . $renavamTiposVeiculos[intval($veiculoTipo)];
2865
-        $this->pTextBox($x, $yVeic, $w1+40, $h, $texto, $aFont, 'T', 'L', 0, '');
2859
+        $this->pTextBox($x, $yVeic, $w1 + 40, $h, $texto, $aFont, 'T', 'L', 0, '');
2866 2860
         $yVeic = $y + $h;
2867 2861
         $xVeic = $x + 65;
2868 2862
         $texto = 'Nº Motor: .........: ' . $veiculoMotor;
2869
-        $this->pTextBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
2863
+        $this->pTextBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
2870 2864
         $yVeic += $h;
2871 2865
         $texto = 'Renavam...........: ' . $veiculoRenavam;
2872
-        $this->pTextBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
2866
+        $this->pTextBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
2873 2867
         $yVeic += $h;
2874 2868
         $texto = 'HP.....................: ' . $veiculoHp;
2875
-        $this->pTextBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
2869
+        $this->pTextBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
2876 2870
         $yVeic += $h;
2877 2871
         $texto = 'Placa.................: ' . $veiculoPlaca;
2878
-        $this->pTextBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
2872
+        $this->pTextBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
2879 2873
         $yVeic += $h;
2880 2874
         $texto = 'Tipo Pintura......: ' . $renavamTipoPintura[$veiculoTipoPintura];
2881
-        $this->pTextBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
2875
+        $this->pTextBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
2882 2876
         $yVeic = $y + $h;
2883 2877
         $xVeic = $xVeic + 55;
2884 2878
         $texto = 'Marca / Modelo.....: ' . $veiculoMarcaModelo;
2885
-        $this->pTextBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
2879
+        $this->pTextBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
2886 2880
         $yVeic += $h;
2887 2881
         $texto = 'Especie..................: ' . $renavamEspecie[intval($veiculoEspecie)];
2888
-        $this->pTextBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
2882
+        $this->pTextBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
2889 2883
         $yVeic += $h;
2890 2884
         $texto = 'Combustivel..........: ' . $renavamCombustivel[intval($veiculoCombustivel)];
2891
-        $this->pTextBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
2885
+        $this->pTextBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
2892 2886
         $yVeic += $h;
2893 2887
         $texto = 'Serial.....................: ' . $veiculoSerial;
2894
-        $this->pTextBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
2888
+        $this->pTextBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
2895 2889
         $yVeic += $h;
2896
-        $texto = 'Ano Fab/Mod........: '. $veiculoFabricacao . '/' . $veiculoModelo;
2897
-        $this->pTextBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
2890
+        $texto = 'Ano Fab/Mod........: ' . $veiculoFabricacao . '/' . $veiculoModelo;
2891
+        $this->pTextBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
2898 2892
         $yVeic += $h;
2899
-        $texto = 'Distancia Entre Eixos(mm)..: '. $veiculoDistancia;
2900
-        $this->pTextBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
2893
+        $texto = 'Distancia Entre Eixos(mm)..: ' . $veiculoDistancia;
2894
+        $this->pTextBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
2901 2895
     }
2902 2896
 
2903 2897
     /**
@@ -2921,12 +2915,12 @@  discard block
 block discarded – undo
2921 2915
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
2922 2916
         //INSCRIÇÃO MUNICIPAL
2923 2917
         $y += 3;
2924
-        $w = round($this->wPrint*0.23, 0);
2918
+        $w = round($this->wPrint * 0.23, 0);
2925 2919
         $texto = 'INSCRIÇÃO MUNICIPAL';
2926 2920
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2927 2921
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
2928 2922
         //inscrição municipal
2929
-        $texto = ! empty($this->emit->getElementsByTagName("IM")->item(0)->nodeValue) ?
2923
+        $texto = !empty($this->emit->getElementsByTagName("IM")->item(0)->nodeValue) ?
2930 2924
                 $this->emit->getElementsByTagName("IM")->item(0)->nodeValue : '';
2931 2925
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
2932 2926
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 0, '');
@@ -2936,7 +2930,7 @@  discard block
 block discarded – undo
2936 2930
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2937 2931
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
2938 2932
         if (isset($this->ISSQNtot)) {
2939
-            $texto = ! empty($this->ISSQNtot->getElementsByTagName("vServ")->item(0)->nodeValue) ?
2933
+            $texto = !empty($this->ISSQNtot->getElementsByTagName("vServ")->item(0)->nodeValue) ?
2940 2934
                     $this->ISSQNtot->getElementsByTagName("vServ")->item(0)->nodeValue : '';
2941 2935
             $texto = number_format($texto, 2, ",", ".");
2942 2936
         } else {
@@ -2950,9 +2944,9 @@  discard block
 block discarded – undo
2950 2944
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2951 2945
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
2952 2946
         if (isset($this->ISSQNtot)) {
2953
-            $texto = ! empty($this->ISSQNtot->getElementsByTagName("vBC")->item(0)->nodeValue) ?
2947
+            $texto = !empty($this->ISSQNtot->getElementsByTagName("vBC")->item(0)->nodeValue) ?
2954 2948
                     $this->ISSQNtot->getElementsByTagName("vBC")->item(0)->nodeValue : '';
2955
-            $texto = ! empty($texto) ? number_format($texto, 2, ",", ".") : '';
2949
+            $texto = !empty($texto) ? number_format($texto, 2, ",", ".") : '';
2956 2950
         } else {
2957 2951
             $texto = '';
2958 2952
         }
@@ -2963,21 +2957,21 @@  discard block
 block discarded – undo
2963 2957
         if ($this->orientacao == 'P') {
2964 2958
             $w = $this->wPrint - (3 * $w);
2965 2959
         } else {
2966
-            $w = $this->wPrint - (3 * $w)-$this->wCanhoto;
2960
+            $w = $this->wPrint - (3 * $w) - $this->wCanhoto;
2967 2961
         }
2968 2962
         $texto = 'VALOR TOTAL DO ISSQN';
2969 2963
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2970 2964
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
2971 2965
         if (isset($this->ISSQNtot)) {
2972
-            $texto = ! empty($this->ISSQNtot->getElementsByTagName("vISS")->item(0)->nodeValue) ?
2966
+            $texto = !empty($this->ISSQNtot->getElementsByTagName("vISS")->item(0)->nodeValue) ?
2973 2967
                     $this->ISSQNtot->getElementsByTagName("vISS")->item(0)->nodeValue : '';
2974
-            $texto = ! empty($texto) ? number_format($texto, 2, ",", ".") : '';
2968
+            $texto = !empty($texto) ? number_format($texto, 2, ",", ".") : '';
2975 2969
         } else {
2976 2970
             $texto = '';
2977 2971
         }
2978 2972
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
2979 2973
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'R', 0, '');
2980
-        return ($y+$h+1);
2974
+        return ($y + $h + 1);
2981 2975
     }
2982 2976
 
2983 2977
     /**
@@ -2998,7 +2992,7 @@  discard block
 block discarded – undo
2998 2992
         if ($this->orientacao == 'P') {
2999 2993
               $w = $this->wPrint;
3000 2994
         } else {
3001
-              $w = $this->wPrint-$this->wCanhoto;
2995
+              $w = $this->wPrint - $this->wCanhoto;
3002 2996
         }
3003 2997
         $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
3004 2998
         $this->pTextBox($x, $y, $w, 8, $texto, $aFont, 'T', 'L', 0, '');
@@ -3014,15 +3008,15 @@  discard block
 block discarded – undo
3014 3008
         //$this->textoAdic com o texto completo do campo
3015 3009
         $y += 1;
3016 3010
         $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'');
3017
-        $this->pTextBox($x, $y+2, $w-2, $h-3, $this->textoAdic, $aFont, 'T', 'L', 0, '', false);
3011
+        $this->pTextBox($x, $y + 2, $w - 2, $h - 3, $this->textoAdic, $aFont, 'T', 'L', 0, '', false);
3018 3012
         //RESERVADO AO FISCO
3019 3013
         $texto = "RESERVADO AO FISCO";
3020 3014
         $x += $w;
3021 3015
         $y -= 1;
3022 3016
         if ($this->orientacao == 'P') {
3023
-            $w = $this->wPrint-$w;
3017
+            $w = $this->wPrint - $w;
3024 3018
         } else {
3025
-            $w = $this->wPrint-$w-$this->wCanhoto;
3019
+            $w = $this->wPrint - $w - $this->wCanhoto;
3026 3020
         }
3027 3021
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'B');
3028 3022
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -3061,8 +3055,8 @@  discard block
 block discarded – undo
3061 3055
         }
3062 3056
         $y += 2;
3063 3057
         $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'');
3064
-        $this->pTextBox($x, $y, $w-2, $h-3, $texto, $aFont, 'T', 'L', 0, '', false);
3065
-        return $y+$h;
3058
+        $this->pTextBox($x, $y, $w - 2, $h - 3, $texto, $aFont, 'T', 'L', 0, '', false);
3059
+        return $y + $h;
3066 3060
     }
3067 3061
 
3068 3062
     /**
@@ -3080,13 +3074,13 @@  discard block
 block discarded – undo
3080 3074
         if ($this->orientacao == 'P') {
3081 3075
               $w = $this->wPrint;
3082 3076
         } else {
3083
-              $w = $this->wPrint-$this->wCanhoto;
3077
+              $w = $this->wPrint - $this->wCanhoto;
3084 3078
               $x = $this->wCanhoto;
3085 3079
         }
3086 3080
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'I');
3087
-        $texto = "Impresso em ". date('d/m/Y') . " as " . date('H:i:s');
3081
+        $texto = "Impresso em " . date('d/m/Y') . " as " . date('H:i:s');
3088 3082
         $this->pTextBox($x, $y, $w, 0, $texto, $aFont, 'T', 'L', false);
3089
-        $texto = $this->creditos .  "  Powered by NFePHP";
3083
+        $texto = $this->creditos . "  Powered by NFePHP";
3090 3084
         $this->pTextBox($x, $y, $w, 0, $texto, $aFont, 'T', 'R', false, '');
3091 3085
     }
3092 3086
 
@@ -3139,9 +3133,9 @@  discard block
 block discarded – undo
3139 3133
         } else {
3140 3134
             //linha separadora do canhoto - 238
3141 3135
             //posicao altura
3142
-            $y = $this->wPrint-85;
3136
+            $y = $this->wPrint - 85;
3143 3137
             //altura
3144
-            $w = $this->wPrint-85-24;
3138
+            $w = $this->wPrint - 85 - 24;
3145 3139
         }
3146 3140
         $h = 10;
3147 3141
         //desenha caixa
@@ -3164,21 +3158,21 @@  discard block
 block discarded – undo
3164 3158
             $texto .= "AO LADO";
3165 3159
         }
3166 3160
         $texto .= ". EMISSÃO: ";
3167
-        $dEmi = ! empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
3161
+        $dEmi = !empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
3168 3162
                 $this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue : '';
3169 3163
         if ($dEmi == '') {
3170
-            $dEmi = ! empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
3164
+            $dEmi = !empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
3171 3165
                     $this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue : '';
3172 3166
             $aDemi = explode('T', $dEmi);
3173 3167
             $dEmi = $aDemi[0];
3174 3168
         }
3175
-        $texto .= $this->pYmd2dmy($dEmi) ." ";
3169
+        $texto .= $this->pYmd2dmy($dEmi) . " ";
3176 3170
         $texto .= "VALOR TOTAL: R$ ";
3177 3171
         $texto .= number_format($this->ICMSTot->getElementsByTagName("vNF")->item(0)->nodeValue, 2, ",", ".") . " ";
3178 3172
         $texto .= "DESTINATÁRIO: ";
3179 3173
         $texto .= $destinatario;
3180 3174
         if ($this->orientacao == 'P') {
3181
-            $this->pTextBox($x, $y, $w-1, $h, $texto, $aFont, 'C', 'L', 0, '', false);
3175
+            $this->pTextBox($x, $y, $w - 1, $h, $texto, $aFont, 'C', 'L', 0, '', false);
3182 3176
             $x1 = $x + $w;
3183 3177
             $w1 = $this->wPrint - $w;
3184 3178
             $texto = "NF-e";
@@ -3191,12 +3185,12 @@  discard block
 block discarded – undo
3191 3185
             //DATA DE RECEBIMENTO
3192 3186
             $texto = "DATA DE RECEBIMENTO";
3193 3187
             $y += $h;
3194
-            $w2 = round($this->wPrint*0.17, 0); //35;
3188
+            $w2 = round($this->wPrint * 0.17, 0); //35;
3195 3189
             $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
3196 3190
             $this->pTextBox($x, $y, $w2, 8, $texto, $aFont, 'T', 'L', 1, '');
3197 3191
             //IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR
3198 3192
             $x += $w2;
3199
-            $w3 = $w-$w2;
3193
+            $w3 = $w - $w2;
3200 3194
             $texto = "IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR";
3201 3195
             $this->pTextBox($x, $y, $w3, 8, $texto, $aFont, 'T', 'L', 1, '');
3202 3196
             $x = $oldX;
@@ -3206,7 +3200,7 @@  discard block
 block discarded – undo
3206 3200
             return $y;
3207 3201
         } else {
3208 3202
             $x--;
3209
-            $x = $this->pTextBox90($x, $y, $w-1, $h, $texto, $aFontSmall, 'C', 'L', 0, '', false);
3203
+            $x = $this->pTextBox90($x, $y, $w - 1, $h, $texto, $aFontSmall, 'C', 'L', 0, '', false);
3210 3204
             //NUMERO DA NOTA FISCAL LOGO NFE
3211 3205
             $w1 = 16;
3212 3206
             $x1 = $oldX;
@@ -3220,18 +3214,18 @@  discard block
 block discarded – undo
3220 3214
             $this->pTextBox($x1, $y, $w1, 18, $texto, $aFont, 'C', 'C', 1, '');
3221 3215
             //DATA DO RECEBIMENTO
3222 3216
             $texto = "DATA DO RECEBIMENTO";
3223
-            $y = $this->wPrint-85;
3217
+            $y = $this->wPrint - 85;
3224 3218
             $x = 12;
3225
-            $w2 = round($this->wPrint*0.17, 0); //35;
3219
+            $w2 = round($this->wPrint * 0.17, 0); //35;
3226 3220
             $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
3227 3221
             $this->pTextBox90($x, $y, $w2, 8, $texto, $aFont, 'T', 'L', 1, '');
3228 3222
             //IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR
3229 3223
             $y -= $w2;
3230
-            $w3 = $w-$w2;
3224
+            $w3 = $w - $w2;
3231 3225
             $texto = "IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR";
3232 3226
             $aFont = array('font'=>$this->fontePadrao, 'size'=>5.7, 'style'=>'');
3233 3227
             $x = $this->pTextBox90($x, $y, $w3, 8, $texto, $aFont, 'T', 'L', 1, '');
3234
-            $this->pdf->DashedVLine(23, $oldY, 0.1, $this->wPrint-20, 67);
3228
+            $this->pdf->DashedVLine(23, $oldY, 0.1, $this->wPrint - 20, 67);
3235 3229
             return $x;
3236 3230
         }
3237 3231
     }
@@ -3248,13 +3242,13 @@  discard block
 block discarded – undo
3248 3242
     {
3249 3243
         $saida = "";
3250 3244
         if (isset($this->compra)) {
3251
-            if (! empty($this->compra->getElementsByTagName("xNEmp")->item(0)->nodeValue)) {
3245
+            if (!empty($this->compra->getElementsByTagName("xNEmp")->item(0)->nodeValue)) {
3252 3246
                 $saida .= " Nota de Empenho: " . $this->compra->getElementsByTagName("xNEmp")->item(0)->nodeValue;
3253 3247
             }
3254
-            if (! empty($this->compra->getElementsByTagName("xPed")->item(0)->nodeValue)) {
3248
+            if (!empty($this->compra->getElementsByTagName("xPed")->item(0)->nodeValue)) {
3255 3249
                 $saida .= " Pedido: " . $this->compra->getElementsByTagName("xPed")->item(0)->nodeValue;
3256 3250
             }
3257
-            if (! empty($this->compra->getElementsByTagName("xCont")->item(0)->nodeValue)) {
3251
+            if (!empty($this->compra->getElementsByTagName("xCont")->item(0)->nodeValue)) {
3258 3252
                 $saida .= " Contrato: " . $this->compra->getElementsByTagName("xCont")->item(0)->nodeValue;
3259 3253
             }
3260 3254
         }
@@ -3280,21 +3274,21 @@  discard block
 block discarded – undo
3280 3274
         if ($vICMS > 0) {
3281 3275
             $vICMS = 1;
3282 3276
         }
3283
-        $icmss  = $this->ICMSTot->getElementsByTagName("vBC")->item(0)->nodeValue;
3277
+        $icmss = $this->ICMSTot->getElementsByTagName("vBC")->item(0)->nodeValue;
3284 3278
         if ($icmss > 0) {
3285 3279
             $icmss = 1;
3286 3280
         }
3287
-        $dEmi = ! empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
3281
+        $dEmi = !empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
3288 3282
                 $this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue : '';
3289 3283
         if ($dEmi == '') {
3290
-            $dEmi = ! empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
3284
+            $dEmi = !empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
3291 3285
                     $this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue : '';
3292 3286
             $aDemi = explode('T', $dEmi);
3293 3287
             $dEmi = $aDemi[0];
3294 3288
         }
3295 3289
         $dd  = $dEmi;
3296 3290
         $rpos = strrpos($dd, '-');
3297
-        $dd  = substr($dd, $rpos +1);
3291
+        $dd  = substr($dd, $rpos + 1);
3298 3292
         $chave = sprintf($forma, $cUF, $this->tpEmis, $CNPJ, $vNF, $vICMS, $icmss, $dd);
3299 3293
         $chave = $chave . $this->pModulo11($chave);
3300 3294
         return $chave;
@@ -3315,7 +3309,7 @@  discard block
 block discarded – undo
3315 3309
         $formaNfRef = "\r\nNF  Ref.: série:%d numero:%d emit:%s em %s modelo: %d";
3316 3310
         $formaECFRef = "\r\nECF Ref.: modelo: %s ECF:%d COO:%d";
3317 3311
         $formaNfpRef = "\r\nNFP Ref.: série:%d número:%d emit:%s em %s modelo: %d IE:%s";
3318
-        $saida='';
3312
+        $saida = '';
3319 3313
         $nfRefs = $this->ide->getElementsByTagName('NFref');
3320 3314
         if (0 === $nfRefs->length) {
3321 3315
             return $saida;
@@ -3328,7 +3322,7 @@  discard block
 block discarded – undo
3328 3322
             foreach ($refNFe as $chave_acessoRef) {
3329 3323
                 $chave_acesso = $chave_acessoRef->nodeValue;
3330 3324
                 $chave_acessoF = $this->pFormat($chave_acesso, $this->formatoChave);
3331
-                $data = substr($chave_acesso, 4, 2)."/20".substr($chave_acesso, 2, 2);
3325
+                $data = substr($chave_acesso, 4, 2) . "/20" . substr($chave_acesso, 2, 2);
3332 3326
                 $cnpj = $this->pFormat(substr($chave_acesso, 6, 14), "##.###.###/####-##");
3333 3327
                 $serie  = substr($chave_acesso, 22, 3);
3334 3328
                 $numero = substr($chave_acesso, 25, 9);
@@ -3349,7 +3343,7 @@  discard block
 block discarded – undo
3349 3343
             foreach ($refCTe as $chave_acessoRef) {
3350 3344
                 $chave_acesso = $chave_acessoRef->nodeValue;
3351 3345
                 $chave_acessoF = $this->pFormat($chave_acesso, $this->formatoChave);
3352
-                $data = substr($chave_acesso, 4, 2)."/20".substr($chave_acesso, 2, 2);
3346
+                $data = substr($chave_acesso, 4, 2) . "/20" . substr($chave_acesso, 2, 2);
3353 3347
                 $cnpj = $this->pFormat(substr($chave_acesso, 6, 14), "##.###.###/####-##");
3354 3348
                 $serie  = substr($chave_acesso, 22, 3);
3355 3349
                 $numero = substr($chave_acesso, 25, 9);
@@ -3365,10 +3359,9 @@  discard block
 block discarded – undo
3365 3359
             $refNFP = $nfRef->getElementsByTagName('refNFP');
3366 3360
             foreach ($refNFP as $umaRefNFe) {
3367 3361
                 $data = $umaRefNFe->getElementsByTagName('AAMM')->item(0)->nodeValue;
3368
-                $cnpj = ! empty($umaRefNFe->getElementsByTagName('CNPJ')->item(0)->nodeValue) ?
3369
-                    $umaRefNFe->getElementsByTagName('CNPJ')->item(0)->nodeValue :
3370
-                    '';
3371
-                $cpf = ! empty($umaRefNFe->getElementsByTagName('CPF')->item(0)->nodeValue) ?
3362
+                $cnpj = !empty($umaRefNFe->getElementsByTagName('CNPJ')->item(0)->nodeValue) ?
3363
+                    $umaRefNFe->getElementsByTagName('CNPJ')->item(0)->nodeValue : '';
3364
+                $cpf = !empty($umaRefNFe->getElementsByTagName('CPF')->item(0)->nodeValue) ?
3372 3365
                         $umaRefNFe->getElementsByTagName('CPF')->item(0)->nodeValue : '';
3373 3366
                 $mod = $umaRefNFe->getElementsByTagName('mod')->item(0)->nodeValue;
3374 3367
                 $serie = $umaRefNFe->getElementsByTagName('serie')->item(0)->nodeValue;
@@ -3394,6 +3387,6 @@  discard block
 block discarded – undo
3394 3387
         imagedestroy($image);
3395 3388
         $stringdata = ob_get_contents(); // read from buffer
3396 3389
         ob_end_clean();
3397
-        return 'data://text/plain;base64,'.base64_encode($stringdata);
3390
+        return 'data://text/plain;base64,' . base64_encode($stringdata);
3398 3391
     }
3399 3392
 }
Please login to merge, or discard this patch.