Passed
Pull Request — master (#125)
by
unknown
03:48
created
src/NFe/Danfe.php 3 patches
Doc Comments   +18 added lines, -14 removed lines patch added patch discarded remove patch
@@ -988,8 +988,8 @@  discard block
 block discarded – undo
988 988
      *cabecalhoDANFE
989 989
      * Monta o cabelhalho da DANFE (retrato e paisagem)
990 990
      *
991
-     * @param  number $x      Posição horizontal inicial, canto esquerdo
992
-     * @param  number $y      Posição vertical inicial, canto superior
991
+     * @param  integer $x      Posição horizontal inicial, canto esquerdo
992
+     * @param  integer $y      Posição vertical inicial, canto superior
993 993
      * @param  number $pag    Número da Página
994 994
      * @param  number $totPag Total de páginas
995 995
      * @return number Posição vertical final
@@ -1421,8 +1421,8 @@  discard block
 block discarded – undo
1421 1421
      * Monta o campo com os dados do destinatário na DANFE. (retrato e paisagem)
1422 1422
      *
1423 1423
      * @name   destinatarioDANFE
1424
-     * @param  number $x Posição horizontal canto esquerdo
1425
-     * @param  number $y Posição vertical canto superior
1424
+     * @param  integer $x Posição horizontal canto esquerdo
1425
+     * @param  integer $y Posição vertical canto superior
1426 1426
      * @return number Posição vertical final
1427 1427
      */
1428 1428
     protected function pDestinatarioDANFE($x = 0, $y = 0)
@@ -1622,7 +1622,7 @@  discard block
 block discarded – undo
1622 1622
      * Gera a String do Texto da Fatura
1623 1623
       *
1624 1624
      * @name   getTextoFatura
1625
-     * @return uma String com o texto ou "";
1625
+     * @return string String com o texto ou "";
1626 1626
      */
1627 1627
     protected function pGetTextoFatura()
1628 1628
     {
@@ -1675,8 +1675,8 @@  discard block
 block discarded – undo
1675 1675
      * Monta o campo de duplicatas da DANFE (retrato e paisagem)
1676 1676
      *
1677 1677
      * @name   faturaDANFE
1678
-     * @param  number $x Posição horizontal canto esquerdo
1679
-     * @param  number $y Posição vertical canto superior
1678
+     * @param  integer $x Posição horizontal canto esquerdo
1679
+     * @param  double $y Posição vertical canto superior
1680 1680
      * @return number Posição vertical final
1681 1681
      */
1682 1682
     protected function pFaturaDANFE($x, $y)
@@ -1789,6 +1789,8 @@  discard block
 block discarded – undo
1789 1789
      * @param  float $h Altura do campo
1790 1790
      * @param  float $h Título do campo
1791 1791
      * @param  float $h Valor do imposto
1792
+     * @param string $titulo
1793
+     * @param string $campoImposto
1792 1794
      * @return float Sugestão do $x do próximo imposto
1793 1795
      */
1794 1796
     protected function pImpostoDanfeHelper($x, $y, $w, $h, $titulo, $campoImposto)
@@ -1815,9 +1817,9 @@  discard block
 block discarded – undo
1815 1817
      * impostoDANFE
1816 1818
      * Monta o campo de impostos e totais da DANFE (retrato e paisagem)
1817 1819
      *
1818
-     * @param  number $x Posição horizontal canto esquerdo
1819
-     * @param  number $y Posição vertical canto superior
1820
-     * @return number Posição vertical final
1820
+     * @param  integer $x Posição horizontal canto esquerdo
1821
+     * @param  double $y Posição vertical canto superior
1822
+     * @return double Posição vertical final
1821 1823
      */
1822 1824
     protected function pImpostoDANFE($x, $y)
1823 1825
     {
@@ -2199,6 +2201,10 @@  discard block
 block discarded – undo
2199 2201
 
2200 2202
 
2201 2203
 
2204
+    /**
2205
+     * @param string $campo
2206
+     * @param string $formato
2207
+     */
2202 2208
     protected function pDescricaoProdutoHelper($origem, $campo, $formato)
2203 2209
     {
2204 2210
         $valor_original = $origem->getElementsByTagName($campo)->item(0);
@@ -2288,7 +2294,6 @@  discard block
 block discarded – undo
2288 2294
      * @param  float $x       Posição horizontal canto esquerdo
2289 2295
      * @param  float $y       Posição vertical canto superior
2290 2296
      * @param  float $nInicio Número do item inicial
2291
-     * @param  float $max     Número do item final
2292 2297
      * @param  float $hmax    Altura máxima do campo de itens em mm
2293 2298
      * @return float Posição vertical final
2294 2299
      */
@@ -2738,8 +2743,7 @@  discard block
 block discarded – undo
2738 2743
      * sobre a API NfePHP
2739 2744
      *
2740 2745
      * @name   pRodape
2741
-     * @param  float $xInic  Posição horizontal canto esquerdo
2742
-     * @param  float $yFinal Posição vertical final para impressão
2746
+     * @param integer $x
2743 2747
      * @return void
2744 2748
      */
2745 2749
     protected function pRodape($x, $y)
@@ -2762,7 +2766,7 @@  discard block
 block discarded – undo
2762 2766
      * Monta o canhoto da DANFE (retrato e paisagem)
2763 2767
      *
2764 2768
      * @name   canhotoDANFE
2765
-     * @param  number $x Posição horizontal canto esquerdo
2769
+     * @param  integer $x Posição horizontal canto esquerdo
2766 2770
      * @param  number $y Posição vertical canto superior
2767 2771
      * @return number Posição vertical final
2768 2772
      *
Please login to merge, or discard this patch.
Indentation   +26 added lines, -26 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();
@@ -787,8 +787,8 @@  discard block
 block discarded – undo
787 787
         //retorna o ID na NFe
788 788
         if ($classPdf!==false) {
789 789
             $aR = array(
790
-             'id'=>str_replace('NFe', '', $this->infNFe->getAttribute("Id")),
791
-             'classe_PDF'=>$this->pdf);
790
+                'id'=>str_replace('NFe', '', $this->infNFe->getAttribute("Id")),
791
+                'classe_PDF'=>$this->pdf);
792 792
             return $aR;
793 793
         } else {
794 794
             return str_replace('NFe', '', $this->infNFe->getAttribute("Id"));
@@ -999,7 +999,7 @@  discard block
 block discarded – undo
999 999
         $oldX = $x;
1000 1000
         $oldY = $y;
1001 1001
         if ($this->orientacao == 'P') {
1002
-              $maxW = $this->wPrint;
1002
+                $maxW = $this->wPrint;
1003 1003
         } else {
1004 1004
             if ($pag == 1) { // primeira página
1005 1005
                 $maxW = $this->wPrint - $this->wCanhoto;
@@ -1329,8 +1329,8 @@  discard block
 block discarded – undo
1329 1329
             $w = $maxW-(2*$x);
1330 1330
             $this->pdf->SetTextColor(200, 200, 200);
1331 1331
             $texto = "DANFE impresso em contingência -\n".
1332
-                     "DPEC regularmente recebido pela Receita\n".
1333
-                     "Federal do Brasil";
1332
+                        "DPEC regularmente recebido pela Receita\n".
1333
+                        "Federal do Brasil";
1334 1334
             $aFont = array('font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B');
1335 1335
             $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1336 1336
             $this->pdf->SetTextColor(0, 0, 0);
@@ -1617,13 +1617,13 @@  discard block
 block discarded – undo
1617 1617
         return ($y + $h);
1618 1618
     } //fim da função destinatarioDANFE
1619 1619
 
1620
-     /**
1621
-     * pGetTextoFatura
1622
-     * Gera a String do Texto da Fatura
1623
-      *
1624
-     * @name   getTextoFatura
1625
-     * @return uma String com o texto ou "";
1626
-     */
1620
+        /**
1621
+         * pGetTextoFatura
1622
+         * Gera a String do Texto da Fatura
1623
+         *
1624
+         * @name   getTextoFatura
1625
+         * @return uma String com o texto ou "";
1626
+         */
1627 1627
     protected function pGetTextoFatura()
1628 1628
     {
1629 1629
         if (isset($this->cobr)) {
@@ -1653,13 +1653,13 @@  discard block
 block discarded – undo
1653 1653
         return "";
1654 1654
     } //fim getTextoFatura
1655 1655
 
1656
-     /**
1657
-     * pSizeExtraTextoFatura
1658
-     * Calcula o espaço ocupado pelo texto da fatura. Este espaço só é utilizado quando não houver duplicata.
1659
-      *
1660
-     * @name   pSizeExtraTextoFatura
1661
-     * @return integer
1662
-     */
1656
+        /**
1657
+         * pSizeExtraTextoFatura
1658
+         * Calcula o espaço ocupado pelo texto da fatura. Este espaço só é utilizado quando não houver duplicata.
1659
+         *
1660
+         * @name   pSizeExtraTextoFatura
1661
+         * @return integer
1662
+         */
1663 1663
     protected function pSizeExtraTextoFatura()
1664 1664
     {
1665 1665
         $textoFatura = $this->pGetTextoFatura();
@@ -2345,7 +2345,7 @@  discard block
 block discarded – undo
2345 2345
         $w4 = round($w*0.05, 0);
2346 2346
         $texto = 'O/CSOSN';//Regime do Simples CRT = 1 ou CRT = 2
2347 2347
         if ($this->pSimpleGetValue($this->emit, 'CRT') == '3') {
2348
-             $texto = 'O/CST';//Regime Normal
2348
+                $texto = 'O/CST';//Regime Normal
2349 2349
         }
2350 2350
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2351 2351
         $this->pTextBox($x, $y, $w4, $h, $texto, $aFont, 'C', 'C', 0, '', false);
@@ -2663,9 +2663,9 @@  discard block
 block discarded – undo
2663 2663
         //DADOS ADICIONAIS
2664 2664
         $texto = "DADOS ADICIONAIS";
2665 2665
         if ($this->orientacao == 'P') {
2666
-              $w = $this->wPrint;
2666
+                $w = $this->wPrint;
2667 2667
         } else {
2668
-              $w = $this->wPrint-$this->wCanhoto;
2668
+                $w = $this->wPrint-$this->wCanhoto;
2669 2669
         }
2670 2670
         $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
2671 2671
         $this->pTextBox($x, $y, $w, 8, $texto, $aFont, 'T', 'L', 0, '');
@@ -2745,10 +2745,10 @@  discard block
 block discarded – undo
2745 2745
     protected function pRodape($x, $y)
2746 2746
     {
2747 2747
         if ($this->orientacao == 'P') {
2748
-              $w = $this->wPrint;
2748
+                $w = $this->wPrint;
2749 2749
         } else {
2750
-              $w = $this->wPrint-$this->wCanhoto;
2751
-              $x = $this->wCanhoto;
2750
+                $w = $this->wPrint-$this->wCanhoto;
2751
+                $x = $this->wCanhoto;
2752 2752
         }
2753 2753
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'I');
2754 2754
         $texto = "Impresso em ". date('d/m/Y') . " as " . date('H:i:s');
Please login to merge, or discard this patch.
Spacing   +313 added lines, -320 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,19 +726,19 @@  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
         //coloca os dados das faturas
737
-        $y = $this->pFaturaDANFE($x, $y+1);
731
+        $y = $this->pFaturaDANFE($x, $y + 1);
738 732
         //coloca os dados dos impostos e totais da NFe
739
-        $y = $this->pImpostoDANFE($x, $y+1);
733
+        $y = $this->pImpostoDANFE($x, $y + 1);
740 734
         //coloca os dados do trasnporte
741
-        $y = $this->pTransporteDANFE($x, $y+1);
735
+        $y = $this->pTransporteDANFE($x, $y + 1);
742 736
         //itens da DANFE
743 737
         $nInicial = 0;
744
-        $y = $this->pItensDANFE($x, $y+1, $nInicial, $hDispo1, $pag, $totPag, $hCabecItens);
738
+        $y = $this->pItensDANFE($x, $y + 1, $nInicial, $hDispo1, $pag, $totPag, $hCabecItens);
745 739
         //coloca os dados do ISSQN
746 740
         if ($linhaISSQN == 1) {
747
-            $y = $this->pIssqnDANFE($x, $y+4);
741
+            $y = $this->pIssqnDANFE($x, $y + 4);
748 742
         } else {
749 743
             $y += 4;
750 744
         }
@@ -752,7 +746,7 @@  discard block
 block discarded – undo
752 746
         $y = $this->pDadosAdicionaisDANFE($x, $y, $hdadosadic);
753 747
         //coloca o rodapé da página
754 748
         if ($this->orientacao == 'P') {
755
-            $this->pRodape($xInic, $y-1);
749
+            $this->pRodape($xInic, $y - 1);
756 750
         } else {
757 751
             $this->pRodape($xInic, $this->hPrint + 1);
758 752
         }
@@ -772,7 +766,7 @@  discard block
 block discarded – undo
772 766
             //coloca o cabeçalho na página adicional
773 767
             $y = $this->pCabecalhoDANFE($x, $y, $n, $totPag);
774 768
             //coloca os itens na página adicional
775
-            $y = $this->pItensDANFE($x, $y+1, $nInicial, $hDispo2, $n, $totPag, $hCabecItens);
769
+            $y = $this->pItensDANFE($x, $y + 1, $nInicial, $hDispo2, $n, $totPag, $hCabecItens);
776 770
             //coloca o rodapé da página
777 771
             if ($this->orientacao == 'P') {
778 772
                 $this->pRodape($xInic, $y + 4);
@@ -785,7 +779,7 @@  discard block
 block discarded – undo
785 779
             }
786 780
         }
787 781
         //retorna o ID na NFe
788
-        if ($classPdf!==false) {
782
+        if ($classPdf !== false) {
789 783
             $aR = array(
790 784
              'id'=>str_replace('NFe', '', $this->infNFe->getAttribute("Id")),
791 785
              'classe_PDF'=>$this->pdf);
@@ -818,7 +812,7 @@  discard block
 block discarded – undo
818 812
         if ($startPos === false) {
819 813
             return $cdata;
820 814
         }
821
-        for ($x=$len; $x>0; $x--) {
815
+        for ($x = $len; $x > 0; $x--) {
822 816
             if (substr($cdata, $x, 1) == '>') {
823 817
                 $endPos = $x;
824 818
                 break;
@@ -829,15 +823,15 @@  discard block
 block discarded – undo
829 823
         } else {
830 824
             $parte1 = '';
831 825
         }
832
-        $parte2 = substr($cdata, $startPos, $endPos-$startPos+1);
826
+        $parte2 = substr($cdata, $startPos, $endPos - $startPos + 1);
833 827
         if ($endPos < $len) {
834 828
             $parte3 = substr($cdata, $endPos + 1, $len - $endPos - 1);
835 829
         } else {
836 830
             $parte3 = '';
837 831
         }
838
-        $texto = trim($parte1).' '.trim($parte3);
832
+        $texto = trim($parte1) . ' ' . trim($parte3);
839 833
         if (strpos($parte2, '<CDATA>') === false) {
840
-            $cdata = '<CDATA>'.$parte2.'</CDATA>';
834
+            $cdata = '<CDATA>' . $parte2 . '</CDATA>';
841 835
         } else {
842 836
             $cdata = $parte2;
843 837
         }
@@ -911,15 +905,15 @@  discard block
 block discarded – undo
911 905
         //grupo CADATA infCpl
912 906
         $t = $dom->getElementsByTagName('transmissor')->item(0);
913 907
         $r = $dom->getElementsByTagName('receptor')->item(0);
914
-        $versao = ! empty($dom->getElementsByTagName('versao')->item(0)->nodeValue) ?
915
-            'Versao:'.$dom->getElementsByTagName('versao')->item(0)->nodeValue.' ' : '';
916
-        $especieNF = ! empty($dom->getElementsByTagName('especieNF')->item(0)->nodeValue) ?
917
-            'Especie:'.$dom->getElementsByTagName('especieNF')->item(0)->nodeValue.' ' : '';
918
-        $fabEntrega = ! empty($dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue) ?
919
-            'Entrega:'.$dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue.' ' : '';
920
-        $dca = ! empty($dom->getElementsByTagName('dca')->item(0)->nodeValue) ?
921
-            'dca:'.$dom->getElementsByTagName('dca')->item(0)->nodeValue.' ' : '';
922
-        $texto .= "".$versao.$especieNF.$fabEntrega.$dca;
908
+        $versao = !empty($dom->getElementsByTagName('versao')->item(0)->nodeValue) ?
909
+            'Versao:' . $dom->getElementsByTagName('versao')->item(0)->nodeValue . ' ' : '';
910
+        $especieNF = !empty($dom->getElementsByTagName('especieNF')->item(0)->nodeValue) ?
911
+            'Especie:' . $dom->getElementsByTagName('especieNF')->item(0)->nodeValue . ' ' : '';
912
+        $fabEntrega = !empty($dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue) ?
913
+            'Entrega:' . $dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue . ' ' : '';
914
+        $dca = !empty($dom->getElementsByTagName('dca')->item(0)->nodeValue) ?
915
+            'dca:' . $dom->getElementsByTagName('dca')->item(0)->nodeValue . ' ' : '';
916
+        $texto .= "" . $versao . $especieNF . $fabEntrega . $dca;
923 917
         if (isset($t)) {
924 918
             if ($t->hasAttributes()) {
925 919
                 $texto .= " Transmissor ";
@@ -1009,14 +1003,14 @@  discard block
 block discarded – undo
1009 1003
         }
1010 1004
         //####################################################################################
1011 1005
         //coluna esquerda identificação do emitente
1012
-        $w = round($maxW*0.41, 0);
1006
+        $w = round($maxW * 0.41, 0);
1013 1007
         if ($this->orientacao == 'P') {
1014 1008
             $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'I');
1015 1009
         } else {
1016 1010
             $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B');
1017 1011
         }
1018 1012
         $w1 = $w;
1019
-        $h=32;
1013
+        $h = 32;
1020 1014
         $oldY += $h;
1021 1015
         $this->pTextBox($x, $y, $w, $h);
1022 1016
         $texto = 'IDENTIFICAÇÃO DO EMITENTE';
@@ -1030,41 +1024,41 @@  discard block
 block discarded – undo
1030 1024
         //se não houver logo centraliza dos dados do emitente
1031 1025
         // coloca o logo
1032 1026
         if (is_file($this->logomarca)) {
1033
-            $logoInfo=getimagesize($this->logomarca);
1027
+            $logoInfo = getimagesize($this->logomarca);
1034 1028
             //largura da imagem em mm
1035
-            $logoWmm = ($logoInfo[0]/72)*25.4;
1029
+            $logoWmm = ($logoInfo[0] / 72) * 25.4;
1036 1030
             //altura da imagem em mm
1037
-            $logoHmm = ($logoInfo[1]/72)*25.4;
1038
-            if ($this->logoAlign=='L') {
1039
-                $nImgW = round($w/3, 0);
1040
-                $nImgH = round($logoHmm * ($nImgW/$logoWmm), 0);
1041
-                $xImg = $x+1;
1042
-                $yImg = round(($h-$nImgH)/2, 0)+$y;
1031
+            $logoHmm = ($logoInfo[1] / 72) * 25.4;
1032
+            if ($this->logoAlign == 'L') {
1033
+                $nImgW = round($w / 3, 0);
1034
+                $nImgH = round($logoHmm * ($nImgW / $logoWmm), 0);
1035
+                $xImg = $x + 1;
1036
+                $yImg = round(($h - $nImgH) / 2, 0) + $y;
1043 1037
                 //estabelecer posições do texto
1044
-                $x1 = round($xImg + $nImgW +1, 0);
1045
-                $y1 = round($h/3+$y, 0);
1046
-                $tw = round(2*$w/3, 0);
1047
-            } elseif ($this->logoAlign=='C') {
1048
-                $nImgH = round($h/3, 0);
1049
-                $nImgW = round($logoWmm * ($nImgH/$logoHmm), 0);
1050
-                $xImg = round(($w-$nImgW)/2+$x, 0);
1051
-                $yImg = $y+3;
1038
+                $x1 = round($xImg + $nImgW + 1, 0);
1039
+                $y1 = round($h / 3 + $y, 0);
1040
+                $tw = round(2 * $w / 3, 0);
1041
+            } elseif ($this->logoAlign == 'C') {
1042
+                $nImgH = round($h / 3, 0);
1043
+                $nImgW = round($logoWmm * ($nImgH / $logoHmm), 0);
1044
+                $xImg = round(($w - $nImgW) / 2 + $x, 0);
1045
+                $yImg = $y + 3;
1052 1046
                 $x1 = $x;
1053 1047
                 $y1 = round($yImg + $nImgH + 1, 0);
1054 1048
                 $tw = $w;
1055
-            } elseif ($this->logoAlign=='R') {
1056
-                $nImgW = round($w/3, 0);
1057
-                $nImgH = round($logoHmm * ($nImgW/$logoWmm), 0);
1058
-                $xImg = round($x+($w-(1+$nImgW)), 0);
1059
-                $yImg = round(($h-$nImgH)/2, 0)+$y;
1049
+            } elseif ($this->logoAlign == 'R') {
1050
+                $nImgW = round($w / 3, 0);
1051
+                $nImgH = round($logoHmm * ($nImgW / $logoWmm), 0);
1052
+                $xImg = round($x + ($w - (1 + $nImgW)), 0);
1053
+                $yImg = round(($h - $nImgH) / 2, 0) + $y;
1060 1054
                 $x1 = $x;
1061
-                $y1 = round($h/3+$y, 0);
1062
-                $tw = round(2*$w/3, 0);
1063
-            } elseif ($this->logoAlign=='F') {
1064
-                $nImgH = round($h-5, 0);
1065
-                $nImgW = round($logoWmm * ($nImgH/$logoHmm), 0);
1066
-                $xImg = round(($w-$nImgW)/2+$x, 0);
1067
-                $yImg = $y+3;
1055
+                $y1 = round($h / 3 + $y, 0);
1056
+                $tw = round(2 * $w / 3, 0);
1057
+            } elseif ($this->logoAlign == 'F') {
1058
+                $nImgH = round($h - 5, 0);
1059
+                $nImgW = round($logoWmm * ($nImgH / $logoHmm), 0);
1060
+                $xImg = round(($w - $nImgW) / 2 + $x, 0);
1061
+                $yImg = $y + 3;
1068 1062
                 $x1 = $x;
1069 1063
                 $y1 = round($yImg + $nImgH + 1, 0);
1070 1064
                 $tw = $w;
@@ -1072,7 +1066,7 @@  discard block
 block discarded – undo
1072 1066
             $this->pdf->Image($this->logomarca, $xImg, $yImg, $nImgW, $nImgH);
1073 1067
         } else {
1074 1068
             $x1 = $x;
1075
-            $y1 = round($h/3+$y, 0);
1069
+            $y1 = round($h / 3 + $y, 0);
1076 1070
             $tw = $w;
1077 1071
         }
1078 1072
         // monta as informações apenas se diferente de full logo
@@ -1082,9 +1076,9 @@  discard block
 block discarded – undo
1082 1076
             $texto = $this->emit->getElementsByTagName("xNome")->item(0)->nodeValue;
1083 1077
             $this->pTextBox($x1, $y1, $tw, 8, $texto, $aFont, 'T', 'C', 0, '');
1084 1078
             //endereço
1085
-            $y1 = $y1+5;
1079
+            $y1 = $y1 + 5;
1086 1080
             $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'');
1087
-            $fone = ! empty($this->enderEmit->getElementsByTagName("fone")->item(0)->nodeValue)
1081
+            $fone = !empty($this->enderEmit->getElementsByTagName("fone")->item(0)->nodeValue)
1088 1082
                  ? $this->enderEmit->getElementsByTagName("fone")->item(0)->nodeValue
1089 1083
                  : '';
1090 1084
             $lgr = $this->pSimpleGetValue($this->enderEmit, "xLgr");
@@ -1104,37 +1098,37 @@  discard block
 block discarded – undo
1104 1098
         //####################################################################################
1105 1099
         //coluna central Danfe
1106 1100
         $x += $w;
1107
-        $w=round($maxW * 0.17, 0);//35;
1101
+        $w = round($maxW * 0.17, 0); //35;
1108 1102
         $w2 = $w;
1109 1103
         $h = 32;
1110 1104
         $this->pTextBox($x, $y, $w, $h);
1111 1105
 
1112
-        if (! $this->pNotaCancelada()) {
1106
+        if (!$this->pNotaCancelada()) {
1113 1107
             // A PRINCIPIO NÃO PRECISAVA, POIS A NFE ESTÁ AUTORIZADA,
1114 1108
             // SÓ SE RETIRA O DANFE PARA NOTAS NÃO AUTORIZADAS
1115 1109
             $texto = "DANFE";
1116 1110
             $aFont = array('font'=>$this->fontePadrao, 'size'=>14, 'style'=>'B');
1117
-            $this->pTextBox($x, $y+1, $w, $h, $texto, $aFont, 'T', 'C', 0, '');
1111
+            $this->pTextBox($x, $y + 1, $w, $h, $texto, $aFont, 'T', 'C', 0, '');
1118 1112
             $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'');
1119 1113
             $texto = 'Documento Auxiliar da Nota Fiscal Eletrônica';
1120 1114
             $h = 20;
1121
-            $this->pTextBox($x, $y+6, $w, $h, $texto, $aFont, 'T', 'C', 0, '', false);
1115
+            $this->pTextBox($x, $y + 6, $w, $h, $texto, $aFont, 'T', 'C', 0, '', false);
1122 1116
         }
1123 1117
 
1124 1118
         $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'');
1125 1119
         $texto = '0 - ENTRADA';
1126 1120
         $y1 = $y + 14;
1127 1121
         $h = 8;
1128
-        $this->pTextBox($x+2, $y1, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1122
+        $this->pTextBox($x + 2, $y1, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1129 1123
         $texto = '1 - SAÍDA';
1130 1124
         $y1 = $y + 17;
1131
-        $this->pTextBox($x+2, $y1, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1125
+        $this->pTextBox($x + 2, $y1, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1132 1126
         //tipo de nF
1133 1127
         $aFont = array('font'=>$this->fontePadrao, 'size'=>12, 'style'=>'B');
1134 1128
         $y1 = $y + 13;
1135 1129
         $h = 7;
1136 1130
         $texto = $this->ide->getElementsByTagName('tpNF')->item(0)->nodeValue;
1137
-        $this->pTextBox($x+27, $y1, 5, $h, $texto, $aFont, 'C', 'C', 1, '');
1131
+        $this->pTextBox($x + 27, $y1, 5, $h, $texto, $aFont, 'C', 'C', 1, '');
1138 1132
         //numero da NF
1139 1133
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
1140 1134
         $y1 = $y + 20;
@@ -1156,7 +1150,7 @@  discard block
 block discarded – undo
1156 1150
         //####################################################################################
1157 1151
         //coluna codigo de barras
1158 1152
         $x += $w;
1159
-        $w = ($maxW-$w1-$w2);//85;
1153
+        $w = ($maxW - $w1 - $w2); //85;
1160 1154
         $w3 = $w;
1161 1155
         $h = 32;
1162 1156
         $this->pTextBox($x, $y, $w, $h);
@@ -1165,22 +1159,22 @@  discard block
 block discarded – undo
1165 1159
         $bW = 75;
1166 1160
         $bH = 12;
1167 1161
         //codigo de barras
1168
-        $this->pdf->Code128($x+(($w-$bW)/2), $y+2, $chave_acesso, $bW, $bH);
1162
+        $this->pdf->Code128($x + (($w - $bW) / 2), $y + 2, $chave_acesso, $bW, $bH);
1169 1163
         //linhas divisorias
1170
-        $this->pdf->Line($x, $y+4+$bH, $x+$w, $y+4+$bH);
1171
-        $this->pdf->Line($x, $y+12+$bH, $x+$w, $y+12+$bH);
1164
+        $this->pdf->Line($x, $y + 4 + $bH, $x + $w, $y + 4 + $bH);
1165
+        $this->pdf->Line($x, $y + 12 + $bH, $x + $w, $y + 12 + $bH);
1172 1166
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1173
-        $y1 = $y+4+$bH;
1167
+        $y1 = $y + 4 + $bH;
1174 1168
         $h = 7;
1175 1169
         $texto = 'CHAVE DE ACESSO';
1176 1170
         $this->pTextBox($x, $y1, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1177 1171
         $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B');
1178
-        $y1 = $y+8+$bH;
1172
+        $y1 = $y + 8 + $bH;
1179 1173
         $texto = $this->pFormat($chave_acesso, $this->formatoChave);
1180
-        $this->pTextBox($x+2, $y1, $w-2, $h, $texto, $aFont, 'T', 'C', 0, '');
1181
-        $y1 = $y+12+$bH;
1174
+        $this->pTextBox($x + 2, $y1, $w - 2, $h, $texto, $aFont, 'T', 'C', 0, '');
1175
+        $y1 = $y + 12 + $bH;
1182 1176
         $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'');
1183
-        $chaveContingencia="";
1177
+        $chaveContingencia = "";
1184 1178
         if ($this->pNotaDPEC()) {
1185 1179
             $cabecalhoProtoAutorizacao = 'NÚMERO DE REGISTRO DPEC';
1186 1180
         } else {
@@ -1191,16 +1185,16 @@  discard block
 block discarded – undo
1191 1185
             $chaveContingencia = $this->pGeraChaveAdicionalDeContingencia();
1192 1186
             $this->pdf->SetFillColor(0, 0, 0);
1193 1187
             //codigo de barras
1194
-            $this->pdf->Code128($x+11, $y1+1, $chaveContingencia, $bW*.9, $bH/2);
1188
+            $this->pdf->Code128($x + 11, $y1 + 1, $chaveContingencia, $bW * .9, $bH / 2);
1195 1189
         } else {
1196 1190
             $texto = 'Consulta de autenticidade no portal nacional da NF-e';
1197
-            $this->pTextBox($x+2, $y1, $w-2, $h, $texto, $aFont, 'T', 'C', 0, '');
1198
-            $y1 = $y+16+$bH;
1191
+            $this->pTextBox($x + 2, $y1, $w - 2, $h, $texto, $aFont, 'T', 'C', 0, '');
1192
+            $y1 = $y + 16 + $bH;
1199 1193
             $texto = 'www.nfe.fazenda.gov.br/portal ou no site da Sefaz Autorizadora';
1200 1194
             $this->pTextBox(
1201
-                $x+2,
1195
+                $x + 2,
1202 1196
                 $y1,
1203
-                $w-2,
1197
+                $w - 2,
1204 1198
                 $h,
1205 1199
                 $texto,
1206 1200
                 $aFont,
@@ -1216,7 +1210,7 @@  discard block
 block discarded – undo
1216 1210
         //natureza da operação
1217 1211
         $texto = 'NATUREZA DA OPERAÇÃO';
1218 1212
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1219
-        $w = $w1+$w2;
1213
+        $w = $w1 + $w2;
1220 1214
         $y = $oldY;
1221 1215
         $oldY += $h;
1222 1216
         $x = $oldX;
@@ -1246,7 +1240,7 @@  discard block
 block discarded – undo
1246 1240
                 $cStat = '';
1247 1241
             } else {
1248 1242
                 if (isset($this->nfeProc)) {
1249
-                    $texto = ! empty($this->nfeProc->getElementsByTagName("nProt")->item(0)->nodeValue) ?
1243
+                    $texto = !empty($this->nfeProc->getElementsByTagName("nProt")->item(0)->nodeValue) ?
1250 1244
                             $this->nfeProc->getElementsByTagName("nProt")->item(0)->nodeValue : '';
1251 1245
                     $tsHora = $this->pConvertTime($this->nfeProc->getElementsByTagName("dhRecbto")->item(0)->nodeValue);
1252 1246
                     if ($texto != '') {
@@ -1277,25 +1271,25 @@  discard block
 block discarded – undo
1277 1271
         $texto = 'INSCRIÇÃO ESTADUAL DO SUBST. TRIBUT.';
1278 1272
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1279 1273
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1280
-        $texto = ! empty($this->emit->getElementsByTagName("IEST")->item(0)->nodeValue)
1274
+        $texto = !empty($this->emit->getElementsByTagName("IEST")->item(0)->nodeValue)
1281 1275
              ? $this->emit->getElementsByTagName("IEST")->item(0)->nodeValue
1282 1276
              : '';
1283 1277
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
1284 1278
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1285 1279
         //CNPJ
1286 1280
         $x += $w;
1287
-        $w = ($maxW-(2*$w));
1281
+        $w = ($maxW - (2 * $w));
1288 1282
         $texto = 'CNPJ / CPF';
1289 1283
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1290 1284
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1291 1285
         //Pegando valor do CPF/CNPJ
1292
-        if (! empty($this->emit->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1286
+        if (!empty($this->emit->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1293 1287
             $texto = $this->pFormat(
1294 1288
                 $this->emit->getElementsByTagName("CNPJ")->item(0)->nodeValue,
1295 1289
                 "###.###.###/####-##"
1296 1290
             );
1297 1291
         } else {
1298
-            $texto = ! empty($this->emit->getElementsByTagName("CPF")->item(0)->nodeValue) ?
1292
+            $texto = !empty($this->emit->getElementsByTagName("CPF")->item(0)->nodeValue) ?
1299 1293
                 $this->pFormat(
1300 1294
                     $this->emit->getElementsByTagName("CPF")->item(0)->nodeValue,
1301 1295
                     "###.###.###-##"
@@ -1311,9 +1305,9 @@  discard block
 block discarded – undo
1311 1305
         if ($this->pNotaCancelada()) {
1312 1306
             //101 Cancelamento
1313 1307
             $x = 10;
1314
-            $y = $this->hPrint-130;
1308
+            $y = $this->hPrint - 130;
1315 1309
             $h = 25;
1316
-            $w = $maxW-(2*$x);
1310
+            $w = $maxW - (2 * $x);
1317 1311
             $this->pdf->SetTextColor(90, 90, 90);
1318 1312
             $texto = "NFe CANCELADA";
1319 1313
             $aFont = array('font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B');
@@ -1324,12 +1318,12 @@  discard block
 block discarded – undo
1324 1318
         if ($this->pNotaDPEC() || $this->tpEmis == 4) {
1325 1319
             //DPEC
1326 1320
             $x = 10;
1327
-            $y = $this->hPrint-130;
1321
+            $y = $this->hPrint - 130;
1328 1322
             $h = 25;
1329
-            $w = $maxW-(2*$x);
1323
+            $w = $maxW - (2 * $x);
1330 1324
             $this->pdf->SetTextColor(200, 200, 200);
1331
-            $texto = "DANFE impresso em contingência -\n".
1332
-                     "DPEC regularmente recebido pela Receita\n".
1325
+            $texto = "DANFE impresso em contingência -\n" .
1326
+                     "DPEC regularmente recebido pela Receita\n" .
1333 1327
                      "Federal do Brasil";
1334 1328
             $aFont = array('font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B');
1335 1329
             $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
@@ -1338,22 +1332,22 @@  discard block
 block discarded – undo
1338 1332
         if ($this->pNotaDenegada()) {
1339 1333
             //110 301 302 Denegada
1340 1334
             $x = 10;
1341
-            $y = $this->hPrint-130;
1335
+            $y = $this->hPrint - 130;
1342 1336
             $h = 25;
1343
-            $w = $maxW-(2*$x);
1337
+            $w = $maxW - (2 * $x);
1344 1338
             $this->pdf->SetTextColor(90, 90, 90);
1345 1339
             $texto = "NFe USO DENEGADO";
1346 1340
             $aFont = array('font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B');
1347 1341
             $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1348 1342
             $y += $h;
1349 1343
             $h = 5;
1350
-            $w = $maxW-(2*$x);
1344
+            $w = $maxW - (2 * $x);
1351 1345
             if (isset($this->infProt)) {
1352 1346
                 $xMotivo = $this->infProt->getElementsByTagName("xMotivo")->item(0)->nodeValue;
1353 1347
             } else {
1354 1348
                 $xMotivo = '';
1355 1349
             }
1356
-            $texto = "SEM VALOR FISCAL\n".$xMotivo;
1350
+            $texto = "SEM VALOR FISCAL\n" . $xMotivo;
1357 1351
             $aFont = array('font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B');
1358 1352
             $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1359 1353
             $this->pdf->SetTextColor(0, 0, 0);
@@ -1362,29 +1356,29 @@  discard block
 block discarded – undo
1362 1356
         if ($tpAmb != 1) {
1363 1357
             $x = 10;
1364 1358
             if ($this->orientacao == 'P') {
1365
-                $y = round($this->hPrint*2/3, 0);
1359
+                $y = round($this->hPrint * 2 / 3, 0);
1366 1360
             } else {
1367
-                $y = round($this->hPrint/2, 0);
1361
+                $y = round($this->hPrint / 2, 0);
1368 1362
             }
1369 1363
             $h = 5;
1370
-            $w = $maxW-(2*$x);
1364
+            $w = $maxW - (2 * $x);
1371 1365
             $this->pdf->SetTextColor(90, 90, 90);
1372 1366
             $texto = "SEM VALOR FISCAL";
1373 1367
             $aFont = array('font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B');
1374 1368
             $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1375 1369
             $aFont = array('font'=>$this->fontePadrao, 'size'=>30, 'style'=>'B');
1376 1370
             $texto = "AMBIENTE DE HOMOLOGAÇÃO";
1377
-            $this->pTextBox($x, $y+14, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1371
+            $this->pTextBox($x, $y + 14, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1378 1372
             $this->pdf->SetTextColor(0, 0, 0);
1379 1373
         } else {
1380 1374
             $x = 10;
1381 1375
             if ($this->orientacao == 'P') {
1382
-                $y = round($this->hPrint*2/3, 0);
1376
+                $y = round($this->hPrint * 2 / 3, 0);
1383 1377
             } else {
1384
-                $y = round($this->hPrint/2, 0);
1378
+                $y = round($this->hPrint / 2, 0);
1385 1379
             }//fim orientacao
1386 1380
             $h = 5;
1387
-            $w = $maxW-(2*$x);
1381
+            $w = $maxW - (2 * $x);
1388 1382
             $this->pdf->SetTextColor(90, 90, 90);
1389 1383
             //indicar FALTA DO PROTOCOLO se NFe não for em contingência
1390 1384
             if (($this->tpEmis == 2 || $this->tpEmis == 5) && !$this->pNotaDPEC()) {
@@ -1394,7 +1388,7 @@  discard block
 block discarded – undo
1394 1388
                 $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1395 1389
                 $aFont = array('font'=>$this->fontePadrao, 'size'=>30, 'style'=>'B');
1396 1390
                 $texto = "devido à problemas técnicos";
1397
-                $this->pTextBox($x, $y+12, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1391
+                $this->pTextBox($x, $y + 12, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1398 1392
             } else {
1399 1393
                 if (!isset($this->nfeProc)) {
1400 1394
                     if (!$this->pNotaDPEC()) {
@@ -1405,9 +1399,9 @@  discard block
 block discarded – undo
1405 1399
                     $aFont = array('font'=>$this->fontePadrao, 'size'=>30, 'style'=>'B');
1406 1400
                     $texto = "FALTA PROTOCOLO DE APROVAÇÃO DA SEFAZ";
1407 1401
                     if (!$this->pNotaDPEC()) {
1408
-                        $this->pTextBox($x, $y+12, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1402
+                        $this->pTextBox($x, $y + 12, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1409 1403
                     } else {
1410
-                        $this->pTextBox($x, $y+25, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1404
+                        $this->pTextBox($x, $y + 25, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1411 1405
                     }
1412 1406
                 }//fim nefProc
1413 1407
             }//fim tpEmis
@@ -1442,7 +1436,7 @@  discard block
 block discarded – undo
1442 1436
         $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
1443 1437
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1444 1438
         //NOME / RAZÃO SOCIAL
1445
-        $w = round($maxW*0.61, 0);
1439
+        $w = round($maxW * 0.61, 0);
1446 1440
         $w1 = $w;
1447 1441
         $y += 3;
1448 1442
         $texto = 'NOME / RAZÃO SOCIAL';
@@ -1457,19 +1451,19 @@  discard block
 block discarded – undo
1457 1451
         }
1458 1452
         //CNPJ / CPF
1459 1453
         $x += $w;
1460
-        $w = round($maxW*0.23, 0);
1454
+        $w = round($maxW * 0.23, 0);
1461 1455
         $w2 = $w;
1462 1456
         $texto = 'CNPJ / CPF';
1463 1457
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1464 1458
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1465 1459
         //Pegando valor do CPF/CNPJ
1466
-        if (! empty($this->dest->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1460
+        if (!empty($this->dest->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1467 1461
             $texto = $this->pFormat(
1468 1462
                 $this->dest->getElementsByTagName("CNPJ")->item(0)->nodeValue,
1469 1463
                 "###.###.###/####-##"
1470 1464
             );
1471 1465
         } else {
1472
-            $texto = ! empty($this->dest->getElementsByTagName("CPF")->item(0)->nodeValue) ?
1466
+            $texto = !empty($this->dest->getElementsByTagName("CPF")->item(0)->nodeValue) ?
1473 1467
                     $this->pFormat(
1474 1468
                         $this->dest->getElementsByTagName("CPF")->item(0)->nodeValue,
1475 1469
                         "###.###.###-##"
@@ -1479,15 +1473,15 @@  discard block
 block discarded – undo
1479 1473
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1480 1474
         //DATA DA EMISSÃO
1481 1475
         $x += $w;
1482
-        $w = $maxW-($w1+$w2);
1476
+        $w = $maxW - ($w1 + $w2);
1483 1477
         $wx = $w;
1484 1478
         $texto = 'DATA DA EMISSÃO';
1485 1479
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1486 1480
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1487
-        $dEmi = ! empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
1481
+        $dEmi = !empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
1488 1482
                 $this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue : '';
1489 1483
         if ($dEmi == '') {
1490
-            $dEmi = ! empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
1484
+            $dEmi = !empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
1491 1485
                     $this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue : '';
1492 1486
             $aDemi = explode('T', $dEmi);
1493 1487
             $dEmi = $aDemi[0];
@@ -1500,7 +1494,7 @@  discard block
 block discarded – undo
1500 1494
             $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 1, '');
1501 1495
         }
1502 1496
         //ENDEREÇO
1503
-        $w = round($maxW*0.47, 0);
1497
+        $w = round($maxW * 0.47, 0);
1504 1498
         $w1 = $w;
1505 1499
         $y += $h;
1506 1500
         $x = $oldX;
@@ -1515,7 +1509,7 @@  discard block
 block discarded – undo
1515 1509
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 0, '', true);
1516 1510
         //BAIRRO / DISTRITO
1517 1511
         $x += $w;
1518
-        $w = round($maxW*0.21, 0);
1512
+        $w = round($maxW * 0.21, 0);
1519 1513
         $w2 = $w;
1520 1514
         $texto = 'BAIRRO / DISTRITO';
1521 1515
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
@@ -1525,12 +1519,12 @@  discard block
 block discarded – undo
1525 1519
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1526 1520
         //CEP
1527 1521
         $x += $w;
1528
-        $w = $maxW-$w1-$w2-$wx;
1522
+        $w = $maxW - $w1 - $w2 - $wx;
1529 1523
         $w2 = $w;
1530 1524
         $texto = 'CEP';
1531 1525
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1532 1526
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1533
-        $texto = ! empty($this->dest->getElementsByTagName("CEP")->item(0)->nodeValue) ?
1527
+        $texto = !empty($this->dest->getElementsByTagName("CEP")->item(0)->nodeValue) ?
1534 1528
                 $this->dest->getElementsByTagName("CEP")->item(0)->nodeValue : '';
1535 1529
         $texto = $this->pFormat($texto, "#####-###");
1536 1530
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
@@ -1541,10 +1535,10 @@  discard block
 block discarded – undo
1541 1535
         $texto = 'DATA DA SAÍDA/ENTRADA';
1542 1536
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1543 1537
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1544
-        $dSaiEnt = ! empty($this->ide->getElementsByTagName("dSaiEnt")->item(0)->nodeValue) ?
1538
+        $dSaiEnt = !empty($this->ide->getElementsByTagName("dSaiEnt")->item(0)->nodeValue) ?
1545 1539
                 $this->ide->getElementsByTagName("dSaiEnt")->item(0)->nodeValue : '';
1546 1540
         if ($dSaiEnt == '') {
1547
-            $dSaiEnt = ! empty($this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue) ?
1541
+            $dSaiEnt = !empty($this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue) ?
1548 1542
                     $this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue : '';
1549 1543
             $aDsaient = explode('T', $dSaiEnt);
1550 1544
             $dSaiEnt = $aDsaient[0];
@@ -1561,7 +1555,7 @@  discard block
 block discarded – undo
1561 1555
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1562 1556
         $texto = $this->dest->getElementsByTagName("xMun")->item(0)->nodeValue;
1563 1557
         if (strtoupper(trim($texto)) == "EXTERIOR" && $this->dest->getElementsByTagName("xPais")->length > 0) {
1564
-            $texto .= " - " .  $this->dest->getElementsByTagName("xPais")->item(0)->nodeValue;
1558
+            $texto .= " - " . $this->dest->getElementsByTagName("xPais")->item(0)->nodeValue;
1565 1559
         }
1566 1560
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
1567 1561
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 0, '');
@@ -1576,18 +1570,18 @@  discard block
 block discarded – undo
1576 1570
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1577 1571
         //FONE / FAX
1578 1572
         $x += $w;
1579
-        $w = round(($maxW -$w1-$wx-8)/2, 0);
1573
+        $w = round(($maxW - $w1 - $wx - 8) / 2, 0);
1580 1574
         $w3 = $w;
1581 1575
         $texto = 'FONE / FAX';
1582 1576
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1583 1577
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1584
-        $texto = ! empty($this->dest->getElementsByTagName("fone")->item(0)->nodeValue) ?
1578
+        $texto = !empty($this->dest->getElementsByTagName("fone")->item(0)->nodeValue) ?
1585 1579
                 $this->dest->getElementsByTagName("fone")->item(0)->nodeValue : '';
1586 1580
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
1587 1581
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1588 1582
         //INSCRIÇÃO ESTADUAL
1589 1583
         $x += $w;
1590
-        $w = $maxW -$w1-$wx-8-$w3;
1584
+        $w = $maxW - $w1 - $wx - 8 - $w3;
1591 1585
         $texto = 'INSCRIÇÃO ESTADUAL';
1592 1586
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1593 1587
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -1601,10 +1595,10 @@  discard block
 block discarded – undo
1601 1595
         $texto = 'HORA DA SAÍDA/ENTRADA';
1602 1596
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1603 1597
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1604
-        $hSaiEnt = ! empty($this->ide->getElementsByTagName("hSaiEnt")->item(0)->nodeValue) ?
1598
+        $hSaiEnt = !empty($this->ide->getElementsByTagName("hSaiEnt")->item(0)->nodeValue) ?
1605 1599
                 $this->ide->getElementsByTagName("hSaiEnt")->item(0)->nodeValue : '';
1606 1600
         if ($hSaiEnt == '') {
1607
-            $dhSaiEnt = ! empty($this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue) ?
1601
+            $dhSaiEnt = !empty($this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue) ?
1608 1602
                     $this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue : '';
1609 1603
             $tsDhSaiEnt = $this->pConvertTime($dhSaiEnt);
1610 1604
             if ($tsDhSaiEnt != '') {
@@ -1682,7 +1676,7 @@  discard block
 block discarded – undo
1682 1676
     protected function pFaturaDANFE($x, $y)
1683 1677
     {
1684 1678
         $linha = 1;
1685
-        $h = 8+3;
1679
+        $h = 8 + 3;
1686 1680
         $oldx = $x;
1687 1681
         $textoFatura = $this->pGetTextoFatura();
1688 1682
         //verificar se existem duplicatas
@@ -1703,27 +1697,27 @@  discard block
 block discarded – undo
1703 1697
             $dupcont = 0;
1704 1698
             $nFat = $this->dup->length;
1705 1699
             if ($textoFatura !== "" && $this->exibirTextoFatura) {
1706
-                $myH=6;
1700
+                $myH = 6;
1707 1701
                 $myW = $this->wPrint;
1708 1702
                 if ($this->orientacao == 'L') {
1709 1703
                     $myW -= $this->wCanhoto;
1710 1704
                 }
1711 1705
                 $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'');
1712 1706
                 $this->pTextBox($x, $y, $myW, $myH, $textoFatura, $aFont, 'C', 'L', 1, '');
1713
-                $y+=$myH+1;
1707
+                $y += $myH + 1;
1714 1708
             }
1715 1709
             if ($this->orientacao == 'P') {
1716
-                $w = round($this->wPrint/7.018, 0)-1;
1710
+                $w = round($this->wPrint / 7.018, 0) - 1;
1717 1711
             } else {
1718 1712
                 $w = 28;
1719 1713
             }
1720 1714
             $increm = 1;
1721 1715
             foreach ($this->dup as $k => $d) {
1722
-                $nDup = ! empty($this->dup->item($k)->getElementsByTagName('nDup')->item(0)->nodeValue) ?
1716
+                $nDup = !empty($this->dup->item($k)->getElementsByTagName('nDup')->item(0)->nodeValue) ?
1723 1717
                         $this->dup->item($k)->getElementsByTagName('nDup')->item(0)->nodeValue : '';
1724
-                $dDup = ! empty($this->dup->item($k)->getElementsByTagName('dVenc')->item(0)->nodeValue) ?
1718
+                $dDup = !empty($this->dup->item($k)->getElementsByTagName('dVenc')->item(0)->nodeValue) ?
1725 1719
                         $this->pYmd2dmy($this->dup->item($k)->getElementsByTagName('dVenc')->item(0)->nodeValue) : '';
1726
-                $vDup = ! empty($this->dup->item($k)->getElementsByTagName('vDup')->item(0)->nodeValue) ?
1720
+                $vDup = !empty($this->dup->item($k)->getElementsByTagName('vDup')->item(0)->nodeValue) ?
1727 1721
                         'R$ ' . number_format(
1728 1722
                             $this->dup->item($k)->getElementsByTagName('vDup')->item(0)->nodeValue,
1729 1723
                             2,
@@ -1732,14 +1726,14 @@  discard block
 block discarded – undo
1732 1726
                         ) : '';
1733 1727
                 $h = 8;
1734 1728
                 $texto = '';
1735
-                if ($nDup!='0' && $nDup!='') {
1729
+                if ($nDup != '0' && $nDup != '') {
1736 1730
                     $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1737 1731
                     $this->pTextBox($x, $y, $w, $h, 'Num.', $aFont, 'T', 'L', 1, '');
1738 1732
                     $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
1739 1733
                     $this->pTextBox($x, $y, $w, $h, $nDup, $aFont, 'T', 'R', 0, '');
1740 1734
                 } else {
1741 1735
                     $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1742
-                    $this->pTextBox($x, $y, $w, $h, ($dupcont+1)."", $aFont, 'T', 'L', 1, '');
1736
+                    $this->pTextBox($x, $y, $w, $h, ($dupcont + 1) . "", $aFont, 'T', 'L', 1, '');
1743 1737
                 }
1744 1738
                 $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1745 1739
                 $this->pTextBox($x, $y, $w, $h, 'Venc.', $aFont, 'C', 'L', 0, '');
@@ -1749,7 +1743,7 @@  discard block
 block discarded – undo
1749 1743
                 $this->pTextBox($x, $y, $w, $h, 'Valor', $aFont, 'B', 'L', 0, '');
1750 1744
                 $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
1751 1745
                 $this->pTextBox($x, $y, $w, $h, $vDup, $aFont, 'B', 'R', 0, '');
1752
-                $x += $w+$increm;
1746
+                $x += $w + $increm;
1753 1747
                 $dupcont += 1;
1754 1748
                 if ($this->orientacao == 'P') {
1755 1749
                     $maxDupCont = 6;
@@ -1771,10 +1765,10 @@  discard block
 block discarded – undo
1771 1765
                 $y -= 9;
1772 1766
                 $linha--;
1773 1767
             }
1774
-            return ($y+$h);
1768
+            return ($y + $h);
1775 1769
         } else {
1776 1770
             $linha = 0;
1777
-            return ($y-2);
1771
+            return ($y - 2);
1778 1772
         }
1779 1773
     } //fim da função faturaDANFE
1780 1774
 
@@ -1886,7 +1880,7 @@  discard block
 block discarded – undo
1886 1880
         }
1887 1881
         $x = $this->pImpostoDanfeHelper($x, $y, $w, $h, "V. TOTAL DA NOTA", "vNF");
1888 1882
 
1889
-        return ($y+$h);
1883
+        return ($y + $h);
1890 1884
     } //fim impostoDANFE
1891 1885
 
1892 1886
     /**
@@ -1914,13 +1908,13 @@  discard block
 block discarded – undo
1914 1908
         $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
1915 1909
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1916 1910
         //NOME / RAZÃO SOCIAL
1917
-        $w1 = $maxW*0.29;
1911
+        $w1 = $maxW * 0.29;
1918 1912
         $y += 3;
1919 1913
         $texto = 'NOME / RAZÃO SOCIAL';
1920 1914
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1921 1915
         $this->pTextBox($x, $y, $w1, $h, $texto, $aFont, 'T', 'L', 1, '');
1922 1916
         if (isset($this->transporta)) {
1923
-            $texto = ! empty($this->transporta->getElementsByTagName("xNome")->item(0)->nodeValue) ?
1917
+            $texto = !empty($this->transporta->getElementsByTagName("xNome")->item(0)->nodeValue) ?
1924 1918
                     $this->transporta->getElementsByTagName("xNome")->item(0)->nodeValue : '';
1925 1919
         } else {
1926 1920
             $texto = '';
@@ -1929,11 +1923,11 @@  discard block
 block discarded – undo
1929 1923
         $this->pTextBox($x, $y, $w1, $h, $texto, $aFont, 'B', 'L', 0, '');
1930 1924
         //FRETE POR CONTA
1931 1925
         $x += $w1;
1932
-        $w2 = $maxW*0.15;
1926
+        $w2 = $maxW * 0.15;
1933 1927
         $texto = 'FRETE';
1934 1928
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1935 1929
         $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
1936
-        $tipoFrete = ! empty($this->transp->getElementsByTagName("modFrete")->item(0)->nodeValue) ?
1930
+        $tipoFrete = !empty($this->transp->getElementsByTagName("modFrete")->item(0)->nodeValue) ?
1937 1931
                 $this->transp->getElementsByTagName("modFrete")->item(0)->nodeValue : '0';
1938 1932
         switch ($tipoFrete) {
1939 1933
             case 0:
@@ -1963,7 +1957,7 @@  discard block
 block discarded – undo
1963 1957
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1964 1958
         $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
1965 1959
         if (isset($this->veicTransp)) {
1966
-            $texto = ! empty($this->veicTransp->getElementsByTagName("RNTC")->item(0)->nodeValue) ?
1960
+            $texto = !empty($this->veicTransp->getElementsByTagName("RNTC")->item(0)->nodeValue) ?
1967 1961
                     $this->veicTransp->getElementsByTagName("RNTC")->item(0)->nodeValue : '';
1968 1962
         } else {
1969 1963
             $texto = '';
@@ -1976,10 +1970,10 @@  discard block
 block discarded – undo
1976 1970
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1977 1971
         $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
1978 1972
         if (isset($this->veicTransp)) {
1979
-            $texto = ! empty($this->veicTransp->getElementsByTagName("placa")->item(0)->nodeValue) ?
1973
+            $texto = !empty($this->veicTransp->getElementsByTagName("placa")->item(0)->nodeValue) ?
1980 1974
                     $this->veicTransp->getElementsByTagName("placa")->item(0)->nodeValue : '';
1981 1975
         } elseif (isset($this->reboque)) {
1982
-            $texto = ! empty($this->reboque->getElementsByTagName("placa")->item(0)->nodeValue) ?
1976
+            $texto = !empty($this->reboque->getElementsByTagName("placa")->item(0)->nodeValue) ?
1983 1977
                     $this->reboque->getElementsByTagName("placa")->item(0)->nodeValue : '';
1984 1978
         } else {
1985 1979
             $texto = '';
@@ -1988,15 +1982,15 @@  discard block
 block discarded – undo
1988 1982
         $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'B', 'C', 0, '');
1989 1983
         //UF
1990 1984
         $x += $w2;
1991
-        $w3 = round($maxW*0.04, 0);
1985
+        $w3 = round($maxW * 0.04, 0);
1992 1986
         $texto = 'UF';
1993 1987
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1994 1988
         $this->pTextBox($x, $y, $w3, $h, $texto, $aFont, 'T', 'L', 1, '');
1995 1989
         if (isset($this->veicTransp)) {
1996
-            $texto = ! empty($this->veicTransp->getElementsByTagName("UF")->item(0)->nodeValue) ?
1990
+            $texto = !empty($this->veicTransp->getElementsByTagName("UF")->item(0)->nodeValue) ?
1997 1991
                     $this->veicTransp->getElementsByTagName("UF")->item(0)->nodeValue : '';
1998 1992
         } elseif (isset($this->reboque)) {
1999
-            $texto = ! empty($this->reboque->getElementsByTagName("UF")->item(0)->nodeValue) ?
1993
+            $texto = !empty($this->reboque->getElementsByTagName("UF")->item(0)->nodeValue) ?
2000 1994
                     $this->reboque->getElementsByTagName("UF")->item(0)->nodeValue : '';
2001 1995
         } else {
2002 1996
             $texto = '';
@@ -2005,18 +1999,18 @@  discard block
 block discarded – undo
2005 1999
         $this->pTextBox($x, $y, $w3, $h, $texto, $aFont, 'B', 'C', 0, '');
2006 2000
         //CNPJ / CPF
2007 2001
         $x += $w3;
2008
-        $w = $maxW-($w1+3*$w2+$w3);
2002
+        $w = $maxW - ($w1 + 3 * $w2 + $w3);
2009 2003
         $texto = 'CNPJ / CPF';
2010 2004
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2011 2005
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
2012 2006
         if (isset($this->transporta)) {
2013
-            $texto = ! empty($this->transporta->getElementsByTagName("CNPJ")->item(0)->nodeValue) ?
2007
+            $texto = !empty($this->transporta->getElementsByTagName("CNPJ")->item(0)->nodeValue) ?
2014 2008
                     $this->pFormat(
2015 2009
                         $this->transporta->getElementsByTagName("CNPJ")->item(0)->nodeValue,
2016 2010
                         "##.###.###/####-##"
2017 2011
                     ) : '';
2018 2012
             if ($texto == '') {
2019
-                $texto = ! empty($this->transporta->getElementsByTagName("CPF")->item(0)->nodeValue) ?
2013
+                $texto = !empty($this->transporta->getElementsByTagName("CPF")->item(0)->nodeValue) ?
2020 2014
                         $this->pFormat(
2021 2015
                             $this->transporta->getElementsByTagName("CPF")->item(0)->nodeValue,
2022 2016
                             "###.###.###-##"
@@ -2032,12 +2026,12 @@  discard block
 block discarded – undo
2032 2026
         $y += $h;
2033 2027
         $x = $oldX;
2034 2028
         $h = 7;
2035
-        $w1 = $maxW*0.44;
2029
+        $w1 = $maxW * 0.44;
2036 2030
         $texto = 'ENDEREÇO';
2037 2031
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2038 2032
         $this->pTextBox($x, $y, $w1, $h, $texto, $aFont, 'T', 'L', 1, '');
2039 2033
         if (isset($this->transporta)) {
2040
-            $texto = ! empty($this->transporta->getElementsByTagName("xEnder")->item(0)->nodeValue) ?
2034
+            $texto = !empty($this->transporta->getElementsByTagName("xEnder")->item(0)->nodeValue) ?
2041 2035
                     $this->transporta->getElementsByTagName("xEnder")->item(0)->nodeValue : '';
2042 2036
         } else {
2043 2037
             $texto = '';
@@ -2046,12 +2040,12 @@  discard block
 block discarded – undo
2046 2040
         $this->pTextBox($x, $y, $w1, $h, $texto, $aFont, 'B', 'L', 0, '');
2047 2041
         //MUNICÍPIO
2048 2042
         $x += $w1;
2049
-        $w2 = round($maxW*0.30, 0);
2043
+        $w2 = round($maxW * 0.30, 0);
2050 2044
         $texto = 'MUNICÍPIO';
2051 2045
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2052 2046
         $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
2053 2047
         if (isset($this->transporta)) {
2054
-            $texto = ! empty($this->transporta->getElementsByTagName("xMun")->item(0)->nodeValue) ?
2048
+            $texto = !empty($this->transporta->getElementsByTagName("xMun")->item(0)->nodeValue) ?
2055 2049
                     $this->transporta->getElementsByTagName("xMun")->item(0)->nodeValue : '';
2056 2050
         } else {
2057 2051
             $texto = '';
@@ -2060,12 +2054,12 @@  discard block
 block discarded – undo
2060 2054
         $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'B', 'C', 0, '');
2061 2055
         //UF
2062 2056
         $x += $w2;
2063
-        $w3 = round($maxW*0.04, 0);
2057
+        $w3 = round($maxW * 0.04, 0);
2064 2058
         $texto = 'UF';
2065 2059
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2066 2060
         $this->pTextBox($x, $y, $w3, $h, $texto, $aFont, 'T', 'L', 1, '');
2067 2061
         if (isset($this->transporta)) {
2068
-            $texto = ! empty($this->transporta->getElementsByTagName("UF")->item(0)->nodeValue) ?
2062
+            $texto = !empty($this->transporta->getElementsByTagName("UF")->item(0)->nodeValue) ?
2069 2063
                     $this->transporta->getElementsByTagName("UF")->item(0)->nodeValue : '';
2070 2064
         } else {
2071 2065
             $texto = '';
@@ -2074,13 +2068,13 @@  discard block
 block discarded – undo
2074 2068
         $this->pTextBox($x, $y, $w3, $h, $texto, $aFont, 'B', 'C', 0, '');
2075 2069
         //INSCRIÇÃO ESTADUAL
2076 2070
         $x += $w3;
2077
-        $w = $maxW-($w1+$w2+$w3);
2071
+        $w = $maxW - ($w1 + $w2 + $w3);
2078 2072
         $texto = 'INSCRIÇÃO ESTADUAL';
2079 2073
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2080 2074
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
2081 2075
         $texto = '';
2082 2076
         if (isset($this->transporta)) {
2083
-            if (! empty($this->transporta->getElementsByTagName("IE")->item(0)->nodeValue)) {
2077
+            if (!empty($this->transporta->getElementsByTagName("IE")->item(0)->nodeValue)) {
2084 2078
                 $texto = $this->transporta->getElementsByTagName("IE")->item(0)->nodeValue;
2085 2079
             }
2086 2080
         }
@@ -2093,16 +2087,16 @@  discard block
 block discarded – undo
2093 2087
         $marca = '';
2094 2088
         $numero = '';
2095 2089
         $texto = '';
2096
-        $pesoBruto=0;
2097
-        $pesoLiquido=0;
2090
+        $pesoBruto = 0;
2091
+        $pesoLiquido = 0;
2098 2092
         foreach ($volumes as $volume) {
2099
-            $quantidade += ! empty($volume->getElementsByTagName("qVol")->item(0)->nodeValue) ?
2093
+            $quantidade += !empty($volume->getElementsByTagName("qVol")->item(0)->nodeValue) ?
2100 2094
                     $volume->getElementsByTagName("qVol")->item(0)->nodeValue : 0;
2101
-            $pesoBruto += ! empty($volume->getElementsByTagName("pesoB")->item(0)->nodeValue) ?
2095
+            $pesoBruto += !empty($volume->getElementsByTagName("pesoB")->item(0)->nodeValue) ?
2102 2096
                     $volume->getElementsByTagName("pesoB")->item(0)->nodeValue : 0;
2103
-            $pesoLiquido += ! empty($volume->getElementsByTagName("pesoL")->item(0)->nodeValue) ?
2097
+            $pesoLiquido += !empty($volume->getElementsByTagName("pesoL")->item(0)->nodeValue) ?
2104 2098
                     $volume->getElementsByTagName("pesoL")->item(0)->nodeValue : 0;
2105
-            $texto = ! empty($this->transp->getElementsByTagName("esp")->item(0)->nodeValue) ?
2099
+            $texto = !empty($this->transp->getElementsByTagName("esp")->item(0)->nodeValue) ?
2106 2100
                     $this->transp->getElementsByTagName("esp")->item(0)->nodeValue : '';
2107 2101
             if ($texto != $especie && $especie != '') {
2108 2102
                 //tem várias especies
@@ -2110,7 +2104,7 @@  discard block
 block discarded – undo
2110 2104
             } else {
2111 2105
                 $especie = $texto;
2112 2106
             }
2113
-            $texto = ! empty($this->transp->getElementsByTagName("marca")->item(0)->nodeValue) ?
2107
+            $texto = !empty($this->transp->getElementsByTagName("marca")->item(0)->nodeValue) ?
2114 2108
                     $this->transp->getElementsByTagName("marca")->item(0)->nodeValue : '';
2115 2109
             if ($texto != $marca && $marca != '') {
2116 2110
                 //tem várias especies
@@ -2118,7 +2112,7 @@  discard block
 block discarded – undo
2118 2112
             } else {
2119 2113
                 $marca = $texto;
2120 2114
             }
2121
-            $texto = ! empty($this->transp->getElementsByTagName("nVol")->item(0)->nodeValue) ?
2115
+            $texto = !empty($this->transp->getElementsByTagName("nVol")->item(0)->nodeValue) ?
2122 2116
                     $this->transp->getElementsByTagName("nVol")->item(0)->nodeValue : '';
2123 2117
             if ($texto != $numero && $numero != '') {
2124 2118
                 //tem várias especies
@@ -2133,7 +2127,7 @@  discard block
 block discarded – undo
2133 2127
         $y += $h;
2134 2128
         $x = $oldX;
2135 2129
         $h = 7;
2136
-        $w1 = round($maxW*0.10, 0);
2130
+        $w1 = round($maxW * 0.10, 0);
2137 2131
         $texto = 'QUANTIDADE';
2138 2132
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2139 2133
         $this->pTextBox($x, $y, $w1, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -2144,7 +2138,7 @@  discard block
 block discarded – undo
2144 2138
         }
2145 2139
         //ESPÉCIE
2146 2140
         $x += $w1;
2147
-        $w2 = round($maxW*0.17, 0);
2141
+        $w2 = round($maxW * 0.17, 0);
2148 2142
         $texto = 'ESPÉCIE';
2149 2143
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2150 2144
         $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -2156,7 +2150,7 @@  discard block
 block discarded – undo
2156 2150
         $texto = 'MARCA';
2157 2151
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2158 2152
         $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
2159
-        $texto = ! empty($this->transp->getElementsByTagName("marca")->item(0)->nodeValue) ?
2153
+        $texto = !empty($this->transp->getElementsByTagName("marca")->item(0)->nodeValue) ?
2160 2154
                 $this->transp->getElementsByTagName("marca")->item(0)->nodeValue : '';
2161 2155
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
2162 2156
         $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'B', 'C', 0, '');
@@ -2170,7 +2164,7 @@  discard block
 block discarded – undo
2170 2164
         $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'B', 'C', 0, '');
2171 2165
         //PESO BRUTO
2172 2166
         $x += $w2;
2173
-        $w3 = round($maxW*0.20, 0);
2167
+        $w3 = round($maxW * 0.20, 0);
2174 2168
         $texto = 'PESO BRUTO';
2175 2169
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2176 2170
         $this->pTextBox($x, $y, $w3, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -2183,7 +2177,7 @@  discard block
 block discarded – undo
2183 2177
         $this->pTextBox($x, $y, $w3, $h, $texto, $aFont, 'B', 'R', 0, '');
2184 2178
         //PESO LÍQUIDO
2185 2179
         $x += $w3;
2186
-        $w = $maxW -($w1+3*$w2+$w3);
2180
+        $w = $maxW - ($w1 + 3 * $w2 + $w3);
2187 2181
         $texto = 'PESO LÍQUIDO';
2188 2182
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2189 2183
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -2194,7 +2188,7 @@  discard block
 block discarded – undo
2194 2188
         }
2195 2189
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
2196 2190
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'R', 0, '');
2197
-        return ($y+$h);
2191
+        return ($y + $h);
2198 2192
     } //fim transporteDANFE
2199 2193
 
2200 2194
 
@@ -2206,7 +2200,7 @@  discard block
 block discarded – undo
2206 2200
             return "";
2207 2201
         }
2208 2202
         $valor_original = $valor_original->nodeValue;
2209
-        $valor = ! empty($valor_original) ? number_format($valor_original, 2, ",", ".") : '';
2203
+        $valor = !empty($valor_original) ? number_format($valor_original, 2, ",", ".") : '';
2210 2204
 
2211 2205
         if ($valor != "") {
2212 2206
             return sprintf($formato, $valor);
@@ -2244,13 +2238,13 @@  discard block
 block discarded – undo
2244 2238
             $impostos .= $this->pDescricaoProdutoHelper($ICMSUFDest, "vICMSUFDest", " vICMSUFDest=%s");
2245 2239
             $impostos .= $this->pDescricaoProdutoHelper($ICMSUFDest, "vICMSUFRemet", " vICMSUFRemet=%s");
2246 2240
         }
2247
-        $infAdProd = ! empty($itemProd->getElementsByTagName('infAdProd')->item(0)->nodeValue) ?
2241
+        $infAdProd = !empty($itemProd->getElementsByTagName('infAdProd')->item(0)->nodeValue) ?
2248 2242
                 substr($this->pAnfavea($itemProd->getElementsByTagName('infAdProd')->item(0)->nodeValue), 0, 500) : '';
2249
-        if (! empty($infAdProd)) {
2243
+        if (!empty($infAdProd)) {
2250 2244
             $infAdProd = trim($infAdProd);
2251 2245
             $infAdProd .= ' ';
2252 2246
         }
2253
-        $loteTxt ='';
2247
+        $loteTxt = '';
2254 2248
         $rastro = $prod->getElementsByTagName("med");
2255 2249
         if (!isset($rastro)) {
2256 2250
             $rastro = $prod->getElementsByTagName("rastro");
@@ -2266,14 +2260,14 @@  discard block
 block discarded – undo
2266 2260
                 $i++;
2267 2261
             }
2268 2262
             if ($loteTxt != '') {
2269
-                $loteTxt.= ' ';
2263
+                $loteTxt .= ' ';
2270 2264
             }
2271 2265
         }
2272 2266
         //NT2013.006 FCI
2273
-        $nFCI = (! empty($itemProd->getElementsByTagName('nFCI')->item(0)->nodeValue)) ?
2274
-                ' FCI:'.$itemProd->getElementsByTagName('nFCI')->item(0)->nodeValue : '';
2275
-        $tmp_ad=$infAdProd . ($this->descProdInfoComplemento ? $loteTxt . $impostos . $nFCI : '');
2276
-        $texto = $prod->getElementsByTagName("xProd")->item(0)->nodeValue . (strlen($tmp_ad)!=0?"\n    ".$tmp_ad:'');
2267
+        $nFCI = (!empty($itemProd->getElementsByTagName('nFCI')->item(0)->nodeValue)) ?
2268
+                ' FCI:' . $itemProd->getElementsByTagName('nFCI')->item(0)->nodeValue : '';
2269
+        $tmp_ad = $infAdProd . ($this->descProdInfoComplemento ? $loteTxt . $impostos . $nFCI : '');
2270
+        $texto = $prod->getElementsByTagName("xProd")->item(0)->nodeValue . (strlen($tmp_ad) != 0 ? "\n    " . $tmp_ad : '');
2277 2271
         if ($this->descProdQuebraLinha) {
2278 2272
             $texto = str_replace(";", "\n", $texto);
2279 2273
         }
@@ -2321,104 +2315,104 @@  discard block
 block discarded – undo
2321 2315
         // cabecalho LOOP COM OS DADOS DOS PRODUTOS
2322 2316
         //CÓDIGO PRODUTO
2323 2317
         $texto = "CÓDIGO PRODUTO";
2324
-        $w1 = round($w*0.09, 0);
2318
+        $w1 = round($w * 0.09, 0);
2325 2319
         $h = 4;
2326 2320
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2327 2321
         $this->pTextBox($x, $y, $w1, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2328
-        $this->pdf->Line($x+$w1, $y, $x+$w1, $y+$hmax);
2322
+        $this->pdf->Line($x + $w1, $y, $x + $w1, $y + $hmax);
2329 2323
         //DESCRIÇÃO DO PRODUTO / SERVIÇO
2330 2324
         $x += $w1;
2331
-        $w2 = round($w*0.28, 0);
2325
+        $w2 = round($w * 0.28, 0);
2332 2326
         $texto = 'DESCRIÇÃO DO PRODUTO / SERVIÇO';
2333 2327
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2334 2328
         $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2335
-        $this->pdf->Line($x+$w2, $y, $x+$w2, $y+$hmax);
2329
+        $this->pdf->Line($x + $w2, $y, $x + $w2, $y + $hmax);
2336 2330
         //NCM/SH
2337 2331
         $x += $w2;
2338
-        $w3 = round($w*0.06, 0);
2332
+        $w3 = round($w * 0.06, 0);
2339 2333
         $texto = 'NCM/SH';
2340 2334
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2341 2335
         $this->pTextBox($x, $y, $w3, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2342
-        $this->pdf->Line($x+$w3, $y, $x+$w3, $y+$hmax);
2336
+        $this->pdf->Line($x + $w3, $y, $x + $w3, $y + $hmax);
2343 2337
         //O/CST ou O/CSOSN
2344 2338
         $x += $w3;
2345
-        $w4 = round($w*0.05, 0);
2346
-        $texto = 'O/CSOSN';//Regime do Simples CRT = 1 ou CRT = 2
2339
+        $w4 = round($w * 0.05, 0);
2340
+        $texto = 'O/CSOSN'; //Regime do Simples CRT = 1 ou CRT = 2
2347 2341
         if ($this->pSimpleGetValue($this->emit, 'CRT') == '3') {
2348
-             $texto = 'O/CST';//Regime Normal
2342
+             $texto = 'O/CST'; //Regime Normal
2349 2343
         }
2350 2344
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2351 2345
         $this->pTextBox($x, $y, $w4, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2352
-        $this->pdf->Line($x+$w4, $y, $x+$w4, $y+$hmax);
2346
+        $this->pdf->Line($x + $w4, $y, $x + $w4, $y + $hmax);
2353 2347
         //CFOP
2354 2348
         $x += $w4;
2355
-        $w5 = round($w*0.04, 0);
2349
+        $w5 = round($w * 0.04, 0);
2356 2350
         $texto = 'CFOP';
2357 2351
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2358 2352
         $this->pTextBox($x, $y, $w5, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2359
-        $this->pdf->Line($x+$w5, $y, $x+$w5, $y+$hmax);
2353
+        $this->pdf->Line($x + $w5, $y, $x + $w5, $y + $hmax);
2360 2354
         //UN
2361 2355
         $x += $w5;
2362
-        $w6 = round($w*0.03, 0);
2356
+        $w6 = round($w * 0.03, 0);
2363 2357
         $texto = 'UN';
2364 2358
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2365 2359
         $this->pTextBox($x, $y, $w6, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2366
-        $this->pdf->Line($x+$w6, $y, $x+$w6, $y+$hmax);
2360
+        $this->pdf->Line($x + $w6, $y, $x + $w6, $y + $hmax);
2367 2361
         //QUANT
2368 2362
         $x += $w6;
2369
-        $w7 = round($w*0.07, 0);
2363
+        $w7 = round($w * 0.07, 0);
2370 2364
         $texto = 'QUANT';
2371 2365
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2372 2366
         $this->pTextBox($x, $y, $w7, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2373
-        $this->pdf->Line($x+$w7, $y, $x+$w7, $y+$hmax);
2367
+        $this->pdf->Line($x + $w7, $y, $x + $w7, $y + $hmax);
2374 2368
         //VALOR UNIT
2375 2369
         $x += $w7;
2376
-        $w8 = round($w*0.06, 0);
2370
+        $w8 = round($w * 0.06, 0);
2377 2371
         $texto = 'VALOR UNIT';
2378 2372
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2379 2373
         $this->pTextBox($x, $y, $w8, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2380
-        $this->pdf->Line($x+$w8, $y, $x+$w8, $y+$hmax);
2374
+        $this->pdf->Line($x + $w8, $y, $x + $w8, $y + $hmax);
2381 2375
         //VALOR TOTAL
2382 2376
         $x += $w8;
2383
-        $w9 = round($w*0.06, 0);
2377
+        $w9 = round($w * 0.06, 0);
2384 2378
         $texto = 'VALOR TOTAL';
2385 2379
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2386 2380
         $this->pTextBox($x, $y, $w9, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2387
-        $this->pdf->Line($x+$w9, $y, $x+$w9, $y+$hmax);
2381
+        $this->pdf->Line($x + $w9, $y, $x + $w9, $y + $hmax);
2388 2382
         //B.CÁLC ICMS
2389 2383
         $x += $w9;
2390
-        $w10 = round($w*0.06, 0);
2384
+        $w10 = round($w * 0.06, 0);
2391 2385
         $texto = 'B.CÁLC ICMS';
2392 2386
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2393 2387
         $this->pTextBox($x, $y, $w10, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2394
-        $this->pdf->Line($x+$w10, $y, $x+$w10, $y+$hmax);
2388
+        $this->pdf->Line($x + $w10, $y, $x + $w10, $y + $hmax);
2395 2389
         //VALOR ICMS
2396 2390
         $x += $w10;
2397
-        $w11 = round($w*0.06, 0);
2391
+        $w11 = round($w * 0.06, 0);
2398 2392
         $texto = 'VALOR ICMS';
2399 2393
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2400 2394
         $this->pTextBox($x, $y, $w11, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2401
-        $this->pdf->Line($x+$w11, $y, $x+$w11, $y+$hmax);
2395
+        $this->pdf->Line($x + $w11, $y, $x + $w11, $y + $hmax);
2402 2396
         //VALOR IPI
2403 2397
         $x += $w11;
2404
-        $w12 = round($w*0.05, 0);
2398
+        $w12 = round($w * 0.05, 0);
2405 2399
         $texto = 'VALOR IPI';
2406 2400
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2407 2401
         $this->pTextBox($x, $y, $w12, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2408
-        $this->pdf->Line($x+$w12, $y, $x+$w12, $y+$hmax);
2402
+        $this->pdf->Line($x + $w12, $y, $x + $w12, $y + $hmax);
2409 2403
         //ALÍQ. ICMS
2410 2404
         $x += $w12;
2411
-        $w13 = round($w*0.035, 0);
2405
+        $w13 = round($w * 0.035, 0);
2412 2406
         $texto = 'ALÍQ. ICMS';
2413 2407
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2414 2408
         $this->pTextBox($x, $y, $w13, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2415
-        $this->pdf->Line($x+$w13, $y, $x+$w13, $y+$hmax);
2409
+        $this->pdf->Line($x + $w13, $y, $x + $w13, $y + $hmax);
2416 2410
         //ALÍQ. IPI
2417 2411
         $x += $w13;
2418
-        $w14 = $w-($w1+$w2+$w3+$w4+$w5+$w6+$w7+$w8+$w9+$w10+$w11+$w12+$w13);
2412
+        $w14 = $w - ($w1 + $w2 + $w3 + $w4 + $w5 + $w6 + $w7 + $w8 + $w9 + $w10 + $w11 + $w12 + $w13);
2419 2413
         $texto = 'ALÍQ. IPI';
2420 2414
         $this->pTextBox($x, $y, $w14, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2421
-        $this->pdf->Line($oldX, $y+$h+1, $oldX + $w, $y+$h+1);
2415
+        $this->pdf->Line($oldX, $y + $h + 1, $oldX + $w, $y + $h + 1);
2422 2416
         $y += 5;
2423 2417
         //##################################################################################
2424 2418
         // LOOP COM OS DADOS DOS PRODUTOS
@@ -2435,7 +2429,7 @@  discard block
 block discarded – undo
2435 2429
                 $IPI  = $imposto->getElementsByTagName("IPI")->item(0);
2436 2430
                 $textoProduto = $this->pDescricaoProduto($thisItem);
2437 2431
                 $linhaDescr = $this->pGetNumLines($textoProduto, $w2, $aFont);
2438
-                $h = round(($linhaDescr * $this->pdf->fontSize)+ ($linhaDescr * 0.5), 2);
2432
+                $h = round(($linhaDescr * $this->pdf->fontSize) + ($linhaDescr * 0.5), 2);
2439 2433
                 $hUsado += $h;
2440 2434
                 if ($pag != $totpag) {
2441 2435
                     if ($hUsado >= $hmax && $i < $totItens) {
@@ -2445,11 +2439,11 @@  discard block
 block discarded – undo
2445 2439
                         break;
2446 2440
                     }
2447 2441
                 }
2448
-                $y_linha=$y+$h;
2442
+                $y_linha = $y + $h;
2449 2443
                 // linha entre itens
2450 2444
                 $this->pdf->DashedHLine($oldX, $y_linha, $w, 0.1, 120);
2451 2445
                 //corrige o x
2452
-                $x=$oldX;
2446
+                $x = $oldX;
2453 2447
                 //codigo do produto
2454 2448
                 $texto = $prod->getElementsByTagName("cProd")->item(0)->nodeValue;
2455 2449
                 $this->pTextBox($x, $y, $w1, $h, $texto, $aFont, 'T', 'C', 0, '');
@@ -2462,16 +2456,16 @@  discard block
 block discarded – undo
2462 2456
                 }
2463 2457
                 $x += $w2;
2464 2458
                 //NCM
2465
-                $texto = ! empty($prod->getElementsByTagName("NCM")->item(0)->nodeValue) ?
2459
+                $texto = !empty($prod->getElementsByTagName("NCM")->item(0)->nodeValue) ?
2466 2460
                         $prod->getElementsByTagName("NCM")->item(0)->nodeValue : '';
2467 2461
                 $this->pTextBox($x, $y, $w3, $h, $texto, $aFont, 'T', 'C', 0, '');
2468 2462
                 $x += $w3;
2469 2463
                 //CST
2470 2464
                 if (isset($ICMS)) {
2471
-                    $origem =  $this->pSimpleGetValue($ICMS, "orig");
2472
-                    $cst =  $this->pSimpleGetValue($ICMS, "CST");
2473
-                    $csosn =  $this->pSimpleGetValue($ICMS, "CSOSN");
2474
-                    $texto = $origem.$cst.$csosn;
2465
+                    $origem = $this->pSimpleGetValue($ICMS, "orig");
2466
+                    $cst = $this->pSimpleGetValue($ICMS, "CST");
2467
+                    $csosn = $this->pSimpleGetValue($ICMS, "CSOSN");
2468
+                    $texto = $origem . $cst . $csosn;
2475 2469
                     $this->pTextBox($x, $y, $w4, $h, $texto, $aFont, 'T', 'C', 0, '');
2476 2470
                 }
2477 2471
                 //CFOP
@@ -2505,7 +2499,7 @@  discard block
 block discarded – undo
2505 2499
                 //Valor da Base de calculo
2506 2500
                 $x += $w9;
2507 2501
                 if (isset($ICMS)) {
2508
-                    $texto = ! empty($ICMS->getElementsByTagName("vBC")->item(0)->nodeValue) ?
2502
+                    $texto = !empty($ICMS->getElementsByTagName("vBC")->item(0)->nodeValue) ?
2509 2503
                             number_format(
2510 2504
                                 $ICMS->getElementsByTagName("vBC")->item(0)->nodeValue,
2511 2505
                                 2,
@@ -2517,7 +2511,7 @@  discard block
 block discarded – undo
2517 2511
                 //Valor do ICMS
2518 2512
                 $x += $w10;
2519 2513
                 if (isset($ICMS)) {
2520
-                    $texto = ! empty($ICMS->getElementsByTagName("vICMS")->item(0)->nodeValue) ?
2514
+                    $texto = !empty($ICMS->getElementsByTagName("vICMS")->item(0)->nodeValue) ?
2521 2515
                             number_format(
2522 2516
                                 $ICMS->getElementsByTagName("vICMS")->item(0)->nodeValue,
2523 2517
                                 2,
@@ -2529,8 +2523,8 @@  discard block
 block discarded – undo
2529 2523
                 //Valor do IPI
2530 2524
                 $x += $w11;
2531 2525
                 if (isset($IPI)) {
2532
-                    $texto = ! empty($IPI->getElementsByTagName("vIPI")->item(0)->nodeValue) ?
2533
-                            number_format($IPI->getElementsByTagName("vIPI")->item(0)->nodeValue, 2, ",", ".") :'';
2526
+                    $texto = !empty($IPI->getElementsByTagName("vIPI")->item(0)->nodeValue) ?
2527
+                            number_format($IPI->getElementsByTagName("vIPI")->item(0)->nodeValue, 2, ",", ".") : '';
2534 2528
                 } else {
2535 2529
                     $texto = '';
2536 2530
                 }
@@ -2538,7 +2532,7 @@  discard block
 block discarded – undo
2538 2532
                 // %ICMS
2539 2533
                 $x += $w12;
2540 2534
                 if (isset($ICMS)) {
2541
-                    $texto = ! empty($ICMS->getElementsByTagName("pICMS")->item(0)->nodeValue) ?
2535
+                    $texto = !empty($ICMS->getElementsByTagName("pICMS")->item(0)->nodeValue) ?
2542 2536
                             number_format(
2543 2537
                                 $ICMS->getElementsByTagName("pICMS")->item(0)->nodeValue,
2544 2538
                                 2,
@@ -2550,7 +2544,7 @@  discard block
 block discarded – undo
2550 2544
                 //%IPI
2551 2545
                 $x += $w13;
2552 2546
                 if (isset($IPI)) {
2553
-                    $texto = ! empty($IPI->getElementsByTagName("pIPI")->item(0)->nodeValue) ?
2547
+                    $texto = !empty($IPI->getElementsByTagName("pIPI")->item(0)->nodeValue) ?
2554 2548
                             number_format($IPI->getElementsByTagName("pIPI")->item(0)->nodeValue, 2, ",", ".") : '';
2555 2549
                 } else {
2556 2550
                     $texto = '';
@@ -2564,7 +2558,7 @@  discard block
 block discarded – undo
2564 2558
                 $i++;
2565 2559
             }
2566 2560
         }
2567
-        return $oldY+$hmax;
2561
+        return $oldY + $hmax;
2568 2562
     }
2569 2563
 
2570 2564
     /**
@@ -2588,12 +2582,12 @@  discard block
 block discarded – undo
2588 2582
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
2589 2583
         //INSCRIÇÃO MUNICIPAL
2590 2584
         $y += 3;
2591
-        $w = round($this->wPrint*0.23, 0);
2585
+        $w = round($this->wPrint * 0.23, 0);
2592 2586
         $texto = 'INSCRIÇÃO MUNICIPAL';
2593 2587
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2594 2588
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
2595 2589
         //inscrição municipal
2596
-        $texto = ! empty($this->emit->getElementsByTagName("IM")->item(0)->nodeValue) ?
2590
+        $texto = !empty($this->emit->getElementsByTagName("IM")->item(0)->nodeValue) ?
2597 2591
                 $this->emit->getElementsByTagName("IM")->item(0)->nodeValue : '';
2598 2592
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
2599 2593
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 0, '');
@@ -2603,7 +2597,7 @@  discard block
 block discarded – undo
2603 2597
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2604 2598
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
2605 2599
         if (isset($this->ISSQNtot)) {
2606
-            $texto = ! empty($this->ISSQNtot->getElementsByTagName("vServ")->item(0)->nodeValue) ?
2600
+            $texto = !empty($this->ISSQNtot->getElementsByTagName("vServ")->item(0)->nodeValue) ?
2607 2601
                     $this->ISSQNtot->getElementsByTagName("vServ")->item(0)->nodeValue : '';
2608 2602
             $texto = number_format($texto, 2, ",", ".");
2609 2603
         } else {
@@ -2617,9 +2611,9 @@  discard block
 block discarded – undo
2617 2611
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2618 2612
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
2619 2613
         if (isset($this->ISSQNtot)) {
2620
-            $texto = ! empty($this->ISSQNtot->getElementsByTagName("vBC")->item(0)->nodeValue) ?
2614
+            $texto = !empty($this->ISSQNtot->getElementsByTagName("vBC")->item(0)->nodeValue) ?
2621 2615
                     $this->ISSQNtot->getElementsByTagName("vBC")->item(0)->nodeValue : '';
2622
-            $texto = ! empty($texto) ? number_format($texto, 2, ",", ".") : '';
2616
+            $texto = !empty($texto) ? number_format($texto, 2, ",", ".") : '';
2623 2617
         } else {
2624 2618
             $texto = '';
2625 2619
         }
@@ -2630,21 +2624,21 @@  discard block
 block discarded – undo
2630 2624
         if ($this->orientacao == 'P') {
2631 2625
             $w = $this->wPrint - (3 * $w);
2632 2626
         } else {
2633
-            $w = $this->wPrint - (3 * $w)-$this->wCanhoto;
2627
+            $w = $this->wPrint - (3 * $w) - $this->wCanhoto;
2634 2628
         }
2635 2629
         $texto = 'VALOR TOTAL DO ISSQN';
2636 2630
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2637 2631
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
2638 2632
         if (isset($this->ISSQNtot)) {
2639
-            $texto = ! empty($this->ISSQNtot->getElementsByTagName("vISS")->item(0)->nodeValue) ?
2633
+            $texto = !empty($this->ISSQNtot->getElementsByTagName("vISS")->item(0)->nodeValue) ?
2640 2634
                     $this->ISSQNtot->getElementsByTagName("vISS")->item(0)->nodeValue : '';
2641
-            $texto = ! empty($texto) ? number_format($texto, 2, ",", ".") : '';
2635
+            $texto = !empty($texto) ? number_format($texto, 2, ",", ".") : '';
2642 2636
         } else {
2643 2637
             $texto = '';
2644 2638
         }
2645 2639
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
2646 2640
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'R', 0, '');
2647
-        return ($y+$h+1);
2641
+        return ($y + $h + 1);
2648 2642
     }
2649 2643
 
2650 2644
     /**
@@ -2665,7 +2659,7 @@  discard block
 block discarded – undo
2665 2659
         if ($this->orientacao == 'P') {
2666 2660
               $w = $this->wPrint;
2667 2661
         } else {
2668
-              $w = $this->wPrint-$this->wCanhoto;
2662
+              $w = $this->wPrint - $this->wCanhoto;
2669 2663
         }
2670 2664
         $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
2671 2665
         $this->pTextBox($x, $y, $w, 8, $texto, $aFont, 'T', 'L', 0, '');
@@ -2681,15 +2675,15 @@  discard block
 block discarded – undo
2681 2675
         //$this->textoAdic com o texto completo do campo
2682 2676
         $y += 1;
2683 2677
         $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'');
2684
-        $this->pTextBox($x, $y+2, $w-2, $h-3, $this->textoAdic, $aFont, 'T', 'L', 0, '', false);
2678
+        $this->pTextBox($x, $y + 2, $w - 2, $h - 3, $this->textoAdic, $aFont, 'T', 'L', 0, '', false);
2685 2679
         //RESERVADO AO FISCO
2686 2680
         $texto = "RESERVADO AO FISCO";
2687 2681
         $x += $w;
2688 2682
         $y -= 1;
2689 2683
         if ($this->orientacao == 'P') {
2690
-            $w = $this->wPrint-$w;
2684
+            $w = $this->wPrint - $w;
2691 2685
         } else {
2692
-            $w = $this->wPrint-$w-$this->wCanhoto;
2686
+            $w = $this->wPrint - $w - $this->wCanhoto;
2693 2687
         }
2694 2688
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'B');
2695 2689
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -2728,8 +2722,8 @@  discard block
 block discarded – undo
2728 2722
         }
2729 2723
         $y += 2;
2730 2724
         $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'');
2731
-        $this->pTextBox($x, $y, $w-2, $h-3, $texto, $aFont, 'T', 'L', 0, '', false);
2732
-        return $y+$h;
2725
+        $this->pTextBox($x, $y, $w - 2, $h - 3, $texto, $aFont, 'T', 'L', 0, '', false);
2726
+        return $y + $h;
2733 2727
     }
2734 2728
 
2735 2729
     /**
@@ -2747,13 +2741,13 @@  discard block
 block discarded – undo
2747 2741
         if ($this->orientacao == 'P') {
2748 2742
               $w = $this->wPrint;
2749 2743
         } else {
2750
-              $w = $this->wPrint-$this->wCanhoto;
2744
+              $w = $this->wPrint - $this->wCanhoto;
2751 2745
               $x = $this->wCanhoto;
2752 2746
         }
2753 2747
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'I');
2754
-        $texto = "Impresso em ". date('d/m/Y') . " as " . date('H:i:s');
2748
+        $texto = "Impresso em " . date('d/m/Y') . " as " . date('H:i:s');
2755 2749
         $this->pTextBox($x, $y, $w, 0, $texto, $aFont, 'T', 'L', false);
2756
-        $texto = $this->creditos .  "  Powered by NFePHP";
2750
+        $texto = $this->creditos . "  Powered by NFePHP";
2757 2751
         $this->pTextBox($x, $y, $w, 0, $texto, $aFont, 'T', 'R', false, '');
2758 2752
     }
2759 2753
 
@@ -2806,9 +2800,9 @@  discard block
 block discarded – undo
2806 2800
         } else {
2807 2801
             //linha separadora do canhoto - 238
2808 2802
             //posicao altura
2809
-            $y = $this->wPrint-85;
2803
+            $y = $this->wPrint - 85;
2810 2804
             //altura
2811
-            $w = $this->wPrint-85-24;
2805
+            $w = $this->wPrint - 85 - 24;
2812 2806
         }
2813 2807
         $h = 10;
2814 2808
         //desenha caixa
@@ -2831,21 +2825,21 @@  discard block
 block discarded – undo
2831 2825
             $texto .= "AO LADO";
2832 2826
         }
2833 2827
         $texto .= ". EMISSÃO: ";
2834
-        $dEmi = ! empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
2828
+        $dEmi = !empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
2835 2829
                 $this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue : '';
2836 2830
         if ($dEmi == '') {
2837
-            $dEmi = ! empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
2831
+            $dEmi = !empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
2838 2832
                     $this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue : '';
2839 2833
             $aDemi = explode('T', $dEmi);
2840 2834
             $dEmi = $aDemi[0];
2841 2835
         }
2842
-        $texto .= $this->pYmd2dmy($dEmi) ." ";
2836
+        $texto .= $this->pYmd2dmy($dEmi) . " ";
2843 2837
         $texto .= "VALOR TOTAL: R$ ";
2844 2838
         $texto .= number_format($this->ICMSTot->getElementsByTagName("vNF")->item(0)->nodeValue, 2, ",", ".") . " ";
2845 2839
         $texto .= "DESTINATÁRIO: ";
2846 2840
         $texto .= $destinatario;
2847 2841
         if ($this->orientacao == 'P') {
2848
-            $this->pTextBox($x, $y, $w-1, $h, $texto, $aFont, 'C', 'L', 0, '', false);
2842
+            $this->pTextBox($x, $y, $w - 1, $h, $texto, $aFont, 'C', 'L', 0, '', false);
2849 2843
             $x1 = $x + $w;
2850 2844
             $w1 = $this->wPrint - $w;
2851 2845
             $texto = "NF-e";
@@ -2858,12 +2852,12 @@  discard block
 block discarded – undo
2858 2852
             //DATA DE RECEBIMENTO
2859 2853
             $texto = "DATA DE RECEBIMENTO";
2860 2854
             $y += $h;
2861
-            $w2 = round($this->wPrint*0.17, 0); //35;
2855
+            $w2 = round($this->wPrint * 0.17, 0); //35;
2862 2856
             $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2863 2857
             $this->pTextBox($x, $y, $w2, 8, $texto, $aFont, 'T', 'L', 1, '');
2864 2858
             //IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR
2865 2859
             $x += $w2;
2866
-            $w3 = $w-$w2;
2860
+            $w3 = $w - $w2;
2867 2861
             $texto = "IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR";
2868 2862
             $this->pTextBox($x, $y, $w3, 8, $texto, $aFont, 'T', 'L', 1, '');
2869 2863
             $x = $oldX;
@@ -2873,7 +2867,7 @@  discard block
 block discarded – undo
2873 2867
             return $y;
2874 2868
         } else {
2875 2869
             $x--;
2876
-            $x = $this->pTextBox90($x, $y, $w-1, $h, $texto, $aFontSmall, 'C', 'L', 0, '', false);
2870
+            $x = $this->pTextBox90($x, $y, $w - 1, $h, $texto, $aFontSmall, 'C', 'L', 0, '', false);
2877 2871
             //NUMERO DA NOTA FISCAL LOGO NFE
2878 2872
             $w1 = 16;
2879 2873
             $x1 = $oldX;
@@ -2887,18 +2881,18 @@  discard block
 block discarded – undo
2887 2881
             $this->pTextBox($x1, $y, $w1, 18, $texto, $aFont, 'C', 'C', 1, '');
2888 2882
             //DATA DO RECEBIMENTO
2889 2883
             $texto = "DATA DO RECEBIMENTO";
2890
-            $y = $this->wPrint-85;
2884
+            $y = $this->wPrint - 85;
2891 2885
             $x = 12;
2892
-            $w2 = round($this->wPrint*0.17, 0); //35;
2886
+            $w2 = round($this->wPrint * 0.17, 0); //35;
2893 2887
             $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2894 2888
             $this->pTextBox90($x, $y, $w2, 8, $texto, $aFont, 'T', 'L', 1, '');
2895 2889
             //IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR
2896 2890
             $y -= $w2;
2897
-            $w3 = $w-$w2;
2891
+            $w3 = $w - $w2;
2898 2892
             $texto = "IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR";
2899 2893
             $aFont = array('font'=>$this->fontePadrao, 'size'=>5.7, 'style'=>'');
2900 2894
             $x = $this->pTextBox90($x, $y, $w3, 8, $texto, $aFont, 'T', 'L', 1, '');
2901
-            $this->pdf->DashedVLine(23, $oldY, 0.1, $this->wPrint-20, 67);
2895
+            $this->pdf->DashedVLine(23, $oldY, 0.1, $this->wPrint - 20, 67);
2902 2896
             return $x;
2903 2897
         }
2904 2898
     }
@@ -2915,13 +2909,13 @@  discard block
 block discarded – undo
2915 2909
     {
2916 2910
         $saida = "";
2917 2911
         if (isset($this->compra)) {
2918
-            if (! empty($this->compra->getElementsByTagName("xNEmp")->item(0)->nodeValue)) {
2912
+            if (!empty($this->compra->getElementsByTagName("xNEmp")->item(0)->nodeValue)) {
2919 2913
                 $saida .= " Nota de Empenho: " . $this->compra->getElementsByTagName("xNEmp")->item(0)->nodeValue;
2920 2914
             }
2921
-            if (! empty($this->compra->getElementsByTagName("xPed")->item(0)->nodeValue)) {
2915
+            if (!empty($this->compra->getElementsByTagName("xPed")->item(0)->nodeValue)) {
2922 2916
                 $saida .= " Pedido: " . $this->compra->getElementsByTagName("xPed")->item(0)->nodeValue;
2923 2917
             }
2924
-            if (! empty($this->compra->getElementsByTagName("xCont")->item(0)->nodeValue)) {
2918
+            if (!empty($this->compra->getElementsByTagName("xCont")->item(0)->nodeValue)) {
2925 2919
                 $saida .= " Contrato: " . $this->compra->getElementsByTagName("xCont")->item(0)->nodeValue;
2926 2920
             }
2927 2921
         }
@@ -2947,21 +2941,21 @@  discard block
 block discarded – undo
2947 2941
         if ($vICMS > 0) {
2948 2942
             $vICMS = 1;
2949 2943
         }
2950
-        $icmss  = $this->ICMSTot->getElementsByTagName("vBC")->item(0)->nodeValue;
2944
+        $icmss = $this->ICMSTot->getElementsByTagName("vBC")->item(0)->nodeValue;
2951 2945
         if ($icmss > 0) {
2952 2946
             $icmss = 1;
2953 2947
         }
2954
-        $dEmi = ! empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
2948
+        $dEmi = !empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
2955 2949
                 $this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue : '';
2956 2950
         if ($dEmi == '') {
2957
-            $dEmi = ! empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
2951
+            $dEmi = !empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
2958 2952
                     $this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue : '';
2959 2953
             $aDemi = explode('T', $dEmi);
2960 2954
             $dEmi = $aDemi[0];
2961 2955
         }
2962 2956
         $dd  = $dEmi;
2963 2957
         $rpos = strrpos($dd, '-');
2964
-        $dd  = substr($dd, $rpos +1);
2958
+        $dd  = substr($dd, $rpos + 1);
2965 2959
         $chave = sprintf($forma, $cUF, $this->tpEmis, $CNPJ, $vNF, $vICMS, $icmss, $dd);
2966 2960
         $chave = $chave . $this->pModulo11($chave);
2967 2961
         return $chave;
@@ -2982,7 +2976,7 @@  discard block
 block discarded – undo
2982 2976
         $formaNfRef = "\r\nNF  Ref.: série:%d numero:%d emit:%s em %s modelo: %d";
2983 2977
         $formaECFRef = "\r\nECF Ref.: modelo: %s ECF:%d COO:%d";
2984 2978
         $formaNfpRef = "\r\nNFP Ref.: série:%d número:%d emit:%s em %s modelo: %d IE:%s";
2985
-        $saida='';
2979
+        $saida = '';
2986 2980
         $nfRefs = $this->ide->getElementsByTagName('NFref');
2987 2981
         if (0 === $nfRefs->length) {
2988 2982
             return $saida;
@@ -2995,7 +2989,7 @@  discard block
 block discarded – undo
2995 2989
             foreach ($refNFe as $chave_acessoRef) {
2996 2990
                 $chave_acesso = $chave_acessoRef->nodeValue;
2997 2991
                 $chave_acessoF = $this->pFormat($chave_acesso, $this->formatoChave);
2998
-                $data = substr($chave_acesso, 4, 2)."/20".substr($chave_acesso, 2, 2);
2992
+                $data = substr($chave_acesso, 4, 2) . "/20" . substr($chave_acesso, 2, 2);
2999 2993
                 $cnpj = $this->pFormat(substr($chave_acesso, 6, 14), "##.###.###/####-##");
3000 2994
                 $serie  = substr($chave_acesso, 22, 3);
3001 2995
                 $numero = substr($chave_acesso, 25, 9);
@@ -3016,7 +3010,7 @@  discard block
 block discarded – undo
3016 3010
             foreach ($refCTe as $chave_acessoRef) {
3017 3011
                 $chave_acesso = $chave_acessoRef->nodeValue;
3018 3012
                 $chave_acessoF = $this->pFormat($chave_acesso, $this->formatoChave);
3019
-                $data = substr($chave_acesso, 4, 2)."/20".substr($chave_acesso, 2, 2);
3013
+                $data = substr($chave_acesso, 4, 2) . "/20" . substr($chave_acesso, 2, 2);
3020 3014
                 $cnpj = $this->pFormat(substr($chave_acesso, 6, 14), "##.###.###/####-##");
3021 3015
                 $serie  = substr($chave_acesso, 22, 3);
3022 3016
                 $numero = substr($chave_acesso, 25, 9);
@@ -3032,10 +3026,9 @@  discard block
 block discarded – undo
3032 3026
             $refNFP = $nfRef->getElementsByTagName('refNFP');
3033 3027
             foreach ($refNFP as $umaRefNFe) {
3034 3028
                 $data = $umaRefNFe->getElementsByTagName('AAMM')->item(0)->nodeValue;
3035
-                $cnpj = ! empty($umaRefNFe->getElementsByTagName('CNPJ')->item(0)->nodeValue) ?
3036
-                    $umaRefNFe->getElementsByTagName('CNPJ')->item(0)->nodeValue :
3037
-                    '';
3038
-                $cpf = ! empty($umaRefNFe->getElementsByTagName('CPF')->item(0)->nodeValue) ?
3029
+                $cnpj = !empty($umaRefNFe->getElementsByTagName('CNPJ')->item(0)->nodeValue) ?
3030
+                    $umaRefNFe->getElementsByTagName('CNPJ')->item(0)->nodeValue : '';
3031
+                $cpf = !empty($umaRefNFe->getElementsByTagName('CPF')->item(0)->nodeValue) ?
3039 3032
                         $umaRefNFe->getElementsByTagName('CPF')->item(0)->nodeValue : '';
3040 3033
                 $mod = $umaRefNFe->getElementsByTagName('mod')->item(0)->nodeValue;
3041 3034
                 $serie = $umaRefNFe->getElementsByTagName('serie')->item(0)->nodeValue;
Please login to merge, or discard this patch.