Passed
Push — master ( 4ea538...37bece )
by Roberto
07:43 queued 10s
created
src/NFe/Danfe.php 1 patch
Spacing   +346 added lines, -347 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,25 +1220,25 @@  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
         $texto = 'CNPJ';
1232 1232
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1233 1233
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1234 1234
         //Pegando valor do CPF/CNPJ
1235
-        if (! empty($this->emit->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1235
+        if (!empty($this->emit->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1236 1236
             $texto = $this->formatField(
1237 1237
                 $this->emit->getElementsByTagName("CNPJ")->item(0)->nodeValue,
1238 1238
                 "###.###.###/####-##"
1239 1239
             );
1240 1240
         } else {
1241
-            $texto = ! empty($this->emit->getElementsByTagName("CPF")->item(0)->nodeValue)
1241
+            $texto = !empty($this->emit->getElementsByTagName("CPF")->item(0)->nodeValue)
1242 1242
             ? $this->formatField(
1243 1243
                 $this->emit->getElementsByTagName("CPF")->item(0)->nodeValue,
1244 1244
                 "###.###.###-##"
@@ -1255,22 +1255,22 @@  discard block
 block discarded – undo
1255 1255
         $resp = $this->statusNFe();
1256 1256
         if (!$resp['status']) {
1257 1257
             $x = 10;
1258
-            $y = $this->hPrint-130;
1258
+            $y = $this->hPrint - 130;
1259 1259
             $h = 25;
1260
-            $w = $maxW-(2*$x);
1260
+            $w = $maxW - (2 * $x);
1261 1261
             $this->pdf->settextcolor(90, 90, 90);
1262 1262
             $texto = $resp['message'];
1263 1263
             $aFont = ['font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B'];
1264 1264
             $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1265 1265
             $y += $h;
1266 1266
             $h = 5;
1267
-            $w = $maxW-(2*$x);
1267
+            $w = $maxW - (2 * $x);
1268 1268
             if (isset($this->infProt) && $resp['status']) {
1269 1269
                 $xMotivo = $this->infProt->getElementsByTagName("xMotivo")->item(0)->nodeValue;
1270 1270
             } else {
1271 1271
                 $xMotivo = '';
1272 1272
             }
1273
-            $texto = "SEM VALOR FISCAL\n".$xMotivo;
1273
+            $texto = "SEM VALOR FISCAL\n" . $xMotivo;
1274 1274
             $aFont = ['font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B'];
1275 1275
             $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1276 1276
             $this->pdf->settextcolor(0, 0, 0);
@@ -1293,12 +1293,12 @@  discard block
 block discarded – undo
1293 1293
         if ($this->notaDpec() || $this->tpEmis == 4) {
1294 1294
             //DPEC
1295 1295
             $x = 10;
1296
-            $y = $this->hPrint-130;
1296
+            $y = $this->hPrint - 130;
1297 1297
             $h = 25;
1298
-            $w = $maxW-(2*$x);
1298
+            $w = $maxW - (2 * $x);
1299 1299
             $this->pdf->SetTextColor(200, 200, 200);
1300
-            $texto = "DANFE impresso em contingência -\n".
1301
-                     "DPEC regularmente recebido pela Receita\n".
1300
+            $texto = "DANFE impresso em contingência -\n" .
1301
+                     "DPEC regularmente recebido pela Receita\n" .
1302 1302
                      "Federal do Brasil";
1303 1303
             $aFont = ['font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B'];
1304 1304
             $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
@@ -1417,7 +1417,7 @@  discard block
 block discarded – undo
1417 1417
         $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
1418 1418
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1419 1419
         //NOME / RAZÃO SOCIAL
1420
-        $w = round($maxW*0.61, 0);
1420
+        $w = round($maxW * 0.61, 0);
1421 1421
         $w1 = $w;
1422 1422
         $y += 3;
1423 1423
         $texto = 'NOME / RAZÃO SOCIAL';
@@ -1432,19 +1432,19 @@  discard block
 block discarded – undo
1432 1432
         }
1433 1433
         //CNPJ / CPF
1434 1434
         $x += $w;
1435
-        $w = round($maxW*0.23, 0);
1435
+        $w = round($maxW * 0.23, 0);
1436 1436
         $w2 = $w;
1437 1437
         $texto = 'CNPJ / CPF';
1438 1438
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1439 1439
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1440 1440
         //Pegando valor do CPF/CNPJ
1441
-        if (! empty($this->dest->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1441
+        if (!empty($this->dest->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1442 1442
             $texto = $this->formatField(
1443 1443
                 $this->dest->getElementsByTagName("CNPJ")->item(0)->nodeValue,
1444 1444
                 "###.###.###/####-##"
1445 1445
             );
1446 1446
         } else {
1447
-            $texto = ! empty($this->dest->getElementsByTagName("CPF")->item(0)->nodeValue)
1447
+            $texto = !empty($this->dest->getElementsByTagName("CPF")->item(0)->nodeValue)
1448 1448
             ? $this->formatField(
1449 1449
                 $this->dest->getElementsByTagName("CPF")->item(0)->nodeValue,
1450 1450
                 "###.###.###-##"
@@ -1455,16 +1455,16 @@  discard block
 block discarded – undo
1455 1455
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1456 1456
         //DATA DA EMISSÃO
1457 1457
         $x += $w;
1458
-        $w = $maxW-($w1+$w2);
1458
+        $w = $maxW - ($w1 + $w2);
1459 1459
         $wx = $w;
1460 1460
         $texto = 'DATA DA EMISSÃO';
1461 1461
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1462 1462
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1463
-        $dEmi = ! empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue)
1463
+        $dEmi = !empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue)
1464 1464
         ? $this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue
1465 1465
         : '';
1466 1466
         if ($dEmi == '') {
1467
-            $dEmi = ! empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue)
1467
+            $dEmi = !empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue)
1468 1468
             ? $this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue
1469 1469
             : '';
1470 1470
             $aDemi = explode('T', $dEmi);
@@ -1478,7 +1478,7 @@  discard block
 block discarded – undo
1478 1478
             $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 1, '');
1479 1479
         }
1480 1480
         //ENDEREÇO
1481
-        $w = round($maxW*0.47, 0);
1481
+        $w = round($maxW * 0.47, 0);
1482 1482
         $w1 = $w;
1483 1483
         $y += $h;
1484 1484
         $x = $oldX;
@@ -1493,7 +1493,7 @@  discard block
 block discarded – undo
1493 1493
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 0, '', true);
1494 1494
         //BAIRRO / DISTRITO
1495 1495
         $x += $w;
1496
-        $w = round($maxW*0.21, 0);
1496
+        $w = round($maxW * 0.21, 0);
1497 1497
         $w2 = $w;
1498 1498
         $texto = 'BAIRRO / DISTRITO';
1499 1499
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
@@ -1503,12 +1503,12 @@  discard block
 block discarded – undo
1503 1503
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1504 1504
         //CEP
1505 1505
         $x += $w;
1506
-        $w = $maxW-$w1-$w2-$wx;
1506
+        $w = $maxW - $w1 - $w2 - $wx;
1507 1507
         $w2 = $w;
1508 1508
         $texto = 'CEP';
1509 1509
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1510 1510
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1511
-        $texto = ! empty($this->dest->getElementsByTagName("CEP")->item(0)->nodeValue)
1511
+        $texto = !empty($this->dest->getElementsByTagName("CEP")->item(0)->nodeValue)
1512 1512
         ? $this->dest->getElementsByTagName("CEP")->item(0)->nodeValue
1513 1513
         : '';
1514 1514
         $texto = $this->formatField($texto, "#####-###");
@@ -1520,11 +1520,11 @@  discard block
 block discarded – undo
1520 1520
         $texto = 'DATA DA SAÍDA/ENTRADA';
1521 1521
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1522 1522
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1523
-        $dSaiEnt = ! empty($this->ide->getElementsByTagName("dSaiEnt")->item(0)->nodeValue)
1523
+        $dSaiEnt = !empty($this->ide->getElementsByTagName("dSaiEnt")->item(0)->nodeValue)
1524 1524
             ? $this->ide->getElementsByTagName("dSaiEnt")->item(0)->nodeValue
1525 1525
             : '';
1526 1526
         if ($dSaiEnt == '') {
1527
-            $dSaiEnt = ! empty($this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue)
1527
+            $dSaiEnt = !empty($this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue)
1528 1528
                 ? $this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue
1529 1529
                 : '';
1530 1530
             $aDsaient = explode('T', $dSaiEnt);
@@ -1544,7 +1544,7 @@  discard block
 block discarded – undo
1544 1544
         if (strtoupper(trim($texto)) == "EXTERIOR"
1545 1545
             && $this->dest->getElementsByTagName("xPais")->length > 0
1546 1546
         ) {
1547
-            $texto .= " - " .  $this->dest->getElementsByTagName("xPais")->item(0)->nodeValue;
1547
+            $texto .= " - " . $this->dest->getElementsByTagName("xPais")->item(0)->nodeValue;
1548 1548
         }
1549 1549
         $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'];
1550 1550
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 0, '');
@@ -1559,19 +1559,19 @@  discard block
 block discarded – undo
1559 1559
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1560 1560
         //FONE / FAX
1561 1561
         $x += $w;
1562
-        $w = round(($maxW -$w1-$wx-8)/2, 0);
1562
+        $w = round(($maxW - $w1 - $wx - 8) / 2, 0);
1563 1563
         $w3 = $w;
1564 1564
         $texto = 'FONE / FAX';
1565 1565
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1566 1566
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1567
-        $texto = ! empty($this->dest->getElementsByTagName("fone")->item(0)->nodeValue)
1567
+        $texto = !empty($this->dest->getElementsByTagName("fone")->item(0)->nodeValue)
1568 1568
         ? $this->dest->getElementsByTagName("fone")->item(0)->nodeValue
1569 1569
         : '';
1570 1570
         $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'];
1571 1571
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1572 1572
         //INSCRIÇÃO ESTADUAL
1573 1573
         $x += $w;
1574
-        $w = $maxW -$w1-$wx-8-$w3;
1574
+        $w = $maxW - $w1 - $wx - 8 - $w3;
1575 1575
         $texto = 'INSCRIÇÃO ESTADUAL';
1576 1576
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1577 1577
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -1585,11 +1585,11 @@  discard block
 block discarded – undo
1585 1585
         $texto = 'HORA DA SAÍDA/ENTRADA';
1586 1586
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1587 1587
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1588
-        $hSaiEnt = ! empty($this->ide->getElementsByTagName("hSaiEnt")->item(0)->nodeValue)
1588
+        $hSaiEnt = !empty($this->ide->getElementsByTagName("hSaiEnt")->item(0)->nodeValue)
1589 1589
         ? $this->ide->getElementsByTagName("hSaiEnt")->item(0)->nodeValue
1590 1590
         : '';
1591 1591
         if ($hSaiEnt == '') {
1592
-            $dhSaiEnt = ! empty($this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue)
1592
+            $dhSaiEnt = !empty($this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue)
1593 1593
             ? $this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue
1594 1594
             : '';
1595 1595
             $tsDhSaiEnt = $this->toTimestamp($dhSaiEnt);
@@ -1628,7 +1628,7 @@  discard block
 block discarded – undo
1628 1628
         $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
1629 1629
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1630 1630
         //NOME / RAZÃO SOCIAL
1631
-        $w = round($maxW*0.61, 0);
1631
+        $w = round($maxW * 0.61, 0);
1632 1632
         $w1 = $w;
1633 1633
         $y += 3;
1634 1634
         $texto = 'NOME / RAZÃO SOCIAL';
@@ -1646,19 +1646,19 @@  discard block
 block discarded – undo
1646 1646
         }
1647 1647
         //CNPJ / CPF
1648 1648
         $x += $w;
1649
-        $w = round($maxW*0.23, 0);
1649
+        $w = round($maxW * 0.23, 0);
1650 1650
         $w2 = $w;
1651 1651
         $texto = 'CNPJ / CPF';
1652 1652
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1653 1653
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1654 1654
         //Pegando valor do CPF/CNPJ
1655
-        if (! empty($this->entrega->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1655
+        if (!empty($this->entrega->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1656 1656
             $texto = $this->formatField(
1657 1657
                 $this->entrega->getElementsByTagName("CNPJ")->item(0)->nodeValue,
1658 1658
                 "###.###.###/####-##"
1659 1659
             );
1660 1660
         } else {
1661
-            $texto = ! empty($this->entrega->getElementsByTagName("CPF")->item(0)->nodeValue) ?
1661
+            $texto = !empty($this->entrega->getElementsByTagName("CPF")->item(0)->nodeValue) ?
1662 1662
                     $this->formatField(
1663 1663
                         $this->entrega->getElementsByTagName("CPF")->item(0)->nodeValue,
1664 1664
                         "###.###.###-##"
@@ -1668,7 +1668,7 @@  discard block
 block discarded – undo
1668 1668
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1669 1669
         //INSCRIÇÃO ESTADUAL
1670 1670
         $x += $w;
1671
-        $w = $maxW-($w1+$w2);
1671
+        $w = $maxW - ($w1 + $w2);
1672 1672
         $wx = $w;
1673 1673
         $texto = 'INSCRIÇÃO ESTADUAL';
1674 1674
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
@@ -1684,7 +1684,7 @@  discard block
 block discarded – undo
1684 1684
             $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 1, '');
1685 1685
         }
1686 1686
         //ENDEREÇO
1687
-        $w = round($maxW*0.355, 0) + $wx;
1687
+        $w = round($maxW * 0.355, 0) + $wx;
1688 1688
         $w1 = $w;
1689 1689
         $y += $h;
1690 1690
         $x = $oldX;
@@ -1698,7 +1698,7 @@  discard block
 block discarded – undo
1698 1698
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 0, '', true);
1699 1699
         //BAIRRO / DISTRITO
1700 1700
         $x += $w;
1701
-        $w = round($maxW*0.335, 0);
1701
+        $w = round($maxW * 0.335, 0);
1702 1702
         $w2 = $w;
1703 1703
         $texto = 'BAIRRO / DISTRITO';
1704 1704
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
@@ -1708,17 +1708,17 @@  discard block
 block discarded – undo
1708 1708
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1709 1709
         //CEP
1710 1710
         $x += $w;
1711
-        $w = $maxW-($w1+$w2);
1711
+        $w = $maxW - ($w1 + $w2);
1712 1712
         $texto = 'CEP';
1713 1713
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1714 1714
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1715
-        $texto = ! empty($this->entrega->getElementsByTagName("CEP")->item(0)->nodeValue) ?
1715
+        $texto = !empty($this->entrega->getElementsByTagName("CEP")->item(0)->nodeValue) ?
1716 1716
                 $this->entrega->getElementsByTagName("CEP")->item(0)->nodeValue : '';
1717 1717
         $texto = $this->formatField($texto, "#####-###");
1718 1718
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
1719 1719
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1720 1720
         //MUNICÍPIO
1721
-        $w = round($maxW*0.805, 0);
1721
+        $w = round($maxW * 0.805, 0);
1722 1722
         $w1 = $w;
1723 1723
         $y += $h;
1724 1724
         $x = $oldX;
@@ -1727,7 +1727,7 @@  discard block
 block discarded – undo
1727 1727
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1728 1728
         $texto = $this->entrega->getElementsByTagName("xMun")->item(0)->nodeValue;
1729 1729
         if (strtoupper(trim($texto)) == "EXTERIOR" && $this->entrega->getElementsByTagName("xPais")->length > 0) {
1730
-            $texto .= " - " .  $this->entrega->getElementsByTagName("xPais")->item(0)->nodeValue;
1730
+            $texto .= " - " . $this->entrega->getElementsByTagName("xPais")->item(0)->nodeValue;
1731 1731
         }
1732 1732
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
1733 1733
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 0, '');
@@ -1742,11 +1742,11 @@  discard block
 block discarded – undo
1742 1742
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1743 1743
         //FONE / FAX
1744 1744
         $x += $w;
1745
-        $w = $maxW-$w-$w1;
1745
+        $w = $maxW - $w - $w1;
1746 1746
         $texto = 'FONE / FAX';
1747 1747
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1748 1748
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1749
-        $texto = ! empty($this->entrega->getElementsByTagName("fone")->item(0)->nodeValue) ?
1749
+        $texto = !empty($this->entrega->getElementsByTagName("fone")->item(0)->nodeValue) ?
1750 1750
                 $this->entrega->getElementsByTagName("fone")->item(0)->nodeValue : '';
1751 1751
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
1752 1752
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
@@ -1778,7 +1778,7 @@  discard block
 block discarded – undo
1778 1778
         $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
1779 1779
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1780 1780
         //NOME / RAZÃO SOCIAL
1781
-        $w = round($maxW*0.61, 0);
1781
+        $w = round($maxW * 0.61, 0);
1782 1782
         $w1 = $w;
1783 1783
         $y += 3;
1784 1784
         $texto = 'NOME / RAZÃO SOCIAL';
@@ -1796,19 +1796,19 @@  discard block
 block discarded – undo
1796 1796
         }
1797 1797
         //CNPJ / CPF
1798 1798
         $x += $w;
1799
-        $w = round($maxW*0.23, 0);
1799
+        $w = round($maxW * 0.23, 0);
1800 1800
         $w2 = $w;
1801 1801
         $texto = 'CNPJ / CPF';
1802 1802
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1803 1803
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1804 1804
         //Pegando valor do CPF/CNPJ
1805
-        if (! empty($this->retirada->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1805
+        if (!empty($this->retirada->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1806 1806
             $texto = $this->formatField(
1807 1807
                 $this->retirada->getElementsByTagName("CNPJ")->item(0)->nodeValue,
1808 1808
                 "###.###.###/####-##"
1809 1809
             );
1810 1810
         } else {
1811
-            $texto = ! empty($this->retirada->getElementsByTagName("CPF")->item(0)->nodeValue) ?
1811
+            $texto = !empty($this->retirada->getElementsByTagName("CPF")->item(0)->nodeValue) ?
1812 1812
                     $this->formatField(
1813 1813
                         $this->retirada->getElementsByTagName("CPF")->item(0)->nodeValue,
1814 1814
                         "###.###.###-##"
@@ -1818,7 +1818,7 @@  discard block
 block discarded – undo
1818 1818
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1819 1819
         //INSCRIÇÃO ESTADUAL
1820 1820
         $x += $w;
1821
-        $w = $maxW-($w1+$w2);
1821
+        $w = $maxW - ($w1 + $w2);
1822 1822
         $wx = $w;
1823 1823
         $texto = 'INSCRIÇÃO ESTADUAL';
1824 1824
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
@@ -1834,7 +1834,7 @@  discard block
 block discarded – undo
1834 1834
             $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 1, '');
1835 1835
         }
1836 1836
         //ENDEREÇO
1837
-        $w = round($maxW*0.355, 0) + $wx;
1837
+        $w = round($maxW * 0.355, 0) + $wx;
1838 1838
         $w1 = $w;
1839 1839
         $y += $h;
1840 1840
         $x = $oldX;
@@ -1848,7 +1848,7 @@  discard block
 block discarded – undo
1848 1848
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 0, '', true);
1849 1849
         //BAIRRO / DISTRITO
1850 1850
         $x += $w;
1851
-        $w = round($maxW*0.335, 0);
1851
+        $w = round($maxW * 0.335, 0);
1852 1852
         $w2 = $w;
1853 1853
         $texto = 'BAIRRO / DISTRITO';
1854 1854
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
@@ -1858,17 +1858,17 @@  discard block
 block discarded – undo
1858 1858
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1859 1859
         //CEP
1860 1860
         $x += $w;
1861
-        $w = $maxW-($w1+$w2);
1861
+        $w = $maxW - ($w1 + $w2);
1862 1862
         $texto = 'CEP';
1863 1863
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1864 1864
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1865
-        $texto = ! empty($this->retirada->getElementsByTagName("CEP")->item(0)->nodeValue) ?
1865
+        $texto = !empty($this->retirada->getElementsByTagName("CEP")->item(0)->nodeValue) ?
1866 1866
                 $this->retirada->getElementsByTagName("CEP")->item(0)->nodeValue : '';
1867 1867
         $texto = $this->formatField($texto, "#####-###");
1868 1868
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
1869 1869
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1870 1870
         //MUNICÍPIO
1871
-        $w = round($maxW*0.805, 0);
1871
+        $w = round($maxW * 0.805, 0);
1872 1872
         $w1 = $w;
1873 1873
         $y += $h;
1874 1874
         $x = $oldX;
@@ -1877,7 +1877,7 @@  discard block
 block discarded – undo
1877 1877
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1878 1878
         $texto = $this->retirada->getElementsByTagName("xMun")->item(0)->nodeValue;
1879 1879
         if (strtoupper(trim($texto)) == "EXTERIOR" && $this->retirada->getElementsByTagName("xPais")->length > 0) {
1880
-            $texto .= " - " .  $this->retirada->getElementsByTagName("xPais")->item(0)->nodeValue;
1880
+            $texto .= " - " . $this->retirada->getElementsByTagName("xPais")->item(0)->nodeValue;
1881 1881
         }
1882 1882
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
1883 1883
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 0, '');
@@ -1892,11 +1892,11 @@  discard block
 block discarded – undo
1892 1892
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1893 1893
         //FONE / FAX
1894 1894
         $x += $w;
1895
-        $w = $maxW-$w-$w1;
1895
+        $w = $maxW - $w - $w1;
1896 1896
         $texto = 'FONE / FAX';
1897 1897
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1898 1898
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1899
-        $texto = ! empty($this->retirada->getElementsByTagName("fone")->item(0)->nodeValue) ?
1899
+        $texto = !empty($this->retirada->getElementsByTagName("fone")->item(0)->nodeValue) ?
1900 1900
                 $this->retirada->getElementsByTagName("fone")->item(0)->nodeValue : '';
1901 1901
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
1902 1902
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
@@ -1969,7 +1969,7 @@  discard block
 block discarded – undo
1969 1969
     protected function fatura($x, $y)
1970 1970
     {
1971 1971
         $linha = 1;
1972
-        $h = 8+3;
1972
+        $h = 8 + 3;
1973 1973
         $oldx = $x;
1974 1974
         $textoFatura = $this->getTextoFatura();
1975 1975
         //verificar se existem duplicatas
@@ -2002,29 +2002,29 @@  discard block
 block discarded – undo
2002 2002
                 return ($y + $h - 3);
2003 2003
             }
2004 2004
             if ($textoFatura !== "" && $this->exibirTextoFatura) {
2005
-                $myH=6;
2005
+                $myH = 6;
2006 2006
                 $myW = $this->wPrint;
2007 2007
                 if ($this->orientacao == 'L') {
2008 2008
                     $myW -= $this->wCanhoto;
2009 2009
                 }
2010 2010
                 $aFont = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>''];
2011 2011
                 $this->pdf->textBox($x, $y, $myW, $myH, $textoFatura, $aFont, 'C', 'L', 1, '');
2012
-                $y+=$myH+1;
2012
+                $y += $myH + 1;
2013 2013
             }
2014 2014
             if ($this->orientacao == 'P') {
2015
-                $w = round($this->wPrint/7.018, 0)-1;
2015
+                $w = round($this->wPrint / 7.018, 0) - 1;
2016 2016
             } else {
2017 2017
                 $w = 28;
2018 2018
             }
2019 2019
             $increm = 1;
2020 2020
             foreach ($this->dup as $k => $d) {
2021
-                $nDup = ! empty($this->dup->item($k)->getElementsByTagName('nDup')->item(0)->nodeValue)
2021
+                $nDup = !empty($this->dup->item($k)->getElementsByTagName('nDup')->item(0)->nodeValue)
2022 2022
                 ? $this->dup->item($k)->getElementsByTagName('nDup')->item(0)->nodeValue
2023 2023
                 : '';
2024
-                $dDup = ! empty($this->dup->item($k)->getElementsByTagName('dVenc')->item(0)->nodeValue)
2024
+                $dDup = !empty($this->dup->item($k)->getElementsByTagName('dVenc')->item(0)->nodeValue)
2025 2025
                 ? $this->ymdTodmy($this->dup->item($k)->getElementsByTagName('dVenc')->item(0)->nodeValue)
2026 2026
                 : '';
2027
-                $vDup = ! empty($this->dup->item($k)->getElementsByTagName('vDup')->item(0)->nodeValue)
2027
+                $vDup = !empty($this->dup->item($k)->getElementsByTagName('vDup')->item(0)->nodeValue)
2028 2028
                 ? 'R$ ' . number_format(
2029 2029
                     $this->dup->item($k)->getElementsByTagName('vDup')->item(0)->nodeValue,
2030 2030
                     2,
@@ -2034,14 +2034,14 @@  discard block
 block discarded – undo
2034 2034
                 : '';
2035 2035
                 $h = 8;
2036 2036
                 $texto = '';
2037
-                if ($nDup!='0' && $nDup!='') {
2037
+                if ($nDup != '0' && $nDup != '') {
2038 2038
                     $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2039 2039
                     $this->pdf->textBox($x, $y, $w, $h, 'Num.', $aFont, 'T', 'L', 1, '');
2040 2040
                     $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
2041 2041
                     $this->pdf->textBox($x, $y, $w, $h, $nDup, $aFont, 'T', 'R', 0, '');
2042 2042
                 } else {
2043 2043
                     $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2044
-                    $this->pdf->textBox($x, $y, $w, $h, ($dupcont+1)."", $aFont, 'T', 'L', 1, '');
2044
+                    $this->pdf->textBox($x, $y, $w, $h, ($dupcont + 1) . "", $aFont, 'T', 'L', 1, '');
2045 2045
                 }
2046 2046
                 $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2047 2047
                 $this->pdf->textBox($x, $y, $w, $h, 'Venc.', $aFont, 'C', 'L', 0, '');
@@ -2051,7 +2051,7 @@  discard block
 block discarded – undo
2051 2051
                 $this->pdf->textBox($x, $y, $w, $h, 'Valor', $aFont, 'B', 'L', 0, '');
2052 2052
                 $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
2053 2053
                 $this->pdf->textBox($x, $y, $w, $h, $vDup, $aFont, 'B', 'R', 0, '');
2054
-                $x += $w+$increm;
2054
+                $x += $w + $increm;
2055 2055
                 $dupcont += 1;
2056 2056
                 if ($this->orientacao == 'P') {
2057 2057
                     $maxDupCont = 6;
@@ -2073,10 +2073,10 @@  discard block
 block discarded – undo
2073 2073
                 $y -= 9;
2074 2074
                 $linha--;
2075 2075
             }
2076
-            return ($y+$h);
2076
+            return ($y + $h);
2077 2077
         } else {
2078 2078
             $linha = 0;
2079
-            return ($y-2);
2079
+            return ($y - 2);
2080 2080
         }
2081 2081
     }
2082 2082
 
@@ -2092,7 +2092,7 @@  discard block
 block discarded – undo
2092 2092
     protected function pagamento($x, $y)
2093 2093
     {
2094 2094
         $linha = 1;
2095
-        $h = 8+3;
2095
+        $h = 8 + 3;
2096 2096
         $oldx = $x;
2097 2097
         //verificar se existem cobranças definidas
2098 2098
         if (isset($this->detPag) && $this->detPag->length > 0) {
@@ -2111,7 +2111,7 @@  discard block
 block discarded – undo
2111 2111
             $dups = "";
2112 2112
             $dupcont = 0;
2113 2113
             if ($this->orientacao == 'P') {
2114
-                $w = round($this->wPrint/7.018, 0)-1;
2114
+                $w = round($this->wPrint / 7.018, 0) - 1;
2115 2115
             } else {
2116 2116
                 $w = 28;
2117 2117
             }
@@ -2121,17 +2121,17 @@  discard block
 block discarded – undo
2121 2121
                 $maxDupCont = 8;
2122 2122
             }
2123 2123
             $increm = 1;
2124
-            $formaPagamento = ['01'=>'Dinheiro','02'=>'Cheque','03'=>'Cartão de Crédito',
2125
-                                    '04'=>'Cartão de Débito','05'=>'Crédito Loja','10'=>'Vale Alimentação',
2126
-                                    '11'=>'Vale Refeição','12'=>'Vale Presente','13'=>'Vale Combustível',
2127
-                                    '14'=>'Duplicata Mercantil','15'=>'Boleto','90'=>'Sem pagamento','99'=>'Outros'];
2128
-            $bandeira = ['01'=>'Visa','02'=>'Mastercard','03'=>'American','04'=>'Sorocred','05'=>'Diners',
2129
-                              '06'=>'Elo','07'=>'Hipercard','08'=>'Aura','09'=>'Cabal','99'=>'Outros'];
2124
+            $formaPagamento = ['01'=>'Dinheiro', '02'=>'Cheque', '03'=>'Cartão de Crédito',
2125
+                                    '04'=>'Cartão de Débito', '05'=>'Crédito Loja', '10'=>'Vale Alimentação',
2126
+                                    '11'=>'Vale Refeição', '12'=>'Vale Presente', '13'=>'Vale Combustível',
2127
+                                    '14'=>'Duplicata Mercantil', '15'=>'Boleto', '90'=>'Sem pagamento', '99'=>'Outros'];
2128
+            $bandeira = ['01'=>'Visa', '02'=>'Mastercard', '03'=>'American', '04'=>'Sorocred', '05'=>'Diners',
2129
+                              '06'=>'Elo', '07'=>'Hipercard', '08'=>'Aura', '09'=>'Cabal', '99'=>'Outros'];
2130 2130
             foreach ($this->detPag as $k => $d) {
2131 2131
                 $fPag = !empty($this->detPag->item($k)->getElementsByTagName('tPag')->item(0)->nodeValue)
2132 2132
                 ? $this->detPag->item($k)->getElementsByTagName('tPag')->item(0)->nodeValue
2133 2133
                 : '0';
2134
-                $vPag = ! empty($this->detPag->item($k)->getElementsByTagName('vPag')->item(0)->nodeValue)
2134
+                $vPag = !empty($this->detPag->item($k)->getElementsByTagName('vPag')->item(0)->nodeValue)
2135 2135
                 ? 'R$ ' . number_format(
2136 2136
                     $this->detPag->item($k)->getElementsByTagName('vPag')->item(0)->nodeValue,
2137 2137
                     2,
@@ -2143,7 +2143,7 @@  discard block
 block discarded – undo
2143 2143
                 $texto = '';
2144 2144
                 if (isset($formaPagamento[$fPag])) {
2145 2145
                     /*Exibir Item sem pagamento ou outros?*/
2146
-                    if ($fPag=='90' || $fPag=='99') {
2146
+                    if ($fPag == '90' || $fPag == '99') {
2147 2147
                         continue;
2148 2148
                     }
2149 2149
                     $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
@@ -2152,16 +2152,16 @@  discard block
 block discarded – undo
2152 2152
                     $this->pdf->textBox($x, $y, $w, $h, $formaPagamento[$fPag], $aFont, 'T', 'R', 0, '');
2153 2153
                 } else {
2154 2154
                     $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>''];
2155
-                    $this->pdf->textBox($x, $y, $w, $h, "Forma ".$fPag." não encontrado", $aFont, 'T', 'L', 1, '');
2155
+                    $this->pdf->textBox($x, $y, $w, $h, "Forma " . $fPag . " não encontrado", $aFont, 'T', 'L', 1, '');
2156 2156
                 }
2157 2157
                 $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2158 2158
                 $this->pdf->textBox($x, $y, $w, $h, 'Valor', $aFont, 'B', 'L', 0, '');
2159 2159
                 $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
2160 2160
                 $this->pdf->textBox($x, $y, $w, $h, $vPag, $aFont, 'B', 'R', 0, '');
2161
-                $x += $w+$increm;
2161
+                $x += $w + $increm;
2162 2162
                 $dupcont += 1;
2163 2163
 
2164
-                if ($dupcont>$maxDupCont) {
2164
+                if ($dupcont > $maxDupCont) {
2165 2165
                     $y += 9;
2166 2166
                     $x = $oldx;
2167 2167
                     $dupcont = 0;
@@ -2176,10 +2176,10 @@  discard block
 block discarded – undo
2176 2176
                 $y -= 9;
2177 2177
                 $linha--;
2178 2178
             }
2179
-            return ($y+$h);
2179
+            return ($y + $h);
2180 2180
         } else {
2181 2181
             $linha = 0;
2182
-            return ($y-2);
2182
+            return ($y - 2);
2183 2183
         }
2184 2184
     } //fim da função pagamento
2185 2185
     
@@ -2291,7 +2291,7 @@  discard block
 block discarded – undo
2291 2291
         }
2292 2292
         $x = $this->impostoHelper($x, $y, $w, $h, "V. TOTAL DA NOTA", "vNF");
2293 2293
 
2294
-        return ($y+$h);
2294
+        return ($y + $h);
2295 2295
     } //fim imposto
2296 2296
 
2297 2297
     /**
@@ -2319,13 +2319,13 @@  discard block
 block discarded – undo
2319 2319
         $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
2320 2320
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
2321 2321
         //NOME / RAZÃO SOCIAL
2322
-        $w1 = $maxW*0.29;
2322
+        $w1 = $maxW * 0.29;
2323 2323
         $y += 3;
2324 2324
         $texto = 'NOME / RAZÃO SOCIAL';
2325 2325
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2326 2326
         $this->pdf->textBox($x, $y, $w1, $h, $texto, $aFont, 'T', 'L', 1, '');
2327 2327
         if (isset($this->transporta)) {
2328
-            $texto = ! empty($this->transporta->getElementsByTagName("xNome")->item(0)->nodeValue)
2328
+            $texto = !empty($this->transporta->getElementsByTagName("xNome")->item(0)->nodeValue)
2329 2329
             ? $this->transporta->getElementsByTagName("xNome")->item(0)->nodeValue
2330 2330
             : '';
2331 2331
         } else {
@@ -2335,11 +2335,11 @@  discard block
 block discarded – undo
2335 2335
         $this->pdf->textBox($x, $y, $w1, $h, $texto, $aFont, 'B', 'L', 0, '');
2336 2336
         //FRETE POR CONTA
2337 2337
         $x += $w1;
2338
-        $w2 = $maxW*0.15;
2338
+        $w2 = $maxW * 0.15;
2339 2339
         $texto = 'FRETE';
2340 2340
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2341 2341
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
2342
-        $tipoFrete = ! empty($this->transp->getElementsByTagName("modFrete")->item(0)->nodeValue)
2342
+        $tipoFrete = !empty($this->transp->getElementsByTagName("modFrete")->item(0)->nodeValue)
2343 2343
         ? $this->transp->getElementsByTagName("modFrete")->item(0)->nodeValue
2344 2344
         : '0';
2345 2345
         switch ($tipoFrete) {
@@ -2370,7 +2370,7 @@  discard block
 block discarded – undo
2370 2370
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2371 2371
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
2372 2372
         if (isset($this->veicTransp)) {
2373
-            $texto = ! empty($this->veicTransp->getElementsByTagName("RNTC")->item(0)->nodeValue)
2373
+            $texto = !empty($this->veicTransp->getElementsByTagName("RNTC")->item(0)->nodeValue)
2374 2374
             ? $this->veicTransp->getElementsByTagName("RNTC")->item(0)->nodeValue
2375 2375
             : '';
2376 2376
         } else {
@@ -2384,11 +2384,11 @@  discard block
 block discarded – undo
2384 2384
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2385 2385
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
2386 2386
         if (isset($this->veicTransp)) {
2387
-            $texto = ! empty($this->veicTransp->getElementsByTagName("placa")->item(0)->nodeValue)
2387
+            $texto = !empty($this->veicTransp->getElementsByTagName("placa")->item(0)->nodeValue)
2388 2388
             ? $this->veicTransp->getElementsByTagName("placa")->item(0)->nodeValue
2389 2389
             : '';
2390 2390
         } elseif (isset($this->reboque)) {
2391
-            $texto = ! empty($this->reboque->getElementsByTagName("placa")->item(0)->nodeValue)
2391
+            $texto = !empty($this->reboque->getElementsByTagName("placa")->item(0)->nodeValue)
2392 2392
             ? $this->reboque->getElementsByTagName("placa")->item(0)->nodeValue
2393 2393
             : '';
2394 2394
         } else {
@@ -2398,16 +2398,16 @@  discard block
 block discarded – undo
2398 2398
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'B', 'C', 0, '');
2399 2399
         //UF
2400 2400
         $x += $w2;
2401
-        $w3 = round($maxW*0.04, 0);
2401
+        $w3 = round($maxW * 0.04, 0);
2402 2402
         $texto = 'UF';
2403 2403
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2404 2404
         $this->pdf->textBox($x, $y, $w3, $h, $texto, $aFont, 'T', 'L', 1, '');
2405 2405
         if (isset($this->veicTransp)) {
2406
-            $texto = ! empty($this->veicTransp->getElementsByTagName("UF")->item(0)->nodeValue)
2406
+            $texto = !empty($this->veicTransp->getElementsByTagName("UF")->item(0)->nodeValue)
2407 2407
             ? $this->veicTransp->getElementsByTagName("UF")->item(0)->nodeValue
2408 2408
             : '';
2409 2409
         } elseif (isset($this->reboque)) {
2410
-            $texto = ! empty($this->reboque->getElementsByTagName("UF")->item(0)->nodeValue)
2410
+            $texto = !empty($this->reboque->getElementsByTagName("UF")->item(0)->nodeValue)
2411 2411
             ? $this->reboque->getElementsByTagName("UF")->item(0)->nodeValue
2412 2412
             : '';
2413 2413
         } else {
@@ -2417,19 +2417,19 @@  discard block
 block discarded – undo
2417 2417
         $this->pdf->textBox($x, $y, $w3, $h, $texto, $aFont, 'B', 'C', 0, '');
2418 2418
         //CNPJ / CPF
2419 2419
         $x += $w3;
2420
-        $w = $maxW-($w1+3*$w2+$w3);
2420
+        $w = $maxW - ($w1 + 3 * $w2 + $w3);
2421 2421
         $texto = 'CNPJ / CPF';
2422 2422
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2423 2423
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
2424 2424
         if (isset($this->transporta)) {
2425
-            $texto = ! empty($this->transporta->getElementsByTagName("CNPJ")->item(0)->nodeValue)
2425
+            $texto = !empty($this->transporta->getElementsByTagName("CNPJ")->item(0)->nodeValue)
2426 2426
             ? $this->formatField(
2427 2427
                 $this->transporta->getElementsByTagName("CNPJ")->item(0)->nodeValue,
2428 2428
                 "##.###.###/####-##"
2429 2429
             )
2430 2430
             : '';
2431 2431
             if ($texto == '') {
2432
-                $texto = ! empty($this->transporta->getElementsByTagName("CPF")->item(0)->nodeValue)
2432
+                $texto = !empty($this->transporta->getElementsByTagName("CPF")->item(0)->nodeValue)
2433 2433
                 ? $this->formatField(
2434 2434
                     $this->transporta->getElementsByTagName("CPF")->item(0)->nodeValue,
2435 2435
                     "###.###.###-##"
@@ -2446,12 +2446,12 @@  discard block
 block discarded – undo
2446 2446
         $y += $h;
2447 2447
         $x = $oldX;
2448 2448
         $h = 7;
2449
-        $w1 = $maxW*0.44;
2449
+        $w1 = $maxW * 0.44;
2450 2450
         $texto = 'ENDEREÇO';
2451 2451
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2452 2452
         $this->pdf->textBox($x, $y, $w1, $h, $texto, $aFont, 'T', 'L', 1, '');
2453 2453
         if (isset($this->transporta)) {
2454
-            $texto = ! empty($this->transporta->getElementsByTagName("xEnder")->item(0)->nodeValue)
2454
+            $texto = !empty($this->transporta->getElementsByTagName("xEnder")->item(0)->nodeValue)
2455 2455
                 ? $this->transporta->getElementsByTagName("xEnder")->item(0)->nodeValue
2456 2456
                 : '';
2457 2457
         } else {
@@ -2461,12 +2461,12 @@  discard block
 block discarded – undo
2461 2461
         $this->pdf->textBox($x, $y, $w1, $h, $texto, $aFont, 'B', 'L', 0, '');
2462 2462
         //MUNICÍPIO
2463 2463
         $x += $w1;
2464
-        $w2 = round($maxW*0.30, 0);
2464
+        $w2 = round($maxW * 0.30, 0);
2465 2465
         $texto = 'MUNICÍPIO';
2466 2466
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2467 2467
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
2468 2468
         if (isset($this->transporta)) {
2469
-            $texto = ! empty($this->transporta->getElementsByTagName("xMun")->item(0)->nodeValue)
2469
+            $texto = !empty($this->transporta->getElementsByTagName("xMun")->item(0)->nodeValue)
2470 2470
                 ? $this->transporta->getElementsByTagName("xMun")->item(0)->nodeValue
2471 2471
                 : '';
2472 2472
         } else {
@@ -2476,12 +2476,12 @@  discard block
 block discarded – undo
2476 2476
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'B', 'C', 0, '');
2477 2477
         //UF
2478 2478
         $x += $w2;
2479
-        $w3 = round($maxW*0.04, 0);
2479
+        $w3 = round($maxW * 0.04, 0);
2480 2480
         $texto = 'UF';
2481 2481
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2482 2482
         $this->pdf->textBox($x, $y, $w3, $h, $texto, $aFont, 'T', 'L', 1, '');
2483 2483
         if (isset($this->transporta)) {
2484
-            $texto = ! empty($this->transporta->getElementsByTagName("UF")->item(0)->nodeValue)
2484
+            $texto = !empty($this->transporta->getElementsByTagName("UF")->item(0)->nodeValue)
2485 2485
                 ? $this->transporta->getElementsByTagName("UF")->item(0)->nodeValue
2486 2486
                 : '';
2487 2487
         } else {
@@ -2491,13 +2491,13 @@  discard block
 block discarded – undo
2491 2491
         $this->pdf->textBox($x, $y, $w3, $h, $texto, $aFont, 'B', 'C', 0, '');
2492 2492
         //INSCRIÇÃO ESTADUAL
2493 2493
         $x += $w3;
2494
-        $w = $maxW-($w1+$w2+$w3);
2494
+        $w = $maxW - ($w1 + $w2 + $w3);
2495 2495
         $texto = 'INSCRIÇÃO ESTADUAL';
2496 2496
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2497 2497
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
2498 2498
         $texto = '';
2499 2499
         if (isset($this->transporta)) {
2500
-            if (! empty($this->transporta->getElementsByTagName("IE")->item(0)->nodeValue)) {
2500
+            if (!empty($this->transporta->getElementsByTagName("IE")->item(0)->nodeValue)) {
2501 2501
                 $texto = $this->transporta->getElementsByTagName("IE")->item(0)->nodeValue;
2502 2502
             }
2503 2503
         }
@@ -2510,16 +2510,16 @@  discard block
 block discarded – undo
2510 2510
         $marca = '';
2511 2511
         $numero = '';
2512 2512
         $texto = '';
2513
-        $pesoBruto=0;
2514
-        $pesoLiquido=0;
2513
+        $pesoBruto = 0;
2514
+        $pesoLiquido = 0;
2515 2515
         foreach ($volumes as $volume) {
2516
-            $quantidade += ! empty($volume->getElementsByTagName("qVol")->item(0)->nodeValue) ?
2516
+            $quantidade += !empty($volume->getElementsByTagName("qVol")->item(0)->nodeValue) ?
2517 2517
                     $volume->getElementsByTagName("qVol")->item(0)->nodeValue : 0;
2518
-            $pesoBruto += ! empty($volume->getElementsByTagName("pesoB")->item(0)->nodeValue) ?
2518
+            $pesoBruto += !empty($volume->getElementsByTagName("pesoB")->item(0)->nodeValue) ?
2519 2519
                     $volume->getElementsByTagName("pesoB")->item(0)->nodeValue : 0;
2520
-            $pesoLiquido += ! empty($volume->getElementsByTagName("pesoL")->item(0)->nodeValue) ?
2520
+            $pesoLiquido += !empty($volume->getElementsByTagName("pesoL")->item(0)->nodeValue) ?
2521 2521
                     $volume->getElementsByTagName("pesoL")->item(0)->nodeValue : 0;
2522
-            $texto = ! empty($this->transp->getElementsByTagName("esp")->item(0)->nodeValue) ?
2522
+            $texto = !empty($this->transp->getElementsByTagName("esp")->item(0)->nodeValue) ?
2523 2523
                     $this->transp->getElementsByTagName("esp")->item(0)->nodeValue : '';
2524 2524
             if ($texto != $especie && $especie != '') {
2525 2525
                 //tem várias especies
@@ -2527,7 +2527,7 @@  discard block
 block discarded – undo
2527 2527
             } else {
2528 2528
                 $especie = $texto;
2529 2529
             }
2530
-            $texto = ! empty($this->transp->getElementsByTagName("marca")->item(0)->nodeValue)
2530
+            $texto = !empty($this->transp->getElementsByTagName("marca")->item(0)->nodeValue)
2531 2531
                 ? $this->transp->getElementsByTagName("marca")->item(0)->nodeValue
2532 2532
                 : '';
2533 2533
             if ($texto != $marca && $marca != '') {
@@ -2536,7 +2536,7 @@  discard block
 block discarded – undo
2536 2536
             } else {
2537 2537
                 $marca = $texto;
2538 2538
             }
2539
-            $texto = ! empty($this->transp->getElementsByTagName("nVol")->item(0)->nodeValue)
2539
+            $texto = !empty($this->transp->getElementsByTagName("nVol")->item(0)->nodeValue)
2540 2540
                 ? $this->transp->getElementsByTagName("nVol")->item(0)->nodeValue
2541 2541
                 : '';
2542 2542
             if ($texto != $numero && $numero != '') {
@@ -2552,7 +2552,7 @@  discard block
 block discarded – undo
2552 2552
         $y += $h;
2553 2553
         $x = $oldX;
2554 2554
         $h = 7;
2555
-        $w1 = round($maxW*0.10, 0);
2555
+        $w1 = round($maxW * 0.10, 0);
2556 2556
         $texto = 'QUANTIDADE';
2557 2557
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2558 2558
         $this->pdf->textBox($x, $y, $w1, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -2563,7 +2563,7 @@  discard block
 block discarded – undo
2563 2563
         }
2564 2564
         //ESPÉCIE
2565 2565
         $x += $w1;
2566
-        $w2 = round($maxW*0.17, 0);
2566
+        $w2 = round($maxW * 0.17, 0);
2567 2567
         $texto = 'ESPÉCIE';
2568 2568
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2569 2569
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -2575,7 +2575,7 @@  discard block
 block discarded – undo
2575 2575
         $texto = 'MARCA';
2576 2576
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2577 2577
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
2578
-        $texto = ! empty($this->transp->getElementsByTagName("marca")->item(0)->nodeValue) ?
2578
+        $texto = !empty($this->transp->getElementsByTagName("marca")->item(0)->nodeValue) ?
2579 2579
                 $this->transp->getElementsByTagName("marca")->item(0)->nodeValue : '';
2580 2580
         $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'];
2581 2581
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'B', 'C', 0, '');
@@ -2589,7 +2589,7 @@  discard block
 block discarded – undo
2589 2589
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'B', 'C', 0, '');
2590 2590
         //PESO BRUTO
2591 2591
         $x += $w2;
2592
-        $w3 = round($maxW*0.20, 0);
2592
+        $w3 = round($maxW * 0.20, 0);
2593 2593
         $texto = 'PESO BRUTO';
2594 2594
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2595 2595
         $this->pdf->textBox($x, $y, $w3, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -2602,7 +2602,7 @@  discard block
 block discarded – undo
2602 2602
         $this->pdf->textBox($x, $y, $w3, $h, $texto, $aFont, 'B', 'R', 0, '');
2603 2603
         //PESO LÍQUIDO
2604 2604
         $x += $w3;
2605
-        $w = $maxW -($w1+3*$w2+$w3);
2605
+        $w = $maxW - ($w1 + 3 * $w2 + $w3);
2606 2606
         $texto = 'PESO LÍQUIDO';
2607 2607
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2608 2608
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -2613,7 +2613,7 @@  discard block
 block discarded – undo
2613 2613
         }
2614 2614
         $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'];
2615 2615
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'R', 0, '');
2616
-        return ($y+$h);
2616
+        return ($y + $h);
2617 2617
     } //fim transporte
2618 2618
 
2619 2619
 
@@ -2625,7 +2625,7 @@  discard block
 block discarded – undo
2625 2625
             return "";
2626 2626
         }
2627 2627
         $valor_original = $valor_original->nodeValue;
2628
-        $valor = ! empty($valor_original) ? number_format($valor_original, 2, ",", ".") : '';
2628
+        $valor = !empty($valor_original) ? number_format($valor_original, 2, ",", ".") : '';
2629 2629
 
2630 2630
         if ($valor != "") {
2631 2631
             return sprintf($formato, $valor);
@@ -2672,18 +2672,18 @@  discard block
 block discarded – undo
2672 2672
             $impostos .= $this->descricaoProdutoHelper($ICMSUFDest, "vICMSUFDest", " vICMSUFDest=%s");
2673 2673
             $impostos .= $this->descricaoProdutoHelper($ICMSUFDest, "vICMSUFRemet", " vICMSUFRemet=%s");
2674 2674
         }
2675
-        $infAdProd = ! empty($itemProd->getElementsByTagName('infAdProd')->item(0)->nodeValue)
2675
+        $infAdProd = !empty($itemProd->getElementsByTagName('infAdProd')->item(0)->nodeValue)
2676 2676
         ? substr(
2677 2677
             $this->anfaveaDANFE($itemProd->getElementsByTagName('infAdProd')->item(0)->nodeValue),
2678 2678
             0,
2679 2679
             500
2680 2680
         )
2681 2681
         : '';
2682
-        if (! empty($infAdProd)) {
2682
+        if (!empty($infAdProd)) {
2683 2683
             $infAdProd = trim($infAdProd);
2684 2684
             $infAdProd .= ' ';
2685 2685
         }
2686
-        $loteTxt ='';
2686
+        $loteTxt = '';
2687 2687
         $rastro = $prod->getElementsByTagName("med");
2688 2688
         if (!empty($prod->getElementsByTagName("rastro"))) {
2689 2689
             $rastro = $prod->getElementsByTagName("rastro");
@@ -2697,15 +2697,15 @@  discard block
 block discarded – undo
2697 2697
                 $i++;
2698 2698
             }
2699 2699
             if ($loteTxt != '') {
2700
-                $loteTxt.= ' ';
2700
+                $loteTxt .= ' ';
2701 2701
             }
2702 2702
         }
2703 2703
         //NT2013.006 FCI
2704
-        $nFCI = (! empty($itemProd->getElementsByTagName('nFCI')->item(0)->nodeValue)) ?
2705
-                ' FCI:'.$itemProd->getElementsByTagName('nFCI')->item(0)->nodeValue : '';
2706
-        $tmp_ad=$infAdProd . ($this->descProdInfoComplemento ? $loteTxt . $impostos . $nFCI : '');
2704
+        $nFCI = (!empty($itemProd->getElementsByTagName('nFCI')->item(0)->nodeValue)) ?
2705
+                ' FCI:' . $itemProd->getElementsByTagName('nFCI')->item(0)->nodeValue : '';
2706
+        $tmp_ad = $infAdProd . ($this->descProdInfoComplemento ? $loteTxt . $impostos . $nFCI : '');
2707 2707
         $texto = $prod->getElementsByTagName("xProd")->item(0)->nodeValue
2708
-            . (strlen($tmp_ad)!=0?"\n    ".$tmp_ad:'');
2708
+            . (strlen($tmp_ad) != 0 ? "\n    " . $tmp_ad : '');
2709 2709
         //decodifica os caracteres html no xml
2710 2710
         $texto = html_entity_decode($texto);
2711 2711
         if ($this->descProdQuebraLinha) {
@@ -2755,111 +2755,111 @@  discard block
 block discarded – undo
2755 2755
         // cabecalho LOOP COM OS DADOS DOS PRODUTOS
2756 2756
         //CÓDIGO PRODUTO
2757 2757
         $texto = "CÓDIGO PRODUTO";
2758
-        $w1 = round($w*0.09, 0);
2758
+        $w1 = round($w * 0.09, 0);
2759 2759
         $h = 4;
2760 2760
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2761 2761
         $this->pdf->textBox($x, $y, $w1, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2762
-        $this->pdf->line($x+$w1, $y, $x+$w1, $y+$hmax);
2762
+        $this->pdf->line($x + $w1, $y, $x + $w1, $y + $hmax);
2763 2763
         //DESCRIÇÃO DO PRODUTO / SERVIÇO
2764 2764
         $x += $w1;
2765
-        $w2 = round($w*0.25, 0);
2765
+        $w2 = round($w * 0.25, 0);
2766 2766
         $texto = 'DESCRIÇÃO DO PRODUTO / SERVIÇO';
2767 2767
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2768 2768
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2769
-        $this->pdf->line($x+$w2, $y, $x+$w2, $y+$hmax);
2769
+        $this->pdf->line($x + $w2, $y, $x + $w2, $y + $hmax);
2770 2770
         //NCM/SH
2771 2771
         $x += $w2;
2772
-        $w3 = round($w*0.06, 0);
2772
+        $w3 = round($w * 0.06, 0);
2773 2773
         $texto = 'NCM/SH';
2774 2774
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2775 2775
         $this->pdf->textBox($x, $y, $w3, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2776
-        $this->pdf->line($x+$w3, $y, $x+$w3, $y+$hmax);
2776
+        $this->pdf->line($x + $w3, $y, $x + $w3, $y + $hmax);
2777 2777
         //O/CST ou O/CSOSN
2778 2778
         $x += $w3;
2779
-        $w4 = round($w*0.05, 0);
2780
-        $texto = 'O/CSOSN';//Regime do Simples CRT = 1 ou CRT = 2
2779
+        $w4 = round($w * 0.05, 0);
2780
+        $texto = 'O/CSOSN'; //Regime do Simples CRT = 1 ou CRT = 2
2781 2781
         if ($this->getTagValue($this->emit, 'CRT') == '3') {
2782
-             $texto = 'O/CST';//Regime Normal
2782
+             $texto = 'O/CST'; //Regime Normal
2783 2783
         }
2784 2784
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2785 2785
         $this->pdf->textBox($x, $y, $w4, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2786
-        $this->pdf->line($x+$w4, $y, $x+$w4, $y+$hmax);
2786
+        $this->pdf->line($x + $w4, $y, $x + $w4, $y + $hmax);
2787 2787
         //CFOP
2788 2788
         $x += $w4;
2789
-        $w5 = round($w*0.04, 0);
2789
+        $w5 = round($w * 0.04, 0);
2790 2790
         $texto = 'CFOP';
2791 2791
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2792 2792
         $this->pdf->textBox($x, $y, $w5, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2793
-        $this->pdf->line($x+$w5, $y, $x+$w5, $y+$hmax);
2793
+        $this->pdf->line($x + $w5, $y, $x + $w5, $y + $hmax);
2794 2794
         //UN
2795 2795
         $x += $w5;
2796
-        $w6 = round($w*0.03, 0);
2796
+        $w6 = round($w * 0.03, 0);
2797 2797
         $texto = 'UN';
2798 2798
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2799 2799
         $this->pdf->textBox($x, $y, $w6, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2800
-        $this->pdf->line($x+$w6, $y, $x+$w6, $y+$hmax);
2800
+        $this->pdf->line($x + $w6, $y, $x + $w6, $y + $hmax);
2801 2801
         //QUANT
2802 2802
         $x += $w6;
2803
-        $w7 = round($w*0.08, 0);
2803
+        $w7 = round($w * 0.08, 0);
2804 2804
         $texto = 'QUANT';
2805 2805
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2806 2806
         $this->pdf->textBox($x, $y, $w7, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2807
-        $this->pdf->line($x+$w7, $y, $x+$w7, $y+$hmax);
2807
+        $this->pdf->line($x + $w7, $y, $x + $w7, $y + $hmax);
2808 2808
         //VALOR UNIT
2809 2809
         $x += $w7;
2810
-        $w8 = round($w*0.06, 0);
2810
+        $w8 = round($w * 0.06, 0);
2811 2811
         $texto = 'VALOR UNIT';
2812 2812
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2813 2813
         $this->pdf->textBox($x, $y, $w8, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2814
-        $this->pdf->line($x+$w8, $y, $x+$w8, $y+$hmax);
2814
+        $this->pdf->line($x + $w8, $y, $x + $w8, $y + $hmax);
2815 2815
         //VALOR TOTAL
2816 2816
         $x += $w8;
2817
-        $w9 = round($w*0.06, 0);
2817
+        $w9 = round($w * 0.06, 0);
2818 2818
         $texto = 'VALOR TOTAL';
2819 2819
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2820 2820
         $this->pdf->textBox($x, $y, $w9, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2821
-        $this->pdf->line($x+$w9, $y, $x+$w9, $y+$hmax);
2821
+        $this->pdf->line($x + $w9, $y, $x + $w9, $y + $hmax);
2822 2822
         //VALOR DESCONTO
2823 2823
         $x += $w9;
2824
-        $w10 = round($w*0.05, 0);
2824
+        $w10 = round($w * 0.05, 0);
2825 2825
         $texto = 'VALOR DESC';
2826 2826
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2827 2827
         $this->pdf->textBox($x, $y, $w10, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2828
-        $this->pdf->line($x+$w10, $y, $x+$w10, $y+$hmax);
2828
+        $this->pdf->line($x + $w10, $y, $x + $w10, $y + $hmax);
2829 2829
         //B.CÁLC ICMS
2830 2830
         $x += $w10;
2831
-        $w11 = round($w*0.06, 0);
2831
+        $w11 = round($w * 0.06, 0);
2832 2832
         $texto = 'B.CÁLC ICMS';
2833 2833
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2834 2834
         $this->pdf->textBox($x, $y, $w11, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2835
-        $this->pdf->line($x+$w11, $y, $x+$w11, $y+$hmax);
2835
+        $this->pdf->line($x + $w11, $y, $x + $w11, $y + $hmax);
2836 2836
         //VALOR ICMS
2837 2837
         $x += $w11;
2838
-        $w12 = round($w*0.06, 0);
2838
+        $w12 = round($w * 0.06, 0);
2839 2839
         $texto = 'VALOR ICMS';
2840 2840
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2841 2841
         $this->pdf->textBox($x, $y, $w12, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2842
-        $this->pdf->line($x+$w12, $y, $x+$w12, $y+$hmax);
2842
+        $this->pdf->line($x + $w12, $y, $x + $w12, $y + $hmax);
2843 2843
         //VALOR IPI
2844 2844
         $x += $w12;
2845
-        $w13 = round($w*0.05, 0);
2845
+        $w13 = round($w * 0.05, 0);
2846 2846
         $texto = 'VALOR IPI';
2847 2847
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2848 2848
         $this->pdf->textBox($x, $y, $w13, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2849
-        $this->pdf->line($x+$w13, $y, $x+$w13, $y+$hmax);
2849
+        $this->pdf->line($x + $w13, $y, $x + $w13, $y + $hmax);
2850 2850
         //ALÍQ. ICMS
2851 2851
         $x += $w13;
2852
-        $w14 = round($w*0.04, 0);
2852
+        $w14 = round($w * 0.04, 0);
2853 2853
         $texto = 'ALÍQ. ICMS';
2854 2854
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2855 2855
         $this->pdf->textBox($x, $y, $w14, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2856
-        $this->pdf->line($x+$w14, $y, $x+$w14, $y+$hmax);
2856
+        $this->pdf->line($x + $w14, $y, $x + $w14, $y + $hmax);
2857 2857
         //ALÍQ. IPI
2858 2858
         $x += $w14;
2859
-        $w15 = $w-($w1+$w2+$w3+$w4+$w5+$w6+$w7+$w8+$w9+$w10+$w11+$w12+$w13+$w14);
2859
+        $w15 = $w - ($w1 + $w2 + $w3 + $w4 + $w5 + $w6 + $w7 + $w8 + $w9 + $w10 + $w11 + $w12 + $w13 + $w14);
2860 2860
         $texto = 'ALÍQ. IPI';
2861 2861
         $this->pdf->textBox($x, $y, $w15, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2862
-        $this->pdf->line($oldX, $y+$h+1, $oldX + $w, $y+$h+1);
2862
+        $this->pdf->line($oldX, $y + $h + 1, $oldX + $w, $y + $h + 1);
2863 2863
         $y += 5;
2864 2864
         //##################################################################################
2865 2865
         // LOOP COM OS DADOS DOS PRODUTOS
@@ -2877,7 +2877,7 @@  discard block
 block discarded – undo
2877 2877
                 $textoProduto = trim($this->descricaoProduto($thisItem));
2878 2878
 
2879 2879
                 $linhaDescr = $this->pdf->getNumLines($textoProduto, $w2, $aFont);
2880
-                $h = round(($linhaDescr * $this->pdf->fontSize)+ ($linhaDescr * 0.5), 2);
2880
+                $h = round(($linhaDescr * $this->pdf->fontSize) + ($linhaDescr * 0.5), 2);
2881 2881
                 $hUsado += $h;
2882 2882
 
2883 2883
                 $diffH = $hmax - $hUsado;
@@ -2890,11 +2890,11 @@  discard block
 block discarded – undo
2890 2890
                         break;
2891 2891
                     }
2892 2892
                 }
2893
-                $y_linha=$y+$h;
2893
+                $y_linha = $y + $h;
2894 2894
                 // linha entre itens
2895 2895
                 $this->pdf->dashedHLine($oldX, $y_linha, $w, 0.1, 120);
2896 2896
                 //corrige o x
2897
-                $x=$oldX;
2897
+                $x = $oldX;
2898 2898
                 //codigo do produto
2899 2899
                 $texto = $prod->getElementsByTagName("cProd")->item(0)->nodeValue;
2900 2900
                 $this->pdf->textBox($x, $y, $w1, $h, $texto, $aFont, 'T', 'C', 0, '');
@@ -2907,16 +2907,16 @@  discard block
 block discarded – undo
2907 2907
                 }
2908 2908
                 $x += $w2;
2909 2909
                 //NCM
2910
-                $texto = ! empty($prod->getElementsByTagName("NCM")->item(0)->nodeValue) ?
2910
+                $texto = !empty($prod->getElementsByTagName("NCM")->item(0)->nodeValue) ?
2911 2911
                         $prod->getElementsByTagName("NCM")->item(0)->nodeValue : '';
2912 2912
                 $this->pdf->textBox($x, $y, $w3, $h, $texto, $aFont, 'T', 'C', 0, '');
2913 2913
                 $x += $w3;
2914 2914
                 //CST
2915 2915
                 if (isset($ICMS)) {
2916
-                    $origem =  $this->getTagValue($ICMS, "orig");
2917
-                    $cst =  $this->getTagValue($ICMS, "CST");
2918
-                    $csosn =  $this->getTagValue($ICMS, "CSOSN");
2919
-                    $texto = $origem.$cst.$csosn;
2916
+                    $origem = $this->getTagValue($ICMS, "orig");
2917
+                    $cst = $this->getTagValue($ICMS, "CST");
2918
+                    $csosn = $this->getTagValue($ICMS, "CSOSN");
2919
+                    $texto = $origem . $cst . $csosn;
2920 2920
                     $this->pdf->textBox($x, $y, $w4, $h, $texto, $aFont, 'T', 'C', 0, '');
2921 2921
                 }
2922 2922
                 //CFOP
@@ -2954,7 +2954,7 @@  discard block
 block discarded – undo
2954 2954
                 //Valor da Base de calculo
2955 2955
                 $x += $w10;
2956 2956
                 if (isset($ICMS)) {
2957
-                    $texto = ! empty($ICMS->getElementsByTagName("vBC")->item(0)->nodeValue)
2957
+                    $texto = !empty($ICMS->getElementsByTagName("vBC")->item(0)->nodeValue)
2958 2958
                     ? number_format(
2959 2959
                         $ICMS->getElementsByTagName("vBC")->item(0)->nodeValue,
2960 2960
                         2,
@@ -2967,7 +2967,7 @@  discard block
 block discarded – undo
2967 2967
                 //Valor do ICMS
2968 2968
                 $x += $w11;
2969 2969
                 if (isset($ICMS)) {
2970
-                    $texto = ! empty($ICMS->getElementsByTagName("vICMS")->item(0)->nodeValue)
2970
+                    $texto = !empty($ICMS->getElementsByTagName("vICMS")->item(0)->nodeValue)
2971 2971
                     ? number_format(
2972 2972
                         $ICMS->getElementsByTagName("vICMS")->item(0)->nodeValue,
2973 2973
                         2,
@@ -2980,7 +2980,7 @@  discard block
 block discarded – undo
2980 2980
                 //Valor do IPI
2981 2981
                 $x += $w12;
2982 2982
                 if (isset($IPI)) {
2983
-                    $texto = ! empty($IPI->getElementsByTagName("vIPI")->item(0)->nodeValue)
2983
+                    $texto = !empty($IPI->getElementsByTagName("vIPI")->item(0)->nodeValue)
2984 2984
                     ? number_format(
2985 2985
                         $IPI->getElementsByTagName("vIPI")->item(0)->nodeValue,
2986 2986
                         2,
@@ -2995,7 +2995,7 @@  discard block
 block discarded – undo
2995 2995
                 // %ICMS
2996 2996
                 $x += $w13;
2997 2997
                 if (isset($ICMS)) {
2998
-                    $texto = ! empty($ICMS->getElementsByTagName("pICMS")->item(0)->nodeValue)
2998
+                    $texto = !empty($ICMS->getElementsByTagName("pICMS")->item(0)->nodeValue)
2999 2999
                     ? number_format(
3000 3000
                         $ICMS->getElementsByTagName("pICMS")->item(0)->nodeValue,
3001 3001
                         2,
@@ -3008,7 +3008,7 @@  discard block
 block discarded – undo
3008 3008
                 //%IPI
3009 3009
                 $x += $w14;
3010 3010
                 if (isset($IPI)) {
3011
-                    $texto = ! empty($IPI->getElementsByTagName("pIPI")->item(0)->nodeValue)
3011
+                    $texto = !empty($IPI->getElementsByTagName("pIPI")->item(0)->nodeValue)
3012 3012
                     ? number_format(
3013 3013
                         $IPI->getElementsByTagName("pIPI")->item(0)->nodeValue,
3014 3014
                         2,
@@ -3039,7 +3039,7 @@  discard block
 block discarded – undo
3039 3039
                 $i++;
3040 3040
             }
3041 3041
         }
3042
-        return $oldY+$hmax;
3042
+        return $oldY + $hmax;
3043 3043
     }
3044 3044
 
3045 3045
 
@@ -3073,7 +3073,7 @@  discard block
 block discarded – undo
3073 3073
 
3074 3074
         $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>''];
3075 3075
 
3076
-        $w1 = round($w*0.09, 0);
3076
+        $w1 = round($w * 0.09, 0);
3077 3077
 
3078 3078
         // Tabela Renavam Combustivel
3079 3079
         $renavamCombustivel = [
@@ -3168,54 +3168,54 @@  discard block
 block discarded – undo
3168 3168
 
3169 3169
         $yVeic = $y + $h;
3170 3170
         $texto = 'Chassi: ............: ' . $veiculoChassi;
3171
-        $this->pdf->textBox($x, $yVeic, $w1+40, $h, $texto, $aFont, 'T', 'L', 0, '');
3171
+        $this->pdf->textBox($x, $yVeic, $w1 + 40, $h, $texto, $aFont, 'T', 'L', 0, '');
3172 3172
         $yVeic += $h;
3173 3173
         $texto = 'Cor...................: ' . $veiculoCor;
3174
-        $this->pdf->textBox($x, $yVeic, $w1+40, $h, $texto, $aFont, 'T', 'L', 0, '');
3174
+        $this->pdf->textBox($x, $yVeic, $w1 + 40, $h, $texto, $aFont, 'T', 'L', 0, '');
3175 3175
         $yVeic += $h;
3176 3176
         $texto = 'Cilindrada........: ' . $veiculoCilindrada;
3177
-        $this->pdf->textBox($x, $yVeic, $w1+40, $h, $texto, $aFont, 'T', 'L', 0, '');
3177
+        $this->pdf->textBox($x, $yVeic, $w1 + 40, $h, $texto, $aFont, 'T', 'L', 0, '');
3178 3178
         $yVeic += $h;
3179 3179
         $texto = 'Cmkg...............: ' . $veiculoCmkg;
3180
-        $this->pdf->textBox($x, $yVeic, $w1+40, $h, $texto, $aFont, 'T', 'L', 0, '');
3180
+        $this->pdf->textBox($x, $yVeic, $w1 + 40, $h, $texto, $aFont, 'T', 'L', 0, '');
3181 3181
         $yVeic += $h;
3182 3182
         $texto = 'Tipo.................: ' . ($renavamTiposVeiculos[intval($veiculoTipo)] ?? $veiculoTipo);
3183
-         $this->pdf->textBox($x, $yVeic, $w1+40, $h, $texto, $aFont, 'T', 'L', 0, '');
3183
+         $this->pdf->textBox($x, $yVeic, $w1 + 40, $h, $texto, $aFont, 'T', 'L', 0, '');
3184 3184
         $yVeic = $y + $h;
3185 3185
         $xVeic = $x + 65;
3186 3186
         $texto = 'Nº Motor: .........: ' . $veiculoMotor;
3187
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
3187
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
3188 3188
         $yVeic += $h;
3189 3189
         $texto = 'Renavam...........: ' . $veiculoRenavam;
3190
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
3190
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
3191 3191
         $yVeic += $h;
3192 3192
         $texto = 'HP.....................: ' . $veiculoHp;
3193
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
3193
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
3194 3194
         $yVeic += $h;
3195 3195
         $texto = 'Placa.................: ' . $veiculoPlaca;
3196
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
3196
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
3197 3197
         $yVeic += $h;
3198 3198
         $texto = 'Tipo Pintura......: ' . ($renavamEspecie[intval($veiculoTipoPintura)] ?? $veiculoTipoPintura);
3199
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
3199
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
3200 3200
         $yVeic = $y + $h;
3201 3201
         $xVeic = $xVeic + 55;
3202 3202
         $texto = 'Marca / Modelo.....: ' . $veiculoMarcaModelo;
3203
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
3203
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
3204 3204
         $yVeic += $h;
3205 3205
         $texto = 'Especie..................: ' . ($renavamEspecie[intval($veiculoEspecie)] ?? $veiculoEspecie);
3206
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
3206
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
3207 3207
         $yVeic += $h;
3208 3208
         $texto = 'Combustivel..........: ' . ($renavamCombustivel[intval($veiculoCombustivel)] ?? $veiculoCombustivel);
3209
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
3209
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
3210 3210
         $yVeic += $h;
3211 3211
         $texto = 'Serial.....................: ' . $veiculoSerial;
3212
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
3212
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
3213 3213
         $yVeic += $h;
3214
-        $texto = 'Ano Fab/Mod........: '. $veiculoFabricacao . '/' . $veiculoModelo;
3215
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
3214
+        $texto = 'Ano Fab/Mod........: ' . $veiculoFabricacao . '/' . $veiculoModelo;
3215
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
3216 3216
         $yVeic += $h;
3217
-        $texto = 'Distancia Entre Eixos(mm)..: '. $veiculoDistancia;
3218
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
3217
+        $texto = 'Distancia Entre Eixos(mm)..: ' . $veiculoDistancia;
3218
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
3219 3219
     }
3220 3220
 
3221 3221
     /**
@@ -3239,12 +3239,12 @@  discard block
 block discarded – undo
3239 3239
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
3240 3240
         //INSCRIÇÃO MUNICIPAL
3241 3241
         $y += 3;
3242
-        $w = round($this->wPrint*0.23, 0);
3242
+        $w = round($this->wPrint * 0.23, 0);
3243 3243
         $texto = 'INSCRIÇÃO MUNICIPAL';
3244 3244
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
3245 3245
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
3246 3246
         //inscrição municipal
3247
-        $texto = ! empty($this->emit->getElementsByTagName("IM")->item(0)->nodeValue) ?
3247
+        $texto = !empty($this->emit->getElementsByTagName("IM")->item(0)->nodeValue) ?
3248 3248
                 $this->emit->getElementsByTagName("IM")->item(0)->nodeValue : '';
3249 3249
         $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'];
3250 3250
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 0, '');
@@ -3254,7 +3254,7 @@  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("vServ")->item(0)->nodeValue) ?
3257
+            $texto = !empty($this->ISSQNtot->getElementsByTagName("vServ")->item(0)->nodeValue) ?
3258 3258
                     $this->ISSQNtot->getElementsByTagName("vServ")->item(0)->nodeValue : '';
3259 3259
             $texto = number_format($texto, 2, ",", ".");
3260 3260
         } else {
@@ -3268,9 +3268,9 @@  discard block
 block discarded – undo
3268 3268
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
3269 3269
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
3270 3270
         if (isset($this->ISSQNtot)) {
3271
-            $texto = ! empty($this->ISSQNtot->getElementsByTagName("vBC")->item(0)->nodeValue) ?
3271
+            $texto = !empty($this->ISSQNtot->getElementsByTagName("vBC")->item(0)->nodeValue) ?
3272 3272
                     $this->ISSQNtot->getElementsByTagName("vBC")->item(0)->nodeValue : '';
3273
-            $texto = ! empty($texto) ? number_format($texto, 2, ",", ".") : '';
3273
+            $texto = !empty($texto) ? number_format($texto, 2, ",", ".") : '';
3274 3274
         } else {
3275 3275
             $texto = '';
3276 3276
         }
@@ -3281,21 +3281,21 @@  discard block
 block discarded – undo
3281 3281
         if ($this->orientacao == 'P') {
3282 3282
             $w = $this->wPrint - (3 * $w);
3283 3283
         } else {
3284
-            $w = $this->wPrint - (3 * $w)-$this->wCanhoto;
3284
+            $w = $this->wPrint - (3 * $w) - $this->wCanhoto;
3285 3285
         }
3286 3286
         $texto = 'VALOR TOTAL DO ISSQN';
3287 3287
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
3288 3288
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
3289 3289
         if (isset($this->ISSQNtot)) {
3290
-            $texto = ! empty($this->ISSQNtot->getElementsByTagName("vISS")->item(0)->nodeValue) ?
3290
+            $texto = !empty($this->ISSQNtot->getElementsByTagName("vISS")->item(0)->nodeValue) ?
3291 3291
                     $this->ISSQNtot->getElementsByTagName("vISS")->item(0)->nodeValue : '';
3292
-            $texto = ! empty($texto) ? number_format($texto, 2, ",", ".") : '';
3292
+            $texto = !empty($texto) ? number_format($texto, 2, ",", ".") : '';
3293 3293
         } else {
3294 3294
             $texto = '';
3295 3295
         }
3296 3296
         $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'];
3297 3297
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'R', 0, '');
3298
-        return ($y+$h+1);
3298
+        return ($y + $h + 1);
3299 3299
     }
3300 3300
 
3301 3301
     /**
@@ -3316,7 +3316,7 @@  discard block
 block discarded – undo
3316 3316
         if ($this->orientacao == 'P') {
3317 3317
               $w = $this->wPrint;
3318 3318
         } else {
3319
-              $w = $this->wPrint-$this->wCanhoto;
3319
+              $w = $this->wPrint - $this->wCanhoto;
3320 3320
         }
3321 3321
         $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
3322 3322
         $this->pdf->textBox($x, $y, $w, 8, $texto, $aFont, 'T', 'L', 0, '');
@@ -3331,8 +3331,8 @@  discard block
 block discarded – undo
3331 3331
         //$this->wAdic com a largura do campo
3332 3332
         //$this->textoAdic com o texto completo do campo
3333 3333
         $y += 1;
3334
-        $aFont = ['font'=>$this->fontePadrao, 'size'=>$this->textadicfontsize*$this->pdf->k, 'style'=>''];
3335
-        $this->pdf->textBox($x, $y+2, $w-2, $h-3, $this->textoAdic, $aFont, 'T', 'L', 0, '', false);
3334
+        $aFont = ['font'=>$this->fontePadrao, 'size'=>$this->textadicfontsize * $this->pdf->k, 'style'=>''];
3335
+        $this->pdf->textBox($x, $y + 2, $w - 2, $h - 3, $this->textoAdic, $aFont, 'T', 'L', 0, '', false);
3336 3336
         //RESERVADO AO FISCO
3337 3337
         $texto = "RESERVADO AO FISCO";
3338 3338
         if (isset($this->nfeProc) && $this->nfeProc->getElementsByTagName("xMsg")->length) {
@@ -3341,9 +3341,9 @@  discard block
 block discarded – undo
3341 3341
         $x += $w;
3342 3342
         $y -= 1;
3343 3343
         if ($this->orientacao == 'P') {
3344
-            $w = $this->wPrint-$w;
3344
+            $w = $this->wPrint - $w;
3345 3345
         } else {
3346
-            $w = $this->wPrint-$w-$this->wCanhoto;
3346
+            $w = $this->wPrint - $w - $this->wCanhoto;
3347 3347
         }
3348 3348
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>'B'];
3349 3349
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -3382,8 +3382,8 @@  discard block
 block discarded – undo
3382 3382
         }
3383 3383
         $y += 2;
3384 3384
         $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>''];
3385
-        $this->pdf->textBox($x, $y, $w-2, $h-3, $texto, $aFont, 'T', 'L', 0, '', false);
3386
-        return $y+$h;
3385
+        $this->pdf->textBox($x, $y, $w - 2, $h - 3, $texto, $aFont, 'T', 'L', 0, '', false);
3386
+        return $y + $h;
3387 3387
     }
3388 3388
 
3389 3389
     /**
@@ -3402,11 +3402,11 @@  discard block
 block discarded – undo
3402 3402
         if ($this->orientacao == 'P') {
3403 3403
               $w = $this->wPrint;
3404 3404
         } else {
3405
-              $w = $this->wPrint-$this->wCanhoto;
3405
+              $w = $this->wPrint - $this->wCanhoto;
3406 3406
               $x = $this->wCanhoto;
3407 3407
         }
3408 3408
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>'I'];
3409
-        $texto = "Impresso em ". date('d/m/Y') . " as " . date('H:i:s')
3409
+        $texto = "Impresso em " . date('d/m/Y') . " as " . date('H:i:s')
3410 3410
             . '  ' . $this->creditos;
3411 3411
         $this->pdf->textBox($x, $y, $w, 0, $texto, $aFont, 'T', 'L', false);
3412 3412
         $texto = "Powered by NFePHP®";
@@ -3462,9 +3462,9 @@  discard block
 block discarded – undo
3462 3462
         } else {
3463 3463
             //linha separadora do canhoto - 238
3464 3464
             //posicao altura
3465
-            $y = $this->wPrint-85;
3465
+            $y = $this->wPrint - 85;
3466 3466
             //altura
3467
-            $w = $this->wPrint-85-24;
3467
+            $w = $this->wPrint - 85 - 24;
3468 3468
         }
3469 3469
         $h = 10;
3470 3470
         //desenha caixa
@@ -3487,21 +3487,21 @@  discard block
 block discarded – undo
3487 3487
             $texto .= "AO LADO";
3488 3488
         }
3489 3489
         $texto .= ". EMISSÃO: ";
3490
-        $dEmi = ! empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
3490
+        $dEmi = !empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
3491 3491
                 $this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue : '';
3492 3492
         if ($dEmi == '') {
3493
-            $dEmi = ! empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
3493
+            $dEmi = !empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
3494 3494
                     $this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue : '';
3495 3495
             $aDemi = explode('T', $dEmi);
3496 3496
             $dEmi = $aDemi[0];
3497 3497
         }
3498
-        $texto .= $this->ymdTodmy($dEmi) ." ";
3498
+        $texto .= $this->ymdTodmy($dEmi) . " ";
3499 3499
         $texto .= "VALOR TOTAL: R$ ";
3500 3500
         $texto .= number_format($this->ICMSTot->getElementsByTagName("vNF")->item(0)->nodeValue, 2, ",", ".") . " ";
3501 3501
         $texto .= "DESTINATÁRIO: ";
3502 3502
         $texto .= $destinatario;
3503 3503
         if ($this->orientacao == 'P') {
3504
-            $this->pdf->textBox($x, $y, $w-1, $h, $texto, $aFont, 'C', 'L', 0, '', false);
3504
+            $this->pdf->textBox($x, $y, $w - 1, $h, $texto, $aFont, 'C', 'L', 0, '', false);
3505 3505
             $x1 = $x + $w;
3506 3506
             $w1 = $this->wPrint - $w;
3507 3507
             $texto = "NF-e";
@@ -3514,12 +3514,12 @@  discard block
 block discarded – undo
3514 3514
             //DATA DE RECEBIMENTO
3515 3515
             $texto = "DATA DE RECEBIMENTO";
3516 3516
             $y += $h;
3517
-            $w2 = round($this->wPrint*0.17, 0); //35;
3517
+            $w2 = round($this->wPrint * 0.17, 0); //35;
3518 3518
             $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
3519 3519
             $this->pdf->textBox($x, $y, $w2, 8, $texto, $aFont, 'T', 'L', 1, '');
3520 3520
             //IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR
3521 3521
             $x += $w2;
3522
-            $w3 = $w-$w2;
3522
+            $w3 = $w - $w2;
3523 3523
             $texto = "IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR";
3524 3524
             $this->pdf->textBox($x, $y, $w3, 8, $texto, $aFont, 'T', 'L', 1, '');
3525 3525
             $x = $oldX;
@@ -3529,7 +3529,7 @@  discard block
 block discarded – undo
3529 3529
             return $y;
3530 3530
         } else {
3531 3531
             $x--;
3532
-            $x = $this->pdf->textBox90($x, $y, $w-1, $h, $texto, $aFontSmall, 'C', 'L', 0, '', false);
3532
+            $x = $this->pdf->textBox90($x, $y, $w - 1, $h, $texto, $aFontSmall, 'C', 'L', 0, '', false);
3533 3533
             //NUMERO DA NOTA FISCAL LOGO NFE
3534 3534
             $w1 = 18;
3535 3535
             $x1 = $oldX;
@@ -3543,14 +3543,14 @@  discard block
 block discarded – undo
3543 3543
             $this->pdf->textBox($x1, $y, $w1, 18, $texto, $aFont, 'C', 'C', 1, '');
3544 3544
             //DATA DO RECEBIMENTO
3545 3545
             $texto = "DATA DO RECEBIMENTO";
3546
-            $y = $this->wPrint-85;
3546
+            $y = $this->wPrint - 85;
3547 3547
             $x = 12;
3548
-            $w2 = round($this->wPrint*0.17, 0); //35;
3548
+            $w2 = round($this->wPrint * 0.17, 0); //35;
3549 3549
             $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
3550 3550
             $this->pdf->textBox90($x, $y, $w2, 8, $texto, $aFont, 'T', 'L', 1, '');
3551 3551
             //IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR
3552 3552
             $y -= $w2;
3553
-            $w3 = $w-$w2;
3553
+            $w3 = $w - $w2;
3554 3554
             $texto = "IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR";
3555 3555
             $aFont = ['font'=>$this->fontePadrao, 'size'=>5.7, 'style'=>''];
3556 3556
             $x = $this->pdf->textBox90($x, $y, $w3, 8, $texto, $aFont, 'T', 'L', 1, '');
@@ -3571,13 +3571,13 @@  discard block
 block discarded – undo
3571 3571
     {
3572 3572
         $saida = "";
3573 3573
         if (isset($this->compra)) {
3574
-            if (! empty($this->compra->getElementsByTagName("xNEmp")->item(0)->nodeValue)) {
3574
+            if (!empty($this->compra->getElementsByTagName("xNEmp")->item(0)->nodeValue)) {
3575 3575
                 $saida .= " Nota de Empenho: " . $this->compra->getElementsByTagName("xNEmp")->item(0)->nodeValue;
3576 3576
             }
3577
-            if (! empty($this->compra->getElementsByTagName("xPed")->item(0)->nodeValue)) {
3577
+            if (!empty($this->compra->getElementsByTagName("xPed")->item(0)->nodeValue)) {
3578 3578
                 $saida .= " Pedido: " . $this->compra->getElementsByTagName("xPed")->item(0)->nodeValue;
3579 3579
             }
3580
-            if (! empty($this->compra->getElementsByTagName("xCont")->item(0)->nodeValue)) {
3580
+            if (!empty($this->compra->getElementsByTagName("xCont")->item(0)->nodeValue)) {
3581 3581
                 $saida .= " Contrato: " . $this->compra->getElementsByTagName("xCont")->item(0)->nodeValue;
3582 3582
             }
3583 3583
         }
@@ -3603,21 +3603,21 @@  discard block
 block discarded – undo
3603 3603
         if ($vICMS > 0) {
3604 3604
             $vICMS = 1;
3605 3605
         }
3606
-        $icmss  = $this->ICMSTot->getElementsByTagName("vBC")->item(0)->nodeValue;
3606
+        $icmss = $this->ICMSTot->getElementsByTagName("vBC")->item(0)->nodeValue;
3607 3607
         if ($icmss > 0) {
3608 3608
             $icmss = 1;
3609 3609
         }
3610
-        $dEmi = ! empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
3610
+        $dEmi = !empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
3611 3611
                 $this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue : '';
3612 3612
         if ($dEmi == '') {
3613
-            $dEmi = ! empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
3613
+            $dEmi = !empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
3614 3614
                     $this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue : '';
3615 3615
             $aDemi = explode('T', $dEmi);
3616 3616
             $dEmi = $aDemi[0];
3617 3617
         }
3618 3618
         $dd  = $dEmi;
3619 3619
         $rpos = strrpos($dd, '-');
3620
-        $dd  = substr($dd, $rpos +1);
3620
+        $dd  = substr($dd, $rpos + 1);
3621 3621
         $chave = sprintf($forma, $cUF, $this->tpEmis, $CNPJ, $vNF, $vICMS, $icmss, $dd);
3622 3622
         $chave = $chave . $this->modulo11($chave);
3623 3623
         return $chave;
@@ -3638,7 +3638,7 @@  discard block
 block discarded – undo
3638 3638
         $formaNfRef = "\r\nNF  Ref.: série:%d numero:%d emit:%s em %s modelo: %d";
3639 3639
         $formaECFRef = "\r\nECF Ref.: modelo: %s ECF:%d COO:%d";
3640 3640
         $formaNfpRef = "\r\nNFP Ref.: série:%d número:%d emit:%s em %s modelo: %d IE:%s";
3641
-        $saida='';
3641
+        $saida = '';
3642 3642
         $nfRefs = $this->ide->getElementsByTagName('NFref');
3643 3643
         if (0 === $nfRefs->length) {
3644 3644
             return $saida;
@@ -3654,7 +3654,7 @@  discard block
 block discarded – undo
3654 3654
             foreach ($refNFe as $chave_acessoRef) {
3655 3655
                 $chave_acesso = $chave_acessoRef->nodeValue;
3656 3656
                 $chave_acessoF = $this->formatField($chave_acesso, $this->formatoChave);
3657
-                $data = substr($chave_acesso, 4, 2)."/20".substr($chave_acesso, 2, 2);
3657
+                $data = substr($chave_acesso, 4, 2) . "/20" . substr($chave_acesso, 2, 2);
3658 3658
                 $cnpj = $this->formatField(substr($chave_acesso, 6, 14), "##.###.###/####-##");
3659 3659
                 $serie  = substr($chave_acesso, 22, 3);
3660 3660
                 $numero = substr($chave_acesso, 25, 9);
@@ -3675,7 +3675,7 @@  discard block
 block discarded – undo
3675 3675
             foreach ($refCTe as $chave_acessoRef) {
3676 3676
                 $chave_acesso = $chave_acessoRef->nodeValue;
3677 3677
                 $chave_acessoF = $this->formatField($chave_acesso, $this->formatoChave);
3678
-                $data = substr($chave_acesso, 4, 2)."/20".substr($chave_acesso, 2, 2);
3678
+                $data = substr($chave_acesso, 4, 2) . "/20" . substr($chave_acesso, 2, 2);
3679 3679
                 $cnpj = $this->formatField(substr($chave_acesso, 6, 14), "##.###.###/####-##");
3680 3680
                 $serie  = substr($chave_acesso, 22, 3);
3681 3681
                 $numero = substr($chave_acesso, 25, 9);
@@ -3691,10 +3691,9 @@  discard block
 block discarded – undo
3691 3691
             $refNFP = $nfRef->getElementsByTagName('refNFP');
3692 3692
             foreach ($refNFP as $umaRefNFe) {
3693 3693
                 $data = $umaRefNFe->getElementsByTagName('AAMM')->item(0)->nodeValue;
3694
-                $cnpj = ! empty($umaRefNFe->getElementsByTagName('CNPJ')->item(0)->nodeValue) ?
3695
-                    $umaRefNFe->getElementsByTagName('CNPJ')->item(0)->nodeValue :
3696
-                    '';
3697
-                $cpf = ! empty($umaRefNFe->getElementsByTagName('CPF')->item(0)->nodeValue) ?
3694
+                $cnpj = !empty($umaRefNFe->getElementsByTagName('CNPJ')->item(0)->nodeValue) ?
3695
+                    $umaRefNFe->getElementsByTagName('CNPJ')->item(0)->nodeValue : '';
3696
+                $cpf = !empty($umaRefNFe->getElementsByTagName('CPF')->item(0)->nodeValue) ?
3698 3697
                         $umaRefNFe->getElementsByTagName('CPF')->item(0)->nodeValue : '';
3699 3698
                 $mod = $umaRefNFe->getElementsByTagName('mod')->item(0)->nodeValue;
3700 3699
                 $serie = $umaRefNFe->getElementsByTagName('serie')->item(0)->nodeValue;
@@ -3759,6 +3758,6 @@  discard block
 block discarded – undo
3759 3758
         imagedestroy($image);
3760 3759
         $stringdata = ob_get_contents(); // read from buffer
3761 3760
         ob_end_clean();
3762
-        return 'data://text/plain;base64,'.base64_encode($stringdata);
3761
+        return 'data://text/plain;base64,' . base64_encode($stringdata);
3763 3762
     }
3764 3763
 }
Please login to merge, or discard this patch.