Passed
Pull Request — master (#65)
by Eduardo
03:41
created
src/NFe/Danfe.php 1 patch
Spacing   +314 added lines, -321 removed lines patch added patch discarded remove patch
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
      * ativa ou desativa o modo de debug
299 299
      * @var integer
300 300
      */
301
-    protected $debugMode=2;
301
+    protected $debugMode = 2;
302 302
 
303 303
     /**
304 304
      * __construct
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
             $this->fontePadrao = $fonteDANFE;
352 352
         }
353 353
         //se for passado o xml
354
-        if (! empty($this->xml)) {
354
+        if (!empty($this->xml)) {
355 355
             $this->dom = new Dom();
356 356
             $this->dom->loadXML($this->xml);
357 357
             $this->nfeProc    = $this->dom->getElementsByTagName("nfeProc")->item(0);
@@ -495,10 +495,10 @@  discard block
 block discarded – undo
495 495
         //total inicial de paginas
496 496
         $totPag = 1;
497 497
         //largura imprimivel em mm: largura da folha menos as margens esq/direita
498
-        $this->wPrint = $maxW-($margEsq*2);
498
+        $this->wPrint = $maxW - ($margEsq * 2);
499 499
         //comprimento (altura) imprimivel em mm: altura da folha menos as margens
500 500
         //superior e inferior
501
-        $this->hPrint = $maxH-$margSup-$margInf;
501
+        $this->hPrint = $maxH - $margSup - $margInf;
502 502
         // estabelece contagem de paginas
503 503
         $this->pdf->aliasNbPages();
504 504
         // fixa as margens
@@ -536,34 +536,28 @@  discard block
 block discarded – undo
536 536
         }
537 537
         //calcular a altura necessária para os dados adicionais
538 538
         if ($this->orientacao == 'P') {
539
-            $this->wAdic = round($this->wPrint*0.66, 0);
539
+            $this->wAdic = round($this->wPrint * 0.66, 0);
540 540
         } else {
541
-            $this->wAdic = round(($this->wPrint-$this->wCanhoto)*0.5, 0);
541
+            $this->wAdic = round(($this->wPrint - $this->wCanhoto) * 0.5, 0);
542 542
         }
543 543
         $fontProduto = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'');
544 544
         $this->textoAdic = '';
545 545
         if (isset($this->retirada)) {
546
-            $txRetCNPJ = ! empty($this->retirada->getElementsByTagName("CNPJ")->item(0)->nodeValue) ?
547
-                $this->retirada->getElementsByTagName("CNPJ")->item(0)->nodeValue :
548
-                '';
549
-            $txRetxLgr = ! empty($this->retirada->getElementsByTagName("xLgr")->item(0)->nodeValue) ?
550
-                $this->retirada->getElementsByTagName("xLgr")->item(0)->nodeValue :
551
-                '';
552
-            $txRetnro = ! empty($this->retirada->getElementsByTagName("nro")->item(0)->nodeValue) ?
553
-                $this->retirada->getElementsByTagName("nro")->item(0)->nodeValue :
554
-                's/n';
546
+            $txRetCNPJ = !empty($this->retirada->getElementsByTagName("CNPJ")->item(0)->nodeValue) ?
547
+                $this->retirada->getElementsByTagName("CNPJ")->item(0)->nodeValue : '';
548
+            $txRetxLgr = !empty($this->retirada->getElementsByTagName("xLgr")->item(0)->nodeValue) ?
549
+                $this->retirada->getElementsByTagName("xLgr")->item(0)->nodeValue : '';
550
+            $txRetnro = !empty($this->retirada->getElementsByTagName("nro")->item(0)->nodeValue) ?
551
+                $this->retirada->getElementsByTagName("nro")->item(0)->nodeValue : 's/n';
555 552
             $txRetxCpl = $this->pSimpleGetValue($this->retirada, "xCpl", " - ");
556
-            $txRetxBairro = ! empty($this->retirada->getElementsByTagName("xBairro")->item(0)->nodeValue) ?
557
-                $this->retirada->getElementsByTagName("xBairro")->item(0)->nodeValue :
558
-                '';
559
-            $txRetxMun = ! empty($this->retirada->getElementsByTagName("xMun")->item(0)->nodeValue) ?
560
-                $this->retirada->getElementsByTagName("xMun")->item(0)->nodeValue :
561
-                '';
562
-            $txRetUF = ! empty($this->retirada->getElementsByTagName("UF")->item(0)->nodeValue) ?
563
-                $this->retirada->getElementsByTagName("UF")->item(0)->nodeValue :
564
-                '';
565
-            $this->textoAdic .= "LOCAL DE RETIRADA : ".
566
-                    $txRetCNPJ.
553
+            $txRetxBairro = !empty($this->retirada->getElementsByTagName("xBairro")->item(0)->nodeValue) ?
554
+                $this->retirada->getElementsByTagName("xBairro")->item(0)->nodeValue : '';
555
+            $txRetxMun = !empty($this->retirada->getElementsByTagName("xMun")->item(0)->nodeValue) ?
556
+                $this->retirada->getElementsByTagName("xMun")->item(0)->nodeValue : '';
557
+            $txRetUF = !empty($this->retirada->getElementsByTagName("UF")->item(0)->nodeValue) ?
558
+                $this->retirada->getElementsByTagName("UF")->item(0)->nodeValue : '';
559
+            $this->textoAdic .= "LOCAL DE RETIRADA : " .
560
+                    $txRetCNPJ .
567 561
                     '-' .
568 562
                     $txRetxLgr .
569 563
                     ', ' .
@@ -580,24 +574,24 @@  discard block
 block discarded – undo
580 574
         }
581 575
         //dados do local de entrega da mercadoria
582 576
         if (isset($this->entrega)) {
583
-            $txRetCNPJ = ! empty($this->entrega->getElementsByTagName("CNPJ")->item(0)->nodeValue) ?
577
+            $txRetCNPJ = !empty($this->entrega->getElementsByTagName("CNPJ")->item(0)->nodeValue) ?
584 578
                 $this->entrega->getElementsByTagName("CNPJ")->item(0)->nodeValue : '';
585
-            $txRetxLgr = ! empty($this->entrega->getElementsByTagName("xLgr")->item(0)->nodeValue) ?
579
+            $txRetxLgr = !empty($this->entrega->getElementsByTagName("xLgr")->item(0)->nodeValue) ?
586 580
                 $this->entrega->getElementsByTagName("xLgr")->item(0)->nodeValue : '';
587
-            $txRetnro = ! empty($this->entrega->getElementsByTagName("nro")->item(0)->nodeValue) ?
581
+            $txRetnro = !empty($this->entrega->getElementsByTagName("nro")->item(0)->nodeValue) ?
588 582
                 $this->entrega->getElementsByTagName("nro")->item(0)->nodeValue : 's/n';
589 583
             $txRetxCpl = $this->pSimpleGetValue($this->entrega, "xCpl", " - ");
590
-            $txRetxBairro = ! empty($this->entrega->getElementsByTagName("xBairro")->item(0)->nodeValue) ?
584
+            $txRetxBairro = !empty($this->entrega->getElementsByTagName("xBairro")->item(0)->nodeValue) ?
591 585
                 $this->entrega->getElementsByTagName("xBairro")->item(0)->nodeValue : '';
592
-            $txRetxMun = ! empty($this->entrega->getElementsByTagName("xMun")->item(0)->nodeValue) ?
586
+            $txRetxMun = !empty($this->entrega->getElementsByTagName("xMun")->item(0)->nodeValue) ?
593 587
                 $this->entrega->getElementsByTagName("xMun")->item(0)->nodeValue : '';
594
-            $txRetUF = ! empty($this->entrega->getElementsByTagName("UF")->item(0)->nodeValue) ?
588
+            $txRetUF = !empty($this->entrega->getElementsByTagName("UF")->item(0)->nodeValue) ?
595 589
                 $this->entrega->getElementsByTagName("UF")->item(0)->nodeValue : '';
596 590
             if ($this->textoAdic != '') {
597 591
                 $this->textoAdic .= ". \r\n";
598 592
             }
599
-            $this->textoAdic .= "LOCAL DE ENTREGA : ".$txRetCNPJ.'-'.$txRetxLgr.', '.$txRetnro.' '.$txRetxCpl.
600
-               ' - '.$txRetxBairro.' '.$txRetxMun.' - '.$txRetUF."\r\n";
593
+            $this->textoAdic .= "LOCAL DE ENTREGA : " . $txRetCNPJ . '-' . $txRetxLgr . ', ' . $txRetnro . ' ' . $txRetxCpl .
594
+               ' - ' . $txRetxBairro . ' ' . $txRetxMun . ' - ' . $txRetUF . "\r\n";
601 595
         }
602 596
         //informações adicionais
603 597
         $this->textoAdic .= $this->pGeraInformacoesDasNotasReferenciadas();
@@ -606,7 +600,7 @@  discard block
 block discarded – undo
606 600
             if ($this->textoAdic != '') {
607 601
                 $this->textoAdic .= ". \r\n";
608 602
             }
609
-            $this->textoAdic .= ! empty($this->infAdic->getElementsByTagName("infCpl")->item(0)->nodeValue) ?
603
+            $this->textoAdic .= !empty($this->infAdic->getElementsByTagName("infCpl")->item(0)->nodeValue) ?
610 604
                 'Inf. Contribuinte: ' .
611 605
                 trim($this->pAnfavea($this->infAdic->getElementsByTagName("infCpl")->item(0)->nodeValue)) : '';
612 606
             $infPedido = $this->pGeraInformacoesDaTagCompra();
@@ -614,14 +608,14 @@  discard block
 block discarded – undo
614 608
                 $this->textoAdic .= $infPedido;
615 609
             }
616 610
             $this->textoAdic .= $this->pSimpleGetValue($this->dest, "email", ' Email do Destinatário: ');
617
-            $this->textoAdic .= ! empty($this->infAdic->getElementsByTagName("infAdFisco")->item(0)->nodeValue) ?
611
+            $this->textoAdic .= !empty($this->infAdic->getElementsByTagName("infAdFisco")->item(0)->nodeValue) ?
618 612
                 "\r\n Inf. fisco: " .
619 613
                 trim($this->infAdic->getElementsByTagName("infAdFisco")->item(0)->nodeValue) : '';
620 614
             $obsCont = $this->infAdic->getElementsByTagName("obsCont");
621 615
             if (isset($obsCont)) {
622 616
                 foreach ($obsCont as $obs) {
623
-                    $campo =  $obsCont->item($i)->getAttribute("xCampo");
624
-                    $xTexto = ! empty($obsCont->item($i)->getElementsByTagName("xTexto")->item(0)->nodeValue) ?
617
+                    $campo = $obsCont->item($i)->getAttribute("xCampo");
618
+                    $xTexto = !empty($obsCont->item($i)->getElementsByTagName("xTexto")->item(0)->nodeValue) ?
625 619
                         $obsCont->item($i)->getElementsByTagName("xTexto")->item(0)->nodeValue : '';
626 620
                     $this->textoAdic .= "\r\n" . $campo . ':  ' . trim($xTexto);
627 621
                     $i++;
@@ -649,38 +643,38 @@  discard block
 block discarded – undo
649 643
         foreach ($alinhas as $linha) {
650 644
             $numlinhasdados += $this->pGetNumLines($linha, $this->wAdic, $fontProduto);
651 645
         }
652
-        $hdadosadic = round(($numlinhasdados+3) * $this->pdf->fontSize, 0);
646
+        $hdadosadic = round(($numlinhasdados + 3) * $this->pdf->fontSize, 0);
653 647
         if ($hdadosadic < 10) {
654 648
             $hdadosadic = 10;
655 649
         }
656 650
         //altura disponivel para os campos da DANFE
657
-        $hcabecalho = 47;//para cabeçalho
658
-        $hdestinatario = 25;//para destinatario
659
-        $hduplicatas = 12;//para cada grupo de 7 duplicatas
660
-        $himposto = 18;// para imposto
661
-        $htransporte = 25;// para transporte
662
-        $hissqn = 11;// para issqn
663
-        $hfooter = 5;// para rodape
664
-        $hCabecItens = 4;//cabeçalho dos itens
651
+        $hcabecalho = 47; //para cabeçalho
652
+        $hdestinatario = 25; //para destinatario
653
+        $hduplicatas = 12; //para cada grupo de 7 duplicatas
654
+        $himposto = 18; // para imposto
655
+        $htransporte = 25; // para transporte
656
+        $hissqn = 11; // para issqn
657
+        $hfooter = 5; // para rodape
658
+        $hCabecItens = 4; //cabeçalho dos itens
665 659
         //alturas disponiveis para os dados
666 660
         $hDispo1 = $this->hPrint - 10 - ($hcabecalho +
667 661
             $hdestinatario + ($linhasDup * $hduplicatas) + $himposto + $htransporte +
668 662
             ($linhaISSQN * $hissqn) + $hdadosadic + $hfooter + $hCabecItens +
669 663
             $this->pSizeExtraTextoFatura());
670 664
         if ($this->orientacao == 'P') {
671
-            $hDispo1 -= 23 * $this->qCanhoto;//para canhoto
665
+            $hDispo1 -= 23 * $this->qCanhoto; //para canhoto
672 666
             $w = $this->wPrint;
673 667
         } else {
674
-            $hcanhoto = $this->hPrint;//para canhoto
668
+            $hcanhoto = $this->hPrint; //para canhoto
675 669
             $w = $this->wPrint - $this->wCanhoto;
676 670
         }
677
-        $hDispo2 = $this->hPrint - 10 - ($hcabecalho + $hfooter + $hCabecItens)-4;
671
+        $hDispo2 = $this->hPrint - 10 - ($hcabecalho + $hfooter + $hCabecItens) - 4;
678 672
         //Contagem da altura ocupada para impressão dos itens
679 673
         $fontProduto = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'');
680 674
         $i = 0;
681 675
         $numlinhas = 0;
682 676
         $hUsado = $hCabecItens;
683
-        $w2 = round($w*0.28, 0);
677
+        $w2 = round($w * 0.28, 0);
684 678
         $hDispo = $hDispo1;
685 679
         $totPag = 1;
686 680
         while ($i < $this->det->length) {
@@ -692,7 +686,7 @@  discard block
 block discarded – undo
692 686
                 $hDispo = $hDispo2;
693 687
                 $hUsado = $hCabecItens;
694 688
                 // Remove canhoto para páginas secundárias em modo paisagem ('L')
695
-                $w2 = round($this->wPrint*0.28, 0);
689
+                $w2 = round($this->wPrint * 0.28, 0);
696 690
                 $i--; // decrementa para readicionar o item que não coube nessa pagina na outra.
697 691
             }
698 692
             $i++;
@@ -716,19 +710,19 @@  discard block
 block discarded – undo
716 710
         //coloca o cabeçalho
717 711
         $y = $this->pCabecalhoDANFE($x, $y, $pag, $totPag);
718 712
         //coloca os dados do destinatário
719
-        $y = $this->pDestinatarioDANFE($x, $y+1);
713
+        $y = $this->pDestinatarioDANFE($x, $y + 1);
720 714
         //coloca os dados das faturas
721
-        $y = $this->pFaturaDANFE($x, $y+1);
715
+        $y = $this->pFaturaDANFE($x, $y + 1);
722 716
         //coloca os dados dos impostos e totais da NFe
723
-        $y = $this->pImpostoDANFE($x, $y+1);
717
+        $y = $this->pImpostoDANFE($x, $y + 1);
724 718
         //coloca os dados do trasnporte
725
-        $y = $this->pTransporteDANFE($x, $y+1);
719
+        $y = $this->pTransporteDANFE($x, $y + 1);
726 720
         //itens da DANFE
727 721
         $nInicial = 0;
728
-        $y = $this->pItensDANFE($x, $y+1, $nInicial, $hDispo1, $pag, $totPag, $hCabecItens);
722
+        $y = $this->pItensDANFE($x, $y + 1, $nInicial, $hDispo1, $pag, $totPag, $hCabecItens);
729 723
         //coloca os dados do ISSQN
730 724
         if ($linhaISSQN == 1) {
731
-            $y = $this->pIssqnDANFE($x, $y+4);
725
+            $y = $this->pIssqnDANFE($x, $y + 4);
732 726
         } else {
733 727
             $y += 4;
734 728
         }
@@ -736,7 +730,7 @@  discard block
 block discarded – undo
736 730
         $y = $this->pDadosAdicionaisDANFE($x, $y, $hdadosadic);
737 731
         //coloca o rodapé da página
738 732
         if ($this->orientacao == 'P') {
739
-            $this->pRodape($xInic, $y-1);
733
+            $this->pRodape($xInic, $y - 1);
740 734
         } else {
741 735
             $this->pRodape($xInic, $this->hPrint + 1);
742 736
         }
@@ -756,7 +750,7 @@  discard block
 block discarded – undo
756 750
             //coloca o cabeçalho na página adicional
757 751
             $y = $this->pCabecalhoDANFE($x, $y, $n, $totPag);
758 752
             //coloca os itens na página adicional
759
-            $y = $this->pItensDANFE($x, $y+1, $nInicial, $hDispo2, $n, $totPag, $hCabecItens);
753
+            $y = $this->pItensDANFE($x, $y + 1, $nInicial, $hDispo2, $n, $totPag, $hCabecItens);
760 754
             //coloca o rodapé da página
761 755
             if ($this->orientacao == 'P') {
762 756
                 $this->pRodape($xInic, $y + 4);
@@ -769,7 +763,7 @@  discard block
 block discarded – undo
769 763
             }
770 764
         }
771 765
         //retorna o ID na NFe
772
-        if ($classPdf!==false) {
766
+        if ($classPdf !== false) {
773 767
             $aR = array(
774 768
              'id'=>str_replace('NFe', '', $this->infNFe->getAttribute("Id")),
775 769
              'classe_PDF'=>$this->pdf);
@@ -802,7 +796,7 @@  discard block
 block discarded – undo
802 796
         if ($startPos === false) {
803 797
             return $cdata;
804 798
         }
805
-        for ($x=$len; $x>0; $x--) {
799
+        for ($x = $len; $x > 0; $x--) {
806 800
             if (substr($cdata, $x, 1) == '>') {
807 801
                 $endPos = $x;
808 802
                 break;
@@ -813,15 +807,15 @@  discard block
 block discarded – undo
813 807
         } else {
814 808
             $parte1 = '';
815 809
         }
816
-        $parte2 = substr($cdata, $startPos, $endPos-$startPos+1);
810
+        $parte2 = substr($cdata, $startPos, $endPos - $startPos + 1);
817 811
         if ($endPos < $len) {
818 812
             $parte3 = substr($cdata, $endPos + 1, $len - $endPos - 1);
819 813
         } else {
820 814
             $parte3 = '';
821 815
         }
822
-        $texto = trim($parte1).' '.trim($parte3);
816
+        $texto = trim($parte1) . ' ' . trim($parte3);
823 817
         if (strpos($parte2, '<CDATA>') === false) {
824
-            $cdata = '<CDATA>'.$parte2.'</CDATA>';
818
+            $cdata = '<CDATA>' . $parte2 . '</CDATA>';
825 819
         } else {
826 820
             $cdata = $parte2;
827 821
         }
@@ -893,15 +887,15 @@  discard block
 block discarded – undo
893 887
         //grupo CADATA infCpl
894 888
         $t = $dom->getElementsByTagName('transmissor')->item(0);
895 889
         $r = $dom->getElementsByTagName('receptor')->item(0);
896
-        $versao = ! empty($dom->getElementsByTagName('versao')->item(0)->nodeValue) ?
897
-            'Versao:'.$dom->getElementsByTagName('versao')->item(0)->nodeValue.' ' : '';
898
-        $especieNF = ! empty($dom->getElementsByTagName('especieNF')->item(0)->nodeValue) ?
899
-            'Especie:'.$dom->getElementsByTagName('especieNF')->item(0)->nodeValue.' ' : '';
900
-        $fabEntrega = ! empty($dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue) ?
901
-            'Entrega:'.$dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue.' ' : '';
902
-        $dca = ! empty($dom->getElementsByTagName('dca')->item(0)->nodeValue) ?
903
-            'dca:'.$dom->getElementsByTagName('dca')->item(0)->nodeValue.' ' : '';
904
-        $texto .= "".$versao.$especieNF.$fabEntrega.$dca;
890
+        $versao = !empty($dom->getElementsByTagName('versao')->item(0)->nodeValue) ?
891
+            'Versao:' . $dom->getElementsByTagName('versao')->item(0)->nodeValue . ' ' : '';
892
+        $especieNF = !empty($dom->getElementsByTagName('especieNF')->item(0)->nodeValue) ?
893
+            'Especie:' . $dom->getElementsByTagName('especieNF')->item(0)->nodeValue . ' ' : '';
894
+        $fabEntrega = !empty($dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue) ?
895
+            'Entrega:' . $dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue . ' ' : '';
896
+        $dca = !empty($dom->getElementsByTagName('dca')->item(0)->nodeValue) ?
897
+            'dca:' . $dom->getElementsByTagName('dca')->item(0)->nodeValue . ' ' : '';
898
+        $texto .= "" . $versao . $especieNF . $fabEntrega . $dca;
905 899
         if (isset($t)) {
906 900
             if ($t->hasAttributes()) {
907 901
                 $texto .= " Transmissor ";
@@ -991,14 +985,14 @@  discard block
 block discarded – undo
991 985
         }
992 986
         //####################################################################################
993 987
         //coluna esquerda identificação do emitente
994
-        $w = round($maxW*0.41, 0);
988
+        $w = round($maxW * 0.41, 0);
995 989
         if ($this->orientacao == 'P') {
996 990
             $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'I');
997 991
         } else {
998 992
             $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B');
999 993
         }
1000 994
         $w1 = $w;
1001
-        $h=32;
995
+        $h = 32;
1002 996
         $oldY += $h;
1003 997
         $this->pTextBox($x, $y, $w, $h);
1004 998
         $texto = 'IDENTIFICAÇÃO DO EMITENTE';
@@ -1012,41 +1006,41 @@  discard block
 block discarded – undo
1012 1006
         //se não houver logo centraliza dos dados do emitente
1013 1007
         // coloca o logo
1014 1008
         if (is_file($this->logomarca)) {
1015
-            $logoInfo=getimagesize($this->logomarca);
1009
+            $logoInfo = getimagesize($this->logomarca);
1016 1010
             //largura da imagem em mm
1017
-            $logoWmm = ($logoInfo[0]/72)*25.4;
1011
+            $logoWmm = ($logoInfo[0] / 72) * 25.4;
1018 1012
             //altura da imagem em mm
1019
-            $logoHmm = ($logoInfo[1]/72)*25.4;
1020
-            if ($this->logoAlign=='L') {
1021
-                $nImgW = round($w/3, 0);
1022
-                $nImgH = round($logoHmm * ($nImgW/$logoWmm), 0);
1023
-                $xImg = $x+1;
1024
-                $yImg = round(($h-$nImgH)/2, 0)+$y;
1013
+            $logoHmm = ($logoInfo[1] / 72) * 25.4;
1014
+            if ($this->logoAlign == 'L') {
1015
+                $nImgW = round($w / 3, 0);
1016
+                $nImgH = round($logoHmm * ($nImgW / $logoWmm), 0);
1017
+                $xImg = $x + 1;
1018
+                $yImg = round(($h - $nImgH) / 2, 0) + $y;
1025 1019
                 //estabelecer posições do texto
1026
-                $x1 = round($xImg + $nImgW +1, 0);
1027
-                $y1 = round($h/3+$y, 0);
1028
-                $tw = round(2*$w/3, 0);
1029
-            } elseif ($this->logoAlign=='C') {
1030
-                $nImgH = round($h/3, 0);
1031
-                $nImgW = round($logoWmm * ($nImgH/$logoHmm), 0);
1032
-                $xImg = round(($w-$nImgW)/2+$x, 0);
1033
-                $yImg = $y+3;
1020
+                $x1 = round($xImg + $nImgW + 1, 0);
1021
+                $y1 = round($h / 3 + $y, 0);
1022
+                $tw = round(2 * $w / 3, 0);
1023
+            } elseif ($this->logoAlign == 'C') {
1024
+                $nImgH = round($h / 3, 0);
1025
+                $nImgW = round($logoWmm * ($nImgH / $logoHmm), 0);
1026
+                $xImg = round(($w - $nImgW) / 2 + $x, 0);
1027
+                $yImg = $y + 3;
1034 1028
                 $x1 = $x;
1035 1029
                 $y1 = round($yImg + $nImgH + 1, 0);
1036 1030
                 $tw = $w;
1037
-            } elseif ($this->logoAlign=='R') {
1038
-                $nImgW = round($w/3, 0);
1039
-                $nImgH = round($logoHmm * ($nImgW/$logoWmm), 0);
1040
-                $xImg = round($x+($w-(1+$nImgW)), 0);
1041
-                $yImg = round(($h-$nImgH)/2, 0)+$y;
1031
+            } elseif ($this->logoAlign == 'R') {
1032
+                $nImgW = round($w / 3, 0);
1033
+                $nImgH = round($logoHmm * ($nImgW / $logoWmm), 0);
1034
+                $xImg = round($x + ($w - (1 + $nImgW)), 0);
1035
+                $yImg = round(($h - $nImgH) / 2, 0) + $y;
1042 1036
                 $x1 = $x;
1043
-                $y1 = round($h/3+$y, 0);
1044
-                $tw = round(2*$w/3, 0);
1045
-            } elseif ($this->logoAlign=='F') {
1046
-                $nImgH = round($h-5, 0);
1047
-                $nImgW = round($logoWmm * ($nImgH/$logoHmm), 0);
1048
-                $xImg = round(($w-$nImgW)/2+$x, 0);
1049
-                $yImg = $y+3;
1037
+                $y1 = round($h / 3 + $y, 0);
1038
+                $tw = round(2 * $w / 3, 0);
1039
+            } elseif ($this->logoAlign == 'F') {
1040
+                $nImgH = round($h - 5, 0);
1041
+                $nImgW = round($logoWmm * ($nImgH / $logoHmm), 0);
1042
+                $xImg = round(($w - $nImgW) / 2 + $x, 0);
1043
+                $yImg = $y + 3;
1050 1044
                 $x1 = $x;
1051 1045
                 $y1 = round($yImg + $nImgH + 1, 0);
1052 1046
                 $tw = $w;
@@ -1054,7 +1048,7 @@  discard block
 block discarded – undo
1054 1048
             $this->pdf->Image($this->logomarca, $xImg, $yImg, $nImgW, $nImgH);
1055 1049
         } else {
1056 1050
             $x1 = $x;
1057
-            $y1 = round($h/3+$y, 0);
1051
+            $y1 = round($h / 3 + $y, 0);
1058 1052
             $tw = $w;
1059 1053
         }
1060 1054
         // monta as informações apenas se diferente de full logo
@@ -1064,9 +1058,9 @@  discard block
 block discarded – undo
1064 1058
             $texto = $this->emit->getElementsByTagName("xNome")->item(0)->nodeValue;
1065 1059
             $this->pTextBox($x1, $y1, $tw, 8, $texto, $aFont, 'T', 'C', 0, '');
1066 1060
             //endereço
1067
-            $y1 = $y1+5;
1061
+            $y1 = $y1 + 5;
1068 1062
             $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'');
1069
-            $fone = ! empty($this->enderEmit->getElementsByTagName("fone")->item(0)->nodeValue)
1063
+            $fone = !empty($this->enderEmit->getElementsByTagName("fone")->item(0)->nodeValue)
1070 1064
                  ? $this->enderEmit->getElementsByTagName("fone")->item(0)->nodeValue
1071 1065
                  : '';
1072 1066
             $lgr = $this->pSimpleGetValue($this->enderEmit, "xLgr");
@@ -1086,37 +1080,37 @@  discard block
 block discarded – undo
1086 1080
         //####################################################################################
1087 1081
         //coluna central Danfe
1088 1082
         $x += $w;
1089
-        $w=round($maxW * 0.17, 0);//35;
1083
+        $w = round($maxW * 0.17, 0); //35;
1090 1084
         $w2 = $w;
1091 1085
         $h = 32;
1092 1086
         $this->pTextBox($x, $y, $w, $h);
1093 1087
 
1094
-        if (! $this->pNotaCancelada()) {
1088
+        if (!$this->pNotaCancelada()) {
1095 1089
             // A PRINCIPIO NÃO PRECISAVA, POIS A NFE ESTÁ AUTORIZADA,
1096 1090
             // SÓ SE RETIRA O DANFE PARA NOTAS NÃO AUTORIZADAS
1097 1091
             $texto = "DANFE";
1098 1092
             $aFont = array('font'=>$this->fontePadrao, 'size'=>14, 'style'=>'B');
1099
-            $this->pTextBox($x, $y+1, $w, $h, $texto, $aFont, 'T', 'C', 0, '');
1093
+            $this->pTextBox($x, $y + 1, $w, $h, $texto, $aFont, 'T', 'C', 0, '');
1100 1094
             $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'');
1101 1095
             $texto = 'Documento Auxiliar da Nota Fiscal Eletrônica';
1102 1096
             $h = 20;
1103
-            $this->pTextBox($x, $y+6, $w, $h, $texto, $aFont, 'T', 'C', 0, '', false);
1097
+            $this->pTextBox($x, $y + 6, $w, $h, $texto, $aFont, 'T', 'C', 0, '', false);
1104 1098
         }
1105 1099
 
1106 1100
         $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'');
1107 1101
         $texto = '0 - ENTRADA';
1108 1102
         $y1 = $y + 14;
1109 1103
         $h = 8;
1110
-        $this->pTextBox($x+2, $y1, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1104
+        $this->pTextBox($x + 2, $y1, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1111 1105
         $texto = '1 - SAÍDA';
1112 1106
         $y1 = $y + 17;
1113
-        $this->pTextBox($x+2, $y1, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1107
+        $this->pTextBox($x + 2, $y1, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1114 1108
         //tipo de nF
1115 1109
         $aFont = array('font'=>$this->fontePadrao, 'size'=>12, 'style'=>'B');
1116 1110
         $y1 = $y + 13;
1117 1111
         $h = 7;
1118 1112
         $texto = $this->ide->getElementsByTagName('tpNF')->item(0)->nodeValue;
1119
-        $this->pTextBox($x+27, $y1, 5, $h, $texto, $aFont, 'C', 'C', 1, '');
1113
+        $this->pTextBox($x + 27, $y1, 5, $h, $texto, $aFont, 'C', 'C', 1, '');
1120 1114
         //numero da NF
1121 1115
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
1122 1116
         $y1 = $y + 20;
@@ -1138,7 +1132,7 @@  discard block
 block discarded – undo
1138 1132
         //####################################################################################
1139 1133
         //coluna codigo de barras
1140 1134
         $x += $w;
1141
-        $w = ($maxW-$w1-$w2);//85;
1135
+        $w = ($maxW - $w1 - $w2); //85;
1142 1136
         $w3 = $w;
1143 1137
         $h = 32;
1144 1138
         $this->pTextBox($x, $y, $w, $h);
@@ -1147,22 +1141,22 @@  discard block
 block discarded – undo
1147 1141
         $bW = 75;
1148 1142
         $bH = 12;
1149 1143
         //codigo de barras
1150
-        $this->pdf->Code128($x+(($w-$bW)/2), $y+2, $chave_acesso, $bW, $bH);
1144
+        $this->pdf->Code128($x + (($w - $bW) / 2), $y + 2, $chave_acesso, $bW, $bH);
1151 1145
         //linhas divisorias
1152
-        $this->pdf->Line($x, $y+4+$bH, $x+$w, $y+4+$bH);
1153
-        $this->pdf->Line($x, $y+12+$bH, $x+$w, $y+12+$bH);
1146
+        $this->pdf->Line($x, $y + 4 + $bH, $x + $w, $y + 4 + $bH);
1147
+        $this->pdf->Line($x, $y + 12 + $bH, $x + $w, $y + 12 + $bH);
1154 1148
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1155
-        $y1 = $y+4+$bH;
1149
+        $y1 = $y + 4 + $bH;
1156 1150
         $h = 7;
1157 1151
         $texto = 'CHAVE DE ACESSO';
1158 1152
         $this->pTextBox($x, $y1, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1159 1153
         $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B');
1160
-        $y1 = $y+8+$bH;
1154
+        $y1 = $y + 8 + $bH;
1161 1155
         $texto = $this->pFormat($chave_acesso, $this->formatoChave);
1162
-        $this->pTextBox($x+2, $y1, $w-2, $h, $texto, $aFont, 'T', 'C', 0, '');
1163
-        $y1 = $y+12+$bH;
1156
+        $this->pTextBox($x + 2, $y1, $w - 2, $h, $texto, $aFont, 'T', 'C', 0, '');
1157
+        $y1 = $y + 12 + $bH;
1164 1158
         $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'');
1165
-        $chaveContingencia="";
1159
+        $chaveContingencia = "";
1166 1160
         if ($this->pNotaDPEC()) {
1167 1161
             $cabecalhoProtoAutorizacao = 'NÚMERO DE REGISTRO DPEC';
1168 1162
         } else {
@@ -1173,16 +1167,16 @@  discard block
 block discarded – undo
1173 1167
             $chaveContingencia = $this->pGeraChaveAdicionalDeContingencia();
1174 1168
             $this->pdf->SetFillColor(0, 0, 0);
1175 1169
             //codigo de barras
1176
-            $this->pdf->Code128($x+11, $y1+1, $chaveContingencia, $bW*.9, $bH/2);
1170
+            $this->pdf->Code128($x + 11, $y1 + 1, $chaveContingencia, $bW * .9, $bH / 2);
1177 1171
         } else {
1178 1172
             $texto = 'Consulta de autenticidade no portal nacional da NF-e';
1179
-            $this->pTextBox($x+2, $y1, $w-2, $h, $texto, $aFont, 'T', 'C', 0, '');
1180
-            $y1 = $y+16+$bH;
1173
+            $this->pTextBox($x + 2, $y1, $w - 2, $h, $texto, $aFont, 'T', 'C', 0, '');
1174
+            $y1 = $y + 16 + $bH;
1181 1175
             $texto = 'www.nfe.fazenda.gov.br/portal ou no site da Sefaz Autorizadora';
1182 1176
             $this->pTextBox(
1183
-                $x+2,
1177
+                $x + 2,
1184 1178
                 $y1,
1185
-                $w-2,
1179
+                $w - 2,
1186 1180
                 $h,
1187 1181
                 $texto,
1188 1182
                 $aFont,
@@ -1198,7 +1192,7 @@  discard block
 block discarded – undo
1198 1192
         //natureza da operação
1199 1193
         $texto = 'NATUREZA DA OPERAÇÃO';
1200 1194
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1201
-        $w = $w1+$w2;
1195
+        $w = $w1 + $w2;
1202 1196
         $y = $oldY;
1203 1197
         $oldY += $h;
1204 1198
         $x = $oldX;
@@ -1228,7 +1222,7 @@  discard block
 block discarded – undo
1228 1222
                 $cStat = '';
1229 1223
             } else {
1230 1224
                 if (isset($this->nfeProc)) {
1231
-                    $texto = ! empty($this->nfeProc->getElementsByTagName("nProt")->item(0)->nodeValue) ?
1225
+                    $texto = !empty($this->nfeProc->getElementsByTagName("nProt")->item(0)->nodeValue) ?
1232 1226
                             $this->nfeProc->getElementsByTagName("nProt")->item(0)->nodeValue : '';
1233 1227
                     $tsHora = $this->pConvertTime($this->nfeProc->getElementsByTagName("dhRecbto")->item(0)->nodeValue);
1234 1228
                     if ($texto != '') {
@@ -1259,25 +1253,25 @@  discard block
 block discarded – undo
1259 1253
         $texto = 'INSCRIÇÃO ESTADUAL DO SUBST. TRIBUT.';
1260 1254
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1261 1255
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1262
-        $texto = ! empty($this->emit->getElementsByTagName("IEST")->item(0)->nodeValue)
1256
+        $texto = !empty($this->emit->getElementsByTagName("IEST")->item(0)->nodeValue)
1263 1257
              ? $this->emit->getElementsByTagName("IEST")->item(0)->nodeValue
1264 1258
              : '';
1265 1259
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
1266 1260
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1267 1261
         //CNPJ
1268 1262
         $x += $w;
1269
-        $w = ($maxW-(2*$w));
1263
+        $w = ($maxW - (2 * $w));
1270 1264
         $texto = 'CNPJ / CPF';
1271 1265
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1272 1266
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1273 1267
         //Pegando valor do CPF/CNPJ
1274
-        if (! empty($this->emit->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1268
+        if (!empty($this->emit->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1275 1269
             $texto = $this->pFormat(
1276 1270
                 $this->emit->getElementsByTagName("CNPJ")->item(0)->nodeValue,
1277 1271
                 "###.###.###/####-##"
1278 1272
             );
1279 1273
         } else {
1280
-            $texto = ! empty($this->emit->getElementsByTagName("CPF")->item(0)->nodeValue) ?
1274
+            $texto = !empty($this->emit->getElementsByTagName("CPF")->item(0)->nodeValue) ?
1281 1275
                 $this->pFormat(
1282 1276
                     $this->emit->getElementsByTagName("CPF")->item(0)->nodeValue,
1283 1277
                     "###.###.###-##"
@@ -1293,9 +1287,9 @@  discard block
 block discarded – undo
1293 1287
         if ($this->pNotaCancelada()) {
1294 1288
             //101 Cancelamento
1295 1289
             $x = 10;
1296
-            $y = $this->hPrint-130;
1290
+            $y = $this->hPrint - 130;
1297 1291
             $h = 25;
1298
-            $w = $maxW-(2*$x);
1292
+            $w = $maxW - (2 * $x);
1299 1293
             $this->pdf->SetTextColor(90, 90, 90);
1300 1294
             $texto = "NFe CANCELADA";
1301 1295
             $aFont = array('font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B');
@@ -1306,12 +1300,12 @@  discard block
 block discarded – undo
1306 1300
         if ($this->pNotaDPEC() || $this->tpEmis == 4) {
1307 1301
             //DPEC
1308 1302
             $x = 10;
1309
-            $y = $this->hPrint-130;
1303
+            $y = $this->hPrint - 130;
1310 1304
             $h = 25;
1311
-            $w = $maxW-(2*$x);
1305
+            $w = $maxW - (2 * $x);
1312 1306
             $this->pdf->SetTextColor(200, 200, 200);
1313
-            $texto = "DANFE impresso em contingência -\n".
1314
-                     "DPEC regularmente recebido pela Receita\n".
1307
+            $texto = "DANFE impresso em contingência -\n" .
1308
+                     "DPEC regularmente recebido pela Receita\n" .
1315 1309
                      "Federal do Brasil";
1316 1310
             $aFont = array('font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B');
1317 1311
             $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
@@ -1320,22 +1314,22 @@  discard block
 block discarded – undo
1320 1314
         if ($this->pNotaDenegada()) {
1321 1315
             //110 301 302 Denegada
1322 1316
             $x = 10;
1323
-            $y = $this->hPrint-130;
1317
+            $y = $this->hPrint - 130;
1324 1318
             $h = 25;
1325
-            $w = $maxW-(2*$x);
1319
+            $w = $maxW - (2 * $x);
1326 1320
             $this->pdf->SetTextColor(90, 90, 90);
1327 1321
             $texto = "NFe USO DENEGADO";
1328 1322
             $aFont = array('font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B');
1329 1323
             $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1330 1324
             $y += $h;
1331 1325
             $h = 5;
1332
-            $w = $maxW-(2*$x);
1326
+            $w = $maxW - (2 * $x);
1333 1327
             if (isset($this->infProt)) {
1334 1328
                 $xMotivo = $this->infProt->getElementsByTagName("xMotivo")->item(0)->nodeValue;
1335 1329
             } else {
1336 1330
                 $xMotivo = '';
1337 1331
             }
1338
-            $texto = "SEM VALOR FISCAL\n".$xMotivo;
1332
+            $texto = "SEM VALOR FISCAL\n" . $xMotivo;
1339 1333
             $aFont = array('font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B');
1340 1334
             $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1341 1335
             $this->pdf->SetTextColor(0, 0, 0);
@@ -1344,29 +1338,29 @@  discard block
 block discarded – undo
1344 1338
         if ($tpAmb != 1) {
1345 1339
             $x = 10;
1346 1340
             if ($this->orientacao == 'P') {
1347
-                $y = round($this->hPrint*2/3, 0);
1341
+                $y = round($this->hPrint * 2 / 3, 0);
1348 1342
             } else {
1349
-                $y = round($this->hPrint/2, 0);
1343
+                $y = round($this->hPrint / 2, 0);
1350 1344
             }
1351 1345
             $h = 5;
1352
-            $w = $maxW-(2*$x);
1346
+            $w = $maxW - (2 * $x);
1353 1347
             $this->pdf->SetTextColor(90, 90, 90);
1354 1348
             $texto = "SEM VALOR FISCAL";
1355 1349
             $aFont = array('font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B');
1356 1350
             $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1357 1351
             $aFont = array('font'=>$this->fontePadrao, 'size'=>30, 'style'=>'B');
1358 1352
             $texto = "AMBIENTE DE HOMOLOGAÇÃO";
1359
-            $this->pTextBox($x, $y+14, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1353
+            $this->pTextBox($x, $y + 14, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1360 1354
             $this->pdf->SetTextColor(0, 0, 0);
1361 1355
         } else {
1362 1356
             $x = 10;
1363 1357
             if ($this->orientacao == 'P') {
1364
-                $y = round($this->hPrint*2/3, 0);
1358
+                $y = round($this->hPrint * 2 / 3, 0);
1365 1359
             } else {
1366
-                $y = round($this->hPrint/2, 0);
1360
+                $y = round($this->hPrint / 2, 0);
1367 1361
             }//fim orientacao
1368 1362
             $h = 5;
1369
-            $w = $maxW-(2*$x);
1363
+            $w = $maxW - (2 * $x);
1370 1364
             $this->pdf->SetTextColor(90, 90, 90);
1371 1365
             //indicar FALTA DO PROTOCOLO se NFe não for em contingência
1372 1366
             if (($this->tpEmis == 2 || $this->tpEmis == 5) && !$this->pNotaDPEC()) {
@@ -1376,7 +1370,7 @@  discard block
 block discarded – undo
1376 1370
                 $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1377 1371
                 $aFont = array('font'=>$this->fontePadrao, 'size'=>30, 'style'=>'B');
1378 1372
                 $texto = "devido à problemas técnicos";
1379
-                $this->pTextBox($x, $y+12, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1373
+                $this->pTextBox($x, $y + 12, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1380 1374
             } else {
1381 1375
                 if (!isset($this->nfeProc)) {
1382 1376
                     if (!$this->pNotaDPEC()) {
@@ -1387,9 +1381,9 @@  discard block
 block discarded – undo
1387 1381
                     $aFont = array('font'=>$this->fontePadrao, 'size'=>30, 'style'=>'B');
1388 1382
                     $texto = "FALTA PROTOCOLO DE APROVAÇÃO DA SEFAZ";
1389 1383
                     if (!$this->pNotaDPEC()) {
1390
-                        $this->pTextBox($x, $y+12, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1384
+                        $this->pTextBox($x, $y + 12, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1391 1385
                     } else {
1392
-                        $this->pTextBox($x, $y+25, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1386
+                        $this->pTextBox($x, $y + 25, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1393 1387
                     }
1394 1388
                 }//fim nefProc
1395 1389
             }//fim tpEmis
@@ -1424,7 +1418,7 @@  discard block
 block discarded – undo
1424 1418
         $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
1425 1419
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1426 1420
         //NOME / RAZÃO SOCIAL
1427
-        $w = round($maxW*0.61, 0);
1421
+        $w = round($maxW * 0.61, 0);
1428 1422
         $w1 = $w;
1429 1423
         $y += 3;
1430 1424
         $texto = 'NOME / RAZÃO SOCIAL';
@@ -1439,19 +1433,19 @@  discard block
 block discarded – undo
1439 1433
         }
1440 1434
         //CNPJ / CPF
1441 1435
         $x += $w;
1442
-        $w = round($maxW*0.23, 0);
1436
+        $w = round($maxW * 0.23, 0);
1443 1437
         $w2 = $w;
1444 1438
         $texto = 'CNPJ / CPF';
1445 1439
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1446 1440
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1447 1441
         //Pegando valor do CPF/CNPJ
1448
-        if (! empty($this->dest->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1442
+        if (!empty($this->dest->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1449 1443
             $texto = $this->pFormat(
1450 1444
                 $this->dest->getElementsByTagName("CNPJ")->item(0)->nodeValue,
1451 1445
                 "###.###.###/####-##"
1452 1446
             );
1453 1447
         } else {
1454
-            $texto = ! empty($this->dest->getElementsByTagName("CPF")->item(0)->nodeValue) ?
1448
+            $texto = !empty($this->dest->getElementsByTagName("CPF")->item(0)->nodeValue) ?
1455 1449
                     $this->pFormat(
1456 1450
                         $this->dest->getElementsByTagName("CPF")->item(0)->nodeValue,
1457 1451
                         "###.###.###-##"
@@ -1461,15 +1455,15 @@  discard block
 block discarded – undo
1461 1455
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1462 1456
         //DATA DA EMISSÃO
1463 1457
         $x += $w;
1464
-        $w = $maxW-($w1+$w2);
1458
+        $w = $maxW - ($w1 + $w2);
1465 1459
         $wx = $w;
1466 1460
         $texto = 'DATA DA EMISSÃO';
1467 1461
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1468 1462
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1469
-        $dEmi = ! empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
1463
+        $dEmi = !empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
1470 1464
                 $this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue : '';
1471 1465
         if ($dEmi == '') {
1472
-            $dEmi = ! empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
1466
+            $dEmi = !empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
1473 1467
                     $this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue : '';
1474 1468
             $aDemi = explode('T', $dEmi);
1475 1469
             $dEmi = $aDemi[0];
@@ -1482,7 +1476,7 @@  discard block
 block discarded – undo
1482 1476
             $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 1, '');
1483 1477
         }
1484 1478
         //ENDEREÇO
1485
-        $w = round($maxW*0.47, 0);
1479
+        $w = round($maxW * 0.47, 0);
1486 1480
         $w1 = $w;
1487 1481
         $y += $h;
1488 1482
         $x = $oldX;
@@ -1497,7 +1491,7 @@  discard block
 block discarded – undo
1497 1491
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 0, '', true);
1498 1492
         //BAIRRO / DISTRITO
1499 1493
         $x += $w;
1500
-        $w = round($maxW*0.21, 0);
1494
+        $w = round($maxW * 0.21, 0);
1501 1495
         $w2 = $w;
1502 1496
         $texto = 'BAIRRO / DISTRITO';
1503 1497
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
@@ -1507,12 +1501,12 @@  discard block
 block discarded – undo
1507 1501
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1508 1502
         //CEP
1509 1503
         $x += $w;
1510
-        $w = $maxW-$w1-$w2-$wx;
1504
+        $w = $maxW - $w1 - $w2 - $wx;
1511 1505
         $w2 = $w;
1512 1506
         $texto = 'CEP';
1513 1507
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1514 1508
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1515
-        $texto = ! empty($this->dest->getElementsByTagName("CEP")->item(0)->nodeValue) ?
1509
+        $texto = !empty($this->dest->getElementsByTagName("CEP")->item(0)->nodeValue) ?
1516 1510
                 $this->dest->getElementsByTagName("CEP")->item(0)->nodeValue : '';
1517 1511
         $texto = $this->pFormat($texto, "#####-###");
1518 1512
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
@@ -1523,10 +1517,10 @@  discard block
 block discarded – undo
1523 1517
         $texto = 'DATA DA SAÍDA/ENTRADA';
1524 1518
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1525 1519
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1526
-        $dSaiEnt = ! empty($this->ide->getElementsByTagName("dSaiEnt")->item(0)->nodeValue) ?
1520
+        $dSaiEnt = !empty($this->ide->getElementsByTagName("dSaiEnt")->item(0)->nodeValue) ?
1527 1521
                 $this->ide->getElementsByTagName("dSaiEnt")->item(0)->nodeValue : '';
1528 1522
         if ($dSaiEnt == '') {
1529
-            $dSaiEnt = ! empty($this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue) ?
1523
+            $dSaiEnt = !empty($this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue) ?
1530 1524
                     $this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue : '';
1531 1525
             $aDsaient = explode('T', $dSaiEnt);
1532 1526
             $dSaiEnt = $aDsaient[0];
@@ -1543,7 +1537,7 @@  discard block
 block discarded – undo
1543 1537
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1544 1538
         $texto = $this->dest->getElementsByTagName("xMun")->item(0)->nodeValue;
1545 1539
         if (strtoupper(trim($texto)) == "EXTERIOR" && $this->dest->getElementsByTagName("xPais")->length > 0) {
1546
-            $texto .= " - " .  $this->dest->getElementsByTagName("xPais")->item(0)->nodeValue;
1540
+            $texto .= " - " . $this->dest->getElementsByTagName("xPais")->item(0)->nodeValue;
1547 1541
         }
1548 1542
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
1549 1543
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 0, '');
@@ -1558,18 +1552,18 @@  discard block
 block discarded – undo
1558 1552
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1559 1553
         //FONE / FAX
1560 1554
         $x += $w;
1561
-        $w = round(($maxW -$w1-$wx-8)/2, 0);
1555
+        $w = round(($maxW - $w1 - $wx - 8) / 2, 0);
1562 1556
         $w3 = $w;
1563 1557
         $texto = 'FONE / FAX';
1564 1558
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1565 1559
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1566
-        $texto = ! empty($this->dest->getElementsByTagName("fone")->item(0)->nodeValue) ?
1560
+        $texto = !empty($this->dest->getElementsByTagName("fone")->item(0)->nodeValue) ?
1567 1561
                 $this->dest->getElementsByTagName("fone")->item(0)->nodeValue : '';
1568 1562
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
1569 1563
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1570 1564
         //INSCRIÇÃO ESTADUAL
1571 1565
         $x += $w;
1572
-        $w = $maxW -$w1-$wx-8-$w3;
1566
+        $w = $maxW - $w1 - $wx - 8 - $w3;
1573 1567
         $texto = 'INSCRIÇÃO ESTADUAL';
1574 1568
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1575 1569
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -1583,10 +1577,10 @@  discard block
 block discarded – undo
1583 1577
         $texto = 'HORA DA SAÍDA/ENTRADA';
1584 1578
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1585 1579
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1586
-        $hSaiEnt = ! empty($this->ide->getElementsByTagName("hSaiEnt")->item(0)->nodeValue) ?
1580
+        $hSaiEnt = !empty($this->ide->getElementsByTagName("hSaiEnt")->item(0)->nodeValue) ?
1587 1581
                 $this->ide->getElementsByTagName("hSaiEnt")->item(0)->nodeValue : '';
1588 1582
         if ($hSaiEnt == '') {
1589
-            $dhSaiEnt = ! empty($this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue) ?
1583
+            $dhSaiEnt = !empty($this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue) ?
1590 1584
                     $this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue : '';
1591 1585
             $tsDhSaiEnt = $this->pConvertTime($dhSaiEnt);
1592 1586
             if ($tsDhSaiEnt != '') {
@@ -1611,7 +1605,7 @@  discard block
 block discarded – undo
1611 1605
         if (isset($this->cobr)) {
1612 1606
             $fat = $this->cobr->getElementsByTagName("fat")->item(0);
1613 1607
             if (isset($fat)) {
1614
-                $textoIndPag="";
1608
+                $textoIndPag = "";
1615 1609
                 $indPag = $this->pSimpleGetValue($this->ide, "indPag");
1616 1610
                 if ($indPag == 0) {
1617 1611
                     $textoIndPag = "Pagamento à Vista - ";
@@ -1658,7 +1652,7 @@  discard block
 block discarded – undo
1658 1652
     protected function pFaturaDANFE($x, $y)
1659 1653
     {
1660 1654
         $linha = 1;
1661
-        $h = 8+3;
1655
+        $h = 8 + 3;
1662 1656
         $oldx = $x;
1663 1657
         $textoFatura = $this->pGetTextoFatura();
1664 1658
         //verificar se existem duplicatas
@@ -1679,27 +1673,27 @@  discard block
 block discarded – undo
1679 1673
             $dupcont = 0;
1680 1674
             $nFat = $this->dup->length;
1681 1675
             if ($textoFatura !== "" && $this->exibirTextoFatura) {
1682
-                $myH=6;
1676
+                $myH = 6;
1683 1677
                 $myW = $this->wPrint;
1684 1678
                 if ($this->orientacao == 'L') {
1685 1679
                     $myW -= $this->wCanhoto;
1686 1680
                 }
1687 1681
                 $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'');
1688 1682
                 $this->pTextBox($x, $y, $myW, $myH, $textoFatura, $aFont, 'C', 'L', 1, '');
1689
-                $y+=$myH+1;
1683
+                $y += $myH + 1;
1690 1684
             }
1691 1685
             if ($this->orientacao == 'P') {
1692
-                $w = round($this->wPrint/7.018, 0)-1;
1686
+                $w = round($this->wPrint / 7.018, 0) - 1;
1693 1687
             } else {
1694 1688
                 $w = 28;
1695 1689
             }
1696 1690
             $increm = 1;
1697 1691
             foreach ($this->dup as $k => $d) {
1698
-                $nDup = ! empty($this->dup->item($k)->getElementsByTagName('nDup')->item(0)->nodeValue) ?
1692
+                $nDup = !empty($this->dup->item($k)->getElementsByTagName('nDup')->item(0)->nodeValue) ?
1699 1693
                         $this->dup->item($k)->getElementsByTagName('nDup')->item(0)->nodeValue : '';
1700
-                $dDup = ! empty($this->dup->item($k)->getElementsByTagName('dVenc')->item(0)->nodeValue) ?
1694
+                $dDup = !empty($this->dup->item($k)->getElementsByTagName('dVenc')->item(0)->nodeValue) ?
1701 1695
                         $this->pYmd2dmy($this->dup->item($k)->getElementsByTagName('dVenc')->item(0)->nodeValue) : '';
1702
-                $vDup = ! empty($this->dup->item($k)->getElementsByTagName('vDup')->item(0)->nodeValue) ?
1696
+                $vDup = !empty($this->dup->item($k)->getElementsByTagName('vDup')->item(0)->nodeValue) ?
1703 1697
                         'R$ ' . number_format(
1704 1698
                             $this->dup->item($k)->getElementsByTagName('vDup')->item(0)->nodeValue,
1705 1699
                             2,
@@ -1708,14 +1702,14 @@  discard block
 block discarded – undo
1708 1702
                         ) : '';
1709 1703
                 $h = 8;
1710 1704
                 $texto = '';
1711
-                if ($nDup!='0' && $nDup!='') {
1705
+                if ($nDup != '0' && $nDup != '') {
1712 1706
                     $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1713 1707
                     $this->pTextBox($x, $y, $w, $h, 'Num.', $aFont, 'T', 'L', 1, '');
1714 1708
                     $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
1715 1709
                     $this->pTextBox($x, $y, $w, $h, $nDup, $aFont, 'T', 'R', 0, '');
1716 1710
                 } else {
1717 1711
                     $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1718
-                    $this->pTextBox($x, $y, $w, $h, ($dupcont+1)."", $aFont, 'T', 'L', 1, '');
1712
+                    $this->pTextBox($x, $y, $w, $h, ($dupcont + 1) . "", $aFont, 'T', 'L', 1, '');
1719 1713
                 }
1720 1714
                 $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1721 1715
                 $this->pTextBox($x, $y, $w, $h, 'Venc.', $aFont, 'C', 'L', 0, '');
@@ -1725,7 +1719,7 @@  discard block
 block discarded – undo
1725 1719
                 $this->pTextBox($x, $y, $w, $h, 'Valor', $aFont, 'B', 'L', 0, '');
1726 1720
                 $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
1727 1721
                 $this->pTextBox($x, $y, $w, $h, $vDup, $aFont, 'B', 'R', 0, '');
1728
-                $x += $w+$increm;
1722
+                $x += $w + $increm;
1729 1723
                 $dupcont += 1;
1730 1724
                 if ($this->orientacao == 'P') {
1731 1725
                     $maxDupCont = 6;
@@ -1747,10 +1741,10 @@  discard block
 block discarded – undo
1747 1741
                 $y -= 9;
1748 1742
                 $linha--;
1749 1743
             }
1750
-            return ($y+$h);
1744
+            return ($y + $h);
1751 1745
         } else {
1752 1746
             $linha = 0;
1753
-            return ($y-2);
1747
+            return ($y - 2);
1754 1748
         }
1755 1749
     } //fim da função faturaDANFE
1756 1750
 
@@ -1862,7 +1856,7 @@  discard block
 block discarded – undo
1862 1856
         }
1863 1857
         $x = $this->pImpostoDanfeHelper($x, $y, $w, $h, "V. TOTAL DA NOTA", "vNF");
1864 1858
 
1865
-        return ($y+$h);
1859
+        return ($y + $h);
1866 1860
     } //fim impostoDANFE
1867 1861
 
1868 1862
     /**
@@ -1890,13 +1884,13 @@  discard block
 block discarded – undo
1890 1884
         $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
1891 1885
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1892 1886
         //NOME / RAZÃO SOCIAL
1893
-        $w1 = $maxW*0.29;
1887
+        $w1 = $maxW * 0.29;
1894 1888
         $y += 3;
1895 1889
         $texto = 'NOME / RAZÃO SOCIAL';
1896 1890
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1897 1891
         $this->pTextBox($x, $y, $w1, $h, $texto, $aFont, 'T', 'L', 1, '');
1898 1892
         if (isset($this->transporta)) {
1899
-            $texto = ! empty($this->transporta->getElementsByTagName("xNome")->item(0)->nodeValue) ?
1893
+            $texto = !empty($this->transporta->getElementsByTagName("xNome")->item(0)->nodeValue) ?
1900 1894
                     $this->transporta->getElementsByTagName("xNome")->item(0)->nodeValue : '';
1901 1895
         } else {
1902 1896
             $texto = '';
@@ -1905,11 +1899,11 @@  discard block
 block discarded – undo
1905 1899
         $this->pTextBox($x, $y, $w1, $h, $texto, $aFont, 'B', 'L', 0, '');
1906 1900
         //FRETE POR CONTA
1907 1901
         $x += $w1;
1908
-        $w2 = $maxW*0.15;
1902
+        $w2 = $maxW * 0.15;
1909 1903
         $texto = 'FRETE POR CONTA';
1910 1904
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1911 1905
         $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
1912
-        $tipoFrete = ! empty($this->transp->getElementsByTagName("modFrete")->item(0)->nodeValue) ?
1906
+        $tipoFrete = !empty($this->transp->getElementsByTagName("modFrete")->item(0)->nodeValue) ?
1913 1907
                 $this->transp->getElementsByTagName("modFrete")->item(0)->nodeValue : '0';
1914 1908
         switch ($tipoFrete) {
1915 1909
             case 0:
@@ -1933,7 +1927,7 @@  discard block
 block discarded – undo
1933 1927
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1934 1928
         $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
1935 1929
         if (isset($this->veicTransp)) {
1936
-            $texto = ! empty($this->veicTransp->getElementsByTagName("RNTC")->item(0)->nodeValue) ?
1930
+            $texto = !empty($this->veicTransp->getElementsByTagName("RNTC")->item(0)->nodeValue) ?
1937 1931
                     $this->veicTransp->getElementsByTagName("RNTC")->item(0)->nodeValue : '';
1938 1932
         } else {
1939 1933
             $texto = '';
@@ -1946,10 +1940,10 @@  discard block
 block discarded – undo
1946 1940
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1947 1941
         $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
1948 1942
         if (isset($this->veicTransp)) {
1949
-            $texto = ! empty($this->veicTransp->getElementsByTagName("placa")->item(0)->nodeValue) ?
1943
+            $texto = !empty($this->veicTransp->getElementsByTagName("placa")->item(0)->nodeValue) ?
1950 1944
                     $this->veicTransp->getElementsByTagName("placa")->item(0)->nodeValue : '';
1951 1945
         } elseif (isset($this->reboque)) {
1952
-            $texto = ! empty($this->reboque->getElementsByTagName("placa")->item(0)->nodeValue) ?
1946
+            $texto = !empty($this->reboque->getElementsByTagName("placa")->item(0)->nodeValue) ?
1953 1947
                     $this->reboque->getElementsByTagName("placa")->item(0)->nodeValue : '';
1954 1948
         } else {
1955 1949
             $texto = '';
@@ -1958,15 +1952,15 @@  discard block
 block discarded – undo
1958 1952
         $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'B', 'C', 0, '');
1959 1953
         //UF
1960 1954
         $x += $w2;
1961
-        $w3 = round($maxW*0.04, 0);
1955
+        $w3 = round($maxW * 0.04, 0);
1962 1956
         $texto = 'UF';
1963 1957
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1964 1958
         $this->pTextBox($x, $y, $w3, $h, $texto, $aFont, 'T', 'L', 1, '');
1965 1959
         if (isset($this->veicTransp)) {
1966
-            $texto = ! empty($this->veicTransp->getElementsByTagName("UF")->item(0)->nodeValue) ?
1960
+            $texto = !empty($this->veicTransp->getElementsByTagName("UF")->item(0)->nodeValue) ?
1967 1961
                     $this->veicTransp->getElementsByTagName("UF")->item(0)->nodeValue : '';
1968 1962
         } elseif (isset($this->reboque)) {
1969
-            $texto = ! empty($this->reboque->getElementsByTagName("UF")->item(0)->nodeValue) ?
1963
+            $texto = !empty($this->reboque->getElementsByTagName("UF")->item(0)->nodeValue) ?
1970 1964
                     $this->reboque->getElementsByTagName("UF")->item(0)->nodeValue : '';
1971 1965
         } else {
1972 1966
             $texto = '';
@@ -1975,18 +1969,18 @@  discard block
 block discarded – undo
1975 1969
         $this->pTextBox($x, $y, $w3, $h, $texto, $aFont, 'B', 'C', 0, '');
1976 1970
         //CNPJ / CPF
1977 1971
         $x += $w3;
1978
-        $w = $maxW-($w1+3*$w2+$w3);
1972
+        $w = $maxW - ($w1 + 3 * $w2 + $w3);
1979 1973
         $texto = 'CNPJ / CPF';
1980 1974
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1981 1975
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1982 1976
         if (isset($this->transporta)) {
1983
-            $texto = ! empty($this->transporta->getElementsByTagName("CNPJ")->item(0)->nodeValue) ?
1977
+            $texto = !empty($this->transporta->getElementsByTagName("CNPJ")->item(0)->nodeValue) ?
1984 1978
                     $this->pFormat(
1985 1979
                         $this->transporta->getElementsByTagName("CNPJ")->item(0)->nodeValue,
1986 1980
                         "##.###.###/####-##"
1987 1981
                     ) : '';
1988 1982
             if ($texto == '') {
1989
-                $texto = ! empty($this->transporta->getElementsByTagName("CPF")->item(0)->nodeValue) ?
1983
+                $texto = !empty($this->transporta->getElementsByTagName("CPF")->item(0)->nodeValue) ?
1990 1984
                         $this->pFormat(
1991 1985
                             $this->transporta->getElementsByTagName("CPF")->item(0)->nodeValue,
1992 1986
                             "###.###.###-##"
@@ -2002,12 +1996,12 @@  discard block
 block discarded – undo
2002 1996
         $y += $h;
2003 1997
         $x = $oldX;
2004 1998
         $h = 7;
2005
-        $w1 = $maxW*0.44;
1999
+        $w1 = $maxW * 0.44;
2006 2000
         $texto = 'ENDEREÇO';
2007 2001
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2008 2002
         $this->pTextBox($x, $y, $w1, $h, $texto, $aFont, 'T', 'L', 1, '');
2009 2003
         if (isset($this->transporta)) {
2010
-            $texto = ! empty($this->transporta->getElementsByTagName("xEnder")->item(0)->nodeValue) ?
2004
+            $texto = !empty($this->transporta->getElementsByTagName("xEnder")->item(0)->nodeValue) ?
2011 2005
                     $this->transporta->getElementsByTagName("xEnder")->item(0)->nodeValue : '';
2012 2006
         } else {
2013 2007
             $texto = '';
@@ -2016,12 +2010,12 @@  discard block
 block discarded – undo
2016 2010
         $this->pTextBox($x, $y, $w1, $h, $texto, $aFont, 'B', 'L', 0, '');
2017 2011
         //MUNICÍPIO
2018 2012
         $x += $w1;
2019
-        $w2 = round($maxW*0.30, 0);
2013
+        $w2 = round($maxW * 0.30, 0);
2020 2014
         $texto = 'MUNICÍPIO';
2021 2015
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2022 2016
         $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
2023 2017
         if (isset($this->transporta)) {
2024
-            $texto = ! empty($this->transporta->getElementsByTagName("xMun")->item(0)->nodeValue) ?
2018
+            $texto = !empty($this->transporta->getElementsByTagName("xMun")->item(0)->nodeValue) ?
2025 2019
                     $this->transporta->getElementsByTagName("xMun")->item(0)->nodeValue : '';
2026 2020
         } else {
2027 2021
             $texto = '';
@@ -2030,12 +2024,12 @@  discard block
 block discarded – undo
2030 2024
         $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'B', 'C', 0, '');
2031 2025
         //UF
2032 2026
         $x += $w2;
2033
-        $w3 = round($maxW*0.04, 0);
2027
+        $w3 = round($maxW * 0.04, 0);
2034 2028
         $texto = 'UF';
2035 2029
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2036 2030
         $this->pTextBox($x, $y, $w3, $h, $texto, $aFont, 'T', 'L', 1, '');
2037 2031
         if (isset($this->transporta)) {
2038
-            $texto = ! empty($this->transporta->getElementsByTagName("UF")->item(0)->nodeValue) ?
2032
+            $texto = !empty($this->transporta->getElementsByTagName("UF")->item(0)->nodeValue) ?
2039 2033
                     $this->transporta->getElementsByTagName("UF")->item(0)->nodeValue : '';
2040 2034
         } else {
2041 2035
             $texto = '';
@@ -2044,13 +2038,13 @@  discard block
 block discarded – undo
2044 2038
         $this->pTextBox($x, $y, $w3, $h, $texto, $aFont, 'B', 'C', 0, '');
2045 2039
         //INSCRIÇÃO ESTADUAL
2046 2040
         $x += $w3;
2047
-        $w = $maxW-($w1+$w2+$w3);
2041
+        $w = $maxW - ($w1 + $w2 + $w3);
2048 2042
         $texto = 'INSCRIÇÃO ESTADUAL';
2049 2043
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2050 2044
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
2051 2045
         $texto = '';
2052 2046
         if (isset($this->transporta)) {
2053
-            if (! empty($this->transporta->getElementsByTagName("IE")->item(0)->nodeValue)) {
2047
+            if (!empty($this->transporta->getElementsByTagName("IE")->item(0)->nodeValue)) {
2054 2048
                 $texto = $this->transporta->getElementsByTagName("IE")->item(0)->nodeValue;
2055 2049
             }
2056 2050
         }
@@ -2063,16 +2057,16 @@  discard block
 block discarded – undo
2063 2057
         $marca = '';
2064 2058
         $numero = '';
2065 2059
         $texto = '';
2066
-        $pesoBruto=0;
2067
-        $pesoLiquido=0;
2060
+        $pesoBruto = 0;
2061
+        $pesoLiquido = 0;
2068 2062
         foreach ($volumes as $volume) {
2069
-            $quantidade += ! empty($volume->getElementsByTagName("qVol")->item(0)->nodeValue) ?
2063
+            $quantidade += !empty($volume->getElementsByTagName("qVol")->item(0)->nodeValue) ?
2070 2064
                     $volume->getElementsByTagName("qVol")->item(0)->nodeValue : 0;
2071
-            $pesoBruto += ! empty($volume->getElementsByTagName("pesoB")->item(0)->nodeValue) ?
2065
+            $pesoBruto += !empty($volume->getElementsByTagName("pesoB")->item(0)->nodeValue) ?
2072 2066
                     $volume->getElementsByTagName("pesoB")->item(0)->nodeValue : 0;
2073
-            $pesoLiquido += ! empty($volume->getElementsByTagName("pesoL")->item(0)->nodeValue) ?
2067
+            $pesoLiquido += !empty($volume->getElementsByTagName("pesoL")->item(0)->nodeValue) ?
2074 2068
                     $volume->getElementsByTagName("pesoL")->item(0)->nodeValue : 0;
2075
-            $texto = ! empty($this->transp->getElementsByTagName("esp")->item(0)->nodeValue) ?
2069
+            $texto = !empty($this->transp->getElementsByTagName("esp")->item(0)->nodeValue) ?
2076 2070
                     $this->transp->getElementsByTagName("esp")->item(0)->nodeValue : '';
2077 2071
             if ($texto != $especie && $especie != '') {
2078 2072
                 //tem várias especies
@@ -2080,7 +2074,7 @@  discard block
 block discarded – undo
2080 2074
             } else {
2081 2075
                 $especie = $texto;
2082 2076
             }
2083
-            $texto = ! empty($this->transp->getElementsByTagName("marca")->item(0)->nodeValue) ?
2077
+            $texto = !empty($this->transp->getElementsByTagName("marca")->item(0)->nodeValue) ?
2084 2078
                     $this->transp->getElementsByTagName("marca")->item(0)->nodeValue : '';
2085 2079
             if ($texto != $marca && $marca != '') {
2086 2080
                 //tem várias especies
@@ -2088,7 +2082,7 @@  discard block
 block discarded – undo
2088 2082
             } else {
2089 2083
                 $marca = $texto;
2090 2084
             }
2091
-            $texto = ! empty($this->transp->getElementsByTagName("nVol")->item(0)->nodeValue) ?
2085
+            $texto = !empty($this->transp->getElementsByTagName("nVol")->item(0)->nodeValue) ?
2092 2086
                     $this->transp->getElementsByTagName("nVol")->item(0)->nodeValue : '';
2093 2087
             if ($texto != $numero && $numero != '') {
2094 2088
                 //tem várias especies
@@ -2103,7 +2097,7 @@  discard block
 block discarded – undo
2103 2097
         $y += $h;
2104 2098
         $x = $oldX;
2105 2099
         $h = 7;
2106
-        $w1 = round($maxW*0.10, 0);
2100
+        $w1 = round($maxW * 0.10, 0);
2107 2101
         $texto = 'QUANTIDADE';
2108 2102
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2109 2103
         $this->pTextBox($x, $y, $w1, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -2114,7 +2108,7 @@  discard block
 block discarded – undo
2114 2108
         }
2115 2109
         //ESPÉCIE
2116 2110
         $x += $w1;
2117
-        $w2 = round($maxW*0.17, 0);
2111
+        $w2 = round($maxW * 0.17, 0);
2118 2112
         $texto = 'ESPÉCIE';
2119 2113
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2120 2114
         $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -2126,7 +2120,7 @@  discard block
 block discarded – undo
2126 2120
         $texto = 'MARCA';
2127 2121
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2128 2122
         $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
2129
-        $texto = ! empty($this->transp->getElementsByTagName("marca")->item(0)->nodeValue) ?
2123
+        $texto = !empty($this->transp->getElementsByTagName("marca")->item(0)->nodeValue) ?
2130 2124
                 $this->transp->getElementsByTagName("marca")->item(0)->nodeValue : '';
2131 2125
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
2132 2126
         $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'B', 'C', 0, '');
@@ -2140,7 +2134,7 @@  discard block
 block discarded – undo
2140 2134
         $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'B', 'C', 0, '');
2141 2135
         //PESO BRUTO
2142 2136
         $x += $w2;
2143
-        $w3 = round($maxW*0.20, 0);
2137
+        $w3 = round($maxW * 0.20, 0);
2144 2138
         $texto = 'PESO BRUTO';
2145 2139
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2146 2140
         $this->pTextBox($x, $y, $w3, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -2153,7 +2147,7 @@  discard block
 block discarded – undo
2153 2147
         $this->pTextBox($x, $y, $w3, $h, $texto, $aFont, 'B', 'R', 0, '');
2154 2148
         //PESO LÍQUIDO
2155 2149
         $x += $w3;
2156
-        $w = $maxW -($w1+3*$w2+$w3);
2150
+        $w = $maxW - ($w1 + 3 * $w2 + $w3);
2157 2151
         $texto = 'PESO LÍQUIDO';
2158 2152
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2159 2153
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -2164,7 +2158,7 @@  discard block
 block discarded – undo
2164 2158
         }
2165 2159
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
2166 2160
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'R', 0, '');
2167
-        return ($y+$h);
2161
+        return ($y + $h);
2168 2162
     } //fim transporteDANFE
2169 2163
 
2170 2164
 
@@ -2176,7 +2170,7 @@  discard block
 block discarded – undo
2176 2170
             return "";
2177 2171
         }
2178 2172
         $valor_original = $valor_original->nodeValue;
2179
-        $valor = ! empty($valor_original) ? number_format($valor_original, 2, ",", ".") : '';
2173
+        $valor = !empty($valor_original) ? number_format($valor_original, 2, ",", ".") : '';
2180 2174
 
2181 2175
         if ($valor != "") {
2182 2176
             return sprintf($formato, $valor);
@@ -2214,13 +2208,13 @@  discard block
 block discarded – undo
2214 2208
             $impostos .= $this->pDescricaoProdutoHelper($ICMSUFDest, "vICMSUFDest", " vICMSUFDest=%s");
2215 2209
             $impostos .= $this->pDescricaoProdutoHelper($ICMSUFDest, "vICMSUFRemet", " vICMSUFRemet=%s");
2216 2210
         }
2217
-        $infAdProd = ! empty($itemProd->getElementsByTagName('infAdProd')->item(0)->nodeValue) ?
2211
+        $infAdProd = !empty($itemProd->getElementsByTagName('infAdProd')->item(0)->nodeValue) ?
2218 2212
                 substr($this->pAnfavea($itemProd->getElementsByTagName('infAdProd')->item(0)->nodeValue), 0, 500) : '';
2219
-        if (! empty($infAdProd)) {
2213
+        if (!empty($infAdProd)) {
2220 2214
             $infAdProd = trim($infAdProd);
2221 2215
             $infAdProd .= ' ';
2222 2216
         }
2223
-        $medTxt='';
2217
+        $medTxt = '';
2224 2218
         $med = $prod->getElementsByTagName("med");
2225 2219
         if (isset($med)) {
2226 2220
             $i = 0;
@@ -2233,14 +2227,14 @@  discard block
 block discarded – undo
2233 2227
                 $i++;
2234 2228
             }
2235 2229
             if ($medTxt != '') {
2236
-                $medTxt.= ' ';
2230
+                $medTxt .= ' ';
2237 2231
             }
2238 2232
         }
2239 2233
         //NT2013.006 FCI
2240
-        $nFCI = (! empty($itemProd->getElementsByTagName('nFCI')->item(0)->nodeValue)) ?
2241
-                ' FCI:'.$itemProd->getElementsByTagName('nFCI')->item(0)->nodeValue : '';
2242
-        $tmp_ad=$infAdProd . ($this->descProdInfoComplemento ? $medTxt . $impostos . $nFCI : '');
2243
-        $texto = $prod->getElementsByTagName("xProd")->item(0)->nodeValue . (strlen($tmp_ad)!=0?"\n    ".$tmp_ad:'');
2234
+        $nFCI = (!empty($itemProd->getElementsByTagName('nFCI')->item(0)->nodeValue)) ?
2235
+                ' FCI:' . $itemProd->getElementsByTagName('nFCI')->item(0)->nodeValue : '';
2236
+        $tmp_ad = $infAdProd . ($this->descProdInfoComplemento ? $medTxt . $impostos . $nFCI : '');
2237
+        $texto = $prod->getElementsByTagName("xProd")->item(0)->nodeValue . (strlen($tmp_ad) != 0 ? "\n    " . $tmp_ad : '');
2244 2238
         if ($this->descProdQuebraLinha) {
2245 2239
             $texto = str_replace(";", "\n", $texto);
2246 2240
         }
@@ -2288,104 +2282,104 @@  discard block
 block discarded – undo
2288 2282
         // cabecalho LOOP COM OS DADOS DOS PRODUTOS
2289 2283
         //CÓDIGO PRODUTO
2290 2284
         $texto = "CÓDIGO PRODUTO";
2291
-        $w1 = round($w*0.09, 0);
2285
+        $w1 = round($w * 0.09, 0);
2292 2286
         $h = 4;
2293 2287
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2294 2288
         $this->pTextBox($x, $y, $w1, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2295
-        $this->pdf->Line($x+$w1, $y, $x+$w1, $y+$hmax);
2289
+        $this->pdf->Line($x + $w1, $y, $x + $w1, $y + $hmax);
2296 2290
         //DESCRIÇÃO DO PRODUTO / SERVIÇO
2297 2291
         $x += $w1;
2298
-        $w2 = round($w*0.28, 0);
2292
+        $w2 = round($w * 0.28, 0);
2299 2293
         $texto = 'DESCRIÇÃO DO PRODUTO / SERVIÇO';
2300 2294
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2301 2295
         $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2302
-        $this->pdf->Line($x+$w2, $y, $x+$w2, $y+$hmax);
2296
+        $this->pdf->Line($x + $w2, $y, $x + $w2, $y + $hmax);
2303 2297
         //NCM/SH
2304 2298
         $x += $w2;
2305
-        $w3 = round($w*0.06, 0);
2299
+        $w3 = round($w * 0.06, 0);
2306 2300
         $texto = 'NCM/SH';
2307 2301
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2308 2302
         $this->pTextBox($x, $y, $w3, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2309
-        $this->pdf->Line($x+$w3, $y, $x+$w3, $y+$hmax);
2303
+        $this->pdf->Line($x + $w3, $y, $x + $w3, $y + $hmax);
2310 2304
         //O/CST ou O/CSOSN
2311 2305
         $x += $w3;
2312
-        $w4 = round($w*0.05, 0);
2313
-        $texto = 'O/CSOSN';//Regime do Simples CRT = 1 ou CRT = 2
2306
+        $w4 = round($w * 0.05, 0);
2307
+        $texto = 'O/CSOSN'; //Regime do Simples CRT = 1 ou CRT = 2
2314 2308
         if ($this->pSimpleGetValue($this->emit, 'CRT') == '3') {
2315
-             $texto = 'O/CST';//Regime Normal
2309
+             $texto = 'O/CST'; //Regime Normal
2316 2310
         }
2317 2311
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2318 2312
         $this->pTextBox($x, $y, $w4, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2319
-        $this->pdf->Line($x+$w4, $y, $x+$w4, $y+$hmax);
2313
+        $this->pdf->Line($x + $w4, $y, $x + $w4, $y + $hmax);
2320 2314
         //CFOP
2321 2315
         $x += $w4;
2322
-        $w5 = round($w*0.04, 0);
2316
+        $w5 = round($w * 0.04, 0);
2323 2317
         $texto = 'CFOP';
2324 2318
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2325 2319
         $this->pTextBox($x, $y, $w5, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2326
-        $this->pdf->Line($x+$w5, $y, $x+$w5, $y+$hmax);
2320
+        $this->pdf->Line($x + $w5, $y, $x + $w5, $y + $hmax);
2327 2321
         //UN
2328 2322
         $x += $w5;
2329
-        $w6 = round($w*0.03, 0);
2323
+        $w6 = round($w * 0.03, 0);
2330 2324
         $texto = 'UN';
2331 2325
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2332 2326
         $this->pTextBox($x, $y, $w6, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2333
-        $this->pdf->Line($x+$w6, $y, $x+$w6, $y+$hmax);
2327
+        $this->pdf->Line($x + $w6, $y, $x + $w6, $y + $hmax);
2334 2328
         //QUANT
2335 2329
         $x += $w6;
2336
-        $w7 = round($w*0.07, 0);
2330
+        $w7 = round($w * 0.07, 0);
2337 2331
         $texto = 'QUANT';
2338 2332
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2339 2333
         $this->pTextBox($x, $y, $w7, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2340
-        $this->pdf->Line($x+$w7, $y, $x+$w7, $y+$hmax);
2334
+        $this->pdf->Line($x + $w7, $y, $x + $w7, $y + $hmax);
2341 2335
         //VALOR UNIT
2342 2336
         $x += $w7;
2343
-        $w8 = round($w*0.06, 0);
2337
+        $w8 = round($w * 0.06, 0);
2344 2338
         $texto = 'VALOR UNIT';
2345 2339
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2346 2340
         $this->pTextBox($x, $y, $w8, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2347
-        $this->pdf->Line($x+$w8, $y, $x+$w8, $y+$hmax);
2341
+        $this->pdf->Line($x + $w8, $y, $x + $w8, $y + $hmax);
2348 2342
         //VALOR TOTAL
2349 2343
         $x += $w8;
2350
-        $w9 = round($w*0.06, 0);
2344
+        $w9 = round($w * 0.06, 0);
2351 2345
         $texto = 'VALOR TOTAL';
2352 2346
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2353 2347
         $this->pTextBox($x, $y, $w9, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2354
-        $this->pdf->Line($x+$w9, $y, $x+$w9, $y+$hmax);
2348
+        $this->pdf->Line($x + $w9, $y, $x + $w9, $y + $hmax);
2355 2349
         //B.CÁLC ICMS
2356 2350
         $x += $w9;
2357
-        $w10 = round($w*0.06, 0);
2351
+        $w10 = round($w * 0.06, 0);
2358 2352
         $texto = 'B.CÁLC ICMS';
2359 2353
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2360 2354
         $this->pTextBox($x, $y, $w10, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2361
-        $this->pdf->Line($x+$w10, $y, $x+$w10, $y+$hmax);
2355
+        $this->pdf->Line($x + $w10, $y, $x + $w10, $y + $hmax);
2362 2356
         //VALOR ICMS
2363 2357
         $x += $w10;
2364
-        $w11 = round($w*0.06, 0);
2358
+        $w11 = round($w * 0.06, 0);
2365 2359
         $texto = 'VALOR ICMS';
2366 2360
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2367 2361
         $this->pTextBox($x, $y, $w11, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2368
-        $this->pdf->Line($x+$w11, $y, $x+$w11, $y+$hmax);
2362
+        $this->pdf->Line($x + $w11, $y, $x + $w11, $y + $hmax);
2369 2363
         //VALOR IPI
2370 2364
         $x += $w11;
2371
-        $w12 = round($w*0.05, 0);
2365
+        $w12 = round($w * 0.05, 0);
2372 2366
         $texto = 'VALOR IPI';
2373 2367
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2374 2368
         $this->pTextBox($x, $y, $w12, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2375
-        $this->pdf->Line($x+$w12, $y, $x+$w12, $y+$hmax);
2369
+        $this->pdf->Line($x + $w12, $y, $x + $w12, $y + $hmax);
2376 2370
         //ALÍQ. ICMS
2377 2371
         $x += $w12;
2378
-        $w13 = round($w*0.035, 0);
2372
+        $w13 = round($w * 0.035, 0);
2379 2373
         $texto = 'ALÍQ. ICMS';
2380 2374
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2381 2375
         $this->pTextBox($x, $y, $w13, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2382
-        $this->pdf->Line($x+$w13, $y, $x+$w13, $y+$hmax);
2376
+        $this->pdf->Line($x + $w13, $y, $x + $w13, $y + $hmax);
2383 2377
         //ALÍQ. IPI
2384 2378
         $x += $w13;
2385
-        $w14 = $w-($w1+$w2+$w3+$w4+$w5+$w6+$w7+$w8+$w9+$w10+$w11+$w12+$w13);
2379
+        $w14 = $w - ($w1 + $w2 + $w3 + $w4 + $w5 + $w6 + $w7 + $w8 + $w9 + $w10 + $w11 + $w12 + $w13);
2386 2380
         $texto = 'ALÍQ. IPI';
2387 2381
         $this->pTextBox($x, $y, $w14, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2388
-        $this->pdf->Line($oldX, $y+$h+1, $oldX + $w, $y+$h+1);
2382
+        $this->pdf->Line($oldX, $y + $h + 1, $oldX + $w, $y + $h + 1);
2389 2383
         $y += 5;
2390 2384
         //##################################################################################
2391 2385
         // LOOP COM OS DADOS DOS PRODUTOS
@@ -2402,7 +2396,7 @@  discard block
 block discarded – undo
2402 2396
                 $IPI  = $imposto->getElementsByTagName("IPI")->item(0);
2403 2397
                 $textoProduto = $this->pDescricaoProduto($thisItem);
2404 2398
                 $linhaDescr = $this->pGetNumLines($textoProduto, $w2, $aFont);
2405
-                $h = round(($linhaDescr * $this->pdf->fontSize)+ ($linhaDescr * 0.5), 2);
2399
+                $h = round(($linhaDescr * $this->pdf->fontSize) + ($linhaDescr * 0.5), 2);
2406 2400
                 $hUsado += $h;
2407 2401
                 if ($pag != $totpag) {
2408 2402
                     if ($hUsado >= $hmax && $i < $totItens) {
@@ -2412,11 +2406,11 @@  discard block
 block discarded – undo
2412 2406
                         break;
2413 2407
                     }
2414 2408
                 }
2415
-                $y_linha=$y+$h;
2409
+                $y_linha = $y + $h;
2416 2410
                 // linha entre itens
2417 2411
                 $this->pdf->DashedHLine($oldX, $y_linha, $w, 0.1, 120);
2418 2412
                 //corrige o x
2419
-                $x=$oldX;
2413
+                $x = $oldX;
2420 2414
                 //codigo do produto
2421 2415
                 $texto = $prod->getElementsByTagName("cProd")->item(0)->nodeValue;
2422 2416
                 $this->pTextBox($x, $y, $w1, $h, $texto, $aFont, 'T', 'C', 0, '');
@@ -2429,16 +2423,16 @@  discard block
 block discarded – undo
2429 2423
                 }
2430 2424
                 $x += $w2;
2431 2425
                 //NCM
2432
-                $texto = ! empty($prod->getElementsByTagName("NCM")->item(0)->nodeValue) ?
2426
+                $texto = !empty($prod->getElementsByTagName("NCM")->item(0)->nodeValue) ?
2433 2427
                         $prod->getElementsByTagName("NCM")->item(0)->nodeValue : '';
2434 2428
                 $this->pTextBox($x, $y, $w3, $h, $texto, $aFont, 'T', 'C', 0, '');
2435 2429
                 $x += $w3;
2436 2430
                 //CST
2437 2431
                 if (isset($ICMS)) {
2438
-                    $origem =  $this->pSimpleGetValue($ICMS, "orig");
2439
-                    $cst =  $this->pSimpleGetValue($ICMS, "CST");
2440
-                    $csosn =  $this->pSimpleGetValue($ICMS, "CSOSN");
2441
-                    $texto = $origem.$cst.$csosn;
2432
+                    $origem = $this->pSimpleGetValue($ICMS, "orig");
2433
+                    $cst = $this->pSimpleGetValue($ICMS, "CST");
2434
+                    $csosn = $this->pSimpleGetValue($ICMS, "CSOSN");
2435
+                    $texto = $origem . $cst . $csosn;
2442 2436
                     $this->pTextBox($x, $y, $w4, $h, $texto, $aFont, 'T', 'C', 0, '');
2443 2437
                 }
2444 2438
                 //CFOP
@@ -2472,7 +2466,7 @@  discard block
 block discarded – undo
2472 2466
                 //Valor da Base de calculo
2473 2467
                 $x += $w9;
2474 2468
                 if (isset($ICMS)) {
2475
-                    $texto = ! empty($ICMS->getElementsByTagName("vBC")->item(0)->nodeValue) ?
2469
+                    $texto = !empty($ICMS->getElementsByTagName("vBC")->item(0)->nodeValue) ?
2476 2470
                             number_format(
2477 2471
                                 $ICMS->getElementsByTagName("vBC")->item(0)->nodeValue,
2478 2472
                                 2,
@@ -2484,7 +2478,7 @@  discard block
 block discarded – undo
2484 2478
                 //Valor do ICMS
2485 2479
                 $x += $w10;
2486 2480
                 if (isset($ICMS)) {
2487
-                    $texto = ! empty($ICMS->getElementsByTagName("vICMS")->item(0)->nodeValue) ?
2481
+                    $texto = !empty($ICMS->getElementsByTagName("vICMS")->item(0)->nodeValue) ?
2488 2482
                             number_format(
2489 2483
                                 $ICMS->getElementsByTagName("vICMS")->item(0)->nodeValue,
2490 2484
                                 2,
@@ -2496,8 +2490,8 @@  discard block
 block discarded – undo
2496 2490
                 //Valor do IPI
2497 2491
                 $x += $w11;
2498 2492
                 if (isset($IPI)) {
2499
-                    $texto = ! empty($IPI->getElementsByTagName("vIPI")->item(0)->nodeValue) ?
2500
-                            number_format($IPI->getElementsByTagName("vIPI")->item(0)->nodeValue, 2, ",", ".") :'';
2493
+                    $texto = !empty($IPI->getElementsByTagName("vIPI")->item(0)->nodeValue) ?
2494
+                            number_format($IPI->getElementsByTagName("vIPI")->item(0)->nodeValue, 2, ",", ".") : '';
2501 2495
                 } else {
2502 2496
                     $texto = '';
2503 2497
                 }
@@ -2505,7 +2499,7 @@  discard block
 block discarded – undo
2505 2499
                 // %ICMS
2506 2500
                 $x += $w12;
2507 2501
                 if (isset($ICMS)) {
2508
-                    $texto = ! empty($ICMS->getElementsByTagName("pICMS")->item(0)->nodeValue) ?
2502
+                    $texto = !empty($ICMS->getElementsByTagName("pICMS")->item(0)->nodeValue) ?
2509 2503
                             number_format(
2510 2504
                                 $ICMS->getElementsByTagName("pICMS")->item(0)->nodeValue,
2511 2505
                                 2,
@@ -2517,7 +2511,7 @@  discard block
 block discarded – undo
2517 2511
                 //%IPI
2518 2512
                 $x += $w13;
2519 2513
                 if (isset($IPI)) {
2520
-                    $texto = ! empty($IPI->getElementsByTagName("pIPI")->item(0)->nodeValue) ?
2514
+                    $texto = !empty($IPI->getElementsByTagName("pIPI")->item(0)->nodeValue) ?
2521 2515
                             number_format($IPI->getElementsByTagName("pIPI")->item(0)->nodeValue, 2, ",", ".") : '';
2522 2516
                 } else {
2523 2517
                     $texto = '';
@@ -2531,7 +2525,7 @@  discard block
 block discarded – undo
2531 2525
                 $i++;
2532 2526
             }
2533 2527
         }
2534
-        return $oldY+$hmax;
2528
+        return $oldY + $hmax;
2535 2529
     }
2536 2530
 
2537 2531
     /**
@@ -2555,12 +2549,12 @@  discard block
 block discarded – undo
2555 2549
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
2556 2550
         //INSCRIÇÃO MUNICIPAL
2557 2551
         $y += 3;
2558
-        $w = round($this->wPrint*0.23, 0);
2552
+        $w = round($this->wPrint * 0.23, 0);
2559 2553
         $texto = 'INSCRIÇÃO MUNICIPAL';
2560 2554
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2561 2555
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
2562 2556
         //inscrição municipal
2563
-        $texto = ! empty($this->emit->getElementsByTagName("IM")->item(0)->nodeValue) ?
2557
+        $texto = !empty($this->emit->getElementsByTagName("IM")->item(0)->nodeValue) ?
2564 2558
                 $this->emit->getElementsByTagName("IM")->item(0)->nodeValue : '';
2565 2559
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
2566 2560
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 0, '');
@@ -2570,7 +2564,7 @@  discard block
 block discarded – undo
2570 2564
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2571 2565
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
2572 2566
         if (isset($this->ISSQNtot)) {
2573
-            $texto = ! empty($this->ISSQNtot->getElementsByTagName("vServ")->item(0)->nodeValue) ?
2567
+            $texto = !empty($this->ISSQNtot->getElementsByTagName("vServ")->item(0)->nodeValue) ?
2574 2568
                     $this->ISSQNtot->getElementsByTagName("vServ")->item(0)->nodeValue : '';
2575 2569
             $texto = number_format($texto, 2, ",", ".");
2576 2570
         } else {
@@ -2584,9 +2578,9 @@  discard block
 block discarded – undo
2584 2578
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2585 2579
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
2586 2580
         if (isset($this->ISSQNtot)) {
2587
-            $texto = ! empty($this->ISSQNtot->getElementsByTagName("vBC")->item(0)->nodeValue) ?
2581
+            $texto = !empty($this->ISSQNtot->getElementsByTagName("vBC")->item(0)->nodeValue) ?
2588 2582
                     $this->ISSQNtot->getElementsByTagName("vBC")->item(0)->nodeValue : '';
2589
-            $texto = ! empty($texto) ? number_format($texto, 2, ",", ".") : '';
2583
+            $texto = !empty($texto) ? number_format($texto, 2, ",", ".") : '';
2590 2584
         } else {
2591 2585
             $texto = '';
2592 2586
         }
@@ -2597,21 +2591,21 @@  discard block
 block discarded – undo
2597 2591
         if ($this->orientacao == 'P') {
2598 2592
             $w = $this->wPrint - (3 * $w);
2599 2593
         } else {
2600
-            $w = $this->wPrint - (3 * $w)-$this->wCanhoto;
2594
+            $w = $this->wPrint - (3 * $w) - $this->wCanhoto;
2601 2595
         }
2602 2596
         $texto = 'VALOR TOTAL DO ISSQN';
2603 2597
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2604 2598
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
2605 2599
         if (isset($this->ISSQNtot)) {
2606
-            $texto = ! empty($this->ISSQNtot->getElementsByTagName("vISS")->item(0)->nodeValue) ?
2600
+            $texto = !empty($this->ISSQNtot->getElementsByTagName("vISS")->item(0)->nodeValue) ?
2607 2601
                     $this->ISSQNtot->getElementsByTagName("vISS")->item(0)->nodeValue : '';
2608
-            $texto = ! empty($texto) ? number_format($texto, 2, ",", ".") : '';
2602
+            $texto = !empty($texto) ? number_format($texto, 2, ",", ".") : '';
2609 2603
         } else {
2610 2604
             $texto = '';
2611 2605
         }
2612 2606
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
2613 2607
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'R', 0, '');
2614
-        return ($y+$h+1);
2608
+        return ($y + $h + 1);
2615 2609
     }
2616 2610
 
2617 2611
     /**
@@ -2632,7 +2626,7 @@  discard block
 block discarded – undo
2632 2626
         if ($this->orientacao == 'P') {
2633 2627
               $w = $this->wPrint;
2634 2628
         } else {
2635
-              $w = $this->wPrint-$this->wCanhoto;
2629
+              $w = $this->wPrint - $this->wCanhoto;
2636 2630
         }
2637 2631
         $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
2638 2632
         $this->pTextBox($x, $y, $w, 8, $texto, $aFont, 'T', 'L', 0, '');
@@ -2648,15 +2642,15 @@  discard block
 block discarded – undo
2648 2642
         //$this->textoAdic com o texto completo do campo
2649 2643
         $y += 1;
2650 2644
         $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'');
2651
-        $this->pTextBox($x, $y+2, $w-2, $h-3, $this->textoAdic, $aFont, 'T', 'L', 0, '', false);
2645
+        $this->pTextBox($x, $y + 2, $w - 2, $h - 3, $this->textoAdic, $aFont, 'T', 'L', 0, '', false);
2652 2646
         //RESERVADO AO FISCO
2653 2647
         $texto = "RESERVADO AO FISCO";
2654 2648
         $x += $w;
2655 2649
         $y -= 1;
2656 2650
         if ($this->orientacao == 'P') {
2657
-            $w = $this->wPrint-$w;
2651
+            $w = $this->wPrint - $w;
2658 2652
         } else {
2659
-            $w = $this->wPrint-$w-$this->wCanhoto;
2653
+            $w = $this->wPrint - $w - $this->wCanhoto;
2660 2654
         }
2661 2655
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'B');
2662 2656
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -2695,8 +2689,8 @@  discard block
 block discarded – undo
2695 2689
         }
2696 2690
         $y += 2;
2697 2691
         $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'');
2698
-        $this->pTextBox($x, $y, $w-2, $h-3, $texto, $aFont, 'T', 'L', 0, '', false);
2699
-        return $y+$h;
2692
+        $this->pTextBox($x, $y, $w - 2, $h - 3, $texto, $aFont, 'T', 'L', 0, '', false);
2693
+        return $y + $h;
2700 2694
     }
2701 2695
 
2702 2696
     /**
@@ -2714,13 +2708,13 @@  discard block
 block discarded – undo
2714 2708
         if ($this->orientacao == 'P') {
2715 2709
               $w = $this->wPrint;
2716 2710
         } else {
2717
-              $w = $this->wPrint-$this->wCanhoto;
2711
+              $w = $this->wPrint - $this->wCanhoto;
2718 2712
               $x = $this->wCanhoto;
2719 2713
         }
2720 2714
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'I');
2721
-        $texto = "Impresso em ". date('d/m/Y') . " as " . date('H:i:s');
2715
+        $texto = "Impresso em " . date('d/m/Y') . " as " . date('H:i:s');
2722 2716
         $this->pTextBox($x, $y, $w, 0, $texto, $aFont, 'T', 'L', false);
2723
-        $texto = "DanfeNFePHP ver. " . $this->version .  "  Powered by NFePHP (GNU/GPLv3 GNU/LGPLv3) © www.nfephp.org";
2717
+        $texto = "DanfeNFePHP ver. " . $this->version . "  Powered by NFePHP (GNU/GPLv3 GNU/LGPLv3) © www.nfephp.org";
2724 2718
         $this->pTextBox($x, $y, $w, 0, $texto, $aFont, 'T', 'R', false, 'http://www.nfephp.org');
2725 2719
     }
2726 2720
 
@@ -2773,9 +2767,9 @@  discard block
 block discarded – undo
2773 2767
         } else {
2774 2768
             //linha separadora do canhoto - 238
2775 2769
             //posicao altura
2776
-            $y = $this->wPrint-85;
2770
+            $y = $this->wPrint - 85;
2777 2771
             //altura
2778
-            $w = $this->wPrint-85-24;
2772
+            $w = $this->wPrint - 85 - 24;
2779 2773
         }
2780 2774
         $h = 10;
2781 2775
         //desenha caixa
@@ -2798,21 +2792,21 @@  discard block
 block discarded – undo
2798 2792
             $texto .= "AO LADO";
2799 2793
         }
2800 2794
         $texto .= ". EMISSÃO: ";
2801
-        $dEmi = ! empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
2795
+        $dEmi = !empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
2802 2796
                 $this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue : '';
2803 2797
         if ($dEmi == '') {
2804
-            $dEmi = ! empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
2798
+            $dEmi = !empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
2805 2799
                     $this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue : '';
2806 2800
             $aDemi = explode('T', $dEmi);
2807 2801
             $dEmi = $aDemi[0];
2808 2802
         }
2809
-        $texto .= $this->pYmd2dmy($dEmi) ." ";
2803
+        $texto .= $this->pYmd2dmy($dEmi) . " ";
2810 2804
         $texto .= "VALOR TOTAL: R$ ";
2811 2805
         $texto .= number_format($this->ICMSTot->getElementsByTagName("vNF")->item(0)->nodeValue, 2, ",", ".") . " ";
2812 2806
         $texto .= "DESTINATÁRIO: ";
2813 2807
         $texto .= $destinatario;
2814 2808
         if ($this->orientacao == 'P') {
2815
-            $this->pTextBox($x, $y, $w-1, $h, $texto, $aFont, 'C', 'L', 0, '', false);
2809
+            $this->pTextBox($x, $y, $w - 1, $h, $texto, $aFont, 'C', 'L', 0, '', false);
2816 2810
             $x1 = $x + $w;
2817 2811
             $w1 = $this->wPrint - $w;
2818 2812
             $texto = "NF-e";
@@ -2825,12 +2819,12 @@  discard block
 block discarded – undo
2825 2819
             //DATA DE RECEBIMENTO
2826 2820
             $texto = "DATA DE RECEBIMENTO";
2827 2821
             $y += $h;
2828
-            $w2 = round($this->wPrint*0.17, 0); //35;
2822
+            $w2 = round($this->wPrint * 0.17, 0); //35;
2829 2823
             $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2830 2824
             $this->pTextBox($x, $y, $w2, 8, $texto, $aFont, 'T', 'L', 1, '');
2831 2825
             //IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR
2832 2826
             $x += $w2;
2833
-            $w3 = $w-$w2;
2827
+            $w3 = $w - $w2;
2834 2828
             $texto = "IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR";
2835 2829
             $this->pTextBox($x, $y, $w3, 8, $texto, $aFont, 'T', 'L', 1, '');
2836 2830
             $x = $oldX;
@@ -2840,7 +2834,7 @@  discard block
 block discarded – undo
2840 2834
             return $y;
2841 2835
         } else {
2842 2836
             $x--;
2843
-            $x = $this->pTextBox90($x, $y, $w-1, $h, $texto, $aFontSmall, 'C', 'L', 0, '', false);
2837
+            $x = $this->pTextBox90($x, $y, $w - 1, $h, $texto, $aFontSmall, 'C', 'L', 0, '', false);
2844 2838
             //NUMERO DA NOTA FISCAL LOGO NFE
2845 2839
             $w1 = 16;
2846 2840
             $x1 = $oldX;
@@ -2854,18 +2848,18 @@  discard block
 block discarded – undo
2854 2848
             $this->pTextBox($x1, $y, $w1, 18, $texto, $aFont, 'C', 'C', 1, '');
2855 2849
             //DATA DO RECEBIMENTO
2856 2850
             $texto = "DATA DO RECEBIMENTO";
2857
-            $y = $this->wPrint-85;
2851
+            $y = $this->wPrint - 85;
2858 2852
             $x = 12;
2859
-            $w2 = round($this->wPrint*0.17, 0); //35;
2853
+            $w2 = round($this->wPrint * 0.17, 0); //35;
2860 2854
             $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2861 2855
             $this->pTextBox90($x, $y, $w2, 8, $texto, $aFont, 'T', 'L', 1, '');
2862 2856
             //IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR
2863 2857
             $y -= $w2;
2864
-            $w3 = $w-$w2;
2858
+            $w3 = $w - $w2;
2865 2859
             $texto = "IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR";
2866 2860
             $aFont = array('font'=>$this->fontePadrao, 'size'=>5.7, 'style'=>'');
2867 2861
             $x = $this->pTextBox90($x, $y, $w3, 8, $texto, $aFont, 'T', 'L', 1, '');
2868
-            $this->pdf->DashedVLine(23, $oldY, 0.1, $this->wPrint-20, 67);
2862
+            $this->pdf->DashedVLine(23, $oldY, 0.1, $this->wPrint - 20, 67);
2869 2863
             return $x;
2870 2864
         }
2871 2865
     }
@@ -2882,13 +2876,13 @@  discard block
 block discarded – undo
2882 2876
     {
2883 2877
         $saida = "";
2884 2878
         if (isset($this->compra)) {
2885
-            if (! empty($this->compra->getElementsByTagName("xNEmp")->item(0)->nodeValue)) {
2879
+            if (!empty($this->compra->getElementsByTagName("xNEmp")->item(0)->nodeValue)) {
2886 2880
                 $saida .= " Nota de Empenho: " . $this->compra->getElementsByTagName("xNEmp")->item(0)->nodeValue;
2887 2881
             }
2888
-            if (! empty($this->compra->getElementsByTagName("xPed")->item(0)->nodeValue)) {
2882
+            if (!empty($this->compra->getElementsByTagName("xPed")->item(0)->nodeValue)) {
2889 2883
                 $saida .= " Pedido: " . $this->compra->getElementsByTagName("xPed")->item(0)->nodeValue;
2890 2884
             }
2891
-            if (! empty($this->compra->getElementsByTagName("xCont")->item(0)->nodeValue)) {
2885
+            if (!empty($this->compra->getElementsByTagName("xCont")->item(0)->nodeValue)) {
2892 2886
                 $saida .= " Contrato: " . $this->compra->getElementsByTagName("xCont")->item(0)->nodeValue;
2893 2887
             }
2894 2888
         }
@@ -2914,21 +2908,21 @@  discard block
 block discarded – undo
2914 2908
         if ($vICMS > 0) {
2915 2909
             $vICMS = 1;
2916 2910
         }
2917
-        $icmss  = $this->ICMSTot->getElementsByTagName("vBC")->item(0)->nodeValue;
2911
+        $icmss = $this->ICMSTot->getElementsByTagName("vBC")->item(0)->nodeValue;
2918 2912
         if ($icmss > 0) {
2919 2913
             $icmss = 1;
2920 2914
         }
2921
-        $dEmi = ! empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
2915
+        $dEmi = !empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
2922 2916
                 $this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue : '';
2923 2917
         if ($dEmi == '') {
2924
-            $dEmi = ! empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
2918
+            $dEmi = !empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
2925 2919
                     $this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue : '';
2926 2920
             $aDemi = explode('T', $dEmi);
2927 2921
             $dEmi = $aDemi[0];
2928 2922
         }
2929 2923
         $dd  = $dEmi;
2930 2924
         $rpos = strrpos($dd, '-');
2931
-        $dd  = substr($dd, $rpos +1);
2925
+        $dd  = substr($dd, $rpos + 1);
2932 2926
         $chave = sprintf($forma, $cUF, $this->tpEmis, $CNPJ, $vNF, $vICMS, $icmss, $dd);
2933 2927
         $chave = $chave . $this->pModulo11($chave);
2934 2928
         return $chave;
@@ -2949,7 +2943,7 @@  discard block
 block discarded – undo
2949 2943
         $formaNfRef = "\r\nNF  Ref.: série:%d numero:%d emit:%s em %s modelo: %d";
2950 2944
         $formaECFRef = "\r\nECF Ref.: modelo: %s ECF:%d COO:%d";
2951 2945
         $formaNfpRef = "\r\nNFP Ref.: série:%d número:%d emit:%s em %s modelo: %d IE:%s";
2952
-        $saida='';
2946
+        $saida = '';
2953 2947
         $nfRefs = $this->ide->getElementsByTagName('NFref');
2954 2948
         if (0 === $nfRefs->length) {
2955 2949
             return $saida;
@@ -2962,7 +2956,7 @@  discard block
 block discarded – undo
2962 2956
             foreach ($refNFe as $chave_acessoRef) {
2963 2957
                 $chave_acesso = $chave_acessoRef->nodeValue;
2964 2958
                 $chave_acessoF = $this->pFormat($chave_acesso, $this->formatoChave);
2965
-                $data = substr($chave_acesso, 4, 2)."/20".substr($chave_acesso, 2, 2);
2959
+                $data = substr($chave_acesso, 4, 2) . "/20" . substr($chave_acesso, 2, 2);
2966 2960
                 $cnpj = $this->pFormat(substr($chave_acesso, 6, 14), "##.###.###/####-##");
2967 2961
                 $serie  = substr($chave_acesso, 22, 3);
2968 2962
                 $numero = substr($chave_acesso, 25, 9);
@@ -2983,7 +2977,7 @@  discard block
 block discarded – undo
2983 2977
             foreach ($refCTe as $chave_acessoRef) {
2984 2978
                 $chave_acesso = $chave_acessoRef->nodeValue;
2985 2979
                 $chave_acessoF = $this->pFormat($chave_acesso, $this->formatoChave);
2986
-                $data = substr($chave_acesso, 4, 2)."/20".substr($chave_acesso, 2, 2);
2980
+                $data = substr($chave_acesso, 4, 2) . "/20" . substr($chave_acesso, 2, 2);
2987 2981
                 $cnpj = $this->pFormat(substr($chave_acesso, 6, 14), "##.###.###/####-##");
2988 2982
                 $serie  = substr($chave_acesso, 22, 3);
2989 2983
                 $numero = substr($chave_acesso, 25, 9);
@@ -2999,10 +2993,9 @@  discard block
 block discarded – undo
2999 2993
             $refNFP = $nfRef->getElementsByTagName('refNFP');
3000 2994
             foreach ($refNFP as $umaRefNFe) {
3001 2995
                 $data = $umaRefNFe->getElementsByTagName('AAMM')->item(0)->nodeValue;
3002
-                $cnpj = ! empty($umaRefNFe->getElementsByTagName('CNPJ')->item(0)->nodeValue) ?
3003
-                    $umaRefNFe->getElementsByTagName('CNPJ')->item(0)->nodeValue :
3004
-                    '';
3005
-                $cpf = ! empty($umaRefNFe->getElementsByTagName('CPF')->item(0)->nodeValue) ?
2996
+                $cnpj = !empty($umaRefNFe->getElementsByTagName('CNPJ')->item(0)->nodeValue) ?
2997
+                    $umaRefNFe->getElementsByTagName('CNPJ')->item(0)->nodeValue : '';
2998
+                $cpf = !empty($umaRefNFe->getElementsByTagName('CPF')->item(0)->nodeValue) ?
3006 2999
                         $umaRefNFe->getElementsByTagName('CPF')->item(0)->nodeValue : '';
3007 3000
                 $mod = $umaRefNFe->getElementsByTagName('mod')->item(0)->nodeValue;
3008 3001
                 $serie = $umaRefNFe->getElementsByTagName('serie')->item(0)->nodeValue;
Please login to merge, or discard this patch.