Completed
Pull Request — master (#279)
by Roberto
02:21
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();
@@ -879,7 +879,7 @@  discard block
 block discarded – undo
879 879
         $oldX = $x;
880 880
         $oldY = $y;
881 881
         if ($this->orientacao == 'P') {
882
-              $maxW = $this->wPrint;
882
+                $maxW = $this->wPrint;
883 883
         } else {
884 884
             if ($pag == 1) { // primeira página
885 885
                 $maxW = $this->wPrint - $this->wCanhoto;
@@ -1254,8 +1254,8 @@  discard block
 block discarded – undo
1254 1254
             $w = $maxW-(2*$x);
1255 1255
             $this->pdf->SetTextColor(200, 200, 200);
1256 1256
             $texto = "DANFE impresso em contingência -\n".
1257
-                     "DPEC regularmente recebido pela Receita\n".
1258
-                     "Federal do Brasil";
1257
+                        "DPEC regularmente recebido pela Receita\n".
1258
+                        "Federal do Brasil";
1259 1259
             $aFont = ['font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B'];
1260 1260
             $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1261 1261
             $this->pdf->SetTextColor(0, 0, 0);
@@ -1559,13 +1559,13 @@  discard block
 block discarded – undo
1559 1559
         return ($y + $h);
1560 1560
     } //fim da função destinatarioDANFE
1561 1561
 
1562
-     /**
1563
-     * getTextoFatura
1564
-     * Gera a String do Texto da Fatura
1565
-      *
1566
-     * @name   getTextoFatura
1567
-     * @return uma String com o texto ou "";
1568
-     */
1562
+        /**
1563
+         * getTextoFatura
1564
+         * Gera a String do Texto da Fatura
1565
+         *
1566
+         * @name   getTextoFatura
1567
+         * @return uma String com o texto ou "";
1568
+         */
1569 1569
     protected function getTextoFatura()
1570 1570
     {
1571 1571
         if (isset($this->cobr)) {
@@ -1596,13 +1596,13 @@  discard block
 block discarded – undo
1596 1596
         return "";
1597 1597
     }
1598 1598
 
1599
-     /**
1600
-     * sizeExtraTextoFatura
1601
-     * Calcula o espaço ocupado pelo texto da fatura. Este espaço só é utilizado quando não houver duplicata.
1602
-      *
1603
-     * @name   sizeExtraTextoFatura
1604
-     * @return integer
1605
-     */
1599
+        /**
1600
+         * sizeExtraTextoFatura
1601
+         * Calcula o espaço ocupado pelo texto da fatura. Este espaço só é utilizado quando não houver duplicata.
1602
+         *
1603
+         * @name   sizeExtraTextoFatura
1604
+         * @return integer
1605
+         */
1606 1606
     protected function sizeExtraTextoFatura()
1607 1607
     {
1608 1608
         $textoFatura = $this->getTextoFatura();
@@ -1782,7 +1782,7 @@  discard block
 block discarded – undo
1782 1782
                                     '11'=>'Vale Refeição','12'=>'Vale Presente','13'=>'Vale Combustível',
1783 1783
                                     '14'=>'Duplicata Mercantil','15'=>'Boleto','90'=>'Sem pagamento','99'=>'Outros'];
1784 1784
             $bandeira = ['01'=>'Visa','02'=>'Mastercard','03'=>'American','04'=>'Sorocred','05'=>'Diners',
1785
-                              '06'=>'Elo','07'=>'Hipercard','08'=>'Aura','09'=>'Cabal','99'=>'Outros'];
1785
+                                '06'=>'Elo','07'=>'Hipercard','08'=>'Aura','09'=>'Cabal','99'=>'Outros'];
1786 1786
             foreach ($this->detPag as $k => $d) {
1787 1787
                 $fPag = !empty($this->detPag->item($k)->getElementsByTagName('tPag')->item(0)->nodeValue)
1788 1788
                     ? $this->detPag->item($k)->getElementsByTagName('tPag')->item(0)->nodeValue
@@ -2435,7 +2435,7 @@  discard block
 block discarded – undo
2435 2435
         $w4 = round($w*0.05, 0);
2436 2436
         $texto = 'O/CSOSN';//Regime do Simples CRT = 1 ou CRT = 2
2437 2437
         if ($this->getTagValue($this->emit, 'CRT') == '3') {
2438
-             $texto = 'O/CST';//Regime Normal
2438
+                $texto = 'O/CST';//Regime Normal
2439 2439
         }
2440 2440
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2441 2441
         $this->pdf->textBox($x, $y, $w4, $h, $texto, $aFont, 'C', 'C', 0, '', false);
@@ -2825,7 +2825,7 @@  discard block
 block discarded – undo
2825 2825
         $this->pdf->textBox($x, $yVeic, $w1+40, $h, $texto, $aFont, 'T', 'L', 0, '');
2826 2826
         $yVeic += $h;
2827 2827
         $texto = 'Tipo.................: ' . ($renavamTiposVeiculos[intval($veiculoTipo)] ?? $veiculoTipo);
2828
-         $this->pdf->textBox($x, $yVeic, $w1+40, $h, $texto, $aFont, 'T', 'L', 0, '');
2828
+            $this->pdf->textBox($x, $yVeic, $w1+40, $h, $texto, $aFont, 'T', 'L', 0, '');
2829 2829
         $yVeic = $y + $h;
2830 2830
         $xVeic = $x + 65;
2831 2831
         $texto = 'Nº Motor: .........: ' . $veiculoMotor;
@@ -2959,9 +2959,9 @@  discard block
 block discarded – undo
2959 2959
         //DADOS ADICIONAIS
2960 2960
         $texto = "DADOS ADICIONAIS";
2961 2961
         if ($this->orientacao == 'P') {
2962
-              $w = $this->wPrint;
2962
+                $w = $this->wPrint;
2963 2963
         } else {
2964
-              $w = $this->wPrint-$this->wCanhoto;
2964
+                $w = $this->wPrint-$this->wCanhoto;
2965 2965
         }
2966 2966
         $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
2967 2967
         $this->pdf->textBox($x, $y, $w, 8, $texto, $aFont, 'T', 'L', 0, '');
@@ -3042,10 +3042,10 @@  discard block
 block discarded – undo
3042 3042
         
3043 3043
         $y = $this->maxH - 4;
3044 3044
         if ($this->orientacao == 'P') {
3045
-              $w = $this->wPrint;
3045
+                $w = $this->wPrint;
3046 3046
         } else {
3047
-              $w = $this->wPrint-$this->wCanhoto;
3048
-              $x = $this->wCanhoto;
3047
+                $w = $this->wPrint-$this->wCanhoto;
3048
+                $x = $this->wCanhoto;
3049 3049
         }
3050 3050
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>'I'];
3051 3051
         $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: ' .
495 495
                 $this->anfaveaDANFE($this->getTagValue($this->infAdic, "infCpl")) : '';
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: " .
503 503
                 $this->getTagValue($this->infAdic, "infAdFisco") : '';
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
                     $this->textoAdic .= "\r\n" . $campo . ':  ' . trim($xTexto);
511 511
                     $i++;
@@ -533,37 +533,37 @@  discard block
 block discarded – undo
533 533
         foreach ($alinhas as $linha) {
534 534
             $numlinhasdados += $this->pdf->getNumLines($linha, $this->wAdic, $fontProduto);
535 535
         }
536
-        $hdadosadic = round(($numlinhasdados+3) * $this->pdf->fontSize, 0);
536
+        $hdadosadic = round(($numlinhasdados + 3) * $this->pdf->fontSize, 0);
537 537
         if ($hdadosadic < 10) {
538 538
             $hdadosadic = 10;
539 539
         }
540 540
         //altura disponivel para os campos da DANFE
541
-        $hcabecalho = 47;//para cabeçalho
542
-        $hdestinatario = 25;//para destinatario
543
-        $hduplicatas = 12;//para cada grupo de 7 duplicatas
544
-        $himposto = 18;// para imposto
545
-        $htransporte = 25;// para transporte
546
-        $hissqn = 11;// para issqn
547
-        $hfooter = 5;// para rodape
548
-        $hCabecItens = 4;//cabeçalho dos itens
541
+        $hcabecalho = 47; //para cabeçalho
542
+        $hdestinatario = 25; //para destinatario
543
+        $hduplicatas = 12; //para cada grupo de 7 duplicatas
544
+        $himposto = 18; // para imposto
545
+        $htransporte = 25; // para transporte
546
+        $hissqn = 11; // para issqn
547
+        $hfooter = 5; // para rodape
548
+        $hCabecItens = 4; //cabeçalho dos itens
549 549
         //alturas disponiveis para os dados
550 550
         $hDispo1 = $this->hPrint - 10 - ($hcabecalho +
551 551
             $hdestinatario + ($linhasDup * $hduplicatas) + $himposto + $htransporte +
552 552
             ($linhaISSQN * $hissqn) + $hdadosadic + $hfooter + $hCabecItens +
553 553
             $this->sizeExtraTextoFatura());
554 554
         if ($this->orientacao == 'P') {
555
-            $hDispo1 -= 24 * $this->qCanhoto;//para canhoto
555
+            $hDispo1 -= 24 * $this->qCanhoto; //para canhoto
556 556
             $w = $this->wPrint;
557 557
         } else {
558
-            $hcanhoto = $this->hPrint;//para canhoto
558
+            $hcanhoto = $this->hPrint; //para canhoto
559 559
             $w = $this->wPrint - $this->wCanhoto;
560 560
         }
561
-        $hDispo2 = $this->hPrint - 10 - ($hcabecalho + $hfooter + $hCabecItens)-4;
561
+        $hDispo2 = $this->hPrint - 10 - ($hcabecalho + $hfooter + $hCabecItens) - 4;
562 562
         //Contagem da altura ocupada para impressão dos itens
563 563
         $fontProduto = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>''];
564 564
         $numlinhas = 0;
565 565
         $hUsado = $hCabecItens;
566
-        $w2 = round($w*0.28, 0);
566
+        $w2 = round($w * 0.28, 0);
567 567
         $hDispo = $hDispo1;
568 568
         $totPag = 1;
569 569
         $i = 0;
@@ -576,7 +576,7 @@  discard block
 block discarded – undo
576 576
                 $hDispo = $hDispo2;
577 577
                 $hUsado = $hCabecItens;
578 578
                 // Remove canhoto para páginas secundárias em modo paisagem ('L')
579
-                $w2 = round($this->wPrint*0.28, 0);
579
+                $w2 = round($this->wPrint * 0.28, 0);
580 580
                 $i--; // decrementa para readicionar o item que não coube nessa pagina na outra.
581 581
             }
582 582
             $i++;
@@ -600,7 +600,7 @@  discard block
 block discarded – undo
600 600
         //coloca o cabeçalho
601 601
         $y = $this->header($x, $y, $pag, $totPag);
602 602
         //coloca os dados do destinatário
603
-        $y = $this->destinatarioDANFE($x, $y+1);
603
+        $y = $this->destinatarioDANFE($x, $y + 1);
604 604
         
605 605
         
606 606
         //Verifica as formas de pagamento da nota fiscal
@@ -614,29 +614,29 @@  discard block
 block discarded – undo
614 614
         }
615 615
         //caso tenha boleto imprimir fatura
616 616
         if ($this->dup->length > 0) {
617
-            $y = $this->fatura($x, $y+1);
617
+            $y = $this->fatura($x, $y + 1);
618 618
         } else {
619 619
             //Se somente tiver a forma de pagamento sem pagamento ou outros não imprimir nada
620
-            if (count($formaPag)=='1' && (isset($formaPag[90]) || isset($formaPag[99]))) {
620
+            if (count($formaPag) == '1' && (isset($formaPag[90]) || isset($formaPag[99]))) {
621 621
                 $y = $y;
622 622
             } else {
623 623
                 //caso tenha mais de uma forma de pagamento ou seja diferente de boleto exibe a
624 624
                 //forma de pagamento e o valor
625
-                $y = $this->pagamento($x, $y+1);
625
+                $y = $this->pagamento($x, $y + 1);
626 626
             }
627 627
         }
628 628
         //coloca os dados dos impostos e totais da NFe
629
-        $y = $this->imposto($x, $y+1);
629
+        $y = $this->imposto($x, $y + 1);
630 630
         //coloca os dados do trasnporte
631
-        $y = $this->transporte($x, $y+1);
631
+        $y = $this->transporte($x, $y + 1);
632 632
         //itens da DANFE
633 633
         $nInicial = 0;
634 634
 
635
-        $y = $this->itens($x, $y+1, $nInicial, $hDispo1, $pag, $totPag, $hCabecItens);
635
+        $y = $this->itens($x, $y + 1, $nInicial, $hDispo1, $pag, $totPag, $hCabecItens);
636 636
 
637 637
         //coloca os dados do ISSQN
638 638
         if ($linhaISSQN == 1) {
639
-            $y = $this->issqn($x, $y+4);
639
+            $y = $this->issqn($x, $y + 4);
640 640
         } else {
641 641
             $y += 4;
642 642
         }
@@ -665,7 +665,7 @@  discard block
 block discarded – undo
665 665
             //coloca o cabeçalho na página adicional
666 666
             $y = $this->header($x, $y, $n, $totPag);
667 667
             //coloca os itens na página adicional
668
-            $y = $this->itens($x, $y+1, $nInicial, $hDispo2, $n, $totPag, $hCabecItens);
668
+            $y = $this->itens($x, $y + 1, $nInicial, $hDispo2, $n, $totPag, $hCabecItens);
669 669
             //coloca o rodapé da página
670 670
             if ($this->orientacao == 'P') {
671 671
                 $this->rodape($margEsq);
@@ -702,7 +702,7 @@  discard block
 block discarded – undo
702 702
         if ($startPos === false) {
703 703
             return $cdata;
704 704
         }
705
-        for ($x=$len; $x>0; $x--) {
705
+        for ($x = $len; $x > 0; $x--) {
706 706
             if (substr($cdata, $x, 1) == '>') {
707 707
                 $endPos = $x;
708 708
                 break;
@@ -713,15 +713,15 @@  discard block
 block discarded – undo
713 713
         } else {
714 714
             $parte1 = '';
715 715
         }
716
-        $parte2 = substr($cdata, $startPos, $endPos-$startPos+1);
716
+        $parte2 = substr($cdata, $startPos, $endPos - $startPos + 1);
717 717
         if ($endPos < $len) {
718 718
             $parte3 = substr($cdata, $endPos + 1, $len - $endPos - 1);
719 719
         } else {
720 720
             $parte3 = '';
721 721
         }
722
-        $texto = trim($parte1).' '.trim($parte3);
722
+        $texto = trim($parte1) . ' ' . trim($parte3);
723 723
         if (strpos($parte2, '<CDATA>') === false) {
724
-            $cdata = '<CDATA>'.$parte2.'</CDATA>';
724
+            $cdata = '<CDATA>' . $parte2 . '</CDATA>';
725 725
         } else {
726 726
             $cdata = $parte2;
727 727
         }
@@ -795,15 +795,15 @@  discard block
 block discarded – undo
795 795
         //grupo CADATA infCpl
796 796
         $t = $dom->getElementsByTagName('transmissor')->item(0);
797 797
         $r = $dom->getElementsByTagName('receptor')->item(0);
798
-        $versao = ! empty($dom->getElementsByTagName('versao')->item(0)->nodeValue) ?
799
-            'Versao:'.$dom->getElementsByTagName('versao')->item(0)->nodeValue.' ' : '';
800
-        $especieNF = ! empty($dom->getElementsByTagName('especieNF')->item(0)->nodeValue) ?
801
-            'Especie:'.$dom->getElementsByTagName('especieNF')->item(0)->nodeValue.' ' : '';
802
-        $fabEntrega = ! empty($dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue) ?
803
-            'Entrega:'.$dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue.' ' : '';
804
-        $dca = ! empty($dom->getElementsByTagName('dca')->item(0)->nodeValue) ?
805
-            'dca:'.$dom->getElementsByTagName('dca')->item(0)->nodeValue.' ' : '';
806
-        $texto .= "".$versao.$especieNF.$fabEntrega.$dca;
798
+        $versao = !empty($dom->getElementsByTagName('versao')->item(0)->nodeValue) ?
799
+            'Versao:' . $dom->getElementsByTagName('versao')->item(0)->nodeValue . ' ' : '';
800
+        $especieNF = !empty($dom->getElementsByTagName('especieNF')->item(0)->nodeValue) ?
801
+            'Especie:' . $dom->getElementsByTagName('especieNF')->item(0)->nodeValue . ' ' : '';
802
+        $fabEntrega = !empty($dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue) ?
803
+            'Entrega:' . $dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue . ' ' : '';
804
+        $dca = !empty($dom->getElementsByTagName('dca')->item(0)->nodeValue) ?
805
+            'dca:' . $dom->getElementsByTagName('dca')->item(0)->nodeValue . ' ' : '';
806
+        $texto .= "" . $versao . $especieNF . $fabEntrega . $dca;
807 807
         if (isset($t)) {
808 808
             if ($t->hasAttributes()) {
809 809
                 $texto .= " Transmissor ";
@@ -889,14 +889,14 @@  discard block
 block discarded – undo
889 889
         }
890 890
         //####################################################################################
891 891
         //coluna esquerda identificação do emitente
892
-        $w = round($maxW*0.41, 0);
892
+        $w = round($maxW * 0.41, 0);
893 893
         if ($this->orientacao == 'P') {
894 894
             $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>'I'];
895 895
         } else {
896 896
             $aFont = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B'];
897 897
         }
898 898
         $w1 = $w;
899
-        $h=32;
899
+        $h = 32;
900 900
         $oldY += $h;
901 901
         $this->pdf->textBox($x, $y, $w, $h);
902 902
         $texto = 'IDENTIFICAÇÃO DO EMITENTE';
@@ -917,39 +917,39 @@  discard block
 block discarded – undo
917 917
                 $type == 'jpg';
918 918
             }
919 919
             //largura da imagem em mm
920
-            $logoWmm = ($logoInfo[0]/72)*25.4;
920
+            $logoWmm = ($logoInfo[0] / 72) * 25.4;
921 921
             //altura da imagem em mm
922
-            $logoHmm = ($logoInfo[1]/72)*25.4;
923
-            if ($this->logoAlign=='L') {
924
-                $nImgW = round($w/3, 0);
925
-                $nImgH = round($logoHmm * ($nImgW/$logoWmm), 0);
926
-                $xImg = $x+1;
927
-                $yImg = round(($h-$nImgH)/2, 0)+$y;
922
+            $logoHmm = ($logoInfo[1] / 72) * 25.4;
923
+            if ($this->logoAlign == 'L') {
924
+                $nImgW = round($w / 3, 0);
925
+                $nImgH = round($logoHmm * ($nImgW / $logoWmm), 0);
926
+                $xImg = $x + 1;
927
+                $yImg = round(($h - $nImgH) / 2, 0) + $y;
928 928
                 //estabelecer posições do texto
929
-                $x1 = round($xImg + $nImgW +1, 0);
930
-                $y1 = round($h/3+$y, 0);
931
-                $tw = round(2*$w/3, 0);
932
-            } elseif ($this->logoAlign=='C') {
933
-                $nImgH = round($h/3, 0);
934
-                $nImgW = round($logoWmm * ($nImgH/$logoHmm), 0);
935
-                $xImg = round(($w-$nImgW)/2+$x, 0);
936
-                $yImg = $y+3;
929
+                $x1 = round($xImg + $nImgW + 1, 0);
930
+                $y1 = round($h / 3 + $y, 0);
931
+                $tw = round(2 * $w / 3, 0);
932
+            } elseif ($this->logoAlign == 'C') {
933
+                $nImgH = round($h / 3, 0);
934
+                $nImgW = round($logoWmm * ($nImgH / $logoHmm), 0);
935
+                $xImg = round(($w - $nImgW) / 2 + $x, 0);
936
+                $yImg = $y + 3;
937 937
                 $x1 = $x;
938 938
                 $y1 = round($yImg + $nImgH + 1, 0);
939 939
                 $tw = $w;
940
-            } elseif ($this->logoAlign=='R') {
941
-                $nImgW = round($w/3, 0);
942
-                $nImgH = round($logoHmm * ($nImgW/$logoWmm), 0);
943
-                $xImg = round($x+($w-(1+$nImgW)), 0);
944
-                $yImg = round(($h-$nImgH)/2, 0)+$y;
940
+            } elseif ($this->logoAlign == 'R') {
941
+                $nImgW = round($w / 3, 0);
942
+                $nImgH = round($logoHmm * ($nImgW / $logoWmm), 0);
943
+                $xImg = round($x + ($w - (1 + $nImgW)), 0);
944
+                $yImg = round(($h - $nImgH) / 2, 0) + $y;
945 945
                 $x1 = $x;
946
-                $y1 = round($h/3+$y, 0);
947
-                $tw = round(2*$w/3, 0);
948
-            } elseif ($this->logoAlign=='F') {
949
-                $nImgH = round($h-5, 0);
950
-                $nImgW = round($logoWmm * ($nImgH/$logoHmm), 0);
951
-                $xImg = round(($w-$nImgW)/2+$x, 0);
952
-                $yImg = $y+3;
946
+                $y1 = round($h / 3 + $y, 0);
947
+                $tw = round(2 * $w / 3, 0);
948
+            } elseif ($this->logoAlign == 'F') {
949
+                $nImgH = round($h - 5, 0);
950
+                $nImgW = round($logoWmm * ($nImgH / $logoHmm), 0);
951
+                $xImg = round(($w - $nImgW) / 2 + $x, 0);
952
+                $yImg = $y + 3;
953 953
                 $x1 = $x;
954 954
                 $y1 = round($yImg + $nImgH + 1, 0);
955 955
                 $tw = $w;
@@ -958,7 +958,7 @@  discard block
 block discarded – undo
958 958
             $this->pdf->Image($this->logomarca, $xImg, $yImg, $nImgW, $nImgH, $type);
959 959
         } else {
960 960
             $x1 = $x;
961
-            $y1 = round($h/3+$y, 0);
961
+            $y1 = round($h / 3 + $y, 0);
962 962
             $tw = $w;
963 963
         }
964 964
         // monta as informações apenas se diferente de full logo
@@ -968,9 +968,9 @@  discard block
 block discarded – undo
968 968
             $texto = $this->emit->getElementsByTagName("xNome")->item(0)->nodeValue;
969 969
             $this->pdf->textBox($x1, $y1, $tw, 8, $texto, $aFont, 'T', 'C', 0, '');
970 970
             //endereço
971
-            $y1 = $y1+5;
971
+            $y1 = $y1 + 5;
972 972
             $aFont = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>''];
973
-            $fone = ! empty($this->enderEmit->getElementsByTagName("fone")->item(0)->nodeValue)
973
+            $fone = !empty($this->enderEmit->getElementsByTagName("fone")->item(0)->nodeValue)
974 974
                  ? $this->enderEmit->getElementsByTagName("fone")->item(0)->nodeValue
975 975
                  : '';
976 976
             $lgr = $this->getTagValue($this->enderEmit, "xLgr");
@@ -990,34 +990,34 @@  discard block
 block discarded – undo
990 990
         //####################################################################################
991 991
         //coluna central Danfe
992 992
         $x += $w;
993
-        $w=round($maxW * 0.17, 0);//35;
993
+        $w = round($maxW * 0.17, 0); //35;
994 994
         $w2 = $w;
995 995
         $h = 32;
996 996
         $this->pdf->textBox($x, $y, $w, $h);
997 997
   
998 998
         $texto = "DANFE";
999 999
         $aFont = ['font'=>$this->fontePadrao, 'size'=>14, 'style'=>'B'];
1000
-        $this->pdf->textBox($x, $y+1, $w, $h, $texto, $aFont, 'T', 'C', 0, '');
1000
+        $this->pdf->textBox($x, $y + 1, $w, $h, $texto, $aFont, 'T', 'C', 0, '');
1001 1001
         $aFont = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>''];
1002 1002
         $texto = 'Documento Auxiliar da Nota Fiscal Eletrônica';
1003 1003
         $h = 20;
1004
-        $this->pdf->textBox($x, $y+6, $w, $h, $texto, $aFont, 'T', 'C', 0, '', false);
1004
+        $this->pdf->textBox($x, $y + 6, $w, $h, $texto, $aFont, 'T', 'C', 0, '', false);
1005 1005
         
1006 1006
 
1007 1007
         $aFont = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>''];
1008 1008
         $texto = '0 - ENTRADA';
1009 1009
         $y1 = $y + 14;
1010 1010
         $h = 8;
1011
-        $this->pdf->textBox($x+2, $y1, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1011
+        $this->pdf->textBox($x + 2, $y1, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1012 1012
         $texto = '1 - SAÍDA';
1013 1013
         $y1 = $y + 17;
1014
-        $this->pdf->textBox($x+2, $y1, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1014
+        $this->pdf->textBox($x + 2, $y1, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1015 1015
         //tipo de nF
1016 1016
         $aFont = ['font'=>$this->fontePadrao, 'size'=>12, 'style'=>'B'];
1017 1017
         $y1 = $y + 13;
1018 1018
         $h = 7;
1019 1019
         $texto = $this->ide->getElementsByTagName('tpNF')->item(0)->nodeValue;
1020
-        $this->pdf->textBox($x+27, $y1, 5, $h, $texto, $aFont, 'C', 'C', 1, '');
1020
+        $this->pdf->textBox($x + 27, $y1, 5, $h, $texto, $aFont, 'C', 'C', 1, '');
1021 1021
         //numero da NF
1022 1022
         $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'];
1023 1023
         $y1 = $y + 20;
@@ -1049,7 +1049,7 @@  discard block
 block discarded – undo
1049 1049
         //####################################################################################
1050 1050
         //coluna codigo de barras
1051 1051
         $x += $w;
1052
-        $w = ($maxW-$w1-$w2);//85;
1052
+        $w = ($maxW - $w1 - $w2); //85;
1053 1053
         $w3 = $w;
1054 1054
         $h = 32;
1055 1055
         $this->pdf->textBox($x, $y, $w, $h);
@@ -1058,22 +1058,22 @@  discard block
 block discarded – undo
1058 1058
         $bW = 75;
1059 1059
         $bH = 12;
1060 1060
         //codigo de barras
1061
-        $this->pdf->code128($x+(($w-$bW)/2), $y+2, $chave_acesso, $bW, $bH);
1061
+        $this->pdf->code128($x + (($w - $bW) / 2), $y + 2, $chave_acesso, $bW, $bH);
1062 1062
         //linhas divisorias
1063
-        $this->pdf->line($x, $y+4+$bH, $x+$w, $y+4+$bH);
1064
-        $this->pdf->line($x, $y+12+$bH, $x+$w, $y+12+$bH);
1063
+        $this->pdf->line($x, $y + 4 + $bH, $x + $w, $y + 4 + $bH);
1064
+        $this->pdf->line($x, $y + 12 + $bH, $x + $w, $y + 12 + $bH);
1065 1065
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1066
-        $y1 = $y+4+$bH;
1066
+        $y1 = $y + 4 + $bH;
1067 1067
         $h = 7;
1068 1068
         $texto = 'CHAVE DE ACESSO';
1069 1069
         $this->pdf->textBox($x, $y1, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1070 1070
         $aFont = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B'];
1071
-        $y1 = $y+8+$bH;
1071
+        $y1 = $y + 8 + $bH;
1072 1072
         $texto = $this->formatField($chave_acesso, $this->formatoChave);
1073
-        $this->pdf->textBox($x+2, $y1, $w-2, $h, $texto, $aFont, 'T', 'C', 0, '');
1074
-        $y1 = $y+12+$bH;
1073
+        $this->pdf->textBox($x + 2, $y1, $w - 2, $h, $texto, $aFont, 'T', 'C', 0, '');
1074
+        $y1 = $y + 12 + $bH;
1075 1075
         $aFont = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>''];
1076
-        $chaveContingencia="";
1076
+        $chaveContingencia = "";
1077 1077
         if ($this->notaDpec()) {
1078 1078
             $cabecalhoProtoAutorizacao = 'NÚMERO DE REGISTRO DPEC';
1079 1079
         } else {
@@ -1084,16 +1084,16 @@  discard block
 block discarded – undo
1084 1084
             $chaveContingencia = $this->geraChaveAdicionalDeContingencia();
1085 1085
             $this->pdf->setFillColor(0, 0, 0);
1086 1086
             //codigo de barras
1087
-            $this->pdf->code128($x+11, $y1+1, $chaveContingencia, $bW*.9, $bH/2);
1087
+            $this->pdf->code128($x + 11, $y1 + 1, $chaveContingencia, $bW * .9, $bH / 2);
1088 1088
         } else {
1089 1089
             $texto = 'Consulta de autenticidade no portal nacional da NF-e';
1090
-            $this->pdf->textBox($x+2, $y1, $w-2, $h, $texto, $aFont, 'T', 'C', 0, '');
1091
-            $y1 = $y+16+$bH;
1090
+            $this->pdf->textBox($x + 2, $y1, $w - 2, $h, $texto, $aFont, 'T', 'C', 0, '');
1091
+            $y1 = $y + 16 + $bH;
1092 1092
             $texto = 'www.nfe.fazenda.gov.br/portal ou no site da Sefaz Autorizadora';
1093 1093
             $this->pdf->textBox(
1094
-                $x+2,
1094
+                $x + 2,
1095 1095
                 $y1,
1096
-                $w-2,
1096
+                $w - 2,
1097 1097
                 $h,
1098 1098
                 $texto,
1099 1099
                 $aFont,
@@ -1109,7 +1109,7 @@  discard block
 block discarded – undo
1109 1109
         //natureza da operação
1110 1110
         $texto = 'NATUREZA DA OPERAÇÃO';
1111 1111
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1112
-        $w = $w1+$w2;
1112
+        $w = $w1 + $w2;
1113 1113
         $y = $oldY;
1114 1114
         $oldY += $h;
1115 1115
         $x = $oldX;
@@ -1142,7 +1142,7 @@  discard block
 block discarded – undo
1142 1142
                 $cStat = '';
1143 1143
             } else {
1144 1144
                 if (isset($this->nfeProc)) {
1145
-                    $texto = ! empty($this->nfeProc->getElementsByTagName("nProt")->item(0)->nodeValue)
1145
+                    $texto = !empty($this->nfeProc->getElementsByTagName("nProt")->item(0)->nodeValue)
1146 1146
                         ? $this->nfeProc->getElementsByTagName("nProt")->item(0)->nodeValue
1147 1147
                         : '';
1148 1148
                     $tsHora = $this->toTimestamp(
@@ -1176,25 +1176,25 @@  discard block
 block discarded – undo
1176 1176
         $texto = 'INSCRIÇÃO ESTADUAL DO SUBST. TRIBUT.';
1177 1177
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1178 1178
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1179
-        $texto = ! empty($this->emit->getElementsByTagName("IEST")->item(0)->nodeValue)
1179
+        $texto = !empty($this->emit->getElementsByTagName("IEST")->item(0)->nodeValue)
1180 1180
              ? $this->emit->getElementsByTagName("IEST")->item(0)->nodeValue
1181 1181
              : '';
1182 1182
         $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'];
1183 1183
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1184 1184
         //CNPJ
1185 1185
         $x += $w;
1186
-        $w = ($maxW-(2*$w));
1186
+        $w = ($maxW - (2 * $w));
1187 1187
         $texto = 'CNPJ / CPF';
1188 1188
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1189 1189
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1190 1190
         //Pegando valor do CPF/CNPJ
1191
-        if (! empty($this->emit->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1191
+        if (!empty($this->emit->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1192 1192
             $texto = $this->formatField(
1193 1193
                 $this->emit->getElementsByTagName("CNPJ")->item(0)->nodeValue,
1194 1194
                 "###.###.###/####-##"
1195 1195
             );
1196 1196
         } else {
1197
-            $texto = ! empty($this->emit->getElementsByTagName("CPF")->item(0)->nodeValue)
1197
+            $texto = !empty($this->emit->getElementsByTagName("CPF")->item(0)->nodeValue)
1198 1198
                 ? $this->formatField(
1199 1199
                     $this->emit->getElementsByTagName("CPF")->item(0)->nodeValue,
1200 1200
                     "###.###.###-##"
@@ -1211,22 +1211,22 @@  discard block
 block discarded – undo
1211 1211
         $resp = $this->statusNFe();
1212 1212
         if (!$resp['status']) {
1213 1213
             $x = 10;
1214
-            $y = $this->hPrint-130;
1214
+            $y = $this->hPrint - 130;
1215 1215
             $h = 25;
1216
-            $w = $maxW-(2*$x);
1216
+            $w = $maxW - (2 * $x);
1217 1217
             $this->pdf->settextcolor(90, 90, 90);
1218 1218
             $texto = $resp['message'];
1219 1219
             $aFont = ['font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B'];
1220 1220
             $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1221 1221
             $y += $h;
1222 1222
             $h = 5;
1223
-            $w = $maxW-(2*$x);
1223
+            $w = $maxW - (2 * $x);
1224 1224
             if (isset($this->infProt) && $resp['status']) {
1225 1225
                 $xMotivo = $this->infProt->getElementsByTagName("xMotivo")->item(0)->nodeValue;
1226 1226
             } else {
1227 1227
                 $xMotivo = '';
1228 1228
             }
1229
-            $texto = "SEM VALOR FISCAL\n".$xMotivo;
1229
+            $texto = "SEM VALOR FISCAL\n" . $xMotivo;
1230 1230
             $aFont = ['font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B'];
1231 1231
             $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1232 1232
             $this->pdf->settextcolor(0, 0, 0);
@@ -1249,12 +1249,12 @@  discard block
 block discarded – undo
1249 1249
         if ($this->notaDpec() || $this->tpEmis == 4) {
1250 1250
             //DPEC
1251 1251
             $x = 10;
1252
-            $y = $this->hPrint-130;
1252
+            $y = $this->hPrint - 130;
1253 1253
             $h = 25;
1254
-            $w = $maxW-(2*$x);
1254
+            $w = $maxW - (2 * $x);
1255 1255
             $this->pdf->SetTextColor(200, 200, 200);
1256
-            $texto = "DANFE impresso em contingência -\n".
1257
-                     "DPEC regularmente recebido pela Receita\n".
1256
+            $texto = "DANFE impresso em contingência -\n" .
1257
+                     "DPEC regularmente recebido pela Receita\n" .
1258 1258
                      "Federal do Brasil";
1259 1259
             $aFont = ['font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B'];
1260 1260
             $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
@@ -1373,7 +1373,7 @@  discard block
 block discarded – undo
1373 1373
         $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
1374 1374
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1375 1375
         //NOME / RAZÃO SOCIAL
1376
-        $w = round($maxW*0.61, 0);
1376
+        $w = round($maxW * 0.61, 0);
1377 1377
         $w1 = $w;
1378 1378
         $y += 3;
1379 1379
         $texto = 'NOME / RAZÃO SOCIAL';
@@ -1388,19 +1388,19 @@  discard block
 block discarded – undo
1388 1388
         }
1389 1389
         //CNPJ / CPF
1390 1390
         $x += $w;
1391
-        $w = round($maxW*0.23, 0);
1391
+        $w = round($maxW * 0.23, 0);
1392 1392
         $w2 = $w;
1393 1393
         $texto = 'CNPJ / CPF';
1394 1394
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1395 1395
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1396 1396
         //Pegando valor do CPF/CNPJ
1397
-        if (! empty($this->dest->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1397
+        if (!empty($this->dest->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1398 1398
             $texto = $this->formatField(
1399 1399
                 $this->dest->getElementsByTagName("CNPJ")->item(0)->nodeValue,
1400 1400
                 "###.###.###/####-##"
1401 1401
             );
1402 1402
         } else {
1403
-            $texto = ! empty($this->dest->getElementsByTagName("CPF")->item(0)->nodeValue)
1403
+            $texto = !empty($this->dest->getElementsByTagName("CPF")->item(0)->nodeValue)
1404 1404
                 ? $this->formatField(
1405 1405
                     $this->dest->getElementsByTagName("CPF")->item(0)->nodeValue,
1406 1406
                     "###.###.###-##"
@@ -1411,16 +1411,16 @@  discard block
 block discarded – undo
1411 1411
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1412 1412
         //DATA DA EMISSÃO
1413 1413
         $x += $w;
1414
-        $w = $maxW-($w1+$w2);
1414
+        $w = $maxW - ($w1 + $w2);
1415 1415
         $wx = $w;
1416 1416
         $texto = 'DATA DA EMISSÃO';
1417 1417
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1418 1418
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1419
-        $dEmi = ! empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue)
1419
+        $dEmi = !empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue)
1420 1420
             ? $this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue
1421 1421
             : '';
1422 1422
         if ($dEmi == '') {
1423
-            $dEmi = ! empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue)
1423
+            $dEmi = !empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue)
1424 1424
                 ? $this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue
1425 1425
                 : '';
1426 1426
             $aDemi = explode('T', $dEmi);
@@ -1434,7 +1434,7 @@  discard block
 block discarded – undo
1434 1434
             $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 1, '');
1435 1435
         }
1436 1436
         //ENDEREÇO
1437
-        $w = round($maxW*0.47, 0);
1437
+        $w = round($maxW * 0.47, 0);
1438 1438
         $w1 = $w;
1439 1439
         $y += $h;
1440 1440
         $x = $oldX;
@@ -1449,7 +1449,7 @@  discard block
 block discarded – undo
1449 1449
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 0, '', true);
1450 1450
         //BAIRRO / DISTRITO
1451 1451
         $x += $w;
1452
-        $w = round($maxW*0.21, 0);
1452
+        $w = round($maxW * 0.21, 0);
1453 1453
         $w2 = $w;
1454 1454
         $texto = 'BAIRRO / DISTRITO';
1455 1455
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
@@ -1459,12 +1459,12 @@  discard block
 block discarded – undo
1459 1459
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1460 1460
         //CEP
1461 1461
         $x += $w;
1462
-        $w = $maxW-$w1-$w2-$wx;
1462
+        $w = $maxW - $w1 - $w2 - $wx;
1463 1463
         $w2 = $w;
1464 1464
         $texto = 'CEP';
1465 1465
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1466 1466
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1467
-        $texto = ! empty($this->dest->getElementsByTagName("CEP")->item(0)->nodeValue)
1467
+        $texto = !empty($this->dest->getElementsByTagName("CEP")->item(0)->nodeValue)
1468 1468
             ? $this->dest->getElementsByTagName("CEP")->item(0)->nodeValue
1469 1469
             : '';
1470 1470
         $texto = $this->formatField($texto, "#####-###");
@@ -1476,11 +1476,11 @@  discard block
 block discarded – undo
1476 1476
         $texto = 'DATA DA SAÍDA/ENTRADA';
1477 1477
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1478 1478
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1479
-        $dSaiEnt = ! empty($this->ide->getElementsByTagName("dSaiEnt")->item(0)->nodeValue)
1479
+        $dSaiEnt = !empty($this->ide->getElementsByTagName("dSaiEnt")->item(0)->nodeValue)
1480 1480
             ? $this->ide->getElementsByTagName("dSaiEnt")->item(0)->nodeValue
1481 1481
             : '';
1482 1482
         if ($dSaiEnt == '') {
1483
-            $dSaiEnt = ! empty($this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue)
1483
+            $dSaiEnt = !empty($this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue)
1484 1484
                 ? $this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue
1485 1485
                 : '';
1486 1486
             $aDsaient = explode('T', $dSaiEnt);
@@ -1500,7 +1500,7 @@  discard block
 block discarded – undo
1500 1500
         if (strtoupper(trim($texto)) == "EXTERIOR"
1501 1501
             && $this->dest->getElementsByTagName("xPais")->length > 0
1502 1502
         ) {
1503
-            $texto .= " - " .  $this->dest->getElementsByTagName("xPais")->item(0)->nodeValue;
1503
+            $texto .= " - " . $this->dest->getElementsByTagName("xPais")->item(0)->nodeValue;
1504 1504
         }
1505 1505
         $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'];
1506 1506
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 0, '');
@@ -1515,19 +1515,19 @@  discard block
 block discarded – undo
1515 1515
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1516 1516
         //FONE / FAX
1517 1517
         $x += $w;
1518
-        $w = round(($maxW -$w1-$wx-8)/2, 0);
1518
+        $w = round(($maxW - $w1 - $wx - 8) / 2, 0);
1519 1519
         $w3 = $w;
1520 1520
         $texto = 'FONE / FAX';
1521 1521
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1522 1522
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1523
-        $texto = ! empty($this->dest->getElementsByTagName("fone")->item(0)->nodeValue)
1523
+        $texto = !empty($this->dest->getElementsByTagName("fone")->item(0)->nodeValue)
1524 1524
             ? $this->dest->getElementsByTagName("fone")->item(0)->nodeValue
1525 1525
             : '';
1526 1526
         $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'];
1527 1527
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1528 1528
         //INSCRIÇÃO ESTADUAL
1529 1529
         $x += $w;
1530
-        $w = $maxW -$w1-$wx-8-$w3;
1530
+        $w = $maxW - $w1 - $wx - 8 - $w3;
1531 1531
         $texto = 'INSCRIÇÃO ESTADUAL';
1532 1532
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1533 1533
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -1541,11 +1541,11 @@  discard block
 block discarded – undo
1541 1541
         $texto = 'HORA DA SAÍDA/ENTRADA';
1542 1542
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1543 1543
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1544
-        $hSaiEnt = ! empty($this->ide->getElementsByTagName("hSaiEnt")->item(0)->nodeValue)
1544
+        $hSaiEnt = !empty($this->ide->getElementsByTagName("hSaiEnt")->item(0)->nodeValue)
1545 1545
             ? $this->ide->getElementsByTagName("hSaiEnt")->item(0)->nodeValue
1546 1546
             : '';
1547 1547
         if ($hSaiEnt == '') {
1548
-            $dhSaiEnt = ! empty($this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue)
1548
+            $dhSaiEnt = !empty($this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue)
1549 1549
                 ? $this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue
1550 1550
                 : '';
1551 1551
             $tsDhSaiEnt = $this->toTimestamp($dhSaiEnt);
@@ -1625,7 +1625,7 @@  discard block
 block discarded – undo
1625 1625
     protected function fatura($x, $y)
1626 1626
     {
1627 1627
         $linha = 1;
1628
-        $h = 8+3;
1628
+        $h = 8 + 3;
1629 1629
         $oldx = $x;
1630 1630
         $textoFatura = $this->getTextoFatura();
1631 1631
         //verificar se existem duplicatas
@@ -1658,29 +1658,29 @@  discard block
 block discarded – undo
1658 1658
                 return ($y + $h - 3);
1659 1659
             }
1660 1660
             if ($textoFatura !== "" && $this->exibirTextoFatura) {
1661
-                $myH=6;
1661
+                $myH = 6;
1662 1662
                 $myW = $this->wPrint;
1663 1663
                 if ($this->orientacao == 'L') {
1664 1664
                     $myW -= $this->wCanhoto;
1665 1665
                 }
1666 1666
                 $aFont = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>''];
1667 1667
                 $this->pdf->textBox($x, $y, $myW, $myH, $textoFatura, $aFont, 'C', 'L', 1, '');
1668
-                $y+=$myH+1;
1668
+                $y += $myH + 1;
1669 1669
             }
1670 1670
             if ($this->orientacao == 'P') {
1671
-                $w = round($this->wPrint/7.018, 0)-1;
1671
+                $w = round($this->wPrint / 7.018, 0) - 1;
1672 1672
             } else {
1673 1673
                 $w = 28;
1674 1674
             }
1675 1675
             $increm = 1;
1676 1676
             foreach ($this->dup as $k => $d) {
1677
-                $nDup = ! empty($this->dup->item($k)->getElementsByTagName('nDup')->item(0)->nodeValue)
1677
+                $nDup = !empty($this->dup->item($k)->getElementsByTagName('nDup')->item(0)->nodeValue)
1678 1678
                     ? $this->dup->item($k)->getElementsByTagName('nDup')->item(0)->nodeValue
1679 1679
                     : '';
1680
-                $dDup = ! empty($this->dup->item($k)->getElementsByTagName('dVenc')->item(0)->nodeValue)
1680
+                $dDup = !empty($this->dup->item($k)->getElementsByTagName('dVenc')->item(0)->nodeValue)
1681 1681
                     ? $this->ymdTodmy($this->dup->item($k)->getElementsByTagName('dVenc')->item(0)->nodeValue)
1682 1682
                     : '';
1683
-                $vDup = ! empty($this->dup->item($k)->getElementsByTagName('vDup')->item(0)->nodeValue)
1683
+                $vDup = !empty($this->dup->item($k)->getElementsByTagName('vDup')->item(0)->nodeValue)
1684 1684
                     ? 'R$ ' . number_format(
1685 1685
                         $this->dup->item($k)->getElementsByTagName('vDup')->item(0)->nodeValue,
1686 1686
                         2,
@@ -1690,14 +1690,14 @@  discard block
 block discarded – undo
1690 1690
                     : '';
1691 1691
                 $h = 8;
1692 1692
                 $texto = '';
1693
-                if ($nDup!='0' && $nDup!='') {
1693
+                if ($nDup != '0' && $nDup != '') {
1694 1694
                     $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1695 1695
                     $this->pdf->textBox($x, $y, $w, $h, 'Num.', $aFont, 'T', 'L', 1, '');
1696 1696
                     $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
1697 1697
                     $this->pdf->textBox($x, $y, $w, $h, $nDup, $aFont, 'T', 'R', 0, '');
1698 1698
                 } else {
1699 1699
                     $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1700
-                    $this->pdf->textBox($x, $y, $w, $h, ($dupcont+1)."", $aFont, 'T', 'L', 1, '');
1700
+                    $this->pdf->textBox($x, $y, $w, $h, ($dupcont + 1) . "", $aFont, 'T', 'L', 1, '');
1701 1701
                 }
1702 1702
                 $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1703 1703
                 $this->pdf->textBox($x, $y, $w, $h, 'Venc.', $aFont, 'C', 'L', 0, '');
@@ -1707,7 +1707,7 @@  discard block
 block discarded – undo
1707 1707
                 $this->pdf->textBox($x, $y, $w, $h, 'Valor', $aFont, 'B', 'L', 0, '');
1708 1708
                 $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
1709 1709
                 $this->pdf->textBox($x, $y, $w, $h, $vDup, $aFont, 'B', 'R', 0, '');
1710
-                $x += $w+$increm;
1710
+                $x += $w + $increm;
1711 1711
                 $dupcont += 1;
1712 1712
                 if ($this->orientacao == 'P') {
1713 1713
                     $maxDupCont = 6;
@@ -1729,10 +1729,10 @@  discard block
 block discarded – undo
1729 1729
                 $y -= 9;
1730 1730
                 $linha--;
1731 1731
             }
1732
-            return ($y+$h);
1732
+            return ($y + $h);
1733 1733
         } else {
1734 1734
             $linha = 0;
1735
-            return ($y-2);
1735
+            return ($y - 2);
1736 1736
         }
1737 1737
     }
1738 1738
 
@@ -1748,7 +1748,7 @@  discard block
 block discarded – undo
1748 1748
     protected function pagamento($x, $y)
1749 1749
     {
1750 1750
         $linha = 1;
1751
-        $h = 8+3;
1751
+        $h = 8 + 3;
1752 1752
         $oldx = $x;
1753 1753
         //verificar se existem cobranças definidas
1754 1754
         if (isset($this->detPag) && $this->detPag->length > 0) {
@@ -1767,7 +1767,7 @@  discard block
 block discarded – undo
1767 1767
             $dups = "";
1768 1768
             $dupcont = 0;
1769 1769
             if ($this->orientacao == 'P') {
1770
-                $w = round($this->wPrint/7.018, 0)-1;
1770
+                $w = round($this->wPrint / 7.018, 0) - 1;
1771 1771
             } else {
1772 1772
                 $w = 28;
1773 1773
             }
@@ -1777,17 +1777,17 @@  discard block
 block discarded – undo
1777 1777
                 $maxDupCont = 8;
1778 1778
             }
1779 1779
             $increm = 1;
1780
-            $formaPagamento = ['01'=>'Dinheiro','02'=>'Cheque','03'=>'Cartão de Crédito',
1781
-                                    '04'=>'Cartão de Débito','05'=>'Crédito Loja','10'=>'Vale Alimentação',
1782
-                                    '11'=>'Vale Refeição','12'=>'Vale Presente','13'=>'Vale Combustível',
1783
-                                    '14'=>'Duplicata Mercantil','15'=>'Boleto','90'=>'Sem pagamento','99'=>'Outros'];
1784
-            $bandeira = ['01'=>'Visa','02'=>'Mastercard','03'=>'American','04'=>'Sorocred','05'=>'Diners',
1785
-                              '06'=>'Elo','07'=>'Hipercard','08'=>'Aura','09'=>'Cabal','99'=>'Outros'];
1780
+            $formaPagamento = ['01'=>'Dinheiro', '02'=>'Cheque', '03'=>'Cartão de Crédito',
1781
+                                    '04'=>'Cartão de Débito', '05'=>'Crédito Loja', '10'=>'Vale Alimentação',
1782
+                                    '11'=>'Vale Refeição', '12'=>'Vale Presente', '13'=>'Vale Combustível',
1783
+                                    '14'=>'Duplicata Mercantil', '15'=>'Boleto', '90'=>'Sem pagamento', '99'=>'Outros'];
1784
+            $bandeira = ['01'=>'Visa', '02'=>'Mastercard', '03'=>'American', '04'=>'Sorocred', '05'=>'Diners',
1785
+                              '06'=>'Elo', '07'=>'Hipercard', '08'=>'Aura', '09'=>'Cabal', '99'=>'Outros'];
1786 1786
             foreach ($this->detPag as $k => $d) {
1787 1787
                 $fPag = !empty($this->detPag->item($k)->getElementsByTagName('tPag')->item(0)->nodeValue)
1788 1788
                     ? $this->detPag->item($k)->getElementsByTagName('tPag')->item(0)->nodeValue
1789 1789
                     : '0';
1790
-                $vPag = ! empty($this->detPag->item($k)->getElementsByTagName('vPag')->item(0)->nodeValue)
1790
+                $vPag = !empty($this->detPag->item($k)->getElementsByTagName('vPag')->item(0)->nodeValue)
1791 1791
                     ? 'R$ ' . number_format(
1792 1792
                         $this->detPag->item($k)->getElementsByTagName('vPag')->item(0)->nodeValue,
1793 1793
                         2,
@@ -1799,7 +1799,7 @@  discard block
 block discarded – undo
1799 1799
                 $texto = '';
1800 1800
                 if (isset($formaPagamento[$fPag])) {
1801 1801
                     /*Exibir Item sem pagamento ou outros?*/
1802
-                    if ($fPag=='90' || $fPag=='99') {
1802
+                    if ($fPag == '90' || $fPag == '99') {
1803 1803
                         continue;
1804 1804
                     }
1805 1805
                     $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
@@ -1808,16 +1808,16 @@  discard block
 block discarded – undo
1808 1808
                     $this->pdf->textBox($x, $y, $w, $h, $formaPagamento[$fPag], $aFont, 'T', 'R', 0, '');
1809 1809
                 } else {
1810 1810
                     $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>''];
1811
-                    $this->pdf->textBox($x, $y, $w, $h, "Forma ".$fPag." não encontrado", $aFont, 'T', 'L', 1, '');
1811
+                    $this->pdf->textBox($x, $y, $w, $h, "Forma " . $fPag . " não encontrado", $aFont, 'T', 'L', 1, '');
1812 1812
                 }
1813 1813
                 $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1814 1814
                 $this->pdf->textBox($x, $y, $w, $h, 'Valor', $aFont, 'B', 'L', 0, '');
1815 1815
                 $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
1816 1816
                 $this->pdf->textBox($x, $y, $w, $h, $vPag, $aFont, 'B', 'R', 0, '');
1817
-                $x += $w+$increm;
1817
+                $x += $w + $increm;
1818 1818
                 $dupcont += 1;
1819 1819
 
1820
-                if ($dupcont>$maxDupCont) {
1820
+                if ($dupcont > $maxDupCont) {
1821 1821
                     $y += 9;
1822 1822
                     $x = $oldx;
1823 1823
                     $dupcont = 0;
@@ -1832,10 +1832,10 @@  discard block
 block discarded – undo
1832 1832
                 $y -= 9;
1833 1833
                 $linha--;
1834 1834
             }
1835
-            return ($y+$h);
1835
+            return ($y + $h);
1836 1836
         } else {
1837 1837
             $linha = 0;
1838
-            return ($y-2);
1838
+            return ($y - 2);
1839 1839
         }
1840 1840
     } //fim da função pagamento
1841 1841
     
@@ -1947,7 +1947,7 @@  discard block
 block discarded – undo
1947 1947
         }
1948 1948
         $x = $this->impostoHelper($x, $y, $w, $h, "V. TOTAL DA NOTA", "vNF");
1949 1949
 
1950
-        return ($y+$h);
1950
+        return ($y + $h);
1951 1951
     } //fim imposto
1952 1952
 
1953 1953
     /**
@@ -1975,13 +1975,13 @@  discard block
 block discarded – undo
1975 1975
         $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
1976 1976
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1977 1977
         //NOME / RAZÃO SOCIAL
1978
-        $w1 = $maxW*0.29;
1978
+        $w1 = $maxW * 0.29;
1979 1979
         $y += 3;
1980 1980
         $texto = 'NOME / RAZÃO SOCIAL';
1981 1981
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1982 1982
         $this->pdf->textBox($x, $y, $w1, $h, $texto, $aFont, 'T', 'L', 1, '');
1983 1983
         if (isset($this->transporta)) {
1984
-            $texto = ! empty($this->transporta->getElementsByTagName("xNome")->item(0)->nodeValue)
1984
+            $texto = !empty($this->transporta->getElementsByTagName("xNome")->item(0)->nodeValue)
1985 1985
                 ? $this->transporta->getElementsByTagName("xNome")->item(0)->nodeValue
1986 1986
                 : '';
1987 1987
         } else {
@@ -1991,11 +1991,11 @@  discard block
 block discarded – undo
1991 1991
         $this->pdf->textBox($x, $y, $w1, $h, $texto, $aFont, 'B', 'L', 0, '');
1992 1992
         //FRETE POR CONTA
1993 1993
         $x += $w1;
1994
-        $w2 = $maxW*0.15;
1994
+        $w2 = $maxW * 0.15;
1995 1995
         $texto = 'FRETE';
1996 1996
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1997 1997
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
1998
-        $tipoFrete = ! empty($this->transp->getElementsByTagName("modFrete")->item(0)->nodeValue)
1998
+        $tipoFrete = !empty($this->transp->getElementsByTagName("modFrete")->item(0)->nodeValue)
1999 1999
             ? $this->transp->getElementsByTagName("modFrete")->item(0)->nodeValue
2000 2000
             : '0';
2001 2001
         switch ($tipoFrete) {
@@ -2026,7 +2026,7 @@  discard block
 block discarded – undo
2026 2026
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2027 2027
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
2028 2028
         if (isset($this->veicTransp)) {
2029
-            $texto = ! empty($this->veicTransp->getElementsByTagName("RNTC")->item(0)->nodeValue)
2029
+            $texto = !empty($this->veicTransp->getElementsByTagName("RNTC")->item(0)->nodeValue)
2030 2030
                 ? $this->veicTransp->getElementsByTagName("RNTC")->item(0)->nodeValue
2031 2031
                 : '';
2032 2032
         } else {
@@ -2040,11 +2040,11 @@  discard block
 block discarded – undo
2040 2040
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2041 2041
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
2042 2042
         if (isset($this->veicTransp)) {
2043
-            $texto = ! empty($this->veicTransp->getElementsByTagName("placa")->item(0)->nodeValue)
2043
+            $texto = !empty($this->veicTransp->getElementsByTagName("placa")->item(0)->nodeValue)
2044 2044
                 ? $this->veicTransp->getElementsByTagName("placa")->item(0)->nodeValue
2045 2045
                 : '';
2046 2046
         } elseif (isset($this->reboque)) {
2047
-            $texto = ! empty($this->reboque->getElementsByTagName("placa")->item(0)->nodeValue)
2047
+            $texto = !empty($this->reboque->getElementsByTagName("placa")->item(0)->nodeValue)
2048 2048
                 ? $this->reboque->getElementsByTagName("placa")->item(0)->nodeValue
2049 2049
                 : '';
2050 2050
         } else {
@@ -2054,16 +2054,16 @@  discard block
 block discarded – undo
2054 2054
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'B', 'C', 0, '');
2055 2055
         //UF
2056 2056
         $x += $w2;
2057
-        $w3 = round($maxW*0.04, 0);
2057
+        $w3 = round($maxW * 0.04, 0);
2058 2058
         $texto = 'UF';
2059 2059
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2060 2060
         $this->pdf->textBox($x, $y, $w3, $h, $texto, $aFont, 'T', 'L', 1, '');
2061 2061
         if (isset($this->veicTransp)) {
2062
-            $texto = ! empty($this->veicTransp->getElementsByTagName("UF")->item(0)->nodeValue)
2062
+            $texto = !empty($this->veicTransp->getElementsByTagName("UF")->item(0)->nodeValue)
2063 2063
                 ? $this->veicTransp->getElementsByTagName("UF")->item(0)->nodeValue
2064 2064
                 : '';
2065 2065
         } elseif (isset($this->reboque)) {
2066
-            $texto = ! empty($this->reboque->getElementsByTagName("UF")->item(0)->nodeValue)
2066
+            $texto = !empty($this->reboque->getElementsByTagName("UF")->item(0)->nodeValue)
2067 2067
                 ? $this->reboque->getElementsByTagName("UF")->item(0)->nodeValue
2068 2068
                 : '';
2069 2069
         } else {
@@ -2073,19 +2073,19 @@  discard block
 block discarded – undo
2073 2073
         $this->pdf->textBox($x, $y, $w3, $h, $texto, $aFont, 'B', 'C', 0, '');
2074 2074
         //CNPJ / CPF
2075 2075
         $x += $w3;
2076
-        $w = $maxW-($w1+3*$w2+$w3);
2076
+        $w = $maxW - ($w1 + 3 * $w2 + $w3);
2077 2077
         $texto = 'CNPJ / CPF';
2078 2078
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2079 2079
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
2080 2080
         if (isset($this->transporta)) {
2081
-            $texto = ! empty($this->transporta->getElementsByTagName("CNPJ")->item(0)->nodeValue)
2081
+            $texto = !empty($this->transporta->getElementsByTagName("CNPJ")->item(0)->nodeValue)
2082 2082
                 ? $this->formatField(
2083 2083
                     $this->transporta->getElementsByTagName("CNPJ")->item(0)->nodeValue,
2084 2084
                     "##.###.###/####-##"
2085 2085
                 )
2086 2086
                 : '';
2087 2087
             if ($texto == '') {
2088
-                $texto = ! empty($this->transporta->getElementsByTagName("CPF")->item(0)->nodeValue)
2088
+                $texto = !empty($this->transporta->getElementsByTagName("CPF")->item(0)->nodeValue)
2089 2089
                     ? $this->formatField(
2090 2090
                         $this->transporta->getElementsByTagName("CPF")->item(0)->nodeValue,
2091 2091
                         "###.###.###-##"
@@ -2102,12 +2102,12 @@  discard block
 block discarded – undo
2102 2102
         $y += $h;
2103 2103
         $x = $oldX;
2104 2104
         $h = 7;
2105
-        $w1 = $maxW*0.44;
2105
+        $w1 = $maxW * 0.44;
2106 2106
         $texto = 'ENDEREÇO';
2107 2107
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2108 2108
         $this->pdf->textBox($x, $y, $w1, $h, $texto, $aFont, 'T', 'L', 1, '');
2109 2109
         if (isset($this->transporta)) {
2110
-            $texto = ! empty($this->transporta->getElementsByTagName("xEnder")->item(0)->nodeValue)
2110
+            $texto = !empty($this->transporta->getElementsByTagName("xEnder")->item(0)->nodeValue)
2111 2111
                 ? $this->transporta->getElementsByTagName("xEnder")->item(0)->nodeValue
2112 2112
                 : '';
2113 2113
         } else {
@@ -2117,12 +2117,12 @@  discard block
 block discarded – undo
2117 2117
         $this->pdf->textBox($x, $y, $w1, $h, $texto, $aFont, 'B', 'L', 0, '');
2118 2118
         //MUNICÍPIO
2119 2119
         $x += $w1;
2120
-        $w2 = round($maxW*0.30, 0);
2120
+        $w2 = round($maxW * 0.30, 0);
2121 2121
         $texto = 'MUNICÍPIO';
2122 2122
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2123 2123
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
2124 2124
         if (isset($this->transporta)) {
2125
-            $texto = ! empty($this->transporta->getElementsByTagName("xMun")->item(0)->nodeValue)
2125
+            $texto = !empty($this->transporta->getElementsByTagName("xMun")->item(0)->nodeValue)
2126 2126
                 ? $this->transporta->getElementsByTagName("xMun")->item(0)->nodeValue
2127 2127
                 : '';
2128 2128
         } else {
@@ -2132,12 +2132,12 @@  discard block
 block discarded – undo
2132 2132
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'B', 'C', 0, '');
2133 2133
         //UF
2134 2134
         $x += $w2;
2135
-        $w3 = round($maxW*0.04, 0);
2135
+        $w3 = round($maxW * 0.04, 0);
2136 2136
         $texto = 'UF';
2137 2137
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2138 2138
         $this->pdf->textBox($x, $y, $w3, $h, $texto, $aFont, 'T', 'L', 1, '');
2139 2139
         if (isset($this->transporta)) {
2140
-            $texto = ! empty($this->transporta->getElementsByTagName("UF")->item(0)->nodeValue)
2140
+            $texto = !empty($this->transporta->getElementsByTagName("UF")->item(0)->nodeValue)
2141 2141
                 ? $this->transporta->getElementsByTagName("UF")->item(0)->nodeValue
2142 2142
                 : '';
2143 2143
         } else {
@@ -2147,13 +2147,13 @@  discard block
 block discarded – undo
2147 2147
         $this->pdf->textBox($x, $y, $w3, $h, $texto, $aFont, 'B', 'C', 0, '');
2148 2148
         //INSCRIÇÃO ESTADUAL
2149 2149
         $x += $w3;
2150
-        $w = $maxW-($w1+$w2+$w3);
2150
+        $w = $maxW - ($w1 + $w2 + $w3);
2151 2151
         $texto = 'INSCRIÇÃO ESTADUAL';
2152 2152
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2153 2153
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
2154 2154
         $texto = '';
2155 2155
         if (isset($this->transporta)) {
2156
-            if (! empty($this->transporta->getElementsByTagName("IE")->item(0)->nodeValue)) {
2156
+            if (!empty($this->transporta->getElementsByTagName("IE")->item(0)->nodeValue)) {
2157 2157
                 $texto = $this->transporta->getElementsByTagName("IE")->item(0)->nodeValue;
2158 2158
             }
2159 2159
         }
@@ -2166,16 +2166,16 @@  discard block
 block discarded – undo
2166 2166
         $marca = '';
2167 2167
         $numero = '';
2168 2168
         $texto = '';
2169
-        $pesoBruto=0;
2170
-        $pesoLiquido=0;
2169
+        $pesoBruto = 0;
2170
+        $pesoLiquido = 0;
2171 2171
         foreach ($volumes as $volume) {
2172
-            $quantidade += ! empty($volume->getElementsByTagName("qVol")->item(0)->nodeValue) ?
2172
+            $quantidade += !empty($volume->getElementsByTagName("qVol")->item(0)->nodeValue) ?
2173 2173
                     $volume->getElementsByTagName("qVol")->item(0)->nodeValue : 0;
2174
-            $pesoBruto += ! empty($volume->getElementsByTagName("pesoB")->item(0)->nodeValue) ?
2174
+            $pesoBruto += !empty($volume->getElementsByTagName("pesoB")->item(0)->nodeValue) ?
2175 2175
                     $volume->getElementsByTagName("pesoB")->item(0)->nodeValue : 0;
2176
-            $pesoLiquido += ! empty($volume->getElementsByTagName("pesoL")->item(0)->nodeValue) ?
2176
+            $pesoLiquido += !empty($volume->getElementsByTagName("pesoL")->item(0)->nodeValue) ?
2177 2177
                     $volume->getElementsByTagName("pesoL")->item(0)->nodeValue : 0;
2178
-            $texto = ! empty($this->transp->getElementsByTagName("esp")->item(0)->nodeValue) ?
2178
+            $texto = !empty($this->transp->getElementsByTagName("esp")->item(0)->nodeValue) ?
2179 2179
                     $this->transp->getElementsByTagName("esp")->item(0)->nodeValue : '';
2180 2180
             if ($texto != $especie && $especie != '') {
2181 2181
                 //tem várias especies
@@ -2183,7 +2183,7 @@  discard block
 block discarded – undo
2183 2183
             } else {
2184 2184
                 $especie = $texto;
2185 2185
             }
2186
-            $texto = ! empty($this->transp->getElementsByTagName("marca")->item(0)->nodeValue)
2186
+            $texto = !empty($this->transp->getElementsByTagName("marca")->item(0)->nodeValue)
2187 2187
                 ? $this->transp->getElementsByTagName("marca")->item(0)->nodeValue
2188 2188
                 : '';
2189 2189
             if ($texto != $marca && $marca != '') {
@@ -2192,7 +2192,7 @@  discard block
 block discarded – undo
2192 2192
             } else {
2193 2193
                 $marca = $texto;
2194 2194
             }
2195
-            $texto = ! empty($this->transp->getElementsByTagName("nVol")->item(0)->nodeValue)
2195
+            $texto = !empty($this->transp->getElementsByTagName("nVol")->item(0)->nodeValue)
2196 2196
                 ? $this->transp->getElementsByTagName("nVol")->item(0)->nodeValue
2197 2197
                 : '';
2198 2198
             if ($texto != $numero && $numero != '') {
@@ -2208,7 +2208,7 @@  discard block
 block discarded – undo
2208 2208
         $y += $h;
2209 2209
         $x = $oldX;
2210 2210
         $h = 7;
2211
-        $w1 = round($maxW*0.10, 0);
2211
+        $w1 = round($maxW * 0.10, 0);
2212 2212
         $texto = 'QUANTIDADE';
2213 2213
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2214 2214
         $this->pdf->textBox($x, $y, $w1, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -2219,7 +2219,7 @@  discard block
 block discarded – undo
2219 2219
         }
2220 2220
         //ESPÉCIE
2221 2221
         $x += $w1;
2222
-        $w2 = round($maxW*0.17, 0);
2222
+        $w2 = round($maxW * 0.17, 0);
2223 2223
         $texto = 'ESPÉCIE';
2224 2224
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2225 2225
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -2231,7 +2231,7 @@  discard block
 block discarded – undo
2231 2231
         $texto = 'MARCA';
2232 2232
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2233 2233
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
2234
-        $texto = ! empty($this->transp->getElementsByTagName("marca")->item(0)->nodeValue) ?
2234
+        $texto = !empty($this->transp->getElementsByTagName("marca")->item(0)->nodeValue) ?
2235 2235
                 $this->transp->getElementsByTagName("marca")->item(0)->nodeValue : '';
2236 2236
         $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'];
2237 2237
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'B', 'C', 0, '');
@@ -2245,7 +2245,7 @@  discard block
 block discarded – undo
2245 2245
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'B', 'C', 0, '');
2246 2246
         //PESO BRUTO
2247 2247
         $x += $w2;
2248
-        $w3 = round($maxW*0.20, 0);
2248
+        $w3 = round($maxW * 0.20, 0);
2249 2249
         $texto = 'PESO BRUTO';
2250 2250
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2251 2251
         $this->pdf->textBox($x, $y, $w3, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -2258,7 +2258,7 @@  discard block
 block discarded – undo
2258 2258
         $this->pdf->textBox($x, $y, $w3, $h, $texto, $aFont, 'B', 'R', 0, '');
2259 2259
         //PESO LÍQUIDO
2260 2260
         $x += $w3;
2261
-        $w = $maxW -($w1+3*$w2+$w3);
2261
+        $w = $maxW - ($w1 + 3 * $w2 + $w3);
2262 2262
         $texto = 'PESO LÍQUIDO';
2263 2263
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2264 2264
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -2269,7 +2269,7 @@  discard block
 block discarded – undo
2269 2269
         }
2270 2270
         $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'];
2271 2271
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'R', 0, '');
2272
-        return ($y+$h);
2272
+        return ($y + $h);
2273 2273
     } //fim transporte
2274 2274
 
2275 2275
 
@@ -2281,7 +2281,7 @@  discard block
 block discarded – undo
2281 2281
             return "";
2282 2282
         }
2283 2283
         $valor_original = $valor_original->nodeValue;
2284
-        $valor = ! empty($valor_original) ? number_format($valor_original, 2, ",", ".") : '';
2284
+        $valor = !empty($valor_original) ? number_format($valor_original, 2, ",", ".") : '';
2285 2285
 
2286 2286
         if ($valor != "") {
2287 2287
             return sprintf($formato, $valor);
@@ -2328,18 +2328,18 @@  discard block
 block discarded – undo
2328 2328
             $impostos .= $this->descricaoProdutoHelper($ICMSUFDest, "vICMSUFDest", " vICMSUFDest=%s");
2329 2329
             $impostos .= $this->descricaoProdutoHelper($ICMSUFDest, "vICMSUFRemet", " vICMSUFRemet=%s");
2330 2330
         }
2331
-        $infAdProd = ! empty($itemProd->getElementsByTagName('infAdProd')->item(0)->nodeValue)
2331
+        $infAdProd = !empty($itemProd->getElementsByTagName('infAdProd')->item(0)->nodeValue)
2332 2332
             ? substr(
2333 2333
                 $this->anfaveaDANFE($itemProd->getElementsByTagName('infAdProd')->item(0)->nodeValue),
2334 2334
                 0,
2335 2335
                 500
2336 2336
             )
2337 2337
             : '';
2338
-        if (! empty($infAdProd)) {
2338
+        if (!empty($infAdProd)) {
2339 2339
             $infAdProd = trim($infAdProd);
2340 2340
             $infAdProd .= ' ';
2341 2341
         }
2342
-        $loteTxt ='';
2342
+        $loteTxt = '';
2343 2343
         $rastro = $prod->getElementsByTagName("med");
2344 2344
         if (!empty($prod->getElementsByTagName("rastro"))) {
2345 2345
             $rastro = $prod->getElementsByTagName("rastro");
@@ -2353,15 +2353,15 @@  discard block
 block discarded – undo
2353 2353
                 $i++;
2354 2354
             }
2355 2355
             if ($loteTxt != '') {
2356
-                $loteTxt.= ' ';
2356
+                $loteTxt .= ' ';
2357 2357
             }
2358 2358
         }
2359 2359
         //NT2013.006 FCI
2360
-        $nFCI = (! empty($itemProd->getElementsByTagName('nFCI')->item(0)->nodeValue)) ?
2361
-                ' FCI:'.$itemProd->getElementsByTagName('nFCI')->item(0)->nodeValue : '';
2362
-        $tmp_ad=$infAdProd . ($this->descProdInfoComplemento ? $loteTxt . $impostos . $nFCI : '');
2360
+        $nFCI = (!empty($itemProd->getElementsByTagName('nFCI')->item(0)->nodeValue)) ?
2361
+                ' FCI:' . $itemProd->getElementsByTagName('nFCI')->item(0)->nodeValue : '';
2362
+        $tmp_ad = $infAdProd . ($this->descProdInfoComplemento ? $loteTxt . $impostos . $nFCI : '');
2363 2363
         $texto = $prod->getElementsByTagName("xProd")->item(0)->nodeValue
2364
-            . (strlen($tmp_ad)!=0?"\n    ".$tmp_ad:'');
2364
+            . (strlen($tmp_ad) != 0 ? "\n    " . $tmp_ad : '');
2365 2365
         //decodifica os caracteres html no xml
2366 2366
         $texto = html_entity_decode($texto);
2367 2367
         if ($this->descProdQuebraLinha) {
@@ -2411,104 +2411,104 @@  discard block
 block discarded – undo
2411 2411
         // cabecalho LOOP COM OS DADOS DOS PRODUTOS
2412 2412
         //CÓDIGO PRODUTO
2413 2413
         $texto = "CÓDIGO PRODUTO";
2414
-        $w1 = round($w*0.09, 0);
2414
+        $w1 = round($w * 0.09, 0);
2415 2415
         $h = 4;
2416 2416
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2417 2417
         $this->pdf->textBox($x, $y, $w1, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2418
-        $this->pdf->line($x+$w1, $y, $x+$w1, $y+$hmax);
2418
+        $this->pdf->line($x + $w1, $y, $x + $w1, $y + $hmax);
2419 2419
         //DESCRIÇÃO DO PRODUTO / SERVIÇO
2420 2420
         $x += $w1;
2421
-        $w2 = round($w*0.28, 0);
2421
+        $w2 = round($w * 0.28, 0);
2422 2422
         $texto = 'DESCRIÇÃO DO PRODUTO / SERVIÇO';
2423 2423
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2424 2424
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2425
-        $this->pdf->line($x+$w2, $y, $x+$w2, $y+$hmax);
2425
+        $this->pdf->line($x + $w2, $y, $x + $w2, $y + $hmax);
2426 2426
         //NCM/SH
2427 2427
         $x += $w2;
2428
-        $w3 = round($w*0.06, 0);
2428
+        $w3 = round($w * 0.06, 0);
2429 2429
         $texto = 'NCM/SH';
2430 2430
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2431 2431
         $this->pdf->textBox($x, $y, $w3, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2432
-        $this->pdf->line($x+$w3, $y, $x+$w3, $y+$hmax);
2432
+        $this->pdf->line($x + $w3, $y, $x + $w3, $y + $hmax);
2433 2433
         //O/CST ou O/CSOSN
2434 2434
         $x += $w3;
2435
-        $w4 = round($w*0.05, 0);
2436
-        $texto = 'O/CSOSN';//Regime do Simples CRT = 1 ou CRT = 2
2435
+        $w4 = round($w * 0.05, 0);
2436
+        $texto = 'O/CSOSN'; //Regime do Simples CRT = 1 ou CRT = 2
2437 2437
         if ($this->getTagValue($this->emit, 'CRT') == '3') {
2438
-             $texto = 'O/CST';//Regime Normal
2438
+             $texto = 'O/CST'; //Regime Normal
2439 2439
         }
2440 2440
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2441 2441
         $this->pdf->textBox($x, $y, $w4, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2442
-        $this->pdf->line($x+$w4, $y, $x+$w4, $y+$hmax);
2442
+        $this->pdf->line($x + $w4, $y, $x + $w4, $y + $hmax);
2443 2443
         //CFOP
2444 2444
         $x += $w4;
2445
-        $w5 = round($w*0.04, 0);
2445
+        $w5 = round($w * 0.04, 0);
2446 2446
         $texto = 'CFOP';
2447 2447
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2448 2448
         $this->pdf->textBox($x, $y, $w5, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2449
-        $this->pdf->line($x+$w5, $y, $x+$w5, $y+$hmax);
2449
+        $this->pdf->line($x + $w5, $y, $x + $w5, $y + $hmax);
2450 2450
         //UN
2451 2451
         $x += $w5;
2452
-        $w6 = round($w*0.03, 0);
2452
+        $w6 = round($w * 0.03, 0);
2453 2453
         $texto = 'UN';
2454 2454
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2455 2455
         $this->pdf->textBox($x, $y, $w6, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2456
-        $this->pdf->line($x+$w6, $y, $x+$w6, $y+$hmax);
2456
+        $this->pdf->line($x + $w6, $y, $x + $w6, $y + $hmax);
2457 2457
         //QUANT
2458 2458
         $x += $w6;
2459
-        $w7 = round($w*0.07, 0);
2459
+        $w7 = round($w * 0.07, 0);
2460 2460
         $texto = 'QUANT';
2461 2461
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2462 2462
         $this->pdf->textBox($x, $y, $w7, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2463
-        $this->pdf->line($x+$w7, $y, $x+$w7, $y+$hmax);
2463
+        $this->pdf->line($x + $w7, $y, $x + $w7, $y + $hmax);
2464 2464
         //VALOR UNIT
2465 2465
         $x += $w7;
2466
-        $w8 = round($w*0.06, 0);
2466
+        $w8 = round($w * 0.06, 0);
2467 2467
         $texto = 'VALOR UNIT';
2468 2468
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2469 2469
         $this->pdf->textBox($x, $y, $w8, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2470
-        $this->pdf->line($x+$w8, $y, $x+$w8, $y+$hmax);
2470
+        $this->pdf->line($x + $w8, $y, $x + $w8, $y + $hmax);
2471 2471
         //VALOR TOTAL
2472 2472
         $x += $w8;
2473
-        $w9 = round($w*0.06, 0);
2473
+        $w9 = round($w * 0.06, 0);
2474 2474
         $texto = 'VALOR TOTAL';
2475 2475
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2476 2476
         $this->pdf->textBox($x, $y, $w9, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2477
-        $this->pdf->line($x+$w9, $y, $x+$w9, $y+$hmax);
2477
+        $this->pdf->line($x + $w9, $y, $x + $w9, $y + $hmax);
2478 2478
         //B.CÁLC ICMS
2479 2479
         $x += $w9;
2480
-        $w10 = round($w*0.06, 0);
2480
+        $w10 = round($w * 0.06, 0);
2481 2481
         $texto = 'B.CÁLC ICMS';
2482 2482
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2483 2483
         $this->pdf->textBox($x, $y, $w10, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2484
-        $this->pdf->line($x+$w10, $y, $x+$w10, $y+$hmax);
2484
+        $this->pdf->line($x + $w10, $y, $x + $w10, $y + $hmax);
2485 2485
         //VALOR ICMS
2486 2486
         $x += $w10;
2487
-        $w11 = round($w*0.06, 0);
2487
+        $w11 = round($w * 0.06, 0);
2488 2488
         $texto = 'VALOR ICMS';
2489 2489
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2490 2490
         $this->pdf->textBox($x, $y, $w11, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2491
-        $this->pdf->line($x+$w11, $y, $x+$w11, $y+$hmax);
2491
+        $this->pdf->line($x + $w11, $y, $x + $w11, $y + $hmax);
2492 2492
         //VALOR IPI
2493 2493
         $x += $w11;
2494
-        $w12 = round($w*0.05, 0);
2494
+        $w12 = round($w * 0.05, 0);
2495 2495
         $texto = 'VALOR IPI';
2496 2496
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2497 2497
         $this->pdf->textBox($x, $y, $w12, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2498
-        $this->pdf->line($x+$w12, $y, $x+$w12, $y+$hmax);
2498
+        $this->pdf->line($x + $w12, $y, $x + $w12, $y + $hmax);
2499 2499
         //ALÍQ. ICMS
2500 2500
         $x += $w12;
2501
-        $w13 = round($w*0.035, 0);
2501
+        $w13 = round($w * 0.035, 0);
2502 2502
         $texto = 'ALÍQ. ICMS';
2503 2503
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2504 2504
         $this->pdf->textBox($x, $y, $w13, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2505
-        $this->pdf->line($x+$w13, $y, $x+$w13, $y+$hmax);
2505
+        $this->pdf->line($x + $w13, $y, $x + $w13, $y + $hmax);
2506 2506
         //ALÍQ. IPI
2507 2507
         $x += $w13;
2508
-        $w14 = $w-($w1+$w2+$w3+$w4+$w5+$w6+$w7+$w8+$w9+$w10+$w11+$w12+$w13);
2508
+        $w14 = $w - ($w1 + $w2 + $w3 + $w4 + $w5 + $w6 + $w7 + $w8 + $w9 + $w10 + $w11 + $w12 + $w13);
2509 2509
         $texto = 'ALÍQ. IPI';
2510 2510
         $this->pdf->textBox($x, $y, $w14, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2511
-        $this->pdf->line($oldX, $y+$h+1, $oldX + $w, $y+$h+1);
2511
+        $this->pdf->line($oldX, $y + $h + 1, $oldX + $w, $y + $h + 1);
2512 2512
         $y += 5;
2513 2513
         //##################################################################################
2514 2514
         // LOOP COM OS DADOS DOS PRODUTOS
@@ -2526,7 +2526,7 @@  discard block
 block discarded – undo
2526 2526
                 $textoProduto = trim($this->descricaoProduto($thisItem));
2527 2527
 
2528 2528
                 $linhaDescr = $this->pdf->getNumLines($textoProduto, $w2, $aFont);
2529
-                $h = round(($linhaDescr * $this->pdf->fontSize)+ ($linhaDescr * 0.5), 2);
2529
+                $h = round(($linhaDescr * $this->pdf->fontSize) + ($linhaDescr * 0.5), 2);
2530 2530
                 $hUsado += $h;
2531 2531
 
2532 2532
                 $diffH = $hmax - $hUsado;
@@ -2539,11 +2539,11 @@  discard block
 block discarded – undo
2539 2539
                         break;
2540 2540
                     }
2541 2541
                 }
2542
-                $y_linha=$y+$h;
2542
+                $y_linha = $y + $h;
2543 2543
                 // linha entre itens
2544 2544
                 $this->pdf->dashedHLine($oldX, $y_linha, $w, 0.1, 120);
2545 2545
                 //corrige o x
2546
-                $x=$oldX;
2546
+                $x = $oldX;
2547 2547
                 //codigo do produto
2548 2548
                 $texto = $prod->getElementsByTagName("cProd")->item(0)->nodeValue;
2549 2549
                 $this->pdf->textBox($x, $y, $w1, $h, $texto, $aFont, 'T', 'C', 0, '');
@@ -2556,16 +2556,16 @@  discard block
 block discarded – undo
2556 2556
                 }
2557 2557
                 $x += $w2;
2558 2558
                 //NCM
2559
-                $texto = ! empty($prod->getElementsByTagName("NCM")->item(0)->nodeValue) ?
2559
+                $texto = !empty($prod->getElementsByTagName("NCM")->item(0)->nodeValue) ?
2560 2560
                         $prod->getElementsByTagName("NCM")->item(0)->nodeValue : '';
2561 2561
                 $this->pdf->textBox($x, $y, $w3, $h, $texto, $aFont, 'T', 'C', 0, '');
2562 2562
                 $x += $w3;
2563 2563
                 //CST
2564 2564
                 if (isset($ICMS)) {
2565
-                    $origem =  $this->getTagValue($ICMS, "orig");
2566
-                    $cst =  $this->getTagValue($ICMS, "CST");
2567
-                    $csosn =  $this->getTagValue($ICMS, "CSOSN");
2568
-                    $texto = $origem.$cst.$csosn;
2565
+                    $origem = $this->getTagValue($ICMS, "orig");
2566
+                    $cst = $this->getTagValue($ICMS, "CST");
2567
+                    $csosn = $this->getTagValue($ICMS, "CSOSN");
2568
+                    $texto = $origem . $cst . $csosn;
2569 2569
                     $this->pdf->textBox($x, $y, $w4, $h, $texto, $aFont, 'T', 'C', 0, '');
2570 2570
                 }
2571 2571
                 //CFOP
@@ -2599,7 +2599,7 @@  discard block
 block discarded – undo
2599 2599
                 //Valor da Base de calculo
2600 2600
                 $x += $w9;
2601 2601
                 if (isset($ICMS)) {
2602
-                    $texto = ! empty($ICMS->getElementsByTagName("vBC")->item(0)->nodeValue)
2602
+                    $texto = !empty($ICMS->getElementsByTagName("vBC")->item(0)->nodeValue)
2603 2603
                         ? number_format(
2604 2604
                             $ICMS->getElementsByTagName("vBC")->item(0)->nodeValue,
2605 2605
                             2,
@@ -2612,7 +2612,7 @@  discard block
 block discarded – undo
2612 2612
                 //Valor do ICMS
2613 2613
                 $x += $w10;
2614 2614
                 if (isset($ICMS)) {
2615
-                    $texto = ! empty($ICMS->getElementsByTagName("vICMS")->item(0)->nodeValue)
2615
+                    $texto = !empty($ICMS->getElementsByTagName("vICMS")->item(0)->nodeValue)
2616 2616
                         ? number_format(
2617 2617
                             $ICMS->getElementsByTagName("vICMS")->item(0)->nodeValue,
2618 2618
                             2,
@@ -2625,7 +2625,7 @@  discard block
 block discarded – undo
2625 2625
                 //Valor do IPI
2626 2626
                 $x += $w11;
2627 2627
                 if (isset($IPI)) {
2628
-                    $texto = ! empty($IPI->getElementsByTagName("vIPI")->item(0)->nodeValue)
2628
+                    $texto = !empty($IPI->getElementsByTagName("vIPI")->item(0)->nodeValue)
2629 2629
                         ? number_format(
2630 2630
                             $IPI->getElementsByTagName("vIPI")->item(0)->nodeValue,
2631 2631
                             2,
@@ -2640,7 +2640,7 @@  discard block
 block discarded – undo
2640 2640
                 // %ICMS
2641 2641
                 $x += $w12;
2642 2642
                 if (isset($ICMS)) {
2643
-                    $texto = ! empty($ICMS->getElementsByTagName("pICMS")->item(0)->nodeValue)
2643
+                    $texto = !empty($ICMS->getElementsByTagName("pICMS")->item(0)->nodeValue)
2644 2644
                         ? number_format(
2645 2645
                             $ICMS->getElementsByTagName("pICMS")->item(0)->nodeValue,
2646 2646
                             2,
@@ -2653,7 +2653,7 @@  discard block
 block discarded – undo
2653 2653
                 //%IPI
2654 2654
                 $x += $w13;
2655 2655
                 if (isset($IPI)) {
2656
-                    $texto = ! empty($IPI->getElementsByTagName("pIPI")->item(0)->nodeValue)
2656
+                    $texto = !empty($IPI->getElementsByTagName("pIPI")->item(0)->nodeValue)
2657 2657
                         ? number_format(
2658 2658
                             $IPI->getElementsByTagName("pIPI")->item(0)->nodeValue,
2659 2659
                             2,
@@ -2684,7 +2684,7 @@  discard block
 block discarded – undo
2684 2684
                 $i++;
2685 2685
             }
2686 2686
         }
2687
-        return $oldY+$hmax;
2687
+        return $oldY + $hmax;
2688 2688
     }
2689 2689
 
2690 2690
 
@@ -2718,7 +2718,7 @@  discard block
 block discarded – undo
2718 2718
 
2719 2719
         $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>''];
2720 2720
 
2721
-        $w1 = round($w*0.09, 0);
2721
+        $w1 = round($w * 0.09, 0);
2722 2722
 
2723 2723
         // Tabela Renavam Combustivel
2724 2724
         $renavamCombustivel = [
@@ -2813,54 +2813,54 @@  discard block
 block discarded – undo
2813 2813
 
2814 2814
         $yVeic = $y + $h;
2815 2815
         $texto = 'Chassi: ............: ' . $veiculoChassi;
2816
-        $this->pdf->textBox($x, $yVeic, $w1+40, $h, $texto, $aFont, 'T', 'L', 0, '');
2816
+        $this->pdf->textBox($x, $yVeic, $w1 + 40, $h, $texto, $aFont, 'T', 'L', 0, '');
2817 2817
         $yVeic += $h;
2818 2818
         $texto = 'Cor...................: ' . $veiculoCor;
2819
-        $this->pdf->textBox($x, $yVeic, $w1+40, $h, $texto, $aFont, 'T', 'L', 0, '');
2819
+        $this->pdf->textBox($x, $yVeic, $w1 + 40, $h, $texto, $aFont, 'T', 'L', 0, '');
2820 2820
         $yVeic += $h;
2821 2821
         $texto = 'Cilindrada........: ' . $veiculoCilindrada;
2822
-        $this->pdf->textBox($x, $yVeic, $w1+40, $h, $texto, $aFont, 'T', 'L', 0, '');
2822
+        $this->pdf->textBox($x, $yVeic, $w1 + 40, $h, $texto, $aFont, 'T', 'L', 0, '');
2823 2823
         $yVeic += $h;
2824 2824
         $texto = 'Cmkg...............: ' . $veiculoCmkg;
2825
-        $this->pdf->textBox($x, $yVeic, $w1+40, $h, $texto, $aFont, 'T', 'L', 0, '');
2825
+        $this->pdf->textBox($x, $yVeic, $w1 + 40, $h, $texto, $aFont, 'T', 'L', 0, '');
2826 2826
         $yVeic += $h;
2827 2827
         $texto = 'Tipo.................: ' . ($renavamTiposVeiculos[intval($veiculoTipo)] ?? $veiculoTipo);
2828
-         $this->pdf->textBox($x, $yVeic, $w1+40, $h, $texto, $aFont, 'T', 'L', 0, '');
2828
+         $this->pdf->textBox($x, $yVeic, $w1 + 40, $h, $texto, $aFont, 'T', 'L', 0, '');
2829 2829
         $yVeic = $y + $h;
2830 2830
         $xVeic = $x + 65;
2831 2831
         $texto = 'Nº Motor: .........: ' . $veiculoMotor;
2832
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
2832
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
2833 2833
         $yVeic += $h;
2834 2834
         $texto = 'Renavam...........: ' . $veiculoRenavam;
2835
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
2835
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
2836 2836
         $yVeic += $h;
2837 2837
         $texto = 'HP.....................: ' . $veiculoHp;
2838
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
2838
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
2839 2839
         $yVeic += $h;
2840 2840
         $texto = 'Placa.................: ' . $veiculoPlaca;
2841
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
2841
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
2842 2842
         $yVeic += $h;
2843 2843
         $texto = 'Tipo Pintura......: ' . ($renavamEspecie[intval($veiculoTipoPintura)] ?? $veiculoTipoPintura);
2844
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
2844
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
2845 2845
         $yVeic = $y + $h;
2846 2846
         $xVeic = $xVeic + 55;
2847 2847
         $texto = 'Marca / Modelo.....: ' . $veiculoMarcaModelo;
2848
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
2848
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
2849 2849
         $yVeic += $h;
2850 2850
         $texto = 'Especie..................: ' . ($renavamEspecie[intval($veiculoEspecie)] ?? $veiculoEspecie);
2851
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
2851
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
2852 2852
         $yVeic += $h;
2853 2853
         $texto = 'Combustivel..........: ' . ($renavamCombustivel[intval($veiculoCombustivel)] ?? $veiculoCombustivel);
2854
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
2854
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
2855 2855
         $yVeic += $h;
2856 2856
         $texto = 'Serial.....................: ' . $veiculoSerial;
2857
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
2857
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
2858 2858
         $yVeic += $h;
2859
-        $texto = 'Ano Fab/Mod........: '. $veiculoFabricacao . '/' . $veiculoModelo;
2860
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
2859
+        $texto = 'Ano Fab/Mod........: ' . $veiculoFabricacao . '/' . $veiculoModelo;
2860
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
2861 2861
         $yVeic += $h;
2862
-        $texto = 'Distancia Entre Eixos(mm)..: '. $veiculoDistancia;
2863
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
2862
+        $texto = 'Distancia Entre Eixos(mm)..: ' . $veiculoDistancia;
2863
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
2864 2864
     }
2865 2865
 
2866 2866
     /**
@@ -2884,12 +2884,12 @@  discard block
 block discarded – undo
2884 2884
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
2885 2885
         //INSCRIÇÃO MUNICIPAL
2886 2886
         $y += 3;
2887
-        $w = round($this->wPrint*0.23, 0);
2887
+        $w = round($this->wPrint * 0.23, 0);
2888 2888
         $texto = 'INSCRIÇÃO MUNICIPAL';
2889 2889
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2890 2890
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
2891 2891
         //inscrição municipal
2892
-        $texto = ! empty($this->emit->getElementsByTagName("IM")->item(0)->nodeValue) ?
2892
+        $texto = !empty($this->emit->getElementsByTagName("IM")->item(0)->nodeValue) ?
2893 2893
                 $this->emit->getElementsByTagName("IM")->item(0)->nodeValue : '';
2894 2894
         $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'];
2895 2895
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 0, '');
@@ -2899,7 +2899,7 @@  discard block
 block discarded – undo
2899 2899
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2900 2900
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
2901 2901
         if (isset($this->ISSQNtot)) {
2902
-            $texto = ! empty($this->ISSQNtot->getElementsByTagName("vServ")->item(0)->nodeValue) ?
2902
+            $texto = !empty($this->ISSQNtot->getElementsByTagName("vServ")->item(0)->nodeValue) ?
2903 2903
                     $this->ISSQNtot->getElementsByTagName("vServ")->item(0)->nodeValue : '';
2904 2904
             $texto = number_format($texto, 2, ",", ".");
2905 2905
         } else {
@@ -2913,9 +2913,9 @@  discard block
 block discarded – undo
2913 2913
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2914 2914
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
2915 2915
         if (isset($this->ISSQNtot)) {
2916
-            $texto = ! empty($this->ISSQNtot->getElementsByTagName("vBC")->item(0)->nodeValue) ?
2916
+            $texto = !empty($this->ISSQNtot->getElementsByTagName("vBC")->item(0)->nodeValue) ?
2917 2917
                     $this->ISSQNtot->getElementsByTagName("vBC")->item(0)->nodeValue : '';
2918
-            $texto = ! empty($texto) ? number_format($texto, 2, ",", ".") : '';
2918
+            $texto = !empty($texto) ? number_format($texto, 2, ",", ".") : '';
2919 2919
         } else {
2920 2920
             $texto = '';
2921 2921
         }
@@ -2926,21 +2926,21 @@  discard block
 block discarded – undo
2926 2926
         if ($this->orientacao == 'P') {
2927 2927
             $w = $this->wPrint - (3 * $w);
2928 2928
         } else {
2929
-            $w = $this->wPrint - (3 * $w)-$this->wCanhoto;
2929
+            $w = $this->wPrint - (3 * $w) - $this->wCanhoto;
2930 2930
         }
2931 2931
         $texto = 'VALOR TOTAL DO ISSQN';
2932 2932
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2933 2933
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
2934 2934
         if (isset($this->ISSQNtot)) {
2935
-            $texto = ! empty($this->ISSQNtot->getElementsByTagName("vISS")->item(0)->nodeValue) ?
2935
+            $texto = !empty($this->ISSQNtot->getElementsByTagName("vISS")->item(0)->nodeValue) ?
2936 2936
                     $this->ISSQNtot->getElementsByTagName("vISS")->item(0)->nodeValue : '';
2937
-            $texto = ! empty($texto) ? number_format($texto, 2, ",", ".") : '';
2937
+            $texto = !empty($texto) ? number_format($texto, 2, ",", ".") : '';
2938 2938
         } else {
2939 2939
             $texto = '';
2940 2940
         }
2941 2941
         $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'];
2942 2942
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'R', 0, '');
2943
-        return ($y+$h+1);
2943
+        return ($y + $h + 1);
2944 2944
     }
2945 2945
 
2946 2946
     /**
@@ -2961,7 +2961,7 @@  discard block
 block discarded – undo
2961 2961
         if ($this->orientacao == 'P') {
2962 2962
               $w = $this->wPrint;
2963 2963
         } else {
2964
-              $w = $this->wPrint-$this->wCanhoto;
2964
+              $w = $this->wPrint - $this->wCanhoto;
2965 2965
         }
2966 2966
         $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
2967 2967
         $this->pdf->textBox($x, $y, $w, 8, $texto, $aFont, 'T', 'L', 0, '');
@@ -2977,15 +2977,15 @@  discard block
 block discarded – undo
2977 2977
         //$this->textoAdic com o texto completo do campo
2978 2978
         $y += 1;
2979 2979
         $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>''];
2980
-        $this->pdf->textBox($x, $y+2, $w-2, $h-3, $this->textoAdic, $aFont, 'T', 'L', 0, '', false);
2980
+        $this->pdf->textBox($x, $y + 2, $w - 2, $h - 3, $this->textoAdic, $aFont, 'T', 'L', 0, '', false);
2981 2981
         //RESERVADO AO FISCO
2982 2982
         $texto = "RESERVADO AO FISCO";
2983 2983
         $x += $w;
2984 2984
         $y -= 1;
2985 2985
         if ($this->orientacao == 'P') {
2986
-            $w = $this->wPrint-$w;
2986
+            $w = $this->wPrint - $w;
2987 2987
         } else {
2988
-            $w = $this->wPrint-$w-$this->wCanhoto;
2988
+            $w = $this->wPrint - $w - $this->wCanhoto;
2989 2989
         }
2990 2990
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>'B'];
2991 2991
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -3024,8 +3024,8 @@  discard block
 block discarded – undo
3024 3024
         }
3025 3025
         $y += 2;
3026 3026
         $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>''];
3027
-        $this->pdf->textBox($x, $y, $w-2, $h-3, $texto, $aFont, 'T', 'L', 0, '', false);
3028
-        return $y+$h;
3027
+        $this->pdf->textBox($x, $y, $w - 2, $h - 3, $texto, $aFont, 'T', 'L', 0, '', false);
3028
+        return $y + $h;
3029 3029
     }
3030 3030
 
3031 3031
     /**
@@ -3044,11 +3044,11 @@  discard block
 block discarded – undo
3044 3044
         if ($this->orientacao == 'P') {
3045 3045
               $w = $this->wPrint;
3046 3046
         } else {
3047
-              $w = $this->wPrint-$this->wCanhoto;
3047
+              $w = $this->wPrint - $this->wCanhoto;
3048 3048
               $x = $this->wCanhoto;
3049 3049
         }
3050 3050
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>'I'];
3051
-        $texto = "Impresso em ". date('d/m/Y') . " as " . date('H:i:s')
3051
+        $texto = "Impresso em " . date('d/m/Y') . " as " . date('H:i:s')
3052 3052
             . '  ' . $this->creditos;
3053 3053
         $this->pdf->textBox($x, $y, $w, 0, $texto, $aFont, 'T', 'L', false);
3054 3054
         $texto = "Powered by NFePHP®";
@@ -3104,9 +3104,9 @@  discard block
 block discarded – undo
3104 3104
         } else {
3105 3105
             //linha separadora do canhoto - 238
3106 3106
             //posicao altura
3107
-            $y = $this->wPrint-85;
3107
+            $y = $this->wPrint - 85;
3108 3108
             //altura
3109
-            $w = $this->wPrint-85-24;
3109
+            $w = $this->wPrint - 85 - 24;
3110 3110
         }
3111 3111
         $h = 10;
3112 3112
         //desenha caixa
@@ -3129,21 +3129,21 @@  discard block
 block discarded – undo
3129 3129
             $texto .= "AO LADO";
3130 3130
         }
3131 3131
         $texto .= ". EMISSÃO: ";
3132
-        $dEmi = ! empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
3132
+        $dEmi = !empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
3133 3133
                 $this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue : '';
3134 3134
         if ($dEmi == '') {
3135
-            $dEmi = ! empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
3135
+            $dEmi = !empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
3136 3136
                     $this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue : '';
3137 3137
             $aDemi = explode('T', $dEmi);
3138 3138
             $dEmi = $aDemi[0];
3139 3139
         }
3140
-        $texto .= $this->ymdTodmy($dEmi) ." ";
3140
+        $texto .= $this->ymdTodmy($dEmi) . " ";
3141 3141
         $texto .= "VALOR TOTAL: R$ ";
3142 3142
         $texto .= number_format($this->ICMSTot->getElementsByTagName("vNF")->item(0)->nodeValue, 2, ",", ".") . " ";
3143 3143
         $texto .= "DESTINATÁRIO: ";
3144 3144
         $texto .= $destinatario;
3145 3145
         if ($this->orientacao == 'P') {
3146
-            $this->pdf->textBox($x, $y, $w-1, $h, $texto, $aFont, 'C', 'L', 0, '', false);
3146
+            $this->pdf->textBox($x, $y, $w - 1, $h, $texto, $aFont, 'C', 'L', 0, '', false);
3147 3147
             $x1 = $x + $w;
3148 3148
             $w1 = $this->wPrint - $w;
3149 3149
             $texto = "NF-e";
@@ -3156,12 +3156,12 @@  discard block
 block discarded – undo
3156 3156
             //DATA DE RECEBIMENTO
3157 3157
             $texto = "DATA DE RECEBIMENTO";
3158 3158
             $y += $h;
3159
-            $w2 = round($this->wPrint*0.17, 0); //35;
3159
+            $w2 = round($this->wPrint * 0.17, 0); //35;
3160 3160
             $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
3161 3161
             $this->pdf->textBox($x, $y, $w2, 8, $texto, $aFont, 'T', 'L', 1, '');
3162 3162
             //IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR
3163 3163
             $x += $w2;
3164
-            $w3 = $w-$w2;
3164
+            $w3 = $w - $w2;
3165 3165
             $texto = "IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR";
3166 3166
             $this->pdf->textBox($x, $y, $w3, 8, $texto, $aFont, 'T', 'L', 1, '');
3167 3167
             $x = $oldX;
@@ -3171,7 +3171,7 @@  discard block
 block discarded – undo
3171 3171
             return $y;
3172 3172
         } else {
3173 3173
             $x--;
3174
-            $x = $this->pdf->textBox90($x, $y, $w-1, $h, $texto, $aFontSmall, 'C', 'L', 0, '', false);
3174
+            $x = $this->pdf->textBox90($x, $y, $w - 1, $h, $texto, $aFontSmall, 'C', 'L', 0, '', false);
3175 3175
             //NUMERO DA NOTA FISCAL LOGO NFE
3176 3176
             $w1 = 18;
3177 3177
             $x1 = $oldX;
@@ -3185,14 +3185,14 @@  discard block
 block discarded – undo
3185 3185
             $this->pdf->textBox($x1, $y, $w1, 18, $texto, $aFont, 'C', 'C', 1, '');
3186 3186
             //DATA DO RECEBIMENTO
3187 3187
             $texto = "DATA DO RECEBIMENTO";
3188
-            $y = $this->wPrint-85;
3188
+            $y = $this->wPrint - 85;
3189 3189
             $x = 12;
3190
-            $w2 = round($this->wPrint*0.17, 0); //35;
3190
+            $w2 = round($this->wPrint * 0.17, 0); //35;
3191 3191
             $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
3192 3192
             $this->pdf->textBox90($x, $y, $w2, 8, $texto, $aFont, 'T', 'L', 1, '');
3193 3193
             //IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR
3194 3194
             $y -= $w2;
3195
-            $w3 = $w-$w2;
3195
+            $w3 = $w - $w2;
3196 3196
             $texto = "IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR";
3197 3197
             $aFont = ['font'=>$this->fontePadrao, 'size'=>5.7, 'style'=>''];
3198 3198
             $x = $this->pdf->textBox90($x, $y, $w3, 8, $texto, $aFont, 'T', 'L', 1, '');
@@ -3213,13 +3213,13 @@  discard block
 block discarded – undo
3213 3213
     {
3214 3214
         $saida = "";
3215 3215
         if (isset($this->compra)) {
3216
-            if (! empty($this->compra->getElementsByTagName("xNEmp")->item(0)->nodeValue)) {
3216
+            if (!empty($this->compra->getElementsByTagName("xNEmp")->item(0)->nodeValue)) {
3217 3217
                 $saida .= " Nota de Empenho: " . $this->compra->getElementsByTagName("xNEmp")->item(0)->nodeValue;
3218 3218
             }
3219
-            if (! empty($this->compra->getElementsByTagName("xPed")->item(0)->nodeValue)) {
3219
+            if (!empty($this->compra->getElementsByTagName("xPed")->item(0)->nodeValue)) {
3220 3220
                 $saida .= " Pedido: " . $this->compra->getElementsByTagName("xPed")->item(0)->nodeValue;
3221 3221
             }
3222
-            if (! empty($this->compra->getElementsByTagName("xCont")->item(0)->nodeValue)) {
3222
+            if (!empty($this->compra->getElementsByTagName("xCont")->item(0)->nodeValue)) {
3223 3223
                 $saida .= " Contrato: " . $this->compra->getElementsByTagName("xCont")->item(0)->nodeValue;
3224 3224
             }
3225 3225
         }
@@ -3245,21 +3245,21 @@  discard block
 block discarded – undo
3245 3245
         if ($vICMS > 0) {
3246 3246
             $vICMS = 1;
3247 3247
         }
3248
-        $icmss  = $this->ICMSTot->getElementsByTagName("vBC")->item(0)->nodeValue;
3248
+        $icmss = $this->ICMSTot->getElementsByTagName("vBC")->item(0)->nodeValue;
3249 3249
         if ($icmss > 0) {
3250 3250
             $icmss = 1;
3251 3251
         }
3252
-        $dEmi = ! empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
3252
+        $dEmi = !empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
3253 3253
                 $this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue : '';
3254 3254
         if ($dEmi == '') {
3255
-            $dEmi = ! empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
3255
+            $dEmi = !empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
3256 3256
                     $this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue : '';
3257 3257
             $aDemi = explode('T', $dEmi);
3258 3258
             $dEmi = $aDemi[0];
3259 3259
         }
3260 3260
         $dd  = $dEmi;
3261 3261
         $rpos = strrpos($dd, '-');
3262
-        $dd  = substr($dd, $rpos +1);
3262
+        $dd  = substr($dd, $rpos + 1);
3263 3263
         $chave = sprintf($forma, $cUF, $this->tpEmis, $CNPJ, $vNF, $vICMS, $icmss, $dd);
3264 3264
         $chave = $chave . $this->modulo11($chave);
3265 3265
         return $chave;
@@ -3280,7 +3280,7 @@  discard block
 block discarded – undo
3280 3280
         $formaNfRef = "\r\nNF  Ref.: série:%d numero:%d emit:%s em %s modelo: %d";
3281 3281
         $formaECFRef = "\r\nECF Ref.: modelo: %s ECF:%d COO:%d";
3282 3282
         $formaNfpRef = "\r\nNFP Ref.: série:%d número:%d emit:%s em %s modelo: %d IE:%s";
3283
-        $saida='';
3283
+        $saida = '';
3284 3284
         $nfRefs = $this->ide->getElementsByTagName('NFref');
3285 3285
         if (0 === $nfRefs->length) {
3286 3286
             return $saida;
@@ -3296,7 +3296,7 @@  discard block
 block discarded – undo
3296 3296
             foreach ($refNFe as $chave_acessoRef) {
3297 3297
                 $chave_acesso = $chave_acessoRef->nodeValue;
3298 3298
                 $chave_acessoF = $this->formatField($chave_acesso, $this->formatoChave);
3299
-                $data = substr($chave_acesso, 4, 2)."/20".substr($chave_acesso, 2, 2);
3299
+                $data = substr($chave_acesso, 4, 2) . "/20" . substr($chave_acesso, 2, 2);
3300 3300
                 $cnpj = $this->formatField(substr($chave_acesso, 6, 14), "##.###.###/####-##");
3301 3301
                 $serie  = substr($chave_acesso, 22, 3);
3302 3302
                 $numero = substr($chave_acesso, 25, 9);
@@ -3317,7 +3317,7 @@  discard block
 block discarded – undo
3317 3317
             foreach ($refCTe as $chave_acessoRef) {
3318 3318
                 $chave_acesso = $chave_acessoRef->nodeValue;
3319 3319
                 $chave_acessoF = $this->formatField($chave_acesso, $this->formatoChave);
3320
-                $data = substr($chave_acesso, 4, 2)."/20".substr($chave_acesso, 2, 2);
3320
+                $data = substr($chave_acesso, 4, 2) . "/20" . substr($chave_acesso, 2, 2);
3321 3321
                 $cnpj = $this->formatField(substr($chave_acesso, 6, 14), "##.###.###/####-##");
3322 3322
                 $serie  = substr($chave_acesso, 22, 3);
3323 3323
                 $numero = substr($chave_acesso, 25, 9);
@@ -3333,10 +3333,9 @@  discard block
 block discarded – undo
3333 3333
             $refNFP = $nfRef->getElementsByTagName('refNFP');
3334 3334
             foreach ($refNFP as $umaRefNFe) {
3335 3335
                 $data = $umaRefNFe->getElementsByTagName('AAMM')->item(0)->nodeValue;
3336
-                $cnpj = ! empty($umaRefNFe->getElementsByTagName('CNPJ')->item(0)->nodeValue) ?
3337
-                    $umaRefNFe->getElementsByTagName('CNPJ')->item(0)->nodeValue :
3338
-                    '';
3339
-                $cpf = ! empty($umaRefNFe->getElementsByTagName('CPF')->item(0)->nodeValue) ?
3336
+                $cnpj = !empty($umaRefNFe->getElementsByTagName('CNPJ')->item(0)->nodeValue) ?
3337
+                    $umaRefNFe->getElementsByTagName('CNPJ')->item(0)->nodeValue : '';
3338
+                $cpf = !empty($umaRefNFe->getElementsByTagName('CPF')->item(0)->nodeValue) ?
3340 3339
                         $umaRefNFe->getElementsByTagName('CPF')->item(0)->nodeValue : '';
3341 3340
                 $mod = $umaRefNFe->getElementsByTagName('mod')->item(0)->nodeValue;
3342 3341
                 $serie = $umaRefNFe->getElementsByTagName('serie')->item(0)->nodeValue;
@@ -3401,6 +3400,6 @@  discard block
 block discarded – undo
3401 3400
         imagedestroy($image);
3402 3401
         $stringdata = ob_get_contents(); // read from buffer
3403 3402
         ob_end_clean();
3404
-        return 'data://text/plain;base64,'.base64_encode($stringdata);
3403
+        return 'data://text/plain;base64,' . base64_encode($stringdata);
3405 3404
     }
3406 3405
 }
Please login to merge, or discard this patch.