Completed
Push — master ( 01c3fa...6aa518 )
by Roberto
07:48 queued 05:15
created
src/NFe/Danfce.php 1 patch
Spacing   +78 added lines, -78 removed lines patch added patch discarded remove patch
@@ -27,11 +27,11 @@  discard block
 block discarded – undo
27 27
     protected $paperwidth = 80;
28 28
     protected $creditos;
29 29
     protected $xml; // string XML NFe
30
-    protected $logomarca=''; // path para logomarca em jpg
31
-    protected $formatoChave="#### #### #### #### #### #### #### #### #### #### ####";
32
-    protected $debugMode=0; //ativa ou desativa o modo de debug
30
+    protected $logomarca = ''; // path para logomarca em jpg
31
+    protected $formatoChave = "#### #### #### #### #### #### #### #### #### #### ####";
32
+    protected $debugMode = 0; //ativa ou desativa o modo de debug
33 33
     protected $tpImp; //ambiente
34
-    protected $fontePadrao='Times';
34
+    protected $fontePadrao = 'Times';
35 35
     protected $nfeProc;
36 36
     protected $nfe;
37 37
     protected $infNFe;
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
         $this->textoAdic = '';
201 201
         if (isset($this->infAdic)) {
202 202
             $this->textoAdic .= !empty($this->infAdic->getElementsByTagName('infCpl')->item(0)->nodeValue) ?
203
-            'Inf. Contribuinte: '.
203
+            'Inf. Contribuinte: ' .
204 204
             trim($this->anfaveaDANFE($this->infAdic->getElementsByTagName('infCpl')->item(0)->nodeValue)) : '';
205 205
             if (!empty($this->textoAdic)) {
206 206
                 $this->textoAdic = str_replace(";", "\n", $this->textoAdic);
@@ -241,10 +241,10 @@  discard block
 block discarded – undo
241 241
         //total inicial de paginas
242 242
         $totPag = 1;
243 243
         //largura imprimivel em mm: largura da folha menos as margens esq/direita
244
-        $this->wPrint = $maxW-($margEsq*2);
244
+        $this->wPrint = $maxW - ($margEsq * 2);
245 245
         //comprimento (altura) imprimivel em mm: altura da folha menos as margens
246 246
         //superior e inferior
247
-        $this->hPrint = $maxH-$margSup-$margInf;
247
+        $this->hPrint = $maxH - $margSup - $margInf;
248 248
         // estabelece contagem de paginas
249 249
         $this->pdf->aliasNbPages();
250 250
         $this->pdf->setMargins($margEsq, $margSup); // fixa as margens
@@ -255,11 +255,11 @@  discard block
 block discarded – undo
255 255
         $this->pdf->setLineWidth(0.1); // define a largura da linha
256 256
         $this->pdf->setTextColor(0, 0, 0);
257 257
         $this->pdf->textBox(0, 0, $maxW, $maxH); // POR QUE PRECISO DESA LINHA?
258
-        $hcabecalho = 27;//para cabeçalho (dados emitente mais logomarca)  (FIXO)
259
-        $hcabecalhoSecundario = 10 + 3;//para cabeçalho secundário (cabeçalho sefaz) (FIXO)
260
-        $hprodutos = $hLinha + ($qtdItens * $hMaxLinha) ;//box poduto
258
+        $hcabecalho = 27; //para cabeçalho (dados emitente mais logomarca)  (FIXO)
259
+        $hcabecalhoSecundario = 10 + 3; //para cabeçalho secundário (cabeçalho sefaz) (FIXO)
260
+        $hprodutos = $hLinha + ($qtdItens * $hMaxLinha); //box poduto
261 261
         $hTotal = 12; //box total (FIXO)
262
-        $hpagamentos = $hLinha + ($qtdPgto * $hLinha) + 3;//para pagamentos
262
+        $hpagamentos = $hLinha + ($qtdPgto * $hLinha) + 3; //para pagamentos
263 263
         if (!empty($this->vTroco)) {
264 264
             $hpagamentos += $hLinha;
265 265
         }
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
         $y = $xInic + $hcabecalho + $hcabecalhoSecundario + $hprodutos + $hTotal;
293 293
         $y = $this->pagamentosDANFE($x, $y, $hpagamentos);
294 294
         //COLOCA MENSAGEM FISCAL
295
-        $y = $xInic + $hcabecalho + $hcabecalhoSecundario + $hprodutos + $hTotal+ $hpagamentos;
295
+        $y = $xInic + $hcabecalho + $hcabecalhoSecundario + $hprodutos + $hTotal + $hpagamentos;
296 296
         $y = $this->fiscalDANFE($x, $y, $hmsgfiscal);
297 297
         //COLOCA CONSUMIDOR
298 298
         $y = $xInic + $hcabecalho + $hcabecalhoSecundario + $hprodutos + $hTotal + $hpagamentos + $hmsgfiscal;
@@ -320,14 +320,14 @@  discard block
 block discarded – undo
320 320
         $emitIM     = $this->getTagValue($this->emit, "IM");
321 321
         $emitFone = $this->getTagValue($this->enderEmit, "fone");
322 322
         $foneLen = strlen($emitFone);
323
-        if ($foneLen>0) {
323
+        if ($foneLen > 0) {
324 324
             $ddd = substr($emitFone, 0, 2);
325 325
             $fone1 = substr($emitFone, -8);
326 326
             $digito9 = ' ';
327 327
             if ($foneLen == 11) {
328 328
                 $digito9 = substr($emitFone, 2, 1);
329 329
             }
330
-            $emitFone = ' - ('.$ddd.') '.$digito9. ' ' . substr($fone1, 0, 4) . '-' . substr($fone1, -4);
330
+            $emitFone = ' - (' . $ddd . ') ' . $digito9 . ' ' . substr($fone1, 0, 4) . '-' . substr($fone1, -4);
331 331
         } else {
332 332
             $emitFone = '';
333 333
         }
@@ -341,18 +341,18 @@  discard block
 block discarded – undo
341 341
         // CONFIGURAÇÃO DE POSIÇÃO
342 342
         $margemInterna = $this->margemInterna;
343 343
         $maxW = $this->wPrint;
344
-        $h = $h-($margemInterna);
344
+        $h = $h - ($margemInterna);
345 345
         //COLOCA LOGOMARCA
346 346
         if (is_file($this->logomarca)) {
347 347
             $xImg = $margemInterna;
348 348
             $yImg = $margemInterna + 1;
349 349
             $this->pdf->image($this->logomarca, $xImg, $yImg, 30, 22.5);
350
-            $xRs = ($maxW*0.4) + $margemInterna;
351
-            $wRs = ($maxW*0.6);
350
+            $xRs = ($maxW * 0.4) + $margemInterna;
351
+            $wRs = ($maxW * 0.6);
352 352
             $alignEmit = 'L';
353 353
         } else {
354 354
             $xRs = $margemInterna;
355
-            $wRs = ($maxW*1);
355
+            $wRs = ($maxW * 1);
356 356
             $alignEmit = 'L';
357 357
         }
358 358
         //COLOCA RAZÃO SOCIAL
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
     {
373 373
         $margemInterna = $this->margemInterna;
374 374
         $maxW = $this->wPrint;
375
-        $w = ($maxW*1);
375
+        $w = ($maxW * 1);
376 376
         $hBox1 = 7;
377 377
         $texto = "DANFE NFC-e\nDocumento Auxiliar da Nota Fiscal de Consumidor Eletrônica";
378 378
         $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B');
@@ -389,13 +389,13 @@  discard block
 block discarded – undo
389 389
         $margemInterna = $this->margemInterna;
390 390
         $maxW = $this->wPrint;
391 391
         $qtdItens = $this->det->length;
392
-        $w = ($maxW*1);
392
+        $w = ($maxW * 1);
393 393
         $hLinha = $this->hLinha;
394 394
         $aFontCabProdutos = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
395
-        $wBoxCod = $w*0.17;
395
+        $wBoxCod = $w * 0.17;
396 396
         $texto = "CÓDIGO";
397 397
         $this->pdf->textBox($x, $y, $wBoxCod, $hLinha, $texto, $aFontCabProdutos, 'T', 'L', 0, '', false);
398
-        $wBoxDescricao = $w*0.43;
398
+        $wBoxDescricao = $w * 0.43;
399 399
         $xBoxDescricao = $wBoxCod + $x;
400 400
         $texto = "DESCRICÃO";
401 401
         $this->pdf->textBox(
@@ -411,19 +411,19 @@  discard block
 block discarded – undo
411 411
             '',
412 412
             false
413 413
         );
414
-        $wBoxQt = $w*0.08;
414
+        $wBoxQt = $w * 0.08;
415 415
         $xBoxQt = $wBoxDescricao + $xBoxDescricao;
416 416
         $texto = "QT";
417 417
         $this->pdf->textBox($xBoxQt, $y, $wBoxQt, $hLinha, $texto, $aFontCabProdutos, 'T', 'L', 0, '', false);
418
-        $wBoxUn = $w*0.06;
418
+        $wBoxUn = $w * 0.06;
419 419
         $xBoxUn = $wBoxQt + $xBoxQt;
420 420
         $texto = "UN";
421 421
         $this->pdf->textBox($xBoxUn, $y, $wBoxUn, $hLinha, $texto, $aFontCabProdutos, 'T', 'L', 0, '', false);
422
-        $wBoxVl = $w*0.13;
422
+        $wBoxVl = $w * 0.13;
423 423
         $xBoxVl = $wBoxUn + $xBoxUn;
424 424
         $texto = "VALOR";
425 425
         $this->pdf->textBox($xBoxVl, $y, $wBoxVl, $hLinha, $texto, $aFontCabProdutos, 'T', 'L', 0, '', false);
426
-        $wBoxTotal = $w*0.13;
426
+        $wBoxTotal = $w * 0.13;
427 427
         $xBoxTotal = $wBoxVl + $xBoxVl;
428 428
         $texto = "TOTAL";
429 429
         $this->pdf->textBox($xBoxTotal, $y, $wBoxTotal, $hLinha, $texto, $aFontCabProdutos, 'T', 'L', 0, '', false);
@@ -443,9 +443,9 @@  discard block
 block discarded – undo
443 443
                 $vUnCom     = number_format($this->getTagValue($prod, "vUnCom"), 2, ",", ".");
444 444
                 $vProd      = number_format($this->getTagValue($prod, "vProd"), 2, ",", ".");
445 445
                 //COLOCA PRODUTO
446
-                $yBoxProd = $y + $hLinha + ($cont*$hMaxLinha);
446
+                $yBoxProd = $y + $hLinha + ($cont * $hMaxLinha);
447 447
                 //COLOCA PRODUTO CÓDIGO
448
-                $wBoxCod = $w*0.17;
448
+                $wBoxCod = $w * 0.17;
449 449
                 $texto = $cProd;
450 450
                 $this->pdf->textBox(
451 451
                     $x,
@@ -461,7 +461,7 @@  discard block
 block discarded – undo
461 461
                     false
462 462
                 );
463 463
                 //COLOCA PRODUTO DESCRIÇÃO
464
-                $wBoxDescricao = $w*0.43;
464
+                $wBoxDescricao = $w * 0.43;
465 465
                 $xBoxDescricao = $wBoxCod + $x;
466 466
                 $texto = $xProd;
467 467
                 $this->pdf->textBox(
@@ -478,7 +478,7 @@  discard block
 block discarded – undo
478 478
                     false
479 479
                 );
480 480
                 //COLOCA PRODUTO QUANTIDADE
481
-                $wBoxQt = $w*0.08;
481
+                $wBoxQt = $w * 0.08;
482 482
                 $xBoxQt = $wBoxDescricao + $xBoxDescricao;
483 483
                 $texto = $qCom;
484 484
                 $this->pdf->textBox(
@@ -495,7 +495,7 @@  discard block
 block discarded – undo
495 495
                     false
496 496
                 );
497 497
                 //COLOCA PRODUTO UNIDADE
498
-                $wBoxUn = $w*0.06;
498
+                $wBoxUn = $w * 0.06;
499 499
                 $xBoxUn = $wBoxQt + $xBoxQt;
500 500
                 $texto = $uCom;
501 501
                 $this->pdf->textBox(
@@ -512,7 +512,7 @@  discard block
 block discarded – undo
512 512
                     false
513 513
                 );
514 514
                 //COLOCA PRODUTO VL UNITÁRIO
515
-                $wBoxVl = $w*0.13;
515
+                $wBoxVl = $w * 0.13;
516 516
                 $xBoxVl = $wBoxUn + $xBoxUn;
517 517
                 $texto = $vUnCom;
518 518
                 $this->pdf->textBox(
@@ -529,7 +529,7 @@  discard block
 block discarded – undo
529 529
                     false
530 530
                 );
531 531
                 //COLOCA PRODUTO VL TOTAL
532
-                $wBoxTotal = $w*0.13;
532
+                $wBoxTotal = $w * 0.13;
533 533
                 $xBoxTotal = $wBoxVl + $xBoxVl;
534 534
                 $texto = $vProd;
535 535
                 $this->pdf->textBox(
@@ -556,8 +556,8 @@  discard block
 block discarded – undo
556 556
         $margemInterna = $this->margemInterna;
557 557
         $maxW = $this->wPrint;
558 558
         $hLinha = 3;
559
-        $wColEsq = ($maxW*0.7);
560
-        $wColDir = ($maxW*0.3);
559
+        $wColEsq = ($maxW * 0.7);
560
+        $wColDir = ($maxW * 0.3);
561 561
         $xValor = $x + $wColEsq;
562 562
         $qtdItens = $this->det->length;
563 563
         $vProd = $this->getTagValue($this->ICMSTot, "vProd");
@@ -578,28 +578,28 @@  discard block
 block discarded – undo
578 578
         $texto = "R$ " . number_format($vProd, 2, ",", ".");
579 579
         $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
580 580
         $this->pdf->textBox($xValor, $yTotal, $wColDir, $hLinha, $texto, $aFont, 'T', 'R', 0, '', false);
581
-        $yDesconto = $y + ($hLinha*2);
581
+        $yDesconto = $y + ($hLinha * 2);
582 582
         $texto = "Descontos";
583 583
         $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
584 584
         $this->pdf->textBox($x, $yDesconto, $wColEsq, $hLinha, $texto, $aFont, 'T', 'L', 0, '', false);
585 585
         $texto = "R$ " . $vDesc;
586 586
         $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
587 587
         $this->pdf->textBox($xValor, $yDesconto, $wColDir, $hLinha, $texto, $aFont, 'T', 'R', 0, '', false);
588
-        $yFrete= $y + ($hLinha*3);
588
+        $yFrete = $y + ($hLinha * 3);
589 589
         $texto = "Frete";
590 590
         $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
591 591
         $this->pdf->textBox($x, $yFrete, $wColEsq, $hLinha, $texto, $aFont, 'T', 'L', 0, '', false);
592 592
         $texto = "R$ " . $vFrete;
593 593
         $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
594 594
         $this->pdf->textBox($xValor, $yFrete, $wColDir, $hLinha, $texto, $aFont, 'T', 'R', 0, '', false);
595
-        $yTotalFinal = $y + ($hLinha*4);
595
+        $yTotalFinal = $y + ($hLinha * 4);
596 596
         $texto = "Total";
597 597
         $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
598 598
         $this->pdf->textBox($x, $yTotalFinal, $wColEsq, $hLinha, $texto, $aFont, 'T', 'L', 0, '', false);
599 599
         $texto = "R$ " . $vNF;
600 600
         $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
601 601
         $this->pdf->textBox($xValor, $yTotalFinal, $wColDir, $hLinha, $texto, $aFont, 'T', 'R', 0, '', false);
602
-        $yTotalFinal = $y + ($hLinha*5);
602
+        $yTotalFinal = $y + ($hLinha * 5);
603 603
         $texto = "Informação dos Tributos Totais Incidentes";
604 604
         $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>''];
605 605
         $this->pdf->textBox($x, $yTotalFinal, $wColEsq, $hLinha, $texto, $aFont, 'T', 'L', 0, '', false);
@@ -614,16 +614,16 @@  discard block
 block discarded – undo
614 614
         $margemInterna = $this->margemInterna;
615 615
         $maxW = $this->wPrint;
616 616
         $qtdPgto = $this->pag->length;
617
-        $w = ($maxW*1);
617
+        $w = ($maxW * 1);
618 618
         $hLinha = $this->hLinha;
619
-        $wColEsq = ($maxW*0.7);
620
-        $wColDir = ($maxW*0.3);
619
+        $wColEsq = ($maxW * 0.7);
620
+        $wColDir = ($maxW * 0.3);
621 621
         $xValor = $x + $wColEsq;
622 622
         $aFontPgto = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
623
-        $wBoxEsq = $w*0.7;
623
+        $wBoxEsq = $w * 0.7;
624 624
         $texto = "FORMA DE PAGAMENTO";
625 625
         $this->pdf->textBox($x, $y, $wBoxEsq, $hLinha, $texto, $aFontPgto, 'T', 'L', 0, '', false);
626
-        $wBoxDir = $w*0.3;
626
+        $wBoxDir = $w * 0.3;
627 627
         $xBoxDescricao = $x + $wBoxEsq;
628 628
         $texto = "VALOR PAGO";
629 629
         $this->pdf->textBox($xBoxDescricao, $y, $wBoxDir, $hLinha, $texto, $aFontPgto, 'T', 'R', 0, '', false);
@@ -645,7 +645,7 @@  discard block
 block discarded – undo
645 645
                     $tBandNome = self::getCardName($tBand);
646 646
                 }
647 647
                 //COLOCA PRODUTO
648
-                $yBoxProd = $y + $hLinha + ($cont*$hLinha);
648
+                $yBoxProd = $y + $hLinha + ($cont * $hLinha);
649 649
                 //COLOCA PRODUTO CÓDIGO
650 650
                 $texto = $tPagNome;
651 651
                 $this->pdf->textBox($x, $yBoxProd, $wBoxEsq, $hLinha, $texto, $aFontPgto, 'T', 'L', 0, '', false);
@@ -669,7 +669,7 @@  discard block
 block discarded – undo
669 669
             }
670 670
             
671 671
             if (!empty($this->vTroco)) {
672
-                $yBoxProd = $y + $hLinha + ($cont*$hLinha);
672
+                $yBoxProd = $y + $hLinha + ($cont * $hLinha);
673 673
                 //COLOCA PRODUTO CÓDIGO
674 674
                 $texto = 'Troco';
675 675
                 $this->pdf->textBox($x, $yBoxProd, $wBoxEsq, $hLinha, $texto, $aFontPgto, 'T', 'L', 0, '', false);
@@ -698,7 +698,7 @@  discard block
 block discarded – undo
698 698
         $y += 6;
699 699
         $margemInterna = $this->margemInterna;
700 700
         $maxW = $this->wPrint;
701
-        $w = ($maxW*1);
701
+        $w = ($maxW * 1);
702 702
         $hLinha = $this->hLinha;
703 703
         $aFontTit = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B'];
704 704
         $aFontTex = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>''];
@@ -730,19 +730,19 @@  discard block
 block discarded – undo
730 730
         $dhEmiLocalFormat = $dhEmilocal->format('d/m/Y H:i:s');
731 731
         $texto = "ÁREA DE MENSAGEM FISCAL";
732 732
         $this->pdf->textBox($x, $y, $w, $hLinha, $texto, $aFontTit, 'C', 'C', 0, '', false);
733
-        $yTex1 = $y + ($hLinha*1);
734
-        $hTex1 = $hLinha*2;
735
-        $texto = "Número " . $nNF . " Série " . $serieNF . " " .$dhEmiLocalFormat . " - Via Consumidor";
733
+        $yTex1 = $y + ($hLinha * 1);
734
+        $hTex1 = $hLinha * 2;
735
+        $texto = "Número " . $nNF . " Série " . $serieNF . " " . $dhEmiLocalFormat . " - Via Consumidor";
736 736
         $this->pdf->textBox($x, $yTex1, $w, $hTex1, $texto, $aFontTex, 'C', 'C', 0, '', false);
737
-        $yTex2 = $y + ($hLinha*3);
738
-        $hTex2 = $hLinha*2;
737
+        $yTex2 = $y + ($hLinha * 3);
738
+        $hTex2 = $hLinha * 2;
739 739
         
740 740
         $texto = !empty($this->urlChave) ? "Consulte pela Chave de Acesso em " . $this->urlChave : '';
741 741
         $this->pdf->textBox($x, $yTex2, $w, $hTex2, $texto, $aFontTex, 'C', 'C', 0, '', false);
742 742
         $texto = "CHAVE DE ACESSO";
743
-        $yTit2 = $y + ($hLinha*5);
743
+        $yTit2 = $y + ($hLinha * 5);
744 744
         $this->pdf->textBox($x, $yTit2, $w, $hLinha, $texto, $aFontTit, 'C', 'C', 0, '', false);
745
-        $yTex3 = $y + ($hLinha*6);
745
+        $yTex3 = $y + ($hLinha * 6);
746 746
         $texto = $chNFe;
747 747
         $this->pdf->textBox($x, $yTex3, $w, $hLinha, $texto, $aFontTex, 'C', 'C', 0, '', false);
748 748
     }
@@ -752,7 +752,7 @@  discard block
 block discarded – undo
752 752
         $y += 6;
753 753
         $margemInterna = $this->margemInterna;
754 754
         $maxW = $this->wPrint;
755
-        $w = ($maxW*1);
755
+        $w = ($maxW * 1);
756 756
         $hLinha = $this->hLinha;
757 757
         $aFontTit = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B'];
758 758
         $aFontTex = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>''];
@@ -768,7 +768,7 @@  discard block
 block discarded – undo
768 768
             $consCNPJ = !empty($this->dest->getElementsByTagName("CNPJ")->item(0)->nodeValue)
769 769
                     ? $this->dest->getElementsByTagName("CNPJ")->item(0)->nodeValue
770 770
                     : '';
771
-            $cDest = $consCPF.$consCNPJ.$considEstrangeiro; //documentos do consumidor
771
+            $cDest = $consCPF . $consCNPJ . $considEstrangeiro; //documentos do consumidor
772 772
             $enderDest = $this->dest->getElementsByTagName("enderDest")->item(0);
773 773
             $consNome = $this->getTagValue($this->dest, "xNome");
774 774
             $consLgr = $this->getTagValue($enderDest, "xLgr");
@@ -808,8 +808,8 @@  discard block
 block discarded – undo
808 808
             $yTex1 = $y + $hLinha;
809 809
             $texto = $consNome;
810 810
             if (!empty($consDoc)) {
811
-                $texto .= " - ". $consDoc . "\n" . $consEnd;
812
-                $this->pdf->textBox($x, $yTex1, $w, $hLinha*3, $texto, $aFontTex, 'C', 'C', 0, '', false);
811
+                $texto .= " - " . $consDoc . "\n" . $consEnd;
812
+                $this->pdf->textBox($x, $yTex1, $w, $hLinha * 3, $texto, $aFontTex, 'C', 'C', 0, '', false);
813 813
             }
814 814
         } else {
815 815
             $yTex1 = $y + $hLinha;
@@ -823,7 +823,7 @@  discard block
 block discarded – undo
823 823
         $y += 6;
824 824
         $margemInterna = $this->margemInterna;
825 825
         $maxW = $this->wPrint;
826
-        $w = ($maxW*1)+4;
826
+        $w = ($maxW * 1) + 4;
827 827
         $hLinha = $this->hLinha;
828 828
         $hBoxLinha = $this->hBoxLinha;
829 829
         $aFontTit = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B');
@@ -832,7 +832,7 @@  discard block
 block discarded – undo
832 832
         $nProt = '';
833 833
         if (isset($this->nfeProc)) {
834 834
             $nProt = $this->getTagValue($this->nfeProc, "nProt");
835
-            $dhRecbto  = $this->getTagValue($this->nfeProc, "dhRecbto");
835
+            $dhRecbto = $this->getTagValue($this->nfeProc, "dhRecbto");
836 836
         }
837 837
         $barcode = new Barcode();
838 838
         $bobj = $barcode->getBarcodeObj(
@@ -846,15 +846,15 @@  discard block
 block discarded – undo
846 846
         $qrcode = $bobj->getPngData();
847 847
         $wQr = 50;
848 848
         $hQr = 50;
849
-        $yQr = ($y+$margemInterna);
850
-        $xQr = ($w/2) - ($wQr/2);
849
+        $yQr = ($y + $margemInterna);
850
+        $xQr = ($w / 2) - ($wQr / 2);
851 851
         // prepare a base64 encoded "data url"
852 852
         $pic = 'data://text/plain;base64,' . base64_encode($qrcode);
853 853
         $info = getimagesize($pic);
854 854
         $this->pdf->image($pic, $xQr, $yQr, $wQr, $hQr, 'PNG');
855 855
         $dt = new DateTime($dhRecbto);
856
-        $yQr = ($yQr+$hQr+$margemInterna);
857
-        $this->pdf->textBox($x, $yQr, $w-4, $hBoxLinha, "Protocolo de Autorização: " . $nProt . "\n"
856
+        $yQr = ($yQr + $hQr + $margemInterna);
857
+        $this->pdf->textBox($x, $yQr, $w - 4, $hBoxLinha, "Protocolo de Autorização: " . $nProt . "\n"
858 858
             . $dt->format('d/m/Y H:i:s'), $aFontTex, 'C', 'C', 0, '', false);
859 859
     }
860 860
    
@@ -874,7 +874,7 @@  discard block
 block discarded – undo
874 874
         }
875 875
         $heigthText = $this->pTextBox($x, $y, $w, $hLinha, $texto, $aFontTit, 'C', 'C', 0, '', false);
876 876
         // seta o textbox do texto adicional
877
-        $this->pdf->textBox($x, $y+3, $w-2, $hLinha-3, $this->textoAdic, $aFontTex, 'T', 'L', 0, '', false);
877
+        $this->pdf->textBox($x, $y + 3, $w - 2, $hLinha - 3, $this->textoAdic, $aFontTex, 'T', 'L', 0, '', false);
878 878
     }
879 879
     
880 880
     /**
@@ -900,7 +900,7 @@  discard block
 block discarded – undo
900 900
         if ($startPos === false) {
901 901
             return $cdata;
902 902
         }
903
-        for ($x=$len; $x>0; $x--) {
903
+        for ($x = $len; $x > 0; $x--) {
904 904
             if (substr($cdata, $x, 1) == '>') {
905 905
                 $endPos = $x;
906 906
                 break;
@@ -911,15 +911,15 @@  discard block
 block discarded – undo
911 911
         } else {
912 912
             $parte1 = '';
913 913
         }
914
-        $parte2 = substr($cdata, $startPos, $endPos-$startPos+1);
914
+        $parte2 = substr($cdata, $startPos, $endPos - $startPos + 1);
915 915
         if ($endPos < $len) {
916 916
             $parte3 = substr($cdata, $endPos + 1, $len - $endPos - 1);
917 917
         } else {
918 918
             $parte3 = '';
919 919
         }
920
-        $texto = trim($parte1).' '.trim($parte3);
920
+        $texto = trim($parte1) . ' ' . trim($parte3);
921 921
         if (strpos($parte2, '<CDATA>') === false) {
922
-            $cdata = '<CDATA>'.$parte2.'</CDATA>';
922
+            $cdata = '<CDATA>' . $parte2 . '</CDATA>';
923 923
         } else {
924 924
             $cdata = $parte2;
925 925
         }
@@ -991,15 +991,15 @@  discard block
 block discarded – undo
991 991
         //grupo CADATA infCpl
992 992
         $t = $dom->getElementsByTagName('transmissor')->item(0);
993 993
         $r = $dom->getElementsByTagName('receptor')->item(0);
994
-        $versao = ! empty($dom->getElementsByTagName('versao')->item(0)->nodeValue) ?
995
-        'Versao:'.$dom->getElementsByTagName('versao')->item(0)->nodeValue.' ' : '';
996
-        $especieNF = ! empty($dom->getElementsByTagName('especieNF')->item(0)->nodeValue) ?
997
-        'Especie:'.$dom->getElementsByTagName('especieNF')->item(0)->nodeValue.' ' : '';
998
-        $fabEntrega = ! empty($dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue) ?
999
-        'Entrega:'.$dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue.' ' : '';
1000
-        $dca = ! empty($dom->getElementsByTagName('dca')->item(0)->nodeValue) ?
1001
-        'dca:'.$dom->getElementsByTagName('dca')->item(0)->nodeValue.' ' : '';
1002
-        $texto .= "".$versao.$especieNF.$fabEntrega.$dca;
994
+        $versao = !empty($dom->getElementsByTagName('versao')->item(0)->nodeValue) ?
995
+        'Versao:' . $dom->getElementsByTagName('versao')->item(0)->nodeValue . ' ' : '';
996
+        $especieNF = !empty($dom->getElementsByTagName('especieNF')->item(0)->nodeValue) ?
997
+        'Especie:' . $dom->getElementsByTagName('especieNF')->item(0)->nodeValue . ' ' : '';
998
+        $fabEntrega = !empty($dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue) ?
999
+        'Entrega:' . $dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue . ' ' : '';
1000
+        $dca = !empty($dom->getElementsByTagName('dca')->item(0)->nodeValue) ?
1001
+        'dca:' . $dom->getElementsByTagName('dca')->item(0)->nodeValue . ' ' : '';
1002
+        $texto .= "" . $versao . $especieNF . $fabEntrega . $dca;
1003 1003
         if (isset($t)) {
1004 1004
             if ($t->hasAttributes()) {
1005 1005
                 $texto .= " Transmissor ";
Please login to merge, or discard this patch.
src/NFe/Danfe.php 1 patch
Spacing   +340 added lines, -341 removed lines patch added patch discarded remove patch
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
             if ($papel == 'A4') {
384 384
                 $this->maxW = 297;
385 385
                 $this->maxH = 210;
386
-                $xInic = $margEsq+10;
386
+                $xInic = $margEsq + 10;
387 387
                 //se paisagem multiplica a largura do canhoto pela quantidade de canhotos
388 388
                 //$this->wCanhoto *= $this->qCanhoto;
389 389
             }
@@ -391,10 +391,10 @@  discard block
 block discarded – undo
391 391
         //total inicial de paginas
392 392
         $totPag = 1;
393 393
         //largura imprimivel em mm: largura da folha menos as margens esq/direita
394
-        $this->wPrint = $this->maxW-($margEsq * 2);
394
+        $this->wPrint = $this->maxW - ($margEsq * 2);
395 395
         //comprimento (altura) imprimivel em mm: altura da folha menos as margens
396 396
         //superior e inferior
397
-        $this->hPrint = $this->maxH-$margSup-$margInf;
397
+        $this->hPrint = $this->maxH - $margSup - $margInf;
398 398
         // estabelece contagem de paginas
399 399
         $this->pdf->aliasNbPages();
400 400
         // fixa as margens
@@ -438,9 +438,9 @@  discard block
 block discarded – undo
438 438
         }
439 439
         //calcular a altura necessária para os dados adicionais
440 440
         if ($this->orientacao == 'P') {
441
-            $this->wAdic = round($this->wPrint*0.66, 0);
441
+            $this->wAdic = round($this->wPrint * 0.66, 0);
442 442
         } else {
443
-            $this->wAdic = round(($this->wPrint-$this->wCanhoto)*0.5, 0);
443
+            $this->wAdic = round(($this->wPrint - $this->wCanhoto) * 0.5, 0);
444 444
         }
445 445
         $fontProduto = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>''];
446 446
         $this->textoAdic = '';
@@ -452,8 +452,8 @@  discard block
 block discarded – undo
452 452
             $txRetxBairro = $this->getTagValue($this->retirada, "xBairro");
453 453
             $txRetxMun = $this->getTagValue($this->retirada, "xMun");
454 454
             $txRetUF = $this->getTagValue($this->retirada, "UF");
455
-            $this->textoAdic .= "LOCAL DE RETIRADA : ".
456
-                    $txRetCNPJ.
455
+            $this->textoAdic .= "LOCAL DE RETIRADA : " .
456
+                    $txRetCNPJ .
457 457
                     '-' .
458 458
                     $txRetxLgr .
459 459
                     ', ' .
@@ -480,8 +480,8 @@  discard block
 block discarded – undo
480 480
             if ($this->textoAdic != '') {
481 481
                 $this->textoAdic .= ". \r\n";
482 482
             }
483
-            $this->textoAdic .= "LOCAL DE ENTREGA : ".$txRetCNPJ.'-'.$txRetxLgr.', '.$txRetnro.' '.$txRetxCpl.
484
-               ' - '.$txRetxBairro.' '.$txRetxMun.' - '.$txRetUF."\r\n";
483
+            $this->textoAdic .= "LOCAL DE ENTREGA : " . $txRetCNPJ . '-' . $txRetxLgr . ', ' . $txRetnro . ' ' . $txRetxCpl .
484
+               ' - ' . $txRetxBairro . ' ' . $txRetxMun . ' - ' . $txRetUF . "\r\n";
485 485
         }
486 486
         //informações adicionais
487 487
         $this->textoAdic .= $this->geraInformacoesDasNotasReferenciadas();
@@ -490,7 +490,7 @@  discard block
 block discarded – undo
490 490
             if ($this->textoAdic != '') {
491 491
                 $this->textoAdic .= ". \r\n";
492 492
             }
493
-            $this->textoAdic .= ! empty($this->getTagValue($this->infAdic, "infCpl"))
493
+            $this->textoAdic .= !empty($this->getTagValue($this->infAdic, "infCpl"))
494 494
             ? 'Inf. Contribuinte: ' . $this->anfaveaDANFE($this->getTagValue($this->infAdic, "infCpl"))
495 495
             : '';
496 496
             $infPedido = $this->geraInformacoesDaTagCompra();
@@ -498,14 +498,14 @@  discard block
 block discarded – undo
498 498
                 $this->textoAdic .= $infPedido;
499 499
             }
500 500
             $this->textoAdic .= $this->getTagValue($this->dest, "email", ' Email do Destinatário: ');
501
-            $this->textoAdic .= ! empty($this->getTagValue($this->infAdic, "infAdFisco"))
501
+            $this->textoAdic .= !empty($this->getTagValue($this->infAdic, "infAdFisco"))
502 502
             ? "\r\n Inf. fisco: " . $this->getTagValue($this->infAdic, "infAdFisco")
503 503
             : '';
504 504
             $obsCont = $this->infAdic->getElementsByTagName("obsCont");
505 505
             if (isset($obsCont)) {
506 506
                 foreach ($obsCont as $obs) {
507
-                    $campo =  $obsCont->item($i)->getAttribute("xCampo");
508
-                    $xTexto = ! empty($obsCont->item($i)->getElementsByTagName("xTexto")->item(0)->nodeValue)
507
+                    $campo = $obsCont->item($i)->getAttribute("xCampo");
508
+                    $xTexto = !empty($obsCont->item($i)->getElementsByTagName("xTexto")->item(0)->nodeValue)
509 509
                     ? $obsCont->item($i)->getElementsByTagName("xTexto")->item(0)->nodeValue
510 510
                     : '';
511 511
                     $this->textoAdic .= "\r\n" . $campo . ':  ' . trim($xTexto);
@@ -535,14 +535,14 @@  discard block
 block discarded – undo
535 535
         foreach ($alinhas as $linha) {
536 536
             $numlinhasdados += $this->pdf->getNumLines($linha, $this->wAdic, $fontProduto);
537 537
         }
538
-        $hdadosadic = round(($numlinhasdados+3) * $this->pdf->fontSize, 0);
538
+        $hdadosadic = round(($numlinhasdados + 3) * $this->pdf->fontSize, 0);
539 539
         if ($hdadosadic < 10) {
540 540
             $hdadosadic = 10;
541 541
         }
542 542
         //altura disponivel para os campos da DANFE
543
-        $hcabecalho = 47;//para cabeçalho
544
-        $hdestinatario = 25;//para destinatario
545
-        $hduplicatas = 12;//para cada grupo de 7 duplicatas
543
+        $hcabecalho = 47; //para cabeçalho
544
+        $hdestinatario = 25; //para destinatario
545
+        $hduplicatas = 12; //para cada grupo de 7 duplicatas
546 546
         if (isset($this->entrega)) {
547 547
             $hlocalentrega = 25;
548 548
         } else {
@@ -553,11 +553,11 @@  discard block
 block discarded – undo
553 553
         } else {
554 554
             $hlocalretirada = 0;
555 555
         }
556
-        $himposto = 18;// para imposto
557
-        $htransporte = 25;// para transporte
558
-        $hissqn = 11;// para issqn
559
-        $hfooter = 5;// para rodape
560
-        $hCabecItens = 4;//cabeçalho dos itens
556
+        $himposto = 18; // para imposto
557
+        $htransporte = 25; // para transporte
558
+        $hissqn = 11; // para issqn
559
+        $hfooter = 5; // para rodape
560
+        $hCabecItens = 4; //cabeçalho dos itens
561 561
         //alturas disponiveis para os dados
562 562
         $hDispo1 = $this->hPrint - 10 - ($hcabecalho +
563 563
             //$hdestinatario + ($linhasDup * $hduplicatas) + $himposto + $htransporte +
@@ -566,18 +566,18 @@  discard block
 block discarded – undo
566 566
             ($linhaISSQN * $hissqn) + $hdadosadic + $hfooter + $hCabecItens +
567 567
             $this->sizeExtraTextoFatura());
568 568
         if ($this->orientacao == 'P') {
569
-            $hDispo1 -= 24 * $this->qCanhoto;//para canhoto
569
+            $hDispo1 -= 24 * $this->qCanhoto; //para canhoto
570 570
             $w = $this->wPrint;
571 571
         } else {
572
-            $hcanhoto = $this->hPrint;//para canhoto
572
+            $hcanhoto = $this->hPrint; //para canhoto
573 573
             $w = $this->wPrint - $this->wCanhoto;
574 574
         }
575
-        $hDispo2 = $this->hPrint - 10 - ($hcabecalho + $hfooter + $hCabecItens)-4;
575
+        $hDispo2 = $this->hPrint - 10 - ($hcabecalho + $hfooter + $hCabecItens) - 4;
576 576
         //Contagem da altura ocupada para impressão dos itens
577 577
         $fontProduto = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>''];
578 578
         $numlinhas = 0;
579 579
         $hUsado = $hCabecItens;
580
-        $w2 = round($w*0.28, 0);
580
+        $w2 = round($w * 0.28, 0);
581 581
         $hDispo = $hDispo1;
582 582
         $totPag = 1;
583 583
         $i = 0;
@@ -590,7 +590,7 @@  discard block
 block discarded – undo
590 590
                 $hDispo = $hDispo2;
591 591
                 $hUsado = $hCabecItens;
592 592
                 // Remove canhoto para páginas secundárias em modo paisagem ('L')
593
-                $w2 = round($this->wPrint*0.28, 0);
593
+                $w2 = round($this->wPrint * 0.28, 0);
594 594
                 $i--; // decrementa para readicionar o item que não coube nessa pagina na outra.
595 595
             }
596 596
             $i++;
@@ -614,15 +614,15 @@  discard block
 block discarded – undo
614 614
         //coloca o cabeçalho
615 615
         $y = $this->header($x, $y, $pag, $totPag);
616 616
         //coloca os dados do destinatário
617
-        $y = $this->destinatarioDANFE($x, $y+1);
617
+        $y = $this->destinatarioDANFE($x, $y + 1);
618 618
         
619 619
         //coloca os dados do local de retirada
620 620
         if (isset($this->retirada)) {
621
-            $y = $this->localRetiradaDANFE($x, $y+1);
621
+            $y = $this->localRetiradaDANFE($x, $y + 1);
622 622
         }
623 623
         //coloca os dados do local de entrega
624 624
         if (isset($this->entrega)) {
625
-            $y = $this->localEntregaDANFE($x, $y+1);
625
+            $y = $this->localEntregaDANFE($x, $y + 1);
626 626
         }
627 627
         
628 628
         //Verifica as formas de pagamento da nota fiscal
@@ -637,29 +637,29 @@  discard block
 block discarded – undo
637 637
         }
638 638
         //caso tenha boleto imprimir fatura
639 639
         if ($this->dup->length > 0) {
640
-            $y = $this->fatura($x, $y+1);
640
+            $y = $this->fatura($x, $y + 1);
641 641
         } else {
642 642
             //Se somente tiver a forma de pagamento sem pagamento ou outros não imprimir nada
643
-            if (count($formaPag)=='1' && (isset($formaPag[90]) || isset($formaPag[99]))) {
643
+            if (count($formaPag) == '1' && (isset($formaPag[90]) || isset($formaPag[99]))) {
644 644
                 $y = $y;
645 645
             } else {
646 646
                 //caso tenha mais de uma forma de pagamento ou seja diferente de boleto exibe a
647 647
                 //forma de pagamento e o valor
648
-                $y = $this->pagamento($x, $y+1);
648
+                $y = $this->pagamento($x, $y + 1);
649 649
             }
650 650
         }
651 651
         //coloca os dados dos impostos e totais da NFe
652
-        $y = $this->imposto($x, $y+1);
652
+        $y = $this->imposto($x, $y + 1);
653 653
         //coloca os dados do trasnporte
654
-        $y = $this->transporte($x, $y+1);
654
+        $y = $this->transporte($x, $y + 1);
655 655
         //itens da DANFE
656 656
         $nInicial = 0;
657 657
 
658
-        $y = $this->itens($x, $y+1, $nInicial, $hDispo1, $pag, $totPag, $hCabecItens);
658
+        $y = $this->itens($x, $y + 1, $nInicial, $hDispo1, $pag, $totPag, $hCabecItens);
659 659
 
660 660
         //coloca os dados do ISSQN
661 661
         if ($linhaISSQN == 1) {
662
-            $y = $this->issqn($x, $y+4);
662
+            $y = $this->issqn($x, $y + 4);
663 663
         } else {
664 664
             $y += 4;
665 665
         }
@@ -688,7 +688,7 @@  discard block
 block discarded – undo
688 688
             //coloca o cabeçalho na página adicional
689 689
             $y = $this->header($x, $y, $n, $totPag);
690 690
             //coloca os itens na página adicional
691
-            $y = $this->itens($x, $y+1, $nInicial, $hDispo2, $n, $totPag, $hCabecItens);
691
+            $y = $this->itens($x, $y + 1, $nInicial, $hDispo2, $n, $totPag, $hCabecItens);
692 692
             //coloca o rodapé da página
693 693
             if ($this->orientacao == 'P') {
694 694
                 $this->rodape($margEsq);
@@ -725,7 +725,7 @@  discard block
 block discarded – undo
725 725
         if ($startPos === false) {
726 726
             return $cdata;
727 727
         }
728
-        for ($x=$len; $x>0; $x--) {
728
+        for ($x = $len; $x > 0; $x--) {
729 729
             if (substr($cdata, $x, 1) == '>') {
730 730
                 $endPos = $x;
731 731
                 break;
@@ -736,15 +736,15 @@  discard block
 block discarded – undo
736 736
         } else {
737 737
             $parte1 = '';
738 738
         }
739
-        $parte2 = substr($cdata, $startPos, $endPos-$startPos+1);
739
+        $parte2 = substr($cdata, $startPos, $endPos - $startPos + 1);
740 740
         if ($endPos < $len) {
741 741
             $parte3 = substr($cdata, $endPos + 1, $len - $endPos - 1);
742 742
         } else {
743 743
             $parte3 = '';
744 744
         }
745
-        $texto = trim($parte1).' '.trim($parte3);
745
+        $texto = trim($parte1) . ' ' . trim($parte3);
746 746
         if (strpos($parte2, '<CDATA>') === false) {
747
-            $cdata = '<CDATA>'.$parte2.'</CDATA>';
747
+            $cdata = '<CDATA>' . $parte2 . '</CDATA>';
748 748
         } else {
749 749
             $cdata = $parte2;
750 750
         }
@@ -818,15 +818,15 @@  discard block
 block discarded – undo
818 818
         //grupo CADATA infCpl
819 819
         $t = $dom->getElementsByTagName('transmissor')->item(0);
820 820
         $r = $dom->getElementsByTagName('receptor')->item(0);
821
-        $versao = ! empty($dom->getElementsByTagName('versao')->item(0)->nodeValue) ?
822
-            'Versao:'.$dom->getElementsByTagName('versao')->item(0)->nodeValue.' ' : '';
823
-        $especieNF = ! empty($dom->getElementsByTagName('especieNF')->item(0)->nodeValue) ?
824
-            'Especie:'.$dom->getElementsByTagName('especieNF')->item(0)->nodeValue.' ' : '';
825
-        $fabEntrega = ! empty($dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue) ?
826
-            'Entrega:'.$dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue.' ' : '';
827
-        $dca = ! empty($dom->getElementsByTagName('dca')->item(0)->nodeValue) ?
828
-            'dca:'.$dom->getElementsByTagName('dca')->item(0)->nodeValue.' ' : '';
829
-        $texto .= "".$versao.$especieNF.$fabEntrega.$dca;
821
+        $versao = !empty($dom->getElementsByTagName('versao')->item(0)->nodeValue) ?
822
+            'Versao:' . $dom->getElementsByTagName('versao')->item(0)->nodeValue . ' ' : '';
823
+        $especieNF = !empty($dom->getElementsByTagName('especieNF')->item(0)->nodeValue) ?
824
+            'Especie:' . $dom->getElementsByTagName('especieNF')->item(0)->nodeValue . ' ' : '';
825
+        $fabEntrega = !empty($dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue) ?
826
+            'Entrega:' . $dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue . ' ' : '';
827
+        $dca = !empty($dom->getElementsByTagName('dca')->item(0)->nodeValue) ?
828
+            'dca:' . $dom->getElementsByTagName('dca')->item(0)->nodeValue . ' ' : '';
829
+        $texto .= "" . $versao . $especieNF . $fabEntrega . $dca;
830 830
         if (isset($t)) {
831 831
             if ($t->hasAttributes()) {
832 832
                 $texto .= " Transmissor ";
@@ -912,14 +912,14 @@  discard block
 block discarded – undo
912 912
         }
913 913
         //####################################################################################
914 914
         //coluna esquerda identificação do emitente
915
-        $w = round($maxW*0.41, 0);
915
+        $w = round($maxW * 0.41, 0);
916 916
         if ($this->orientacao == 'P') {
917 917
             $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>'I'];
918 918
         } else {
919 919
             $aFont = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B'];
920 920
         }
921 921
         $w1 = $w;
922
-        $h=32;
922
+        $h = 32;
923 923
         $oldY += $h;
924 924
         $this->pdf->textBox($x, $y, $w, $h);
925 925
         $texto = 'IDENTIFICAÇÃO DO EMITENTE';
@@ -940,39 +940,39 @@  discard block
 block discarded – undo
940 940
                 $type == 'jpg';
941 941
             }
942 942
             //largura da imagem em mm
943
-            $logoWmm = ($logoInfo[0]/72)*25.4;
943
+            $logoWmm = ($logoInfo[0] / 72) * 25.4;
944 944
             //altura da imagem em mm
945
-            $logoHmm = ($logoInfo[1]/72)*25.4;
946
-            if ($this->logoAlign=='L') {
947
-                $nImgW = round($w/3, 0);
948
-                $nImgH = round($logoHmm * ($nImgW/$logoWmm), 0);
949
-                $xImg = $x+1;
950
-                $yImg = round(($h-$nImgH)/2, 0)+$y;
945
+            $logoHmm = ($logoInfo[1] / 72) * 25.4;
946
+            if ($this->logoAlign == 'L') {
947
+                $nImgW = round($w / 3, 0);
948
+                $nImgH = round($logoHmm * ($nImgW / $logoWmm), 0);
949
+                $xImg = $x + 1;
950
+                $yImg = round(($h - $nImgH) / 2, 0) + $y;
951 951
                 //estabelecer posições do texto
952
-                $x1 = round($xImg + $nImgW +1, 0);
953
-                $y1 = round($h/3+$y, 0);
954
-                $tw = round(2*$w/3, 0);
955
-            } elseif ($this->logoAlign=='C') {
956
-                $nImgH = round($h/3, 0);
957
-                $nImgW = round($logoWmm * ($nImgH/$logoHmm), 0);
958
-                $xImg = round(($w-$nImgW)/2+$x, 0);
959
-                $yImg = $y+3;
952
+                $x1 = round($xImg + $nImgW + 1, 0);
953
+                $y1 = round($h / 3 + $y, 0);
954
+                $tw = round(2 * $w / 3, 0);
955
+            } elseif ($this->logoAlign == 'C') {
956
+                $nImgH = round($h / 3, 0);
957
+                $nImgW = round($logoWmm * ($nImgH / $logoHmm), 0);
958
+                $xImg = round(($w - $nImgW) / 2 + $x, 0);
959
+                $yImg = $y + 3;
960 960
                 $x1 = $x;
961 961
                 $y1 = round($yImg + $nImgH + 1, 0);
962 962
                 $tw = $w;
963
-            } elseif ($this->logoAlign=='R') {
964
-                $nImgW = round($w/3, 0);
965
-                $nImgH = round($logoHmm * ($nImgW/$logoWmm), 0);
966
-                $xImg = round($x+($w-(1+$nImgW)), 0);
967
-                $yImg = round(($h-$nImgH)/2, 0)+$y;
963
+            } elseif ($this->logoAlign == 'R') {
964
+                $nImgW = round($w / 3, 0);
965
+                $nImgH = round($logoHmm * ($nImgW / $logoWmm), 0);
966
+                $xImg = round($x + ($w - (1 + $nImgW)), 0);
967
+                $yImg = round(($h - $nImgH) / 2, 0) + $y;
968 968
                 $x1 = $x;
969
-                $y1 = round($h/3+$y, 0);
970
-                $tw = round(2*$w/3, 0);
971
-            } elseif ($this->logoAlign=='F') {
972
-                $nImgH = round($h-5, 0);
973
-                $nImgW = round($logoWmm * ($nImgH/$logoHmm), 0);
974
-                $xImg = round(($w-$nImgW)/2+$x, 0);
975
-                $yImg = $y+3;
969
+                $y1 = round($h / 3 + $y, 0);
970
+                $tw = round(2 * $w / 3, 0);
971
+            } elseif ($this->logoAlign == 'F') {
972
+                $nImgH = round($h - 5, 0);
973
+                $nImgW = round($logoWmm * ($nImgH / $logoHmm), 0);
974
+                $xImg = round(($w - $nImgW) / 2 + $x, 0);
975
+                $yImg = $y + 3;
976 976
                 $x1 = $x;
977 977
                 $y1 = round($yImg + $nImgH + 1, 0);
978 978
                 $tw = $w;
@@ -981,7 +981,7 @@  discard block
 block discarded – undo
981 981
             $this->pdf->Image($this->logomarca, $xImg, $yImg, $nImgW, $nImgH, $type);
982 982
         } else {
983 983
             $x1 = $x;
984
-            $y1 = round($h/3+$y, 0);
984
+            $y1 = round($h / 3 + $y, 0);
985 985
             $tw = $w;
986 986
         }
987 987
         // monta as informações apenas se diferente de full logo
@@ -991,9 +991,9 @@  discard block
 block discarded – undo
991 991
             $texto = $this->emit->getElementsByTagName("xNome")->item(0)->nodeValue;
992 992
             $this->pdf->textBox($x1, $y1, $tw, 8, $texto, $aFont, 'T', 'C', 0, '');
993 993
             //endereço
994
-            $y1 = $y1+5;
994
+            $y1 = $y1 + 5;
995 995
             $aFont = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>''];
996
-            $fone = ! empty($this->enderEmit->getElementsByTagName("fone")->item(0)->nodeValue)
996
+            $fone = !empty($this->enderEmit->getElementsByTagName("fone")->item(0)->nodeValue)
997 997
             ? $this->enderEmit->getElementsByTagName("fone")->item(0)->nodeValue
998 998
             : '';
999 999
             $lgr = $this->getTagValue($this->enderEmit, "xLgr");
@@ -1013,33 +1013,33 @@  discard block
 block discarded – undo
1013 1013
         //####################################################################################
1014 1014
         //coluna central Danfe
1015 1015
         $x += $w;
1016
-        $w=round($maxW * 0.17, 0);//35;
1016
+        $w = round($maxW * 0.17, 0); //35;
1017 1017
         $w2 = $w;
1018 1018
         $h = 32;
1019 1019
         $this->pdf->textBox($x, $y, $w, $h);
1020 1020
   
1021 1021
         $texto = "DANFE";
1022 1022
         $aFont = ['font'=>$this->fontePadrao, 'size'=>14, 'style'=>'B'];
1023
-        $this->pdf->textBox($x, $y+1, $w, $h, $texto, $aFont, 'T', 'C', 0, '');
1023
+        $this->pdf->textBox($x, $y + 1, $w, $h, $texto, $aFont, 'T', 'C', 0, '');
1024 1024
         $aFont = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>''];
1025 1025
         $texto = 'Documento Auxiliar da Nota Fiscal Eletrônica';
1026 1026
         $h = 20;
1027
-        $this->pdf->textBox($x, $y+6, $w, $h, $texto, $aFont, 'T', 'C', 0, '', false);
1027
+        $this->pdf->textBox($x, $y + 6, $w, $h, $texto, $aFont, 'T', 'C', 0, '', false);
1028 1028
 
1029 1029
         $aFont = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>''];
1030 1030
         $texto = '0 - ENTRADA';
1031 1031
         $y1 = $y + 14;
1032 1032
         $h = 8;
1033
-        $this->pdf->textBox($x+2, $y1, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1033
+        $this->pdf->textBox($x + 2, $y1, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1034 1034
         $texto = '1 - SAÍDA';
1035 1035
         $y1 = $y + 17;
1036
-        $this->pdf->textBox($x+2, $y1, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1036
+        $this->pdf->textBox($x + 2, $y1, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1037 1037
         //tipo de nF
1038 1038
         $aFont = ['font'=>$this->fontePadrao, 'size'=>12, 'style'=>'B'];
1039 1039
         $y1 = $y + 13;
1040 1040
         $h = 7;
1041 1041
         $texto = $this->ide->getElementsByTagName('tpNF')->item(0)->nodeValue;
1042
-        $this->pdf->textBox($x+27, $y1, 5, $h, $texto, $aFont, 'C', 'C', 1, '');
1042
+        $this->pdf->textBox($x + 27, $y1, 5, $h, $texto, $aFont, 'C', 'C', 1, '');
1043 1043
         //numero da NF
1044 1044
         $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'];
1045 1045
         $y1 = $y + 20;
@@ -1071,7 +1071,7 @@  discard block
 block discarded – undo
1071 1071
         //####################################################################################
1072 1072
         //coluna codigo de barras
1073 1073
         $x += $w;
1074
-        $w = ($maxW-$w1-$w2);//85;
1074
+        $w = ($maxW - $w1 - $w2); //85;
1075 1075
         $w3 = $w;
1076 1076
         $h = 32;
1077 1077
         $this->pdf->textBox($x, $y, $w, $h);
@@ -1080,22 +1080,22 @@  discard block
 block discarded – undo
1080 1080
         $bW = 75;
1081 1081
         $bH = 12;
1082 1082
         //codigo de barras
1083
-        $this->pdf->code128($x+(($w-$bW)/2), $y+2, $chave_acesso, $bW, $bH);
1083
+        $this->pdf->code128($x + (($w - $bW) / 2), $y + 2, $chave_acesso, $bW, $bH);
1084 1084
         //linhas divisorias
1085
-        $this->pdf->line($x, $y+4+$bH, $x+$w, $y+4+$bH);
1086
-        $this->pdf->line($x, $y+12+$bH, $x+$w, $y+12+$bH);
1085
+        $this->pdf->line($x, $y + 4 + $bH, $x + $w, $y + 4 + $bH);
1086
+        $this->pdf->line($x, $y + 12 + $bH, $x + $w, $y + 12 + $bH);
1087 1087
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1088
-        $y1 = $y+4+$bH;
1088
+        $y1 = $y + 4 + $bH;
1089 1089
         $h = 7;
1090 1090
         $texto = 'CHAVE DE ACESSO';
1091 1091
         $this->pdf->textBox($x, $y1, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1092 1092
         $aFont = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B'];
1093
-        $y1 = $y+8+$bH;
1093
+        $y1 = $y + 8 + $bH;
1094 1094
         $texto = $this->formatField($chave_acesso, $this->formatoChave);
1095
-        $this->pdf->textBox($x+2, $y1, $w-2, $h, $texto, $aFont, 'T', 'C', 0, '');
1096
-        $y1 = $y+12+$bH;
1095
+        $this->pdf->textBox($x + 2, $y1, $w - 2, $h, $texto, $aFont, 'T', 'C', 0, '');
1096
+        $y1 = $y + 12 + $bH;
1097 1097
         $aFont = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>''];
1098
-        $chaveContingencia="";
1098
+        $chaveContingencia = "";
1099 1099
         if ($this->notaDpec()) {
1100 1100
             $cabecalhoProtoAutorizacao = 'NÚMERO DE REGISTRO DPEC';
1101 1101
         } else {
@@ -1106,16 +1106,16 @@  discard block
 block discarded – undo
1106 1106
             $chaveContingencia = $this->geraChaveAdicionalDeContingencia();
1107 1107
             $this->pdf->setFillColor(0, 0, 0);
1108 1108
             //codigo de barras
1109
-            $this->pdf->code128($x+11, $y1+1, $chaveContingencia, $bW*.9, $bH/2);
1109
+            $this->pdf->code128($x + 11, $y1 + 1, $chaveContingencia, $bW * .9, $bH / 2);
1110 1110
         } else {
1111 1111
             $texto = 'Consulta de autenticidade no portal nacional da NF-e';
1112
-            $this->pdf->textBox($x+2, $y1, $w-2, $h, $texto, $aFont, 'T', 'C', 0, '');
1113
-            $y1 = $y+16+$bH;
1112
+            $this->pdf->textBox($x + 2, $y1, $w - 2, $h, $texto, $aFont, 'T', 'C', 0, '');
1113
+            $y1 = $y + 16 + $bH;
1114 1114
             $texto = 'www.nfe.fazenda.gov.br/portal ou no site da Sefaz Autorizadora';
1115 1115
             $this->pdf->textBox(
1116
-                $x+2,
1116
+                $x + 2,
1117 1117
                 $y1,
1118
-                $w-2,
1118
+                $w - 2,
1119 1119
                 $h,
1120 1120
                 $texto,
1121 1121
                 $aFont,
@@ -1131,7 +1131,7 @@  discard block
 block discarded – undo
1131 1131
         //natureza da operação
1132 1132
         $texto = 'NATUREZA DA OPERAÇÃO';
1133 1133
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1134
-        $w = $w1+$w2;
1134
+        $w = $w1 + $w2;
1135 1135
         $y = $oldY;
1136 1136
         $oldY += $h;
1137 1137
         $x = $oldX;
@@ -1164,7 +1164,7 @@  discard block
 block discarded – undo
1164 1164
                 $cStat = '';
1165 1165
             } else {
1166 1166
                 if (isset($this->nfeProc)) {
1167
-                    $texto = ! empty($this->nfeProc->getElementsByTagName("nProt")->item(0)->nodeValue)
1167
+                    $texto = !empty($this->nfeProc->getElementsByTagName("nProt")->item(0)->nodeValue)
1168 1168
                     ? $this->nfeProc->getElementsByTagName("nProt")->item(0)->nodeValue
1169 1169
                     : '';
1170 1170
                     $tsHora = $this->toTimestamp(
@@ -1198,25 +1198,25 @@  discard block
 block discarded – undo
1198 1198
         $texto = 'INSCRIÇÃO ESTADUAL DO SUBST. TRIBUT.';
1199 1199
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1200 1200
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1201
-        $texto = ! empty($this->emit->getElementsByTagName("IEST")->item(0)->nodeValue)
1201
+        $texto = !empty($this->emit->getElementsByTagName("IEST")->item(0)->nodeValue)
1202 1202
         ? $this->emit->getElementsByTagName("IEST")->item(0)->nodeValue
1203 1203
         : '';
1204 1204
         $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'];
1205 1205
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1206 1206
         //CNPJ
1207 1207
         $x += $w;
1208
-        $w = ($maxW-(2*$w));
1208
+        $w = ($maxW - (2 * $w));
1209 1209
         $texto = 'CNPJ / CPF';
1210 1210
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1211 1211
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1212 1212
         //Pegando valor do CPF/CNPJ
1213
-        if (! empty($this->emit->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1213
+        if (!empty($this->emit->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1214 1214
             $texto = $this->formatField(
1215 1215
                 $this->emit->getElementsByTagName("CNPJ")->item(0)->nodeValue,
1216 1216
                 "###.###.###/####-##"
1217 1217
             );
1218 1218
         } else {
1219
-            $texto = ! empty($this->emit->getElementsByTagName("CPF")->item(0)->nodeValue)
1219
+            $texto = !empty($this->emit->getElementsByTagName("CPF")->item(0)->nodeValue)
1220 1220
             ? $this->formatField(
1221 1221
                 $this->emit->getElementsByTagName("CPF")->item(0)->nodeValue,
1222 1222
                 "###.###.###-##"
@@ -1233,22 +1233,22 @@  discard block
 block discarded – undo
1233 1233
         $resp = $this->statusNFe();
1234 1234
         if (!$resp['status']) {
1235 1235
             $x = 10;
1236
-            $y = $this->hPrint-130;
1236
+            $y = $this->hPrint - 130;
1237 1237
             $h = 25;
1238
-            $w = $maxW-(2*$x);
1238
+            $w = $maxW - (2 * $x);
1239 1239
             $this->pdf->settextcolor(90, 90, 90);
1240 1240
             $texto = $resp['message'];
1241 1241
             $aFont = ['font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B'];
1242 1242
             $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1243 1243
             $y += $h;
1244 1244
             $h = 5;
1245
-            $w = $maxW-(2*$x);
1245
+            $w = $maxW - (2 * $x);
1246 1246
             if (isset($this->infProt) && $resp['status']) {
1247 1247
                 $xMotivo = $this->infProt->getElementsByTagName("xMotivo")->item(0)->nodeValue;
1248 1248
             } else {
1249 1249
                 $xMotivo = '';
1250 1250
             }
1251
-            $texto = "SEM VALOR FISCAL\n".$xMotivo;
1251
+            $texto = "SEM VALOR FISCAL\n" . $xMotivo;
1252 1252
             $aFont = ['font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B'];
1253 1253
             $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1254 1254
             $this->pdf->settextcolor(0, 0, 0);
@@ -1271,12 +1271,12 @@  discard block
 block discarded – undo
1271 1271
         if ($this->notaDpec() || $this->tpEmis == 4) {
1272 1272
             //DPEC
1273 1273
             $x = 10;
1274
-            $y = $this->hPrint-130;
1274
+            $y = $this->hPrint - 130;
1275 1275
             $h = 25;
1276
-            $w = $maxW-(2*$x);
1276
+            $w = $maxW - (2 * $x);
1277 1277
             $this->pdf->SetTextColor(200, 200, 200);
1278
-            $texto = "DANFE impresso em contingência -\n".
1279
-                     "DPEC regularmente recebido pela Receita\n".
1278
+            $texto = "DANFE impresso em contingência -\n" .
1279
+                     "DPEC regularmente recebido pela Receita\n" .
1280 1280
                      "Federal do Brasil";
1281 1281
             $aFont = ['font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B'];
1282 1282
             $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
@@ -1395,7 +1395,7 @@  discard block
 block discarded – undo
1395 1395
         $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
1396 1396
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1397 1397
         //NOME / RAZÃO SOCIAL
1398
-        $w = round($maxW*0.61, 0);
1398
+        $w = round($maxW * 0.61, 0);
1399 1399
         $w1 = $w;
1400 1400
         $y += 3;
1401 1401
         $texto = 'NOME / RAZÃO SOCIAL';
@@ -1410,19 +1410,19 @@  discard block
 block discarded – undo
1410 1410
         }
1411 1411
         //CNPJ / CPF
1412 1412
         $x += $w;
1413
-        $w = round($maxW*0.23, 0);
1413
+        $w = round($maxW * 0.23, 0);
1414 1414
         $w2 = $w;
1415 1415
         $texto = 'CNPJ / CPF';
1416 1416
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1417 1417
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1418 1418
         //Pegando valor do CPF/CNPJ
1419
-        if (! empty($this->dest->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1419
+        if (!empty($this->dest->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1420 1420
             $texto = $this->formatField(
1421 1421
                 $this->dest->getElementsByTagName("CNPJ")->item(0)->nodeValue,
1422 1422
                 "###.###.###/####-##"
1423 1423
             );
1424 1424
         } else {
1425
-            $texto = ! empty($this->dest->getElementsByTagName("CPF")->item(0)->nodeValue)
1425
+            $texto = !empty($this->dest->getElementsByTagName("CPF")->item(0)->nodeValue)
1426 1426
             ? $this->formatField(
1427 1427
                 $this->dest->getElementsByTagName("CPF")->item(0)->nodeValue,
1428 1428
                 "###.###.###-##"
@@ -1433,16 +1433,16 @@  discard block
 block discarded – undo
1433 1433
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1434 1434
         //DATA DA EMISSÃO
1435 1435
         $x += $w;
1436
-        $w = $maxW-($w1+$w2);
1436
+        $w = $maxW - ($w1 + $w2);
1437 1437
         $wx = $w;
1438 1438
         $texto = 'DATA DA EMISSÃO';
1439 1439
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1440 1440
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1441
-        $dEmi = ! empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue)
1441
+        $dEmi = !empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue)
1442 1442
         ? $this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue
1443 1443
         : '';
1444 1444
         if ($dEmi == '') {
1445
-            $dEmi = ! empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue)
1445
+            $dEmi = !empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue)
1446 1446
             ? $this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue
1447 1447
             : '';
1448 1448
             $aDemi = explode('T', $dEmi);
@@ -1456,7 +1456,7 @@  discard block
 block discarded – undo
1456 1456
             $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 1, '');
1457 1457
         }
1458 1458
         //ENDEREÇO
1459
-        $w = round($maxW*0.47, 0);
1459
+        $w = round($maxW * 0.47, 0);
1460 1460
         $w1 = $w;
1461 1461
         $y += $h;
1462 1462
         $x = $oldX;
@@ -1471,7 +1471,7 @@  discard block
 block discarded – undo
1471 1471
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 0, '', true);
1472 1472
         //BAIRRO / DISTRITO
1473 1473
         $x += $w;
1474
-        $w = round($maxW*0.21, 0);
1474
+        $w = round($maxW * 0.21, 0);
1475 1475
         $w2 = $w;
1476 1476
         $texto = 'BAIRRO / DISTRITO';
1477 1477
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
@@ -1481,12 +1481,12 @@  discard block
 block discarded – undo
1481 1481
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1482 1482
         //CEP
1483 1483
         $x += $w;
1484
-        $w = $maxW-$w1-$w2-$wx;
1484
+        $w = $maxW - $w1 - $w2 - $wx;
1485 1485
         $w2 = $w;
1486 1486
         $texto = 'CEP';
1487 1487
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1488 1488
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1489
-        $texto = ! empty($this->dest->getElementsByTagName("CEP")->item(0)->nodeValue)
1489
+        $texto = !empty($this->dest->getElementsByTagName("CEP")->item(0)->nodeValue)
1490 1490
         ? $this->dest->getElementsByTagName("CEP")->item(0)->nodeValue
1491 1491
         : '';
1492 1492
         $texto = $this->formatField($texto, "#####-###");
@@ -1498,11 +1498,11 @@  discard block
 block discarded – undo
1498 1498
         $texto = 'DATA DA SAÍDA/ENTRADA';
1499 1499
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1500 1500
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1501
-        $dSaiEnt = ! empty($this->ide->getElementsByTagName("dSaiEnt")->item(0)->nodeValue)
1501
+        $dSaiEnt = !empty($this->ide->getElementsByTagName("dSaiEnt")->item(0)->nodeValue)
1502 1502
             ? $this->ide->getElementsByTagName("dSaiEnt")->item(0)->nodeValue
1503 1503
             : '';
1504 1504
         if ($dSaiEnt == '') {
1505
-            $dSaiEnt = ! empty($this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue)
1505
+            $dSaiEnt = !empty($this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue)
1506 1506
                 ? $this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue
1507 1507
                 : '';
1508 1508
             $aDsaient = explode('T', $dSaiEnt);
@@ -1522,7 +1522,7 @@  discard block
 block discarded – undo
1522 1522
         if (strtoupper(trim($texto)) == "EXTERIOR"
1523 1523
             && $this->dest->getElementsByTagName("xPais")->length > 0
1524 1524
         ) {
1525
-            $texto .= " - " .  $this->dest->getElementsByTagName("xPais")->item(0)->nodeValue;
1525
+            $texto .= " - " . $this->dest->getElementsByTagName("xPais")->item(0)->nodeValue;
1526 1526
         }
1527 1527
         $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'];
1528 1528
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 0, '');
@@ -1537,19 +1537,19 @@  discard block
 block discarded – undo
1537 1537
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1538 1538
         //FONE / FAX
1539 1539
         $x += $w;
1540
-        $w = round(($maxW -$w1-$wx-8)/2, 0);
1540
+        $w = round(($maxW - $w1 - $wx - 8) / 2, 0);
1541 1541
         $w3 = $w;
1542 1542
         $texto = 'FONE / FAX';
1543 1543
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1544 1544
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1545
-        $texto = ! empty($this->dest->getElementsByTagName("fone")->item(0)->nodeValue)
1545
+        $texto = !empty($this->dest->getElementsByTagName("fone")->item(0)->nodeValue)
1546 1546
         ? $this->dest->getElementsByTagName("fone")->item(0)->nodeValue
1547 1547
         : '';
1548 1548
         $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'];
1549 1549
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1550 1550
         //INSCRIÇÃO ESTADUAL
1551 1551
         $x += $w;
1552
-        $w = $maxW -$w1-$wx-8-$w3;
1552
+        $w = $maxW - $w1 - $wx - 8 - $w3;
1553 1553
         $texto = 'INSCRIÇÃO ESTADUAL';
1554 1554
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1555 1555
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -1563,11 +1563,11 @@  discard block
 block discarded – undo
1563 1563
         $texto = 'HORA DA SAÍDA/ENTRADA';
1564 1564
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1565 1565
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1566
-        $hSaiEnt = ! empty($this->ide->getElementsByTagName("hSaiEnt")->item(0)->nodeValue)
1566
+        $hSaiEnt = !empty($this->ide->getElementsByTagName("hSaiEnt")->item(0)->nodeValue)
1567 1567
         ? $this->ide->getElementsByTagName("hSaiEnt")->item(0)->nodeValue
1568 1568
         : '';
1569 1569
         if ($hSaiEnt == '') {
1570
-            $dhSaiEnt = ! empty($this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue)
1570
+            $dhSaiEnt = !empty($this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue)
1571 1571
             ? $this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue
1572 1572
             : '';
1573 1573
             $tsDhSaiEnt = $this->toTimestamp($dhSaiEnt);
@@ -1606,7 +1606,7 @@  discard block
 block discarded – undo
1606 1606
         $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
1607 1607
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1608 1608
         //NOME / RAZÃO SOCIAL
1609
-        $w = round($maxW*0.61, 0);
1609
+        $w = round($maxW * 0.61, 0);
1610 1610
         $w1 = $w;
1611 1611
         $y += 3;
1612 1612
         $texto = 'NOME / RAZÃO SOCIAL';
@@ -1624,19 +1624,19 @@  discard block
 block discarded – undo
1624 1624
         }
1625 1625
         //CNPJ / CPF
1626 1626
         $x += $w;
1627
-        $w = round($maxW*0.23, 0);
1627
+        $w = round($maxW * 0.23, 0);
1628 1628
         $w2 = $w;
1629 1629
         $texto = 'CNPJ / CPF';
1630 1630
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1631 1631
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1632 1632
         //Pegando valor do CPF/CNPJ
1633
-        if (! empty($this->entrega->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1633
+        if (!empty($this->entrega->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1634 1634
             $texto = $this->formatField(
1635 1635
                 $this->entrega->getElementsByTagName("CNPJ")->item(0)->nodeValue,
1636 1636
                 "###.###.###/####-##"
1637 1637
             );
1638 1638
         } else {
1639
-            $texto = ! empty($this->entrega->getElementsByTagName("CPF")->item(0)->nodeValue) ?
1639
+            $texto = !empty($this->entrega->getElementsByTagName("CPF")->item(0)->nodeValue) ?
1640 1640
                     $this->formatField(
1641 1641
                         $this->entrega->getElementsByTagName("CPF")->item(0)->nodeValue,
1642 1642
                         "###.###.###-##"
@@ -1646,7 +1646,7 @@  discard block
 block discarded – undo
1646 1646
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1647 1647
         //INSCRIÇÃO ESTADUAL
1648 1648
         $x += $w;
1649
-        $w = $maxW-($w1+$w2);
1649
+        $w = $maxW - ($w1 + $w2);
1650 1650
         $wx = $w;
1651 1651
         $texto = 'INSCRIÇÃO ESTADUAL';
1652 1652
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
@@ -1662,7 +1662,7 @@  discard block
 block discarded – undo
1662 1662
             $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 1, '');
1663 1663
         }
1664 1664
         //ENDEREÇO
1665
-        $w = round($maxW*0.355, 0) + $wx;
1665
+        $w = round($maxW * 0.355, 0) + $wx;
1666 1666
         $w1 = $w;
1667 1667
         $y += $h;
1668 1668
         $x = $oldX;
@@ -1676,7 +1676,7 @@  discard block
 block discarded – undo
1676 1676
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 0, '', true);
1677 1677
         //BAIRRO / DISTRITO
1678 1678
         $x += $w;
1679
-        $w = round($maxW*0.335, 0);
1679
+        $w = round($maxW * 0.335, 0);
1680 1680
         $w2 = $w;
1681 1681
         $texto = 'BAIRRO / DISTRITO';
1682 1682
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
@@ -1686,17 +1686,17 @@  discard block
 block discarded – undo
1686 1686
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1687 1687
         //CEP
1688 1688
         $x += $w;
1689
-        $w = $maxW-($w1+$w2);
1689
+        $w = $maxW - ($w1 + $w2);
1690 1690
         $texto = 'CEP';
1691 1691
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1692 1692
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1693
-        $texto = ! empty($this->entrega->getElementsByTagName("CEP")->item(0)->nodeValue) ?
1693
+        $texto = !empty($this->entrega->getElementsByTagName("CEP")->item(0)->nodeValue) ?
1694 1694
                 $this->entrega->getElementsByTagName("CEP")->item(0)->nodeValue : '';
1695 1695
         $texto = $this->formatField($texto, "#####-###");
1696 1696
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
1697 1697
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1698 1698
         //MUNICÍPIO
1699
-        $w = round($maxW*0.805, 0);
1699
+        $w = round($maxW * 0.805, 0);
1700 1700
         $w1 = $w;
1701 1701
         $y += $h;
1702 1702
         $x = $oldX;
@@ -1705,7 +1705,7 @@  discard block
 block discarded – undo
1705 1705
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1706 1706
         $texto = $this->entrega->getElementsByTagName("xMun")->item(0)->nodeValue;
1707 1707
         if (strtoupper(trim($texto)) == "EXTERIOR" && $this->entrega->getElementsByTagName("xPais")->length > 0) {
1708
-            $texto .= " - " .  $this->entrega->getElementsByTagName("xPais")->item(0)->nodeValue;
1708
+            $texto .= " - " . $this->entrega->getElementsByTagName("xPais")->item(0)->nodeValue;
1709 1709
         }
1710 1710
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
1711 1711
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 0, '');
@@ -1720,11 +1720,11 @@  discard block
 block discarded – undo
1720 1720
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1721 1721
         //FONE / FAX
1722 1722
         $x += $w;
1723
-        $w = $maxW-$w-$w1;
1723
+        $w = $maxW - $w - $w1;
1724 1724
         $texto = 'FONE / FAX';
1725 1725
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1726 1726
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1727
-        $texto = ! empty($this->entrega->getElementsByTagName("fone")->item(0)->nodeValue) ?
1727
+        $texto = !empty($this->entrega->getElementsByTagName("fone")->item(0)->nodeValue) ?
1728 1728
                 $this->entrega->getElementsByTagName("fone")->item(0)->nodeValue : '';
1729 1729
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
1730 1730
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
@@ -1756,7 +1756,7 @@  discard block
 block discarded – undo
1756 1756
         $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
1757 1757
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1758 1758
         //NOME / RAZÃO SOCIAL
1759
-        $w = round($maxW*0.61, 0);
1759
+        $w = round($maxW * 0.61, 0);
1760 1760
         $w1 = $w;
1761 1761
         $y += 3;
1762 1762
         $texto = 'NOME / RAZÃO SOCIAL';
@@ -1774,19 +1774,19 @@  discard block
 block discarded – undo
1774 1774
         }
1775 1775
         //CNPJ / CPF
1776 1776
         $x += $w;
1777
-        $w = round($maxW*0.23, 0);
1777
+        $w = round($maxW * 0.23, 0);
1778 1778
         $w2 = $w;
1779 1779
         $texto = 'CNPJ / CPF';
1780 1780
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1781 1781
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1782 1782
         //Pegando valor do CPF/CNPJ
1783
-        if (! empty($this->retirada->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1783
+        if (!empty($this->retirada->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1784 1784
             $texto = $this->formatField(
1785 1785
                 $this->retirada->getElementsByTagName("CNPJ")->item(0)->nodeValue,
1786 1786
                 "###.###.###/####-##"
1787 1787
             );
1788 1788
         } else {
1789
-            $texto = ! empty($this->retirada->getElementsByTagName("CPF")->item(0)->nodeValue) ?
1789
+            $texto = !empty($this->retirada->getElementsByTagName("CPF")->item(0)->nodeValue) ?
1790 1790
                     $this->formatField(
1791 1791
                         $this->retirada->getElementsByTagName("CPF")->item(0)->nodeValue,
1792 1792
                         "###.###.###-##"
@@ -1796,7 +1796,7 @@  discard block
 block discarded – undo
1796 1796
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1797 1797
         //INSCRIÇÃO ESTADUAL
1798 1798
         $x += $w;
1799
-        $w = $maxW-($w1+$w2);
1799
+        $w = $maxW - ($w1 + $w2);
1800 1800
         $wx = $w;
1801 1801
         $texto = 'INSCRIÇÃO ESTADUAL';
1802 1802
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
@@ -1812,7 +1812,7 @@  discard block
 block discarded – undo
1812 1812
             $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 1, '');
1813 1813
         }
1814 1814
         //ENDEREÇO
1815
-        $w = round($maxW*0.355, 0) + $wx;
1815
+        $w = round($maxW * 0.355, 0) + $wx;
1816 1816
         $w1 = $w;
1817 1817
         $y += $h;
1818 1818
         $x = $oldX;
@@ -1826,7 +1826,7 @@  discard block
 block discarded – undo
1826 1826
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 0, '', true);
1827 1827
         //BAIRRO / DISTRITO
1828 1828
         $x += $w;
1829
-        $w = round($maxW*0.335, 0);
1829
+        $w = round($maxW * 0.335, 0);
1830 1830
         $w2 = $w;
1831 1831
         $texto = 'BAIRRO / DISTRITO';
1832 1832
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
@@ -1836,17 +1836,17 @@  discard block
 block discarded – undo
1836 1836
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1837 1837
         //CEP
1838 1838
         $x += $w;
1839
-        $w = $maxW-($w1+$w2);
1839
+        $w = $maxW - ($w1 + $w2);
1840 1840
         $texto = 'CEP';
1841 1841
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1842 1842
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1843
-        $texto = ! empty($this->retirada->getElementsByTagName("CEP")->item(0)->nodeValue) ?
1843
+        $texto = !empty($this->retirada->getElementsByTagName("CEP")->item(0)->nodeValue) ?
1844 1844
                 $this->retirada->getElementsByTagName("CEP")->item(0)->nodeValue : '';
1845 1845
         $texto = $this->formatField($texto, "#####-###");
1846 1846
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
1847 1847
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1848 1848
         //MUNICÍPIO
1849
-        $w = round($maxW*0.805, 0);
1849
+        $w = round($maxW * 0.805, 0);
1850 1850
         $w1 = $w;
1851 1851
         $y += $h;
1852 1852
         $x = $oldX;
@@ -1855,7 +1855,7 @@  discard block
 block discarded – undo
1855 1855
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1856 1856
         $texto = $this->retirada->getElementsByTagName("xMun")->item(0)->nodeValue;
1857 1857
         if (strtoupper(trim($texto)) == "EXTERIOR" && $this->retirada->getElementsByTagName("xPais")->length > 0) {
1858
-            $texto .= " - " .  $this->retirada->getElementsByTagName("xPais")->item(0)->nodeValue;
1858
+            $texto .= " - " . $this->retirada->getElementsByTagName("xPais")->item(0)->nodeValue;
1859 1859
         }
1860 1860
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
1861 1861
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 0, '');
@@ -1870,11 +1870,11 @@  discard block
 block discarded – undo
1870 1870
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1871 1871
         //FONE / FAX
1872 1872
         $x += $w;
1873
-        $w = $maxW-$w-$w1;
1873
+        $w = $maxW - $w - $w1;
1874 1874
         $texto = 'FONE / FAX';
1875 1875
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1876 1876
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1877
-        $texto = ! empty($this->retirada->getElementsByTagName("fone")->item(0)->nodeValue) ?
1877
+        $texto = !empty($this->retirada->getElementsByTagName("fone")->item(0)->nodeValue) ?
1878 1878
                 $this->retirada->getElementsByTagName("fone")->item(0)->nodeValue : '';
1879 1879
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
1880 1880
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
@@ -1947,7 +1947,7 @@  discard block
 block discarded – undo
1947 1947
     protected function fatura($x, $y)
1948 1948
     {
1949 1949
         $linha = 1;
1950
-        $h = 8+3;
1950
+        $h = 8 + 3;
1951 1951
         $oldx = $x;
1952 1952
         $textoFatura = $this->getTextoFatura();
1953 1953
         //verificar se existem duplicatas
@@ -1980,29 +1980,29 @@  discard block
 block discarded – undo
1980 1980
                 return ($y + $h - 3);
1981 1981
             }
1982 1982
             if ($textoFatura !== "" && $this->exibirTextoFatura) {
1983
-                $myH=6;
1983
+                $myH = 6;
1984 1984
                 $myW = $this->wPrint;
1985 1985
                 if ($this->orientacao == 'L') {
1986 1986
                     $myW -= $this->wCanhoto;
1987 1987
                 }
1988 1988
                 $aFont = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>''];
1989 1989
                 $this->pdf->textBox($x, $y, $myW, $myH, $textoFatura, $aFont, 'C', 'L', 1, '');
1990
-                $y+=$myH+1;
1990
+                $y += $myH + 1;
1991 1991
             }
1992 1992
             if ($this->orientacao == 'P') {
1993
-                $w = round($this->wPrint/7.018, 0)-1;
1993
+                $w = round($this->wPrint / 7.018, 0) - 1;
1994 1994
             } else {
1995 1995
                 $w = 28;
1996 1996
             }
1997 1997
             $increm = 1;
1998 1998
             foreach ($this->dup as $k => $d) {
1999
-                $nDup = ! empty($this->dup->item($k)->getElementsByTagName('nDup')->item(0)->nodeValue)
1999
+                $nDup = !empty($this->dup->item($k)->getElementsByTagName('nDup')->item(0)->nodeValue)
2000 2000
                 ? $this->dup->item($k)->getElementsByTagName('nDup')->item(0)->nodeValue
2001 2001
                 : '';
2002
-                $dDup = ! empty($this->dup->item($k)->getElementsByTagName('dVenc')->item(0)->nodeValue)
2002
+                $dDup = !empty($this->dup->item($k)->getElementsByTagName('dVenc')->item(0)->nodeValue)
2003 2003
                 ? $this->ymdTodmy($this->dup->item($k)->getElementsByTagName('dVenc')->item(0)->nodeValue)
2004 2004
                 : '';
2005
-                $vDup = ! empty($this->dup->item($k)->getElementsByTagName('vDup')->item(0)->nodeValue)
2005
+                $vDup = !empty($this->dup->item($k)->getElementsByTagName('vDup')->item(0)->nodeValue)
2006 2006
                 ? 'R$ ' . number_format(
2007 2007
                     $this->dup->item($k)->getElementsByTagName('vDup')->item(0)->nodeValue,
2008 2008
                     2,
@@ -2012,14 +2012,14 @@  discard block
 block discarded – undo
2012 2012
                 : '';
2013 2013
                 $h = 8;
2014 2014
                 $texto = '';
2015
-                if ($nDup!='0' && $nDup!='') {
2015
+                if ($nDup != '0' && $nDup != '') {
2016 2016
                     $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2017 2017
                     $this->pdf->textBox($x, $y, $w, $h, 'Num.', $aFont, 'T', 'L', 1, '');
2018 2018
                     $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
2019 2019
                     $this->pdf->textBox($x, $y, $w, $h, $nDup, $aFont, 'T', 'R', 0, '');
2020 2020
                 } else {
2021 2021
                     $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2022
-                    $this->pdf->textBox($x, $y, $w, $h, ($dupcont+1)."", $aFont, 'T', 'L', 1, '');
2022
+                    $this->pdf->textBox($x, $y, $w, $h, ($dupcont + 1) . "", $aFont, 'T', 'L', 1, '');
2023 2023
                 }
2024 2024
                 $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2025 2025
                 $this->pdf->textBox($x, $y, $w, $h, 'Venc.', $aFont, 'C', 'L', 0, '');
@@ -2029,7 +2029,7 @@  discard block
 block discarded – undo
2029 2029
                 $this->pdf->textBox($x, $y, $w, $h, 'Valor', $aFont, 'B', 'L', 0, '');
2030 2030
                 $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
2031 2031
                 $this->pdf->textBox($x, $y, $w, $h, $vDup, $aFont, 'B', 'R', 0, '');
2032
-                $x += $w+$increm;
2032
+                $x += $w + $increm;
2033 2033
                 $dupcont += 1;
2034 2034
                 if ($this->orientacao == 'P') {
2035 2035
                     $maxDupCont = 6;
@@ -2051,10 +2051,10 @@  discard block
 block discarded – undo
2051 2051
                 $y -= 9;
2052 2052
                 $linha--;
2053 2053
             }
2054
-            return ($y+$h);
2054
+            return ($y + $h);
2055 2055
         } else {
2056 2056
             $linha = 0;
2057
-            return ($y-2);
2057
+            return ($y - 2);
2058 2058
         }
2059 2059
     }
2060 2060
 
@@ -2070,7 +2070,7 @@  discard block
 block discarded – undo
2070 2070
     protected function pagamento($x, $y)
2071 2071
     {
2072 2072
         $linha = 1;
2073
-        $h = 8+3;
2073
+        $h = 8 + 3;
2074 2074
         $oldx = $x;
2075 2075
         //verificar se existem cobranças definidas
2076 2076
         if (isset($this->detPag) && $this->detPag->length > 0) {
@@ -2089,7 +2089,7 @@  discard block
 block discarded – undo
2089 2089
             $dups = "";
2090 2090
             $dupcont = 0;
2091 2091
             if ($this->orientacao == 'P') {
2092
-                $w = round($this->wPrint/7.018, 0)-1;
2092
+                $w = round($this->wPrint / 7.018, 0) - 1;
2093 2093
             } else {
2094 2094
                 $w = 28;
2095 2095
             }
@@ -2099,17 +2099,17 @@  discard block
 block discarded – undo
2099 2099
                 $maxDupCont = 8;
2100 2100
             }
2101 2101
             $increm = 1;
2102
-            $formaPagamento = ['01'=>'Dinheiro','02'=>'Cheque','03'=>'Cartão de Crédito',
2103
-                                    '04'=>'Cartão de Débito','05'=>'Crédito Loja','10'=>'Vale Alimentação',
2104
-                                    '11'=>'Vale Refeição','12'=>'Vale Presente','13'=>'Vale Combustível',
2105
-                                    '14'=>'Duplicata Mercantil','15'=>'Boleto','90'=>'Sem pagamento','99'=>'Outros'];
2106
-            $bandeira = ['01'=>'Visa','02'=>'Mastercard','03'=>'American','04'=>'Sorocred','05'=>'Diners',
2107
-                              '06'=>'Elo','07'=>'Hipercard','08'=>'Aura','09'=>'Cabal','99'=>'Outros'];
2102
+            $formaPagamento = ['01'=>'Dinheiro', '02'=>'Cheque', '03'=>'Cartão de Crédito',
2103
+                                    '04'=>'Cartão de Débito', '05'=>'Crédito Loja', '10'=>'Vale Alimentação',
2104
+                                    '11'=>'Vale Refeição', '12'=>'Vale Presente', '13'=>'Vale Combustível',
2105
+                                    '14'=>'Duplicata Mercantil', '15'=>'Boleto', '90'=>'Sem pagamento', '99'=>'Outros'];
2106
+            $bandeira = ['01'=>'Visa', '02'=>'Mastercard', '03'=>'American', '04'=>'Sorocred', '05'=>'Diners',
2107
+                              '06'=>'Elo', '07'=>'Hipercard', '08'=>'Aura', '09'=>'Cabal', '99'=>'Outros'];
2108 2108
             foreach ($this->detPag as $k => $d) {
2109 2109
                 $fPag = !empty($this->detPag->item($k)->getElementsByTagName('tPag')->item(0)->nodeValue)
2110 2110
                 ? $this->detPag->item($k)->getElementsByTagName('tPag')->item(0)->nodeValue
2111 2111
                 : '0';
2112
-                $vPag = ! empty($this->detPag->item($k)->getElementsByTagName('vPag')->item(0)->nodeValue)
2112
+                $vPag = !empty($this->detPag->item($k)->getElementsByTagName('vPag')->item(0)->nodeValue)
2113 2113
                 ? 'R$ ' . number_format(
2114 2114
                     $this->detPag->item($k)->getElementsByTagName('vPag')->item(0)->nodeValue,
2115 2115
                     2,
@@ -2121,7 +2121,7 @@  discard block
 block discarded – undo
2121 2121
                 $texto = '';
2122 2122
                 if (isset($formaPagamento[$fPag])) {
2123 2123
                     /*Exibir Item sem pagamento ou outros?*/
2124
-                    if ($fPag=='90' || $fPag=='99') {
2124
+                    if ($fPag == '90' || $fPag == '99') {
2125 2125
                         continue;
2126 2126
                     }
2127 2127
                     $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
@@ -2130,16 +2130,16 @@  discard block
 block discarded – undo
2130 2130
                     $this->pdf->textBox($x, $y, $w, $h, $formaPagamento[$fPag], $aFont, 'T', 'R', 0, '');
2131 2131
                 } else {
2132 2132
                     $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>''];
2133
-                    $this->pdf->textBox($x, $y, $w, $h, "Forma ".$fPag." não encontrado", $aFont, 'T', 'L', 1, '');
2133
+                    $this->pdf->textBox($x, $y, $w, $h, "Forma " . $fPag . " não encontrado", $aFont, 'T', 'L', 1, '');
2134 2134
                 }
2135 2135
                 $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2136 2136
                 $this->pdf->textBox($x, $y, $w, $h, 'Valor', $aFont, 'B', 'L', 0, '');
2137 2137
                 $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
2138 2138
                 $this->pdf->textBox($x, $y, $w, $h, $vPag, $aFont, 'B', 'R', 0, '');
2139
-                $x += $w+$increm;
2139
+                $x += $w + $increm;
2140 2140
                 $dupcont += 1;
2141 2141
 
2142
-                if ($dupcont>$maxDupCont) {
2142
+                if ($dupcont > $maxDupCont) {
2143 2143
                     $y += 9;
2144 2144
                     $x = $oldx;
2145 2145
                     $dupcont = 0;
@@ -2154,10 +2154,10 @@  discard block
 block discarded – undo
2154 2154
                 $y -= 9;
2155 2155
                 $linha--;
2156 2156
             }
2157
-            return ($y+$h);
2157
+            return ($y + $h);
2158 2158
         } else {
2159 2159
             $linha = 0;
2160
-            return ($y-2);
2160
+            return ($y - 2);
2161 2161
         }
2162 2162
     } //fim da função pagamento
2163 2163
     
@@ -2269,7 +2269,7 @@  discard block
 block discarded – undo
2269 2269
         }
2270 2270
         $x = $this->impostoHelper($x, $y, $w, $h, "V. TOTAL DA NOTA", "vNF");
2271 2271
 
2272
-        return ($y+$h);
2272
+        return ($y + $h);
2273 2273
     } //fim imposto
2274 2274
 
2275 2275
     /**
@@ -2297,13 +2297,13 @@  discard block
 block discarded – undo
2297 2297
         $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
2298 2298
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
2299 2299
         //NOME / RAZÃO SOCIAL
2300
-        $w1 = $maxW*0.29;
2300
+        $w1 = $maxW * 0.29;
2301 2301
         $y += 3;
2302 2302
         $texto = 'NOME / RAZÃO SOCIAL';
2303 2303
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2304 2304
         $this->pdf->textBox($x, $y, $w1, $h, $texto, $aFont, 'T', 'L', 1, '');
2305 2305
         if (isset($this->transporta)) {
2306
-            $texto = ! empty($this->transporta->getElementsByTagName("xNome")->item(0)->nodeValue)
2306
+            $texto = !empty($this->transporta->getElementsByTagName("xNome")->item(0)->nodeValue)
2307 2307
             ? $this->transporta->getElementsByTagName("xNome")->item(0)->nodeValue
2308 2308
             : '';
2309 2309
         } else {
@@ -2313,11 +2313,11 @@  discard block
 block discarded – undo
2313 2313
         $this->pdf->textBox($x, $y, $w1, $h, $texto, $aFont, 'B', 'L', 0, '');
2314 2314
         //FRETE POR CONTA
2315 2315
         $x += $w1;
2316
-        $w2 = $maxW*0.15;
2316
+        $w2 = $maxW * 0.15;
2317 2317
         $texto = 'FRETE';
2318 2318
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2319 2319
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
2320
-        $tipoFrete = ! empty($this->transp->getElementsByTagName("modFrete")->item(0)->nodeValue)
2320
+        $tipoFrete = !empty($this->transp->getElementsByTagName("modFrete")->item(0)->nodeValue)
2321 2321
         ? $this->transp->getElementsByTagName("modFrete")->item(0)->nodeValue
2322 2322
         : '0';
2323 2323
         switch ($tipoFrete) {
@@ -2348,7 +2348,7 @@  discard block
 block discarded – undo
2348 2348
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2349 2349
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
2350 2350
         if (isset($this->veicTransp)) {
2351
-            $texto = ! empty($this->veicTransp->getElementsByTagName("RNTC")->item(0)->nodeValue)
2351
+            $texto = !empty($this->veicTransp->getElementsByTagName("RNTC")->item(0)->nodeValue)
2352 2352
             ? $this->veicTransp->getElementsByTagName("RNTC")->item(0)->nodeValue
2353 2353
             : '';
2354 2354
         } else {
@@ -2362,11 +2362,11 @@  discard block
 block discarded – undo
2362 2362
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2363 2363
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
2364 2364
         if (isset($this->veicTransp)) {
2365
-            $texto = ! empty($this->veicTransp->getElementsByTagName("placa")->item(0)->nodeValue)
2365
+            $texto = !empty($this->veicTransp->getElementsByTagName("placa")->item(0)->nodeValue)
2366 2366
             ? $this->veicTransp->getElementsByTagName("placa")->item(0)->nodeValue
2367 2367
             : '';
2368 2368
         } elseif (isset($this->reboque)) {
2369
-            $texto = ! empty($this->reboque->getElementsByTagName("placa")->item(0)->nodeValue)
2369
+            $texto = !empty($this->reboque->getElementsByTagName("placa")->item(0)->nodeValue)
2370 2370
             ? $this->reboque->getElementsByTagName("placa")->item(0)->nodeValue
2371 2371
             : '';
2372 2372
         } else {
@@ -2376,16 +2376,16 @@  discard block
 block discarded – undo
2376 2376
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'B', 'C', 0, '');
2377 2377
         //UF
2378 2378
         $x += $w2;
2379
-        $w3 = round($maxW*0.04, 0);
2379
+        $w3 = round($maxW * 0.04, 0);
2380 2380
         $texto = 'UF';
2381 2381
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2382 2382
         $this->pdf->textBox($x, $y, $w3, $h, $texto, $aFont, 'T', 'L', 1, '');
2383 2383
         if (isset($this->veicTransp)) {
2384
-            $texto = ! empty($this->veicTransp->getElementsByTagName("UF")->item(0)->nodeValue)
2384
+            $texto = !empty($this->veicTransp->getElementsByTagName("UF")->item(0)->nodeValue)
2385 2385
             ? $this->veicTransp->getElementsByTagName("UF")->item(0)->nodeValue
2386 2386
             : '';
2387 2387
         } elseif (isset($this->reboque)) {
2388
-            $texto = ! empty($this->reboque->getElementsByTagName("UF")->item(0)->nodeValue)
2388
+            $texto = !empty($this->reboque->getElementsByTagName("UF")->item(0)->nodeValue)
2389 2389
             ? $this->reboque->getElementsByTagName("UF")->item(0)->nodeValue
2390 2390
             : '';
2391 2391
         } else {
@@ -2395,19 +2395,19 @@  discard block
 block discarded – undo
2395 2395
         $this->pdf->textBox($x, $y, $w3, $h, $texto, $aFont, 'B', 'C', 0, '');
2396 2396
         //CNPJ / CPF
2397 2397
         $x += $w3;
2398
-        $w = $maxW-($w1+3*$w2+$w3);
2398
+        $w = $maxW - ($w1 + 3 * $w2 + $w3);
2399 2399
         $texto = 'CNPJ / CPF';
2400 2400
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2401 2401
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
2402 2402
         if (isset($this->transporta)) {
2403
-            $texto = ! empty($this->transporta->getElementsByTagName("CNPJ")->item(0)->nodeValue)
2403
+            $texto = !empty($this->transporta->getElementsByTagName("CNPJ")->item(0)->nodeValue)
2404 2404
             ? $this->formatField(
2405 2405
                 $this->transporta->getElementsByTagName("CNPJ")->item(0)->nodeValue,
2406 2406
                 "##.###.###/####-##"
2407 2407
             )
2408 2408
             : '';
2409 2409
             if ($texto == '') {
2410
-                $texto = ! empty($this->transporta->getElementsByTagName("CPF")->item(0)->nodeValue)
2410
+                $texto = !empty($this->transporta->getElementsByTagName("CPF")->item(0)->nodeValue)
2411 2411
                 ? $this->formatField(
2412 2412
                     $this->transporta->getElementsByTagName("CPF")->item(0)->nodeValue,
2413 2413
                     "###.###.###-##"
@@ -2424,12 +2424,12 @@  discard block
 block discarded – undo
2424 2424
         $y += $h;
2425 2425
         $x = $oldX;
2426 2426
         $h = 7;
2427
-        $w1 = $maxW*0.44;
2427
+        $w1 = $maxW * 0.44;
2428 2428
         $texto = 'ENDEREÇO';
2429 2429
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2430 2430
         $this->pdf->textBox($x, $y, $w1, $h, $texto, $aFont, 'T', 'L', 1, '');
2431 2431
         if (isset($this->transporta)) {
2432
-            $texto = ! empty($this->transporta->getElementsByTagName("xEnder")->item(0)->nodeValue)
2432
+            $texto = !empty($this->transporta->getElementsByTagName("xEnder")->item(0)->nodeValue)
2433 2433
                 ? $this->transporta->getElementsByTagName("xEnder")->item(0)->nodeValue
2434 2434
                 : '';
2435 2435
         } else {
@@ -2439,12 +2439,12 @@  discard block
 block discarded – undo
2439 2439
         $this->pdf->textBox($x, $y, $w1, $h, $texto, $aFont, 'B', 'L', 0, '');
2440 2440
         //MUNICÍPIO
2441 2441
         $x += $w1;
2442
-        $w2 = round($maxW*0.30, 0);
2442
+        $w2 = round($maxW * 0.30, 0);
2443 2443
         $texto = 'MUNICÍPIO';
2444 2444
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2445 2445
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
2446 2446
         if (isset($this->transporta)) {
2447
-            $texto = ! empty($this->transporta->getElementsByTagName("xMun")->item(0)->nodeValue)
2447
+            $texto = !empty($this->transporta->getElementsByTagName("xMun")->item(0)->nodeValue)
2448 2448
                 ? $this->transporta->getElementsByTagName("xMun")->item(0)->nodeValue
2449 2449
                 : '';
2450 2450
         } else {
@@ -2454,12 +2454,12 @@  discard block
 block discarded – undo
2454 2454
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'B', 'C', 0, '');
2455 2455
         //UF
2456 2456
         $x += $w2;
2457
-        $w3 = round($maxW*0.04, 0);
2457
+        $w3 = round($maxW * 0.04, 0);
2458 2458
         $texto = 'UF';
2459 2459
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2460 2460
         $this->pdf->textBox($x, $y, $w3, $h, $texto, $aFont, 'T', 'L', 1, '');
2461 2461
         if (isset($this->transporta)) {
2462
-            $texto = ! empty($this->transporta->getElementsByTagName("UF")->item(0)->nodeValue)
2462
+            $texto = !empty($this->transporta->getElementsByTagName("UF")->item(0)->nodeValue)
2463 2463
                 ? $this->transporta->getElementsByTagName("UF")->item(0)->nodeValue
2464 2464
                 : '';
2465 2465
         } else {
@@ -2469,13 +2469,13 @@  discard block
 block discarded – undo
2469 2469
         $this->pdf->textBox($x, $y, $w3, $h, $texto, $aFont, 'B', 'C', 0, '');
2470 2470
         //INSCRIÇÃO ESTADUAL
2471 2471
         $x += $w3;
2472
-        $w = $maxW-($w1+$w2+$w3);
2472
+        $w = $maxW - ($w1 + $w2 + $w3);
2473 2473
         $texto = 'INSCRIÇÃO ESTADUAL';
2474 2474
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2475 2475
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
2476 2476
         $texto = '';
2477 2477
         if (isset($this->transporta)) {
2478
-            if (! empty($this->transporta->getElementsByTagName("IE")->item(0)->nodeValue)) {
2478
+            if (!empty($this->transporta->getElementsByTagName("IE")->item(0)->nodeValue)) {
2479 2479
                 $texto = $this->transporta->getElementsByTagName("IE")->item(0)->nodeValue;
2480 2480
             }
2481 2481
         }
@@ -2488,16 +2488,16 @@  discard block
 block discarded – undo
2488 2488
         $marca = '';
2489 2489
         $numero = '';
2490 2490
         $texto = '';
2491
-        $pesoBruto=0;
2492
-        $pesoLiquido=0;
2491
+        $pesoBruto = 0;
2492
+        $pesoLiquido = 0;
2493 2493
         foreach ($volumes as $volume) {
2494
-            $quantidade += ! empty($volume->getElementsByTagName("qVol")->item(0)->nodeValue) ?
2494
+            $quantidade += !empty($volume->getElementsByTagName("qVol")->item(0)->nodeValue) ?
2495 2495
                     $volume->getElementsByTagName("qVol")->item(0)->nodeValue : 0;
2496
-            $pesoBruto += ! empty($volume->getElementsByTagName("pesoB")->item(0)->nodeValue) ?
2496
+            $pesoBruto += !empty($volume->getElementsByTagName("pesoB")->item(0)->nodeValue) ?
2497 2497
                     $volume->getElementsByTagName("pesoB")->item(0)->nodeValue : 0;
2498
-            $pesoLiquido += ! empty($volume->getElementsByTagName("pesoL")->item(0)->nodeValue) ?
2498
+            $pesoLiquido += !empty($volume->getElementsByTagName("pesoL")->item(0)->nodeValue) ?
2499 2499
                     $volume->getElementsByTagName("pesoL")->item(0)->nodeValue : 0;
2500
-            $texto = ! empty($this->transp->getElementsByTagName("esp")->item(0)->nodeValue) ?
2500
+            $texto = !empty($this->transp->getElementsByTagName("esp")->item(0)->nodeValue) ?
2501 2501
                     $this->transp->getElementsByTagName("esp")->item(0)->nodeValue : '';
2502 2502
             if ($texto != $especie && $especie != '') {
2503 2503
                 //tem várias especies
@@ -2505,7 +2505,7 @@  discard block
 block discarded – undo
2505 2505
             } else {
2506 2506
                 $especie = $texto;
2507 2507
             }
2508
-            $texto = ! empty($this->transp->getElementsByTagName("marca")->item(0)->nodeValue)
2508
+            $texto = !empty($this->transp->getElementsByTagName("marca")->item(0)->nodeValue)
2509 2509
                 ? $this->transp->getElementsByTagName("marca")->item(0)->nodeValue
2510 2510
                 : '';
2511 2511
             if ($texto != $marca && $marca != '') {
@@ -2514,7 +2514,7 @@  discard block
 block discarded – undo
2514 2514
             } else {
2515 2515
                 $marca = $texto;
2516 2516
             }
2517
-            $texto = ! empty($this->transp->getElementsByTagName("nVol")->item(0)->nodeValue)
2517
+            $texto = !empty($this->transp->getElementsByTagName("nVol")->item(0)->nodeValue)
2518 2518
                 ? $this->transp->getElementsByTagName("nVol")->item(0)->nodeValue
2519 2519
                 : '';
2520 2520
             if ($texto != $numero && $numero != '') {
@@ -2530,7 +2530,7 @@  discard block
 block discarded – undo
2530 2530
         $y += $h;
2531 2531
         $x = $oldX;
2532 2532
         $h = 7;
2533
-        $w1 = round($maxW*0.10, 0);
2533
+        $w1 = round($maxW * 0.10, 0);
2534 2534
         $texto = 'QUANTIDADE';
2535 2535
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2536 2536
         $this->pdf->textBox($x, $y, $w1, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -2541,7 +2541,7 @@  discard block
 block discarded – undo
2541 2541
         }
2542 2542
         //ESPÉCIE
2543 2543
         $x += $w1;
2544
-        $w2 = round($maxW*0.17, 0);
2544
+        $w2 = round($maxW * 0.17, 0);
2545 2545
         $texto = 'ESPÉCIE';
2546 2546
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2547 2547
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -2553,7 +2553,7 @@  discard block
 block discarded – undo
2553 2553
         $texto = 'MARCA';
2554 2554
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2555 2555
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
2556
-        $texto = ! empty($this->transp->getElementsByTagName("marca")->item(0)->nodeValue) ?
2556
+        $texto = !empty($this->transp->getElementsByTagName("marca")->item(0)->nodeValue) ?
2557 2557
                 $this->transp->getElementsByTagName("marca")->item(0)->nodeValue : '';
2558 2558
         $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'];
2559 2559
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'B', 'C', 0, '');
@@ -2567,7 +2567,7 @@  discard block
 block discarded – undo
2567 2567
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'B', 'C', 0, '');
2568 2568
         //PESO BRUTO
2569 2569
         $x += $w2;
2570
-        $w3 = round($maxW*0.20, 0);
2570
+        $w3 = round($maxW * 0.20, 0);
2571 2571
         $texto = 'PESO BRUTO';
2572 2572
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2573 2573
         $this->pdf->textBox($x, $y, $w3, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -2580,7 +2580,7 @@  discard block
 block discarded – undo
2580 2580
         $this->pdf->textBox($x, $y, $w3, $h, $texto, $aFont, 'B', 'R', 0, '');
2581 2581
         //PESO LÍQUIDO
2582 2582
         $x += $w3;
2583
-        $w = $maxW -($w1+3*$w2+$w3);
2583
+        $w = $maxW - ($w1 + 3 * $w2 + $w3);
2584 2584
         $texto = 'PESO LÍQUIDO';
2585 2585
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2586 2586
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -2591,7 +2591,7 @@  discard block
 block discarded – undo
2591 2591
         }
2592 2592
         $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'];
2593 2593
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'R', 0, '');
2594
-        return ($y+$h);
2594
+        return ($y + $h);
2595 2595
     } //fim transporte
2596 2596
 
2597 2597
 
@@ -2603,7 +2603,7 @@  discard block
 block discarded – undo
2603 2603
             return "";
2604 2604
         }
2605 2605
         $valor_original = $valor_original->nodeValue;
2606
-        $valor = ! empty($valor_original) ? number_format($valor_original, 2, ",", ".") : '';
2606
+        $valor = !empty($valor_original) ? number_format($valor_original, 2, ",", ".") : '';
2607 2607
 
2608 2608
         if ($valor != "") {
2609 2609
             return sprintf($formato, $valor);
@@ -2650,18 +2650,18 @@  discard block
 block discarded – undo
2650 2650
             $impostos .= $this->descricaoProdutoHelper($ICMSUFDest, "vICMSUFDest", " vICMSUFDest=%s");
2651 2651
             $impostos .= $this->descricaoProdutoHelper($ICMSUFDest, "vICMSUFRemet", " vICMSUFRemet=%s");
2652 2652
         }
2653
-        $infAdProd = ! empty($itemProd->getElementsByTagName('infAdProd')->item(0)->nodeValue)
2653
+        $infAdProd = !empty($itemProd->getElementsByTagName('infAdProd')->item(0)->nodeValue)
2654 2654
         ? substr(
2655 2655
             $this->anfaveaDANFE($itemProd->getElementsByTagName('infAdProd')->item(0)->nodeValue),
2656 2656
             0,
2657 2657
             500
2658 2658
         )
2659 2659
         : '';
2660
-        if (! empty($infAdProd)) {
2660
+        if (!empty($infAdProd)) {
2661 2661
             $infAdProd = trim($infAdProd);
2662 2662
             $infAdProd .= ' ';
2663 2663
         }
2664
-        $loteTxt ='';
2664
+        $loteTxt = '';
2665 2665
         $rastro = $prod->getElementsByTagName("med");
2666 2666
         if (!empty($prod->getElementsByTagName("rastro"))) {
2667 2667
             $rastro = $prod->getElementsByTagName("rastro");
@@ -2675,15 +2675,15 @@  discard block
 block discarded – undo
2675 2675
                 $i++;
2676 2676
             }
2677 2677
             if ($loteTxt != '') {
2678
-                $loteTxt.= ' ';
2678
+                $loteTxt .= ' ';
2679 2679
             }
2680 2680
         }
2681 2681
         //NT2013.006 FCI
2682
-        $nFCI = (! empty($itemProd->getElementsByTagName('nFCI')->item(0)->nodeValue)) ?
2683
-                ' FCI:'.$itemProd->getElementsByTagName('nFCI')->item(0)->nodeValue : '';
2684
-        $tmp_ad=$infAdProd . ($this->descProdInfoComplemento ? $loteTxt . $impostos . $nFCI : '');
2682
+        $nFCI = (!empty($itemProd->getElementsByTagName('nFCI')->item(0)->nodeValue)) ?
2683
+                ' FCI:' . $itemProd->getElementsByTagName('nFCI')->item(0)->nodeValue : '';
2684
+        $tmp_ad = $infAdProd . ($this->descProdInfoComplemento ? $loteTxt . $impostos . $nFCI : '');
2685 2685
         $texto = $prod->getElementsByTagName("xProd")->item(0)->nodeValue
2686
-            . (strlen($tmp_ad)!=0?"\n    ".$tmp_ad:'');
2686
+            . (strlen($tmp_ad) != 0 ? "\n    " . $tmp_ad : '');
2687 2687
         //decodifica os caracteres html no xml
2688 2688
         $texto = html_entity_decode($texto);
2689 2689
         if ($this->descProdQuebraLinha) {
@@ -2733,104 +2733,104 @@  discard block
 block discarded – undo
2733 2733
         // cabecalho LOOP COM OS DADOS DOS PRODUTOS
2734 2734
         //CÓDIGO PRODUTO
2735 2735
         $texto = "CÓDIGO PRODUTO";
2736
-        $w1 = round($w*0.09, 0);
2736
+        $w1 = round($w * 0.09, 0);
2737 2737
         $h = 4;
2738 2738
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2739 2739
         $this->pdf->textBox($x, $y, $w1, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2740
-        $this->pdf->line($x+$w1, $y, $x+$w1, $y+$hmax);
2740
+        $this->pdf->line($x + $w1, $y, $x + $w1, $y + $hmax);
2741 2741
         //DESCRIÇÃO DO PRODUTO / SERVIÇO
2742 2742
         $x += $w1;
2743
-        $w2 = round($w*0.28, 0);
2743
+        $w2 = round($w * 0.28, 0);
2744 2744
         $texto = 'DESCRIÇÃO DO PRODUTO / SERVIÇO';
2745 2745
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2746 2746
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2747
-        $this->pdf->line($x+$w2, $y, $x+$w2, $y+$hmax);
2747
+        $this->pdf->line($x + $w2, $y, $x + $w2, $y + $hmax);
2748 2748
         //NCM/SH
2749 2749
         $x += $w2;
2750
-        $w3 = round($w*0.06, 0);
2750
+        $w3 = round($w * 0.06, 0);
2751 2751
         $texto = 'NCM/SH';
2752 2752
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2753 2753
         $this->pdf->textBox($x, $y, $w3, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2754
-        $this->pdf->line($x+$w3, $y, $x+$w3, $y+$hmax);
2754
+        $this->pdf->line($x + $w3, $y, $x + $w3, $y + $hmax);
2755 2755
         //O/CST ou O/CSOSN
2756 2756
         $x += $w3;
2757
-        $w4 = round($w*0.05, 0);
2758
-        $texto = 'O/CSOSN';//Regime do Simples CRT = 1 ou CRT = 2
2757
+        $w4 = round($w * 0.05, 0);
2758
+        $texto = 'O/CSOSN'; //Regime do Simples CRT = 1 ou CRT = 2
2759 2759
         if ($this->getTagValue($this->emit, 'CRT') == '3') {
2760
-             $texto = 'O/CST';//Regime Normal
2760
+             $texto = 'O/CST'; //Regime Normal
2761 2761
         }
2762 2762
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2763 2763
         $this->pdf->textBox($x, $y, $w4, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2764
-        $this->pdf->line($x+$w4, $y, $x+$w4, $y+$hmax);
2764
+        $this->pdf->line($x + $w4, $y, $x + $w4, $y + $hmax);
2765 2765
         //CFOP
2766 2766
         $x += $w4;
2767
-        $w5 = round($w*0.04, 0);
2767
+        $w5 = round($w * 0.04, 0);
2768 2768
         $texto = 'CFOP';
2769 2769
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2770 2770
         $this->pdf->textBox($x, $y, $w5, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2771
-        $this->pdf->line($x+$w5, $y, $x+$w5, $y+$hmax);
2771
+        $this->pdf->line($x + $w5, $y, $x + $w5, $y + $hmax);
2772 2772
         //UN
2773 2773
         $x += $w5;
2774
-        $w6 = round($w*0.03, 0);
2774
+        $w6 = round($w * 0.03, 0);
2775 2775
         $texto = 'UN';
2776 2776
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2777 2777
         $this->pdf->textBox($x, $y, $w6, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2778
-        $this->pdf->line($x+$w6, $y, $x+$w6, $y+$hmax);
2778
+        $this->pdf->line($x + $w6, $y, $x + $w6, $y + $hmax);
2779 2779
         //QUANT
2780 2780
         $x += $w6;
2781
-        $w7 = round($w*0.07, 0);
2781
+        $w7 = round($w * 0.07, 0);
2782 2782
         $texto = 'QUANT';
2783 2783
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2784 2784
         $this->pdf->textBox($x, $y, $w7, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2785
-        $this->pdf->line($x+$w7, $y, $x+$w7, $y+$hmax);
2785
+        $this->pdf->line($x + $w7, $y, $x + $w7, $y + $hmax);
2786 2786
         //VALOR UNIT
2787 2787
         $x += $w7;
2788
-        $w8 = round($w*0.06, 0);
2788
+        $w8 = round($w * 0.06, 0);
2789 2789
         $texto = 'VALOR UNIT';
2790 2790
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2791 2791
         $this->pdf->textBox($x, $y, $w8, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2792
-        $this->pdf->line($x+$w8, $y, $x+$w8, $y+$hmax);
2792
+        $this->pdf->line($x + $w8, $y, $x + $w8, $y + $hmax);
2793 2793
         //VALOR TOTAL
2794 2794
         $x += $w8;
2795
-        $w9 = round($w*0.06, 0);
2795
+        $w9 = round($w * 0.06, 0);
2796 2796
         $texto = 'VALOR TOTAL';
2797 2797
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2798 2798
         $this->pdf->textBox($x, $y, $w9, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2799
-        $this->pdf->line($x+$w9, $y, $x+$w9, $y+$hmax);
2799
+        $this->pdf->line($x + $w9, $y, $x + $w9, $y + $hmax);
2800 2800
         //B.CÁLC ICMS
2801 2801
         $x += $w9;
2802
-        $w10 = round($w*0.06, 0);
2802
+        $w10 = round($w * 0.06, 0);
2803 2803
         $texto = 'B.CÁLC ICMS';
2804 2804
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2805 2805
         $this->pdf->textBox($x, $y, $w10, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2806
-        $this->pdf->line($x+$w10, $y, $x+$w10, $y+$hmax);
2806
+        $this->pdf->line($x + $w10, $y, $x + $w10, $y + $hmax);
2807 2807
         //VALOR ICMS
2808 2808
         $x += $w10;
2809
-        $w11 = round($w*0.06, 0);
2809
+        $w11 = round($w * 0.06, 0);
2810 2810
         $texto = 'VALOR ICMS';
2811 2811
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2812 2812
         $this->pdf->textBox($x, $y, $w11, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2813
-        $this->pdf->line($x+$w11, $y, $x+$w11, $y+$hmax);
2813
+        $this->pdf->line($x + $w11, $y, $x + $w11, $y + $hmax);
2814 2814
         //VALOR IPI
2815 2815
         $x += $w11;
2816
-        $w12 = round($w*0.05, 0);
2816
+        $w12 = round($w * 0.05, 0);
2817 2817
         $texto = 'VALOR IPI';
2818 2818
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2819 2819
         $this->pdf->textBox($x, $y, $w12, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2820
-        $this->pdf->line($x+$w12, $y, $x+$w12, $y+$hmax);
2820
+        $this->pdf->line($x + $w12, $y, $x + $w12, $y + $hmax);
2821 2821
         //ALÍQ. ICMS
2822 2822
         $x += $w12;
2823
-        $w13 = round($w*0.035, 0);
2823
+        $w13 = round($w * 0.035, 0);
2824 2824
         $texto = 'ALÍQ. ICMS';
2825 2825
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2826 2826
         $this->pdf->textBox($x, $y, $w13, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2827
-        $this->pdf->line($x+$w13, $y, $x+$w13, $y+$hmax);
2827
+        $this->pdf->line($x + $w13, $y, $x + $w13, $y + $hmax);
2828 2828
         //ALÍQ. IPI
2829 2829
         $x += $w13;
2830
-        $w14 = $w-($w1+$w2+$w3+$w4+$w5+$w6+$w7+$w8+$w9+$w10+$w11+$w12+$w13);
2830
+        $w14 = $w - ($w1 + $w2 + $w3 + $w4 + $w5 + $w6 + $w7 + $w8 + $w9 + $w10 + $w11 + $w12 + $w13);
2831 2831
         $texto = 'ALÍQ. IPI';
2832 2832
         $this->pdf->textBox($x, $y, $w14, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2833
-        $this->pdf->line($oldX, $y+$h+1, $oldX + $w, $y+$h+1);
2833
+        $this->pdf->line($oldX, $y + $h + 1, $oldX + $w, $y + $h + 1);
2834 2834
         $y += 5;
2835 2835
         //##################################################################################
2836 2836
         // LOOP COM OS DADOS DOS PRODUTOS
@@ -2848,7 +2848,7 @@  discard block
 block discarded – undo
2848 2848
                 $textoProduto = trim($this->descricaoProduto($thisItem));
2849 2849
 
2850 2850
                 $linhaDescr = $this->pdf->getNumLines($textoProduto, $w2, $aFont);
2851
-                $h = round(($linhaDescr * $this->pdf->fontSize)+ ($linhaDescr * 0.5), 2);
2851
+                $h = round(($linhaDescr * $this->pdf->fontSize) + ($linhaDescr * 0.5), 2);
2852 2852
                 $hUsado += $h;
2853 2853
 
2854 2854
                 $diffH = $hmax - $hUsado;
@@ -2861,11 +2861,11 @@  discard block
 block discarded – undo
2861 2861
                         break;
2862 2862
                     }
2863 2863
                 }
2864
-                $y_linha=$y+$h;
2864
+                $y_linha = $y + $h;
2865 2865
                 // linha entre itens
2866 2866
                 $this->pdf->dashedHLine($oldX, $y_linha, $w, 0.1, 120);
2867 2867
                 //corrige o x
2868
-                $x=$oldX;
2868
+                $x = $oldX;
2869 2869
                 //codigo do produto
2870 2870
                 $texto = $prod->getElementsByTagName("cProd")->item(0)->nodeValue;
2871 2871
                 $this->pdf->textBox($x, $y, $w1, $h, $texto, $aFont, 'T', 'C', 0, '');
@@ -2878,16 +2878,16 @@  discard block
 block discarded – undo
2878 2878
                 }
2879 2879
                 $x += $w2;
2880 2880
                 //NCM
2881
-                $texto = ! empty($prod->getElementsByTagName("NCM")->item(0)->nodeValue) ?
2881
+                $texto = !empty($prod->getElementsByTagName("NCM")->item(0)->nodeValue) ?
2882 2882
                         $prod->getElementsByTagName("NCM")->item(0)->nodeValue : '';
2883 2883
                 $this->pdf->textBox($x, $y, $w3, $h, $texto, $aFont, 'T', 'C', 0, '');
2884 2884
                 $x += $w3;
2885 2885
                 //CST
2886 2886
                 if (isset($ICMS)) {
2887
-                    $origem =  $this->getTagValue($ICMS, "orig");
2888
-                    $cst =  $this->getTagValue($ICMS, "CST");
2889
-                    $csosn =  $this->getTagValue($ICMS, "CSOSN");
2890
-                    $texto = $origem.$cst.$csosn;
2887
+                    $origem = $this->getTagValue($ICMS, "orig");
2888
+                    $cst = $this->getTagValue($ICMS, "CST");
2889
+                    $csosn = $this->getTagValue($ICMS, "CSOSN");
2890
+                    $texto = $origem . $cst . $csosn;
2891 2891
                     $this->pdf->textBox($x, $y, $w4, $h, $texto, $aFont, 'T', 'C', 0, '');
2892 2892
                 }
2893 2893
                 //CFOP
@@ -2921,7 +2921,7 @@  discard block
 block discarded – undo
2921 2921
                 //Valor da Base de calculo
2922 2922
                 $x += $w9;
2923 2923
                 if (isset($ICMS)) {
2924
-                    $texto = ! empty($ICMS->getElementsByTagName("vBC")->item(0)->nodeValue)
2924
+                    $texto = !empty($ICMS->getElementsByTagName("vBC")->item(0)->nodeValue)
2925 2925
                     ? number_format(
2926 2926
                         $ICMS->getElementsByTagName("vBC")->item(0)->nodeValue,
2927 2927
                         2,
@@ -2934,7 +2934,7 @@  discard block
 block discarded – undo
2934 2934
                 //Valor do ICMS
2935 2935
                 $x += $w10;
2936 2936
                 if (isset($ICMS)) {
2937
-                    $texto = ! empty($ICMS->getElementsByTagName("vICMS")->item(0)->nodeValue)
2937
+                    $texto = !empty($ICMS->getElementsByTagName("vICMS")->item(0)->nodeValue)
2938 2938
                     ? number_format(
2939 2939
                         $ICMS->getElementsByTagName("vICMS")->item(0)->nodeValue,
2940 2940
                         2,
@@ -2947,7 +2947,7 @@  discard block
 block discarded – undo
2947 2947
                 //Valor do IPI
2948 2948
                 $x += $w11;
2949 2949
                 if (isset($IPI)) {
2950
-                    $texto = ! empty($IPI->getElementsByTagName("vIPI")->item(0)->nodeValue)
2950
+                    $texto = !empty($IPI->getElementsByTagName("vIPI")->item(0)->nodeValue)
2951 2951
                     ? number_format(
2952 2952
                         $IPI->getElementsByTagName("vIPI")->item(0)->nodeValue,
2953 2953
                         2,
@@ -2962,7 +2962,7 @@  discard block
 block discarded – undo
2962 2962
                 // %ICMS
2963 2963
                 $x += $w12;
2964 2964
                 if (isset($ICMS)) {
2965
-                    $texto = ! empty($ICMS->getElementsByTagName("pICMS")->item(0)->nodeValue)
2965
+                    $texto = !empty($ICMS->getElementsByTagName("pICMS")->item(0)->nodeValue)
2966 2966
                     ? number_format(
2967 2967
                         $ICMS->getElementsByTagName("pICMS")->item(0)->nodeValue,
2968 2968
                         2,
@@ -2975,7 +2975,7 @@  discard block
 block discarded – undo
2975 2975
                 //%IPI
2976 2976
                 $x += $w13;
2977 2977
                 if (isset($IPI)) {
2978
-                    $texto = ! empty($IPI->getElementsByTagName("pIPI")->item(0)->nodeValue)
2978
+                    $texto = !empty($IPI->getElementsByTagName("pIPI")->item(0)->nodeValue)
2979 2979
                     ? number_format(
2980 2980
                         $IPI->getElementsByTagName("pIPI")->item(0)->nodeValue,
2981 2981
                         2,
@@ -3006,7 +3006,7 @@  discard block
 block discarded – undo
3006 3006
                 $i++;
3007 3007
             }
3008 3008
         }
3009
-        return $oldY+$hmax;
3009
+        return $oldY + $hmax;
3010 3010
     }
3011 3011
 
3012 3012
 
@@ -3040,7 +3040,7 @@  discard block
 block discarded – undo
3040 3040
 
3041 3041
         $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>''];
3042 3042
 
3043
-        $w1 = round($w*0.09, 0);
3043
+        $w1 = round($w * 0.09, 0);
3044 3044
 
3045 3045
         // Tabela Renavam Combustivel
3046 3046
         $renavamCombustivel = [
@@ -3135,54 +3135,54 @@  discard block
 block discarded – undo
3135 3135
 
3136 3136
         $yVeic = $y + $h;
3137 3137
         $texto = 'Chassi: ............: ' . $veiculoChassi;
3138
-        $this->pdf->textBox($x, $yVeic, $w1+40, $h, $texto, $aFont, 'T', 'L', 0, '');
3138
+        $this->pdf->textBox($x, $yVeic, $w1 + 40, $h, $texto, $aFont, 'T', 'L', 0, '');
3139 3139
         $yVeic += $h;
3140 3140
         $texto = 'Cor...................: ' . $veiculoCor;
3141
-        $this->pdf->textBox($x, $yVeic, $w1+40, $h, $texto, $aFont, 'T', 'L', 0, '');
3141
+        $this->pdf->textBox($x, $yVeic, $w1 + 40, $h, $texto, $aFont, 'T', 'L', 0, '');
3142 3142
         $yVeic += $h;
3143 3143
         $texto = 'Cilindrada........: ' . $veiculoCilindrada;
3144
-        $this->pdf->textBox($x, $yVeic, $w1+40, $h, $texto, $aFont, 'T', 'L', 0, '');
3144
+        $this->pdf->textBox($x, $yVeic, $w1 + 40, $h, $texto, $aFont, 'T', 'L', 0, '');
3145 3145
         $yVeic += $h;
3146 3146
         $texto = 'Cmkg...............: ' . $veiculoCmkg;
3147
-        $this->pdf->textBox($x, $yVeic, $w1+40, $h, $texto, $aFont, 'T', 'L', 0, '');
3147
+        $this->pdf->textBox($x, $yVeic, $w1 + 40, $h, $texto, $aFont, 'T', 'L', 0, '');
3148 3148
         $yVeic += $h;
3149 3149
         $texto = 'Tipo.................: ' . ($renavamTiposVeiculos[intval($veiculoTipo)] ?? $veiculoTipo);
3150
-         $this->pdf->textBox($x, $yVeic, $w1+40, $h, $texto, $aFont, 'T', 'L', 0, '');
3150
+         $this->pdf->textBox($x, $yVeic, $w1 + 40, $h, $texto, $aFont, 'T', 'L', 0, '');
3151 3151
         $yVeic = $y + $h;
3152 3152
         $xVeic = $x + 65;
3153 3153
         $texto = 'Nº Motor: .........: ' . $veiculoMotor;
3154
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
3154
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
3155 3155
         $yVeic += $h;
3156 3156
         $texto = 'Renavam...........: ' . $veiculoRenavam;
3157
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
3157
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
3158 3158
         $yVeic += $h;
3159 3159
         $texto = 'HP.....................: ' . $veiculoHp;
3160
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
3160
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
3161 3161
         $yVeic += $h;
3162 3162
         $texto = 'Placa.................: ' . $veiculoPlaca;
3163
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
3163
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
3164 3164
         $yVeic += $h;
3165 3165
         $texto = 'Tipo Pintura......: ' . ($renavamEspecie[intval($veiculoTipoPintura)] ?? $veiculoTipoPintura);
3166
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
3166
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
3167 3167
         $yVeic = $y + $h;
3168 3168
         $xVeic = $xVeic + 55;
3169 3169
         $texto = 'Marca / Modelo.....: ' . $veiculoMarcaModelo;
3170
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
3170
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
3171 3171
         $yVeic += $h;
3172 3172
         $texto = 'Especie..................: ' . ($renavamEspecie[intval($veiculoEspecie)] ?? $veiculoEspecie);
3173
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
3173
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
3174 3174
         $yVeic += $h;
3175 3175
         $texto = 'Combustivel..........: ' . ($renavamCombustivel[intval($veiculoCombustivel)] ?? $veiculoCombustivel);
3176
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
3176
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
3177 3177
         $yVeic += $h;
3178 3178
         $texto = 'Serial.....................: ' . $veiculoSerial;
3179
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
3179
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
3180 3180
         $yVeic += $h;
3181
-        $texto = 'Ano Fab/Mod........: '. $veiculoFabricacao . '/' . $veiculoModelo;
3182
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
3181
+        $texto = 'Ano Fab/Mod........: ' . $veiculoFabricacao . '/' . $veiculoModelo;
3182
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
3183 3183
         $yVeic += $h;
3184
-        $texto = 'Distancia Entre Eixos(mm)..: '. $veiculoDistancia;
3185
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
3184
+        $texto = 'Distancia Entre Eixos(mm)..: ' . $veiculoDistancia;
3185
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
3186 3186
     }
3187 3187
 
3188 3188
     /**
@@ -3206,12 +3206,12 @@  discard block
 block discarded – undo
3206 3206
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
3207 3207
         //INSCRIÇÃO MUNICIPAL
3208 3208
         $y += 3;
3209
-        $w = round($this->wPrint*0.23, 0);
3209
+        $w = round($this->wPrint * 0.23, 0);
3210 3210
         $texto = 'INSCRIÇÃO MUNICIPAL';
3211 3211
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
3212 3212
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
3213 3213
         //inscrição municipal
3214
-        $texto = ! empty($this->emit->getElementsByTagName("IM")->item(0)->nodeValue) ?
3214
+        $texto = !empty($this->emit->getElementsByTagName("IM")->item(0)->nodeValue) ?
3215 3215
                 $this->emit->getElementsByTagName("IM")->item(0)->nodeValue : '';
3216 3216
         $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'];
3217 3217
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 0, '');
@@ -3221,7 +3221,7 @@  discard block
 block discarded – undo
3221 3221
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
3222 3222
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
3223 3223
         if (isset($this->ISSQNtot)) {
3224
-            $texto = ! empty($this->ISSQNtot->getElementsByTagName("vServ")->item(0)->nodeValue) ?
3224
+            $texto = !empty($this->ISSQNtot->getElementsByTagName("vServ")->item(0)->nodeValue) ?
3225 3225
                     $this->ISSQNtot->getElementsByTagName("vServ")->item(0)->nodeValue : '';
3226 3226
             $texto = number_format($texto, 2, ",", ".");
3227 3227
         } else {
@@ -3235,9 +3235,9 @@  discard block
 block discarded – undo
3235 3235
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
3236 3236
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
3237 3237
         if (isset($this->ISSQNtot)) {
3238
-            $texto = ! empty($this->ISSQNtot->getElementsByTagName("vBC")->item(0)->nodeValue) ?
3238
+            $texto = !empty($this->ISSQNtot->getElementsByTagName("vBC")->item(0)->nodeValue) ?
3239 3239
                     $this->ISSQNtot->getElementsByTagName("vBC")->item(0)->nodeValue : '';
3240
-            $texto = ! empty($texto) ? number_format($texto, 2, ",", ".") : '';
3240
+            $texto = !empty($texto) ? number_format($texto, 2, ",", ".") : '';
3241 3241
         } else {
3242 3242
             $texto = '';
3243 3243
         }
@@ -3248,21 +3248,21 @@  discard block
 block discarded – undo
3248 3248
         if ($this->orientacao == 'P') {
3249 3249
             $w = $this->wPrint - (3 * $w);
3250 3250
         } else {
3251
-            $w = $this->wPrint - (3 * $w)-$this->wCanhoto;
3251
+            $w = $this->wPrint - (3 * $w) - $this->wCanhoto;
3252 3252
         }
3253 3253
         $texto = 'VALOR TOTAL DO ISSQN';
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("vISS")->item(0)->nodeValue) ?
3257
+            $texto = !empty($this->ISSQNtot->getElementsByTagName("vISS")->item(0)->nodeValue) ?
3258 3258
                     $this->ISSQNtot->getElementsByTagName("vISS")->item(0)->nodeValue : '';
3259
-            $texto = ! empty($texto) ? number_format($texto, 2, ",", ".") : '';
3259
+            $texto = !empty($texto) ? number_format($texto, 2, ",", ".") : '';
3260 3260
         } else {
3261 3261
             $texto = '';
3262 3262
         }
3263 3263
         $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'];
3264 3264
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'R', 0, '');
3265
-        return ($y+$h+1);
3265
+        return ($y + $h + 1);
3266 3266
     }
3267 3267
 
3268 3268
     /**
@@ -3283,7 +3283,7 @@  discard block
 block discarded – undo
3283 3283
         if ($this->orientacao == 'P') {
3284 3284
               $w = $this->wPrint;
3285 3285
         } else {
3286
-              $w = $this->wPrint-$this->wCanhoto;
3286
+              $w = $this->wPrint - $this->wCanhoto;
3287 3287
         }
3288 3288
         $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
3289 3289
         $this->pdf->textBox($x, $y, $w, 8, $texto, $aFont, 'T', 'L', 0, '');
@@ -3299,7 +3299,7 @@  discard block
 block discarded – undo
3299 3299
         //$this->textoAdic com o texto completo do campo
3300 3300
         $y += 1;
3301 3301
         $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>''];
3302
-        $this->pdf->textBox($x, $y+2, $w-2, $h-3, $this->textoAdic, $aFont, 'T', 'L', 0, '', false);
3302
+        $this->pdf->textBox($x, $y + 2, $w - 2, $h - 3, $this->textoAdic, $aFont, 'T', 'L', 0, '', false);
3303 3303
         //RESERVADO AO FISCO
3304 3304
         $texto = "RESERVADO AO FISCO";
3305 3305
         if ($this->nfeProc->getElementsByTagName("xMsg")) {
@@ -3308,9 +3308,9 @@  discard block
 block discarded – undo
3308 3308
         $x += $w;
3309 3309
         $y -= 1;
3310 3310
         if ($this->orientacao == 'P') {
3311
-            $w = $this->wPrint-$w;
3311
+            $w = $this->wPrint - $w;
3312 3312
         } else {
3313
-            $w = $this->wPrint-$w-$this->wCanhoto;
3313
+            $w = $this->wPrint - $w - $this->wCanhoto;
3314 3314
         }
3315 3315
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>'B'];
3316 3316
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -3349,8 +3349,8 @@  discard block
 block discarded – undo
3349 3349
         }
3350 3350
         $y += 2;
3351 3351
         $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>''];
3352
-        $this->pdf->textBox($x, $y, $w-2, $h-3, $texto, $aFont, 'T', 'L', 0, '', false);
3353
-        return $y+$h;
3352
+        $this->pdf->textBox($x, $y, $w - 2, $h - 3, $texto, $aFont, 'T', 'L', 0, '', false);
3353
+        return $y + $h;
3354 3354
     }
3355 3355
 
3356 3356
     /**
@@ -3369,11 +3369,11 @@  discard block
 block discarded – undo
3369 3369
         if ($this->orientacao == 'P') {
3370 3370
               $w = $this->wPrint;
3371 3371
         } else {
3372
-              $w = $this->wPrint-$this->wCanhoto;
3372
+              $w = $this->wPrint - $this->wCanhoto;
3373 3373
               $x = $this->wCanhoto;
3374 3374
         }
3375 3375
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>'I'];
3376
-        $texto = "Impresso em ". date('d/m/Y') . " as " . date('H:i:s')
3376
+        $texto = "Impresso em " . date('d/m/Y') . " as " . date('H:i:s')
3377 3377
             . '  ' . $this->creditos;
3378 3378
         $this->pdf->textBox($x, $y, $w, 0, $texto, $aFont, 'T', 'L', false);
3379 3379
         $texto = "Powered by NFePHP®";
@@ -3429,9 +3429,9 @@  discard block
 block discarded – undo
3429 3429
         } else {
3430 3430
             //linha separadora do canhoto - 238
3431 3431
             //posicao altura
3432
-            $y = $this->wPrint-85;
3432
+            $y = $this->wPrint - 85;
3433 3433
             //altura
3434
-            $w = $this->wPrint-85-24;
3434
+            $w = $this->wPrint - 85 - 24;
3435 3435
         }
3436 3436
         $h = 10;
3437 3437
         //desenha caixa
@@ -3454,21 +3454,21 @@  discard block
 block discarded – undo
3454 3454
             $texto .= "AO LADO";
3455 3455
         }
3456 3456
         $texto .= ". EMISSÃO: ";
3457
-        $dEmi = ! empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
3457
+        $dEmi = !empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
3458 3458
                 $this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue : '';
3459 3459
         if ($dEmi == '') {
3460
-            $dEmi = ! empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
3460
+            $dEmi = !empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
3461 3461
                     $this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue : '';
3462 3462
             $aDemi = explode('T', $dEmi);
3463 3463
             $dEmi = $aDemi[0];
3464 3464
         }
3465
-        $texto .= $this->ymdTodmy($dEmi) ." ";
3465
+        $texto .= $this->ymdTodmy($dEmi) . " ";
3466 3466
         $texto .= "VALOR TOTAL: R$ ";
3467 3467
         $texto .= number_format($this->ICMSTot->getElementsByTagName("vNF")->item(0)->nodeValue, 2, ",", ".") . " ";
3468 3468
         $texto .= "DESTINATÁRIO: ";
3469 3469
         $texto .= $destinatario;
3470 3470
         if ($this->orientacao == 'P') {
3471
-            $this->pdf->textBox($x, $y, $w-1, $h, $texto, $aFont, 'C', 'L', 0, '', false);
3471
+            $this->pdf->textBox($x, $y, $w - 1, $h, $texto, $aFont, 'C', 'L', 0, '', false);
3472 3472
             $x1 = $x + $w;
3473 3473
             $w1 = $this->wPrint - $w;
3474 3474
             $texto = "NF-e";
@@ -3481,12 +3481,12 @@  discard block
 block discarded – undo
3481 3481
             //DATA DE RECEBIMENTO
3482 3482
             $texto = "DATA DE RECEBIMENTO";
3483 3483
             $y += $h;
3484
-            $w2 = round($this->wPrint*0.17, 0); //35;
3484
+            $w2 = round($this->wPrint * 0.17, 0); //35;
3485 3485
             $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
3486 3486
             $this->pdf->textBox($x, $y, $w2, 8, $texto, $aFont, 'T', 'L', 1, '');
3487 3487
             //IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR
3488 3488
             $x += $w2;
3489
-            $w3 = $w-$w2;
3489
+            $w3 = $w - $w2;
3490 3490
             $texto = "IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR";
3491 3491
             $this->pdf->textBox($x, $y, $w3, 8, $texto, $aFont, 'T', 'L', 1, '');
3492 3492
             $x = $oldX;
@@ -3496,7 +3496,7 @@  discard block
 block discarded – undo
3496 3496
             return $y;
3497 3497
         } else {
3498 3498
             $x--;
3499
-            $x = $this->pdf->textBox90($x, $y, $w-1, $h, $texto, $aFontSmall, 'C', 'L', 0, '', false);
3499
+            $x = $this->pdf->textBox90($x, $y, $w - 1, $h, $texto, $aFontSmall, 'C', 'L', 0, '', false);
3500 3500
             //NUMERO DA NOTA FISCAL LOGO NFE
3501 3501
             $w1 = 18;
3502 3502
             $x1 = $oldX;
@@ -3510,14 +3510,14 @@  discard block
 block discarded – undo
3510 3510
             $this->pdf->textBox($x1, $y, $w1, 18, $texto, $aFont, 'C', 'C', 1, '');
3511 3511
             //DATA DO RECEBIMENTO
3512 3512
             $texto = "DATA DO RECEBIMENTO";
3513
-            $y = $this->wPrint-85;
3513
+            $y = $this->wPrint - 85;
3514 3514
             $x = 12;
3515
-            $w2 = round($this->wPrint*0.17, 0); //35;
3515
+            $w2 = round($this->wPrint * 0.17, 0); //35;
3516 3516
             $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
3517 3517
             $this->pdf->textBox90($x, $y, $w2, 8, $texto, $aFont, 'T', 'L', 1, '');
3518 3518
             //IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR
3519 3519
             $y -= $w2;
3520
-            $w3 = $w-$w2;
3520
+            $w3 = $w - $w2;
3521 3521
             $texto = "IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR";
3522 3522
             $aFont = ['font'=>$this->fontePadrao, 'size'=>5.7, 'style'=>''];
3523 3523
             $x = $this->pdf->textBox90($x, $y, $w3, 8, $texto, $aFont, 'T', 'L', 1, '');
@@ -3538,13 +3538,13 @@  discard block
 block discarded – undo
3538 3538
     {
3539 3539
         $saida = "";
3540 3540
         if (isset($this->compra)) {
3541
-            if (! empty($this->compra->getElementsByTagName("xNEmp")->item(0)->nodeValue)) {
3541
+            if (!empty($this->compra->getElementsByTagName("xNEmp")->item(0)->nodeValue)) {
3542 3542
                 $saida .= " Nota de Empenho: " . $this->compra->getElementsByTagName("xNEmp")->item(0)->nodeValue;
3543 3543
             }
3544
-            if (! empty($this->compra->getElementsByTagName("xPed")->item(0)->nodeValue)) {
3544
+            if (!empty($this->compra->getElementsByTagName("xPed")->item(0)->nodeValue)) {
3545 3545
                 $saida .= " Pedido: " . $this->compra->getElementsByTagName("xPed")->item(0)->nodeValue;
3546 3546
             }
3547
-            if (! empty($this->compra->getElementsByTagName("xCont")->item(0)->nodeValue)) {
3547
+            if (!empty($this->compra->getElementsByTagName("xCont")->item(0)->nodeValue)) {
3548 3548
                 $saida .= " Contrato: " . $this->compra->getElementsByTagName("xCont")->item(0)->nodeValue;
3549 3549
             }
3550 3550
         }
@@ -3570,21 +3570,21 @@  discard block
 block discarded – undo
3570 3570
         if ($vICMS > 0) {
3571 3571
             $vICMS = 1;
3572 3572
         }
3573
-        $icmss  = $this->ICMSTot->getElementsByTagName("vBC")->item(0)->nodeValue;
3573
+        $icmss = $this->ICMSTot->getElementsByTagName("vBC")->item(0)->nodeValue;
3574 3574
         if ($icmss > 0) {
3575 3575
             $icmss = 1;
3576 3576
         }
3577
-        $dEmi = ! empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
3577
+        $dEmi = !empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
3578 3578
                 $this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue : '';
3579 3579
         if ($dEmi == '') {
3580
-            $dEmi = ! empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
3580
+            $dEmi = !empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
3581 3581
                     $this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue : '';
3582 3582
             $aDemi = explode('T', $dEmi);
3583 3583
             $dEmi = $aDemi[0];
3584 3584
         }
3585 3585
         $dd  = $dEmi;
3586 3586
         $rpos = strrpos($dd, '-');
3587
-        $dd  = substr($dd, $rpos +1);
3587
+        $dd  = substr($dd, $rpos + 1);
3588 3588
         $chave = sprintf($forma, $cUF, $this->tpEmis, $CNPJ, $vNF, $vICMS, $icmss, $dd);
3589 3589
         $chave = $chave . $this->modulo11($chave);
3590 3590
         return $chave;
@@ -3605,7 +3605,7 @@  discard block
 block discarded – undo
3605 3605
         $formaNfRef = "\r\nNF  Ref.: série:%d numero:%d emit:%s em %s modelo: %d";
3606 3606
         $formaECFRef = "\r\nECF Ref.: modelo: %s ECF:%d COO:%d";
3607 3607
         $formaNfpRef = "\r\nNFP Ref.: série:%d número:%d emit:%s em %s modelo: %d IE:%s";
3608
-        $saida='';
3608
+        $saida = '';
3609 3609
         $nfRefs = $this->ide->getElementsByTagName('NFref');
3610 3610
         if (0 === $nfRefs->length) {
3611 3611
             return $saida;
@@ -3621,7 +3621,7 @@  discard block
 block discarded – undo
3621 3621
             foreach ($refNFe as $chave_acessoRef) {
3622 3622
                 $chave_acesso = $chave_acessoRef->nodeValue;
3623 3623
                 $chave_acessoF = $this->formatField($chave_acesso, $this->formatoChave);
3624
-                $data = substr($chave_acesso, 4, 2)."/20".substr($chave_acesso, 2, 2);
3624
+                $data = substr($chave_acesso, 4, 2) . "/20" . substr($chave_acesso, 2, 2);
3625 3625
                 $cnpj = $this->formatField(substr($chave_acesso, 6, 14), "##.###.###/####-##");
3626 3626
                 $serie  = substr($chave_acesso, 22, 3);
3627 3627
                 $numero = substr($chave_acesso, 25, 9);
@@ -3642,7 +3642,7 @@  discard block
 block discarded – undo
3642 3642
             foreach ($refCTe as $chave_acessoRef) {
3643 3643
                 $chave_acesso = $chave_acessoRef->nodeValue;
3644 3644
                 $chave_acessoF = $this->formatField($chave_acesso, $this->formatoChave);
3645
-                $data = substr($chave_acesso, 4, 2)."/20".substr($chave_acesso, 2, 2);
3645
+                $data = substr($chave_acesso, 4, 2) . "/20" . substr($chave_acesso, 2, 2);
3646 3646
                 $cnpj = $this->formatField(substr($chave_acesso, 6, 14), "##.###.###/####-##");
3647 3647
                 $serie  = substr($chave_acesso, 22, 3);
3648 3648
                 $numero = substr($chave_acesso, 25, 9);
@@ -3658,10 +3658,9 @@  discard block
 block discarded – undo
3658 3658
             $refNFP = $nfRef->getElementsByTagName('refNFP');
3659 3659
             foreach ($refNFP as $umaRefNFe) {
3660 3660
                 $data = $umaRefNFe->getElementsByTagName('AAMM')->item(0)->nodeValue;
3661
-                $cnpj = ! empty($umaRefNFe->getElementsByTagName('CNPJ')->item(0)->nodeValue) ?
3662
-                    $umaRefNFe->getElementsByTagName('CNPJ')->item(0)->nodeValue :
3663
-                    '';
3664
-                $cpf = ! empty($umaRefNFe->getElementsByTagName('CPF')->item(0)->nodeValue) ?
3661
+                $cnpj = !empty($umaRefNFe->getElementsByTagName('CNPJ')->item(0)->nodeValue) ?
3662
+                    $umaRefNFe->getElementsByTagName('CNPJ')->item(0)->nodeValue : '';
3663
+                $cpf = !empty($umaRefNFe->getElementsByTagName('CPF')->item(0)->nodeValue) ?
3665 3664
                         $umaRefNFe->getElementsByTagName('CPF')->item(0)->nodeValue : '';
3666 3665
                 $mod = $umaRefNFe->getElementsByTagName('mod')->item(0)->nodeValue;
3667 3666
                 $serie = $umaRefNFe->getElementsByTagName('serie')->item(0)->nodeValue;
@@ -3726,6 +3725,6 @@  discard block
 block discarded – undo
3726 3725
         imagedestroy($image);
3727 3726
         $stringdata = ob_get_contents(); // read from buffer
3728 3727
         ob_end_clean();
3729
-        return 'data://text/plain;base64,'.base64_encode($stringdata);
3728
+        return 'data://text/plain;base64,' . base64_encode($stringdata);
3730 3729
     }
3731 3730
 }
Please login to merge, or discard this patch.