Completed
Pull Request — master (#279)
by Roberto
02:17
created
src/NFe/Danfe.php 3 patches
Doc Comments   +26 added lines, -15 removed lines patch added patch discarded remove patch
@@ -870,8 +870,8 @@  discard block
 block discarded – undo
870 870
      *header
871 871
      * Monta o cabelhalho da DANFE (retrato e paisagem)
872 872
      *
873
-     * @param  number $x      Posição horizontal inicial, canto esquerdo
874
-     * @param  number $y      Posição vertical inicial, canto superior
873
+     * @param  integer $x      Posição horizontal inicial, canto esquerdo
874
+     * @param  integer $y      Posição vertical inicial, canto superior
875 875
      * @param  number $pag    Número da Página
876 876
      * @param  number $totPag Total de páginas
877 877
      * @return number Posição vertical final
@@ -1338,8 +1338,8 @@  discard block
 block discarded – undo
1338 1338
      * Monta o campo com os dados do destinatário na DANFE. (retrato e paisagem)
1339 1339
      *
1340 1340
      * @name   destinatarioDANFE
1341
-     * @param  number $x Posição horizontal canto esquerdo
1342
-     * @param  number $y Posição vertical canto superior
1341
+     * @param  integer $x Posição horizontal canto esquerdo
1342
+     * @param  integer $y Posição vertical canto superior
1343 1343
      * @return number Posição vertical final
1344 1344
      */
1345 1345
     protected function destinatarioDANFE($x = 0, $y = 0)
@@ -1539,7 +1539,7 @@  discard block
 block discarded – undo
1539 1539
      * Gera a String do Texto da Fatura
1540 1540
       *
1541 1541
      * @name   getTextoFatura
1542
-     * @return uma String com o texto ou "";
1542
+     * @return string String com o texto ou "";
1543 1543
      */
1544 1544
     protected function getTextoFatura()
1545 1545
     {
@@ -1593,8 +1593,8 @@  discard block
 block discarded – undo
1593 1593
      * Monta o campo de duplicatas da DANFE (retrato e paisagem)
1594 1594
      *
1595 1595
      * @name   fatura
1596
-     * @param  number $x Posição horizontal canto esquerdo
1597
-     * @param  number $y Posição vertical canto superior
1596
+     * @param  integer $x Posição horizontal canto esquerdo
1597
+     * @param  double $y Posição vertical canto superior
1598 1598
      * @return number Posição vertical final
1599 1599
      */
1600 1600
     protected function fatura($x, $y)
@@ -1713,8 +1713,8 @@  discard block
 block discarded – undo
1713 1713
      * Monta o campo de pagamentos da DANFE (retrato e paisagem) (foi baseada na fatura)
1714 1714
      *
1715 1715
      * @name   pagamento
1716
-     * @param  number $x Posição horizontal canto esquerdo
1717
-     * @param  number $y Posição vertical canto superior
1716
+     * @param  integer $x Posição horizontal canto esquerdo
1717
+     * @param  double $y Posição vertical canto superior
1718 1718
      * @return number Posição vertical final
1719 1719
      */
1720 1720
     protected function pagamento($x, $y)
@@ -1820,6 +1820,8 @@  discard block
 block discarded – undo
1820 1820
      * @param  float $h Altura do campo
1821 1821
      * @param  float $h Título do campo
1822 1822
      * @param  float $h Valor do imposto
1823
+     * @param string $titulo
1824
+     * @param string $campoImposto
1823 1825
      * @return float Sugestão do $x do próximo imposto
1824 1826
      */
1825 1827
     protected function impostoHelper($x, $y, $w, $h, $titulo, $campoImposto)
@@ -1846,9 +1848,9 @@  discard block
 block discarded – undo
1846 1848
      * imposto
1847 1849
      * Monta o campo de impostos e totais da DANFE (retrato e paisagem)
1848 1850
      *
1849
-     * @param  number $x Posição horizontal canto esquerdo
1850
-     * @param  number $y Posição vertical canto superior
1851
-     * @return number Posição vertical final
1851
+     * @param  integer $x Posição horizontal canto esquerdo
1852
+     * @param  double $y Posição vertical canto superior
1853
+     * @return double Posição vertical final
1852 1854
      */
1853 1855
     protected function imposto($x, $y)
1854 1856
     {
@@ -2230,6 +2232,10 @@  discard block
 block discarded – undo
2230 2232
 
2231 2233
 
2232 2234
 
2235
+    /**
2236
+     * @param string $campo
2237
+     * @param string $formato
2238
+     */
2233 2239
     protected function descricaoProdutoHelper($origem, $campo, $formato)
2234 2240
     {
2235 2241
         $valor_original = $origem->getElementsByTagName($campo)->item(0);
@@ -2333,7 +2339,6 @@  discard block
 block discarded – undo
2333 2339
      * @param  float $x       Posição horizontal canto esquerdo
2334 2340
      * @param  float $y       Posição vertical canto superior
2335 2341
      * @param  float $nInicio Número do item inicial
2336
-     * @param  float $max     Número do item final
2337 2342
      * @param  float $hmax    Altura máxima do campo de itens em mm
2338 2343
      * @return float Posição vertical final
2339 2344
      */
@@ -3000,8 +3005,8 @@  discard block
 block discarded – undo
3000 3005
      * Monta o canhoto da DANFE (retrato e paisagem)
3001 3006
      *
3002 3007
      * @name   canhotoDANFE
3003
-     * @param  number $x Posição horizontal canto esquerdo
3004
-     * @param  number $y Posição vertical canto superior
3008
+     * @param  integer $x Posição horizontal canto esquerdo
3009
+     * @param  integer $y Posição vertical canto superior
3005 3010
      * @return number Posição vertical final
3006 3011
      *
3007 3012
      * TODO 21/07/14 fmertins: quando orientação L-paisagem, o canhoto está sendo gerado incorretamente
@@ -3294,6 +3299,9 @@  discard block
 block discarded – undo
3294 3299
         return $saida;
3295 3300
     }
3296 3301
     
3302
+    /**
3303
+     * @param string $xml
3304
+     */
3297 3305
     private function loadDoc($xml)
3298 3306
     {
3299 3307
         $this->xml = $xml;
@@ -3333,6 +3341,9 @@  discard block
 block discarded – undo
3333 3341
         }
3334 3342
     }
3335 3343
     
3344
+    /**
3345
+     * @param string $original
3346
+     */
3336 3347
     private function imagePNGtoJPG($original)
3337 3348
     {
3338 3349
         $image = imagecreatefrompng($original);
Please login to merge, or discard this patch.
Indentation   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -27,10 +27,10 @@  discard block
 block discarded – undo
27 27
      * @var string
28 28
      */
29 29
     protected $numero_registro_dpec = '';
30
-     /**
31
-     * Parâmetro para exibir ou ocultar os valores do PIS/COFINS.
32
-     * @var boolean
33
-     */
30
+        /**
31
+         * Parâmetro para exibir ou ocultar os valores do PIS/COFINS.
32
+         * @var boolean
33
+         */
34 34
     protected $qCanhoto = 1;
35 35
     /**
36 36
      * Define a exbição dos valores de PIS e Cofins
@@ -481,7 +481,7 @@  discard block
 block discarded – undo
481 481
                 $this->textoAdic .= ". \r\n";
482 482
             }
483 483
             $this->textoAdic .= "LOCAL DE ENTREGA : ".$txRetCNPJ.'-'.$txRetxLgr.', '.$txRetnro.' '.$txRetxCpl.
484
-               ' - '.$txRetxBairro.' '.$txRetxMun.' - '.$txRetUF."\r\n";
484
+                ' - '.$txRetxBairro.' '.$txRetxMun.' - '.$txRetUF."\r\n";
485 485
         }
486 486
         //informações adicionais
487 487
         $this->textoAdic .= $this->geraInformacoesDasNotasReferenciadas();
@@ -882,7 +882,7 @@  discard block
 block discarded – undo
882 882
         $oldX = $x;
883 883
         $oldY = $y;
884 884
         if ($this->orientacao == 'P') {
885
-              $maxW = $this->wPrint;
885
+                $maxW = $this->wPrint;
886 886
         } else {
887 887
             if ($pag == 1) { // primeira página
888 888
                 $maxW = $this->wPrint - $this->wCanhoto;
@@ -1256,8 +1256,8 @@  discard block
 block discarded – undo
1256 1256
             $w = $maxW-(2*$x);
1257 1257
             $this->pdf->SetTextColor(200, 200, 200);
1258 1258
             $texto = "DANFE impresso em contingência -\n".
1259
-                     "DPEC regularmente recebido pela Receita\n".
1260
-                     "Federal do Brasil";
1259
+                        "DPEC regularmente recebido pela Receita\n".
1260
+                        "Federal do Brasil";
1261 1261
             $aFont = ['font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B'];
1262 1262
             $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1263 1263
             $this->pdf->SetTextColor(0, 0, 0);
@@ -1561,13 +1561,13 @@  discard block
 block discarded – undo
1561 1561
         return ($y + $h);
1562 1562
     } //fim da função destinatarioDANFE
1563 1563
 
1564
-     /**
1565
-     * getTextoFatura
1566
-     * Gera a String do Texto da Fatura
1567
-      *
1568
-     * @name   getTextoFatura
1569
-     * @return uma String com o texto ou "";
1570
-     */
1564
+        /**
1565
+         * getTextoFatura
1566
+         * Gera a String do Texto da Fatura
1567
+         *
1568
+         * @name   getTextoFatura
1569
+         * @return uma String com o texto ou "";
1570
+         */
1571 1571
     protected function getTextoFatura()
1572 1572
     {
1573 1573
         if (isset($this->cobr)) {
@@ -1598,13 +1598,13 @@  discard block
 block discarded – undo
1598 1598
         return "";
1599 1599
     }
1600 1600
 
1601
-     /**
1602
-     * sizeExtraTextoFatura
1603
-     * Calcula o espaço ocupado pelo texto da fatura. Este espaço só é utilizado quando não houver duplicata.
1604
-      *
1605
-     * @name   sizeExtraTextoFatura
1606
-     * @return integer
1607
-     */
1601
+        /**
1602
+         * sizeExtraTextoFatura
1603
+         * Calcula o espaço ocupado pelo texto da fatura. Este espaço só é utilizado quando não houver duplicata.
1604
+         *
1605
+         * @name   sizeExtraTextoFatura
1606
+         * @return integer
1607
+         */
1608 1608
     protected function sizeExtraTextoFatura()
1609 1609
     {
1610 1610
         $textoFatura = $this->getTextoFatura();
@@ -1784,7 +1784,7 @@  discard block
 block discarded – undo
1784 1784
                                     '11'=>'Vale Refeição','12'=>'Vale Presente','13'=>'Vale Combustível',
1785 1785
                                     '14'=>'Duplicata Mercantil','15'=>'Boleto','90'=>'Sem pagamento','99'=>'Outros'];
1786 1786
             $bandeira = ['01'=>'Visa','02'=>'Mastercard','03'=>'American','04'=>'Sorocred','05'=>'Diners',
1787
-                              '06'=>'Elo','07'=>'Hipercard','08'=>'Aura','09'=>'Cabal','99'=>'Outros'];
1787
+                                '06'=>'Elo','07'=>'Hipercard','08'=>'Aura','09'=>'Cabal','99'=>'Outros'];
1788 1788
             foreach ($this->detPag as $k => $d) {
1789 1789
                 $fPag = !empty($this->detPag->item($k)->getElementsByTagName('tPag')->item(0)->nodeValue)
1790 1790
                 ? $this->detPag->item($k)->getElementsByTagName('tPag')->item(0)->nodeValue
@@ -2437,7 +2437,7 @@  discard block
 block discarded – undo
2437 2437
         $w4 = round($w*0.05, 0);
2438 2438
         $texto = 'O/CSOSN';//Regime do Simples CRT = 1 ou CRT = 2
2439 2439
         if ($this->getTagValue($this->emit, 'CRT') == '3') {
2440
-             $texto = 'O/CST';//Regime Normal
2440
+                $texto = 'O/CST';//Regime Normal
2441 2441
         }
2442 2442
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2443 2443
         $this->pdf->textBox($x, $y, $w4, $h, $texto, $aFont, 'C', 'C', 0, '', false);
@@ -2827,7 +2827,7 @@  discard block
 block discarded – undo
2827 2827
         $this->pdf->textBox($x, $yVeic, $w1+40, $h, $texto, $aFont, 'T', 'L', 0, '');
2828 2828
         $yVeic += $h;
2829 2829
         $texto = 'Tipo.................: ' . ($renavamTiposVeiculos[intval($veiculoTipo)] ?? $veiculoTipo);
2830
-         $this->pdf->textBox($x, $yVeic, $w1+40, $h, $texto, $aFont, 'T', 'L', 0, '');
2830
+            $this->pdf->textBox($x, $yVeic, $w1+40, $h, $texto, $aFont, 'T', 'L', 0, '');
2831 2831
         $yVeic = $y + $h;
2832 2832
         $xVeic = $x + 65;
2833 2833
         $texto = 'Nº Motor: .........: ' . $veiculoMotor;
@@ -2961,9 +2961,9 @@  discard block
 block discarded – undo
2961 2961
         //DADOS ADICIONAIS
2962 2962
         $texto = "DADOS ADICIONAIS";
2963 2963
         if ($this->orientacao == 'P') {
2964
-              $w = $this->wPrint;
2964
+                $w = $this->wPrint;
2965 2965
         } else {
2966
-              $w = $this->wPrint-$this->wCanhoto;
2966
+                $w = $this->wPrint-$this->wCanhoto;
2967 2967
         }
2968 2968
         $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
2969 2969
         $this->pdf->textBox($x, $y, $w, 8, $texto, $aFont, 'T', 'L', 0, '');
@@ -3044,10 +3044,10 @@  discard block
 block discarded – undo
3044 3044
         
3045 3045
         $y = $this->maxH - 4;
3046 3046
         if ($this->orientacao == 'P') {
3047
-              $w = $this->wPrint;
3047
+                $w = $this->wPrint;
3048 3048
         } else {
3049
-              $w = $this->wPrint-$this->wCanhoto;
3050
-              $x = $this->wCanhoto;
3049
+                $w = $this->wPrint-$this->wCanhoto;
3050
+                $x = $this->wCanhoto;
3051 3051
         }
3052 3052
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>'I'];
3053 3053
         $texto = "Impresso em ". date('d/m/Y') . " as " . date('H:i:s')
Please login to merge, or discard this patch.
Spacing   +312 added lines, -313 removed lines patch added patch discarded remove patch
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
             if ($papel == 'A4') {
384 384
                 $this->maxW = 297;
385 385
                 $this->maxH = 210;
386
-                $xInic = $margEsq+10;
386
+                $xInic = $margEsq + 10;
387 387
                 //se paisagem multiplica a largura do canhoto pela quantidade de canhotos
388 388
                 //$this->wCanhoto *= $this->qCanhoto;
389 389
             }
@@ -391,10 +391,10 @@  discard block
 block discarded – undo
391 391
         //total inicial de paginas
392 392
         $totPag = 1;
393 393
         //largura imprimivel em mm: largura da folha menos as margens esq/direita
394
-        $this->wPrint = $this->maxW-($margEsq * 2);
394
+        $this->wPrint = $this->maxW - ($margEsq * 2);
395 395
         //comprimento (altura) imprimivel em mm: altura da folha menos as margens
396 396
         //superior e inferior
397
-        $this->hPrint = $this->maxH-$margSup-$margInf;
397
+        $this->hPrint = $this->maxH - $margSup - $margInf;
398 398
         // estabelece contagem de paginas
399 399
         $this->pdf->aliasNbPages();
400 400
         // fixa as margens
@@ -438,9 +438,9 @@  discard block
 block discarded – undo
438 438
         }
439 439
         //calcular a altura necessária para os dados adicionais
440 440
         if ($this->orientacao == 'P') {
441
-            $this->wAdic = round($this->wPrint*0.66, 0);
441
+            $this->wAdic = round($this->wPrint * 0.66, 0);
442 442
         } else {
443
-            $this->wAdic = round(($this->wPrint-$this->wCanhoto)*0.5, 0);
443
+            $this->wAdic = round(($this->wPrint - $this->wCanhoto) * 0.5, 0);
444 444
         }
445 445
         $fontProduto = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>''];
446 446
         $this->textoAdic = '';
@@ -452,8 +452,8 @@  discard block
 block discarded – undo
452 452
             $txRetxBairro = $this->getTagValue($this->retirada, "xBairro");
453 453
             $txRetxMun = $this->getTagValue($this->retirada, "xMun");
454 454
             $txRetUF = $this->getTagValue($this->retirada, "UF");
455
-            $this->textoAdic .= "LOCAL DE RETIRADA : ".
456
-                    $txRetCNPJ.
455
+            $this->textoAdic .= "LOCAL DE RETIRADA : " .
456
+                    $txRetCNPJ .
457 457
                     '-' .
458 458
                     $txRetxLgr .
459 459
                     ', ' .
@@ -480,8 +480,8 @@  discard block
 block discarded – undo
480 480
             if ($this->textoAdic != '') {
481 481
                 $this->textoAdic .= ". \r\n";
482 482
             }
483
-            $this->textoAdic .= "LOCAL DE ENTREGA : ".$txRetCNPJ.'-'.$txRetxLgr.', '.$txRetnro.' '.$txRetxCpl.
484
-               ' - '.$txRetxBairro.' '.$txRetxMun.' - '.$txRetUF."\r\n";
483
+            $this->textoAdic .= "LOCAL DE ENTREGA : " . $txRetCNPJ . '-' . $txRetxLgr . ', ' . $txRetnro . ' ' . $txRetxCpl .
484
+               ' - ' . $txRetxBairro . ' ' . $txRetxMun . ' - ' . $txRetUF . "\r\n";
485 485
         }
486 486
         //informações adicionais
487 487
         $this->textoAdic .= $this->geraInformacoesDasNotasReferenciadas();
@@ -490,7 +490,7 @@  discard block
 block discarded – undo
490 490
             if ($this->textoAdic != '') {
491 491
                 $this->textoAdic .= ". \r\n";
492 492
             }
493
-            $this->textoAdic .= ! empty($this->getTagValue($this->infAdic, "infCpl"))
493
+            $this->textoAdic .= !empty($this->getTagValue($this->infAdic, "infCpl"))
494 494
             ? 'Inf. Contribuinte: ' . $this->anfaveaDANFE($this->getTagValue($this->infAdic, "infCpl"))
495 495
             : '';
496 496
             $infPedido = $this->geraInformacoesDaTagCompra();
@@ -498,14 +498,14 @@  discard block
 block discarded – undo
498 498
                 $this->textoAdic .= $infPedido;
499 499
             }
500 500
             $this->textoAdic .= $this->getTagValue($this->dest, "email", ' Email do Destinatário: ');
501
-            $this->textoAdic .= ! empty($this->getTagValue($this->infAdic, "infAdFisco"))
501
+            $this->textoAdic .= !empty($this->getTagValue($this->infAdic, "infAdFisco"))
502 502
             ? "\r\n Inf. fisco: " . $this->getTagValue($this->infAdic, "infAdFisco")
503 503
             : '';
504 504
             $obsCont = $this->infAdic->getElementsByTagName("obsCont");
505 505
             if (isset($obsCont)) {
506 506
                 foreach ($obsCont as $obs) {
507
-                    $campo =  $obsCont->item($i)->getAttribute("xCampo");
508
-                    $xTexto = ! empty($obsCont->item($i)->getElementsByTagName("xTexto")->item(0)->nodeValue)
507
+                    $campo = $obsCont->item($i)->getAttribute("xCampo");
508
+                    $xTexto = !empty($obsCont->item($i)->getElementsByTagName("xTexto")->item(0)->nodeValue)
509 509
                     ? $obsCont->item($i)->getElementsByTagName("xTexto")->item(0)->nodeValue
510 510
                     : '';
511 511
                     $this->textoAdic .= "\r\n" . $campo . ':  ' . trim($xTexto);
@@ -535,37 +535,37 @@  discard block
 block discarded – undo
535 535
         foreach ($alinhas as $linha) {
536 536
             $numlinhasdados += $this->pdf->getNumLines($linha, $this->wAdic, $fontProduto);
537 537
         }
538
-        $hdadosadic = round(($numlinhasdados+3) * $this->pdf->fontSize, 0);
538
+        $hdadosadic = round(($numlinhasdados + 3) * $this->pdf->fontSize, 0);
539 539
         if ($hdadosadic < 10) {
540 540
             $hdadosadic = 10;
541 541
         }
542 542
         //altura disponivel para os campos da DANFE
543
-        $hcabecalho = 47;//para cabeçalho
544
-        $hdestinatario = 25;//para destinatario
545
-        $hduplicatas = 12;//para cada grupo de 7 duplicatas
546
-        $himposto = 18;// para imposto
547
-        $htransporte = 25;// para transporte
548
-        $hissqn = 11;// para issqn
549
-        $hfooter = 5;// para rodape
550
-        $hCabecItens = 4;//cabeçalho dos itens
543
+        $hcabecalho = 47; //para cabeçalho
544
+        $hdestinatario = 25; //para destinatario
545
+        $hduplicatas = 12; //para cada grupo de 7 duplicatas
546
+        $himposto = 18; // para imposto
547
+        $htransporte = 25; // para transporte
548
+        $hissqn = 11; // para issqn
549
+        $hfooter = 5; // para rodape
550
+        $hCabecItens = 4; //cabeçalho dos itens
551 551
         //alturas disponiveis para os dados
552 552
         $hDispo1 = $this->hPrint - 10 - ($hcabecalho +
553 553
             $hdestinatario + ($linhasDup * $hduplicatas) + $himposto + $htransporte +
554 554
             ($linhaISSQN * $hissqn) + $hdadosadic + $hfooter + $hCabecItens +
555 555
             $this->sizeExtraTextoFatura());
556 556
         if ($this->orientacao == 'P') {
557
-            $hDispo1 -= 24 * $this->qCanhoto;//para canhoto
557
+            $hDispo1 -= 24 * $this->qCanhoto; //para canhoto
558 558
             $w = $this->wPrint;
559 559
         } else {
560
-            $hcanhoto = $this->hPrint;//para canhoto
560
+            $hcanhoto = $this->hPrint; //para canhoto
561 561
             $w = $this->wPrint - $this->wCanhoto;
562 562
         }
563
-        $hDispo2 = $this->hPrint - 10 - ($hcabecalho + $hfooter + $hCabecItens)-4;
563
+        $hDispo2 = $this->hPrint - 10 - ($hcabecalho + $hfooter + $hCabecItens) - 4;
564 564
         //Contagem da altura ocupada para impressão dos itens
565 565
         $fontProduto = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>''];
566 566
         $numlinhas = 0;
567 567
         $hUsado = $hCabecItens;
568
-        $w2 = round($w*0.28, 0);
568
+        $w2 = round($w * 0.28, 0);
569 569
         $hDispo = $hDispo1;
570 570
         $totPag = 1;
571 571
         $i = 0;
@@ -578,7 +578,7 @@  discard block
 block discarded – undo
578 578
                 $hDispo = $hDispo2;
579 579
                 $hUsado = $hCabecItens;
580 580
                 // Remove canhoto para páginas secundárias em modo paisagem ('L')
581
-                $w2 = round($this->wPrint*0.28, 0);
581
+                $w2 = round($this->wPrint * 0.28, 0);
582 582
                 $i--; // decrementa para readicionar o item que não coube nessa pagina na outra.
583 583
             }
584 584
             $i++;
@@ -602,7 +602,7 @@  discard block
 block discarded – undo
602 602
         //coloca o cabeçalho
603 603
         $y = $this->header($x, $y, $pag, $totPag);
604 604
         //coloca os dados do destinatário
605
-        $y = $this->destinatarioDANFE($x, $y+1);
605
+        $y = $this->destinatarioDANFE($x, $y + 1);
606 606
         
607 607
         
608 608
         //Verifica as formas de pagamento da nota fiscal
@@ -617,29 +617,29 @@  discard block
 block discarded – undo
617 617
         }
618 618
         //caso tenha boleto imprimir fatura
619 619
         if ($this->dup->length > 0) {
620
-            $y = $this->fatura($x, $y+1);
620
+            $y = $this->fatura($x, $y + 1);
621 621
         } else {
622 622
             //Se somente tiver a forma de pagamento sem pagamento ou outros não imprimir nada
623
-            if (count($formaPag)=='1' && (isset($formaPag[90]) || isset($formaPag[99]))) {
623
+            if (count($formaPag) == '1' && (isset($formaPag[90]) || isset($formaPag[99]))) {
624 624
                 $y = $y;
625 625
             } else {
626 626
                 //caso tenha mais de uma forma de pagamento ou seja diferente de boleto exibe a
627 627
                 //forma de pagamento e o valor
628
-                $y = $this->pagamento($x, $y+1);
628
+                $y = $this->pagamento($x, $y + 1);
629 629
             }
630 630
         }
631 631
         //coloca os dados dos impostos e totais da NFe
632
-        $y = $this->imposto($x, $y+1);
632
+        $y = $this->imposto($x, $y + 1);
633 633
         //coloca os dados do trasnporte
634
-        $y = $this->transporte($x, $y+1);
634
+        $y = $this->transporte($x, $y + 1);
635 635
         //itens da DANFE
636 636
         $nInicial = 0;
637 637
 
638
-        $y = $this->itens($x, $y+1, $nInicial, $hDispo1, $pag, $totPag, $hCabecItens);
638
+        $y = $this->itens($x, $y + 1, $nInicial, $hDispo1, $pag, $totPag, $hCabecItens);
639 639
 
640 640
         //coloca os dados do ISSQN
641 641
         if ($linhaISSQN == 1) {
642
-            $y = $this->issqn($x, $y+4);
642
+            $y = $this->issqn($x, $y + 4);
643 643
         } else {
644 644
             $y += 4;
645 645
         }
@@ -668,7 +668,7 @@  discard block
 block discarded – undo
668 668
             //coloca o cabeçalho na página adicional
669 669
             $y = $this->header($x, $y, $n, $totPag);
670 670
             //coloca os itens na página adicional
671
-            $y = $this->itens($x, $y+1, $nInicial, $hDispo2, $n, $totPag, $hCabecItens);
671
+            $y = $this->itens($x, $y + 1, $nInicial, $hDispo2, $n, $totPag, $hCabecItens);
672 672
             //coloca o rodapé da página
673 673
             if ($this->orientacao == 'P') {
674 674
                 $this->rodape($margEsq);
@@ -705,7 +705,7 @@  discard block
 block discarded – undo
705 705
         if ($startPos === false) {
706 706
             return $cdata;
707 707
         }
708
-        for ($x=$len; $x>0; $x--) {
708
+        for ($x = $len; $x > 0; $x--) {
709 709
             if (substr($cdata, $x, 1) == '>') {
710 710
                 $endPos = $x;
711 711
                 break;
@@ -716,15 +716,15 @@  discard block
 block discarded – undo
716 716
         } else {
717 717
             $parte1 = '';
718 718
         }
719
-        $parte2 = substr($cdata, $startPos, $endPos-$startPos+1);
719
+        $parte2 = substr($cdata, $startPos, $endPos - $startPos + 1);
720 720
         if ($endPos < $len) {
721 721
             $parte3 = substr($cdata, $endPos + 1, $len - $endPos - 1);
722 722
         } else {
723 723
             $parte3 = '';
724 724
         }
725
-        $texto = trim($parte1).' '.trim($parte3);
725
+        $texto = trim($parte1) . ' ' . trim($parte3);
726 726
         if (strpos($parte2, '<CDATA>') === false) {
727
-            $cdata = '<CDATA>'.$parte2.'</CDATA>';
727
+            $cdata = '<CDATA>' . $parte2 . '</CDATA>';
728 728
         } else {
729 729
             $cdata = $parte2;
730 730
         }
@@ -798,15 +798,15 @@  discard block
 block discarded – undo
798 798
         //grupo CADATA infCpl
799 799
         $t = $dom->getElementsByTagName('transmissor')->item(0);
800 800
         $r = $dom->getElementsByTagName('receptor')->item(0);
801
-        $versao = ! empty($dom->getElementsByTagName('versao')->item(0)->nodeValue) ?
802
-            'Versao:'.$dom->getElementsByTagName('versao')->item(0)->nodeValue.' ' : '';
803
-        $especieNF = ! empty($dom->getElementsByTagName('especieNF')->item(0)->nodeValue) ?
804
-            'Especie:'.$dom->getElementsByTagName('especieNF')->item(0)->nodeValue.' ' : '';
805
-        $fabEntrega = ! empty($dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue) ?
806
-            'Entrega:'.$dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue.' ' : '';
807
-        $dca = ! empty($dom->getElementsByTagName('dca')->item(0)->nodeValue) ?
808
-            'dca:'.$dom->getElementsByTagName('dca')->item(0)->nodeValue.' ' : '';
809
-        $texto .= "".$versao.$especieNF.$fabEntrega.$dca;
801
+        $versao = !empty($dom->getElementsByTagName('versao')->item(0)->nodeValue) ?
802
+            'Versao:' . $dom->getElementsByTagName('versao')->item(0)->nodeValue . ' ' : '';
803
+        $especieNF = !empty($dom->getElementsByTagName('especieNF')->item(0)->nodeValue) ?
804
+            'Especie:' . $dom->getElementsByTagName('especieNF')->item(0)->nodeValue . ' ' : '';
805
+        $fabEntrega = !empty($dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue) ?
806
+            'Entrega:' . $dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue . ' ' : '';
807
+        $dca = !empty($dom->getElementsByTagName('dca')->item(0)->nodeValue) ?
808
+            'dca:' . $dom->getElementsByTagName('dca')->item(0)->nodeValue . ' ' : '';
809
+        $texto .= "" . $versao . $especieNF . $fabEntrega . $dca;
810 810
         if (isset($t)) {
811 811
             if ($t->hasAttributes()) {
812 812
                 $texto .= " Transmissor ";
@@ -892,14 +892,14 @@  discard block
 block discarded – undo
892 892
         }
893 893
         //####################################################################################
894 894
         //coluna esquerda identificação do emitente
895
-        $w = round($maxW*0.41, 0);
895
+        $w = round($maxW * 0.41, 0);
896 896
         if ($this->orientacao == 'P') {
897 897
             $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>'I'];
898 898
         } else {
899 899
             $aFont = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B'];
900 900
         }
901 901
         $w1 = $w;
902
-        $h=32;
902
+        $h = 32;
903 903
         $oldY += $h;
904 904
         $this->pdf->textBox($x, $y, $w, $h);
905 905
         $texto = 'IDENTIFICAÇÃO DO EMITENTE';
@@ -920,39 +920,39 @@  discard block
 block discarded – undo
920 920
                 $type == 'jpg';
921 921
             }
922 922
             //largura da imagem em mm
923
-            $logoWmm = ($logoInfo[0]/72)*25.4;
923
+            $logoWmm = ($logoInfo[0] / 72) * 25.4;
924 924
             //altura da imagem em mm
925
-            $logoHmm = ($logoInfo[1]/72)*25.4;
926
-            if ($this->logoAlign=='L') {
927
-                $nImgW = round($w/3, 0);
928
-                $nImgH = round($logoHmm * ($nImgW/$logoWmm), 0);
929
-                $xImg = $x+1;
930
-                $yImg = round(($h-$nImgH)/2, 0)+$y;
925
+            $logoHmm = ($logoInfo[1] / 72) * 25.4;
926
+            if ($this->logoAlign == 'L') {
927
+                $nImgW = round($w / 3, 0);
928
+                $nImgH = round($logoHmm * ($nImgW / $logoWmm), 0);
929
+                $xImg = $x + 1;
930
+                $yImg = round(($h - $nImgH) / 2, 0) + $y;
931 931
                 //estabelecer posições do texto
932
-                $x1 = round($xImg + $nImgW +1, 0);
933
-                $y1 = round($h/3+$y, 0);
934
-                $tw = round(2*$w/3, 0);
935
-            } elseif ($this->logoAlign=='C') {
936
-                $nImgH = round($h/3, 0);
937
-                $nImgW = round($logoWmm * ($nImgH/$logoHmm), 0);
938
-                $xImg = round(($w-$nImgW)/2+$x, 0);
939
-                $yImg = $y+3;
932
+                $x1 = round($xImg + $nImgW + 1, 0);
933
+                $y1 = round($h / 3 + $y, 0);
934
+                $tw = round(2 * $w / 3, 0);
935
+            } elseif ($this->logoAlign == 'C') {
936
+                $nImgH = round($h / 3, 0);
937
+                $nImgW = round($logoWmm * ($nImgH / $logoHmm), 0);
938
+                $xImg = round(($w - $nImgW) / 2 + $x, 0);
939
+                $yImg = $y + 3;
940 940
                 $x1 = $x;
941 941
                 $y1 = round($yImg + $nImgH + 1, 0);
942 942
                 $tw = $w;
943
-            } elseif ($this->logoAlign=='R') {
944
-                $nImgW = round($w/3, 0);
945
-                $nImgH = round($logoHmm * ($nImgW/$logoWmm), 0);
946
-                $xImg = round($x+($w-(1+$nImgW)), 0);
947
-                $yImg = round(($h-$nImgH)/2, 0)+$y;
943
+            } elseif ($this->logoAlign == 'R') {
944
+                $nImgW = round($w / 3, 0);
945
+                $nImgH = round($logoHmm * ($nImgW / $logoWmm), 0);
946
+                $xImg = round($x + ($w - (1 + $nImgW)), 0);
947
+                $yImg = round(($h - $nImgH) / 2, 0) + $y;
948 948
                 $x1 = $x;
949
-                $y1 = round($h/3+$y, 0);
950
-                $tw = round(2*$w/3, 0);
951
-            } elseif ($this->logoAlign=='F') {
952
-                $nImgH = round($h-5, 0);
953
-                $nImgW = round($logoWmm * ($nImgH/$logoHmm), 0);
954
-                $xImg = round(($w-$nImgW)/2+$x, 0);
955
-                $yImg = $y+3;
949
+                $y1 = round($h / 3 + $y, 0);
950
+                $tw = round(2 * $w / 3, 0);
951
+            } elseif ($this->logoAlign == 'F') {
952
+                $nImgH = round($h - 5, 0);
953
+                $nImgW = round($logoWmm * ($nImgH / $logoHmm), 0);
954
+                $xImg = round(($w - $nImgW) / 2 + $x, 0);
955
+                $yImg = $y + 3;
956 956
                 $x1 = $x;
957 957
                 $y1 = round($yImg + $nImgH + 1, 0);
958 958
                 $tw = $w;
@@ -961,7 +961,7 @@  discard block
 block discarded – undo
961 961
             $this->pdf->Image($this->logomarca, $xImg, $yImg, $nImgW, $nImgH, $type);
962 962
         } else {
963 963
             $x1 = $x;
964
-            $y1 = round($h/3+$y, 0);
964
+            $y1 = round($h / 3 + $y, 0);
965 965
             $tw = $w;
966 966
         }
967 967
         // monta as informações apenas se diferente de full logo
@@ -971,9 +971,9 @@  discard block
 block discarded – undo
971 971
             $texto = $this->emit->getElementsByTagName("xNome")->item(0)->nodeValue;
972 972
             $this->pdf->textBox($x1, $y1, $tw, 8, $texto, $aFont, 'T', 'C', 0, '');
973 973
             //endereço
974
-            $y1 = $y1+5;
974
+            $y1 = $y1 + 5;
975 975
             $aFont = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>''];
976
-            $fone = ! empty($this->enderEmit->getElementsByTagName("fone")->item(0)->nodeValue)
976
+            $fone = !empty($this->enderEmit->getElementsByTagName("fone")->item(0)->nodeValue)
977 977
             ? $this->enderEmit->getElementsByTagName("fone")->item(0)->nodeValue
978 978
             : '';
979 979
             $lgr = $this->getTagValue($this->enderEmit, "xLgr");
@@ -993,33 +993,33 @@  discard block
 block discarded – undo
993 993
         //####################################################################################
994 994
         //coluna central Danfe
995 995
         $x += $w;
996
-        $w=round($maxW * 0.17, 0);//35;
996
+        $w = round($maxW * 0.17, 0); //35;
997 997
         $w2 = $w;
998 998
         $h = 32;
999 999
         $this->pdf->textBox($x, $y, $w, $h);
1000 1000
   
1001 1001
         $texto = "DANFE";
1002 1002
         $aFont = ['font'=>$this->fontePadrao, 'size'=>14, 'style'=>'B'];
1003
-        $this->pdf->textBox($x, $y+1, $w, $h, $texto, $aFont, 'T', 'C', 0, '');
1003
+        $this->pdf->textBox($x, $y + 1, $w, $h, $texto, $aFont, 'T', 'C', 0, '');
1004 1004
         $aFont = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>''];
1005 1005
         $texto = 'Documento Auxiliar da Nota Fiscal Eletrônica';
1006 1006
         $h = 20;
1007
-        $this->pdf->textBox($x, $y+6, $w, $h, $texto, $aFont, 'T', 'C', 0, '', false);
1007
+        $this->pdf->textBox($x, $y + 6, $w, $h, $texto, $aFont, 'T', 'C', 0, '', false);
1008 1008
 
1009 1009
         $aFont = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>''];
1010 1010
         $texto = '0 - ENTRADA';
1011 1011
         $y1 = $y + 14;
1012 1012
         $h = 8;
1013
-        $this->pdf->textBox($x+2, $y1, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1013
+        $this->pdf->textBox($x + 2, $y1, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1014 1014
         $texto = '1 - SAÍDA';
1015 1015
         $y1 = $y + 17;
1016
-        $this->pdf->textBox($x+2, $y1, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1016
+        $this->pdf->textBox($x + 2, $y1, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1017 1017
         //tipo de nF
1018 1018
         $aFont = ['font'=>$this->fontePadrao, 'size'=>12, 'style'=>'B'];
1019 1019
         $y1 = $y + 13;
1020 1020
         $h = 7;
1021 1021
         $texto = $this->ide->getElementsByTagName('tpNF')->item(0)->nodeValue;
1022
-        $this->pdf->textBox($x+27, $y1, 5, $h, $texto, $aFont, 'C', 'C', 1, '');
1022
+        $this->pdf->textBox($x + 27, $y1, 5, $h, $texto, $aFont, 'C', 'C', 1, '');
1023 1023
         //numero da NF
1024 1024
         $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'];
1025 1025
         $y1 = $y + 20;
@@ -1051,7 +1051,7 @@  discard block
 block discarded – undo
1051 1051
         //####################################################################################
1052 1052
         //coluna codigo de barras
1053 1053
         $x += $w;
1054
-        $w = ($maxW-$w1-$w2);//85;
1054
+        $w = ($maxW - $w1 - $w2); //85;
1055 1055
         $w3 = $w;
1056 1056
         $h = 32;
1057 1057
         $this->pdf->textBox($x, $y, $w, $h);
@@ -1060,22 +1060,22 @@  discard block
 block discarded – undo
1060 1060
         $bW = 75;
1061 1061
         $bH = 12;
1062 1062
         //codigo de barras
1063
-        $this->pdf->code128($x+(($w-$bW)/2), $y+2, $chave_acesso, $bW, $bH);
1063
+        $this->pdf->code128($x + (($w - $bW) / 2), $y + 2, $chave_acesso, $bW, $bH);
1064 1064
         //linhas divisorias
1065
-        $this->pdf->line($x, $y+4+$bH, $x+$w, $y+4+$bH);
1066
-        $this->pdf->line($x, $y+12+$bH, $x+$w, $y+12+$bH);
1065
+        $this->pdf->line($x, $y + 4 + $bH, $x + $w, $y + 4 + $bH);
1066
+        $this->pdf->line($x, $y + 12 + $bH, $x + $w, $y + 12 + $bH);
1067 1067
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1068
-        $y1 = $y+4+$bH;
1068
+        $y1 = $y + 4 + $bH;
1069 1069
         $h = 7;
1070 1070
         $texto = 'CHAVE DE ACESSO';
1071 1071
         $this->pdf->textBox($x, $y1, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1072 1072
         $aFont = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B'];
1073
-        $y1 = $y+8+$bH;
1073
+        $y1 = $y + 8 + $bH;
1074 1074
         $texto = $this->formatField($chave_acesso, $this->formatoChave);
1075
-        $this->pdf->textBox($x+2, $y1, $w-2, $h, $texto, $aFont, 'T', 'C', 0, '');
1076
-        $y1 = $y+12+$bH;
1075
+        $this->pdf->textBox($x + 2, $y1, $w - 2, $h, $texto, $aFont, 'T', 'C', 0, '');
1076
+        $y1 = $y + 12 + $bH;
1077 1077
         $aFont = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>''];
1078
-        $chaveContingencia="";
1078
+        $chaveContingencia = "";
1079 1079
         if ($this->notaDpec()) {
1080 1080
             $cabecalhoProtoAutorizacao = 'NÚMERO DE REGISTRO DPEC';
1081 1081
         } else {
@@ -1086,16 +1086,16 @@  discard block
 block discarded – undo
1086 1086
             $chaveContingencia = $this->geraChaveAdicionalDeContingencia();
1087 1087
             $this->pdf->setFillColor(0, 0, 0);
1088 1088
             //codigo de barras
1089
-            $this->pdf->code128($x+11, $y1+1, $chaveContingencia, $bW*.9, $bH/2);
1089
+            $this->pdf->code128($x + 11, $y1 + 1, $chaveContingencia, $bW * .9, $bH / 2);
1090 1090
         } else {
1091 1091
             $texto = 'Consulta de autenticidade no portal nacional da NF-e';
1092
-            $this->pdf->textBox($x+2, $y1, $w-2, $h, $texto, $aFont, 'T', 'C', 0, '');
1093
-            $y1 = $y+16+$bH;
1092
+            $this->pdf->textBox($x + 2, $y1, $w - 2, $h, $texto, $aFont, 'T', 'C', 0, '');
1093
+            $y1 = $y + 16 + $bH;
1094 1094
             $texto = 'www.nfe.fazenda.gov.br/portal ou no site da Sefaz Autorizadora';
1095 1095
             $this->pdf->textBox(
1096
-                $x+2,
1096
+                $x + 2,
1097 1097
                 $y1,
1098
-                $w-2,
1098
+                $w - 2,
1099 1099
                 $h,
1100 1100
                 $texto,
1101 1101
                 $aFont,
@@ -1111,7 +1111,7 @@  discard block
 block discarded – undo
1111 1111
         //natureza da operação
1112 1112
         $texto = 'NATUREZA DA OPERAÇÃO';
1113 1113
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1114
-        $w = $w1+$w2;
1114
+        $w = $w1 + $w2;
1115 1115
         $y = $oldY;
1116 1116
         $oldY += $h;
1117 1117
         $x = $oldX;
@@ -1144,7 +1144,7 @@  discard block
 block discarded – undo
1144 1144
                 $cStat = '';
1145 1145
             } else {
1146 1146
                 if (isset($this->nfeProc)) {
1147
-                    $texto = ! empty($this->nfeProc->getElementsByTagName("nProt")->item(0)->nodeValue)
1147
+                    $texto = !empty($this->nfeProc->getElementsByTagName("nProt")->item(0)->nodeValue)
1148 1148
                     ? $this->nfeProc->getElementsByTagName("nProt")->item(0)->nodeValue
1149 1149
                     : '';
1150 1150
                     $tsHora = $this->toTimestamp(
@@ -1178,25 +1178,25 @@  discard block
 block discarded – undo
1178 1178
         $texto = 'INSCRIÇÃO ESTADUAL DO SUBST. TRIBUT.';
1179 1179
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1180 1180
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1181
-        $texto = ! empty($this->emit->getElementsByTagName("IEST")->item(0)->nodeValue)
1181
+        $texto = !empty($this->emit->getElementsByTagName("IEST")->item(0)->nodeValue)
1182 1182
         ? $this->emit->getElementsByTagName("IEST")->item(0)->nodeValue
1183 1183
         : '';
1184 1184
         $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'];
1185 1185
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1186 1186
         //CNPJ
1187 1187
         $x += $w;
1188
-        $w = ($maxW-(2*$w));
1188
+        $w = ($maxW - (2 * $w));
1189 1189
         $texto = 'CNPJ / CPF';
1190 1190
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1191 1191
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1192 1192
         //Pegando valor do CPF/CNPJ
1193
-        if (! empty($this->emit->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1193
+        if (!empty($this->emit->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1194 1194
             $texto = $this->formatField(
1195 1195
                 $this->emit->getElementsByTagName("CNPJ")->item(0)->nodeValue,
1196 1196
                 "###.###.###/####-##"
1197 1197
             );
1198 1198
         } else {
1199
-            $texto = ! empty($this->emit->getElementsByTagName("CPF")->item(0)->nodeValue)
1199
+            $texto = !empty($this->emit->getElementsByTagName("CPF")->item(0)->nodeValue)
1200 1200
             ? $this->formatField(
1201 1201
                 $this->emit->getElementsByTagName("CPF")->item(0)->nodeValue,
1202 1202
                 "###.###.###-##"
@@ -1213,22 +1213,22 @@  discard block
 block discarded – undo
1213 1213
         $resp = $this->statusNFe();
1214 1214
         if (!$resp['status']) {
1215 1215
             $x = 10;
1216
-            $y = $this->hPrint-130;
1216
+            $y = $this->hPrint - 130;
1217 1217
             $h = 25;
1218
-            $w = $maxW-(2*$x);
1218
+            $w = $maxW - (2 * $x);
1219 1219
             $this->pdf->settextcolor(90, 90, 90);
1220 1220
             $texto = $resp['message'];
1221 1221
             $aFont = ['font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B'];
1222 1222
             $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1223 1223
             $y += $h;
1224 1224
             $h = 5;
1225
-            $w = $maxW-(2*$x);
1225
+            $w = $maxW - (2 * $x);
1226 1226
             if (isset($this->infProt) && $resp['status']) {
1227 1227
                 $xMotivo = $this->infProt->getElementsByTagName("xMotivo")->item(0)->nodeValue;
1228 1228
             } else {
1229 1229
                 $xMotivo = '';
1230 1230
             }
1231
-            $texto = "SEM VALOR FISCAL\n".$xMotivo;
1231
+            $texto = "SEM VALOR FISCAL\n" . $xMotivo;
1232 1232
             $aFont = ['font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B'];
1233 1233
             $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1234 1234
             $this->pdf->settextcolor(0, 0, 0);
@@ -1251,12 +1251,12 @@  discard block
 block discarded – undo
1251 1251
         if ($this->notaDpec() || $this->tpEmis == 4) {
1252 1252
             //DPEC
1253 1253
             $x = 10;
1254
-            $y = $this->hPrint-130;
1254
+            $y = $this->hPrint - 130;
1255 1255
             $h = 25;
1256
-            $w = $maxW-(2*$x);
1256
+            $w = $maxW - (2 * $x);
1257 1257
             $this->pdf->SetTextColor(200, 200, 200);
1258
-            $texto = "DANFE impresso em contingência -\n".
1259
-                     "DPEC regularmente recebido pela Receita\n".
1258
+            $texto = "DANFE impresso em contingência -\n" .
1259
+                     "DPEC regularmente recebido pela Receita\n" .
1260 1260
                      "Federal do Brasil";
1261 1261
             $aFont = ['font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B'];
1262 1262
             $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
@@ -1375,7 +1375,7 @@  discard block
 block discarded – undo
1375 1375
         $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
1376 1376
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1377 1377
         //NOME / RAZÃO SOCIAL
1378
-        $w = round($maxW*0.61, 0);
1378
+        $w = round($maxW * 0.61, 0);
1379 1379
         $w1 = $w;
1380 1380
         $y += 3;
1381 1381
         $texto = 'NOME / RAZÃO SOCIAL';
@@ -1390,19 +1390,19 @@  discard block
 block discarded – undo
1390 1390
         }
1391 1391
         //CNPJ / CPF
1392 1392
         $x += $w;
1393
-        $w = round($maxW*0.23, 0);
1393
+        $w = round($maxW * 0.23, 0);
1394 1394
         $w2 = $w;
1395 1395
         $texto = 'CNPJ / CPF';
1396 1396
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1397 1397
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1398 1398
         //Pegando valor do CPF/CNPJ
1399
-        if (! empty($this->dest->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1399
+        if (!empty($this->dest->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1400 1400
             $texto = $this->formatField(
1401 1401
                 $this->dest->getElementsByTagName("CNPJ")->item(0)->nodeValue,
1402 1402
                 "###.###.###/####-##"
1403 1403
             );
1404 1404
         } else {
1405
-            $texto = ! empty($this->dest->getElementsByTagName("CPF")->item(0)->nodeValue)
1405
+            $texto = !empty($this->dest->getElementsByTagName("CPF")->item(0)->nodeValue)
1406 1406
             ? $this->formatField(
1407 1407
                 $this->dest->getElementsByTagName("CPF")->item(0)->nodeValue,
1408 1408
                 "###.###.###-##"
@@ -1413,16 +1413,16 @@  discard block
 block discarded – undo
1413 1413
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1414 1414
         //DATA DA EMISSÃO
1415 1415
         $x += $w;
1416
-        $w = $maxW-($w1+$w2);
1416
+        $w = $maxW - ($w1 + $w2);
1417 1417
         $wx = $w;
1418 1418
         $texto = 'DATA DA EMISSÃO';
1419 1419
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1420 1420
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1421
-        $dEmi = ! empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue)
1421
+        $dEmi = !empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue)
1422 1422
         ? $this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue
1423 1423
         : '';
1424 1424
         if ($dEmi == '') {
1425
-            $dEmi = ! empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue)
1425
+            $dEmi = !empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue)
1426 1426
             ? $this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue
1427 1427
             : '';
1428 1428
             $aDemi = explode('T', $dEmi);
@@ -1436,7 +1436,7 @@  discard block
 block discarded – undo
1436 1436
             $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 1, '');
1437 1437
         }
1438 1438
         //ENDEREÇO
1439
-        $w = round($maxW*0.47, 0);
1439
+        $w = round($maxW * 0.47, 0);
1440 1440
         $w1 = $w;
1441 1441
         $y += $h;
1442 1442
         $x = $oldX;
@@ -1451,7 +1451,7 @@  discard block
 block discarded – undo
1451 1451
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 0, '', true);
1452 1452
         //BAIRRO / DISTRITO
1453 1453
         $x += $w;
1454
-        $w = round($maxW*0.21, 0);
1454
+        $w = round($maxW * 0.21, 0);
1455 1455
         $w2 = $w;
1456 1456
         $texto = 'BAIRRO / DISTRITO';
1457 1457
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
@@ -1461,12 +1461,12 @@  discard block
 block discarded – undo
1461 1461
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1462 1462
         //CEP
1463 1463
         $x += $w;
1464
-        $w = $maxW-$w1-$w2-$wx;
1464
+        $w = $maxW - $w1 - $w2 - $wx;
1465 1465
         $w2 = $w;
1466 1466
         $texto = 'CEP';
1467 1467
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1468 1468
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1469
-        $texto = ! empty($this->dest->getElementsByTagName("CEP")->item(0)->nodeValue)
1469
+        $texto = !empty($this->dest->getElementsByTagName("CEP")->item(0)->nodeValue)
1470 1470
         ? $this->dest->getElementsByTagName("CEP")->item(0)->nodeValue
1471 1471
         : '';
1472 1472
         $texto = $this->formatField($texto, "#####-###");
@@ -1478,11 +1478,11 @@  discard block
 block discarded – undo
1478 1478
         $texto = 'DATA DA SAÍDA/ENTRADA';
1479 1479
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1480 1480
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1481
-        $dSaiEnt = ! empty($this->ide->getElementsByTagName("dSaiEnt")->item(0)->nodeValue)
1481
+        $dSaiEnt = !empty($this->ide->getElementsByTagName("dSaiEnt")->item(0)->nodeValue)
1482 1482
             ? $this->ide->getElementsByTagName("dSaiEnt")->item(0)->nodeValue
1483 1483
             : '';
1484 1484
         if ($dSaiEnt == '') {
1485
-            $dSaiEnt = ! empty($this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue)
1485
+            $dSaiEnt = !empty($this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue)
1486 1486
                 ? $this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue
1487 1487
                 : '';
1488 1488
             $aDsaient = explode('T', $dSaiEnt);
@@ -1502,7 +1502,7 @@  discard block
 block discarded – undo
1502 1502
         if (strtoupper(trim($texto)) == "EXTERIOR"
1503 1503
             && $this->dest->getElementsByTagName("xPais")->length > 0
1504 1504
         ) {
1505
-            $texto .= " - " .  $this->dest->getElementsByTagName("xPais")->item(0)->nodeValue;
1505
+            $texto .= " - " . $this->dest->getElementsByTagName("xPais")->item(0)->nodeValue;
1506 1506
         }
1507 1507
         $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'];
1508 1508
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 0, '');
@@ -1517,19 +1517,19 @@  discard block
 block discarded – undo
1517 1517
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1518 1518
         //FONE / FAX
1519 1519
         $x += $w;
1520
-        $w = round(($maxW -$w1-$wx-8)/2, 0);
1520
+        $w = round(($maxW - $w1 - $wx - 8) / 2, 0);
1521 1521
         $w3 = $w;
1522 1522
         $texto = 'FONE / FAX';
1523 1523
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1524 1524
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1525
-        $texto = ! empty($this->dest->getElementsByTagName("fone")->item(0)->nodeValue)
1525
+        $texto = !empty($this->dest->getElementsByTagName("fone")->item(0)->nodeValue)
1526 1526
         ? $this->dest->getElementsByTagName("fone")->item(0)->nodeValue
1527 1527
         : '';
1528 1528
         $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'];
1529 1529
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1530 1530
         //INSCRIÇÃO ESTADUAL
1531 1531
         $x += $w;
1532
-        $w = $maxW -$w1-$wx-8-$w3;
1532
+        $w = $maxW - $w1 - $wx - 8 - $w3;
1533 1533
         $texto = 'INSCRIÇÃO ESTADUAL';
1534 1534
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1535 1535
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -1543,11 +1543,11 @@  discard block
 block discarded – undo
1543 1543
         $texto = 'HORA DA SAÍDA/ENTRADA';
1544 1544
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1545 1545
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1546
-        $hSaiEnt = ! empty($this->ide->getElementsByTagName("hSaiEnt")->item(0)->nodeValue)
1546
+        $hSaiEnt = !empty($this->ide->getElementsByTagName("hSaiEnt")->item(0)->nodeValue)
1547 1547
         ? $this->ide->getElementsByTagName("hSaiEnt")->item(0)->nodeValue
1548 1548
         : '';
1549 1549
         if ($hSaiEnt == '') {
1550
-            $dhSaiEnt = ! empty($this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue)
1550
+            $dhSaiEnt = !empty($this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue)
1551 1551
             ? $this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue
1552 1552
             : '';
1553 1553
             $tsDhSaiEnt = $this->toTimestamp($dhSaiEnt);
@@ -1627,7 +1627,7 @@  discard block
 block discarded – undo
1627 1627
     protected function fatura($x, $y)
1628 1628
     {
1629 1629
         $linha = 1;
1630
-        $h = 8+3;
1630
+        $h = 8 + 3;
1631 1631
         $oldx = $x;
1632 1632
         $textoFatura = $this->getTextoFatura();
1633 1633
         //verificar se existem duplicatas
@@ -1660,29 +1660,29 @@  discard block
 block discarded – undo
1660 1660
                 return ($y + $h - 3);
1661 1661
             }
1662 1662
             if ($textoFatura !== "" && $this->exibirTextoFatura) {
1663
-                $myH=6;
1663
+                $myH = 6;
1664 1664
                 $myW = $this->wPrint;
1665 1665
                 if ($this->orientacao == 'L') {
1666 1666
                     $myW -= $this->wCanhoto;
1667 1667
                 }
1668 1668
                 $aFont = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>''];
1669 1669
                 $this->pdf->textBox($x, $y, $myW, $myH, $textoFatura, $aFont, 'C', 'L', 1, '');
1670
-                $y+=$myH+1;
1670
+                $y += $myH + 1;
1671 1671
             }
1672 1672
             if ($this->orientacao == 'P') {
1673
-                $w = round($this->wPrint/7.018, 0)-1;
1673
+                $w = round($this->wPrint / 7.018, 0) - 1;
1674 1674
             } else {
1675 1675
                 $w = 28;
1676 1676
             }
1677 1677
             $increm = 1;
1678 1678
             foreach ($this->dup as $k => $d) {
1679
-                $nDup = ! empty($this->dup->item($k)->getElementsByTagName('nDup')->item(0)->nodeValue)
1679
+                $nDup = !empty($this->dup->item($k)->getElementsByTagName('nDup')->item(0)->nodeValue)
1680 1680
                 ? $this->dup->item($k)->getElementsByTagName('nDup')->item(0)->nodeValue
1681 1681
                 : '';
1682
-                $dDup = ! empty($this->dup->item($k)->getElementsByTagName('dVenc')->item(0)->nodeValue)
1682
+                $dDup = !empty($this->dup->item($k)->getElementsByTagName('dVenc')->item(0)->nodeValue)
1683 1683
                 ? $this->ymdTodmy($this->dup->item($k)->getElementsByTagName('dVenc')->item(0)->nodeValue)
1684 1684
                 : '';
1685
-                $vDup = ! empty($this->dup->item($k)->getElementsByTagName('vDup')->item(0)->nodeValue)
1685
+                $vDup = !empty($this->dup->item($k)->getElementsByTagName('vDup')->item(0)->nodeValue)
1686 1686
                 ? 'R$ ' . number_format(
1687 1687
                     $this->dup->item($k)->getElementsByTagName('vDup')->item(0)->nodeValue,
1688 1688
                     2,
@@ -1692,14 +1692,14 @@  discard block
 block discarded – undo
1692 1692
                 : '';
1693 1693
                 $h = 8;
1694 1694
                 $texto = '';
1695
-                if ($nDup!='0' && $nDup!='') {
1695
+                if ($nDup != '0' && $nDup != '') {
1696 1696
                     $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1697 1697
                     $this->pdf->textBox($x, $y, $w, $h, 'Num.', $aFont, 'T', 'L', 1, '');
1698 1698
                     $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
1699 1699
                     $this->pdf->textBox($x, $y, $w, $h, $nDup, $aFont, 'T', 'R', 0, '');
1700 1700
                 } else {
1701 1701
                     $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1702
-                    $this->pdf->textBox($x, $y, $w, $h, ($dupcont+1)."", $aFont, 'T', 'L', 1, '');
1702
+                    $this->pdf->textBox($x, $y, $w, $h, ($dupcont + 1) . "", $aFont, 'T', 'L', 1, '');
1703 1703
                 }
1704 1704
                 $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1705 1705
                 $this->pdf->textBox($x, $y, $w, $h, 'Venc.', $aFont, 'C', 'L', 0, '');
@@ -1709,7 +1709,7 @@  discard block
 block discarded – undo
1709 1709
                 $this->pdf->textBox($x, $y, $w, $h, 'Valor', $aFont, 'B', 'L', 0, '');
1710 1710
                 $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
1711 1711
                 $this->pdf->textBox($x, $y, $w, $h, $vDup, $aFont, 'B', 'R', 0, '');
1712
-                $x += $w+$increm;
1712
+                $x += $w + $increm;
1713 1713
                 $dupcont += 1;
1714 1714
                 if ($this->orientacao == 'P') {
1715 1715
                     $maxDupCont = 6;
@@ -1731,10 +1731,10 @@  discard block
 block discarded – undo
1731 1731
                 $y -= 9;
1732 1732
                 $linha--;
1733 1733
             }
1734
-            return ($y+$h);
1734
+            return ($y + $h);
1735 1735
         } else {
1736 1736
             $linha = 0;
1737
-            return ($y-2);
1737
+            return ($y - 2);
1738 1738
         }
1739 1739
     }
1740 1740
 
@@ -1750,7 +1750,7 @@  discard block
 block discarded – undo
1750 1750
     protected function pagamento($x, $y)
1751 1751
     {
1752 1752
         $linha = 1;
1753
-        $h = 8+3;
1753
+        $h = 8 + 3;
1754 1754
         $oldx = $x;
1755 1755
         //verificar se existem cobranças definidas
1756 1756
         if (isset($this->detPag) && $this->detPag->length > 0) {
@@ -1769,7 +1769,7 @@  discard block
 block discarded – undo
1769 1769
             $dups = "";
1770 1770
             $dupcont = 0;
1771 1771
             if ($this->orientacao == 'P') {
1772
-                $w = round($this->wPrint/7.018, 0)-1;
1772
+                $w = round($this->wPrint / 7.018, 0) - 1;
1773 1773
             } else {
1774 1774
                 $w = 28;
1775 1775
             }
@@ -1779,17 +1779,17 @@  discard block
 block discarded – undo
1779 1779
                 $maxDupCont = 8;
1780 1780
             }
1781 1781
             $increm = 1;
1782
-            $formaPagamento = ['01'=>'Dinheiro','02'=>'Cheque','03'=>'Cartão de Crédito',
1783
-                                    '04'=>'Cartão de Débito','05'=>'Crédito Loja','10'=>'Vale Alimentação',
1784
-                                    '11'=>'Vale Refeição','12'=>'Vale Presente','13'=>'Vale Combustível',
1785
-                                    '14'=>'Duplicata Mercantil','15'=>'Boleto','90'=>'Sem pagamento','99'=>'Outros'];
1786
-            $bandeira = ['01'=>'Visa','02'=>'Mastercard','03'=>'American','04'=>'Sorocred','05'=>'Diners',
1787
-                              '06'=>'Elo','07'=>'Hipercard','08'=>'Aura','09'=>'Cabal','99'=>'Outros'];
1782
+            $formaPagamento = ['01'=>'Dinheiro', '02'=>'Cheque', '03'=>'Cartão de Crédito',
1783
+                                    '04'=>'Cartão de Débito', '05'=>'Crédito Loja', '10'=>'Vale Alimentação',
1784
+                                    '11'=>'Vale Refeição', '12'=>'Vale Presente', '13'=>'Vale Combustível',
1785
+                                    '14'=>'Duplicata Mercantil', '15'=>'Boleto', '90'=>'Sem pagamento', '99'=>'Outros'];
1786
+            $bandeira = ['01'=>'Visa', '02'=>'Mastercard', '03'=>'American', '04'=>'Sorocred', '05'=>'Diners',
1787
+                              '06'=>'Elo', '07'=>'Hipercard', '08'=>'Aura', '09'=>'Cabal', '99'=>'Outros'];
1788 1788
             foreach ($this->detPag as $k => $d) {
1789 1789
                 $fPag = !empty($this->detPag->item($k)->getElementsByTagName('tPag')->item(0)->nodeValue)
1790 1790
                 ? $this->detPag->item($k)->getElementsByTagName('tPag')->item(0)->nodeValue
1791 1791
                 : '0';
1792
-                $vPag = ! empty($this->detPag->item($k)->getElementsByTagName('vPag')->item(0)->nodeValue)
1792
+                $vPag = !empty($this->detPag->item($k)->getElementsByTagName('vPag')->item(0)->nodeValue)
1793 1793
                 ? 'R$ ' . number_format(
1794 1794
                     $this->detPag->item($k)->getElementsByTagName('vPag')->item(0)->nodeValue,
1795 1795
                     2,
@@ -1801,7 +1801,7 @@  discard block
 block discarded – undo
1801 1801
                 $texto = '';
1802 1802
                 if (isset($formaPagamento[$fPag])) {
1803 1803
                     /*Exibir Item sem pagamento ou outros?*/
1804
-                    if ($fPag=='90' || $fPag=='99') {
1804
+                    if ($fPag == '90' || $fPag == '99') {
1805 1805
                         continue;
1806 1806
                     }
1807 1807
                     $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
@@ -1810,16 +1810,16 @@  discard block
 block discarded – undo
1810 1810
                     $this->pdf->textBox($x, $y, $w, $h, $formaPagamento[$fPag], $aFont, 'T', 'R', 0, '');
1811 1811
                 } else {
1812 1812
                     $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>''];
1813
-                    $this->pdf->textBox($x, $y, $w, $h, "Forma ".$fPag." não encontrado", $aFont, 'T', 'L', 1, '');
1813
+                    $this->pdf->textBox($x, $y, $w, $h, "Forma " . $fPag . " não encontrado", $aFont, 'T', 'L', 1, '');
1814 1814
                 }
1815 1815
                 $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1816 1816
                 $this->pdf->textBox($x, $y, $w, $h, 'Valor', $aFont, 'B', 'L', 0, '');
1817 1817
                 $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
1818 1818
                 $this->pdf->textBox($x, $y, $w, $h, $vPag, $aFont, 'B', 'R', 0, '');
1819
-                $x += $w+$increm;
1819
+                $x += $w + $increm;
1820 1820
                 $dupcont += 1;
1821 1821
 
1822
-                if ($dupcont>$maxDupCont) {
1822
+                if ($dupcont > $maxDupCont) {
1823 1823
                     $y += 9;
1824 1824
                     $x = $oldx;
1825 1825
                     $dupcont = 0;
@@ -1834,10 +1834,10 @@  discard block
 block discarded – undo
1834 1834
                 $y -= 9;
1835 1835
                 $linha--;
1836 1836
             }
1837
-            return ($y+$h);
1837
+            return ($y + $h);
1838 1838
         } else {
1839 1839
             $linha = 0;
1840
-            return ($y-2);
1840
+            return ($y - 2);
1841 1841
         }
1842 1842
     } //fim da função pagamento
1843 1843
     
@@ -1949,7 +1949,7 @@  discard block
 block discarded – undo
1949 1949
         }
1950 1950
         $x = $this->impostoHelper($x, $y, $w, $h, "V. TOTAL DA NOTA", "vNF");
1951 1951
 
1952
-        return ($y+$h);
1952
+        return ($y + $h);
1953 1953
     } //fim imposto
1954 1954
 
1955 1955
     /**
@@ -1977,13 +1977,13 @@  discard block
 block discarded – undo
1977 1977
         $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
1978 1978
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1979 1979
         //NOME / RAZÃO SOCIAL
1980
-        $w1 = $maxW*0.29;
1980
+        $w1 = $maxW * 0.29;
1981 1981
         $y += 3;
1982 1982
         $texto = 'NOME / RAZÃO SOCIAL';
1983 1983
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1984 1984
         $this->pdf->textBox($x, $y, $w1, $h, $texto, $aFont, 'T', 'L', 1, '');
1985 1985
         if (isset($this->transporta)) {
1986
-            $texto = ! empty($this->transporta->getElementsByTagName("xNome")->item(0)->nodeValue)
1986
+            $texto = !empty($this->transporta->getElementsByTagName("xNome")->item(0)->nodeValue)
1987 1987
             ? $this->transporta->getElementsByTagName("xNome")->item(0)->nodeValue
1988 1988
             : '';
1989 1989
         } else {
@@ -1993,11 +1993,11 @@  discard block
 block discarded – undo
1993 1993
         $this->pdf->textBox($x, $y, $w1, $h, $texto, $aFont, 'B', 'L', 0, '');
1994 1994
         //FRETE POR CONTA
1995 1995
         $x += $w1;
1996
-        $w2 = $maxW*0.15;
1996
+        $w2 = $maxW * 0.15;
1997 1997
         $texto = 'FRETE';
1998 1998
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1999 1999
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
2000
-        $tipoFrete = ! empty($this->transp->getElementsByTagName("modFrete")->item(0)->nodeValue)
2000
+        $tipoFrete = !empty($this->transp->getElementsByTagName("modFrete")->item(0)->nodeValue)
2001 2001
         ? $this->transp->getElementsByTagName("modFrete")->item(0)->nodeValue
2002 2002
         : '0';
2003 2003
         switch ($tipoFrete) {
@@ -2028,7 +2028,7 @@  discard block
 block discarded – undo
2028 2028
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2029 2029
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
2030 2030
         if (isset($this->veicTransp)) {
2031
-            $texto = ! empty($this->veicTransp->getElementsByTagName("RNTC")->item(0)->nodeValue)
2031
+            $texto = !empty($this->veicTransp->getElementsByTagName("RNTC")->item(0)->nodeValue)
2032 2032
             ? $this->veicTransp->getElementsByTagName("RNTC")->item(0)->nodeValue
2033 2033
             : '';
2034 2034
         } else {
@@ -2042,11 +2042,11 @@  discard block
 block discarded – undo
2042 2042
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2043 2043
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
2044 2044
         if (isset($this->veicTransp)) {
2045
-            $texto = ! empty($this->veicTransp->getElementsByTagName("placa")->item(0)->nodeValue)
2045
+            $texto = !empty($this->veicTransp->getElementsByTagName("placa")->item(0)->nodeValue)
2046 2046
             ? $this->veicTransp->getElementsByTagName("placa")->item(0)->nodeValue
2047 2047
             : '';
2048 2048
         } elseif (isset($this->reboque)) {
2049
-            $texto = ! empty($this->reboque->getElementsByTagName("placa")->item(0)->nodeValue)
2049
+            $texto = !empty($this->reboque->getElementsByTagName("placa")->item(0)->nodeValue)
2050 2050
             ? $this->reboque->getElementsByTagName("placa")->item(0)->nodeValue
2051 2051
             : '';
2052 2052
         } else {
@@ -2056,16 +2056,16 @@  discard block
 block discarded – undo
2056 2056
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'B', 'C', 0, '');
2057 2057
         //UF
2058 2058
         $x += $w2;
2059
-        $w3 = round($maxW*0.04, 0);
2059
+        $w3 = round($maxW * 0.04, 0);
2060 2060
         $texto = 'UF';
2061 2061
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2062 2062
         $this->pdf->textBox($x, $y, $w3, $h, $texto, $aFont, 'T', 'L', 1, '');
2063 2063
         if (isset($this->veicTransp)) {
2064
-            $texto = ! empty($this->veicTransp->getElementsByTagName("UF")->item(0)->nodeValue)
2064
+            $texto = !empty($this->veicTransp->getElementsByTagName("UF")->item(0)->nodeValue)
2065 2065
             ? $this->veicTransp->getElementsByTagName("UF")->item(0)->nodeValue
2066 2066
             : '';
2067 2067
         } elseif (isset($this->reboque)) {
2068
-            $texto = ! empty($this->reboque->getElementsByTagName("UF")->item(0)->nodeValue)
2068
+            $texto = !empty($this->reboque->getElementsByTagName("UF")->item(0)->nodeValue)
2069 2069
             ? $this->reboque->getElementsByTagName("UF")->item(0)->nodeValue
2070 2070
             : '';
2071 2071
         } else {
@@ -2075,19 +2075,19 @@  discard block
 block discarded – undo
2075 2075
         $this->pdf->textBox($x, $y, $w3, $h, $texto, $aFont, 'B', 'C', 0, '');
2076 2076
         //CNPJ / CPF
2077 2077
         $x += $w3;
2078
-        $w = $maxW-($w1+3*$w2+$w3);
2078
+        $w = $maxW - ($w1 + 3 * $w2 + $w3);
2079 2079
         $texto = 'CNPJ / CPF';
2080 2080
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2081 2081
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
2082 2082
         if (isset($this->transporta)) {
2083
-            $texto = ! empty($this->transporta->getElementsByTagName("CNPJ")->item(0)->nodeValue)
2083
+            $texto = !empty($this->transporta->getElementsByTagName("CNPJ")->item(0)->nodeValue)
2084 2084
             ? $this->formatField(
2085 2085
                 $this->transporta->getElementsByTagName("CNPJ")->item(0)->nodeValue,
2086 2086
                 "##.###.###/####-##"
2087 2087
             )
2088 2088
             : '';
2089 2089
             if ($texto == '') {
2090
-                $texto = ! empty($this->transporta->getElementsByTagName("CPF")->item(0)->nodeValue)
2090
+                $texto = !empty($this->transporta->getElementsByTagName("CPF")->item(0)->nodeValue)
2091 2091
                 ? $this->formatField(
2092 2092
                     $this->transporta->getElementsByTagName("CPF")->item(0)->nodeValue,
2093 2093
                     "###.###.###-##"
@@ -2104,12 +2104,12 @@  discard block
 block discarded – undo
2104 2104
         $y += $h;
2105 2105
         $x = $oldX;
2106 2106
         $h = 7;
2107
-        $w1 = $maxW*0.44;
2107
+        $w1 = $maxW * 0.44;
2108 2108
         $texto = 'ENDEREÇO';
2109 2109
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2110 2110
         $this->pdf->textBox($x, $y, $w1, $h, $texto, $aFont, 'T', 'L', 1, '');
2111 2111
         if (isset($this->transporta)) {
2112
-            $texto = ! empty($this->transporta->getElementsByTagName("xEnder")->item(0)->nodeValue)
2112
+            $texto = !empty($this->transporta->getElementsByTagName("xEnder")->item(0)->nodeValue)
2113 2113
                 ? $this->transporta->getElementsByTagName("xEnder")->item(0)->nodeValue
2114 2114
                 : '';
2115 2115
         } else {
@@ -2119,12 +2119,12 @@  discard block
 block discarded – undo
2119 2119
         $this->pdf->textBox($x, $y, $w1, $h, $texto, $aFont, 'B', 'L', 0, '');
2120 2120
         //MUNICÍPIO
2121 2121
         $x += $w1;
2122
-        $w2 = round($maxW*0.30, 0);
2122
+        $w2 = round($maxW * 0.30, 0);
2123 2123
         $texto = 'MUNICÍPIO';
2124 2124
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2125 2125
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
2126 2126
         if (isset($this->transporta)) {
2127
-            $texto = ! empty($this->transporta->getElementsByTagName("xMun")->item(0)->nodeValue)
2127
+            $texto = !empty($this->transporta->getElementsByTagName("xMun")->item(0)->nodeValue)
2128 2128
                 ? $this->transporta->getElementsByTagName("xMun")->item(0)->nodeValue
2129 2129
                 : '';
2130 2130
         } else {
@@ -2134,12 +2134,12 @@  discard block
 block discarded – undo
2134 2134
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'B', 'C', 0, '');
2135 2135
         //UF
2136 2136
         $x += $w2;
2137
-        $w3 = round($maxW*0.04, 0);
2137
+        $w3 = round($maxW * 0.04, 0);
2138 2138
         $texto = 'UF';
2139 2139
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2140 2140
         $this->pdf->textBox($x, $y, $w3, $h, $texto, $aFont, 'T', 'L', 1, '');
2141 2141
         if (isset($this->transporta)) {
2142
-            $texto = ! empty($this->transporta->getElementsByTagName("UF")->item(0)->nodeValue)
2142
+            $texto = !empty($this->transporta->getElementsByTagName("UF")->item(0)->nodeValue)
2143 2143
                 ? $this->transporta->getElementsByTagName("UF")->item(0)->nodeValue
2144 2144
                 : '';
2145 2145
         } else {
@@ -2149,13 +2149,13 @@  discard block
 block discarded – undo
2149 2149
         $this->pdf->textBox($x, $y, $w3, $h, $texto, $aFont, 'B', 'C', 0, '');
2150 2150
         //INSCRIÇÃO ESTADUAL
2151 2151
         $x += $w3;
2152
-        $w = $maxW-($w1+$w2+$w3);
2152
+        $w = $maxW - ($w1 + $w2 + $w3);
2153 2153
         $texto = 'INSCRIÇÃO ESTADUAL';
2154 2154
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2155 2155
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
2156 2156
         $texto = '';
2157 2157
         if (isset($this->transporta)) {
2158
-            if (! empty($this->transporta->getElementsByTagName("IE")->item(0)->nodeValue)) {
2158
+            if (!empty($this->transporta->getElementsByTagName("IE")->item(0)->nodeValue)) {
2159 2159
                 $texto = $this->transporta->getElementsByTagName("IE")->item(0)->nodeValue;
2160 2160
             }
2161 2161
         }
@@ -2168,16 +2168,16 @@  discard block
 block discarded – undo
2168 2168
         $marca = '';
2169 2169
         $numero = '';
2170 2170
         $texto = '';
2171
-        $pesoBruto=0;
2172
-        $pesoLiquido=0;
2171
+        $pesoBruto = 0;
2172
+        $pesoLiquido = 0;
2173 2173
         foreach ($volumes as $volume) {
2174
-            $quantidade += ! empty($volume->getElementsByTagName("qVol")->item(0)->nodeValue) ?
2174
+            $quantidade += !empty($volume->getElementsByTagName("qVol")->item(0)->nodeValue) ?
2175 2175
                     $volume->getElementsByTagName("qVol")->item(0)->nodeValue : 0;
2176
-            $pesoBruto += ! empty($volume->getElementsByTagName("pesoB")->item(0)->nodeValue) ?
2176
+            $pesoBruto += !empty($volume->getElementsByTagName("pesoB")->item(0)->nodeValue) ?
2177 2177
                     $volume->getElementsByTagName("pesoB")->item(0)->nodeValue : 0;
2178
-            $pesoLiquido += ! empty($volume->getElementsByTagName("pesoL")->item(0)->nodeValue) ?
2178
+            $pesoLiquido += !empty($volume->getElementsByTagName("pesoL")->item(0)->nodeValue) ?
2179 2179
                     $volume->getElementsByTagName("pesoL")->item(0)->nodeValue : 0;
2180
-            $texto = ! empty($this->transp->getElementsByTagName("esp")->item(0)->nodeValue) ?
2180
+            $texto = !empty($this->transp->getElementsByTagName("esp")->item(0)->nodeValue) ?
2181 2181
                     $this->transp->getElementsByTagName("esp")->item(0)->nodeValue : '';
2182 2182
             if ($texto != $especie && $especie != '') {
2183 2183
                 //tem várias especies
@@ -2185,7 +2185,7 @@  discard block
 block discarded – undo
2185 2185
             } else {
2186 2186
                 $especie = $texto;
2187 2187
             }
2188
-            $texto = ! empty($this->transp->getElementsByTagName("marca")->item(0)->nodeValue)
2188
+            $texto = !empty($this->transp->getElementsByTagName("marca")->item(0)->nodeValue)
2189 2189
                 ? $this->transp->getElementsByTagName("marca")->item(0)->nodeValue
2190 2190
                 : '';
2191 2191
             if ($texto != $marca && $marca != '') {
@@ -2194,7 +2194,7 @@  discard block
 block discarded – undo
2194 2194
             } else {
2195 2195
                 $marca = $texto;
2196 2196
             }
2197
-            $texto = ! empty($this->transp->getElementsByTagName("nVol")->item(0)->nodeValue)
2197
+            $texto = !empty($this->transp->getElementsByTagName("nVol")->item(0)->nodeValue)
2198 2198
                 ? $this->transp->getElementsByTagName("nVol")->item(0)->nodeValue
2199 2199
                 : '';
2200 2200
             if ($texto != $numero && $numero != '') {
@@ -2210,7 +2210,7 @@  discard block
 block discarded – undo
2210 2210
         $y += $h;
2211 2211
         $x = $oldX;
2212 2212
         $h = 7;
2213
-        $w1 = round($maxW*0.10, 0);
2213
+        $w1 = round($maxW * 0.10, 0);
2214 2214
         $texto = 'QUANTIDADE';
2215 2215
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2216 2216
         $this->pdf->textBox($x, $y, $w1, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -2221,7 +2221,7 @@  discard block
 block discarded – undo
2221 2221
         }
2222 2222
         //ESPÉCIE
2223 2223
         $x += $w1;
2224
-        $w2 = round($maxW*0.17, 0);
2224
+        $w2 = round($maxW * 0.17, 0);
2225 2225
         $texto = 'ESPÉCIE';
2226 2226
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2227 2227
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -2233,7 +2233,7 @@  discard block
 block discarded – undo
2233 2233
         $texto = 'MARCA';
2234 2234
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2235 2235
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
2236
-        $texto = ! empty($this->transp->getElementsByTagName("marca")->item(0)->nodeValue) ?
2236
+        $texto = !empty($this->transp->getElementsByTagName("marca")->item(0)->nodeValue) ?
2237 2237
                 $this->transp->getElementsByTagName("marca")->item(0)->nodeValue : '';
2238 2238
         $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'];
2239 2239
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'B', 'C', 0, '');
@@ -2247,7 +2247,7 @@  discard block
 block discarded – undo
2247 2247
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'B', 'C', 0, '');
2248 2248
         //PESO BRUTO
2249 2249
         $x += $w2;
2250
-        $w3 = round($maxW*0.20, 0);
2250
+        $w3 = round($maxW * 0.20, 0);
2251 2251
         $texto = 'PESO BRUTO';
2252 2252
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2253 2253
         $this->pdf->textBox($x, $y, $w3, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -2260,7 +2260,7 @@  discard block
 block discarded – undo
2260 2260
         $this->pdf->textBox($x, $y, $w3, $h, $texto, $aFont, 'B', 'R', 0, '');
2261 2261
         //PESO LÍQUIDO
2262 2262
         $x += $w3;
2263
-        $w = $maxW -($w1+3*$w2+$w3);
2263
+        $w = $maxW - ($w1 + 3 * $w2 + $w3);
2264 2264
         $texto = 'PESO LÍQUIDO';
2265 2265
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2266 2266
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -2271,7 +2271,7 @@  discard block
 block discarded – undo
2271 2271
         }
2272 2272
         $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'];
2273 2273
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'R', 0, '');
2274
-        return ($y+$h);
2274
+        return ($y + $h);
2275 2275
     } //fim transporte
2276 2276
 
2277 2277
 
@@ -2283,7 +2283,7 @@  discard block
 block discarded – undo
2283 2283
             return "";
2284 2284
         }
2285 2285
         $valor_original = $valor_original->nodeValue;
2286
-        $valor = ! empty($valor_original) ? number_format($valor_original, 2, ",", ".") : '';
2286
+        $valor = !empty($valor_original) ? number_format($valor_original, 2, ",", ".") : '';
2287 2287
 
2288 2288
         if ($valor != "") {
2289 2289
             return sprintf($formato, $valor);
@@ -2330,18 +2330,18 @@  discard block
 block discarded – undo
2330 2330
             $impostos .= $this->descricaoProdutoHelper($ICMSUFDest, "vICMSUFDest", " vICMSUFDest=%s");
2331 2331
             $impostos .= $this->descricaoProdutoHelper($ICMSUFDest, "vICMSUFRemet", " vICMSUFRemet=%s");
2332 2332
         }
2333
-        $infAdProd = ! empty($itemProd->getElementsByTagName('infAdProd')->item(0)->nodeValue)
2333
+        $infAdProd = !empty($itemProd->getElementsByTagName('infAdProd')->item(0)->nodeValue)
2334 2334
         ? substr(
2335 2335
             $this->anfaveaDANFE($itemProd->getElementsByTagName('infAdProd')->item(0)->nodeValue),
2336 2336
             0,
2337 2337
             500
2338 2338
         )
2339 2339
         : '';
2340
-        if (! empty($infAdProd)) {
2340
+        if (!empty($infAdProd)) {
2341 2341
             $infAdProd = trim($infAdProd);
2342 2342
             $infAdProd .= ' ';
2343 2343
         }
2344
-        $loteTxt ='';
2344
+        $loteTxt = '';
2345 2345
         $rastro = $prod->getElementsByTagName("med");
2346 2346
         if (!empty($prod->getElementsByTagName("rastro"))) {
2347 2347
             $rastro = $prod->getElementsByTagName("rastro");
@@ -2355,15 +2355,15 @@  discard block
 block discarded – undo
2355 2355
                 $i++;
2356 2356
             }
2357 2357
             if ($loteTxt != '') {
2358
-                $loteTxt.= ' ';
2358
+                $loteTxt .= ' ';
2359 2359
             }
2360 2360
         }
2361 2361
         //NT2013.006 FCI
2362
-        $nFCI = (! empty($itemProd->getElementsByTagName('nFCI')->item(0)->nodeValue)) ?
2363
-                ' FCI:'.$itemProd->getElementsByTagName('nFCI')->item(0)->nodeValue : '';
2364
-        $tmp_ad=$infAdProd . ($this->descProdInfoComplemento ? $loteTxt . $impostos . $nFCI : '');
2362
+        $nFCI = (!empty($itemProd->getElementsByTagName('nFCI')->item(0)->nodeValue)) ?
2363
+                ' FCI:' . $itemProd->getElementsByTagName('nFCI')->item(0)->nodeValue : '';
2364
+        $tmp_ad = $infAdProd . ($this->descProdInfoComplemento ? $loteTxt . $impostos . $nFCI : '');
2365 2365
         $texto = $prod->getElementsByTagName("xProd")->item(0)->nodeValue
2366
-            . (strlen($tmp_ad)!=0?"\n    ".$tmp_ad:'');
2366
+            . (strlen($tmp_ad) != 0 ? "\n    " . $tmp_ad : '');
2367 2367
         //decodifica os caracteres html no xml
2368 2368
         $texto = html_entity_decode($texto);
2369 2369
         if ($this->descProdQuebraLinha) {
@@ -2413,104 +2413,104 @@  discard block
 block discarded – undo
2413 2413
         // cabecalho LOOP COM OS DADOS DOS PRODUTOS
2414 2414
         //CÓDIGO PRODUTO
2415 2415
         $texto = "CÓDIGO PRODUTO";
2416
-        $w1 = round($w*0.09, 0);
2416
+        $w1 = round($w * 0.09, 0);
2417 2417
         $h = 4;
2418 2418
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2419 2419
         $this->pdf->textBox($x, $y, $w1, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2420
-        $this->pdf->line($x+$w1, $y, $x+$w1, $y+$hmax);
2420
+        $this->pdf->line($x + $w1, $y, $x + $w1, $y + $hmax);
2421 2421
         //DESCRIÇÃO DO PRODUTO / SERVIÇO
2422 2422
         $x += $w1;
2423
-        $w2 = round($w*0.28, 0);
2423
+        $w2 = round($w * 0.28, 0);
2424 2424
         $texto = 'DESCRIÇÃO DO PRODUTO / SERVIÇO';
2425 2425
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2426 2426
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2427
-        $this->pdf->line($x+$w2, $y, $x+$w2, $y+$hmax);
2427
+        $this->pdf->line($x + $w2, $y, $x + $w2, $y + $hmax);
2428 2428
         //NCM/SH
2429 2429
         $x += $w2;
2430
-        $w3 = round($w*0.06, 0);
2430
+        $w3 = round($w * 0.06, 0);
2431 2431
         $texto = 'NCM/SH';
2432 2432
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2433 2433
         $this->pdf->textBox($x, $y, $w3, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2434
-        $this->pdf->line($x+$w3, $y, $x+$w3, $y+$hmax);
2434
+        $this->pdf->line($x + $w3, $y, $x + $w3, $y + $hmax);
2435 2435
         //O/CST ou O/CSOSN
2436 2436
         $x += $w3;
2437
-        $w4 = round($w*0.05, 0);
2438
-        $texto = 'O/CSOSN';//Regime do Simples CRT = 1 ou CRT = 2
2437
+        $w4 = round($w * 0.05, 0);
2438
+        $texto = 'O/CSOSN'; //Regime do Simples CRT = 1 ou CRT = 2
2439 2439
         if ($this->getTagValue($this->emit, 'CRT') == '3') {
2440
-             $texto = 'O/CST';//Regime Normal
2440
+             $texto = 'O/CST'; //Regime Normal
2441 2441
         }
2442 2442
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2443 2443
         $this->pdf->textBox($x, $y, $w4, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2444
-        $this->pdf->line($x+$w4, $y, $x+$w4, $y+$hmax);
2444
+        $this->pdf->line($x + $w4, $y, $x + $w4, $y + $hmax);
2445 2445
         //CFOP
2446 2446
         $x += $w4;
2447
-        $w5 = round($w*0.04, 0);
2447
+        $w5 = round($w * 0.04, 0);
2448 2448
         $texto = 'CFOP';
2449 2449
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2450 2450
         $this->pdf->textBox($x, $y, $w5, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2451
-        $this->pdf->line($x+$w5, $y, $x+$w5, $y+$hmax);
2451
+        $this->pdf->line($x + $w5, $y, $x + $w5, $y + $hmax);
2452 2452
         //UN
2453 2453
         $x += $w5;
2454
-        $w6 = round($w*0.03, 0);
2454
+        $w6 = round($w * 0.03, 0);
2455 2455
         $texto = 'UN';
2456 2456
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2457 2457
         $this->pdf->textBox($x, $y, $w6, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2458
-        $this->pdf->line($x+$w6, $y, $x+$w6, $y+$hmax);
2458
+        $this->pdf->line($x + $w6, $y, $x + $w6, $y + $hmax);
2459 2459
         //QUANT
2460 2460
         $x += $w6;
2461
-        $w7 = round($w*0.07, 0);
2461
+        $w7 = round($w * 0.07, 0);
2462 2462
         $texto = 'QUANT';
2463 2463
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2464 2464
         $this->pdf->textBox($x, $y, $w7, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2465
-        $this->pdf->line($x+$w7, $y, $x+$w7, $y+$hmax);
2465
+        $this->pdf->line($x + $w7, $y, $x + $w7, $y + $hmax);
2466 2466
         //VALOR UNIT
2467 2467
         $x += $w7;
2468
-        $w8 = round($w*0.06, 0);
2468
+        $w8 = round($w * 0.06, 0);
2469 2469
         $texto = 'VALOR UNIT';
2470 2470
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2471 2471
         $this->pdf->textBox($x, $y, $w8, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2472
-        $this->pdf->line($x+$w8, $y, $x+$w8, $y+$hmax);
2472
+        $this->pdf->line($x + $w8, $y, $x + $w8, $y + $hmax);
2473 2473
         //VALOR TOTAL
2474 2474
         $x += $w8;
2475
-        $w9 = round($w*0.06, 0);
2475
+        $w9 = round($w * 0.06, 0);
2476 2476
         $texto = 'VALOR TOTAL';
2477 2477
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2478 2478
         $this->pdf->textBox($x, $y, $w9, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2479
-        $this->pdf->line($x+$w9, $y, $x+$w9, $y+$hmax);
2479
+        $this->pdf->line($x + $w9, $y, $x + $w9, $y + $hmax);
2480 2480
         //B.CÁLC ICMS
2481 2481
         $x += $w9;
2482
-        $w10 = round($w*0.06, 0);
2482
+        $w10 = round($w * 0.06, 0);
2483 2483
         $texto = 'B.CÁLC ICMS';
2484 2484
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2485 2485
         $this->pdf->textBox($x, $y, $w10, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2486
-        $this->pdf->line($x+$w10, $y, $x+$w10, $y+$hmax);
2486
+        $this->pdf->line($x + $w10, $y, $x + $w10, $y + $hmax);
2487 2487
         //VALOR ICMS
2488 2488
         $x += $w10;
2489
-        $w11 = round($w*0.06, 0);
2489
+        $w11 = round($w * 0.06, 0);
2490 2490
         $texto = 'VALOR ICMS';
2491 2491
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2492 2492
         $this->pdf->textBox($x, $y, $w11, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2493
-        $this->pdf->line($x+$w11, $y, $x+$w11, $y+$hmax);
2493
+        $this->pdf->line($x + $w11, $y, $x + $w11, $y + $hmax);
2494 2494
         //VALOR IPI
2495 2495
         $x += $w11;
2496
-        $w12 = round($w*0.05, 0);
2496
+        $w12 = round($w * 0.05, 0);
2497 2497
         $texto = 'VALOR IPI';
2498 2498
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2499 2499
         $this->pdf->textBox($x, $y, $w12, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2500
-        $this->pdf->line($x+$w12, $y, $x+$w12, $y+$hmax);
2500
+        $this->pdf->line($x + $w12, $y, $x + $w12, $y + $hmax);
2501 2501
         //ALÍQ. ICMS
2502 2502
         $x += $w12;
2503
-        $w13 = round($w*0.035, 0);
2503
+        $w13 = round($w * 0.035, 0);
2504 2504
         $texto = 'ALÍQ. ICMS';
2505 2505
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2506 2506
         $this->pdf->textBox($x, $y, $w13, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2507
-        $this->pdf->line($x+$w13, $y, $x+$w13, $y+$hmax);
2507
+        $this->pdf->line($x + $w13, $y, $x + $w13, $y + $hmax);
2508 2508
         //ALÍQ. IPI
2509 2509
         $x += $w13;
2510
-        $w14 = $w-($w1+$w2+$w3+$w4+$w5+$w6+$w7+$w8+$w9+$w10+$w11+$w12+$w13);
2510
+        $w14 = $w - ($w1 + $w2 + $w3 + $w4 + $w5 + $w6 + $w7 + $w8 + $w9 + $w10 + $w11 + $w12 + $w13);
2511 2511
         $texto = 'ALÍQ. IPI';
2512 2512
         $this->pdf->textBox($x, $y, $w14, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2513
-        $this->pdf->line($oldX, $y+$h+1, $oldX + $w, $y+$h+1);
2513
+        $this->pdf->line($oldX, $y + $h + 1, $oldX + $w, $y + $h + 1);
2514 2514
         $y += 5;
2515 2515
         //##################################################################################
2516 2516
         // LOOP COM OS DADOS DOS PRODUTOS
@@ -2528,7 +2528,7 @@  discard block
 block discarded – undo
2528 2528
                 $textoProduto = trim($this->descricaoProduto($thisItem));
2529 2529
 
2530 2530
                 $linhaDescr = $this->pdf->getNumLines($textoProduto, $w2, $aFont);
2531
-                $h = round(($linhaDescr * $this->pdf->fontSize)+ ($linhaDescr * 0.5), 2);
2531
+                $h = round(($linhaDescr * $this->pdf->fontSize) + ($linhaDescr * 0.5), 2);
2532 2532
                 $hUsado += $h;
2533 2533
 
2534 2534
                 $diffH = $hmax - $hUsado;
@@ -2541,11 +2541,11 @@  discard block
 block discarded – undo
2541 2541
                         break;
2542 2542
                     }
2543 2543
                 }
2544
-                $y_linha=$y+$h;
2544
+                $y_linha = $y + $h;
2545 2545
                 // linha entre itens
2546 2546
                 $this->pdf->dashedHLine($oldX, $y_linha, $w, 0.1, 120);
2547 2547
                 //corrige o x
2548
-                $x=$oldX;
2548
+                $x = $oldX;
2549 2549
                 //codigo do produto
2550 2550
                 $texto = $prod->getElementsByTagName("cProd")->item(0)->nodeValue;
2551 2551
                 $this->pdf->textBox($x, $y, $w1, $h, $texto, $aFont, 'T', 'C', 0, '');
@@ -2558,16 +2558,16 @@  discard block
 block discarded – undo
2558 2558
                 }
2559 2559
                 $x += $w2;
2560 2560
                 //NCM
2561
-                $texto = ! empty($prod->getElementsByTagName("NCM")->item(0)->nodeValue) ?
2561
+                $texto = !empty($prod->getElementsByTagName("NCM")->item(0)->nodeValue) ?
2562 2562
                         $prod->getElementsByTagName("NCM")->item(0)->nodeValue : '';
2563 2563
                 $this->pdf->textBox($x, $y, $w3, $h, $texto, $aFont, 'T', 'C', 0, '');
2564 2564
                 $x += $w3;
2565 2565
                 //CST
2566 2566
                 if (isset($ICMS)) {
2567
-                    $origem =  $this->getTagValue($ICMS, "orig");
2568
-                    $cst =  $this->getTagValue($ICMS, "CST");
2569
-                    $csosn =  $this->getTagValue($ICMS, "CSOSN");
2570
-                    $texto = $origem.$cst.$csosn;
2567
+                    $origem = $this->getTagValue($ICMS, "orig");
2568
+                    $cst = $this->getTagValue($ICMS, "CST");
2569
+                    $csosn = $this->getTagValue($ICMS, "CSOSN");
2570
+                    $texto = $origem . $cst . $csosn;
2571 2571
                     $this->pdf->textBox($x, $y, $w4, $h, $texto, $aFont, 'T', 'C', 0, '');
2572 2572
                 }
2573 2573
                 //CFOP
@@ -2601,7 +2601,7 @@  discard block
 block discarded – undo
2601 2601
                 //Valor da Base de calculo
2602 2602
                 $x += $w9;
2603 2603
                 if (isset($ICMS)) {
2604
-                    $texto = ! empty($ICMS->getElementsByTagName("vBC")->item(0)->nodeValue)
2604
+                    $texto = !empty($ICMS->getElementsByTagName("vBC")->item(0)->nodeValue)
2605 2605
                     ? number_format(
2606 2606
                         $ICMS->getElementsByTagName("vBC")->item(0)->nodeValue,
2607 2607
                         2,
@@ -2614,7 +2614,7 @@  discard block
 block discarded – undo
2614 2614
                 //Valor do ICMS
2615 2615
                 $x += $w10;
2616 2616
                 if (isset($ICMS)) {
2617
-                    $texto = ! empty($ICMS->getElementsByTagName("vICMS")->item(0)->nodeValue)
2617
+                    $texto = !empty($ICMS->getElementsByTagName("vICMS")->item(0)->nodeValue)
2618 2618
                     ? number_format(
2619 2619
                         $ICMS->getElementsByTagName("vICMS")->item(0)->nodeValue,
2620 2620
                         2,
@@ -2627,7 +2627,7 @@  discard block
 block discarded – undo
2627 2627
                 //Valor do IPI
2628 2628
                 $x += $w11;
2629 2629
                 if (isset($IPI)) {
2630
-                    $texto = ! empty($IPI->getElementsByTagName("vIPI")->item(0)->nodeValue)
2630
+                    $texto = !empty($IPI->getElementsByTagName("vIPI")->item(0)->nodeValue)
2631 2631
                     ? number_format(
2632 2632
                         $IPI->getElementsByTagName("vIPI")->item(0)->nodeValue,
2633 2633
                         2,
@@ -2642,7 +2642,7 @@  discard block
 block discarded – undo
2642 2642
                 // %ICMS
2643 2643
                 $x += $w12;
2644 2644
                 if (isset($ICMS)) {
2645
-                    $texto = ! empty($ICMS->getElementsByTagName("pICMS")->item(0)->nodeValue)
2645
+                    $texto = !empty($ICMS->getElementsByTagName("pICMS")->item(0)->nodeValue)
2646 2646
                     ? number_format(
2647 2647
                         $ICMS->getElementsByTagName("pICMS")->item(0)->nodeValue,
2648 2648
                         2,
@@ -2655,7 +2655,7 @@  discard block
 block discarded – undo
2655 2655
                 //%IPI
2656 2656
                 $x += $w13;
2657 2657
                 if (isset($IPI)) {
2658
-                    $texto = ! empty($IPI->getElementsByTagName("pIPI")->item(0)->nodeValue)
2658
+                    $texto = !empty($IPI->getElementsByTagName("pIPI")->item(0)->nodeValue)
2659 2659
                     ? number_format(
2660 2660
                         $IPI->getElementsByTagName("pIPI")->item(0)->nodeValue,
2661 2661
                         2,
@@ -2686,7 +2686,7 @@  discard block
 block discarded – undo
2686 2686
                 $i++;
2687 2687
             }
2688 2688
         }
2689
-        return $oldY+$hmax;
2689
+        return $oldY + $hmax;
2690 2690
     }
2691 2691
 
2692 2692
 
@@ -2720,7 +2720,7 @@  discard block
 block discarded – undo
2720 2720
 
2721 2721
         $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>''];
2722 2722
 
2723
-        $w1 = round($w*0.09, 0);
2723
+        $w1 = round($w * 0.09, 0);
2724 2724
 
2725 2725
         // Tabela Renavam Combustivel
2726 2726
         $renavamCombustivel = [
@@ -2815,54 +2815,54 @@  discard block
 block discarded – undo
2815 2815
 
2816 2816
         $yVeic = $y + $h;
2817 2817
         $texto = 'Chassi: ............: ' . $veiculoChassi;
2818
-        $this->pdf->textBox($x, $yVeic, $w1+40, $h, $texto, $aFont, 'T', 'L', 0, '');
2818
+        $this->pdf->textBox($x, $yVeic, $w1 + 40, $h, $texto, $aFont, 'T', 'L', 0, '');
2819 2819
         $yVeic += $h;
2820 2820
         $texto = 'Cor...................: ' . $veiculoCor;
2821
-        $this->pdf->textBox($x, $yVeic, $w1+40, $h, $texto, $aFont, 'T', 'L', 0, '');
2821
+        $this->pdf->textBox($x, $yVeic, $w1 + 40, $h, $texto, $aFont, 'T', 'L', 0, '');
2822 2822
         $yVeic += $h;
2823 2823
         $texto = 'Cilindrada........: ' . $veiculoCilindrada;
2824
-        $this->pdf->textBox($x, $yVeic, $w1+40, $h, $texto, $aFont, 'T', 'L', 0, '');
2824
+        $this->pdf->textBox($x, $yVeic, $w1 + 40, $h, $texto, $aFont, 'T', 'L', 0, '');
2825 2825
         $yVeic += $h;
2826 2826
         $texto = 'Cmkg...............: ' . $veiculoCmkg;
2827
-        $this->pdf->textBox($x, $yVeic, $w1+40, $h, $texto, $aFont, 'T', 'L', 0, '');
2827
+        $this->pdf->textBox($x, $yVeic, $w1 + 40, $h, $texto, $aFont, 'T', 'L', 0, '');
2828 2828
         $yVeic += $h;
2829 2829
         $texto = 'Tipo.................: ' . ($renavamTiposVeiculos[intval($veiculoTipo)] ?? $veiculoTipo);
2830
-         $this->pdf->textBox($x, $yVeic, $w1+40, $h, $texto, $aFont, 'T', 'L', 0, '');
2830
+         $this->pdf->textBox($x, $yVeic, $w1 + 40, $h, $texto, $aFont, 'T', 'L', 0, '');
2831 2831
         $yVeic = $y + $h;
2832 2832
         $xVeic = $x + 65;
2833 2833
         $texto = 'Nº Motor: .........: ' . $veiculoMotor;
2834
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
2834
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
2835 2835
         $yVeic += $h;
2836 2836
         $texto = 'Renavam...........: ' . $veiculoRenavam;
2837
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
2837
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
2838 2838
         $yVeic += $h;
2839 2839
         $texto = 'HP.....................: ' . $veiculoHp;
2840
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
2840
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
2841 2841
         $yVeic += $h;
2842 2842
         $texto = 'Placa.................: ' . $veiculoPlaca;
2843
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
2843
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
2844 2844
         $yVeic += $h;
2845 2845
         $texto = 'Tipo Pintura......: ' . ($renavamEspecie[intval($veiculoTipoPintura)] ?? $veiculoTipoPintura);
2846
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
2846
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
2847 2847
         $yVeic = $y + $h;
2848 2848
         $xVeic = $xVeic + 55;
2849 2849
         $texto = 'Marca / Modelo.....: ' . $veiculoMarcaModelo;
2850
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
2850
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
2851 2851
         $yVeic += $h;
2852 2852
         $texto = 'Especie..................: ' . ($renavamEspecie[intval($veiculoEspecie)] ?? $veiculoEspecie);
2853
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
2853
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
2854 2854
         $yVeic += $h;
2855 2855
         $texto = 'Combustivel..........: ' . ($renavamCombustivel[intval($veiculoCombustivel)] ?? $veiculoCombustivel);
2856
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
2856
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
2857 2857
         $yVeic += $h;
2858 2858
         $texto = 'Serial.....................: ' . $veiculoSerial;
2859
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
2859
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
2860 2860
         $yVeic += $h;
2861
-        $texto = 'Ano Fab/Mod........: '. $veiculoFabricacao . '/' . $veiculoModelo;
2862
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
2861
+        $texto = 'Ano Fab/Mod........: ' . $veiculoFabricacao . '/' . $veiculoModelo;
2862
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
2863 2863
         $yVeic += $h;
2864
-        $texto = 'Distancia Entre Eixos(mm)..: '. $veiculoDistancia;
2865
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
2864
+        $texto = 'Distancia Entre Eixos(mm)..: ' . $veiculoDistancia;
2865
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
2866 2866
     }
2867 2867
 
2868 2868
     /**
@@ -2886,12 +2886,12 @@  discard block
 block discarded – undo
2886 2886
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
2887 2887
         //INSCRIÇÃO MUNICIPAL
2888 2888
         $y += 3;
2889
-        $w = round($this->wPrint*0.23, 0);
2889
+        $w = round($this->wPrint * 0.23, 0);
2890 2890
         $texto = 'INSCRIÇÃO MUNICIPAL';
2891 2891
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2892 2892
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
2893 2893
         //inscrição municipal
2894
-        $texto = ! empty($this->emit->getElementsByTagName("IM")->item(0)->nodeValue) ?
2894
+        $texto = !empty($this->emit->getElementsByTagName("IM")->item(0)->nodeValue) ?
2895 2895
                 $this->emit->getElementsByTagName("IM")->item(0)->nodeValue : '';
2896 2896
         $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'];
2897 2897
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 0, '');
@@ -2901,7 +2901,7 @@  discard block
 block discarded – undo
2901 2901
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2902 2902
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
2903 2903
         if (isset($this->ISSQNtot)) {
2904
-            $texto = ! empty($this->ISSQNtot->getElementsByTagName("vServ")->item(0)->nodeValue) ?
2904
+            $texto = !empty($this->ISSQNtot->getElementsByTagName("vServ")->item(0)->nodeValue) ?
2905 2905
                     $this->ISSQNtot->getElementsByTagName("vServ")->item(0)->nodeValue : '';
2906 2906
             $texto = number_format($texto, 2, ",", ".");
2907 2907
         } else {
@@ -2915,9 +2915,9 @@  discard block
 block discarded – undo
2915 2915
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2916 2916
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
2917 2917
         if (isset($this->ISSQNtot)) {
2918
-            $texto = ! empty($this->ISSQNtot->getElementsByTagName("vBC")->item(0)->nodeValue) ?
2918
+            $texto = !empty($this->ISSQNtot->getElementsByTagName("vBC")->item(0)->nodeValue) ?
2919 2919
                     $this->ISSQNtot->getElementsByTagName("vBC")->item(0)->nodeValue : '';
2920
-            $texto = ! empty($texto) ? number_format($texto, 2, ",", ".") : '';
2920
+            $texto = !empty($texto) ? number_format($texto, 2, ",", ".") : '';
2921 2921
         } else {
2922 2922
             $texto = '';
2923 2923
         }
@@ -2928,21 +2928,21 @@  discard block
 block discarded – undo
2928 2928
         if ($this->orientacao == 'P') {
2929 2929
             $w = $this->wPrint - (3 * $w);
2930 2930
         } else {
2931
-            $w = $this->wPrint - (3 * $w)-$this->wCanhoto;
2931
+            $w = $this->wPrint - (3 * $w) - $this->wCanhoto;
2932 2932
         }
2933 2933
         $texto = 'VALOR TOTAL DO ISSQN';
2934 2934
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2935 2935
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
2936 2936
         if (isset($this->ISSQNtot)) {
2937
-            $texto = ! empty($this->ISSQNtot->getElementsByTagName("vISS")->item(0)->nodeValue) ?
2937
+            $texto = !empty($this->ISSQNtot->getElementsByTagName("vISS")->item(0)->nodeValue) ?
2938 2938
                     $this->ISSQNtot->getElementsByTagName("vISS")->item(0)->nodeValue : '';
2939
-            $texto = ! empty($texto) ? number_format($texto, 2, ",", ".") : '';
2939
+            $texto = !empty($texto) ? number_format($texto, 2, ",", ".") : '';
2940 2940
         } else {
2941 2941
             $texto = '';
2942 2942
         }
2943 2943
         $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'];
2944 2944
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'R', 0, '');
2945
-        return ($y+$h+1);
2945
+        return ($y + $h + 1);
2946 2946
     }
2947 2947
 
2948 2948
     /**
@@ -2963,7 +2963,7 @@  discard block
 block discarded – undo
2963 2963
         if ($this->orientacao == 'P') {
2964 2964
               $w = $this->wPrint;
2965 2965
         } else {
2966
-              $w = $this->wPrint-$this->wCanhoto;
2966
+              $w = $this->wPrint - $this->wCanhoto;
2967 2967
         }
2968 2968
         $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
2969 2969
         $this->pdf->textBox($x, $y, $w, 8, $texto, $aFont, 'T', 'L', 0, '');
@@ -2979,15 +2979,15 @@  discard block
 block discarded – undo
2979 2979
         //$this->textoAdic com o texto completo do campo
2980 2980
         $y += 1;
2981 2981
         $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>''];
2982
-        $this->pdf->textBox($x, $y+2, $w-2, $h-3, $this->textoAdic, $aFont, 'T', 'L', 0, '', false);
2982
+        $this->pdf->textBox($x, $y + 2, $w - 2, $h - 3, $this->textoAdic, $aFont, 'T', 'L', 0, '', false);
2983 2983
         //RESERVADO AO FISCO
2984 2984
         $texto = "RESERVADO AO FISCO";
2985 2985
         $x += $w;
2986 2986
         $y -= 1;
2987 2987
         if ($this->orientacao == 'P') {
2988
-            $w = $this->wPrint-$w;
2988
+            $w = $this->wPrint - $w;
2989 2989
         } else {
2990
-            $w = $this->wPrint-$w-$this->wCanhoto;
2990
+            $w = $this->wPrint - $w - $this->wCanhoto;
2991 2991
         }
2992 2992
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>'B'];
2993 2993
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -3026,8 +3026,8 @@  discard block
 block discarded – undo
3026 3026
         }
3027 3027
         $y += 2;
3028 3028
         $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>''];
3029
-        $this->pdf->textBox($x, $y, $w-2, $h-3, $texto, $aFont, 'T', 'L', 0, '', false);
3030
-        return $y+$h;
3029
+        $this->pdf->textBox($x, $y, $w - 2, $h - 3, $texto, $aFont, 'T', 'L', 0, '', false);
3030
+        return $y + $h;
3031 3031
     }
3032 3032
 
3033 3033
     /**
@@ -3046,11 +3046,11 @@  discard block
 block discarded – undo
3046 3046
         if ($this->orientacao == 'P') {
3047 3047
               $w = $this->wPrint;
3048 3048
         } else {
3049
-              $w = $this->wPrint-$this->wCanhoto;
3049
+              $w = $this->wPrint - $this->wCanhoto;
3050 3050
               $x = $this->wCanhoto;
3051 3051
         }
3052 3052
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>'I'];
3053
-        $texto = "Impresso em ". date('d/m/Y') . " as " . date('H:i:s')
3053
+        $texto = "Impresso em " . date('d/m/Y') . " as " . date('H:i:s')
3054 3054
             . '  ' . $this->creditos;
3055 3055
         $this->pdf->textBox($x, $y, $w, 0, $texto, $aFont, 'T', 'L', false);
3056 3056
         $texto = "Powered by NFePHP®";
@@ -3106,9 +3106,9 @@  discard block
 block discarded – undo
3106 3106
         } else {
3107 3107
             //linha separadora do canhoto - 238
3108 3108
             //posicao altura
3109
-            $y = $this->wPrint-85;
3109
+            $y = $this->wPrint - 85;
3110 3110
             //altura
3111
-            $w = $this->wPrint-85-24;
3111
+            $w = $this->wPrint - 85 - 24;
3112 3112
         }
3113 3113
         $h = 10;
3114 3114
         //desenha caixa
@@ -3131,21 +3131,21 @@  discard block
 block discarded – undo
3131 3131
             $texto .= "AO LADO";
3132 3132
         }
3133 3133
         $texto .= ". EMISSÃO: ";
3134
-        $dEmi = ! empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
3134
+        $dEmi = !empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
3135 3135
                 $this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue : '';
3136 3136
         if ($dEmi == '') {
3137
-            $dEmi = ! empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
3137
+            $dEmi = !empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
3138 3138
                     $this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue : '';
3139 3139
             $aDemi = explode('T', $dEmi);
3140 3140
             $dEmi = $aDemi[0];
3141 3141
         }
3142
-        $texto .= $this->ymdTodmy($dEmi) ." ";
3142
+        $texto .= $this->ymdTodmy($dEmi) . " ";
3143 3143
         $texto .= "VALOR TOTAL: R$ ";
3144 3144
         $texto .= number_format($this->ICMSTot->getElementsByTagName("vNF")->item(0)->nodeValue, 2, ",", ".") . " ";
3145 3145
         $texto .= "DESTINATÁRIO: ";
3146 3146
         $texto .= $destinatario;
3147 3147
         if ($this->orientacao == 'P') {
3148
-            $this->pdf->textBox($x, $y, $w-1, $h, $texto, $aFont, 'C', 'L', 0, '', false);
3148
+            $this->pdf->textBox($x, $y, $w - 1, $h, $texto, $aFont, 'C', 'L', 0, '', false);
3149 3149
             $x1 = $x + $w;
3150 3150
             $w1 = $this->wPrint - $w;
3151 3151
             $texto = "NF-e";
@@ -3158,12 +3158,12 @@  discard block
 block discarded – undo
3158 3158
             //DATA DE RECEBIMENTO
3159 3159
             $texto = "DATA DE RECEBIMENTO";
3160 3160
             $y += $h;
3161
-            $w2 = round($this->wPrint*0.17, 0); //35;
3161
+            $w2 = round($this->wPrint * 0.17, 0); //35;
3162 3162
             $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
3163 3163
             $this->pdf->textBox($x, $y, $w2, 8, $texto, $aFont, 'T', 'L', 1, '');
3164 3164
             //IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR
3165 3165
             $x += $w2;
3166
-            $w3 = $w-$w2;
3166
+            $w3 = $w - $w2;
3167 3167
             $texto = "IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR";
3168 3168
             $this->pdf->textBox($x, $y, $w3, 8, $texto, $aFont, 'T', 'L', 1, '');
3169 3169
             $x = $oldX;
@@ -3173,7 +3173,7 @@  discard block
 block discarded – undo
3173 3173
             return $y;
3174 3174
         } else {
3175 3175
             $x--;
3176
-            $x = $this->pdf->textBox90($x, $y, $w-1, $h, $texto, $aFontSmall, 'C', 'L', 0, '', false);
3176
+            $x = $this->pdf->textBox90($x, $y, $w - 1, $h, $texto, $aFontSmall, 'C', 'L', 0, '', false);
3177 3177
             //NUMERO DA NOTA FISCAL LOGO NFE
3178 3178
             $w1 = 18;
3179 3179
             $x1 = $oldX;
@@ -3187,14 +3187,14 @@  discard block
 block discarded – undo
3187 3187
             $this->pdf->textBox($x1, $y, $w1, 18, $texto, $aFont, 'C', 'C', 1, '');
3188 3188
             //DATA DO RECEBIMENTO
3189 3189
             $texto = "DATA DO RECEBIMENTO";
3190
-            $y = $this->wPrint-85;
3190
+            $y = $this->wPrint - 85;
3191 3191
             $x = 12;
3192
-            $w2 = round($this->wPrint*0.17, 0); //35;
3192
+            $w2 = round($this->wPrint * 0.17, 0); //35;
3193 3193
             $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
3194 3194
             $this->pdf->textBox90($x, $y, $w2, 8, $texto, $aFont, 'T', 'L', 1, '');
3195 3195
             //IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR
3196 3196
             $y -= $w2;
3197
-            $w3 = $w-$w2;
3197
+            $w3 = $w - $w2;
3198 3198
             $texto = "IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR";
3199 3199
             $aFont = ['font'=>$this->fontePadrao, 'size'=>5.7, 'style'=>''];
3200 3200
             $x = $this->pdf->textBox90($x, $y, $w3, 8, $texto, $aFont, 'T', 'L', 1, '');
@@ -3215,13 +3215,13 @@  discard block
 block discarded – undo
3215 3215
     {
3216 3216
         $saida = "";
3217 3217
         if (isset($this->compra)) {
3218
-            if (! empty($this->compra->getElementsByTagName("xNEmp")->item(0)->nodeValue)) {
3218
+            if (!empty($this->compra->getElementsByTagName("xNEmp")->item(0)->nodeValue)) {
3219 3219
                 $saida .= " Nota de Empenho: " . $this->compra->getElementsByTagName("xNEmp")->item(0)->nodeValue;
3220 3220
             }
3221
-            if (! empty($this->compra->getElementsByTagName("xPed")->item(0)->nodeValue)) {
3221
+            if (!empty($this->compra->getElementsByTagName("xPed")->item(0)->nodeValue)) {
3222 3222
                 $saida .= " Pedido: " . $this->compra->getElementsByTagName("xPed")->item(0)->nodeValue;
3223 3223
             }
3224
-            if (! empty($this->compra->getElementsByTagName("xCont")->item(0)->nodeValue)) {
3224
+            if (!empty($this->compra->getElementsByTagName("xCont")->item(0)->nodeValue)) {
3225 3225
                 $saida .= " Contrato: " . $this->compra->getElementsByTagName("xCont")->item(0)->nodeValue;
3226 3226
             }
3227 3227
         }
@@ -3247,21 +3247,21 @@  discard block
 block discarded – undo
3247 3247
         if ($vICMS > 0) {
3248 3248
             $vICMS = 1;
3249 3249
         }
3250
-        $icmss  = $this->ICMSTot->getElementsByTagName("vBC")->item(0)->nodeValue;
3250
+        $icmss = $this->ICMSTot->getElementsByTagName("vBC")->item(0)->nodeValue;
3251 3251
         if ($icmss > 0) {
3252 3252
             $icmss = 1;
3253 3253
         }
3254
-        $dEmi = ! empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
3254
+        $dEmi = !empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
3255 3255
                 $this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue : '';
3256 3256
         if ($dEmi == '') {
3257
-            $dEmi = ! empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
3257
+            $dEmi = !empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
3258 3258
                     $this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue : '';
3259 3259
             $aDemi = explode('T', $dEmi);
3260 3260
             $dEmi = $aDemi[0];
3261 3261
         }
3262 3262
         $dd  = $dEmi;
3263 3263
         $rpos = strrpos($dd, '-');
3264
-        $dd  = substr($dd, $rpos +1);
3264
+        $dd  = substr($dd, $rpos + 1);
3265 3265
         $chave = sprintf($forma, $cUF, $this->tpEmis, $CNPJ, $vNF, $vICMS, $icmss, $dd);
3266 3266
         $chave = $chave . $this->modulo11($chave);
3267 3267
         return $chave;
@@ -3282,7 +3282,7 @@  discard block
 block discarded – undo
3282 3282
         $formaNfRef = "\r\nNF  Ref.: série:%d numero:%d emit:%s em %s modelo: %d";
3283 3283
         $formaECFRef = "\r\nECF Ref.: modelo: %s ECF:%d COO:%d";
3284 3284
         $formaNfpRef = "\r\nNFP Ref.: série:%d número:%d emit:%s em %s modelo: %d IE:%s";
3285
-        $saida='';
3285
+        $saida = '';
3286 3286
         $nfRefs = $this->ide->getElementsByTagName('NFref');
3287 3287
         if (0 === $nfRefs->length) {
3288 3288
             return $saida;
@@ -3298,7 +3298,7 @@  discard block
 block discarded – undo
3298 3298
             foreach ($refNFe as $chave_acessoRef) {
3299 3299
                 $chave_acesso = $chave_acessoRef->nodeValue;
3300 3300
                 $chave_acessoF = $this->formatField($chave_acesso, $this->formatoChave);
3301
-                $data = substr($chave_acesso, 4, 2)."/20".substr($chave_acesso, 2, 2);
3301
+                $data = substr($chave_acesso, 4, 2) . "/20" . substr($chave_acesso, 2, 2);
3302 3302
                 $cnpj = $this->formatField(substr($chave_acesso, 6, 14), "##.###.###/####-##");
3303 3303
                 $serie  = substr($chave_acesso, 22, 3);
3304 3304
                 $numero = substr($chave_acesso, 25, 9);
@@ -3319,7 +3319,7 @@  discard block
 block discarded – undo
3319 3319
             foreach ($refCTe as $chave_acessoRef) {
3320 3320
                 $chave_acesso = $chave_acessoRef->nodeValue;
3321 3321
                 $chave_acessoF = $this->formatField($chave_acesso, $this->formatoChave);
3322
-                $data = substr($chave_acesso, 4, 2)."/20".substr($chave_acesso, 2, 2);
3322
+                $data = substr($chave_acesso, 4, 2) . "/20" . substr($chave_acesso, 2, 2);
3323 3323
                 $cnpj = $this->formatField(substr($chave_acesso, 6, 14), "##.###.###/####-##");
3324 3324
                 $serie  = substr($chave_acesso, 22, 3);
3325 3325
                 $numero = substr($chave_acesso, 25, 9);
@@ -3335,10 +3335,9 @@  discard block
 block discarded – undo
3335 3335
             $refNFP = $nfRef->getElementsByTagName('refNFP');
3336 3336
             foreach ($refNFP as $umaRefNFe) {
3337 3337
                 $data = $umaRefNFe->getElementsByTagName('AAMM')->item(0)->nodeValue;
3338
-                $cnpj = ! empty($umaRefNFe->getElementsByTagName('CNPJ')->item(0)->nodeValue) ?
3339
-                    $umaRefNFe->getElementsByTagName('CNPJ')->item(0)->nodeValue :
3340
-                    '';
3341
-                $cpf = ! empty($umaRefNFe->getElementsByTagName('CPF')->item(0)->nodeValue) ?
3338
+                $cnpj = !empty($umaRefNFe->getElementsByTagName('CNPJ')->item(0)->nodeValue) ?
3339
+                    $umaRefNFe->getElementsByTagName('CNPJ')->item(0)->nodeValue : '';
3340
+                $cpf = !empty($umaRefNFe->getElementsByTagName('CPF')->item(0)->nodeValue) ?
3342 3341
                         $umaRefNFe->getElementsByTagName('CPF')->item(0)->nodeValue : '';
3343 3342
                 $mod = $umaRefNFe->getElementsByTagName('mod')->item(0)->nodeValue;
3344 3343
                 $serie = $umaRefNFe->getElementsByTagName('serie')->item(0)->nodeValue;
@@ -3403,6 +3402,6 @@  discard block
 block discarded – undo
3403 3402
         imagedestroy($image);
3404 3403
         $stringdata = ob_get_contents(); // read from buffer
3405 3404
         ob_end_clean();
3406
-        return 'data://text/plain;base64,'.base64_encode($stringdata);
3405
+        return 'data://text/plain;base64,' . base64_encode($stringdata);
3407 3406
     }
3408 3407
 }
Please login to merge, or discard this patch.