Completed
Push — master ( 7fe95f...ca4d0e )
by Roberto
06:24 queued 03:23
created
src/NFe/Danfce.php 1 patch
Spacing   +80 added lines, -80 removed lines patch added patch discarded remove patch
@@ -26,8 +26,8 @@  discard block
 block discarded – undo
26 26
     protected $papel;
27 27
     protected $paperwidth = 80;
28 28
     protected $xml; // string XML NFe
29
-    protected $logomarca=''; // path para logomarca em jpg
30
-    protected $formatoChave="#### #### #### #### #### #### #### #### #### #### ####";
29
+    protected $logomarca = ''; // path para logomarca em jpg
30
+    protected $formatoChave = "#### #### #### #### #### #### #### #### #### #### ####";
31 31
     protected $nfeProc;
32 32
     protected $nfe;
33 33
     protected $infNFe;
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
         $this->textoAdic = '';
160 160
         if (isset($this->infAdic)) {
161 161
             $this->textoAdic .= !empty($this->infAdic->getElementsByTagName('infCpl')->item(0)->nodeValue) ?
162
-            'Inf. Contribuinte: '.
162
+            'Inf. Contribuinte: ' .
163 163
             trim($this->anfaveaDANFE($this->infAdic->getElementsByTagName('infCpl')->item(0)->nodeValue)) : '';
164 164
         }
165 165
         if (!empty($this->textoAdic)) {
@@ -199,10 +199,10 @@  discard block
 block discarded – undo
199 199
         //total inicial de paginas
200 200
         $totPag = 1;
201 201
         //largura imprimivel em mm: largura da folha menos as margens esq/direita
202
-        $this->wPrint = $maxW-($margEsq*2);
202
+        $this->wPrint = $maxW - ($margEsq * 2);
203 203
         //comprimento (altura) imprimivel em mm: altura da folha menos as margens
204 204
         //superior e inferior
205
-        $this->hPrint = $maxH-$margSup-$margInf;
205
+        $this->hPrint = $maxH - $margSup - $margInf;
206 206
         // estabelece contagem de paginas
207 207
         $this->pdf->aliasNbPages();
208 208
         $this->pdf->setMargins($margEsq, $margSup); // fixa as margens
@@ -213,11 +213,11 @@  discard block
 block discarded – undo
213 213
         $this->pdf->setLineWidth(0.1); // define a largura da linha
214 214
         $this->pdf->setTextColor(0, 0, 0);
215 215
         $this->pdf->textBox(0, 0, $maxW, $maxH); // POR QUE PRECISO DESA LINHA?
216
-        $hcabecalho = 27;//para cabeçalho (dados emitente mais logomarca)  (FIXO)
217
-        $hcabecalhoSecundario = 10 + 3;//para cabeçalho secundário (cabeçalho sefaz) (FIXO)
218
-        $hprodutos = $hLinha + ($qtdItens * $hMaxLinha)+2 ;//box poduto
216
+        $hcabecalho = 27; //para cabeçalho (dados emitente mais logomarca)  (FIXO)
217
+        $hcabecalhoSecundario = 10 + 3; //para cabeçalho secundário (cabeçalho sefaz) (FIXO)
218
+        $hprodutos = $hLinha + ($qtdItens * $hMaxLinha) + 2; //box poduto
219 219
         $hTotal = 17; //box total (FIXO)
220
-        $hpagamentos = $hLinha + ($qtdPgto * $hLinha) + 3;//para pagamentos
220
+        $hpagamentos = $hLinha + ($qtdPgto * $hLinha) + 3; //para pagamentos
221 221
         if (!empty($this->vTroco)) {
222 222
             $hpagamentos += $hLinha;
223 223
         }
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
         $y = $xInic + $hcabecalho + $hcabecalhoSecundario + $hprodutos + $hTotal;
251 251
         $y = $this->pagamentosDANFE($x, $y, $hpagamentos);
252 252
         //COLOCA MENSAGEM FISCAL
253
-        $y = $xInic + $hcabecalho + $hcabecalhoSecundario + $hprodutos + $hTotal+ $hpagamentos;
253
+        $y = $xInic + $hcabecalho + $hcabecalhoSecundario + $hprodutos + $hTotal + $hpagamentos;
254 254
         $y = $this->fiscalDANFE($x, $y, $hmsgfiscal);
255 255
         //COLOCA CONSUMIDOR
256 256
         $y = $xInic + $hcabecalho + $hcabecalhoSecundario + $hprodutos + $hTotal + $hpagamentos + $hmsgfiscal;
@@ -278,14 +278,14 @@  discard block
 block discarded – undo
278 278
         $emitIM     = $this->getTagValue($this->emit, "IM");
279 279
         $emitFone = $this->getTagValue($this->enderEmit, "fone");
280 280
         $foneLen = strlen($emitFone);
281
-        if ($foneLen>0) {
281
+        if ($foneLen > 0) {
282 282
             $ddd = substr($emitFone, 0, 2);
283 283
             $fone1 = substr($emitFone, -8);
284 284
             $digito9 = ' ';
285 285
             if ($foneLen == 11) {
286 286
                 $digito9 = substr($emitFone, 2, 1);
287 287
             }
288
-            $emitFone = ' - ('.$ddd.') '.$digito9. ' ' . substr($fone1, 0, 4) . '-' . substr($fone1, -4);
288
+            $emitFone = ' - (' . $ddd . ') ' . $digito9 . ' ' . substr($fone1, 0, 4) . '-' . substr($fone1, -4);
289 289
         } else {
290 290
             $emitFone = '';
291 291
         }
@@ -299,23 +299,23 @@  discard block
 block discarded – undo
299 299
         // CONFIGURAÇÃO DE POSIÇÃO
300 300
         $margemInterna = $this->margemInterna;
301 301
         $maxW = $this->wPrint;
302
-        $h = $h-($margemInterna);
302
+        $h = $h - ($margemInterna);
303 303
         //COLOCA LOGOMARCA
304 304
         if (!empty($this->logomarca)) {
305 305
             $xImg = $margemInterna;
306 306
             $yImg = $margemInterna + 1;
307 307
             $logoInfo = getimagesize($this->logomarca);
308
-            $logoWmm = ($logoInfo[0]/72)*25.4;
309
-            $logoHmm = ($logoInfo[1]/72)*25.4;
308
+            $logoWmm = ($logoInfo[0] / 72) * 25.4;
309
+            $logoHmm = ($logoInfo[1] / 72) * 25.4;
310 310
             $nImgW = 30;
311
-            $nImgH = round($logoHmm * ($nImgW/$logoWmm), 0);
311
+            $nImgH = round($logoHmm * ($nImgW / $logoWmm), 0);
312 312
             $this->pdf->image($this->logomarca, $xImg, $yImg, $nImgW, $nImgH, 'jpeg');
313
-            $xRs = ($maxW*0.4) + $margemInterna;
314
-            $wRs = ($maxW*0.6);
313
+            $xRs = ($maxW * 0.4) + $margemInterna;
314
+            $wRs = ($maxW * 0.6);
315 315
             $alignEmit = 'L';
316 316
         } else {
317 317
             $xRs = $margemInterna;
318
-            $wRs = ($maxW*1);
318
+            $wRs = ($maxW * 1);
319 319
             $alignEmit = 'L';
320 320
         }
321 321
         //COLOCA RAZÃO SOCIAL
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
     {
336 336
         $margemInterna = $this->margemInterna;
337 337
         $maxW = $this->wPrint;
338
-        $w = ($maxW*1);
338
+        $w = ($maxW * 1);
339 339
         $hBox1 = 7;
340 340
         $texto = "DANFE NFC-e\nDocumento Auxiliar da Nota Fiscal de Consumidor Eletrônica";
341 341
         $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B');
@@ -352,13 +352,13 @@  discard block
 block discarded – undo
352 352
         $margemInterna = $this->margemInterna;
353 353
         $maxW = $this->wPrint;
354 354
         $qtdItens = $this->det->length;
355
-        $w = ($maxW*1);
355
+        $w = ($maxW * 1);
356 356
         $hLinha = $this->hLinha;
357 357
         $aFontCabProdutos = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
358
-        $wBoxCod = $w*0.17;
358
+        $wBoxCod = $w * 0.17;
359 359
         $texto = "CÓDIGO";
360 360
         $this->pdf->textBox($x, $y, $wBoxCod, $hLinha, $texto, $aFontCabProdutos, 'T', 'L', 0, '', false);
361
-        $wBoxDescricao = $w*0.43;
361
+        $wBoxDescricao = $w * 0.43;
362 362
         $xBoxDescricao = $wBoxCod + $x;
363 363
         $texto = "DESCRICÃO";
364 364
         $this->pdf->textBox(
@@ -374,19 +374,19 @@  discard block
 block discarded – undo
374 374
             '',
375 375
             false
376 376
         );
377
-        $wBoxQt = $w*0.08;
377
+        $wBoxQt = $w * 0.08;
378 378
         $xBoxQt = $wBoxDescricao + $xBoxDescricao;
379 379
         $texto = "QT";
380 380
         $this->pdf->textBox($xBoxQt, $y, $wBoxQt, $hLinha, $texto, $aFontCabProdutos, 'T', 'L', 0, '', false);
381
-        $wBoxUn = $w*0.06;
381
+        $wBoxUn = $w * 0.06;
382 382
         $xBoxUn = $wBoxQt + $xBoxQt;
383 383
         $texto = "UN";
384 384
         $this->pdf->textBox($xBoxUn, $y, $wBoxUn, $hLinha, $texto, $aFontCabProdutos, 'T', 'L', 0, '', false);
385
-        $wBoxVl = $w*0.13;
385
+        $wBoxVl = $w * 0.13;
386 386
         $xBoxVl = $wBoxUn + $xBoxUn;
387 387
         $texto = "VALOR";
388 388
         $this->pdf->textBox($xBoxVl, $y, $wBoxVl, $hLinha, $texto, $aFontCabProdutos, 'T', 'L', 0, '', false);
389
-        $wBoxTotal = $w*0.13;
389
+        $wBoxTotal = $w * 0.13;
390 390
         $xBoxTotal = $wBoxVl + $xBoxVl;
391 391
         $texto = "TOTAL";
392 392
         $this->pdf->textBox($xBoxTotal, $y, $wBoxTotal, $hLinha, $texto, $aFontCabProdutos, 'T', 'L', 0, '', false);
@@ -406,9 +406,9 @@  discard block
 block discarded – undo
406 406
                 $vUnCom     = number_format($this->getTagValue($prod, "vUnCom"), 2, ",", ".");
407 407
                 $vProd      = number_format($this->getTagValue($prod, "vProd"), 2, ",", ".");
408 408
                 //COLOCA PRODUTO
409
-                $yBoxProd = $y + $hLinha + ($cont*$hMaxLinha);
409
+                $yBoxProd = $y + $hLinha + ($cont * $hMaxLinha);
410 410
                 //COLOCA PRODUTO CÓDIGO
411
-                $wBoxCod = $w*0.17;
411
+                $wBoxCod = $w * 0.17;
412 412
                 $texto = $cProd;
413 413
                 $this->pdf->textBox(
414 414
                     $x,
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
                     false
425 425
                 );
426 426
                 //COLOCA PRODUTO DESCRIÇÃO
427
-                $wBoxDescricao = $w*0.43;
427
+                $wBoxDescricao = $w * 0.43;
428 428
                 $xBoxDescricao = $wBoxCod + $x;
429 429
                 $texto = $xProd;
430 430
                 $this->pdf->textBox(
@@ -441,7 +441,7 @@  discard block
 block discarded – undo
441 441
                     false
442 442
                 );
443 443
                 //COLOCA PRODUTO QUANTIDADE
444
-                $wBoxQt = $w*0.08;
444
+                $wBoxQt = $w * 0.08;
445 445
                 $xBoxQt = $wBoxDescricao + $xBoxDescricao;
446 446
                 $texto = $qCom;
447 447
                 $this->pdf->textBox(
@@ -458,7 +458,7 @@  discard block
 block discarded – undo
458 458
                     false
459 459
                 );
460 460
                 //COLOCA PRODUTO UNIDADE
461
-                $wBoxUn = $w*0.06;
461
+                $wBoxUn = $w * 0.06;
462 462
                 $xBoxUn = $wBoxQt + $xBoxQt;
463 463
                 $texto = $uCom;
464 464
                 $this->pdf->textBox(
@@ -475,7 +475,7 @@  discard block
 block discarded – undo
475 475
                     false
476 476
                 );
477 477
                 //COLOCA PRODUTO VL UNITÁRIO
478
-                $wBoxVl = $w*0.13;
478
+                $wBoxVl = $w * 0.13;
479 479
                 $xBoxVl = $wBoxUn + $xBoxUn;
480 480
                 $texto = $vUnCom;
481 481
                 $this->pdf->textBox(
@@ -492,7 +492,7 @@  discard block
 block discarded – undo
492 492
                     false
493 493
                 );
494 494
                 //COLOCA PRODUTO VL TOTAL
495
-                $wBoxTotal = $w*0.13;
495
+                $wBoxTotal = $w * 0.13;
496 496
                 $xBoxTotal = $wBoxVl + $xBoxVl;
497 497
                 $texto = $vProd;
498 498
                 $this->pdf->textBox(
@@ -519,8 +519,8 @@  discard block
 block discarded – undo
519 519
         $margemInterna = $this->margemInterna;
520 520
         $maxW = $this->wPrint;
521 521
         $hLinha = 3;
522
-        $wColEsq = ($maxW*0.7);
523
-        $wColDir = ($maxW*0.3);
522
+        $wColEsq = ($maxW * 0.7);
523
+        $wColDir = ($maxW * 0.3);
524 524
         $xValor = $x + $wColEsq;
525 525
         $qtdItens = $this->det->length;
526 526
         $vProd = $this->getTagValue($this->ICMSTot, "vProd");
@@ -542,35 +542,35 @@  discard block
 block discarded – undo
542 542
         $texto = "R$ " . number_format($vProd, 2, ",", ".");
543 543
         $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
544 544
         $this->pdf->textBox($xValor, $yTotal, $wColDir, $hLinha, $texto, $aFont, 'T', 'R', 0, '', false);
545
-        $yDesconto = $y + ($hLinha*2);
545
+        $yDesconto = $y + ($hLinha * 2);
546 546
         $texto = "Descontos";
547 547
         $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
548 548
         $this->pdf->textBox($x, $yDesconto, $wColEsq, $hLinha, $texto, $aFont, 'T', 'L', 0, '', false);
549 549
         $texto = "R$ " . $vDesc;
550 550
         $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
551 551
         $this->pdf->textBox($xValor, $yDesconto, $wColDir, $hLinha, $texto, $aFont, 'T', 'R', 0, '', false);
552
-        $yFrete= $y + ($hLinha*3);
552
+        $yFrete = $y + ($hLinha * 3);
553 553
         $texto = "Frete";
554 554
         $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
555 555
         $this->pdf->textBox($x, $yFrete, $wColEsq, $hLinha, $texto, $aFont, 'T', 'L', 0, '', false);
556 556
         $texto = "R$ " . $vFrete;
557 557
         $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
558 558
         $this->pdf->textBox($xValor, $yFrete, $wColDir, $hLinha, $texto, $aFont, 'T', 'R', 0, '', false);
559
-        $yOutro= $y + ($hLinha*4);
559
+        $yOutro = $y + ($hLinha * 4);
560 560
         $texto = "Outro";
561 561
         $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
562 562
         $this->pdf->textBox($x, $yOutro, $wColEsq, $hLinha, $texto, $aFont, 'T', 'L', 0, '', false);
563 563
         $texto = "R$ " . $vOutro;
564 564
         $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
565 565
         $this->pdf->textBox($xValor, $yOutro, $wColDir, $hLinha, $texto, $aFont, 'T', 'R', 0, '', false);
566
-        $yTotalFinal = $y + ($hLinha*5);
566
+        $yTotalFinal = $y + ($hLinha * 5);
567 567
         $texto = "Total";
568 568
         $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
569 569
         $this->pdf->textBox($x, $yTotalFinal, $wColEsq, $hLinha, $texto, $aFont, 'T', 'L', 0, '', false);
570 570
         $texto = "R$ " . $vNF;
571 571
         $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
572 572
         $this->pdf->textBox($xValor, $yTotalFinal, $wColDir, $hLinha, $texto, $aFont, 'T', 'R', 0, '', false);
573
-        $yTotalFinal = $y + ($hLinha*6.3);
573
+        $yTotalFinal = $y + ($hLinha * 6.3);
574 574
         $texto = "Informação dos Tributos Totais Incidentes";
575 575
         $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>''];
576 576
         $this->pdf->textBox($x, $yTotalFinal, $wColEsq, $hLinha, $texto, $aFont, 'T', 'L', 0, '', false);
@@ -585,16 +585,16 @@  discard block
 block discarded – undo
585 585
         $margemInterna = $this->margemInterna;
586 586
         $maxW = $this->wPrint;
587 587
         $qtdPgto = $this->pag->length;
588
-        $w = ($maxW*1);
588
+        $w = ($maxW * 1);
589 589
         $hLinha = $this->hLinha;
590
-        $wColEsq = ($maxW*0.7);
591
-        $wColDir = ($maxW*0.3);
590
+        $wColEsq = ($maxW * 0.7);
591
+        $wColDir = ($maxW * 0.3);
592 592
         $xValor = $x + $wColEsq;
593 593
         $aFontPgto = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
594
-        $wBoxEsq = $w*0.7;
594
+        $wBoxEsq = $w * 0.7;
595 595
         $texto = "FORMA DE PAGAMENTO";
596 596
         $this->pdf->textBox($x, $y, $wBoxEsq, $hLinha, $texto, $aFontPgto, 'T', 'L', 0, '', false);
597
-        $wBoxDir = $w*0.3;
597
+        $wBoxDir = $w * 0.3;
598 598
         $xBoxDescricao = $x + $wBoxEsq;
599 599
         $texto = "VALOR PAGO";
600 600
         $this->pdf->textBox($xBoxDescricao, $y, $wBoxDir, $hLinha, $texto, $aFontPgto, 'T', 'R', 0, '', false);
@@ -616,7 +616,7 @@  discard block
 block discarded – undo
616 616
                     $tBandNome = self::getCardName($tBand);
617 617
                 }
618 618
                 //COLOCA PRODUTO
619
-                $yBoxProd = $y + $hLinha + ($cont*$hLinha);
619
+                $yBoxProd = $y + $hLinha + ($cont * $hLinha);
620 620
                 //COLOCA PRODUTO CÓDIGO
621 621
                 $texto = $tPagNome;
622 622
                 $this->pdf->textBox($x, $yBoxProd, $wBoxEsq, $hLinha, $texto, $aFontPgto, 'T', 'L', 0, '', false);
@@ -640,7 +640,7 @@  discard block
 block discarded – undo
640 640
             }
641 641
             
642 642
             if (!empty($this->vTroco)) {
643
-                $yBoxProd = $y + $hLinha + ($cont*$hLinha);
643
+                $yBoxProd = $y + $hLinha + ($cont * $hLinha);
644 644
                 //COLOCA PRODUTO CÓDIGO
645 645
                 $texto = 'Troco';
646 646
                 $this->pdf->textBox($x, $yBoxProd, $wBoxEsq, $hLinha, $texto, $aFontPgto, 'T', 'L', 0, '', false);
@@ -669,7 +669,7 @@  discard block
 block discarded – undo
669 669
         $y += 6;
670 670
         $margemInterna = $this->margemInterna;
671 671
         $maxW = $this->wPrint;
672
-        $w = ($maxW*1);
672
+        $w = ($maxW * 1);
673 673
         $hLinha = $this->hLinha;
674 674
         $aFontTit = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B'];
675 675
         $aFontTex = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>''];
@@ -701,19 +701,19 @@  discard block
 block discarded – undo
701 701
         $dhEmiLocalFormat = $dhEmilocal->format('d/m/Y H:i:s');
702 702
         $texto = "ÁREA DE MENSAGEM FISCAL";
703 703
         $this->pdf->textBox($x, $y, $w, $hLinha, $texto, $aFontTit, 'C', 'C', 0, '', false);
704
-        $yTex1 = $y + ($hLinha*1);
705
-        $hTex1 = $hLinha*2;
706
-        $texto = "Número " . $nNF . " Série " . $serieNF . " " .$dhEmiLocalFormat . " - Via Consumidor";
704
+        $yTex1 = $y + ($hLinha * 1);
705
+        $hTex1 = $hLinha * 2;
706
+        $texto = "Número " . $nNF . " Série " . $serieNF . " " . $dhEmiLocalFormat . " - Via Consumidor";
707 707
         $this->pdf->textBox($x, $yTex1, $w, $hTex1, $texto, $aFontTex, 'C', 'C', 0, '', false);
708
-        $yTex2 = $y + ($hLinha*3);
709
-        $hTex2 = $hLinha*2;
708
+        $yTex2 = $y + ($hLinha * 3);
709
+        $hTex2 = $hLinha * 2;
710 710
         
711 711
         $texto = !empty($this->urlChave) ? "Consulte pela Chave de Acesso em " . $this->urlChave : '';
712 712
         $this->pdf->textBox($x, $yTex2, $w, $hTex2, $texto, $aFontTex, 'C', 'C', 0, '', false);
713 713
         $texto = "CHAVE DE ACESSO";
714
-        $yTit2 = $y + ($hLinha*5);
714
+        $yTit2 = $y + ($hLinha * 5);
715 715
         $this->pdf->textBox($x, $yTit2, $w, $hLinha, $texto, $aFontTit, 'C', 'C', 0, '', false);
716
-        $yTex3 = $y + ($hLinha*6);
716
+        $yTex3 = $y + ($hLinha * 6);
717 717
         $texto = $chNFe;
718 718
         $this->pdf->textBox($x, $yTex3, $w, $hLinha, $texto, $aFontTex, 'C', 'C', 0, '', false);
719 719
     }
@@ -723,7 +723,7 @@  discard block
 block discarded – undo
723 723
         $y += 6;
724 724
         $margemInterna = $this->margemInterna;
725 725
         $maxW = $this->wPrint;
726
-        $w = ($maxW*1);
726
+        $w = ($maxW * 1);
727 727
         $hLinha = $this->hLinha;
728 728
         $aFontTit = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B'];
729 729
         $aFontTex = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>''];
@@ -739,7 +739,7 @@  discard block
 block discarded – undo
739 739
             $consCNPJ = !empty($this->dest->getElementsByTagName("CNPJ")->item(0)->nodeValue)
740 740
                     ? $this->dest->getElementsByTagName("CNPJ")->item(0)->nodeValue
741 741
                     : '';
742
-            $cDest = $consCPF.$consCNPJ.$considEstrangeiro; //documentos do consumidor
742
+            $cDest = $consCPF . $consCNPJ . $considEstrangeiro; //documentos do consumidor
743 743
             $enderDest = $this->dest->getElementsByTagName("enderDest")->item(0);
744 744
             $consNome = $this->getTagValue($this->dest, "xNome");
745 745
             $consLgr = $this->getTagValue($enderDest, "xLgr");
@@ -779,8 +779,8 @@  discard block
 block discarded – undo
779 779
             $yTex1 = $y + $hLinha;
780 780
             $texto = $consNome;
781 781
             if (!empty($consDoc)) {
782
-                $texto .= " - ". $consDoc . "\n" . $consEnd;
783
-                $this->pdf->textBox($x, $yTex1, $w, $hLinha*3, $texto, $aFontTex, 'C', 'C', 0, '', false);
782
+                $texto .= " - " . $consDoc . "\n" . $consEnd;
783
+                $this->pdf->textBox($x, $yTex1, $w, $hLinha * 3, $texto, $aFontTex, 'C', 'C', 0, '', false);
784 784
             }
785 785
         } else {
786 786
             $yTex1 = $y + $hLinha;
@@ -794,7 +794,7 @@  discard block
 block discarded – undo
794 794
         $y += 6;
795 795
         $margemInterna = $this->margemInterna;
796 796
         $maxW = $this->wPrint;
797
-        $w = ($maxW*1)+4;
797
+        $w = ($maxW * 1) + 4;
798 798
         $hLinha = $this->hLinha;
799 799
         $hBoxLinha = $this->hBoxLinha;
800 800
         $aFontTit = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B');
@@ -803,7 +803,7 @@  discard block
 block discarded – undo
803 803
         $nProt = '';
804 804
         if (isset($this->nfeProc)) {
805 805
             $nProt = $this->getTagValue($this->nfeProc, "nProt");
806
-            $dhRecbto  = $this->getTagValue($this->nfeProc, "dhRecbto");
806
+            $dhRecbto = $this->getTagValue($this->nfeProc, "dhRecbto");
807 807
         }
808 808
         $barcode = new Barcode();
809 809
         $bobj = $barcode->getBarcodeObj(
@@ -817,15 +817,15 @@  discard block
 block discarded – undo
817 817
         $qrcode = $bobj->getPngData();
818 818
         $wQr = 50;
819 819
         $hQr = 50;
820
-        $yQr = ($y+$margemInterna);
821
-        $xQr = ($w/2) - ($wQr/2);
820
+        $yQr = ($y + $margemInterna);
821
+        $xQr = ($w / 2) - ($wQr / 2);
822 822
         // prepare a base64 encoded "data url"
823 823
         $pic = 'data://text/plain;base64,' . base64_encode($qrcode);
824 824
         $info = getimagesize($pic);
825 825
         $this->pdf->image($pic, $xQr, $yQr, $wQr, $hQr, 'PNG');
826 826
         $dt = new DateTime($dhRecbto);
827
-        $yQr = ($yQr+$hQr+$margemInterna);
828
-        $this->pdf->textBox($x, $yQr, $w-4, $hBoxLinha, "Protocolo de Autorização: " . $nProt . "\n"
827
+        $yQr = ($yQr + $hQr + $margemInterna);
828
+        $this->pdf->textBox($x, $yQr, $w - 4, $hBoxLinha, "Protocolo de Autorização: " . $nProt . "\n"
829 829
             . $dt->format('d/m/Y H:i:s'), $aFontTex, 'C', 'C', 0, '', false);
830 830
     }
831 831
    
@@ -851,7 +851,7 @@  discard block
 block discarded – undo
851 851
             $heigthText = $this->pdf->textBox($x, $y, $w, $hLinha, $texto, $aFontTit, 'C', 'C', 0, '', false);
852 852
         }
853 853
         // seta o textbox do texto adicional
854
-        $this->pdf->textBox($x, $y+3, $w-2, $hLinha-3, $this->textoAdic, $aFontTex, 'T', 'L', 0, '', false);
854
+        $this->pdf->textBox($x, $y + 3, $w - 2, $hLinha - 3, $this->textoAdic, $aFontTex, 'T', 'L', 0, '', false);
855 855
     }
856 856
     
857 857
     /**
@@ -877,7 +877,7 @@  discard block
 block discarded – undo
877 877
         if ($startPos === false) {
878 878
             return $cdata;
879 879
         }
880
-        for ($x=$len; $x>0; $x--) {
880
+        for ($x = $len; $x > 0; $x--) {
881 881
             if (substr($cdata, $x, 1) == '>') {
882 882
                 $endPos = $x;
883 883
                 break;
@@ -888,15 +888,15 @@  discard block
 block discarded – undo
888 888
         } else {
889 889
             $parte1 = '';
890 890
         }
891
-        $parte2 = substr($cdata, $startPos, $endPos-$startPos+1);
891
+        $parte2 = substr($cdata, $startPos, $endPos - $startPos + 1);
892 892
         if ($endPos < $len) {
893 893
             $parte3 = substr($cdata, $endPos + 1, $len - $endPos - 1);
894 894
         } else {
895 895
             $parte3 = '';
896 896
         }
897
-        $texto = trim($parte1).' '.trim($parte3);
897
+        $texto = trim($parte1) . ' ' . trim($parte3);
898 898
         if (strpos($parte2, '<CDATA>') === false) {
899
-            $cdata = '<CDATA>'.$parte2.'</CDATA>';
899
+            $cdata = '<CDATA>' . $parte2 . '</CDATA>';
900 900
         } else {
901 901
             $cdata = $parte2;
902 902
         }
@@ -968,15 +968,15 @@  discard block
 block discarded – undo
968 968
         //grupo CADATA infCpl
969 969
         $t = $dom->getElementsByTagName('transmissor')->item(0);
970 970
         $r = $dom->getElementsByTagName('receptor')->item(0);
971
-        $versao = ! empty($dom->getElementsByTagName('versao')->item(0)->nodeValue) ?
972
-        'Versao:'.$dom->getElementsByTagName('versao')->item(0)->nodeValue.' ' : '';
973
-        $especieNF = ! empty($dom->getElementsByTagName('especieNF')->item(0)->nodeValue) ?
974
-        'Especie:'.$dom->getElementsByTagName('especieNF')->item(0)->nodeValue.' ' : '';
975
-        $fabEntrega = ! empty($dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue) ?
976
-        'Entrega:'.$dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue.' ' : '';
977
-        $dca = ! empty($dom->getElementsByTagName('dca')->item(0)->nodeValue) ?
978
-        'dca:'.$dom->getElementsByTagName('dca')->item(0)->nodeValue.' ' : '';
979
-        $texto .= "".$versao.$especieNF.$fabEntrega.$dca;
971
+        $versao = !empty($dom->getElementsByTagName('versao')->item(0)->nodeValue) ?
972
+        'Versao:' . $dom->getElementsByTagName('versao')->item(0)->nodeValue . ' ' : '';
973
+        $especieNF = !empty($dom->getElementsByTagName('especieNF')->item(0)->nodeValue) ?
974
+        'Especie:' . $dom->getElementsByTagName('especieNF')->item(0)->nodeValue . ' ' : '';
975
+        $fabEntrega = !empty($dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue) ?
976
+        'Entrega:' . $dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue . ' ' : '';
977
+        $dca = !empty($dom->getElementsByTagName('dca')->item(0)->nodeValue) ?
978
+        'dca:' . $dom->getElementsByTagName('dca')->item(0)->nodeValue . ' ' : '';
979
+        $texto .= "" . $versao . $especieNF . $fabEntrega . $dca;
980 980
         if (isset($t)) {
981 981
             if ($t->hasAttributes()) {
982 982
                 $texto .= " Transmissor ";
Please login to merge, or discard this patch.