Completed
Pull Request — master (#358)
by Roberto
03:32
created
src/NFe/Danfe.php 2 patches
Indentation   +25 added lines, -26 removed lines patch added patch discarded remove patch
@@ -370,7 +370,6 @@  discard block
 block discarded – undo
370 370
      * A definição de margens e posições iniciais para a impressão são estabelecidas
371 371
      * pelo conteúdo da funçao e podem ser modificados.
372 372
      *
373
-
374 373
      * @return string O ID da NFe numero de 44 digitos extraido do arquivo XML
375 374
      */
376 375
     protected function monta(
@@ -844,7 +843,7 @@  discard block
 block discarded – undo
844 843
         $oldX = $x;
845 844
         $oldY = $y;
846 845
         if ($this->orientacao == 'P') {
847
-              $maxW = $this->wPrint;
846
+                $maxW = $this->wPrint;
848 847
         } else {
849 848
             if ($pag == 1) { // primeira página
850 849
                 $maxW = $this->wPrint - $this->wCanhoto;
@@ -1206,8 +1205,8 @@  discard block
 block discarded – undo
1206 1205
             $w = $maxW-(2*$x);
1207 1206
             $this->pdf->SetTextColor(200, 200, 200);
1208 1207
             $texto = "DANFE impresso em contingência -\n".
1209
-                     "DPEC regularmente recebido pela Receita\n".
1210
-                     "Federal do Brasil";
1208
+                        "DPEC regularmente recebido pela Receita\n".
1209
+                        "Federal do Brasil";
1211 1210
             $aFont = ['font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B'];
1212 1211
             $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1213 1212
             $this->pdf->SetTextColor(0, 0, 0);
@@ -1727,13 +1726,13 @@  discard block
 block discarded – undo
1727 1726
         return ($y + $h);
1728 1727
     } //fim da função localRetiradaDANFE
1729 1728
     
1730
-     /**
1731
-     * getTextoFatura
1732
-     * Gera a String do Texto da Fatura
1733
-      *
1734
-     * @name   getTextoFatura
1735
-     * @return uma String com o texto ou "";
1736
-     */
1729
+        /**
1730
+         * getTextoFatura
1731
+         * Gera a String do Texto da Fatura
1732
+         *
1733
+         * @name   getTextoFatura
1734
+         * @return uma String com o texto ou "";
1735
+         */
1737 1736
     protected function getTextoFatura()
1738 1737
     {
1739 1738
         if (isset($this->cobr)) {
@@ -1764,13 +1763,13 @@  discard block
 block discarded – undo
1764 1763
         return "";
1765 1764
     }
1766 1765
 
1767
-     /**
1768
-     * sizeExtraTextoFatura
1769
-     * Calcula o espaço ocupado pelo texto da fatura. Este espaço só é utilizado quando não houver duplicata.
1770
-      *
1771
-     * @name   sizeExtraTextoFatura
1772
-     * @return integer
1773
-     */
1766
+        /**
1767
+         * sizeExtraTextoFatura
1768
+         * Calcula o espaço ocupado pelo texto da fatura. Este espaço só é utilizado quando não houver duplicata.
1769
+         *
1770
+         * @name   sizeExtraTextoFatura
1771
+         * @return integer
1772
+         */
1774 1773
     protected function sizeExtraTextoFatura()
1775 1774
     {
1776 1775
         $textoFatura = $this->getTextoFatura();
@@ -1950,7 +1949,7 @@  discard block
 block discarded – undo
1950 1949
                                     '11'=>'Vale Refeição','12'=>'Vale Presente','13'=>'Vale Combustível',
1951 1950
                                     '14'=>'Duplicata Mercantil','15'=>'Boleto','90'=>'Sem pagamento','99'=>'Outros'];
1952 1951
             $bandeira = ['01'=>'Visa','02'=>'Mastercard','03'=>'American','04'=>'Sorocred','05'=>'Diners',
1953
-                              '06'=>'Elo','07'=>'Hipercard','08'=>'Aura','09'=>'Cabal','99'=>'Outros'];
1952
+                                '06'=>'Elo','07'=>'Hipercard','08'=>'Aura','09'=>'Cabal','99'=>'Outros'];
1954 1953
             foreach ($this->detPag as $k => $d) {
1955 1954
                 $fPag = !empty($this->detPag->item($k)->getElementsByTagName('tPag')->item(0)->nodeValue)
1956 1955
                 ? $this->detPag->item($k)->getElementsByTagName('tPag')->item(0)->nodeValue
@@ -2601,7 +2600,7 @@  discard block
 block discarded – undo
2601 2600
         $w4 = round($w*0.05, 0);
2602 2601
         $texto = 'O/CSOSN';//Regime do Simples CRT = 1 ou CRT = 2
2603 2602
         if ($this->getTagValue($this->emit, 'CRT') == '3') {
2604
-             $texto = 'O/CST';//Regime Normal
2603
+                $texto = 'O/CST';//Regime Normal
2605 2604
         }
2606 2605
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2607 2606
         $this->pdf->textBox($x, $y, $w4, $h, $texto, $aFont, 'C', 'C', 0, '', false);
@@ -3040,7 +3039,7 @@  discard block
 block discarded – undo
3040 3039
         $this->pdf->textBox($x, $yVeic, $w1+40, $h, $texto, $aFont, 'T', 'L', 0, '');
3041 3040
         $yVeic += $h;
3042 3041
         $texto = 'Tipo.................: ' . ($renavamTiposVeiculos[intval($veiculoTipo)] ?? $veiculoTipo);
3043
-         $this->pdf->textBox($x, $yVeic, $w1+40, $h, $texto, $aFont, 'T', 'L', 0, '');
3042
+            $this->pdf->textBox($x, $yVeic, $w1+40, $h, $texto, $aFont, 'T', 'L', 0, '');
3044 3043
         $yVeic = $y + $h;
3045 3044
         $xVeic = $x + 65;
3046 3045
         $texto = 'Nº Motor: .........: ' . $veiculoMotor;
@@ -3176,9 +3175,9 @@  discard block
 block discarded – undo
3176 3175
         //DADOS ADICIONAIS
3177 3176
         $texto = "DADOS ADICIONAIS";
3178 3177
         if ($this->orientacao == 'P') {
3179
-              $w = $this->wPrint;
3178
+                $w = $this->wPrint;
3180 3179
         } else {
3181
-              $w = $this->wPrint-$this->wCanhoto;
3180
+                $w = $this->wPrint-$this->wCanhoto;
3182 3181
         }
3183 3182
         $aFont = ['font'=> $this->fontePadrao, 'size' => 7, 'style'=> 'B'];
3184 3183
         $this->pdf->textBox($x, $y, $w, 8, $texto, $aFont, 'T', 'L', 0, '');
@@ -3265,10 +3264,10 @@  discard block
 block discarded – undo
3265 3264
     {
3266 3265
         $y = $this->maxH - 4;
3267 3266
         if ($this->orientacao == 'P') {
3268
-              $w = $this->wPrint;
3267
+                $w = $this->wPrint;
3269 3268
         } else {
3270
-              $w = $this->wPrint-$this->wCanhoto;
3271
-              $x = $this->wCanhoto;
3269
+                $w = $this->wPrint-$this->wCanhoto;
3270
+                $x = $this->wCanhoto;
3272 3271
         }
3273 3272
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>'I'];
3274 3273
         $texto = "Impresso em ". date('d/m/Y') . " as " . date('H:i:s')
Please login to merge, or discard this patch.
Spacing   +338 added lines, -339 removed lines patch added patch discarded remove patch
@@ -283,14 +283,14 @@  discard block
 block discarded – undo
283 283
             'style' => ''
284 284
         ];
285 285
         $k = $this->pdf->k;
286
-        $this->textadicfontsize = $fontProduto['size']/$k;
286
+        $this->textadicfontsize = $fontProduto['size'] / $k;
287 287
         $this->textoAdic .= $this->geraInformacoesDasNotasReferenciadas();
288 288
         if (isset($this->infAdic)) {
289 289
             $i = 0;
290 290
             if ($this->textoAdic != '') {
291 291
                 $this->textoAdic .= ". \n";
292 292
             }
293
-            $this->textoAdic .= ! empty($this->getTagValue($this->infAdic, "infCpl"))
293
+            $this->textoAdic .= !empty($this->getTagValue($this->infAdic, "infCpl"))
294 294
                 ? 'Inf. Contribuinte: ' . $this->anfaveaDANFE($this->getTagValue($this->infAdic, "infCpl"))
295 295
                 : '';
296 296
             $infPedido = $this->geraInformacoesDaTagCompra();
@@ -298,14 +298,14 @@  discard block
 block discarded – undo
298 298
                 $this->textoAdic .= $infPedido;
299 299
             }
300 300
             $this->textoAdic .= $this->getTagValue($this->dest, "email", ' Email do Destinatário: ');
301
-            $this->textoAdic .= ! empty($this->getTagValue($this->infAdic, "infAdFisco"))
301
+            $this->textoAdic .= !empty($this->getTagValue($this->infAdic, "infAdFisco"))
302 302
                 ? "\n Inf. fisco: " . $this->getTagValue($this->infAdic, "infAdFisco")
303 303
                 : '';
304 304
             $obsCont = $this->infAdic->getElementsByTagName("obsCont");
305 305
             if (isset($obsCont)) {
306 306
                 foreach ($obsCont as $obs) {
307
-                    $campo =  $obsCont->item($i)->getAttribute("xCampo");
308
-                    $xTexto = ! empty($obsCont->item($i)->getElementsByTagName("xTexto")->item(0)->nodeValue)
307
+                    $campo = $obsCont->item($i)->getAttribute("xCampo");
308
+                    $xTexto = !empty($obsCont->item($i)->getElementsByTagName("xTexto")->item(0)->nodeValue)
309 309
                         ? $obsCont->item($i)->getElementsByTagName("xTexto")->item(0)->nodeValue
310 310
                         : '';
311 311
                     $this->textoAdic .= "\n" . $campo . ':  ' . trim($xTexto);
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
         //fim da alteração NT 2013.003 Lei da Transparência
332 332
         $this->textoAdic = str_replace(";", "\n", $this->textoAdic);
333 333
         $alinhas = explode("\n", $this->textoAdic);
334
-        $numlinhasdados = $this->pdf->getNumLines($this->textoAdic, $this->wAdic, $fontProduto)+1.5;
334
+        $numlinhasdados = $this->pdf->getNumLines($this->textoAdic, $this->wAdic, $fontProduto) + 1.5;
335 335
         $this->textadicfontsize = $this->pdf->fontSize;
336 336
         $hdadosadic = ceil($numlinhasdados * ($this->textadicfontsize));
337 337
         if ($hdadosadic > 70) {
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
                     'size' => $f,
343 343
                     'style' => ''
344 344
                 ];
345
-                $numlinhasdados = $this->pdf->getNumLines($this->textoAdic, $this->wAdic, $fontProduto)+3;
345
+                $numlinhasdados = $this->pdf->getNumLines($this->textoAdic, $this->wAdic, $fontProduto) + 3;
346 346
                 $this->textadicfontsize = $this->pdf->fontSize;
347 347
                 $hdadosadic = ceil($numlinhasdados * $this->textadicfontsize);
348 348
                 echo $hdadosadic;
@@ -402,7 +402,7 @@  discard block
 block discarded – undo
402 402
             if ($this->papel == 'A4') {
403 403
                 $this->maxW = 297;
404 404
                 $this->maxH = 210;
405
-                $xInic = $this->margesq+10;
405
+                $xInic = $this->margesq + 10;
406 406
                 //se paisagem multiplica a largura do canhoto pela quantidade de canhotos
407 407
                 //$this->wCanhoto *= $this->qCanhoto;
408 408
             }
@@ -410,10 +410,10 @@  discard block
 block discarded – undo
410 410
         //total inicial de paginas
411 411
         $totPag = 1;
412 412
         //largura imprimivel em mm: largura da folha menos as margens esq/direita
413
-        $this->wPrint = $this->maxW-($this->margesq * 2);
413
+        $this->wPrint = $this->maxW - ($this->margesq * 2);
414 414
         //comprimento (altura) imprimivel em mm: altura da folha menos as margens
415 415
         //superior e inferior
416
-        $this->hPrint = $this->maxH-$this->margsup-$this->marginf;
416
+        $this->hPrint = $this->maxH - $this->margsup - $this->marginf;
417 417
         // estabelece contagem de paginas
418 418
         $this->pdf->aliasNbPages();
419 419
         // fixa as margens
@@ -457,18 +457,18 @@  discard block
 block discarded – undo
457 457
         }
458 458
         //calcular a altura necessária para os dados adicionais
459 459
         if ($this->orientacao == 'P') {
460
-            $this->wAdic = round($this->wPrint*0.66, 0);
460
+            $this->wAdic = round($this->wPrint * 0.66, 0);
461 461
         } else {
462
-            $this->wAdic = round(($this->wPrint-$this->wCanhoto)*0.5, 0);
462
+            $this->wAdic = round(($this->wPrint - $this->wCanhoto) * 0.5, 0);
463 463
         }
464 464
         $fontProduto = ['font' => $this->fontePadrao, 'size' => 7, 'style' => ''];
465 465
         
466 466
         $this->hdadosadic = $this->calculoEspacoVericalDadosAdicionais();
467 467
         
468 468
         //altura disponivel para os campos da DANFE
469
-        $hcabecalho = 47;//para cabeçalho
470
-        $hdestinatario = 25;//para destinatario
471
-        $hduplicatas = 12;//para cada grupo de 7 duplicatas
469
+        $hcabecalho = 47; //para cabeçalho
470
+        $hdestinatario = 25; //para destinatario
471
+        $hduplicatas = 12; //para cada grupo de 7 duplicatas
472 472
         if (isset($this->entrega)) {
473 473
             $hlocalentrega = 25;
474 474
         } else {
@@ -479,11 +479,11 @@  discard block
 block discarded – undo
479 479
         } else {
480 480
             $hlocalretirada = 0;
481 481
         }
482
-        $himposto = 18;// para imposto
483
-        $htransporte = 25;// para transporte
484
-        $hissqn = 11;// para issqn
485
-        $hfooter = 5;// para rodape
486
-        $hCabecItens = 4;//cabeçalho dos itens
482
+        $himposto = 18; // para imposto
483
+        $htransporte = 25; // para transporte
484
+        $hissqn = 11; // para issqn
485
+        $hfooter = 5; // para rodape
486
+        $hCabecItens = 4; //cabeçalho dos itens
487 487
         //
488 488
         $hOCUPADA = 
489 489
             $hcabecalho
@@ -508,10 +508,10 @@  discard block
 block discarded – undo
508 508
             $this->sizeExtraTextoFatura());*/
509 509
         
510 510
         if ($this->orientacao == 'P') {
511
-            $hDispo1 -= 24 * $this->qCanhoto;//para canhoto
511
+            $hDispo1 -= 24 * $this->qCanhoto; //para canhoto
512 512
             $w = $this->wPrint;
513 513
         } else {
514
-            $hcanhoto = $this->hPrint;//para canhoto
514
+            $hcanhoto = $this->hPrint; //para canhoto
515 515
             $w = $this->wPrint - $this->wCanhoto;
516 516
         }
517 517
         //$hDispo1 += 14;
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
         $fontProduto = ['font' => $this->fontePadrao, 'size' => 7, 'style' => ''];
521 521
         $numlinhas = 0;
522 522
         $hUsado = $hCabecItens;
523
-        $w2 = round($w*0.28, 0);
523
+        $w2 = round($w * 0.28, 0);
524 524
         $hDispo = $hDispo1;
525 525
         $totPag = 1;
526 526
         $i = 0;
@@ -536,7 +536,7 @@  discard block
 block discarded – undo
536 536
                 $hDispo = $hDispo2;
537 537
                 $hUsado = $hCabecItens;
538 538
                 // Remove canhoto para páginas secundárias em modo paisagem ('L')
539
-                $w2 = round($this->wPrint*0.28, 0);
539
+                $w2 = round($this->wPrint * 0.28, 0);
540 540
                 $i--; // decrementa para readicionar o item que não coube nessa pagina na outra.
541 541
             }
542 542
             $i++;
@@ -557,14 +557,14 @@  discard block
 block discarded – undo
557 557
         //coloca o cabeçalho
558 558
         $y = $this->header($x, $y, $pag, $totPag);
559 559
         //coloca os dados do destinatário
560
-        $y = $this->destinatarioDANFE($x, $y+1);
560
+        $y = $this->destinatarioDANFE($x, $y + 1);
561 561
         //coloca os dados do local de retirada
562 562
         if (isset($this->retirada)) {
563
-            $y = $this->localRetiradaDANFE($x, $y+1);
563
+            $y = $this->localRetiradaDANFE($x, $y + 1);
564 564
         }
565 565
         //coloca os dados do local de entrega
566 566
         if (isset($this->entrega)) {
567
-            $y = $this->localEntregaDANFE($x, $y+1);
567
+            $y = $this->localEntregaDANFE($x, $y + 1);
568 568
         }
569 569
         
570 570
         //Verifica as formas de pagamento da nota fiscal
@@ -579,29 +579,29 @@  discard block
 block discarded – undo
579 579
         }
580 580
         //caso tenha boleto imprimir fatura
581 581
         if ($this->dup->length > 0) {
582
-            $y = $this->fatura($x, $y+1);
582
+            $y = $this->fatura($x, $y + 1);
583 583
         } else {
584 584
             //Se somente tiver a forma de pagamento sem pagamento ou outros não imprimir nada
585
-            if (count($formaPag)=='1' && (isset($formaPag[90]) || isset($formaPag[99]))) {
585
+            if (count($formaPag) == '1' && (isset($formaPag[90]) || isset($formaPag[99]))) {
586 586
                 $y = $y;
587 587
             } else {
588 588
                 //caso tenha mais de uma forma de pagamento ou seja diferente de boleto exibe a
589 589
                 //forma de pagamento e o valor
590
-                $y = $this->pagamento($x, $y+1);
590
+                $y = $this->pagamento($x, $y + 1);
591 591
             }
592 592
         }
593 593
         //coloca os dados dos impostos e totais da NFe
594
-        $y = $this->imposto($x, $y+1);
594
+        $y = $this->imposto($x, $y + 1);
595 595
         //coloca os dados do trasnporte
596
-        $y = $this->transporte($x, $y+1);
596
+        $y = $this->transporte($x, $y + 1);
597 597
         //itens da DANFE
598 598
         $nInicial = 0;
599 599
 
600
-        $y = $this->itens($x, $y+1, $nInicial, $hDispo1, $pag, $totPag, $hCabecItens);
600
+        $y = $this->itens($x, $y + 1, $nInicial, $hDispo1, $pag, $totPag, $hCabecItens);
601 601
 
602 602
         //coloca os dados do ISSQN
603 603
         if ($linhaISSQN == 1) {
604
-            $y = $this->issqn($x, $y+4);
604
+            $y = $this->issqn($x, $y + 4);
605 605
         } else {
606 606
             $y += 4;
607 607
         }
@@ -630,7 +630,7 @@  discard block
 block discarded – undo
630 630
             //coloca o cabeçalho na página adicional
631 631
             $y = $this->header($x, $y, $n, $totPag);
632 632
             //coloca os itens na página adicional
633
-            $y = $this->itens($x, $y+1, $nInicial, $hDispo2, $n, $totPag, $hCabecItens);
633
+            $y = $this->itens($x, $y + 1, $nInicial, $hDispo2, $n, $totPag, $hCabecItens);
634 634
             //coloca o rodapé da página
635 635
             if ($this->orientacao == 'P') {
636 636
                 $this->rodape($this->margesq);
@@ -667,7 +667,7 @@  discard block
 block discarded – undo
667 667
         if ($startPos === false) {
668 668
             return $cdata;
669 669
         }
670
-        for ($x=$len; $x>0; $x--) {
670
+        for ($x = $len; $x > 0; $x--) {
671 671
             if (substr($cdata, $x, 1) == '>') {
672 672
                 $endPos = $x;
673 673
                 break;
@@ -678,15 +678,15 @@  discard block
 block discarded – undo
678 678
         } else {
679 679
             $parte1 = '';
680 680
         }
681
-        $parte2 = substr($cdata, $startPos, $endPos-$startPos+1);
681
+        $parte2 = substr($cdata, $startPos, $endPos - $startPos + 1);
682 682
         if ($endPos < $len) {
683 683
             $parte3 = substr($cdata, $endPos + 1, $len - $endPos - 1);
684 684
         } else {
685 685
             $parte3 = '';
686 686
         }
687
-        $texto = trim($parte1).' '.trim($parte3);
687
+        $texto = trim($parte1) . ' ' . trim($parte3);
688 688
         if (strpos($parte2, '<CDATA>') === false) {
689
-            $cdata = '<CDATA>'.$parte2.'</CDATA>';
689
+            $cdata = '<CDATA>' . $parte2 . '</CDATA>';
690 690
         } else {
691 691
             $cdata = $parte2;
692 692
         }
@@ -760,15 +760,15 @@  discard block
 block discarded – undo
760 760
         //grupo CADATA infCpl
761 761
         $t = $dom->getElementsByTagName('transmissor')->item(0);
762 762
         $r = $dom->getElementsByTagName('receptor')->item(0);
763
-        $versao = ! empty($dom->getElementsByTagName('versao')->item(0)->nodeValue) ?
764
-            'Versao:'.$dom->getElementsByTagName('versao')->item(0)->nodeValue.' ' : '';
765
-        $especieNF = ! empty($dom->getElementsByTagName('especieNF')->item(0)->nodeValue) ?
766
-            'Especie:'.$dom->getElementsByTagName('especieNF')->item(0)->nodeValue.' ' : '';
767
-        $fabEntrega = ! empty($dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue) ?
768
-            'Entrega:'.$dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue.' ' : '';
769
-        $dca = ! empty($dom->getElementsByTagName('dca')->item(0)->nodeValue) ?
770
-            'dca:'.$dom->getElementsByTagName('dca')->item(0)->nodeValue.' ' : '';
771
-        $texto .= "".$versao.$especieNF.$fabEntrega.$dca;
763
+        $versao = !empty($dom->getElementsByTagName('versao')->item(0)->nodeValue) ?
764
+            'Versao:' . $dom->getElementsByTagName('versao')->item(0)->nodeValue . ' ' : '';
765
+        $especieNF = !empty($dom->getElementsByTagName('especieNF')->item(0)->nodeValue) ?
766
+            'Especie:' . $dom->getElementsByTagName('especieNF')->item(0)->nodeValue . ' ' : '';
767
+        $fabEntrega = !empty($dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue) ?
768
+            'Entrega:' . $dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue . ' ' : '';
769
+        $dca = !empty($dom->getElementsByTagName('dca')->item(0)->nodeValue) ?
770
+            'dca:' . $dom->getElementsByTagName('dca')->item(0)->nodeValue . ' ' : '';
771
+        $texto .= "" . $versao . $especieNF . $fabEntrega . $dca;
772 772
         if (isset($t)) {
773 773
             if ($t->hasAttributes()) {
774 774
                 $texto .= " Transmissor ";
@@ -854,14 +854,14 @@  discard block
 block discarded – undo
854 854
         }
855 855
         //####################################################################################
856 856
         //coluna esquerda identificação do emitente
857
-        $w = round($maxW*0.41, 0);
857
+        $w = round($maxW * 0.41, 0);
858 858
         if ($this->orientacao == 'P') {
859 859
             $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>'I'];
860 860
         } else {
861 861
             $aFont = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B'];
862 862
         }
863 863
         $w1 = $w;
864
-        $h=32;
864
+        $h = 32;
865 865
         $oldY += $h;
866 866
         $this->pdf->textBox($x, $y, $w, $h);
867 867
         $texto = 'IDENTIFICAÇÃO DO EMITENTE';
@@ -877,39 +877,39 @@  discard block
 block discarded – undo
877 877
         if (!empty($this->logomarca)) {
878 878
             $logoInfo = getimagesize($this->logomarca);
879 879
             //largura da imagem em mm
880
-            $logoWmm = ($logoInfo[0]/72)*25.4;
880
+            $logoWmm = ($logoInfo[0] / 72) * 25.4;
881 881
             //altura da imagem em mm
882
-            $logoHmm = ($logoInfo[1]/72)*25.4;
883
-            if ($this->logoAlign=='L') {
884
-                $nImgW = round($w/3, 0);
885
-                $nImgH = round($logoHmm * ($nImgW/$logoWmm), 0);
886
-                $xImg = $x+1;
887
-                $yImg = round(($h-$nImgH)/2, 0)+$y;
882
+            $logoHmm = ($logoInfo[1] / 72) * 25.4;
883
+            if ($this->logoAlign == 'L') {
884
+                $nImgW = round($w / 3, 0);
885
+                $nImgH = round($logoHmm * ($nImgW / $logoWmm), 0);
886
+                $xImg = $x + 1;
887
+                $yImg = round(($h - $nImgH) / 2, 0) + $y;
888 888
                 //estabelecer posições do texto
889
-                $x1 = round($xImg + $nImgW +1, 0);
890
-                $y1 = round($h/3+$y, 0);
891
-                $tw = round(2*$w/3, 0);
892
-            } elseif ($this->logoAlign=='C') {
893
-                $nImgH = round($h/3, 0);
894
-                $nImgW = round($logoWmm * ($nImgH/$logoHmm), 0);
895
-                $xImg = round(($w-$nImgW)/2+$x, 0);
896
-                $yImg = $y+3;
889
+                $x1 = round($xImg + $nImgW + 1, 0);
890
+                $y1 = round($h / 3 + $y, 0);
891
+                $tw = round(2 * $w / 3, 0);
892
+            } elseif ($this->logoAlign == 'C') {
893
+                $nImgH = round($h / 3, 0);
894
+                $nImgW = round($logoWmm * ($nImgH / $logoHmm), 0);
895
+                $xImg = round(($w - $nImgW) / 2 + $x, 0);
896
+                $yImg = $y + 3;
897 897
                 $x1 = $x;
898 898
                 $y1 = round($yImg + $nImgH + 1, 0);
899 899
                 $tw = $w;
900
-            } elseif ($this->logoAlign=='R') {
901
-                $nImgW = round($w/3, 0);
902
-                $nImgH = round($logoHmm * ($nImgW/$logoWmm), 0);
903
-                $xImg = round($x+($w-(1+$nImgW)), 0);
904
-                $yImg = round(($h-$nImgH)/2, 0)+$y;
900
+            } elseif ($this->logoAlign == 'R') {
901
+                $nImgW = round($w / 3, 0);
902
+                $nImgH = round($logoHmm * ($nImgW / $logoWmm), 0);
903
+                $xImg = round($x + ($w - (1 + $nImgW)), 0);
904
+                $yImg = round(($h - $nImgH) / 2, 0) + $y;
905 905
                 $x1 = $x;
906
-                $y1 = round($h/3+$y, 0);
907
-                $tw = round(2*$w/3, 0);
908
-            } elseif ($this->logoAlign=='F') {
909
-                $nImgH = round($h-5, 0);
910
-                $nImgW = round($logoWmm * ($nImgH/$logoHmm), 0);
911
-                $xImg = round(($w-$nImgW)/2+$x, 0);
912
-                $yImg = $y+3;
906
+                $y1 = round($h / 3 + $y, 0);
907
+                $tw = round(2 * $w / 3, 0);
908
+            } elseif ($this->logoAlign == 'F') {
909
+                $nImgH = round($h - 5, 0);
910
+                $nImgW = round($logoWmm * ($nImgH / $logoHmm), 0);
911
+                $xImg = round(($w - $nImgW) / 2 + $x, 0);
912
+                $yImg = $y + 3;
913 913
                 $x1 = $x;
914 914
                 $y1 = round($yImg + $nImgH + 1, 0);
915 915
                 $tw = $w;
@@ -918,7 +918,7 @@  discard block
 block discarded – undo
918 918
             $this->pdf->Image($this->logomarca, $xImg, $yImg, $nImgW, $nImgH, 'jpeg');
919 919
         } else {
920 920
             $x1 = $x;
921
-            $y1 = round($h/3+$y, 0);
921
+            $y1 = round($h / 3 + $y, 0);
922 922
             $tw = $w;
923 923
         }
924 924
         // monta as informações apenas se diferente de full logo
@@ -928,9 +928,9 @@  discard block
 block discarded – undo
928 928
             $texto = $this->emit->getElementsByTagName("xNome")->item(0)->nodeValue;
929 929
             $this->pdf->textBox($x1, $y1, $tw, 8, $texto, $aFont, 'T', 'C', 0, '');
930 930
             //endereço
931
-            $y1 = $y1+5;
931
+            $y1 = $y1 + 5;
932 932
             $aFont = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>''];
933
-            $fone = ! empty($this->enderEmit->getElementsByTagName("fone")->item(0)->nodeValue)
933
+            $fone = !empty($this->enderEmit->getElementsByTagName("fone")->item(0)->nodeValue)
934 934
             ? $this->enderEmit->getElementsByTagName("fone")->item(0)->nodeValue
935 935
             : '';
936 936
             $lgr = $this->getTagValue($this->enderEmit, "xLgr");
@@ -950,33 +950,33 @@  discard block
 block discarded – undo
950 950
         //####################################################################################
951 951
         //coluna central Danfe
952 952
         $x += $w;
953
-        $w=round($maxW * 0.17, 0);//35;
953
+        $w = round($maxW * 0.17, 0); //35;
954 954
         $w2 = $w;
955 955
         $h = 32;
956 956
         $this->pdf->textBox($x, $y, $w, $h);
957 957
   
958 958
         $texto = "DANFE";
959 959
         $aFont = ['font'=>$this->fontePadrao, 'size'=>14, 'style'=>'B'];
960
-        $this->pdf->textBox($x, $y+1, $w, $h, $texto, $aFont, 'T', 'C', 0, '');
960
+        $this->pdf->textBox($x, $y + 1, $w, $h, $texto, $aFont, 'T', 'C', 0, '');
961 961
         $aFont = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>''];
962 962
         $texto = 'Documento Auxiliar da Nota Fiscal Eletrônica';
963 963
         $h = 20;
964
-        $this->pdf->textBox($x, $y+6, $w, $h, $texto, $aFont, 'T', 'C', 0, '', false);
964
+        $this->pdf->textBox($x, $y + 6, $w, $h, $texto, $aFont, 'T', 'C', 0, '', false);
965 965
 
966 966
         $aFont = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>''];
967 967
         $texto = '0 - ENTRADA';
968 968
         $y1 = $y + 14;
969 969
         $h = 8;
970
-        $this->pdf->textBox($x+2, $y1, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
970
+        $this->pdf->textBox($x + 2, $y1, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
971 971
         $texto = '1 - SAÍDA';
972 972
         $y1 = $y + 17;
973
-        $this->pdf->textBox($x+2, $y1, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
973
+        $this->pdf->textBox($x + 2, $y1, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
974 974
         //tipo de nF
975 975
         $aFont = ['font'=>$this->fontePadrao, 'size'=>12, 'style'=>'B'];
976 976
         $y1 = $y + 13;
977 977
         $h = 7;
978 978
         $texto = $this->ide->getElementsByTagName('tpNF')->item(0)->nodeValue;
979
-        $this->pdf->textBox($x+27, $y1, 5, $h, $texto, $aFont, 'C', 'C', 1, '');
979
+        $this->pdf->textBox($x + 27, $y1, 5, $h, $texto, $aFont, 'C', 'C', 1, '');
980 980
         //numero da NF
981 981
         $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'];
982 982
         $y1 = $y + 20;
@@ -1008,7 +1008,7 @@  discard block
 block discarded – undo
1008 1008
         //####################################################################################
1009 1009
         //coluna codigo de barras
1010 1010
         $x += $w;
1011
-        $w = ($maxW-$w1-$w2);//85;
1011
+        $w = ($maxW - $w1 - $w2); //85;
1012 1012
         $w3 = $w;
1013 1013
         $h = 32;
1014 1014
         $this->pdf->textBox($x, $y, $w, $h);
@@ -1017,22 +1017,22 @@  discard block
 block discarded – undo
1017 1017
         $bW = 75;
1018 1018
         $bH = 12;
1019 1019
         //codigo de barras
1020
-        $this->pdf->code128($x+(($w-$bW)/2), $y+2, $chave_acesso, $bW, $bH);
1020
+        $this->pdf->code128($x + (($w - $bW) / 2), $y + 2, $chave_acesso, $bW, $bH);
1021 1021
         //linhas divisorias
1022
-        $this->pdf->line($x, $y+4+$bH, $x+$w, $y+4+$bH);
1023
-        $this->pdf->line($x, $y+12+$bH, $x+$w, $y+12+$bH);
1022
+        $this->pdf->line($x, $y + 4 + $bH, $x + $w, $y + 4 + $bH);
1023
+        $this->pdf->line($x, $y + 12 + $bH, $x + $w, $y + 12 + $bH);
1024 1024
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1025
-        $y1 = $y+4+$bH;
1025
+        $y1 = $y + 4 + $bH;
1026 1026
         $h = 7;
1027 1027
         $texto = 'CHAVE DE ACESSO';
1028 1028
         $this->pdf->textBox($x, $y1, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1029 1029
         $aFont = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B'];
1030
-        $y1 = $y+8+$bH;
1030
+        $y1 = $y + 8 + $bH;
1031 1031
         $texto = $this->formatField($chave_acesso, $this->formatoChave);
1032
-        $this->pdf->textBox($x+2, $y1, $w-2, $h, $texto, $aFont, 'T', 'C', 0, '');
1033
-        $y1 = $y+12+$bH;
1032
+        $this->pdf->textBox($x + 2, $y1, $w - 2, $h, $texto, $aFont, 'T', 'C', 0, '');
1033
+        $y1 = $y + 12 + $bH;
1034 1034
         $aFont = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>''];
1035
-        $chaveContingencia="";
1035
+        $chaveContingencia = "";
1036 1036
         if ($this->notaDpec()) {
1037 1037
             $cabecalhoProtoAutorizacao = 'NÚMERO DE REGISTRO DPEC';
1038 1038
         } else {
@@ -1043,16 +1043,16 @@  discard block
 block discarded – undo
1043 1043
             $chaveContingencia = $this->geraChaveAdicionalDeContingencia();
1044 1044
             $this->pdf->setFillColor(0, 0, 0);
1045 1045
             //codigo de barras
1046
-            $this->pdf->code128($x+11, $y1+1, $chaveContingencia, $bW*.9, $bH/2);
1046
+            $this->pdf->code128($x + 11, $y1 + 1, $chaveContingencia, $bW * .9, $bH / 2);
1047 1047
         } else {
1048 1048
             $texto = 'Consulta de autenticidade no portal nacional da NF-e';
1049
-            $this->pdf->textBox($x+2, $y1, $w-2, $h, $texto, $aFont, 'T', 'C', 0, '');
1050
-            $y1 = $y+16+$bH;
1049
+            $this->pdf->textBox($x + 2, $y1, $w - 2, $h, $texto, $aFont, 'T', 'C', 0, '');
1050
+            $y1 = $y + 16 + $bH;
1051 1051
             $texto = 'www.nfe.fazenda.gov.br/portal ou no site da Sefaz Autorizadora';
1052 1052
             $this->pdf->textBox(
1053
-                $x+2,
1053
+                $x + 2,
1054 1054
                 $y1,
1055
-                $w-2,
1055
+                $w - 2,
1056 1056
                 $h,
1057 1057
                 $texto,
1058 1058
                 $aFont,
@@ -1068,7 +1068,7 @@  discard block
 block discarded – undo
1068 1068
         //natureza da operação
1069 1069
         $texto = 'NATUREZA DA OPERAÇÃO';
1070 1070
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1071
-        $w = $w1+$w2;
1071
+        $w = $w1 + $w2;
1072 1072
         $y = $oldY;
1073 1073
         $oldY += $h;
1074 1074
         $x = $oldX;
@@ -1101,7 +1101,7 @@  discard block
 block discarded – undo
1101 1101
                 $cStat = '';
1102 1102
             } else {
1103 1103
                 if (isset($this->nfeProc)) {
1104
-                    $texto = ! empty($this->nfeProc->getElementsByTagName("nProt")->item(0)->nodeValue)
1104
+                    $texto = !empty($this->nfeProc->getElementsByTagName("nProt")->item(0)->nodeValue)
1105 1105
                     ? $this->nfeProc->getElementsByTagName("nProt")->item(0)->nodeValue
1106 1106
                     : '';
1107 1107
                     $tsHora = $this->toTimestamp(
@@ -1143,25 +1143,25 @@  discard block
 block discarded – undo
1143 1143
         $texto = 'INSCRIÇÃO ESTADUAL DO SUBST. TRIBUT.';
1144 1144
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1145 1145
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1146
-        $texto = ! empty($this->emit->getElementsByTagName("IEST")->item(0)->nodeValue)
1146
+        $texto = !empty($this->emit->getElementsByTagName("IEST")->item(0)->nodeValue)
1147 1147
         ? $this->emit->getElementsByTagName("IEST")->item(0)->nodeValue
1148 1148
         : '';
1149 1149
         $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'];
1150 1150
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1151 1151
         //CNPJ
1152 1152
         $x += $w;
1153
-        $w = ($maxW-(3 * $w));
1153
+        $w = ($maxW - (3 * $w));
1154 1154
         $texto = 'CNPJ';
1155 1155
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1156 1156
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1157 1157
         //Pegando valor do CPF/CNPJ
1158
-        if (! empty($this->emit->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1158
+        if (!empty($this->emit->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1159 1159
             $texto = $this->formatField(
1160 1160
                 $this->emit->getElementsByTagName("CNPJ")->item(0)->nodeValue,
1161 1161
                 "###.###.###/####-##"
1162 1162
             );
1163 1163
         } else {
1164
-            $texto = ! empty($this->emit->getElementsByTagName("CPF")->item(0)->nodeValue)
1164
+            $texto = !empty($this->emit->getElementsByTagName("CPF")->item(0)->nodeValue)
1165 1165
             ? $this->formatField(
1166 1166
                 $this->emit->getElementsByTagName("CPF")->item(0)->nodeValue,
1167 1167
                 "###.###.###-##"
@@ -1178,22 +1178,22 @@  discard block
 block discarded – undo
1178 1178
         $resp = $this->statusNFe();
1179 1179
         if (!$resp['status']) {
1180 1180
             $x = 10;
1181
-            $y = $this->hPrint-130;
1181
+            $y = $this->hPrint - 130;
1182 1182
             $h = 25;
1183
-            $w = $maxW-(2*$x);
1183
+            $w = $maxW - (2 * $x);
1184 1184
             $this->pdf->settextcolor(90, 90, 90);
1185 1185
             $texto = $resp['message'];
1186 1186
             $aFont = ['font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B'];
1187 1187
             $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1188 1188
             $y += $h;
1189 1189
             $h = 5;
1190
-            $w = $maxW-(2*$x);
1190
+            $w = $maxW - (2 * $x);
1191 1191
             if (isset($this->infProt) && $resp['status']) {
1192 1192
                 $xMotivo = $this->infProt->getElementsByTagName("xMotivo")->item(0)->nodeValue;
1193 1193
             } else {
1194 1194
                 $xMotivo = '';
1195 1195
             }
1196
-            $texto = "SEM VALOR FISCAL\n".$xMotivo;
1196
+            $texto = "SEM VALOR FISCAL\n" . $xMotivo;
1197 1197
             $aFont = ['font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B'];
1198 1198
             $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1199 1199
             $this->pdf->settextcolor(0, 0, 0);
@@ -1201,12 +1201,12 @@  discard block
 block discarded – undo
1201 1201
         if ($this->notaDpec() || $this->tpEmis == 4) {
1202 1202
             //DPEC
1203 1203
             $x = 10;
1204
-            $y = $this->hPrint-130;
1204
+            $y = $this->hPrint - 130;
1205 1205
             $h = 25;
1206
-            $w = $maxW-(2*$x);
1206
+            $w = $maxW - (2 * $x);
1207 1207
             $this->pdf->SetTextColor(200, 200, 200);
1208
-            $texto = "DANFE impresso em contingência -\n".
1209
-                     "DPEC regularmente recebido pela Receita\n".
1208
+            $texto = "DANFE impresso em contingência -\n" .
1209
+                     "DPEC regularmente recebido pela Receita\n" .
1210 1210
                      "Federal do Brasil";
1211 1211
             $aFont = ['font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B'];
1212 1212
             $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
@@ -1241,7 +1241,7 @@  discard block
 block discarded – undo
1241 1241
         $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
1242 1242
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1243 1243
         //NOME / RAZÃO SOCIAL
1244
-        $w = round($maxW*0.61, 0);
1244
+        $w = round($maxW * 0.61, 0);
1245 1245
         $w1 = $w;
1246 1246
         $y += 3;
1247 1247
         $texto = 'NOME / RAZÃO SOCIAL';
@@ -1256,19 +1256,19 @@  discard block
 block discarded – undo
1256 1256
         }
1257 1257
         //CNPJ / CPF
1258 1258
         $x += $w;
1259
-        $w = round($maxW*0.23, 0);
1259
+        $w = round($maxW * 0.23, 0);
1260 1260
         $w2 = $w;
1261 1261
         $texto = 'CNPJ / CPF';
1262 1262
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1263 1263
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1264 1264
         //Pegando valor do CPF/CNPJ
1265
-        if (! empty($this->dest->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1265
+        if (!empty($this->dest->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1266 1266
             $texto = $this->formatField(
1267 1267
                 $this->dest->getElementsByTagName("CNPJ")->item(0)->nodeValue,
1268 1268
                 "###.###.###/####-##"
1269 1269
             );
1270 1270
         } else {
1271
-            $texto = ! empty($this->dest->getElementsByTagName("CPF")->item(0)->nodeValue)
1271
+            $texto = !empty($this->dest->getElementsByTagName("CPF")->item(0)->nodeValue)
1272 1272
             ? $this->formatField(
1273 1273
                 $this->dest->getElementsByTagName("CPF")->item(0)->nodeValue,
1274 1274
                 "###.###.###-##"
@@ -1279,16 +1279,16 @@  discard block
 block discarded – undo
1279 1279
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1280 1280
         //DATA DA EMISSÃO
1281 1281
         $x += $w;
1282
-        $w = $maxW-($w1+$w2);
1282
+        $w = $maxW - ($w1 + $w2);
1283 1283
         $wx = $w;
1284 1284
         $texto = 'DATA DA EMISSÃO';
1285 1285
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1286 1286
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1287
-        $dEmi = ! empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue)
1287
+        $dEmi = !empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue)
1288 1288
         ? $this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue
1289 1289
         : '';
1290 1290
         if ($dEmi == '') {
1291
-            $dEmi = ! empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue)
1291
+            $dEmi = !empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue)
1292 1292
             ? $this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue
1293 1293
             : '';
1294 1294
             $aDemi = explode('T', $dEmi);
@@ -1302,7 +1302,7 @@  discard block
 block discarded – undo
1302 1302
             $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 1, '');
1303 1303
         }
1304 1304
         //ENDEREÇO
1305
-        $w = round($maxW*0.47, 0);
1305
+        $w = round($maxW * 0.47, 0);
1306 1306
         $w1 = $w;
1307 1307
         $y += $h;
1308 1308
         $x = $oldX;
@@ -1317,7 +1317,7 @@  discard block
 block discarded – undo
1317 1317
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 0, '', true);
1318 1318
         //BAIRRO / DISTRITO
1319 1319
         $x += $w;
1320
-        $w = round($maxW*0.21, 0);
1320
+        $w = round($maxW * 0.21, 0);
1321 1321
         $w2 = $w;
1322 1322
         $texto = 'BAIRRO / DISTRITO';
1323 1323
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
@@ -1327,12 +1327,12 @@  discard block
 block discarded – undo
1327 1327
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1328 1328
         //CEP
1329 1329
         $x += $w;
1330
-        $w = $maxW-$w1-$w2-$wx;
1330
+        $w = $maxW - $w1 - $w2 - $wx;
1331 1331
         $w2 = $w;
1332 1332
         $texto = 'CEP';
1333 1333
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1334 1334
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1335
-        $texto = ! empty($this->dest->getElementsByTagName("CEP")->item(0)->nodeValue)
1335
+        $texto = !empty($this->dest->getElementsByTagName("CEP")->item(0)->nodeValue)
1336 1336
         ? $this->dest->getElementsByTagName("CEP")->item(0)->nodeValue
1337 1337
         : '';
1338 1338
         $texto = $this->formatField($texto, "#####-###");
@@ -1344,11 +1344,11 @@  discard block
 block discarded – undo
1344 1344
         $texto = 'DATA DA SAÍDA/ENTRADA';
1345 1345
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1346 1346
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1347
-        $dSaiEnt = ! empty($this->ide->getElementsByTagName("dSaiEnt")->item(0)->nodeValue)
1347
+        $dSaiEnt = !empty($this->ide->getElementsByTagName("dSaiEnt")->item(0)->nodeValue)
1348 1348
             ? $this->ide->getElementsByTagName("dSaiEnt")->item(0)->nodeValue
1349 1349
             : '';
1350 1350
         if ($dSaiEnt == '') {
1351
-            $dSaiEnt = ! empty($this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue)
1351
+            $dSaiEnt = !empty($this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue)
1352 1352
                 ? $this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue
1353 1353
                 : '';
1354 1354
             $aDsaient = explode('T', $dSaiEnt);
@@ -1368,7 +1368,7 @@  discard block
 block discarded – undo
1368 1368
         if (strtoupper(trim($texto)) == "EXTERIOR"
1369 1369
             && $this->dest->getElementsByTagName("xPais")->length > 0
1370 1370
         ) {
1371
-            $texto .= " - " .  $this->dest->getElementsByTagName("xPais")->item(0)->nodeValue;
1371
+            $texto .= " - " . $this->dest->getElementsByTagName("xPais")->item(0)->nodeValue;
1372 1372
         }
1373 1373
         $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'];
1374 1374
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 0, '');
@@ -1383,19 +1383,19 @@  discard block
 block discarded – undo
1383 1383
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1384 1384
         //FONE / FAX
1385 1385
         $x += $w;
1386
-        $w = round(($maxW -$w1-$wx-8)/2, 0);
1386
+        $w = round(($maxW - $w1 - $wx - 8) / 2, 0);
1387 1387
         $w3 = $w;
1388 1388
         $texto = 'FONE / FAX';
1389 1389
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1390 1390
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1391
-        $texto = ! empty($this->dest->getElementsByTagName("fone")->item(0)->nodeValue)
1391
+        $texto = !empty($this->dest->getElementsByTagName("fone")->item(0)->nodeValue)
1392 1392
         ? $this->dest->getElementsByTagName("fone")->item(0)->nodeValue
1393 1393
         : '';
1394 1394
         $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'];
1395 1395
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1396 1396
         //INSCRIÇÃO ESTADUAL
1397 1397
         $x += $w;
1398
-        $w = $maxW -$w1-$wx-8-$w3;
1398
+        $w = $maxW - $w1 - $wx - 8 - $w3;
1399 1399
         $texto = 'INSCRIÇÃO ESTADUAL';
1400 1400
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1401 1401
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -1409,11 +1409,11 @@  discard block
 block discarded – undo
1409 1409
         $texto = 'HORA DA SAÍDA/ENTRADA';
1410 1410
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1411 1411
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1412
-        $hSaiEnt = ! empty($this->ide->getElementsByTagName("hSaiEnt")->item(0)->nodeValue)
1412
+        $hSaiEnt = !empty($this->ide->getElementsByTagName("hSaiEnt")->item(0)->nodeValue)
1413 1413
         ? $this->ide->getElementsByTagName("hSaiEnt")->item(0)->nodeValue
1414 1414
         : '';
1415 1415
         if ($hSaiEnt == '') {
1416
-            $dhSaiEnt = ! empty($this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue)
1416
+            $dhSaiEnt = !empty($this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue)
1417 1417
             ? $this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue
1418 1418
             : '';
1419 1419
             $tsDhSaiEnt = $this->toTimestamp($dhSaiEnt);
@@ -1452,7 +1452,7 @@  discard block
 block discarded – undo
1452 1452
         $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
1453 1453
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1454 1454
         //NOME / RAZÃO SOCIAL
1455
-        $w = round($maxW*0.61, 0);
1455
+        $w = round($maxW * 0.61, 0);
1456 1456
         $w1 = $w;
1457 1457
         $y += 3;
1458 1458
         $texto = 'NOME / RAZÃO SOCIAL';
@@ -1470,19 +1470,19 @@  discard block
 block discarded – undo
1470 1470
         }
1471 1471
         //CNPJ / CPF
1472 1472
         $x += $w;
1473
-        $w = round($maxW*0.23, 0);
1473
+        $w = round($maxW * 0.23, 0);
1474 1474
         $w2 = $w;
1475 1475
         $texto = 'CNPJ / CPF';
1476 1476
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1477 1477
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1478 1478
         //Pegando valor do CPF/CNPJ
1479
-        if (! empty($this->entrega->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1479
+        if (!empty($this->entrega->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1480 1480
             $texto = $this->formatField(
1481 1481
                 $this->entrega->getElementsByTagName("CNPJ")->item(0)->nodeValue,
1482 1482
                 "###.###.###/####-##"
1483 1483
             );
1484 1484
         } else {
1485
-            $texto = ! empty($this->entrega->getElementsByTagName("CPF")->item(0)->nodeValue) ?
1485
+            $texto = !empty($this->entrega->getElementsByTagName("CPF")->item(0)->nodeValue) ?
1486 1486
                     $this->formatField(
1487 1487
                         $this->entrega->getElementsByTagName("CPF")->item(0)->nodeValue,
1488 1488
                         "###.###.###-##"
@@ -1492,7 +1492,7 @@  discard block
 block discarded – undo
1492 1492
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1493 1493
         //INSCRIÇÃO ESTADUAL
1494 1494
         $x += $w;
1495
-        $w = $maxW-($w1+$w2);
1495
+        $w = $maxW - ($w1 + $w2);
1496 1496
         $wx = $w;
1497 1497
         $texto = 'INSCRIÇÃO ESTADUAL';
1498 1498
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
@@ -1508,7 +1508,7 @@  discard block
 block discarded – undo
1508 1508
             $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 1, '');
1509 1509
         }
1510 1510
         //ENDEREÇO
1511
-        $w = round($maxW*0.355, 0) + $wx;
1511
+        $w = round($maxW * 0.355, 0) + $wx;
1512 1512
         $w1 = $w;
1513 1513
         $y += $h;
1514 1514
         $x = $oldX;
@@ -1522,7 +1522,7 @@  discard block
 block discarded – undo
1522 1522
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 0, '', true);
1523 1523
         //BAIRRO / DISTRITO
1524 1524
         $x += $w;
1525
-        $w = round($maxW*0.335, 0);
1525
+        $w = round($maxW * 0.335, 0);
1526 1526
         $w2 = $w;
1527 1527
         $texto = 'BAIRRO / DISTRITO';
1528 1528
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
@@ -1532,17 +1532,17 @@  discard block
 block discarded – undo
1532 1532
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1533 1533
         //CEP
1534 1534
         $x += $w;
1535
-        $w = $maxW-($w1+$w2);
1535
+        $w = $maxW - ($w1 + $w2);
1536 1536
         $texto = 'CEP';
1537 1537
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1538 1538
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1539
-        $texto = ! empty($this->entrega->getElementsByTagName("CEP")->item(0)->nodeValue) ?
1539
+        $texto = !empty($this->entrega->getElementsByTagName("CEP")->item(0)->nodeValue) ?
1540 1540
                 $this->entrega->getElementsByTagName("CEP")->item(0)->nodeValue : '';
1541 1541
         $texto = $this->formatField($texto, "#####-###");
1542 1542
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
1543 1543
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1544 1544
         //MUNICÍPIO
1545
-        $w = round($maxW*0.805, 0);
1545
+        $w = round($maxW * 0.805, 0);
1546 1546
         $w1 = $w;
1547 1547
         $y += $h;
1548 1548
         $x = $oldX;
@@ -1551,7 +1551,7 @@  discard block
 block discarded – undo
1551 1551
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1552 1552
         $texto = $this->entrega->getElementsByTagName("xMun")->item(0)->nodeValue;
1553 1553
         if (strtoupper(trim($texto)) == "EXTERIOR" && $this->entrega->getElementsByTagName("xPais")->length > 0) {
1554
-            $texto .= " - " .  $this->entrega->getElementsByTagName("xPais")->item(0)->nodeValue;
1554
+            $texto .= " - " . $this->entrega->getElementsByTagName("xPais")->item(0)->nodeValue;
1555 1555
         }
1556 1556
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
1557 1557
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 0, '');
@@ -1566,11 +1566,11 @@  discard block
 block discarded – undo
1566 1566
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1567 1567
         //FONE / FAX
1568 1568
         $x += $w;
1569
-        $w = $maxW-$w-$w1;
1569
+        $w = $maxW - $w - $w1;
1570 1570
         $texto = 'FONE / FAX';
1571 1571
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1572 1572
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1573
-        $texto = ! empty($this->entrega->getElementsByTagName("fone")->item(0)->nodeValue) ?
1573
+        $texto = !empty($this->entrega->getElementsByTagName("fone")->item(0)->nodeValue) ?
1574 1574
                 $this->entrega->getElementsByTagName("fone")->item(0)->nodeValue : '';
1575 1575
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
1576 1576
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
@@ -1602,7 +1602,7 @@  discard block
 block discarded – undo
1602 1602
         $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
1603 1603
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1604 1604
         //NOME / RAZÃO SOCIAL
1605
-        $w = round($maxW*0.61, 0);
1605
+        $w = round($maxW * 0.61, 0);
1606 1606
         $w1 = $w;
1607 1607
         $y += 3;
1608 1608
         $texto = 'NOME / RAZÃO SOCIAL';
@@ -1620,19 +1620,19 @@  discard block
 block discarded – undo
1620 1620
         }
1621 1621
         //CNPJ / CPF
1622 1622
         $x += $w;
1623
-        $w = round($maxW*0.23, 0);
1623
+        $w = round($maxW * 0.23, 0);
1624 1624
         $w2 = $w;
1625 1625
         $texto = 'CNPJ / CPF';
1626 1626
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1627 1627
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1628 1628
         //Pegando valor do CPF/CNPJ
1629
-        if (! empty($this->retirada->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1629
+        if (!empty($this->retirada->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1630 1630
             $texto = $this->formatField(
1631 1631
                 $this->retirada->getElementsByTagName("CNPJ")->item(0)->nodeValue,
1632 1632
                 "###.###.###/####-##"
1633 1633
             );
1634 1634
         } else {
1635
-            $texto = ! empty($this->retirada->getElementsByTagName("CPF")->item(0)->nodeValue) ?
1635
+            $texto = !empty($this->retirada->getElementsByTagName("CPF")->item(0)->nodeValue) ?
1636 1636
                     $this->formatField(
1637 1637
                         $this->retirada->getElementsByTagName("CPF")->item(0)->nodeValue,
1638 1638
                         "###.###.###-##"
@@ -1642,7 +1642,7 @@  discard block
 block discarded – undo
1642 1642
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1643 1643
         //INSCRIÇÃO ESTADUAL
1644 1644
         $x += $w;
1645
-        $w = $maxW-($w1+$w2);
1645
+        $w = $maxW - ($w1 + $w2);
1646 1646
         $wx = $w;
1647 1647
         $texto = 'INSCRIÇÃO ESTADUAL';
1648 1648
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
@@ -1658,7 +1658,7 @@  discard block
 block discarded – undo
1658 1658
             $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 1, '');
1659 1659
         }
1660 1660
         //ENDEREÇO
1661
-        $w = round($maxW*0.355, 0) + $wx;
1661
+        $w = round($maxW * 0.355, 0) + $wx;
1662 1662
         $w1 = $w;
1663 1663
         $y += $h;
1664 1664
         $x = $oldX;
@@ -1672,7 +1672,7 @@  discard block
 block discarded – undo
1672 1672
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 0, '', true);
1673 1673
         //BAIRRO / DISTRITO
1674 1674
         $x += $w;
1675
-        $w = round($maxW*0.335, 0);
1675
+        $w = round($maxW * 0.335, 0);
1676 1676
         $w2 = $w;
1677 1677
         $texto = 'BAIRRO / DISTRITO';
1678 1678
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
@@ -1682,17 +1682,17 @@  discard block
 block discarded – undo
1682 1682
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1683 1683
         //CEP
1684 1684
         $x += $w;
1685
-        $w = $maxW-($w1+$w2);
1685
+        $w = $maxW - ($w1 + $w2);
1686 1686
         $texto = 'CEP';
1687 1687
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1688 1688
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1689
-        $texto = ! empty($this->retirada->getElementsByTagName("CEP")->item(0)->nodeValue) ?
1689
+        $texto = !empty($this->retirada->getElementsByTagName("CEP")->item(0)->nodeValue) ?
1690 1690
                 $this->retirada->getElementsByTagName("CEP")->item(0)->nodeValue : '';
1691 1691
         $texto = $this->formatField($texto, "#####-###");
1692 1692
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
1693 1693
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1694 1694
         //MUNICÍPIO
1695
-        $w = round($maxW*0.805, 0);
1695
+        $w = round($maxW * 0.805, 0);
1696 1696
         $w1 = $w;
1697 1697
         $y += $h;
1698 1698
         $x = $oldX;
@@ -1701,7 +1701,7 @@  discard block
 block discarded – undo
1701 1701
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1702 1702
         $texto = $this->retirada->getElementsByTagName("xMun")->item(0)->nodeValue;
1703 1703
         if (strtoupper(trim($texto)) == "EXTERIOR" && $this->retirada->getElementsByTagName("xPais")->length > 0) {
1704
-            $texto .= " - " .  $this->retirada->getElementsByTagName("xPais")->item(0)->nodeValue;
1704
+            $texto .= " - " . $this->retirada->getElementsByTagName("xPais")->item(0)->nodeValue;
1705 1705
         }
1706 1706
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
1707 1707
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 0, '');
@@ -1716,11 +1716,11 @@  discard block
 block discarded – undo
1716 1716
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1717 1717
         //FONE / FAX
1718 1718
         $x += $w;
1719
-        $w = $maxW-$w-$w1;
1719
+        $w = $maxW - $w - $w1;
1720 1720
         $texto = 'FONE / FAX';
1721 1721
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1722 1722
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1723
-        $texto = ! empty($this->retirada->getElementsByTagName("fone")->item(0)->nodeValue) ?
1723
+        $texto = !empty($this->retirada->getElementsByTagName("fone")->item(0)->nodeValue) ?
1724 1724
                 $this->retirada->getElementsByTagName("fone")->item(0)->nodeValue : '';
1725 1725
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
1726 1726
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
@@ -1793,7 +1793,7 @@  discard block
 block discarded – undo
1793 1793
     protected function fatura($x, $y)
1794 1794
     {
1795 1795
         $linha = 1;
1796
-        $h = 8+3;
1796
+        $h = 8 + 3;
1797 1797
         $oldx = $x;
1798 1798
         $textoFatura = $this->getTextoFatura();
1799 1799
         //verificar se existem duplicatas
@@ -1826,29 +1826,29 @@  discard block
 block discarded – undo
1826 1826
                 return ($y + $h - 3);
1827 1827
             }
1828 1828
             if ($textoFatura !== "" && $this->exibirTextoFatura) {
1829
-                $myH=6;
1829
+                $myH = 6;
1830 1830
                 $myW = $this->wPrint;
1831 1831
                 if ($this->orientacao == 'L') {
1832 1832
                     $myW -= $this->wCanhoto;
1833 1833
                 }
1834 1834
                 $aFont = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>''];
1835 1835
                 $this->pdf->textBox($x, $y, $myW, $myH, $textoFatura, $aFont, 'C', 'L', 1, '');
1836
-                $y+=$myH+1;
1836
+                $y += $myH + 1;
1837 1837
             }
1838 1838
             if ($this->orientacao == 'P') {
1839
-                $w = round($this->wPrint/7.018, 0)-1;
1839
+                $w = round($this->wPrint / 7.018, 0) - 1;
1840 1840
             } else {
1841 1841
                 $w = 28;
1842 1842
             }
1843 1843
             $increm = 1;
1844 1844
             foreach ($this->dup as $k => $d) {
1845
-                $nDup = ! empty($this->dup->item($k)->getElementsByTagName('nDup')->item(0)->nodeValue)
1845
+                $nDup = !empty($this->dup->item($k)->getElementsByTagName('nDup')->item(0)->nodeValue)
1846 1846
                 ? $this->dup->item($k)->getElementsByTagName('nDup')->item(0)->nodeValue
1847 1847
                 : '';
1848
-                $dDup = ! empty($this->dup->item($k)->getElementsByTagName('dVenc')->item(0)->nodeValue)
1848
+                $dDup = !empty($this->dup->item($k)->getElementsByTagName('dVenc')->item(0)->nodeValue)
1849 1849
                 ? $this->ymdTodmy($this->dup->item($k)->getElementsByTagName('dVenc')->item(0)->nodeValue)
1850 1850
                 : '';
1851
-                $vDup = ! empty($this->dup->item($k)->getElementsByTagName('vDup')->item(0)->nodeValue)
1851
+                $vDup = !empty($this->dup->item($k)->getElementsByTagName('vDup')->item(0)->nodeValue)
1852 1852
                 ? 'R$ ' . number_format(
1853 1853
                     $this->dup->item($k)->getElementsByTagName('vDup')->item(0)->nodeValue,
1854 1854
                     2,
@@ -1858,14 +1858,14 @@  discard block
 block discarded – undo
1858 1858
                 : '';
1859 1859
                 $h = 8;
1860 1860
                 $texto = '';
1861
-                if ($nDup!='0' && $nDup!='') {
1861
+                if ($nDup != '0' && $nDup != '') {
1862 1862
                     $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1863 1863
                     $this->pdf->textBox($x, $y, $w, $h, 'Num.', $aFont, 'T', 'L', 1, '');
1864 1864
                     $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
1865 1865
                     $this->pdf->textBox($x, $y, $w, $h, $nDup, $aFont, 'T', 'R', 0, '');
1866 1866
                 } else {
1867 1867
                     $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1868
-                    $this->pdf->textBox($x, $y, $w, $h, ($dupcont+1)."", $aFont, 'T', 'L', 1, '');
1868
+                    $this->pdf->textBox($x, $y, $w, $h, ($dupcont + 1) . "", $aFont, 'T', 'L', 1, '');
1869 1869
                 }
1870 1870
                 $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1871 1871
                 $this->pdf->textBox($x, $y, $w, $h, 'Venc.', $aFont, 'C', 'L', 0, '');
@@ -1875,7 +1875,7 @@  discard block
 block discarded – undo
1875 1875
                 $this->pdf->textBox($x, $y, $w, $h, 'Valor', $aFont, 'B', 'L', 0, '');
1876 1876
                 $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
1877 1877
                 $this->pdf->textBox($x, $y, $w, $h, $vDup, $aFont, 'B', 'R', 0, '');
1878
-                $x += $w+$increm;
1878
+                $x += $w + $increm;
1879 1879
                 $dupcont += 1;
1880 1880
                 if ($this->orientacao == 'P') {
1881 1881
                     $maxDupCont = 6;
@@ -1897,10 +1897,10 @@  discard block
 block discarded – undo
1897 1897
                 $y -= 9;
1898 1898
                 $linha--;
1899 1899
             }
1900
-            return ($y+$h);
1900
+            return ($y + $h);
1901 1901
         } else {
1902 1902
             $linha = 0;
1903
-            return ($y-2);
1903
+            return ($y - 2);
1904 1904
         }
1905 1905
     }
1906 1906
 
@@ -1916,13 +1916,13 @@  discard block
 block discarded – undo
1916 1916
     protected function pagamento($x, $y)
1917 1917
     {
1918 1918
         $linha = 1;
1919
-        $h = 8+3;
1919
+        $h = 8 + 3;
1920 1920
         $oldx = $x;
1921 1921
         //verificar se existem cobranças definidas
1922 1922
         if (isset($this->detPag) && $this->detPag->length > 0) {
1923 1923
             //#####################################################################
1924 1924
             //Tipo de pagamento
1925
-            $texto =  "PAGAMENTO";
1925
+            $texto = "PAGAMENTO";
1926 1926
             if ($this->orientacao == 'P') {
1927 1927
                 $w = $this->wPrint;
1928 1928
             } else {
@@ -1935,7 +1935,7 @@  discard block
 block discarded – undo
1935 1935
             $dups = "";
1936 1936
             $dupcont = 0;
1937 1937
             if ($this->orientacao == 'P') {
1938
-                $w = round($this->wPrint/7.018, 0)-1;
1938
+                $w = round($this->wPrint / 7.018, 0) - 1;
1939 1939
             } else {
1940 1940
                 $w = 28;
1941 1941
             }
@@ -1945,17 +1945,17 @@  discard block
 block discarded – undo
1945 1945
                 $maxDupCont = 8;
1946 1946
             }
1947 1947
             $increm = 1;
1948
-            $formaPagamento = ['01'=>'Dinheiro','02'=>'Cheque','03'=>'Cartão de Crédito',
1949
-                                    '04'=>'Cartão de Débito','05'=>'Crédito Loja','10'=>'Vale Alimentação',
1950
-                                    '11'=>'Vale Refeição','12'=>'Vale Presente','13'=>'Vale Combustível',
1951
-                                    '14'=>'Duplicata Mercantil','15'=>'Boleto','90'=>'Sem pagamento','99'=>'Outros'];
1952
-            $bandeira = ['01'=>'Visa','02'=>'Mastercard','03'=>'American','04'=>'Sorocred','05'=>'Diners',
1953
-                              '06'=>'Elo','07'=>'Hipercard','08'=>'Aura','09'=>'Cabal','99'=>'Outros'];
1948
+            $formaPagamento = ['01'=>'Dinheiro', '02'=>'Cheque', '03'=>'Cartão de Crédito',
1949
+                                    '04'=>'Cartão de Débito', '05'=>'Crédito Loja', '10'=>'Vale Alimentação',
1950
+                                    '11'=>'Vale Refeição', '12'=>'Vale Presente', '13'=>'Vale Combustível',
1951
+                                    '14'=>'Duplicata Mercantil', '15'=>'Boleto', '90'=>'Sem pagamento', '99'=>'Outros'];
1952
+            $bandeira = ['01'=>'Visa', '02'=>'Mastercard', '03'=>'American', '04'=>'Sorocred', '05'=>'Diners',
1953
+                              '06'=>'Elo', '07'=>'Hipercard', '08'=>'Aura', '09'=>'Cabal', '99'=>'Outros'];
1954 1954
             foreach ($this->detPag as $k => $d) {
1955 1955
                 $fPag = !empty($this->detPag->item($k)->getElementsByTagName('tPag')->item(0)->nodeValue)
1956 1956
                 ? $this->detPag->item($k)->getElementsByTagName('tPag')->item(0)->nodeValue
1957 1957
                 : '0';
1958
-                $vPag = ! empty($this->detPag->item($k)->getElementsByTagName('vPag')->item(0)->nodeValue)
1958
+                $vPag = !empty($this->detPag->item($k)->getElementsByTagName('vPag')->item(0)->nodeValue)
1959 1959
                 ? 'R$ ' . number_format(
1960 1960
                     $this->detPag->item($k)->getElementsByTagName('vPag')->item(0)->nodeValue,
1961 1961
                     2,
@@ -1967,7 +1967,7 @@  discard block
 block discarded – undo
1967 1967
                 $texto = '';
1968 1968
                 if (isset($formaPagamento[$fPag])) {
1969 1969
                     /*Exibir Item sem pagamento ou outros?*/
1970
-                    if ($fPag=='90' || $fPag=='99') {
1970
+                    if ($fPag == '90' || $fPag == '99') {
1971 1971
                         continue;
1972 1972
                     }
1973 1973
                     $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
@@ -1976,16 +1976,16 @@  discard block
 block discarded – undo
1976 1976
                     $this->pdf->textBox($x, $y, $w, $h, $formaPagamento[$fPag], $aFont, 'T', 'R', 0, '');
1977 1977
                 } else {
1978 1978
                     $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>''];
1979
-                    $this->pdf->textBox($x, $y, $w, $h, "Forma ".$fPag." não encontrado", $aFont, 'T', 'L', 1, '');
1979
+                    $this->pdf->textBox($x, $y, $w, $h, "Forma " . $fPag . " não encontrado", $aFont, 'T', 'L', 1, '');
1980 1980
                 }
1981 1981
                 $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1982 1982
                 $this->pdf->textBox($x, $y, $w, $h, 'Valor', $aFont, 'B', 'L', 0, '');
1983 1983
                 $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
1984 1984
                 $this->pdf->textBox($x, $y, $w, $h, $vPag, $aFont, 'B', 'R', 0, '');
1985
-                $x += $w+$increm;
1985
+                $x += $w + $increm;
1986 1986
                 $dupcont += 1;
1987 1987
 
1988
-                if ($dupcont>$maxDupCont) {
1988
+                if ($dupcont > $maxDupCont) {
1989 1989
                     $y += 9;
1990 1990
                     $x = $oldx;
1991 1991
                     $dupcont = 0;
@@ -2000,10 +2000,10 @@  discard block
 block discarded – undo
2000 2000
                 $y -= 9;
2001 2001
                 $linha--;
2002 2002
             }
2003
-            return ($y+$h);
2003
+            return ($y + $h);
2004 2004
         } else {
2005 2005
             $linha = 0;
2006
-            return ($y-2);
2006
+            return ($y - 2);
2007 2007
         }
2008 2008
     } //fim da função pagamento
2009 2009
     
@@ -2112,7 +2112,7 @@  discard block
 block discarded – undo
2112 2112
         }
2113 2113
         $x = $this->impostoHelper($x, $y, $w, $h, "V. TOTAL DA NOTA", "vNF");
2114 2114
 
2115
-        return ($y+$h);
2115
+        return ($y + $h);
2116 2116
     } //fim imposto
2117 2117
 
2118 2118
     /**
@@ -2140,13 +2140,13 @@  discard block
 block discarded – undo
2140 2140
         $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
2141 2141
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
2142 2142
         //NOME / RAZÃO SOCIAL
2143
-        $w1 = $maxW*0.29;
2143
+        $w1 = $maxW * 0.29;
2144 2144
         $y += 3;
2145 2145
         $texto = 'NOME / RAZÃO SOCIAL';
2146 2146
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2147 2147
         $this->pdf->textBox($x, $y, $w1, $h, $texto, $aFont, 'T', 'L', 1, '');
2148 2148
         if (isset($this->transporta)) {
2149
-            $texto = ! empty($this->transporta->getElementsByTagName("xNome")->item(0)->nodeValue)
2149
+            $texto = !empty($this->transporta->getElementsByTagName("xNome")->item(0)->nodeValue)
2150 2150
             ? $this->transporta->getElementsByTagName("xNome")->item(0)->nodeValue
2151 2151
             : '';
2152 2152
         } else {
@@ -2156,11 +2156,11 @@  discard block
 block discarded – undo
2156 2156
         $this->pdf->textBox($x, $y, $w1, $h, $texto, $aFont, 'B', 'L', 0, '');
2157 2157
         //FRETE POR CONTA
2158 2158
         $x += $w1;
2159
-        $w2 = $maxW*0.15;
2159
+        $w2 = $maxW * 0.15;
2160 2160
         $texto = 'FRETE';
2161 2161
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2162 2162
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
2163
-        $tipoFrete = ! empty($this->transp->getElementsByTagName("modFrete")->item(0)->nodeValue)
2163
+        $tipoFrete = !empty($this->transp->getElementsByTagName("modFrete")->item(0)->nodeValue)
2164 2164
         ? $this->transp->getElementsByTagName("modFrete")->item(0)->nodeValue
2165 2165
         : '0';
2166 2166
         switch ($tipoFrete) {
@@ -2191,7 +2191,7 @@  discard block
 block discarded – undo
2191 2191
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2192 2192
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
2193 2193
         if (isset($this->veicTransp)) {
2194
-            $texto = ! empty($this->veicTransp->getElementsByTagName("RNTC")->item(0)->nodeValue)
2194
+            $texto = !empty($this->veicTransp->getElementsByTagName("RNTC")->item(0)->nodeValue)
2195 2195
             ? $this->veicTransp->getElementsByTagName("RNTC")->item(0)->nodeValue
2196 2196
             : '';
2197 2197
         } else {
@@ -2205,11 +2205,11 @@  discard block
 block discarded – undo
2205 2205
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2206 2206
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
2207 2207
         if (isset($this->veicTransp)) {
2208
-            $texto = ! empty($this->veicTransp->getElementsByTagName("placa")->item(0)->nodeValue)
2208
+            $texto = !empty($this->veicTransp->getElementsByTagName("placa")->item(0)->nodeValue)
2209 2209
             ? $this->veicTransp->getElementsByTagName("placa")->item(0)->nodeValue
2210 2210
             : '';
2211 2211
         } elseif (isset($this->reboque)) {
2212
-            $texto = ! empty($this->reboque->getElementsByTagName("placa")->item(0)->nodeValue)
2212
+            $texto = !empty($this->reboque->getElementsByTagName("placa")->item(0)->nodeValue)
2213 2213
             ? $this->reboque->getElementsByTagName("placa")->item(0)->nodeValue
2214 2214
             : '';
2215 2215
         } else {
@@ -2219,16 +2219,16 @@  discard block
 block discarded – undo
2219 2219
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'B', 'C', 0, '');
2220 2220
         //UF
2221 2221
         $x += $w2;
2222
-        $w3 = round($maxW*0.04, 0);
2222
+        $w3 = round($maxW * 0.04, 0);
2223 2223
         $texto = 'UF';
2224 2224
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2225 2225
         $this->pdf->textBox($x, $y, $w3, $h, $texto, $aFont, 'T', 'L', 1, '');
2226 2226
         if (isset($this->veicTransp)) {
2227
-            $texto = ! empty($this->veicTransp->getElementsByTagName("UF")->item(0)->nodeValue)
2227
+            $texto = !empty($this->veicTransp->getElementsByTagName("UF")->item(0)->nodeValue)
2228 2228
             ? $this->veicTransp->getElementsByTagName("UF")->item(0)->nodeValue
2229 2229
             : '';
2230 2230
         } elseif (isset($this->reboque)) {
2231
-            $texto = ! empty($this->reboque->getElementsByTagName("UF")->item(0)->nodeValue)
2231
+            $texto = !empty($this->reboque->getElementsByTagName("UF")->item(0)->nodeValue)
2232 2232
             ? $this->reboque->getElementsByTagName("UF")->item(0)->nodeValue
2233 2233
             : '';
2234 2234
         } else {
@@ -2238,19 +2238,19 @@  discard block
 block discarded – undo
2238 2238
         $this->pdf->textBox($x, $y, $w3, $h, $texto, $aFont, 'B', 'C', 0, '');
2239 2239
         //CNPJ / CPF
2240 2240
         $x += $w3;
2241
-        $w = $maxW-($w1+3*$w2+$w3);
2241
+        $w = $maxW - ($w1 + 3 * $w2 + $w3);
2242 2242
         $texto = 'CNPJ / CPF';
2243 2243
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2244 2244
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
2245 2245
         if (isset($this->transporta)) {
2246
-            $texto = ! empty($this->transporta->getElementsByTagName("CNPJ")->item(0)->nodeValue)
2246
+            $texto = !empty($this->transporta->getElementsByTagName("CNPJ")->item(0)->nodeValue)
2247 2247
             ? $this->formatField(
2248 2248
                 $this->transporta->getElementsByTagName("CNPJ")->item(0)->nodeValue,
2249 2249
                 "##.###.###/####-##"
2250 2250
             )
2251 2251
             : '';
2252 2252
             if ($texto == '') {
2253
-                $texto = ! empty($this->transporta->getElementsByTagName("CPF")->item(0)->nodeValue)
2253
+                $texto = !empty($this->transporta->getElementsByTagName("CPF")->item(0)->nodeValue)
2254 2254
                 ? $this->formatField(
2255 2255
                     $this->transporta->getElementsByTagName("CPF")->item(0)->nodeValue,
2256 2256
                     "###.###.###-##"
@@ -2267,12 +2267,12 @@  discard block
 block discarded – undo
2267 2267
         $y += $h;
2268 2268
         $x = $oldX;
2269 2269
         $h = 7;
2270
-        $w1 = $maxW*0.44;
2270
+        $w1 = $maxW * 0.44;
2271 2271
         $texto = 'ENDEREÇO';
2272 2272
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2273 2273
         $this->pdf->textBox($x, $y, $w1, $h, $texto, $aFont, 'T', 'L', 1, '');
2274 2274
         if (isset($this->transporta)) {
2275
-            $texto = ! empty($this->transporta->getElementsByTagName("xEnder")->item(0)->nodeValue)
2275
+            $texto = !empty($this->transporta->getElementsByTagName("xEnder")->item(0)->nodeValue)
2276 2276
                 ? $this->transporta->getElementsByTagName("xEnder")->item(0)->nodeValue
2277 2277
                 : '';
2278 2278
         } else {
@@ -2282,12 +2282,12 @@  discard block
 block discarded – undo
2282 2282
         $this->pdf->textBox($x, $y, $w1, $h, $texto, $aFont, 'B', 'L', 0, '');
2283 2283
         //MUNICÍPIO
2284 2284
         $x += $w1;
2285
-        $w2 = round($maxW*0.30, 0);
2285
+        $w2 = round($maxW * 0.30, 0);
2286 2286
         $texto = 'MUNICÍPIO';
2287 2287
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2288 2288
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
2289 2289
         if (isset($this->transporta)) {
2290
-            $texto = ! empty($this->transporta->getElementsByTagName("xMun")->item(0)->nodeValue)
2290
+            $texto = !empty($this->transporta->getElementsByTagName("xMun")->item(0)->nodeValue)
2291 2291
                 ? $this->transporta->getElementsByTagName("xMun")->item(0)->nodeValue
2292 2292
                 : '';
2293 2293
         } else {
@@ -2297,12 +2297,12 @@  discard block
 block discarded – undo
2297 2297
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'B', 'C', 0, '');
2298 2298
         //UF
2299 2299
         $x += $w2;
2300
-        $w3 = round($maxW*0.04, 0);
2300
+        $w3 = round($maxW * 0.04, 0);
2301 2301
         $texto = 'UF';
2302 2302
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2303 2303
         $this->pdf->textBox($x, $y, $w3, $h, $texto, $aFont, 'T', 'L', 1, '');
2304 2304
         if (isset($this->transporta)) {
2305
-            $texto = ! empty($this->transporta->getElementsByTagName("UF")->item(0)->nodeValue)
2305
+            $texto = !empty($this->transporta->getElementsByTagName("UF")->item(0)->nodeValue)
2306 2306
                 ? $this->transporta->getElementsByTagName("UF")->item(0)->nodeValue
2307 2307
                 : '';
2308 2308
         } else {
@@ -2312,13 +2312,13 @@  discard block
 block discarded – undo
2312 2312
         $this->pdf->textBox($x, $y, $w3, $h, $texto, $aFont, 'B', 'C', 0, '');
2313 2313
         //INSCRIÇÃO ESTADUAL
2314 2314
         $x += $w3;
2315
-        $w = $maxW-($w1+$w2+$w3);
2315
+        $w = $maxW - ($w1 + $w2 + $w3);
2316 2316
         $texto = 'INSCRIÇÃO ESTADUAL';
2317 2317
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2318 2318
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
2319 2319
         $texto = '';
2320 2320
         if (isset($this->transporta)) {
2321
-            if (! empty($this->transporta->getElementsByTagName("IE")->item(0)->nodeValue)) {
2321
+            if (!empty($this->transporta->getElementsByTagName("IE")->item(0)->nodeValue)) {
2322 2322
                 $texto = $this->transporta->getElementsByTagName("IE")->item(0)->nodeValue;
2323 2323
             }
2324 2324
         }
@@ -2331,16 +2331,16 @@  discard block
 block discarded – undo
2331 2331
         $marca = '';
2332 2332
         $numero = '';
2333 2333
         $texto = '';
2334
-        $pesoBruto=0;
2335
-        $pesoLiquido=0;
2334
+        $pesoBruto = 0;
2335
+        $pesoLiquido = 0;
2336 2336
         foreach ($volumes as $volume) {
2337
-            $quantidade += ! empty($volume->getElementsByTagName("qVol")->item(0)->nodeValue) ?
2337
+            $quantidade += !empty($volume->getElementsByTagName("qVol")->item(0)->nodeValue) ?
2338 2338
                     $volume->getElementsByTagName("qVol")->item(0)->nodeValue : 0;
2339
-            $pesoBruto += ! empty($volume->getElementsByTagName("pesoB")->item(0)->nodeValue) ?
2339
+            $pesoBruto += !empty($volume->getElementsByTagName("pesoB")->item(0)->nodeValue) ?
2340 2340
                     $volume->getElementsByTagName("pesoB")->item(0)->nodeValue : 0;
2341
-            $pesoLiquido += ! empty($volume->getElementsByTagName("pesoL")->item(0)->nodeValue) ?
2341
+            $pesoLiquido += !empty($volume->getElementsByTagName("pesoL")->item(0)->nodeValue) ?
2342 2342
                     $volume->getElementsByTagName("pesoL")->item(0)->nodeValue : 0;
2343
-            $texto = ! empty($this->transp->getElementsByTagName("esp")->item(0)->nodeValue) ?
2343
+            $texto = !empty($this->transp->getElementsByTagName("esp")->item(0)->nodeValue) ?
2344 2344
                     $this->transp->getElementsByTagName("esp")->item(0)->nodeValue : '';
2345 2345
             if ($texto != $especie && $especie != '') {
2346 2346
                 //tem várias especies
@@ -2348,7 +2348,7 @@  discard block
 block discarded – undo
2348 2348
             } else {
2349 2349
                 $especie = $texto;
2350 2350
             }
2351
-            $texto = ! empty($this->transp->getElementsByTagName("marca")->item(0)->nodeValue)
2351
+            $texto = !empty($this->transp->getElementsByTagName("marca")->item(0)->nodeValue)
2352 2352
                 ? $this->transp->getElementsByTagName("marca")->item(0)->nodeValue
2353 2353
                 : '';
2354 2354
             if ($texto != $marca && $marca != '') {
@@ -2357,7 +2357,7 @@  discard block
 block discarded – undo
2357 2357
             } else {
2358 2358
                 $marca = $texto;
2359 2359
             }
2360
-            $texto = ! empty($this->transp->getElementsByTagName("nVol")->item(0)->nodeValue)
2360
+            $texto = !empty($this->transp->getElementsByTagName("nVol")->item(0)->nodeValue)
2361 2361
                 ? $this->transp->getElementsByTagName("nVol")->item(0)->nodeValue
2362 2362
                 : '';
2363 2363
             if ($texto != $numero && $numero != '') {
@@ -2373,7 +2373,7 @@  discard block
 block discarded – undo
2373 2373
         $y += $h;
2374 2374
         $x = $oldX;
2375 2375
         $h = 7;
2376
-        $w1 = round($maxW*0.10, 0);
2376
+        $w1 = round($maxW * 0.10, 0);
2377 2377
         $texto = 'QUANTIDADE';
2378 2378
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2379 2379
         $this->pdf->textBox($x, $y, $w1, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -2384,7 +2384,7 @@  discard block
 block discarded – undo
2384 2384
         }
2385 2385
         //ESPÉCIE
2386 2386
         $x += $w1;
2387
-        $w2 = round($maxW*0.17, 0);
2387
+        $w2 = round($maxW * 0.17, 0);
2388 2388
         $texto = 'ESPÉCIE';
2389 2389
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2390 2390
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -2396,7 +2396,7 @@  discard block
 block discarded – undo
2396 2396
         $texto = 'MARCA';
2397 2397
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2398 2398
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
2399
-        $texto = ! empty($this->transp->getElementsByTagName("marca")->item(0)->nodeValue) ?
2399
+        $texto = !empty($this->transp->getElementsByTagName("marca")->item(0)->nodeValue) ?
2400 2400
                 $this->transp->getElementsByTagName("marca")->item(0)->nodeValue : '';
2401 2401
         $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'];
2402 2402
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'B', 'C', 0, '');
@@ -2410,7 +2410,7 @@  discard block
 block discarded – undo
2410 2410
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'B', 'C', 0, '');
2411 2411
         //PESO BRUTO
2412 2412
         $x += $w2;
2413
-        $w3 = round($maxW*0.20, 0);
2413
+        $w3 = round($maxW * 0.20, 0);
2414 2414
         $texto = 'PESO BRUTO';
2415 2415
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2416 2416
         $this->pdf->textBox($x, $y, $w3, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -2423,7 +2423,7 @@  discard block
 block discarded – undo
2423 2423
         $this->pdf->textBox($x, $y, $w3, $h, $texto, $aFont, 'B', 'R', 0, '');
2424 2424
         //PESO LÍQUIDO
2425 2425
         $x += $w3;
2426
-        $w = $maxW -($w1+3*$w2+$w3);
2426
+        $w = $maxW - ($w1 + 3 * $w2 + $w3);
2427 2427
         $texto = 'PESO LÍQUIDO';
2428 2428
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2429 2429
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -2434,7 +2434,7 @@  discard block
 block discarded – undo
2434 2434
         }
2435 2435
         $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'];
2436 2436
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'R', 0, '');
2437
-        return ($y+$h);
2437
+        return ($y + $h);
2438 2438
     } //fim transporte
2439 2439
 
2440 2440
 
@@ -2446,7 +2446,7 @@  discard block
 block discarded – undo
2446 2446
             return "";
2447 2447
         }
2448 2448
         $valor_original = $valor_original->nodeValue;
2449
-        $valor = ! empty($valor_original) ? number_format($valor_original, 2, ",", ".") : '';
2449
+        $valor = !empty($valor_original) ? number_format($valor_original, 2, ",", ".") : '';
2450 2450
 
2451 2451
         if ($valor != "") {
2452 2452
             return sprintf($formato, $valor);
@@ -2493,18 +2493,18 @@  discard block
 block discarded – undo
2493 2493
             $impostos .= $this->descricaoProdutoHelper($ICMSUFDest, "vICMSUFDest", " vICMSUFDest=%s");
2494 2494
             $impostos .= $this->descricaoProdutoHelper($ICMSUFDest, "vICMSUFRemet", " vICMSUFRemet=%s");
2495 2495
         }
2496
-        $infAdProd = ! empty($itemProd->getElementsByTagName('infAdProd')->item(0)->nodeValue)
2496
+        $infAdProd = !empty($itemProd->getElementsByTagName('infAdProd')->item(0)->nodeValue)
2497 2497
         ? substr(
2498 2498
             $this->anfaveaDANFE($itemProd->getElementsByTagName('infAdProd')->item(0)->nodeValue),
2499 2499
             0,
2500 2500
             500
2501 2501
         )
2502 2502
         : '';
2503
-        if (! empty($infAdProd)) {
2503
+        if (!empty($infAdProd)) {
2504 2504
             $infAdProd = trim($infAdProd);
2505 2505
             $infAdProd .= ' ';
2506 2506
         }
2507
-        $loteTxt ='';
2507
+        $loteTxt = '';
2508 2508
         $rastro = $prod->getElementsByTagName("med");
2509 2509
         if (!empty($prod->getElementsByTagName("rastro"))) {
2510 2510
             $rastro = $prod->getElementsByTagName("rastro");
@@ -2518,15 +2518,15 @@  discard block
 block discarded – undo
2518 2518
                 $i++;
2519 2519
             }
2520 2520
             if ($loteTxt != '') {
2521
-                $loteTxt.= ' ';
2521
+                $loteTxt .= ' ';
2522 2522
             }
2523 2523
         }
2524 2524
         //NT2013.006 FCI
2525
-        $nFCI = (! empty($itemProd->getElementsByTagName('nFCI')->item(0)->nodeValue)) ?
2526
-                ' FCI:'.$itemProd->getElementsByTagName('nFCI')->item(0)->nodeValue : '';
2527
-        $tmp_ad=$infAdProd . ($this->descProdInfoComplemento ? $loteTxt . $impostos . $nFCI : '');
2525
+        $nFCI = (!empty($itemProd->getElementsByTagName('nFCI')->item(0)->nodeValue)) ?
2526
+                ' FCI:' . $itemProd->getElementsByTagName('nFCI')->item(0)->nodeValue : '';
2527
+        $tmp_ad = $infAdProd . ($this->descProdInfoComplemento ? $loteTxt . $impostos . $nFCI : '');
2528 2528
         $texto = $prod->getElementsByTagName("xProd")->item(0)->nodeValue
2529
-            . (strlen($tmp_ad)!=0?"\n    ".$tmp_ad:'');
2529
+            . (strlen($tmp_ad) != 0 ? "\n    " . $tmp_ad : '');
2530 2530
         //decodifica os caracteres html no xml
2531 2531
         $texto = html_entity_decode($texto);
2532 2532
         if ($this->descProdQuebraLinha) {
@@ -2577,111 +2577,111 @@  discard block
 block discarded – undo
2577 2577
         // cabecalho LOOP COM OS DADOS DOS PRODUTOS
2578 2578
         //CÓDIGO PRODUTO
2579 2579
         $texto = "CÓDIGO PRODUTO";
2580
-        $w1 = round($w*0.09, 0);
2580
+        $w1 = round($w * 0.09, 0);
2581 2581
         $h = 4;
2582 2582
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2583 2583
         $this->pdf->textBox($x, $y, $w1, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2584
-        $this->pdf->line($x+$w1, $y, $x+$w1, $y+$hmax);
2584
+        $this->pdf->line($x + $w1, $y, $x + $w1, $y + $hmax);
2585 2585
         //DESCRIÇÃO DO PRODUTO / SERVIÇO
2586 2586
         $x += $w1;
2587
-        $w2 = round($w*0.25, 0);
2587
+        $w2 = round($w * 0.25, 0);
2588 2588
         $texto = 'DESCRIÇÃO DO PRODUTO / SERVIÇO';
2589 2589
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2590 2590
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2591
-        $this->pdf->line($x+$w2, $y, $x+$w2, $y+$hmax);
2591
+        $this->pdf->line($x + $w2, $y, $x + $w2, $y + $hmax);
2592 2592
         //NCM/SH
2593 2593
         $x += $w2;
2594
-        $w3 = round($w*0.06, 0);
2594
+        $w3 = round($w * 0.06, 0);
2595 2595
         $texto = 'NCM/SH';
2596 2596
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2597 2597
         $this->pdf->textBox($x, $y, $w3, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2598
-        $this->pdf->line($x+$w3, $y, $x+$w3, $y+$hmax);
2598
+        $this->pdf->line($x + $w3, $y, $x + $w3, $y + $hmax);
2599 2599
         //O/CST ou O/CSOSN
2600 2600
         $x += $w3;
2601
-        $w4 = round($w*0.05, 0);
2602
-        $texto = 'O/CSOSN';//Regime do Simples CRT = 1 ou CRT = 2
2601
+        $w4 = round($w * 0.05, 0);
2602
+        $texto = 'O/CSOSN'; //Regime do Simples CRT = 1 ou CRT = 2
2603 2603
         if ($this->getTagValue($this->emit, 'CRT') == '3') {
2604
-             $texto = 'O/CST';//Regime Normal
2604
+             $texto = 'O/CST'; //Regime Normal
2605 2605
         }
2606 2606
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2607 2607
         $this->pdf->textBox($x, $y, $w4, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2608
-        $this->pdf->line($x+$w4, $y, $x+$w4, $y+$hmax);
2608
+        $this->pdf->line($x + $w4, $y, $x + $w4, $y + $hmax);
2609 2609
         //CFOP
2610 2610
         $x += $w4;
2611
-        $w5 = round($w*0.04, 0);
2611
+        $w5 = round($w * 0.04, 0);
2612 2612
         $texto = 'CFOP';
2613 2613
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2614 2614
         $this->pdf->textBox($x, $y, $w5, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2615
-        $this->pdf->line($x+$w5, $y, $x+$w5, $y+$hmax);
2615
+        $this->pdf->line($x + $w5, $y, $x + $w5, $y + $hmax);
2616 2616
         //UN
2617 2617
         $x += $w5;
2618
-        $w6 = round($w*0.03, 0);
2618
+        $w6 = round($w * 0.03, 0);
2619 2619
         $texto = 'UN';
2620 2620
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2621 2621
         $this->pdf->textBox($x, $y, $w6, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2622
-        $this->pdf->line($x+$w6, $y, $x+$w6, $y+$hmax);
2622
+        $this->pdf->line($x + $w6, $y, $x + $w6, $y + $hmax);
2623 2623
         //QUANT
2624 2624
         $x += $w6;
2625
-        $w7 = round($w*0.08, 0);
2625
+        $w7 = round($w * 0.08, 0);
2626 2626
         $texto = 'QUANT';
2627 2627
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2628 2628
         $this->pdf->textBox($x, $y, $w7, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2629
-        $this->pdf->line($x+$w7, $y, $x+$w7, $y+$hmax);
2629
+        $this->pdf->line($x + $w7, $y, $x + $w7, $y + $hmax);
2630 2630
         //VALOR UNIT
2631 2631
         $x += $w7;
2632
-        $w8 = round($w*0.06, 0);
2632
+        $w8 = round($w * 0.06, 0);
2633 2633
         $texto = 'VALOR UNIT';
2634 2634
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2635 2635
         $this->pdf->textBox($x, $y, $w8, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2636
-        $this->pdf->line($x+$w8, $y, $x+$w8, $y+$hmax);
2636
+        $this->pdf->line($x + $w8, $y, $x + $w8, $y + $hmax);
2637 2637
         //VALOR TOTAL
2638 2638
         $x += $w8;
2639
-        $w9 = round($w*0.06, 0);
2639
+        $w9 = round($w * 0.06, 0);
2640 2640
         $texto = 'VALOR TOTAL';
2641 2641
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2642 2642
         $this->pdf->textBox($x, $y, $w9, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2643
-        $this->pdf->line($x+$w9, $y, $x+$w9, $y+$hmax);
2643
+        $this->pdf->line($x + $w9, $y, $x + $w9, $y + $hmax);
2644 2644
         //VALOR DESCONTO
2645 2645
         $x += $w9;
2646
-        $w10 = round($w*0.05, 0);
2646
+        $w10 = round($w * 0.05, 0);
2647 2647
         $texto = 'VALOR DESC';
2648 2648
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2649 2649
         $this->pdf->textBox($x, $y, $w10, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2650
-        $this->pdf->line($x+$w10, $y, $x+$w10, $y+$hmax);
2650
+        $this->pdf->line($x + $w10, $y, $x + $w10, $y + $hmax);
2651 2651
         //B.CÁLC ICMS
2652 2652
         $x += $w10;
2653
-        $w11 = round($w*0.06, 0);
2653
+        $w11 = round($w * 0.06, 0);
2654 2654
         $texto = 'B.CÁLC ICMS';
2655 2655
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2656 2656
         $this->pdf->textBox($x, $y, $w11, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2657
-        $this->pdf->line($x+$w11, $y, $x+$w11, $y+$hmax);
2657
+        $this->pdf->line($x + $w11, $y, $x + $w11, $y + $hmax);
2658 2658
         //VALOR ICMS
2659 2659
         $x += $w11;
2660
-        $w12 = round($w*0.06, 0);
2660
+        $w12 = round($w * 0.06, 0);
2661 2661
         $texto = 'VALOR ICMS';
2662 2662
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2663 2663
         $this->pdf->textBox($x, $y, $w12, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2664
-        $this->pdf->line($x+$w12, $y, $x+$w12, $y+$hmax);
2664
+        $this->pdf->line($x + $w12, $y, $x + $w12, $y + $hmax);
2665 2665
         //VALOR IPI
2666 2666
         $x += $w12;
2667
-        $w13 = round($w*0.05, 0);
2667
+        $w13 = round($w * 0.05, 0);
2668 2668
         $texto = 'VALOR IPI';
2669 2669
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2670 2670
         $this->pdf->textBox($x, $y, $w13, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2671
-        $this->pdf->line($x+$w13, $y, $x+$w13, $y+$hmax);
2671
+        $this->pdf->line($x + $w13, $y, $x + $w13, $y + $hmax);
2672 2672
         //ALÍQ. ICMS
2673 2673
         $x += $w13;
2674
-        $w14 = round($w*0.04, 0);
2674
+        $w14 = round($w * 0.04, 0);
2675 2675
         $texto = 'ALÍQ. ICMS';
2676 2676
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2677 2677
         $this->pdf->textBox($x, $y, $w14, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2678
-        $this->pdf->line($x+$w14, $y, $x+$w14, $y+$hmax);
2678
+        $this->pdf->line($x + $w14, $y, $x + $w14, $y + $hmax);
2679 2679
         //ALÍQ. IPI
2680 2680
         $x += $w14;
2681
-        $w15 = $w-($w1+$w2+$w3+$w4+$w5+$w6+$w7+$w8+$w9+$w10+$w11+$w12+$w13+$w14);
2681
+        $w15 = $w - ($w1 + $w2 + $w3 + $w4 + $w5 + $w6 + $w7 + $w8 + $w9 + $w10 + $w11 + $w12 + $w13 + $w14);
2682 2682
         $texto = 'ALÍQ. IPI';
2683 2683
         $this->pdf->textBox($x, $y, $w15, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2684
-        $this->pdf->line($oldX, $y+$h+1, $oldX + $w, $y+$h+1);
2684
+        $this->pdf->line($oldX, $y + $h + 1, $oldX + $w, $y + $h + 1);
2685 2685
         $y += 5;
2686 2686
         //##################################################################################
2687 2687
         // LOOP COM OS DADOS DOS PRODUTOS
@@ -2720,11 +2720,11 @@  discard block
 block discarded – undo
2720 2720
                         break;
2721 2721
                     }
2722 2722
                 }
2723
-                $y_linha=$y+$h;
2723
+                $y_linha = $y + $h;
2724 2724
                 // linha entre itens
2725 2725
                 $this->pdf->dashedHLine($oldX, $y_linha, $w, 0.1, 120);
2726 2726
                 //corrige o x
2727
-                $x=$oldX;
2727
+                $x = $oldX;
2728 2728
                 //codigo do produto
2729 2729
                 $guup = $i + 1;
2730 2730
                 $texto = $prod->getElementsByTagName("cProd")->item(0)->nodeValue;
@@ -2738,16 +2738,16 @@  discard block
 block discarded – undo
2738 2738
                 }
2739 2739
                 $x += $w2;
2740 2740
                 //NCM
2741
-                $texto = ! empty($prod->getElementsByTagName("NCM")->item(0)->nodeValue) ?
2741
+                $texto = !empty($prod->getElementsByTagName("NCM")->item(0)->nodeValue) ?
2742 2742
                         $prod->getElementsByTagName("NCM")->item(0)->nodeValue : '';
2743 2743
                 $this->pdf->textBox($x, $y, $w3, $h, $texto, $aFont, 'T', 'C', 0, '');
2744 2744
                 $x += $w3;
2745 2745
                 //CST
2746 2746
                 if (isset($ICMS)) {
2747
-                    $origem =  $this->getTagValue($ICMS, "orig");
2748
-                    $cst =  $this->getTagValue($ICMS, "CST");
2749
-                    $csosn =  $this->getTagValue($ICMS, "CSOSN");
2750
-                    $texto = $origem.$cst.$csosn;
2747
+                    $origem = $this->getTagValue($ICMS, "orig");
2748
+                    $cst = $this->getTagValue($ICMS, "CST");
2749
+                    $csosn = $this->getTagValue($ICMS, "CSOSN");
2750
+                    $texto = $origem . $cst . $csosn;
2751 2751
                     $this->pdf->textBox($x, $y, $w4, $h, $texto, $aFont, 'T', 'C', 0, '');
2752 2752
                 }
2753 2753
                 //CFOP
@@ -2814,7 +2814,7 @@  discard block
 block discarded – undo
2814 2814
                 //Valor da Base de calculo
2815 2815
                 $x += $w10;
2816 2816
                 if (isset($ICMS)) {
2817
-                    $texto = ! empty($ICMS->getElementsByTagName("vBC")->item(0)->nodeValue)
2817
+                    $texto = !empty($ICMS->getElementsByTagName("vBC")->item(0)->nodeValue)
2818 2818
                     ? number_format(
2819 2819
                         $ICMS->getElementsByTagName("vBC")->item(0)->nodeValue,
2820 2820
                         2,
@@ -2827,7 +2827,7 @@  discard block
 block discarded – undo
2827 2827
                 //Valor do ICMS
2828 2828
                 $x += $w11;
2829 2829
                 if (isset($ICMS)) {
2830
-                    $texto = ! empty($ICMS->getElementsByTagName("vICMS")->item(0)->nodeValue)
2830
+                    $texto = !empty($ICMS->getElementsByTagName("vICMS")->item(0)->nodeValue)
2831 2831
                     ? number_format(
2832 2832
                         $ICMS->getElementsByTagName("vICMS")->item(0)->nodeValue,
2833 2833
                         2,
@@ -2840,7 +2840,7 @@  discard block
 block discarded – undo
2840 2840
                 //Valor do IPI
2841 2841
                 $x += $w12;
2842 2842
                 if (isset($IPI)) {
2843
-                    $texto = ! empty($IPI->getElementsByTagName("vIPI")->item(0)->nodeValue)
2843
+                    $texto = !empty($IPI->getElementsByTagName("vIPI")->item(0)->nodeValue)
2844 2844
                     ? number_format(
2845 2845
                         $IPI->getElementsByTagName("vIPI")->item(0)->nodeValue,
2846 2846
                         2,
@@ -2855,7 +2855,7 @@  discard block
 block discarded – undo
2855 2855
                 // %ICMS
2856 2856
                 $x += $w13;
2857 2857
                 if (isset($ICMS)) {
2858
-                    $texto = ! empty($ICMS->getElementsByTagName("pICMS")->item(0)->nodeValue)
2858
+                    $texto = !empty($ICMS->getElementsByTagName("pICMS")->item(0)->nodeValue)
2859 2859
                     ? number_format(
2860 2860
                         $ICMS->getElementsByTagName("pICMS")->item(0)->nodeValue,
2861 2861
                         2,
@@ -2868,7 +2868,7 @@  discard block
 block discarded – undo
2868 2868
                 //%IPI
2869 2869
                 $x += $w14;
2870 2870
                 if (isset($IPI)) {
2871
-                    $texto = ! empty($IPI->getElementsByTagName("pIPI")->item(0)->nodeValue)
2871
+                    $texto = !empty($IPI->getElementsByTagName("pIPI")->item(0)->nodeValue)
2872 2872
                     ? number_format(
2873 2873
                         $IPI->getElementsByTagName("pIPI")->item(0)->nodeValue,
2874 2874
                         2,
@@ -2899,7 +2899,7 @@  discard block
 block discarded – undo
2899 2899
                 $i++;
2900 2900
             }
2901 2901
         }
2902
-        return $oldY+$hmax;
2902
+        return $oldY + $hmax;
2903 2903
     }
2904 2904
 
2905 2905
 
@@ -2933,7 +2933,7 @@  discard block
 block discarded – undo
2933 2933
 
2934 2934
         $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>''];
2935 2935
 
2936
-        $w1 = round($w*0.09, 0);
2936
+        $w1 = round($w * 0.09, 0);
2937 2937
 
2938 2938
         // Tabela Renavam Combustivel
2939 2939
         $renavamCombustivel = [
@@ -3028,54 +3028,54 @@  discard block
 block discarded – undo
3028 3028
 
3029 3029
         $yVeic = $y + $h;
3030 3030
         $texto = 'Chassi: ............: ' . $veiculoChassi;
3031
-        $this->pdf->textBox($x, $yVeic, $w1+40, $h, $texto, $aFont, 'T', 'L', 0, '');
3031
+        $this->pdf->textBox($x, $yVeic, $w1 + 40, $h, $texto, $aFont, 'T', 'L', 0, '');
3032 3032
         $yVeic += $h;
3033 3033
         $texto = 'Cor...................: ' . $veiculoCor;
3034
-        $this->pdf->textBox($x, $yVeic, $w1+40, $h, $texto, $aFont, 'T', 'L', 0, '');
3034
+        $this->pdf->textBox($x, $yVeic, $w1 + 40, $h, $texto, $aFont, 'T', 'L', 0, '');
3035 3035
         $yVeic += $h;
3036 3036
         $texto = 'Cilindrada........: ' . $veiculoCilindrada;
3037
-        $this->pdf->textBox($x, $yVeic, $w1+40, $h, $texto, $aFont, 'T', 'L', 0, '');
3037
+        $this->pdf->textBox($x, $yVeic, $w1 + 40, $h, $texto, $aFont, 'T', 'L', 0, '');
3038 3038
         $yVeic += $h;
3039 3039
         $texto = 'Cmkg...............: ' . $veiculoCmkg;
3040
-        $this->pdf->textBox($x, $yVeic, $w1+40, $h, $texto, $aFont, 'T', 'L', 0, '');
3040
+        $this->pdf->textBox($x, $yVeic, $w1 + 40, $h, $texto, $aFont, 'T', 'L', 0, '');
3041 3041
         $yVeic += $h;
3042 3042
         $texto = 'Tipo.................: ' . ($renavamTiposVeiculos[intval($veiculoTipo)] ?? $veiculoTipo);
3043
-         $this->pdf->textBox($x, $yVeic, $w1+40, $h, $texto, $aFont, 'T', 'L', 0, '');
3043
+         $this->pdf->textBox($x, $yVeic, $w1 + 40, $h, $texto, $aFont, 'T', 'L', 0, '');
3044 3044
         $yVeic = $y + $h;
3045 3045
         $xVeic = $x + 65;
3046 3046
         $texto = 'Nº Motor: .........: ' . $veiculoMotor;
3047
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
3047
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
3048 3048
         $yVeic += $h;
3049 3049
         $texto = 'Renavam...........: ' . $veiculoRenavam;
3050
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
3050
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
3051 3051
         $yVeic += $h;
3052 3052
         $texto = 'HP.....................: ' . $veiculoHp;
3053
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
3053
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
3054 3054
         $yVeic += $h;
3055 3055
         $texto = 'Placa.................: ' . $veiculoPlaca;
3056
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
3056
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
3057 3057
         $yVeic += $h;
3058 3058
         $texto = 'Tipo Pintura......: ' . ($renavamEspecie[intval($veiculoTipoPintura)] ?? $veiculoTipoPintura);
3059
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
3059
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
3060 3060
         $yVeic = $y + $h;
3061 3061
         $xVeic = $xVeic + 55;
3062 3062
         $texto = 'Marca / Modelo.....: ' . $veiculoMarcaModelo;
3063
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
3063
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
3064 3064
         $yVeic += $h;
3065 3065
         $texto = 'Especie..................: ' . ($renavamEspecie[intval($veiculoEspecie)] ?? $veiculoEspecie);
3066
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
3066
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
3067 3067
         $yVeic += $h;
3068 3068
         $texto = 'Combustivel..........: ' . ($renavamCombustivel[intval($veiculoCombustivel)] ?? $veiculoCombustivel);
3069
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
3069
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
3070 3070
         $yVeic += $h;
3071 3071
         $texto = 'Serial.....................: ' . $veiculoSerial;
3072
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
3072
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
3073 3073
         $yVeic += $h;
3074
-        $texto = 'Ano Fab/Mod........: '. $veiculoFabricacao . '/' . $veiculoModelo;
3075
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
3074
+        $texto = 'Ano Fab/Mod........: ' . $veiculoFabricacao . '/' . $veiculoModelo;
3075
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
3076 3076
         $yVeic += $h;
3077
-        $texto = 'Distancia Entre Eixos(mm)..: '. $veiculoDistancia;
3078
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
3077
+        $texto = 'Distancia Entre Eixos(mm)..: ' . $veiculoDistancia;
3078
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
3079 3079
     }
3080 3080
 
3081 3081
     /**
@@ -3099,12 +3099,12 @@  discard block
 block discarded – undo
3099 3099
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
3100 3100
         //INSCRIÇÃO MUNICIPAL
3101 3101
         $y += 3;
3102
-        $w = round($this->wPrint*0.23, 0);
3102
+        $w = round($this->wPrint * 0.23, 0);
3103 3103
         $texto = 'INSCRIÇÃO MUNICIPAL';
3104 3104
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
3105 3105
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
3106 3106
         //inscrição municipal
3107
-        $texto = ! empty($this->emit->getElementsByTagName("IM")->item(0)->nodeValue) ?
3107
+        $texto = !empty($this->emit->getElementsByTagName("IM")->item(0)->nodeValue) ?
3108 3108
                 $this->emit->getElementsByTagName("IM")->item(0)->nodeValue : '';
3109 3109
         $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'];
3110 3110
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 0, '');
@@ -3114,7 +3114,7 @@  discard block
 block discarded – undo
3114 3114
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
3115 3115
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
3116 3116
         if (isset($this->ISSQNtot)) {
3117
-            $texto = ! empty($this->ISSQNtot->getElementsByTagName("vServ")->item(0)->nodeValue) ?
3117
+            $texto = !empty($this->ISSQNtot->getElementsByTagName("vServ")->item(0)->nodeValue) ?
3118 3118
                     $this->ISSQNtot->getElementsByTagName("vServ")->item(0)->nodeValue : '';
3119 3119
             $texto = number_format($texto, 2, ",", ".");
3120 3120
         } else {
@@ -3128,9 +3128,9 @@  discard block
 block discarded – undo
3128 3128
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
3129 3129
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
3130 3130
         if (isset($this->ISSQNtot)) {
3131
-            $texto = ! empty($this->ISSQNtot->getElementsByTagName("vBC")->item(0)->nodeValue) ?
3131
+            $texto = !empty($this->ISSQNtot->getElementsByTagName("vBC")->item(0)->nodeValue) ?
3132 3132
                     $this->ISSQNtot->getElementsByTagName("vBC")->item(0)->nodeValue : '';
3133
-            $texto = ! empty($texto) ? number_format($texto, 2, ",", ".") : '';
3133
+            $texto = !empty($texto) ? number_format($texto, 2, ",", ".") : '';
3134 3134
         } else {
3135 3135
             $texto = '';
3136 3136
         }
@@ -3141,21 +3141,21 @@  discard block
 block discarded – undo
3141 3141
         if ($this->orientacao == 'P') {
3142 3142
             $w = $this->wPrint - (3 * $w);
3143 3143
         } else {
3144
-            $w = $this->wPrint - (3 * $w)-$this->wCanhoto;
3144
+            $w = $this->wPrint - (3 * $w) - $this->wCanhoto;
3145 3145
         }
3146 3146
         $texto = 'VALOR TOTAL DO ISSQN';
3147 3147
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
3148 3148
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
3149 3149
         if (isset($this->ISSQNtot)) {
3150
-            $texto = ! empty($this->ISSQNtot->getElementsByTagName("vISS")->item(0)->nodeValue) ?
3150
+            $texto = !empty($this->ISSQNtot->getElementsByTagName("vISS")->item(0)->nodeValue) ?
3151 3151
                     $this->ISSQNtot->getElementsByTagName("vISS")->item(0)->nodeValue : '';
3152
-            $texto = ! empty($texto) ? number_format($texto, 2, ",", ".") : '';
3152
+            $texto = !empty($texto) ? number_format($texto, 2, ",", ".") : '';
3153 3153
         } else {
3154 3154
             $texto = '';
3155 3155
         }
3156 3156
         $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'];
3157 3157
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'R', 0, '');
3158
-        return ($y+$h+1);
3158
+        return ($y + $h + 1);
3159 3159
     }
3160 3160
 
3161 3161
     /**
@@ -3178,7 +3178,7 @@  discard block
 block discarded – undo
3178 3178
         if ($this->orientacao == 'P') {
3179 3179
               $w = $this->wPrint;
3180 3180
         } else {
3181
-              $w = $this->wPrint-$this->wCanhoto;
3181
+              $w = $this->wPrint - $this->wCanhoto;
3182 3182
         }
3183 3183
         $aFont = ['font'=> $this->fontePadrao, 'size' => 7, 'style'=> 'B'];
3184 3184
         $this->pdf->textBox($x, $y, $w, 8, $texto, $aFont, 'T', 'L', 0, '');
@@ -3198,7 +3198,7 @@  discard block
 block discarded – undo
3198 3198
         $y += 1;
3199 3199
         $aFont = ['font'=>$this->fontePadrao, 'size'=> $this->textadicfontsize * $this->pdf->k, 'style'=>''];
3200 3200
         //$aFont = ['font'=>$this->fontePadrao, 'size'=> 5, 'style'=>''];
3201
-        $this->pdf->textBox($x, $y+2, $w-2, $h, $this->textoAdic, $aFont, 'T', 'L', 0, '', false);
3201
+        $this->pdf->textBox($x, $y + 2, $w - 2, $h, $this->textoAdic, $aFont, 'T', 'L', 0, '', false);
3202 3202
         //RESERVADO AO FISCO
3203 3203
         $texto = "RESERVADO AO FISCO";
3204 3204
         if (isset($this->nfeProc) && $this->nfeProc->getElementsByTagName("xMsg")->length) {
@@ -3207,9 +3207,9 @@  discard block
 block discarded – undo
3207 3207
         $x += $w;
3208 3208
         $y -= 1;
3209 3209
         if ($this->orientacao == 'P') {
3210
-            $w = $this->wPrint-$w;
3210
+            $w = $this->wPrint - $w;
3211 3211
         } else {
3212
-            $w = $this->wPrint-$w-$this->wCanhoto;
3212
+            $w = $this->wPrint - $w - $this->wCanhoto;
3213 3213
         }
3214 3214
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>'B'];
3215 3215
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -3248,8 +3248,8 @@  discard block
 block discarded – undo
3248 3248
         }
3249 3249
         $y += 2;
3250 3250
         $aFont = ['font' => $this->fontePadrao, 'size' => 7, 'style' => ''];
3251
-        $this->pdf->textBox($x, $y, $w-2, $h, $texto, $aFont, 'T', 'L', 0, '', false);
3252
-        return $y+$h;
3251
+        $this->pdf->textBox($x, $y, $w - 2, $h, $texto, $aFont, 'T', 'L', 0, '', false);
3252
+        return $y + $h;
3253 3253
     }
3254 3254
 
3255 3255
     /**
@@ -3267,11 +3267,11 @@  discard block
 block discarded – undo
3267 3267
         if ($this->orientacao == 'P') {
3268 3268
               $w = $this->wPrint;
3269 3269
         } else {
3270
-              $w = $this->wPrint-$this->wCanhoto;
3270
+              $w = $this->wPrint - $this->wCanhoto;
3271 3271
               $x = $this->wCanhoto;
3272 3272
         }
3273 3273
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>'I'];
3274
-        $texto = "Impresso em ". date('d/m/Y') . " as " . date('H:i:s')
3274
+        $texto = "Impresso em " . date('d/m/Y') . " as " . date('H:i:s')
3275 3275
             . '  ' . $this->creditos;
3276 3276
         $this->pdf->textBox($x, $y, $w, 0, $texto, $aFont, 'T', 'L', false);
3277 3277
         $texto = $this->powered ? "Powered by NFePHP®" : '';
@@ -3327,9 +3327,9 @@  discard block
 block discarded – undo
3327 3327
         } else {
3328 3328
             //linha separadora do canhoto - 238
3329 3329
             //posicao altura
3330
-            $y = $this->wPrint-85;
3330
+            $y = $this->wPrint - 85;
3331 3331
             //altura
3332
-            $w = $this->wPrint-85-24;
3332
+            $w = $this->wPrint - 85 - 24;
3333 3333
         }
3334 3334
         $h = 10;
3335 3335
         //desenha caixa
@@ -3352,21 +3352,21 @@  discard block
 block discarded – undo
3352 3352
             $texto .= "AO LADO";
3353 3353
         }
3354 3354
         $texto .= ". EMISSÃO: ";
3355
-        $dEmi = ! empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
3355
+        $dEmi = !empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
3356 3356
                 $this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue : '';
3357 3357
         if ($dEmi == '') {
3358
-            $dEmi = ! empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
3358
+            $dEmi = !empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
3359 3359
                     $this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue : '';
3360 3360
             $aDemi = explode('T', $dEmi);
3361 3361
             $dEmi = $aDemi[0];
3362 3362
         }
3363
-        $texto .= $this->ymdTodmy($dEmi) ." ";
3363
+        $texto .= $this->ymdTodmy($dEmi) . " ";
3364 3364
         $texto .= "VALOR TOTAL: R$ ";
3365 3365
         $texto .= number_format($this->ICMSTot->getElementsByTagName("vNF")->item(0)->nodeValue, 2, ",", ".") . " ";
3366 3366
         $texto .= "DESTINATÁRIO: ";
3367 3367
         $texto .= $destinatario;
3368 3368
         if ($this->orientacao == 'P') {
3369
-            $this->pdf->textBox($x, $y, $w-1, $h, $texto, $aFont, 'C', 'L', 0, '', false);
3369
+            $this->pdf->textBox($x, $y, $w - 1, $h, $texto, $aFont, 'C', 'L', 0, '', false);
3370 3370
             $x1 = $x + $w;
3371 3371
             $w1 = $this->wPrint - $w;
3372 3372
             $texto = "NF-e";
@@ -3379,12 +3379,12 @@  discard block
 block discarded – undo
3379 3379
             //DATA DE RECEBIMENTO
3380 3380
             $texto = "DATA DE RECEBIMENTO";
3381 3381
             $y += $h;
3382
-            $w2 = round($this->wPrint*0.17, 0); //35;
3382
+            $w2 = round($this->wPrint * 0.17, 0); //35;
3383 3383
             $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
3384 3384
             $this->pdf->textBox($x, $y, $w2, 8, $texto, $aFont, 'T', 'L', 1, '');
3385 3385
             //IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR
3386 3386
             $x += $w2;
3387
-            $w3 = $w-$w2;
3387
+            $w3 = $w - $w2;
3388 3388
             $texto = "IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR";
3389 3389
             $this->pdf->textBox($x, $y, $w3, 8, $texto, $aFont, 'T', 'L', 1, '');
3390 3390
             $x = $oldX;
@@ -3394,7 +3394,7 @@  discard block
 block discarded – undo
3394 3394
             return $y;
3395 3395
         } else {
3396 3396
             $x--;
3397
-            $x = $this->pdf->textBox90($x, $y, $w-1, $h, $texto, $aFontSmall, 'C', 'L', 0, '', false);
3397
+            $x = $this->pdf->textBox90($x, $y, $w - 1, $h, $texto, $aFontSmall, 'C', 'L', 0, '', false);
3398 3398
             //NUMERO DA NOTA FISCAL LOGO NFE
3399 3399
             $w1 = 18;
3400 3400
             $x1 = $oldX;
@@ -3408,14 +3408,14 @@  discard block
 block discarded – undo
3408 3408
             $this->pdf->textBox($x1, $y, $w1, 18, $texto, $aFont, 'C', 'C', 1, '');
3409 3409
             //DATA DO RECEBIMENTO
3410 3410
             $texto = "DATA DO RECEBIMENTO";
3411
-            $y = $this->wPrint-85;
3411
+            $y = $this->wPrint - 85;
3412 3412
             $x = 12;
3413
-            $w2 = round($this->wPrint*0.17, 0); //35;
3413
+            $w2 = round($this->wPrint * 0.17, 0); //35;
3414 3414
             $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
3415 3415
             $this->pdf->textBox90($x, $y, $w2, 8, $texto, $aFont, 'T', 'L', 1, '');
3416 3416
             //IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR
3417 3417
             $y -= $w2;
3418
-            $w3 = $w-$w2;
3418
+            $w3 = $w - $w2;
3419 3419
             $texto = "IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR";
3420 3420
             $aFont = ['font'=>$this->fontePadrao, 'size'=>5.7, 'style'=>''];
3421 3421
             $x = $this->pdf->textBox90($x, $y, $w3, 8, $texto, $aFont, 'T', 'L', 1, '');
@@ -3436,13 +3436,13 @@  discard block
 block discarded – undo
3436 3436
     {
3437 3437
         $saida = "";
3438 3438
         if (isset($this->compra)) {
3439
-            if (! empty($this->compra->getElementsByTagName("xNEmp")->item(0)->nodeValue)) {
3439
+            if (!empty($this->compra->getElementsByTagName("xNEmp")->item(0)->nodeValue)) {
3440 3440
                 $saida .= " Nota de Empenho: " . $this->compra->getElementsByTagName("xNEmp")->item(0)->nodeValue;
3441 3441
             }
3442
-            if (! empty($this->compra->getElementsByTagName("xPed")->item(0)->nodeValue)) {
3442
+            if (!empty($this->compra->getElementsByTagName("xPed")->item(0)->nodeValue)) {
3443 3443
                 $saida .= " Pedido: " . $this->compra->getElementsByTagName("xPed")->item(0)->nodeValue;
3444 3444
             }
3445
-            if (! empty($this->compra->getElementsByTagName("xCont")->item(0)->nodeValue)) {
3445
+            if (!empty($this->compra->getElementsByTagName("xCont")->item(0)->nodeValue)) {
3446 3446
                 $saida .= " Contrato: " . $this->compra->getElementsByTagName("xCont")->item(0)->nodeValue;
3447 3447
             }
3448 3448
         }
@@ -3468,21 +3468,21 @@  discard block
 block discarded – undo
3468 3468
         if ($vICMS > 0) {
3469 3469
             $vICMS = 1;
3470 3470
         }
3471
-        $icmss  = $this->ICMSTot->getElementsByTagName("vBC")->item(0)->nodeValue;
3471
+        $icmss = $this->ICMSTot->getElementsByTagName("vBC")->item(0)->nodeValue;
3472 3472
         if ($icmss > 0) {
3473 3473
             $icmss = 1;
3474 3474
         }
3475
-        $dEmi = ! empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
3475
+        $dEmi = !empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
3476 3476
                 $this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue : '';
3477 3477
         if ($dEmi == '') {
3478
-            $dEmi = ! empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
3478
+            $dEmi = !empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
3479 3479
                     $this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue : '';
3480 3480
             $aDemi = explode('T', $dEmi);
3481 3481
             $dEmi = $aDemi[0];
3482 3482
         }
3483 3483
         $dd  = $dEmi;
3484 3484
         $rpos = strrpos($dd, '-');
3485
-        $dd  = substr($dd, $rpos +1);
3485
+        $dd  = substr($dd, $rpos + 1);
3486 3486
         $chave = sprintf($forma, $cUF, $this->tpEmis, $CNPJ, $vNF, $vICMS, $icmss, $dd);
3487 3487
         $chave = $chave . $this->modulo11($chave);
3488 3488
         return $chave;
@@ -3503,7 +3503,7 @@  discard block
 block discarded – undo
3503 3503
         $formaNfRef = "\r\nNF  Ref.: série:%d numero:%d emit:%s em %s modelo: %d";
3504 3504
         $formaECFRef = "\r\nECF Ref.: modelo: %s ECF:%d COO:%d";
3505 3505
         $formaNfpRef = "\r\nNFP Ref.: série:%d número:%d emit:%s em %s modelo: %d IE:%s";
3506
-        $saida='';
3506
+        $saida = '';
3507 3507
         $nfRefs = $this->ide->getElementsByTagName('NFref');
3508 3508
         if (0 === $nfRefs->length) {
3509 3509
             return $saida;
@@ -3519,7 +3519,7 @@  discard block
 block discarded – undo
3519 3519
             foreach ($refNFe as $chave_acessoRef) {
3520 3520
                 $chave_acesso = $chave_acessoRef->nodeValue;
3521 3521
                 $chave_acessoF = $this->formatField($chave_acesso, $this->formatoChave);
3522
-                $data = substr($chave_acesso, 4, 2)."/20".substr($chave_acesso, 2, 2);
3522
+                $data = substr($chave_acesso, 4, 2) . "/20" . substr($chave_acesso, 2, 2);
3523 3523
                 $cnpj = $this->formatField(substr($chave_acesso, 6, 14), "##.###.###/####-##");
3524 3524
                 $serie  = substr($chave_acesso, 22, 3);
3525 3525
                 $numero = substr($chave_acesso, 25, 9);
@@ -3540,7 +3540,7 @@  discard block
 block discarded – undo
3540 3540
             foreach ($refCTe as $chave_acessoRef) {
3541 3541
                 $chave_acesso = $chave_acessoRef->nodeValue;
3542 3542
                 $chave_acessoF = $this->formatField($chave_acesso, $this->formatoChave);
3543
-                $data = substr($chave_acesso, 4, 2)."/20".substr($chave_acesso, 2, 2);
3543
+                $data = substr($chave_acesso, 4, 2) . "/20" . substr($chave_acesso, 2, 2);
3544 3544
                 $cnpj = $this->formatField(substr($chave_acesso, 6, 14), "##.###.###/####-##");
3545 3545
                 $serie  = substr($chave_acesso, 22, 3);
3546 3546
                 $numero = substr($chave_acesso, 25, 9);
@@ -3556,10 +3556,9 @@  discard block
 block discarded – undo
3556 3556
             $refNFP = $nfRef->getElementsByTagName('refNFP');
3557 3557
             foreach ($refNFP as $umaRefNFe) {
3558 3558
                 $data = $umaRefNFe->getElementsByTagName('AAMM')->item(0)->nodeValue;
3559
-                $cnpj = ! empty($umaRefNFe->getElementsByTagName('CNPJ')->item(0)->nodeValue) ?
3560
-                    $umaRefNFe->getElementsByTagName('CNPJ')->item(0)->nodeValue :
3561
-                    '';
3562
-                $cpf = ! empty($umaRefNFe->getElementsByTagName('CPF')->item(0)->nodeValue) ?
3559
+                $cnpj = !empty($umaRefNFe->getElementsByTagName('CNPJ')->item(0)->nodeValue) ?
3560
+                    $umaRefNFe->getElementsByTagName('CNPJ')->item(0)->nodeValue : '';
3561
+                $cpf = !empty($umaRefNFe->getElementsByTagName('CPF')->item(0)->nodeValue) ?
3563 3562
                         $umaRefNFe->getElementsByTagName('CPF')->item(0)->nodeValue : '';
3564 3563
                 $mod = $umaRefNFe->getElementsByTagName('mod')->item(0)->nodeValue;
3565 3564
                 $serie = $umaRefNFe->getElementsByTagName('serie')->item(0)->nodeValue;
Please login to merge, or discard this patch.
src/Legacy/Pdf.php 1 patch
Spacing   +221 added lines, -221 removed lines patch added patch discarded remove patch
@@ -6,129 +6,129 @@  discard block
 block discarded – undo
6 6
 
7 7
 class Pdf extends Fpdf
8 8
 {
9
-    private $t128;                                             // tabela de codigos 128
10
-    private $abcSet="";                                        // conjunto de caracteres legiveis em 128
11
-    private $aSet="";                                          // grupo A do conjunto de de caracteres legiveis
12
-    private $bSet="";                                          // grupo B do conjunto de caracteres legiveis
13
-    private $cSet="";                                          // grupo C do conjunto de caracteres legiveis
14
-    private $setFrom;                                          // converter de
15
-    private $setTo;                                            // converter para
16
-    private $jStart = ["A"=>103, "B"=>104, "C"=>105];     // Caracteres de seleção do grupo 128
17
-    private $jSwap = ["A"=>101, "B"=>100, "C"=>99];       // Caracteres de troca de grupo
9
+    private $t128; // tabela de codigos 128
10
+    private $abcSet = ""; // conjunto de caracteres legiveis em 128
11
+    private $aSet = ""; // grupo A do conjunto de de caracteres legiveis
12
+    private $bSet = ""; // grupo B do conjunto de caracteres legiveis
13
+    private $cSet = ""; // grupo C do conjunto de caracteres legiveis
14
+    private $setFrom; // converter de
15
+    private $setTo; // converter para
16
+    private $jStart = ["A"=>103, "B"=>104, "C"=>105]; // Caracteres de seleção do grupo 128
17
+    private $jSwap = ["A"=>101, "B"=>100, "C"=>99]; // Caracteres de troca de grupo
18 18
 
19 19
     public function __construct($orientation = 'P', $unit = 'mm', $format = 'A4')
20 20
     {
21 21
         //passar parametros para a classe principal
22 22
         parent::__construct($orientation, $unit, $format);
23 23
         // composição dos caracteres do barcode 128
24
-        $this->t128[] = array(2, 1, 2, 2, 2, 2);           //0 : [ ]
25
-        $this->t128[] = array(2, 2, 2, 1, 2, 2);           //1 : [!]
26
-        $this->t128[] = array(2, 2, 2, 2, 2, 1);           //2 : ["]
27
-        $this->t128[] = array(1, 2, 1, 2, 2, 3);           //3 : [#]
28
-        $this->t128[] = array(1, 2, 1, 3, 2, 2);           //4 : [$]
29
-        $this->t128[] = array(1, 3, 1, 2, 2, 2);           //5 : [%]
30
-        $this->t128[] = array(1, 2, 2, 2, 1, 3);           //6 : [&]
31
-        $this->t128[] = array(1, 2, 2, 3, 1, 2);           //7 : [']
32
-        $this->t128[] = array(1, 3, 2, 2, 1, 2);           //8 : [(]
33
-        $this->t128[] = array(2, 2, 1, 2, 1, 3);           //9 : [)]
34
-        $this->t128[] = array(2, 2, 1, 3, 1, 2);           //10 : [*]
35
-        $this->t128[] = array(2, 3, 1, 2, 1, 2);           //11 : [+]
36
-        $this->t128[] = array(1, 1, 2, 2, 3, 2);           //12 : [,]
37
-        $this->t128[] = array(1, 2, 2, 1, 3, 2);           //13 : [-]
38
-        $this->t128[] = array(1, 2, 2, 2, 3, 1);           //14 : [.]
39
-        $this->t128[] = array(1, 1, 3, 2, 2, 2);           //15 : [/]
40
-        $this->t128[] = array(1, 2, 3, 1, 2, 2);           //16 : [0]
41
-        $this->t128[] = array(1, 2, 3, 2, 2, 1);           //17 : [1]
42
-        $this->t128[] = array(2, 2, 3, 2, 1, 1);           //18 : [2]
43
-        $this->t128[] = array(2, 2, 1, 1, 3, 2);           //19 : [3]
44
-        $this->t128[] = array(2, 2, 1, 2, 3, 1);           //20 : [4]
45
-        $this->t128[] = array(2, 1, 3, 2, 1, 2);           //21 : [5]
46
-        $this->t128[] = array(2, 2, 3, 1, 1, 2);           //22 : [6]
47
-        $this->t128[] = array(3, 1, 2, 1, 3, 1);           //23 : [7]
48
-        $this->t128[] = array(3, 1, 1, 2, 2, 2);           //24 : [8]
49
-        $this->t128[] = array(3, 2, 1, 1, 2, 2);           //25 : [9]
50
-        $this->t128[] = array(3, 2, 1, 2, 2, 1);           //26 : [:]
51
-        $this->t128[] = array(3, 1, 2, 2, 1, 2);           //27 : [;]
52
-        $this->t128[] = array(3, 2, 2, 1, 1, 2);           //28 : [<]
53
-        $this->t128[] = array(3, 2, 2, 2, 1, 1);           //29 : [=]
54
-        $this->t128[] = array(2, 1, 2, 1, 2, 3);           //30 : [>]
55
-        $this->t128[] = array(2, 1, 2, 3, 2, 1);           //31 : [?]
56
-        $this->t128[] = array(2, 3, 2, 1, 2, 1);           //32 : [@]
57
-        $this->t128[] = array(1, 1, 1, 3, 2, 3);           //33 : [A]
58
-        $this->t128[] = array(1, 3, 1, 1, 2, 3);           //34 : [B]
59
-        $this->t128[] = array(1, 3, 1, 3, 2, 1);           //35 : [C]
60
-        $this->t128[] = array(1, 1, 2, 3, 1, 3);           //36 : [D]
61
-        $this->t128[] = array(1, 3, 2, 1, 1, 3);           //37 : [E]
62
-        $this->t128[] = array(1, 3, 2, 3, 1, 1);           //38 : [F]
63
-        $this->t128[] = array(2, 1, 1, 3, 1, 3);           //39 : [G]
64
-        $this->t128[] = array(2, 3, 1, 1, 1, 3);           //40 : [H]
65
-        $this->t128[] = array(2, 3, 1, 3, 1, 1);           //41 : [I]
66
-        $this->t128[] = array(1, 1, 2, 1, 3, 3);           //42 : [J]
67
-        $this->t128[] = array(1, 1, 2, 3, 3, 1);           //43 : [K]
68
-        $this->t128[] = array(1, 3, 2, 1, 3, 1);           //44 : [L]
69
-        $this->t128[] = array(1, 1, 3, 1, 2, 3);           //45 : [M]
70
-        $this->t128[] = array(1, 1, 3, 3, 2, 1);           //46 : [N]
71
-        $this->t128[] = array(1, 3, 3, 1, 2, 1);           //47 : [O]
72
-        $this->t128[] = array(3, 1, 3, 1, 2, 1);           //48 : [P]
73
-        $this->t128[] = array(2, 1, 1, 3, 3, 1);           //49 : [Q]
74
-        $this->t128[] = array(2, 3, 1, 1, 3, 1);           //50 : [R]
75
-        $this->t128[] = array(2, 1, 3, 1, 1, 3);           //51 : [S]
76
-        $this->t128[] = array(2, 1, 3, 3, 1, 1);           //52 : [T]
77
-        $this->t128[] = array(2, 1, 3, 1, 3, 1);           //53 : [U]
78
-        $this->t128[] = array(3, 1, 1, 1, 2, 3);           //54 : [V]
79
-        $this->t128[] = array(3, 1, 1, 3, 2, 1);           //55 : [W]
80
-        $this->t128[] = array(3, 3, 1, 1, 2, 1);           //56 : [X]
81
-        $this->t128[] = array(3, 1, 2, 1, 1, 3);           //57 : [Y]
82
-        $this->t128[] = array(3, 1, 2, 3, 1, 1);           //58 : [Z]
83
-        $this->t128[] = array(3, 3, 2, 1, 1, 1);           //59 : [[]
84
-        $this->t128[] = array(3, 1, 4, 1, 1, 1);           //60 : [\]
85
-        $this->t128[] = array(2, 2, 1, 4, 1, 1);           //61 : []]
86
-        $this->t128[] = array(4, 3, 1, 1, 1, 1);           //62 : [^]
87
-        $this->t128[] = array(1, 1, 1, 2, 2, 4);           //63 : [_]
88
-        $this->t128[] = array(1, 1, 1, 4, 2, 2);           //64 : [`]
89
-        $this->t128[] = array(1, 2, 1, 1, 2, 4);           //65 : [a]
90
-        $this->t128[] = array(1, 2, 1, 4, 2, 1);           //66 : [b]
91
-        $this->t128[] = array(1, 4, 1, 1, 2, 2);           //67 : [c]
92
-        $this->t128[] = array(1, 4, 1, 2, 2, 1);           //68 : [d]
93
-        $this->t128[] = array(1, 1, 2, 2, 1, 4);           //69 : [e]
94
-        $this->t128[] = array(1, 1, 2, 4, 1, 2);           //70 : [f]
95
-        $this->t128[] = array(1, 2, 2, 1, 1, 4);           //71 : [g]
96
-        $this->t128[] = array(1, 2, 2, 4, 1, 1);           //72 : [h]
97
-        $this->t128[] = array(1, 4, 2, 1, 1, 2);           //73 : [i]
98
-        $this->t128[] = array(1, 4, 2, 2, 1, 1);           //74 : [j]
99
-        $this->t128[] = array(2, 4, 1, 2, 1, 1);           //75 : [k]
100
-        $this->t128[] = array(2, 2, 1, 1, 1, 4);           //76 : [l]
101
-        $this->t128[] = array(4, 1, 3, 1, 1, 1);           //77 : [m]
102
-        $this->t128[] = array(2, 4, 1, 1, 1, 2);           //78 : [n]
103
-        $this->t128[] = array(1, 3, 4, 1, 1, 1);           //79 : [o]
104
-        $this->t128[] = array(1, 1, 1, 2, 4, 2);           //80 : [p]
105
-        $this->t128[] = array(1, 2, 1, 1, 4, 2);           //81 : [q]
106
-        $this->t128[] = array(1, 2, 1, 2, 4, 1);           //82 : [r]
107
-        $this->t128[] = array(1, 1, 4, 2, 1, 2);           //83 : [s]
108
-        $this->t128[] = array(1, 2, 4, 1, 1, 2);           //84 : [t]
109
-        $this->t128[] = array(1, 2, 4, 2, 1, 1);           //85 : [u]
110
-        $this->t128[] = array(4, 1, 1, 2, 1, 2);           //86 : [v]
111
-        $this->t128[] = array(4, 2, 1, 1, 1, 2);           //87 : [w]
112
-        $this->t128[] = array(4, 2, 1, 2, 1, 1);           //88 : [x]
113
-        $this->t128[] = array(2, 1, 2, 1, 4, 1);           //89 : [y]
114
-        $this->t128[] = array(2, 1, 4, 1, 2, 1);           //90 : [z]
115
-        $this->t128[] = array(4, 1, 2, 1, 2, 1);           //91 : [{]
116
-        $this->t128[] = array(1, 1, 1, 1, 4, 3);           //92 : [|]
117
-        $this->t128[] = array(1, 1, 1, 3, 4, 1);           //93 : [}]
118
-        $this->t128[] = array(1, 3, 1, 1, 4, 1);           //94 : [~]
119
-        $this->t128[] = array(1, 1, 4, 1, 1, 3);           //95 : [DEL]
120
-        $this->t128[] = array(1, 1, 4, 3, 1, 1);           //96 : [FNC3]
121
-        $this->t128[] = array(4, 1, 1, 1, 1, 3);           //97 : [FNC2]
122
-        $this->t128[] = array(4, 1, 1, 3, 1, 1);           //98 : [SHIFT]
123
-        $this->t128[] = array(1, 1, 3, 1, 4, 1);           //99 : [Cswap]
124
-        $this->t128[] = array(1, 1, 4, 1, 3, 1);           //100 : [Bswap]
125
-        $this->t128[] = array(3, 1, 1, 1, 4, 1);           //101 : [Aswap]
126
-        $this->t128[] = array(4, 1, 1, 1, 3, 1);           //102 : [FNC1]
127
-        $this->t128[] = array(2, 1, 1, 4, 1, 2);           //103 : [Astart]
128
-        $this->t128[] = array(2, 1, 1, 2, 1, 4);           //104 : [Bstart]
129
-        $this->t128[] = array(2, 1, 1, 2, 3, 2);           //105 : [Cstart]
130
-        $this->t128[] = array(2, 3, 3, 1, 1, 1);           //106 : [STOP]
131
-        $this->t128[] = array(2, 1);                       //107 : [END BAR]
24
+        $this->t128[] = array(2, 1, 2, 2, 2, 2); //0 : [ ]
25
+        $this->t128[] = array(2, 2, 2, 1, 2, 2); //1 : [!]
26
+        $this->t128[] = array(2, 2, 2, 2, 2, 1); //2 : ["]
27
+        $this->t128[] = array(1, 2, 1, 2, 2, 3); //3 : [#]
28
+        $this->t128[] = array(1, 2, 1, 3, 2, 2); //4 : [$]
29
+        $this->t128[] = array(1, 3, 1, 2, 2, 2); //5 : [%]
30
+        $this->t128[] = array(1, 2, 2, 2, 1, 3); //6 : [&]
31
+        $this->t128[] = array(1, 2, 2, 3, 1, 2); //7 : [']
32
+        $this->t128[] = array(1, 3, 2, 2, 1, 2); //8 : [(]
33
+        $this->t128[] = array(2, 2, 1, 2, 1, 3); //9 : [)]
34
+        $this->t128[] = array(2, 2, 1, 3, 1, 2); //10 : [*]
35
+        $this->t128[] = array(2, 3, 1, 2, 1, 2); //11 : [+]
36
+        $this->t128[] = array(1, 1, 2, 2, 3, 2); //12 : [,]
37
+        $this->t128[] = array(1, 2, 2, 1, 3, 2); //13 : [-]
38
+        $this->t128[] = array(1, 2, 2, 2, 3, 1); //14 : [.]
39
+        $this->t128[] = array(1, 1, 3, 2, 2, 2); //15 : [/]
40
+        $this->t128[] = array(1, 2, 3, 1, 2, 2); //16 : [0]
41
+        $this->t128[] = array(1, 2, 3, 2, 2, 1); //17 : [1]
42
+        $this->t128[] = array(2, 2, 3, 2, 1, 1); //18 : [2]
43
+        $this->t128[] = array(2, 2, 1, 1, 3, 2); //19 : [3]
44
+        $this->t128[] = array(2, 2, 1, 2, 3, 1); //20 : [4]
45
+        $this->t128[] = array(2, 1, 3, 2, 1, 2); //21 : [5]
46
+        $this->t128[] = array(2, 2, 3, 1, 1, 2); //22 : [6]
47
+        $this->t128[] = array(3, 1, 2, 1, 3, 1); //23 : [7]
48
+        $this->t128[] = array(3, 1, 1, 2, 2, 2); //24 : [8]
49
+        $this->t128[] = array(3, 2, 1, 1, 2, 2); //25 : [9]
50
+        $this->t128[] = array(3, 2, 1, 2, 2, 1); //26 : [:]
51
+        $this->t128[] = array(3, 1, 2, 2, 1, 2); //27 : [;]
52
+        $this->t128[] = array(3, 2, 2, 1, 1, 2); //28 : [<]
53
+        $this->t128[] = array(3, 2, 2, 2, 1, 1); //29 : [=]
54
+        $this->t128[] = array(2, 1, 2, 1, 2, 3); //30 : [>]
55
+        $this->t128[] = array(2, 1, 2, 3, 2, 1); //31 : [?]
56
+        $this->t128[] = array(2, 3, 2, 1, 2, 1); //32 : [@]
57
+        $this->t128[] = array(1, 1, 1, 3, 2, 3); //33 : [A]
58
+        $this->t128[] = array(1, 3, 1, 1, 2, 3); //34 : [B]
59
+        $this->t128[] = array(1, 3, 1, 3, 2, 1); //35 : [C]
60
+        $this->t128[] = array(1, 1, 2, 3, 1, 3); //36 : [D]
61
+        $this->t128[] = array(1, 3, 2, 1, 1, 3); //37 : [E]
62
+        $this->t128[] = array(1, 3, 2, 3, 1, 1); //38 : [F]
63
+        $this->t128[] = array(2, 1, 1, 3, 1, 3); //39 : [G]
64
+        $this->t128[] = array(2, 3, 1, 1, 1, 3); //40 : [H]
65
+        $this->t128[] = array(2, 3, 1, 3, 1, 1); //41 : [I]
66
+        $this->t128[] = array(1, 1, 2, 1, 3, 3); //42 : [J]
67
+        $this->t128[] = array(1, 1, 2, 3, 3, 1); //43 : [K]
68
+        $this->t128[] = array(1, 3, 2, 1, 3, 1); //44 : [L]
69
+        $this->t128[] = array(1, 1, 3, 1, 2, 3); //45 : [M]
70
+        $this->t128[] = array(1, 1, 3, 3, 2, 1); //46 : [N]
71
+        $this->t128[] = array(1, 3, 3, 1, 2, 1); //47 : [O]
72
+        $this->t128[] = array(3, 1, 3, 1, 2, 1); //48 : [P]
73
+        $this->t128[] = array(2, 1, 1, 3, 3, 1); //49 : [Q]
74
+        $this->t128[] = array(2, 3, 1, 1, 3, 1); //50 : [R]
75
+        $this->t128[] = array(2, 1, 3, 1, 1, 3); //51 : [S]
76
+        $this->t128[] = array(2, 1, 3, 3, 1, 1); //52 : [T]
77
+        $this->t128[] = array(2, 1, 3, 1, 3, 1); //53 : [U]
78
+        $this->t128[] = array(3, 1, 1, 1, 2, 3); //54 : [V]
79
+        $this->t128[] = array(3, 1, 1, 3, 2, 1); //55 : [W]
80
+        $this->t128[] = array(3, 3, 1, 1, 2, 1); //56 : [X]
81
+        $this->t128[] = array(3, 1, 2, 1, 1, 3); //57 : [Y]
82
+        $this->t128[] = array(3, 1, 2, 3, 1, 1); //58 : [Z]
83
+        $this->t128[] = array(3, 3, 2, 1, 1, 1); //59 : [[]
84
+        $this->t128[] = array(3, 1, 4, 1, 1, 1); //60 : [\]
85
+        $this->t128[] = array(2, 2, 1, 4, 1, 1); //61 : []]
86
+        $this->t128[] = array(4, 3, 1, 1, 1, 1); //62 : [^]
87
+        $this->t128[] = array(1, 1, 1, 2, 2, 4); //63 : [_]
88
+        $this->t128[] = array(1, 1, 1, 4, 2, 2); //64 : [`]
89
+        $this->t128[] = array(1, 2, 1, 1, 2, 4); //65 : [a]
90
+        $this->t128[] = array(1, 2, 1, 4, 2, 1); //66 : [b]
91
+        $this->t128[] = array(1, 4, 1, 1, 2, 2); //67 : [c]
92
+        $this->t128[] = array(1, 4, 1, 2, 2, 1); //68 : [d]
93
+        $this->t128[] = array(1, 1, 2, 2, 1, 4); //69 : [e]
94
+        $this->t128[] = array(1, 1, 2, 4, 1, 2); //70 : [f]
95
+        $this->t128[] = array(1, 2, 2, 1, 1, 4); //71 : [g]
96
+        $this->t128[] = array(1, 2, 2, 4, 1, 1); //72 : [h]
97
+        $this->t128[] = array(1, 4, 2, 1, 1, 2); //73 : [i]
98
+        $this->t128[] = array(1, 4, 2, 2, 1, 1); //74 : [j]
99
+        $this->t128[] = array(2, 4, 1, 2, 1, 1); //75 : [k]
100
+        $this->t128[] = array(2, 2, 1, 1, 1, 4); //76 : [l]
101
+        $this->t128[] = array(4, 1, 3, 1, 1, 1); //77 : [m]
102
+        $this->t128[] = array(2, 4, 1, 1, 1, 2); //78 : [n]
103
+        $this->t128[] = array(1, 3, 4, 1, 1, 1); //79 : [o]
104
+        $this->t128[] = array(1, 1, 1, 2, 4, 2); //80 : [p]
105
+        $this->t128[] = array(1, 2, 1, 1, 4, 2); //81 : [q]
106
+        $this->t128[] = array(1, 2, 1, 2, 4, 1); //82 : [r]
107
+        $this->t128[] = array(1, 1, 4, 2, 1, 2); //83 : [s]
108
+        $this->t128[] = array(1, 2, 4, 1, 1, 2); //84 : [t]
109
+        $this->t128[] = array(1, 2, 4, 2, 1, 1); //85 : [u]
110
+        $this->t128[] = array(4, 1, 1, 2, 1, 2); //86 : [v]
111
+        $this->t128[] = array(4, 2, 1, 1, 1, 2); //87 : [w]
112
+        $this->t128[] = array(4, 2, 1, 2, 1, 1); //88 : [x]
113
+        $this->t128[] = array(2, 1, 2, 1, 4, 1); //89 : [y]
114
+        $this->t128[] = array(2, 1, 4, 1, 2, 1); //90 : [z]
115
+        $this->t128[] = array(4, 1, 2, 1, 2, 1); //91 : [{]
116
+        $this->t128[] = array(1, 1, 1, 1, 4, 3); //92 : [|]
117
+        $this->t128[] = array(1, 1, 1, 3, 4, 1); //93 : [}]
118
+        $this->t128[] = array(1, 3, 1, 1, 4, 1); //94 : [~]
119
+        $this->t128[] = array(1, 1, 4, 1, 1, 3); //95 : [DEL]
120
+        $this->t128[] = array(1, 1, 4, 3, 1, 1); //96 : [FNC3]
121
+        $this->t128[] = array(4, 1, 1, 1, 1, 3); //97 : [FNC2]
122
+        $this->t128[] = array(4, 1, 1, 3, 1, 1); //98 : [SHIFT]
123
+        $this->t128[] = array(1, 1, 3, 1, 4, 1); //99 : [Cswap]
124
+        $this->t128[] = array(1, 1, 4, 1, 3, 1); //100 : [Bswap]
125
+        $this->t128[] = array(3, 1, 1, 1, 4, 1); //101 : [Aswap]
126
+        $this->t128[] = array(4, 1, 1, 1, 3, 1); //102 : [FNC1]
127
+        $this->t128[] = array(2, 1, 1, 4, 1, 2); //103 : [Astart]
128
+        $this->t128[] = array(2, 1, 1, 2, 1, 4); //104 : [Bstart]
129
+        $this->t128[] = array(2, 1, 1, 2, 3, 2); //105 : [Cstart]
130
+        $this->t128[] = array(2, 3, 3, 1, 1, 1); //106 : [STOP]
131
+        $this->t128[] = array(2, 1); //107 : [END BAR]
132 132
         for ($i = 32; $i <= 95; $i++) {   // conjunto de caracteres
133 133
             $this->abcSet .= chr($i);
134 134
         }
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
             $this->abcSet .= chr($i);
143 143
             $this->bSet .= chr($i);
144 144
         }
145
-        $this->cSet="0123456789";
145
+        $this->cSet = "0123456789";
146 146
         for ($i = 0; $i < 96; $i++) {
147 147
             // convertendo grupos A & B
148 148
             if (isset($this->setFrom["A"])) {
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
                 $this->setFrom["B"] .= chr($i + 32);
153 153
             }
154 154
             if (isset($this->setTo["A"])) {
155
-                $this->setTo["A"] .= chr(($i < 32) ? $i+64 : $i-32);
155
+                $this->setTo["A"] .= chr(($i < 32) ? $i + 64 : $i - 32);
156 156
             }
157 157
             if (isset($this->setTo["A"])) {
158 158
                 $this->setTo["B"] .= chr($i);
@@ -165,21 +165,21 @@  discard block
 block discarded – undo
165 165
      */
166 166
     public function code128($x, $y, $code, $w, $h)
167 167
     {
168
-        $Aguid="";
169
-        $Bguid="";
170
-        $Cguid="";
171
-        for ($i=0; $i < strlen($code); $i++) {
172
-            $needle=substr($code, $i, 1);
173
-            $Aguid .= ((strpos($this->aSet, $needle)===false) ? "N" : "O");
174
-            $Bguid .= ((strpos($this->bSet, $needle)===false) ? "N" : "O");
175
-            $Cguid .= ((strpos($this->cSet, $needle)===false) ? "N" : "O");
168
+        $Aguid = "";
169
+        $Bguid = "";
170
+        $Cguid = "";
171
+        for ($i = 0; $i < strlen($code); $i++) {
172
+            $needle = substr($code, $i, 1);
173
+            $Aguid .= ((strpos($this->aSet, $needle) === false) ? "N" : "O");
174
+            $Bguid .= ((strpos($this->bSet, $needle) === false) ? "N" : "O");
175
+            $Cguid .= ((strpos($this->cSet, $needle) === false) ? "N" : "O");
176 176
         }
177 177
         $SminiC = "OOOO";
178 178
         $IminiC = 4;
179 179
         $crypt = "";
180 180
         while ($code > "") {
181 181
             $i = strpos($Cguid, $SminiC);
182
-            if ($i!==false) {
182
+            if ($i !== false) {
183 183
                 $Aguid [$i] = "N";
184 184
                 $Bguid [$i] = "N";
185 185
             }
@@ -189,10 +189,10 @@  discard block
 block discarded – undo
189 189
                 if ($made === false) {
190 190
                     $made = strlen($Cguid);
191 191
                 }
192
-                if (fmod($made, 2)==1) {
192
+                if (fmod($made, 2) == 1) {
193 193
                     $made--;
194 194
                 }
195
-                for ($i=0; $i < $made; $i += 2) {
195
+                for ($i = 0; $i < $made; $i += 2) {
196 196
                     $crypt .= chr(strval(substr($code, $i, 2)));
197 197
                 }
198 198
                     $jeu = "C";
@@ -205,8 +205,8 @@  discard block
 block discarded – undo
205 205
                 if ($madeB === false) {
206 206
                     $madeB = strlen($Bguid);
207 207
                 }
208
-                $made = (($madeA < $madeB) ? $madeB : $madeA );
209
-                $jeu = (($madeA < $madeB) ? "B" : "A" );
208
+                $made = (($madeA < $madeB) ? $madeB : $madeA);
209
+                $jeu = (($madeA < $madeB) ? "B" : "A");
210 210
                 $jeuguid = $jeu . "guid";
211 211
                 $crypt .= chr(($crypt > "") ? $this->jSwap["$jeu"] : $this->jStart["$jeu"]);
212 212
                 $crypt .= strtr(substr($code, 0, $made), $this->setFrom[$jeu], $this->setTo[$jeu]);
@@ -217,18 +217,18 @@  discard block
 block discarded – undo
217 217
             $Cguid = substr($Cguid, $made);
218 218
         }
219 219
         $check = ord($crypt[0]);
220
-        for ($i=0; $i<strlen($crypt); $i++) {
220
+        for ($i = 0; $i < strlen($crypt); $i++) {
221 221
             $check += (ord($crypt[$i]) * $i);
222 222
         }
223 223
         $check %= 103;
224 224
         $crypt .= chr($check) . chr(106) . chr(107);
225 225
         $i = (strlen($crypt) * 11) - 8;
226
-        $modul = $w/$i;
227
-        for ($i=0; $i<strlen($crypt); $i++) {
226
+        $modul = $w / $i;
227
+        for ($i = 0; $i < strlen($crypt); $i++) {
228 228
             $c = $this->t128[ord($crypt[$i])];
229
-            for ($j=0; $j<count($c); $j++) {
230
-                $this->Rect($x, $y, $c[$j]*$modul, $h, "F");
231
-                $x += ($c[$j++]+$c[$j])*$modul;
229
+            for ($j = 0; $j < count($c); $j++) {
230
+                $this->Rect($x, $y, $c[$j] * $modul, $h, "F");
231
+                $x += ($c[$j++] + $c[$j]) * $modul;
232 232
             }
233 233
         }
234 234
     }
@@ -252,11 +252,11 @@  discard block
 block discarded – undo
252 252
         }
253 253
         $this->angle = $angle;
254 254
         if ($angle != 0) {
255
-            $angle *= M_PI/180;
255
+            $angle *= M_PI / 180;
256 256
             $c = cos($angle);
257 257
             $s = sin($angle);
258
-            $cx =$x*$this->k;
259
-            $cy = ($this->h-$y)*$this->k;
258
+            $cx = $x * $this->k;
259
+            $cy = ($this->h - $y) * $this->k;
260 260
             $this->out(
261 261
                 sprintf(
262 262
                     'q %.5F %.5F %.5F %.5F %.2F %.2F cm 1 0 0 1 %.2F %.2F cm',
@@ -294,40 +294,40 @@  discard block
 block discarded – undo
294 294
         } else {
295 295
             $op = 'S';
296 296
         }
297
-        $MyArc = 4/3 * (sqrt(2) - 1);
298
-        $this->out(sprintf('%.2F %.2F m', ($x+$r)*$k, ($hp-$y)*$k));
299
-        $xc = $x+$w-$r;
300
-        $yc = $y+$r;
301
-        $this->out(sprintf('%.2F %.2F l', $xc*$k, ($hp-$y)*$k));
302
-        if (strpos($corners, '2')===false) {
303
-            $this->out(sprintf('%.2F %.2F l', ($x+$w)*$k, ($hp-$y)*$k));
297
+        $MyArc = 4 / 3 * (sqrt(2) - 1);
298
+        $this->out(sprintf('%.2F %.2F m', ($x + $r) * $k, ($hp - $y) * $k));
299
+        $xc = $x + $w - $r;
300
+        $yc = $y + $r;
301
+        $this->out(sprintf('%.2F %.2F l', $xc * $k, ($hp - $y) * $k));
302
+        if (strpos($corners, '2') === false) {
303
+            $this->out(sprintf('%.2F %.2F l', ($x + $w) * $k, ($hp - $y) * $k));
304 304
         } else {
305
-            $this->arc($xc + $r*$MyArc, $yc - $r, $xc + $r, $yc - $r*$MyArc, $xc + $r, $yc);
305
+            $this->arc($xc + $r * $MyArc, $yc - $r, $xc + $r, $yc - $r * $MyArc, $xc + $r, $yc);
306 306
         }
307
-        $xc = $x+$w-$r;
308
-        $yc = $y+$h-$r;
309
-        $this->out(sprintf('%.2F %.2F l', ($x+$w)*$k, ($hp-$yc)*$k));
310
-        if (strpos($corners, '3')===false) {
311
-            $this->out(sprintf('%.2F %.2F l', ($x+$w)*$k, ($hp-($y+$h))*$k));
307
+        $xc = $x + $w - $r;
308
+        $yc = $y + $h - $r;
309
+        $this->out(sprintf('%.2F %.2F l', ($x + $w) * $k, ($hp - $yc) * $k));
310
+        if (strpos($corners, '3') === false) {
311
+            $this->out(sprintf('%.2F %.2F l', ($x + $w) * $k, ($hp - ($y + $h)) * $k));
312 312
         } else {
313
-            $this->arc($xc + $r, $yc + $r*$MyArc, $xc + $r*$MyArc, $yc + $r, $xc, $yc + $r);
313
+            $this->arc($xc + $r, $yc + $r * $MyArc, $xc + $r * $MyArc, $yc + $r, $xc, $yc + $r);
314 314
         }
315
-        $xc = $x+$r;
316
-        $yc = $y+$h-$r;
317
-        $this->out(sprintf('%.2F %.2F l', $xc*$k, ($hp-($y+$h))*$k));
318
-        if (strpos($corners, '4')===false) {
319
-            $this->out(sprintf('%.2F %.2F l', ($x)*$k, ($hp-($y+$h))*$k));
315
+        $xc = $x + $r;
316
+        $yc = $y + $h - $r;
317
+        $this->out(sprintf('%.2F %.2F l', $xc * $k, ($hp - ($y + $h)) * $k));
318
+        if (strpos($corners, '4') === false) {
319
+            $this->out(sprintf('%.2F %.2F l', ($x) * $k, ($hp - ($y + $h)) * $k));
320 320
         } else {
321
-            $this->arc($xc - $r*$MyArc, $yc + $r, $xc - $r, $yc + $r*$MyArc, $xc - $r, $yc);
321
+            $this->arc($xc - $r * $MyArc, $yc + $r, $xc - $r, $yc + $r * $MyArc, $xc - $r, $yc);
322 322
         }
323
-        $xc = $x+$r ;
324
-        $yc = $y+$r;
325
-        $this->out(sprintf('%.2F %.2F l', ($x)*$k, ($hp-$yc)*$k));
326
-        if (strpos($corners, '1')===false) {
327
-            $this->out(sprintf('%.2F %.2F l', ($x)*$k, ($hp-$y)*$k));
328
-            $this->out(sprintf('%.2F %.2F l', ($x+$r)*$k, ($hp-$y)*$k));
323
+        $xc = $x + $r;
324
+        $yc = $y + $r;
325
+        $this->out(sprintf('%.2F %.2F l', ($x) * $k, ($hp - $yc) * $k));
326
+        if (strpos($corners, '1') === false) {
327
+            $this->out(sprintf('%.2F %.2F l', ($x) * $k, ($hp - $y) * $k));
328
+            $this->out(sprintf('%.2F %.2F l', ($x + $r) * $k, ($hp - $y) * $k));
329 329
         } else {
330
-            $this->arc($xc - $r, $yc - $r*$MyArc, $xc - $r*$MyArc, $yc - $r, $xc, $yc - $r);
330
+            $this->arc($xc - $r, $yc - $r * $MyArc, $xc - $r * $MyArc, $yc - $r, $xc, $yc - $r);
331 331
         }
332 332
         $this->out($op);
333 333
     }
@@ -347,12 +347,12 @@  discard block
 block discarded – undo
347 347
         $this->out(
348 348
             sprintf(
349 349
                 '%.2F %.2F %.2F %.2F %.2F %.2F c ',
350
-                $x1*$this->k,
351
-                ($h-$y1)*$this->k,
352
-                $x2*$this->k,
353
-                ($h-$y2)*$this->k,
354
-                $x3*$this->k,
355
-                ($h-$y3)*$this->k
350
+                $x1 * $this->k,
351
+                ($h - $y1) * $this->k,
352
+                $x2 * $this->k,
353
+                ($h - $y2) * $this->k,
354
+                $x3 * $this->k,
355
+                ($h - $y3) * $this->k
356 356
             )
357 357
         );
358 358
     }
@@ -369,26 +369,26 @@  discard block
 block discarded – undo
369 369
     public function dashedRect($x1, $y1, $x2, $y2, $width = 1, $nb = 15)
370 370
     {
371 371
         $this->setLineWidth($width);
372
-        $longueur = abs($x1-$x2);
373
-        $hauteur = abs($y1-$y2);
372
+        $longueur = abs($x1 - $x2);
373
+        $hauteur = abs($y1 - $y2);
374 374
         if ($longueur > $hauteur) {
375
-            $Pointilles = ($longueur/$nb)/2;
375
+            $Pointilles = ($longueur / $nb) / 2;
376 376
         } else {
377
-            $Pointilles = ($hauteur/$nb)/2;
377
+            $Pointilles = ($hauteur / $nb) / 2;
378 378
         }
379
-        for ($i=$x1; $i<=$x2; $i+=$Pointilles+$Pointilles) {
380
-            for ($j=$i; $j<=($i+$Pointilles); $j++) {
381
-                if ($j<=($x2-1)) {
382
-                    $this->line($j, $y1, $j+1, $y1);
383
-                    $this->line($j, $y2, $j+1, $y2);
379
+        for ($i = $x1; $i <= $x2; $i += $Pointilles + $Pointilles) {
380
+            for ($j = $i; $j <= ($i + $Pointilles); $j++) {
381
+                if ($j <= ($x2 - 1)) {
382
+                    $this->line($j, $y1, $j + 1, $y1);
383
+                    $this->line($j, $y2, $j + 1, $y2);
384 384
                 }
385 385
             }
386 386
         }
387
-        for ($i=$y1; $i<=$y2; $i+=$Pointilles+$Pointilles) {
388
-            for ($j=$i; $j<=($i+$Pointilles); $j++) {
389
-                if ($j<=($y2-1)) {
390
-                    $this->line($x1, $j, $x1, $j+1);
391
-                    $this->line($x2, $j, $x2, $j+1);
387
+        for ($i = $y1; $i <= $y2; $i += $Pointilles + $Pointilles) {
388
+            for ($j = $i; $j <= ($i + $Pointilles); $j++) {
389
+                if ($j <= ($y2 - 1)) {
390
+                    $this->line($x1, $j, $x1, $j + 1);
391
+                    $this->line($x2, $j, $x2, $j + 1);
392 392
                 }
393 393
             }
394 394
         }
@@ -409,16 +409,16 @@  discard block
 block discarded – undo
409 409
         $yi = $this->getY();
410 410
         $hrow = $this->fontSize;
411 411
         $textrows = $this->drawRows($w, $hrow, $strText, 0, $align, 0, 0, 0);
412
-        $maxrows = floor($h/$this->fontSize);
412
+        $maxrows = floor($h / $this->fontSize);
413 413
         $rows = min($textrows, $maxrows);
414 414
         $dy = 0;
415 415
         if (strtoupper($valign) == 'M') {
416
-            $dy = ($h-$rows*$this->fontSize)/2;
416
+            $dy = ($h - $rows * $this->fontSize) / 2;
417 417
         }
418 418
         if (strtoupper($valign) == 'B') {
419
-            $dy = $h-$rows*$this->fontSize;
419
+            $dy = $h - $rows * $this->fontSize;
420 420
         }
421
-        $this->setY($yi+$dy);
421
+        $this->setY($yi + $dy);
422 422
         $this->setX($xi);
423 423
         $this->drawRows($w, $hrow, $strText, 0, $align, false, $rows, 1);
424 424
         if ($border) {
@@ -440,17 +440,17 @@  discard block
 block discarded – undo
440 440
      */
441 441
     private function drawRows($w, $h, $txt, $border = 0, $align = 'J', $fill = false, $maxline = 0, $prn = 0)
442 442
     {
443
-        $cw =& $this->currentFont['cw'];
443
+        $cw = & $this->currentFont['cw'];
444 444
         if ($w == 0) {
445
-            $w = $this->w-$this->rMargin-$this->x;
445
+            $w = $this->w - $this->rMargin - $this->x;
446 446
         }
447
-        $wmax = ($w-2*$this->cMargin)*1000/$this->fontSize;
447
+        $wmax = ($w - 2 * $this->cMargin) * 1000 / $this->fontSize;
448 448
         $s = str_replace("\r", '', $txt);
449 449
         $nb = strlen($s);
450
-        if ($nb > 0 && $s[$nb-1] == "\n") {
450
+        if ($nb > 0 && $s[$nb - 1] == "\n") {
451 451
             $nb--;
452 452
         }
453
-        $b=0;
453
+        $b = 0;
454 454
         if ($border) {
455 455
             if ($border == 1) {
456 456
                 $border = 'LTRB';
@@ -464,7 +464,7 @@  discard block
 block discarded – undo
464 464
                 if (is_int(strpos($border, 'R'))) {
465 465
                     $b2 .= 'R';
466 466
                 }
467
-                $b = is_int(strpos($border, 'T')) ? $b2.'T' : $b2;
467
+                $b = is_int(strpos($border, 'T')) ? $b2 . 'T' : $b2;
468 468
             }
469 469
         }
470 470
         $sep = -1;
@@ -483,7 +483,7 @@  discard block
 block discarded – undo
483 483
                     }
484 484
                 }
485 485
                 if ($prn == 1) {
486
-                    $this->cell($w, $h, substr($s, $j, $i-$j), $b, 2, $align, $fill);
486
+                    $this->cell($w, $h, substr($s, $j, $i - $j), $b, 2, $align, $fill);
487 487
                 }
488 488
                 $i++;
489 489
                 $sep = -1;
@@ -517,19 +517,19 @@  discard block
 block discarded – undo
517 517
                         }
518 518
                     }
519 519
                     if ($prn == 1) {
520
-                        $this->cell($w, $h, substr($s, $j, $i-$j), $b, 2, $align, $fill);
520
+                        $this->cell($w, $h, substr($s, $j, $i - $j), $b, 2, $align, $fill);
521 521
                     }
522 522
                 } else {
523 523
                     if ($align == 'J') {
524
-                        $this->ws = ($ns>1) ? ($wmax-$ls)/1000*$this->FontSize/($ns-1) : 0;
524
+                        $this->ws = ($ns > 1) ? ($wmax - $ls) / 1000 * $this->FontSize / ($ns - 1) : 0;
525 525
                         if ($prn == 1) {
526
-                            $this->out(sprintf('%.3F Tw', $this->ws*$this->k));
526
+                            $this->out(sprintf('%.3F Tw', $this->ws * $this->k));
527 527
                         }
528 528
                     }
529 529
                     if ($prn == 1) {
530
-                        $this->cell($w, $h, substr($s, $j, $sep-$j), $b, 2, $align, $fill);
530
+                        $this->cell($w, $h, substr($s, $j, $sep - $j), $b, 2, $align, $fill);
531 531
                     }
532
-                    $i = $sep+1;
532
+                    $i = $sep + 1;
533 533
                 }
534 534
                 $sep = -1;
535 535
                 $j = $i;
@@ -556,7 +556,7 @@  discard block
 block discarded – undo
556 556
             $b .= 'B';
557 557
         }
558 558
         if ($prn == 1) {
559
-            $this->cell($w, $h, substr($s, $j, $i-$j), $b, 2, $align, $fill);
559
+            $this->cell($w, $h, substr($s, $j, $i - $j), $b, 2, $align, $fill);
560 560
         }
561 561
         $this->x = $this->lMargin;
562 562
         return $nl;
@@ -585,14 +585,14 @@  discard block
 block discarded – undo
585 585
                 $wordwidth = $this->getStringWidth($word);
586 586
                 if ($wordwidth > $maxwidth) {
587 587
                     // Word is too long, we cut it
588
-                    for ($i=0; $i < strlen($word); $i++) {
588
+                    for ($i = 0; $i < strlen($word); $i++) {
589 589
                         $wordwidth = $this->getStringWidth(substr($word, $i, 1));
590 590
                         if ($width + $wordwidth <= $maxwidth) {
591 591
                             $width += $wordwidth;
592 592
                             $text .= substr($word, $i, 1);
593 593
                         } else {
594 594
                             $width = $wordwidth;
595
-                            $text = rtrim($text)."\n".substr($word, $i, 1);
595
+                            $text = rtrim($text) . "\n" . substr($word, $i, 1);
596 596
                             $count++;
597 597
                         }
598 598
                     }
@@ -605,7 +605,7 @@  discard block
 block discarded – undo
605 605
                     $count++;
606 606
                 }
607 607
             }
608
-            $text = rtrim($text)."\n";
608
+            $text = rtrim($text) . "\n";
609 609
             $count++;
610 610
         }
611 611
         $text = rtrim($text);
@@ -637,21 +637,21 @@  discard block
 block discarded – undo
637 637
         $scale = false,
638 638
         $force = true
639 639
     ) {
640
-        $str_width=$this->getStringWidth($txt);
640
+        $str_width = $this->getStringWidth($txt);
641 641
         if ($w == 0) {
642
-            $w = $this->w-$this->rMargin-$this->x;
642
+            $w = $this->w - $this->rMargin - $this->x;
643 643
         }
644
-        $ratio = ($w-$this->cMargin*2)/$str_width;
644
+        $ratio = ($w - $this->cMargin * 2) / $str_width;
645 645
         $fit = ($ratio < 1 || ($ratio > 1 && $force));
646 646
         if ($fit) {
647 647
             if ($scale) {
648 648
                 //Calcula a escala horizontal
649
-                $horiz_scale = $ratio*100.0;
649
+                $horiz_scale = $ratio * 100.0;
650 650
                 //Ajusta a escala horizontal
651 651
                 $this->out(sprintf('BT %.2F Tz ET', $horiz_scale));
652 652
             } else {
653 653
                 //Calcula o espaçamento de caracteres em pontos
654
-                $char_space = ($w-$this->cMargin*2-$str_width)/max($this->_MBGetStringLength($txt)-1, 1)*$this->k;
654
+                $char_space = ($w - $this->cMargin * 2 - $str_width) / max($this->_MBGetStringLength($txt) - 1, 1) * $this->k;
655 655
                 //Ajusta o espaçamento de caracteres
656 656
                 $this->out(sprintf('BT %.2F Tc ET', $char_space));
657 657
             }
@@ -662,7 +662,7 @@  discard block
 block discarded – undo
662 662
         $this->cell($w, $h, $txt, $border, $ln, $align, $fill, $link);
663 663
         //Reseta o espaçamento de caracteres e a escala horizontal
664 664
         if ($fit) {
665
-            $this->out('BT '.($scale ? '100 Tz' : '0 Tc').' ET');
665
+            $this->out('BT ' . ($scale ? '100 Tz' : '0 Tc') . ' ET');
666 666
         }
667 667
     }
668 668
 
@@ -757,7 +757,7 @@  discard block
 block discarded – undo
757 757
             $len = 0;
758 758
             $nbbytes = strlen($s);
759 759
             for ($i = 0; $i < $nbbytes; $i++) {
760
-                if (ord($s[$i])<128) {
760
+                if (ord($s[$i]) < 128) {
761 761
                     $len++;
762 762
                 } else {
763 763
                     $len++;
@@ -783,11 +783,11 @@  discard block
 block discarded – undo
783 783
     {
784 784
         $this->setDrawColor(110);
785 785
         $this->setLineWidth($h);
786
-        $wDash = ($w/$n)/2;
787
-        for ($i=$x; $i<=$x+$w; $i += $wDash+$wDash) {
788
-            for ($j=$i; $j<= ($i+$wDash); $j++) {
789
-                if ($j <= ($x+$w-1)) {
790
-                    $this->line($j, $y, $j+1, $y);
786
+        $wDash = ($w / $n) / 2;
787
+        for ($i = $x; $i <= $x + $w; $i += $wDash + $wDash) {
788
+            for ($j = $i; $j <= ($i + $wDash); $j++) {
789
+                if ($j <= ($x + $w - 1)) {
790
+                    $this->line($j, $y, $j + 1, $y);
791 791
                 }
792 792
             }
793 793
         }
@@ -812,7 +812,7 @@  discard block
 block discarded – undo
812 812
             $y = $aux;
813 813
         }
814 814
         while ($y < $yfinal && $n > 0) {
815
-            $this->line($x, $y, $x, $y+1);
815
+            $this->line($x, $y, $x, $y + 1);
816 816
             $y += 3;
817 817
             $n--;
818 818
         }
Please login to merge, or discard this patch.