Completed
Push — master ( a9e3b8...b5002a )
by Roberto
13:10 queued 02:27
created
src/NFe/Danfce.php 1 patch
Spacing   +89 added lines, -89 removed lines patch added patch discarded remove patch
@@ -24,11 +24,11 @@  discard block
 block discarded – undo
24 24
 {
25 25
     protected $papel;
26 26
     protected $xml; // string XML NFe
27
-    protected $logomarca=''; // path para logomarca em jpg
28
-    protected $formatoChave="#### #### #### #### #### #### #### #### #### #### ####";
29
-    protected $debugMode=0; //ativa ou desativa o modo de debug
27
+    protected $logomarca = ''; // path para logomarca em jpg
28
+    protected $formatoChave = "#### #### #### #### #### #### #### #### #### #### ####";
29
+    protected $debugMode = 0; //ativa ou desativa o modo de debug
30 30
     protected $tpImp; //ambiente
31
-    protected $fontePadrao='Times';
31
+    protected $fontePadrao = 'Times';
32 32
     protected $nfeProc;
33 33
     protected $nfe;
34 34
     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
                 $this->textoAdic = str_replace(";", "\n", $this->textoAdic);
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
             $orientacao = 'P';
283 283
         }
284 284
         $this->orientacao = $orientacao;
285
-        $this->papel = array(80,$tamPapelVert);
285
+        $this->papel = array(80, $tamPapelVert);
286 286
         $this->logoAlign = $logoAlign;
287 287
         //$this->situacao_externa = $situacaoExterna;
288 288
         $this->numero_registro_dpec = $depecNumReg;
@@ -306,10 +306,10 @@  discard block
 block discarded – undo
306 306
         //total inicial de paginas
307 307
         $totPag = 1;
308 308
         //largura imprimivel em mm: largura da folha menos as margens esq/direita
309
-        $this->wPrint = $maxW-($margEsq*2);
309
+        $this->wPrint = $maxW - ($margEsq * 2);
310 310
         //comprimento (altura) imprimivel em mm: altura da folha menos as margens
311 311
         //superior e inferior
312
-        $this->hPrint = $maxH-$margSup-$margInf;
312
+        $this->hPrint = $maxH - $margSup - $margInf;
313 313
         // estabelece contagem de paginas
314 314
         $this->pdf->aliasNbPages();
315 315
         $this->pdf->setMargins($margEsq, $margSup); // fixa as margens
@@ -320,25 +320,25 @@  discard block
 block discarded – undo
320 320
         $this->pdf->setLineWidth(0.1); // define a largura da linha
321 321
         $this->pdf->setTextColor(0, 0, 0);
322 322
         $this->pTextBox(0, 0, $maxW, $maxH); // POR QUE PRECISO DESA LINHA?
323
-        $hcabecalho = 27;//para cabeçalho (dados emitente mais logomarca)  (FIXO)
324
-        $hcabecalhoSecundario = 10;//para cabeçalho secundário (cabeçalho sefaz) (FIXO)
325
-        $hprodutos = $hLinha + ($qtdItens*$hMaxLinha) ;//box poduto
323
+        $hcabecalho = 27; //para cabeçalho (dados emitente mais logomarca)  (FIXO)
324
+        $hcabecalhoSecundario = 10; //para cabeçalho secundário (cabeçalho sefaz) (FIXO)
325
+        $hprodutos = $hLinha + ($qtdItens * $hMaxLinha); //box poduto
326 326
         $hTotal = 12; //box total (FIXO)
327
-        $hpagamentos = $hLinha + ($qtdPgto*$hLinha);//para pagamentos
327
+        $hpagamentos = $hLinha + ($qtdPgto * $hLinha); //para pagamentos
328 328
         if (!empty($this->vTroco)) {
329 329
             $hpagamentos += $hLinha;
330 330
         }
331
-        $hmsgfiscal = 21;// para imposto (FIXO)
331
+        $hmsgfiscal = 21; // para imposto (FIXO)
332 332
         if (!isset($this->dest)) {
333
-            $hcliente = 6;// para cliente (FIXO)
333
+            $hcliente = 6; // para cliente (FIXO)
334 334
         } else {
335 335
             $hcliente = 12;
336 336
         }// para cliente (FIXO)};
337
-        $hQRCode = 50;// para qrcode (FIXO)
338
-        $hCabecItens = 4;//cabeçalho dos itens
337
+        $hQRCode = 50; // para qrcode (FIXO)
338
+        $hCabecItens = 4; //cabeçalho dos itens
339 339
         
340 340
         $hUsado = $hCabecItens;
341
-        $w2 = round($this->wPrint*0.31, 0);
341
+        $w2 = round($this->wPrint * 0.31, 0);
342 342
         $totPag = 1;
343 343
         $pag = 1;
344 344
         $x = $xInic;
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
         $y = $xInic + $hcabecalho + $hcabecalhoSecundario + $hprodutos + $hTotal;
359 359
         $y = $this->pPagamentosDANFE($x, $y, $hpagamentos);
360 360
         //COLOCA MENSAGEM FISCAL
361
-        $y = $xInic + $hcabecalho + $hcabecalhoSecundario + $hprodutos + $hTotal+ $hpagamentos;
361
+        $y = $xInic + $hcabecalho + $hcabecalhoSecundario + $hprodutos + $hTotal + $hpagamentos;
362 362
         $y = $this->pFiscalDANFE($x, $y, $hmsgfiscal);
363 363
         //COLOCA CONSUMIDOR
364 364
         $y = $xInic + $hcabecalho + $hcabecalhoSecundario + $hprodutos + $hTotal + $hpagamentos + $hmsgfiscal;
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
         }
378 378
         
379 379
         //retorna o ID na NFe
380
-        if ($classPdf!==false) {
380
+        if ($classPdf !== false) {
381 381
             $aR = [
382 382
              'id'=>str_replace('NFe', '', $this->infNFe->getAttribute("Id")),
383 383
              'classe_PDF'=>$this->pdf
@@ -397,14 +397,14 @@  discard block
 block discarded – undo
397 397
         $emitIM     = $this->pSimpleGetValue($this->emit, "IM");
398 398
         $emitFone = $this->pSimpleGetValue($this->enderEmit, "fone");
399 399
         $foneLen = strlen($emitFone);
400
-        if ($foneLen>0) {
400
+        if ($foneLen > 0) {
401 401
             $ddd = substr($emitFone, 0, 2);
402 402
             $fone1 = substr($emitFone, -8);
403 403
             $digito9 = ' ';
404 404
             if ($foneLen == 11) {
405 405
                 $digito9 = substr($emitFone, 2, 1);
406 406
             }
407
-            $emitFone = ' - ('.$ddd.') '.$digito9. ' ' . substr($fone1, 0, 4) . '-' . substr($fone1, -4);
407
+            $emitFone = ' - (' . $ddd . ') ' . $digito9 . ' ' . substr($fone1, 0, 4) . '-' . substr($fone1, -4);
408 408
         } else {
409 409
             $emitFone = '';
410 410
         }
@@ -418,18 +418,18 @@  discard block
 block discarded – undo
418 418
         // CONFIGURAÇÃO DE POSIÇÃO
419 419
         $margemInterna = $this->margemInterna;
420 420
         $maxW = $this->wPrint;
421
-        $h = $h-($margemInterna);
421
+        $h = $h - ($margemInterna);
422 422
         //COLOCA LOGOMARCA
423 423
         if (is_file($this->logomarca)) {
424 424
             $xImg = $margemInterna;
425 425
             $yImg = $margemInterna + 1;
426 426
             $this->pdf->Image($this->logomarca, $xImg, $yImg, 30, 22.5);
427
-            $xRs = ($maxW*0.4) + $margemInterna;
428
-            $wRs = ($maxW*0.6);
427
+            $xRs = ($maxW * 0.4) + $margemInterna;
428
+            $wRs = ($maxW * 0.6);
429 429
             $alignEmit = 'L';
430 430
         } else {
431 431
             $xRs = $margemInterna;
432
-            $wRs = ($maxW*1);
432
+            $wRs = ($maxW * 1);
433 433
             $alignEmit = 'L';
434 434
         }
435 435
         //COLOCA RAZÃO SOCIAL
@@ -449,7 +449,7 @@  discard block
 block discarded – undo
449 449
     {
450 450
         $margemInterna = $this->margemInterna;
451 451
         $maxW = $this->wPrint;
452
-        $w = ($maxW*1);
452
+        $w = ($maxW * 1);
453 453
         $hBox1 = 7;
454 454
         $texto = "DANFE NFC-e\nDocumento Auxiliar da Nota Fiscal de Consumidor Eletrônica";
455 455
         $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B');
@@ -466,13 +466,13 @@  discard block
 block discarded – undo
466 466
         $margemInterna = $this->margemInterna;
467 467
         $maxW = $this->wPrint;
468 468
         $qtdItens = $this->det->length;
469
-        $w = ($maxW*1);
469
+        $w = ($maxW * 1);
470 470
         $hLinha = $this->hLinha;
471 471
         $aFontCabProdutos = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
472
-        $wBoxCod = $w*0.17;
472
+        $wBoxCod = $w * 0.17;
473 473
         $texto = "CÓDIGO";
474 474
         $this->pTextBox($x, $y, $wBoxCod, $hLinha, $texto, $aFontCabProdutos, 'T', 'L', 0, '', false);
475
-        $wBoxDescricao = $w*0.43;
475
+        $wBoxDescricao = $w * 0.43;
476 476
         $xBoxDescricao = $wBoxCod + $x;
477 477
         $texto = "DESCRICÃO";
478 478
         $this->pTextBox(
@@ -488,19 +488,19 @@  discard block
 block discarded – undo
488 488
             '',
489 489
             false
490 490
         );
491
-        $wBoxQt = $w*0.08;
491
+        $wBoxQt = $w * 0.08;
492 492
         $xBoxQt = $wBoxDescricao + $xBoxDescricao;
493 493
         $texto = "QT";
494 494
         $this->pTextBox($xBoxQt, $y, $wBoxQt, $hLinha, $texto, $aFontCabProdutos, 'T', 'L', 0, '', false);
495
-        $wBoxUn = $w*0.06;
495
+        $wBoxUn = $w * 0.06;
496 496
         $xBoxUn = $wBoxQt + $xBoxQt;
497 497
         $texto = "UN";
498 498
         $this->pTextBox($xBoxUn, $y, $wBoxUn, $hLinha, $texto, $aFontCabProdutos, 'T', 'L', 0, '', false);
499
-        $wBoxVl = $w*0.13;
499
+        $wBoxVl = $w * 0.13;
500 500
         $xBoxVl = $wBoxUn + $xBoxUn;
501 501
         $texto = "VALOR";
502 502
         $this->pTextBox($xBoxVl, $y, $wBoxVl, $hLinha, $texto, $aFontCabProdutos, 'T', 'L', 0, '', false);
503
-        $wBoxTotal = $w*0.13;
503
+        $wBoxTotal = $w * 0.13;
504 504
         $xBoxTotal = $wBoxVl + $xBoxVl;
505 505
         $texto = "TOTAL";
506 506
         $this->pTextBox($xBoxTotal, $y, $wBoxTotal, $hLinha, $texto, $aFontCabProdutos, 'T', 'L', 0, '', false);
@@ -520,13 +520,13 @@  discard block
 block discarded – undo
520 520
                 $vUnCom     = number_format($this->pSimpleGetValue($prod, "vUnCom"), 2, ",", ".");
521 521
                 $vProd      = number_format($this->pSimpleGetValue($prod, "vProd"), 2, ",", ".");
522 522
                 //COLOCA PRODUTO
523
-                $yBoxProd = $y + $hLinha + ($cont*$hMaxLinha);
523
+                $yBoxProd = $y + $hLinha + ($cont * $hMaxLinha);
524 524
                 //COLOCA PRODUTO CÓDIGO
525
-                $wBoxCod = $w*0.17;
525
+                $wBoxCod = $w * 0.17;
526 526
                 $texto = $cProd;
527 527
                 $this->pTextBox($x, $yBoxProd, $wBoxCod, $hMaxLinha, $texto, $aFontProdutos, 'C', 'C', 0, '', false);
528 528
                 //COLOCA PRODUTO DESCRIÇÃO
529
-                $wBoxDescricao = $w*0.43;
529
+                $wBoxDescricao = $w * 0.43;
530 530
                 $xBoxDescricao = $wBoxCod + $x;
531 531
                 $texto = $xProd;
532 532
                 $this->pTextBox(
@@ -543,7 +543,7 @@  discard block
 block discarded – undo
543 543
                     false
544 544
                 );
545 545
                 //COLOCA PRODUTO QUANTIDADE
546
-                $wBoxQt = $w*0.08;
546
+                $wBoxQt = $w * 0.08;
547 547
                 $xBoxQt = $wBoxDescricao + $xBoxDescricao;
548 548
                 $texto = $qCom;
549 549
                 $this->pTextBox(
@@ -560,7 +560,7 @@  discard block
 block discarded – undo
560 560
                     false
561 561
                 );
562 562
                 //COLOCA PRODUTO UNIDADE
563
-                $wBoxUn = $w*0.06;
563
+                $wBoxUn = $w * 0.06;
564 564
                 $xBoxUn = $wBoxQt + $xBoxQt;
565 565
                 $texto = $uCom;
566 566
                 $this->pTextBox(
@@ -577,7 +577,7 @@  discard block
 block discarded – undo
577 577
                     false
578 578
                 );
579 579
                 //COLOCA PRODUTO VL UNITÁRIO
580
-                $wBoxVl = $w*0.13;
580
+                $wBoxVl = $w * 0.13;
581 581
                 $xBoxVl = $wBoxUn + $xBoxUn;
582 582
                 $texto = $vUnCom;
583 583
                 $this->pTextBox(
@@ -594,7 +594,7 @@  discard block
 block discarded – undo
594 594
                     false
595 595
                 );
596 596
                 //COLOCA PRODUTO VL TOTAL
597
-                $wBoxTotal = $w*0.13;
597
+                $wBoxTotal = $w * 0.13;
598 598
                 $xBoxTotal = $wBoxVl + $xBoxVl;
599 599
                 $texto = $vProd;
600 600
                 $this->pTextBox(
@@ -621,8 +621,8 @@  discard block
 block discarded – undo
621 621
         $margemInterna = $this->margemInterna;
622 622
         $maxW = $this->wPrint;
623 623
         $hLinha = 3;
624
-        $wColEsq = ($maxW*0.7);
625
-        $wColDir = ($maxW*0.3);
624
+        $wColEsq = ($maxW * 0.7);
625
+        $wColDir = ($maxW * 0.3);
626 626
         $xValor = $x + $wColEsq;
627 627
         $qtdItens = $this->det->length;
628 628
         $vProd = $this->pSimpleGetValue($this->ICMSTot, "vProd");
@@ -643,28 +643,28 @@  discard block
 block discarded – undo
643 643
         $texto = "R$ " . number_format($vProd, 2, ",", ".");
644 644
         $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
645 645
         $this->pTextBox($xValor, $yTotal, $wColDir, $hLinha, $texto, $aFont, 'T', 'R', 0, '', false);
646
-        $yDesconto = $y + ($hLinha*2);
646
+        $yDesconto = $y + ($hLinha * 2);
647 647
         $texto = "Descontos";
648 648
         $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
649 649
         $this->pTextBox($x, $yDesconto, $wColEsq, $hLinha, $texto, $aFont, 'T', 'L', 0, '', false);
650 650
         $texto = "R$ " . $vDesc;
651 651
         $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
652 652
         $this->pTextBox($xValor, $yDesconto, $wColDir, $hLinha, $texto, $aFont, 'T', 'R', 0, '', false);
653
-        $yFrete= $y + ($hLinha*3);
653
+        $yFrete = $y + ($hLinha * 3);
654 654
         $texto = "Frete";
655 655
         $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
656 656
         $this->pTextBox($x, $yFrete, $wColEsq, $hLinha, $texto, $aFont, 'T', 'L', 0, '', false);
657 657
         $texto = "R$ " . $vFrete;
658 658
         $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
659 659
         $this->pTextBox($xValor, $yFrete, $wColDir, $hLinha, $texto, $aFont, 'T', 'R', 0, '', false);
660
-        $yTotalFinal = $y + ($hLinha*4);
660
+        $yTotalFinal = $y + ($hLinha * 4);
661 661
         $texto = "Total";
662 662
         $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
663 663
         $this->pTextBox($x, $yTotalFinal, $wColEsq, $hLinha, $texto, $aFont, 'T', 'L', 0, '', false);
664 664
         $texto = "R$ " . $vNF;
665 665
         $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
666 666
         $this->pTextBox($xValor, $yTotalFinal, $wColDir, $hLinha, $texto, $aFont, 'T', 'R', 0, '', false);
667
-        $yTotalFinal = $y + ($hLinha*5);
667
+        $yTotalFinal = $y + ($hLinha * 5);
668 668
         $texto = "Informação dos Tributos Totais Incidentes";
669 669
         $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'');
670 670
         $this->pTextBox($x, $yTotalFinal, $wColEsq, $hLinha, $texto, $aFont, 'T', 'L', 0, '', false);
@@ -679,16 +679,16 @@  discard block
 block discarded – undo
679 679
         $margemInterna = $this->margemInterna;
680 680
         $maxW = $this->wPrint;
681 681
         $qtdPgto = $this->pag->length;
682
-        $w = ($maxW*1);
682
+        $w = ($maxW * 1);
683 683
         $hLinha = $this->hLinha;
684
-        $wColEsq = ($maxW*0.7);
685
-        $wColDir = ($maxW*0.3);
684
+        $wColEsq = ($maxW * 0.7);
685
+        $wColDir = ($maxW * 0.3);
686 686
         $xValor = $x + $wColEsq;
687 687
         $aFontPgto = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
688
-        $wBoxEsq = $w*0.7;
688
+        $wBoxEsq = $w * 0.7;
689 689
         $texto = "FORMA DE PAGAMENTO";
690 690
         $this->pTextBox($x, $y, $wBoxEsq, $hLinha, $texto, $aFontPgto, 'T', 'L', 0, '', false);
691
-        $wBoxDir = $w*0.3;
691
+        $wBoxDir = $w * 0.3;
692 692
         $xBoxDescricao = $x + $wBoxEsq;
693 693
         $texto = "VALOR PAGO";
694 694
         $this->pTextBox($xBoxDescricao, $y, $wBoxDir, $hLinha, $texto, $aFontPgto, 'T', 'R', 0, '', false);
@@ -710,7 +710,7 @@  discard block
 block discarded – undo
710 710
                     $tBandNome = self::getCardName($tBand);
711 711
                 }
712 712
                 //COLOCA PRODUTO
713
-                $yBoxProd = $y + $hLinha + ($cont*$hLinha);
713
+                $yBoxProd = $y + $hLinha + ($cont * $hLinha);
714 714
                 //COLOCA PRODUTO CÓDIGO
715 715
                 $texto = $tPagNome;
716 716
                 $this->pTextBox($x, $yBoxProd, $wBoxEsq, $hLinha, $texto, $aFontPgto, 'T', 'L', 0, '', false);
@@ -734,7 +734,7 @@  discard block
 block discarded – undo
734 734
             }
735 735
             
736 736
             if (!empty($this->vTroco)) {
737
-                $yBoxProd = $y + $hLinha + ($cont*$hLinha);
737
+                $yBoxProd = $y + $hLinha + ($cont * $hLinha);
738 738
                 //COLOCA PRODUTO CÓDIGO
739 739
                 $texto = 'Troco';
740 740
                 $this->pTextBox($x, $yBoxProd, $wBoxEsq, $hLinha, $texto, $aFontPgto, 'T', 'L', 0, '', false);
@@ -751,7 +751,7 @@  discard block
 block discarded – undo
751 751
         $y += 6;
752 752
         $margemInterna = $this->margemInterna;
753 753
         $maxW = $this->wPrint;
754
-        $w = ($maxW*1);
754
+        $w = ($maxW * 1);
755 755
         $hLinha = $this->hLinha;
756 756
         $aFontTit = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B');
757 757
         $aFontTex = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'');
@@ -782,18 +782,18 @@  discard block
 block discarded – undo
782 782
         $urlChave = $this->urlConsulta[$tpAmb][$this->UFSigla[$cUF]];
783 783
         $texto = "ÁREA DE MENSAGEM FISCAL";
784 784
         $this->pTextBox($x, $y, $w, $hLinha, $texto, $aFontTit, 'C', 'C', 0, '', false);
785
-        $yTex1 = $y + ($hLinha*1);
786
-        $hTex1 = $hLinha*2;
787
-        $texto = "Número " . $nNF . " Série " . $serieNF . " " .$dhEmi . " - Via Consumidor";
785
+        $yTex1 = $y + ($hLinha * 1);
786
+        $hTex1 = $hLinha * 2;
787
+        $texto = "Número " . $nNF . " Série " . $serieNF . " " . $dhEmi . " - Via Consumidor";
788 788
         $this->pTextBox($x, $yTex1, $w, $hTex1, $texto, $aFontTex, 'C', 'C', 0, '', false);
789
-        $yTex2 = $y + ($hLinha*3);
790
-        $hTex2 = $hLinha*2;
789
+        $yTex2 = $y + ($hLinha * 3);
790
+        $hTex2 = $hLinha * 2;
791 791
         $texto = "Consulte pela Chave de Acesso em " . $urlChave;
792 792
         $this->pTextBox($x, $yTex2, $w, $hTex2, $texto, $aFontTex, 'C', 'C', 0, '', false);
793 793
         $texto = "CHAVE DE ACESSO";
794
-        $yTit2 = $y + ($hLinha*5);
794
+        $yTit2 = $y + ($hLinha * 5);
795 795
         $this->pTextBox($x, $yTit2, $w, $hLinha, $texto, $aFontTit, 'C', 'C', 0, '', false);
796
-        $yTex3 = $y + ($hLinha*6);
796
+        $yTex3 = $y + ($hLinha * 6);
797 797
         $texto = $chNFe;
798 798
         $this->pTextBox($x, $yTex3, $w, $hLinha, $texto, $aFontTex, 'C', 'C', 0, '', false);
799 799
     }
@@ -803,7 +803,7 @@  discard block
 block discarded – undo
803 803
         $y += 6;
804 804
         $margemInterna = $this->margemInterna;
805 805
         $maxW = $this->wPrint;
806
-        $w = ($maxW*1);
806
+        $w = ($maxW * 1);
807 807
         $hLinha = $this->hLinha;
808 808
         $aFontTit = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B');
809 809
         $aFontTex = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'');
@@ -819,7 +819,7 @@  discard block
 block discarded – undo
819 819
             $consCNPJ = !empty($this->dest->getElementsByTagName("CNPJ")->item(0)->nodeValue)
820 820
                     ? $this->dest->getElementsByTagName("CNPJ")->item(0)->nodeValue
821 821
                     : '';
822
-            $cDest = $consCPF.$consCNPJ.$considEstrangeiro; //documentos do consumidor
822
+            $cDest = $consCPF . $consCNPJ . $considEstrangeiro; //documentos do consumidor
823 823
             $enderDest = $this->dest->getElementsByTagName("enderDest")->item(0);
824 824
             $consNome = $this->pSimpleGetValue($this->dest, "xNome");
825 825
             $consLgr = $this->pSimpleGetValue($enderDest, "xLgr");
@@ -859,8 +859,8 @@  discard block
 block discarded – undo
859 859
             $yTex1 = $y + $hLinha;
860 860
             $texto = $consNome;
861 861
             if (!empty($consDoc)) {
862
-                $texto .= " - ". $consDoc . "\n" . $consEnd;
863
-                $this->pTextBox($x, $yTex1, $w, $hLinha*3, $texto, $aFontTex, 'C', 'C', 0, '', false);
862
+                $texto .= " - " . $consDoc . "\n" . $consEnd;
863
+                $this->pTextBox($x, $yTex1, $w, $hLinha * 3, $texto, $aFontTex, 'C', 'C', 0, '', false);
864 864
             }
865 865
         } else {
866 866
             $yTex1 = $y + $hLinha;
@@ -874,7 +874,7 @@  discard block
 block discarded – undo
874 874
         $y += 6;
875 875
         $margemInterna = $this->margemInterna;
876 876
         $maxW = $this->wPrint;
877
-        $w = ($maxW*1);
877
+        $w = ($maxW * 1);
878 878
         $hLinha = $this->hLinha;
879 879
         $hBoxLinha = $this->hBoxLinha;
880 880
         $aFontTit = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B');
@@ -883,7 +883,7 @@  discard block
 block discarded – undo
883 883
         $nProt = '';
884 884
         if (isset($this->nfeProc)) {
885 885
             $nProt = $this->pSimpleGetValue($this->nfeProc, "nProt");
886
-            $dhRecbto  = $this->pSimpleGetValue($this->nfeProc, "dhRecbto");
886
+            $dhRecbto = $this->pSimpleGetValue($this->nfeProc, "dhRecbto");
887 887
         }
888 888
         $barcode = new Barcode();
889 889
         $bobj = $barcode->getBarcodeObj(
@@ -897,14 +897,14 @@  discard block
 block discarded – undo
897 897
         $qrcode = $bobj->getPngData();
898 898
         $wQr = 50;
899 899
         $hQr = 50;
900
-        $yQr = ($y+$margemInterna);
901
-        $xQr = ($w/2) - ($wQr/2);
900
+        $yQr = ($y + $margemInterna);
901
+        $xQr = ($w / 2) - ($wQr / 2);
902 902
         // prepare a base64 encoded "data url"
903 903
         $pic = 'data://text/plain;base64,' . base64_encode($qrcode);
904 904
         $info = getimagesize($pic);
905 905
         $this->pdf->image($pic, $xQr, $yQr, $wQr, $hQr, 'PNG');
906 906
         $dt = new DateTime($dhRecbto);
907
-        $yQr = ($yQr+$hQr+$margemInterna);
907
+        $yQr = ($yQr + $hQr + $margemInterna);
908 908
         $this->pTextBox($x, $yQr, $w, $hBoxLinha, "Protocolo de Autorização: " . $nProt . "\n"
909 909
             . $dt->format('d/m/Y H:i:s'), $aFontTex, 'C', 'C', 0, '', false);
910 910
     }
@@ -923,7 +923,7 @@  discard block
 block discarded – undo
923 923
         $heigthText = $this->pTextBox($x, $y, $w, $hLinha, $texto, $aFontTit, 'C', 'C', 0, '', false);
924 924
                 
925 925
         // seta o textbox do texto adicional
926
-        $this->pTextBox($x, $y+3, $w-2, $hLinha-3, $this->textoAdic, $aFontTex, 'T', 'L', 0, '', false);
926
+        $this->pTextBox($x, $y + 3, $w - 2, $hLinha - 3, $this->textoAdic, $aFontTex, 'T', 'L', 0, '', false);
927 927
     }
928 928
     
929 929
     /**
@@ -983,7 +983,7 @@  discard block
 block discarded – undo
983 983
         if ($startPos === false) {
984 984
             return $cdata;
985 985
         }
986
-        for ($x=$len; $x>0; $x--) {
986
+        for ($x = $len; $x > 0; $x--) {
987 987
             if (substr($cdata, $x, 1) == '>') {
988 988
                 $endPos = $x;
989 989
                 break;
@@ -994,15 +994,15 @@  discard block
 block discarded – undo
994 994
         } else {
995 995
             $parte1 = '';
996 996
         }
997
-        $parte2 = substr($cdata, $startPos, $endPos-$startPos+1);
997
+        $parte2 = substr($cdata, $startPos, $endPos - $startPos + 1);
998 998
         if ($endPos < $len) {
999 999
             $parte3 = substr($cdata, $endPos + 1, $len - $endPos - 1);
1000 1000
         } else {
1001 1001
             $parte3 = '';
1002 1002
         }
1003
-        $texto = trim($parte1).' '.trim($parte3);
1003
+        $texto = trim($parte1) . ' ' . trim($parte3);
1004 1004
         if (strpos($parte2, '<CDATA>') === false) {
1005
-            $cdata = '<CDATA>'.$parte2.'</CDATA>';
1005
+            $cdata = '<CDATA>' . $parte2 . '</CDATA>';
1006 1006
         } else {
1007 1007
             $cdata = $parte2;
1008 1008
         }
@@ -1074,15 +1074,15 @@  discard block
 block discarded – undo
1074 1074
         //grupo CADATA infCpl
1075 1075
         $t = $dom->getElementsByTagName('transmissor')->item(0);
1076 1076
         $r = $dom->getElementsByTagName('receptor')->item(0);
1077
-        $versao = ! empty($dom->getElementsByTagName('versao')->item(0)->nodeValue) ?
1078
-        'Versao:'.$dom->getElementsByTagName('versao')->item(0)->nodeValue.' ' : '';
1079
-        $especieNF = ! empty($dom->getElementsByTagName('especieNF')->item(0)->nodeValue) ?
1080
-        'Especie:'.$dom->getElementsByTagName('especieNF')->item(0)->nodeValue.' ' : '';
1081
-        $fabEntrega = ! empty($dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue) ?
1082
-        'Entrega:'.$dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue.' ' : '';
1083
-        $dca = ! empty($dom->getElementsByTagName('dca')->item(0)->nodeValue) ?
1084
-        'dca:'.$dom->getElementsByTagName('dca')->item(0)->nodeValue.' ' : '';
1085
-        $texto .= "".$versao.$especieNF.$fabEntrega.$dca;
1077
+        $versao = !empty($dom->getElementsByTagName('versao')->item(0)->nodeValue) ?
1078
+        'Versao:' . $dom->getElementsByTagName('versao')->item(0)->nodeValue . ' ' : '';
1079
+        $especieNF = !empty($dom->getElementsByTagName('especieNF')->item(0)->nodeValue) ?
1080
+        'Especie:' . $dom->getElementsByTagName('especieNF')->item(0)->nodeValue . ' ' : '';
1081
+        $fabEntrega = !empty($dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue) ?
1082
+        'Entrega:' . $dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue . ' ' : '';
1083
+        $dca = !empty($dom->getElementsByTagName('dca')->item(0)->nodeValue) ?
1084
+        'dca:' . $dom->getElementsByTagName('dca')->item(0)->nodeValue . ' ' : '';
1085
+        $texto .= "" . $versao . $especieNF . $fabEntrega . $dca;
1086 1086
         if (isset($t)) {
1087 1087
             if ($t->hasAttributes()) {
1088 1088
                 $texto .= " Transmissor ";
@@ -1163,7 +1163,7 @@  discard block
 block discarded – undo
1163 1163
         $bin = "";
1164 1164
         $iCount = 0;
1165 1165
         do {
1166
-            $bin .= chr(hexdec($str{$iCount}.$str{($iCount + 1)}));
1166
+            $bin .= chr(hexdec($str{$iCount} . $str{($iCount + 1)}));
1167 1167
             $iCount += 2;
1168 1168
         } while ($iCount < strlen($str));
1169 1169
         return $bin;
@@ -1197,12 +1197,12 @@  discard block
 block discarded – undo
1197 1197
         $seq .= '&digVal=' . strtolower($digHex);
1198 1198
         $seq .= '&cIdToken=' . $idToken;
1199 1199
         //o hash code é calculado com o Token incluso
1200
-        $hash = sha1($seq.$token);
1201
-        $seq .= '&cHashQRCode='. strtoupper($hash);
1200
+        $hash = sha1($seq . $token);
1201
+        $seq .= '&cHashQRCode=' . strtoupper($hash);
1202 1202
         if (strpos($url, '?') === false) {
1203
-            $seq = $url.'?'.$seq;
1203
+            $seq = $url . '?' . $seq;
1204 1204
         } else {
1205
-            $seq = $url.''.$seq;
1205
+            $seq = $url . '' . $seq;
1206 1206
         }
1207 1207
         return $seq;
1208 1208
     }
Please login to merge, or discard this patch.