Passed
Push — master ( ac8994...bc6f5f )
by Roberto
03:09 queued 11s
created
src/NFe/Danfe.php 1 patch
Spacing   +330 added lines, -331 removed lines patch added patch discarded remove patch
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
             $this->fontePadrao = $fonteDANFE;
356 356
         }
357 357
         //se for passado o xml
358
-        if (! empty($this->xml)) {
358
+        if (!empty($this->xml)) {
359 359
             $this->dom = new Dom();
360 360
             $this->dom->loadXML($this->xml);
361 361
             $this->nfeProc    = $this->dom->getElementsByTagName("nfeProc")->item(0);
@@ -511,10 +511,10 @@  discard block
 block discarded – undo
511 511
         //total inicial de paginas
512 512
         $totPag = 1;
513 513
         //largura imprimivel em mm: largura da folha menos as margens esq/direita
514
-        $this->wPrint = $maxW-($margEsq*2);
514
+        $this->wPrint = $maxW - ($margEsq * 2);
515 515
         //comprimento (altura) imprimivel em mm: altura da folha menos as margens
516 516
         //superior e inferior
517
-        $this->hPrint = $maxH-$margSup-$margInf;
517
+        $this->hPrint = $maxH - $margSup - $margInf;
518 518
         // estabelece contagem de paginas
519 519
         $this->pdf->aliasNbPages();
520 520
         // fixa as margens
@@ -552,9 +552,9 @@  discard block
 block discarded – undo
552 552
         }
553 553
         //calcular a altura necessária para os dados adicionais
554 554
         if ($this->orientacao == 'P') {
555
-            $this->wAdic = round($this->wPrint*0.66, 0);
555
+            $this->wAdic = round($this->wPrint * 0.66, 0);
556 556
         } else {
557
-            $this->wAdic = round(($this->wPrint-$this->wCanhoto)*0.5, 0);
557
+            $this->wAdic = round(($this->wPrint - $this->wCanhoto) * 0.5, 0);
558 558
         }
559 559
         $fontProduto = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'');
560 560
         $this->textoAdic = '';
@@ -566,8 +566,8 @@  discard block
 block discarded – undo
566 566
             $txRetxBairro = $this->getTagValue($this->retirada, "xBairro");
567 567
             $txRetxMun = $this->getTagValue($this->retirada, "xMun");
568 568
             $txRetUF = $this->getTagValue($this->retirada, "UF");
569
-            $this->textoAdic .= "LOCAL DE RETIRADA : ".
570
-                    $txRetCNPJ.
569
+            $this->textoAdic .= "LOCAL DE RETIRADA : " .
570
+                    $txRetCNPJ .
571 571
                     '-' .
572 572
                     $txRetxLgr .
573 573
                     ', ' .
@@ -594,8 +594,8 @@  discard block
 block discarded – undo
594 594
             if ($this->textoAdic != '') {
595 595
                 $this->textoAdic .= ". \r\n";
596 596
             }
597
-            $this->textoAdic .= "LOCAL DE ENTREGA : ".$txRetCNPJ.'-'.$txRetxLgr.', '.$txRetnro.' '.$txRetxCpl.
598
-               ' - '.$txRetxBairro.' '.$txRetxMun.' - '.$txRetUF."\r\n";
597
+            $this->textoAdic .= "LOCAL DE ENTREGA : " . $txRetCNPJ . '-' . $txRetxLgr . ', ' . $txRetnro . ' ' . $txRetxCpl .
598
+               ' - ' . $txRetxBairro . ' ' . $txRetxMun . ' - ' . $txRetUF . "\r\n";
599 599
         }
600 600
         //informações adicionais
601 601
         $this->textoAdic .= $this->pGeraInformacoesDasNotasReferenciadas();
@@ -604,7 +604,7 @@  discard block
 block discarded – undo
604 604
             if ($this->textoAdic != '') {
605 605
                 $this->textoAdic .= ". \r\n";
606 606
             }
607
-            $this->textoAdic .= ! empty($this->getTagValue($this->infAdic, "infCpl")) ?
607
+            $this->textoAdic .= !empty($this->getTagValue($this->infAdic, "infCpl")) ?
608 608
                 'Inf. Contribuinte: ' .
609 609
                 $this->pAnfavea($this->getTagValue($this->infAdic, "infCpl")) : '';
610 610
             $infPedido = $this->pGeraInformacoesDaTagCompra();
@@ -612,14 +612,14 @@  discard block
 block discarded – undo
612 612
                 $this->textoAdic .= $infPedido;
613 613
             }
614 614
             $this->textoAdic .= $this->getTagValue($this->dest, "email", ' Email do Destinatário: ');
615
-            $this->textoAdic .= ! empty($this->getTagValue($this->infAdic, "infAdFisco")) ?
615
+            $this->textoAdic .= !empty($this->getTagValue($this->infAdic, "infAdFisco")) ?
616 616
                 "\r\n Inf. fisco: " .
617 617
                 $this->getTagValue($this->infAdic, "infAdFisco") : '';
618 618
             $obsCont = $this->infAdic->getElementsByTagName("obsCont");
619 619
             if (isset($obsCont)) {
620 620
                 foreach ($obsCont as $obs) {
621
-                    $campo =  $obsCont->item($i)->getAttribute("xCampo");
622
-                    $xTexto = ! empty($obsCont->item($i)->getElementsByTagName("xTexto")->item(0)->nodeValue) ?
621
+                    $campo = $obsCont->item($i)->getAttribute("xCampo");
622
+                    $xTexto = !empty($obsCont->item($i)->getElementsByTagName("xTexto")->item(0)->nodeValue) ?
623 623
                         $obsCont->item($i)->getElementsByTagName("xTexto")->item(0)->nodeValue : '';
624 624
                     $this->textoAdic .= "\r\n" . $campo . ':  ' . trim($xTexto);
625 625
                     $i++;
@@ -647,38 +647,38 @@  discard block
 block discarded – undo
647 647
         foreach ($alinhas as $linha) {
648 648
             $numlinhasdados += $this->pGetNumLines($linha, $this->wAdic, $fontProduto);
649 649
         }
650
-        $hdadosadic = round(($numlinhasdados+3) * $this->pdf->fontSize, 0);
650
+        $hdadosadic = round(($numlinhasdados + 3) * $this->pdf->fontSize, 0);
651 651
         if ($hdadosadic < 10) {
652 652
             $hdadosadic = 10;
653 653
         }
654 654
         //altura disponivel para os campos da DANFE
655
-        $hcabecalho = 47;//para cabeçalho
656
-        $hdestinatario = 25;//para destinatario
657
-        $hduplicatas = 12;//para cada grupo de 7 duplicatas
658
-        $himposto = 18;// para imposto
659
-        $htransporte = 25;// para transporte
660
-        $hissqn = 11;// para issqn
661
-        $hfooter = 5;// para rodape
662
-        $hCabecItens = 4;//cabeçalho dos itens
655
+        $hcabecalho = 47; //para cabeçalho
656
+        $hdestinatario = 25; //para destinatario
657
+        $hduplicatas = 12; //para cada grupo de 7 duplicatas
658
+        $himposto = 18; // para imposto
659
+        $htransporte = 25; // para transporte
660
+        $hissqn = 11; // para issqn
661
+        $hfooter = 5; // para rodape
662
+        $hCabecItens = 4; //cabeçalho dos itens
663 663
         //alturas disponiveis para os dados
664 664
         $hDispo1 = $this->hPrint - 10 - ($hcabecalho +
665 665
             $hdestinatario + ($linhasDup * $hduplicatas) + $himposto + $htransporte +
666 666
             ($linhaISSQN * $hissqn) + $hdadosadic + $hfooter + $hCabecItens +
667 667
             $this->pSizeExtraTextoFatura());
668 668
         if ($this->orientacao == 'P') {
669
-            $hDispo1 -= 24 * $this->qCanhoto;//para canhoto
669
+            $hDispo1 -= 24 * $this->qCanhoto; //para canhoto
670 670
             $w = $this->wPrint;
671 671
         } else {
672
-            $hcanhoto = $this->hPrint;//para canhoto
672
+            $hcanhoto = $this->hPrint; //para canhoto
673 673
             $w = $this->wPrint - $this->wCanhoto;
674 674
         }
675
-        $hDispo2 = $this->hPrint - 10 - ($hcabecalho + $hfooter + $hCabecItens)-4;
675
+        $hDispo2 = $this->hPrint - 10 - ($hcabecalho + $hfooter + $hCabecItens) - 4;
676 676
         //Contagem da altura ocupada para impressão dos itens
677 677
         $fontProduto = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'');
678 678
         $i = 1;
679 679
         $numlinhas = 0;
680 680
         $hUsado = $hCabecItens;
681
-        $w2 = round($w*0.28, 0);
681
+        $w2 = round($w * 0.28, 0);
682 682
         $hDispo = $hDispo1;
683 683
         $totPag = 1;
684 684
         while ($i < $this->det->length) {
@@ -690,7 +690,7 @@  discard block
 block discarded – undo
690 690
                 $hDispo = $hDispo2;
691 691
                 $hUsado = $hCabecItens;
692 692
                 // Remove canhoto para páginas secundárias em modo paisagem ('L')
693
-                $w2 = round($this->wPrint*0.28, 0);
693
+                $w2 = round($this->wPrint * 0.28, 0);
694 694
                 $i--; // decrementa para readicionar o item que não coube nessa pagina na outra.
695 695
             }
696 696
             $i++;
@@ -714,7 +714,7 @@  discard block
 block discarded – undo
714 714
         //coloca o cabeçalho
715 715
         $y = $this->pCabecalhoDANFE($x, $y, $pag, $totPag);
716 716
         //coloca os dados do destinatário
717
-        $y = $this->pDestinatarioDANFE($x, $y+1);
717
+        $y = $this->pDestinatarioDANFE($x, $y + 1);
718 718
         
719 719
         
720 720
         //Verifica as formas de pagamento da nota fiscal
@@ -728,29 +728,29 @@  discard block
 block discarded – undo
728 728
         }
729 729
         //caso tenha boleto imprimir fatura
730 730
         if ($this->dup->length > 0) {
731
-            $y = $this->pFaturaDANFE($x, $y+1);
731
+            $y = $this->pFaturaDANFE($x, $y + 1);
732 732
         } else {
733 733
             //Se somente tiver a forma de pagamento sem pagamento ou outros não imprimir nada
734
-            if (count($formaPag)=='1' && (isset($formaPag[90]) || isset($formaPag[99]))) {
734
+            if (count($formaPag) == '1' && (isset($formaPag[90]) || isset($formaPag[99]))) {
735 735
                 $y = $y;
736 736
             } else {
737 737
                 //caso tenha mais de uma forma de pagamento ou seja diferente de boleto exibe a
738 738
                 //forma de pagamento e o valor
739
-                $y = $this->pagamentoDANFE($x, $y+1);
739
+                $y = $this->pagamentoDANFE($x, $y + 1);
740 740
             }
741 741
         }
742 742
         //coloca os dados dos impostos e totais da NFe
743
-        $y = $this->pImpostoDANFE($x, $y+1);
743
+        $y = $this->pImpostoDANFE($x, $y + 1);
744 744
         //coloca os dados do trasnporte
745
-        $y = $this->pTransporteDANFE($x, $y+1);
745
+        $y = $this->pTransporteDANFE($x, $y + 1);
746 746
         //itens da DANFE
747 747
         $nInicial = 0;
748 748
 
749
-        $y = $this->pItensDANFE($x, $y+1, $nInicial, $hDispo1, $pag, $totPag, $hCabecItens);
749
+        $y = $this->pItensDANFE($x, $y + 1, $nInicial, $hDispo1, $pag, $totPag, $hCabecItens);
750 750
 
751 751
         //coloca os dados do ISSQN
752 752
         if ($linhaISSQN == 1) {
753
-            $y = $this->pIssqnDANFE($x, $y+4);
753
+            $y = $this->pIssqnDANFE($x, $y + 4);
754 754
         } else {
755 755
             $y += 4;
756 756
         }
@@ -758,7 +758,7 @@  discard block
 block discarded – undo
758 758
         $y = $this->pDadosAdicionaisDANFE($x, $y, $hdadosadic);
759 759
         //coloca o rodapé da página
760 760
         if ($this->orientacao == 'P') {
761
-            $this->pRodape($xInic, $y-1);
761
+            $this->pRodape($xInic, $y - 1);
762 762
         } else {
763 763
             $this->pRodape($xInic, $this->hPrint + 1);
764 764
         }
@@ -779,7 +779,7 @@  discard block
 block discarded – undo
779 779
             //coloca o cabeçalho na página adicional
780 780
             $y = $this->pCabecalhoDANFE($x, $y, $n, $totPag);
781 781
             //coloca os itens na página adicional
782
-            $y = $this->pItensDANFE($x, $y+1, $nInicial, $hDispo2, $n, $totPag, $hCabecItens);
782
+            $y = $this->pItensDANFE($x, $y + 1, $nInicial, $hDispo2, $n, $totPag, $hCabecItens);
783 783
             //coloca o rodapé da página
784 784
             if ($this->orientacao == 'P') {
785 785
                 $this->pRodape($xInic, $y + 4);
@@ -792,7 +792,7 @@  discard block
 block discarded – undo
792 792
             }
793 793
         }
794 794
         //retorna o ID na NFe
795
-        if ($classPdf!==false) {
795
+        if ($classPdf !== false) {
796 796
             $aR = array(
797 797
              'id'=>str_replace('NFe', '', $this->infNFe->getAttribute("Id")),
798 798
              'classe_PDF'=>$this->pdf);
@@ -825,7 +825,7 @@  discard block
 block discarded – undo
825 825
         if ($startPos === false) {
826 826
             return $cdata;
827 827
         }
828
-        for ($x=$len; $x>0; $x--) {
828
+        for ($x = $len; $x > 0; $x--) {
829 829
             if (substr($cdata, $x, 1) == '>') {
830 830
                 $endPos = $x;
831 831
                 break;
@@ -836,15 +836,15 @@  discard block
 block discarded – undo
836 836
         } else {
837 837
             $parte1 = '';
838 838
         }
839
-        $parte2 = substr($cdata, $startPos, $endPos-$startPos+1);
839
+        $parte2 = substr($cdata, $startPos, $endPos - $startPos + 1);
840 840
         if ($endPos < $len) {
841 841
             $parte3 = substr($cdata, $endPos + 1, $len - $endPos - 1);
842 842
         } else {
843 843
             $parte3 = '';
844 844
         }
845
-        $texto = trim($parte1).' '.trim($parte3);
845
+        $texto = trim($parte1) . ' ' . trim($parte3);
846 846
         if (strpos($parte2, '<CDATA>') === false) {
847
-            $cdata = '<CDATA>'.$parte2.'</CDATA>';
847
+            $cdata = '<CDATA>' . $parte2 . '</CDATA>';
848 848
         } else {
849 849
             $cdata = $parte2;
850 850
         }
@@ -918,15 +918,15 @@  discard block
 block discarded – undo
918 918
         //grupo CADATA infCpl
919 919
         $t = $dom->getElementsByTagName('transmissor')->item(0);
920 920
         $r = $dom->getElementsByTagName('receptor')->item(0);
921
-        $versao = ! empty($dom->getElementsByTagName('versao')->item(0)->nodeValue) ?
922
-            'Versao:'.$dom->getElementsByTagName('versao')->item(0)->nodeValue.' ' : '';
923
-        $especieNF = ! empty($dom->getElementsByTagName('especieNF')->item(0)->nodeValue) ?
924
-            'Especie:'.$dom->getElementsByTagName('especieNF')->item(0)->nodeValue.' ' : '';
925
-        $fabEntrega = ! empty($dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue) ?
926
-            'Entrega:'.$dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue.' ' : '';
927
-        $dca = ! empty($dom->getElementsByTagName('dca')->item(0)->nodeValue) ?
928
-            'dca:'.$dom->getElementsByTagName('dca')->item(0)->nodeValue.' ' : '';
929
-        $texto .= "".$versao.$especieNF.$fabEntrega.$dca;
921
+        $versao = !empty($dom->getElementsByTagName('versao')->item(0)->nodeValue) ?
922
+            'Versao:' . $dom->getElementsByTagName('versao')->item(0)->nodeValue . ' ' : '';
923
+        $especieNF = !empty($dom->getElementsByTagName('especieNF')->item(0)->nodeValue) ?
924
+            'Especie:' . $dom->getElementsByTagName('especieNF')->item(0)->nodeValue . ' ' : '';
925
+        $fabEntrega = !empty($dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue) ?
926
+            'Entrega:' . $dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue . ' ' : '';
927
+        $dca = !empty($dom->getElementsByTagName('dca')->item(0)->nodeValue) ?
928
+            'dca:' . $dom->getElementsByTagName('dca')->item(0)->nodeValue . ' ' : '';
929
+        $texto .= "" . $versao . $especieNF . $fabEntrega . $dca;
930 930
         if (isset($t)) {
931 931
             if ($t->hasAttributes()) {
932 932
                 $texto .= " Transmissor ";
@@ -1016,14 +1016,14 @@  discard block
 block discarded – undo
1016 1016
         }
1017 1017
         //####################################################################################
1018 1018
         //coluna esquerda identificação do emitente
1019
-        $w = round($maxW*0.41, 0);
1019
+        $w = round($maxW * 0.41, 0);
1020 1020
         if ($this->orientacao == 'P') {
1021 1021
             $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'I');
1022 1022
         } else {
1023 1023
             $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B');
1024 1024
         }
1025 1025
         $w1 = $w;
1026
-        $h=32;
1026
+        $h = 32;
1027 1027
         $oldY += $h;
1028 1028
         $this->pTextBox($x, $y, $w, $h);
1029 1029
         $texto = 'IDENTIFICAÇÃO DO EMITENTE';
@@ -1044,39 +1044,39 @@  discard block
 block discarded – undo
1044 1044
                 $type == 'jpg';
1045 1045
             }
1046 1046
             //largura da imagem em mm
1047
-            $logoWmm = ($logoInfo[0]/72)*25.4;
1047
+            $logoWmm = ($logoInfo[0] / 72) * 25.4;
1048 1048
             //altura da imagem em mm
1049
-            $logoHmm = ($logoInfo[1]/72)*25.4;
1050
-            if ($this->logoAlign=='L') {
1051
-                $nImgW = round($w/3, 0);
1052
-                $nImgH = round($logoHmm * ($nImgW/$logoWmm), 0);
1053
-                $xImg = $x+1;
1054
-                $yImg = round(($h-$nImgH)/2, 0)+$y;
1049
+            $logoHmm = ($logoInfo[1] / 72) * 25.4;
1050
+            if ($this->logoAlign == 'L') {
1051
+                $nImgW = round($w / 3, 0);
1052
+                $nImgH = round($logoHmm * ($nImgW / $logoWmm), 0);
1053
+                $xImg = $x + 1;
1054
+                $yImg = round(($h - $nImgH) / 2, 0) + $y;
1055 1055
                 //estabelecer posições do texto
1056
-                $x1 = round($xImg + $nImgW +1, 0);
1057
-                $y1 = round($h/3+$y, 0);
1058
-                $tw = round(2*$w/3, 0);
1059
-            } elseif ($this->logoAlign=='C') {
1060
-                $nImgH = round($h/3, 0);
1061
-                $nImgW = round($logoWmm * ($nImgH/$logoHmm), 0);
1062
-                $xImg = round(($w-$nImgW)/2+$x, 0);
1063
-                $yImg = $y+3;
1056
+                $x1 = round($xImg + $nImgW + 1, 0);
1057
+                $y1 = round($h / 3 + $y, 0);
1058
+                $tw = round(2 * $w / 3, 0);
1059
+            } elseif ($this->logoAlign == 'C') {
1060
+                $nImgH = round($h / 3, 0);
1061
+                $nImgW = round($logoWmm * ($nImgH / $logoHmm), 0);
1062
+                $xImg = round(($w - $nImgW) / 2 + $x, 0);
1063
+                $yImg = $y + 3;
1064 1064
                 $x1 = $x;
1065 1065
                 $y1 = round($yImg + $nImgH + 1, 0);
1066 1066
                 $tw = $w;
1067
-            } elseif ($this->logoAlign=='R') {
1068
-                $nImgW = round($w/3, 0);
1069
-                $nImgH = round($logoHmm * ($nImgW/$logoWmm), 0);
1070
-                $xImg = round($x+($w-(1+$nImgW)), 0);
1071
-                $yImg = round(($h-$nImgH)/2, 0)+$y;
1067
+            } elseif ($this->logoAlign == 'R') {
1068
+                $nImgW = round($w / 3, 0);
1069
+                $nImgH = round($logoHmm * ($nImgW / $logoWmm), 0);
1070
+                $xImg = round($x + ($w - (1 + $nImgW)), 0);
1071
+                $yImg = round(($h - $nImgH) / 2, 0) + $y;
1072 1072
                 $x1 = $x;
1073
-                $y1 = round($h/3+$y, 0);
1074
-                $tw = round(2*$w/3, 0);
1075
-            } elseif ($this->logoAlign=='F') {
1076
-                $nImgH = round($h-5, 0);
1077
-                $nImgW = round($logoWmm * ($nImgH/$logoHmm), 0);
1078
-                $xImg = round(($w-$nImgW)/2+$x, 0);
1079
-                $yImg = $y+3;
1073
+                $y1 = round($h / 3 + $y, 0);
1074
+                $tw = round(2 * $w / 3, 0);
1075
+            } elseif ($this->logoAlign == 'F') {
1076
+                $nImgH = round($h - 5, 0);
1077
+                $nImgW = round($logoWmm * ($nImgH / $logoHmm), 0);
1078
+                $xImg = round(($w - $nImgW) / 2 + $x, 0);
1079
+                $yImg = $y + 3;
1080 1080
                 $x1 = $x;
1081 1081
                 $y1 = round($yImg + $nImgH + 1, 0);
1082 1082
                 $tw = $w;
@@ -1085,7 +1085,7 @@  discard block
 block discarded – undo
1085 1085
             $this->pdf->Image($this->logomarca, $xImg, $yImg, $nImgW, $nImgH, $type);
1086 1086
         } else {
1087 1087
             $x1 = $x;
1088
-            $y1 = round($h/3+$y, 0);
1088
+            $y1 = round($h / 3 + $y, 0);
1089 1089
             $tw = $w;
1090 1090
         }
1091 1091
         // monta as informações apenas se diferente de full logo
@@ -1095,9 +1095,9 @@  discard block
 block discarded – undo
1095 1095
             $texto = $this->emit->getElementsByTagName("xNome")->item(0)->nodeValue;
1096 1096
             $this->pTextBox($x1, $y1, $tw, 8, $texto, $aFont, 'T', 'C', 0, '');
1097 1097
             //endereço
1098
-            $y1 = $y1+5;
1098
+            $y1 = $y1 + 5;
1099 1099
             $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'');
1100
-            $fone = ! empty($this->enderEmit->getElementsByTagName("fone")->item(0)->nodeValue)
1100
+            $fone = !empty($this->enderEmit->getElementsByTagName("fone")->item(0)->nodeValue)
1101 1101
                  ? $this->enderEmit->getElementsByTagName("fone")->item(0)->nodeValue
1102 1102
                  : '';
1103 1103
             $lgr = $this->getTagValue($this->enderEmit, "xLgr");
@@ -1117,37 +1117,37 @@  discard block
 block discarded – undo
1117 1117
         //####################################################################################
1118 1118
         //coluna central Danfe
1119 1119
         $x += $w;
1120
-        $w=round($maxW * 0.17, 0);//35;
1120
+        $w = round($maxW * 0.17, 0); //35;
1121 1121
         $w2 = $w;
1122 1122
         $h = 32;
1123 1123
         $this->pTextBox($x, $y, $w, $h);
1124 1124
 
1125
-        if (! $this->pNotaCancelada()) {
1125
+        if (!$this->pNotaCancelada()) {
1126 1126
             // A PRINCIPIO NÃO PRECISAVA, POIS A NFE ESTÁ AUTORIZADA,
1127 1127
             // SÓ SE RETIRA O DANFE PARA NOTAS NÃO AUTORIZADAS
1128 1128
             $texto = "DANFE";
1129 1129
             $aFont = array('font'=>$this->fontePadrao, 'size'=>14, 'style'=>'B');
1130
-            $this->pTextBox($x, $y+1, $w, $h, $texto, $aFont, 'T', 'C', 0, '');
1130
+            $this->pTextBox($x, $y + 1, $w, $h, $texto, $aFont, 'T', 'C', 0, '');
1131 1131
             $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'');
1132 1132
             $texto = 'Documento Auxiliar da Nota Fiscal Eletrônica';
1133 1133
             $h = 20;
1134
-            $this->pTextBox($x, $y+6, $w, $h, $texto, $aFont, 'T', 'C', 0, '', false);
1134
+            $this->pTextBox($x, $y + 6, $w, $h, $texto, $aFont, 'T', 'C', 0, '', false);
1135 1135
         }
1136 1136
 
1137 1137
         $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'');
1138 1138
         $texto = '0 - ENTRADA';
1139 1139
         $y1 = $y + 14;
1140 1140
         $h = 8;
1141
-        $this->pTextBox($x+2, $y1, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1141
+        $this->pTextBox($x + 2, $y1, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1142 1142
         $texto = '1 - SAÍDA';
1143 1143
         $y1 = $y + 17;
1144
-        $this->pTextBox($x+2, $y1, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1144
+        $this->pTextBox($x + 2, $y1, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1145 1145
         //tipo de nF
1146 1146
         $aFont = array('font'=>$this->fontePadrao, 'size'=>12, 'style'=>'B');
1147 1147
         $y1 = $y + 13;
1148 1148
         $h = 7;
1149 1149
         $texto = $this->ide->getElementsByTagName('tpNF')->item(0)->nodeValue;
1150
-        $this->pTextBox($x+27, $y1, 5, $h, $texto, $aFont, 'C', 'C', 1, '');
1150
+        $this->pTextBox($x + 27, $y1, 5, $h, $texto, $aFont, 'C', 'C', 1, '');
1151 1151
         //numero da NF
1152 1152
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
1153 1153
         $y1 = $y + 20;
@@ -1169,7 +1169,7 @@  discard block
 block discarded – undo
1169 1169
         //####################################################################################
1170 1170
         //coluna codigo de barras
1171 1171
         $x += $w;
1172
-        $w = ($maxW-$w1-$w2);//85;
1172
+        $w = ($maxW - $w1 - $w2); //85;
1173 1173
         $w3 = $w;
1174 1174
         $h = 32;
1175 1175
         $this->pTextBox($x, $y, $w, $h);
@@ -1178,22 +1178,22 @@  discard block
 block discarded – undo
1178 1178
         $bW = 75;
1179 1179
         $bH = 12;
1180 1180
         //codigo de barras
1181
-        $this->pdf->Code128($x+(($w-$bW)/2), $y+2, $chave_acesso, $bW, $bH);
1181
+        $this->pdf->Code128($x + (($w - $bW) / 2), $y + 2, $chave_acesso, $bW, $bH);
1182 1182
         //linhas divisorias
1183
-        $this->pdf->Line($x, $y+4+$bH, $x+$w, $y+4+$bH);
1184
-        $this->pdf->Line($x, $y+12+$bH, $x+$w, $y+12+$bH);
1183
+        $this->pdf->Line($x, $y + 4 + $bH, $x + $w, $y + 4 + $bH);
1184
+        $this->pdf->Line($x, $y + 12 + $bH, $x + $w, $y + 12 + $bH);
1185 1185
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1186
-        $y1 = $y+4+$bH;
1186
+        $y1 = $y + 4 + $bH;
1187 1187
         $h = 7;
1188 1188
         $texto = 'CHAVE DE ACESSO';
1189 1189
         $this->pTextBox($x, $y1, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1190 1190
         $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B');
1191
-        $y1 = $y+8+$bH;
1191
+        $y1 = $y + 8 + $bH;
1192 1192
         $texto = $this->pFormat($chave_acesso, $this->formatoChave);
1193
-        $this->pTextBox($x+2, $y1, $w-2, $h, $texto, $aFont, 'T', 'C', 0, '');
1194
-        $y1 = $y+12+$bH;
1193
+        $this->pTextBox($x + 2, $y1, $w - 2, $h, $texto, $aFont, 'T', 'C', 0, '');
1194
+        $y1 = $y + 12 + $bH;
1195 1195
         $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'');
1196
-        $chaveContingencia="";
1196
+        $chaveContingencia = "";
1197 1197
         if ($this->pNotaDPEC()) {
1198 1198
             $cabecalhoProtoAutorizacao = 'NÚMERO DE REGISTRO DPEC';
1199 1199
         } else {
@@ -1204,16 +1204,16 @@  discard block
 block discarded – undo
1204 1204
             $chaveContingencia = $this->pGeraChaveAdicionalDeContingencia();
1205 1205
             $this->pdf->SetFillColor(0, 0, 0);
1206 1206
             //codigo de barras
1207
-            $this->pdf->Code128($x+11, $y1+1, $chaveContingencia, $bW*.9, $bH/2);
1207
+            $this->pdf->Code128($x + 11, $y1 + 1, $chaveContingencia, $bW * .9, $bH / 2);
1208 1208
         } else {
1209 1209
             $texto = 'Consulta de autenticidade no portal nacional da NF-e';
1210
-            $this->pTextBox($x+2, $y1, $w-2, $h, $texto, $aFont, 'T', 'C', 0, '');
1211
-            $y1 = $y+16+$bH;
1210
+            $this->pTextBox($x + 2, $y1, $w - 2, $h, $texto, $aFont, 'T', 'C', 0, '');
1211
+            $y1 = $y + 16 + $bH;
1212 1212
             $texto = 'www.nfe.fazenda.gov.br/portal ou no site da Sefaz Autorizadora';
1213 1213
             $this->pTextBox(
1214
-                $x+2,
1214
+                $x + 2,
1215 1215
                 $y1,
1216
-                $w-2,
1216
+                $w - 2,
1217 1217
                 $h,
1218 1218
                 $texto,
1219 1219
                 $aFont,
@@ -1229,7 +1229,7 @@  discard block
 block discarded – undo
1229 1229
         //natureza da operação
1230 1230
         $texto = 'NATUREZA DA OPERAÇÃO';
1231 1231
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1232
-        $w = $w1+$w2;
1232
+        $w = $w1 + $w2;
1233 1233
         $y = $oldY;
1234 1234
         $oldY += $h;
1235 1235
         $x = $oldX;
@@ -1259,7 +1259,7 @@  discard block
 block discarded – undo
1259 1259
                 $cStat = '';
1260 1260
             } else {
1261 1261
                 if (isset($this->nfeProc)) {
1262
-                    $texto = ! empty($this->nfeProc->getElementsByTagName("nProt")->item(0)->nodeValue) ?
1262
+                    $texto = !empty($this->nfeProc->getElementsByTagName("nProt")->item(0)->nodeValue) ?
1263 1263
                             $this->nfeProc->getElementsByTagName("nProt")->item(0)->nodeValue : '';
1264 1264
                     $tsHora = $this->pConvertTime($this->nfeProc->getElementsByTagName("dhRecbto")->item(0)->nodeValue);
1265 1265
                     if ($texto != '') {
@@ -1290,25 +1290,25 @@  discard block
 block discarded – undo
1290 1290
         $texto = 'INSCRIÇÃO ESTADUAL DO SUBST. TRIBUT.';
1291 1291
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1292 1292
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1293
-        $texto = ! empty($this->emit->getElementsByTagName("IEST")->item(0)->nodeValue)
1293
+        $texto = !empty($this->emit->getElementsByTagName("IEST")->item(0)->nodeValue)
1294 1294
              ? $this->emit->getElementsByTagName("IEST")->item(0)->nodeValue
1295 1295
              : '';
1296 1296
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
1297 1297
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1298 1298
         //CNPJ
1299 1299
         $x += $w;
1300
-        $w = ($maxW-(2*$w));
1300
+        $w = ($maxW - (2 * $w));
1301 1301
         $texto = 'CNPJ / CPF';
1302 1302
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1303 1303
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1304 1304
         //Pegando valor do CPF/CNPJ
1305
-        if (! empty($this->emit->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1305
+        if (!empty($this->emit->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1306 1306
             $texto = $this->pFormat(
1307 1307
                 $this->emit->getElementsByTagName("CNPJ")->item(0)->nodeValue,
1308 1308
                 "###.###.###/####-##"
1309 1309
             );
1310 1310
         } else {
1311
-            $texto = ! empty($this->emit->getElementsByTagName("CPF")->item(0)->nodeValue) ?
1311
+            $texto = !empty($this->emit->getElementsByTagName("CPF")->item(0)->nodeValue) ?
1312 1312
                 $this->pFormat(
1313 1313
                     $this->emit->getElementsByTagName("CPF")->item(0)->nodeValue,
1314 1314
                     "###.###.###-##"
@@ -1324,9 +1324,9 @@  discard block
 block discarded – undo
1324 1324
         if ($this->pNotaCancelada()) {
1325 1325
             //101 Cancelamento
1326 1326
             $x = 10;
1327
-            $y = $this->hPrint-130;
1327
+            $y = $this->hPrint - 130;
1328 1328
             $h = 25;
1329
-            $w = $maxW-(2*$x);
1329
+            $w = $maxW - (2 * $x);
1330 1330
             $this->pdf->SetTextColor(90, 90, 90);
1331 1331
             $texto = "NFe CANCELADA";
1332 1332
             $aFont = array('font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B');
@@ -1337,12 +1337,12 @@  discard block
 block discarded – undo
1337 1337
         if ($this->pNotaDPEC() || $this->tpEmis == 4) {
1338 1338
             //DPEC
1339 1339
             $x = 10;
1340
-            $y = $this->hPrint-130;
1340
+            $y = $this->hPrint - 130;
1341 1341
             $h = 25;
1342
-            $w = $maxW-(2*$x);
1342
+            $w = $maxW - (2 * $x);
1343 1343
             $this->pdf->SetTextColor(200, 200, 200);
1344
-            $texto = "DANFE impresso em contingência -\n".
1345
-                     "DPEC regularmente recebido pela Receita\n".
1344
+            $texto = "DANFE impresso em contingência -\n" .
1345
+                     "DPEC regularmente recebido pela Receita\n" .
1346 1346
                      "Federal do Brasil";
1347 1347
             $aFont = array('font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B');
1348 1348
             $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
@@ -1351,22 +1351,22 @@  discard block
 block discarded – undo
1351 1351
         if ($this->pNotaDenegada()) {
1352 1352
             //110 301 302 Denegada
1353 1353
             $x = 10;
1354
-            $y = $this->hPrint-130;
1354
+            $y = $this->hPrint - 130;
1355 1355
             $h = 25;
1356
-            $w = $maxW-(2*$x);
1356
+            $w = $maxW - (2 * $x);
1357 1357
             $this->pdf->SetTextColor(90, 90, 90);
1358 1358
             $texto = "NFe USO DENEGADO";
1359 1359
             $aFont = array('font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B');
1360 1360
             $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1361 1361
             $y += $h;
1362 1362
             $h = 5;
1363
-            $w = $maxW-(2*$x);
1363
+            $w = $maxW - (2 * $x);
1364 1364
             if (isset($this->infProt)) {
1365 1365
                 $xMotivo = $this->infProt->getElementsByTagName("xMotivo")->item(0)->nodeValue;
1366 1366
             } else {
1367 1367
                 $xMotivo = '';
1368 1368
             }
1369
-            $texto = "SEM VALOR FISCAL\n".$xMotivo;
1369
+            $texto = "SEM VALOR FISCAL\n" . $xMotivo;
1370 1370
             $aFont = array('font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B');
1371 1371
             $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1372 1372
             $this->pdf->SetTextColor(0, 0, 0);
@@ -1375,29 +1375,29 @@  discard block
 block discarded – undo
1375 1375
         if ($tpAmb != 1) {
1376 1376
             $x = 10;
1377 1377
             if ($this->orientacao == 'P') {
1378
-                $y = round($this->hPrint*2/3, 0);
1378
+                $y = round($this->hPrint * 2 / 3, 0);
1379 1379
             } else {
1380
-                $y = round($this->hPrint/2, 0);
1380
+                $y = round($this->hPrint / 2, 0);
1381 1381
             }
1382 1382
             $h = 5;
1383
-            $w = $maxW-(2*$x);
1383
+            $w = $maxW - (2 * $x);
1384 1384
             $this->pdf->SetTextColor(90, 90, 90);
1385 1385
             $texto = "SEM VALOR FISCAL";
1386 1386
             $aFont = array('font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B');
1387 1387
             $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1388 1388
             $aFont = array('font'=>$this->fontePadrao, 'size'=>30, 'style'=>'B');
1389 1389
             $texto = "AMBIENTE DE HOMOLOGAÇÃO";
1390
-            $this->pTextBox($x, $y+14, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1390
+            $this->pTextBox($x, $y + 14, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1391 1391
             $this->pdf->SetTextColor(0, 0, 0);
1392 1392
         } else {
1393 1393
             $x = 10;
1394 1394
             if ($this->orientacao == 'P') {
1395
-                $y = round($this->hPrint*2/3, 0);
1395
+                $y = round($this->hPrint * 2 / 3, 0);
1396 1396
             } else {
1397
-                $y = round($this->hPrint/2, 0);
1397
+                $y = round($this->hPrint / 2, 0);
1398 1398
             }//fim orientacao
1399 1399
             $h = 5;
1400
-            $w = $maxW-(2*$x);
1400
+            $w = $maxW - (2 * $x);
1401 1401
             $this->pdf->SetTextColor(90, 90, 90);
1402 1402
             //indicar FALTA DO PROTOCOLO se NFe não for em contingência
1403 1403
             if (($this->tpEmis == 2 || $this->tpEmis == 5) && !$this->pNotaDPEC()) {
@@ -1407,7 +1407,7 @@  discard block
 block discarded – undo
1407 1407
                 $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1408 1408
                 $aFont = array('font'=>$this->fontePadrao, 'size'=>30, 'style'=>'B');
1409 1409
                 $texto = "devido à problemas técnicos";
1410
-                $this->pTextBox($x, $y+12, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1410
+                $this->pTextBox($x, $y + 12, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1411 1411
             } else {
1412 1412
                 if (!isset($this->nfeProc)) {
1413 1413
                     if (!$this->pNotaDPEC()) {
@@ -1418,9 +1418,9 @@  discard block
 block discarded – undo
1418 1418
                     $aFont = array('font'=>$this->fontePadrao, 'size'=>30, 'style'=>'B');
1419 1419
                     $texto = "FALTA PROTOCOLO DE APROVAÇÃO DA SEFAZ";
1420 1420
                     if (!$this->pNotaDPEC()) {
1421
-                        $this->pTextBox($x, $y+12, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1421
+                        $this->pTextBox($x, $y + 12, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1422 1422
                     } else {
1423
-                        $this->pTextBox($x, $y+25, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1423
+                        $this->pTextBox($x, $y + 25, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1424 1424
                     }
1425 1425
                 }//fim nefProc
1426 1426
             }//fim tpEmis
@@ -1455,7 +1455,7 @@  discard block
 block discarded – undo
1455 1455
         $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
1456 1456
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1457 1457
         //NOME / RAZÃO SOCIAL
1458
-        $w = round($maxW*0.61, 0);
1458
+        $w = round($maxW * 0.61, 0);
1459 1459
         $w1 = $w;
1460 1460
         $y += 3;
1461 1461
         $texto = 'NOME / RAZÃO SOCIAL';
@@ -1470,19 +1470,19 @@  discard block
 block discarded – undo
1470 1470
         }
1471 1471
         //CNPJ / CPF
1472 1472
         $x += $w;
1473
-        $w = round($maxW*0.23, 0);
1473
+        $w = round($maxW * 0.23, 0);
1474 1474
         $w2 = $w;
1475 1475
         $texto = 'CNPJ / CPF';
1476 1476
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1477 1477
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1478 1478
         //Pegando valor do CPF/CNPJ
1479
-        if (! empty($this->dest->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1479
+        if (!empty($this->dest->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1480 1480
             $texto = $this->pFormat(
1481 1481
                 $this->dest->getElementsByTagName("CNPJ")->item(0)->nodeValue,
1482 1482
                 "###.###.###/####-##"
1483 1483
             );
1484 1484
         } else {
1485
-            $texto = ! empty($this->dest->getElementsByTagName("CPF")->item(0)->nodeValue) ?
1485
+            $texto = !empty($this->dest->getElementsByTagName("CPF")->item(0)->nodeValue) ?
1486 1486
                     $this->pFormat(
1487 1487
                         $this->dest->getElementsByTagName("CPF")->item(0)->nodeValue,
1488 1488
                         "###.###.###-##"
@@ -1492,15 +1492,15 @@  discard block
 block discarded – undo
1492 1492
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1493 1493
         //DATA DA EMISSÃO
1494 1494
         $x += $w;
1495
-        $w = $maxW-($w1+$w2);
1495
+        $w = $maxW - ($w1 + $w2);
1496 1496
         $wx = $w;
1497 1497
         $texto = 'DATA DA EMISSÃO';
1498 1498
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1499 1499
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1500
-        $dEmi = ! empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
1500
+        $dEmi = !empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
1501 1501
                 $this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue : '';
1502 1502
         if ($dEmi == '') {
1503
-            $dEmi = ! empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
1503
+            $dEmi = !empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
1504 1504
                     $this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue : '';
1505 1505
             $aDemi = explode('T', $dEmi);
1506 1506
             $dEmi = $aDemi[0];
@@ -1513,7 +1513,7 @@  discard block
 block discarded – undo
1513 1513
             $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 1, '');
1514 1514
         }
1515 1515
         //ENDEREÇO
1516
-        $w = round($maxW*0.47, 0);
1516
+        $w = round($maxW * 0.47, 0);
1517 1517
         $w1 = $w;
1518 1518
         $y += $h;
1519 1519
         $x = $oldX;
@@ -1528,7 +1528,7 @@  discard block
 block discarded – undo
1528 1528
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 0, '', true);
1529 1529
         //BAIRRO / DISTRITO
1530 1530
         $x += $w;
1531
-        $w = round($maxW*0.21, 0);
1531
+        $w = round($maxW * 0.21, 0);
1532 1532
         $w2 = $w;
1533 1533
         $texto = 'BAIRRO / DISTRITO';
1534 1534
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
@@ -1538,12 +1538,12 @@  discard block
 block discarded – undo
1538 1538
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1539 1539
         //CEP
1540 1540
         $x += $w;
1541
-        $w = $maxW-$w1-$w2-$wx;
1541
+        $w = $maxW - $w1 - $w2 - $wx;
1542 1542
         $w2 = $w;
1543 1543
         $texto = 'CEP';
1544 1544
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1545 1545
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1546
-        $texto = ! empty($this->dest->getElementsByTagName("CEP")->item(0)->nodeValue) ?
1546
+        $texto = !empty($this->dest->getElementsByTagName("CEP")->item(0)->nodeValue) ?
1547 1547
                 $this->dest->getElementsByTagName("CEP")->item(0)->nodeValue : '';
1548 1548
         $texto = $this->pFormat($texto, "#####-###");
1549 1549
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
@@ -1554,10 +1554,10 @@  discard block
 block discarded – undo
1554 1554
         $texto = 'DATA DA SAÍDA/ENTRADA';
1555 1555
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1556 1556
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1557
-        $dSaiEnt = ! empty($this->ide->getElementsByTagName("dSaiEnt")->item(0)->nodeValue) ?
1557
+        $dSaiEnt = !empty($this->ide->getElementsByTagName("dSaiEnt")->item(0)->nodeValue) ?
1558 1558
                 $this->ide->getElementsByTagName("dSaiEnt")->item(0)->nodeValue : '';
1559 1559
         if ($dSaiEnt == '') {
1560
-            $dSaiEnt = ! empty($this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue) ?
1560
+            $dSaiEnt = !empty($this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue) ?
1561 1561
                     $this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue : '';
1562 1562
             $aDsaient = explode('T', $dSaiEnt);
1563 1563
             $dSaiEnt = $aDsaient[0];
@@ -1574,7 +1574,7 @@  discard block
 block discarded – undo
1574 1574
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1575 1575
         $texto = $this->dest->getElementsByTagName("xMun")->item(0)->nodeValue;
1576 1576
         if (strtoupper(trim($texto)) == "EXTERIOR" && $this->dest->getElementsByTagName("xPais")->length > 0) {
1577
-            $texto .= " - " .  $this->dest->getElementsByTagName("xPais")->item(0)->nodeValue;
1577
+            $texto .= " - " . $this->dest->getElementsByTagName("xPais")->item(0)->nodeValue;
1578 1578
         }
1579 1579
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
1580 1580
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 0, '');
@@ -1589,18 +1589,18 @@  discard block
 block discarded – undo
1589 1589
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1590 1590
         //FONE / FAX
1591 1591
         $x += $w;
1592
-        $w = round(($maxW -$w1-$wx-8)/2, 0);
1592
+        $w = round(($maxW - $w1 - $wx - 8) / 2, 0);
1593 1593
         $w3 = $w;
1594 1594
         $texto = 'FONE / FAX';
1595 1595
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1596 1596
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1597
-        $texto = ! empty($this->dest->getElementsByTagName("fone")->item(0)->nodeValue) ?
1597
+        $texto = !empty($this->dest->getElementsByTagName("fone")->item(0)->nodeValue) ?
1598 1598
                 $this->dest->getElementsByTagName("fone")->item(0)->nodeValue : '';
1599 1599
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
1600 1600
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1601 1601
         //INSCRIÇÃO ESTADUAL
1602 1602
         $x += $w;
1603
-        $w = $maxW -$w1-$wx-8-$w3;
1603
+        $w = $maxW - $w1 - $wx - 8 - $w3;
1604 1604
         $texto = 'INSCRIÇÃO ESTADUAL';
1605 1605
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1606 1606
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -1614,10 +1614,10 @@  discard block
 block discarded – undo
1614 1614
         $texto = 'HORA DA SAÍDA/ENTRADA';
1615 1615
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1616 1616
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1617
-        $hSaiEnt = ! empty($this->ide->getElementsByTagName("hSaiEnt")->item(0)->nodeValue) ?
1617
+        $hSaiEnt = !empty($this->ide->getElementsByTagName("hSaiEnt")->item(0)->nodeValue) ?
1618 1618
                 $this->ide->getElementsByTagName("hSaiEnt")->item(0)->nodeValue : '';
1619 1619
         if ($hSaiEnt == '') {
1620
-            $dhSaiEnt = ! empty($this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue) ?
1620
+            $dhSaiEnt = !empty($this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue) ?
1621 1621
                     $this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue : '';
1622 1622
             $tsDhSaiEnt = $this->pConvertTime($dhSaiEnt);
1623 1623
             if ($tsDhSaiEnt != '') {
@@ -1696,7 +1696,7 @@  discard block
 block discarded – undo
1696 1696
     protected function pFaturaDANFE($x, $y)
1697 1697
     {
1698 1698
         $linha = 1;
1699
-        $h = 8+3;
1699
+        $h = 8 + 3;
1700 1700
         $oldx = $x;
1701 1701
         $textoFatura = $this->pGetTextoFatura();
1702 1702
         //verificar se existem duplicatas
@@ -1717,27 +1717,27 @@  discard block
 block discarded – undo
1717 1717
             $dupcont = 0;
1718 1718
             $nFat = $this->dup->length;
1719 1719
             if ($textoFatura !== "" && $this->exibirTextoFatura) {
1720
-                $myH=6;
1720
+                $myH = 6;
1721 1721
                 $myW = $this->wPrint;
1722 1722
                 if ($this->orientacao == 'L') {
1723 1723
                     $myW -= $this->wCanhoto;
1724 1724
                 }
1725 1725
                 $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'');
1726 1726
                 $this->pTextBox($x, $y, $myW, $myH, $textoFatura, $aFont, 'C', 'L', 1, '');
1727
-                $y+=$myH+1;
1727
+                $y += $myH + 1;
1728 1728
             }
1729 1729
             if ($this->orientacao == 'P') {
1730
-                $w = round($this->wPrint/7.018, 0)-1;
1730
+                $w = round($this->wPrint / 7.018, 0) - 1;
1731 1731
             } else {
1732 1732
                 $w = 28;
1733 1733
             }
1734 1734
             $increm = 1;
1735 1735
             foreach ($this->dup as $k => $d) {
1736
-                $nDup = ! empty($this->dup->item($k)->getElementsByTagName('nDup')->item(0)->nodeValue) ?
1736
+                $nDup = !empty($this->dup->item($k)->getElementsByTagName('nDup')->item(0)->nodeValue) ?
1737 1737
                         $this->dup->item($k)->getElementsByTagName('nDup')->item(0)->nodeValue : '';
1738
-                $dDup = ! empty($this->dup->item($k)->getElementsByTagName('dVenc')->item(0)->nodeValue) ?
1738
+                $dDup = !empty($this->dup->item($k)->getElementsByTagName('dVenc')->item(0)->nodeValue) ?
1739 1739
                         $this->pYmd2dmy($this->dup->item($k)->getElementsByTagName('dVenc')->item(0)->nodeValue) : '';
1740
-                $vDup = ! empty($this->dup->item($k)->getElementsByTagName('vDup')->item(0)->nodeValue) ?
1740
+                $vDup = !empty($this->dup->item($k)->getElementsByTagName('vDup')->item(0)->nodeValue) ?
1741 1741
                         'R$ ' . number_format(
1742 1742
                             $this->dup->item($k)->getElementsByTagName('vDup')->item(0)->nodeValue,
1743 1743
                             2,
@@ -1746,14 +1746,14 @@  discard block
 block discarded – undo
1746 1746
                         ) : '';
1747 1747
                 $h = 8;
1748 1748
                 $texto = '';
1749
-                if ($nDup!='0' && $nDup!='') {
1749
+                if ($nDup != '0' && $nDup != '') {
1750 1750
                     $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1751 1751
                     $this->pTextBox($x, $y, $w, $h, 'Num.', $aFont, 'T', 'L', 1, '');
1752 1752
                     $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
1753 1753
                     $this->pTextBox($x, $y, $w, $h, $nDup, $aFont, 'T', 'R', 0, '');
1754 1754
                 } else {
1755 1755
                     $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1756
-                    $this->pTextBox($x, $y, $w, $h, ($dupcont+1)."", $aFont, 'T', 'L', 1, '');
1756
+                    $this->pTextBox($x, $y, $w, $h, ($dupcont + 1) . "", $aFont, 'T', 'L', 1, '');
1757 1757
                 }
1758 1758
                 $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1759 1759
                 $this->pTextBox($x, $y, $w, $h, 'Venc.', $aFont, 'C', 'L', 0, '');
@@ -1763,7 +1763,7 @@  discard block
 block discarded – undo
1763 1763
                 $this->pTextBox($x, $y, $w, $h, 'Valor', $aFont, 'B', 'L', 0, '');
1764 1764
                 $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
1765 1765
                 $this->pTextBox($x, $y, $w, $h, $vDup, $aFont, 'B', 'R', 0, '');
1766
-                $x += $w+$increm;
1766
+                $x += $w + $increm;
1767 1767
                 $dupcont += 1;
1768 1768
                 if ($this->orientacao == 'P') {
1769 1769
                     $maxDupCont = 6;
@@ -1785,10 +1785,10 @@  discard block
 block discarded – undo
1785 1785
                 $y -= 9;
1786 1786
                 $linha--;
1787 1787
             }
1788
-            return ($y+$h);
1788
+            return ($y + $h);
1789 1789
         } else {
1790 1790
             $linha = 0;
1791
-            return ($y-2);
1791
+            return ($y - 2);
1792 1792
         }
1793 1793
     } //fim da função faturaDANFE
1794 1794
 
@@ -1804,7 +1804,7 @@  discard block
 block discarded – undo
1804 1804
     protected function pagamentoDANFE($x, $y)
1805 1805
     {
1806 1806
         $linha = 1;
1807
-        $h = 8+3;
1807
+        $h = 8 + 3;
1808 1808
         $oldx = $x;
1809 1809
         //verificar se existem cobranças definidas
1810 1810
         if (isset($this->detPag) && $this->detPag->length > 0) {
@@ -1823,7 +1823,7 @@  discard block
 block discarded – undo
1823 1823
             $dups = "";
1824 1824
             $dupcont = 0;
1825 1825
             if ($this->orientacao == 'P') {
1826
-                $w = round($this->wPrint/7.018, 0)-1;
1826
+                $w = round($this->wPrint / 7.018, 0) - 1;
1827 1827
             } else {
1828 1828
                 $w = 28;
1829 1829
             }
@@ -1833,16 +1833,16 @@  discard block
 block discarded – undo
1833 1833
                 $maxDupCont = 8;
1834 1834
             }
1835 1835
             $increm = 1;
1836
-            $formaPagamento = array('01'=>'Dinheiro','02'=>'Cheque','03'=>'Cartão de Crédito',
1837
-                                    '04'=>'Cartão de Débito','05'=>'Crédito Loja','10'=>'Vale Alimentação',
1838
-                                    '11'=>'Vale Refeição','12'=>'Vale Presente','13'=>'Vale Combustível',
1839
-                                    '14'=>'Duplicata Mercantil','15'=>'Boleto','90'=>'Sem pagamento','99'=>'Outros');
1840
-            $bandeira = array('01'=>'Visa','02'=>'Mastercard','03'=>'American','04'=>'Sorocred','05'=>'Diners',
1841
-                              '06'=>'Elo','07'=>'Hipercard','08'=>'Aura','09'=>'Cabal','99'=>'Outros');
1836
+            $formaPagamento = array('01'=>'Dinheiro', '02'=>'Cheque', '03'=>'Cartão de Crédito',
1837
+                                    '04'=>'Cartão de Débito', '05'=>'Crédito Loja', '10'=>'Vale Alimentação',
1838
+                                    '11'=>'Vale Refeição', '12'=>'Vale Presente', '13'=>'Vale Combustível',
1839
+                                    '14'=>'Duplicata Mercantil', '15'=>'Boleto', '90'=>'Sem pagamento', '99'=>'Outros');
1840
+            $bandeira = array('01'=>'Visa', '02'=>'Mastercard', '03'=>'American', '04'=>'Sorocred', '05'=>'Diners',
1841
+                              '06'=>'Elo', '07'=>'Hipercard', '08'=>'Aura', '09'=>'Cabal', '99'=>'Outros');
1842 1842
             foreach ($this->detPag as $k => $d) {
1843 1843
                 $fPag = !empty($this->detPag->item($k)->getElementsByTagName('tPag')->item(0)->nodeValue)
1844 1844
                     ? $this->detPag->item($k)->getElementsByTagName('tPag')->item(0)->nodeValue : '0';
1845
-                $vPag = ! empty($this->detPag->item($k)->getElementsByTagName('vPag')->item(0)->nodeValue)
1845
+                $vPag = !empty($this->detPag->item($k)->getElementsByTagName('vPag')->item(0)->nodeValue)
1846 1846
                     ? 'R$ ' . number_format(
1847 1847
                         $this->detPag->item($k)->getElementsByTagName('vPag')->item(0)->nodeValue,
1848 1848
                         2,
@@ -1853,7 +1853,7 @@  discard block
 block discarded – undo
1853 1853
                 $texto = '';
1854 1854
                 if (isset($formaPagamento[$fPag])) {
1855 1855
                     /*Exibir Item sem pagamento ou outros?*/
1856
-                    if ($fPag=='90' || $fPag=='99') {
1856
+                    if ($fPag == '90' || $fPag == '99') {
1857 1857
                         continue;
1858 1858
                     }
1859 1859
                     $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
@@ -1862,16 +1862,16 @@  discard block
 block discarded – undo
1862 1862
                     $this->pTextBox($x, $y, $w, $h, $formaPagamento[$fPag], $aFont, 'T', 'R', 0, '');
1863 1863
                 } else {
1864 1864
                     $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'');
1865
-                    $this->pTextBox($x, $y, $w, $h, "Forma ".$fPag." não encontrado", $aFont, 'T', 'L', 1, '');
1865
+                    $this->pTextBox($x, $y, $w, $h, "Forma " . $fPag . " não encontrado", $aFont, 'T', 'L', 1, '');
1866 1866
                 }
1867 1867
                 $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1868 1868
                 $this->pTextBox($x, $y, $w, $h, 'Valor', $aFont, 'B', 'L', 0, '');
1869 1869
                 $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
1870 1870
                 $this->pTextBox($x, $y, $w, $h, $vPag, $aFont, 'B', 'R', 0, '');
1871
-                $x += $w+$increm;
1871
+                $x += $w + $increm;
1872 1872
                 $dupcont += 1;
1873 1873
 
1874
-                if ($dupcont>$maxDupCont) {
1874
+                if ($dupcont > $maxDupCont) {
1875 1875
                     $y += 9;
1876 1876
                     $x = $oldx;
1877 1877
                     $dupcont = 0;
@@ -1886,10 +1886,10 @@  discard block
 block discarded – undo
1886 1886
                 $y -= 9;
1887 1887
                 $linha--;
1888 1888
             }
1889
-            return ($y+$h);
1889
+            return ($y + $h);
1890 1890
         } else {
1891 1891
             $linha = 0;
1892
-            return ($y-2);
1892
+            return ($y - 2);
1893 1893
         }
1894 1894
     } //fim da função pagamentoDANFE
1895 1895
     
@@ -2001,7 +2001,7 @@  discard block
 block discarded – undo
2001 2001
         }
2002 2002
         $x = $this->pImpostoDanfeHelper($x, $y, $w, $h, "V. TOTAL DA NOTA", "vNF");
2003 2003
 
2004
-        return ($y+$h);
2004
+        return ($y + $h);
2005 2005
     } //fim impostoDANFE
2006 2006
 
2007 2007
     /**
@@ -2029,13 +2029,13 @@  discard block
 block discarded – undo
2029 2029
         $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
2030 2030
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
2031 2031
         //NOME / RAZÃO SOCIAL
2032
-        $w1 = $maxW*0.29;
2032
+        $w1 = $maxW * 0.29;
2033 2033
         $y += 3;
2034 2034
         $texto = 'NOME / RAZÃO SOCIAL';
2035 2035
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2036 2036
         $this->pTextBox($x, $y, $w1, $h, $texto, $aFont, 'T', 'L', 1, '');
2037 2037
         if (isset($this->transporta)) {
2038
-            $texto = ! empty($this->transporta->getElementsByTagName("xNome")->item(0)->nodeValue) ?
2038
+            $texto = !empty($this->transporta->getElementsByTagName("xNome")->item(0)->nodeValue) ?
2039 2039
                     $this->transporta->getElementsByTagName("xNome")->item(0)->nodeValue : '';
2040 2040
         } else {
2041 2041
             $texto = '';
@@ -2044,11 +2044,11 @@  discard block
 block discarded – undo
2044 2044
         $this->pTextBox($x, $y, $w1, $h, $texto, $aFont, 'B', 'L', 0, '');
2045 2045
         //FRETE POR CONTA
2046 2046
         $x += $w1;
2047
-        $w2 = $maxW*0.15;
2047
+        $w2 = $maxW * 0.15;
2048 2048
         $texto = 'FRETE';
2049 2049
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2050 2050
         $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
2051
-        $tipoFrete = ! empty($this->transp->getElementsByTagName("modFrete")->item(0)->nodeValue) ?
2051
+        $tipoFrete = !empty($this->transp->getElementsByTagName("modFrete")->item(0)->nodeValue) ?
2052 2052
                 $this->transp->getElementsByTagName("modFrete")->item(0)->nodeValue : '0';
2053 2053
         switch ($tipoFrete) {
2054 2054
             case 0:
@@ -2078,7 +2078,7 @@  discard block
 block discarded – undo
2078 2078
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2079 2079
         $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
2080 2080
         if (isset($this->veicTransp)) {
2081
-            $texto = ! empty($this->veicTransp->getElementsByTagName("RNTC")->item(0)->nodeValue) ?
2081
+            $texto = !empty($this->veicTransp->getElementsByTagName("RNTC")->item(0)->nodeValue) ?
2082 2082
                     $this->veicTransp->getElementsByTagName("RNTC")->item(0)->nodeValue : '';
2083 2083
         } else {
2084 2084
             $texto = '';
@@ -2091,10 +2091,10 @@  discard block
 block discarded – undo
2091 2091
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2092 2092
         $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
2093 2093
         if (isset($this->veicTransp)) {
2094
-            $texto = ! empty($this->veicTransp->getElementsByTagName("placa")->item(0)->nodeValue) ?
2094
+            $texto = !empty($this->veicTransp->getElementsByTagName("placa")->item(0)->nodeValue) ?
2095 2095
                     $this->veicTransp->getElementsByTagName("placa")->item(0)->nodeValue : '';
2096 2096
         } elseif (isset($this->reboque)) {
2097
-            $texto = ! empty($this->reboque->getElementsByTagName("placa")->item(0)->nodeValue) ?
2097
+            $texto = !empty($this->reboque->getElementsByTagName("placa")->item(0)->nodeValue) ?
2098 2098
                     $this->reboque->getElementsByTagName("placa")->item(0)->nodeValue : '';
2099 2099
         } else {
2100 2100
             $texto = '';
@@ -2103,15 +2103,15 @@  discard block
 block discarded – undo
2103 2103
         $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'B', 'C', 0, '');
2104 2104
         //UF
2105 2105
         $x += $w2;
2106
-        $w3 = round($maxW*0.04, 0);
2106
+        $w3 = round($maxW * 0.04, 0);
2107 2107
         $texto = 'UF';
2108 2108
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2109 2109
         $this->pTextBox($x, $y, $w3, $h, $texto, $aFont, 'T', 'L', 1, '');
2110 2110
         if (isset($this->veicTransp)) {
2111
-            $texto = ! empty($this->veicTransp->getElementsByTagName("UF")->item(0)->nodeValue) ?
2111
+            $texto = !empty($this->veicTransp->getElementsByTagName("UF")->item(0)->nodeValue) ?
2112 2112
                     $this->veicTransp->getElementsByTagName("UF")->item(0)->nodeValue : '';
2113 2113
         } elseif (isset($this->reboque)) {
2114
-            $texto = ! empty($this->reboque->getElementsByTagName("UF")->item(0)->nodeValue) ?
2114
+            $texto = !empty($this->reboque->getElementsByTagName("UF")->item(0)->nodeValue) ?
2115 2115
                     $this->reboque->getElementsByTagName("UF")->item(0)->nodeValue : '';
2116 2116
         } else {
2117 2117
             $texto = '';
@@ -2120,18 +2120,18 @@  discard block
 block discarded – undo
2120 2120
         $this->pTextBox($x, $y, $w3, $h, $texto, $aFont, 'B', 'C', 0, '');
2121 2121
         //CNPJ / CPF
2122 2122
         $x += $w3;
2123
-        $w = $maxW-($w1+3*$w2+$w3);
2123
+        $w = $maxW - ($w1 + 3 * $w2 + $w3);
2124 2124
         $texto = 'CNPJ / CPF';
2125 2125
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2126 2126
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
2127 2127
         if (isset($this->transporta)) {
2128
-            $texto = ! empty($this->transporta->getElementsByTagName("CNPJ")->item(0)->nodeValue) ?
2128
+            $texto = !empty($this->transporta->getElementsByTagName("CNPJ")->item(0)->nodeValue) ?
2129 2129
                     $this->pFormat(
2130 2130
                         $this->transporta->getElementsByTagName("CNPJ")->item(0)->nodeValue,
2131 2131
                         "##.###.###/####-##"
2132 2132
                     ) : '';
2133 2133
             if ($texto == '') {
2134
-                $texto = ! empty($this->transporta->getElementsByTagName("CPF")->item(0)->nodeValue) ?
2134
+                $texto = !empty($this->transporta->getElementsByTagName("CPF")->item(0)->nodeValue) ?
2135 2135
                         $this->pFormat(
2136 2136
                             $this->transporta->getElementsByTagName("CPF")->item(0)->nodeValue,
2137 2137
                             "###.###.###-##"
@@ -2147,12 +2147,12 @@  discard block
 block discarded – undo
2147 2147
         $y += $h;
2148 2148
         $x = $oldX;
2149 2149
         $h = 7;
2150
-        $w1 = $maxW*0.44;
2150
+        $w1 = $maxW * 0.44;
2151 2151
         $texto = 'ENDEREÇO';
2152 2152
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2153 2153
         $this->pTextBox($x, $y, $w1, $h, $texto, $aFont, 'T', 'L', 1, '');
2154 2154
         if (isset($this->transporta)) {
2155
-            $texto = ! empty($this->transporta->getElementsByTagName("xEnder")->item(0)->nodeValue) ?
2155
+            $texto = !empty($this->transporta->getElementsByTagName("xEnder")->item(0)->nodeValue) ?
2156 2156
                     $this->transporta->getElementsByTagName("xEnder")->item(0)->nodeValue : '';
2157 2157
         } else {
2158 2158
             $texto = '';
@@ -2161,12 +2161,12 @@  discard block
 block discarded – undo
2161 2161
         $this->pTextBox($x, $y, $w1, $h, $texto, $aFont, 'B', 'L', 0, '');
2162 2162
         //MUNICÍPIO
2163 2163
         $x += $w1;
2164
-        $w2 = round($maxW*0.30, 0);
2164
+        $w2 = round($maxW * 0.30, 0);
2165 2165
         $texto = 'MUNICÍPIO';
2166 2166
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2167 2167
         $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
2168 2168
         if (isset($this->transporta)) {
2169
-            $texto = ! empty($this->transporta->getElementsByTagName("xMun")->item(0)->nodeValue) ?
2169
+            $texto = !empty($this->transporta->getElementsByTagName("xMun")->item(0)->nodeValue) ?
2170 2170
                     $this->transporta->getElementsByTagName("xMun")->item(0)->nodeValue : '';
2171 2171
         } else {
2172 2172
             $texto = '';
@@ -2175,12 +2175,12 @@  discard block
 block discarded – undo
2175 2175
         $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'B', 'C', 0, '');
2176 2176
         //UF
2177 2177
         $x += $w2;
2178
-        $w3 = round($maxW*0.04, 0);
2178
+        $w3 = round($maxW * 0.04, 0);
2179 2179
         $texto = 'UF';
2180 2180
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2181 2181
         $this->pTextBox($x, $y, $w3, $h, $texto, $aFont, 'T', 'L', 1, '');
2182 2182
         if (isset($this->transporta)) {
2183
-            $texto = ! empty($this->transporta->getElementsByTagName("UF")->item(0)->nodeValue) ?
2183
+            $texto = !empty($this->transporta->getElementsByTagName("UF")->item(0)->nodeValue) ?
2184 2184
                     $this->transporta->getElementsByTagName("UF")->item(0)->nodeValue : '';
2185 2185
         } else {
2186 2186
             $texto = '';
@@ -2189,13 +2189,13 @@  discard block
 block discarded – undo
2189 2189
         $this->pTextBox($x, $y, $w3, $h, $texto, $aFont, 'B', 'C', 0, '');
2190 2190
         //INSCRIÇÃO ESTADUAL
2191 2191
         $x += $w3;
2192
-        $w = $maxW-($w1+$w2+$w3);
2192
+        $w = $maxW - ($w1 + $w2 + $w3);
2193 2193
         $texto = 'INSCRIÇÃO ESTADUAL';
2194 2194
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2195 2195
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
2196 2196
         $texto = '';
2197 2197
         if (isset($this->transporta)) {
2198
-            if (! empty($this->transporta->getElementsByTagName("IE")->item(0)->nodeValue)) {
2198
+            if (!empty($this->transporta->getElementsByTagName("IE")->item(0)->nodeValue)) {
2199 2199
                 $texto = $this->transporta->getElementsByTagName("IE")->item(0)->nodeValue;
2200 2200
             }
2201 2201
         }
@@ -2208,16 +2208,16 @@  discard block
 block discarded – undo
2208 2208
         $marca = '';
2209 2209
         $numero = '';
2210 2210
         $texto = '';
2211
-        $pesoBruto=0;
2212
-        $pesoLiquido=0;
2211
+        $pesoBruto = 0;
2212
+        $pesoLiquido = 0;
2213 2213
         foreach ($volumes as $volume) {
2214
-            $quantidade += ! empty($volume->getElementsByTagName("qVol")->item(0)->nodeValue) ?
2214
+            $quantidade += !empty($volume->getElementsByTagName("qVol")->item(0)->nodeValue) ?
2215 2215
                     $volume->getElementsByTagName("qVol")->item(0)->nodeValue : 0;
2216
-            $pesoBruto += ! empty($volume->getElementsByTagName("pesoB")->item(0)->nodeValue) ?
2216
+            $pesoBruto += !empty($volume->getElementsByTagName("pesoB")->item(0)->nodeValue) ?
2217 2217
                     $volume->getElementsByTagName("pesoB")->item(0)->nodeValue : 0;
2218
-            $pesoLiquido += ! empty($volume->getElementsByTagName("pesoL")->item(0)->nodeValue) ?
2218
+            $pesoLiquido += !empty($volume->getElementsByTagName("pesoL")->item(0)->nodeValue) ?
2219 2219
                     $volume->getElementsByTagName("pesoL")->item(0)->nodeValue : 0;
2220
-            $texto = ! empty($this->transp->getElementsByTagName("esp")->item(0)->nodeValue) ?
2220
+            $texto = !empty($this->transp->getElementsByTagName("esp")->item(0)->nodeValue) ?
2221 2221
                     $this->transp->getElementsByTagName("esp")->item(0)->nodeValue : '';
2222 2222
             if ($texto != $especie && $especie != '') {
2223 2223
                 //tem várias especies
@@ -2225,7 +2225,7 @@  discard block
 block discarded – undo
2225 2225
             } else {
2226 2226
                 $especie = $texto;
2227 2227
             }
2228
-            $texto = ! empty($this->transp->getElementsByTagName("marca")->item(0)->nodeValue) ?
2228
+            $texto = !empty($this->transp->getElementsByTagName("marca")->item(0)->nodeValue) ?
2229 2229
                     $this->transp->getElementsByTagName("marca")->item(0)->nodeValue : '';
2230 2230
             if ($texto != $marca && $marca != '') {
2231 2231
                 //tem várias especies
@@ -2233,7 +2233,7 @@  discard block
 block discarded – undo
2233 2233
             } else {
2234 2234
                 $marca = $texto;
2235 2235
             }
2236
-            $texto = ! empty($this->transp->getElementsByTagName("nVol")->item(0)->nodeValue) ?
2236
+            $texto = !empty($this->transp->getElementsByTagName("nVol")->item(0)->nodeValue) ?
2237 2237
                     $this->transp->getElementsByTagName("nVol")->item(0)->nodeValue : '';
2238 2238
             if ($texto != $numero && $numero != '') {
2239 2239
                 //tem várias especies
@@ -2248,7 +2248,7 @@  discard block
 block discarded – undo
2248 2248
         $y += $h;
2249 2249
         $x = $oldX;
2250 2250
         $h = 7;
2251
-        $w1 = round($maxW*0.10, 0);
2251
+        $w1 = round($maxW * 0.10, 0);
2252 2252
         $texto = 'QUANTIDADE';
2253 2253
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2254 2254
         $this->pTextBox($x, $y, $w1, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -2259,7 +2259,7 @@  discard block
 block discarded – undo
2259 2259
         }
2260 2260
         //ESPÉCIE
2261 2261
         $x += $w1;
2262
-        $w2 = round($maxW*0.17, 0);
2262
+        $w2 = round($maxW * 0.17, 0);
2263 2263
         $texto = 'ESPÉCIE';
2264 2264
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2265 2265
         $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -2271,7 +2271,7 @@  discard block
 block discarded – undo
2271 2271
         $texto = 'MARCA';
2272 2272
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2273 2273
         $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
2274
-        $texto = ! empty($this->transp->getElementsByTagName("marca")->item(0)->nodeValue) ?
2274
+        $texto = !empty($this->transp->getElementsByTagName("marca")->item(0)->nodeValue) ?
2275 2275
                 $this->transp->getElementsByTagName("marca")->item(0)->nodeValue : '';
2276 2276
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
2277 2277
         $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'B', 'C', 0, '');
@@ -2285,7 +2285,7 @@  discard block
 block discarded – undo
2285 2285
         $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'B', 'C', 0, '');
2286 2286
         //PESO BRUTO
2287 2287
         $x += $w2;
2288
-        $w3 = round($maxW*0.20, 0);
2288
+        $w3 = round($maxW * 0.20, 0);
2289 2289
         $texto = 'PESO BRUTO';
2290 2290
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2291 2291
         $this->pTextBox($x, $y, $w3, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -2298,7 +2298,7 @@  discard block
 block discarded – undo
2298 2298
         $this->pTextBox($x, $y, $w3, $h, $texto, $aFont, 'B', 'R', 0, '');
2299 2299
         //PESO LÍQUIDO
2300 2300
         $x += $w3;
2301
-        $w = $maxW -($w1+3*$w2+$w3);
2301
+        $w = $maxW - ($w1 + 3 * $w2 + $w3);
2302 2302
         $texto = 'PESO LÍQUIDO';
2303 2303
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2304 2304
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -2309,7 +2309,7 @@  discard block
 block discarded – undo
2309 2309
         }
2310 2310
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
2311 2311
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'R', 0, '');
2312
-        return ($y+$h);
2312
+        return ($y + $h);
2313 2313
     } //fim transporteDANFE
2314 2314
 
2315 2315
 
@@ -2321,7 +2321,7 @@  discard block
 block discarded – undo
2321 2321
             return "";
2322 2322
         }
2323 2323
         $valor_original = $valor_original->nodeValue;
2324
-        $valor = ! empty($valor_original) ? number_format($valor_original, 2, ",", ".") : '';
2324
+        $valor = !empty($valor_original) ? number_format($valor_original, 2, ",", ".") : '';
2325 2325
 
2326 2326
         if ($valor != "") {
2327 2327
             return sprintf($formato, $valor);
@@ -2365,13 +2365,13 @@  discard block
 block discarded – undo
2365 2365
             $impostos .= $this->pDescricaoProdutoHelper($ICMSUFDest, "vICMSUFDest", " vICMSUFDest=%s");
2366 2366
             $impostos .= $this->pDescricaoProdutoHelper($ICMSUFDest, "vICMSUFRemet", " vICMSUFRemet=%s");
2367 2367
         }
2368
-        $infAdProd = ! empty($itemProd->getElementsByTagName('infAdProd')->item(0)->nodeValue) ?
2368
+        $infAdProd = !empty($itemProd->getElementsByTagName('infAdProd')->item(0)->nodeValue) ?
2369 2369
                 substr($this->pAnfavea($itemProd->getElementsByTagName('infAdProd')->item(0)->nodeValue), 0, 500) : '';
2370
-        if (! empty($infAdProd)) {
2370
+        if (!empty($infAdProd)) {
2371 2371
             $infAdProd = trim($infAdProd);
2372 2372
             $infAdProd .= ' ';
2373 2373
         }
2374
-        $loteTxt ='';
2374
+        $loteTxt = '';
2375 2375
         $rastro = $prod->getElementsByTagName("med");
2376 2376
         if (!isset($rastro)) {
2377 2377
             $rastro = $prod->getElementsByTagName("rastro");
@@ -2387,14 +2387,14 @@  discard block
 block discarded – undo
2387 2387
                 $i++;
2388 2388
             }
2389 2389
             if ($loteTxt != '') {
2390
-                $loteTxt.= ' ';
2390
+                $loteTxt .= ' ';
2391 2391
             }
2392 2392
         }
2393 2393
         //NT2013.006 FCI
2394
-        $nFCI = (! empty($itemProd->getElementsByTagName('nFCI')->item(0)->nodeValue)) ?
2395
-                ' FCI:'.$itemProd->getElementsByTagName('nFCI')->item(0)->nodeValue : '';
2396
-        $tmp_ad=$infAdProd . ($this->descProdInfoComplemento ? $loteTxt . $impostos . $nFCI : '');
2397
-        $texto = $prod->getElementsByTagName("xProd")->item(0)->nodeValue . (strlen($tmp_ad)!=0?"\n    ".$tmp_ad:'');
2394
+        $nFCI = (!empty($itemProd->getElementsByTagName('nFCI')->item(0)->nodeValue)) ?
2395
+                ' FCI:' . $itemProd->getElementsByTagName('nFCI')->item(0)->nodeValue : '';
2396
+        $tmp_ad = $infAdProd . ($this->descProdInfoComplemento ? $loteTxt . $impostos . $nFCI : '');
2397
+        $texto = $prod->getElementsByTagName("xProd")->item(0)->nodeValue . (strlen($tmp_ad) != 0 ? "\n    " . $tmp_ad : '');
2398 2398
         //decodifica os caracteres html no xml
2399 2399
         $texto = html_entity_decode($texto);
2400 2400
         if ($this->descProdQuebraLinha) {
@@ -2444,104 +2444,104 @@  discard block
 block discarded – undo
2444 2444
         // cabecalho LOOP COM OS DADOS DOS PRODUTOS
2445 2445
         //CÓDIGO PRODUTO
2446 2446
         $texto = "CÓDIGO PRODUTO";
2447
-        $w1 = round($w*0.09, 0);
2447
+        $w1 = round($w * 0.09, 0);
2448 2448
         $h = 4;
2449 2449
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2450 2450
         $this->pTextBox($x, $y, $w1, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2451
-        $this->pdf->Line($x+$w1, $y, $x+$w1, $y+$hmax);
2451
+        $this->pdf->Line($x + $w1, $y, $x + $w1, $y + $hmax);
2452 2452
         //DESCRIÇÃO DO PRODUTO / SERVIÇO
2453 2453
         $x += $w1;
2454
-        $w2 = round($w*0.28, 0);
2454
+        $w2 = round($w * 0.28, 0);
2455 2455
         $texto = 'DESCRIÇÃO DO PRODUTO / SERVIÇO';
2456 2456
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2457 2457
         $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2458
-        $this->pdf->Line($x+$w2, $y, $x+$w2, $y+$hmax);
2458
+        $this->pdf->Line($x + $w2, $y, $x + $w2, $y + $hmax);
2459 2459
         //NCM/SH
2460 2460
         $x += $w2;
2461
-        $w3 = round($w*0.06, 0);
2461
+        $w3 = round($w * 0.06, 0);
2462 2462
         $texto = 'NCM/SH';
2463 2463
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2464 2464
         $this->pTextBox($x, $y, $w3, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2465
-        $this->pdf->Line($x+$w3, $y, $x+$w3, $y+$hmax);
2465
+        $this->pdf->Line($x + $w3, $y, $x + $w3, $y + $hmax);
2466 2466
         //O/CST ou O/CSOSN
2467 2467
         $x += $w3;
2468
-        $w4 = round($w*0.05, 0);
2469
-        $texto = 'O/CSOSN';//Regime do Simples CRT = 1 ou CRT = 2
2468
+        $w4 = round($w * 0.05, 0);
2469
+        $texto = 'O/CSOSN'; //Regime do Simples CRT = 1 ou CRT = 2
2470 2470
         if ($this->getTagValue($this->emit, 'CRT') == '3') {
2471
-             $texto = 'O/CST';//Regime Normal
2471
+             $texto = 'O/CST'; //Regime Normal
2472 2472
         }
2473 2473
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2474 2474
         $this->pTextBox($x, $y, $w4, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2475
-        $this->pdf->Line($x+$w4, $y, $x+$w4, $y+$hmax);
2475
+        $this->pdf->Line($x + $w4, $y, $x + $w4, $y + $hmax);
2476 2476
         //CFOP
2477 2477
         $x += $w4;
2478
-        $w5 = round($w*0.04, 0);
2478
+        $w5 = round($w * 0.04, 0);
2479 2479
         $texto = 'CFOP';
2480 2480
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2481 2481
         $this->pTextBox($x, $y, $w5, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2482
-        $this->pdf->Line($x+$w5, $y, $x+$w5, $y+$hmax);
2482
+        $this->pdf->Line($x + $w5, $y, $x + $w5, $y + $hmax);
2483 2483
         //UN
2484 2484
         $x += $w5;
2485
-        $w6 = round($w*0.03, 0);
2485
+        $w6 = round($w * 0.03, 0);
2486 2486
         $texto = 'UN';
2487 2487
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2488 2488
         $this->pTextBox($x, $y, $w6, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2489
-        $this->pdf->Line($x+$w6, $y, $x+$w6, $y+$hmax);
2489
+        $this->pdf->Line($x + $w6, $y, $x + $w6, $y + $hmax);
2490 2490
         //QUANT
2491 2491
         $x += $w6;
2492
-        $w7 = round($w*0.07, 0);
2492
+        $w7 = round($w * 0.07, 0);
2493 2493
         $texto = 'QUANT';
2494 2494
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2495 2495
         $this->pTextBox($x, $y, $w7, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2496
-        $this->pdf->Line($x+$w7, $y, $x+$w7, $y+$hmax);
2496
+        $this->pdf->Line($x + $w7, $y, $x + $w7, $y + $hmax);
2497 2497
         //VALOR UNIT
2498 2498
         $x += $w7;
2499
-        $w8 = round($w*0.06, 0);
2499
+        $w8 = round($w * 0.06, 0);
2500 2500
         $texto = 'VALOR UNIT';
2501 2501
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2502 2502
         $this->pTextBox($x, $y, $w8, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2503
-        $this->pdf->Line($x+$w8, $y, $x+$w8, $y+$hmax);
2503
+        $this->pdf->Line($x + $w8, $y, $x + $w8, $y + $hmax);
2504 2504
         //VALOR TOTAL
2505 2505
         $x += $w8;
2506
-        $w9 = round($w*0.06, 0);
2506
+        $w9 = round($w * 0.06, 0);
2507 2507
         $texto = 'VALOR TOTAL';
2508 2508
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2509 2509
         $this->pTextBox($x, $y, $w9, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2510
-        $this->pdf->Line($x+$w9, $y, $x+$w9, $y+$hmax);
2510
+        $this->pdf->Line($x + $w9, $y, $x + $w9, $y + $hmax);
2511 2511
         //B.CÁLC ICMS
2512 2512
         $x += $w9;
2513
-        $w10 = round($w*0.06, 0);
2513
+        $w10 = round($w * 0.06, 0);
2514 2514
         $texto = 'B.CÁLC ICMS';
2515 2515
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2516 2516
         $this->pTextBox($x, $y, $w10, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2517
-        $this->pdf->Line($x+$w10, $y, $x+$w10, $y+$hmax);
2517
+        $this->pdf->Line($x + $w10, $y, $x + $w10, $y + $hmax);
2518 2518
         //VALOR ICMS
2519 2519
         $x += $w10;
2520
-        $w11 = round($w*0.06, 0);
2520
+        $w11 = round($w * 0.06, 0);
2521 2521
         $texto = 'VALOR ICMS';
2522 2522
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2523 2523
         $this->pTextBox($x, $y, $w11, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2524
-        $this->pdf->Line($x+$w11, $y, $x+$w11, $y+$hmax);
2524
+        $this->pdf->Line($x + $w11, $y, $x + $w11, $y + $hmax);
2525 2525
         //VALOR IPI
2526 2526
         $x += $w11;
2527
-        $w12 = round($w*0.05, 0);
2527
+        $w12 = round($w * 0.05, 0);
2528 2528
         $texto = 'VALOR IPI';
2529 2529
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2530 2530
         $this->pTextBox($x, $y, $w12, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2531
-        $this->pdf->Line($x+$w12, $y, $x+$w12, $y+$hmax);
2531
+        $this->pdf->Line($x + $w12, $y, $x + $w12, $y + $hmax);
2532 2532
         //ALÍQ. ICMS
2533 2533
         $x += $w12;
2534
-        $w13 = round($w*0.035, 0);
2534
+        $w13 = round($w * 0.035, 0);
2535 2535
         $texto = 'ALÍQ. ICMS';
2536 2536
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2537 2537
         $this->pTextBox($x, $y, $w13, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2538
-        $this->pdf->Line($x+$w13, $y, $x+$w13, $y+$hmax);
2538
+        $this->pdf->Line($x + $w13, $y, $x + $w13, $y + $hmax);
2539 2539
         //ALÍQ. IPI
2540 2540
         $x += $w13;
2541
-        $w14 = $w-($w1+$w2+$w3+$w4+$w5+$w6+$w7+$w8+$w9+$w10+$w11+$w12+$w13);
2541
+        $w14 = $w - ($w1 + $w2 + $w3 + $w4 + $w5 + $w6 + $w7 + $w8 + $w9 + $w10 + $w11 + $w12 + $w13);
2542 2542
         $texto = 'ALÍQ. IPI';
2543 2543
         $this->pTextBox($x, $y, $w14, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2544
-        $this->pdf->Line($oldX, $y+$h+1, $oldX + $w, $y+$h+1);
2544
+        $this->pdf->Line($oldX, $y + $h + 1, $oldX + $w, $y + $h + 1);
2545 2545
         $y += 5;
2546 2546
         //##################################################################################
2547 2547
         // LOOP COM OS DADOS DOS PRODUTOS
@@ -2559,7 +2559,7 @@  discard block
 block discarded – undo
2559 2559
                 $textoProduto = trim($this->pDescricaoProduto($thisItem));
2560 2560
 
2561 2561
                 $linhaDescr = $this->pGetNumLines($textoProduto, $w2, $aFont);
2562
-                $h = round(($linhaDescr * $this->pdf->fontSize)+ ($linhaDescr * 0.5), 2);
2562
+                $h = round(($linhaDescr * $this->pdf->fontSize) + ($linhaDescr * 0.5), 2);
2563 2563
                 $hUsado += $h;
2564 2564
 
2565 2565
                 $diffH = $hmax - $hUsado;
@@ -2572,11 +2572,11 @@  discard block
 block discarded – undo
2572 2572
                         break;
2573 2573
                     }
2574 2574
                 }
2575
-                $y_linha=$y+$h;
2575
+                $y_linha = $y + $h;
2576 2576
                 // linha entre itens
2577 2577
                 $this->pdf->DashedHLine($oldX, $y_linha, $w, 0.1, 120);
2578 2578
                 //corrige o x
2579
-                $x=$oldX;
2579
+                $x = $oldX;
2580 2580
                 //codigo do produto
2581 2581
                 $texto = $prod->getElementsByTagName("cProd")->item(0)->nodeValue;
2582 2582
                 $this->pTextBox($x, $y, $w1, $h, $texto, $aFont, 'T', 'C', 0, '');
@@ -2589,16 +2589,16 @@  discard block
 block discarded – undo
2589 2589
                 }
2590 2590
                 $x += $w2;
2591 2591
                 //NCM
2592
-                $texto = ! empty($prod->getElementsByTagName("NCM")->item(0)->nodeValue) ?
2592
+                $texto = !empty($prod->getElementsByTagName("NCM")->item(0)->nodeValue) ?
2593 2593
                         $prod->getElementsByTagName("NCM")->item(0)->nodeValue : '';
2594 2594
                 $this->pTextBox($x, $y, $w3, $h, $texto, $aFont, 'T', 'C', 0, '');
2595 2595
                 $x += $w3;
2596 2596
                 //CST
2597 2597
                 if (isset($ICMS)) {
2598
-                    $origem =  $this->getTagValue($ICMS, "orig");
2599
-                    $cst =  $this->getTagValue($ICMS, "CST");
2600
-                    $csosn =  $this->getTagValue($ICMS, "CSOSN");
2601
-                    $texto = $origem.$cst.$csosn;
2598
+                    $origem = $this->getTagValue($ICMS, "orig");
2599
+                    $cst = $this->getTagValue($ICMS, "CST");
2600
+                    $csosn = $this->getTagValue($ICMS, "CSOSN");
2601
+                    $texto = $origem . $cst . $csosn;
2602 2602
                     $this->pTextBox($x, $y, $w4, $h, $texto, $aFont, 'T', 'C', 0, '');
2603 2603
                 }
2604 2604
                 //CFOP
@@ -2632,7 +2632,7 @@  discard block
 block discarded – undo
2632 2632
                 //Valor da Base de calculo
2633 2633
                 $x += $w9;
2634 2634
                 if (isset($ICMS)) {
2635
-                    $texto = ! empty($ICMS->getElementsByTagName("vBC")->item(0)->nodeValue) ?
2635
+                    $texto = !empty($ICMS->getElementsByTagName("vBC")->item(0)->nodeValue) ?
2636 2636
                             number_format(
2637 2637
                                 $ICMS->getElementsByTagName("vBC")->item(0)->nodeValue,
2638 2638
                                 2,
@@ -2644,7 +2644,7 @@  discard block
 block discarded – undo
2644 2644
                 //Valor do ICMS
2645 2645
                 $x += $w10;
2646 2646
                 if (isset($ICMS)) {
2647
-                    $texto = ! empty($ICMS->getElementsByTagName("vICMS")->item(0)->nodeValue) ?
2647
+                    $texto = !empty($ICMS->getElementsByTagName("vICMS")->item(0)->nodeValue) ?
2648 2648
                             number_format(
2649 2649
                                 $ICMS->getElementsByTagName("vICMS")->item(0)->nodeValue,
2650 2650
                                 2,
@@ -2656,8 +2656,8 @@  discard block
 block discarded – undo
2656 2656
                 //Valor do IPI
2657 2657
                 $x += $w11;
2658 2658
                 if (isset($IPI)) {
2659
-                    $texto = ! empty($IPI->getElementsByTagName("vIPI")->item(0)->nodeValue) ?
2660
-                            number_format($IPI->getElementsByTagName("vIPI")->item(0)->nodeValue, 2, ",", ".") :'';
2659
+                    $texto = !empty($IPI->getElementsByTagName("vIPI")->item(0)->nodeValue) ?
2660
+                            number_format($IPI->getElementsByTagName("vIPI")->item(0)->nodeValue, 2, ",", ".") : '';
2661 2661
                 } else {
2662 2662
                     $texto = '';
2663 2663
                 }
@@ -2665,7 +2665,7 @@  discard block
 block discarded – undo
2665 2665
                 // %ICMS
2666 2666
                 $x += $w12;
2667 2667
                 if (isset($ICMS)) {
2668
-                    $texto = ! empty($ICMS->getElementsByTagName("pICMS")->item(0)->nodeValue) ?
2668
+                    $texto = !empty($ICMS->getElementsByTagName("pICMS")->item(0)->nodeValue) ?
2669 2669
                             number_format(
2670 2670
                                 $ICMS->getElementsByTagName("pICMS")->item(0)->nodeValue,
2671 2671
                                 2,
@@ -2677,7 +2677,7 @@  discard block
 block discarded – undo
2677 2677
                 //%IPI
2678 2678
                 $x += $w13;
2679 2679
                 if (isset($IPI)) {
2680
-                    $texto = ! empty($IPI->getElementsByTagName("pIPI")->item(0)->nodeValue) ?
2680
+                    $texto = !empty($IPI->getElementsByTagName("pIPI")->item(0)->nodeValue) ?
2681 2681
                             number_format($IPI->getElementsByTagName("pIPI")->item(0)->nodeValue, 2, ",", ".") : '';
2682 2682
                 } else {
2683 2683
                     $texto = '';
@@ -2702,7 +2702,7 @@  discard block
 block discarded – undo
2702 2702
                 $i++;
2703 2703
             }
2704 2704
         }
2705
-        return $oldY+$hmax;
2705
+        return $oldY + $hmax;
2706 2706
     }
2707 2707
 
2708 2708
 
@@ -2736,7 +2736,7 @@  discard block
 block discarded – undo
2736 2736
 
2737 2737
         $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'');
2738 2738
 
2739
-        $w1 = round($w*0.09, 0);
2739
+        $w1 = round($w * 0.09, 0);
2740 2740
 
2741 2741
         // Tabela Renavam Combustivel
2742 2742
         $renavamCombustivel = array(
@@ -2835,54 +2835,54 @@  discard block
 block discarded – undo
2835 2835
 
2836 2836
         $yVeic = $y + $h;
2837 2837
         $texto = 'Chassi: ............: ' . $veiculoChassi;
2838
-        $this->pTextBox($x, $yVeic, $w1+40, $h, $texto, $aFont, 'T', 'L', 0, '');
2838
+        $this->pTextBox($x, $yVeic, $w1 + 40, $h, $texto, $aFont, 'T', 'L', 0, '');
2839 2839
         $yVeic += $h;
2840 2840
         $texto = 'Cor...................: ' . $veiculoCor;
2841
-        $this->pTextBox($x, $yVeic, $w1+40, $h, $texto, $aFont, 'T', 'L', 0, '');
2841
+        $this->pTextBox($x, $yVeic, $w1 + 40, $h, $texto, $aFont, 'T', 'L', 0, '');
2842 2842
         $yVeic += $h;
2843 2843
         $texto = 'Cilindrada........: ' . $veiculoCilindrada;
2844
-        $this->pTextBox($x, $yVeic, $w1+40, $h, $texto, $aFont, 'T', 'L', 0, '');
2844
+        $this->pTextBox($x, $yVeic, $w1 + 40, $h, $texto, $aFont, 'T', 'L', 0, '');
2845 2845
         $yVeic += $h;
2846 2846
         $texto = 'Cmkg...............: ' . $veiculoCmkg;
2847
-        $this->pTextBox($x, $yVeic, $w1+40, $h, $texto, $aFont, 'T', 'L', 0, '');
2847
+        $this->pTextBox($x, $yVeic, $w1 + 40, $h, $texto, $aFont, 'T', 'L', 0, '');
2848 2848
         $yVeic += $h;
2849 2849
         $texto = 'Tipo.................: ' . $renavamTiposVeiculos[intval($veiculoTipo)];
2850
-        $this->pTextBox($x, $yVeic, $w1+40, $h, $texto, $aFont, 'T', 'L', 0, '');
2850
+        $this->pTextBox($x, $yVeic, $w1 + 40, $h, $texto, $aFont, 'T', 'L', 0, '');
2851 2851
         $yVeic = $y + $h;
2852 2852
         $xVeic = $x + 65;
2853 2853
         $texto = 'Nº Motor: .........: ' . $veiculoMotor;
2854
-        $this->pTextBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
2854
+        $this->pTextBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
2855 2855
         $yVeic += $h;
2856 2856
         $texto = 'Renavam...........: ' . $veiculoRenavam;
2857
-        $this->pTextBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
2857
+        $this->pTextBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
2858 2858
         $yVeic += $h;
2859 2859
         $texto = 'HP.....................: ' . $veiculoHp;
2860
-        $this->pTextBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
2860
+        $this->pTextBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
2861 2861
         $yVeic += $h;
2862 2862
         $texto = 'Placa.................: ' . $veiculoPlaca;
2863
-        $this->pTextBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
2863
+        $this->pTextBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
2864 2864
         $yVeic += $h;
2865 2865
         $texto = 'Tipo Pintura......: ' . $renavamTipoPintura[$veiculoTipoPintura];
2866
-        $this->pTextBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
2866
+        $this->pTextBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
2867 2867
         $yVeic = $y + $h;
2868 2868
         $xVeic = $xVeic + 55;
2869 2869
         $texto = 'Marca / Modelo.....: ' . $veiculoMarcaModelo;
2870
-        $this->pTextBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
2870
+        $this->pTextBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
2871 2871
         $yVeic += $h;
2872 2872
         $texto = 'Especie..................: ' . $renavamEspecie[intval($veiculoEspecie)];
2873
-        $this->pTextBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
2873
+        $this->pTextBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
2874 2874
         $yVeic += $h;
2875 2875
         $texto = 'Combustivel..........: ' . $renavamCombustivel[intval($veiculoCombustivel)];
2876
-        $this->pTextBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
2876
+        $this->pTextBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
2877 2877
         $yVeic += $h;
2878 2878
         $texto = 'Serial.....................: ' . $veiculoSerial;
2879
-        $this->pTextBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
2879
+        $this->pTextBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
2880 2880
         $yVeic += $h;
2881
-        $texto = 'Ano Fab/Mod........: '. $veiculoFabricacao . '/' . $veiculoModelo;
2882
-        $this->pTextBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
2881
+        $texto = 'Ano Fab/Mod........: ' . $veiculoFabricacao . '/' . $veiculoModelo;
2882
+        $this->pTextBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
2883 2883
         $yVeic += $h;
2884
-        $texto = 'Distancia Entre Eixos(mm)..: '. $veiculoDistancia;
2885
-        $this->pTextBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
2884
+        $texto = 'Distancia Entre Eixos(mm)..: ' . $veiculoDistancia;
2885
+        $this->pTextBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
2886 2886
     }
2887 2887
 
2888 2888
     /**
@@ -2906,12 +2906,12 @@  discard block
 block discarded – undo
2906 2906
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
2907 2907
         //INSCRIÇÃO MUNICIPAL
2908 2908
         $y += 3;
2909
-        $w = round($this->wPrint*0.23, 0);
2909
+        $w = round($this->wPrint * 0.23, 0);
2910 2910
         $texto = 'INSCRIÇÃO MUNICIPAL';
2911 2911
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2912 2912
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
2913 2913
         //inscrição municipal
2914
-        $texto = ! empty($this->emit->getElementsByTagName("IM")->item(0)->nodeValue) ?
2914
+        $texto = !empty($this->emit->getElementsByTagName("IM")->item(0)->nodeValue) ?
2915 2915
                 $this->emit->getElementsByTagName("IM")->item(0)->nodeValue : '';
2916 2916
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
2917 2917
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 0, '');
@@ -2921,7 +2921,7 @@  discard block
 block discarded – undo
2921 2921
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2922 2922
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
2923 2923
         if (isset($this->ISSQNtot)) {
2924
-            $texto = ! empty($this->ISSQNtot->getElementsByTagName("vServ")->item(0)->nodeValue) ?
2924
+            $texto = !empty($this->ISSQNtot->getElementsByTagName("vServ")->item(0)->nodeValue) ?
2925 2925
                     $this->ISSQNtot->getElementsByTagName("vServ")->item(0)->nodeValue : '';
2926 2926
             $texto = number_format($texto, 2, ",", ".");
2927 2927
         } else {
@@ -2935,9 +2935,9 @@  discard block
 block discarded – undo
2935 2935
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2936 2936
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
2937 2937
         if (isset($this->ISSQNtot)) {
2938
-            $texto = ! empty($this->ISSQNtot->getElementsByTagName("vBC")->item(0)->nodeValue) ?
2938
+            $texto = !empty($this->ISSQNtot->getElementsByTagName("vBC")->item(0)->nodeValue) ?
2939 2939
                     $this->ISSQNtot->getElementsByTagName("vBC")->item(0)->nodeValue : '';
2940
-            $texto = ! empty($texto) ? number_format($texto, 2, ",", ".") : '';
2940
+            $texto = !empty($texto) ? number_format($texto, 2, ",", ".") : '';
2941 2941
         } else {
2942 2942
             $texto = '';
2943 2943
         }
@@ -2948,21 +2948,21 @@  discard block
 block discarded – undo
2948 2948
         if ($this->orientacao == 'P') {
2949 2949
             $w = $this->wPrint - (3 * $w);
2950 2950
         } else {
2951
-            $w = $this->wPrint - (3 * $w)-$this->wCanhoto;
2951
+            $w = $this->wPrint - (3 * $w) - $this->wCanhoto;
2952 2952
         }
2953 2953
         $texto = 'VALOR TOTAL DO ISSQN';
2954 2954
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2955 2955
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
2956 2956
         if (isset($this->ISSQNtot)) {
2957
-            $texto = ! empty($this->ISSQNtot->getElementsByTagName("vISS")->item(0)->nodeValue) ?
2957
+            $texto = !empty($this->ISSQNtot->getElementsByTagName("vISS")->item(0)->nodeValue) ?
2958 2958
                     $this->ISSQNtot->getElementsByTagName("vISS")->item(0)->nodeValue : '';
2959
-            $texto = ! empty($texto) ? number_format($texto, 2, ",", ".") : '';
2959
+            $texto = !empty($texto) ? number_format($texto, 2, ",", ".") : '';
2960 2960
         } else {
2961 2961
             $texto = '';
2962 2962
         }
2963 2963
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
2964 2964
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'R', 0, '');
2965
-        return ($y+$h+1);
2965
+        return ($y + $h + 1);
2966 2966
     }
2967 2967
 
2968 2968
     /**
@@ -2983,7 +2983,7 @@  discard block
 block discarded – undo
2983 2983
         if ($this->orientacao == 'P') {
2984 2984
               $w = $this->wPrint;
2985 2985
         } else {
2986
-              $w = $this->wPrint-$this->wCanhoto;
2986
+              $w = $this->wPrint - $this->wCanhoto;
2987 2987
         }
2988 2988
         $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
2989 2989
         $this->pTextBox($x, $y, $w, 8, $texto, $aFont, 'T', 'L', 0, '');
@@ -2999,15 +2999,15 @@  discard block
 block discarded – undo
2999 2999
         //$this->textoAdic com o texto completo do campo
3000 3000
         $y += 1;
3001 3001
         $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'');
3002
-        $this->pTextBox($x, $y+2, $w-2, $h-3, $this->textoAdic, $aFont, 'T', 'L', 0, '', false);
3002
+        $this->pTextBox($x, $y + 2, $w - 2, $h - 3, $this->textoAdic, $aFont, 'T', 'L', 0, '', false);
3003 3003
         //RESERVADO AO FISCO
3004 3004
         $texto = "RESERVADO AO FISCO";
3005 3005
         $x += $w;
3006 3006
         $y -= 1;
3007 3007
         if ($this->orientacao == 'P') {
3008
-            $w = $this->wPrint-$w;
3008
+            $w = $this->wPrint - $w;
3009 3009
         } else {
3010
-            $w = $this->wPrint-$w-$this->wCanhoto;
3010
+            $w = $this->wPrint - $w - $this->wCanhoto;
3011 3011
         }
3012 3012
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'B');
3013 3013
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -3046,8 +3046,8 @@  discard block
 block discarded – undo
3046 3046
         }
3047 3047
         $y += 2;
3048 3048
         $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'');
3049
-        $this->pTextBox($x, $y, $w-2, $h-3, $texto, $aFont, 'T', 'L', 0, '', false);
3050
-        return $y+$h;
3049
+        $this->pTextBox($x, $y, $w - 2, $h - 3, $texto, $aFont, 'T', 'L', 0, '', false);
3050
+        return $y + $h;
3051 3051
     }
3052 3052
 
3053 3053
     /**
@@ -3065,13 +3065,13 @@  discard block
 block discarded – undo
3065 3065
         if ($this->orientacao == 'P') {
3066 3066
               $w = $this->wPrint;
3067 3067
         } else {
3068
-              $w = $this->wPrint-$this->wCanhoto;
3068
+              $w = $this->wPrint - $this->wCanhoto;
3069 3069
               $x = $this->wCanhoto;
3070 3070
         }
3071 3071
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'I');
3072
-        $texto = "Impresso em ". date('d/m/Y') . " as " . date('H:i:s');
3072
+        $texto = "Impresso em " . date('d/m/Y') . " as " . date('H:i:s');
3073 3073
         $this->pTextBox($x, $y, $w, 0, $texto, $aFont, 'T', 'L', false);
3074
-        $texto = $this->creditos .  "  Powered by NFePHP";
3074
+        $texto = $this->creditos . "  Powered by NFePHP";
3075 3075
         $this->pTextBox($x, $y, $w, 0, $texto, $aFont, 'T', 'R', false, '');
3076 3076
     }
3077 3077
 
@@ -3124,9 +3124,9 @@  discard block
 block discarded – undo
3124 3124
         } else {
3125 3125
             //linha separadora do canhoto - 238
3126 3126
             //posicao altura
3127
-            $y = $this->wPrint-85;
3127
+            $y = $this->wPrint - 85;
3128 3128
             //altura
3129
-            $w = $this->wPrint-85-24;
3129
+            $w = $this->wPrint - 85 - 24;
3130 3130
         }
3131 3131
         $h = 10;
3132 3132
         //desenha caixa
@@ -3149,21 +3149,21 @@  discard block
 block discarded – undo
3149 3149
             $texto .= "AO LADO";
3150 3150
         }
3151 3151
         $texto .= ". EMISSÃO: ";
3152
-        $dEmi = ! empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
3152
+        $dEmi = !empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
3153 3153
                 $this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue : '';
3154 3154
         if ($dEmi == '') {
3155
-            $dEmi = ! empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
3155
+            $dEmi = !empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
3156 3156
                     $this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue : '';
3157 3157
             $aDemi = explode('T', $dEmi);
3158 3158
             $dEmi = $aDemi[0];
3159 3159
         }
3160
-        $texto .= $this->pYmd2dmy($dEmi) ." ";
3160
+        $texto .= $this->pYmd2dmy($dEmi) . " ";
3161 3161
         $texto .= "VALOR TOTAL: R$ ";
3162 3162
         $texto .= number_format($this->ICMSTot->getElementsByTagName("vNF")->item(0)->nodeValue, 2, ",", ".") . " ";
3163 3163
         $texto .= "DESTINATÁRIO: ";
3164 3164
         $texto .= $destinatario;
3165 3165
         if ($this->orientacao == 'P') {
3166
-            $this->pTextBox($x, $y, $w-1, $h, $texto, $aFont, 'C', 'L', 0, '', false);
3166
+            $this->pTextBox($x, $y, $w - 1, $h, $texto, $aFont, 'C', 'L', 0, '', false);
3167 3167
             $x1 = $x + $w;
3168 3168
             $w1 = $this->wPrint - $w;
3169 3169
             $texto = "NF-e";
@@ -3176,12 +3176,12 @@  discard block
 block discarded – undo
3176 3176
             //DATA DE RECEBIMENTO
3177 3177
             $texto = "DATA DE RECEBIMENTO";
3178 3178
             $y += $h;
3179
-            $w2 = round($this->wPrint*0.17, 0); //35;
3179
+            $w2 = round($this->wPrint * 0.17, 0); //35;
3180 3180
             $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
3181 3181
             $this->pTextBox($x, $y, $w2, 8, $texto, $aFont, 'T', 'L', 1, '');
3182 3182
             //IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR
3183 3183
             $x += $w2;
3184
-            $w3 = $w-$w2;
3184
+            $w3 = $w - $w2;
3185 3185
             $texto = "IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR";
3186 3186
             $this->pTextBox($x, $y, $w3, 8, $texto, $aFont, 'T', 'L', 1, '');
3187 3187
             $x = $oldX;
@@ -3191,7 +3191,7 @@  discard block
 block discarded – undo
3191 3191
             return $y;
3192 3192
         } else {
3193 3193
             $x--;
3194
-            $x = $this->pTextBox90($x, $y, $w-1, $h, $texto, $aFontSmall, 'C', 'L', 0, '', false);
3194
+            $x = $this->pTextBox90($x, $y, $w - 1, $h, $texto, $aFontSmall, 'C', 'L', 0, '', false);
3195 3195
             //NUMERO DA NOTA FISCAL LOGO NFE
3196 3196
             $w1 = 18;
3197 3197
             $x1 = $oldX;
@@ -3205,18 +3205,18 @@  discard block
 block discarded – undo
3205 3205
             $this->pTextBox($x1, $y, $w1, 18, $texto, $aFont, 'C', 'C', 1, '');
3206 3206
             //DATA DO RECEBIMENTO
3207 3207
             $texto = "DATA DO RECEBIMENTO";
3208
-            $y = $this->wPrint-85;
3208
+            $y = $this->wPrint - 85;
3209 3209
             $x = 12;
3210
-            $w2 = round($this->wPrint*0.17, 0); //35;
3210
+            $w2 = round($this->wPrint * 0.17, 0); //35;
3211 3211
             $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
3212 3212
             $this->pTextBox90($x, $y, $w2, 8, $texto, $aFont, 'T', 'L', 1, '');
3213 3213
             //IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR
3214 3214
             $y -= $w2;
3215
-            $w3 = $w-$w2;
3215
+            $w3 = $w - $w2;
3216 3216
             $texto = "IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR";
3217 3217
             $aFont = array('font'=>$this->fontePadrao, 'size'=>5.7, 'style'=>'');
3218 3218
             $x = $this->pTextBox90($x, $y, $w3, 8, $texto, $aFont, 'T', 'L', 1, '');
3219
-            $this->pdf->DashedVLine(23, $oldY, 0.1, $this->wPrint-20, 67);
3219
+            $this->pdf->DashedVLine(23, $oldY, 0.1, $this->wPrint - 20, 67);
3220 3220
             return $x;
3221 3221
         }
3222 3222
     }
@@ -3233,13 +3233,13 @@  discard block
 block discarded – undo
3233 3233
     {
3234 3234
         $saida = "";
3235 3235
         if (isset($this->compra)) {
3236
-            if (! empty($this->compra->getElementsByTagName("xNEmp")->item(0)->nodeValue)) {
3236
+            if (!empty($this->compra->getElementsByTagName("xNEmp")->item(0)->nodeValue)) {
3237 3237
                 $saida .= " Nota de Empenho: " . $this->compra->getElementsByTagName("xNEmp")->item(0)->nodeValue;
3238 3238
             }
3239
-            if (! empty($this->compra->getElementsByTagName("xPed")->item(0)->nodeValue)) {
3239
+            if (!empty($this->compra->getElementsByTagName("xPed")->item(0)->nodeValue)) {
3240 3240
                 $saida .= " Pedido: " . $this->compra->getElementsByTagName("xPed")->item(0)->nodeValue;
3241 3241
             }
3242
-            if (! empty($this->compra->getElementsByTagName("xCont")->item(0)->nodeValue)) {
3242
+            if (!empty($this->compra->getElementsByTagName("xCont")->item(0)->nodeValue)) {
3243 3243
                 $saida .= " Contrato: " . $this->compra->getElementsByTagName("xCont")->item(0)->nodeValue;
3244 3244
             }
3245 3245
         }
@@ -3265,21 +3265,21 @@  discard block
 block discarded – undo
3265 3265
         if ($vICMS > 0) {
3266 3266
             $vICMS = 1;
3267 3267
         }
3268
-        $icmss  = $this->ICMSTot->getElementsByTagName("vBC")->item(0)->nodeValue;
3268
+        $icmss = $this->ICMSTot->getElementsByTagName("vBC")->item(0)->nodeValue;
3269 3269
         if ($icmss > 0) {
3270 3270
             $icmss = 1;
3271 3271
         }
3272
-        $dEmi = ! empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
3272
+        $dEmi = !empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
3273 3273
                 $this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue : '';
3274 3274
         if ($dEmi == '') {
3275
-            $dEmi = ! empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
3275
+            $dEmi = !empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
3276 3276
                     $this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue : '';
3277 3277
             $aDemi = explode('T', $dEmi);
3278 3278
             $dEmi = $aDemi[0];
3279 3279
         }
3280 3280
         $dd  = $dEmi;
3281 3281
         $rpos = strrpos($dd, '-');
3282
-        $dd  = substr($dd, $rpos +1);
3282
+        $dd  = substr($dd, $rpos + 1);
3283 3283
         $chave = sprintf($forma, $cUF, $this->tpEmis, $CNPJ, $vNF, $vICMS, $icmss, $dd);
3284 3284
         $chave = $chave . $this->pModulo11($chave);
3285 3285
         return $chave;
@@ -3300,7 +3300,7 @@  discard block
 block discarded – undo
3300 3300
         $formaNfRef = "\r\nNF  Ref.: série:%d numero:%d emit:%s em %s modelo: %d";
3301 3301
         $formaECFRef = "\r\nECF Ref.: modelo: %s ECF:%d COO:%d";
3302 3302
         $formaNfpRef = "\r\nNFP Ref.: série:%d número:%d emit:%s em %s modelo: %d IE:%s";
3303
-        $saida='';
3303
+        $saida = '';
3304 3304
         $nfRefs = $this->ide->getElementsByTagName('NFref');
3305 3305
         if (0 === $nfRefs->length) {
3306 3306
             return $saida;
@@ -3316,7 +3316,7 @@  discard block
 block discarded – undo
3316 3316
             foreach ($refNFe as $chave_acessoRef) {
3317 3317
                 $chave_acesso = $chave_acessoRef->nodeValue;
3318 3318
                 $chave_acessoF = $this->pFormat($chave_acesso, $this->formatoChave);
3319
-                $data = substr($chave_acesso, 4, 2)."/20".substr($chave_acesso, 2, 2);
3319
+                $data = substr($chave_acesso, 4, 2) . "/20" . substr($chave_acesso, 2, 2);
3320 3320
                 $cnpj = $this->pFormat(substr($chave_acesso, 6, 14), "##.###.###/####-##");
3321 3321
                 $serie  = substr($chave_acesso, 22, 3);
3322 3322
                 $numero = substr($chave_acesso, 25, 9);
@@ -3337,7 +3337,7 @@  discard block
 block discarded – undo
3337 3337
             foreach ($refCTe as $chave_acessoRef) {
3338 3338
                 $chave_acesso = $chave_acessoRef->nodeValue;
3339 3339
                 $chave_acessoF = $this->pFormat($chave_acesso, $this->formatoChave);
3340
-                $data = substr($chave_acesso, 4, 2)."/20".substr($chave_acesso, 2, 2);
3340
+                $data = substr($chave_acesso, 4, 2) . "/20" . substr($chave_acesso, 2, 2);
3341 3341
                 $cnpj = $this->pFormat(substr($chave_acesso, 6, 14), "##.###.###/####-##");
3342 3342
                 $serie  = substr($chave_acesso, 22, 3);
3343 3343
                 $numero = substr($chave_acesso, 25, 9);
@@ -3353,10 +3353,9 @@  discard block
 block discarded – undo
3353 3353
             $refNFP = $nfRef->getElementsByTagName('refNFP');
3354 3354
             foreach ($refNFP as $umaRefNFe) {
3355 3355
                 $data = $umaRefNFe->getElementsByTagName('AAMM')->item(0)->nodeValue;
3356
-                $cnpj = ! empty($umaRefNFe->getElementsByTagName('CNPJ')->item(0)->nodeValue) ?
3357
-                    $umaRefNFe->getElementsByTagName('CNPJ')->item(0)->nodeValue :
3358
-                    '';
3359
-                $cpf = ! empty($umaRefNFe->getElementsByTagName('CPF')->item(0)->nodeValue) ?
3356
+                $cnpj = !empty($umaRefNFe->getElementsByTagName('CNPJ')->item(0)->nodeValue) ?
3357
+                    $umaRefNFe->getElementsByTagName('CNPJ')->item(0)->nodeValue : '';
3358
+                $cpf = !empty($umaRefNFe->getElementsByTagName('CPF')->item(0)->nodeValue) ?
3360 3359
                         $umaRefNFe->getElementsByTagName('CPF')->item(0)->nodeValue : '';
3361 3360
                 $mod = $umaRefNFe->getElementsByTagName('mod')->item(0)->nodeValue;
3362 3361
                 $serie = $umaRefNFe->getElementsByTagName('serie')->item(0)->nodeValue;
@@ -3382,6 +3381,6 @@  discard block
 block discarded – undo
3382 3381
         imagedestroy($image);
3383 3382
         $stringdata = ob_get_contents(); // read from buffer
3384 3383
         ob_end_clean();
3385
-        return 'data://text/plain;base64,'.base64_encode($stringdata);
3384
+        return 'data://text/plain;base64,' . base64_encode($stringdata);
3386 3385
     }
3387 3386
 }
Please login to merge, or discard this patch.