Passed
Push — master ( 4100b8...b04b3d )
by Roberto
02:50 queued 11s
created
src/NFe/Danfce.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,6 @@
 block discarded – undo
13 13
  * @link      http://github.com/nfephp-org/sped-da for the canonical source repository
14 14
  * @author    Roberto Spadim <roberto at spadim dot com dot br>
15 15
  */
16
-use Exception;
17 16
 use InvalidArgumentException;
18 17
 use NFePHP\DA\Legacy\Dom;
19 18
 use NFePHP\DA\Legacy\Pdf;
Please login to merge, or discard this patch.
Spacing   +79 added lines, -79 removed lines patch added patch discarded remove patch
@@ -25,11 +25,11 @@  discard block
 block discarded – undo
25 25
 {
26 26
     protected $papel;
27 27
     protected $xml; // string XML NFe
28
-    protected $logomarca=''; // path para logomarca em jpg
29
-    protected $formatoChave="#### #### #### #### #### #### #### #### #### #### ####";
30
-    protected $debugMode=0; //ativa ou desativa o modo de debug
28
+    protected $logomarca = ''; // path para logomarca em jpg
29
+    protected $formatoChave = "#### #### #### #### #### #### #### #### #### #### ####";
30
+    protected $debugMode = 0; //ativa ou desativa o modo de debug
31 31
     protected $tpImp; //ambiente
32
-    protected $fontePadrao='Times';
32
+    protected $fontePadrao = 'Times';
33 33
     protected $nfeProc;
34 34
     protected $nfe;
35 35
     protected $infNFe;
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
         $this->textoAdic = '';
168 168
         if (isset($this->infAdic)) {
169 169
             $this->textoAdic .= !empty($this->infAdic->getElementsByTagName('infCpl')->item(0)->nodeValue) ?
170
-            'Inf. Contribuinte: '.
170
+            'Inf. Contribuinte: ' .
171 171
             trim($this->anfaveaDANFE($this->infAdic->getElementsByTagName('infCpl')->item(0)->nodeValue)) : '';
172 172
             if (!empty($this->textoAdic)) {
173 173
                 $this->textoAdic = str_replace(";", "\n", $this->textoAdic);
@@ -216,10 +216,10 @@  discard block
 block discarded – undo
216 216
         //total inicial de paginas
217 217
         $totPag = 1;
218 218
         //largura imprimivel em mm: largura da folha menos as margens esq/direita
219
-        $this->wPrint = $maxW-($margEsq*2);
219
+        $this->wPrint = $maxW - ($margEsq * 2);
220 220
         //comprimento (altura) imprimivel em mm: altura da folha menos as margens
221 221
         //superior e inferior
222
-        $this->hPrint = $maxH-$margSup-$margInf;
222
+        $this->hPrint = $maxH - $margSup - $margInf;
223 223
         // estabelece contagem de paginas
224 224
         $this->pdf->aliasNbPages();
225 225
         $this->pdf->setMargins($margEsq, $margSup); // fixa as margens
@@ -230,11 +230,11 @@  discard block
 block discarded – undo
230 230
         $this->pdf->setLineWidth(0.1); // define a largura da linha
231 231
         $this->pdf->setTextColor(0, 0, 0);
232 232
         $this->pdf->textBox(0, 0, $maxW, $maxH); // POR QUE PRECISO DESA LINHA?
233
-        $hcabecalho = 27;//para cabeçalho (dados emitente mais logomarca)  (FIXO)
234
-        $hcabecalhoSecundario = 10 + 3;//para cabeçalho secundário (cabeçalho sefaz) (FIXO)
235
-        $hprodutos = $hLinha + ($qtdItens * $hMaxLinha) ;//box poduto
233
+        $hcabecalho = 27; //para cabeçalho (dados emitente mais logomarca)  (FIXO)
234
+        $hcabecalhoSecundario = 10 + 3; //para cabeçalho secundário (cabeçalho sefaz) (FIXO)
235
+        $hprodutos = $hLinha + ($qtdItens * $hMaxLinha); //box poduto
236 236
         $hTotal = 12; //box total (FIXO)
237
-        $hpagamentos = $hLinha + ($qtdPgto * $hLinha) + 3;//para pagamentos
237
+        $hpagamentos = $hLinha + ($qtdPgto * $hLinha) + 3; //para pagamentos
238 238
         if (!empty($this->vTroco)) {
239 239
             $hpagamentos += $hLinha;
240 240
         }
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
         $y = $xInic + $hcabecalho + $hcabecalhoSecundario + $hprodutos + $hTotal;
268 268
         $y = $this->pagamentosDANFE($x, $y, $hpagamentos);
269 269
         //COLOCA MENSAGEM FISCAL
270
-        $y = $xInic + $hcabecalho + $hcabecalhoSecundario + $hprodutos + $hTotal+ $hpagamentos;
270
+        $y = $xInic + $hcabecalho + $hcabecalhoSecundario + $hprodutos + $hTotal + $hpagamentos;
271 271
         $y = $this->fiscalDANFE($x, $y, $hmsgfiscal);
272 272
         //COLOCA CONSUMIDOR
273 273
         $y = $xInic + $hcabecalho + $hcabecalhoSecundario + $hprodutos + $hTotal + $hpagamentos + $hmsgfiscal;
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
         }
287 287
         
288 288
         //retorna o ID na NFe
289
-        if ($classPdf!==false) {
289
+        if ($classPdf !== false) {
290 290
             $aR = [
291 291
              'id'=>str_replace('NFe', '', $this->infNFe->getAttribute("Id")),
292 292
              'classe_PDF'=>$this->pdf
@@ -306,14 +306,14 @@  discard block
 block discarded – undo
306 306
         $emitIM     = $this->getTagValue($this->emit, "IM");
307 307
         $emitFone = $this->getTagValue($this->enderEmit, "fone");
308 308
         $foneLen = strlen($emitFone);
309
-        if ($foneLen>0) {
309
+        if ($foneLen > 0) {
310 310
             $ddd = substr($emitFone, 0, 2);
311 311
             $fone1 = substr($emitFone, -8);
312 312
             $digito9 = ' ';
313 313
             if ($foneLen == 11) {
314 314
                 $digito9 = substr($emitFone, 2, 1);
315 315
             }
316
-            $emitFone = ' - ('.$ddd.') '.$digito9. ' ' . substr($fone1, 0, 4) . '-' . substr($fone1, -4);
316
+            $emitFone = ' - (' . $ddd . ') ' . $digito9 . ' ' . substr($fone1, 0, 4) . '-' . substr($fone1, -4);
317 317
         } else {
318 318
             $emitFone = '';
319 319
         }
@@ -327,18 +327,18 @@  discard block
 block discarded – undo
327 327
         // CONFIGURAÇÃO DE POSIÇÃO
328 328
         $margemInterna = $this->margemInterna;
329 329
         $maxW = $this->wPrint;
330
-        $h = $h-($margemInterna);
330
+        $h = $h - ($margemInterna);
331 331
         //COLOCA LOGOMARCA
332 332
         if (is_file($this->logomarca)) {
333 333
             $xImg = $margemInterna;
334 334
             $yImg = $margemInterna + 1;
335 335
             $this->pdf->image($this->logomarca, $xImg, $yImg, 30, 22.5);
336
-            $xRs = ($maxW*0.4) + $margemInterna;
337
-            $wRs = ($maxW*0.6);
336
+            $xRs = ($maxW * 0.4) + $margemInterna;
337
+            $wRs = ($maxW * 0.6);
338 338
             $alignEmit = 'L';
339 339
         } else {
340 340
             $xRs = $margemInterna;
341
-            $wRs = ($maxW*1);
341
+            $wRs = ($maxW * 1);
342 342
             $alignEmit = 'L';
343 343
         }
344 344
         //COLOCA RAZÃO SOCIAL
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
     {
359 359
         $margemInterna = $this->margemInterna;
360 360
         $maxW = $this->wPrint;
361
-        $w = ($maxW*1);
361
+        $w = ($maxW * 1);
362 362
         $hBox1 = 7;
363 363
         $texto = "DANFE NFC-e\nDocumento Auxiliar da Nota Fiscal de Consumidor Eletrônica";
364 364
         $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B');
@@ -375,13 +375,13 @@  discard block
 block discarded – undo
375 375
         $margemInterna = $this->margemInterna;
376 376
         $maxW = $this->wPrint;
377 377
         $qtdItens = $this->det->length;
378
-        $w = ($maxW*1);
378
+        $w = ($maxW * 1);
379 379
         $hLinha = $this->hLinha;
380 380
         $aFontCabProdutos = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
381
-        $wBoxCod = $w*0.17;
381
+        $wBoxCod = $w * 0.17;
382 382
         $texto = "CÓDIGO";
383 383
         $this->pdf->textBox($x, $y, $wBoxCod, $hLinha, $texto, $aFontCabProdutos, 'T', 'L', 0, '', false);
384
-        $wBoxDescricao = $w*0.43;
384
+        $wBoxDescricao = $w * 0.43;
385 385
         $xBoxDescricao = $wBoxCod + $x;
386 386
         $texto = "DESCRICÃO";
387 387
         $this->pdf->textBox(
@@ -397,19 +397,19 @@  discard block
 block discarded – undo
397 397
             '',
398 398
             false
399 399
         );
400
-        $wBoxQt = $w*0.08;
400
+        $wBoxQt = $w * 0.08;
401 401
         $xBoxQt = $wBoxDescricao + $xBoxDescricao;
402 402
         $texto = "QT";
403 403
         $this->pdf->textBox($xBoxQt, $y, $wBoxQt, $hLinha, $texto, $aFontCabProdutos, 'T', 'L', 0, '', false);
404
-        $wBoxUn = $w*0.06;
404
+        $wBoxUn = $w * 0.06;
405 405
         $xBoxUn = $wBoxQt + $xBoxQt;
406 406
         $texto = "UN";
407 407
         $this->pdf->textBox($xBoxUn, $y, $wBoxUn, $hLinha, $texto, $aFontCabProdutos, 'T', 'L', 0, '', false);
408
-        $wBoxVl = $w*0.13;
408
+        $wBoxVl = $w * 0.13;
409 409
         $xBoxVl = $wBoxUn + $xBoxUn;
410 410
         $texto = "VALOR";
411 411
         $this->pdf->textBox($xBoxVl, $y, $wBoxVl, $hLinha, $texto, $aFontCabProdutos, 'T', 'L', 0, '', false);
412
-        $wBoxTotal = $w*0.13;
412
+        $wBoxTotal = $w * 0.13;
413 413
         $xBoxTotal = $wBoxVl + $xBoxVl;
414 414
         $texto = "TOTAL";
415 415
         $this->pdf->textBox($xBoxTotal, $y, $wBoxTotal, $hLinha, $texto, $aFontCabProdutos, 'T', 'L', 0, '', false);
@@ -429,9 +429,9 @@  discard block
 block discarded – undo
429 429
                 $vUnCom     = number_format($this->getTagValue($prod, "vUnCom"), 2, ",", ".");
430 430
                 $vProd      = number_format($this->getTagValue($prod, "vProd"), 2, ",", ".");
431 431
                 //COLOCA PRODUTO
432
-                $yBoxProd = $y + $hLinha + ($cont*$hMaxLinha);
432
+                $yBoxProd = $y + $hLinha + ($cont * $hMaxLinha);
433 433
                 //COLOCA PRODUTO CÓDIGO
434
-                $wBoxCod = $w*0.17;
434
+                $wBoxCod = $w * 0.17;
435 435
                 $texto = $cProd;
436 436
                 $this->pdf->textBox(
437 437
                     $x,
@@ -447,7 +447,7 @@  discard block
 block discarded – undo
447 447
                     false
448 448
                 );
449 449
                 //COLOCA PRODUTO DESCRIÇÃO
450
-                $wBoxDescricao = $w*0.43;
450
+                $wBoxDescricao = $w * 0.43;
451 451
                 $xBoxDescricao = $wBoxCod + $x;
452 452
                 $texto = $xProd;
453 453
                 $this->pdf->textBox(
@@ -464,7 +464,7 @@  discard block
 block discarded – undo
464 464
                     false
465 465
                 );
466 466
                 //COLOCA PRODUTO QUANTIDADE
467
-                $wBoxQt = $w*0.08;
467
+                $wBoxQt = $w * 0.08;
468 468
                 $xBoxQt = $wBoxDescricao + $xBoxDescricao;
469 469
                 $texto = $qCom;
470 470
                 $this->pdf->textBox(
@@ -481,7 +481,7 @@  discard block
 block discarded – undo
481 481
                     false
482 482
                 );
483 483
                 //COLOCA PRODUTO UNIDADE
484
-                $wBoxUn = $w*0.06;
484
+                $wBoxUn = $w * 0.06;
485 485
                 $xBoxUn = $wBoxQt + $xBoxQt;
486 486
                 $texto = $uCom;
487 487
                 $this->pdf->textBox(
@@ -498,7 +498,7 @@  discard block
 block discarded – undo
498 498
                     false
499 499
                 );
500 500
                 //COLOCA PRODUTO VL UNITÁRIO
501
-                $wBoxVl = $w*0.13;
501
+                $wBoxVl = $w * 0.13;
502 502
                 $xBoxVl = $wBoxUn + $xBoxUn;
503 503
                 $texto = $vUnCom;
504 504
                 $this->pdf->textBox(
@@ -515,7 +515,7 @@  discard block
 block discarded – undo
515 515
                     false
516 516
                 );
517 517
                 //COLOCA PRODUTO VL TOTAL
518
-                $wBoxTotal = $w*0.13;
518
+                $wBoxTotal = $w * 0.13;
519 519
                 $xBoxTotal = $wBoxVl + $xBoxVl;
520 520
                 $texto = $vProd;
521 521
                 $this->pdf->textBox(
@@ -542,8 +542,8 @@  discard block
 block discarded – undo
542 542
         $margemInterna = $this->margemInterna;
543 543
         $maxW = $this->wPrint;
544 544
         $hLinha = 3;
545
-        $wColEsq = ($maxW*0.7);
546
-        $wColDir = ($maxW*0.3);
545
+        $wColEsq = ($maxW * 0.7);
546
+        $wColDir = ($maxW * 0.3);
547 547
         $xValor = $x + $wColEsq;
548 548
         $qtdItens = $this->det->length;
549 549
         $vProd = $this->getTagValue($this->ICMSTot, "vProd");
@@ -564,28 +564,28 @@  discard block
 block discarded – undo
564 564
         $texto = "R$ " . number_format($vProd, 2, ",", ".");
565 565
         $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
566 566
         $this->pdf->textBox($xValor, $yTotal, $wColDir, $hLinha, $texto, $aFont, 'T', 'R', 0, '', false);
567
-        $yDesconto = $y + ($hLinha*2);
567
+        $yDesconto = $y + ($hLinha * 2);
568 568
         $texto = "Descontos";
569 569
         $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
570 570
         $this->pdf->textBox($x, $yDesconto, $wColEsq, $hLinha, $texto, $aFont, 'T', 'L', 0, '', false);
571 571
         $texto = "R$ " . $vDesc;
572 572
         $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
573 573
         $this->pdf->textBox($xValor, $yDesconto, $wColDir, $hLinha, $texto, $aFont, 'T', 'R', 0, '', false);
574
-        $yFrete= $y + ($hLinha*3);
574
+        $yFrete = $y + ($hLinha * 3);
575 575
         $texto = "Frete";
576 576
         $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
577 577
         $this->pdf->textBox($x, $yFrete, $wColEsq, $hLinha, $texto, $aFont, 'T', 'L', 0, '', false);
578 578
         $texto = "R$ " . $vFrete;
579 579
         $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
580 580
         $this->pdf->textBox($xValor, $yFrete, $wColDir, $hLinha, $texto, $aFont, 'T', 'R', 0, '', false);
581
-        $yTotalFinal = $y + ($hLinha*4);
581
+        $yTotalFinal = $y + ($hLinha * 4);
582 582
         $texto = "Total";
583 583
         $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
584 584
         $this->pdf->textBox($x, $yTotalFinal, $wColEsq, $hLinha, $texto, $aFont, 'T', 'L', 0, '', false);
585 585
         $texto = "R$ " . $vNF;
586 586
         $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
587 587
         $this->pdf->textBox($xValor, $yTotalFinal, $wColDir, $hLinha, $texto, $aFont, 'T', 'R', 0, '', false);
588
-        $yTotalFinal = $y + ($hLinha*5);
588
+        $yTotalFinal = $y + ($hLinha * 5);
589 589
         $texto = "Informação dos Tributos Totais Incidentes";
590 590
         $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>''];
591 591
         $this->pdf->textBox($x, $yTotalFinal, $wColEsq, $hLinha, $texto, $aFont, 'T', 'L', 0, '', false);
@@ -600,16 +600,16 @@  discard block
 block discarded – undo
600 600
         $margemInterna = $this->margemInterna;
601 601
         $maxW = $this->wPrint;
602 602
         $qtdPgto = $this->pag->length;
603
-        $w = ($maxW*1);
603
+        $w = ($maxW * 1);
604 604
         $hLinha = $this->hLinha;
605
-        $wColEsq = ($maxW*0.7);
606
-        $wColDir = ($maxW*0.3);
605
+        $wColEsq = ($maxW * 0.7);
606
+        $wColDir = ($maxW * 0.3);
607 607
         $xValor = $x + $wColEsq;
608 608
         $aFontPgto = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
609
-        $wBoxEsq = $w*0.7;
609
+        $wBoxEsq = $w * 0.7;
610 610
         $texto = "FORMA DE PAGAMENTO";
611 611
         $this->pdf->textBox($x, $y, $wBoxEsq, $hLinha, $texto, $aFontPgto, 'T', 'L', 0, '', false);
612
-        $wBoxDir = $w*0.3;
612
+        $wBoxDir = $w * 0.3;
613 613
         $xBoxDescricao = $x + $wBoxEsq;
614 614
         $texto = "VALOR PAGO";
615 615
         $this->pdf->textBox($xBoxDescricao, $y, $wBoxDir, $hLinha, $texto, $aFontPgto, 'T', 'R', 0, '', false);
@@ -631,7 +631,7 @@  discard block
 block discarded – undo
631 631
                     $tBandNome = self::getCardName($tBand);
632 632
                 }
633 633
                 //COLOCA PRODUTO
634
-                $yBoxProd = $y + $hLinha + ($cont*$hLinha);
634
+                $yBoxProd = $y + $hLinha + ($cont * $hLinha);
635 635
                 //COLOCA PRODUTO CÓDIGO
636 636
                 $texto = $tPagNome;
637 637
                 $this->pdf->textBox($x, $yBoxProd, $wBoxEsq, $hLinha, $texto, $aFontPgto, 'T', 'L', 0, '', false);
@@ -655,7 +655,7 @@  discard block
 block discarded – undo
655 655
             }
656 656
             
657 657
             if (!empty($this->vTroco)) {
658
-                $yBoxProd = $y + $hLinha + ($cont*$hLinha);
658
+                $yBoxProd = $y + $hLinha + ($cont * $hLinha);
659 659
                 //COLOCA PRODUTO CÓDIGO
660 660
                 $texto = 'Troco';
661 661
                 $this->pdf->textBox($x, $yBoxProd, $wBoxEsq, $hLinha, $texto, $aFontPgto, 'T', 'L', 0, '', false);
@@ -684,7 +684,7 @@  discard block
 block discarded – undo
684 684
         $y += 6;
685 685
         $margemInterna = $this->margemInterna;
686 686
         $maxW = $this->wPrint;
687
-        $w = ($maxW*1);
687
+        $w = ($maxW * 1);
688 688
         $hLinha = $this->hLinha;
689 689
         $aFontTit = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B'];
690 690
         $aFontTex = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>''];
@@ -716,19 +716,19 @@  discard block
 block discarded – undo
716 716
         $dhEmiLocalFormat = $dhEmilocal->format('d/m/Y H:i:s');
717 717
         $texto = "ÁREA DE MENSAGEM FISCAL";
718 718
         $this->pdf->textBox($x, $y, $w, $hLinha, $texto, $aFontTit, 'C', 'C', 0, '', false);
719
-        $yTex1 = $y + ($hLinha*1);
720
-        $hTex1 = $hLinha*2;
721
-        $texto = "Número " . $nNF . " Série " . $serieNF . " " .$dhEmiLocalFormat . " - Via Consumidor";
719
+        $yTex1 = $y + ($hLinha * 1);
720
+        $hTex1 = $hLinha * 2;
721
+        $texto = "Número " . $nNF . " Série " . $serieNF . " " . $dhEmiLocalFormat . " - Via Consumidor";
722 722
         $this->pdf->textBox($x, $yTex1, $w, $hTex1, $texto, $aFontTex, 'C', 'C', 0, '', false);
723
-        $yTex2 = $y + ($hLinha*3);
724
-        $hTex2 = $hLinha*2;
723
+        $yTex2 = $y + ($hLinha * 3);
724
+        $hTex2 = $hLinha * 2;
725 725
         
726 726
         $texto = !empty($this->urlChave) ? "Consulte pela Chave de Acesso em " . $this->urlChave : '';
727 727
         $this->pdf->textBox($x, $yTex2, $w, $hTex2, $texto, $aFontTex, 'C', 'C', 0, '', false);
728 728
         $texto = "CHAVE DE ACESSO";
729
-        $yTit2 = $y + ($hLinha*5);
729
+        $yTit2 = $y + ($hLinha * 5);
730 730
         $this->pdf->textBox($x, $yTit2, $w, $hLinha, $texto, $aFontTit, 'C', 'C', 0, '', false);
731
-        $yTex3 = $y + ($hLinha*6);
731
+        $yTex3 = $y + ($hLinha * 6);
732 732
         $texto = $chNFe;
733 733
         $this->pdf->textBox($x, $yTex3, $w, $hLinha, $texto, $aFontTex, 'C', 'C', 0, '', false);
734 734
     }
@@ -738,7 +738,7 @@  discard block
 block discarded – undo
738 738
         $y += 6;
739 739
         $margemInterna = $this->margemInterna;
740 740
         $maxW = $this->wPrint;
741
-        $w = ($maxW*1);
741
+        $w = ($maxW * 1);
742 742
         $hLinha = $this->hLinha;
743 743
         $aFontTit = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B'];
744 744
         $aFontTex = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>''];
@@ -754,7 +754,7 @@  discard block
 block discarded – undo
754 754
             $consCNPJ = !empty($this->dest->getElementsByTagName("CNPJ")->item(0)->nodeValue)
755 755
                     ? $this->dest->getElementsByTagName("CNPJ")->item(0)->nodeValue
756 756
                     : '';
757
-            $cDest = $consCPF.$consCNPJ.$considEstrangeiro; //documentos do consumidor
757
+            $cDest = $consCPF . $consCNPJ . $considEstrangeiro; //documentos do consumidor
758 758
             $enderDest = $this->dest->getElementsByTagName("enderDest")->item(0);
759 759
             $consNome = $this->getTagValue($this->dest, "xNome");
760 760
             $consLgr = $this->getTagValue($enderDest, "xLgr");
@@ -794,8 +794,8 @@  discard block
 block discarded – undo
794 794
             $yTex1 = $y + $hLinha;
795 795
             $texto = $consNome;
796 796
             if (!empty($consDoc)) {
797
-                $texto .= " - ". $consDoc . "\n" . $consEnd;
798
-                $this->pdf->textBox($x, $yTex1, $w, $hLinha*3, $texto, $aFontTex, 'C', 'C', 0, '', false);
797
+                $texto .= " - " . $consDoc . "\n" . $consEnd;
798
+                $this->pdf->textBox($x, $yTex1, $w, $hLinha * 3, $texto, $aFontTex, 'C', 'C', 0, '', false);
799 799
             }
800 800
         } else {
801 801
             $yTex1 = $y + $hLinha;
@@ -809,7 +809,7 @@  discard block
 block discarded – undo
809 809
         $y += 6;
810 810
         $margemInterna = $this->margemInterna;
811 811
         $maxW = $this->wPrint;
812
-        $w = ($maxW*1)+4;
812
+        $w = ($maxW * 1) + 4;
813 813
         $hLinha = $this->hLinha;
814 814
         $hBoxLinha = $this->hBoxLinha;
815 815
         $aFontTit = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B');
@@ -818,7 +818,7 @@  discard block
 block discarded – undo
818 818
         $nProt = '';
819 819
         if (isset($this->nfeProc)) {
820 820
             $nProt = $this->getTagValue($this->nfeProc, "nProt");
821
-            $dhRecbto  = $this->getTagValue($this->nfeProc, "dhRecbto");
821
+            $dhRecbto = $this->getTagValue($this->nfeProc, "dhRecbto");
822 822
         }
823 823
         $barcode = new Barcode();
824 824
         $bobj = $barcode->getBarcodeObj(
@@ -832,15 +832,15 @@  discard block
 block discarded – undo
832 832
         $qrcode = $bobj->getPngData();
833 833
         $wQr = 50;
834 834
         $hQr = 50;
835
-        $yQr = ($y+$margemInterna);
836
-        $xQr = ($w/2) - ($wQr/2);
835
+        $yQr = ($y + $margemInterna);
836
+        $xQr = ($w / 2) - ($wQr / 2);
837 837
         // prepare a base64 encoded "data url"
838 838
         $pic = 'data://text/plain;base64,' . base64_encode($qrcode);
839 839
         $info = getimagesize($pic);
840 840
         $this->pdf->image($pic, $xQr, $yQr, $wQr, $hQr, 'PNG');
841 841
         $dt = new DateTime($dhRecbto);
842
-        $yQr = ($yQr+$hQr+$margemInterna);
843
-        $this->pdf->textBox($x, $yQr, $w-4, $hBoxLinha, "Protocolo de Autorização: " . $nProt . "\n"
842
+        $yQr = ($yQr + $hQr + $margemInterna);
843
+        $this->pdf->textBox($x, $yQr, $w - 4, $hBoxLinha, "Protocolo de Autorização: " . $nProt . "\n"
844 844
             . $dt->format('d/m/Y H:i:s'), $aFontTex, 'C', 'C', 0, '', false);
845 845
     }
846 846
    
@@ -858,7 +858,7 @@  discard block
 block discarded – undo
858 858
         $heigthText = $this->pdf->textBox($x, $y, $w, $hLinha, $texto, $aFontTit, 'C', 'C', 0, '', false);
859 859
                 
860 860
         // seta o textbox do texto adicional
861
-        $this->pdf->textBox($x, $y+3, $w-2, $hLinha-3, $this->textoAdic, $aFontTex, 'T', 'L', 0, '', false);
861
+        $this->pdf->textBox($x, $y + 3, $w - 2, $hLinha - 3, $this->textoAdic, $aFontTex, 'T', 'L', 0, '', false);
862 862
     }
863 863
     
864 864
     /**
@@ -918,7 +918,7 @@  discard block
 block discarded – undo
918 918
         if ($startPos === false) {
919 919
             return $cdata;
920 920
         }
921
-        for ($x=$len; $x>0; $x--) {
921
+        for ($x = $len; $x > 0; $x--) {
922 922
             if (substr($cdata, $x, 1) == '>') {
923 923
                 $endPos = $x;
924 924
                 break;
@@ -929,15 +929,15 @@  discard block
 block discarded – undo
929 929
         } else {
930 930
             $parte1 = '';
931 931
         }
932
-        $parte2 = substr($cdata, $startPos, $endPos-$startPos+1);
932
+        $parte2 = substr($cdata, $startPos, $endPos - $startPos + 1);
933 933
         if ($endPos < $len) {
934 934
             $parte3 = substr($cdata, $endPos + 1, $len - $endPos - 1);
935 935
         } else {
936 936
             $parte3 = '';
937 937
         }
938
-        $texto = trim($parte1).' '.trim($parte3);
938
+        $texto = trim($parte1) . ' ' . trim($parte3);
939 939
         if (strpos($parte2, '<CDATA>') === false) {
940
-            $cdata = '<CDATA>'.$parte2.'</CDATA>';
940
+            $cdata = '<CDATA>' . $parte2 . '</CDATA>';
941 941
         } else {
942 942
             $cdata = $parte2;
943 943
         }
@@ -1009,15 +1009,15 @@  discard block
 block discarded – undo
1009 1009
         //grupo CADATA infCpl
1010 1010
         $t = $dom->getElementsByTagName('transmissor')->item(0);
1011 1011
         $r = $dom->getElementsByTagName('receptor')->item(0);
1012
-        $versao = ! empty($dom->getElementsByTagName('versao')->item(0)->nodeValue) ?
1013
-        'Versao:'.$dom->getElementsByTagName('versao')->item(0)->nodeValue.' ' : '';
1014
-        $especieNF = ! empty($dom->getElementsByTagName('especieNF')->item(0)->nodeValue) ?
1015
-        'Especie:'.$dom->getElementsByTagName('especieNF')->item(0)->nodeValue.' ' : '';
1016
-        $fabEntrega = ! empty($dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue) ?
1017
-        'Entrega:'.$dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue.' ' : '';
1018
-        $dca = ! empty($dom->getElementsByTagName('dca')->item(0)->nodeValue) ?
1019
-        'dca:'.$dom->getElementsByTagName('dca')->item(0)->nodeValue.' ' : '';
1020
-        $texto .= "".$versao.$especieNF.$fabEntrega.$dca;
1012
+        $versao = !empty($dom->getElementsByTagName('versao')->item(0)->nodeValue) ?
1013
+        'Versao:' . $dom->getElementsByTagName('versao')->item(0)->nodeValue . ' ' : '';
1014
+        $especieNF = !empty($dom->getElementsByTagName('especieNF')->item(0)->nodeValue) ?
1015
+        'Especie:' . $dom->getElementsByTagName('especieNF')->item(0)->nodeValue . ' ' : '';
1016
+        $fabEntrega = !empty($dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue) ?
1017
+        'Entrega:' . $dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue . ' ' : '';
1018
+        $dca = !empty($dom->getElementsByTagName('dca')->item(0)->nodeValue) ?
1019
+        'dca:' . $dom->getElementsByTagName('dca')->item(0)->nodeValue . ' ' : '';
1020
+        $texto .= "" . $versao . $especieNF . $fabEntrega . $dca;
1021 1021
         if (isset($t)) {
1022 1022
             if ($t->hasAttributes()) {
1023 1023
                 $texto .= " Transmissor ";
Please login to merge, or discard this patch.
src/NFe/Danfe.php 2 patches
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -595,7 +595,7 @@  discard block
 block discarded – undo
595 595
                 $this->textoAdic .= ". \r\n";
596 596
             }
597 597
             $this->textoAdic .= "LOCAL DE ENTREGA : ".$txRetCNPJ.'-'.$txRetxLgr.', '.$txRetnro.' '.$txRetxCpl.
598
-               ' - '.$txRetxBairro.' '.$txRetxMun.' - '.$txRetUF."\r\n";
598
+                ' - '.$txRetxBairro.' '.$txRetxMun.' - '.$txRetUF."\r\n";
599 599
         }
600 600
         //informações adicionais
601 601
         $this->textoAdic .= $this->geraInformacoesDasNotasReferenciadas();
@@ -1038,7 +1038,7 @@  discard block
 block discarded – undo
1038 1038
         $oldX = $x;
1039 1039
         $oldY = $y;
1040 1040
         if ($this->orientacao == 'P') {
1041
-              $maxW = $this->wPrint;
1041
+                $maxW = $this->wPrint;
1042 1042
         } else {
1043 1043
             if ($pag == 1) { // primeira página
1044 1044
                 $maxW = $this->wPrint - $this->wCanhoto;
@@ -1396,8 +1396,8 @@  discard block
 block discarded – undo
1396 1396
             $w = $maxW-(2*$x);
1397 1397
             $this->pdf->SetTextColor(200, 200, 200);
1398 1398
             $texto = "DANFE impresso em contingência -\n".
1399
-                     "DPEC regularmente recebido pela Receita\n".
1400
-                     "Federal do Brasil";
1399
+                        "DPEC regularmente recebido pela Receita\n".
1400
+                        "Federal do Brasil";
1401 1401
             $aFont = ['font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B'];
1402 1402
             $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1403 1403
             $this->pdf->SetTextColor(0, 0, 0);
@@ -1690,13 +1690,13 @@  discard block
 block discarded – undo
1690 1690
         return ($y + $h);
1691 1691
     } //fim da função destinatarioDANFE
1692 1692
 
1693
-     /**
1694
-     * getTextoFatura
1695
-     * Gera a String do Texto da Fatura
1696
-      *
1697
-     * @name   getTextoFatura
1698
-     * @return uma String com o texto ou "";
1699
-     */
1693
+        /**
1694
+         * getTextoFatura
1695
+         * Gera a String do Texto da Fatura
1696
+         *
1697
+         * @name   getTextoFatura
1698
+         * @return uma String com o texto ou "";
1699
+         */
1700 1700
     protected function getTextoFatura()
1701 1701
     {
1702 1702
         if (isset($this->cobr)) {
@@ -1727,13 +1727,13 @@  discard block
 block discarded – undo
1727 1727
         return "";
1728 1728
     }
1729 1729
 
1730
-     /**
1731
-     * sizeExtraTextoFatura
1732
-     * Calcula o espaço ocupado pelo texto da fatura. Este espaço só é utilizado quando não houver duplicata.
1733
-      *
1734
-     * @name   sizeExtraTextoFatura
1735
-     * @return integer
1736
-     */
1730
+        /**
1731
+         * sizeExtraTextoFatura
1732
+         * Calcula o espaço ocupado pelo texto da fatura. Este espaço só é utilizado quando não houver duplicata.
1733
+         *
1734
+         * @name   sizeExtraTextoFatura
1735
+         * @return integer
1736
+         */
1737 1737
     protected function sizeExtraTextoFatura()
1738 1738
     {
1739 1739
         $textoFatura = $this->getTextoFatura();
@@ -1898,7 +1898,7 @@  discard block
 block discarded – undo
1898 1898
                                     '11'=>'Vale Refeição','12'=>'Vale Presente','13'=>'Vale Combustível',
1899 1899
                                     '14'=>'Duplicata Mercantil','15'=>'Boleto','90'=>'Sem pagamento','99'=>'Outros'];
1900 1900
             $bandeira = ['01'=>'Visa','02'=>'Mastercard','03'=>'American','04'=>'Sorocred','05'=>'Diners',
1901
-                              '06'=>'Elo','07'=>'Hipercard','08'=>'Aura','09'=>'Cabal','99'=>'Outros'];
1901
+                                '06'=>'Elo','07'=>'Hipercard','08'=>'Aura','09'=>'Cabal','99'=>'Outros'];
1902 1902
             foreach ($this->detPag as $k => $d) {
1903 1903
                 $fPag = !empty($this->detPag->item($k)->getElementsByTagName('tPag')->item(0)->nodeValue)
1904 1904
                     ? $this->detPag->item($k)->getElementsByTagName('tPag')->item(0)->nodeValue : '0';
@@ -2534,7 +2534,7 @@  discard block
 block discarded – undo
2534 2534
         $w4 = round($w*0.05, 0);
2535 2535
         $texto = 'O/CSOSN';//Regime do Simples CRT = 1 ou CRT = 2
2536 2536
         if ($this->getTagValue($this->emit, 'CRT') == '3') {
2537
-             $texto = 'O/CST';//Regime Normal
2537
+                $texto = 'O/CST';//Regime Normal
2538 2538
         }
2539 2539
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2540 2540
         $this->pdf->textBox($x, $y, $w4, $h, $texto, $aFont, 'C', 'C', 0, '', false);
@@ -2909,7 +2909,7 @@  discard block
 block discarded – undo
2909 2909
         $this->pdf->textBox($x, $yVeic, $w1+40, $h, $texto, $aFont, 'T', 'L', 0, '');
2910 2910
         $yVeic += $h;
2911 2911
         $texto = 'Tipo.................: ' . ($renavamTiposVeiculos[intval($veiculoTipo)] ?? $veiculoTipo);
2912
-         $this->pdf->textBox($x, $yVeic, $w1+40, $h, $texto, $aFont, 'T', 'L', 0, '');
2912
+            $this->pdf->textBox($x, $yVeic, $w1+40, $h, $texto, $aFont, 'T', 'L', 0, '');
2913 2913
         $yVeic = $y + $h;
2914 2914
         $xVeic = $x + 65;
2915 2915
         $texto = 'Nº Motor: .........: ' . $veiculoMotor;
@@ -3043,9 +3043,9 @@  discard block
 block discarded – undo
3043 3043
         //DADOS ADICIONAIS
3044 3044
         $texto = "DADOS ADICIONAIS";
3045 3045
         if ($this->orientacao == 'P') {
3046
-              $w = $this->wPrint;
3046
+                $w = $this->wPrint;
3047 3047
         } else {
3048
-              $w = $this->wPrint-$this->wCanhoto;
3048
+                $w = $this->wPrint-$this->wCanhoto;
3049 3049
         }
3050 3050
         $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
3051 3051
         $this->pdf->textBox($x, $y, $w, 8, $texto, $aFont, 'T', 'L', 0, '');
@@ -3125,10 +3125,10 @@  discard block
 block discarded – undo
3125 3125
     protected function rodape($x, $y)
3126 3126
     {
3127 3127
         if ($this->orientacao == 'P') {
3128
-              $w = $this->wPrint;
3128
+                $w = $this->wPrint;
3129 3129
         } else {
3130
-              $w = $this->wPrint-$this->wCanhoto;
3131
-              $x = $this->wCanhoto;
3130
+                $w = $this->wPrint-$this->wCanhoto;
3131
+                $x = $this->wCanhoto;
3132 3132
         }
3133 3133
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>'I'];
3134 3134
         $texto = "Impresso em ". date('d/m/Y') . " as " . date('H:i:s');
Please login to merge, or discard this patch.
Spacing   +317 added lines, -318 removed lines patch added patch discarded remove patch
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
             $this->fontePadrao = $fonteDANFE;
356 356
         }
357 357
         //se for passado o xml
358
-        if (! empty($this->xml)) {
358
+        if (!empty($this->xml)) {
359 359
             $this->dom = new Dom();
360 360
             $this->dom->loadXML($this->xml);
361 361
             $this->nfeProc    = $this->dom->getElementsByTagName("nfeProc")->item(0);
@@ -511,10 +511,10 @@  discard block
 block discarded – undo
511 511
         //total inicial de paginas
512 512
         $totPag = 1;
513 513
         //largura imprimivel em mm: largura da folha menos as margens esq/direita
514
-        $this->wPrint = $maxW-($margEsq*2);
514
+        $this->wPrint = $maxW - ($margEsq * 2);
515 515
         //comprimento (altura) imprimivel em mm: altura da folha menos as margens
516 516
         //superior e inferior
517
-        $this->hPrint = $maxH-$margSup-$margInf;
517
+        $this->hPrint = $maxH - $margSup - $margInf;
518 518
         // estabelece contagem de paginas
519 519
         $this->pdf->aliasNbPages();
520 520
         // fixa as margens
@@ -552,9 +552,9 @@  discard block
 block discarded – undo
552 552
         }
553 553
         //calcular a altura necessária para os dados adicionais
554 554
         if ($this->orientacao == 'P') {
555
-            $this->wAdic = round($this->wPrint*0.66, 0);
555
+            $this->wAdic = round($this->wPrint * 0.66, 0);
556 556
         } else {
557
-            $this->wAdic = round(($this->wPrint-$this->wCanhoto)*0.5, 0);
557
+            $this->wAdic = round(($this->wPrint - $this->wCanhoto) * 0.5, 0);
558 558
         }
559 559
         $fontProduto = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>''];
560 560
         $this->textoAdic = '';
@@ -566,8 +566,8 @@  discard block
 block discarded – undo
566 566
             $txRetxBairro = $this->getTagValue($this->retirada, "xBairro");
567 567
             $txRetxMun = $this->getTagValue($this->retirada, "xMun");
568 568
             $txRetUF = $this->getTagValue($this->retirada, "UF");
569
-            $this->textoAdic .= "LOCAL DE RETIRADA : ".
570
-                    $txRetCNPJ.
569
+            $this->textoAdic .= "LOCAL DE RETIRADA : " .
570
+                    $txRetCNPJ .
571 571
                     '-' .
572 572
                     $txRetxLgr .
573 573
                     ', ' .
@@ -594,8 +594,8 @@  discard block
 block discarded – undo
594 594
             if ($this->textoAdic != '') {
595 595
                 $this->textoAdic .= ". \r\n";
596 596
             }
597
-            $this->textoAdic .= "LOCAL DE ENTREGA : ".$txRetCNPJ.'-'.$txRetxLgr.', '.$txRetnro.' '.$txRetxCpl.
598
-               ' - '.$txRetxBairro.' '.$txRetxMun.' - '.$txRetUF."\r\n";
597
+            $this->textoAdic .= "LOCAL DE ENTREGA : " . $txRetCNPJ . '-' . $txRetxLgr . ', ' . $txRetnro . ' ' . $txRetxCpl .
598
+               ' - ' . $txRetxBairro . ' ' . $txRetxMun . ' - ' . $txRetUF . "\r\n";
599 599
         }
600 600
         //informações adicionais
601 601
         $this->textoAdic .= $this->geraInformacoesDasNotasReferenciadas();
@@ -604,7 +604,7 @@  discard block
 block discarded – undo
604 604
             if ($this->textoAdic != '') {
605 605
                 $this->textoAdic .= ". \r\n";
606 606
             }
607
-            $this->textoAdic .= ! empty($this->getTagValue($this->infAdic, "infCpl")) ?
607
+            $this->textoAdic .= !empty($this->getTagValue($this->infAdic, "infCpl")) ?
608 608
                 'Inf. Contribuinte: ' .
609 609
                 $this->anfaveaDANFE($this->getTagValue($this->infAdic, "infCpl")) : '';
610 610
             $infPedido = $this->geraInformacoesDaTagCompra();
@@ -612,14 +612,14 @@  discard block
 block discarded – undo
612 612
                 $this->textoAdic .= $infPedido;
613 613
             }
614 614
             $this->textoAdic .= $this->getTagValue($this->dest, "email", ' Email do Destinatário: ');
615
-            $this->textoAdic .= ! empty($this->getTagValue($this->infAdic, "infAdFisco")) ?
615
+            $this->textoAdic .= !empty($this->getTagValue($this->infAdic, "infAdFisco")) ?
616 616
                 "\r\n Inf. fisco: " .
617 617
                 $this->getTagValue($this->infAdic, "infAdFisco") : '';
618 618
             $obsCont = $this->infAdic->getElementsByTagName("obsCont");
619 619
             if (isset($obsCont)) {
620 620
                 foreach ($obsCont as $obs) {
621
-                    $campo =  $obsCont->item($i)->getAttribute("xCampo");
622
-                    $xTexto = ! empty($obsCont->item($i)->getElementsByTagName("xTexto")->item(0)->nodeValue) ?
621
+                    $campo = $obsCont->item($i)->getAttribute("xCampo");
622
+                    $xTexto = !empty($obsCont->item($i)->getElementsByTagName("xTexto")->item(0)->nodeValue) ?
623 623
                         $obsCont->item($i)->getElementsByTagName("xTexto")->item(0)->nodeValue : '';
624 624
                     $this->textoAdic .= "\r\n" . $campo . ':  ' . trim($xTexto);
625 625
                     $i++;
@@ -647,37 +647,37 @@  discard block
 block discarded – undo
647 647
         foreach ($alinhas as $linha) {
648 648
             $numlinhasdados += $this->pdf->getNumLines($linha, $this->wAdic, $fontProduto);
649 649
         }
650
-        $hdadosadic = round(($numlinhasdados+3) * $this->pdf->fontSize, 0);
650
+        $hdadosadic = round(($numlinhasdados + 3) * $this->pdf->fontSize, 0);
651 651
         if ($hdadosadic < 10) {
652 652
             $hdadosadic = 10;
653 653
         }
654 654
         //altura disponivel para os campos da DANFE
655
-        $hcabecalho = 47;//para cabeçalho
656
-        $hdestinatario = 25;//para destinatario
657
-        $hduplicatas = 12;//para cada grupo de 7 duplicatas
658
-        $himposto = 18;// para imposto
659
-        $htransporte = 25;// para transporte
660
-        $hissqn = 11;// para issqn
661
-        $hfooter = 5;// para rodape
662
-        $hCabecItens = 4;//cabeçalho dos itens
655
+        $hcabecalho = 47; //para cabeçalho
656
+        $hdestinatario = 25; //para destinatario
657
+        $hduplicatas = 12; //para cada grupo de 7 duplicatas
658
+        $himposto = 18; // para imposto
659
+        $htransporte = 25; // para transporte
660
+        $hissqn = 11; // para issqn
661
+        $hfooter = 5; // para rodape
662
+        $hCabecItens = 4; //cabeçalho dos itens
663 663
         //alturas disponiveis para os dados
664 664
         $hDispo1 = $this->hPrint - 10 - ($hcabecalho +
665 665
             $hdestinatario + ($linhasDup * $hduplicatas) + $himposto + $htransporte +
666 666
             ($linhaISSQN * $hissqn) + $hdadosadic + $hfooter + $hCabecItens +
667 667
             $this->sizeExtraTextoFatura());
668 668
         if ($this->orientacao == 'P') {
669
-            $hDispo1 -= 24 * $this->qCanhoto;//para canhoto
669
+            $hDispo1 -= 24 * $this->qCanhoto; //para canhoto
670 670
             $w = $this->wPrint;
671 671
         } else {
672
-            $hcanhoto = $this->hPrint;//para canhoto
672
+            $hcanhoto = $this->hPrint; //para canhoto
673 673
             $w = $this->wPrint - $this->wCanhoto;
674 674
         }
675
-        $hDispo2 = $this->hPrint - 10 - ($hcabecalho + $hfooter + $hCabecItens)-4;
675
+        $hDispo2 = $this->hPrint - 10 - ($hcabecalho + $hfooter + $hCabecItens) - 4;
676 676
         //Contagem da altura ocupada para impressão dos itens
677 677
         $fontProduto = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>''];
678 678
         $numlinhas = 0;
679 679
         $hUsado = $hCabecItens;
680
-        $w2 = round($w*0.28, 0);
680
+        $w2 = round($w * 0.28, 0);
681 681
         $hDispo = $hDispo1;
682 682
         $totPag = 1;
683 683
         $i = 0;
@@ -690,7 +690,7 @@  discard block
 block discarded – undo
690 690
                 $hDispo = $hDispo2;
691 691
                 $hUsado = $hCabecItens;
692 692
                 // Remove canhoto para páginas secundárias em modo paisagem ('L')
693
-                $w2 = round($this->wPrint*0.28, 0);
693
+                $w2 = round($this->wPrint * 0.28, 0);
694 694
                 $i--; // decrementa para readicionar o item que não coube nessa pagina na outra.
695 695
             }
696 696
             $i++;
@@ -714,7 +714,7 @@  discard block
 block discarded – undo
714 714
         //coloca o cabeçalho
715 715
         $y = $this->cabecalhoDANFE($x, $y, $pag, $totPag);
716 716
         //coloca os dados do destinatário
717
-        $y = $this->destinatarioDANFE($x, $y+1);
717
+        $y = $this->destinatarioDANFE($x, $y + 1);
718 718
         
719 719
         
720 720
         //Verifica as formas de pagamento da nota fiscal
@@ -728,29 +728,29 @@  discard block
 block discarded – undo
728 728
         }
729 729
         //caso tenha boleto imprimir fatura
730 730
         if ($this->dup->length > 0) {
731
-            $y = $this->faturaDANFE($x, $y+1);
731
+            $y = $this->faturaDANFE($x, $y + 1);
732 732
         } else {
733 733
             //Se somente tiver a forma de pagamento sem pagamento ou outros não imprimir nada
734
-            if (count($formaPag)=='1' && (isset($formaPag[90]) || isset($formaPag[99]))) {
734
+            if (count($formaPag) == '1' && (isset($formaPag[90]) || isset($formaPag[99]))) {
735 735
                 $y = $y;
736 736
             } else {
737 737
                 //caso tenha mais de uma forma de pagamento ou seja diferente de boleto exibe a
738 738
                 //forma de pagamento e o valor
739
-                $y = $this->pagamentoDANFE($x, $y+1);
739
+                $y = $this->pagamentoDANFE($x, $y + 1);
740 740
             }
741 741
         }
742 742
         //coloca os dados dos impostos e totais da NFe
743
-        $y = $this->impostoDANFE($x, $y+1);
743
+        $y = $this->impostoDANFE($x, $y + 1);
744 744
         //coloca os dados do trasnporte
745
-        $y = $this->transporteDANFE($x, $y+1);
745
+        $y = $this->transporteDANFE($x, $y + 1);
746 746
         //itens da DANFE
747 747
         $nInicial = 0;
748 748
 
749
-        $y = $this->itensDANFE($x, $y+1, $nInicial, $hDispo1, $pag, $totPag, $hCabecItens);
749
+        $y = $this->itensDANFE($x, $y + 1, $nInicial, $hDispo1, $pag, $totPag, $hCabecItens);
750 750
 
751 751
         //coloca os dados do ISSQN
752 752
         if ($linhaISSQN == 1) {
753
-            $y = $this->issqnDANFE($x, $y+4);
753
+            $y = $this->issqnDANFE($x, $y + 4);
754 754
         } else {
755 755
             $y += 4;
756 756
         }
@@ -758,7 +758,7 @@  discard block
 block discarded – undo
758 758
         $y = $this->dadosAdicionaisDANFE($x, $y, $hdadosadic);
759 759
         //coloca o rodapé da página
760 760
         if ($this->orientacao == 'P') {
761
-            $this->rodape($xInic, $y-1);
761
+            $this->rodape($xInic, $y - 1);
762 762
         } else {
763 763
             $this->rodape($xInic, $this->hPrint + 1);
764 764
         }
@@ -779,7 +779,7 @@  discard block
 block discarded – undo
779 779
             //coloca o cabeçalho na página adicional
780 780
             $y = $this->cabecalhoDANFE($x, $y, $n, $totPag);
781 781
             //coloca os itens na página adicional
782
-            $y = $this->itensDANFE($x, $y+1, $nInicial, $hDispo2, $n, $totPag, $hCabecItens);
782
+            $y = $this->itensDANFE($x, $y + 1, $nInicial, $hDispo2, $n, $totPag, $hCabecItens);
783 783
             //coloca o rodapé da página
784 784
             if ($this->orientacao == 'P') {
785 785
                 $this->rodape($xInic, $y + 4);
@@ -792,7 +792,7 @@  discard block
 block discarded – undo
792 792
             }
793 793
         }
794 794
         //retorna o ID na NFe
795
-        if ($classPdf!==false) {
795
+        if ($classPdf !== false) {
796 796
             $aR = [
797 797
                 'id'=>str_replace('NFe', '', $this->infNFe->getAttribute("Id")),
798 798
                 'classe_PDF'=>$this->pdf
@@ -826,7 +826,7 @@  discard block
 block discarded – undo
826 826
         if ($startPos === false) {
827 827
             return $cdata;
828 828
         }
829
-        for ($x=$len; $x>0; $x--) {
829
+        for ($x = $len; $x > 0; $x--) {
830 830
             if (substr($cdata, $x, 1) == '>') {
831 831
                 $endPos = $x;
832 832
                 break;
@@ -837,15 +837,15 @@  discard block
 block discarded – undo
837 837
         } else {
838 838
             $parte1 = '';
839 839
         }
840
-        $parte2 = substr($cdata, $startPos, $endPos-$startPos+1);
840
+        $parte2 = substr($cdata, $startPos, $endPos - $startPos + 1);
841 841
         if ($endPos < $len) {
842 842
             $parte3 = substr($cdata, $endPos + 1, $len - $endPos - 1);
843 843
         } else {
844 844
             $parte3 = '';
845 845
         }
846
-        $texto = trim($parte1).' '.trim($parte3);
846
+        $texto = trim($parte1) . ' ' . trim($parte3);
847 847
         if (strpos($parte2, '<CDATA>') === false) {
848
-            $cdata = '<CDATA>'.$parte2.'</CDATA>';
848
+            $cdata = '<CDATA>' . $parte2 . '</CDATA>';
849 849
         } else {
850 850
             $cdata = $parte2;
851 851
         }
@@ -919,15 +919,15 @@  discard block
 block discarded – undo
919 919
         //grupo CADATA infCpl
920 920
         $t = $dom->getElementsByTagName('transmissor')->item(0);
921 921
         $r = $dom->getElementsByTagName('receptor')->item(0);
922
-        $versao = ! empty($dom->getElementsByTagName('versao')->item(0)->nodeValue) ?
923
-            'Versao:'.$dom->getElementsByTagName('versao')->item(0)->nodeValue.' ' : '';
924
-        $especieNF = ! empty($dom->getElementsByTagName('especieNF')->item(0)->nodeValue) ?
925
-            'Especie:'.$dom->getElementsByTagName('especieNF')->item(0)->nodeValue.' ' : '';
926
-        $fabEntrega = ! empty($dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue) ?
927
-            'Entrega:'.$dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue.' ' : '';
928
-        $dca = ! empty($dom->getElementsByTagName('dca')->item(0)->nodeValue) ?
929
-            'dca:'.$dom->getElementsByTagName('dca')->item(0)->nodeValue.' ' : '';
930
-        $texto .= "".$versao.$especieNF.$fabEntrega.$dca;
922
+        $versao = !empty($dom->getElementsByTagName('versao')->item(0)->nodeValue) ?
923
+            'Versao:' . $dom->getElementsByTagName('versao')->item(0)->nodeValue . ' ' : '';
924
+        $especieNF = !empty($dom->getElementsByTagName('especieNF')->item(0)->nodeValue) ?
925
+            'Especie:' . $dom->getElementsByTagName('especieNF')->item(0)->nodeValue . ' ' : '';
926
+        $fabEntrega = !empty($dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue) ?
927
+            'Entrega:' . $dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue . ' ' : '';
928
+        $dca = !empty($dom->getElementsByTagName('dca')->item(0)->nodeValue) ?
929
+            'dca:' . $dom->getElementsByTagName('dca')->item(0)->nodeValue . ' ' : '';
930
+        $texto .= "" . $versao . $especieNF . $fabEntrega . $dca;
931 931
         if (isset($t)) {
932 932
             if ($t->hasAttributes()) {
933 933
                 $texto .= " Transmissor ";
@@ -1048,14 +1048,14 @@  discard block
 block discarded – undo
1048 1048
         }
1049 1049
         //####################################################################################
1050 1050
         //coluna esquerda identificação do emitente
1051
-        $w = round($maxW*0.41, 0);
1051
+        $w = round($maxW * 0.41, 0);
1052 1052
         if ($this->orientacao == 'P') {
1053 1053
             $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>'I'];
1054 1054
         } else {
1055 1055
             $aFont = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B'];
1056 1056
         }
1057 1057
         $w1 = $w;
1058
-        $h=32;
1058
+        $h = 32;
1059 1059
         $oldY += $h;
1060 1060
         $this->pdf->textBox($x, $y, $w, $h);
1061 1061
         $texto = 'IDENTIFICAÇÃO DO EMITENTE';
@@ -1076,39 +1076,39 @@  discard block
 block discarded – undo
1076 1076
                 $type == 'jpg';
1077 1077
             }
1078 1078
             //largura da imagem em mm
1079
-            $logoWmm = ($logoInfo[0]/72)*25.4;
1079
+            $logoWmm = ($logoInfo[0] / 72) * 25.4;
1080 1080
             //altura da imagem em mm
1081
-            $logoHmm = ($logoInfo[1]/72)*25.4;
1082
-            if ($this->logoAlign=='L') {
1083
-                $nImgW = round($w/3, 0);
1084
-                $nImgH = round($logoHmm * ($nImgW/$logoWmm), 0);
1085
-                $xImg = $x+1;
1086
-                $yImg = round(($h-$nImgH)/2, 0)+$y;
1081
+            $logoHmm = ($logoInfo[1] / 72) * 25.4;
1082
+            if ($this->logoAlign == 'L') {
1083
+                $nImgW = round($w / 3, 0);
1084
+                $nImgH = round($logoHmm * ($nImgW / $logoWmm), 0);
1085
+                $xImg = $x + 1;
1086
+                $yImg = round(($h - $nImgH) / 2, 0) + $y;
1087 1087
                 //estabelecer posições do texto
1088
-                $x1 = round($xImg + $nImgW +1, 0);
1089
-                $y1 = round($h/3+$y, 0);
1090
-                $tw = round(2*$w/3, 0);
1091
-            } elseif ($this->logoAlign=='C') {
1092
-                $nImgH = round($h/3, 0);
1093
-                $nImgW = round($logoWmm * ($nImgH/$logoHmm), 0);
1094
-                $xImg = round(($w-$nImgW)/2+$x, 0);
1095
-                $yImg = $y+3;
1088
+                $x1 = round($xImg + $nImgW + 1, 0);
1089
+                $y1 = round($h / 3 + $y, 0);
1090
+                $tw = round(2 * $w / 3, 0);
1091
+            } elseif ($this->logoAlign == 'C') {
1092
+                $nImgH = round($h / 3, 0);
1093
+                $nImgW = round($logoWmm * ($nImgH / $logoHmm), 0);
1094
+                $xImg = round(($w - $nImgW) / 2 + $x, 0);
1095
+                $yImg = $y + 3;
1096 1096
                 $x1 = $x;
1097 1097
                 $y1 = round($yImg + $nImgH + 1, 0);
1098 1098
                 $tw = $w;
1099
-            } elseif ($this->logoAlign=='R') {
1100
-                $nImgW = round($w/3, 0);
1101
-                $nImgH = round($logoHmm * ($nImgW/$logoWmm), 0);
1102
-                $xImg = round($x+($w-(1+$nImgW)), 0);
1103
-                $yImg = round(($h-$nImgH)/2, 0)+$y;
1099
+            } elseif ($this->logoAlign == 'R') {
1100
+                $nImgW = round($w / 3, 0);
1101
+                $nImgH = round($logoHmm * ($nImgW / $logoWmm), 0);
1102
+                $xImg = round($x + ($w - (1 + $nImgW)), 0);
1103
+                $yImg = round(($h - $nImgH) / 2, 0) + $y;
1104 1104
                 $x1 = $x;
1105
-                $y1 = round($h/3+$y, 0);
1106
-                $tw = round(2*$w/3, 0);
1107
-            } elseif ($this->logoAlign=='F') {
1108
-                $nImgH = round($h-5, 0);
1109
-                $nImgW = round($logoWmm * ($nImgH/$logoHmm), 0);
1110
-                $xImg = round(($w-$nImgW)/2+$x, 0);
1111
-                $yImg = $y+3;
1105
+                $y1 = round($h / 3 + $y, 0);
1106
+                $tw = round(2 * $w / 3, 0);
1107
+            } elseif ($this->logoAlign == 'F') {
1108
+                $nImgH = round($h - 5, 0);
1109
+                $nImgW = round($logoWmm * ($nImgH / $logoHmm), 0);
1110
+                $xImg = round(($w - $nImgW) / 2 + $x, 0);
1111
+                $yImg = $y + 3;
1112 1112
                 $x1 = $x;
1113 1113
                 $y1 = round($yImg + $nImgH + 1, 0);
1114 1114
                 $tw = $w;
@@ -1117,7 +1117,7 @@  discard block
 block discarded – undo
1117 1117
             $this->pdf->Image($this->logomarca, $xImg, $yImg, $nImgW, $nImgH, $type);
1118 1118
         } else {
1119 1119
             $x1 = $x;
1120
-            $y1 = round($h/3+$y, 0);
1120
+            $y1 = round($h / 3 + $y, 0);
1121 1121
             $tw = $w;
1122 1122
         }
1123 1123
         // monta as informações apenas se diferente de full logo
@@ -1127,9 +1127,9 @@  discard block
 block discarded – undo
1127 1127
             $texto = $this->emit->getElementsByTagName("xNome")->item(0)->nodeValue;
1128 1128
             $this->pdf->textBox($x1, $y1, $tw, 8, $texto, $aFont, 'T', 'C', 0, '');
1129 1129
             //endereço
1130
-            $y1 = $y1+5;
1130
+            $y1 = $y1 + 5;
1131 1131
             $aFont = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>''];
1132
-            $fone = ! empty($this->enderEmit->getElementsByTagName("fone")->item(0)->nodeValue)
1132
+            $fone = !empty($this->enderEmit->getElementsByTagName("fone")->item(0)->nodeValue)
1133 1133
                  ? $this->enderEmit->getElementsByTagName("fone")->item(0)->nodeValue
1134 1134
                  : '';
1135 1135
             $lgr = $this->getTagValue($this->enderEmit, "xLgr");
@@ -1149,34 +1149,34 @@  discard block
 block discarded – undo
1149 1149
         //####################################################################################
1150 1150
         //coluna central Danfe
1151 1151
         $x += $w;
1152
-        $w=round($maxW * 0.17, 0);//35;
1152
+        $w = round($maxW * 0.17, 0); //35;
1153 1153
         $w2 = $w;
1154 1154
         $h = 32;
1155 1155
         $this->pdf->textBox($x, $y, $w, $h);
1156 1156
   
1157 1157
         $texto = "DANFE";
1158 1158
         $aFont = ['font'=>$this->fontePadrao, 'size'=>14, 'style'=>'B'];
1159
-        $this->pdf->textBox($x, $y+1, $w, $h, $texto, $aFont, 'T', 'C', 0, '');
1159
+        $this->pdf->textBox($x, $y + 1, $w, $h, $texto, $aFont, 'T', 'C', 0, '');
1160 1160
         $aFont = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>''];
1161 1161
         $texto = 'Documento Auxiliar da Nota Fiscal Eletrônica';
1162 1162
         $h = 20;
1163
-        $this->pdf->textBox($x, $y+6, $w, $h, $texto, $aFont, 'T', 'C', 0, '', false);
1163
+        $this->pdf->textBox($x, $y + 6, $w, $h, $texto, $aFont, 'T', 'C', 0, '', false);
1164 1164
         
1165 1165
 
1166 1166
         $aFont = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>''];
1167 1167
         $texto = '0 - ENTRADA';
1168 1168
         $y1 = $y + 14;
1169 1169
         $h = 8;
1170
-        $this->pdf->textBox($x+2, $y1, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1170
+        $this->pdf->textBox($x + 2, $y1, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1171 1171
         $texto = '1 - SAÍDA';
1172 1172
         $y1 = $y + 17;
1173
-        $this->pdf->textBox($x+2, $y1, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1173
+        $this->pdf->textBox($x + 2, $y1, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1174 1174
         //tipo de nF
1175 1175
         $aFont = ['font'=>$this->fontePadrao, 'size'=>12, 'style'=>'B'];
1176 1176
         $y1 = $y + 13;
1177 1177
         $h = 7;
1178 1178
         $texto = $this->ide->getElementsByTagName('tpNF')->item(0)->nodeValue;
1179
-        $this->pdf->textBox($x+27, $y1, 5, $h, $texto, $aFont, 'C', 'C', 1, '');
1179
+        $this->pdf->textBox($x + 27, $y1, 5, $h, $texto, $aFont, 'C', 'C', 1, '');
1180 1180
         //numero da NF
1181 1181
         $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'];
1182 1182
         $y1 = $y + 20;
@@ -1198,7 +1198,7 @@  discard block
 block discarded – undo
1198 1198
         //####################################################################################
1199 1199
         //coluna codigo de barras
1200 1200
         $x += $w;
1201
-        $w = ($maxW-$w1-$w2);//85;
1201
+        $w = ($maxW - $w1 - $w2); //85;
1202 1202
         $w3 = $w;
1203 1203
         $h = 32;
1204 1204
         $this->pdf->textBox($x, $y, $w, $h);
@@ -1207,22 +1207,22 @@  discard block
 block discarded – undo
1207 1207
         $bW = 75;
1208 1208
         $bH = 12;
1209 1209
         //codigo de barras
1210
-        $this->pdf->Code128($x+(($w-$bW)/2), $y+2, $chave_acesso, $bW, $bH);
1210
+        $this->pdf->Code128($x + (($w - $bW) / 2), $y + 2, $chave_acesso, $bW, $bH);
1211 1211
         //linhas divisorias
1212
-        $this->pdf->line($x, $y+4+$bH, $x+$w, $y+4+$bH);
1213
-        $this->pdf->line($x, $y+12+$bH, $x+$w, $y+12+$bH);
1212
+        $this->pdf->line($x, $y + 4 + $bH, $x + $w, $y + 4 + $bH);
1213
+        $this->pdf->line($x, $y + 12 + $bH, $x + $w, $y + 12 + $bH);
1214 1214
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1215
-        $y1 = $y+4+$bH;
1215
+        $y1 = $y + 4 + $bH;
1216 1216
         $h = 7;
1217 1217
         $texto = 'CHAVE DE ACESSO';
1218 1218
         $this->pdf->textBox($x, $y1, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1219 1219
         $aFont = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B'];
1220
-        $y1 = $y+8+$bH;
1220
+        $y1 = $y + 8 + $bH;
1221 1221
         $texto = $this->formatField($chave_acesso, $this->formatoChave);
1222
-        $this->pdf->textBox($x+2, $y1, $w-2, $h, $texto, $aFont, 'T', 'C', 0, '');
1223
-        $y1 = $y+12+$bH;
1222
+        $this->pdf->textBox($x + 2, $y1, $w - 2, $h, $texto, $aFont, 'T', 'C', 0, '');
1223
+        $y1 = $y + 12 + $bH;
1224 1224
         $aFont = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>''];
1225
-        $chaveContingencia="";
1225
+        $chaveContingencia = "";
1226 1226
         if ($this->pNotaDPEC()) {
1227 1227
             $cabecalhoProtoAutorizacao = 'NÚMERO DE REGISTRO DPEC';
1228 1228
         } else {
@@ -1233,16 +1233,16 @@  discard block
 block discarded – undo
1233 1233
             $chaveContingencia = $this->pGeraChaveAdicionalDeContingencia();
1234 1234
             $this->pdf->setFillColor(0, 0, 0);
1235 1235
             //codigo de barras
1236
-            $this->pdf->code128($x+11, $y1+1, $chaveContingencia, $bW*.9, $bH/2);
1236
+            $this->pdf->code128($x + 11, $y1 + 1, $chaveContingencia, $bW * .9, $bH / 2);
1237 1237
         } else {
1238 1238
             $texto = 'Consulta de autenticidade no portal nacional da NF-e';
1239
-            $this->pdf->textBox($x+2, $y1, $w-2, $h, $texto, $aFont, 'T', 'C', 0, '');
1240
-            $y1 = $y+16+$bH;
1239
+            $this->pdf->textBox($x + 2, $y1, $w - 2, $h, $texto, $aFont, 'T', 'C', 0, '');
1240
+            $y1 = $y + 16 + $bH;
1241 1241
             $texto = 'www.nfe.fazenda.gov.br/portal ou no site da Sefaz Autorizadora';
1242 1242
             $this->pdf->textBox(
1243
-                $x+2,
1243
+                $x + 2,
1244 1244
                 $y1,
1245
-                $w-2,
1245
+                $w - 2,
1246 1246
                 $h,
1247 1247
                 $texto,
1248 1248
                 $aFont,
@@ -1258,7 +1258,7 @@  discard block
 block discarded – undo
1258 1258
         //natureza da operação
1259 1259
         $texto = 'NATUREZA DA OPERAÇÃO';
1260 1260
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1261
-        $w = $w1+$w2;
1261
+        $w = $w1 + $w2;
1262 1262
         $y = $oldY;
1263 1263
         $oldY += $h;
1264 1264
         $x = $oldX;
@@ -1288,7 +1288,7 @@  discard block
 block discarded – undo
1288 1288
                 $cStat = '';
1289 1289
             } else {
1290 1290
                 if (isset($this->nfeProc)) {
1291
-                    $texto = ! empty($this->nfeProc->getElementsByTagName("nProt")->item(0)->nodeValue) ?
1291
+                    $texto = !empty($this->nfeProc->getElementsByTagName("nProt")->item(0)->nodeValue) ?
1292 1292
                             $this->nfeProc->getElementsByTagName("nProt")->item(0)->nodeValue : '';
1293 1293
                     $tsHora = $this->convertTime($this->nfeProc->getElementsByTagName("dhRecbto")->item(0)->nodeValue);
1294 1294
                     if ($texto != '') {
@@ -1319,25 +1319,25 @@  discard block
 block discarded – undo
1319 1319
         $texto = 'INSCRIÇÃO ESTADUAL DO SUBST. TRIBUT.';
1320 1320
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1321 1321
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1322
-        $texto = ! empty($this->emit->getElementsByTagName("IEST")->item(0)->nodeValue)
1322
+        $texto = !empty($this->emit->getElementsByTagName("IEST")->item(0)->nodeValue)
1323 1323
              ? $this->emit->getElementsByTagName("IEST")->item(0)->nodeValue
1324 1324
              : '';
1325 1325
         $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'];
1326 1326
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1327 1327
         //CNPJ
1328 1328
         $x += $w;
1329
-        $w = ($maxW-(2*$w));
1329
+        $w = ($maxW - (2 * $w));
1330 1330
         $texto = 'CNPJ / CPF';
1331 1331
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1332 1332
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1333 1333
         //Pegando valor do CPF/CNPJ
1334
-        if (! empty($this->emit->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1334
+        if (!empty($this->emit->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1335 1335
             $texto = $this->formatField(
1336 1336
                 $this->emit->getElementsByTagName("CNPJ")->item(0)->nodeValue,
1337 1337
                 "###.###.###/####-##"
1338 1338
             );
1339 1339
         } else {
1340
-            $texto = ! empty($this->emit->getElementsByTagName("CPF")->item(0)->nodeValue) ?
1340
+            $texto = !empty($this->emit->getElementsByTagName("CPF")->item(0)->nodeValue) ?
1341 1341
                 $this->formatField(
1342 1342
                     $this->emit->getElementsByTagName("CPF")->item(0)->nodeValue,
1343 1343
                     "###.###.###-##"
@@ -1353,22 +1353,22 @@  discard block
 block discarded – undo
1353 1353
         $resp = $this->statusNFe();
1354 1354
         if (!$resp['status']) {
1355 1355
             $x = 10;
1356
-            $y = $this->hPrint-130;
1356
+            $y = $this->hPrint - 130;
1357 1357
             $h = 25;
1358
-            $w = $maxW-(2*$x);
1358
+            $w = $maxW - (2 * $x);
1359 1359
             $this->pdf->setTextColor(90, 90, 90);
1360 1360
             $texto = $resp['message'];
1361 1361
             $aFont = ['font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B'];
1362 1362
             $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1363 1363
             $y += $h;
1364 1364
             $h = 5;
1365
-            $w = $maxW-(2*$x);
1365
+            $w = $maxW - (2 * $x);
1366 1366
             if (isset($this->infProt) && $resp['status']) {
1367 1367
                 $xMotivo = $this->infProt->getElementsByTagName("xMotivo")->item(0)->nodeValue;
1368 1368
             } else {
1369 1369
                 $xMotivo = '';
1370 1370
             }
1371
-            $texto = "SEM VALOR FISCAL\n".$xMotivo;
1371
+            $texto = "SEM VALOR FISCAL\n" . $xMotivo;
1372 1372
             $aFont = ['font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B'];
1373 1373
             $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1374 1374
             $this->pdf->setTextColor(0, 0, 0);
@@ -1391,12 +1391,12 @@  discard block
 block discarded – undo
1391 1391
         if ($this->pNotaDPEC() || $this->tpEmis == 4) {
1392 1392
             //DPEC
1393 1393
             $x = 10;
1394
-            $y = $this->hPrint-130;
1394
+            $y = $this->hPrint - 130;
1395 1395
             $h = 25;
1396
-            $w = $maxW-(2*$x);
1396
+            $w = $maxW - (2 * $x);
1397 1397
             $this->pdf->SetTextColor(200, 200, 200);
1398
-            $texto = "DANFE impresso em contingência -\n".
1399
-                     "DPEC regularmente recebido pela Receita\n".
1398
+            $texto = "DANFE impresso em contingência -\n" .
1399
+                     "DPEC regularmente recebido pela Receita\n" .
1400 1400
                      "Federal do Brasil";
1401 1401
             $aFont = ['font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B'];
1402 1402
             $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
@@ -1515,7 +1515,7 @@  discard block
 block discarded – undo
1515 1515
         $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
1516 1516
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1517 1517
         //NOME / RAZÃO SOCIAL
1518
-        $w = round($maxW*0.61, 0);
1518
+        $w = round($maxW * 0.61, 0);
1519 1519
         $w1 = $w;
1520 1520
         $y += 3;
1521 1521
         $texto = 'NOME / RAZÃO SOCIAL';
@@ -1530,19 +1530,19 @@  discard block
 block discarded – undo
1530 1530
         }
1531 1531
         //CNPJ / CPF
1532 1532
         $x += $w;
1533
-        $w = round($maxW*0.23, 0);
1533
+        $w = round($maxW * 0.23, 0);
1534 1534
         $w2 = $w;
1535 1535
         $texto = 'CNPJ / CPF';
1536 1536
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1537 1537
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1538 1538
         //Pegando valor do CPF/CNPJ
1539
-        if (! empty($this->dest->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1539
+        if (!empty($this->dest->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1540 1540
             $texto = $this->formatField(
1541 1541
                 $this->dest->getElementsByTagName("CNPJ")->item(0)->nodeValue,
1542 1542
                 "###.###.###/####-##"
1543 1543
             );
1544 1544
         } else {
1545
-            $texto = ! empty($this->dest->getElementsByTagName("CPF")->item(0)->nodeValue) ?
1545
+            $texto = !empty($this->dest->getElementsByTagName("CPF")->item(0)->nodeValue) ?
1546 1546
                     $this->formatField(
1547 1547
                         $this->dest->getElementsByTagName("CPF")->item(0)->nodeValue,
1548 1548
                         "###.###.###-##"
@@ -1552,15 +1552,15 @@  discard block
 block discarded – undo
1552 1552
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1553 1553
         //DATA DA EMISSÃO
1554 1554
         $x += $w;
1555
-        $w = $maxW-($w1+$w2);
1555
+        $w = $maxW - ($w1 + $w2);
1556 1556
         $wx = $w;
1557 1557
         $texto = 'DATA DA EMISSÃO';
1558 1558
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1559 1559
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1560
-        $dEmi = ! empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
1560
+        $dEmi = !empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
1561 1561
                 $this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue : '';
1562 1562
         if ($dEmi == '') {
1563
-            $dEmi = ! empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
1563
+            $dEmi = !empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
1564 1564
                     $this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue : '';
1565 1565
             $aDemi = explode('T', $dEmi);
1566 1566
             $dEmi = $aDemi[0];
@@ -1573,7 +1573,7 @@  discard block
 block discarded – undo
1573 1573
             $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 1, '');
1574 1574
         }
1575 1575
         //ENDEREÇO
1576
-        $w = round($maxW*0.47, 0);
1576
+        $w = round($maxW * 0.47, 0);
1577 1577
         $w1 = $w;
1578 1578
         $y += $h;
1579 1579
         $x = $oldX;
@@ -1588,7 +1588,7 @@  discard block
 block discarded – undo
1588 1588
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 0, '', true);
1589 1589
         //BAIRRO / DISTRITO
1590 1590
         $x += $w;
1591
-        $w = round($maxW*0.21, 0);
1591
+        $w = round($maxW * 0.21, 0);
1592 1592
         $w2 = $w;
1593 1593
         $texto = 'BAIRRO / DISTRITO';
1594 1594
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
@@ -1598,12 +1598,12 @@  discard block
 block discarded – undo
1598 1598
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1599 1599
         //CEP
1600 1600
         $x += $w;
1601
-        $w = $maxW-$w1-$w2-$wx;
1601
+        $w = $maxW - $w1 - $w2 - $wx;
1602 1602
         $w2 = $w;
1603 1603
         $texto = 'CEP';
1604 1604
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1605 1605
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1606
-        $texto = ! empty($this->dest->getElementsByTagName("CEP")->item(0)->nodeValue) ?
1606
+        $texto = !empty($this->dest->getElementsByTagName("CEP")->item(0)->nodeValue) ?
1607 1607
                 $this->dest->getElementsByTagName("CEP")->item(0)->nodeValue : '';
1608 1608
         $texto = $this->formatField($texto, "#####-###");
1609 1609
         $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'];
@@ -1614,10 +1614,10 @@  discard block
 block discarded – undo
1614 1614
         $texto = 'DATA DA SAÍDA/ENTRADA';
1615 1615
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1616 1616
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1617
-        $dSaiEnt = ! empty($this->ide->getElementsByTagName("dSaiEnt")->item(0)->nodeValue) ?
1617
+        $dSaiEnt = !empty($this->ide->getElementsByTagName("dSaiEnt")->item(0)->nodeValue) ?
1618 1618
                 $this->ide->getElementsByTagName("dSaiEnt")->item(0)->nodeValue : '';
1619 1619
         if ($dSaiEnt == '') {
1620
-            $dSaiEnt = ! empty($this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue) ?
1620
+            $dSaiEnt = !empty($this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue) ?
1621 1621
                     $this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue : '';
1622 1622
             $aDsaient = explode('T', $dSaiEnt);
1623 1623
             $dSaiEnt = $aDsaient[0];
@@ -1634,7 +1634,7 @@  discard block
 block discarded – undo
1634 1634
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1635 1635
         $texto = $this->dest->getElementsByTagName("xMun")->item(0)->nodeValue;
1636 1636
         if (strtoupper(trim($texto)) == "EXTERIOR" && $this->dest->getElementsByTagName("xPais")->length > 0) {
1637
-            $texto .= " - " .  $this->dest->getElementsByTagName("xPais")->item(0)->nodeValue;
1637
+            $texto .= " - " . $this->dest->getElementsByTagName("xPais")->item(0)->nodeValue;
1638 1638
         }
1639 1639
         $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'];
1640 1640
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 0, '');
@@ -1649,18 +1649,18 @@  discard block
 block discarded – undo
1649 1649
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1650 1650
         //FONE / FAX
1651 1651
         $x += $w;
1652
-        $w = round(($maxW -$w1-$wx-8)/2, 0);
1652
+        $w = round(($maxW - $w1 - $wx - 8) / 2, 0);
1653 1653
         $w3 = $w;
1654 1654
         $texto = 'FONE / FAX';
1655 1655
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1656 1656
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1657
-        $texto = ! empty($this->dest->getElementsByTagName("fone")->item(0)->nodeValue) ?
1657
+        $texto = !empty($this->dest->getElementsByTagName("fone")->item(0)->nodeValue) ?
1658 1658
                 $this->dest->getElementsByTagName("fone")->item(0)->nodeValue : '';
1659 1659
         $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'];
1660 1660
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1661 1661
         //INSCRIÇÃO ESTADUAL
1662 1662
         $x += $w;
1663
-        $w = $maxW -$w1-$wx-8-$w3;
1663
+        $w = $maxW - $w1 - $wx - 8 - $w3;
1664 1664
         $texto = 'INSCRIÇÃO ESTADUAL';
1665 1665
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1666 1666
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -1674,10 +1674,10 @@  discard block
 block discarded – undo
1674 1674
         $texto = 'HORA DA SAÍDA/ENTRADA';
1675 1675
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1676 1676
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1677
-        $hSaiEnt = ! empty($this->ide->getElementsByTagName("hSaiEnt")->item(0)->nodeValue) ?
1677
+        $hSaiEnt = !empty($this->ide->getElementsByTagName("hSaiEnt")->item(0)->nodeValue) ?
1678 1678
                 $this->ide->getElementsByTagName("hSaiEnt")->item(0)->nodeValue : '';
1679 1679
         if ($hSaiEnt == '') {
1680
-            $dhSaiEnt = ! empty($this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue) ?
1680
+            $dhSaiEnt = !empty($this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue) ?
1681 1681
                     $this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue : '';
1682 1682
             $tsDhSaiEnt = $this->convertTime($dhSaiEnt);
1683 1683
             if ($tsDhSaiEnt != '') {
@@ -1756,7 +1756,7 @@  discard block
 block discarded – undo
1756 1756
     protected function faturaDANFE($x, $y)
1757 1757
     {
1758 1758
         $linha = 1;
1759
-        $h = 8+3;
1759
+        $h = 8 + 3;
1760 1760
         $oldx = $x;
1761 1761
         $textoFatura = $this->getTextoFatura();
1762 1762
         //verificar se existem duplicatas
@@ -1777,27 +1777,27 @@  discard block
 block discarded – undo
1777 1777
             $dupcont = 0;
1778 1778
             $nFat = $this->dup->length;
1779 1779
             if ($textoFatura !== "" && $this->exibirTextoFatura) {
1780
-                $myH=6;
1780
+                $myH = 6;
1781 1781
                 $myW = $this->wPrint;
1782 1782
                 if ($this->orientacao == 'L') {
1783 1783
                     $myW -= $this->wCanhoto;
1784 1784
                 }
1785 1785
                 $aFont = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>''];
1786 1786
                 $this->pdf->textBox($x, $y, $myW, $myH, $textoFatura, $aFont, 'C', 'L', 1, '');
1787
-                $y+=$myH+1;
1787
+                $y += $myH + 1;
1788 1788
             }
1789 1789
             if ($this->orientacao == 'P') {
1790
-                $w = round($this->wPrint/7.018, 0)-1;
1790
+                $w = round($this->wPrint / 7.018, 0) - 1;
1791 1791
             } else {
1792 1792
                 $w = 28;
1793 1793
             }
1794 1794
             $increm = 1;
1795 1795
             foreach ($this->dup as $k => $d) {
1796
-                $nDup = ! empty($this->dup->item($k)->getElementsByTagName('nDup')->item(0)->nodeValue) ?
1796
+                $nDup = !empty($this->dup->item($k)->getElementsByTagName('nDup')->item(0)->nodeValue) ?
1797 1797
                         $this->dup->item($k)->getElementsByTagName('nDup')->item(0)->nodeValue : '';
1798
-                $dDup = ! empty($this->dup->item($k)->getElementsByTagName('dVenc')->item(0)->nodeValue) ?
1798
+                $dDup = !empty($this->dup->item($k)->getElementsByTagName('dVenc')->item(0)->nodeValue) ?
1799 1799
                         $this->ymdTodmy($this->dup->item($k)->getElementsByTagName('dVenc')->item(0)->nodeValue) : '';
1800
-                $vDup = ! empty($this->dup->item($k)->getElementsByTagName('vDup')->item(0)->nodeValue) ?
1800
+                $vDup = !empty($this->dup->item($k)->getElementsByTagName('vDup')->item(0)->nodeValue) ?
1801 1801
                         'R$ ' . number_format(
1802 1802
                             $this->dup->item($k)->getElementsByTagName('vDup')->item(0)->nodeValue,
1803 1803
                             2,
@@ -1806,14 +1806,14 @@  discard block
 block discarded – undo
1806 1806
                         ) : '';
1807 1807
                 $h = 8;
1808 1808
                 $texto = '';
1809
-                if ($nDup!='0' && $nDup!='') {
1809
+                if ($nDup != '0' && $nDup != '') {
1810 1810
                     $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1811 1811
                     $this->pdf->textBox($x, $y, $w, $h, 'Num.', $aFont, 'T', 'L', 1, '');
1812 1812
                     $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
1813 1813
                     $this->pdf->textBox($x, $y, $w, $h, $nDup, $aFont, 'T', 'R', 0, '');
1814 1814
                 } else {
1815 1815
                     $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1816
-                    $this->pdf->textBox($x, $y, $w, $h, ($dupcont+1)."", $aFont, 'T', 'L', 1, '');
1816
+                    $this->pdf->textBox($x, $y, $w, $h, ($dupcont + 1) . "", $aFont, 'T', 'L', 1, '');
1817 1817
                 }
1818 1818
                 $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1819 1819
                 $this->pdf->textBox($x, $y, $w, $h, 'Venc.', $aFont, 'C', 'L', 0, '');
@@ -1823,7 +1823,7 @@  discard block
 block discarded – undo
1823 1823
                 $this->pdf->textBox($x, $y, $w, $h, 'Valor', $aFont, 'B', 'L', 0, '');
1824 1824
                 $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
1825 1825
                 $this->pdf->textBox($x, $y, $w, $h, $vDup, $aFont, 'B', 'R', 0, '');
1826
-                $x += $w+$increm;
1826
+                $x += $w + $increm;
1827 1827
                 $dupcont += 1;
1828 1828
                 if ($this->orientacao == 'P') {
1829 1829
                     $maxDupCont = 6;
@@ -1845,10 +1845,10 @@  discard block
 block discarded – undo
1845 1845
                 $y -= 9;
1846 1846
                 $linha--;
1847 1847
             }
1848
-            return ($y+$h);
1848
+            return ($y + $h);
1849 1849
         } else {
1850 1850
             $linha = 0;
1851
-            return ($y-2);
1851
+            return ($y - 2);
1852 1852
         }
1853 1853
     } //fim da função faturaDANFE
1854 1854
 
@@ -1864,7 +1864,7 @@  discard block
 block discarded – undo
1864 1864
     protected function pagamentoDANFE($x, $y)
1865 1865
     {
1866 1866
         $linha = 1;
1867
-        $h = 8+3;
1867
+        $h = 8 + 3;
1868 1868
         $oldx = $x;
1869 1869
         //verificar se existem cobranças definidas
1870 1870
         if (isset($this->detPag) && $this->detPag->length > 0) {
@@ -1883,7 +1883,7 @@  discard block
 block discarded – undo
1883 1883
             $dups = "";
1884 1884
             $dupcont = 0;
1885 1885
             if ($this->orientacao == 'P') {
1886
-                $w = round($this->wPrint/7.018, 0)-1;
1886
+                $w = round($this->wPrint / 7.018, 0) - 1;
1887 1887
             } else {
1888 1888
                 $w = 28;
1889 1889
             }
@@ -1893,16 +1893,16 @@  discard block
 block discarded – undo
1893 1893
                 $maxDupCont = 8;
1894 1894
             }
1895 1895
             $increm = 1;
1896
-            $formaPagamento = ['01'=>'Dinheiro','02'=>'Cheque','03'=>'Cartão de Crédito',
1897
-                                    '04'=>'Cartão de Débito','05'=>'Crédito Loja','10'=>'Vale Alimentação',
1898
-                                    '11'=>'Vale Refeição','12'=>'Vale Presente','13'=>'Vale Combustível',
1899
-                                    '14'=>'Duplicata Mercantil','15'=>'Boleto','90'=>'Sem pagamento','99'=>'Outros'];
1900
-            $bandeira = ['01'=>'Visa','02'=>'Mastercard','03'=>'American','04'=>'Sorocred','05'=>'Diners',
1901
-                              '06'=>'Elo','07'=>'Hipercard','08'=>'Aura','09'=>'Cabal','99'=>'Outros'];
1896
+            $formaPagamento = ['01'=>'Dinheiro', '02'=>'Cheque', '03'=>'Cartão de Crédito',
1897
+                                    '04'=>'Cartão de Débito', '05'=>'Crédito Loja', '10'=>'Vale Alimentação',
1898
+                                    '11'=>'Vale Refeição', '12'=>'Vale Presente', '13'=>'Vale Combustível',
1899
+                                    '14'=>'Duplicata Mercantil', '15'=>'Boleto', '90'=>'Sem pagamento', '99'=>'Outros'];
1900
+            $bandeira = ['01'=>'Visa', '02'=>'Mastercard', '03'=>'American', '04'=>'Sorocred', '05'=>'Diners',
1901
+                              '06'=>'Elo', '07'=>'Hipercard', '08'=>'Aura', '09'=>'Cabal', '99'=>'Outros'];
1902 1902
             foreach ($this->detPag as $k => $d) {
1903 1903
                 $fPag = !empty($this->detPag->item($k)->getElementsByTagName('tPag')->item(0)->nodeValue)
1904 1904
                     ? $this->detPag->item($k)->getElementsByTagName('tPag')->item(0)->nodeValue : '0';
1905
-                $vPag = ! empty($this->detPag->item($k)->getElementsByTagName('vPag')->item(0)->nodeValue)
1905
+                $vPag = !empty($this->detPag->item($k)->getElementsByTagName('vPag')->item(0)->nodeValue)
1906 1906
                     ? 'R$ ' . number_format(
1907 1907
                         $this->detPag->item($k)->getElementsByTagName('vPag')->item(0)->nodeValue,
1908 1908
                         2,
@@ -1913,7 +1913,7 @@  discard block
 block discarded – undo
1913 1913
                 $texto = '';
1914 1914
                 if (isset($formaPagamento[$fPag])) {
1915 1915
                     /*Exibir Item sem pagamento ou outros?*/
1916
-                    if ($fPag=='90' || $fPag=='99') {
1916
+                    if ($fPag == '90' || $fPag == '99') {
1917 1917
                         continue;
1918 1918
                     }
1919 1919
                     $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
@@ -1922,16 +1922,16 @@  discard block
 block discarded – undo
1922 1922
                     $this->pdf->textBox($x, $y, $w, $h, $formaPagamento[$fPag], $aFont, 'T', 'R', 0, '');
1923 1923
                 } else {
1924 1924
                     $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>''];
1925
-                    $this->pdf->textBox($x, $y, $w, $h, "Forma ".$fPag." não encontrado", $aFont, 'T', 'L', 1, '');
1925
+                    $this->pdf->textBox($x, $y, $w, $h, "Forma " . $fPag . " não encontrado", $aFont, 'T', 'L', 1, '');
1926 1926
                 }
1927 1927
                 $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1928 1928
                 $this->pdf->textBox($x, $y, $w, $h, 'Valor', $aFont, 'B', 'L', 0, '');
1929 1929
                 $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
1930 1930
                 $this->pdf->textBox($x, $y, $w, $h, $vPag, $aFont, 'B', 'R', 0, '');
1931
-                $x += $w+$increm;
1931
+                $x += $w + $increm;
1932 1932
                 $dupcont += 1;
1933 1933
 
1934
-                if ($dupcont>$maxDupCont) {
1934
+                if ($dupcont > $maxDupCont) {
1935 1935
                     $y += 9;
1936 1936
                     $x = $oldx;
1937 1937
                     $dupcont = 0;
@@ -1946,10 +1946,10 @@  discard block
 block discarded – undo
1946 1946
                 $y -= 9;
1947 1947
                 $linha--;
1948 1948
             }
1949
-            return ($y+$h);
1949
+            return ($y + $h);
1950 1950
         } else {
1951 1951
             $linha = 0;
1952
-            return ($y-2);
1952
+            return ($y - 2);
1953 1953
         }
1954 1954
     } //fim da função pagamentoDANFE
1955 1955
     
@@ -2061,7 +2061,7 @@  discard block
 block discarded – undo
2061 2061
         }
2062 2062
         $x = $this->impostoDanfeHelper($x, $y, $w, $h, "V. TOTAL DA NOTA", "vNF");
2063 2063
 
2064
-        return ($y+$h);
2064
+        return ($y + $h);
2065 2065
     } //fim impostoDANFE
2066 2066
 
2067 2067
     /**
@@ -2089,13 +2089,13 @@  discard block
 block discarded – undo
2089 2089
         $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
2090 2090
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
2091 2091
         //NOME / RAZÃO SOCIAL
2092
-        $w1 = $maxW*0.29;
2092
+        $w1 = $maxW * 0.29;
2093 2093
         $y += 3;
2094 2094
         $texto = 'NOME / RAZÃO SOCIAL';
2095 2095
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2096 2096
         $this->pdf->textBox($x, $y, $w1, $h, $texto, $aFont, 'T', 'L', 1, '');
2097 2097
         if (isset($this->transporta)) {
2098
-            $texto = ! empty($this->transporta->getElementsByTagName("xNome")->item(0)->nodeValue) ?
2098
+            $texto = !empty($this->transporta->getElementsByTagName("xNome")->item(0)->nodeValue) ?
2099 2099
                     $this->transporta->getElementsByTagName("xNome")->item(0)->nodeValue : '';
2100 2100
         } else {
2101 2101
             $texto = '';
@@ -2104,11 +2104,11 @@  discard block
 block discarded – undo
2104 2104
         $this->pdf->textBox($x, $y, $w1, $h, $texto, $aFont, 'B', 'L', 0, '');
2105 2105
         //FRETE POR CONTA
2106 2106
         $x += $w1;
2107
-        $w2 = $maxW*0.15;
2107
+        $w2 = $maxW * 0.15;
2108 2108
         $texto = 'FRETE';
2109 2109
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2110 2110
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
2111
-        $tipoFrete = ! empty($this->transp->getElementsByTagName("modFrete")->item(0)->nodeValue) ?
2111
+        $tipoFrete = !empty($this->transp->getElementsByTagName("modFrete")->item(0)->nodeValue) ?
2112 2112
                 $this->transp->getElementsByTagName("modFrete")->item(0)->nodeValue : '0';
2113 2113
         switch ($tipoFrete) {
2114 2114
             case 0:
@@ -2138,7 +2138,7 @@  discard block
 block discarded – undo
2138 2138
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2139 2139
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
2140 2140
         if (isset($this->veicTransp)) {
2141
-            $texto = ! empty($this->veicTransp->getElementsByTagName("RNTC")->item(0)->nodeValue) ?
2141
+            $texto = !empty($this->veicTransp->getElementsByTagName("RNTC")->item(0)->nodeValue) ?
2142 2142
                     $this->veicTransp->getElementsByTagName("RNTC")->item(0)->nodeValue : '';
2143 2143
         } else {
2144 2144
             $texto = '';
@@ -2151,10 +2151,10 @@  discard block
 block discarded – undo
2151 2151
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2152 2152
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
2153 2153
         if (isset($this->veicTransp)) {
2154
-            $texto = ! empty($this->veicTransp->getElementsByTagName("placa")->item(0)->nodeValue) ?
2154
+            $texto = !empty($this->veicTransp->getElementsByTagName("placa")->item(0)->nodeValue) ?
2155 2155
                     $this->veicTransp->getElementsByTagName("placa")->item(0)->nodeValue : '';
2156 2156
         } elseif (isset($this->reboque)) {
2157
-            $texto = ! empty($this->reboque->getElementsByTagName("placa")->item(0)->nodeValue) ?
2157
+            $texto = !empty($this->reboque->getElementsByTagName("placa")->item(0)->nodeValue) ?
2158 2158
                     $this->reboque->getElementsByTagName("placa")->item(0)->nodeValue : '';
2159 2159
         } else {
2160 2160
             $texto = '';
@@ -2163,15 +2163,15 @@  discard block
 block discarded – undo
2163 2163
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'B', 'C', 0, '');
2164 2164
         //UF
2165 2165
         $x += $w2;
2166
-        $w3 = round($maxW*0.04, 0);
2166
+        $w3 = round($maxW * 0.04, 0);
2167 2167
         $texto = 'UF';
2168 2168
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2169 2169
         $this->pdf->textBox($x, $y, $w3, $h, $texto, $aFont, 'T', 'L', 1, '');
2170 2170
         if (isset($this->veicTransp)) {
2171
-            $texto = ! empty($this->veicTransp->getElementsByTagName("UF")->item(0)->nodeValue) ?
2171
+            $texto = !empty($this->veicTransp->getElementsByTagName("UF")->item(0)->nodeValue) ?
2172 2172
                     $this->veicTransp->getElementsByTagName("UF")->item(0)->nodeValue : '';
2173 2173
         } elseif (isset($this->reboque)) {
2174
-            $texto = ! empty($this->reboque->getElementsByTagName("UF")->item(0)->nodeValue) ?
2174
+            $texto = !empty($this->reboque->getElementsByTagName("UF")->item(0)->nodeValue) ?
2175 2175
                     $this->reboque->getElementsByTagName("UF")->item(0)->nodeValue : '';
2176 2176
         } else {
2177 2177
             $texto = '';
@@ -2180,18 +2180,18 @@  discard block
 block discarded – undo
2180 2180
         $this->pdf->textBox($x, $y, $w3, $h, $texto, $aFont, 'B', 'C', 0, '');
2181 2181
         //CNPJ / CPF
2182 2182
         $x += $w3;
2183
-        $w = $maxW-($w1+3*$w2+$w3);
2183
+        $w = $maxW - ($w1 + 3 * $w2 + $w3);
2184 2184
         $texto = 'CNPJ / CPF';
2185 2185
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2186 2186
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
2187 2187
         if (isset($this->transporta)) {
2188
-            $texto = ! empty($this->transporta->getElementsByTagName("CNPJ")->item(0)->nodeValue) ?
2188
+            $texto = !empty($this->transporta->getElementsByTagName("CNPJ")->item(0)->nodeValue) ?
2189 2189
                     $this->formatField(
2190 2190
                         $this->transporta->getElementsByTagName("CNPJ")->item(0)->nodeValue,
2191 2191
                         "##.###.###/####-##"
2192 2192
                     ) : '';
2193 2193
             if ($texto == '') {
2194
-                $texto = ! empty($this->transporta->getElementsByTagName("CPF")->item(0)->nodeValue) ?
2194
+                $texto = !empty($this->transporta->getElementsByTagName("CPF")->item(0)->nodeValue) ?
2195 2195
                         $this->formatField(
2196 2196
                             $this->transporta->getElementsByTagName("CPF")->item(0)->nodeValue,
2197 2197
                             "###.###.###-##"
@@ -2207,12 +2207,12 @@  discard block
 block discarded – undo
2207 2207
         $y += $h;
2208 2208
         $x = $oldX;
2209 2209
         $h = 7;
2210
-        $w1 = $maxW*0.44;
2210
+        $w1 = $maxW * 0.44;
2211 2211
         $texto = 'ENDEREÇO';
2212 2212
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2213 2213
         $this->pdf->textBox($x, $y, $w1, $h, $texto, $aFont, 'T', 'L', 1, '');
2214 2214
         if (isset($this->transporta)) {
2215
-            $texto = ! empty($this->transporta->getElementsByTagName("xEnder")->item(0)->nodeValue) ?
2215
+            $texto = !empty($this->transporta->getElementsByTagName("xEnder")->item(0)->nodeValue) ?
2216 2216
                     $this->transporta->getElementsByTagName("xEnder")->item(0)->nodeValue : '';
2217 2217
         } else {
2218 2218
             $texto = '';
@@ -2221,12 +2221,12 @@  discard block
 block discarded – undo
2221 2221
         $this->pdf->textBox($x, $y, $w1, $h, $texto, $aFont, 'B', 'L', 0, '');
2222 2222
         //MUNICÍPIO
2223 2223
         $x += $w1;
2224
-        $w2 = round($maxW*0.30, 0);
2224
+        $w2 = round($maxW * 0.30, 0);
2225 2225
         $texto = 'MUNICÍPIO';
2226 2226
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2227 2227
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
2228 2228
         if (isset($this->transporta)) {
2229
-            $texto = ! empty($this->transporta->getElementsByTagName("xMun")->item(0)->nodeValue) ?
2229
+            $texto = !empty($this->transporta->getElementsByTagName("xMun")->item(0)->nodeValue) ?
2230 2230
                     $this->transporta->getElementsByTagName("xMun")->item(0)->nodeValue : '';
2231 2231
         } else {
2232 2232
             $texto = '';
@@ -2235,12 +2235,12 @@  discard block
 block discarded – undo
2235 2235
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'B', 'C', 0, '');
2236 2236
         //UF
2237 2237
         $x += $w2;
2238
-        $w3 = round($maxW*0.04, 0);
2238
+        $w3 = round($maxW * 0.04, 0);
2239 2239
         $texto = 'UF';
2240 2240
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2241 2241
         $this->pdf->textBox($x, $y, $w3, $h, $texto, $aFont, 'T', 'L', 1, '');
2242 2242
         if (isset($this->transporta)) {
2243
-            $texto = ! empty($this->transporta->getElementsByTagName("UF")->item(0)->nodeValue) ?
2243
+            $texto = !empty($this->transporta->getElementsByTagName("UF")->item(0)->nodeValue) ?
2244 2244
                     $this->transporta->getElementsByTagName("UF")->item(0)->nodeValue : '';
2245 2245
         } else {
2246 2246
             $texto = '';
@@ -2249,13 +2249,13 @@  discard block
 block discarded – undo
2249 2249
         $this->pdf->textBox($x, $y, $w3, $h, $texto, $aFont, 'B', 'C', 0, '');
2250 2250
         //INSCRIÇÃO ESTADUAL
2251 2251
         $x += $w3;
2252
-        $w = $maxW-($w1+$w2+$w3);
2252
+        $w = $maxW - ($w1 + $w2 + $w3);
2253 2253
         $texto = 'INSCRIÇÃO ESTADUAL';
2254 2254
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2255 2255
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
2256 2256
         $texto = '';
2257 2257
         if (isset($this->transporta)) {
2258
-            if (! empty($this->transporta->getElementsByTagName("IE")->item(0)->nodeValue)) {
2258
+            if (!empty($this->transporta->getElementsByTagName("IE")->item(0)->nodeValue)) {
2259 2259
                 $texto = $this->transporta->getElementsByTagName("IE")->item(0)->nodeValue;
2260 2260
             }
2261 2261
         }
@@ -2268,16 +2268,16 @@  discard block
 block discarded – undo
2268 2268
         $marca = '';
2269 2269
         $numero = '';
2270 2270
         $texto = '';
2271
-        $pesoBruto=0;
2272
-        $pesoLiquido=0;
2271
+        $pesoBruto = 0;
2272
+        $pesoLiquido = 0;
2273 2273
         foreach ($volumes as $volume) {
2274
-            $quantidade += ! empty($volume->getElementsByTagName("qVol")->item(0)->nodeValue) ?
2274
+            $quantidade += !empty($volume->getElementsByTagName("qVol")->item(0)->nodeValue) ?
2275 2275
                     $volume->getElementsByTagName("qVol")->item(0)->nodeValue : 0;
2276
-            $pesoBruto += ! empty($volume->getElementsByTagName("pesoB")->item(0)->nodeValue) ?
2276
+            $pesoBruto += !empty($volume->getElementsByTagName("pesoB")->item(0)->nodeValue) ?
2277 2277
                     $volume->getElementsByTagName("pesoB")->item(0)->nodeValue : 0;
2278
-            $pesoLiquido += ! empty($volume->getElementsByTagName("pesoL")->item(0)->nodeValue) ?
2278
+            $pesoLiquido += !empty($volume->getElementsByTagName("pesoL")->item(0)->nodeValue) ?
2279 2279
                     $volume->getElementsByTagName("pesoL")->item(0)->nodeValue : 0;
2280
-            $texto = ! empty($this->transp->getElementsByTagName("esp")->item(0)->nodeValue) ?
2280
+            $texto = !empty($this->transp->getElementsByTagName("esp")->item(0)->nodeValue) ?
2281 2281
                     $this->transp->getElementsByTagName("esp")->item(0)->nodeValue : '';
2282 2282
             if ($texto != $especie && $especie != '') {
2283 2283
                 //tem várias especies
@@ -2285,7 +2285,7 @@  discard block
 block discarded – undo
2285 2285
             } else {
2286 2286
                 $especie = $texto;
2287 2287
             }
2288
-            $texto = ! empty($this->transp->getElementsByTagName("marca")->item(0)->nodeValue) ?
2288
+            $texto = !empty($this->transp->getElementsByTagName("marca")->item(0)->nodeValue) ?
2289 2289
                     $this->transp->getElementsByTagName("marca")->item(0)->nodeValue : '';
2290 2290
             if ($texto != $marca && $marca != '') {
2291 2291
                 //tem várias especies
@@ -2293,7 +2293,7 @@  discard block
 block discarded – undo
2293 2293
             } else {
2294 2294
                 $marca = $texto;
2295 2295
             }
2296
-            $texto = ! empty($this->transp->getElementsByTagName("nVol")->item(0)->nodeValue) ?
2296
+            $texto = !empty($this->transp->getElementsByTagName("nVol")->item(0)->nodeValue) ?
2297 2297
                     $this->transp->getElementsByTagName("nVol")->item(0)->nodeValue : '';
2298 2298
             if ($texto != $numero && $numero != '') {
2299 2299
                 //tem várias especies
@@ -2308,7 +2308,7 @@  discard block
 block discarded – undo
2308 2308
         $y += $h;
2309 2309
         $x = $oldX;
2310 2310
         $h = 7;
2311
-        $w1 = round($maxW*0.10, 0);
2311
+        $w1 = round($maxW * 0.10, 0);
2312 2312
         $texto = 'QUANTIDADE';
2313 2313
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2314 2314
         $this->pdf->textBox($x, $y, $w1, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -2319,7 +2319,7 @@  discard block
 block discarded – undo
2319 2319
         }
2320 2320
         //ESPÉCIE
2321 2321
         $x += $w1;
2322
-        $w2 = round($maxW*0.17, 0);
2322
+        $w2 = round($maxW * 0.17, 0);
2323 2323
         $texto = 'ESPÉCIE';
2324 2324
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2325 2325
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -2331,7 +2331,7 @@  discard block
 block discarded – undo
2331 2331
         $texto = 'MARCA';
2332 2332
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2333 2333
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
2334
-        $texto = ! empty($this->transp->getElementsByTagName("marca")->item(0)->nodeValue) ?
2334
+        $texto = !empty($this->transp->getElementsByTagName("marca")->item(0)->nodeValue) ?
2335 2335
                 $this->transp->getElementsByTagName("marca")->item(0)->nodeValue : '';
2336 2336
         $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'];
2337 2337
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'B', 'C', 0, '');
@@ -2345,7 +2345,7 @@  discard block
 block discarded – undo
2345 2345
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'B', 'C', 0, '');
2346 2346
         //PESO BRUTO
2347 2347
         $x += $w2;
2348
-        $w3 = round($maxW*0.20, 0);
2348
+        $w3 = round($maxW * 0.20, 0);
2349 2349
         $texto = 'PESO BRUTO';
2350 2350
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2351 2351
         $this->pdf->textBox($x, $y, $w3, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -2358,7 +2358,7 @@  discard block
 block discarded – undo
2358 2358
         $this->pdf->textBox($x, $y, $w3, $h, $texto, $aFont, 'B', 'R', 0, '');
2359 2359
         //PESO LÍQUIDO
2360 2360
         $x += $w3;
2361
-        $w = $maxW -($w1+3*$w2+$w3);
2361
+        $w = $maxW - ($w1 + 3 * $w2 + $w3);
2362 2362
         $texto = 'PESO LÍQUIDO';
2363 2363
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2364 2364
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -2369,7 +2369,7 @@  discard block
 block discarded – undo
2369 2369
         }
2370 2370
         $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'];
2371 2371
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'R', 0, '');
2372
-        return ($y+$h);
2372
+        return ($y + $h);
2373 2373
     } //fim transporteDANFE
2374 2374
 
2375 2375
 
@@ -2381,7 +2381,7 @@  discard block
 block discarded – undo
2381 2381
             return "";
2382 2382
         }
2383 2383
         $valor_original = $valor_original->nodeValue;
2384
-        $valor = ! empty($valor_original) ? number_format($valor_original, 2, ",", ".") : '';
2384
+        $valor = !empty($valor_original) ? number_format($valor_original, 2, ",", ".") : '';
2385 2385
 
2386 2386
         if ($valor != "") {
2387 2387
             return sprintf($formato, $valor);
@@ -2428,18 +2428,18 @@  discard block
 block discarded – undo
2428 2428
             $impostos .= $this->descricaoProdutoHelper($ICMSUFDest, "vICMSUFDest", " vICMSUFDest=%s");
2429 2429
             $impostos .= $this->descricaoProdutoHelper($ICMSUFDest, "vICMSUFRemet", " vICMSUFRemet=%s");
2430 2430
         }
2431
-        $infAdProd = ! empty($itemProd->getElementsByTagName('infAdProd')->item(0)->nodeValue)
2431
+        $infAdProd = !empty($itemProd->getElementsByTagName('infAdProd')->item(0)->nodeValue)
2432 2432
             ? substr(
2433 2433
                 $this->anfaveaDANFE($itemProd->getElementsByTagName('infAdProd')->item(0)->nodeValue),
2434 2434
                 0,
2435 2435
                 500
2436 2436
             )
2437 2437
             : '';
2438
-        if (! empty($infAdProd)) {
2438
+        if (!empty($infAdProd)) {
2439 2439
             $infAdProd = trim($infAdProd);
2440 2440
             $infAdProd .= ' ';
2441 2441
         }
2442
-        $loteTxt ='';
2442
+        $loteTxt = '';
2443 2443
         $rastro = $prod->getElementsByTagName("med");
2444 2444
         if (!empty($prod->getElementsByTagName("rastro"))) {
2445 2445
             $rastro = $prod->getElementsByTagName("rastro");
@@ -2453,14 +2453,14 @@  discard block
 block discarded – undo
2453 2453
                 $i++;
2454 2454
             }
2455 2455
             if ($loteTxt != '') {
2456
-                $loteTxt.= ' ';
2456
+                $loteTxt .= ' ';
2457 2457
             }
2458 2458
         }
2459 2459
         //NT2013.006 FCI
2460
-        $nFCI = (! empty($itemProd->getElementsByTagName('nFCI')->item(0)->nodeValue)) ?
2461
-                ' FCI:'.$itemProd->getElementsByTagName('nFCI')->item(0)->nodeValue : '';
2462
-        $tmp_ad=$infAdProd . ($this->descProdInfoComplemento ? $loteTxt . $impostos . $nFCI : '');
2463
-        $texto = $prod->getElementsByTagName("xProd")->item(0)->nodeValue . (strlen($tmp_ad)!=0?"\n    ".$tmp_ad:'');
2460
+        $nFCI = (!empty($itemProd->getElementsByTagName('nFCI')->item(0)->nodeValue)) ?
2461
+                ' FCI:' . $itemProd->getElementsByTagName('nFCI')->item(0)->nodeValue : '';
2462
+        $tmp_ad = $infAdProd . ($this->descProdInfoComplemento ? $loteTxt . $impostos . $nFCI : '');
2463
+        $texto = $prod->getElementsByTagName("xProd")->item(0)->nodeValue . (strlen($tmp_ad) != 0 ? "\n    " . $tmp_ad : '');
2464 2464
         //decodifica os caracteres html no xml
2465 2465
         $texto = html_entity_decode($texto);
2466 2466
         if ($this->descProdQuebraLinha) {
@@ -2510,104 +2510,104 @@  discard block
 block discarded – undo
2510 2510
         // cabecalho LOOP COM OS DADOS DOS PRODUTOS
2511 2511
         //CÓDIGO PRODUTO
2512 2512
         $texto = "CÓDIGO PRODUTO";
2513
-        $w1 = round($w*0.09, 0);
2513
+        $w1 = round($w * 0.09, 0);
2514 2514
         $h = 4;
2515 2515
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2516 2516
         $this->pdf->textBox($x, $y, $w1, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2517
-        $this->pdf->line($x+$w1, $y, $x+$w1, $y+$hmax);
2517
+        $this->pdf->line($x + $w1, $y, $x + $w1, $y + $hmax);
2518 2518
         //DESCRIÇÃO DO PRODUTO / SERVIÇO
2519 2519
         $x += $w1;
2520
-        $w2 = round($w*0.28, 0);
2520
+        $w2 = round($w * 0.28, 0);
2521 2521
         $texto = 'DESCRIÇÃO DO PRODUTO / SERVIÇO';
2522 2522
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2523 2523
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2524
-        $this->pdf->line($x+$w2, $y, $x+$w2, $y+$hmax);
2524
+        $this->pdf->line($x + $w2, $y, $x + $w2, $y + $hmax);
2525 2525
         //NCM/SH
2526 2526
         $x += $w2;
2527
-        $w3 = round($w*0.06, 0);
2527
+        $w3 = round($w * 0.06, 0);
2528 2528
         $texto = 'NCM/SH';
2529 2529
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2530 2530
         $this->pdf->textBox($x, $y, $w3, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2531
-        $this->pdf->line($x+$w3, $y, $x+$w3, $y+$hmax);
2531
+        $this->pdf->line($x + $w3, $y, $x + $w3, $y + $hmax);
2532 2532
         //O/CST ou O/CSOSN
2533 2533
         $x += $w3;
2534
-        $w4 = round($w*0.05, 0);
2535
-        $texto = 'O/CSOSN';//Regime do Simples CRT = 1 ou CRT = 2
2534
+        $w4 = round($w * 0.05, 0);
2535
+        $texto = 'O/CSOSN'; //Regime do Simples CRT = 1 ou CRT = 2
2536 2536
         if ($this->getTagValue($this->emit, 'CRT') == '3') {
2537
-             $texto = 'O/CST';//Regime Normal
2537
+             $texto = 'O/CST'; //Regime Normal
2538 2538
         }
2539 2539
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2540 2540
         $this->pdf->textBox($x, $y, $w4, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2541
-        $this->pdf->line($x+$w4, $y, $x+$w4, $y+$hmax);
2541
+        $this->pdf->line($x + $w4, $y, $x + $w4, $y + $hmax);
2542 2542
         //CFOP
2543 2543
         $x += $w4;
2544
-        $w5 = round($w*0.04, 0);
2544
+        $w5 = round($w * 0.04, 0);
2545 2545
         $texto = 'CFOP';
2546 2546
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2547 2547
         $this->pdf->textBox($x, $y, $w5, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2548
-        $this->pdf->line($x+$w5, $y, $x+$w5, $y+$hmax);
2548
+        $this->pdf->line($x + $w5, $y, $x + $w5, $y + $hmax);
2549 2549
         //UN
2550 2550
         $x += $w5;
2551
-        $w6 = round($w*0.03, 0);
2551
+        $w6 = round($w * 0.03, 0);
2552 2552
         $texto = 'UN';
2553 2553
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2554 2554
         $this->pdf->textBox($x, $y, $w6, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2555
-        $this->pdf->line($x+$w6, $y, $x+$w6, $y+$hmax);
2555
+        $this->pdf->line($x + $w6, $y, $x + $w6, $y + $hmax);
2556 2556
         //QUANT
2557 2557
         $x += $w6;
2558
-        $w7 = round($w*0.07, 0);
2558
+        $w7 = round($w * 0.07, 0);
2559 2559
         $texto = 'QUANT';
2560 2560
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2561 2561
         $this->pdf->textBox($x, $y, $w7, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2562
-        $this->pdf->line($x+$w7, $y, $x+$w7, $y+$hmax);
2562
+        $this->pdf->line($x + $w7, $y, $x + $w7, $y + $hmax);
2563 2563
         //VALOR UNIT
2564 2564
         $x += $w7;
2565
-        $w8 = round($w*0.06, 0);
2565
+        $w8 = round($w * 0.06, 0);
2566 2566
         $texto = 'VALOR UNIT';
2567 2567
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2568 2568
         $this->pdf->textBox($x, $y, $w8, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2569
-        $this->pdf->line($x+$w8, $y, $x+$w8, $y+$hmax);
2569
+        $this->pdf->line($x + $w8, $y, $x + $w8, $y + $hmax);
2570 2570
         //VALOR TOTAL
2571 2571
         $x += $w8;
2572
-        $w9 = round($w*0.06, 0);
2572
+        $w9 = round($w * 0.06, 0);
2573 2573
         $texto = 'VALOR TOTAL';
2574 2574
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2575 2575
         $this->pdf->textBox($x, $y, $w9, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2576
-        $this->pdf->line($x+$w9, $y, $x+$w9, $y+$hmax);
2576
+        $this->pdf->line($x + $w9, $y, $x + $w9, $y + $hmax);
2577 2577
         //B.CÁLC ICMS
2578 2578
         $x += $w9;
2579
-        $w10 = round($w*0.06, 0);
2579
+        $w10 = round($w * 0.06, 0);
2580 2580
         $texto = 'B.CÁLC ICMS';
2581 2581
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2582 2582
         $this->pdf->textBox($x, $y, $w10, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2583
-        $this->pdf->line($x+$w10, $y, $x+$w10, $y+$hmax);
2583
+        $this->pdf->line($x + $w10, $y, $x + $w10, $y + $hmax);
2584 2584
         //VALOR ICMS
2585 2585
         $x += $w10;
2586
-        $w11 = round($w*0.06, 0);
2586
+        $w11 = round($w * 0.06, 0);
2587 2587
         $texto = 'VALOR ICMS';
2588 2588
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2589 2589
         $this->pdf->textBox($x, $y, $w11, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2590
-        $this->pdf->line($x+$w11, $y, $x+$w11, $y+$hmax);
2590
+        $this->pdf->line($x + $w11, $y, $x + $w11, $y + $hmax);
2591 2591
         //VALOR IPI
2592 2592
         $x += $w11;
2593
-        $w12 = round($w*0.05, 0);
2593
+        $w12 = round($w * 0.05, 0);
2594 2594
         $texto = 'VALOR IPI';
2595 2595
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2596 2596
         $this->pdf->textBox($x, $y, $w12, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2597
-        $this->pdf->line($x+$w12, $y, $x+$w12, $y+$hmax);
2597
+        $this->pdf->line($x + $w12, $y, $x + $w12, $y + $hmax);
2598 2598
         //ALÍQ. ICMS
2599 2599
         $x += $w12;
2600
-        $w13 = round($w*0.035, 0);
2600
+        $w13 = round($w * 0.035, 0);
2601 2601
         $texto = 'ALÍQ. ICMS';
2602 2602
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2603 2603
         $this->pdf->textBox($x, $y, $w13, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2604
-        $this->pdf->line($x+$w13, $y, $x+$w13, $y+$hmax);
2604
+        $this->pdf->line($x + $w13, $y, $x + $w13, $y + $hmax);
2605 2605
         //ALÍQ. IPI
2606 2606
         $x += $w13;
2607
-        $w14 = $w-($w1+$w2+$w3+$w4+$w5+$w6+$w7+$w8+$w9+$w10+$w11+$w12+$w13);
2607
+        $w14 = $w - ($w1 + $w2 + $w3 + $w4 + $w5 + $w6 + $w7 + $w8 + $w9 + $w10 + $w11 + $w12 + $w13);
2608 2608
         $texto = 'ALÍQ. IPI';
2609 2609
         $this->pdf->textBox($x, $y, $w14, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2610
-        $this->pdf->line($oldX, $y+$h+1, $oldX + $w, $y+$h+1);
2610
+        $this->pdf->line($oldX, $y + $h + 1, $oldX + $w, $y + $h + 1);
2611 2611
         $y += 5;
2612 2612
         //##################################################################################
2613 2613
         // LOOP COM OS DADOS DOS PRODUTOS
@@ -2625,7 +2625,7 @@  discard block
 block discarded – undo
2625 2625
                 $textoProduto = trim($this->descricaoProduto($thisItem));
2626 2626
 
2627 2627
                 $linhaDescr = $this->pdf->getNumLines($textoProduto, $w2, $aFont);
2628
-                $h = round(($linhaDescr * $this->pdf->fontSize)+ ($linhaDescr * 0.5), 2);
2628
+                $h = round(($linhaDescr * $this->pdf->fontSize) + ($linhaDescr * 0.5), 2);
2629 2629
                 $hUsado += $h;
2630 2630
 
2631 2631
                 $diffH = $hmax - $hUsado;
@@ -2638,11 +2638,11 @@  discard block
 block discarded – undo
2638 2638
                         break;
2639 2639
                     }
2640 2640
                 }
2641
-                $y_linha=$y+$h;
2641
+                $y_linha = $y + $h;
2642 2642
                 // linha entre itens
2643 2643
                 $this->pdf->dashedHLine($oldX, $y_linha, $w, 0.1, 120);
2644 2644
                 //corrige o x
2645
-                $x=$oldX;
2645
+                $x = $oldX;
2646 2646
                 //codigo do produto
2647 2647
                 $texto = $prod->getElementsByTagName("cProd")->item(0)->nodeValue;
2648 2648
                 $this->pdf->textBox($x, $y, $w1, $h, $texto, $aFont, 'T', 'C', 0, '');
@@ -2655,16 +2655,16 @@  discard block
 block discarded – undo
2655 2655
                 }
2656 2656
                 $x += $w2;
2657 2657
                 //NCM
2658
-                $texto = ! empty($prod->getElementsByTagName("NCM")->item(0)->nodeValue) ?
2658
+                $texto = !empty($prod->getElementsByTagName("NCM")->item(0)->nodeValue) ?
2659 2659
                         $prod->getElementsByTagName("NCM")->item(0)->nodeValue : '';
2660 2660
                 $this->pdf->textBox($x, $y, $w3, $h, $texto, $aFont, 'T', 'C', 0, '');
2661 2661
                 $x += $w3;
2662 2662
                 //CST
2663 2663
                 if (isset($ICMS)) {
2664
-                    $origem =  $this->getTagValue($ICMS, "orig");
2665
-                    $cst =  $this->getTagValue($ICMS, "CST");
2666
-                    $csosn =  $this->getTagValue($ICMS, "CSOSN");
2667
-                    $texto = $origem.$cst.$csosn;
2664
+                    $origem = $this->getTagValue($ICMS, "orig");
2665
+                    $cst = $this->getTagValue($ICMS, "CST");
2666
+                    $csosn = $this->getTagValue($ICMS, "CSOSN");
2667
+                    $texto = $origem . $cst . $csosn;
2668 2668
                     $this->pdf->textBox($x, $y, $w4, $h, $texto, $aFont, 'T', 'C', 0, '');
2669 2669
                 }
2670 2670
                 //CFOP
@@ -2698,7 +2698,7 @@  discard block
 block discarded – undo
2698 2698
                 //Valor da Base de calculo
2699 2699
                 $x += $w9;
2700 2700
                 if (isset($ICMS)) {
2701
-                    $texto = ! empty($ICMS->getElementsByTagName("vBC")->item(0)->nodeValue) ?
2701
+                    $texto = !empty($ICMS->getElementsByTagName("vBC")->item(0)->nodeValue) ?
2702 2702
                             number_format(
2703 2703
                                 $ICMS->getElementsByTagName("vBC")->item(0)->nodeValue,
2704 2704
                                 2,
@@ -2710,7 +2710,7 @@  discard block
 block discarded – undo
2710 2710
                 //Valor do ICMS
2711 2711
                 $x += $w10;
2712 2712
                 if (isset($ICMS)) {
2713
-                    $texto = ! empty($ICMS->getElementsByTagName("vICMS")->item(0)->nodeValue) ?
2713
+                    $texto = !empty($ICMS->getElementsByTagName("vICMS")->item(0)->nodeValue) ?
2714 2714
                             number_format(
2715 2715
                                 $ICMS->getElementsByTagName("vICMS")->item(0)->nodeValue,
2716 2716
                                 2,
@@ -2722,8 +2722,8 @@  discard block
 block discarded – undo
2722 2722
                 //Valor do IPI
2723 2723
                 $x += $w11;
2724 2724
                 if (isset($IPI)) {
2725
-                    $texto = ! empty($IPI->getElementsByTagName("vIPI")->item(0)->nodeValue) ?
2726
-                            number_format($IPI->getElementsByTagName("vIPI")->item(0)->nodeValue, 2, ",", ".") :'';
2725
+                    $texto = !empty($IPI->getElementsByTagName("vIPI")->item(0)->nodeValue) ?
2726
+                            number_format($IPI->getElementsByTagName("vIPI")->item(0)->nodeValue, 2, ",", ".") : '';
2727 2727
                 } else {
2728 2728
                     $texto = '';
2729 2729
                 }
@@ -2731,7 +2731,7 @@  discard block
 block discarded – undo
2731 2731
                 // %ICMS
2732 2732
                 $x += $w12;
2733 2733
                 if (isset($ICMS)) {
2734
-                    $texto = ! empty($ICMS->getElementsByTagName("pICMS")->item(0)->nodeValue) ?
2734
+                    $texto = !empty($ICMS->getElementsByTagName("pICMS")->item(0)->nodeValue) ?
2735 2735
                             number_format(
2736 2736
                                 $ICMS->getElementsByTagName("pICMS")->item(0)->nodeValue,
2737 2737
                                 2,
@@ -2743,7 +2743,7 @@  discard block
 block discarded – undo
2743 2743
                 //%IPI
2744 2744
                 $x += $w13;
2745 2745
                 if (isset($IPI)) {
2746
-                    $texto = ! empty($IPI->getElementsByTagName("pIPI")->item(0)->nodeValue) ?
2746
+                    $texto = !empty($IPI->getElementsByTagName("pIPI")->item(0)->nodeValue) ?
2747 2747
                             number_format($IPI->getElementsByTagName("pIPI")->item(0)->nodeValue, 2, ",", ".") : '';
2748 2748
                 } else {
2749 2749
                     $texto = '';
@@ -2768,7 +2768,7 @@  discard block
 block discarded – undo
2768 2768
                 $i++;
2769 2769
             }
2770 2770
         }
2771
-        return $oldY+$hmax;
2771
+        return $oldY + $hmax;
2772 2772
     }
2773 2773
 
2774 2774
 
@@ -2802,7 +2802,7 @@  discard block
 block discarded – undo
2802 2802
 
2803 2803
         $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>''];
2804 2804
 
2805
-        $w1 = round($w*0.09, 0);
2805
+        $w1 = round($w * 0.09, 0);
2806 2806
 
2807 2807
         // Tabela Renavam Combustivel
2808 2808
         $renavamCombustivel = [
@@ -2897,54 +2897,54 @@  discard block
 block discarded – undo
2897 2897
 
2898 2898
         $yVeic = $y + $h;
2899 2899
         $texto = 'Chassi: ............: ' . $veiculoChassi;
2900
-        $this->pdf->textBox($x, $yVeic, $w1+40, $h, $texto, $aFont, 'T', 'L', 0, '');
2900
+        $this->pdf->textBox($x, $yVeic, $w1 + 40, $h, $texto, $aFont, 'T', 'L', 0, '');
2901 2901
         $yVeic += $h;
2902 2902
         $texto = 'Cor...................: ' . $veiculoCor;
2903
-        $this->pdf->textBox($x, $yVeic, $w1+40, $h, $texto, $aFont, 'T', 'L', 0, '');
2903
+        $this->pdf->textBox($x, $yVeic, $w1 + 40, $h, $texto, $aFont, 'T', 'L', 0, '');
2904 2904
         $yVeic += $h;
2905 2905
         $texto = 'Cilindrada........: ' . $veiculoCilindrada;
2906
-        $this->pdf->textBox($x, $yVeic, $w1+40, $h, $texto, $aFont, 'T', 'L', 0, '');
2906
+        $this->pdf->textBox($x, $yVeic, $w1 + 40, $h, $texto, $aFont, 'T', 'L', 0, '');
2907 2907
         $yVeic += $h;
2908 2908
         $texto = 'Cmkg...............: ' . $veiculoCmkg;
2909
-        $this->pdf->textBox($x, $yVeic, $w1+40, $h, $texto, $aFont, 'T', 'L', 0, '');
2909
+        $this->pdf->textBox($x, $yVeic, $w1 + 40, $h, $texto, $aFont, 'T', 'L', 0, '');
2910 2910
         $yVeic += $h;
2911 2911
         $texto = 'Tipo.................: ' . ($renavamTiposVeiculos[intval($veiculoTipo)] ?? $veiculoTipo);
2912
-         $this->pdf->textBox($x, $yVeic, $w1+40, $h, $texto, $aFont, 'T', 'L', 0, '');
2912
+         $this->pdf->textBox($x, $yVeic, $w1 + 40, $h, $texto, $aFont, 'T', 'L', 0, '');
2913 2913
         $yVeic = $y + $h;
2914 2914
         $xVeic = $x + 65;
2915 2915
         $texto = 'Nº Motor: .........: ' . $veiculoMotor;
2916
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
2916
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
2917 2917
         $yVeic += $h;
2918 2918
         $texto = 'Renavam...........: ' . $veiculoRenavam;
2919
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
2919
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
2920 2920
         $yVeic += $h;
2921 2921
         $texto = 'HP.....................: ' . $veiculoHp;
2922
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
2922
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
2923 2923
         $yVeic += $h;
2924 2924
         $texto = 'Placa.................: ' . $veiculoPlaca;
2925
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
2925
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
2926 2926
         $yVeic += $h;
2927 2927
         $texto = 'Tipo Pintura......: ' . ($renavamEspecie[intval($veiculoTipoPintura)] ?? $veiculoTipoPintura);
2928
-        $this->pTextBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
2928
+        $this->pTextBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
2929 2929
         $yVeic = $y + $h;
2930 2930
         $xVeic = $xVeic + 55;
2931 2931
         $texto = 'Marca / Modelo.....: ' . $veiculoMarcaModelo;
2932
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
2932
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
2933 2933
         $yVeic += $h;
2934 2934
         $texto = 'Especie..................: ' . ($renavamEspecie[intval($veiculoEspecie)] ?? $veiculoEspecie);
2935
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
2935
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
2936 2936
         $yVeic += $h;
2937 2937
         $texto = 'Combustivel..........: ' . ($renavamCombustivel[intval($veiculoCombustivel)] ?? $veiculoCombustivel);
2938
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
2938
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
2939 2939
         $yVeic += $h;
2940 2940
         $texto = 'Serial.....................: ' . $veiculoSerial;
2941
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
2941
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
2942 2942
         $yVeic += $h;
2943
-        $texto = 'Ano Fab/Mod........: '. $veiculoFabricacao . '/' . $veiculoModelo;
2944
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
2943
+        $texto = 'Ano Fab/Mod........: ' . $veiculoFabricacao . '/' . $veiculoModelo;
2944
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
2945 2945
         $yVeic += $h;
2946
-        $texto = 'Distancia Entre Eixos(mm)..: '. $veiculoDistancia;
2947
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
2946
+        $texto = 'Distancia Entre Eixos(mm)..: ' . $veiculoDistancia;
2947
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
2948 2948
     }
2949 2949
 
2950 2950
     /**
@@ -2968,12 +2968,12 @@  discard block
 block discarded – undo
2968 2968
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
2969 2969
         //INSCRIÇÃO MUNICIPAL
2970 2970
         $y += 3;
2971
-        $w = round($this->wPrint*0.23, 0);
2971
+        $w = round($this->wPrint * 0.23, 0);
2972 2972
         $texto = 'INSCRIÇÃO MUNICIPAL';
2973 2973
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2974 2974
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
2975 2975
         //inscrição municipal
2976
-        $texto = ! empty($this->emit->getElementsByTagName("IM")->item(0)->nodeValue) ?
2976
+        $texto = !empty($this->emit->getElementsByTagName("IM")->item(0)->nodeValue) ?
2977 2977
                 $this->emit->getElementsByTagName("IM")->item(0)->nodeValue : '';
2978 2978
         $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'];
2979 2979
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 0, '');
@@ -2983,7 +2983,7 @@  discard block
 block discarded – undo
2983 2983
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2984 2984
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
2985 2985
         if (isset($this->ISSQNtot)) {
2986
-            $texto = ! empty($this->ISSQNtot->getElementsByTagName("vServ")->item(0)->nodeValue) ?
2986
+            $texto = !empty($this->ISSQNtot->getElementsByTagName("vServ")->item(0)->nodeValue) ?
2987 2987
                     $this->ISSQNtot->getElementsByTagName("vServ")->item(0)->nodeValue : '';
2988 2988
             $texto = number_format($texto, 2, ",", ".");
2989 2989
         } else {
@@ -2997,9 +2997,9 @@  discard block
 block discarded – undo
2997 2997
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2998 2998
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
2999 2999
         if (isset($this->ISSQNtot)) {
3000
-            $texto = ! empty($this->ISSQNtot->getElementsByTagName("vBC")->item(0)->nodeValue) ?
3000
+            $texto = !empty($this->ISSQNtot->getElementsByTagName("vBC")->item(0)->nodeValue) ?
3001 3001
                     $this->ISSQNtot->getElementsByTagName("vBC")->item(0)->nodeValue : '';
3002
-            $texto = ! empty($texto) ? number_format($texto, 2, ",", ".") : '';
3002
+            $texto = !empty($texto) ? number_format($texto, 2, ",", ".") : '';
3003 3003
         } else {
3004 3004
             $texto = '';
3005 3005
         }
@@ -3010,21 +3010,21 @@  discard block
 block discarded – undo
3010 3010
         if ($this->orientacao == 'P') {
3011 3011
             $w = $this->wPrint - (3 * $w);
3012 3012
         } else {
3013
-            $w = $this->wPrint - (3 * $w)-$this->wCanhoto;
3013
+            $w = $this->wPrint - (3 * $w) - $this->wCanhoto;
3014 3014
         }
3015 3015
         $texto = 'VALOR TOTAL DO ISSQN';
3016 3016
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
3017 3017
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
3018 3018
         if (isset($this->ISSQNtot)) {
3019
-            $texto = ! empty($this->ISSQNtot->getElementsByTagName("vISS")->item(0)->nodeValue) ?
3019
+            $texto = !empty($this->ISSQNtot->getElementsByTagName("vISS")->item(0)->nodeValue) ?
3020 3020
                     $this->ISSQNtot->getElementsByTagName("vISS")->item(0)->nodeValue : '';
3021
-            $texto = ! empty($texto) ? number_format($texto, 2, ",", ".") : '';
3021
+            $texto = !empty($texto) ? number_format($texto, 2, ",", ".") : '';
3022 3022
         } else {
3023 3023
             $texto = '';
3024 3024
         }
3025 3025
         $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'];
3026 3026
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'R', 0, '');
3027
-        return ($y+$h+1);
3027
+        return ($y + $h + 1);
3028 3028
     }
3029 3029
 
3030 3030
     /**
@@ -3045,7 +3045,7 @@  discard block
 block discarded – undo
3045 3045
         if ($this->orientacao == 'P') {
3046 3046
               $w = $this->wPrint;
3047 3047
         } else {
3048
-              $w = $this->wPrint-$this->wCanhoto;
3048
+              $w = $this->wPrint - $this->wCanhoto;
3049 3049
         }
3050 3050
         $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
3051 3051
         $this->pdf->textBox($x, $y, $w, 8, $texto, $aFont, 'T', 'L', 0, '');
@@ -3061,15 +3061,15 @@  discard block
 block discarded – undo
3061 3061
         //$this->textoAdic com o texto completo do campo
3062 3062
         $y += 1;
3063 3063
         $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>''];
3064
-        $this->pdf->textBox($x, $y+2, $w-2, $h-3, $this->textoAdic, $aFont, 'T', 'L', 0, '', false);
3064
+        $this->pdf->textBox($x, $y + 2, $w - 2, $h - 3, $this->textoAdic, $aFont, 'T', 'L', 0, '', false);
3065 3065
         //RESERVADO AO FISCO
3066 3066
         $texto = "RESERVADO AO FISCO";
3067 3067
         $x += $w;
3068 3068
         $y -= 1;
3069 3069
         if ($this->orientacao == 'P') {
3070
-            $w = $this->wPrint-$w;
3070
+            $w = $this->wPrint - $w;
3071 3071
         } else {
3072
-            $w = $this->wPrint-$w-$this->wCanhoto;
3072
+            $w = $this->wPrint - $w - $this->wCanhoto;
3073 3073
         }
3074 3074
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>'B'];
3075 3075
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -3108,8 +3108,8 @@  discard block
 block discarded – undo
3108 3108
         }
3109 3109
         $y += 2;
3110 3110
         $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>''];
3111
-        $this->pdf->textBox($x, $y, $w-2, $h-3, $texto, $aFont, 'T', 'L', 0, '', false);
3112
-        return $y+$h;
3111
+        $this->pdf->textBox($x, $y, $w - 2, $h - 3, $texto, $aFont, 'T', 'L', 0, '', false);
3112
+        return $y + $h;
3113 3113
     }
3114 3114
 
3115 3115
     /**
@@ -3127,13 +3127,13 @@  discard block
 block discarded – undo
3127 3127
         if ($this->orientacao == 'P') {
3128 3128
               $w = $this->wPrint;
3129 3129
         } else {
3130
-              $w = $this->wPrint-$this->wCanhoto;
3130
+              $w = $this->wPrint - $this->wCanhoto;
3131 3131
               $x = $this->wCanhoto;
3132 3132
         }
3133 3133
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>'I'];
3134
-        $texto = "Impresso em ". date('d/m/Y') . " as " . date('H:i:s');
3134
+        $texto = "Impresso em " . date('d/m/Y') . " as " . date('H:i:s');
3135 3135
         $this->pdf->textBox($x, $y, $w, 0, $texto, $aFont, 'T', 'L', false);
3136
-        $texto = $this->creditos .  "  Powered by NFePHP";
3136
+        $texto = $this->creditos . "  Powered by NFePHP";
3137 3137
         $this->pdf->textBox($x, $y, $w, 0, $texto, $aFont, 'T', 'R', false, '');
3138 3138
     }
3139 3139
 
@@ -3186,9 +3186,9 @@  discard block
 block discarded – undo
3186 3186
         } else {
3187 3187
             //linha separadora do canhoto - 238
3188 3188
             //posicao altura
3189
-            $y = $this->wPrint-85;
3189
+            $y = $this->wPrint - 85;
3190 3190
             //altura
3191
-            $w = $this->wPrint-85-24;
3191
+            $w = $this->wPrint - 85 - 24;
3192 3192
         }
3193 3193
         $h = 10;
3194 3194
         //desenha caixa
@@ -3211,21 +3211,21 @@  discard block
 block discarded – undo
3211 3211
             $texto .= "AO LADO";
3212 3212
         }
3213 3213
         $texto .= ". EMISSÃO: ";
3214
-        $dEmi = ! empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
3214
+        $dEmi = !empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
3215 3215
                 $this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue : '';
3216 3216
         if ($dEmi == '') {
3217
-            $dEmi = ! empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
3217
+            $dEmi = !empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
3218 3218
                     $this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue : '';
3219 3219
             $aDemi = explode('T', $dEmi);
3220 3220
             $dEmi = $aDemi[0];
3221 3221
         }
3222
-        $texto .= $this->ymdTodmy($dEmi) ." ";
3222
+        $texto .= $this->ymdTodmy($dEmi) . " ";
3223 3223
         $texto .= "VALOR TOTAL: R$ ";
3224 3224
         $texto .= number_format($this->ICMSTot->getElementsByTagName("vNF")->item(0)->nodeValue, 2, ",", ".") . " ";
3225 3225
         $texto .= "DESTINATÁRIO: ";
3226 3226
         $texto .= $destinatario;
3227 3227
         if ($this->orientacao == 'P') {
3228
-            $this->pdf->textBox($x, $y, $w-1, $h, $texto, $aFont, 'C', 'L', 0, '', false);
3228
+            $this->pdf->textBox($x, $y, $w - 1, $h, $texto, $aFont, 'C', 'L', 0, '', false);
3229 3229
             $x1 = $x + $w;
3230 3230
             $w1 = $this->wPrint - $w;
3231 3231
             $texto = "NF-e";
@@ -3238,12 +3238,12 @@  discard block
 block discarded – undo
3238 3238
             //DATA DE RECEBIMENTO
3239 3239
             $texto = "DATA DE RECEBIMENTO";
3240 3240
             $y += $h;
3241
-            $w2 = round($this->wPrint*0.17, 0); //35;
3241
+            $w2 = round($this->wPrint * 0.17, 0); //35;
3242 3242
             $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
3243 3243
             $this->pdf->textBox($x, $y, $w2, 8, $texto, $aFont, 'T', 'L', 1, '');
3244 3244
             //IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR
3245 3245
             $x += $w2;
3246
-            $w3 = $w-$w2;
3246
+            $w3 = $w - $w2;
3247 3247
             $texto = "IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR";
3248 3248
             $this->pdf->textBox($x, $y, $w3, 8, $texto, $aFont, 'T', 'L', 1, '');
3249 3249
             $x = $oldX;
@@ -3253,7 +3253,7 @@  discard block
 block discarded – undo
3253 3253
             return $y;
3254 3254
         } else {
3255 3255
             $x--;
3256
-            $x = $this->pdf->textBox90($x, $y, $w-1, $h, $texto, $aFontSmall, 'C', 'L', 0, '', false);
3256
+            $x = $this->pdf->textBox90($x, $y, $w - 1, $h, $texto, $aFontSmall, 'C', 'L', 0, '', false);
3257 3257
             //NUMERO DA NOTA FISCAL LOGO NFE
3258 3258
             $w1 = 18;
3259 3259
             $x1 = $oldX;
@@ -3267,18 +3267,18 @@  discard block
 block discarded – undo
3267 3267
             $this->pdf->textBox($x1, $y, $w1, 18, $texto, $aFont, 'C', 'C', 1, '');
3268 3268
             //DATA DO RECEBIMENTO
3269 3269
             $texto = "DATA DO RECEBIMENTO";
3270
-            $y = $this->wPrint-85;
3270
+            $y = $this->wPrint - 85;
3271 3271
             $x = 12;
3272
-            $w2 = round($this->wPrint*0.17, 0); //35;
3272
+            $w2 = round($this->wPrint * 0.17, 0); //35;
3273 3273
             $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
3274 3274
             $this->pdf->textBox90($x, $y, $w2, 8, $texto, $aFont, 'T', 'L', 1, '');
3275 3275
             //IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR
3276 3276
             $y -= $w2;
3277
-            $w3 = $w-$w2;
3277
+            $w3 = $w - $w2;
3278 3278
             $texto = "IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR";
3279 3279
             $aFont = ['font'=>$this->fontePadrao, 'size'=>5.7, 'style'=>''];
3280 3280
             $x = $this->pdf->textBox90($x, $y, $w3, 8, $texto, $aFont, 'T', 'L', 1, '');
3281
-            $this->pdf->DashedVLine(23, $oldY, 0.1, $this->wPrint-20, 67);
3281
+            $this->pdf->DashedVLine(23, $oldY, 0.1, $this->wPrint - 20, 67);
3282 3282
             return $x;
3283 3283
         }
3284 3284
     }
@@ -3295,13 +3295,13 @@  discard block
 block discarded – undo
3295 3295
     {
3296 3296
         $saida = "";
3297 3297
         if (isset($this->compra)) {
3298
-            if (! empty($this->compra->getElementsByTagName("xNEmp")->item(0)->nodeValue)) {
3298
+            if (!empty($this->compra->getElementsByTagName("xNEmp")->item(0)->nodeValue)) {
3299 3299
                 $saida .= " Nota de Empenho: " . $this->compra->getElementsByTagName("xNEmp")->item(0)->nodeValue;
3300 3300
             }
3301
-            if (! empty($this->compra->getElementsByTagName("xPed")->item(0)->nodeValue)) {
3301
+            if (!empty($this->compra->getElementsByTagName("xPed")->item(0)->nodeValue)) {
3302 3302
                 $saida .= " Pedido: " . $this->compra->getElementsByTagName("xPed")->item(0)->nodeValue;
3303 3303
             }
3304
-            if (! empty($this->compra->getElementsByTagName("xCont")->item(0)->nodeValue)) {
3304
+            if (!empty($this->compra->getElementsByTagName("xCont")->item(0)->nodeValue)) {
3305 3305
                 $saida .= " Contrato: " . $this->compra->getElementsByTagName("xCont")->item(0)->nodeValue;
3306 3306
             }
3307 3307
         }
@@ -3327,21 +3327,21 @@  discard block
 block discarded – undo
3327 3327
         if ($vICMS > 0) {
3328 3328
             $vICMS = 1;
3329 3329
         }
3330
-        $icmss  = $this->ICMSTot->getElementsByTagName("vBC")->item(0)->nodeValue;
3330
+        $icmss = $this->ICMSTot->getElementsByTagName("vBC")->item(0)->nodeValue;
3331 3331
         if ($icmss > 0) {
3332 3332
             $icmss = 1;
3333 3333
         }
3334
-        $dEmi = ! empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
3334
+        $dEmi = !empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
3335 3335
                 $this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue : '';
3336 3336
         if ($dEmi == '') {
3337
-            $dEmi = ! empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
3337
+            $dEmi = !empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
3338 3338
                     $this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue : '';
3339 3339
             $aDemi = explode('T', $dEmi);
3340 3340
             $dEmi = $aDemi[0];
3341 3341
         }
3342 3342
         $dd  = $dEmi;
3343 3343
         $rpos = strrpos($dd, '-');
3344
-        $dd  = substr($dd, $rpos +1);
3344
+        $dd  = substr($dd, $rpos + 1);
3345 3345
         $chave = sprintf($forma, $cUF, $this->tpEmis, $CNPJ, $vNF, $vICMS, $icmss, $dd);
3346 3346
         $chave = $chave . $this->modulo11($chave);
3347 3347
         return $chave;
@@ -3362,7 +3362,7 @@  discard block
 block discarded – undo
3362 3362
         $formaNfRef = "\r\nNF  Ref.: série:%d numero:%d emit:%s em %s modelo: %d";
3363 3363
         $formaECFRef = "\r\nECF Ref.: modelo: %s ECF:%d COO:%d";
3364 3364
         $formaNfpRef = "\r\nNFP Ref.: série:%d número:%d emit:%s em %s modelo: %d IE:%s";
3365
-        $saida='';
3365
+        $saida = '';
3366 3366
         $nfRefs = $this->ide->getElementsByTagName('NFref');
3367 3367
         if (0 === $nfRefs->length) {
3368 3368
             return $saida;
@@ -3378,7 +3378,7 @@  discard block
 block discarded – undo
3378 3378
             foreach ($refNFe as $chave_acessoRef) {
3379 3379
                 $chave_acesso = $chave_acessoRef->nodeValue;
3380 3380
                 $chave_acessoF = $this->formatField($chave_acesso, $this->formatoChave);
3381
-                $data = substr($chave_acesso, 4, 2)."/20".substr($chave_acesso, 2, 2);
3381
+                $data = substr($chave_acesso, 4, 2) . "/20" . substr($chave_acesso, 2, 2);
3382 3382
                 $cnpj = $this->formatField(substr($chave_acesso, 6, 14), "##.###.###/####-##");
3383 3383
                 $serie  = substr($chave_acesso, 22, 3);
3384 3384
                 $numero = substr($chave_acesso, 25, 9);
@@ -3399,7 +3399,7 @@  discard block
 block discarded – undo
3399 3399
             foreach ($refCTe as $chave_acessoRef) {
3400 3400
                 $chave_acesso = $chave_acessoRef->nodeValue;
3401 3401
                 $chave_acessoF = $this->formatField($chave_acesso, $this->formatoChave);
3402
-                $data = substr($chave_acesso, 4, 2)."/20".substr($chave_acesso, 2, 2);
3402
+                $data = substr($chave_acesso, 4, 2) . "/20" . substr($chave_acesso, 2, 2);
3403 3403
                 $cnpj = $this->formatField(substr($chave_acesso, 6, 14), "##.###.###/####-##");
3404 3404
                 $serie  = substr($chave_acesso, 22, 3);
3405 3405
                 $numero = substr($chave_acesso, 25, 9);
@@ -3415,10 +3415,9 @@  discard block
 block discarded – undo
3415 3415
             $refNFP = $nfRef->getElementsByTagName('refNFP');
3416 3416
             foreach ($refNFP as $umaRefNFe) {
3417 3417
                 $data = $umaRefNFe->getElementsByTagName('AAMM')->item(0)->nodeValue;
3418
-                $cnpj = ! empty($umaRefNFe->getElementsByTagName('CNPJ')->item(0)->nodeValue) ?
3419
-                    $umaRefNFe->getElementsByTagName('CNPJ')->item(0)->nodeValue :
3420
-                    '';
3421
-                $cpf = ! empty($umaRefNFe->getElementsByTagName('CPF')->item(0)->nodeValue) ?
3418
+                $cnpj = !empty($umaRefNFe->getElementsByTagName('CNPJ')->item(0)->nodeValue) ?
3419
+                    $umaRefNFe->getElementsByTagName('CNPJ')->item(0)->nodeValue : '';
3420
+                $cpf = !empty($umaRefNFe->getElementsByTagName('CPF')->item(0)->nodeValue) ?
3422 3421
                         $umaRefNFe->getElementsByTagName('CPF')->item(0)->nodeValue : '';
3423 3422
                 $mod = $umaRefNFe->getElementsByTagName('mod')->item(0)->nodeValue;
3424 3423
                 $serie = $umaRefNFe->getElementsByTagName('serie')->item(0)->nodeValue;
@@ -3444,6 +3443,6 @@  discard block
 block discarded – undo
3444 3443
         imagedestroy($image);
3445 3444
         $stringdata = ob_get_contents(); // read from buffer
3446 3445
         ob_end_clean();
3447
-        return 'data://text/plain;base64,'.base64_encode($stringdata);
3446
+        return 'data://text/plain;base64,' . base64_encode($stringdata);
3448 3447
     }
3449 3448
 }
Please login to merge, or discard this patch.