Completed
Pull Request — master (#307)
by Felipe
03:00
created
src/NFe/Danfe.php 1 patch
Spacing   +344 added lines, -345 removed lines patch added patch discarded remove patch
@@ -385,7 +385,7 @@  discard block
 block discarded – undo
385 385
             if ($papel == 'A4') {
386 386
                 $this->maxW = 297;
387 387
                 $this->maxH = 210;
388
-                $xInic = $margEsq+10;
388
+                $xInic = $margEsq + 10;
389 389
                 //se paisagem multiplica a largura do canhoto pela quantidade de canhotos
390 390
                 //$this->wCanhoto *= $this->qCanhoto;
391 391
             }
@@ -393,10 +393,10 @@  discard block
 block discarded – undo
393 393
         //total inicial de paginas
394 394
         $totPag = 1;
395 395
         //largura imprimivel em mm: largura da folha menos as margens esq/direita
396
-        $this->wPrint = $this->maxW-($margEsq * 2);
396
+        $this->wPrint = $this->maxW - ($margEsq * 2);
397 397
         //comprimento (altura) imprimivel em mm: altura da folha menos as margens
398 398
         //superior e inferior
399
-        $this->hPrint = $this->maxH-$margSup-$margInf;
399
+        $this->hPrint = $this->maxH - $margSup - $margInf;
400 400
         // estabelece contagem de paginas
401 401
         $this->pdf->aliasNbPages();
402 402
         // fixa as margens
@@ -440,9 +440,9 @@  discard block
 block discarded – undo
440 440
         }
441 441
         //calcular a altura necessária para os dados adicionais
442 442
         if ($this->orientacao == 'P') {
443
-            $this->wAdic = round($this->wPrint*0.66, 0);
443
+            $this->wAdic = round($this->wPrint * 0.66, 0);
444 444
         } else {
445
-            $this->wAdic = round(($this->wPrint-$this->wCanhoto)*0.5, 0);
445
+            $this->wAdic = round(($this->wPrint - $this->wCanhoto) * 0.5, 0);
446 446
         }
447 447
         $fontProduto = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>''];
448 448
         $this->textoAdic = '';
@@ -454,8 +454,8 @@  discard block
 block discarded – undo
454 454
             $txRetxBairro = $this->getTagValue($this->retirada, "xBairro");
455 455
             $txRetxMun = $this->getTagValue($this->retirada, "xMun");
456 456
             $txRetUF = $this->getTagValue($this->retirada, "UF");
457
-            $this->textoAdic .= "LOCAL DE RETIRADA : ".
458
-                    $txRetCNPJ.
457
+            $this->textoAdic .= "LOCAL DE RETIRADA : " .
458
+                    $txRetCNPJ .
459 459
                     '-' .
460 460
                     $txRetxLgr .
461 461
                     ', ' .
@@ -482,8 +482,8 @@  discard block
 block discarded – undo
482 482
             if ($this->textoAdic != '') {
483 483
                 $this->textoAdic .= ". \r\n";
484 484
             }
485
-            $this->textoAdic .= "LOCAL DE ENTREGA : ".$txRetCNPJ.'-'.$txRetxLgr.', '.$txRetnro.' '.$txRetxCpl.
486
-               ' - '.$txRetxBairro.' '.$txRetxMun.' - '.$txRetUF."\r\n";
485
+            $this->textoAdic .= "LOCAL DE ENTREGA : " . $txRetCNPJ . '-' . $txRetxLgr . ', ' . $txRetnro . ' ' . $txRetxCpl .
486
+               ' - ' . $txRetxBairro . ' ' . $txRetxMun . ' - ' . $txRetUF . "\r\n";
487 487
         }
488 488
         //informações adicionais
489 489
         $this->textoAdic .= $this->geraInformacoesDasNotasReferenciadas();
@@ -492,7 +492,7 @@  discard block
 block discarded – undo
492 492
             if ($this->textoAdic != '') {
493 493
                 $this->textoAdic .= ". \r\n";
494 494
             }
495
-            $this->textoAdic .= ! empty($this->getTagValue($this->infAdic, "infCpl"))
495
+            $this->textoAdic .= !empty($this->getTagValue($this->infAdic, "infCpl"))
496 496
             ? 'Inf. Contribuinte: ' . $this->anfaveaDANFE($this->getTagValue($this->infAdic, "infCpl"))
497 497
             : '';
498 498
             $infPedido = $this->geraInformacoesDaTagCompra();
@@ -500,14 +500,14 @@  discard block
 block discarded – undo
500 500
                 $this->textoAdic .= $infPedido;
501 501
             }
502 502
             $this->textoAdic .= $this->getTagValue($this->dest, "email", ' Email do Destinatário: ');
503
-            $this->textoAdic .= ! empty($this->getTagValue($this->infAdic, "infAdFisco"))
503
+            $this->textoAdic .= !empty($this->getTagValue($this->infAdic, "infAdFisco"))
504 504
             ? "\r\n Inf. fisco: " . $this->getTagValue($this->infAdic, "infAdFisco")
505 505
             : '';
506 506
             $obsCont = $this->infAdic->getElementsByTagName("obsCont");
507 507
             if (isset($obsCont)) {
508 508
                 foreach ($obsCont as $obs) {
509
-                    $campo =  $obsCont->item($i)->getAttribute("xCampo");
510
-                    $xTexto = ! empty($obsCont->item($i)->getElementsByTagName("xTexto")->item(0)->nodeValue)
509
+                    $campo = $obsCont->item($i)->getAttribute("xCampo");
510
+                    $xTexto = !empty($obsCont->item($i)->getElementsByTagName("xTexto")->item(0)->nodeValue)
511 511
                     ? $obsCont->item($i)->getElementsByTagName("xTexto")->item(0)->nodeValue
512 512
                     : '';
513 513
                     $this->textoAdic .= "\r\n" . $campo . ':  ' . trim($xTexto);
@@ -538,11 +538,11 @@  discard block
 block discarded – undo
538 538
             $numlinhasdados += $this->pdf->getNumLines($linha, $this->wAdic, $fontProduto);
539 539
         }
540 540
         $this->textadicfontsize = $this->pdf->fontSize;
541
-        $hdadosadic = round(($numlinhasdados+3) * $this->textadicfontsize, 0);
541
+        $hdadosadic = round(($numlinhasdados + 3) * $this->textadicfontsize, 0);
542 542
         if ($hdadosadic > 70) {
543
-            for ($per=1; $per>=0.01; $per=$per-0.01) {
544
-                $this->textadicfontsize = $this->pdf->fontSize*$per;
545
-                $hdadosadic = round(($numlinhasdados+3) * $this->textadicfontsize, 0);
543
+            for ($per = 1; $per >= 0.01; $per = $per - 0.01) {
544
+                $this->textadicfontsize = $this->pdf->fontSize * $per;
545
+                $hdadosadic = round(($numlinhasdados + 3) * $this->textadicfontsize, 0);
546 546
                 if ($hdadosadic <= 90) {
547 547
                     $hdadosadic = 70;
548 548
                     break;
@@ -554,9 +554,9 @@  discard block
 block discarded – undo
554 554
             $hdadosadic = 10;
555 555
         }
556 556
         //altura disponivel para os campos da DANFE
557
-        $hcabecalho = 47;//para cabeçalho
558
-        $hdestinatario = 25;//para destinatario
559
-        $hduplicatas = 12;//para cada grupo de 7 duplicatas
557
+        $hcabecalho = 47; //para cabeçalho
558
+        $hdestinatario = 25; //para destinatario
559
+        $hduplicatas = 12; //para cada grupo de 7 duplicatas
560 560
         if (isset($this->entrega)) {
561 561
             $hlocalentrega = 25;
562 562
         } else {
@@ -567,11 +567,11 @@  discard block
 block discarded – undo
567 567
         } else {
568 568
             $hlocalretirada = 0;
569 569
         }
570
-        $himposto = 18;// para imposto
571
-        $htransporte = 25;// para transporte
572
-        $hissqn = 11;// para issqn
573
-        $hfooter = 5;// para rodape
574
-        $hCabecItens = 4;//cabeçalho dos itens
570
+        $himposto = 18; // para imposto
571
+        $htransporte = 25; // para transporte
572
+        $hissqn = 11; // para issqn
573
+        $hfooter = 5; // para rodape
574
+        $hCabecItens = 4; //cabeçalho dos itens
575 575
         //alturas disponiveis para os dados
576 576
         $hDispo1 = $this->hPrint - 10 - ($hcabecalho +
577 577
             //$hdestinatario + ($linhasDup * $hduplicatas) + $himposto + $htransporte +
@@ -580,18 +580,18 @@  discard block
 block discarded – undo
580 580
             ($linhaISSQN * $hissqn) + $hdadosadic + $hfooter + $hCabecItens +
581 581
             $this->sizeExtraTextoFatura());
582 582
         if ($this->orientacao == 'P') {
583
-            $hDispo1 -= 24 * $this->qCanhoto;//para canhoto
583
+            $hDispo1 -= 24 * $this->qCanhoto; //para canhoto
584 584
             $w = $this->wPrint;
585 585
         } else {
586
-            $hcanhoto = $this->hPrint;//para canhoto
586
+            $hcanhoto = $this->hPrint; //para canhoto
587 587
             $w = $this->wPrint - $this->wCanhoto;
588 588
         }
589
-        $hDispo2 = $this->hPrint - 10 - ($hcabecalho + $hfooter + $hCabecItens)-4;
589
+        $hDispo2 = $this->hPrint - 10 - ($hcabecalho + $hfooter + $hCabecItens) - 4;
590 590
         //Contagem da altura ocupada para impressão dos itens
591 591
         $fontProduto = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>''];
592 592
         $numlinhas = 0;
593 593
         $hUsado = $hCabecItens;
594
-        $w2 = round($w*0.28, 0);
594
+        $w2 = round($w * 0.28, 0);
595 595
         $hDispo = $hDispo1;
596 596
         $totPag = 1;
597 597
         $i = 0;
@@ -604,7 +604,7 @@  discard block
 block discarded – undo
604 604
                 $hDispo = $hDispo2;
605 605
                 $hUsado = $hCabecItens;
606 606
                 // Remove canhoto para páginas secundárias em modo paisagem ('L')
607
-                $w2 = round($this->wPrint*0.28, 0);
607
+                $w2 = round($this->wPrint * 0.28, 0);
608 608
                 $i--; // decrementa para readicionar o item que não coube nessa pagina na outra.
609 609
             }
610 610
             $i++;
@@ -628,15 +628,15 @@  discard block
 block discarded – undo
628 628
         //coloca o cabeçalho
629 629
         $y = $this->header($x, $y, $pag, $totPag);
630 630
         //coloca os dados do destinatário
631
-        $y = $this->destinatarioDANFE($x, $y+1);
631
+        $y = $this->destinatarioDANFE($x, $y + 1);
632 632
         
633 633
         //coloca os dados do local de retirada
634 634
         if (isset($this->retirada)) {
635
-            $y = $this->localRetiradaDANFE($x, $y+1);
635
+            $y = $this->localRetiradaDANFE($x, $y + 1);
636 636
         }
637 637
         //coloca os dados do local de entrega
638 638
         if (isset($this->entrega)) {
639
-            $y = $this->localEntregaDANFE($x, $y+1);
639
+            $y = $this->localEntregaDANFE($x, $y + 1);
640 640
         }
641 641
         
642 642
         //Verifica as formas de pagamento da nota fiscal
@@ -651,29 +651,29 @@  discard block
 block discarded – undo
651 651
         }
652 652
         //caso tenha boleto imprimir fatura
653 653
         if ($this->dup->length > 0) {
654
-            $y = $this->fatura($x, $y+1);
654
+            $y = $this->fatura($x, $y + 1);
655 655
         } else {
656 656
             //Se somente tiver a forma de pagamento sem pagamento ou outros não imprimir nada
657
-            if (count($formaPag)=='1' && (isset($formaPag[90]) || isset($formaPag[99]))) {
657
+            if (count($formaPag) == '1' && (isset($formaPag[90]) || isset($formaPag[99]))) {
658 658
                 $y = $y;
659 659
             } else {
660 660
                 //caso tenha mais de uma forma de pagamento ou seja diferente de boleto exibe a
661 661
                 //forma de pagamento e o valor
662
-                $y = $this->pagamento($x, $y+1);
662
+                $y = $this->pagamento($x, $y + 1);
663 663
             }
664 664
         }
665 665
         //coloca os dados dos impostos e totais da NFe
666
-        $y = $this->imposto($x, $y+1);
666
+        $y = $this->imposto($x, $y + 1);
667 667
         //coloca os dados do trasnporte
668
-        $y = $this->transporte($x, $y+1);
668
+        $y = $this->transporte($x, $y + 1);
669 669
         //itens da DANFE
670 670
         $nInicial = 0;
671 671
 
672
-        $y = $this->itens($x, $y+1, $nInicial, $hDispo1, $pag, $totPag, $hCabecItens);
672
+        $y = $this->itens($x, $y + 1, $nInicial, $hDispo1, $pag, $totPag, $hCabecItens);
673 673
 
674 674
         //coloca os dados do ISSQN
675 675
         if ($linhaISSQN == 1) {
676
-            $y = $this->issqn($x, $y+4);
676
+            $y = $this->issqn($x, $y + 4);
677 677
         } else {
678 678
             $y += 4;
679 679
         }
@@ -702,7 +702,7 @@  discard block
 block discarded – undo
702 702
             //coloca o cabeçalho na página adicional
703 703
             $y = $this->header($x, $y, $n, $totPag);
704 704
             //coloca os itens na página adicional
705
-            $y = $this->itens($x, $y+1, $nInicial, $hDispo2, $n, $totPag, $hCabecItens);
705
+            $y = $this->itens($x, $y + 1, $nInicial, $hDispo2, $n, $totPag, $hCabecItens);
706 706
             //coloca o rodapé da página
707 707
             if ($this->orientacao == 'P') {
708 708
                 $this->rodape($margEsq);
@@ -739,7 +739,7 @@  discard block
 block discarded – undo
739 739
         if ($startPos === false) {
740 740
             return $cdata;
741 741
         }
742
-        for ($x=$len; $x>0; $x--) {
742
+        for ($x = $len; $x > 0; $x--) {
743 743
             if (substr($cdata, $x, 1) == '>') {
744 744
                 $endPos = $x;
745 745
                 break;
@@ -750,15 +750,15 @@  discard block
 block discarded – undo
750 750
         } else {
751 751
             $parte1 = '';
752 752
         }
753
-        $parte2 = substr($cdata, $startPos, $endPos-$startPos+1);
753
+        $parte2 = substr($cdata, $startPos, $endPos - $startPos + 1);
754 754
         if ($endPos < $len) {
755 755
             $parte3 = substr($cdata, $endPos + 1, $len - $endPos - 1);
756 756
         } else {
757 757
             $parte3 = '';
758 758
         }
759
-        $texto = trim($parte1).' '.trim($parte3);
759
+        $texto = trim($parte1) . ' ' . trim($parte3);
760 760
         if (strpos($parte2, '<CDATA>') === false) {
761
-            $cdata = '<CDATA>'.$parte2.'</CDATA>';
761
+            $cdata = '<CDATA>' . $parte2 . '</CDATA>';
762 762
         } else {
763 763
             $cdata = $parte2;
764 764
         }
@@ -832,15 +832,15 @@  discard block
 block discarded – undo
832 832
         //grupo CADATA infCpl
833 833
         $t = $dom->getElementsByTagName('transmissor')->item(0);
834 834
         $r = $dom->getElementsByTagName('receptor')->item(0);
835
-        $versao = ! empty($dom->getElementsByTagName('versao')->item(0)->nodeValue) ?
836
-            'Versao:'.$dom->getElementsByTagName('versao')->item(0)->nodeValue.' ' : '';
837
-        $especieNF = ! empty($dom->getElementsByTagName('especieNF')->item(0)->nodeValue) ?
838
-            'Especie:'.$dom->getElementsByTagName('especieNF')->item(0)->nodeValue.' ' : '';
839
-        $fabEntrega = ! empty($dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue) ?
840
-            'Entrega:'.$dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue.' ' : '';
841
-        $dca = ! empty($dom->getElementsByTagName('dca')->item(0)->nodeValue) ?
842
-            'dca:'.$dom->getElementsByTagName('dca')->item(0)->nodeValue.' ' : '';
843
-        $texto .= "".$versao.$especieNF.$fabEntrega.$dca;
835
+        $versao = !empty($dom->getElementsByTagName('versao')->item(0)->nodeValue) ?
836
+            'Versao:' . $dom->getElementsByTagName('versao')->item(0)->nodeValue . ' ' : '';
837
+        $especieNF = !empty($dom->getElementsByTagName('especieNF')->item(0)->nodeValue) ?
838
+            'Especie:' . $dom->getElementsByTagName('especieNF')->item(0)->nodeValue . ' ' : '';
839
+        $fabEntrega = !empty($dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue) ?
840
+            'Entrega:' . $dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue . ' ' : '';
841
+        $dca = !empty($dom->getElementsByTagName('dca')->item(0)->nodeValue) ?
842
+            'dca:' . $dom->getElementsByTagName('dca')->item(0)->nodeValue . ' ' : '';
843
+        $texto .= "" . $versao . $especieNF . $fabEntrega . $dca;
844 844
         if (isset($t)) {
845 845
             if ($t->hasAttributes()) {
846 846
                 $texto .= " Transmissor ";
@@ -926,14 +926,14 @@  discard block
 block discarded – undo
926 926
         }
927 927
         //####################################################################################
928 928
         //coluna esquerda identificação do emitente
929
-        $w = round($maxW*0.41, 0);
929
+        $w = round($maxW * 0.41, 0);
930 930
         if ($this->orientacao == 'P') {
931 931
             $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>'I'];
932 932
         } else {
933 933
             $aFont = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B'];
934 934
         }
935 935
         $w1 = $w;
936
-        $h=32;
936
+        $h = 32;
937 937
         $oldY += $h;
938 938
         $this->pdf->textBox($x, $y, $w, $h);
939 939
         $texto = 'IDENTIFICAÇÃO DO EMITENTE';
@@ -954,39 +954,39 @@  discard block
 block discarded – undo
954 954
                 $type == 'jpg';
955 955
             }
956 956
             //largura da imagem em mm
957
-            $logoWmm = ($logoInfo[0]/72)*25.4;
957
+            $logoWmm = ($logoInfo[0] / 72) * 25.4;
958 958
             //altura da imagem em mm
959
-            $logoHmm = ($logoInfo[1]/72)*25.4;
960
-            if ($this->logoAlign=='L') {
961
-                $nImgW = round($w/3, 0);
962
-                $nImgH = round($logoHmm * ($nImgW/$logoWmm), 0);
963
-                $xImg = $x+1;
964
-                $yImg = round(($h-$nImgH)/2, 0)+$y;
959
+            $logoHmm = ($logoInfo[1] / 72) * 25.4;
960
+            if ($this->logoAlign == 'L') {
961
+                $nImgW = round($w / 3, 0);
962
+                $nImgH = round($logoHmm * ($nImgW / $logoWmm), 0);
963
+                $xImg = $x + 1;
964
+                $yImg = round(($h - $nImgH) / 2, 0) + $y;
965 965
                 //estabelecer posições do texto
966
-                $x1 = round($xImg + $nImgW +1, 0);
967
-                $y1 = round($h/3+$y, 0);
968
-                $tw = round(2*$w/3, 0);
969
-            } elseif ($this->logoAlign=='C') {
970
-                $nImgH = round($h/3, 0);
971
-                $nImgW = round($logoWmm * ($nImgH/$logoHmm), 0);
972
-                $xImg = round(($w-$nImgW)/2+$x, 0);
973
-                $yImg = $y+3;
966
+                $x1 = round($xImg + $nImgW + 1, 0);
967
+                $y1 = round($h / 3 + $y, 0);
968
+                $tw = round(2 * $w / 3, 0);
969
+            } elseif ($this->logoAlign == 'C') {
970
+                $nImgH = round($h / 3, 0);
971
+                $nImgW = round($logoWmm * ($nImgH / $logoHmm), 0);
972
+                $xImg = round(($w - $nImgW) / 2 + $x, 0);
973
+                $yImg = $y + 3;
974 974
                 $x1 = $x;
975 975
                 $y1 = round($yImg + $nImgH + 1, 0);
976 976
                 $tw = $w;
977
-            } elseif ($this->logoAlign=='R') {
978
-                $nImgW = round($w/3, 0);
979
-                $nImgH = round($logoHmm * ($nImgW/$logoWmm), 0);
980
-                $xImg = round($x+($w-(1+$nImgW)), 0);
981
-                $yImg = round(($h-$nImgH)/2, 0)+$y;
977
+            } elseif ($this->logoAlign == 'R') {
978
+                $nImgW = round($w / 3, 0);
979
+                $nImgH = round($logoHmm * ($nImgW / $logoWmm), 0);
980
+                $xImg = round($x + ($w - (1 + $nImgW)), 0);
981
+                $yImg = round(($h - $nImgH) / 2, 0) + $y;
982 982
                 $x1 = $x;
983
-                $y1 = round($h/3+$y, 0);
984
-                $tw = round(2*$w/3, 0);
985
-            } elseif ($this->logoAlign=='F') {
986
-                $nImgH = round($h-5, 0);
987
-                $nImgW = round($logoWmm * ($nImgH/$logoHmm), 0);
988
-                $xImg = round(($w-$nImgW)/2+$x, 0);
989
-                $yImg = $y+3;
983
+                $y1 = round($h / 3 + $y, 0);
984
+                $tw = round(2 * $w / 3, 0);
985
+            } elseif ($this->logoAlign == 'F') {
986
+                $nImgH = round($h - 5, 0);
987
+                $nImgW = round($logoWmm * ($nImgH / $logoHmm), 0);
988
+                $xImg = round(($w - $nImgW) / 2 + $x, 0);
989
+                $yImg = $y + 3;
990 990
                 $x1 = $x;
991 991
                 $y1 = round($yImg + $nImgH + 1, 0);
992 992
                 $tw = $w;
@@ -995,7 +995,7 @@  discard block
 block discarded – undo
995 995
             $this->pdf->Image($this->logomarca, $xImg, $yImg, $nImgW, $nImgH, $type);
996 996
         } else {
997 997
             $x1 = $x;
998
-            $y1 = round($h/3+$y, 0);
998
+            $y1 = round($h / 3 + $y, 0);
999 999
             $tw = $w;
1000 1000
         }
1001 1001
         // monta as informações apenas se diferente de full logo
@@ -1005,9 +1005,9 @@  discard block
 block discarded – undo
1005 1005
             $texto = $this->emit->getElementsByTagName("xNome")->item(0)->nodeValue;
1006 1006
             $this->pdf->textBox($x1, $y1, $tw, 8, $texto, $aFont, 'T', 'C', 0, '');
1007 1007
             //endereço
1008
-            $y1 = $y1+5;
1008
+            $y1 = $y1 + 5;
1009 1009
             $aFont = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>''];
1010
-            $fone = ! empty($this->enderEmit->getElementsByTagName("fone")->item(0)->nodeValue)
1010
+            $fone = !empty($this->enderEmit->getElementsByTagName("fone")->item(0)->nodeValue)
1011 1011
             ? $this->enderEmit->getElementsByTagName("fone")->item(0)->nodeValue
1012 1012
             : '';
1013 1013
             $lgr = $this->getTagValue($this->enderEmit, "xLgr");
@@ -1027,33 +1027,33 @@  discard block
 block discarded – undo
1027 1027
         //####################################################################################
1028 1028
         //coluna central Danfe
1029 1029
         $x += $w;
1030
-        $w=round($maxW * 0.17, 0);//35;
1030
+        $w = round($maxW * 0.17, 0); //35;
1031 1031
         $w2 = $w;
1032 1032
         $h = 32;
1033 1033
         $this->pdf->textBox($x, $y, $w, $h);
1034 1034
   
1035 1035
         $texto = "DANFE";
1036 1036
         $aFont = ['font'=>$this->fontePadrao, 'size'=>14, 'style'=>'B'];
1037
-        $this->pdf->textBox($x, $y+1, $w, $h, $texto, $aFont, 'T', 'C', 0, '');
1037
+        $this->pdf->textBox($x, $y + 1, $w, $h, $texto, $aFont, 'T', 'C', 0, '');
1038 1038
         $aFont = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>''];
1039 1039
         $texto = 'Documento Auxiliar da Nota Fiscal Eletrônica';
1040 1040
         $h = 20;
1041
-        $this->pdf->textBox($x, $y+6, $w, $h, $texto, $aFont, 'T', 'C', 0, '', false);
1041
+        $this->pdf->textBox($x, $y + 6, $w, $h, $texto, $aFont, 'T', 'C', 0, '', false);
1042 1042
 
1043 1043
         $aFont = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>''];
1044 1044
         $texto = '0 - ENTRADA';
1045 1045
         $y1 = $y + 14;
1046 1046
         $h = 8;
1047
-        $this->pdf->textBox($x+2, $y1, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1047
+        $this->pdf->textBox($x + 2, $y1, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1048 1048
         $texto = '1 - SAÍDA';
1049 1049
         $y1 = $y + 17;
1050
-        $this->pdf->textBox($x+2, $y1, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1050
+        $this->pdf->textBox($x + 2, $y1, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1051 1051
         //tipo de nF
1052 1052
         $aFont = ['font'=>$this->fontePadrao, 'size'=>12, 'style'=>'B'];
1053 1053
         $y1 = $y + 13;
1054 1054
         $h = 7;
1055 1055
         $texto = $this->ide->getElementsByTagName('tpNF')->item(0)->nodeValue;
1056
-        $this->pdf->textBox($x+27, $y1, 5, $h, $texto, $aFont, 'C', 'C', 1, '');
1056
+        $this->pdf->textBox($x + 27, $y1, 5, $h, $texto, $aFont, 'C', 'C', 1, '');
1057 1057
         //numero da NF
1058 1058
         $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'];
1059 1059
         $y1 = $y + 20;
@@ -1085,7 +1085,7 @@  discard block
 block discarded – undo
1085 1085
         //####################################################################################
1086 1086
         //coluna codigo de barras
1087 1087
         $x += $w;
1088
-        $w = ($maxW-$w1-$w2);//85;
1088
+        $w = ($maxW - $w1 - $w2); //85;
1089 1089
         $w3 = $w;
1090 1090
         $h = 32;
1091 1091
         $this->pdf->textBox($x, $y, $w, $h);
@@ -1094,22 +1094,22 @@  discard block
 block discarded – undo
1094 1094
         $bW = 75;
1095 1095
         $bH = 12;
1096 1096
         //codigo de barras
1097
-        $this->pdf->code128($x+(($w-$bW)/2), $y+2, $chave_acesso, $bW, $bH);
1097
+        $this->pdf->code128($x + (($w - $bW) / 2), $y + 2, $chave_acesso, $bW, $bH);
1098 1098
         //linhas divisorias
1099
-        $this->pdf->line($x, $y+4+$bH, $x+$w, $y+4+$bH);
1100
-        $this->pdf->line($x, $y+12+$bH, $x+$w, $y+12+$bH);
1099
+        $this->pdf->line($x, $y + 4 + $bH, $x + $w, $y + 4 + $bH);
1100
+        $this->pdf->line($x, $y + 12 + $bH, $x + $w, $y + 12 + $bH);
1101 1101
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1102
-        $y1 = $y+4+$bH;
1102
+        $y1 = $y + 4 + $bH;
1103 1103
         $h = 7;
1104 1104
         $texto = 'CHAVE DE ACESSO';
1105 1105
         $this->pdf->textBox($x, $y1, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1106 1106
         $aFont = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B'];
1107
-        $y1 = $y+8+$bH;
1107
+        $y1 = $y + 8 + $bH;
1108 1108
         $texto = $this->formatField($chave_acesso, $this->formatoChave);
1109
-        $this->pdf->textBox($x+2, $y1, $w-2, $h, $texto, $aFont, 'T', 'C', 0, '');
1110
-        $y1 = $y+12+$bH;
1109
+        $this->pdf->textBox($x + 2, $y1, $w - 2, $h, $texto, $aFont, 'T', 'C', 0, '');
1110
+        $y1 = $y + 12 + $bH;
1111 1111
         $aFont = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>''];
1112
-        $chaveContingencia="";
1112
+        $chaveContingencia = "";
1113 1113
         if ($this->notaDpec()) {
1114 1114
             $cabecalhoProtoAutorizacao = 'NÚMERO DE REGISTRO DPEC';
1115 1115
         } else {
@@ -1120,16 +1120,16 @@  discard block
 block discarded – undo
1120 1120
             $chaveContingencia = $this->geraChaveAdicionalDeContingencia();
1121 1121
             $this->pdf->setFillColor(0, 0, 0);
1122 1122
             //codigo de barras
1123
-            $this->pdf->code128($x+11, $y1+1, $chaveContingencia, $bW*.9, $bH/2);
1123
+            $this->pdf->code128($x + 11, $y1 + 1, $chaveContingencia, $bW * .9, $bH / 2);
1124 1124
         } else {
1125 1125
             $texto = 'Consulta de autenticidade no portal nacional da NF-e';
1126
-            $this->pdf->textBox($x+2, $y1, $w-2, $h, $texto, $aFont, 'T', 'C', 0, '');
1127
-            $y1 = $y+16+$bH;
1126
+            $this->pdf->textBox($x + 2, $y1, $w - 2, $h, $texto, $aFont, 'T', 'C', 0, '');
1127
+            $y1 = $y + 16 + $bH;
1128 1128
             $texto = 'www.nfe.fazenda.gov.br/portal ou no site da Sefaz Autorizadora';
1129 1129
             $this->pdf->textBox(
1130
-                $x+2,
1130
+                $x + 2,
1131 1131
                 $y1,
1132
-                $w-2,
1132
+                $w - 2,
1133 1133
                 $h,
1134 1134
                 $texto,
1135 1135
                 $aFont,
@@ -1145,7 +1145,7 @@  discard block
 block discarded – undo
1145 1145
         //natureza da operação
1146 1146
         $texto = 'NATUREZA DA OPERAÇÃO';
1147 1147
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1148
-        $w = $w1+$w2;
1148
+        $w = $w1 + $w2;
1149 1149
         $y = $oldY;
1150 1150
         $oldY += $h;
1151 1151
         $x = $oldX;
@@ -1178,7 +1178,7 @@  discard block
 block discarded – undo
1178 1178
                 $cStat = '';
1179 1179
             } else {
1180 1180
                 if (isset($this->nfeProc)) {
1181
-                    $texto = ! empty($this->nfeProc->getElementsByTagName("nProt")->item(0)->nodeValue)
1181
+                    $texto = !empty($this->nfeProc->getElementsByTagName("nProt")->item(0)->nodeValue)
1182 1182
                     ? $this->nfeProc->getElementsByTagName("nProt")->item(0)->nodeValue
1183 1183
                     : '';
1184 1184
                     $tsHora = $this->toTimestamp(
@@ -1220,22 +1220,22 @@  discard block
 block discarded – undo
1220 1220
         $texto = 'INSCRIÇÃO ESTADUAL DO SUBST. TRIBUT.';
1221 1221
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1222 1222
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1223
-        $texto = ! empty($this->emit->getElementsByTagName("IEST")->item(0)->nodeValue)
1223
+        $texto = !empty($this->emit->getElementsByTagName("IEST")->item(0)->nodeValue)
1224 1224
         ? $this->emit->getElementsByTagName("IEST")->item(0)->nodeValue
1225 1225
         : '';
1226 1226
         $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'];
1227 1227
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1228 1228
         //CNPJ
1229 1229
         $x += $w;
1230
-        $w = ($maxW-(3 * $w));
1230
+        $w = ($maxW - (3 * $w));
1231 1231
         //Pegando valor do CPF/CNPJ
1232
-        if (! empty($this->emit->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1232
+        if (!empty($this->emit->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1233 1233
             $texto = $this->formatField(
1234 1234
                 $this->emit->getElementsByTagName("CNPJ")->item(0)->nodeValue,
1235 1235
                 "###.###.###/####-##"
1236 1236
             );
1237 1237
         } else {
1238
-            $texto = ! empty($this->emit->getElementsByTagName("CPF")->item(0)->nodeValue)
1238
+            $texto = !empty($this->emit->getElementsByTagName("CPF")->item(0)->nodeValue)
1239 1239
             ? $this->formatField(
1240 1240
                 $this->emit->getElementsByTagName("CPF")->item(0)->nodeValue,
1241 1241
                 "###.###.###-##"
@@ -1252,22 +1252,22 @@  discard block
 block discarded – undo
1252 1252
         $resp = $this->statusNFe();
1253 1253
         if (!$resp['status']) {
1254 1254
             $x = 10;
1255
-            $y = $this->hPrint-130;
1255
+            $y = $this->hPrint - 130;
1256 1256
             $h = 25;
1257
-            $w = $maxW-(2*$x);
1257
+            $w = $maxW - (2 * $x);
1258 1258
             $this->pdf->settextcolor(90, 90, 90);
1259 1259
             $texto = $resp['message'];
1260 1260
             $aFont = ['font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B'];
1261 1261
             $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1262 1262
             $y += $h;
1263 1263
             $h = 5;
1264
-            $w = $maxW-(2*$x);
1264
+            $w = $maxW - (2 * $x);
1265 1265
             if (isset($this->infProt) && $resp['status']) {
1266 1266
                 $xMotivo = $this->infProt->getElementsByTagName("xMotivo")->item(0)->nodeValue;
1267 1267
             } else {
1268 1268
                 $xMotivo = '';
1269 1269
             }
1270
-            $texto = "SEM VALOR FISCAL\n".$xMotivo;
1270
+            $texto = "SEM VALOR FISCAL\n" . $xMotivo;
1271 1271
             $aFont = ['font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B'];
1272 1272
             $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1273 1273
             $this->pdf->settextcolor(0, 0, 0);
@@ -1290,12 +1290,12 @@  discard block
 block discarded – undo
1290 1290
         if ($this->notaDpec() || $this->tpEmis == 4) {
1291 1291
             //DPEC
1292 1292
             $x = 10;
1293
-            $y = $this->hPrint-130;
1293
+            $y = $this->hPrint - 130;
1294 1294
             $h = 25;
1295
-            $w = $maxW-(2*$x);
1295
+            $w = $maxW - (2 * $x);
1296 1296
             $this->pdf->SetTextColor(200, 200, 200);
1297
-            $texto = "DANFE impresso em contingência -\n".
1298
-                     "DPEC regularmente recebido pela Receita\n".
1297
+            $texto = "DANFE impresso em contingência -\n" .
1298
+                     "DPEC regularmente recebido pela Receita\n" .
1299 1299
                      "Federal do Brasil";
1300 1300
             $aFont = ['font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B'];
1301 1301
             $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
@@ -1414,7 +1414,7 @@  discard block
 block discarded – undo
1414 1414
         $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
1415 1415
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1416 1416
         //NOME / RAZÃO SOCIAL
1417
-        $w = round($maxW*0.61, 0);
1417
+        $w = round($maxW * 0.61, 0);
1418 1418
         $w1 = $w;
1419 1419
         $y += 3;
1420 1420
         $texto = 'NOME / RAZÃO SOCIAL';
@@ -1429,19 +1429,19 @@  discard block
 block discarded – undo
1429 1429
         }
1430 1430
         //CNPJ / CPF
1431 1431
         $x += $w;
1432
-        $w = round($maxW*0.23, 0);
1432
+        $w = round($maxW * 0.23, 0);
1433 1433
         $w2 = $w;
1434 1434
         $texto = 'CNPJ / CPF';
1435 1435
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1436 1436
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1437 1437
         //Pegando valor do CPF/CNPJ
1438
-        if (! empty($this->dest->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1438
+        if (!empty($this->dest->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1439 1439
             $texto = $this->formatField(
1440 1440
                 $this->dest->getElementsByTagName("CNPJ")->item(0)->nodeValue,
1441 1441
                 "###.###.###/####-##"
1442 1442
             );
1443 1443
         } else {
1444
-            $texto = ! empty($this->dest->getElementsByTagName("CPF")->item(0)->nodeValue)
1444
+            $texto = !empty($this->dest->getElementsByTagName("CPF")->item(0)->nodeValue)
1445 1445
             ? $this->formatField(
1446 1446
                 $this->dest->getElementsByTagName("CPF")->item(0)->nodeValue,
1447 1447
                 "###.###.###-##"
@@ -1452,16 +1452,16 @@  discard block
 block discarded – undo
1452 1452
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1453 1453
         //DATA DA EMISSÃO
1454 1454
         $x += $w;
1455
-        $w = $maxW-($w1+$w2);
1455
+        $w = $maxW - ($w1 + $w2);
1456 1456
         $wx = $w;
1457 1457
         $texto = 'DATA DA EMISSÃO';
1458 1458
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1459 1459
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1460
-        $dEmi = ! empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue)
1460
+        $dEmi = !empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue)
1461 1461
         ? $this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue
1462 1462
         : '';
1463 1463
         if ($dEmi == '') {
1464
-            $dEmi = ! empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue)
1464
+            $dEmi = !empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue)
1465 1465
             ? $this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue
1466 1466
             : '';
1467 1467
             $aDemi = explode('T', $dEmi);
@@ -1475,7 +1475,7 @@  discard block
 block discarded – undo
1475 1475
             $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 1, '');
1476 1476
         }
1477 1477
         //ENDEREÇO
1478
-        $w = round($maxW*0.47, 0);
1478
+        $w = round($maxW * 0.47, 0);
1479 1479
         $w1 = $w;
1480 1480
         $y += $h;
1481 1481
         $x = $oldX;
@@ -1490,7 +1490,7 @@  discard block
 block discarded – undo
1490 1490
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 0, '', true);
1491 1491
         //BAIRRO / DISTRITO
1492 1492
         $x += $w;
1493
-        $w = round($maxW*0.21, 0);
1493
+        $w = round($maxW * 0.21, 0);
1494 1494
         $w2 = $w;
1495 1495
         $texto = 'BAIRRO / DISTRITO';
1496 1496
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
@@ -1500,12 +1500,12 @@  discard block
 block discarded – undo
1500 1500
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1501 1501
         //CEP
1502 1502
         $x += $w;
1503
-        $w = $maxW-$w1-$w2-$wx;
1503
+        $w = $maxW - $w1 - $w2 - $wx;
1504 1504
         $w2 = $w;
1505 1505
         $texto = 'CEP';
1506 1506
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1507 1507
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1508
-        $texto = ! empty($this->dest->getElementsByTagName("CEP")->item(0)->nodeValue)
1508
+        $texto = !empty($this->dest->getElementsByTagName("CEP")->item(0)->nodeValue)
1509 1509
         ? $this->dest->getElementsByTagName("CEP")->item(0)->nodeValue
1510 1510
         : '';
1511 1511
         $texto = $this->formatField($texto, "#####-###");
@@ -1517,11 +1517,11 @@  discard block
 block discarded – undo
1517 1517
         $texto = 'DATA DA SAÍDA/ENTRADA';
1518 1518
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1519 1519
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1520
-        $dSaiEnt = ! empty($this->ide->getElementsByTagName("dSaiEnt")->item(0)->nodeValue)
1520
+        $dSaiEnt = !empty($this->ide->getElementsByTagName("dSaiEnt")->item(0)->nodeValue)
1521 1521
             ? $this->ide->getElementsByTagName("dSaiEnt")->item(0)->nodeValue
1522 1522
             : '';
1523 1523
         if ($dSaiEnt == '') {
1524
-            $dSaiEnt = ! empty($this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue)
1524
+            $dSaiEnt = !empty($this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue)
1525 1525
                 ? $this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue
1526 1526
                 : '';
1527 1527
             $aDsaient = explode('T', $dSaiEnt);
@@ -1541,7 +1541,7 @@  discard block
 block discarded – undo
1541 1541
         if (strtoupper(trim($texto)) == "EXTERIOR"
1542 1542
             && $this->dest->getElementsByTagName("xPais")->length > 0
1543 1543
         ) {
1544
-            $texto .= " - " .  $this->dest->getElementsByTagName("xPais")->item(0)->nodeValue;
1544
+            $texto .= " - " . $this->dest->getElementsByTagName("xPais")->item(0)->nodeValue;
1545 1545
         }
1546 1546
         $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'];
1547 1547
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 0, '');
@@ -1556,19 +1556,19 @@  discard block
 block discarded – undo
1556 1556
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1557 1557
         //FONE / FAX
1558 1558
         $x += $w;
1559
-        $w = round(($maxW -$w1-$wx-8)/2, 0);
1559
+        $w = round(($maxW - $w1 - $wx - 8) / 2, 0);
1560 1560
         $w3 = $w;
1561 1561
         $texto = 'FONE / FAX';
1562 1562
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1563 1563
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1564
-        $texto = ! empty($this->dest->getElementsByTagName("fone")->item(0)->nodeValue)
1564
+        $texto = !empty($this->dest->getElementsByTagName("fone")->item(0)->nodeValue)
1565 1565
         ? $this->dest->getElementsByTagName("fone")->item(0)->nodeValue
1566 1566
         : '';
1567 1567
         $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'];
1568 1568
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1569 1569
         //INSCRIÇÃO ESTADUAL
1570 1570
         $x += $w;
1571
-        $w = $maxW -$w1-$wx-8-$w3;
1571
+        $w = $maxW - $w1 - $wx - 8 - $w3;
1572 1572
         $texto = 'INSCRIÇÃO ESTADUAL';
1573 1573
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1574 1574
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -1582,11 +1582,11 @@  discard block
 block discarded – undo
1582 1582
         $texto = 'HORA DA SAÍDA/ENTRADA';
1583 1583
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1584 1584
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1585
-        $hSaiEnt = ! empty($this->ide->getElementsByTagName("hSaiEnt")->item(0)->nodeValue)
1585
+        $hSaiEnt = !empty($this->ide->getElementsByTagName("hSaiEnt")->item(0)->nodeValue)
1586 1586
         ? $this->ide->getElementsByTagName("hSaiEnt")->item(0)->nodeValue
1587 1587
         : '';
1588 1588
         if ($hSaiEnt == '') {
1589
-            $dhSaiEnt = ! empty($this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue)
1589
+            $dhSaiEnt = !empty($this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue)
1590 1590
             ? $this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue
1591 1591
             : '';
1592 1592
             $tsDhSaiEnt = $this->toTimestamp($dhSaiEnt);
@@ -1625,7 +1625,7 @@  discard block
 block discarded – undo
1625 1625
         $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
1626 1626
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1627 1627
         //NOME / RAZÃO SOCIAL
1628
-        $w = round($maxW*0.61, 0);
1628
+        $w = round($maxW * 0.61, 0);
1629 1629
         $w1 = $w;
1630 1630
         $y += 3;
1631 1631
         $texto = 'NOME / RAZÃO SOCIAL';
@@ -1643,19 +1643,19 @@  discard block
 block discarded – undo
1643 1643
         }
1644 1644
         //CNPJ / CPF
1645 1645
         $x += $w;
1646
-        $w = round($maxW*0.23, 0);
1646
+        $w = round($maxW * 0.23, 0);
1647 1647
         $w2 = $w;
1648 1648
         $texto = 'CNPJ / CPF';
1649 1649
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1650 1650
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1651 1651
         //Pegando valor do CPF/CNPJ
1652
-        if (! empty($this->entrega->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1652
+        if (!empty($this->entrega->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1653 1653
             $texto = $this->formatField(
1654 1654
                 $this->entrega->getElementsByTagName("CNPJ")->item(0)->nodeValue,
1655 1655
                 "###.###.###/####-##"
1656 1656
             );
1657 1657
         } else {
1658
-            $texto = ! empty($this->entrega->getElementsByTagName("CPF")->item(0)->nodeValue) ?
1658
+            $texto = !empty($this->entrega->getElementsByTagName("CPF")->item(0)->nodeValue) ?
1659 1659
                     $this->formatField(
1660 1660
                         $this->entrega->getElementsByTagName("CPF")->item(0)->nodeValue,
1661 1661
                         "###.###.###-##"
@@ -1665,7 +1665,7 @@  discard block
 block discarded – undo
1665 1665
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1666 1666
         //INSCRIÇÃO ESTADUAL
1667 1667
         $x += $w;
1668
-        $w = $maxW-($w1+$w2);
1668
+        $w = $maxW - ($w1 + $w2);
1669 1669
         $wx = $w;
1670 1670
         $texto = 'INSCRIÇÃO ESTADUAL';
1671 1671
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
@@ -1681,7 +1681,7 @@  discard block
 block discarded – undo
1681 1681
             $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 1, '');
1682 1682
         }
1683 1683
         //ENDEREÇO
1684
-        $w = round($maxW*0.355, 0) + $wx;
1684
+        $w = round($maxW * 0.355, 0) + $wx;
1685 1685
         $w1 = $w;
1686 1686
         $y += $h;
1687 1687
         $x = $oldX;
@@ -1695,7 +1695,7 @@  discard block
 block discarded – undo
1695 1695
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 0, '', true);
1696 1696
         //BAIRRO / DISTRITO
1697 1697
         $x += $w;
1698
-        $w = round($maxW*0.335, 0);
1698
+        $w = round($maxW * 0.335, 0);
1699 1699
         $w2 = $w;
1700 1700
         $texto = 'BAIRRO / DISTRITO';
1701 1701
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
@@ -1705,17 +1705,17 @@  discard block
 block discarded – undo
1705 1705
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1706 1706
         //CEP
1707 1707
         $x += $w;
1708
-        $w = $maxW-($w1+$w2);
1708
+        $w = $maxW - ($w1 + $w2);
1709 1709
         $texto = 'CEP';
1710 1710
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1711 1711
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1712
-        $texto = ! empty($this->entrega->getElementsByTagName("CEP")->item(0)->nodeValue) ?
1712
+        $texto = !empty($this->entrega->getElementsByTagName("CEP")->item(0)->nodeValue) ?
1713 1713
                 $this->entrega->getElementsByTagName("CEP")->item(0)->nodeValue : '';
1714 1714
         $texto = $this->formatField($texto, "#####-###");
1715 1715
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
1716 1716
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1717 1717
         //MUNICÍPIO
1718
-        $w = round($maxW*0.805, 0);
1718
+        $w = round($maxW * 0.805, 0);
1719 1719
         $w1 = $w;
1720 1720
         $y += $h;
1721 1721
         $x = $oldX;
@@ -1724,7 +1724,7 @@  discard block
 block discarded – undo
1724 1724
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1725 1725
         $texto = $this->entrega->getElementsByTagName("xMun")->item(0)->nodeValue;
1726 1726
         if (strtoupper(trim($texto)) == "EXTERIOR" && $this->entrega->getElementsByTagName("xPais")->length > 0) {
1727
-            $texto .= " - " .  $this->entrega->getElementsByTagName("xPais")->item(0)->nodeValue;
1727
+            $texto .= " - " . $this->entrega->getElementsByTagName("xPais")->item(0)->nodeValue;
1728 1728
         }
1729 1729
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
1730 1730
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 0, '');
@@ -1739,11 +1739,11 @@  discard block
 block discarded – undo
1739 1739
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1740 1740
         //FONE / FAX
1741 1741
         $x += $w;
1742
-        $w = $maxW-$w-$w1;
1742
+        $w = $maxW - $w - $w1;
1743 1743
         $texto = 'FONE / FAX';
1744 1744
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1745 1745
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1746
-        $texto = ! empty($this->entrega->getElementsByTagName("fone")->item(0)->nodeValue) ?
1746
+        $texto = !empty($this->entrega->getElementsByTagName("fone")->item(0)->nodeValue) ?
1747 1747
                 $this->entrega->getElementsByTagName("fone")->item(0)->nodeValue : '';
1748 1748
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
1749 1749
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
@@ -1775,7 +1775,7 @@  discard block
 block discarded – undo
1775 1775
         $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
1776 1776
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1777 1777
         //NOME / RAZÃO SOCIAL
1778
-        $w = round($maxW*0.61, 0);
1778
+        $w = round($maxW * 0.61, 0);
1779 1779
         $w1 = $w;
1780 1780
         $y += 3;
1781 1781
         $texto = 'NOME / RAZÃO SOCIAL';
@@ -1793,19 +1793,19 @@  discard block
 block discarded – undo
1793 1793
         }
1794 1794
         //CNPJ / CPF
1795 1795
         $x += $w;
1796
-        $w = round($maxW*0.23, 0);
1796
+        $w = round($maxW * 0.23, 0);
1797 1797
         $w2 = $w;
1798 1798
         $texto = 'CNPJ / CPF';
1799 1799
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1800 1800
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1801 1801
         //Pegando valor do CPF/CNPJ
1802
-        if (! empty($this->retirada->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1802
+        if (!empty($this->retirada->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1803 1803
             $texto = $this->formatField(
1804 1804
                 $this->retirada->getElementsByTagName("CNPJ")->item(0)->nodeValue,
1805 1805
                 "###.###.###/####-##"
1806 1806
             );
1807 1807
         } else {
1808
-            $texto = ! empty($this->retirada->getElementsByTagName("CPF")->item(0)->nodeValue) ?
1808
+            $texto = !empty($this->retirada->getElementsByTagName("CPF")->item(0)->nodeValue) ?
1809 1809
                     $this->formatField(
1810 1810
                         $this->retirada->getElementsByTagName("CPF")->item(0)->nodeValue,
1811 1811
                         "###.###.###-##"
@@ -1815,7 +1815,7 @@  discard block
 block discarded – undo
1815 1815
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1816 1816
         //INSCRIÇÃO ESTADUAL
1817 1817
         $x += $w;
1818
-        $w = $maxW-($w1+$w2);
1818
+        $w = $maxW - ($w1 + $w2);
1819 1819
         $wx = $w;
1820 1820
         $texto = 'INSCRIÇÃO ESTADUAL';
1821 1821
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
@@ -1831,7 +1831,7 @@  discard block
 block discarded – undo
1831 1831
             $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 1, '');
1832 1832
         }
1833 1833
         //ENDEREÇO
1834
-        $w = round($maxW*0.355, 0) + $wx;
1834
+        $w = round($maxW * 0.355, 0) + $wx;
1835 1835
         $w1 = $w;
1836 1836
         $y += $h;
1837 1837
         $x = $oldX;
@@ -1845,7 +1845,7 @@  discard block
 block discarded – undo
1845 1845
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 0, '', true);
1846 1846
         //BAIRRO / DISTRITO
1847 1847
         $x += $w;
1848
-        $w = round($maxW*0.335, 0);
1848
+        $w = round($maxW * 0.335, 0);
1849 1849
         $w2 = $w;
1850 1850
         $texto = 'BAIRRO / DISTRITO';
1851 1851
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
@@ -1855,17 +1855,17 @@  discard block
 block discarded – undo
1855 1855
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1856 1856
         //CEP
1857 1857
         $x += $w;
1858
-        $w = $maxW-($w1+$w2);
1858
+        $w = $maxW - ($w1 + $w2);
1859 1859
         $texto = 'CEP';
1860 1860
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1861 1861
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1862
-        $texto = ! empty($this->retirada->getElementsByTagName("CEP")->item(0)->nodeValue) ?
1862
+        $texto = !empty($this->retirada->getElementsByTagName("CEP")->item(0)->nodeValue) ?
1863 1863
                 $this->retirada->getElementsByTagName("CEP")->item(0)->nodeValue : '';
1864 1864
         $texto = $this->formatField($texto, "#####-###");
1865 1865
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
1866 1866
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1867 1867
         //MUNICÍPIO
1868
-        $w = round($maxW*0.805, 0);
1868
+        $w = round($maxW * 0.805, 0);
1869 1869
         $w1 = $w;
1870 1870
         $y += $h;
1871 1871
         $x = $oldX;
@@ -1874,7 +1874,7 @@  discard block
 block discarded – undo
1874 1874
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1875 1875
         $texto = $this->retirada->getElementsByTagName("xMun")->item(0)->nodeValue;
1876 1876
         if (strtoupper(trim($texto)) == "EXTERIOR" && $this->retirada->getElementsByTagName("xPais")->length > 0) {
1877
-            $texto .= " - " .  $this->retirada->getElementsByTagName("xPais")->item(0)->nodeValue;
1877
+            $texto .= " - " . $this->retirada->getElementsByTagName("xPais")->item(0)->nodeValue;
1878 1878
         }
1879 1879
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
1880 1880
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 0, '');
@@ -1889,11 +1889,11 @@  discard block
 block discarded – undo
1889 1889
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1890 1890
         //FONE / FAX
1891 1891
         $x += $w;
1892
-        $w = $maxW-$w-$w1;
1892
+        $w = $maxW - $w - $w1;
1893 1893
         $texto = 'FONE / FAX';
1894 1894
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1895 1895
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1896
-        $texto = ! empty($this->retirada->getElementsByTagName("fone")->item(0)->nodeValue) ?
1896
+        $texto = !empty($this->retirada->getElementsByTagName("fone")->item(0)->nodeValue) ?
1897 1897
                 $this->retirada->getElementsByTagName("fone")->item(0)->nodeValue : '';
1898 1898
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
1899 1899
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
@@ -1966,7 +1966,7 @@  discard block
 block discarded – undo
1966 1966
     protected function fatura($x, $y)
1967 1967
     {
1968 1968
         $linha = 1;
1969
-        $h = 8+3;
1969
+        $h = 8 + 3;
1970 1970
         $oldx = $x;
1971 1971
         $textoFatura = $this->getTextoFatura();
1972 1972
         //verificar se existem duplicatas
@@ -1999,29 +1999,29 @@  discard block
 block discarded – undo
1999 1999
                 return ($y + $h - 3);
2000 2000
             }
2001 2001
             if ($textoFatura !== "" && $this->exibirTextoFatura) {
2002
-                $myH=6;
2002
+                $myH = 6;
2003 2003
                 $myW = $this->wPrint;
2004 2004
                 if ($this->orientacao == 'L') {
2005 2005
                     $myW -= $this->wCanhoto;
2006 2006
                 }
2007 2007
                 $aFont = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>''];
2008 2008
                 $this->pdf->textBox($x, $y, $myW, $myH, $textoFatura, $aFont, 'C', 'L', 1, '');
2009
-                $y+=$myH+1;
2009
+                $y += $myH + 1;
2010 2010
             }
2011 2011
             if ($this->orientacao == 'P') {
2012
-                $w = round($this->wPrint/7.018, 0)-1;
2012
+                $w = round($this->wPrint / 7.018, 0) - 1;
2013 2013
             } else {
2014 2014
                 $w = 28;
2015 2015
             }
2016 2016
             $increm = 1;
2017 2017
             foreach ($this->dup as $k => $d) {
2018
-                $nDup = ! empty($this->dup->item($k)->getElementsByTagName('nDup')->item(0)->nodeValue)
2018
+                $nDup = !empty($this->dup->item($k)->getElementsByTagName('nDup')->item(0)->nodeValue)
2019 2019
                 ? $this->dup->item($k)->getElementsByTagName('nDup')->item(0)->nodeValue
2020 2020
                 : '';
2021
-                $dDup = ! empty($this->dup->item($k)->getElementsByTagName('dVenc')->item(0)->nodeValue)
2021
+                $dDup = !empty($this->dup->item($k)->getElementsByTagName('dVenc')->item(0)->nodeValue)
2022 2022
                 ? $this->ymdTodmy($this->dup->item($k)->getElementsByTagName('dVenc')->item(0)->nodeValue)
2023 2023
                 : '';
2024
-                $vDup = ! empty($this->dup->item($k)->getElementsByTagName('vDup')->item(0)->nodeValue)
2024
+                $vDup = !empty($this->dup->item($k)->getElementsByTagName('vDup')->item(0)->nodeValue)
2025 2025
                 ? 'R$ ' . number_format(
2026 2026
                     $this->dup->item($k)->getElementsByTagName('vDup')->item(0)->nodeValue,
2027 2027
                     2,
@@ -2031,14 +2031,14 @@  discard block
 block discarded – undo
2031 2031
                 : '';
2032 2032
                 $h = 8;
2033 2033
                 $texto = '';
2034
-                if ($nDup!='0' && $nDup!='') {
2034
+                if ($nDup != '0' && $nDup != '') {
2035 2035
                     $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2036 2036
                     $this->pdf->textBox($x, $y, $w, $h, 'Num.', $aFont, 'T', 'L', 1, '');
2037 2037
                     $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
2038 2038
                     $this->pdf->textBox($x, $y, $w, $h, $nDup, $aFont, 'T', 'R', 0, '');
2039 2039
                 } else {
2040 2040
                     $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2041
-                    $this->pdf->textBox($x, $y, $w, $h, ($dupcont+1)."", $aFont, 'T', 'L', 1, '');
2041
+                    $this->pdf->textBox($x, $y, $w, $h, ($dupcont + 1) . "", $aFont, 'T', 'L', 1, '');
2042 2042
                 }
2043 2043
                 $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2044 2044
                 $this->pdf->textBox($x, $y, $w, $h, 'Venc.', $aFont, 'C', 'L', 0, '');
@@ -2048,7 +2048,7 @@  discard block
 block discarded – undo
2048 2048
                 $this->pdf->textBox($x, $y, $w, $h, 'Valor', $aFont, 'B', 'L', 0, '');
2049 2049
                 $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
2050 2050
                 $this->pdf->textBox($x, $y, $w, $h, $vDup, $aFont, 'B', 'R', 0, '');
2051
-                $x += $w+$increm;
2051
+                $x += $w + $increm;
2052 2052
                 $dupcont += 1;
2053 2053
                 if ($this->orientacao == 'P') {
2054 2054
                     $maxDupCont = 6;
@@ -2070,10 +2070,10 @@  discard block
 block discarded – undo
2070 2070
                 $y -= 9;
2071 2071
                 $linha--;
2072 2072
             }
2073
-            return ($y+$h);
2073
+            return ($y + $h);
2074 2074
         } else {
2075 2075
             $linha = 0;
2076
-            return ($y-2);
2076
+            return ($y - 2);
2077 2077
         }
2078 2078
     }
2079 2079
 
@@ -2089,7 +2089,7 @@  discard block
 block discarded – undo
2089 2089
     protected function pagamento($x, $y)
2090 2090
     {
2091 2091
         $linha = 1;
2092
-        $h = 8+3;
2092
+        $h = 8 + 3;
2093 2093
         $oldx = $x;
2094 2094
         //verificar se existem cobranças definidas
2095 2095
         if (isset($this->detPag) && $this->detPag->length > 0) {
@@ -2108,7 +2108,7 @@  discard block
 block discarded – undo
2108 2108
             $dups = "";
2109 2109
             $dupcont = 0;
2110 2110
             if ($this->orientacao == 'P') {
2111
-                $w = round($this->wPrint/7.018, 0)-1;
2111
+                $w = round($this->wPrint / 7.018, 0) - 1;
2112 2112
             } else {
2113 2113
                 $w = 28;
2114 2114
             }
@@ -2118,17 +2118,17 @@  discard block
 block discarded – undo
2118 2118
                 $maxDupCont = 8;
2119 2119
             }
2120 2120
             $increm = 1;
2121
-            $formaPagamento = ['01'=>'Dinheiro','02'=>'Cheque','03'=>'Cartão de Crédito',
2122
-                                    '04'=>'Cartão de Débito','05'=>'Crédito Loja','10'=>'Vale Alimentação',
2123
-                                    '11'=>'Vale Refeição','12'=>'Vale Presente','13'=>'Vale Combustível',
2124
-                                    '14'=>'Duplicata Mercantil','15'=>'Boleto','90'=>'Sem pagamento','99'=>'Outros'];
2125
-            $bandeira = ['01'=>'Visa','02'=>'Mastercard','03'=>'American','04'=>'Sorocred','05'=>'Diners',
2126
-                              '06'=>'Elo','07'=>'Hipercard','08'=>'Aura','09'=>'Cabal','99'=>'Outros'];
2121
+            $formaPagamento = ['01'=>'Dinheiro', '02'=>'Cheque', '03'=>'Cartão de Crédito',
2122
+                                    '04'=>'Cartão de Débito', '05'=>'Crédito Loja', '10'=>'Vale Alimentação',
2123
+                                    '11'=>'Vale Refeição', '12'=>'Vale Presente', '13'=>'Vale Combustível',
2124
+                                    '14'=>'Duplicata Mercantil', '15'=>'Boleto', '90'=>'Sem pagamento', '99'=>'Outros'];
2125
+            $bandeira = ['01'=>'Visa', '02'=>'Mastercard', '03'=>'American', '04'=>'Sorocred', '05'=>'Diners',
2126
+                              '06'=>'Elo', '07'=>'Hipercard', '08'=>'Aura', '09'=>'Cabal', '99'=>'Outros'];
2127 2127
             foreach ($this->detPag as $k => $d) {
2128 2128
                 $fPag = !empty($this->detPag->item($k)->getElementsByTagName('tPag')->item(0)->nodeValue)
2129 2129
                 ? $this->detPag->item($k)->getElementsByTagName('tPag')->item(0)->nodeValue
2130 2130
                 : '0';
2131
-                $vPag = ! empty($this->detPag->item($k)->getElementsByTagName('vPag')->item(0)->nodeValue)
2131
+                $vPag = !empty($this->detPag->item($k)->getElementsByTagName('vPag')->item(0)->nodeValue)
2132 2132
                 ? 'R$ ' . number_format(
2133 2133
                     $this->detPag->item($k)->getElementsByTagName('vPag')->item(0)->nodeValue,
2134 2134
                     2,
@@ -2140,7 +2140,7 @@  discard block
 block discarded – undo
2140 2140
                 $texto = '';
2141 2141
                 if (isset($formaPagamento[$fPag])) {
2142 2142
                     /*Exibir Item sem pagamento ou outros?*/
2143
-                    if ($fPag=='90' || $fPag=='99') {
2143
+                    if ($fPag == '90' || $fPag == '99') {
2144 2144
                         continue;
2145 2145
                     }
2146 2146
                     $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
@@ -2149,16 +2149,16 @@  discard block
 block discarded – undo
2149 2149
                     $this->pdf->textBox($x, $y, $w, $h, $formaPagamento[$fPag], $aFont, 'T', 'R', 0, '');
2150 2150
                 } else {
2151 2151
                     $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>''];
2152
-                    $this->pdf->textBox($x, $y, $w, $h, "Forma ".$fPag." não encontrado", $aFont, 'T', 'L', 1, '');
2152
+                    $this->pdf->textBox($x, $y, $w, $h, "Forma " . $fPag . " não encontrado", $aFont, 'T', 'L', 1, '');
2153 2153
                 }
2154 2154
                 $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2155 2155
                 $this->pdf->textBox($x, $y, $w, $h, 'Valor', $aFont, 'B', 'L', 0, '');
2156 2156
                 $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
2157 2157
                 $this->pdf->textBox($x, $y, $w, $h, $vPag, $aFont, 'B', 'R', 0, '');
2158
-                $x += $w+$increm;
2158
+                $x += $w + $increm;
2159 2159
                 $dupcont += 1;
2160 2160
 
2161
-                if ($dupcont>$maxDupCont) {
2161
+                if ($dupcont > $maxDupCont) {
2162 2162
                     $y += 9;
2163 2163
                     $x = $oldx;
2164 2164
                     $dupcont = 0;
@@ -2173,10 +2173,10 @@  discard block
 block discarded – undo
2173 2173
                 $y -= 9;
2174 2174
                 $linha--;
2175 2175
             }
2176
-            return ($y+$h);
2176
+            return ($y + $h);
2177 2177
         } else {
2178 2178
             $linha = 0;
2179
-            return ($y-2);
2179
+            return ($y - 2);
2180 2180
         }
2181 2181
     } //fim da função pagamento
2182 2182
     
@@ -2288,7 +2288,7 @@  discard block
 block discarded – undo
2288 2288
         }
2289 2289
         $x = $this->impostoHelper($x, $y, $w, $h, "V. TOTAL DA NOTA", "vNF");
2290 2290
 
2291
-        return ($y+$h);
2291
+        return ($y + $h);
2292 2292
     } //fim imposto
2293 2293
 
2294 2294
     /**
@@ -2316,13 +2316,13 @@  discard block
 block discarded – undo
2316 2316
         $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
2317 2317
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
2318 2318
         //NOME / RAZÃO SOCIAL
2319
-        $w1 = $maxW*0.29;
2319
+        $w1 = $maxW * 0.29;
2320 2320
         $y += 3;
2321 2321
         $texto = 'NOME / RAZÃO SOCIAL';
2322 2322
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2323 2323
         $this->pdf->textBox($x, $y, $w1, $h, $texto, $aFont, 'T', 'L', 1, '');
2324 2324
         if (isset($this->transporta)) {
2325
-            $texto = ! empty($this->transporta->getElementsByTagName("xNome")->item(0)->nodeValue)
2325
+            $texto = !empty($this->transporta->getElementsByTagName("xNome")->item(0)->nodeValue)
2326 2326
             ? $this->transporta->getElementsByTagName("xNome")->item(0)->nodeValue
2327 2327
             : '';
2328 2328
         } else {
@@ -2332,11 +2332,11 @@  discard block
 block discarded – undo
2332 2332
         $this->pdf->textBox($x, $y, $w1, $h, $texto, $aFont, 'B', 'L', 0, '');
2333 2333
         //FRETE POR CONTA
2334 2334
         $x += $w1;
2335
-        $w2 = $maxW*0.15;
2335
+        $w2 = $maxW * 0.15;
2336 2336
         $texto = 'FRETE';
2337 2337
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2338 2338
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
2339
-        $tipoFrete = ! empty($this->transp->getElementsByTagName("modFrete")->item(0)->nodeValue)
2339
+        $tipoFrete = !empty($this->transp->getElementsByTagName("modFrete")->item(0)->nodeValue)
2340 2340
         ? $this->transp->getElementsByTagName("modFrete")->item(0)->nodeValue
2341 2341
         : '0';
2342 2342
         switch ($tipoFrete) {
@@ -2367,7 +2367,7 @@  discard block
 block discarded – undo
2367 2367
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2368 2368
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
2369 2369
         if (isset($this->veicTransp)) {
2370
-            $texto = ! empty($this->veicTransp->getElementsByTagName("RNTC")->item(0)->nodeValue)
2370
+            $texto = !empty($this->veicTransp->getElementsByTagName("RNTC")->item(0)->nodeValue)
2371 2371
             ? $this->veicTransp->getElementsByTagName("RNTC")->item(0)->nodeValue
2372 2372
             : '';
2373 2373
         } else {
@@ -2381,11 +2381,11 @@  discard block
 block discarded – undo
2381 2381
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2382 2382
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
2383 2383
         if (isset($this->veicTransp)) {
2384
-            $texto = ! empty($this->veicTransp->getElementsByTagName("placa")->item(0)->nodeValue)
2384
+            $texto = !empty($this->veicTransp->getElementsByTagName("placa")->item(0)->nodeValue)
2385 2385
             ? $this->veicTransp->getElementsByTagName("placa")->item(0)->nodeValue
2386 2386
             : '';
2387 2387
         } elseif (isset($this->reboque)) {
2388
-            $texto = ! empty($this->reboque->getElementsByTagName("placa")->item(0)->nodeValue)
2388
+            $texto = !empty($this->reboque->getElementsByTagName("placa")->item(0)->nodeValue)
2389 2389
             ? $this->reboque->getElementsByTagName("placa")->item(0)->nodeValue
2390 2390
             : '';
2391 2391
         } else {
@@ -2395,16 +2395,16 @@  discard block
 block discarded – undo
2395 2395
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'B', 'C', 0, '');
2396 2396
         //UF
2397 2397
         $x += $w2;
2398
-        $w3 = round($maxW*0.04, 0);
2398
+        $w3 = round($maxW * 0.04, 0);
2399 2399
         $texto = 'UF';
2400 2400
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2401 2401
         $this->pdf->textBox($x, $y, $w3, $h, $texto, $aFont, 'T', 'L', 1, '');
2402 2402
         if (isset($this->veicTransp)) {
2403
-            $texto = ! empty($this->veicTransp->getElementsByTagName("UF")->item(0)->nodeValue)
2403
+            $texto = !empty($this->veicTransp->getElementsByTagName("UF")->item(0)->nodeValue)
2404 2404
             ? $this->veicTransp->getElementsByTagName("UF")->item(0)->nodeValue
2405 2405
             : '';
2406 2406
         } elseif (isset($this->reboque)) {
2407
-            $texto = ! empty($this->reboque->getElementsByTagName("UF")->item(0)->nodeValue)
2407
+            $texto = !empty($this->reboque->getElementsByTagName("UF")->item(0)->nodeValue)
2408 2408
             ? $this->reboque->getElementsByTagName("UF")->item(0)->nodeValue
2409 2409
             : '';
2410 2410
         } else {
@@ -2414,19 +2414,19 @@  discard block
 block discarded – undo
2414 2414
         $this->pdf->textBox($x, $y, $w3, $h, $texto, $aFont, 'B', 'C', 0, '');
2415 2415
         //CNPJ / CPF
2416 2416
         $x += $w3;
2417
-        $w = $maxW-($w1+3*$w2+$w3);
2417
+        $w = $maxW - ($w1 + 3 * $w2 + $w3);
2418 2418
         $texto = 'CNPJ / CPF';
2419 2419
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2420 2420
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
2421 2421
         if (isset($this->transporta)) {
2422
-            $texto = ! empty($this->transporta->getElementsByTagName("CNPJ")->item(0)->nodeValue)
2422
+            $texto = !empty($this->transporta->getElementsByTagName("CNPJ")->item(0)->nodeValue)
2423 2423
             ? $this->formatField(
2424 2424
                 $this->transporta->getElementsByTagName("CNPJ")->item(0)->nodeValue,
2425 2425
                 "##.###.###/####-##"
2426 2426
             )
2427 2427
             : '';
2428 2428
             if ($texto == '') {
2429
-                $texto = ! empty($this->transporta->getElementsByTagName("CPF")->item(0)->nodeValue)
2429
+                $texto = !empty($this->transporta->getElementsByTagName("CPF")->item(0)->nodeValue)
2430 2430
                 ? $this->formatField(
2431 2431
                     $this->transporta->getElementsByTagName("CPF")->item(0)->nodeValue,
2432 2432
                     "###.###.###-##"
@@ -2443,12 +2443,12 @@  discard block
 block discarded – undo
2443 2443
         $y += $h;
2444 2444
         $x = $oldX;
2445 2445
         $h = 7;
2446
-        $w1 = $maxW*0.44;
2446
+        $w1 = $maxW * 0.44;
2447 2447
         $texto = 'ENDEREÇO';
2448 2448
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2449 2449
         $this->pdf->textBox($x, $y, $w1, $h, $texto, $aFont, 'T', 'L', 1, '');
2450 2450
         if (isset($this->transporta)) {
2451
-            $texto = ! empty($this->transporta->getElementsByTagName("xEnder")->item(0)->nodeValue)
2451
+            $texto = !empty($this->transporta->getElementsByTagName("xEnder")->item(0)->nodeValue)
2452 2452
                 ? $this->transporta->getElementsByTagName("xEnder")->item(0)->nodeValue
2453 2453
                 : '';
2454 2454
         } else {
@@ -2458,12 +2458,12 @@  discard block
 block discarded – undo
2458 2458
         $this->pdf->textBox($x, $y, $w1, $h, $texto, $aFont, 'B', 'L', 0, '');
2459 2459
         //MUNICÍPIO
2460 2460
         $x += $w1;
2461
-        $w2 = round($maxW*0.30, 0);
2461
+        $w2 = round($maxW * 0.30, 0);
2462 2462
         $texto = 'MUNICÍPIO';
2463 2463
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2464 2464
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
2465 2465
         if (isset($this->transporta)) {
2466
-            $texto = ! empty($this->transporta->getElementsByTagName("xMun")->item(0)->nodeValue)
2466
+            $texto = !empty($this->transporta->getElementsByTagName("xMun")->item(0)->nodeValue)
2467 2467
                 ? $this->transporta->getElementsByTagName("xMun")->item(0)->nodeValue
2468 2468
                 : '';
2469 2469
         } else {
@@ -2473,12 +2473,12 @@  discard block
 block discarded – undo
2473 2473
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'B', 'C', 0, '');
2474 2474
         //UF
2475 2475
         $x += $w2;
2476
-        $w3 = round($maxW*0.04, 0);
2476
+        $w3 = round($maxW * 0.04, 0);
2477 2477
         $texto = 'UF';
2478 2478
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2479 2479
         $this->pdf->textBox($x, $y, $w3, $h, $texto, $aFont, 'T', 'L', 1, '');
2480 2480
         if (isset($this->transporta)) {
2481
-            $texto = ! empty($this->transporta->getElementsByTagName("UF")->item(0)->nodeValue)
2481
+            $texto = !empty($this->transporta->getElementsByTagName("UF")->item(0)->nodeValue)
2482 2482
                 ? $this->transporta->getElementsByTagName("UF")->item(0)->nodeValue
2483 2483
                 : '';
2484 2484
         } else {
@@ -2488,13 +2488,13 @@  discard block
 block discarded – undo
2488 2488
         $this->pdf->textBox($x, $y, $w3, $h, $texto, $aFont, 'B', 'C', 0, '');
2489 2489
         //INSCRIÇÃO ESTADUAL
2490 2490
         $x += $w3;
2491
-        $w = $maxW-($w1+$w2+$w3);
2491
+        $w = $maxW - ($w1 + $w2 + $w3);
2492 2492
         $texto = 'INSCRIÇÃO ESTADUAL';
2493 2493
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2494 2494
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
2495 2495
         $texto = '';
2496 2496
         if (isset($this->transporta)) {
2497
-            if (! empty($this->transporta->getElementsByTagName("IE")->item(0)->nodeValue)) {
2497
+            if (!empty($this->transporta->getElementsByTagName("IE")->item(0)->nodeValue)) {
2498 2498
                 $texto = $this->transporta->getElementsByTagName("IE")->item(0)->nodeValue;
2499 2499
             }
2500 2500
         }
@@ -2507,16 +2507,16 @@  discard block
 block discarded – undo
2507 2507
         $marca = '';
2508 2508
         $numero = '';
2509 2509
         $texto = '';
2510
-        $pesoBruto=0;
2511
-        $pesoLiquido=0;
2510
+        $pesoBruto = 0;
2511
+        $pesoLiquido = 0;
2512 2512
         foreach ($volumes as $volume) {
2513
-            $quantidade += ! empty($volume->getElementsByTagName("qVol")->item(0)->nodeValue) ?
2513
+            $quantidade += !empty($volume->getElementsByTagName("qVol")->item(0)->nodeValue) ?
2514 2514
                     $volume->getElementsByTagName("qVol")->item(0)->nodeValue : 0;
2515
-            $pesoBruto += ! empty($volume->getElementsByTagName("pesoB")->item(0)->nodeValue) ?
2515
+            $pesoBruto += !empty($volume->getElementsByTagName("pesoB")->item(0)->nodeValue) ?
2516 2516
                     $volume->getElementsByTagName("pesoB")->item(0)->nodeValue : 0;
2517
-            $pesoLiquido += ! empty($volume->getElementsByTagName("pesoL")->item(0)->nodeValue) ?
2517
+            $pesoLiquido += !empty($volume->getElementsByTagName("pesoL")->item(0)->nodeValue) ?
2518 2518
                     $volume->getElementsByTagName("pesoL")->item(0)->nodeValue : 0;
2519
-            $texto = ! empty($this->transp->getElementsByTagName("esp")->item(0)->nodeValue) ?
2519
+            $texto = !empty($this->transp->getElementsByTagName("esp")->item(0)->nodeValue) ?
2520 2520
                     $this->transp->getElementsByTagName("esp")->item(0)->nodeValue : '';
2521 2521
             if ($texto != $especie && $especie != '') {
2522 2522
                 //tem várias especies
@@ -2524,7 +2524,7 @@  discard block
 block discarded – undo
2524 2524
             } else {
2525 2525
                 $especie = $texto;
2526 2526
             }
2527
-            $texto = ! empty($this->transp->getElementsByTagName("marca")->item(0)->nodeValue)
2527
+            $texto = !empty($this->transp->getElementsByTagName("marca")->item(0)->nodeValue)
2528 2528
                 ? $this->transp->getElementsByTagName("marca")->item(0)->nodeValue
2529 2529
                 : '';
2530 2530
             if ($texto != $marca && $marca != '') {
@@ -2533,7 +2533,7 @@  discard block
 block discarded – undo
2533 2533
             } else {
2534 2534
                 $marca = $texto;
2535 2535
             }
2536
-            $texto = ! empty($this->transp->getElementsByTagName("nVol")->item(0)->nodeValue)
2536
+            $texto = !empty($this->transp->getElementsByTagName("nVol")->item(0)->nodeValue)
2537 2537
                 ? $this->transp->getElementsByTagName("nVol")->item(0)->nodeValue
2538 2538
                 : '';
2539 2539
             if ($texto != $numero && $numero != '') {
@@ -2549,7 +2549,7 @@  discard block
 block discarded – undo
2549 2549
         $y += $h;
2550 2550
         $x = $oldX;
2551 2551
         $h = 7;
2552
-        $w1 = round($maxW*0.10, 0);
2552
+        $w1 = round($maxW * 0.10, 0);
2553 2553
         $texto = 'QUANTIDADE';
2554 2554
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2555 2555
         $this->pdf->textBox($x, $y, $w1, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -2560,7 +2560,7 @@  discard block
 block discarded – undo
2560 2560
         }
2561 2561
         //ESPÉCIE
2562 2562
         $x += $w1;
2563
-        $w2 = round($maxW*0.17, 0);
2563
+        $w2 = round($maxW * 0.17, 0);
2564 2564
         $texto = 'ESPÉCIE';
2565 2565
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2566 2566
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -2572,7 +2572,7 @@  discard block
 block discarded – undo
2572 2572
         $texto = 'MARCA';
2573 2573
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2574 2574
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
2575
-        $texto = ! empty($this->transp->getElementsByTagName("marca")->item(0)->nodeValue) ?
2575
+        $texto = !empty($this->transp->getElementsByTagName("marca")->item(0)->nodeValue) ?
2576 2576
                 $this->transp->getElementsByTagName("marca")->item(0)->nodeValue : '';
2577 2577
         $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'];
2578 2578
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'B', 'C', 0, '');
@@ -2586,7 +2586,7 @@  discard block
 block discarded – undo
2586 2586
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'B', 'C', 0, '');
2587 2587
         //PESO BRUTO
2588 2588
         $x += $w2;
2589
-        $w3 = round($maxW*0.20, 0);
2589
+        $w3 = round($maxW * 0.20, 0);
2590 2590
         $texto = 'PESO BRUTO';
2591 2591
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2592 2592
         $this->pdf->textBox($x, $y, $w3, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -2599,7 +2599,7 @@  discard block
 block discarded – undo
2599 2599
         $this->pdf->textBox($x, $y, $w3, $h, $texto, $aFont, 'B', 'R', 0, '');
2600 2600
         //PESO LÍQUIDO
2601 2601
         $x += $w3;
2602
-        $w = $maxW -($w1+3*$w2+$w3);
2602
+        $w = $maxW - ($w1 + 3 * $w2 + $w3);
2603 2603
         $texto = 'PESO LÍQUIDO';
2604 2604
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2605 2605
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -2610,7 +2610,7 @@  discard block
 block discarded – undo
2610 2610
         }
2611 2611
         $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'];
2612 2612
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'R', 0, '');
2613
-        return ($y+$h);
2613
+        return ($y + $h);
2614 2614
     } //fim transporte
2615 2615
 
2616 2616
 
@@ -2622,7 +2622,7 @@  discard block
 block discarded – undo
2622 2622
             return "";
2623 2623
         }
2624 2624
         $valor_original = $valor_original->nodeValue;
2625
-        $valor = ! empty($valor_original) ? number_format($valor_original, 2, ",", ".") : '';
2625
+        $valor = !empty($valor_original) ? number_format($valor_original, 2, ",", ".") : '';
2626 2626
 
2627 2627
         if ($valor != "") {
2628 2628
             return sprintf($formato, $valor);
@@ -2669,18 +2669,18 @@  discard block
 block discarded – undo
2669 2669
             $impostos .= $this->descricaoProdutoHelper($ICMSUFDest, "vICMSUFDest", " vICMSUFDest=%s");
2670 2670
             $impostos .= $this->descricaoProdutoHelper($ICMSUFDest, "vICMSUFRemet", " vICMSUFRemet=%s");
2671 2671
         }
2672
-        $infAdProd = ! empty($itemProd->getElementsByTagName('infAdProd')->item(0)->nodeValue)
2672
+        $infAdProd = !empty($itemProd->getElementsByTagName('infAdProd')->item(0)->nodeValue)
2673 2673
         ? substr(
2674 2674
             $this->anfaveaDANFE($itemProd->getElementsByTagName('infAdProd')->item(0)->nodeValue),
2675 2675
             0,
2676 2676
             500
2677 2677
         )
2678 2678
         : '';
2679
-        if (! empty($infAdProd)) {
2679
+        if (!empty($infAdProd)) {
2680 2680
             $infAdProd = trim($infAdProd);
2681 2681
             $infAdProd .= ' ';
2682 2682
         }
2683
-        $loteTxt ='';
2683
+        $loteTxt = '';
2684 2684
         $rastro = $prod->getElementsByTagName("med");
2685 2685
         if (!empty($prod->getElementsByTagName("rastro"))) {
2686 2686
             $rastro = $prod->getElementsByTagName("rastro");
@@ -2694,15 +2694,15 @@  discard block
 block discarded – undo
2694 2694
                 $i++;
2695 2695
             }
2696 2696
             if ($loteTxt != '') {
2697
-                $loteTxt.= ' ';
2697
+                $loteTxt .= ' ';
2698 2698
             }
2699 2699
         }
2700 2700
         //NT2013.006 FCI
2701
-        $nFCI = (! empty($itemProd->getElementsByTagName('nFCI')->item(0)->nodeValue)) ?
2702
-                ' FCI:'.$itemProd->getElementsByTagName('nFCI')->item(0)->nodeValue : '';
2703
-        $tmp_ad=$infAdProd . ($this->descProdInfoComplemento ? $loteTxt . $impostos . $nFCI : '');
2701
+        $nFCI = (!empty($itemProd->getElementsByTagName('nFCI')->item(0)->nodeValue)) ?
2702
+                ' FCI:' . $itemProd->getElementsByTagName('nFCI')->item(0)->nodeValue : '';
2703
+        $tmp_ad = $infAdProd . ($this->descProdInfoComplemento ? $loteTxt . $impostos . $nFCI : '');
2704 2704
         $texto = $prod->getElementsByTagName("xProd")->item(0)->nodeValue
2705
-            . (strlen($tmp_ad)!=0?"\n    ".$tmp_ad:'');
2705
+            . (strlen($tmp_ad) != 0 ? "\n    " . $tmp_ad : '');
2706 2706
         //decodifica os caracteres html no xml
2707 2707
         $texto = html_entity_decode($texto);
2708 2708
         if ($this->descProdQuebraLinha) {
@@ -2752,104 +2752,104 @@  discard block
 block discarded – undo
2752 2752
         // cabecalho LOOP COM OS DADOS DOS PRODUTOS
2753 2753
         //CÓDIGO PRODUTO
2754 2754
         $texto = "CÓDIGO PRODUTO";
2755
-        $w1 = round($w*0.09, 0);
2755
+        $w1 = round($w * 0.09, 0);
2756 2756
         $h = 4;
2757 2757
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2758 2758
         $this->pdf->textBox($x, $y, $w1, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2759
-        $this->pdf->line($x+$w1, $y, $x+$w1, $y+$hmax);
2759
+        $this->pdf->line($x + $w1, $y, $x + $w1, $y + $hmax);
2760 2760
         //DESCRIÇÃO DO PRODUTO / SERVIÇO
2761 2761
         $x += $w1;
2762
-        $w2 = round($w*0.28, 0);
2762
+        $w2 = round($w * 0.28, 0);
2763 2763
         $texto = 'DESCRIÇÃO DO PRODUTO / SERVIÇO';
2764 2764
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2765 2765
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2766
-        $this->pdf->line($x+$w2, $y, $x+$w2, $y+$hmax);
2766
+        $this->pdf->line($x + $w2, $y, $x + $w2, $y + $hmax);
2767 2767
         //NCM/SH
2768 2768
         $x += $w2;
2769
-        $w3 = round($w*0.06, 0);
2769
+        $w3 = round($w * 0.06, 0);
2770 2770
         $texto = 'NCM/SH';
2771 2771
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2772 2772
         $this->pdf->textBox($x, $y, $w3, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2773
-        $this->pdf->line($x+$w3, $y, $x+$w3, $y+$hmax);
2773
+        $this->pdf->line($x + $w3, $y, $x + $w3, $y + $hmax);
2774 2774
         //O/CST ou O/CSOSN
2775 2775
         $x += $w3;
2776
-        $w4 = round($w*0.05, 0);
2777
-        $texto = 'O/CSOSN';//Regime do Simples CRT = 1 ou CRT = 2
2776
+        $w4 = round($w * 0.05, 0);
2777
+        $texto = 'O/CSOSN'; //Regime do Simples CRT = 1 ou CRT = 2
2778 2778
         if ($this->getTagValue($this->emit, 'CRT') == '3') {
2779
-             $texto = 'O/CST';//Regime Normal
2779
+             $texto = 'O/CST'; //Regime Normal
2780 2780
         }
2781 2781
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2782 2782
         $this->pdf->textBox($x, $y, $w4, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2783
-        $this->pdf->line($x+$w4, $y, $x+$w4, $y+$hmax);
2783
+        $this->pdf->line($x + $w4, $y, $x + $w4, $y + $hmax);
2784 2784
         //CFOP
2785 2785
         $x += $w4;
2786
-        $w5 = round($w*0.04, 0);
2786
+        $w5 = round($w * 0.04, 0);
2787 2787
         $texto = 'CFOP';
2788 2788
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2789 2789
         $this->pdf->textBox($x, $y, $w5, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2790
-        $this->pdf->line($x+$w5, $y, $x+$w5, $y+$hmax);
2790
+        $this->pdf->line($x + $w5, $y, $x + $w5, $y + $hmax);
2791 2791
         //UN
2792 2792
         $x += $w5;
2793
-        $w6 = round($w*0.03, 0);
2793
+        $w6 = round($w * 0.03, 0);
2794 2794
         $texto = 'UN';
2795 2795
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2796 2796
         $this->pdf->textBox($x, $y, $w6, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2797
-        $this->pdf->line($x+$w6, $y, $x+$w6, $y+$hmax);
2797
+        $this->pdf->line($x + $w6, $y, $x + $w6, $y + $hmax);
2798 2798
         //QUANT
2799 2799
         $x += $w6;
2800
-        $w7 = round($w*0.07, 0);
2800
+        $w7 = round($w * 0.07, 0);
2801 2801
         $texto = 'QUANT';
2802 2802
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2803 2803
         $this->pdf->textBox($x, $y, $w7, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2804
-        $this->pdf->line($x+$w7, $y, $x+$w7, $y+$hmax);
2804
+        $this->pdf->line($x + $w7, $y, $x + $w7, $y + $hmax);
2805 2805
         //VALOR UNIT
2806 2806
         $x += $w7;
2807
-        $w8 = round($w*0.06, 0);
2807
+        $w8 = round($w * 0.06, 0);
2808 2808
         $texto = 'VALOR UNIT';
2809 2809
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2810 2810
         $this->pdf->textBox($x, $y, $w8, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2811
-        $this->pdf->line($x+$w8, $y, $x+$w8, $y+$hmax);
2811
+        $this->pdf->line($x + $w8, $y, $x + $w8, $y + $hmax);
2812 2812
         //VALOR TOTAL
2813 2813
         $x += $w8;
2814
-        $w9 = round($w*0.06, 0);
2814
+        $w9 = round($w * 0.06, 0);
2815 2815
         $texto = 'VALOR TOTAL';
2816 2816
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2817 2817
         $this->pdf->textBox($x, $y, $w9, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2818
-        $this->pdf->line($x+$w9, $y, $x+$w9, $y+$hmax);
2818
+        $this->pdf->line($x + $w9, $y, $x + $w9, $y + $hmax);
2819 2819
         //B.CÁLC ICMS
2820 2820
         $x += $w9;
2821
-        $w10 = round($w*0.06, 0);
2821
+        $w10 = round($w * 0.06, 0);
2822 2822
         $texto = 'B.CÁLC ICMS';
2823 2823
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2824 2824
         $this->pdf->textBox($x, $y, $w10, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2825
-        $this->pdf->line($x+$w10, $y, $x+$w10, $y+$hmax);
2825
+        $this->pdf->line($x + $w10, $y, $x + $w10, $y + $hmax);
2826 2826
         //VALOR ICMS
2827 2827
         $x += $w10;
2828
-        $w11 = round($w*0.06, 0);
2828
+        $w11 = round($w * 0.06, 0);
2829 2829
         $texto = 'VALOR ICMS';
2830 2830
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2831 2831
         $this->pdf->textBox($x, $y, $w11, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2832
-        $this->pdf->line($x+$w11, $y, $x+$w11, $y+$hmax);
2832
+        $this->pdf->line($x + $w11, $y, $x + $w11, $y + $hmax);
2833 2833
         //VALOR IPI
2834 2834
         $x += $w11;
2835
-        $w12 = round($w*0.05, 0);
2835
+        $w12 = round($w * 0.05, 0);
2836 2836
         $texto = 'VALOR IPI';
2837 2837
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2838 2838
         $this->pdf->textBox($x, $y, $w12, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2839
-        $this->pdf->line($x+$w12, $y, $x+$w12, $y+$hmax);
2839
+        $this->pdf->line($x + $w12, $y, $x + $w12, $y + $hmax);
2840 2840
         //ALÍQ. ICMS
2841 2841
         $x += $w12;
2842
-        $w13 = round($w*0.035, 0);
2842
+        $w13 = round($w * 0.035, 0);
2843 2843
         $texto = 'ALÍQ. ICMS';
2844 2844
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2845 2845
         $this->pdf->textBox($x, $y, $w13, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2846
-        $this->pdf->line($x+$w13, $y, $x+$w13, $y+$hmax);
2846
+        $this->pdf->line($x + $w13, $y, $x + $w13, $y + $hmax);
2847 2847
         //ALÍQ. IPI
2848 2848
         $x += $w13;
2849
-        $w14 = $w-($w1+$w2+$w3+$w4+$w5+$w6+$w7+$w8+$w9+$w10+$w11+$w12+$w13);
2849
+        $w14 = $w - ($w1 + $w2 + $w3 + $w4 + $w5 + $w6 + $w7 + $w8 + $w9 + $w10 + $w11 + $w12 + $w13);
2850 2850
         $texto = 'ALÍQ. IPI';
2851 2851
         $this->pdf->textBox($x, $y, $w14, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2852
-        $this->pdf->line($oldX, $y+$h+1, $oldX + $w, $y+$h+1);
2852
+        $this->pdf->line($oldX, $y + $h + 1, $oldX + $w, $y + $h + 1);
2853 2853
         $y += 5;
2854 2854
         //##################################################################################
2855 2855
         // LOOP COM OS DADOS DOS PRODUTOS
@@ -2867,7 +2867,7 @@  discard block
 block discarded – undo
2867 2867
                 $textoProduto = trim($this->descricaoProduto($thisItem));
2868 2868
 
2869 2869
                 $linhaDescr = $this->pdf->getNumLines($textoProduto, $w2, $aFont);
2870
-                $h = round(($linhaDescr * $this->pdf->fontSize)+ ($linhaDescr * 0.5), 2);
2870
+                $h = round(($linhaDescr * $this->pdf->fontSize) + ($linhaDescr * 0.5), 2);
2871 2871
                 $hUsado += $h;
2872 2872
 
2873 2873
                 $diffH = $hmax - $hUsado;
@@ -2880,11 +2880,11 @@  discard block
 block discarded – undo
2880 2880
                         break;
2881 2881
                     }
2882 2882
                 }
2883
-                $y_linha=$y+$h;
2883
+                $y_linha = $y + $h;
2884 2884
                 // linha entre itens
2885 2885
                 $this->pdf->dashedHLine($oldX, $y_linha, $w, 0.1, 120);
2886 2886
                 //corrige o x
2887
-                $x=$oldX;
2887
+                $x = $oldX;
2888 2888
                 //codigo do produto
2889 2889
                 $texto = $prod->getElementsByTagName("cProd")->item(0)->nodeValue;
2890 2890
                 $this->pdf->textBox($x, $y, $w1, $h, $texto, $aFont, 'T', 'C', 0, '');
@@ -2897,16 +2897,16 @@  discard block
 block discarded – undo
2897 2897
                 }
2898 2898
                 $x += $w2;
2899 2899
                 //NCM
2900
-                $texto = ! empty($prod->getElementsByTagName("NCM")->item(0)->nodeValue) ?
2900
+                $texto = !empty($prod->getElementsByTagName("NCM")->item(0)->nodeValue) ?
2901 2901
                         $prod->getElementsByTagName("NCM")->item(0)->nodeValue : '';
2902 2902
                 $this->pdf->textBox($x, $y, $w3, $h, $texto, $aFont, 'T', 'C', 0, '');
2903 2903
                 $x += $w3;
2904 2904
                 //CST
2905 2905
                 if (isset($ICMS)) {
2906
-                    $origem =  $this->getTagValue($ICMS, "orig");
2907
-                    $cst =  $this->getTagValue($ICMS, "CST");
2908
-                    $csosn =  $this->getTagValue($ICMS, "CSOSN");
2909
-                    $texto = $origem.$cst.$csosn;
2906
+                    $origem = $this->getTagValue($ICMS, "orig");
2907
+                    $cst = $this->getTagValue($ICMS, "CST");
2908
+                    $csosn = $this->getTagValue($ICMS, "CSOSN");
2909
+                    $texto = $origem . $cst . $csosn;
2910 2910
                     $this->pdf->textBox($x, $y, $w4, $h, $texto, $aFont, 'T', 'C', 0, '');
2911 2911
                 }
2912 2912
                 //CFOP
@@ -2940,7 +2940,7 @@  discard block
 block discarded – undo
2940 2940
                 //Valor da Base de calculo
2941 2941
                 $x += $w9;
2942 2942
                 if (isset($ICMS)) {
2943
-                    $texto = ! empty($ICMS->getElementsByTagName("vBC")->item(0)->nodeValue)
2943
+                    $texto = !empty($ICMS->getElementsByTagName("vBC")->item(0)->nodeValue)
2944 2944
                     ? number_format(
2945 2945
                         $ICMS->getElementsByTagName("vBC")->item(0)->nodeValue,
2946 2946
                         2,
@@ -2953,7 +2953,7 @@  discard block
 block discarded – undo
2953 2953
                 //Valor do ICMS
2954 2954
                 $x += $w10;
2955 2955
                 if (isset($ICMS)) {
2956
-                    $texto = ! empty($ICMS->getElementsByTagName("vICMS")->item(0)->nodeValue)
2956
+                    $texto = !empty($ICMS->getElementsByTagName("vICMS")->item(0)->nodeValue)
2957 2957
                     ? number_format(
2958 2958
                         $ICMS->getElementsByTagName("vICMS")->item(0)->nodeValue,
2959 2959
                         2,
@@ -2966,7 +2966,7 @@  discard block
 block discarded – undo
2966 2966
                 //Valor do IPI
2967 2967
                 $x += $w11;
2968 2968
                 if (isset($IPI)) {
2969
-                    $texto = ! empty($IPI->getElementsByTagName("vIPI")->item(0)->nodeValue)
2969
+                    $texto = !empty($IPI->getElementsByTagName("vIPI")->item(0)->nodeValue)
2970 2970
                     ? number_format(
2971 2971
                         $IPI->getElementsByTagName("vIPI")->item(0)->nodeValue,
2972 2972
                         2,
@@ -2981,7 +2981,7 @@  discard block
 block discarded – undo
2981 2981
                 // %ICMS
2982 2982
                 $x += $w12;
2983 2983
                 if (isset($ICMS)) {
2984
-                    $texto = ! empty($ICMS->getElementsByTagName("pICMS")->item(0)->nodeValue)
2984
+                    $texto = !empty($ICMS->getElementsByTagName("pICMS")->item(0)->nodeValue)
2985 2985
                     ? number_format(
2986 2986
                         $ICMS->getElementsByTagName("pICMS")->item(0)->nodeValue,
2987 2987
                         2,
@@ -2994,7 +2994,7 @@  discard block
 block discarded – undo
2994 2994
                 //%IPI
2995 2995
                 $x += $w13;
2996 2996
                 if (isset($IPI)) {
2997
-                    $texto = ! empty($IPI->getElementsByTagName("pIPI")->item(0)->nodeValue)
2997
+                    $texto = !empty($IPI->getElementsByTagName("pIPI")->item(0)->nodeValue)
2998 2998
                     ? number_format(
2999 2999
                         $IPI->getElementsByTagName("pIPI")->item(0)->nodeValue,
3000 3000
                         2,
@@ -3025,7 +3025,7 @@  discard block
 block discarded – undo
3025 3025
                 $i++;
3026 3026
             }
3027 3027
         }
3028
-        return $oldY+$hmax;
3028
+        return $oldY + $hmax;
3029 3029
     }
3030 3030
 
3031 3031
 
@@ -3059,7 +3059,7 @@  discard block
 block discarded – undo
3059 3059
 
3060 3060
         $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>''];
3061 3061
 
3062
-        $w1 = round($w*0.09, 0);
3062
+        $w1 = round($w * 0.09, 0);
3063 3063
 
3064 3064
         // Tabela Renavam Combustivel
3065 3065
         $renavamCombustivel = [
@@ -3154,54 +3154,54 @@  discard block
 block discarded – undo
3154 3154
 
3155 3155
         $yVeic = $y + $h;
3156 3156
         $texto = 'Chassi: ............: ' . $veiculoChassi;
3157
-        $this->pdf->textBox($x, $yVeic, $w1+40, $h, $texto, $aFont, 'T', 'L', 0, '');
3157
+        $this->pdf->textBox($x, $yVeic, $w1 + 40, $h, $texto, $aFont, 'T', 'L', 0, '');
3158 3158
         $yVeic += $h;
3159 3159
         $texto = 'Cor...................: ' . $veiculoCor;
3160
-        $this->pdf->textBox($x, $yVeic, $w1+40, $h, $texto, $aFont, 'T', 'L', 0, '');
3160
+        $this->pdf->textBox($x, $yVeic, $w1 + 40, $h, $texto, $aFont, 'T', 'L', 0, '');
3161 3161
         $yVeic += $h;
3162 3162
         $texto = 'Cilindrada........: ' . $veiculoCilindrada;
3163
-        $this->pdf->textBox($x, $yVeic, $w1+40, $h, $texto, $aFont, 'T', 'L', 0, '');
3163
+        $this->pdf->textBox($x, $yVeic, $w1 + 40, $h, $texto, $aFont, 'T', 'L', 0, '');
3164 3164
         $yVeic += $h;
3165 3165
         $texto = 'Cmkg...............: ' . $veiculoCmkg;
3166
-        $this->pdf->textBox($x, $yVeic, $w1+40, $h, $texto, $aFont, 'T', 'L', 0, '');
3166
+        $this->pdf->textBox($x, $yVeic, $w1 + 40, $h, $texto, $aFont, 'T', 'L', 0, '');
3167 3167
         $yVeic += $h;
3168 3168
         $texto = 'Tipo.................: ' . ($renavamTiposVeiculos[intval($veiculoTipo)] ?? $veiculoTipo);
3169
-         $this->pdf->textBox($x, $yVeic, $w1+40, $h, $texto, $aFont, 'T', 'L', 0, '');
3169
+         $this->pdf->textBox($x, $yVeic, $w1 + 40, $h, $texto, $aFont, 'T', 'L', 0, '');
3170 3170
         $yVeic = $y + $h;
3171 3171
         $xVeic = $x + 65;
3172 3172
         $texto = 'Nº Motor: .........: ' . $veiculoMotor;
3173
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
3173
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
3174 3174
         $yVeic += $h;
3175 3175
         $texto = 'Renavam...........: ' . $veiculoRenavam;
3176
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
3176
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
3177 3177
         $yVeic += $h;
3178 3178
         $texto = 'HP.....................: ' . $veiculoHp;
3179
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
3179
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
3180 3180
         $yVeic += $h;
3181 3181
         $texto = 'Placa.................: ' . $veiculoPlaca;
3182
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
3182
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
3183 3183
         $yVeic += $h;
3184 3184
         $texto = 'Tipo Pintura......: ' . ($renavamEspecie[intval($veiculoTipoPintura)] ?? $veiculoTipoPintura);
3185
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
3185
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
3186 3186
         $yVeic = $y + $h;
3187 3187
         $xVeic = $xVeic + 55;
3188 3188
         $texto = 'Marca / Modelo.....: ' . $veiculoMarcaModelo;
3189
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
3189
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
3190 3190
         $yVeic += $h;
3191 3191
         $texto = 'Especie..................: ' . ($renavamEspecie[intval($veiculoEspecie)] ?? $veiculoEspecie);
3192
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
3192
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
3193 3193
         $yVeic += $h;
3194 3194
         $texto = 'Combustivel..........: ' . ($renavamCombustivel[intval($veiculoCombustivel)] ?? $veiculoCombustivel);
3195
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
3195
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
3196 3196
         $yVeic += $h;
3197 3197
         $texto = 'Serial.....................: ' . $veiculoSerial;
3198
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
3198
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
3199 3199
         $yVeic += $h;
3200
-        $texto = 'Ano Fab/Mod........: '. $veiculoFabricacao . '/' . $veiculoModelo;
3201
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
3200
+        $texto = 'Ano Fab/Mod........: ' . $veiculoFabricacao . '/' . $veiculoModelo;
3201
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
3202 3202
         $yVeic += $h;
3203
-        $texto = 'Distancia Entre Eixos(mm)..: '. $veiculoDistancia;
3204
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
3203
+        $texto = 'Distancia Entre Eixos(mm)..: ' . $veiculoDistancia;
3204
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
3205 3205
     }
3206 3206
 
3207 3207
     /**
@@ -3225,12 +3225,12 @@  discard block
 block discarded – undo
3225 3225
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
3226 3226
         //INSCRIÇÃO MUNICIPAL
3227 3227
         $y += 3;
3228
-        $w = round($this->wPrint*0.23, 0);
3228
+        $w = round($this->wPrint * 0.23, 0);
3229 3229
         $texto = 'INSCRIÇÃO MUNICIPAL';
3230 3230
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
3231 3231
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
3232 3232
         //inscrição municipal
3233
-        $texto = ! empty($this->emit->getElementsByTagName("IM")->item(0)->nodeValue) ?
3233
+        $texto = !empty($this->emit->getElementsByTagName("IM")->item(0)->nodeValue) ?
3234 3234
                 $this->emit->getElementsByTagName("IM")->item(0)->nodeValue : '';
3235 3235
         $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'];
3236 3236
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 0, '');
@@ -3240,7 +3240,7 @@  discard block
 block discarded – undo
3240 3240
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
3241 3241
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
3242 3242
         if (isset($this->ISSQNtot)) {
3243
-            $texto = ! empty($this->ISSQNtot->getElementsByTagName("vServ")->item(0)->nodeValue) ?
3243
+            $texto = !empty($this->ISSQNtot->getElementsByTagName("vServ")->item(0)->nodeValue) ?
3244 3244
                     $this->ISSQNtot->getElementsByTagName("vServ")->item(0)->nodeValue : '';
3245 3245
             $texto = number_format($texto, 2, ",", ".");
3246 3246
         } else {
@@ -3254,9 +3254,9 @@  discard block
 block discarded – undo
3254 3254
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
3255 3255
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
3256 3256
         if (isset($this->ISSQNtot)) {
3257
-            $texto = ! empty($this->ISSQNtot->getElementsByTagName("vBC")->item(0)->nodeValue) ?
3257
+            $texto = !empty($this->ISSQNtot->getElementsByTagName("vBC")->item(0)->nodeValue) ?
3258 3258
                     $this->ISSQNtot->getElementsByTagName("vBC")->item(0)->nodeValue : '';
3259
-            $texto = ! empty($texto) ? number_format($texto, 2, ",", ".") : '';
3259
+            $texto = !empty($texto) ? number_format($texto, 2, ",", ".") : '';
3260 3260
         } else {
3261 3261
             $texto = '';
3262 3262
         }
@@ -3267,21 +3267,21 @@  discard block
 block discarded – undo
3267 3267
         if ($this->orientacao == 'P') {
3268 3268
             $w = $this->wPrint - (3 * $w);
3269 3269
         } else {
3270
-            $w = $this->wPrint - (3 * $w)-$this->wCanhoto;
3270
+            $w = $this->wPrint - (3 * $w) - $this->wCanhoto;
3271 3271
         }
3272 3272
         $texto = 'VALOR TOTAL DO ISSQN';
3273 3273
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
3274 3274
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
3275 3275
         if (isset($this->ISSQNtot)) {
3276
-            $texto = ! empty($this->ISSQNtot->getElementsByTagName("vISS")->item(0)->nodeValue) ?
3276
+            $texto = !empty($this->ISSQNtot->getElementsByTagName("vISS")->item(0)->nodeValue) ?
3277 3277
                     $this->ISSQNtot->getElementsByTagName("vISS")->item(0)->nodeValue : '';
3278
-            $texto = ! empty($texto) ? number_format($texto, 2, ",", ".") : '';
3278
+            $texto = !empty($texto) ? number_format($texto, 2, ",", ".") : '';
3279 3279
         } else {
3280 3280
             $texto = '';
3281 3281
         }
3282 3282
         $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'];
3283 3283
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'R', 0, '');
3284
-        return ($y+$h+1);
3284
+        return ($y + $h + 1);
3285 3285
     }
3286 3286
 
3287 3287
     /**
@@ -3302,7 +3302,7 @@  discard block
 block discarded – undo
3302 3302
         if ($this->orientacao == 'P') {
3303 3303
               $w = $this->wPrint;
3304 3304
         } else {
3305
-              $w = $this->wPrint-$this->wCanhoto;
3305
+              $w = $this->wPrint - $this->wCanhoto;
3306 3306
         }
3307 3307
         $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
3308 3308
         $this->pdf->textBox($x, $y, $w, 8, $texto, $aFont, 'T', 'L', 0, '');
@@ -3317,8 +3317,8 @@  discard block
 block discarded – undo
3317 3317
         //$this->wAdic com a largura do campo
3318 3318
         //$this->textoAdic com o texto completo do campo
3319 3319
         $y += 1;
3320
-        $aFont = ['font'=>$this->fontePadrao, 'size'=>$this->textadicfontsize*$this->pdf->k, 'style'=>''];
3321
-        $this->pdf->textBox($x, $y+2, $w-2, $h-3, $this->textoAdic, $aFont, 'T', 'L', 0, '', false);
3320
+        $aFont = ['font'=>$this->fontePadrao, 'size'=>$this->textadicfontsize * $this->pdf->k, 'style'=>''];
3321
+        $this->pdf->textBox($x, $y + 2, $w - 2, $h - 3, $this->textoAdic, $aFont, 'T', 'L', 0, '', false);
3322 3322
         //RESERVADO AO FISCO
3323 3323
         $texto = "RESERVADO AO FISCO";
3324 3324
         if (isset($this->nfeProc) && $this->nfeProc->getElementsByTagName("xMsg")) {
@@ -3327,9 +3327,9 @@  discard block
 block discarded – undo
3327 3327
         $x += $w;
3328 3328
         $y -= 1;
3329 3329
         if ($this->orientacao == 'P') {
3330
-            $w = $this->wPrint-$w;
3330
+            $w = $this->wPrint - $w;
3331 3331
         } else {
3332
-            $w = $this->wPrint-$w-$this->wCanhoto;
3332
+            $w = $this->wPrint - $w - $this->wCanhoto;
3333 3333
         }
3334 3334
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>'B'];
3335 3335
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -3368,8 +3368,8 @@  discard block
 block discarded – undo
3368 3368
         }
3369 3369
         $y += 2;
3370 3370
         $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>''];
3371
-        $this->pdf->textBox($x, $y, $w-2, $h-3, $texto, $aFont, 'T', 'L', 0, '', false);
3372
-        return $y+$h;
3371
+        $this->pdf->textBox($x, $y, $w - 2, $h - 3, $texto, $aFont, 'T', 'L', 0, '', false);
3372
+        return $y + $h;
3373 3373
     }
3374 3374
 
3375 3375
     /**
@@ -3388,11 +3388,11 @@  discard block
 block discarded – undo
3388 3388
         if ($this->orientacao == 'P') {
3389 3389
               $w = $this->wPrint;
3390 3390
         } else {
3391
-              $w = $this->wPrint-$this->wCanhoto;
3391
+              $w = $this->wPrint - $this->wCanhoto;
3392 3392
               $x = $this->wCanhoto;
3393 3393
         }
3394 3394
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>'I'];
3395
-        $texto = "Impresso em ". date('d/m/Y') . " as " . date('H:i:s')
3395
+        $texto = "Impresso em " . date('d/m/Y') . " as " . date('H:i:s')
3396 3396
             . '  ' . $this->creditos;
3397 3397
         $this->pdf->textBox($x, $y, $w, 0, $texto, $aFont, 'T', 'L', false);
3398 3398
         $texto = "Powered by NFePHP®";
@@ -3448,9 +3448,9 @@  discard block
 block discarded – undo
3448 3448
         } else {
3449 3449
             //linha separadora do canhoto - 238
3450 3450
             //posicao altura
3451
-            $y = $this->wPrint-85;
3451
+            $y = $this->wPrint - 85;
3452 3452
             //altura
3453
-            $w = $this->wPrint-85-24;
3453
+            $w = $this->wPrint - 85 - 24;
3454 3454
         }
3455 3455
         $h = 10;
3456 3456
         //desenha caixa
@@ -3473,21 +3473,21 @@  discard block
 block discarded – undo
3473 3473
             $texto .= "AO LADO";
3474 3474
         }
3475 3475
         $texto .= ". EMISSÃO: ";
3476
-        $dEmi = ! empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
3476
+        $dEmi = !empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
3477 3477
                 $this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue : '';
3478 3478
         if ($dEmi == '') {
3479
-            $dEmi = ! empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
3479
+            $dEmi = !empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
3480 3480
                     $this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue : '';
3481 3481
             $aDemi = explode('T', $dEmi);
3482 3482
             $dEmi = $aDemi[0];
3483 3483
         }
3484
-        $texto .= $this->ymdTodmy($dEmi) ." ";
3484
+        $texto .= $this->ymdTodmy($dEmi) . " ";
3485 3485
         $texto .= "VALOR TOTAL: R$ ";
3486 3486
         $texto .= number_format($this->ICMSTot->getElementsByTagName("vNF")->item(0)->nodeValue, 2, ",", ".") . " ";
3487 3487
         $texto .= "DESTINATÁRIO: ";
3488 3488
         $texto .= $destinatario;
3489 3489
         if ($this->orientacao == 'P') {
3490
-            $this->pdf->textBox($x, $y, $w-1, $h, $texto, $aFont, 'C', 'L', 0, '', false);
3490
+            $this->pdf->textBox($x, $y, $w - 1, $h, $texto, $aFont, 'C', 'L', 0, '', false);
3491 3491
             $x1 = $x + $w;
3492 3492
             $w1 = $this->wPrint - $w;
3493 3493
             $texto = "NF-e";
@@ -3500,12 +3500,12 @@  discard block
 block discarded – undo
3500 3500
             //DATA DE RECEBIMENTO
3501 3501
             $texto = "DATA DE RECEBIMENTO";
3502 3502
             $y += $h;
3503
-            $w2 = round($this->wPrint*0.17, 0); //35;
3503
+            $w2 = round($this->wPrint * 0.17, 0); //35;
3504 3504
             $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
3505 3505
             $this->pdf->textBox($x, $y, $w2, 8, $texto, $aFont, 'T', 'L', 1, '');
3506 3506
             //IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR
3507 3507
             $x += $w2;
3508
-            $w3 = $w-$w2;
3508
+            $w3 = $w - $w2;
3509 3509
             $texto = "IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR";
3510 3510
             $this->pdf->textBox($x, $y, $w3, 8, $texto, $aFont, 'T', 'L', 1, '');
3511 3511
             $x = $oldX;
@@ -3515,7 +3515,7 @@  discard block
 block discarded – undo
3515 3515
             return $y;
3516 3516
         } else {
3517 3517
             $x--;
3518
-            $x = $this->pdf->textBox90($x, $y, $w-1, $h, $texto, $aFontSmall, 'C', 'L', 0, '', false);
3518
+            $x = $this->pdf->textBox90($x, $y, $w - 1, $h, $texto, $aFontSmall, 'C', 'L', 0, '', false);
3519 3519
             //NUMERO DA NOTA FISCAL LOGO NFE
3520 3520
             $w1 = 18;
3521 3521
             $x1 = $oldX;
@@ -3529,14 +3529,14 @@  discard block
 block discarded – undo
3529 3529
             $this->pdf->textBox($x1, $y, $w1, 18, $texto, $aFont, 'C', 'C', 1, '');
3530 3530
             //DATA DO RECEBIMENTO
3531 3531
             $texto = "DATA DO RECEBIMENTO";
3532
-            $y = $this->wPrint-85;
3532
+            $y = $this->wPrint - 85;
3533 3533
             $x = 12;
3534
-            $w2 = round($this->wPrint*0.17, 0); //35;
3534
+            $w2 = round($this->wPrint * 0.17, 0); //35;
3535 3535
             $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
3536 3536
             $this->pdf->textBox90($x, $y, $w2, 8, $texto, $aFont, 'T', 'L', 1, '');
3537 3537
             //IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR
3538 3538
             $y -= $w2;
3539
-            $w3 = $w-$w2;
3539
+            $w3 = $w - $w2;
3540 3540
             $texto = "IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR";
3541 3541
             $aFont = ['font'=>$this->fontePadrao, 'size'=>5.7, 'style'=>''];
3542 3542
             $x = $this->pdf->textBox90($x, $y, $w3, 8, $texto, $aFont, 'T', 'L', 1, '');
@@ -3557,13 +3557,13 @@  discard block
 block discarded – undo
3557 3557
     {
3558 3558
         $saida = "";
3559 3559
         if (isset($this->compra)) {
3560
-            if (! empty($this->compra->getElementsByTagName("xNEmp")->item(0)->nodeValue)) {
3560
+            if (!empty($this->compra->getElementsByTagName("xNEmp")->item(0)->nodeValue)) {
3561 3561
                 $saida .= " Nota de Empenho: " . $this->compra->getElementsByTagName("xNEmp")->item(0)->nodeValue;
3562 3562
             }
3563
-            if (! empty($this->compra->getElementsByTagName("xPed")->item(0)->nodeValue)) {
3563
+            if (!empty($this->compra->getElementsByTagName("xPed")->item(0)->nodeValue)) {
3564 3564
                 $saida .= " Pedido: " . $this->compra->getElementsByTagName("xPed")->item(0)->nodeValue;
3565 3565
             }
3566
-            if (! empty($this->compra->getElementsByTagName("xCont")->item(0)->nodeValue)) {
3566
+            if (!empty($this->compra->getElementsByTagName("xCont")->item(0)->nodeValue)) {
3567 3567
                 $saida .= " Contrato: " . $this->compra->getElementsByTagName("xCont")->item(0)->nodeValue;
3568 3568
             }
3569 3569
         }
@@ -3589,21 +3589,21 @@  discard block
 block discarded – undo
3589 3589
         if ($vICMS > 0) {
3590 3590
             $vICMS = 1;
3591 3591
         }
3592
-        $icmss  = $this->ICMSTot->getElementsByTagName("vBC")->item(0)->nodeValue;
3592
+        $icmss = $this->ICMSTot->getElementsByTagName("vBC")->item(0)->nodeValue;
3593 3593
         if ($icmss > 0) {
3594 3594
             $icmss = 1;
3595 3595
         }
3596
-        $dEmi = ! empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
3596
+        $dEmi = !empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
3597 3597
                 $this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue : '';
3598 3598
         if ($dEmi == '') {
3599
-            $dEmi = ! empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
3599
+            $dEmi = !empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
3600 3600
                     $this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue : '';
3601 3601
             $aDemi = explode('T', $dEmi);
3602 3602
             $dEmi = $aDemi[0];
3603 3603
         }
3604 3604
         $dd  = $dEmi;
3605 3605
         $rpos = strrpos($dd, '-');
3606
-        $dd  = substr($dd, $rpos +1);
3606
+        $dd  = substr($dd, $rpos + 1);
3607 3607
         $chave = sprintf($forma, $cUF, $this->tpEmis, $CNPJ, $vNF, $vICMS, $icmss, $dd);
3608 3608
         $chave = $chave . $this->modulo11($chave);
3609 3609
         return $chave;
@@ -3624,7 +3624,7 @@  discard block
 block discarded – undo
3624 3624
         $formaNfRef = "\r\nNF  Ref.: série:%d numero:%d emit:%s em %s modelo: %d";
3625 3625
         $formaECFRef = "\r\nECF Ref.: modelo: %s ECF:%d COO:%d";
3626 3626
         $formaNfpRef = "\r\nNFP Ref.: série:%d número:%d emit:%s em %s modelo: %d IE:%s";
3627
-        $saida='';
3627
+        $saida = '';
3628 3628
         $nfRefs = $this->ide->getElementsByTagName('NFref');
3629 3629
         if (0 === $nfRefs->length) {
3630 3630
             return $saida;
@@ -3640,7 +3640,7 @@  discard block
 block discarded – undo
3640 3640
             foreach ($refNFe as $chave_acessoRef) {
3641 3641
                 $chave_acesso = $chave_acessoRef->nodeValue;
3642 3642
                 $chave_acessoF = $this->formatField($chave_acesso, $this->formatoChave);
3643
-                $data = substr($chave_acesso, 4, 2)."/20".substr($chave_acesso, 2, 2);
3643
+                $data = substr($chave_acesso, 4, 2) . "/20" . substr($chave_acesso, 2, 2);
3644 3644
                 $cnpj = $this->formatField(substr($chave_acesso, 6, 14), "##.###.###/####-##");
3645 3645
                 $serie  = substr($chave_acesso, 22, 3);
3646 3646
                 $numero = substr($chave_acesso, 25, 9);
@@ -3661,7 +3661,7 @@  discard block
 block discarded – undo
3661 3661
             foreach ($refCTe as $chave_acessoRef) {
3662 3662
                 $chave_acesso = $chave_acessoRef->nodeValue;
3663 3663
                 $chave_acessoF = $this->formatField($chave_acesso, $this->formatoChave);
3664
-                $data = substr($chave_acesso, 4, 2)."/20".substr($chave_acesso, 2, 2);
3664
+                $data = substr($chave_acesso, 4, 2) . "/20" . substr($chave_acesso, 2, 2);
3665 3665
                 $cnpj = $this->formatField(substr($chave_acesso, 6, 14), "##.###.###/####-##");
3666 3666
                 $serie  = substr($chave_acesso, 22, 3);
3667 3667
                 $numero = substr($chave_acesso, 25, 9);
@@ -3677,10 +3677,9 @@  discard block
 block discarded – undo
3677 3677
             $refNFP = $nfRef->getElementsByTagName('refNFP');
3678 3678
             foreach ($refNFP as $umaRefNFe) {
3679 3679
                 $data = $umaRefNFe->getElementsByTagName('AAMM')->item(0)->nodeValue;
3680
-                $cnpj = ! empty($umaRefNFe->getElementsByTagName('CNPJ')->item(0)->nodeValue) ?
3681
-                    $umaRefNFe->getElementsByTagName('CNPJ')->item(0)->nodeValue :
3682
-                    '';
3683
-                $cpf = ! empty($umaRefNFe->getElementsByTagName('CPF')->item(0)->nodeValue) ?
3680
+                $cnpj = !empty($umaRefNFe->getElementsByTagName('CNPJ')->item(0)->nodeValue) ?
3681
+                    $umaRefNFe->getElementsByTagName('CNPJ')->item(0)->nodeValue : '';
3682
+                $cpf = !empty($umaRefNFe->getElementsByTagName('CPF')->item(0)->nodeValue) ?
3684 3683
                         $umaRefNFe->getElementsByTagName('CPF')->item(0)->nodeValue : '';
3685 3684
                 $mod = $umaRefNFe->getElementsByTagName('mod')->item(0)->nodeValue;
3686 3685
                 $serie = $umaRefNFe->getElementsByTagName('serie')->item(0)->nodeValue;
@@ -3745,6 +3744,6 @@  discard block
 block discarded – undo
3745 3744
         imagedestroy($image);
3746 3745
         $stringdata = ob_get_contents(); // read from buffer
3747 3746
         ob_end_clean();
3748
-        return 'data://text/plain;base64,'.base64_encode($stringdata);
3747
+        return 'data://text/plain;base64,' . base64_encode($stringdata);
3749 3748
     }
3750 3749
 }
Please login to merge, or discard this patch.