Passed
Pull Request — master (#224)
by Eduardo
02:48
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,27 +728,27 @@  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
-        $y = $this->pItensDANFE($x, $y+1, $nInicial, $hDispo1, $pag, $totPag, $hCabecItens);
748
+        $y = $this->pItensDANFE($x, $y + 1, $nInicial, $hDispo1, $pag, $totPag, $hCabecItens);
749 749
         //coloca os dados do ISSQN
750 750
         if ($linhaISSQN == 1) {
751
-            $y = $this->pIssqnDANFE($x, $y+4);
751
+            $y = $this->pIssqnDANFE($x, $y + 4);
752 752
         } else {
753 753
             $y += 4;
754 754
         }
@@ -756,7 +756,7 @@  discard block
 block discarded – undo
756 756
         $y = $this->pDadosAdicionaisDANFE($x, $y, $hdadosadic);
757 757
         //coloca o rodapé da página
758 758
         if ($this->orientacao == 'P') {
759
-            $this->pRodape($xInic, $y-1);
759
+            $this->pRodape($xInic, $y - 1);
760 760
         } else {
761 761
             $this->pRodape($xInic, $this->hPrint + 1);
762 762
         }
@@ -776,7 +776,7 @@  discard block
 block discarded – undo
776 776
             //coloca o cabeçalho na página adicional
777 777
             $y = $this->pCabecalhoDANFE($x, $y, $n, $totPag);
778 778
             //coloca os itens na página adicional
779
-            $y = $this->pItensDANFE($x, $y+1, $nInicial, $hDispo2, $n, $totPag, $hCabecItens);
779
+            $y = $this->pItensDANFE($x, $y + 1, $nInicial, $hDispo2, $n, $totPag, $hCabecItens);
780 780
             //coloca o rodapé da página
781 781
             if ($this->orientacao == 'P') {
782 782
                 $this->pRodape($xInic, $y + 4);
@@ -789,7 +789,7 @@  discard block
 block discarded – undo
789 789
             }
790 790
         }
791 791
         //retorna o ID na NFe
792
-        if ($classPdf!==false) {
792
+        if ($classPdf !== false) {
793 793
             $aR = array(
794 794
              'id'=>str_replace('NFe', '', $this->infNFe->getAttribute("Id")),
795 795
              'classe_PDF'=>$this->pdf);
@@ -822,7 +822,7 @@  discard block
 block discarded – undo
822 822
         if ($startPos === false) {
823 823
             return $cdata;
824 824
         }
825
-        for ($x=$len; $x>0; $x--) {
825
+        for ($x = $len; $x > 0; $x--) {
826 826
             if (substr($cdata, $x, 1) == '>') {
827 827
                 $endPos = $x;
828 828
                 break;
@@ -833,15 +833,15 @@  discard block
 block discarded – undo
833 833
         } else {
834 834
             $parte1 = '';
835 835
         }
836
-        $parte2 = substr($cdata, $startPos, $endPos-$startPos+1);
836
+        $parte2 = substr($cdata, $startPos, $endPos - $startPos + 1);
837 837
         if ($endPos < $len) {
838 838
             $parte3 = substr($cdata, $endPos + 1, $len - $endPos - 1);
839 839
         } else {
840 840
             $parte3 = '';
841 841
         }
842
-        $texto = trim($parte1).' '.trim($parte3);
842
+        $texto = trim($parte1) . ' ' . trim($parte3);
843 843
         if (strpos($parte2, '<CDATA>') === false) {
844
-            $cdata = '<CDATA>'.$parte2.'</CDATA>';
844
+            $cdata = '<CDATA>' . $parte2 . '</CDATA>';
845 845
         } else {
846 846
             $cdata = $parte2;
847 847
         }
@@ -915,15 +915,15 @@  discard block
 block discarded – undo
915 915
         //grupo CADATA infCpl
916 916
         $t = $dom->getElementsByTagName('transmissor')->item(0);
917 917
         $r = $dom->getElementsByTagName('receptor')->item(0);
918
-        $versao = ! empty($dom->getElementsByTagName('versao')->item(0)->nodeValue) ?
919
-            'Versao:'.$dom->getElementsByTagName('versao')->item(0)->nodeValue.' ' : '';
920
-        $especieNF = ! empty($dom->getElementsByTagName('especieNF')->item(0)->nodeValue) ?
921
-            'Especie:'.$dom->getElementsByTagName('especieNF')->item(0)->nodeValue.' ' : '';
922
-        $fabEntrega = ! empty($dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue) ?
923
-            'Entrega:'.$dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue.' ' : '';
924
-        $dca = ! empty($dom->getElementsByTagName('dca')->item(0)->nodeValue) ?
925
-            'dca:'.$dom->getElementsByTagName('dca')->item(0)->nodeValue.' ' : '';
926
-        $texto .= "".$versao.$especieNF.$fabEntrega.$dca;
918
+        $versao = !empty($dom->getElementsByTagName('versao')->item(0)->nodeValue) ?
919
+            'Versao:' . $dom->getElementsByTagName('versao')->item(0)->nodeValue . ' ' : '';
920
+        $especieNF = !empty($dom->getElementsByTagName('especieNF')->item(0)->nodeValue) ?
921
+            'Especie:' . $dom->getElementsByTagName('especieNF')->item(0)->nodeValue . ' ' : '';
922
+        $fabEntrega = !empty($dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue) ?
923
+            'Entrega:' . $dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue . ' ' : '';
924
+        $dca = !empty($dom->getElementsByTagName('dca')->item(0)->nodeValue) ?
925
+            'dca:' . $dom->getElementsByTagName('dca')->item(0)->nodeValue . ' ' : '';
926
+        $texto .= "" . $versao . $especieNF . $fabEntrega . $dca;
927 927
         if (isset($t)) {
928 928
             if ($t->hasAttributes()) {
929 929
                 $texto .= " Transmissor ";
@@ -1013,14 +1013,14 @@  discard block
 block discarded – undo
1013 1013
         }
1014 1014
         //####################################################################################
1015 1015
         //coluna esquerda identificação do emitente
1016
-        $w = round($maxW*0.41, 0);
1016
+        $w = round($maxW * 0.41, 0);
1017 1017
         if ($this->orientacao == 'P') {
1018 1018
             $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'I');
1019 1019
         } else {
1020 1020
             $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B');
1021 1021
         }
1022 1022
         $w1 = $w;
1023
-        $h=32;
1023
+        $h = 32;
1024 1024
         $oldY += $h;
1025 1025
         $this->pTextBox($x, $y, $w, $h);
1026 1026
         $texto = 'IDENTIFICAÇÃO DO EMITENTE';
@@ -1041,39 +1041,39 @@  discard block
 block discarded – undo
1041 1041
                 $type == 'jpg';
1042 1042
             }
1043 1043
             //largura da imagem em mm
1044
-            $logoWmm = ($logoInfo[0]/72)*25.4;
1044
+            $logoWmm = ($logoInfo[0] / 72) * 25.4;
1045 1045
             //altura da imagem em mm
1046
-            $logoHmm = ($logoInfo[1]/72)*25.4;
1047
-            if ($this->logoAlign=='L') {
1048
-                $nImgW = round($w/3, 0);
1049
-                $nImgH = round($logoHmm * ($nImgW/$logoWmm), 0);
1050
-                $xImg = $x+1;
1051
-                $yImg = round(($h-$nImgH)/2, 0)+$y;
1046
+            $logoHmm = ($logoInfo[1] / 72) * 25.4;
1047
+            if ($this->logoAlign == 'L') {
1048
+                $nImgW = round($w / 3, 0);
1049
+                $nImgH = round($logoHmm * ($nImgW / $logoWmm), 0);
1050
+                $xImg = $x + 1;
1051
+                $yImg = round(($h - $nImgH) / 2, 0) + $y;
1052 1052
                 //estabelecer posições do texto
1053
-                $x1 = round($xImg + $nImgW +1, 0);
1054
-                $y1 = round($h/3+$y, 0);
1055
-                $tw = round(2*$w/3, 0);
1056
-            } elseif ($this->logoAlign=='C') {
1057
-                $nImgH = round($h/3, 0);
1058
-                $nImgW = round($logoWmm * ($nImgH/$logoHmm), 0);
1059
-                $xImg = round(($w-$nImgW)/2+$x, 0);
1060
-                $yImg = $y+3;
1053
+                $x1 = round($xImg + $nImgW + 1, 0);
1054
+                $y1 = round($h / 3 + $y, 0);
1055
+                $tw = round(2 * $w / 3, 0);
1056
+            } elseif ($this->logoAlign == 'C') {
1057
+                $nImgH = round($h / 3, 0);
1058
+                $nImgW = round($logoWmm * ($nImgH / $logoHmm), 0);
1059
+                $xImg = round(($w - $nImgW) / 2 + $x, 0);
1060
+                $yImg = $y + 3;
1061 1061
                 $x1 = $x;
1062 1062
                 $y1 = round($yImg + $nImgH + 1, 0);
1063 1063
                 $tw = $w;
1064
-            } elseif ($this->logoAlign=='R') {
1065
-                $nImgW = round($w/3, 0);
1066
-                $nImgH = round($logoHmm * ($nImgW/$logoWmm), 0);
1067
-                $xImg = round($x+($w-(1+$nImgW)), 0);
1068
-                $yImg = round(($h-$nImgH)/2, 0)+$y;
1064
+            } elseif ($this->logoAlign == 'R') {
1065
+                $nImgW = round($w / 3, 0);
1066
+                $nImgH = round($logoHmm * ($nImgW / $logoWmm), 0);
1067
+                $xImg = round($x + ($w - (1 + $nImgW)), 0);
1068
+                $yImg = round(($h - $nImgH) / 2, 0) + $y;
1069 1069
                 $x1 = $x;
1070
-                $y1 = round($h/3+$y, 0);
1071
-                $tw = round(2*$w/3, 0);
1072
-            } elseif ($this->logoAlign=='F') {
1073
-                $nImgH = round($h-5, 0);
1074
-                $nImgW = round($logoWmm * ($nImgH/$logoHmm), 0);
1075
-                $xImg = round(($w-$nImgW)/2+$x, 0);
1076
-                $yImg = $y+3;
1070
+                $y1 = round($h / 3 + $y, 0);
1071
+                $tw = round(2 * $w / 3, 0);
1072
+            } elseif ($this->logoAlign == 'F') {
1073
+                $nImgH = round($h - 5, 0);
1074
+                $nImgW = round($logoWmm * ($nImgH / $logoHmm), 0);
1075
+                $xImg = round(($w - $nImgW) / 2 + $x, 0);
1076
+                $yImg = $y + 3;
1077 1077
                 $x1 = $x;
1078 1078
                 $y1 = round($yImg + $nImgH + 1, 0);
1079 1079
                 $tw = $w;
@@ -1082,7 +1082,7 @@  discard block
 block discarded – undo
1082 1082
             $this->pdf->Image($this->logomarca, $xImg, $yImg, $nImgW, $nImgH, $type);
1083 1083
         } else {
1084 1084
             $x1 = $x;
1085
-            $y1 = round($h/3+$y, 0);
1085
+            $y1 = round($h / 3 + $y, 0);
1086 1086
             $tw = $w;
1087 1087
         }
1088 1088
         // monta as informações apenas se diferente de full logo
@@ -1092,9 +1092,9 @@  discard block
 block discarded – undo
1092 1092
             $texto = $this->emit->getElementsByTagName("xNome")->item(0)->nodeValue;
1093 1093
             $this->pTextBox($x1, $y1, $tw, 8, $texto, $aFont, 'T', 'C', 0, '');
1094 1094
             //endereço
1095
-            $y1 = $y1+5;
1095
+            $y1 = $y1 + 5;
1096 1096
             $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'');
1097
-            $fone = ! empty($this->enderEmit->getElementsByTagName("fone")->item(0)->nodeValue)
1097
+            $fone = !empty($this->enderEmit->getElementsByTagName("fone")->item(0)->nodeValue)
1098 1098
                  ? $this->enderEmit->getElementsByTagName("fone")->item(0)->nodeValue
1099 1099
                  : '';
1100 1100
             $lgr = $this->getTagValue($this->enderEmit, "xLgr");
@@ -1114,37 +1114,37 @@  discard block
 block discarded – undo
1114 1114
         //####################################################################################
1115 1115
         //coluna central Danfe
1116 1116
         $x += $w;
1117
-        $w=round($maxW * 0.17, 0);//35;
1117
+        $w = round($maxW * 0.17, 0); //35;
1118 1118
         $w2 = $w;
1119 1119
         $h = 32;
1120 1120
         $this->pTextBox($x, $y, $w, $h);
1121 1121
 
1122
-        if (! $this->pNotaCancelada()) {
1122
+        if (!$this->pNotaCancelada()) {
1123 1123
             // A PRINCIPIO NÃO PRECISAVA, POIS A NFE ESTÁ AUTORIZADA,
1124 1124
             // SÓ SE RETIRA O DANFE PARA NOTAS NÃO AUTORIZADAS
1125 1125
             $texto = "DANFE";
1126 1126
             $aFont = array('font'=>$this->fontePadrao, 'size'=>14, 'style'=>'B');
1127
-            $this->pTextBox($x, $y+1, $w, $h, $texto, $aFont, 'T', 'C', 0, '');
1127
+            $this->pTextBox($x, $y + 1, $w, $h, $texto, $aFont, 'T', 'C', 0, '');
1128 1128
             $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'');
1129 1129
             $texto = 'Documento Auxiliar da Nota Fiscal Eletrônica';
1130 1130
             $h = 20;
1131
-            $this->pTextBox($x, $y+6, $w, $h, $texto, $aFont, 'T', 'C', 0, '', false);
1131
+            $this->pTextBox($x, $y + 6, $w, $h, $texto, $aFont, 'T', 'C', 0, '', false);
1132 1132
         }
1133 1133
 
1134 1134
         $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'');
1135 1135
         $texto = '0 - ENTRADA';
1136 1136
         $y1 = $y + 14;
1137 1137
         $h = 8;
1138
-        $this->pTextBox($x+2, $y1, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1138
+        $this->pTextBox($x + 2, $y1, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1139 1139
         $texto = '1 - SAÍDA';
1140 1140
         $y1 = $y + 17;
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
         //tipo de nF
1143 1143
         $aFont = array('font'=>$this->fontePadrao, 'size'=>12, 'style'=>'B');
1144 1144
         $y1 = $y + 13;
1145 1145
         $h = 7;
1146 1146
         $texto = $this->ide->getElementsByTagName('tpNF')->item(0)->nodeValue;
1147
-        $this->pTextBox($x+27, $y1, 5, $h, $texto, $aFont, 'C', 'C', 1, '');
1147
+        $this->pTextBox($x + 27, $y1, 5, $h, $texto, $aFont, 'C', 'C', 1, '');
1148 1148
         //numero da NF
1149 1149
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
1150 1150
         $y1 = $y + 20;
@@ -1166,7 +1166,7 @@  discard block
 block discarded – undo
1166 1166
         //####################################################################################
1167 1167
         //coluna codigo de barras
1168 1168
         $x += $w;
1169
-        $w = ($maxW-$w1-$w2);//85;
1169
+        $w = ($maxW - $w1 - $w2); //85;
1170 1170
         $w3 = $w;
1171 1171
         $h = 32;
1172 1172
         $this->pTextBox($x, $y, $w, $h);
@@ -1175,22 +1175,22 @@  discard block
 block discarded – undo
1175 1175
         $bW = 75;
1176 1176
         $bH = 12;
1177 1177
         //codigo de barras
1178
-        $this->pdf->Code128($x+(($w-$bW)/2), $y+2, $chave_acesso, $bW, $bH);
1178
+        $this->pdf->Code128($x + (($w - $bW) / 2), $y + 2, $chave_acesso, $bW, $bH);
1179 1179
         //linhas divisorias
1180
-        $this->pdf->Line($x, $y+4+$bH, $x+$w, $y+4+$bH);
1181
-        $this->pdf->Line($x, $y+12+$bH, $x+$w, $y+12+$bH);
1180
+        $this->pdf->Line($x, $y + 4 + $bH, $x + $w, $y + 4 + $bH);
1181
+        $this->pdf->Line($x, $y + 12 + $bH, $x + $w, $y + 12 + $bH);
1182 1182
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1183
-        $y1 = $y+4+$bH;
1183
+        $y1 = $y + 4 + $bH;
1184 1184
         $h = 7;
1185 1185
         $texto = 'CHAVE DE ACESSO';
1186 1186
         $this->pTextBox($x, $y1, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1187 1187
         $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B');
1188
-        $y1 = $y+8+$bH;
1188
+        $y1 = $y + 8 + $bH;
1189 1189
         $texto = $this->pFormat($chave_acesso, $this->formatoChave);
1190
-        $this->pTextBox($x+2, $y1, $w-2, $h, $texto, $aFont, 'T', 'C', 0, '');
1191
-        $y1 = $y+12+$bH;
1190
+        $this->pTextBox($x + 2, $y1, $w - 2, $h, $texto, $aFont, 'T', 'C', 0, '');
1191
+        $y1 = $y + 12 + $bH;
1192 1192
         $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'');
1193
-        $chaveContingencia="";
1193
+        $chaveContingencia = "";
1194 1194
         if ($this->pNotaDPEC()) {
1195 1195
             $cabecalhoProtoAutorizacao = 'NÚMERO DE REGISTRO DPEC';
1196 1196
         } else {
@@ -1201,16 +1201,16 @@  discard block
 block discarded – undo
1201 1201
             $chaveContingencia = $this->pGeraChaveAdicionalDeContingencia();
1202 1202
             $this->pdf->SetFillColor(0, 0, 0);
1203 1203
             //codigo de barras
1204
-            $this->pdf->Code128($x+11, $y1+1, $chaveContingencia, $bW*.9, $bH/2);
1204
+            $this->pdf->Code128($x + 11, $y1 + 1, $chaveContingencia, $bW * .9, $bH / 2);
1205 1205
         } else {
1206 1206
             $texto = 'Consulta de autenticidade no portal nacional da NF-e';
1207
-            $this->pTextBox($x+2, $y1, $w-2, $h, $texto, $aFont, 'T', 'C', 0, '');
1208
-            $y1 = $y+16+$bH;
1207
+            $this->pTextBox($x + 2, $y1, $w - 2, $h, $texto, $aFont, 'T', 'C', 0, '');
1208
+            $y1 = $y + 16 + $bH;
1209 1209
             $texto = 'www.nfe.fazenda.gov.br/portal ou no site da Sefaz Autorizadora';
1210 1210
             $this->pTextBox(
1211
-                $x+2,
1211
+                $x + 2,
1212 1212
                 $y1,
1213
-                $w-2,
1213
+                $w - 2,
1214 1214
                 $h,
1215 1215
                 $texto,
1216 1216
                 $aFont,
@@ -1226,7 +1226,7 @@  discard block
 block discarded – undo
1226 1226
         //natureza da operação
1227 1227
         $texto = 'NATUREZA DA OPERAÇÃO';
1228 1228
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1229
-        $w = $w1+$w2;
1229
+        $w = $w1 + $w2;
1230 1230
         $y = $oldY;
1231 1231
         $oldY += $h;
1232 1232
         $x = $oldX;
@@ -1256,7 +1256,7 @@  discard block
 block discarded – undo
1256 1256
                 $cStat = '';
1257 1257
             } else {
1258 1258
                 if (isset($this->nfeProc)) {
1259
-                    $texto = ! empty($this->nfeProc->getElementsByTagName("nProt")->item(0)->nodeValue) ?
1259
+                    $texto = !empty($this->nfeProc->getElementsByTagName("nProt")->item(0)->nodeValue) ?
1260 1260
                             $this->nfeProc->getElementsByTagName("nProt")->item(0)->nodeValue : '';
1261 1261
                     $tsHora = $this->pConvertTime($this->nfeProc->getElementsByTagName("dhRecbto")->item(0)->nodeValue);
1262 1262
                     if ($texto != '') {
@@ -1287,25 +1287,25 @@  discard block
 block discarded – undo
1287 1287
         $texto = 'INSCRIÇÃO ESTADUAL DO SUBST. TRIBUT.';
1288 1288
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1289 1289
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1290
-        $texto = ! empty($this->emit->getElementsByTagName("IEST")->item(0)->nodeValue)
1290
+        $texto = !empty($this->emit->getElementsByTagName("IEST")->item(0)->nodeValue)
1291 1291
              ? $this->emit->getElementsByTagName("IEST")->item(0)->nodeValue
1292 1292
              : '';
1293 1293
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
1294 1294
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1295 1295
         //CNPJ
1296 1296
         $x += $w;
1297
-        $w = ($maxW-(2*$w));
1297
+        $w = ($maxW - (2 * $w));
1298 1298
         $texto = 'CNPJ / CPF';
1299 1299
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1300 1300
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1301 1301
         //Pegando valor do CPF/CNPJ
1302
-        if (! empty($this->emit->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1302
+        if (!empty($this->emit->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1303 1303
             $texto = $this->pFormat(
1304 1304
                 $this->emit->getElementsByTagName("CNPJ")->item(0)->nodeValue,
1305 1305
                 "###.###.###/####-##"
1306 1306
             );
1307 1307
         } else {
1308
-            $texto = ! empty($this->emit->getElementsByTagName("CPF")->item(0)->nodeValue) ?
1308
+            $texto = !empty($this->emit->getElementsByTagName("CPF")->item(0)->nodeValue) ?
1309 1309
                 $this->pFormat(
1310 1310
                     $this->emit->getElementsByTagName("CPF")->item(0)->nodeValue,
1311 1311
                     "###.###.###-##"
@@ -1321,9 +1321,9 @@  discard block
 block discarded – undo
1321 1321
         if ($this->pNotaCancelada()) {
1322 1322
             //101 Cancelamento
1323 1323
             $x = 10;
1324
-            $y = $this->hPrint-130;
1324
+            $y = $this->hPrint - 130;
1325 1325
             $h = 25;
1326
-            $w = $maxW-(2*$x);
1326
+            $w = $maxW - (2 * $x);
1327 1327
             $this->pdf->SetTextColor(90, 90, 90);
1328 1328
             $texto = "NFe CANCELADA";
1329 1329
             $aFont = array('font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B');
@@ -1334,12 +1334,12 @@  discard block
 block discarded – undo
1334 1334
         if ($this->pNotaDPEC() || $this->tpEmis == 4) {
1335 1335
             //DPEC
1336 1336
             $x = 10;
1337
-            $y = $this->hPrint-130;
1337
+            $y = $this->hPrint - 130;
1338 1338
             $h = 25;
1339
-            $w = $maxW-(2*$x);
1339
+            $w = $maxW - (2 * $x);
1340 1340
             $this->pdf->SetTextColor(200, 200, 200);
1341
-            $texto = "DANFE impresso em contingência -\n".
1342
-                     "DPEC regularmente recebido pela Receita\n".
1341
+            $texto = "DANFE impresso em contingência -\n" .
1342
+                     "DPEC regularmente recebido pela Receita\n" .
1343 1343
                      "Federal do Brasil";
1344 1344
             $aFont = array('font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B');
1345 1345
             $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
@@ -1348,22 +1348,22 @@  discard block
 block discarded – undo
1348 1348
         if ($this->pNotaDenegada()) {
1349 1349
             //110 301 302 Denegada
1350 1350
             $x = 10;
1351
-            $y = $this->hPrint-130;
1351
+            $y = $this->hPrint - 130;
1352 1352
             $h = 25;
1353
-            $w = $maxW-(2*$x);
1353
+            $w = $maxW - (2 * $x);
1354 1354
             $this->pdf->SetTextColor(90, 90, 90);
1355 1355
             $texto = "NFe USO DENEGADO";
1356 1356
             $aFont = array('font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B');
1357 1357
             $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1358 1358
             $y += $h;
1359 1359
             $h = 5;
1360
-            $w = $maxW-(2*$x);
1360
+            $w = $maxW - (2 * $x);
1361 1361
             if (isset($this->infProt)) {
1362 1362
                 $xMotivo = $this->infProt->getElementsByTagName("xMotivo")->item(0)->nodeValue;
1363 1363
             } else {
1364 1364
                 $xMotivo = '';
1365 1365
             }
1366
-            $texto = "SEM VALOR FISCAL\n".$xMotivo;
1366
+            $texto = "SEM VALOR FISCAL\n" . $xMotivo;
1367 1367
             $aFont = array('font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B');
1368 1368
             $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1369 1369
             $this->pdf->SetTextColor(0, 0, 0);
@@ -1372,29 +1372,29 @@  discard block
 block discarded – undo
1372 1372
         if ($tpAmb != 1) {
1373 1373
             $x = 10;
1374 1374
             if ($this->orientacao == 'P') {
1375
-                $y = round($this->hPrint*2/3, 0);
1375
+                $y = round($this->hPrint * 2 / 3, 0);
1376 1376
             } else {
1377
-                $y = round($this->hPrint/2, 0);
1377
+                $y = round($this->hPrint / 2, 0);
1378 1378
             }
1379 1379
             $h = 5;
1380
-            $w = $maxW-(2*$x);
1380
+            $w = $maxW - (2 * $x);
1381 1381
             $this->pdf->SetTextColor(90, 90, 90);
1382 1382
             $texto = "SEM VALOR FISCAL";
1383 1383
             $aFont = array('font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B');
1384 1384
             $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1385 1385
             $aFont = array('font'=>$this->fontePadrao, 'size'=>30, 'style'=>'B');
1386 1386
             $texto = "AMBIENTE DE HOMOLOGAÇÃO";
1387
-            $this->pTextBox($x, $y+14, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1387
+            $this->pTextBox($x, $y + 14, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1388 1388
             $this->pdf->SetTextColor(0, 0, 0);
1389 1389
         } else {
1390 1390
             $x = 10;
1391 1391
             if ($this->orientacao == 'P') {
1392
-                $y = round($this->hPrint*2/3, 0);
1392
+                $y = round($this->hPrint * 2 / 3, 0);
1393 1393
             } else {
1394
-                $y = round($this->hPrint/2, 0);
1394
+                $y = round($this->hPrint / 2, 0);
1395 1395
             }//fim orientacao
1396 1396
             $h = 5;
1397
-            $w = $maxW-(2*$x);
1397
+            $w = $maxW - (2 * $x);
1398 1398
             $this->pdf->SetTextColor(90, 90, 90);
1399 1399
             //indicar FALTA DO PROTOCOLO se NFe não for em contingência
1400 1400
             if (($this->tpEmis == 2 || $this->tpEmis == 5) && !$this->pNotaDPEC()) {
@@ -1404,7 +1404,7 @@  discard block
 block discarded – undo
1404 1404
                 $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1405 1405
                 $aFont = array('font'=>$this->fontePadrao, 'size'=>30, 'style'=>'B');
1406 1406
                 $texto = "devido à problemas técnicos";
1407
-                $this->pTextBox($x, $y+12, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1407
+                $this->pTextBox($x, $y + 12, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1408 1408
             } else {
1409 1409
                 if (!isset($this->nfeProc)) {
1410 1410
                     if (!$this->pNotaDPEC()) {
@@ -1415,9 +1415,9 @@  discard block
 block discarded – undo
1415 1415
                     $aFont = array('font'=>$this->fontePadrao, 'size'=>30, 'style'=>'B');
1416 1416
                     $texto = "FALTA PROTOCOLO DE APROVAÇÃO DA SEFAZ";
1417 1417
                     if (!$this->pNotaDPEC()) {
1418
-                        $this->pTextBox($x, $y+12, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1418
+                        $this->pTextBox($x, $y + 12, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1419 1419
                     } else {
1420
-                        $this->pTextBox($x, $y+25, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1420
+                        $this->pTextBox($x, $y + 25, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1421 1421
                     }
1422 1422
                 }//fim nefProc
1423 1423
             }//fim tpEmis
@@ -1452,7 +1452,7 @@  discard block
 block discarded – undo
1452 1452
         $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
1453 1453
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1454 1454
         //NOME / RAZÃO SOCIAL
1455
-        $w = round($maxW*0.61, 0);
1455
+        $w = round($maxW * 0.61, 0);
1456 1456
         $w1 = $w;
1457 1457
         $y += 3;
1458 1458
         $texto = 'NOME / RAZÃO SOCIAL';
@@ -1467,19 +1467,19 @@  discard block
 block discarded – undo
1467 1467
         }
1468 1468
         //CNPJ / CPF
1469 1469
         $x += $w;
1470
-        $w = round($maxW*0.23, 0);
1470
+        $w = round($maxW * 0.23, 0);
1471 1471
         $w2 = $w;
1472 1472
         $texto = 'CNPJ / CPF';
1473 1473
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1474 1474
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1475 1475
         //Pegando valor do CPF/CNPJ
1476
-        if (! empty($this->dest->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1476
+        if (!empty($this->dest->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1477 1477
             $texto = $this->pFormat(
1478 1478
                 $this->dest->getElementsByTagName("CNPJ")->item(0)->nodeValue,
1479 1479
                 "###.###.###/####-##"
1480 1480
             );
1481 1481
         } else {
1482
-            $texto = ! empty($this->dest->getElementsByTagName("CPF")->item(0)->nodeValue) ?
1482
+            $texto = !empty($this->dest->getElementsByTagName("CPF")->item(0)->nodeValue) ?
1483 1483
                     $this->pFormat(
1484 1484
                         $this->dest->getElementsByTagName("CPF")->item(0)->nodeValue,
1485 1485
                         "###.###.###-##"
@@ -1489,15 +1489,15 @@  discard block
 block discarded – undo
1489 1489
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1490 1490
         //DATA DA EMISSÃO
1491 1491
         $x += $w;
1492
-        $w = $maxW-($w1+$w2);
1492
+        $w = $maxW - ($w1 + $w2);
1493 1493
         $wx = $w;
1494 1494
         $texto = 'DATA DA EMISSÃO';
1495 1495
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1496 1496
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1497
-        $dEmi = ! empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
1497
+        $dEmi = !empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
1498 1498
                 $this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue : '';
1499 1499
         if ($dEmi == '') {
1500
-            $dEmi = ! empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
1500
+            $dEmi = !empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
1501 1501
                     $this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue : '';
1502 1502
             $aDemi = explode('T', $dEmi);
1503 1503
             $dEmi = $aDemi[0];
@@ -1510,7 +1510,7 @@  discard block
 block discarded – undo
1510 1510
             $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 1, '');
1511 1511
         }
1512 1512
         //ENDEREÇO
1513
-        $w = round($maxW*0.47, 0);
1513
+        $w = round($maxW * 0.47, 0);
1514 1514
         $w1 = $w;
1515 1515
         $y += $h;
1516 1516
         $x = $oldX;
@@ -1525,7 +1525,7 @@  discard block
 block discarded – undo
1525 1525
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 0, '', true);
1526 1526
         //BAIRRO / DISTRITO
1527 1527
         $x += $w;
1528
-        $w = round($maxW*0.21, 0);
1528
+        $w = round($maxW * 0.21, 0);
1529 1529
         $w2 = $w;
1530 1530
         $texto = 'BAIRRO / DISTRITO';
1531 1531
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
@@ -1535,12 +1535,12 @@  discard block
 block discarded – undo
1535 1535
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1536 1536
         //CEP
1537 1537
         $x += $w;
1538
-        $w = $maxW-$w1-$w2-$wx;
1538
+        $w = $maxW - $w1 - $w2 - $wx;
1539 1539
         $w2 = $w;
1540 1540
         $texto = 'CEP';
1541 1541
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1542 1542
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1543
-        $texto = ! empty($this->dest->getElementsByTagName("CEP")->item(0)->nodeValue) ?
1543
+        $texto = !empty($this->dest->getElementsByTagName("CEP")->item(0)->nodeValue) ?
1544 1544
                 $this->dest->getElementsByTagName("CEP")->item(0)->nodeValue : '';
1545 1545
         $texto = $this->pFormat($texto, "#####-###");
1546 1546
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
@@ -1551,10 +1551,10 @@  discard block
 block discarded – undo
1551 1551
         $texto = 'DATA DA SAÍDA/ENTRADA';
1552 1552
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1553 1553
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1554
-        $dSaiEnt = ! empty($this->ide->getElementsByTagName("dSaiEnt")->item(0)->nodeValue) ?
1554
+        $dSaiEnt = !empty($this->ide->getElementsByTagName("dSaiEnt")->item(0)->nodeValue) ?
1555 1555
                 $this->ide->getElementsByTagName("dSaiEnt")->item(0)->nodeValue : '';
1556 1556
         if ($dSaiEnt == '') {
1557
-            $dSaiEnt = ! empty($this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue) ?
1557
+            $dSaiEnt = !empty($this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue) ?
1558 1558
                     $this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue : '';
1559 1559
             $aDsaient = explode('T', $dSaiEnt);
1560 1560
             $dSaiEnt = $aDsaient[0];
@@ -1571,7 +1571,7 @@  discard block
 block discarded – undo
1571 1571
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1572 1572
         $texto = $this->dest->getElementsByTagName("xMun")->item(0)->nodeValue;
1573 1573
         if (strtoupper(trim($texto)) == "EXTERIOR" && $this->dest->getElementsByTagName("xPais")->length > 0) {
1574
-            $texto .= " - " .  $this->dest->getElementsByTagName("xPais")->item(0)->nodeValue;
1574
+            $texto .= " - " . $this->dest->getElementsByTagName("xPais")->item(0)->nodeValue;
1575 1575
         }
1576 1576
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
1577 1577
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 0, '');
@@ -1586,18 +1586,18 @@  discard block
 block discarded – undo
1586 1586
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1587 1587
         //FONE / FAX
1588 1588
         $x += $w;
1589
-        $w = round(($maxW -$w1-$wx-8)/2, 0);
1589
+        $w = round(($maxW - $w1 - $wx - 8) / 2, 0);
1590 1590
         $w3 = $w;
1591 1591
         $texto = 'FONE / FAX';
1592 1592
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1593 1593
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1594
-        $texto = ! empty($this->dest->getElementsByTagName("fone")->item(0)->nodeValue) ?
1594
+        $texto = !empty($this->dest->getElementsByTagName("fone")->item(0)->nodeValue) ?
1595 1595
                 $this->dest->getElementsByTagName("fone")->item(0)->nodeValue : '';
1596 1596
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
1597 1597
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1598 1598
         //INSCRIÇÃO ESTADUAL
1599 1599
         $x += $w;
1600
-        $w = $maxW -$w1-$wx-8-$w3;
1600
+        $w = $maxW - $w1 - $wx - 8 - $w3;
1601 1601
         $texto = 'INSCRIÇÃO ESTADUAL';
1602 1602
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1603 1603
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -1611,10 +1611,10 @@  discard block
 block discarded – undo
1611 1611
         $texto = 'HORA DA SAÍDA/ENTRADA';
1612 1612
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1613 1613
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1614
-        $hSaiEnt = ! empty($this->ide->getElementsByTagName("hSaiEnt")->item(0)->nodeValue) ?
1614
+        $hSaiEnt = !empty($this->ide->getElementsByTagName("hSaiEnt")->item(0)->nodeValue) ?
1615 1615
                 $this->ide->getElementsByTagName("hSaiEnt")->item(0)->nodeValue : '';
1616 1616
         if ($hSaiEnt == '') {
1617
-            $dhSaiEnt = ! empty($this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue) ?
1617
+            $dhSaiEnt = !empty($this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue) ?
1618 1618
                     $this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue : '';
1619 1619
             $tsDhSaiEnt = $this->pConvertTime($dhSaiEnt);
1620 1620
             if ($tsDhSaiEnt != '') {
@@ -1693,7 +1693,7 @@  discard block
 block discarded – undo
1693 1693
     protected function pFaturaDANFE($x, $y)
1694 1694
     {
1695 1695
         $linha = 1;
1696
-        $h = 8+3;
1696
+        $h = 8 + 3;
1697 1697
         $oldx = $x;
1698 1698
         $textoFatura = $this->pGetTextoFatura();
1699 1699
         //verificar se existem duplicatas
@@ -1714,27 +1714,27 @@  discard block
 block discarded – undo
1714 1714
             $dupcont = 0;
1715 1715
             $nFat = $this->dup->length;
1716 1716
             if ($textoFatura !== "" && $this->exibirTextoFatura) {
1717
-                $myH=6;
1717
+                $myH = 6;
1718 1718
                 $myW = $this->wPrint;
1719 1719
                 if ($this->orientacao == 'L') {
1720 1720
                     $myW -= $this->wCanhoto;
1721 1721
                 }
1722 1722
                 $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'');
1723 1723
                 $this->pTextBox($x, $y, $myW, $myH, $textoFatura, $aFont, 'C', 'L', 1, '');
1724
-                $y+=$myH+1;
1724
+                $y += $myH + 1;
1725 1725
             }
1726 1726
             if ($this->orientacao == 'P') {
1727
-                $w = round($this->wPrint/7.018, 0)-1;
1727
+                $w = round($this->wPrint / 7.018, 0) - 1;
1728 1728
             } else {
1729 1729
                 $w = 28;
1730 1730
             }
1731 1731
             $increm = 1;
1732 1732
             foreach ($this->dup as $k => $d) {
1733
-                $nDup = ! empty($this->dup->item($k)->getElementsByTagName('nDup')->item(0)->nodeValue) ?
1733
+                $nDup = !empty($this->dup->item($k)->getElementsByTagName('nDup')->item(0)->nodeValue) ?
1734 1734
                         $this->dup->item($k)->getElementsByTagName('nDup')->item(0)->nodeValue : '';
1735
-                $dDup = ! empty($this->dup->item($k)->getElementsByTagName('dVenc')->item(0)->nodeValue) ?
1735
+                $dDup = !empty($this->dup->item($k)->getElementsByTagName('dVenc')->item(0)->nodeValue) ?
1736 1736
                         $this->pYmd2dmy($this->dup->item($k)->getElementsByTagName('dVenc')->item(0)->nodeValue) : '';
1737
-                $vDup = ! empty($this->dup->item($k)->getElementsByTagName('vDup')->item(0)->nodeValue) ?
1737
+                $vDup = !empty($this->dup->item($k)->getElementsByTagName('vDup')->item(0)->nodeValue) ?
1738 1738
                         'R$ ' . number_format(
1739 1739
                             $this->dup->item($k)->getElementsByTagName('vDup')->item(0)->nodeValue,
1740 1740
                             2,
@@ -1743,14 +1743,14 @@  discard block
 block discarded – undo
1743 1743
                         ) : '';
1744 1744
                 $h = 8;
1745 1745
                 $texto = '';
1746
-                if ($nDup!='0' && $nDup!='') {
1746
+                if ($nDup != '0' && $nDup != '') {
1747 1747
                     $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1748 1748
                     $this->pTextBox($x, $y, $w, $h, 'Num.', $aFont, 'T', 'L', 1, '');
1749 1749
                     $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
1750 1750
                     $this->pTextBox($x, $y, $w, $h, $nDup, $aFont, 'T', 'R', 0, '');
1751 1751
                 } else {
1752 1752
                     $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1753
-                    $this->pTextBox($x, $y, $w, $h, ($dupcont+1)."", $aFont, 'T', 'L', 1, '');
1753
+                    $this->pTextBox($x, $y, $w, $h, ($dupcont + 1) . "", $aFont, 'T', 'L', 1, '');
1754 1754
                 }
1755 1755
                 $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1756 1756
                 $this->pTextBox($x, $y, $w, $h, 'Venc.', $aFont, 'C', 'L', 0, '');
@@ -1760,7 +1760,7 @@  discard block
 block discarded – undo
1760 1760
                 $this->pTextBox($x, $y, $w, $h, 'Valor', $aFont, 'B', 'L', 0, '');
1761 1761
                 $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
1762 1762
                 $this->pTextBox($x, $y, $w, $h, $vDup, $aFont, 'B', 'R', 0, '');
1763
-                $x += $w+$increm;
1763
+                $x += $w + $increm;
1764 1764
                 $dupcont += 1;
1765 1765
                 if ($this->orientacao == 'P') {
1766 1766
                     $maxDupCont = 6;
@@ -1782,10 +1782,10 @@  discard block
 block discarded – undo
1782 1782
                 $y -= 9;
1783 1783
                 $linha--;
1784 1784
             }
1785
-            return ($y+$h);
1785
+            return ($y + $h);
1786 1786
         } else {
1787 1787
             $linha = 0;
1788
-            return ($y-2);
1788
+            return ($y - 2);
1789 1789
         }
1790 1790
     } //fim da função faturaDANFE
1791 1791
 
@@ -1801,7 +1801,7 @@  discard block
 block discarded – undo
1801 1801
     protected function pagamentoDANFE($x, $y)
1802 1802
     {
1803 1803
         $linha = 1;
1804
-        $h = 8+3;
1804
+        $h = 8 + 3;
1805 1805
         $oldx = $x;
1806 1806
         //verificar se existem cobranças definidas
1807 1807
         if (isset($this->detPag) && $this->detPag->length > 0) {
@@ -1820,7 +1820,7 @@  discard block
 block discarded – undo
1820 1820
             $dups = "";
1821 1821
             $dupcont = 0;
1822 1822
             if ($this->orientacao == 'P') {
1823
-                $w = round($this->wPrint/7.018, 0)-1;
1823
+                $w = round($this->wPrint / 7.018, 0) - 1;
1824 1824
             } else {
1825 1825
                 $w = 28;
1826 1826
             }
@@ -1830,16 +1830,16 @@  discard block
 block discarded – undo
1830 1830
                 $maxDupCont = 8;
1831 1831
             }
1832 1832
             $increm = 1;
1833
-            $formaPagamento = array('01'=>'Dinheiro','02'=>'Cheque','03'=>'Cartão de Crédito',
1834
-                                    '04'=>'Cartão de Débito','05'=>'Crédito Loja','10'=>'Vale Alimentação',
1835
-                                    '11'=>'Vale Refeição','12'=>'Vale Presente','13'=>'Vale Combustível',
1836
-                                    '14'=>'Duplicata Mercantil','15'=>'Boleto','90'=>'Sem pagamento','99'=>'Outros');
1837
-            $bandeira = array('01'=>'Visa','02'=>'Mastercard','03'=>'American','04'=>'Sorocred','05'=>'Diners',
1838
-                              '06'=>'Elo','07'=>'Hipercard','08'=>'Aura','09'=>'Cabal','99'=>'Outros');
1833
+            $formaPagamento = array('01'=>'Dinheiro', '02'=>'Cheque', '03'=>'Cartão de Crédito',
1834
+                                    '04'=>'Cartão de Débito', '05'=>'Crédito Loja', '10'=>'Vale Alimentação',
1835
+                                    '11'=>'Vale Refeição', '12'=>'Vale Presente', '13'=>'Vale Combustível',
1836
+                                    '14'=>'Duplicata Mercantil', '15'=>'Boleto', '90'=>'Sem pagamento', '99'=>'Outros');
1837
+            $bandeira = array('01'=>'Visa', '02'=>'Mastercard', '03'=>'American', '04'=>'Sorocred', '05'=>'Diners',
1838
+                              '06'=>'Elo', '07'=>'Hipercard', '08'=>'Aura', '09'=>'Cabal', '99'=>'Outros');
1839 1839
             foreach ($this->detPag as $k => $d) {
1840 1840
                 $fPag = !empty($this->detPag->item($k)->getElementsByTagName('tPag')->item(0)->nodeValue)
1841 1841
                     ? $this->detPag->item($k)->getElementsByTagName('tPag')->item(0)->nodeValue : '0';
1842
-                $vPag = ! empty($this->detPag->item($k)->getElementsByTagName('vPag')->item(0)->nodeValue)
1842
+                $vPag = !empty($this->detPag->item($k)->getElementsByTagName('vPag')->item(0)->nodeValue)
1843 1843
                     ? 'R$ ' . number_format(
1844 1844
                         $this->detPag->item($k)->getElementsByTagName('vPag')->item(0)->nodeValue,
1845 1845
                         2,
@@ -1850,7 +1850,7 @@  discard block
 block discarded – undo
1850 1850
                 $texto = '';
1851 1851
                 if (isset($formaPagamento[$fPag])) {
1852 1852
                     /*Exibir Item sem pagamento ou outros?*/
1853
-                    if ($fPag=='90' || $fPag=='99') {
1853
+                    if ($fPag == '90' || $fPag == '99') {
1854 1854
                         continue;
1855 1855
                     }
1856 1856
                     $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
@@ -1859,16 +1859,16 @@  discard block
 block discarded – undo
1859 1859
                     $this->pTextBox($x, $y, $w, $h, $formaPagamento[$fPag], $aFont, 'T', 'R', 0, '');
1860 1860
                 } else {
1861 1861
                     $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'');
1862
-                    $this->pTextBox($x, $y, $w, $h, "Forma ".$fPag." não encontrado", $aFont, 'T', 'L', 1, '');
1862
+                    $this->pTextBox($x, $y, $w, $h, "Forma " . $fPag . " não encontrado", $aFont, 'T', 'L', 1, '');
1863 1863
                 }
1864 1864
                 $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1865 1865
                 $this->pTextBox($x, $y, $w, $h, 'Valor', $aFont, 'B', 'L', 0, '');
1866 1866
                 $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
1867 1867
                 $this->pTextBox($x, $y, $w, $h, $vPag, $aFont, 'B', 'R', 0, '');
1868
-                $x += $w+$increm;
1868
+                $x += $w + $increm;
1869 1869
                 $dupcont += 1;
1870 1870
 
1871
-                if ($dupcont>$maxDupCont) {
1871
+                if ($dupcont > $maxDupCont) {
1872 1872
                     $y += 9;
1873 1873
                     $x = $oldx;
1874 1874
                     $dupcont = 0;
@@ -1883,10 +1883,10 @@  discard block
 block discarded – undo
1883 1883
                 $y -= 9;
1884 1884
                 $linha--;
1885 1885
             }
1886
-            return ($y+$h);
1886
+            return ($y + $h);
1887 1887
         } else {
1888 1888
             $linha = 0;
1889
-            return ($y-2);
1889
+            return ($y - 2);
1890 1890
         }
1891 1891
     } //fim da função pagamentoDANFE
1892 1892
     
@@ -1998,7 +1998,7 @@  discard block
 block discarded – undo
1998 1998
         }
1999 1999
         $x = $this->pImpostoDanfeHelper($x, $y, $w, $h, "V. TOTAL DA NOTA", "vNF");
2000 2000
 
2001
-        return ($y+$h);
2001
+        return ($y + $h);
2002 2002
     } //fim impostoDANFE
2003 2003
 
2004 2004
     /**
@@ -2026,13 +2026,13 @@  discard block
 block discarded – undo
2026 2026
         $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
2027 2027
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
2028 2028
         //NOME / RAZÃO SOCIAL
2029
-        $w1 = $maxW*0.29;
2029
+        $w1 = $maxW * 0.29;
2030 2030
         $y += 3;
2031 2031
         $texto = 'NOME / RAZÃO SOCIAL';
2032 2032
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2033 2033
         $this->pTextBox($x, $y, $w1, $h, $texto, $aFont, 'T', 'L', 1, '');
2034 2034
         if (isset($this->transporta)) {
2035
-            $texto = ! empty($this->transporta->getElementsByTagName("xNome")->item(0)->nodeValue) ?
2035
+            $texto = !empty($this->transporta->getElementsByTagName("xNome")->item(0)->nodeValue) ?
2036 2036
                     $this->transporta->getElementsByTagName("xNome")->item(0)->nodeValue : '';
2037 2037
         } else {
2038 2038
             $texto = '';
@@ -2041,11 +2041,11 @@  discard block
 block discarded – undo
2041 2041
         $this->pTextBox($x, $y, $w1, $h, $texto, $aFont, 'B', 'L', 0, '');
2042 2042
         //FRETE POR CONTA
2043 2043
         $x += $w1;
2044
-        $w2 = $maxW*0.15;
2044
+        $w2 = $maxW * 0.15;
2045 2045
         $texto = 'FRETE';
2046 2046
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2047 2047
         $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
2048
-        $tipoFrete = ! empty($this->transp->getElementsByTagName("modFrete")->item(0)->nodeValue) ?
2048
+        $tipoFrete = !empty($this->transp->getElementsByTagName("modFrete")->item(0)->nodeValue) ?
2049 2049
                 $this->transp->getElementsByTagName("modFrete")->item(0)->nodeValue : '0';
2050 2050
         switch ($tipoFrete) {
2051 2051
             case 0:
@@ -2075,7 +2075,7 @@  discard block
 block discarded – undo
2075 2075
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2076 2076
         $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
2077 2077
         if (isset($this->veicTransp)) {
2078
-            $texto = ! empty($this->veicTransp->getElementsByTagName("RNTC")->item(0)->nodeValue) ?
2078
+            $texto = !empty($this->veicTransp->getElementsByTagName("RNTC")->item(0)->nodeValue) ?
2079 2079
                     $this->veicTransp->getElementsByTagName("RNTC")->item(0)->nodeValue : '';
2080 2080
         } else {
2081 2081
             $texto = '';
@@ -2088,10 +2088,10 @@  discard block
 block discarded – undo
2088 2088
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2089 2089
         $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
2090 2090
         if (isset($this->veicTransp)) {
2091
-            $texto = ! empty($this->veicTransp->getElementsByTagName("placa")->item(0)->nodeValue) ?
2091
+            $texto = !empty($this->veicTransp->getElementsByTagName("placa")->item(0)->nodeValue) ?
2092 2092
                     $this->veicTransp->getElementsByTagName("placa")->item(0)->nodeValue : '';
2093 2093
         } elseif (isset($this->reboque)) {
2094
-            $texto = ! empty($this->reboque->getElementsByTagName("placa")->item(0)->nodeValue) ?
2094
+            $texto = !empty($this->reboque->getElementsByTagName("placa")->item(0)->nodeValue) ?
2095 2095
                     $this->reboque->getElementsByTagName("placa")->item(0)->nodeValue : '';
2096 2096
         } else {
2097 2097
             $texto = '';
@@ -2100,15 +2100,15 @@  discard block
 block discarded – undo
2100 2100
         $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'B', 'C', 0, '');
2101 2101
         //UF
2102 2102
         $x += $w2;
2103
-        $w3 = round($maxW*0.04, 0);
2103
+        $w3 = round($maxW * 0.04, 0);
2104 2104
         $texto = 'UF';
2105 2105
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2106 2106
         $this->pTextBox($x, $y, $w3, $h, $texto, $aFont, 'T', 'L', 1, '');
2107 2107
         if (isset($this->veicTransp)) {
2108
-            $texto = ! empty($this->veicTransp->getElementsByTagName("UF")->item(0)->nodeValue) ?
2108
+            $texto = !empty($this->veicTransp->getElementsByTagName("UF")->item(0)->nodeValue) ?
2109 2109
                     $this->veicTransp->getElementsByTagName("UF")->item(0)->nodeValue : '';
2110 2110
         } elseif (isset($this->reboque)) {
2111
-            $texto = ! empty($this->reboque->getElementsByTagName("UF")->item(0)->nodeValue) ?
2111
+            $texto = !empty($this->reboque->getElementsByTagName("UF")->item(0)->nodeValue) ?
2112 2112
                     $this->reboque->getElementsByTagName("UF")->item(0)->nodeValue : '';
2113 2113
         } else {
2114 2114
             $texto = '';
@@ -2117,18 +2117,18 @@  discard block
 block discarded – undo
2117 2117
         $this->pTextBox($x, $y, $w3, $h, $texto, $aFont, 'B', 'C', 0, '');
2118 2118
         //CNPJ / CPF
2119 2119
         $x += $w3;
2120
-        $w = $maxW-($w1+3*$w2+$w3);
2120
+        $w = $maxW - ($w1 + 3 * $w2 + $w3);
2121 2121
         $texto = 'CNPJ / CPF';
2122 2122
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2123 2123
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
2124 2124
         if (isset($this->transporta)) {
2125
-            $texto = ! empty($this->transporta->getElementsByTagName("CNPJ")->item(0)->nodeValue) ?
2125
+            $texto = !empty($this->transporta->getElementsByTagName("CNPJ")->item(0)->nodeValue) ?
2126 2126
                     $this->pFormat(
2127 2127
                         $this->transporta->getElementsByTagName("CNPJ")->item(0)->nodeValue,
2128 2128
                         "##.###.###/####-##"
2129 2129
                     ) : '';
2130 2130
             if ($texto == '') {
2131
-                $texto = ! empty($this->transporta->getElementsByTagName("CPF")->item(0)->nodeValue) ?
2131
+                $texto = !empty($this->transporta->getElementsByTagName("CPF")->item(0)->nodeValue) ?
2132 2132
                         $this->pFormat(
2133 2133
                             $this->transporta->getElementsByTagName("CPF")->item(0)->nodeValue,
2134 2134
                             "###.###.###-##"
@@ -2144,12 +2144,12 @@  discard block
 block discarded – undo
2144 2144
         $y += $h;
2145 2145
         $x = $oldX;
2146 2146
         $h = 7;
2147
-        $w1 = $maxW*0.44;
2147
+        $w1 = $maxW * 0.44;
2148 2148
         $texto = 'ENDEREÇO';
2149 2149
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2150 2150
         $this->pTextBox($x, $y, $w1, $h, $texto, $aFont, 'T', 'L', 1, '');
2151 2151
         if (isset($this->transporta)) {
2152
-            $texto = ! empty($this->transporta->getElementsByTagName("xEnder")->item(0)->nodeValue) ?
2152
+            $texto = !empty($this->transporta->getElementsByTagName("xEnder")->item(0)->nodeValue) ?
2153 2153
                     $this->transporta->getElementsByTagName("xEnder")->item(0)->nodeValue : '';
2154 2154
         } else {
2155 2155
             $texto = '';
@@ -2158,12 +2158,12 @@  discard block
 block discarded – undo
2158 2158
         $this->pTextBox($x, $y, $w1, $h, $texto, $aFont, 'B', 'L', 0, '');
2159 2159
         //MUNICÍPIO
2160 2160
         $x += $w1;
2161
-        $w2 = round($maxW*0.30, 0);
2161
+        $w2 = round($maxW * 0.30, 0);
2162 2162
         $texto = 'MUNICÍPIO';
2163 2163
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2164 2164
         $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
2165 2165
         if (isset($this->transporta)) {
2166
-            $texto = ! empty($this->transporta->getElementsByTagName("xMun")->item(0)->nodeValue) ?
2166
+            $texto = !empty($this->transporta->getElementsByTagName("xMun")->item(0)->nodeValue) ?
2167 2167
                     $this->transporta->getElementsByTagName("xMun")->item(0)->nodeValue : '';
2168 2168
         } else {
2169 2169
             $texto = '';
@@ -2172,12 +2172,12 @@  discard block
 block discarded – undo
2172 2172
         $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'B', 'C', 0, '');
2173 2173
         //UF
2174 2174
         $x += $w2;
2175
-        $w3 = round($maxW*0.04, 0);
2175
+        $w3 = round($maxW * 0.04, 0);
2176 2176
         $texto = 'UF';
2177 2177
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2178 2178
         $this->pTextBox($x, $y, $w3, $h, $texto, $aFont, 'T', 'L', 1, '');
2179 2179
         if (isset($this->transporta)) {
2180
-            $texto = ! empty($this->transporta->getElementsByTagName("UF")->item(0)->nodeValue) ?
2180
+            $texto = !empty($this->transporta->getElementsByTagName("UF")->item(0)->nodeValue) ?
2181 2181
                     $this->transporta->getElementsByTagName("UF")->item(0)->nodeValue : '';
2182 2182
         } else {
2183 2183
             $texto = '';
@@ -2186,13 +2186,13 @@  discard block
 block discarded – undo
2186 2186
         $this->pTextBox($x, $y, $w3, $h, $texto, $aFont, 'B', 'C', 0, '');
2187 2187
         //INSCRIÇÃO ESTADUAL
2188 2188
         $x += $w3;
2189
-        $w = $maxW-($w1+$w2+$w3);
2189
+        $w = $maxW - ($w1 + $w2 + $w3);
2190 2190
         $texto = 'INSCRIÇÃO ESTADUAL';
2191 2191
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2192 2192
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
2193 2193
         $texto = '';
2194 2194
         if (isset($this->transporta)) {
2195
-            if (! empty($this->transporta->getElementsByTagName("IE")->item(0)->nodeValue)) {
2195
+            if (!empty($this->transporta->getElementsByTagName("IE")->item(0)->nodeValue)) {
2196 2196
                 $texto = $this->transporta->getElementsByTagName("IE")->item(0)->nodeValue;
2197 2197
             }
2198 2198
         }
@@ -2205,16 +2205,16 @@  discard block
 block discarded – undo
2205 2205
         $marca = '';
2206 2206
         $numero = '';
2207 2207
         $texto = '';
2208
-        $pesoBruto=0;
2209
-        $pesoLiquido=0;
2208
+        $pesoBruto = 0;
2209
+        $pesoLiquido = 0;
2210 2210
         foreach ($volumes as $volume) {
2211
-            $quantidade += ! empty($volume->getElementsByTagName("qVol")->item(0)->nodeValue) ?
2211
+            $quantidade += !empty($volume->getElementsByTagName("qVol")->item(0)->nodeValue) ?
2212 2212
                     $volume->getElementsByTagName("qVol")->item(0)->nodeValue : 0;
2213
-            $pesoBruto += ! empty($volume->getElementsByTagName("pesoB")->item(0)->nodeValue) ?
2213
+            $pesoBruto += !empty($volume->getElementsByTagName("pesoB")->item(0)->nodeValue) ?
2214 2214
                     $volume->getElementsByTagName("pesoB")->item(0)->nodeValue : 0;
2215
-            $pesoLiquido += ! empty($volume->getElementsByTagName("pesoL")->item(0)->nodeValue) ?
2215
+            $pesoLiquido += !empty($volume->getElementsByTagName("pesoL")->item(0)->nodeValue) ?
2216 2216
                     $volume->getElementsByTagName("pesoL")->item(0)->nodeValue : 0;
2217
-            $texto = ! empty($this->transp->getElementsByTagName("esp")->item(0)->nodeValue) ?
2217
+            $texto = !empty($this->transp->getElementsByTagName("esp")->item(0)->nodeValue) ?
2218 2218
                     $this->transp->getElementsByTagName("esp")->item(0)->nodeValue : '';
2219 2219
             if ($texto != $especie && $especie != '') {
2220 2220
                 //tem várias especies
@@ -2222,7 +2222,7 @@  discard block
 block discarded – undo
2222 2222
             } else {
2223 2223
                 $especie = $texto;
2224 2224
             }
2225
-            $texto = ! empty($this->transp->getElementsByTagName("marca")->item(0)->nodeValue) ?
2225
+            $texto = !empty($this->transp->getElementsByTagName("marca")->item(0)->nodeValue) ?
2226 2226
                     $this->transp->getElementsByTagName("marca")->item(0)->nodeValue : '';
2227 2227
             if ($texto != $marca && $marca != '') {
2228 2228
                 //tem várias especies
@@ -2230,7 +2230,7 @@  discard block
 block discarded – undo
2230 2230
             } else {
2231 2231
                 $marca = $texto;
2232 2232
             }
2233
-            $texto = ! empty($this->transp->getElementsByTagName("nVol")->item(0)->nodeValue) ?
2233
+            $texto = !empty($this->transp->getElementsByTagName("nVol")->item(0)->nodeValue) ?
2234 2234
                     $this->transp->getElementsByTagName("nVol")->item(0)->nodeValue : '';
2235 2235
             if ($texto != $numero && $numero != '') {
2236 2236
                 //tem várias especies
@@ -2245,7 +2245,7 @@  discard block
 block discarded – undo
2245 2245
         $y += $h;
2246 2246
         $x = $oldX;
2247 2247
         $h = 7;
2248
-        $w1 = round($maxW*0.10, 0);
2248
+        $w1 = round($maxW * 0.10, 0);
2249 2249
         $texto = 'QUANTIDADE';
2250 2250
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2251 2251
         $this->pTextBox($x, $y, $w1, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -2256,7 +2256,7 @@  discard block
 block discarded – undo
2256 2256
         }
2257 2257
         //ESPÉCIE
2258 2258
         $x += $w1;
2259
-        $w2 = round($maxW*0.17, 0);
2259
+        $w2 = round($maxW * 0.17, 0);
2260 2260
         $texto = 'ESPÉCIE';
2261 2261
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2262 2262
         $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -2268,7 +2268,7 @@  discard block
 block discarded – undo
2268 2268
         $texto = 'MARCA';
2269 2269
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2270 2270
         $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
2271
-        $texto = ! empty($this->transp->getElementsByTagName("marca")->item(0)->nodeValue) ?
2271
+        $texto = !empty($this->transp->getElementsByTagName("marca")->item(0)->nodeValue) ?
2272 2272
                 $this->transp->getElementsByTagName("marca")->item(0)->nodeValue : '';
2273 2273
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
2274 2274
         $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'B', 'C', 0, '');
@@ -2282,7 +2282,7 @@  discard block
 block discarded – undo
2282 2282
         $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'B', 'C', 0, '');
2283 2283
         //PESO BRUTO
2284 2284
         $x += $w2;
2285
-        $w3 = round($maxW*0.20, 0);
2285
+        $w3 = round($maxW * 0.20, 0);
2286 2286
         $texto = 'PESO BRUTO';
2287 2287
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2288 2288
         $this->pTextBox($x, $y, $w3, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -2295,7 +2295,7 @@  discard block
 block discarded – undo
2295 2295
         $this->pTextBox($x, $y, $w3, $h, $texto, $aFont, 'B', 'R', 0, '');
2296 2296
         //PESO LÍQUIDO
2297 2297
         $x += $w3;
2298
-        $w = $maxW -($w1+3*$w2+$w3);
2298
+        $w = $maxW - ($w1 + 3 * $w2 + $w3);
2299 2299
         $texto = 'PESO LÍQUIDO';
2300 2300
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2301 2301
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -2306,7 +2306,7 @@  discard block
 block discarded – undo
2306 2306
         }
2307 2307
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
2308 2308
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'R', 0, '');
2309
-        return ($y+$h);
2309
+        return ($y + $h);
2310 2310
     } //fim transporteDANFE
2311 2311
 
2312 2312
 
@@ -2318,7 +2318,7 @@  discard block
 block discarded – undo
2318 2318
             return "";
2319 2319
         }
2320 2320
         $valor_original = $valor_original->nodeValue;
2321
-        $valor = ! empty($valor_original) ? number_format($valor_original, 2, ",", ".") : '';
2321
+        $valor = !empty($valor_original) ? number_format($valor_original, 2, ",", ".") : '';
2322 2322
 
2323 2323
         if ($valor != "") {
2324 2324
             return sprintf($formato, $valor);
@@ -2362,13 +2362,13 @@  discard block
 block discarded – undo
2362 2362
             $impostos .= $this->pDescricaoProdutoHelper($ICMSUFDest, "vICMSUFDest", " vICMSUFDest=%s");
2363 2363
             $impostos .= $this->pDescricaoProdutoHelper($ICMSUFDest, "vICMSUFRemet", " vICMSUFRemet=%s");
2364 2364
         }
2365
-        $infAdProd = ! empty($itemProd->getElementsByTagName('infAdProd')->item(0)->nodeValue) ?
2365
+        $infAdProd = !empty($itemProd->getElementsByTagName('infAdProd')->item(0)->nodeValue) ?
2366 2366
                 substr($this->pAnfavea($itemProd->getElementsByTagName('infAdProd')->item(0)->nodeValue), 0, 500) : '';
2367
-        if (! empty($infAdProd)) {
2367
+        if (!empty($infAdProd)) {
2368 2368
             $infAdProd = trim($infAdProd);
2369 2369
             $infAdProd .= ' ';
2370 2370
         }
2371
-        $loteTxt ='';
2371
+        $loteTxt = '';
2372 2372
         $rastro = $prod->getElementsByTagName("med");
2373 2373
         if (!isset($rastro)) {
2374 2374
             $rastro = $prod->getElementsByTagName("rastro");
@@ -2384,14 +2384,14 @@  discard block
 block discarded – undo
2384 2384
                 $i++;
2385 2385
             }
2386 2386
             if ($loteTxt != '') {
2387
-                $loteTxt.= ' ';
2387
+                $loteTxt .= ' ';
2388 2388
             }
2389 2389
         }
2390 2390
         //NT2013.006 FCI
2391
-        $nFCI = (! empty($itemProd->getElementsByTagName('nFCI')->item(0)->nodeValue)) ?
2392
-                ' FCI:'.$itemProd->getElementsByTagName('nFCI')->item(0)->nodeValue : '';
2393
-        $tmp_ad=$infAdProd . ($this->descProdInfoComplemento ? $loteTxt . $impostos . $nFCI : '');
2394
-        $texto = $prod->getElementsByTagName("xProd")->item(0)->nodeValue . (strlen($tmp_ad)!=0?"\n    ".$tmp_ad:'');
2391
+        $nFCI = (!empty($itemProd->getElementsByTagName('nFCI')->item(0)->nodeValue)) ?
2392
+                ' FCI:' . $itemProd->getElementsByTagName('nFCI')->item(0)->nodeValue : '';
2393
+        $tmp_ad = $infAdProd . ($this->descProdInfoComplemento ? $loteTxt . $impostos . $nFCI : '');
2394
+        $texto = $prod->getElementsByTagName("xProd")->item(0)->nodeValue . (strlen($tmp_ad) != 0 ? "\n    " . $tmp_ad : '');
2395 2395
         //decodifica os caracteres html no xml
2396 2396
         $texto = html_entity_decode($texto);
2397 2397
         if ($this->descProdQuebraLinha) {
@@ -2441,104 +2441,104 @@  discard block
 block discarded – undo
2441 2441
         // cabecalho LOOP COM OS DADOS DOS PRODUTOS
2442 2442
         //CÓDIGO PRODUTO
2443 2443
         $texto = "CÓDIGO PRODUTO";
2444
-        $w1 = round($w*0.09, 0);
2444
+        $w1 = round($w * 0.09, 0);
2445 2445
         $h = 4;
2446 2446
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2447 2447
         $this->pTextBox($x, $y, $w1, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2448
-        $this->pdf->Line($x+$w1, $y, $x+$w1, $y+$hmax);
2448
+        $this->pdf->Line($x + $w1, $y, $x + $w1, $y + $hmax);
2449 2449
         //DESCRIÇÃO DO PRODUTO / SERVIÇO
2450 2450
         $x += $w1;
2451
-        $w2 = round($w*0.28, 0);
2451
+        $w2 = round($w * 0.28, 0);
2452 2452
         $texto = 'DESCRIÇÃO DO PRODUTO / SERVIÇO';
2453 2453
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2454 2454
         $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2455
-        $this->pdf->Line($x+$w2, $y, $x+$w2, $y+$hmax);
2455
+        $this->pdf->Line($x + $w2, $y, $x + $w2, $y + $hmax);
2456 2456
         //NCM/SH
2457 2457
         $x += $w2;
2458
-        $w3 = round($w*0.06, 0);
2458
+        $w3 = round($w * 0.06, 0);
2459 2459
         $texto = 'NCM/SH';
2460 2460
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2461 2461
         $this->pTextBox($x, $y, $w3, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2462
-        $this->pdf->Line($x+$w3, $y, $x+$w3, $y+$hmax);
2462
+        $this->pdf->Line($x + $w3, $y, $x + $w3, $y + $hmax);
2463 2463
         //O/CST ou O/CSOSN
2464 2464
         $x += $w3;
2465
-        $w4 = round($w*0.05, 0);
2466
-        $texto = 'O/CSOSN';//Regime do Simples CRT = 1 ou CRT = 2
2465
+        $w4 = round($w * 0.05, 0);
2466
+        $texto = 'O/CSOSN'; //Regime do Simples CRT = 1 ou CRT = 2
2467 2467
         if ($this->getTagValue($this->emit, 'CRT') == '3') {
2468
-             $texto = 'O/CST';//Regime Normal
2468
+             $texto = 'O/CST'; //Regime Normal
2469 2469
         }
2470 2470
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2471 2471
         $this->pTextBox($x, $y, $w4, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2472
-        $this->pdf->Line($x+$w4, $y, $x+$w4, $y+$hmax);
2472
+        $this->pdf->Line($x + $w4, $y, $x + $w4, $y + $hmax);
2473 2473
         //CFOP
2474 2474
         $x += $w4;
2475
-        $w5 = round($w*0.04, 0);
2475
+        $w5 = round($w * 0.04, 0);
2476 2476
         $texto = 'CFOP';
2477 2477
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2478 2478
         $this->pTextBox($x, $y, $w5, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2479
-        $this->pdf->Line($x+$w5, $y, $x+$w5, $y+$hmax);
2479
+        $this->pdf->Line($x + $w5, $y, $x + $w5, $y + $hmax);
2480 2480
         //UN
2481 2481
         $x += $w5;
2482
-        $w6 = round($w*0.03, 0);
2482
+        $w6 = round($w * 0.03, 0);
2483 2483
         $texto = 'UN';
2484 2484
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2485 2485
         $this->pTextBox($x, $y, $w6, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2486
-        $this->pdf->Line($x+$w6, $y, $x+$w6, $y+$hmax);
2486
+        $this->pdf->Line($x + $w6, $y, $x + $w6, $y + $hmax);
2487 2487
         //QUANT
2488 2488
         $x += $w6;
2489
-        $w7 = round($w*0.07, 0);
2489
+        $w7 = round($w * 0.07, 0);
2490 2490
         $texto = 'QUANT';
2491 2491
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2492 2492
         $this->pTextBox($x, $y, $w7, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2493
-        $this->pdf->Line($x+$w7, $y, $x+$w7, $y+$hmax);
2493
+        $this->pdf->Line($x + $w7, $y, $x + $w7, $y + $hmax);
2494 2494
         //VALOR UNIT
2495 2495
         $x += $w7;
2496
-        $w8 = round($w*0.06, 0);
2496
+        $w8 = round($w * 0.06, 0);
2497 2497
         $texto = 'VALOR UNIT';
2498 2498
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2499 2499
         $this->pTextBox($x, $y, $w8, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2500
-        $this->pdf->Line($x+$w8, $y, $x+$w8, $y+$hmax);
2500
+        $this->pdf->Line($x + $w8, $y, $x + $w8, $y + $hmax);
2501 2501
         //VALOR TOTAL
2502 2502
         $x += $w8;
2503
-        $w9 = round($w*0.06, 0);
2503
+        $w9 = round($w * 0.06, 0);
2504 2504
         $texto = 'VALOR TOTAL';
2505 2505
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2506 2506
         $this->pTextBox($x, $y, $w9, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2507
-        $this->pdf->Line($x+$w9, $y, $x+$w9, $y+$hmax);
2507
+        $this->pdf->Line($x + $w9, $y, $x + $w9, $y + $hmax);
2508 2508
         //B.CÁLC ICMS
2509 2509
         $x += $w9;
2510
-        $w10 = round($w*0.06, 0);
2510
+        $w10 = round($w * 0.06, 0);
2511 2511
         $texto = 'B.CÁLC ICMS';
2512 2512
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2513 2513
         $this->pTextBox($x, $y, $w10, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2514
-        $this->pdf->Line($x+$w10, $y, $x+$w10, $y+$hmax);
2514
+        $this->pdf->Line($x + $w10, $y, $x + $w10, $y + $hmax);
2515 2515
         //VALOR ICMS
2516 2516
         $x += $w10;
2517
-        $w11 = round($w*0.06, 0);
2517
+        $w11 = round($w * 0.06, 0);
2518 2518
         $texto = 'VALOR ICMS';
2519 2519
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2520 2520
         $this->pTextBox($x, $y, $w11, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2521
-        $this->pdf->Line($x+$w11, $y, $x+$w11, $y+$hmax);
2521
+        $this->pdf->Line($x + $w11, $y, $x + $w11, $y + $hmax);
2522 2522
         //VALOR IPI
2523 2523
         $x += $w11;
2524
-        $w12 = round($w*0.05, 0);
2524
+        $w12 = round($w * 0.05, 0);
2525 2525
         $texto = 'VALOR IPI';
2526 2526
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2527 2527
         $this->pTextBox($x, $y, $w12, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2528
-        $this->pdf->Line($x+$w12, $y, $x+$w12, $y+$hmax);
2528
+        $this->pdf->Line($x + $w12, $y, $x + $w12, $y + $hmax);
2529 2529
         //ALÍQ. ICMS
2530 2530
         $x += $w12;
2531
-        $w13 = round($w*0.035, 0);
2531
+        $w13 = round($w * 0.035, 0);
2532 2532
         $texto = 'ALÍQ. ICMS';
2533 2533
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2534 2534
         $this->pTextBox($x, $y, $w13, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2535
-        $this->pdf->Line($x+$w13, $y, $x+$w13, $y+$hmax);
2535
+        $this->pdf->Line($x + $w13, $y, $x + $w13, $y + $hmax);
2536 2536
         //ALÍQ. IPI
2537 2537
         $x += $w13;
2538
-        $w14 = $w-($w1+$w2+$w3+$w4+$w5+$w6+$w7+$w8+$w9+$w10+$w11+$w12+$w13);
2538
+        $w14 = $w - ($w1 + $w2 + $w3 + $w4 + $w5 + $w6 + $w7 + $w8 + $w9 + $w10 + $w11 + $w12 + $w13);
2539 2539
         $texto = 'ALÍQ. IPI';
2540 2540
         $this->pTextBox($x, $y, $w14, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2541
-        $this->pdf->Line($oldX, $y+$h+1, $oldX + $w, $y+$h+1);
2541
+        $this->pdf->Line($oldX, $y + $h + 1, $oldX + $w, $y + $h + 1);
2542 2542
         $y += 5;
2543 2543
         //##################################################################################
2544 2544
         // LOOP COM OS DADOS DOS PRODUTOS
@@ -2555,7 +2555,7 @@  discard block
 block discarded – undo
2555 2555
                 $IPI  = $imposto->getElementsByTagName("IPI")->item(0);
2556 2556
                 $textoProduto = $this->pDescricaoProduto($thisItem);
2557 2557
                 $linhaDescr = $this->pGetNumLines($textoProduto, $w2, $aFont);
2558
-                $h = round(($linhaDescr * $this->pdf->fontSize)+ ($linhaDescr * 0.5), 2);
2558
+                $h = round(($linhaDescr * $this->pdf->fontSize) + ($linhaDescr * 0.5), 2);
2559 2559
                 $hUsado += $h;
2560 2560
                 if ($pag != $totpag) {
2561 2561
                     if ($hUsado >= $hmax && $i < $totItens) {
@@ -2565,11 +2565,11 @@  discard block
 block discarded – undo
2565 2565
                         break;
2566 2566
                     }
2567 2567
                 }
2568
-                $y_linha=$y+$h;
2568
+                $y_linha = $y + $h;
2569 2569
                 // linha entre itens
2570 2570
                 $this->pdf->DashedHLine($oldX, $y_linha, $w, 0.1, 120);
2571 2571
                 //corrige o x
2572
-                $x=$oldX;
2572
+                $x = $oldX;
2573 2573
                 //codigo do produto
2574 2574
                 $texto = $prod->getElementsByTagName("cProd")->item(0)->nodeValue;
2575 2575
                 $this->pTextBox($x, $y, $w1, $h, $texto, $aFont, 'T', 'C', 0, '');
@@ -2582,16 +2582,16 @@  discard block
 block discarded – undo
2582 2582
                 }
2583 2583
                 $x += $w2;
2584 2584
                 //NCM
2585
-                $texto = ! empty($prod->getElementsByTagName("NCM")->item(0)->nodeValue) ?
2585
+                $texto = !empty($prod->getElementsByTagName("NCM")->item(0)->nodeValue) ?
2586 2586
                         $prod->getElementsByTagName("NCM")->item(0)->nodeValue : '';
2587 2587
                 $this->pTextBox($x, $y, $w3, $h, $texto, $aFont, 'T', 'C', 0, '');
2588 2588
                 $x += $w3;
2589 2589
                 //CST
2590 2590
                 if (isset($ICMS)) {
2591
-                    $origem =  $this->getTagValue($ICMS, "orig");
2592
-                    $cst =  $this->getTagValue($ICMS, "CST");
2593
-                    $csosn =  $this->getTagValue($ICMS, "CSOSN");
2594
-                    $texto = $origem.$cst.$csosn;
2591
+                    $origem = $this->getTagValue($ICMS, "orig");
2592
+                    $cst = $this->getTagValue($ICMS, "CST");
2593
+                    $csosn = $this->getTagValue($ICMS, "CSOSN");
2594
+                    $texto = $origem . $cst . $csosn;
2595 2595
                     $this->pTextBox($x, $y, $w4, $h, $texto, $aFont, 'T', 'C', 0, '');
2596 2596
                 }
2597 2597
                 //CFOP
@@ -2625,7 +2625,7 @@  discard block
 block discarded – undo
2625 2625
                 //Valor da Base de calculo
2626 2626
                 $x += $w9;
2627 2627
                 if (isset($ICMS)) {
2628
-                    $texto = ! empty($ICMS->getElementsByTagName("vBC")->item(0)->nodeValue) ?
2628
+                    $texto = !empty($ICMS->getElementsByTagName("vBC")->item(0)->nodeValue) ?
2629 2629
                             number_format(
2630 2630
                                 $ICMS->getElementsByTagName("vBC")->item(0)->nodeValue,
2631 2631
                                 2,
@@ -2637,7 +2637,7 @@  discard block
 block discarded – undo
2637 2637
                 //Valor do ICMS
2638 2638
                 $x += $w10;
2639 2639
                 if (isset($ICMS)) {
2640
-                    $texto = ! empty($ICMS->getElementsByTagName("vICMS")->item(0)->nodeValue) ?
2640
+                    $texto = !empty($ICMS->getElementsByTagName("vICMS")->item(0)->nodeValue) ?
2641 2641
                             number_format(
2642 2642
                                 $ICMS->getElementsByTagName("vICMS")->item(0)->nodeValue,
2643 2643
                                 2,
@@ -2649,8 +2649,8 @@  discard block
 block discarded – undo
2649 2649
                 //Valor do IPI
2650 2650
                 $x += $w11;
2651 2651
                 if (isset($IPI)) {
2652
-                    $texto = ! empty($IPI->getElementsByTagName("vIPI")->item(0)->nodeValue) ?
2653
-                            number_format($IPI->getElementsByTagName("vIPI")->item(0)->nodeValue, 2, ",", ".") :'';
2652
+                    $texto = !empty($IPI->getElementsByTagName("vIPI")->item(0)->nodeValue) ?
2653
+                            number_format($IPI->getElementsByTagName("vIPI")->item(0)->nodeValue, 2, ",", ".") : '';
2654 2654
                 } else {
2655 2655
                     $texto = '';
2656 2656
                 }
@@ -2658,7 +2658,7 @@  discard block
 block discarded – undo
2658 2658
                 // %ICMS
2659 2659
                 $x += $w12;
2660 2660
                 if (isset($ICMS)) {
2661
-                    $texto = ! empty($ICMS->getElementsByTagName("pICMS")->item(0)->nodeValue) ?
2661
+                    $texto = !empty($ICMS->getElementsByTagName("pICMS")->item(0)->nodeValue) ?
2662 2662
                             number_format(
2663 2663
                                 $ICMS->getElementsByTagName("pICMS")->item(0)->nodeValue,
2664 2664
                                 2,
@@ -2670,7 +2670,7 @@  discard block
 block discarded – undo
2670 2670
                 //%IPI
2671 2671
                 $x += $w13;
2672 2672
                 if (isset($IPI)) {
2673
-                    $texto = ! empty($IPI->getElementsByTagName("pIPI")->item(0)->nodeValue) ?
2673
+                    $texto = !empty($IPI->getElementsByTagName("pIPI")->item(0)->nodeValue) ?
2674 2674
                             number_format($IPI->getElementsByTagName("pIPI")->item(0)->nodeValue, 2, ",", ".") : '';
2675 2675
                 } else {
2676 2676
                     $texto = '';
@@ -2695,7 +2695,7 @@  discard block
 block discarded – undo
2695 2695
                 $i++;
2696 2696
             }
2697 2697
         }
2698
-        return $oldY+$hmax;
2698
+        return $oldY + $hmax;
2699 2699
     }
2700 2700
 
2701 2701
 
@@ -2729,7 +2729,7 @@  discard block
 block discarded – undo
2729 2729
 
2730 2730
         $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'');
2731 2731
 
2732
-        $w1 = round($w*0.09, 0);
2732
+        $w1 = round($w * 0.09, 0);
2733 2733
 
2734 2734
         // Tabela Renavam Combustivel
2735 2735
         $renavamCombustivel = array(
@@ -2828,54 +2828,54 @@  discard block
 block discarded – undo
2828 2828
 
2829 2829
         $yVeic = $y + $h;
2830 2830
         $texto = 'Chassi: ............: ' . $veiculoChassi;
2831
-        $this->pTextBox($x, $yVeic, $w1+40, $h, $texto, $aFont, 'T', 'L', 0, '');
2831
+        $this->pTextBox($x, $yVeic, $w1 + 40, $h, $texto, $aFont, 'T', 'L', 0, '');
2832 2832
         $yVeic += $h;
2833 2833
         $texto = 'Cor...................: ' . $veiculoCor;
2834
-        $this->pTextBox($x, $yVeic, $w1+40, $h, $texto, $aFont, 'T', 'L', 0, '');
2834
+        $this->pTextBox($x, $yVeic, $w1 + 40, $h, $texto, $aFont, 'T', 'L', 0, '');
2835 2835
         $yVeic += $h;
2836 2836
         $texto = 'Cilindrada........: ' . $veiculoCilindrada;
2837
-        $this->pTextBox($x, $yVeic, $w1+40, $h, $texto, $aFont, 'T', 'L', 0, '');
2837
+        $this->pTextBox($x, $yVeic, $w1 + 40, $h, $texto, $aFont, 'T', 'L', 0, '');
2838 2838
         $yVeic += $h;
2839 2839
         $texto = 'Cmkg...............: ' . $veiculoCmkg;
2840
-        $this->pTextBox($x, $yVeic, $w1+40, $h, $texto, $aFont, 'T', 'L', 0, '');
2840
+        $this->pTextBox($x, $yVeic, $w1 + 40, $h, $texto, $aFont, 'T', 'L', 0, '');
2841 2841
         $yVeic += $h;
2842 2842
         $texto = 'Tipo.................: ' . array_key_exists(intval($veiculoTipo), $renavamTiposVeiculos) ? $renavamTiposVeiculos[intval($veiculoTipo)] : $veiculoTipo;
2843
-        $this->pTextBox($x, $yVeic, $w1+40, $h, $texto, $aFont, 'T', 'L', 0, '');
2843
+        $this->pTextBox($x, $yVeic, $w1 + 40, $h, $texto, $aFont, 'T', 'L', 0, '');
2844 2844
         $yVeic = $y + $h;
2845 2845
         $xVeic = $x + 65;
2846 2846
         $texto = 'Nº Motor: .........: ' . $veiculoMotor;
2847
-        $this->pTextBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
2847
+        $this->pTextBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
2848 2848
         $yVeic += $h;
2849 2849
         $texto = 'Renavam...........: ' . $veiculoRenavam;
2850
-        $this->pTextBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
2850
+        $this->pTextBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
2851 2851
         $yVeic += $h;
2852 2852
         $texto = 'HP.....................: ' . $veiculoHp;
2853
-        $this->pTextBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
2853
+        $this->pTextBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
2854 2854
         $yVeic += $h;
2855 2855
         $texto = 'Placa.................: ' . $veiculoPlaca;
2856
-        $this->pTextBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
2856
+        $this->pTextBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
2857 2857
         $yVeic += $h;
2858 2858
         $texto = 'Tipo Pintura......: ' . array_key_exists($veiculoTipoPintura, $renavamTipoPintura) ? $renavamTipoPintura[$veiculoTipoPintura] : $veiculoTipoPintura;
2859
-        $this->pTextBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
2859
+        $this->pTextBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
2860 2860
         $yVeic = $y + $h;
2861 2861
         $xVeic = $xVeic + 55;
2862 2862
         $texto = 'Marca / Modelo.....: ' . $veiculoMarcaModelo;
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 = 'Especie..................: ' . array_key_exists(intval($veiculoEspecie), $renavamEspecie) ? $renavamEspecie[intval($veiculoEspecie)] : intval($veiculoEspecie);
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 += $h;
2868 2868
         $texto = 'Combustivel..........: ' . array_key_exists(intval($veiculoCombustivel), $renavamCombustivel) ? $renavamCombustivel[intval($veiculoCombustivel)] : intval($veiculoCombustivel);
2869
-        $this->pTextBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
2869
+        $this->pTextBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
2870 2870
         $yVeic += $h;
2871 2871
         $texto = 'Serial.....................: ' . $veiculoSerial;
2872
-        $this->pTextBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
2872
+        $this->pTextBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
2873 2873
         $yVeic += $h;
2874
-        $texto = 'Ano Fab/Mod........: '. $veiculoFabricacao . '/' . $veiculoModelo;
2875
-        $this->pTextBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
2874
+        $texto = 'Ano Fab/Mod........: ' . $veiculoFabricacao . '/' . $veiculoModelo;
2875
+        $this->pTextBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
2876 2876
         $yVeic += $h;
2877
-        $texto = 'Distancia Entre Eixos(mm)..: '. $veiculoDistancia;
2878
-        $this->pTextBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
2877
+        $texto = 'Distancia Entre Eixos(mm)..: ' . $veiculoDistancia;
2878
+        $this->pTextBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
2879 2879
     }
2880 2880
 
2881 2881
     /**
@@ -2899,12 +2899,12 @@  discard block
 block discarded – undo
2899 2899
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
2900 2900
         //INSCRIÇÃO MUNICIPAL
2901 2901
         $y += 3;
2902
-        $w = round($this->wPrint*0.23, 0);
2902
+        $w = round($this->wPrint * 0.23, 0);
2903 2903
         $texto = 'INSCRIÇÃO MUNICIPAL';
2904 2904
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2905 2905
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
2906 2906
         //inscrição municipal
2907
-        $texto = ! empty($this->emit->getElementsByTagName("IM")->item(0)->nodeValue) ?
2907
+        $texto = !empty($this->emit->getElementsByTagName("IM")->item(0)->nodeValue) ?
2908 2908
                 $this->emit->getElementsByTagName("IM")->item(0)->nodeValue : '';
2909 2909
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
2910 2910
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 0, '');
@@ -2914,7 +2914,7 @@  discard block
 block discarded – undo
2914 2914
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2915 2915
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
2916 2916
         if (isset($this->ISSQNtot)) {
2917
-            $texto = ! empty($this->ISSQNtot->getElementsByTagName("vServ")->item(0)->nodeValue) ?
2917
+            $texto = !empty($this->ISSQNtot->getElementsByTagName("vServ")->item(0)->nodeValue) ?
2918 2918
                     $this->ISSQNtot->getElementsByTagName("vServ")->item(0)->nodeValue : '';
2919 2919
             $texto = number_format($texto, 2, ",", ".");
2920 2920
         } else {
@@ -2928,9 +2928,9 @@  discard block
 block discarded – undo
2928 2928
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2929 2929
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
2930 2930
         if (isset($this->ISSQNtot)) {
2931
-            $texto = ! empty($this->ISSQNtot->getElementsByTagName("vBC")->item(0)->nodeValue) ?
2931
+            $texto = !empty($this->ISSQNtot->getElementsByTagName("vBC")->item(0)->nodeValue) ?
2932 2932
                     $this->ISSQNtot->getElementsByTagName("vBC")->item(0)->nodeValue : '';
2933
-            $texto = ! empty($texto) ? number_format($texto, 2, ",", ".") : '';
2933
+            $texto = !empty($texto) ? number_format($texto, 2, ",", ".") : '';
2934 2934
         } else {
2935 2935
             $texto = '';
2936 2936
         }
@@ -2941,21 +2941,21 @@  discard block
 block discarded – undo
2941 2941
         if ($this->orientacao == 'P') {
2942 2942
             $w = $this->wPrint - (3 * $w);
2943 2943
         } else {
2944
-            $w = $this->wPrint - (3 * $w)-$this->wCanhoto;
2944
+            $w = $this->wPrint - (3 * $w) - $this->wCanhoto;
2945 2945
         }
2946 2946
         $texto = 'VALOR TOTAL DO ISSQN';
2947 2947
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2948 2948
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
2949 2949
         if (isset($this->ISSQNtot)) {
2950
-            $texto = ! empty($this->ISSQNtot->getElementsByTagName("vISS")->item(0)->nodeValue) ?
2950
+            $texto = !empty($this->ISSQNtot->getElementsByTagName("vISS")->item(0)->nodeValue) ?
2951 2951
                     $this->ISSQNtot->getElementsByTagName("vISS")->item(0)->nodeValue : '';
2952
-            $texto = ! empty($texto) ? number_format($texto, 2, ",", ".") : '';
2952
+            $texto = !empty($texto) ? number_format($texto, 2, ",", ".") : '';
2953 2953
         } else {
2954 2954
             $texto = '';
2955 2955
         }
2956 2956
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
2957 2957
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'R', 0, '');
2958
-        return ($y+$h+1);
2958
+        return ($y + $h + 1);
2959 2959
     }
2960 2960
 
2961 2961
     /**
@@ -2976,7 +2976,7 @@  discard block
 block discarded – undo
2976 2976
         if ($this->orientacao == 'P') {
2977 2977
               $w = $this->wPrint;
2978 2978
         } else {
2979
-              $w = $this->wPrint-$this->wCanhoto;
2979
+              $w = $this->wPrint - $this->wCanhoto;
2980 2980
         }
2981 2981
         $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
2982 2982
         $this->pTextBox($x, $y, $w, 8, $texto, $aFont, 'T', 'L', 0, '');
@@ -2992,15 +2992,15 @@  discard block
 block discarded – undo
2992 2992
         //$this->textoAdic com o texto completo do campo
2993 2993
         $y += 1;
2994 2994
         $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'');
2995
-        $this->pTextBox($x, $y+2, $w-2, $h-3, $this->textoAdic, $aFont, 'T', 'L', 0, '', false);
2995
+        $this->pTextBox($x, $y + 2, $w - 2, $h - 3, $this->textoAdic, $aFont, 'T', 'L', 0, '', false);
2996 2996
         //RESERVADO AO FISCO
2997 2997
         $texto = "RESERVADO AO FISCO";
2998 2998
         $x += $w;
2999 2999
         $y -= 1;
3000 3000
         if ($this->orientacao == 'P') {
3001
-            $w = $this->wPrint-$w;
3001
+            $w = $this->wPrint - $w;
3002 3002
         } else {
3003
-            $w = $this->wPrint-$w-$this->wCanhoto;
3003
+            $w = $this->wPrint - $w - $this->wCanhoto;
3004 3004
         }
3005 3005
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'B');
3006 3006
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -3039,8 +3039,8 @@  discard block
 block discarded – undo
3039 3039
         }
3040 3040
         $y += 2;
3041 3041
         $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'');
3042
-        $this->pTextBox($x, $y, $w-2, $h-3, $texto, $aFont, 'T', 'L', 0, '', false);
3043
-        return $y+$h;
3042
+        $this->pTextBox($x, $y, $w - 2, $h - 3, $texto, $aFont, 'T', 'L', 0, '', false);
3043
+        return $y + $h;
3044 3044
     }
3045 3045
 
3046 3046
     /**
@@ -3058,13 +3058,13 @@  discard block
 block discarded – undo
3058 3058
         if ($this->orientacao == 'P') {
3059 3059
               $w = $this->wPrint;
3060 3060
         } else {
3061
-              $w = $this->wPrint-$this->wCanhoto;
3061
+              $w = $this->wPrint - $this->wCanhoto;
3062 3062
               $x = $this->wCanhoto;
3063 3063
         }
3064 3064
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'I');
3065
-        $texto = "Impresso em ". date('d/m/Y') . " as " . date('H:i:s');
3065
+        $texto = "Impresso em " . date('d/m/Y') . " as " . date('H:i:s');
3066 3066
         $this->pTextBox($x, $y, $w, 0, $texto, $aFont, 'T', 'L', false);
3067
-        $texto = $this->creditos .  "  Powered by NFePHP";
3067
+        $texto = $this->creditos . "  Powered by NFePHP";
3068 3068
         $this->pTextBox($x, $y, $w, 0, $texto, $aFont, 'T', 'R', false, '');
3069 3069
     }
3070 3070
 
@@ -3117,9 +3117,9 @@  discard block
 block discarded – undo
3117 3117
         } else {
3118 3118
             //linha separadora do canhoto - 238
3119 3119
             //posicao altura
3120
-            $y = $this->wPrint-85;
3120
+            $y = $this->wPrint - 85;
3121 3121
             //altura
3122
-            $w = $this->wPrint-85-24;
3122
+            $w = $this->wPrint - 85 - 24;
3123 3123
         }
3124 3124
         $h = 10;
3125 3125
         //desenha caixa
@@ -3142,21 +3142,21 @@  discard block
 block discarded – undo
3142 3142
             $texto .= "AO LADO";
3143 3143
         }
3144 3144
         $texto .= ". EMISSÃO: ";
3145
-        $dEmi = ! empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
3145
+        $dEmi = !empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
3146 3146
                 $this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue : '';
3147 3147
         if ($dEmi == '') {
3148
-            $dEmi = ! empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
3148
+            $dEmi = !empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
3149 3149
                     $this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue : '';
3150 3150
             $aDemi = explode('T', $dEmi);
3151 3151
             $dEmi = $aDemi[0];
3152 3152
         }
3153
-        $texto .= $this->pYmd2dmy($dEmi) ." ";
3153
+        $texto .= $this->pYmd2dmy($dEmi) . " ";
3154 3154
         $texto .= "VALOR TOTAL: R$ ";
3155 3155
         $texto .= number_format($this->ICMSTot->getElementsByTagName("vNF")->item(0)->nodeValue, 2, ",", ".") . " ";
3156 3156
         $texto .= "DESTINATÁRIO: ";
3157 3157
         $texto .= $destinatario;
3158 3158
         if ($this->orientacao == 'P') {
3159
-            $this->pTextBox($x, $y, $w-1, $h, $texto, $aFont, 'C', 'L', 0, '', false);
3159
+            $this->pTextBox($x, $y, $w - 1, $h, $texto, $aFont, 'C', 'L', 0, '', false);
3160 3160
             $x1 = $x + $w;
3161 3161
             $w1 = $this->wPrint - $w;
3162 3162
             $texto = "NF-e";
@@ -3169,12 +3169,12 @@  discard block
 block discarded – undo
3169 3169
             //DATA DE RECEBIMENTO
3170 3170
             $texto = "DATA DE RECEBIMENTO";
3171 3171
             $y += $h;
3172
-            $w2 = round($this->wPrint*0.17, 0); //35;
3172
+            $w2 = round($this->wPrint * 0.17, 0); //35;
3173 3173
             $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
3174 3174
             $this->pTextBox($x, $y, $w2, 8, $texto, $aFont, 'T', 'L', 1, '');
3175 3175
             //IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR
3176 3176
             $x += $w2;
3177
-            $w3 = $w-$w2;
3177
+            $w3 = $w - $w2;
3178 3178
             $texto = "IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR";
3179 3179
             $this->pTextBox($x, $y, $w3, 8, $texto, $aFont, 'T', 'L', 1, '');
3180 3180
             $x = $oldX;
@@ -3184,7 +3184,7 @@  discard block
 block discarded – undo
3184 3184
             return $y;
3185 3185
         } else {
3186 3186
             $x--;
3187
-            $x = $this->pTextBox90($x, $y, $w-1, $h, $texto, $aFontSmall, 'C', 'L', 0, '', false);
3187
+            $x = $this->pTextBox90($x, $y, $w - 1, $h, $texto, $aFontSmall, 'C', 'L', 0, '', false);
3188 3188
             //NUMERO DA NOTA FISCAL LOGO NFE
3189 3189
             $w1 = 18;
3190 3190
             $x1 = $oldX;
@@ -3198,18 +3198,18 @@  discard block
 block discarded – undo
3198 3198
             $this->pTextBox($x1, $y, $w1, 18, $texto, $aFont, 'C', 'C', 1, '');
3199 3199
             //DATA DO RECEBIMENTO
3200 3200
             $texto = "DATA DO RECEBIMENTO";
3201
-            $y = $this->wPrint-85;
3201
+            $y = $this->wPrint - 85;
3202 3202
             $x = 12;
3203
-            $w2 = round($this->wPrint*0.17, 0); //35;
3203
+            $w2 = round($this->wPrint * 0.17, 0); //35;
3204 3204
             $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
3205 3205
             $this->pTextBox90($x, $y, $w2, 8, $texto, $aFont, 'T', 'L', 1, '');
3206 3206
             //IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR
3207 3207
             $y -= $w2;
3208
-            $w3 = $w-$w2;
3208
+            $w3 = $w - $w2;
3209 3209
             $texto = "IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR";
3210 3210
             $aFont = array('font'=>$this->fontePadrao, 'size'=>5.7, 'style'=>'');
3211 3211
             $x = $this->pTextBox90($x, $y, $w3, 8, $texto, $aFont, 'T', 'L', 1, '');
3212
-            $this->pdf->DashedVLine(23, $oldY, 0.1, $this->wPrint-20, 67);
3212
+            $this->pdf->DashedVLine(23, $oldY, 0.1, $this->wPrint - 20, 67);
3213 3213
             return $x;
3214 3214
         }
3215 3215
     }
@@ -3226,13 +3226,13 @@  discard block
 block discarded – undo
3226 3226
     {
3227 3227
         $saida = "";
3228 3228
         if (isset($this->compra)) {
3229
-            if (! empty($this->compra->getElementsByTagName("xNEmp")->item(0)->nodeValue)) {
3229
+            if (!empty($this->compra->getElementsByTagName("xNEmp")->item(0)->nodeValue)) {
3230 3230
                 $saida .= " Nota de Empenho: " . $this->compra->getElementsByTagName("xNEmp")->item(0)->nodeValue;
3231 3231
             }
3232
-            if (! empty($this->compra->getElementsByTagName("xPed")->item(0)->nodeValue)) {
3232
+            if (!empty($this->compra->getElementsByTagName("xPed")->item(0)->nodeValue)) {
3233 3233
                 $saida .= " Pedido: " . $this->compra->getElementsByTagName("xPed")->item(0)->nodeValue;
3234 3234
             }
3235
-            if (! empty($this->compra->getElementsByTagName("xCont")->item(0)->nodeValue)) {
3235
+            if (!empty($this->compra->getElementsByTagName("xCont")->item(0)->nodeValue)) {
3236 3236
                 $saida .= " Contrato: " . $this->compra->getElementsByTagName("xCont")->item(0)->nodeValue;
3237 3237
             }
3238 3238
         }
@@ -3258,21 +3258,21 @@  discard block
 block discarded – undo
3258 3258
         if ($vICMS > 0) {
3259 3259
             $vICMS = 1;
3260 3260
         }
3261
-        $icmss  = $this->ICMSTot->getElementsByTagName("vBC")->item(0)->nodeValue;
3261
+        $icmss = $this->ICMSTot->getElementsByTagName("vBC")->item(0)->nodeValue;
3262 3262
         if ($icmss > 0) {
3263 3263
             $icmss = 1;
3264 3264
         }
3265
-        $dEmi = ! empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
3265
+        $dEmi = !empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
3266 3266
                 $this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue : '';
3267 3267
         if ($dEmi == '') {
3268
-            $dEmi = ! empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
3268
+            $dEmi = !empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
3269 3269
                     $this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue : '';
3270 3270
             $aDemi = explode('T', $dEmi);
3271 3271
             $dEmi = $aDemi[0];
3272 3272
         }
3273 3273
         $dd  = $dEmi;
3274 3274
         $rpos = strrpos($dd, '-');
3275
-        $dd  = substr($dd, $rpos +1);
3275
+        $dd  = substr($dd, $rpos + 1);
3276 3276
         $chave = sprintf($forma, $cUF, $this->tpEmis, $CNPJ, $vNF, $vICMS, $icmss, $dd);
3277 3277
         $chave = $chave . $this->pModulo11($chave);
3278 3278
         return $chave;
@@ -3293,7 +3293,7 @@  discard block
 block discarded – undo
3293 3293
         $formaNfRef = "\r\nNF  Ref.: série:%d numero:%d emit:%s em %s modelo: %d";
3294 3294
         $formaECFRef = "\r\nECF Ref.: modelo: %s ECF:%d COO:%d";
3295 3295
         $formaNfpRef = "\r\nNFP Ref.: série:%d número:%d emit:%s em %s modelo: %d IE:%s";
3296
-        $saida='';
3296
+        $saida = '';
3297 3297
         $nfRefs = $this->ide->getElementsByTagName('NFref');
3298 3298
         if (0 === $nfRefs->length) {
3299 3299
             return $saida;
@@ -3309,7 +3309,7 @@  discard block
 block discarded – undo
3309 3309
             foreach ($refNFe as $chave_acessoRef) {
3310 3310
                 $chave_acesso = $chave_acessoRef->nodeValue;
3311 3311
                 $chave_acessoF = $this->pFormat($chave_acesso, $this->formatoChave);
3312
-                $data = substr($chave_acesso, 4, 2)."/20".substr($chave_acesso, 2, 2);
3312
+                $data = substr($chave_acesso, 4, 2) . "/20" . substr($chave_acesso, 2, 2);
3313 3313
                 $cnpj = $this->pFormat(substr($chave_acesso, 6, 14), "##.###.###/####-##");
3314 3314
                 $serie  = substr($chave_acesso, 22, 3);
3315 3315
                 $numero = substr($chave_acesso, 25, 9);
@@ -3330,7 +3330,7 @@  discard block
 block discarded – undo
3330 3330
             foreach ($refCTe as $chave_acessoRef) {
3331 3331
                 $chave_acesso = $chave_acessoRef->nodeValue;
3332 3332
                 $chave_acessoF = $this->pFormat($chave_acesso, $this->formatoChave);
3333
-                $data = substr($chave_acesso, 4, 2)."/20".substr($chave_acesso, 2, 2);
3333
+                $data = substr($chave_acesso, 4, 2) . "/20" . substr($chave_acesso, 2, 2);
3334 3334
                 $cnpj = $this->pFormat(substr($chave_acesso, 6, 14), "##.###.###/####-##");
3335 3335
                 $serie  = substr($chave_acesso, 22, 3);
3336 3336
                 $numero = substr($chave_acesso, 25, 9);
@@ -3346,10 +3346,9 @@  discard block
 block discarded – undo
3346 3346
             $refNFP = $nfRef->getElementsByTagName('refNFP');
3347 3347
             foreach ($refNFP as $umaRefNFe) {
3348 3348
                 $data = $umaRefNFe->getElementsByTagName('AAMM')->item(0)->nodeValue;
3349
-                $cnpj = ! empty($umaRefNFe->getElementsByTagName('CNPJ')->item(0)->nodeValue) ?
3350
-                    $umaRefNFe->getElementsByTagName('CNPJ')->item(0)->nodeValue :
3351
-                    '';
3352
-                $cpf = ! empty($umaRefNFe->getElementsByTagName('CPF')->item(0)->nodeValue) ?
3349
+                $cnpj = !empty($umaRefNFe->getElementsByTagName('CNPJ')->item(0)->nodeValue) ?
3350
+                    $umaRefNFe->getElementsByTagName('CNPJ')->item(0)->nodeValue : '';
3351
+                $cpf = !empty($umaRefNFe->getElementsByTagName('CPF')->item(0)->nodeValue) ?
3353 3352
                         $umaRefNFe->getElementsByTagName('CPF')->item(0)->nodeValue : '';
3354 3353
                 $mod = $umaRefNFe->getElementsByTagName('mod')->item(0)->nodeValue;
3355 3354
                 $serie = $umaRefNFe->getElementsByTagName('serie')->item(0)->nodeValue;
@@ -3375,6 +3374,6 @@  discard block
 block discarded – undo
3375 3374
         imagedestroy($image);
3376 3375
         $stringdata = ob_get_contents(); // read from buffer
3377 3376
         ob_end_clean();
3378
-        return 'data://text/plain;base64,'.base64_encode($stringdata);
3377
+        return 'data://text/plain;base64,' . base64_encode($stringdata);
3379 3378
     }
3380 3379
 }
Please login to merge, or discard this patch.