Passed
Push — master ( 573f47...7b057c )
by Roberto
02:08
created
src/NFe/Danfe.php 2 patches
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -613,7 +613,7 @@  discard block
 block discarded – undo
613 613
                 $this->textoAdic .= ". \r\n";
614 614
             }
615 615
             $this->textoAdic .= "LOCAL DE ENTREGA : ".$txRetCNPJ.'-'.$txRetxLgr.', '.$txRetnro.' '.$txRetxCpl.
616
-               ' - '.$txRetxBairro.' '.$txRetxMun.' - '.$txRetUF."\r\n";
616
+                ' - '.$txRetxBairro.' '.$txRetxMun.' - '.$txRetUF."\r\n";
617 617
         }
618 618
         //informações adicionais
619 619
         $this->textoAdic .= $this->pGeraInformacoesDasNotasReferenciadas();
@@ -807,8 +807,8 @@  discard block
 block discarded – undo
807 807
         //retorna o ID na NFe
808 808
         if ($classPdf!==false) {
809 809
             $aR = array(
810
-             'id'=>str_replace('NFe', '', $this->infNFe->getAttribute("Id")),
811
-             'classe_PDF'=>$this->pdf);
810
+                'id'=>str_replace('NFe', '', $this->infNFe->getAttribute("Id")),
811
+                'classe_PDF'=>$this->pdf);
812 812
             return $aR;
813 813
         } else {
814 814
             return str_replace('NFe', '', $this->infNFe->getAttribute("Id"));
@@ -1019,7 +1019,7 @@  discard block
 block discarded – undo
1019 1019
         $oldX = $x;
1020 1020
         $oldY = $y;
1021 1021
         if ($this->orientacao == 'P') {
1022
-              $maxW = $this->wPrint;
1022
+                $maxW = $this->wPrint;
1023 1023
         } else {
1024 1024
             if ($pag == 1) { // primeira página
1025 1025
                 $maxW = $this->wPrint - $this->wCanhoto;
@@ -1355,8 +1355,8 @@  discard block
 block discarded – undo
1355 1355
             $w = $maxW-(2*$x);
1356 1356
             $this->pdf->SetTextColor(200, 200, 200);
1357 1357
             $texto = "DANFE impresso em contingência -\n".
1358
-                     "DPEC regularmente recebido pela Receita\n".
1359
-                     "Federal do Brasil";
1358
+                        "DPEC regularmente recebido pela Receita\n".
1359
+                        "Federal do Brasil";
1360 1360
             $aFont = array('font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B');
1361 1361
             $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1362 1362
             $this->pdf->SetTextColor(0, 0, 0);
@@ -1643,13 +1643,13 @@  discard block
 block discarded – undo
1643 1643
         return ($y + $h);
1644 1644
     } //fim da função destinatarioDANFE
1645 1645
 
1646
-     /**
1647
-     * pGetTextoFatura
1648
-     * Gera a String do Texto da Fatura
1649
-      *
1650
-     * @name   getTextoFatura
1651
-     * @return uma String com o texto ou "";
1652
-     */
1646
+        /**
1647
+         * pGetTextoFatura
1648
+         * Gera a String do Texto da Fatura
1649
+         *
1650
+         * @name   getTextoFatura
1651
+         * @return uma String com o texto ou "";
1652
+         */
1653 1653
     protected function pGetTextoFatura()
1654 1654
     {
1655 1655
         if (isset($this->cobr)) {
@@ -1680,13 +1680,13 @@  discard block
 block discarded – undo
1680 1680
         return "";
1681 1681
     } //fim getTextoFatura
1682 1682
 
1683
-     /**
1684
-     * pSizeExtraTextoFatura
1685
-     * Calcula o espaço ocupado pelo texto da fatura. Este espaço só é utilizado quando não houver duplicata.
1686
-      *
1687
-     * @name   pSizeExtraTextoFatura
1688
-     * @return integer
1689
-     */
1683
+        /**
1684
+         * pSizeExtraTextoFatura
1685
+         * Calcula o espaço ocupado pelo texto da fatura. Este espaço só é utilizado quando não houver duplicata.
1686
+         *
1687
+         * @name   pSizeExtraTextoFatura
1688
+         * @return integer
1689
+         */
1690 1690
     protected function pSizeExtraTextoFatura()
1691 1691
     {
1692 1692
         $textoFatura = $this->pGetTextoFatura();
@@ -1851,7 +1851,7 @@  discard block
 block discarded – undo
1851 1851
                                     '11'=>'Vale Refeição','12'=>'Vale Presente','13'=>'Vale Combustível',
1852 1852
                                     '14'=>'Duplicata Mercantil','15'=>'Boleto','90'=>'Sem pagamento','99'=>'Outros');
1853 1853
             $bandeira = array('01'=>'Visa','02'=>'Mastercard','03'=>'American','04'=>'Sorocred','05'=>'Diners',
1854
-                              '06'=>'Elo','07'=>'Hipercard','08'=>'Aura','09'=>'Cabal','99'=>'Outros');
1854
+                                '06'=>'Elo','07'=>'Hipercard','08'=>'Aura','09'=>'Cabal','99'=>'Outros');
1855 1855
             foreach ($this->detPag as $k => $d) {
1856 1856
                 $fPag = !empty($this->detPag->item($k)->getElementsByTagName('tPag')->item(0)->nodeValue)
1857 1857
                     ? $this->detPag->item($k)->getElementsByTagName('tPag')->item(0)->nodeValue : '0';
@@ -2474,7 +2474,7 @@  discard block
 block discarded – undo
2474 2474
         $w4 = round($w*0.05, 0);
2475 2475
         $texto = 'O/CSOSN';//Regime do Simples CRT = 1 ou CRT = 2
2476 2476
         if ($this->pSimpleGetValue($this->emit, 'CRT') == '3') {
2477
-             $texto = 'O/CST';//Regime Normal
2477
+                $texto = 'O/CST';//Regime Normal
2478 2478
         }
2479 2479
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2480 2480
         $this->pTextBox($x, $y, $w4, $h, $texto, $aFont, 'C', 'C', 0, '', false);
@@ -2792,9 +2792,9 @@  discard block
 block discarded – undo
2792 2792
         //DADOS ADICIONAIS
2793 2793
         $texto = "DADOS ADICIONAIS";
2794 2794
         if ($this->orientacao == 'P') {
2795
-              $w = $this->wPrint;
2795
+                $w = $this->wPrint;
2796 2796
         } else {
2797
-              $w = $this->wPrint-$this->wCanhoto;
2797
+                $w = $this->wPrint-$this->wCanhoto;
2798 2798
         }
2799 2799
         $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
2800 2800
         $this->pTextBox($x, $y, $w, 8, $texto, $aFont, 'T', 'L', 0, '');
@@ -2874,10 +2874,10 @@  discard block
 block discarded – undo
2874 2874
     protected function pRodape($x, $y)
2875 2875
     {
2876 2876
         if ($this->orientacao == 'P') {
2877
-              $w = $this->wPrint;
2877
+                $w = $this->wPrint;
2878 2878
         } else {
2879
-              $w = $this->wPrint-$this->wCanhoto;
2880
-              $x = $this->wCanhoto;
2879
+                $w = $this->wPrint-$this->wCanhoto;
2880
+                $x = $this->wCanhoto;
2881 2881
         }
2882 2882
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'I');
2883 2883
         $texto = "Impresso em ". date('d/m/Y') . " as " . date('H:i:s');
Please login to merge, or discard this patch.
Spacing   +332 added lines, -339 removed lines patch added patch discarded remove patch
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
      * ativa ou desativa o modo de debug
298 298
      * @var integer
299 299
      */
300
-    protected $debugMode=2;
300
+    protected $debugMode = 2;
301 301
     /**
302 302
      * Creditos para integrador
303 303
      * @var string
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
             $this->fontePadrao = $fonteDANFE;
356 356
         }
357 357
         //se for passado o xml
358
-        if (! empty($this->xml)) {
358
+        if (!empty($this->xml)) {
359 359
             $this->dom = new Dom();
360 360
             $this->dom->loadXML($this->xml);
361 361
             $this->nfeProc    = $this->dom->getElementsByTagName("nfeProc")->item(0);
@@ -511,10 +511,10 @@  discard block
 block discarded – undo
511 511
         //total inicial de paginas
512 512
         $totPag = 1;
513 513
         //largura imprimivel em mm: largura da folha menos as margens esq/direita
514
-        $this->wPrint = $maxW-($margEsq*2);
514
+        $this->wPrint = $maxW - ($margEsq * 2);
515 515
         //comprimento (altura) imprimivel em mm: altura da folha menos as margens
516 516
         //superior e inferior
517
-        $this->hPrint = $maxH-$margSup-$margInf;
517
+        $this->hPrint = $maxH - $margSup - $margInf;
518 518
         // estabelece contagem de paginas
519 519
         $this->pdf->aliasNbPages();
520 520
         // fixa as margens
@@ -552,34 +552,28 @@  discard block
 block discarded – undo
552 552
         }
553 553
         //calcular a altura necessária para os dados adicionais
554 554
         if ($this->orientacao == 'P') {
555
-            $this->wAdic = round($this->wPrint*0.66, 0);
555
+            $this->wAdic = round($this->wPrint * 0.66, 0);
556 556
         } else {
557
-            $this->wAdic = round(($this->wPrint-$this->wCanhoto)*0.5, 0);
557
+            $this->wAdic = round(($this->wPrint - $this->wCanhoto) * 0.5, 0);
558 558
         }
559 559
         $fontProduto = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'');
560 560
         $this->textoAdic = '';
561 561
         if (isset($this->retirada)) {
562
-            $txRetCNPJ = ! empty($this->retirada->getElementsByTagName("CNPJ")->item(0)->nodeValue) ?
563
-                $this->retirada->getElementsByTagName("CNPJ")->item(0)->nodeValue :
564
-                '';
565
-            $txRetxLgr = ! empty($this->retirada->getElementsByTagName("xLgr")->item(0)->nodeValue) ?
566
-                $this->retirada->getElementsByTagName("xLgr")->item(0)->nodeValue :
567
-                '';
568
-            $txRetnro = ! empty($this->retirada->getElementsByTagName("nro")->item(0)->nodeValue) ?
569
-                $this->retirada->getElementsByTagName("nro")->item(0)->nodeValue :
570
-                's/n';
562
+            $txRetCNPJ = !empty($this->retirada->getElementsByTagName("CNPJ")->item(0)->nodeValue) ?
563
+                $this->retirada->getElementsByTagName("CNPJ")->item(0)->nodeValue : '';
564
+            $txRetxLgr = !empty($this->retirada->getElementsByTagName("xLgr")->item(0)->nodeValue) ?
565
+                $this->retirada->getElementsByTagName("xLgr")->item(0)->nodeValue : '';
566
+            $txRetnro = !empty($this->retirada->getElementsByTagName("nro")->item(0)->nodeValue) ?
567
+                $this->retirada->getElementsByTagName("nro")->item(0)->nodeValue : 's/n';
571 568
             $txRetxCpl = $this->pSimpleGetValue($this->retirada, "xCpl", " - ");
572
-            $txRetxBairro = ! empty($this->retirada->getElementsByTagName("xBairro")->item(0)->nodeValue) ?
573
-                $this->retirada->getElementsByTagName("xBairro")->item(0)->nodeValue :
574
-                '';
575
-            $txRetxMun = ! empty($this->retirada->getElementsByTagName("xMun")->item(0)->nodeValue) ?
576
-                $this->retirada->getElementsByTagName("xMun")->item(0)->nodeValue :
577
-                '';
578
-            $txRetUF = ! empty($this->retirada->getElementsByTagName("UF")->item(0)->nodeValue) ?
579
-                $this->retirada->getElementsByTagName("UF")->item(0)->nodeValue :
580
-                '';
581
-            $this->textoAdic .= "LOCAL DE RETIRADA : ".
582
-                    $txRetCNPJ.
569
+            $txRetxBairro = !empty($this->retirada->getElementsByTagName("xBairro")->item(0)->nodeValue) ?
570
+                $this->retirada->getElementsByTagName("xBairro")->item(0)->nodeValue : '';
571
+            $txRetxMun = !empty($this->retirada->getElementsByTagName("xMun")->item(0)->nodeValue) ?
572
+                $this->retirada->getElementsByTagName("xMun")->item(0)->nodeValue : '';
573
+            $txRetUF = !empty($this->retirada->getElementsByTagName("UF")->item(0)->nodeValue) ?
574
+                $this->retirada->getElementsByTagName("UF")->item(0)->nodeValue : '';
575
+            $this->textoAdic .= "LOCAL DE RETIRADA : " .
576
+                    $txRetCNPJ .
583 577
                     '-' .
584 578
                     $txRetxLgr .
585 579
                     ', ' .
@@ -596,24 +590,24 @@  discard block
 block discarded – undo
596 590
         }
597 591
         //dados do local de entrega da mercadoria
598 592
         if (isset($this->entrega)) {
599
-            $txRetCNPJ = ! empty($this->entrega->getElementsByTagName("CNPJ")->item(0)->nodeValue) ?
593
+            $txRetCNPJ = !empty($this->entrega->getElementsByTagName("CNPJ")->item(0)->nodeValue) ?
600 594
                 $this->entrega->getElementsByTagName("CNPJ")->item(0)->nodeValue : '';
601
-            $txRetxLgr = ! empty($this->entrega->getElementsByTagName("xLgr")->item(0)->nodeValue) ?
595
+            $txRetxLgr = !empty($this->entrega->getElementsByTagName("xLgr")->item(0)->nodeValue) ?
602 596
                 $this->entrega->getElementsByTagName("xLgr")->item(0)->nodeValue : '';
603
-            $txRetnro = ! empty($this->entrega->getElementsByTagName("nro")->item(0)->nodeValue) ?
597
+            $txRetnro = !empty($this->entrega->getElementsByTagName("nro")->item(0)->nodeValue) ?
604 598
                 $this->entrega->getElementsByTagName("nro")->item(0)->nodeValue : 's/n';
605 599
             $txRetxCpl = $this->pSimpleGetValue($this->entrega, "xCpl", " - ");
606
-            $txRetxBairro = ! empty($this->entrega->getElementsByTagName("xBairro")->item(0)->nodeValue) ?
600
+            $txRetxBairro = !empty($this->entrega->getElementsByTagName("xBairro")->item(0)->nodeValue) ?
607 601
                 $this->entrega->getElementsByTagName("xBairro")->item(0)->nodeValue : '';
608
-            $txRetxMun = ! empty($this->entrega->getElementsByTagName("xMun")->item(0)->nodeValue) ?
602
+            $txRetxMun = !empty($this->entrega->getElementsByTagName("xMun")->item(0)->nodeValue) ?
609 603
                 $this->entrega->getElementsByTagName("xMun")->item(0)->nodeValue : '';
610
-            $txRetUF = ! empty($this->entrega->getElementsByTagName("UF")->item(0)->nodeValue) ?
604
+            $txRetUF = !empty($this->entrega->getElementsByTagName("UF")->item(0)->nodeValue) ?
611 605
                 $this->entrega->getElementsByTagName("UF")->item(0)->nodeValue : '';
612 606
             if ($this->textoAdic != '') {
613 607
                 $this->textoAdic .= ". \r\n";
614 608
             }
615
-            $this->textoAdic .= "LOCAL DE ENTREGA : ".$txRetCNPJ.'-'.$txRetxLgr.', '.$txRetnro.' '.$txRetxCpl.
616
-               ' - '.$txRetxBairro.' '.$txRetxMun.' - '.$txRetUF."\r\n";
609
+            $this->textoAdic .= "LOCAL DE ENTREGA : " . $txRetCNPJ . '-' . $txRetxLgr . ', ' . $txRetnro . ' ' . $txRetxCpl .
610
+               ' - ' . $txRetxBairro . ' ' . $txRetxMun . ' - ' . $txRetUF . "\r\n";
617 611
         }
618 612
         //informações adicionais
619 613
         $this->textoAdic .= $this->pGeraInformacoesDasNotasReferenciadas();
@@ -622,7 +616,7 @@  discard block
 block discarded – undo
622 616
             if ($this->textoAdic != '') {
623 617
                 $this->textoAdic .= ". \r\n";
624 618
             }
625
-            $this->textoAdic .= ! empty($this->infAdic->getElementsByTagName("infCpl")->item(0)->nodeValue) ?
619
+            $this->textoAdic .= !empty($this->infAdic->getElementsByTagName("infCpl")->item(0)->nodeValue) ?
626 620
                 'Inf. Contribuinte: ' .
627 621
                 trim($this->pAnfavea($this->infAdic->getElementsByTagName("infCpl")->item(0)->nodeValue)) : '';
628 622
             $infPedido = $this->pGeraInformacoesDaTagCompra();
@@ -630,14 +624,14 @@  discard block
 block discarded – undo
630 624
                 $this->textoAdic .= $infPedido;
631 625
             }
632 626
             $this->textoAdic .= $this->pSimpleGetValue($this->dest, "email", ' Email do Destinatário: ');
633
-            $this->textoAdic .= ! empty($this->infAdic->getElementsByTagName("infAdFisco")->item(0)->nodeValue) ?
627
+            $this->textoAdic .= !empty($this->infAdic->getElementsByTagName("infAdFisco")->item(0)->nodeValue) ?
634 628
                 "\r\n Inf. fisco: " .
635 629
                 trim($this->infAdic->getElementsByTagName("infAdFisco")->item(0)->nodeValue) : '';
636 630
             $obsCont = $this->infAdic->getElementsByTagName("obsCont");
637 631
             if (isset($obsCont)) {
638 632
                 foreach ($obsCont as $obs) {
639
-                    $campo =  $obsCont->item($i)->getAttribute("xCampo");
640
-                    $xTexto = ! empty($obsCont->item($i)->getElementsByTagName("xTexto")->item(0)->nodeValue) ?
633
+                    $campo = $obsCont->item($i)->getAttribute("xCampo");
634
+                    $xTexto = !empty($obsCont->item($i)->getElementsByTagName("xTexto")->item(0)->nodeValue) ?
641 635
                         $obsCont->item($i)->getElementsByTagName("xTexto")->item(0)->nodeValue : '';
642 636
                     $this->textoAdic .= "\r\n" . $campo . ':  ' . trim($xTexto);
643 637
                     $i++;
@@ -665,38 +659,38 @@  discard block
 block discarded – undo
665 659
         foreach ($alinhas as $linha) {
666 660
             $numlinhasdados += $this->pGetNumLines($linha, $this->wAdic, $fontProduto);
667 661
         }
668
-        $hdadosadic = round(($numlinhasdados+3) * $this->pdf->fontSize, 0);
662
+        $hdadosadic = round(($numlinhasdados + 3) * $this->pdf->fontSize, 0);
669 663
         if ($hdadosadic < 10) {
670 664
             $hdadosadic = 10;
671 665
         }
672 666
         //altura disponivel para os campos da DANFE
673
-        $hcabecalho = 47;//para cabeçalho
674
-        $hdestinatario = 25;//para destinatario
675
-        $hduplicatas = 12;//para cada grupo de 7 duplicatas
676
-        $himposto = 18;// para imposto
677
-        $htransporte = 25;// para transporte
678
-        $hissqn = 11;// para issqn
679
-        $hfooter = 5;// para rodape
680
-        $hCabecItens = 4;//cabeçalho dos itens
667
+        $hcabecalho = 47; //para cabeçalho
668
+        $hdestinatario = 25; //para destinatario
669
+        $hduplicatas = 12; //para cada grupo de 7 duplicatas
670
+        $himposto = 18; // para imposto
671
+        $htransporte = 25; // para transporte
672
+        $hissqn = 11; // para issqn
673
+        $hfooter = 5; // para rodape
674
+        $hCabecItens = 4; //cabeçalho dos itens
681 675
         //alturas disponiveis para os dados
682 676
         $hDispo1 = $this->hPrint - 10 - ($hcabecalho +
683 677
             $hdestinatario + ($linhasDup * $hduplicatas) + $himposto + $htransporte +
684 678
             ($linhaISSQN * $hissqn) + $hdadosadic + $hfooter + $hCabecItens +
685 679
             $this->pSizeExtraTextoFatura());
686 680
         if ($this->orientacao == 'P') {
687
-            $hDispo1 -= 23 * $this->qCanhoto;//para canhoto
681
+            $hDispo1 -= 23 * $this->qCanhoto; //para canhoto
688 682
             $w = $this->wPrint;
689 683
         } else {
690
-            $hcanhoto = $this->hPrint;//para canhoto
684
+            $hcanhoto = $this->hPrint; //para canhoto
691 685
             $w = $this->wPrint - $this->wCanhoto;
692 686
         }
693
-        $hDispo2 = $this->hPrint - 10 - ($hcabecalho + $hfooter + $hCabecItens)-4;
687
+        $hDispo2 = $this->hPrint - 10 - ($hcabecalho + $hfooter + $hCabecItens) - 4;
694 688
         //Contagem da altura ocupada para impressão dos itens
695 689
         $fontProduto = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'');
696 690
         $i = 0;
697 691
         $numlinhas = 0;
698 692
         $hUsado = $hCabecItens;
699
-        $w2 = round($w*0.28, 0);
693
+        $w2 = round($w * 0.28, 0);
700 694
         $hDispo = $hDispo1;
701 695
         $totPag = 1;
702 696
         while ($i < $this->det->length) {
@@ -708,7 +702,7 @@  discard block
 block discarded – undo
708 702
                 $hDispo = $hDispo2;
709 703
                 $hUsado = $hCabecItens;
710 704
                 // Remove canhoto para páginas secundárias em modo paisagem ('L')
711
-                $w2 = round($this->wPrint*0.28, 0);
705
+                $w2 = round($this->wPrint * 0.28, 0);
712 706
                 $i--; // decrementa para readicionar o item que não coube nessa pagina na outra.
713 707
             }
714 708
             $i++;
@@ -732,7 +726,7 @@  discard block
 block discarded – undo
732 726
         //coloca o cabeçalho
733 727
         $y = $this->pCabecalhoDANFE($x, $y, $pag, $totPag);
734 728
         //coloca os dados do destinatário
735
-        $y = $this->pDestinatarioDANFE($x, $y+1);
729
+        $y = $this->pDestinatarioDANFE($x, $y + 1);
736 730
         
737 731
         
738 732
         //Verifica as formas de pagamento da nota fiscal
@@ -747,34 +741,34 @@  discard block
 block discarded – undo
747 741
         //Caso só tenha pagamento em boleto exibe as faturas ou invés das formas
748 742
         //caso tenha boleto e sem pagamento também exibir faturas pois deve ser devolução de
749 743
         //materiais do destinatário e não tem cobrança
750
-        if ((count($formaPag)=='1' && isset($formaPag[15]) || count($formaPag)=='2'
744
+        if ((count($formaPag) == '1' && isset($formaPag[15]) || count($formaPag) == '2'
751 745
              && isset($formaPag[15]) && isset($formaPag[90])) {
752
-            $y = $this->pFaturaDANFE($x, $y+1);
746
+            $y = $this->pFaturaDANFE($x, $y + 1);
753 747
         } else {
754 748
             //Se somente tiver a forma de pagamento sem pagamento ou outros não imprimir nada
755
-            if (count($formaPag)=='1' && (isset($formaPag[90]) || isset($formaPag[99]))) {
749
+            if (count($formaPag) == '1' && (isset($formaPag[90]) || isset($formaPag[99]))) {
756 750
                 $y = $y;
757 751
             } else {
758 752
                 //Se somente tiver a forma de pagamento sem pagamento ou outros não imprimir nada
759
-                if (count($formaPag)=='1' && (isset($formaPag[90]) || isset($formaPag[99]))) {
753
+                if (count($formaPag) == '1' && (isset($formaPag[90]) || isset($formaPag[99]))) {
760 754
                     $y = $y;
761 755
                 } else {
762 756
                     //caso tenha mais de uma forma de pagamento ou seja diferente de boleto exibe a
763 757
                     //forma de pagamento e o valor
764
-                    $y = $this->pagamentoDANFE($x, $y+1);
758
+                    $y = $this->pagamentoDANFE($x, $y + 1);
765 759
                 }
766 760
             }
767 761
         }
768 762
         //coloca os dados dos impostos e totais da NFe
769
-        $y = $this->pImpostoDANFE($x, $y+1);
763
+        $y = $this->pImpostoDANFE($x, $y + 1);
770 764
         //coloca os dados do trasnporte
771
-        $y = $this->pTransporteDANFE($x, $y+1);
765
+        $y = $this->pTransporteDANFE($x, $y + 1);
772 766
         //itens da DANFE
773 767
         $nInicial = 0;
774
-        $y = $this->pItensDANFE($x, $y+1, $nInicial, $hDispo1, $pag, $totPag, $hCabecItens);
768
+        $y = $this->pItensDANFE($x, $y + 1, $nInicial, $hDispo1, $pag, $totPag, $hCabecItens);
775 769
         //coloca os dados do ISSQN
776 770
         if ($linhaISSQN == 1) {
777
-            $y = $this->pIssqnDANFE($x, $y+4);
771
+            $y = $this->pIssqnDANFE($x, $y + 4);
778 772
         } else {
779 773
             $y += 4;
780 774
         }
@@ -782,7 +776,7 @@  discard block
 block discarded – undo
782 776
         $y = $this->pDadosAdicionaisDANFE($x, $y, $hdadosadic);
783 777
         //coloca o rodapé da página
784 778
         if ($this->orientacao == 'P') {
785
-            $this->pRodape($xInic, $y-1);
779
+            $this->pRodape($xInic, $y - 1);
786 780
         } else {
787 781
             $this->pRodape($xInic, $this->hPrint + 1);
788 782
         }
@@ -802,7 +796,7 @@  discard block
 block discarded – undo
802 796
             //coloca o cabeçalho na página adicional
803 797
             $y = $this->pCabecalhoDANFE($x, $y, $n, $totPag);
804 798
             //coloca os itens na página adicional
805
-            $y = $this->pItensDANFE($x, $y+1, $nInicial, $hDispo2, $n, $totPag, $hCabecItens);
799
+            $y = $this->pItensDANFE($x, $y + 1, $nInicial, $hDispo2, $n, $totPag, $hCabecItens);
806 800
             //coloca o rodapé da página
807 801
             if ($this->orientacao == 'P') {
808 802
                 $this->pRodape($xInic, $y + 4);
@@ -815,7 +809,7 @@  discard block
 block discarded – undo
815 809
             }
816 810
         }
817 811
         //retorna o ID na NFe
818
-        if ($classPdf!==false) {
812
+        if ($classPdf !== false) {
819 813
             $aR = array(
820 814
              'id'=>str_replace('NFe', '', $this->infNFe->getAttribute("Id")),
821 815
              'classe_PDF'=>$this->pdf);
@@ -848,7 +842,7 @@  discard block
 block discarded – undo
848 842
         if ($startPos === false) {
849 843
             return $cdata;
850 844
         }
851
-        for ($x=$len; $x>0; $x--) {
845
+        for ($x = $len; $x > 0; $x--) {
852 846
             if (substr($cdata, $x, 1) == '>') {
853 847
                 $endPos = $x;
854 848
                 break;
@@ -859,15 +853,15 @@  discard block
 block discarded – undo
859 853
         } else {
860 854
             $parte1 = '';
861 855
         }
862
-        $parte2 = substr($cdata, $startPos, $endPos-$startPos+1);
856
+        $parte2 = substr($cdata, $startPos, $endPos - $startPos + 1);
863 857
         if ($endPos < $len) {
864 858
             $parte3 = substr($cdata, $endPos + 1, $len - $endPos - 1);
865 859
         } else {
866 860
             $parte3 = '';
867 861
         }
868
-        $texto = trim($parte1).' '.trim($parte3);
862
+        $texto = trim($parte1) . ' ' . trim($parte3);
869 863
         if (strpos($parte2, '<CDATA>') === false) {
870
-            $cdata = '<CDATA>'.$parte2.'</CDATA>';
864
+            $cdata = '<CDATA>' . $parte2 . '</CDATA>';
871 865
         } else {
872 866
             $cdata = $parte2;
873 867
         }
@@ -941,15 +935,15 @@  discard block
 block discarded – undo
941 935
         //grupo CADATA infCpl
942 936
         $t = $dom->getElementsByTagName('transmissor')->item(0);
943 937
         $r = $dom->getElementsByTagName('receptor')->item(0);
944
-        $versao = ! empty($dom->getElementsByTagName('versao')->item(0)->nodeValue) ?
945
-            'Versao:'.$dom->getElementsByTagName('versao')->item(0)->nodeValue.' ' : '';
946
-        $especieNF = ! empty($dom->getElementsByTagName('especieNF')->item(0)->nodeValue) ?
947
-            'Especie:'.$dom->getElementsByTagName('especieNF')->item(0)->nodeValue.' ' : '';
948
-        $fabEntrega = ! empty($dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue) ?
949
-            'Entrega:'.$dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue.' ' : '';
950
-        $dca = ! empty($dom->getElementsByTagName('dca')->item(0)->nodeValue) ?
951
-            'dca:'.$dom->getElementsByTagName('dca')->item(0)->nodeValue.' ' : '';
952
-        $texto .= "".$versao.$especieNF.$fabEntrega.$dca;
938
+        $versao = !empty($dom->getElementsByTagName('versao')->item(0)->nodeValue) ?
939
+            'Versao:' . $dom->getElementsByTagName('versao')->item(0)->nodeValue . ' ' : '';
940
+        $especieNF = !empty($dom->getElementsByTagName('especieNF')->item(0)->nodeValue) ?
941
+            'Especie:' . $dom->getElementsByTagName('especieNF')->item(0)->nodeValue . ' ' : '';
942
+        $fabEntrega = !empty($dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue) ?
943
+            'Entrega:' . $dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue . ' ' : '';
944
+        $dca = !empty($dom->getElementsByTagName('dca')->item(0)->nodeValue) ?
945
+            'dca:' . $dom->getElementsByTagName('dca')->item(0)->nodeValue . ' ' : '';
946
+        $texto .= "" . $versao . $especieNF . $fabEntrega . $dca;
953 947
         if (isset($t)) {
954 948
             if ($t->hasAttributes()) {
955 949
                 $texto .= " Transmissor ";
@@ -1039,14 +1033,14 @@  discard block
 block discarded – undo
1039 1033
         }
1040 1034
         //####################################################################################
1041 1035
         //coluna esquerda identificação do emitente
1042
-        $w = round($maxW*0.41, 0);
1036
+        $w = round($maxW * 0.41, 0);
1043 1037
         if ($this->orientacao == 'P') {
1044 1038
             $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'I');
1045 1039
         } else {
1046 1040
             $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B');
1047 1041
         }
1048 1042
         $w1 = $w;
1049
-        $h=32;
1043
+        $h = 32;
1050 1044
         $oldY += $h;
1051 1045
         $this->pTextBox($x, $y, $w, $h);
1052 1046
         $texto = 'IDENTIFICAÇÃO DO EMITENTE';
@@ -1067,39 +1061,39 @@  discard block
 block discarded – undo
1067 1061
                 $type == 'jpg';
1068 1062
             }
1069 1063
             //largura da imagem em mm
1070
-            $logoWmm = ($logoInfo[0]/72)*25.4;
1064
+            $logoWmm = ($logoInfo[0] / 72) * 25.4;
1071 1065
             //altura da imagem em mm
1072
-            $logoHmm = ($logoInfo[1]/72)*25.4;
1073
-            if ($this->logoAlign=='L') {
1074
-                $nImgW = round($w/3, 0);
1075
-                $nImgH = round($logoHmm * ($nImgW/$logoWmm), 0);
1076
-                $xImg = $x+1;
1077
-                $yImg = round(($h-$nImgH)/2, 0)+$y;
1066
+            $logoHmm = ($logoInfo[1] / 72) * 25.4;
1067
+            if ($this->logoAlign == 'L') {
1068
+                $nImgW = round($w / 3, 0);
1069
+                $nImgH = round($logoHmm * ($nImgW / $logoWmm), 0);
1070
+                $xImg = $x + 1;
1071
+                $yImg = round(($h - $nImgH) / 2, 0) + $y;
1078 1072
                 //estabelecer posições do texto
1079
-                $x1 = round($xImg + $nImgW +1, 0);
1080
-                $y1 = round($h/3+$y, 0);
1081
-                $tw = round(2*$w/3, 0);
1082
-            } elseif ($this->logoAlign=='C') {
1083
-                $nImgH = round($h/3, 0);
1084
-                $nImgW = round($logoWmm * ($nImgH/$logoHmm), 0);
1085
-                $xImg = round(($w-$nImgW)/2+$x, 0);
1086
-                $yImg = $y+3;
1073
+                $x1 = round($xImg + $nImgW + 1, 0);
1074
+                $y1 = round($h / 3 + $y, 0);
1075
+                $tw = round(2 * $w / 3, 0);
1076
+            } elseif ($this->logoAlign == 'C') {
1077
+                $nImgH = round($h / 3, 0);
1078
+                $nImgW = round($logoWmm * ($nImgH / $logoHmm), 0);
1079
+                $xImg = round(($w - $nImgW) / 2 + $x, 0);
1080
+                $yImg = $y + 3;
1087 1081
                 $x1 = $x;
1088 1082
                 $y1 = round($yImg + $nImgH + 1, 0);
1089 1083
                 $tw = $w;
1090
-            } elseif ($this->logoAlign=='R') {
1091
-                $nImgW = round($w/3, 0);
1092
-                $nImgH = round($logoHmm * ($nImgW/$logoWmm), 0);
1093
-                $xImg = round($x+($w-(1+$nImgW)), 0);
1094
-                $yImg = round(($h-$nImgH)/2, 0)+$y;
1084
+            } elseif ($this->logoAlign == 'R') {
1085
+                $nImgW = round($w / 3, 0);
1086
+                $nImgH = round($logoHmm * ($nImgW / $logoWmm), 0);
1087
+                $xImg = round($x + ($w - (1 + $nImgW)), 0);
1088
+                $yImg = round(($h - $nImgH) / 2, 0) + $y;
1095 1089
                 $x1 = $x;
1096
-                $y1 = round($h/3+$y, 0);
1097
-                $tw = round(2*$w/3, 0);
1098
-            } elseif ($this->logoAlign=='F') {
1099
-                $nImgH = round($h-5, 0);
1100
-                $nImgW = round($logoWmm * ($nImgH/$logoHmm), 0);
1101
-                $xImg = round(($w-$nImgW)/2+$x, 0);
1102
-                $yImg = $y+3;
1090
+                $y1 = round($h / 3 + $y, 0);
1091
+                $tw = round(2 * $w / 3, 0);
1092
+            } elseif ($this->logoAlign == 'F') {
1093
+                $nImgH = round($h - 5, 0);
1094
+                $nImgW = round($logoWmm * ($nImgH / $logoHmm), 0);
1095
+                $xImg = round(($w - $nImgW) / 2 + $x, 0);
1096
+                $yImg = $y + 3;
1103 1097
                 $x1 = $x;
1104 1098
                 $y1 = round($yImg + $nImgH + 1, 0);
1105 1099
                 $tw = $w;
@@ -1108,7 +1102,7 @@  discard block
 block discarded – undo
1108 1102
             $this->pdf->Image($this->logomarca, $xImg, $yImg, $nImgW, $nImgH, $type);
1109 1103
         } else {
1110 1104
             $x1 = $x;
1111
-            $y1 = round($h/3+$y, 0);
1105
+            $y1 = round($h / 3 + $y, 0);
1112 1106
             $tw = $w;
1113 1107
         }
1114 1108
         // monta as informações apenas se diferente de full logo
@@ -1118,9 +1112,9 @@  discard block
 block discarded – undo
1118 1112
             $texto = $this->emit->getElementsByTagName("xNome")->item(0)->nodeValue;
1119 1113
             $this->pTextBox($x1, $y1, $tw, 8, $texto, $aFont, 'T', 'C', 0, '');
1120 1114
             //endereço
1121
-            $y1 = $y1+5;
1115
+            $y1 = $y1 + 5;
1122 1116
             $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'');
1123
-            $fone = ! empty($this->enderEmit->getElementsByTagName("fone")->item(0)->nodeValue)
1117
+            $fone = !empty($this->enderEmit->getElementsByTagName("fone")->item(0)->nodeValue)
1124 1118
                  ? $this->enderEmit->getElementsByTagName("fone")->item(0)->nodeValue
1125 1119
                  : '';
1126 1120
             $lgr = $this->pSimpleGetValue($this->enderEmit, "xLgr");
@@ -1140,37 +1134,37 @@  discard block
 block discarded – undo
1140 1134
         //####################################################################################
1141 1135
         //coluna central Danfe
1142 1136
         $x += $w;
1143
-        $w=round($maxW * 0.17, 0);//35;
1137
+        $w = round($maxW * 0.17, 0); //35;
1144 1138
         $w2 = $w;
1145 1139
         $h = 32;
1146 1140
         $this->pTextBox($x, $y, $w, $h);
1147 1141
 
1148
-        if (! $this->pNotaCancelada()) {
1142
+        if (!$this->pNotaCancelada()) {
1149 1143
             // A PRINCIPIO NÃO PRECISAVA, POIS A NFE ESTÁ AUTORIZADA,
1150 1144
             // SÓ SE RETIRA O DANFE PARA NOTAS NÃO AUTORIZADAS
1151 1145
             $texto = "DANFE";
1152 1146
             $aFont = array('font'=>$this->fontePadrao, 'size'=>14, 'style'=>'B');
1153
-            $this->pTextBox($x, $y+1, $w, $h, $texto, $aFont, 'T', 'C', 0, '');
1147
+            $this->pTextBox($x, $y + 1, $w, $h, $texto, $aFont, 'T', 'C', 0, '');
1154 1148
             $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'');
1155 1149
             $texto = 'Documento Auxiliar da Nota Fiscal Eletrônica';
1156 1150
             $h = 20;
1157
-            $this->pTextBox($x, $y+6, $w, $h, $texto, $aFont, 'T', 'C', 0, '', false);
1151
+            $this->pTextBox($x, $y + 6, $w, $h, $texto, $aFont, 'T', 'C', 0, '', false);
1158 1152
         }
1159 1153
 
1160 1154
         $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'');
1161 1155
         $texto = '0 - ENTRADA';
1162 1156
         $y1 = $y + 14;
1163 1157
         $h = 8;
1164
-        $this->pTextBox($x+2, $y1, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1158
+        $this->pTextBox($x + 2, $y1, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1165 1159
         $texto = '1 - SAÍDA';
1166 1160
         $y1 = $y + 17;
1167
-        $this->pTextBox($x+2, $y1, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1161
+        $this->pTextBox($x + 2, $y1, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1168 1162
         //tipo de nF
1169 1163
         $aFont = array('font'=>$this->fontePadrao, 'size'=>12, 'style'=>'B');
1170 1164
         $y1 = $y + 13;
1171 1165
         $h = 7;
1172 1166
         $texto = $this->ide->getElementsByTagName('tpNF')->item(0)->nodeValue;
1173
-        $this->pTextBox($x+27, $y1, 5, $h, $texto, $aFont, 'C', 'C', 1, '');
1167
+        $this->pTextBox($x + 27, $y1, 5, $h, $texto, $aFont, 'C', 'C', 1, '');
1174 1168
         //numero da NF
1175 1169
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
1176 1170
         $y1 = $y + 20;
@@ -1192,7 +1186,7 @@  discard block
 block discarded – undo
1192 1186
         //####################################################################################
1193 1187
         //coluna codigo de barras
1194 1188
         $x += $w;
1195
-        $w = ($maxW-$w1-$w2);//85;
1189
+        $w = ($maxW - $w1 - $w2); //85;
1196 1190
         $w3 = $w;
1197 1191
         $h = 32;
1198 1192
         $this->pTextBox($x, $y, $w, $h);
@@ -1201,22 +1195,22 @@  discard block
 block discarded – undo
1201 1195
         $bW = 75;
1202 1196
         $bH = 12;
1203 1197
         //codigo de barras
1204
-        $this->pdf->Code128($x+(($w-$bW)/2), $y+2, $chave_acesso, $bW, $bH);
1198
+        $this->pdf->Code128($x + (($w - $bW) / 2), $y + 2, $chave_acesso, $bW, $bH);
1205 1199
         //linhas divisorias
1206
-        $this->pdf->Line($x, $y+4+$bH, $x+$w, $y+4+$bH);
1207
-        $this->pdf->Line($x, $y+12+$bH, $x+$w, $y+12+$bH);
1200
+        $this->pdf->Line($x, $y + 4 + $bH, $x + $w, $y + 4 + $bH);
1201
+        $this->pdf->Line($x, $y + 12 + $bH, $x + $w, $y + 12 + $bH);
1208 1202
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1209
-        $y1 = $y+4+$bH;
1203
+        $y1 = $y + 4 + $bH;
1210 1204
         $h = 7;
1211 1205
         $texto = 'CHAVE DE ACESSO';
1212 1206
         $this->pTextBox($x, $y1, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1213 1207
         $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B');
1214
-        $y1 = $y+8+$bH;
1208
+        $y1 = $y + 8 + $bH;
1215 1209
         $texto = $this->pFormat($chave_acesso, $this->formatoChave);
1216
-        $this->pTextBox($x+2, $y1, $w-2, $h, $texto, $aFont, 'T', 'C', 0, '');
1217
-        $y1 = $y+12+$bH;
1210
+        $this->pTextBox($x + 2, $y1, $w - 2, $h, $texto, $aFont, 'T', 'C', 0, '');
1211
+        $y1 = $y + 12 + $bH;
1218 1212
         $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'');
1219
-        $chaveContingencia="";
1213
+        $chaveContingencia = "";
1220 1214
         if ($this->pNotaDPEC()) {
1221 1215
             $cabecalhoProtoAutorizacao = 'NÚMERO DE REGISTRO DPEC';
1222 1216
         } else {
@@ -1227,16 +1221,16 @@  discard block
 block discarded – undo
1227 1221
             $chaveContingencia = $this->pGeraChaveAdicionalDeContingencia();
1228 1222
             $this->pdf->SetFillColor(0, 0, 0);
1229 1223
             //codigo de barras
1230
-            $this->pdf->Code128($x+11, $y1+1, $chaveContingencia, $bW*.9, $bH/2);
1224
+            $this->pdf->Code128($x + 11, $y1 + 1, $chaveContingencia, $bW * .9, $bH / 2);
1231 1225
         } else {
1232 1226
             $texto = 'Consulta de autenticidade no portal nacional da NF-e';
1233
-            $this->pTextBox($x+2, $y1, $w-2, $h, $texto, $aFont, 'T', 'C', 0, '');
1234
-            $y1 = $y+16+$bH;
1227
+            $this->pTextBox($x + 2, $y1, $w - 2, $h, $texto, $aFont, 'T', 'C', 0, '');
1228
+            $y1 = $y + 16 + $bH;
1235 1229
             $texto = 'www.nfe.fazenda.gov.br/portal ou no site da Sefaz Autorizadora';
1236 1230
             $this->pTextBox(
1237
-                $x+2,
1231
+                $x + 2,
1238 1232
                 $y1,
1239
-                $w-2,
1233
+                $w - 2,
1240 1234
                 $h,
1241 1235
                 $texto,
1242 1236
                 $aFont,
@@ -1252,7 +1246,7 @@  discard block
 block discarded – undo
1252 1246
         //natureza da operação
1253 1247
         $texto = 'NATUREZA DA OPERAÇÃO';
1254 1248
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1255
-        $w = $w1+$w2;
1249
+        $w = $w1 + $w2;
1256 1250
         $y = $oldY;
1257 1251
         $oldY += $h;
1258 1252
         $x = $oldX;
@@ -1282,7 +1276,7 @@  discard block
 block discarded – undo
1282 1276
                 $cStat = '';
1283 1277
             } else {
1284 1278
                 if (isset($this->nfeProc)) {
1285
-                    $texto = ! empty($this->nfeProc->getElementsByTagName("nProt")->item(0)->nodeValue) ?
1279
+                    $texto = !empty($this->nfeProc->getElementsByTagName("nProt")->item(0)->nodeValue) ?
1286 1280
                             $this->nfeProc->getElementsByTagName("nProt")->item(0)->nodeValue : '';
1287 1281
                     $tsHora = $this->pConvertTime($this->nfeProc->getElementsByTagName("dhRecbto")->item(0)->nodeValue);
1288 1282
                     if ($texto != '') {
@@ -1313,25 +1307,25 @@  discard block
 block discarded – undo
1313 1307
         $texto = 'INSCRIÇÃO ESTADUAL DO SUBST. TRIBUT.';
1314 1308
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1315 1309
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1316
-        $texto = ! empty($this->emit->getElementsByTagName("IEST")->item(0)->nodeValue)
1310
+        $texto = !empty($this->emit->getElementsByTagName("IEST")->item(0)->nodeValue)
1317 1311
              ? $this->emit->getElementsByTagName("IEST")->item(0)->nodeValue
1318 1312
              : '';
1319 1313
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
1320 1314
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1321 1315
         //CNPJ
1322 1316
         $x += $w;
1323
-        $w = ($maxW-(2*$w));
1317
+        $w = ($maxW - (2 * $w));
1324 1318
         $texto = 'CNPJ / CPF';
1325 1319
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1326 1320
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1327 1321
         //Pegando valor do CPF/CNPJ
1328
-        if (! empty($this->emit->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1322
+        if (!empty($this->emit->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1329 1323
             $texto = $this->pFormat(
1330 1324
                 $this->emit->getElementsByTagName("CNPJ")->item(0)->nodeValue,
1331 1325
                 "###.###.###/####-##"
1332 1326
             );
1333 1327
         } else {
1334
-            $texto = ! empty($this->emit->getElementsByTagName("CPF")->item(0)->nodeValue) ?
1328
+            $texto = !empty($this->emit->getElementsByTagName("CPF")->item(0)->nodeValue) ?
1335 1329
                 $this->pFormat(
1336 1330
                     $this->emit->getElementsByTagName("CPF")->item(0)->nodeValue,
1337 1331
                     "###.###.###-##"
@@ -1347,9 +1341,9 @@  discard block
 block discarded – undo
1347 1341
         if ($this->pNotaCancelada()) {
1348 1342
             //101 Cancelamento
1349 1343
             $x = 10;
1350
-            $y = $this->hPrint-130;
1344
+            $y = $this->hPrint - 130;
1351 1345
             $h = 25;
1352
-            $w = $maxW-(2*$x);
1346
+            $w = $maxW - (2 * $x);
1353 1347
             $this->pdf->SetTextColor(90, 90, 90);
1354 1348
             $texto = "NFe CANCELADA";
1355 1349
             $aFont = array('font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B');
@@ -1360,12 +1354,12 @@  discard block
 block discarded – undo
1360 1354
         if ($this->pNotaDPEC() || $this->tpEmis == 4) {
1361 1355
             //DPEC
1362 1356
             $x = 10;
1363
-            $y = $this->hPrint-130;
1357
+            $y = $this->hPrint - 130;
1364 1358
             $h = 25;
1365
-            $w = $maxW-(2*$x);
1359
+            $w = $maxW - (2 * $x);
1366 1360
             $this->pdf->SetTextColor(200, 200, 200);
1367
-            $texto = "DANFE impresso em contingência -\n".
1368
-                     "DPEC regularmente recebido pela Receita\n".
1361
+            $texto = "DANFE impresso em contingência -\n" .
1362
+                     "DPEC regularmente recebido pela Receita\n" .
1369 1363
                      "Federal do Brasil";
1370 1364
             $aFont = array('font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B');
1371 1365
             $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
@@ -1374,22 +1368,22 @@  discard block
 block discarded – undo
1374 1368
         if ($this->pNotaDenegada()) {
1375 1369
             //110 301 302 Denegada
1376 1370
             $x = 10;
1377
-            $y = $this->hPrint-130;
1371
+            $y = $this->hPrint - 130;
1378 1372
             $h = 25;
1379
-            $w = $maxW-(2*$x);
1373
+            $w = $maxW - (2 * $x);
1380 1374
             $this->pdf->SetTextColor(90, 90, 90);
1381 1375
             $texto = "NFe USO DENEGADO";
1382 1376
             $aFont = array('font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B');
1383 1377
             $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1384 1378
             $y += $h;
1385 1379
             $h = 5;
1386
-            $w = $maxW-(2*$x);
1380
+            $w = $maxW - (2 * $x);
1387 1381
             if (isset($this->infProt)) {
1388 1382
                 $xMotivo = $this->infProt->getElementsByTagName("xMotivo")->item(0)->nodeValue;
1389 1383
             } else {
1390 1384
                 $xMotivo = '';
1391 1385
             }
1392
-            $texto = "SEM VALOR FISCAL\n".$xMotivo;
1386
+            $texto = "SEM VALOR FISCAL\n" . $xMotivo;
1393 1387
             $aFont = array('font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B');
1394 1388
             $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1395 1389
             $this->pdf->SetTextColor(0, 0, 0);
@@ -1398,29 +1392,29 @@  discard block
 block discarded – undo
1398 1392
         if ($tpAmb != 1) {
1399 1393
             $x = 10;
1400 1394
             if ($this->orientacao == 'P') {
1401
-                $y = round($this->hPrint*2/3, 0);
1395
+                $y = round($this->hPrint * 2 / 3, 0);
1402 1396
             } else {
1403
-                $y = round($this->hPrint/2, 0);
1397
+                $y = round($this->hPrint / 2, 0);
1404 1398
             }
1405 1399
             $h = 5;
1406
-            $w = $maxW-(2*$x);
1400
+            $w = $maxW - (2 * $x);
1407 1401
             $this->pdf->SetTextColor(90, 90, 90);
1408 1402
             $texto = "SEM VALOR FISCAL";
1409 1403
             $aFont = array('font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B');
1410 1404
             $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1411 1405
             $aFont = array('font'=>$this->fontePadrao, 'size'=>30, 'style'=>'B');
1412 1406
             $texto = "AMBIENTE DE HOMOLOGAÇÃO";
1413
-            $this->pTextBox($x, $y+14, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1407
+            $this->pTextBox($x, $y + 14, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1414 1408
             $this->pdf->SetTextColor(0, 0, 0);
1415 1409
         } else {
1416 1410
             $x = 10;
1417 1411
             if ($this->orientacao == 'P') {
1418
-                $y = round($this->hPrint*2/3, 0);
1412
+                $y = round($this->hPrint * 2 / 3, 0);
1419 1413
             } else {
1420
-                $y = round($this->hPrint/2, 0);
1414
+                $y = round($this->hPrint / 2, 0);
1421 1415
             }//fim orientacao
1422 1416
             $h = 5;
1423
-            $w = $maxW-(2*$x);
1417
+            $w = $maxW - (2 * $x);
1424 1418
             $this->pdf->SetTextColor(90, 90, 90);
1425 1419
             //indicar FALTA DO PROTOCOLO se NFe não for em contingência
1426 1420
             if (($this->tpEmis == 2 || $this->tpEmis == 5) && !$this->pNotaDPEC()) {
@@ -1430,7 +1424,7 @@  discard block
 block discarded – undo
1430 1424
                 $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1431 1425
                 $aFont = array('font'=>$this->fontePadrao, 'size'=>30, 'style'=>'B');
1432 1426
                 $texto = "devido à problemas técnicos";
1433
-                $this->pTextBox($x, $y+12, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1427
+                $this->pTextBox($x, $y + 12, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1434 1428
             } else {
1435 1429
                 if (!isset($this->nfeProc)) {
1436 1430
                     if (!$this->pNotaDPEC()) {
@@ -1441,9 +1435,9 @@  discard block
 block discarded – undo
1441 1435
                     $aFont = array('font'=>$this->fontePadrao, 'size'=>30, 'style'=>'B');
1442 1436
                     $texto = "FALTA PROTOCOLO DE APROVAÇÃO DA SEFAZ";
1443 1437
                     if (!$this->pNotaDPEC()) {
1444
-                        $this->pTextBox($x, $y+12, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1438
+                        $this->pTextBox($x, $y + 12, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1445 1439
                     } else {
1446
-                        $this->pTextBox($x, $y+25, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1440
+                        $this->pTextBox($x, $y + 25, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1447 1441
                     }
1448 1442
                 }//fim nefProc
1449 1443
             }//fim tpEmis
@@ -1478,7 +1472,7 @@  discard block
 block discarded – undo
1478 1472
         $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
1479 1473
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1480 1474
         //NOME / RAZÃO SOCIAL
1481
-        $w = round($maxW*0.61, 0);
1475
+        $w = round($maxW * 0.61, 0);
1482 1476
         $w1 = $w;
1483 1477
         $y += 3;
1484 1478
         $texto = 'NOME / RAZÃO SOCIAL';
@@ -1493,19 +1487,19 @@  discard block
 block discarded – undo
1493 1487
         }
1494 1488
         //CNPJ / CPF
1495 1489
         $x += $w;
1496
-        $w = round($maxW*0.23, 0);
1490
+        $w = round($maxW * 0.23, 0);
1497 1491
         $w2 = $w;
1498 1492
         $texto = 'CNPJ / CPF';
1499 1493
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1500 1494
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1501 1495
         //Pegando valor do CPF/CNPJ
1502
-        if (! empty($this->dest->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1496
+        if (!empty($this->dest->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1503 1497
             $texto = $this->pFormat(
1504 1498
                 $this->dest->getElementsByTagName("CNPJ")->item(0)->nodeValue,
1505 1499
                 "###.###.###/####-##"
1506 1500
             );
1507 1501
         } else {
1508
-            $texto = ! empty($this->dest->getElementsByTagName("CPF")->item(0)->nodeValue) ?
1502
+            $texto = !empty($this->dest->getElementsByTagName("CPF")->item(0)->nodeValue) ?
1509 1503
                     $this->pFormat(
1510 1504
                         $this->dest->getElementsByTagName("CPF")->item(0)->nodeValue,
1511 1505
                         "###.###.###-##"
@@ -1515,15 +1509,15 @@  discard block
 block discarded – undo
1515 1509
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1516 1510
         //DATA DA EMISSÃO
1517 1511
         $x += $w;
1518
-        $w = $maxW-($w1+$w2);
1512
+        $w = $maxW - ($w1 + $w2);
1519 1513
         $wx = $w;
1520 1514
         $texto = 'DATA DA EMISSÃO';
1521 1515
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1522 1516
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1523
-        $dEmi = ! empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
1517
+        $dEmi = !empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
1524 1518
                 $this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue : '';
1525 1519
         if ($dEmi == '') {
1526
-            $dEmi = ! empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
1520
+            $dEmi = !empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
1527 1521
                     $this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue : '';
1528 1522
             $aDemi = explode('T', $dEmi);
1529 1523
             $dEmi = $aDemi[0];
@@ -1536,7 +1530,7 @@  discard block
 block discarded – undo
1536 1530
             $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 1, '');
1537 1531
         }
1538 1532
         //ENDEREÇO
1539
-        $w = round($maxW*0.47, 0);
1533
+        $w = round($maxW * 0.47, 0);
1540 1534
         $w1 = $w;
1541 1535
         $y += $h;
1542 1536
         $x = $oldX;
@@ -1551,7 +1545,7 @@  discard block
 block discarded – undo
1551 1545
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 0, '', true);
1552 1546
         //BAIRRO / DISTRITO
1553 1547
         $x += $w;
1554
-        $w = round($maxW*0.21, 0);
1548
+        $w = round($maxW * 0.21, 0);
1555 1549
         $w2 = $w;
1556 1550
         $texto = 'BAIRRO / DISTRITO';
1557 1551
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
@@ -1561,12 +1555,12 @@  discard block
 block discarded – undo
1561 1555
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1562 1556
         //CEP
1563 1557
         $x += $w;
1564
-        $w = $maxW-$w1-$w2-$wx;
1558
+        $w = $maxW - $w1 - $w2 - $wx;
1565 1559
         $w2 = $w;
1566 1560
         $texto = 'CEP';
1567 1561
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1568 1562
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1569
-        $texto = ! empty($this->dest->getElementsByTagName("CEP")->item(0)->nodeValue) ?
1563
+        $texto = !empty($this->dest->getElementsByTagName("CEP")->item(0)->nodeValue) ?
1570 1564
                 $this->dest->getElementsByTagName("CEP")->item(0)->nodeValue : '';
1571 1565
         $texto = $this->pFormat($texto, "#####-###");
1572 1566
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
@@ -1577,10 +1571,10 @@  discard block
 block discarded – undo
1577 1571
         $texto = 'DATA DA SAÍDA/ENTRADA';
1578 1572
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1579 1573
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1580
-        $dSaiEnt = ! empty($this->ide->getElementsByTagName("dSaiEnt")->item(0)->nodeValue) ?
1574
+        $dSaiEnt = !empty($this->ide->getElementsByTagName("dSaiEnt")->item(0)->nodeValue) ?
1581 1575
                 $this->ide->getElementsByTagName("dSaiEnt")->item(0)->nodeValue : '';
1582 1576
         if ($dSaiEnt == '') {
1583
-            $dSaiEnt = ! empty($this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue) ?
1577
+            $dSaiEnt = !empty($this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue) ?
1584 1578
                     $this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue : '';
1585 1579
             $aDsaient = explode('T', $dSaiEnt);
1586 1580
             $dSaiEnt = $aDsaient[0];
@@ -1597,7 +1591,7 @@  discard block
 block discarded – undo
1597 1591
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1598 1592
         $texto = $this->dest->getElementsByTagName("xMun")->item(0)->nodeValue;
1599 1593
         if (strtoupper(trim($texto)) == "EXTERIOR" && $this->dest->getElementsByTagName("xPais")->length > 0) {
1600
-            $texto .= " - " .  $this->dest->getElementsByTagName("xPais")->item(0)->nodeValue;
1594
+            $texto .= " - " . $this->dest->getElementsByTagName("xPais")->item(0)->nodeValue;
1601 1595
         }
1602 1596
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
1603 1597
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 0, '');
@@ -1612,18 +1606,18 @@  discard block
 block discarded – undo
1612 1606
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1613 1607
         //FONE / FAX
1614 1608
         $x += $w;
1615
-        $w = round(($maxW -$w1-$wx-8)/2, 0);
1609
+        $w = round(($maxW - $w1 - $wx - 8) / 2, 0);
1616 1610
         $w3 = $w;
1617 1611
         $texto = 'FONE / FAX';
1618 1612
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1619 1613
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1620
-        $texto = ! empty($this->dest->getElementsByTagName("fone")->item(0)->nodeValue) ?
1614
+        $texto = !empty($this->dest->getElementsByTagName("fone")->item(0)->nodeValue) ?
1621 1615
                 $this->dest->getElementsByTagName("fone")->item(0)->nodeValue : '';
1622 1616
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
1623 1617
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1624 1618
         //INSCRIÇÃO ESTADUAL
1625 1619
         $x += $w;
1626
-        $w = $maxW -$w1-$wx-8-$w3;
1620
+        $w = $maxW - $w1 - $wx - 8 - $w3;
1627 1621
         $texto = 'INSCRIÇÃO ESTADUAL';
1628 1622
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1629 1623
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -1637,10 +1631,10 @@  discard block
 block discarded – undo
1637 1631
         $texto = 'HORA DA SAÍDA/ENTRADA';
1638 1632
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1639 1633
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1640
-        $hSaiEnt = ! empty($this->ide->getElementsByTagName("hSaiEnt")->item(0)->nodeValue) ?
1634
+        $hSaiEnt = !empty($this->ide->getElementsByTagName("hSaiEnt")->item(0)->nodeValue) ?
1641 1635
                 $this->ide->getElementsByTagName("hSaiEnt")->item(0)->nodeValue : '';
1642 1636
         if ($hSaiEnt == '') {
1643
-            $dhSaiEnt = ! empty($this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue) ?
1637
+            $dhSaiEnt = !empty($this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue) ?
1644 1638
                     $this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue : '';
1645 1639
             $tsDhSaiEnt = $this->pConvertTime($dhSaiEnt);
1646 1640
             if ($tsDhSaiEnt != '') {
@@ -1719,7 +1713,7 @@  discard block
 block discarded – undo
1719 1713
     protected function pFaturaDANFE($x, $y)
1720 1714
     {
1721 1715
         $linha = 1;
1722
-        $h = 8+3;
1716
+        $h = 8 + 3;
1723 1717
         $oldx = $x;
1724 1718
         $textoFatura = $this->pGetTextoFatura();
1725 1719
         //verificar se existem duplicatas
@@ -1740,27 +1734,27 @@  discard block
 block discarded – undo
1740 1734
             $dupcont = 0;
1741 1735
             $nFat = $this->dup->length;
1742 1736
             if ($textoFatura !== "" && $this->exibirTextoFatura) {
1743
-                $myH=6;
1737
+                $myH = 6;
1744 1738
                 $myW = $this->wPrint;
1745 1739
                 if ($this->orientacao == 'L') {
1746 1740
                     $myW -= $this->wCanhoto;
1747 1741
                 }
1748 1742
                 $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'');
1749 1743
                 $this->pTextBox($x, $y, $myW, $myH, $textoFatura, $aFont, 'C', 'L', 1, '');
1750
-                $y+=$myH+1;
1744
+                $y += $myH + 1;
1751 1745
             }
1752 1746
             if ($this->orientacao == 'P') {
1753
-                $w = round($this->wPrint/7.018, 0)-1;
1747
+                $w = round($this->wPrint / 7.018, 0) - 1;
1754 1748
             } else {
1755 1749
                 $w = 28;
1756 1750
             }
1757 1751
             $increm = 1;
1758 1752
             foreach ($this->dup as $k => $d) {
1759
-                $nDup = ! empty($this->dup->item($k)->getElementsByTagName('nDup')->item(0)->nodeValue) ?
1753
+                $nDup = !empty($this->dup->item($k)->getElementsByTagName('nDup')->item(0)->nodeValue) ?
1760 1754
                         $this->dup->item($k)->getElementsByTagName('nDup')->item(0)->nodeValue : '';
1761
-                $dDup = ! empty($this->dup->item($k)->getElementsByTagName('dVenc')->item(0)->nodeValue) ?
1755
+                $dDup = !empty($this->dup->item($k)->getElementsByTagName('dVenc')->item(0)->nodeValue) ?
1762 1756
                         $this->pYmd2dmy($this->dup->item($k)->getElementsByTagName('dVenc')->item(0)->nodeValue) : '';
1763
-                $vDup = ! empty($this->dup->item($k)->getElementsByTagName('vDup')->item(0)->nodeValue) ?
1757
+                $vDup = !empty($this->dup->item($k)->getElementsByTagName('vDup')->item(0)->nodeValue) ?
1764 1758
                         'R$ ' . number_format(
1765 1759
                             $this->dup->item($k)->getElementsByTagName('vDup')->item(0)->nodeValue,
1766 1760
                             2,
@@ -1769,14 +1763,14 @@  discard block
 block discarded – undo
1769 1763
                         ) : '';
1770 1764
                 $h = 8;
1771 1765
                 $texto = '';
1772
-                if ($nDup!='0' && $nDup!='') {
1766
+                if ($nDup != '0' && $nDup != '') {
1773 1767
                     $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1774 1768
                     $this->pTextBox($x, $y, $w, $h, 'Num.', $aFont, 'T', 'L', 1, '');
1775 1769
                     $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
1776 1770
                     $this->pTextBox($x, $y, $w, $h, $nDup, $aFont, 'T', 'R', 0, '');
1777 1771
                 } else {
1778 1772
                     $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1779
-                    $this->pTextBox($x, $y, $w, $h, ($dupcont+1)."", $aFont, 'T', 'L', 1, '');
1773
+                    $this->pTextBox($x, $y, $w, $h, ($dupcont + 1) . "", $aFont, 'T', 'L', 1, '');
1780 1774
                 }
1781 1775
                 $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1782 1776
                 $this->pTextBox($x, $y, $w, $h, 'Venc.', $aFont, 'C', 'L', 0, '');
@@ -1786,7 +1780,7 @@  discard block
 block discarded – undo
1786 1780
                 $this->pTextBox($x, $y, $w, $h, 'Valor', $aFont, 'B', 'L', 0, '');
1787 1781
                 $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
1788 1782
                 $this->pTextBox($x, $y, $w, $h, $vDup, $aFont, 'B', 'R', 0, '');
1789
-                $x += $w+$increm;
1783
+                $x += $w + $increm;
1790 1784
                 $dupcont += 1;
1791 1785
                 if ($this->orientacao == 'P') {
1792 1786
                     $maxDupCont = 6;
@@ -1808,10 +1802,10 @@  discard block
 block discarded – undo
1808 1802
                 $y -= 9;
1809 1803
                 $linha--;
1810 1804
             }
1811
-            return ($y+$h);
1805
+            return ($y + $h);
1812 1806
         } else {
1813 1807
             $linha = 0;
1814
-            return ($y-2);
1808
+            return ($y - 2);
1815 1809
         }
1816 1810
     } //fim da função faturaDANFE
1817 1811
 
@@ -1827,7 +1821,7 @@  discard block
 block discarded – undo
1827 1821
     protected function pagamentoDANFE($x, $y)
1828 1822
     {
1829 1823
         $linha = 1;
1830
-        $h = 8+3;
1824
+        $h = 8 + 3;
1831 1825
         $oldx = $x;
1832 1826
         //verificar se existem cobranças definidas
1833 1827
         if (isset($this->detPag) && $this->detPag->length > 0) {
@@ -1846,7 +1840,7 @@  discard block
 block discarded – undo
1846 1840
             $dups = "";
1847 1841
             $dupcont = 0;
1848 1842
             if ($this->orientacao == 'P') {
1849
-                $w = round($this->wPrint/7.018, 0)-1;
1843
+                $w = round($this->wPrint / 7.018, 0) - 1;
1850 1844
             } else {
1851 1845
                 $w = 28;
1852 1846
             }
@@ -1856,16 +1850,16 @@  discard block
 block discarded – undo
1856 1850
                 $maxDupCont = 8;
1857 1851
             }
1858 1852
             $increm = 1;
1859
-            $formaPagamento = array('01'=>'Dinheiro','02'=>'Cheque','03'=>'Cartão de Crédito',
1860
-                                    '04'=>'Cartão de Débito','05'=>'Crédito Loja','10'=>'Vale Alimentação',
1861
-                                    '11'=>'Vale Refeição','12'=>'Vale Presente','13'=>'Vale Combustível',
1862
-                                    '14'=>'Duplicata Mercantil','15'=>'Boleto','90'=>'Sem pagamento','99'=>'Outros');
1863
-            $bandeira = array('01'=>'Visa','02'=>'Mastercard','03'=>'American','04'=>'Sorocred','05'=>'Diners',
1864
-                              '06'=>'Elo','07'=>'Hipercard','08'=>'Aura','09'=>'Cabal','99'=>'Outros');
1853
+            $formaPagamento = array('01'=>'Dinheiro', '02'=>'Cheque', '03'=>'Cartão de Crédito',
1854
+                                    '04'=>'Cartão de Débito', '05'=>'Crédito Loja', '10'=>'Vale Alimentação',
1855
+                                    '11'=>'Vale Refeição', '12'=>'Vale Presente', '13'=>'Vale Combustível',
1856
+                                    '14'=>'Duplicata Mercantil', '15'=>'Boleto', '90'=>'Sem pagamento', '99'=>'Outros');
1857
+            $bandeira = array('01'=>'Visa', '02'=>'Mastercard', '03'=>'American', '04'=>'Sorocred', '05'=>'Diners',
1858
+                              '06'=>'Elo', '07'=>'Hipercard', '08'=>'Aura', '09'=>'Cabal', '99'=>'Outros');
1865 1859
             foreach ($this->detPag as $k => $d) {
1866 1860
                 $fPag = !empty($this->detPag->item($k)->getElementsByTagName('tPag')->item(0)->nodeValue)
1867 1861
                     ? $this->detPag->item($k)->getElementsByTagName('tPag')->item(0)->nodeValue : '0';
1868
-                $vPag = ! empty($this->detPag->item($k)->getElementsByTagName('vPag')->item(0)->nodeValue)
1862
+                $vPag = !empty($this->detPag->item($k)->getElementsByTagName('vPag')->item(0)->nodeValue)
1869 1863
                     ? 'R$ ' . number_format(
1870 1864
                         $this->detPag->item($k)->getElementsByTagName('vPag')->item(0)->nodeValue,
1871 1865
                         2,
@@ -1876,7 +1870,7 @@  discard block
 block discarded – undo
1876 1870
                 $texto = '';
1877 1871
                 if (isset($formaPagamento[$fPag])) {
1878 1872
                     /*Exibir Item sem pagamento ou outros?*/
1879
-                    if ($fPag=='90' || $fPag=='99') {
1873
+                    if ($fPag == '90' || $fPag == '99') {
1880 1874
                         continue;
1881 1875
                     }
1882 1876
                     $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
@@ -1885,16 +1879,16 @@  discard block
 block discarded – undo
1885 1879
                     $this->pTextBox($x, $y, $w, $h, $formaPagamento[$fPag], $aFont, 'T', 'R', 0, '');
1886 1880
                 } else {
1887 1881
                     $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'');
1888
-                    $this->pTextBox($x, $y, $w, $h, "Forma ".$fPag." não encontrado", $aFont, 'T', 'L', 1, '');
1882
+                    $this->pTextBox($x, $y, $w, $h, "Forma " . $fPag . " não encontrado", $aFont, 'T', 'L', 1, '');
1889 1883
                 }
1890 1884
                 $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1891 1885
                 $this->pTextBox($x, $y, $w, $h, 'Valor', $aFont, 'B', 'L', 0, '');
1892 1886
                 $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
1893 1887
                 $this->pTextBox($x, $y, $w, $h, $vPag, $aFont, 'B', 'R', 0, '');
1894
-                $x += $w+$increm;
1888
+                $x += $w + $increm;
1895 1889
                 $dupcont += 1;
1896 1890
 
1897
-                if ($dupcont>$maxDupCont) {
1891
+                if ($dupcont > $maxDupCont) {
1898 1892
                     $y += 9;
1899 1893
                     $x = $oldx;
1900 1894
                     $dupcont = 0;
@@ -1909,10 +1903,10 @@  discard block
 block discarded – undo
1909 1903
                 $y -= 9;
1910 1904
                 $linha--;
1911 1905
             }
1912
-            return ($y+$h);
1906
+            return ($y + $h);
1913 1907
         } else {
1914 1908
             $linha = 0;
1915
-            return ($y-2);
1909
+            return ($y - 2);
1916 1910
         }
1917 1911
     } //fim da função pagamentoDANFE
1918 1912
     
@@ -2024,7 +2018,7 @@  discard block
 block discarded – undo
2024 2018
         }
2025 2019
         $x = $this->pImpostoDanfeHelper($x, $y, $w, $h, "V. TOTAL DA NOTA", "vNF");
2026 2020
 
2027
-        return ($y+$h);
2021
+        return ($y + $h);
2028 2022
     } //fim impostoDANFE
2029 2023
 
2030 2024
     /**
@@ -2052,13 +2046,13 @@  discard block
 block discarded – undo
2052 2046
         $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
2053 2047
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
2054 2048
         //NOME / RAZÃO SOCIAL
2055
-        $w1 = $maxW*0.29;
2049
+        $w1 = $maxW * 0.29;
2056 2050
         $y += 3;
2057 2051
         $texto = 'NOME / RAZÃO SOCIAL';
2058 2052
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2059 2053
         $this->pTextBox($x, $y, $w1, $h, $texto, $aFont, 'T', 'L', 1, '');
2060 2054
         if (isset($this->transporta)) {
2061
-            $texto = ! empty($this->transporta->getElementsByTagName("xNome")->item(0)->nodeValue) ?
2055
+            $texto = !empty($this->transporta->getElementsByTagName("xNome")->item(0)->nodeValue) ?
2062 2056
                     $this->transporta->getElementsByTagName("xNome")->item(0)->nodeValue : '';
2063 2057
         } else {
2064 2058
             $texto = '';
@@ -2067,11 +2061,11 @@  discard block
 block discarded – undo
2067 2061
         $this->pTextBox($x, $y, $w1, $h, $texto, $aFont, 'B', 'L', 0, '');
2068 2062
         //FRETE POR CONTA
2069 2063
         $x += $w1;
2070
-        $w2 = $maxW*0.15;
2064
+        $w2 = $maxW * 0.15;
2071 2065
         $texto = 'FRETE';
2072 2066
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2073 2067
         $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
2074
-        $tipoFrete = ! empty($this->transp->getElementsByTagName("modFrete")->item(0)->nodeValue) ?
2068
+        $tipoFrete = !empty($this->transp->getElementsByTagName("modFrete")->item(0)->nodeValue) ?
2075 2069
                 $this->transp->getElementsByTagName("modFrete")->item(0)->nodeValue : '0';
2076 2070
         switch ($tipoFrete) {
2077 2071
             case 0:
@@ -2101,7 +2095,7 @@  discard block
 block discarded – undo
2101 2095
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2102 2096
         $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
2103 2097
         if (isset($this->veicTransp)) {
2104
-            $texto = ! empty($this->veicTransp->getElementsByTagName("RNTC")->item(0)->nodeValue) ?
2098
+            $texto = !empty($this->veicTransp->getElementsByTagName("RNTC")->item(0)->nodeValue) ?
2105 2099
                     $this->veicTransp->getElementsByTagName("RNTC")->item(0)->nodeValue : '';
2106 2100
         } else {
2107 2101
             $texto = '';
@@ -2114,10 +2108,10 @@  discard block
 block discarded – undo
2114 2108
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2115 2109
         $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
2116 2110
         if (isset($this->veicTransp)) {
2117
-            $texto = ! empty($this->veicTransp->getElementsByTagName("placa")->item(0)->nodeValue) ?
2111
+            $texto = !empty($this->veicTransp->getElementsByTagName("placa")->item(0)->nodeValue) ?
2118 2112
                     $this->veicTransp->getElementsByTagName("placa")->item(0)->nodeValue : '';
2119 2113
         } elseif (isset($this->reboque)) {
2120
-            $texto = ! empty($this->reboque->getElementsByTagName("placa")->item(0)->nodeValue) ?
2114
+            $texto = !empty($this->reboque->getElementsByTagName("placa")->item(0)->nodeValue) ?
2121 2115
                     $this->reboque->getElementsByTagName("placa")->item(0)->nodeValue : '';
2122 2116
         } else {
2123 2117
             $texto = '';
@@ -2126,15 +2120,15 @@  discard block
 block discarded – undo
2126 2120
         $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'B', 'C', 0, '');
2127 2121
         //UF
2128 2122
         $x += $w2;
2129
-        $w3 = round($maxW*0.04, 0);
2123
+        $w3 = round($maxW * 0.04, 0);
2130 2124
         $texto = 'UF';
2131 2125
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2132 2126
         $this->pTextBox($x, $y, $w3, $h, $texto, $aFont, 'T', 'L', 1, '');
2133 2127
         if (isset($this->veicTransp)) {
2134
-            $texto = ! empty($this->veicTransp->getElementsByTagName("UF")->item(0)->nodeValue) ?
2128
+            $texto = !empty($this->veicTransp->getElementsByTagName("UF")->item(0)->nodeValue) ?
2135 2129
                     $this->veicTransp->getElementsByTagName("UF")->item(0)->nodeValue : '';
2136 2130
         } elseif (isset($this->reboque)) {
2137
-            $texto = ! empty($this->reboque->getElementsByTagName("UF")->item(0)->nodeValue) ?
2131
+            $texto = !empty($this->reboque->getElementsByTagName("UF")->item(0)->nodeValue) ?
2138 2132
                     $this->reboque->getElementsByTagName("UF")->item(0)->nodeValue : '';
2139 2133
         } else {
2140 2134
             $texto = '';
@@ -2143,18 +2137,18 @@  discard block
 block discarded – undo
2143 2137
         $this->pTextBox($x, $y, $w3, $h, $texto, $aFont, 'B', 'C', 0, '');
2144 2138
         //CNPJ / CPF
2145 2139
         $x += $w3;
2146
-        $w = $maxW-($w1+3*$w2+$w3);
2140
+        $w = $maxW - ($w1 + 3 * $w2 + $w3);
2147 2141
         $texto = 'CNPJ / CPF';
2148 2142
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2149 2143
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
2150 2144
         if (isset($this->transporta)) {
2151
-            $texto = ! empty($this->transporta->getElementsByTagName("CNPJ")->item(0)->nodeValue) ?
2145
+            $texto = !empty($this->transporta->getElementsByTagName("CNPJ")->item(0)->nodeValue) ?
2152 2146
                     $this->pFormat(
2153 2147
                         $this->transporta->getElementsByTagName("CNPJ")->item(0)->nodeValue,
2154 2148
                         "##.###.###/####-##"
2155 2149
                     ) : '';
2156 2150
             if ($texto == '') {
2157
-                $texto = ! empty($this->transporta->getElementsByTagName("CPF")->item(0)->nodeValue) ?
2151
+                $texto = !empty($this->transporta->getElementsByTagName("CPF")->item(0)->nodeValue) ?
2158 2152
                         $this->pFormat(
2159 2153
                             $this->transporta->getElementsByTagName("CPF")->item(0)->nodeValue,
2160 2154
                             "###.###.###-##"
@@ -2170,12 +2164,12 @@  discard block
 block discarded – undo
2170 2164
         $y += $h;
2171 2165
         $x = $oldX;
2172 2166
         $h = 7;
2173
-        $w1 = $maxW*0.44;
2167
+        $w1 = $maxW * 0.44;
2174 2168
         $texto = 'ENDEREÇO';
2175 2169
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2176 2170
         $this->pTextBox($x, $y, $w1, $h, $texto, $aFont, 'T', 'L', 1, '');
2177 2171
         if (isset($this->transporta)) {
2178
-            $texto = ! empty($this->transporta->getElementsByTagName("xEnder")->item(0)->nodeValue) ?
2172
+            $texto = !empty($this->transporta->getElementsByTagName("xEnder")->item(0)->nodeValue) ?
2179 2173
                     $this->transporta->getElementsByTagName("xEnder")->item(0)->nodeValue : '';
2180 2174
         } else {
2181 2175
             $texto = '';
@@ -2184,12 +2178,12 @@  discard block
 block discarded – undo
2184 2178
         $this->pTextBox($x, $y, $w1, $h, $texto, $aFont, 'B', 'L', 0, '');
2185 2179
         //MUNICÍPIO
2186 2180
         $x += $w1;
2187
-        $w2 = round($maxW*0.30, 0);
2181
+        $w2 = round($maxW * 0.30, 0);
2188 2182
         $texto = 'MUNICÍPIO';
2189 2183
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2190 2184
         $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
2191 2185
         if (isset($this->transporta)) {
2192
-            $texto = ! empty($this->transporta->getElementsByTagName("xMun")->item(0)->nodeValue) ?
2186
+            $texto = !empty($this->transporta->getElementsByTagName("xMun")->item(0)->nodeValue) ?
2193 2187
                     $this->transporta->getElementsByTagName("xMun")->item(0)->nodeValue : '';
2194 2188
         } else {
2195 2189
             $texto = '';
@@ -2198,12 +2192,12 @@  discard block
 block discarded – undo
2198 2192
         $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'B', 'C', 0, '');
2199 2193
         //UF
2200 2194
         $x += $w2;
2201
-        $w3 = round($maxW*0.04, 0);
2195
+        $w3 = round($maxW * 0.04, 0);
2202 2196
         $texto = 'UF';
2203 2197
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2204 2198
         $this->pTextBox($x, $y, $w3, $h, $texto, $aFont, 'T', 'L', 1, '');
2205 2199
         if (isset($this->transporta)) {
2206
-            $texto = ! empty($this->transporta->getElementsByTagName("UF")->item(0)->nodeValue) ?
2200
+            $texto = !empty($this->transporta->getElementsByTagName("UF")->item(0)->nodeValue) ?
2207 2201
                     $this->transporta->getElementsByTagName("UF")->item(0)->nodeValue : '';
2208 2202
         } else {
2209 2203
             $texto = '';
@@ -2212,13 +2206,13 @@  discard block
 block discarded – undo
2212 2206
         $this->pTextBox($x, $y, $w3, $h, $texto, $aFont, 'B', 'C', 0, '');
2213 2207
         //INSCRIÇÃO ESTADUAL
2214 2208
         $x += $w3;
2215
-        $w = $maxW-($w1+$w2+$w3);
2209
+        $w = $maxW - ($w1 + $w2 + $w3);
2216 2210
         $texto = 'INSCRIÇÃO ESTADUAL';
2217 2211
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2218 2212
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
2219 2213
         $texto = '';
2220 2214
         if (isset($this->transporta)) {
2221
-            if (! empty($this->transporta->getElementsByTagName("IE")->item(0)->nodeValue)) {
2215
+            if (!empty($this->transporta->getElementsByTagName("IE")->item(0)->nodeValue)) {
2222 2216
                 $texto = $this->transporta->getElementsByTagName("IE")->item(0)->nodeValue;
2223 2217
             }
2224 2218
         }
@@ -2231,16 +2225,16 @@  discard block
 block discarded – undo
2231 2225
         $marca = '';
2232 2226
         $numero = '';
2233 2227
         $texto = '';
2234
-        $pesoBruto=0;
2235
-        $pesoLiquido=0;
2228
+        $pesoBruto = 0;
2229
+        $pesoLiquido = 0;
2236 2230
         foreach ($volumes as $volume) {
2237
-            $quantidade += ! empty($volume->getElementsByTagName("qVol")->item(0)->nodeValue) ?
2231
+            $quantidade += !empty($volume->getElementsByTagName("qVol")->item(0)->nodeValue) ?
2238 2232
                     $volume->getElementsByTagName("qVol")->item(0)->nodeValue : 0;
2239
-            $pesoBruto += ! empty($volume->getElementsByTagName("pesoB")->item(0)->nodeValue) ?
2233
+            $pesoBruto += !empty($volume->getElementsByTagName("pesoB")->item(0)->nodeValue) ?
2240 2234
                     $volume->getElementsByTagName("pesoB")->item(0)->nodeValue : 0;
2241
-            $pesoLiquido += ! empty($volume->getElementsByTagName("pesoL")->item(0)->nodeValue) ?
2235
+            $pesoLiquido += !empty($volume->getElementsByTagName("pesoL")->item(0)->nodeValue) ?
2242 2236
                     $volume->getElementsByTagName("pesoL")->item(0)->nodeValue : 0;
2243
-            $texto = ! empty($this->transp->getElementsByTagName("esp")->item(0)->nodeValue) ?
2237
+            $texto = !empty($this->transp->getElementsByTagName("esp")->item(0)->nodeValue) ?
2244 2238
                     $this->transp->getElementsByTagName("esp")->item(0)->nodeValue : '';
2245 2239
             if ($texto != $especie && $especie != '') {
2246 2240
                 //tem várias especies
@@ -2248,7 +2242,7 @@  discard block
 block discarded – undo
2248 2242
             } else {
2249 2243
                 $especie = $texto;
2250 2244
             }
2251
-            $texto = ! empty($this->transp->getElementsByTagName("marca")->item(0)->nodeValue) ?
2245
+            $texto = !empty($this->transp->getElementsByTagName("marca")->item(0)->nodeValue) ?
2252 2246
                     $this->transp->getElementsByTagName("marca")->item(0)->nodeValue : '';
2253 2247
             if ($texto != $marca && $marca != '') {
2254 2248
                 //tem várias especies
@@ -2256,7 +2250,7 @@  discard block
 block discarded – undo
2256 2250
             } else {
2257 2251
                 $marca = $texto;
2258 2252
             }
2259
-            $texto = ! empty($this->transp->getElementsByTagName("nVol")->item(0)->nodeValue) ?
2253
+            $texto = !empty($this->transp->getElementsByTagName("nVol")->item(0)->nodeValue) ?
2260 2254
                     $this->transp->getElementsByTagName("nVol")->item(0)->nodeValue : '';
2261 2255
             if ($texto != $numero && $numero != '') {
2262 2256
                 //tem várias especies
@@ -2271,7 +2265,7 @@  discard block
 block discarded – undo
2271 2265
         $y += $h;
2272 2266
         $x = $oldX;
2273 2267
         $h = 7;
2274
-        $w1 = round($maxW*0.10, 0);
2268
+        $w1 = round($maxW * 0.10, 0);
2275 2269
         $texto = 'QUANTIDADE';
2276 2270
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2277 2271
         $this->pTextBox($x, $y, $w1, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -2282,7 +2276,7 @@  discard block
 block discarded – undo
2282 2276
         }
2283 2277
         //ESPÉCIE
2284 2278
         $x += $w1;
2285
-        $w2 = round($maxW*0.17, 0);
2279
+        $w2 = round($maxW * 0.17, 0);
2286 2280
         $texto = 'ESPÉCIE';
2287 2281
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2288 2282
         $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -2294,7 +2288,7 @@  discard block
 block discarded – undo
2294 2288
         $texto = 'MARCA';
2295 2289
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2296 2290
         $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
2297
-        $texto = ! empty($this->transp->getElementsByTagName("marca")->item(0)->nodeValue) ?
2291
+        $texto = !empty($this->transp->getElementsByTagName("marca")->item(0)->nodeValue) ?
2298 2292
                 $this->transp->getElementsByTagName("marca")->item(0)->nodeValue : '';
2299 2293
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
2300 2294
         $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'B', 'C', 0, '');
@@ -2308,7 +2302,7 @@  discard block
 block discarded – undo
2308 2302
         $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'B', 'C', 0, '');
2309 2303
         //PESO BRUTO
2310 2304
         $x += $w2;
2311
-        $w3 = round($maxW*0.20, 0);
2305
+        $w3 = round($maxW * 0.20, 0);
2312 2306
         $texto = 'PESO BRUTO';
2313 2307
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2314 2308
         $this->pTextBox($x, $y, $w3, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -2321,7 +2315,7 @@  discard block
 block discarded – undo
2321 2315
         $this->pTextBox($x, $y, $w3, $h, $texto, $aFont, 'B', 'R', 0, '');
2322 2316
         //PESO LÍQUIDO
2323 2317
         $x += $w3;
2324
-        $w = $maxW -($w1+3*$w2+$w3);
2318
+        $w = $maxW - ($w1 + 3 * $w2 + $w3);
2325 2319
         $texto = 'PESO LÍQUIDO';
2326 2320
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2327 2321
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -2332,7 +2326,7 @@  discard block
 block discarded – undo
2332 2326
         }
2333 2327
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
2334 2328
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'R', 0, '');
2335
-        return ($y+$h);
2329
+        return ($y + $h);
2336 2330
     } //fim transporteDANFE
2337 2331
 
2338 2332
 
@@ -2344,7 +2338,7 @@  discard block
 block discarded – undo
2344 2338
             return "";
2345 2339
         }
2346 2340
         $valor_original = $valor_original->nodeValue;
2347
-        $valor = ! empty($valor_original) ? number_format($valor_original, 2, ",", ".") : '';
2341
+        $valor = !empty($valor_original) ? number_format($valor_original, 2, ",", ".") : '';
2348 2342
 
2349 2343
         if ($valor != "") {
2350 2344
             return sprintf($formato, $valor);
@@ -2388,13 +2382,13 @@  discard block
 block discarded – undo
2388 2382
             $impostos .= $this->pDescricaoProdutoHelper($ICMSUFDest, "vICMSUFDest", " vICMSUFDest=%s");
2389 2383
             $impostos .= $this->pDescricaoProdutoHelper($ICMSUFDest, "vICMSUFRemet", " vICMSUFRemet=%s");
2390 2384
         }
2391
-        $infAdProd = ! empty($itemProd->getElementsByTagName('infAdProd')->item(0)->nodeValue) ?
2385
+        $infAdProd = !empty($itemProd->getElementsByTagName('infAdProd')->item(0)->nodeValue) ?
2392 2386
                 substr($this->pAnfavea($itemProd->getElementsByTagName('infAdProd')->item(0)->nodeValue), 0, 500) : '';
2393
-        if (! empty($infAdProd)) {
2387
+        if (!empty($infAdProd)) {
2394 2388
             $infAdProd = trim($infAdProd);
2395 2389
             $infAdProd .= ' ';
2396 2390
         }
2397
-        $loteTxt ='';
2391
+        $loteTxt = '';
2398 2392
         $rastro = $prod->getElementsByTagName("med");
2399 2393
         if (!isset($rastro)) {
2400 2394
             $rastro = $prod->getElementsByTagName("rastro");
@@ -2410,14 +2404,14 @@  discard block
 block discarded – undo
2410 2404
                 $i++;
2411 2405
             }
2412 2406
             if ($loteTxt != '') {
2413
-                $loteTxt.= ' ';
2407
+                $loteTxt .= ' ';
2414 2408
             }
2415 2409
         }
2416 2410
         //NT2013.006 FCI
2417
-        $nFCI = (! empty($itemProd->getElementsByTagName('nFCI')->item(0)->nodeValue)) ?
2418
-                ' FCI:'.$itemProd->getElementsByTagName('nFCI')->item(0)->nodeValue : '';
2419
-        $tmp_ad=$infAdProd . ($this->descProdInfoComplemento ? $loteTxt . $impostos . $nFCI : '');
2420
-        $texto = $prod->getElementsByTagName("xProd")->item(0)->nodeValue . (strlen($tmp_ad)!=0?"\n    ".$tmp_ad:'');
2411
+        $nFCI = (!empty($itemProd->getElementsByTagName('nFCI')->item(0)->nodeValue)) ?
2412
+                ' FCI:' . $itemProd->getElementsByTagName('nFCI')->item(0)->nodeValue : '';
2413
+        $tmp_ad = $infAdProd . ($this->descProdInfoComplemento ? $loteTxt . $impostos . $nFCI : '');
2414
+        $texto = $prod->getElementsByTagName("xProd")->item(0)->nodeValue . (strlen($tmp_ad) != 0 ? "\n    " . $tmp_ad : '');
2421 2415
         if ($this->descProdQuebraLinha) {
2422 2416
             $texto = str_replace(";", "\n", $texto);
2423 2417
         }
@@ -2465,104 +2459,104 @@  discard block
 block discarded – undo
2465 2459
         // cabecalho LOOP COM OS DADOS DOS PRODUTOS
2466 2460
         //CÓDIGO PRODUTO
2467 2461
         $texto = "CÓDIGO PRODUTO";
2468
-        $w1 = round($w*0.09, 0);
2462
+        $w1 = round($w * 0.09, 0);
2469 2463
         $h = 4;
2470 2464
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2471 2465
         $this->pTextBox($x, $y, $w1, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2472
-        $this->pdf->Line($x+$w1, $y, $x+$w1, $y+$hmax);
2466
+        $this->pdf->Line($x + $w1, $y, $x + $w1, $y + $hmax);
2473 2467
         //DESCRIÇÃO DO PRODUTO / SERVIÇO
2474 2468
         $x += $w1;
2475
-        $w2 = round($w*0.28, 0);
2469
+        $w2 = round($w * 0.28, 0);
2476 2470
         $texto = 'DESCRIÇÃO DO PRODUTO / SERVIÇO';
2477 2471
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2478 2472
         $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2479
-        $this->pdf->Line($x+$w2, $y, $x+$w2, $y+$hmax);
2473
+        $this->pdf->Line($x + $w2, $y, $x + $w2, $y + $hmax);
2480 2474
         //NCM/SH
2481 2475
         $x += $w2;
2482
-        $w3 = round($w*0.06, 0);
2476
+        $w3 = round($w * 0.06, 0);
2483 2477
         $texto = 'NCM/SH';
2484 2478
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2485 2479
         $this->pTextBox($x, $y, $w3, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2486
-        $this->pdf->Line($x+$w3, $y, $x+$w3, $y+$hmax);
2480
+        $this->pdf->Line($x + $w3, $y, $x + $w3, $y + $hmax);
2487 2481
         //O/CST ou O/CSOSN
2488 2482
         $x += $w3;
2489
-        $w4 = round($w*0.05, 0);
2490
-        $texto = 'O/CSOSN';//Regime do Simples CRT = 1 ou CRT = 2
2483
+        $w4 = round($w * 0.05, 0);
2484
+        $texto = 'O/CSOSN'; //Regime do Simples CRT = 1 ou CRT = 2
2491 2485
         if ($this->pSimpleGetValue($this->emit, 'CRT') == '3') {
2492
-             $texto = 'O/CST';//Regime Normal
2486
+             $texto = 'O/CST'; //Regime Normal
2493 2487
         }
2494 2488
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2495 2489
         $this->pTextBox($x, $y, $w4, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2496
-        $this->pdf->Line($x+$w4, $y, $x+$w4, $y+$hmax);
2490
+        $this->pdf->Line($x + $w4, $y, $x + $w4, $y + $hmax);
2497 2491
         //CFOP
2498 2492
         $x += $w4;
2499
-        $w5 = round($w*0.04, 0);
2493
+        $w5 = round($w * 0.04, 0);
2500 2494
         $texto = 'CFOP';
2501 2495
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2502 2496
         $this->pTextBox($x, $y, $w5, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2503
-        $this->pdf->Line($x+$w5, $y, $x+$w5, $y+$hmax);
2497
+        $this->pdf->Line($x + $w5, $y, $x + $w5, $y + $hmax);
2504 2498
         //UN
2505 2499
         $x += $w5;
2506
-        $w6 = round($w*0.03, 0);
2500
+        $w6 = round($w * 0.03, 0);
2507 2501
         $texto = 'UN';
2508 2502
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2509 2503
         $this->pTextBox($x, $y, $w6, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2510
-        $this->pdf->Line($x+$w6, $y, $x+$w6, $y+$hmax);
2504
+        $this->pdf->Line($x + $w6, $y, $x + $w6, $y + $hmax);
2511 2505
         //QUANT
2512 2506
         $x += $w6;
2513
-        $w7 = round($w*0.07, 0);
2507
+        $w7 = round($w * 0.07, 0);
2514 2508
         $texto = 'QUANT';
2515 2509
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2516 2510
         $this->pTextBox($x, $y, $w7, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2517
-        $this->pdf->Line($x+$w7, $y, $x+$w7, $y+$hmax);
2511
+        $this->pdf->Line($x + $w7, $y, $x + $w7, $y + $hmax);
2518 2512
         //VALOR UNIT
2519 2513
         $x += $w7;
2520
-        $w8 = round($w*0.06, 0);
2514
+        $w8 = round($w * 0.06, 0);
2521 2515
         $texto = 'VALOR UNIT';
2522 2516
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2523 2517
         $this->pTextBox($x, $y, $w8, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2524
-        $this->pdf->Line($x+$w8, $y, $x+$w8, $y+$hmax);
2518
+        $this->pdf->Line($x + $w8, $y, $x + $w8, $y + $hmax);
2525 2519
         //VALOR TOTAL
2526 2520
         $x += $w8;
2527
-        $w9 = round($w*0.06, 0);
2521
+        $w9 = round($w * 0.06, 0);
2528 2522
         $texto = 'VALOR TOTAL';
2529 2523
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2530 2524
         $this->pTextBox($x, $y, $w9, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2531
-        $this->pdf->Line($x+$w9, $y, $x+$w9, $y+$hmax);
2525
+        $this->pdf->Line($x + $w9, $y, $x + $w9, $y + $hmax);
2532 2526
         //B.CÁLC ICMS
2533 2527
         $x += $w9;
2534
-        $w10 = round($w*0.06, 0);
2528
+        $w10 = round($w * 0.06, 0);
2535 2529
         $texto = 'B.CÁLC ICMS';
2536 2530
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2537 2531
         $this->pTextBox($x, $y, $w10, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2538
-        $this->pdf->Line($x+$w10, $y, $x+$w10, $y+$hmax);
2532
+        $this->pdf->Line($x + $w10, $y, $x + $w10, $y + $hmax);
2539 2533
         //VALOR ICMS
2540 2534
         $x += $w10;
2541
-        $w11 = round($w*0.06, 0);
2535
+        $w11 = round($w * 0.06, 0);
2542 2536
         $texto = 'VALOR ICMS';
2543 2537
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2544 2538
         $this->pTextBox($x, $y, $w11, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2545
-        $this->pdf->Line($x+$w11, $y, $x+$w11, $y+$hmax);
2539
+        $this->pdf->Line($x + $w11, $y, $x + $w11, $y + $hmax);
2546 2540
         //VALOR IPI
2547 2541
         $x += $w11;
2548
-        $w12 = round($w*0.05, 0);
2542
+        $w12 = round($w * 0.05, 0);
2549 2543
         $texto = 'VALOR IPI';
2550 2544
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2551 2545
         $this->pTextBox($x, $y, $w12, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2552
-        $this->pdf->Line($x+$w12, $y, $x+$w12, $y+$hmax);
2546
+        $this->pdf->Line($x + $w12, $y, $x + $w12, $y + $hmax);
2553 2547
         //ALÍQ. ICMS
2554 2548
         $x += $w12;
2555
-        $w13 = round($w*0.035, 0);
2549
+        $w13 = round($w * 0.035, 0);
2556 2550
         $texto = 'ALÍQ. ICMS';
2557 2551
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2558 2552
         $this->pTextBox($x, $y, $w13, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2559
-        $this->pdf->Line($x+$w13, $y, $x+$w13, $y+$hmax);
2553
+        $this->pdf->Line($x + $w13, $y, $x + $w13, $y + $hmax);
2560 2554
         //ALÍQ. IPI
2561 2555
         $x += $w13;
2562
-        $w14 = $w-($w1+$w2+$w3+$w4+$w5+$w6+$w7+$w8+$w9+$w10+$w11+$w12+$w13);
2556
+        $w14 = $w - ($w1 + $w2 + $w3 + $w4 + $w5 + $w6 + $w7 + $w8 + $w9 + $w10 + $w11 + $w12 + $w13);
2563 2557
         $texto = 'ALÍQ. IPI';
2564 2558
         $this->pTextBox($x, $y, $w14, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2565
-        $this->pdf->Line($oldX, $y+$h+1, $oldX + $w, $y+$h+1);
2559
+        $this->pdf->Line($oldX, $y + $h + 1, $oldX + $w, $y + $h + 1);
2566 2560
         $y += 5;
2567 2561
         //##################################################################################
2568 2562
         // LOOP COM OS DADOS DOS PRODUTOS
@@ -2579,7 +2573,7 @@  discard block
 block discarded – undo
2579 2573
                 $IPI  = $imposto->getElementsByTagName("IPI")->item(0);
2580 2574
                 $textoProduto = $this->pDescricaoProduto($thisItem);
2581 2575
                 $linhaDescr = $this->pGetNumLines($textoProduto, $w2, $aFont);
2582
-                $h = round(($linhaDescr * $this->pdf->fontSize)+ ($linhaDescr * 0.5), 2);
2576
+                $h = round(($linhaDescr * $this->pdf->fontSize) + ($linhaDescr * 0.5), 2);
2583 2577
                 $hUsado += $h;
2584 2578
                 if ($pag != $totpag) {
2585 2579
                     if ($hUsado >= $hmax && $i < $totItens) {
@@ -2589,11 +2583,11 @@  discard block
 block discarded – undo
2589 2583
                         break;
2590 2584
                     }
2591 2585
                 }
2592
-                $y_linha=$y+$h;
2586
+                $y_linha = $y + $h;
2593 2587
                 // linha entre itens
2594 2588
                 $this->pdf->DashedHLine($oldX, $y_linha, $w, 0.1, 120);
2595 2589
                 //corrige o x
2596
-                $x=$oldX;
2590
+                $x = $oldX;
2597 2591
                 //codigo do produto
2598 2592
                 $texto = $prod->getElementsByTagName("cProd")->item(0)->nodeValue;
2599 2593
                 $this->pTextBox($x, $y, $w1, $h, $texto, $aFont, 'T', 'C', 0, '');
@@ -2606,16 +2600,16 @@  discard block
 block discarded – undo
2606 2600
                 }
2607 2601
                 $x += $w2;
2608 2602
                 //NCM
2609
-                $texto = ! empty($prod->getElementsByTagName("NCM")->item(0)->nodeValue) ?
2603
+                $texto = !empty($prod->getElementsByTagName("NCM")->item(0)->nodeValue) ?
2610 2604
                         $prod->getElementsByTagName("NCM")->item(0)->nodeValue : '';
2611 2605
                 $this->pTextBox($x, $y, $w3, $h, $texto, $aFont, 'T', 'C', 0, '');
2612 2606
                 $x += $w3;
2613 2607
                 //CST
2614 2608
                 if (isset($ICMS)) {
2615
-                    $origem =  $this->pSimpleGetValue($ICMS, "orig");
2616
-                    $cst =  $this->pSimpleGetValue($ICMS, "CST");
2617
-                    $csosn =  $this->pSimpleGetValue($ICMS, "CSOSN");
2618
-                    $texto = $origem.$cst.$csosn;
2609
+                    $origem = $this->pSimpleGetValue($ICMS, "orig");
2610
+                    $cst = $this->pSimpleGetValue($ICMS, "CST");
2611
+                    $csosn = $this->pSimpleGetValue($ICMS, "CSOSN");
2612
+                    $texto = $origem . $cst . $csosn;
2619 2613
                     $this->pTextBox($x, $y, $w4, $h, $texto, $aFont, 'T', 'C', 0, '');
2620 2614
                 }
2621 2615
                 //CFOP
@@ -2649,7 +2643,7 @@  discard block
 block discarded – undo
2649 2643
                 //Valor da Base de calculo
2650 2644
                 $x += $w9;
2651 2645
                 if (isset($ICMS)) {
2652
-                    $texto = ! empty($ICMS->getElementsByTagName("vBC")->item(0)->nodeValue) ?
2646
+                    $texto = !empty($ICMS->getElementsByTagName("vBC")->item(0)->nodeValue) ?
2653 2647
                             number_format(
2654 2648
                                 $ICMS->getElementsByTagName("vBC")->item(0)->nodeValue,
2655 2649
                                 2,
@@ -2661,7 +2655,7 @@  discard block
 block discarded – undo
2661 2655
                 //Valor do ICMS
2662 2656
                 $x += $w10;
2663 2657
                 if (isset($ICMS)) {
2664
-                    $texto = ! empty($ICMS->getElementsByTagName("vICMS")->item(0)->nodeValue) ?
2658
+                    $texto = !empty($ICMS->getElementsByTagName("vICMS")->item(0)->nodeValue) ?
2665 2659
                             number_format(
2666 2660
                                 $ICMS->getElementsByTagName("vICMS")->item(0)->nodeValue,
2667 2661
                                 2,
@@ -2673,8 +2667,8 @@  discard block
 block discarded – undo
2673 2667
                 //Valor do IPI
2674 2668
                 $x += $w11;
2675 2669
                 if (isset($IPI)) {
2676
-                    $texto = ! empty($IPI->getElementsByTagName("vIPI")->item(0)->nodeValue) ?
2677
-                            number_format($IPI->getElementsByTagName("vIPI")->item(0)->nodeValue, 2, ",", ".") :'';
2670
+                    $texto = !empty($IPI->getElementsByTagName("vIPI")->item(0)->nodeValue) ?
2671
+                            number_format($IPI->getElementsByTagName("vIPI")->item(0)->nodeValue, 2, ",", ".") : '';
2678 2672
                 } else {
2679 2673
                     $texto = '';
2680 2674
                 }
@@ -2682,7 +2676,7 @@  discard block
 block discarded – undo
2682 2676
                 // %ICMS
2683 2677
                 $x += $w12;
2684 2678
                 if (isset($ICMS)) {
2685
-                    $texto = ! empty($ICMS->getElementsByTagName("pICMS")->item(0)->nodeValue) ?
2679
+                    $texto = !empty($ICMS->getElementsByTagName("pICMS")->item(0)->nodeValue) ?
2686 2680
                             number_format(
2687 2681
                                 $ICMS->getElementsByTagName("pICMS")->item(0)->nodeValue,
2688 2682
                                 2,
@@ -2694,7 +2688,7 @@  discard block
 block discarded – undo
2694 2688
                 //%IPI
2695 2689
                 $x += $w13;
2696 2690
                 if (isset($IPI)) {
2697
-                    $texto = ! empty($IPI->getElementsByTagName("pIPI")->item(0)->nodeValue) ?
2691
+                    $texto = !empty($IPI->getElementsByTagName("pIPI")->item(0)->nodeValue) ?
2698 2692
                             number_format($IPI->getElementsByTagName("pIPI")->item(0)->nodeValue, 2, ",", ".") : '';
2699 2693
                 } else {
2700 2694
                     $texto = '';
@@ -2708,7 +2702,7 @@  discard block
 block discarded – undo
2708 2702
                 $i++;
2709 2703
             }
2710 2704
         }
2711
-        return $oldY+$hmax;
2705
+        return $oldY + $hmax;
2712 2706
     }
2713 2707
 
2714 2708
     /**
@@ -2732,12 +2726,12 @@  discard block
 block discarded – undo
2732 2726
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
2733 2727
         //INSCRIÇÃO MUNICIPAL
2734 2728
         $y += 3;
2735
-        $w = round($this->wPrint*0.23, 0);
2729
+        $w = round($this->wPrint * 0.23, 0);
2736 2730
         $texto = 'INSCRIÇÃO MUNICIPAL';
2737 2731
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2738 2732
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
2739 2733
         //inscrição municipal
2740
-        $texto = ! empty($this->emit->getElementsByTagName("IM")->item(0)->nodeValue) ?
2734
+        $texto = !empty($this->emit->getElementsByTagName("IM")->item(0)->nodeValue) ?
2741 2735
                 $this->emit->getElementsByTagName("IM")->item(0)->nodeValue : '';
2742 2736
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
2743 2737
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 0, '');
@@ -2747,7 +2741,7 @@  discard block
 block discarded – undo
2747 2741
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2748 2742
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
2749 2743
         if (isset($this->ISSQNtot)) {
2750
-            $texto = ! empty($this->ISSQNtot->getElementsByTagName("vServ")->item(0)->nodeValue) ?
2744
+            $texto = !empty($this->ISSQNtot->getElementsByTagName("vServ")->item(0)->nodeValue) ?
2751 2745
                     $this->ISSQNtot->getElementsByTagName("vServ")->item(0)->nodeValue : '';
2752 2746
             $texto = number_format($texto, 2, ",", ".");
2753 2747
         } else {
@@ -2761,9 +2755,9 @@  discard block
 block discarded – undo
2761 2755
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2762 2756
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
2763 2757
         if (isset($this->ISSQNtot)) {
2764
-            $texto = ! empty($this->ISSQNtot->getElementsByTagName("vBC")->item(0)->nodeValue) ?
2758
+            $texto = !empty($this->ISSQNtot->getElementsByTagName("vBC")->item(0)->nodeValue) ?
2765 2759
                     $this->ISSQNtot->getElementsByTagName("vBC")->item(0)->nodeValue : '';
2766
-            $texto = ! empty($texto) ? number_format($texto, 2, ",", ".") : '';
2760
+            $texto = !empty($texto) ? number_format($texto, 2, ",", ".") : '';
2767 2761
         } else {
2768 2762
             $texto = '';
2769 2763
         }
@@ -2774,21 +2768,21 @@  discard block
 block discarded – undo
2774 2768
         if ($this->orientacao == 'P') {
2775 2769
             $w = $this->wPrint - (3 * $w);
2776 2770
         } else {
2777
-            $w = $this->wPrint - (3 * $w)-$this->wCanhoto;
2771
+            $w = $this->wPrint - (3 * $w) - $this->wCanhoto;
2778 2772
         }
2779 2773
         $texto = 'VALOR TOTAL DO ISSQN';
2780 2774
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2781 2775
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
2782 2776
         if (isset($this->ISSQNtot)) {
2783
-            $texto = ! empty($this->ISSQNtot->getElementsByTagName("vISS")->item(0)->nodeValue) ?
2777
+            $texto = !empty($this->ISSQNtot->getElementsByTagName("vISS")->item(0)->nodeValue) ?
2784 2778
                     $this->ISSQNtot->getElementsByTagName("vISS")->item(0)->nodeValue : '';
2785
-            $texto = ! empty($texto) ? number_format($texto, 2, ",", ".") : '';
2779
+            $texto = !empty($texto) ? number_format($texto, 2, ",", ".") : '';
2786 2780
         } else {
2787 2781
             $texto = '';
2788 2782
         }
2789 2783
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
2790 2784
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'R', 0, '');
2791
-        return ($y+$h+1);
2785
+        return ($y + $h + 1);
2792 2786
     }
2793 2787
 
2794 2788
     /**
@@ -2809,7 +2803,7 @@  discard block
 block discarded – undo
2809 2803
         if ($this->orientacao == 'P') {
2810 2804
               $w = $this->wPrint;
2811 2805
         } else {
2812
-              $w = $this->wPrint-$this->wCanhoto;
2806
+              $w = $this->wPrint - $this->wCanhoto;
2813 2807
         }
2814 2808
         $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
2815 2809
         $this->pTextBox($x, $y, $w, 8, $texto, $aFont, 'T', 'L', 0, '');
@@ -2825,15 +2819,15 @@  discard block
 block discarded – undo
2825 2819
         //$this->textoAdic com o texto completo do campo
2826 2820
         $y += 1;
2827 2821
         $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'');
2828
-        $this->pTextBox($x, $y+2, $w-2, $h-3, $this->textoAdic, $aFont, 'T', 'L', 0, '', false);
2822
+        $this->pTextBox($x, $y + 2, $w - 2, $h - 3, $this->textoAdic, $aFont, 'T', 'L', 0, '', false);
2829 2823
         //RESERVADO AO FISCO
2830 2824
         $texto = "RESERVADO AO FISCO";
2831 2825
         $x += $w;
2832 2826
         $y -= 1;
2833 2827
         if ($this->orientacao == 'P') {
2834
-            $w = $this->wPrint-$w;
2828
+            $w = $this->wPrint - $w;
2835 2829
         } else {
2836
-            $w = $this->wPrint-$w-$this->wCanhoto;
2830
+            $w = $this->wPrint - $w - $this->wCanhoto;
2837 2831
         }
2838 2832
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'B');
2839 2833
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -2872,8 +2866,8 @@  discard block
 block discarded – undo
2872 2866
         }
2873 2867
         $y += 2;
2874 2868
         $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'');
2875
-        $this->pTextBox($x, $y, $w-2, $h-3, $texto, $aFont, 'T', 'L', 0, '', false);
2876
-        return $y+$h;
2869
+        $this->pTextBox($x, $y, $w - 2, $h - 3, $texto, $aFont, 'T', 'L', 0, '', false);
2870
+        return $y + $h;
2877 2871
     }
2878 2872
 
2879 2873
     /**
@@ -2891,13 +2885,13 @@  discard block
 block discarded – undo
2891 2885
         if ($this->orientacao == 'P') {
2892 2886
               $w = $this->wPrint;
2893 2887
         } else {
2894
-              $w = $this->wPrint-$this->wCanhoto;
2888
+              $w = $this->wPrint - $this->wCanhoto;
2895 2889
               $x = $this->wCanhoto;
2896 2890
         }
2897 2891
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'I');
2898
-        $texto = "Impresso em ". date('d/m/Y') . " as " . date('H:i:s');
2892
+        $texto = "Impresso em " . date('d/m/Y') . " as " . date('H:i:s');
2899 2893
         $this->pTextBox($x, $y, $w, 0, $texto, $aFont, 'T', 'L', false);
2900
-        $texto = $this->creditos .  "  Powered by NFePHP";
2894
+        $texto = $this->creditos . "  Powered by NFePHP";
2901 2895
         $this->pTextBox($x, $y, $w, 0, $texto, $aFont, 'T', 'R', false, '');
2902 2896
     }
2903 2897
 
@@ -2950,9 +2944,9 @@  discard block
 block discarded – undo
2950 2944
         } else {
2951 2945
             //linha separadora do canhoto - 238
2952 2946
             //posicao altura
2953
-            $y = $this->wPrint-85;
2947
+            $y = $this->wPrint - 85;
2954 2948
             //altura
2955
-            $w = $this->wPrint-85-24;
2949
+            $w = $this->wPrint - 85 - 24;
2956 2950
         }
2957 2951
         $h = 10;
2958 2952
         //desenha caixa
@@ -2975,21 +2969,21 @@  discard block
 block discarded – undo
2975 2969
             $texto .= "AO LADO";
2976 2970
         }
2977 2971
         $texto .= ". EMISSÃO: ";
2978
-        $dEmi = ! empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
2972
+        $dEmi = !empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
2979 2973
                 $this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue : '';
2980 2974
         if ($dEmi == '') {
2981
-            $dEmi = ! empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
2975
+            $dEmi = !empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
2982 2976
                     $this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue : '';
2983 2977
             $aDemi = explode('T', $dEmi);
2984 2978
             $dEmi = $aDemi[0];
2985 2979
         }
2986
-        $texto .= $this->pYmd2dmy($dEmi) ." ";
2980
+        $texto .= $this->pYmd2dmy($dEmi) . " ";
2987 2981
         $texto .= "VALOR TOTAL: R$ ";
2988 2982
         $texto .= number_format($this->ICMSTot->getElementsByTagName("vNF")->item(0)->nodeValue, 2, ",", ".") . " ";
2989 2983
         $texto .= "DESTINATÁRIO: ";
2990 2984
         $texto .= $destinatario;
2991 2985
         if ($this->orientacao == 'P') {
2992
-            $this->pTextBox($x, $y, $w-1, $h, $texto, $aFont, 'C', 'L', 0, '', false);
2986
+            $this->pTextBox($x, $y, $w - 1, $h, $texto, $aFont, 'C', 'L', 0, '', false);
2993 2987
             $x1 = $x + $w;
2994 2988
             $w1 = $this->wPrint - $w;
2995 2989
             $texto = "NF-e";
@@ -3002,12 +2996,12 @@  discard block
 block discarded – undo
3002 2996
             //DATA DE RECEBIMENTO
3003 2997
             $texto = "DATA DE RECEBIMENTO";
3004 2998
             $y += $h;
3005
-            $w2 = round($this->wPrint*0.17, 0); //35;
2999
+            $w2 = round($this->wPrint * 0.17, 0); //35;
3006 3000
             $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
3007 3001
             $this->pTextBox($x, $y, $w2, 8, $texto, $aFont, 'T', 'L', 1, '');
3008 3002
             //IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR
3009 3003
             $x += $w2;
3010
-            $w3 = $w-$w2;
3004
+            $w3 = $w - $w2;
3011 3005
             $texto = "IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR";
3012 3006
             $this->pTextBox($x, $y, $w3, 8, $texto, $aFont, 'T', 'L', 1, '');
3013 3007
             $x = $oldX;
@@ -3017,7 +3011,7 @@  discard block
 block discarded – undo
3017 3011
             return $y;
3018 3012
         } else {
3019 3013
             $x--;
3020
-            $x = $this->pTextBox90($x, $y, $w-1, $h, $texto, $aFontSmall, 'C', 'L', 0, '', false);
3014
+            $x = $this->pTextBox90($x, $y, $w - 1, $h, $texto, $aFontSmall, 'C', 'L', 0, '', false);
3021 3015
             //NUMERO DA NOTA FISCAL LOGO NFE
3022 3016
             $w1 = 16;
3023 3017
             $x1 = $oldX;
@@ -3031,18 +3025,18 @@  discard block
 block discarded – undo
3031 3025
             $this->pTextBox($x1, $y, $w1, 18, $texto, $aFont, 'C', 'C', 1, '');
3032 3026
             //DATA DO RECEBIMENTO
3033 3027
             $texto = "DATA DO RECEBIMENTO";
3034
-            $y = $this->wPrint-85;
3028
+            $y = $this->wPrint - 85;
3035 3029
             $x = 12;
3036
-            $w2 = round($this->wPrint*0.17, 0); //35;
3030
+            $w2 = round($this->wPrint * 0.17, 0); //35;
3037 3031
             $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
3038 3032
             $this->pTextBox90($x, $y, $w2, 8, $texto, $aFont, 'T', 'L', 1, '');
3039 3033
             //IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR
3040 3034
             $y -= $w2;
3041
-            $w3 = $w-$w2;
3035
+            $w3 = $w - $w2;
3042 3036
             $texto = "IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR";
3043 3037
             $aFont = array('font'=>$this->fontePadrao, 'size'=>5.7, 'style'=>'');
3044 3038
             $x = $this->pTextBox90($x, $y, $w3, 8, $texto, $aFont, 'T', 'L', 1, '');
3045
-            $this->pdf->DashedVLine(23, $oldY, 0.1, $this->wPrint-20, 67);
3039
+            $this->pdf->DashedVLine(23, $oldY, 0.1, $this->wPrint - 20, 67);
3046 3040
             return $x;
3047 3041
         }
3048 3042
     }
@@ -3059,13 +3053,13 @@  discard block
 block discarded – undo
3059 3053
     {
3060 3054
         $saida = "";
3061 3055
         if (isset($this->compra)) {
3062
-            if (! empty($this->compra->getElementsByTagName("xNEmp")->item(0)->nodeValue)) {
3056
+            if (!empty($this->compra->getElementsByTagName("xNEmp")->item(0)->nodeValue)) {
3063 3057
                 $saida .= " Nota de Empenho: " . $this->compra->getElementsByTagName("xNEmp")->item(0)->nodeValue;
3064 3058
             }
3065
-            if (! empty($this->compra->getElementsByTagName("xPed")->item(0)->nodeValue)) {
3059
+            if (!empty($this->compra->getElementsByTagName("xPed")->item(0)->nodeValue)) {
3066 3060
                 $saida .= " Pedido: " . $this->compra->getElementsByTagName("xPed")->item(0)->nodeValue;
3067 3061
             }
3068
-            if (! empty($this->compra->getElementsByTagName("xCont")->item(0)->nodeValue)) {
3062
+            if (!empty($this->compra->getElementsByTagName("xCont")->item(0)->nodeValue)) {
3069 3063
                 $saida .= " Contrato: " . $this->compra->getElementsByTagName("xCont")->item(0)->nodeValue;
3070 3064
             }
3071 3065
         }
@@ -3091,21 +3085,21 @@  discard block
 block discarded – undo
3091 3085
         if ($vICMS > 0) {
3092 3086
             $vICMS = 1;
3093 3087
         }
3094
-        $icmss  = $this->ICMSTot->getElementsByTagName("vBC")->item(0)->nodeValue;
3088
+        $icmss = $this->ICMSTot->getElementsByTagName("vBC")->item(0)->nodeValue;
3095 3089
         if ($icmss > 0) {
3096 3090
             $icmss = 1;
3097 3091
         }
3098
-        $dEmi = ! empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
3092
+        $dEmi = !empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
3099 3093
                 $this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue : '';
3100 3094
         if ($dEmi == '') {
3101
-            $dEmi = ! empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
3095
+            $dEmi = !empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
3102 3096
                     $this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue : '';
3103 3097
             $aDemi = explode('T', $dEmi);
3104 3098
             $dEmi = $aDemi[0];
3105 3099
         }
3106 3100
         $dd  = $dEmi;
3107 3101
         $rpos = strrpos($dd, '-');
3108
-        $dd  = substr($dd, $rpos +1);
3102
+        $dd  = substr($dd, $rpos + 1);
3109 3103
         $chave = sprintf($forma, $cUF, $this->tpEmis, $CNPJ, $vNF, $vICMS, $icmss, $dd);
3110 3104
         $chave = $chave . $this->pModulo11($chave);
3111 3105
         return $chave;
@@ -3126,7 +3120,7 @@  discard block
 block discarded – undo
3126 3120
         $formaNfRef = "\r\nNF  Ref.: série:%d numero:%d emit:%s em %s modelo: %d";
3127 3121
         $formaECFRef = "\r\nECF Ref.: modelo: %s ECF:%d COO:%d";
3128 3122
         $formaNfpRef = "\r\nNFP Ref.: série:%d número:%d emit:%s em %s modelo: %d IE:%s";
3129
-        $saida='';
3123
+        $saida = '';
3130 3124
         $nfRefs = $this->ide->getElementsByTagName('NFref');
3131 3125
         if (0 === $nfRefs->length) {
3132 3126
             return $saida;
@@ -3139,7 +3133,7 @@  discard block
 block discarded – undo
3139 3133
             foreach ($refNFe as $chave_acessoRef) {
3140 3134
                 $chave_acesso = $chave_acessoRef->nodeValue;
3141 3135
                 $chave_acessoF = $this->pFormat($chave_acesso, $this->formatoChave);
3142
-                $data = substr($chave_acesso, 4, 2)."/20".substr($chave_acesso, 2, 2);
3136
+                $data = substr($chave_acesso, 4, 2) . "/20" . substr($chave_acesso, 2, 2);
3143 3137
                 $cnpj = $this->pFormat(substr($chave_acesso, 6, 14), "##.###.###/####-##");
3144 3138
                 $serie  = substr($chave_acesso, 22, 3);
3145 3139
                 $numero = substr($chave_acesso, 25, 9);
@@ -3160,7 +3154,7 @@  discard block
 block discarded – undo
3160 3154
             foreach ($refCTe as $chave_acessoRef) {
3161 3155
                 $chave_acesso = $chave_acessoRef->nodeValue;
3162 3156
                 $chave_acessoF = $this->pFormat($chave_acesso, $this->formatoChave);
3163
-                $data = substr($chave_acesso, 4, 2)."/20".substr($chave_acesso, 2, 2);
3157
+                $data = substr($chave_acesso, 4, 2) . "/20" . substr($chave_acesso, 2, 2);
3164 3158
                 $cnpj = $this->pFormat(substr($chave_acesso, 6, 14), "##.###.###/####-##");
3165 3159
                 $serie  = substr($chave_acesso, 22, 3);
3166 3160
                 $numero = substr($chave_acesso, 25, 9);
@@ -3176,10 +3170,9 @@  discard block
 block discarded – undo
3176 3170
             $refNFP = $nfRef->getElementsByTagName('refNFP');
3177 3171
             foreach ($refNFP as $umaRefNFe) {
3178 3172
                 $data = $umaRefNFe->getElementsByTagName('AAMM')->item(0)->nodeValue;
3179
-                $cnpj = ! empty($umaRefNFe->getElementsByTagName('CNPJ')->item(0)->nodeValue) ?
3180
-                    $umaRefNFe->getElementsByTagName('CNPJ')->item(0)->nodeValue :
3181
-                    '';
3182
-                $cpf = ! empty($umaRefNFe->getElementsByTagName('CPF')->item(0)->nodeValue) ?
3173
+                $cnpj = !empty($umaRefNFe->getElementsByTagName('CNPJ')->item(0)->nodeValue) ?
3174
+                    $umaRefNFe->getElementsByTagName('CNPJ')->item(0)->nodeValue : '';
3175
+                $cpf = !empty($umaRefNFe->getElementsByTagName('CPF')->item(0)->nodeValue) ?
3183 3176
                         $umaRefNFe->getElementsByTagName('CPF')->item(0)->nodeValue : '';
3184 3177
                 $mod = $umaRefNFe->getElementsByTagName('mod')->item(0)->nodeValue;
3185 3178
                 $serie = $umaRefNFe->getElementsByTagName('serie')->item(0)->nodeValue;
@@ -3205,6 +3198,6 @@  discard block
 block discarded – undo
3205 3198
         imagedestroy($image);
3206 3199
         $stringdata = ob_get_contents(); // read from buffer
3207 3200
         ob_end_clean();
3208
-        return 'data://text/plain;base64,'.base64_encode($stringdata);
3201
+        return 'data://text/plain;base64,' . base64_encode($stringdata);
3209 3202
     }
3210 3203
 }
Please login to merge, or discard this patch.