Passed
Push — master ( e4694f...d048fd )
by Roberto
03:55
created
src/NFe/Danfce.php 1 patch
Spacing   +87 added lines, -87 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;
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
         $this->textoAdic = '';
258 258
         if (isset($this->infAdic)) {
259 259
             $this->textoAdic .= !empty($this->infAdic->getElementsByTagName('infCpl')->item(0)->nodeValue) ?
260
-            'Inf. Contribuinte: '.
260
+            'Inf. Contribuinte: ' .
261 261
             trim($this->pAnfavea($this->infAdic->getElementsByTagName('infCpl')->item(0)->nodeValue)) : '';
262 262
             if (!empty($this->textoAdic)) {
263 263
                 $tempPDF = new Pdf(); // cria uma instancia temporaria da class pdf
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
             $orientacao = 'P';
274 274
         }
275 275
         $this->orientacao = $orientacao;
276
-        $this->papel = array(80,$tamPapelVert);
276
+        $this->papel = array(80, $tamPapelVert);
277 277
         $this->logoAlign = $logoAlign;
278 278
         //$this->situacao_externa = $situacaoExterna;
279 279
         $this->numero_registro_dpec = $depecNumReg;
@@ -297,10 +297,10 @@  discard block
 block discarded – undo
297 297
         //total inicial de paginas
298 298
         $totPag = 1;
299 299
         //largura imprimivel em mm: largura da folha menos as margens esq/direita
300
-        $this->wPrint = $maxW-($margEsq*2);
300
+        $this->wPrint = $maxW - ($margEsq * 2);
301 301
         //comprimento (altura) imprimivel em mm: altura da folha menos as margens
302 302
         //superior e inferior
303
-        $this->hPrint = $maxH-$margSup-$margInf;
303
+        $this->hPrint = $maxH - $margSup - $margInf;
304 304
         // estabelece contagem de paginas
305 305
         $this->pdf->aliasNbPages();
306 306
         $this->pdf->setMargins($margEsq, $margSup); // fixa as margens
@@ -311,22 +311,22 @@  discard block
 block discarded – undo
311 311
         $this->pdf->setLineWidth(0.1); // define a largura da linha
312 312
         $this->pdf->setTextColor(0, 0, 0);
313 313
         $this->pTextBox(0, 0, $maxW, $maxH); // POR QUE PRECISO DESA LINHA?
314
-        $hcabecalho = 27;//para cabeçalho (dados emitente mais logomarca)  (FIXO)
315
-        $hcabecalhoSecundario = 10;//para cabeçalho secundário (cabeçalho sefaz) (FIXO)
316
-        $hprodutos = $hLinha + ($qtdItens*$hMaxLinha) ;//box poduto
314
+        $hcabecalho = 27; //para cabeçalho (dados emitente mais logomarca)  (FIXO)
315
+        $hcabecalhoSecundario = 10; //para cabeçalho secundário (cabeçalho sefaz) (FIXO)
316
+        $hprodutos = $hLinha + ($qtdItens * $hMaxLinha); //box poduto
317 317
         $hTotal = 12; //box total (FIXO)
318
-        $hpagamentos = $hLinha + ($qtdPgto*$hLinha);//para pagamentos
319
-        $hmsgfiscal = 21;// para imposto (FIXO)
318
+        $hpagamentos = $hLinha + ($qtdPgto * $hLinha); //para pagamentos
319
+        $hmsgfiscal = 21; // para imposto (FIXO)
320 320
         if (!isset($this->dest)) {
321
-            $hcliente = 6;// para cliente (FIXO)
321
+            $hcliente = 6; // para cliente (FIXO)
322 322
         } else {
323 323
             $hcliente = 12;
324 324
         }// para cliente (FIXO)};
325
-        $hQRCode = 50;// para qrcode (FIXO)
326
-        $hCabecItens = 4;//cabeçalho dos itens
325
+        $hQRCode = 50; // para qrcode (FIXO)
326
+        $hCabecItens = 4; //cabeçalho dos itens
327 327
         
328 328
         $hUsado = $hCabecItens;
329
-        $w2 = round($this->wPrint*0.31, 0);
329
+        $w2 = round($this->wPrint * 0.31, 0);
330 330
         $totPag = 1;
331 331
         $pag = 1;
332 332
         $x = $xInic;
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
         $y = $xInic + $hcabecalho + $hcabecalhoSecundario + $hprodutos + $hTotal;
347 347
         $y = $this->pPagamentosDANFE($x, $y, $hpagamentos);
348 348
         //COLOCA MENSAGEM FISCAL
349
-        $y = $xInic + $hcabecalho + $hcabecalhoSecundario + $hprodutos + $hTotal+ $hpagamentos;
349
+        $y = $xInic + $hcabecalho + $hcabecalhoSecundario + $hprodutos + $hTotal + $hpagamentos;
350 350
         $y = $this->pFiscalDANFE($x, $y, $hmsgfiscal);
351 351
         //COLOCA CONSUMIDOR
352 352
         $y = $xInic + $hcabecalho + $hcabecalhoSecundario + $hprodutos + $hTotal + $hpagamentos + $hmsgfiscal;
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
         }
365 365
         
366 366
         //retorna o ID na NFe
367
-        if ($classPdf!==false) {
367
+        if ($classPdf !== false) {
368 368
             $aR = [
369 369
              'id'=>str_replace('NFe', '', $this->infNFe->getAttribute("Id")),
370 370
              'classe_PDF'=>$this->pdf
@@ -384,14 +384,14 @@  discard block
 block discarded – undo
384 384
         $emitIM     = $this->pSimpleGetValue($this->emit, "IM");
385 385
         $emitFone = $this->pSimpleGetValue($this->enderEmit, "fone");
386 386
         $foneLen = strlen($emitFone);
387
-        if ($foneLen>0) {
387
+        if ($foneLen > 0) {
388 388
             $ddd = substr($emitFone, 0, 2);
389 389
             $fone1 = substr($emitFone, -8);
390 390
             $digito9 = ' ';
391 391
             if ($foneLen == 11) {
392 392
                 $digito9 = substr($emitFone, 2, 1);
393 393
             }
394
-            $emitFone = ' - ('.$ddd.') '.$digito9. ' ' . substr($fone1, 0, 4) . '-' . substr($fone1, -4);
394
+            $emitFone = ' - (' . $ddd . ') ' . $digito9 . ' ' . substr($fone1, 0, 4) . '-' . substr($fone1, -4);
395 395
         } else {
396 396
             $emitFone = '';
397 397
         }
@@ -405,18 +405,18 @@  discard block
 block discarded – undo
405 405
         // CONFIGURAÇÃO DE POSIÇÃO
406 406
         $margemInterna = $this->margemInterna;
407 407
         $maxW = $this->wPrint;
408
-        $h = $h-($margemInterna);
408
+        $h = $h - ($margemInterna);
409 409
         //COLOCA LOGOMARCA
410 410
         if (is_file($this->logomarca)) {
411 411
             $xImg = $margemInterna;
412 412
             $yImg = $margemInterna + 1;
413 413
             $this->pdf->Image($this->logomarca, $xImg, $yImg, 30, 22.5);
414
-            $xRs = ($maxW*0.4) + $margemInterna;
415
-            $wRs = ($maxW*0.6);
414
+            $xRs = ($maxW * 0.4) + $margemInterna;
415
+            $wRs = ($maxW * 0.6);
416 416
             $alignEmit = 'L';
417 417
         } else {
418 418
             $xRs = $margemInterna;
419
-            $wRs = ($maxW*1);
419
+            $wRs = ($maxW * 1);
420 420
             $alignEmit = 'L';
421 421
         }
422 422
         //COLOCA RAZÃO SOCIAL
@@ -436,7 +436,7 @@  discard block
 block discarded – undo
436 436
     {
437 437
         $margemInterna = $this->margemInterna;
438 438
         $maxW = $this->wPrint;
439
-        $w = ($maxW*1);
439
+        $w = ($maxW * 1);
440 440
         $hBox1 = 7;
441 441
         $texto = "DANFE NFC-e\nDocumento Auxiliar da Nota Fiscal de Consumidor Eletrônica";
442 442
         $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B');
@@ -453,13 +453,13 @@  discard block
 block discarded – undo
453 453
         $margemInterna = $this->margemInterna;
454 454
         $maxW = $this->wPrint;
455 455
         $qtdItens = $this->det->length;
456
-        $w = ($maxW*1);
456
+        $w = ($maxW * 1);
457 457
         $hLinha = $this->hLinha;
458 458
         $aFontCabProdutos = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
459
-        $wBoxCod = $w*0.17;
459
+        $wBoxCod = $w * 0.17;
460 460
         $texto = "CÓDIGO";
461 461
         $this->pTextBox($x, $y, $wBoxCod, $hLinha, $texto, $aFontCabProdutos, 'T', 'L', 0, '', false);
462
-        $wBoxDescricao = $w*0.43;
462
+        $wBoxDescricao = $w * 0.43;
463 463
         $xBoxDescricao = $wBoxCod + $x;
464 464
         $texto = "DESCRICÃO";
465 465
         $this->pTextBox(
@@ -475,19 +475,19 @@  discard block
 block discarded – undo
475 475
             '',
476 476
             false
477 477
         );
478
-        $wBoxQt = $w*0.08;
478
+        $wBoxQt = $w * 0.08;
479 479
         $xBoxQt = $wBoxDescricao + $xBoxDescricao;
480 480
         $texto = "QT";
481 481
         $this->pTextBox($xBoxQt, $y, $wBoxQt, $hLinha, $texto, $aFontCabProdutos, 'T', 'L', 0, '', false);
482
-        $wBoxUn = $w*0.06;
482
+        $wBoxUn = $w * 0.06;
483 483
         $xBoxUn = $wBoxQt + $xBoxQt;
484 484
         $texto = "UN";
485 485
         $this->pTextBox($xBoxUn, $y, $wBoxUn, $hLinha, $texto, $aFontCabProdutos, 'T', 'L', 0, '', false);
486
-        $wBoxVl = $w*0.13;
486
+        $wBoxVl = $w * 0.13;
487 487
         $xBoxVl = $wBoxUn + $xBoxUn;
488 488
         $texto = "VALOR";
489 489
         $this->pTextBox($xBoxVl, $y, $wBoxVl, $hLinha, $texto, $aFontCabProdutos, 'T', 'L', 0, '', false);
490
-        $wBoxTotal = $w*0.13;
490
+        $wBoxTotal = $w * 0.13;
491 491
         $xBoxTotal = $wBoxVl + $xBoxVl;
492 492
         $texto = "TOTAL";
493 493
         $this->pTextBox($xBoxTotal, $y, $wBoxTotal, $hLinha, $texto, $aFontCabProdutos, 'T', 'L', 0, '', false);
@@ -507,13 +507,13 @@  discard block
 block discarded – undo
507 507
                 $vUnCom     = number_format($this->pSimpleGetValue($prod, "vUnCom"), 2, ",", ".");
508 508
                 $vProd      = number_format($this->pSimpleGetValue($prod, "vProd"), 2, ",", ".");
509 509
                 //COLOCA PRODUTO
510
-                $yBoxProd = $y + $hLinha + ($cont*$hMaxLinha);
510
+                $yBoxProd = $y + $hLinha + ($cont * $hMaxLinha);
511 511
                 //COLOCA PRODUTO CÓDIGO
512
-                $wBoxCod = $w*0.17;
512
+                $wBoxCod = $w * 0.17;
513 513
                 $texto = $cProd;
514 514
                 $this->pTextBox($x, $yBoxProd, $wBoxCod, $hMaxLinha, $texto, $aFontProdutos, 'C', 'C', 0, '', false);
515 515
                 //COLOCA PRODUTO DESCRIÇÃO
516
-                $wBoxDescricao = $w*0.43;
516
+                $wBoxDescricao = $w * 0.43;
517 517
                 $xBoxDescricao = $wBoxCod + $x;
518 518
                 $texto = $xProd;
519 519
                 $this->pTextBox(
@@ -530,7 +530,7 @@  discard block
 block discarded – undo
530 530
                     false
531 531
                 );
532 532
                 //COLOCA PRODUTO QUANTIDADE
533
-                $wBoxQt = $w*0.08;
533
+                $wBoxQt = $w * 0.08;
534 534
                 $xBoxQt = $wBoxDescricao + $xBoxDescricao;
535 535
                 $texto = $qCom;
536 536
                 $this->pTextBox(
@@ -547,7 +547,7 @@  discard block
 block discarded – undo
547 547
                     false
548 548
                 );
549 549
                 //COLOCA PRODUTO UNIDADE
550
-                $wBoxUn = $w*0.06;
550
+                $wBoxUn = $w * 0.06;
551 551
                 $xBoxUn = $wBoxQt + $xBoxQt;
552 552
                 $texto = $uCom;
553 553
                 $this->pTextBox(
@@ -564,7 +564,7 @@  discard block
 block discarded – undo
564 564
                     false
565 565
                 );
566 566
                 //COLOCA PRODUTO VL UNITÁRIO
567
-                $wBoxVl = $w*0.13;
567
+                $wBoxVl = $w * 0.13;
568 568
                 $xBoxVl = $wBoxUn + $xBoxUn;
569 569
                 $texto = $vUnCom;
570 570
                 $this->pTextBox(
@@ -581,7 +581,7 @@  discard block
 block discarded – undo
581 581
                     false
582 582
                 );
583 583
                 //COLOCA PRODUTO VL TOTAL
584
-                $wBoxTotal = $w*0.13;
584
+                $wBoxTotal = $w * 0.13;
585 585
                 $xBoxTotal = $wBoxVl + $xBoxVl;
586 586
                 $texto = $vProd;
587 587
                 $this->pTextBox(
@@ -608,13 +608,13 @@  discard block
 block discarded – undo
608 608
         $margemInterna = $this->margemInterna;
609 609
         $maxW = $this->wPrint;
610 610
         $hLinha = 3;
611
-        $wColEsq = ($maxW*0.7);
612
-        $wColDir = ($maxW*0.3);
611
+        $wColEsq = ($maxW * 0.7);
612
+        $wColDir = ($maxW * 0.3);
613 613
         $xValor = $x + $wColEsq;
614 614
         $qtdItens = $this->det->length;
615 615
         $vProd = $this->pSimpleGetValue($this->ICMSTot, "vProd");
616 616
         $vNF = $this->pSimpleGetValue($this->ICMSTot, "vNF");
617
-        $vDesc  = $this->pSimpleGetValue($this->ICMSTot, "vDesc");
617
+        $vDesc = $this->pSimpleGetValue($this->ICMSTot, "vDesc");
618 618
         $vTotTrib = $this->pSimpleGetValue($this->ICMSTot, "vTotTrib");
619 619
         $texto = "Qtd. Total de Itens";
620 620
         $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
@@ -629,21 +629,21 @@  discard block
 block discarded – undo
629 629
         $texto = "R$ " . number_format($vProd, 2, ",", ".");
630 630
         $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
631 631
         $this->pTextBox($xValor, $yTotal, $wColDir, $hLinha, $texto, $aFont, 'T', 'R', 0, '', false);
632
-        $yDesconto = $y + ($hLinha*2);
632
+        $yDesconto = $y + ($hLinha * 2);
633 633
         $texto = "Descontos";
634 634
         $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
635 635
         $this->pTextBox($x, $yDesconto, $wColEsq, $hLinha, $texto, $aFont, 'T', 'L', 0, '', false);
636 636
         $texto = "R$ " . $vDesc;
637 637
         $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
638 638
         $this->pTextBox($xValor, $yDesconto, $wColDir, $hLinha, $texto, $aFont, 'T', 'R', 0, '', false);
639
-        $yTotalFinal = $y + ($hLinha*3);
639
+        $yTotalFinal = $y + ($hLinha * 3);
640 640
         $texto = "Total";
641 641
         $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
642 642
         $this->pTextBox($x, $yTotalFinal, $wColEsq, $hLinha, $texto, $aFont, 'T', 'L', 0, '', false);
643 643
         $texto = "R$ " . $vNF;
644 644
         $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
645 645
         $this->pTextBox($xValor, $yTotalFinal, $wColDir, $hLinha, $texto, $aFont, 'T', 'R', 0, '', false);
646
-        $yTotalFinal = $y + ($hLinha*4);
646
+        $yTotalFinal = $y + ($hLinha * 4);
647 647
         $texto = "Informação dos Tributos Totais Incidentes";
648 648
         $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'');
649 649
         $this->pTextBox($x, $yTotalFinal, $wColEsq, $hLinha, $texto, $aFont, 'T', 'L', 0, '', false);
@@ -658,16 +658,16 @@  discard block
 block discarded – undo
658 658
         $margemInterna = $this->margemInterna;
659 659
         $maxW = $this->wPrint;
660 660
         $qtdPgto = $this->pag->length;
661
-        $w = ($maxW*1);
661
+        $w = ($maxW * 1);
662 662
         $hLinha = $this->hLinha;
663
-        $wColEsq = ($maxW*0.7);
664
-        $wColDir = ($maxW*0.3);
663
+        $wColEsq = ($maxW * 0.7);
664
+        $wColDir = ($maxW * 0.3);
665 665
         $xValor = $x + $wColEsq;
666 666
         $aFontPgto = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
667
-        $wBoxEsq = $w*0.7;
667
+        $wBoxEsq = $w * 0.7;
668 668
         $texto = "FORMA DE PAGAMENTO";
669 669
         $this->pTextBox($x, $y, $wBoxEsq, $hLinha, $texto, $aFontPgto, 'T', 'L', 0, '', false);
670
-        $wBoxDir = $w*0.3;
670
+        $wBoxDir = $w * 0.3;
671 671
         $xBoxDescricao = $x + $wBoxEsq;
672 672
         $texto = "VALOR PAGO";
673 673
         $this->pTextBox($xBoxDescricao, $y, $wBoxDir, $hLinha, $texto, $aFontPgto, 'T', 'R', 0, '', false);
@@ -689,7 +689,7 @@  discard block
 block discarded – undo
689 689
                     $tBandNome = self::getCardName($tBand);
690 690
                 }
691 691
                 //COLOCA PRODUTO
692
-                $yBoxProd = $y + $hLinha + ($cont*$hLinha);
692
+                $yBoxProd = $y + $hLinha + ($cont * $hLinha);
693 693
                 //COLOCA PRODUTO CÓDIGO
694 694
                 $texto = $tPagNome;
695 695
                 $this->pTextBox($x, $yBoxProd, $wBoxEsq, $hLinha, $texto, $aFontPgto, 'T', 'L', 0, '', false);
@@ -719,7 +719,7 @@  discard block
 block discarded – undo
719 719
         $y += 4;
720 720
         $margemInterna = $this->margemInterna;
721 721
         $maxW = $this->wPrint;
722
-        $w = ($maxW*1);
722
+        $w = ($maxW * 1);
723 723
         $hLinha = $this->hLinha;
724 724
         $aFontTit = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B');
725 725
         $aFontTex = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'');
@@ -733,18 +733,18 @@  discard block
 block discarded – undo
733 733
         $urlChave = $this->urlConsulta[$tpAmb][$this->UFSigla[$cUF]];
734 734
         $texto = "ÁREA DE MENSAGEM FISCAL";
735 735
         $this->pTextBox($x, $y, $w, $hLinha, $texto, $aFontTit, 'C', 'C', 0, '', false);
736
-        $yTex1 = $y + ($hLinha*1);
737
-        $hTex1 = $hLinha*2;
738
-        $texto = "Número " . $nNF . " Série " . $serieNF . " " .$dhEmi . " - Via Consumidor";
736
+        $yTex1 = $y + ($hLinha * 1);
737
+        $hTex1 = $hLinha * 2;
738
+        $texto = "Número " . $nNF . " Série " . $serieNF . " " . $dhEmi . " - Via Consumidor";
739 739
         $this->pTextBox($x, $yTex1, $w, $hTex1, $texto, $aFontTex, 'C', 'C', 0, '', false);
740
-        $yTex2 = $y + ($hLinha*3);
741
-        $hTex2 = $hLinha*2;
740
+        $yTex2 = $y + ($hLinha * 3);
741
+        $hTex2 = $hLinha * 2;
742 742
         $texto = "Consulte pela Chave de Acesso em " . $urlChave;
743 743
         $this->pTextBox($x, $yTex2, $w, $hTex2, $texto, $aFontTex, 'C', 'C', 0, '', false);
744 744
         $texto = "CHAVE DE ACESSO";
745
-        $yTit2 = $y + ($hLinha*5);
745
+        $yTit2 = $y + ($hLinha * 5);
746 746
         $this->pTextBox($x, $yTit2, $w, $hLinha, $texto, $aFontTit, 'C', 'C', 0, '', false);
747
-        $yTex3 = $y + ($hLinha*6);
747
+        $yTex3 = $y + ($hLinha * 6);
748 748
         $texto = $chNFe;
749 749
         $this->pTextBox($x, $yTex3, $w, $hLinha, $texto, $aFontTex, 'C', 'C', 0, '', false);
750 750
     }
@@ -754,7 +754,7 @@  discard block
 block discarded – undo
754 754
         $y += 4;
755 755
         $margemInterna = $this->margemInterna;
756 756
         $maxW = $this->wPrint;
757
-        $w = ($maxW*1);
757
+        $w = ($maxW * 1);
758 758
         $hLinha = $this->hLinha;
759 759
         $aFontTit = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B');
760 760
         $aFontTex = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'');
@@ -770,7 +770,7 @@  discard block
 block discarded – undo
770 770
             $consCNPJ = !empty($this->dest->getElementsByTagName("CNPJ")->item(0)->nodeValue)
771 771
                     ? $this->dest->getElementsByTagName("CNPJ")->item(0)->nodeValue
772 772
                     : '';
773
-            $cDest = $consCPF.$consCNPJ.$considEstrangeiro; //documentos do consumidor
773
+            $cDest = $consCPF . $consCNPJ . $considEstrangeiro; //documentos do consumidor
774 774
             $enderDest = $this->dest->getElementsByTagName("enderDest")->item(0);
775 775
             $consNome = $this->pSimpleGetValue($this->dest, "xNome");
776 776
             $consLgr = $this->pSimpleGetValue($enderDest, "xLgr");
@@ -810,8 +810,8 @@  discard block
 block discarded – undo
810 810
             $yTex1 = $y + $hLinha;
811 811
             $texto = $consNome;
812 812
             if (!empty($consDoc)) {
813
-                $texto .= " - ". $consDoc . "\n" . $consEnd;
814
-                $this->pTextBox($x, $yTex1, $w, $hLinha*3, $texto, $aFontTex, 'C', 'C', 0, '', false);
813
+                $texto .= " - " . $consDoc . "\n" . $consEnd;
814
+                $this->pTextBox($x, $yTex1, $w, $hLinha * 3, $texto, $aFontTex, 'C', 'C', 0, '', false);
815 815
             }
816 816
         } else {
817 817
             $yTex1 = $y + $hLinha;
@@ -825,7 +825,7 @@  discard block
 block discarded – undo
825 825
         $y += 4;
826 826
         $margemInterna = $this->margemInterna;
827 827
         $maxW = $this->wPrint;
828
-        $w = ($maxW*1);
828
+        $w = ($maxW * 1);
829 829
         $hLinha = $this->hLinha;
830 830
         $hBoxLinha = $this->hBoxLinha;
831 831
         $aFontTit = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B');
@@ -834,19 +834,19 @@  discard block
 block discarded – undo
834 834
         $nProt = '';
835 835
         if (isset($this->nfeProc)) {
836 836
             $nProt = $this->pSimpleGetValue($this->nfeProc, "nProt");
837
-            $dhRecbto  = $this->pSimpleGetValue($this->nfeProc, "dhRecbto");
837
+            $dhRecbto = $this->pSimpleGetValue($this->nfeProc, "dhRecbto");
838 838
         }
839 839
         $qrcode = new QRcode($this->qrCode, 'M');
840 840
         $wQr = 50;
841 841
         $hQr = 50;
842
-        $yQr = ($y+$margemInterna);
843
-        $xQr = ($w/2) - ($wQr/2);
842
+        $yQr = ($y + $margemInterna);
843
+        $xQr = ($w / 2) - ($wQr / 2);
844 844
         // prepare a base64 encoded "data url"
845 845
         $pic = 'data://text/plain;base64,' . base64_encode($qrcode->writeString());
846 846
         $info = getimagesize($pic);
847 847
         $this->pdf->image($pic, $xQr, $yQr, $wQr, $hQr, 'PNG');
848 848
         $dt = new DateTime($dhRecbto);
849
-        $yQr = ($yQr+$hQr+$margemInterna);
849
+        $yQr = ($yQr + $hQr + $margemInterna);
850 850
         $this->pTextBox($x, $yQr, $w, $hBoxLinha, "Protocolo de Autorização: " . $nProt . "\n"
851 851
             . $dt->format('d/m/Y H:i:s'), $aFontTex, 'C', 'C', 0, '', false);
852 852
     }
@@ -931,7 +931,7 @@  discard block
 block discarded – undo
931 931
         if ($startPos === false) {
932 932
             return $cdata;
933 933
         }
934
-        for ($x=$len; $x>0; $x--) {
934
+        for ($x = $len; $x > 0; $x--) {
935 935
             if (substr($cdata, $x, 1) == '>') {
936 936
                 $endPos = $x;
937 937
                 break;
@@ -942,15 +942,15 @@  discard block
 block discarded – undo
942 942
         } else {
943 943
             $parte1 = '';
944 944
         }
945
-        $parte2 = substr($cdata, $startPos, $endPos-$startPos+1);
945
+        $parte2 = substr($cdata, $startPos, $endPos - $startPos + 1);
946 946
         if ($endPos < $len) {
947 947
             $parte3 = substr($cdata, $endPos + 1, $len - $endPos - 1);
948 948
         } else {
949 949
             $parte3 = '';
950 950
         }
951
-        $texto = trim($parte1).' '.trim($parte3);
951
+        $texto = trim($parte1) . ' ' . trim($parte3);
952 952
         if (strpos($parte2, '<CDATA>') === false) {
953
-            $cdata = '<CDATA>'.$parte2.'</CDATA>';
953
+            $cdata = '<CDATA>' . $parte2 . '</CDATA>';
954 954
         } else {
955 955
             $cdata = $parte2;
956 956
         }
@@ -1022,15 +1022,15 @@  discard block
 block discarded – undo
1022 1022
         //grupo CADATA infCpl
1023 1023
         $t = $dom->getElementsByTagName('transmissor')->item(0);
1024 1024
         $r = $dom->getElementsByTagName('receptor')->item(0);
1025
-        $versao = ! empty($dom->getElementsByTagName('versao')->item(0)->nodeValue) ?
1026
-        'Versao:'.$dom->getElementsByTagName('versao')->item(0)->nodeValue.' ' : '';
1027
-        $especieNF = ! empty($dom->getElementsByTagName('especieNF')->item(0)->nodeValue) ?
1028
-        'Especie:'.$dom->getElementsByTagName('especieNF')->item(0)->nodeValue.' ' : '';
1029
-        $fabEntrega = ! empty($dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue) ?
1030
-        'Entrega:'.$dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue.' ' : '';
1031
-        $dca = ! empty($dom->getElementsByTagName('dca')->item(0)->nodeValue) ?
1032
-        'dca:'.$dom->getElementsByTagName('dca')->item(0)->nodeValue.' ' : '';
1033
-        $texto .= "".$versao.$especieNF.$fabEntrega.$dca;
1025
+        $versao = !empty($dom->getElementsByTagName('versao')->item(0)->nodeValue) ?
1026
+        'Versao:' . $dom->getElementsByTagName('versao')->item(0)->nodeValue . ' ' : '';
1027
+        $especieNF = !empty($dom->getElementsByTagName('especieNF')->item(0)->nodeValue) ?
1028
+        'Especie:' . $dom->getElementsByTagName('especieNF')->item(0)->nodeValue . ' ' : '';
1029
+        $fabEntrega = !empty($dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue) ?
1030
+        'Entrega:' . $dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue . ' ' : '';
1031
+        $dca = !empty($dom->getElementsByTagName('dca')->item(0)->nodeValue) ?
1032
+        'dca:' . $dom->getElementsByTagName('dca')->item(0)->nodeValue . ' ' : '';
1033
+        $texto .= "" . $versao . $especieNF . $fabEntrega . $dca;
1034 1034
         if (isset($t)) {
1035 1035
             if ($t->hasAttributes()) {
1036 1036
                 $texto .= " Transmissor ";
@@ -1147,7 +1147,7 @@  discard block
 block discarded – undo
1147 1147
         $bin = "";
1148 1148
         $iCount = 0;
1149 1149
         do {
1150
-            $bin .= chr(hexdec($str{$iCount}.$str{($iCount + 1)}));
1150
+            $bin .= chr(hexdec($str{$iCount} . $str{($iCount + 1)}));
1151 1151
             $iCount += 2;
1152 1152
         } while ($iCount < strlen($str));
1153 1153
         return $bin;
@@ -1181,12 +1181,12 @@  discard block
 block discarded – undo
1181 1181
         $seq .= '&digVal=' . strtolower($digHex);
1182 1182
         $seq .= '&cIdToken=' . $idToken;
1183 1183
         //o hash code é calculado com o Token incluso
1184
-        $hash = sha1($seq.$token);
1185
-        $seq .= '&cHashQRCode='. strtoupper($hash);
1184
+        $hash = sha1($seq . $token);
1185
+        $seq .= '&cHashQRCode=' . strtoupper($hash);
1186 1186
         if (strpos($url, '?') === false) {
1187
-            $seq = $url.'?'.$seq;
1187
+            $seq = $url . '?' . $seq;
1188 1188
         } else {
1189
-            $seq = $url.''.$seq;
1189
+            $seq = $url . '' . $seq;
1190 1190
         }
1191 1191
         return $seq;
1192 1192
     }
Please login to merge, or discard this patch.