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