Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
Complex classes like DacteV3 often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use DacteV3, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 23 | class DacteV3 extends Common |
||
| 24 | { |
||
| 25 | const NFEPHP_SITUACAO_EXTERNA_CANCELADA = 1; |
||
| 26 | const NFEPHP_SITUACAO_EXTERNA_DENEGADA = 2; |
||
| 27 | const SIT_DPEC = 3; |
||
| 28 | |||
| 29 | protected $logoAlign = 'C'; |
||
| 30 | protected $yDados = 0; |
||
| 31 | protected $situacao_externa = 0; |
||
| 32 | protected $numero_registro_dpec = ''; |
||
| 33 | protected $pdf; |
||
| 34 | protected $xml; |
||
| 35 | protected $logomarca = ''; |
||
| 36 | protected $errMsg = ''; |
||
| 37 | protected $errStatus = false; |
||
| 38 | protected $orientacao = 'P'; |
||
| 39 | protected $papel = 'A4'; |
||
| 40 | protected $destino = 'I'; |
||
| 41 | protected $pdfDir = ''; |
||
| 42 | protected $fontePadrao = 'Times'; |
||
| 43 | protected $version = '1.3.0'; |
||
| 44 | protected $wPrint; |
||
| 45 | protected $hPrint; |
||
| 46 | protected $dom; |
||
| 47 | protected $infCte; |
||
| 48 | protected $infCteComp; |
||
| 49 | protected $chaveCTeRef; |
||
| 50 | protected $tpCTe; |
||
| 51 | protected $ide; |
||
| 52 | protected $emit; |
||
| 53 | protected $enderEmit; |
||
| 54 | protected $rem; |
||
| 55 | protected $enderReme; |
||
| 56 | protected $dest; |
||
| 57 | protected $enderDest; |
||
| 58 | protected $exped; |
||
| 59 | protected $enderExped; |
||
| 60 | protected $receb; |
||
| 61 | protected $enderReceb; |
||
| 62 | protected $infCarga; |
||
| 63 | protected $infQ; |
||
| 64 | protected $seg; |
||
| 65 | protected $modal; |
||
| 66 | protected $rodo; |
||
| 67 | protected $moto; |
||
| 68 | protected $veic; |
||
| 69 | protected $ferrov; |
||
| 70 | protected $Comp; |
||
| 71 | protected $infNF; |
||
| 72 | protected $infNFe; |
||
| 73 | protected $compl; |
||
| 74 | protected $ICMS; |
||
| 75 | protected $imp; |
||
| 76 | protected $toma4; |
||
| 77 | protected $toma03; |
||
| 78 | protected $tpEmis; |
||
| 79 | protected $tpImp; |
||
| 80 | protected $tpAmb; |
||
| 81 | protected $vPrest; |
||
| 82 | protected $wAdic = 150; |
||
| 83 | protected $textoAdic = ''; |
||
| 84 | protected $debugMode = 2; |
||
| 85 | protected $formatPadrao; |
||
| 86 | protected $formatNegrito; |
||
| 87 | protected $aquav; |
||
| 88 | protected $preVisualizar; |
||
| 89 | protected $flagDocOrigContinuacao; |
||
| 90 | protected $arrayNFe = array(); |
||
| 91 | |||
| 92 | /** |
||
| 93 | * __construct |
||
| 94 | * |
||
| 95 | * @param string $docXML Arquivo XML da CTe |
||
| 96 | * @param string $sOrientacao (Opcional) Orientação da impressão P ou L |
||
| 97 | * @param string $sPapel Tamanho do papel (Ex. A4) |
||
| 98 | * @param string $sPathLogo Caminho para o arquivo do logo |
||
| 99 | * @param string $sDestino Estabelece a direção do envio do documento PDF |
||
| 100 | * @param string $sDirPDF Caminho para o diretorio de armaz. dos PDF |
||
| 101 | * @param string $fonteDACTE Nome da fonte a ser utilizada |
||
| 102 | * @param number $mododebug 0-Não 1-Sim e 2-nada (2 default) |
||
| 103 | * @param string $preVisualizar 0-Não 1-Sim |
||
| 104 | */ |
||
| 105 | public function __construct( |
||
| 250 | |||
| 251 | /** |
||
| 252 | * monta |
||
| 253 | * @param string $orientacao L ou P |
||
| 254 | * @param string $papel A4 |
||
| 255 | * @param string $logoAlign C, L ou R |
||
| 256 | * @param Pdf $classPDF |
||
| 257 | * @return string montagem |
||
| 258 | */ |
||
| 259 | public function monta( |
||
| 268 | |||
| 269 | /** |
||
| 270 | * printDocument |
||
| 271 | * @param string $nome |
||
| 272 | * @param string $destino |
||
| 273 | * @param string $printer |
||
| 274 | * @return |
||
| 275 | */ |
||
| 276 | public function printDocument($nome = '', $destino = 'I', $printer = '') |
||
| 280 | |||
| 281 | /** |
||
| 282 | * Dados brutos do PDF |
||
| 283 | * @return string |
||
| 284 | */ |
||
| 285 | public function render() |
||
| 289 | |||
| 290 | |||
| 291 | protected function zCteDPEC() |
||
| 295 | |||
| 296 | |||
| 297 | /** |
||
| 298 | * montaDACTE |
||
| 299 | * Esta função monta a DACTE conforme as informações fornecidas para a classe |
||
| 300 | * durante sua construção. |
||
| 301 | * A definição de margens e posições iniciais para a impressão são estabelecidas no |
||
| 302 | * pelo conteúdo da funçao e podem ser modificados. |
||
| 303 | * |
||
| 304 | * @param string $orientacao (Opcional) Estabelece a orientação da |
||
| 305 | * impressão (ex. P-retrato), se nada for fornecido será |
||
| 306 | * usado o padrão da NFe |
||
| 307 | * @param string $papel (Opcional) Estabelece o tamanho do papel (ex. A4) |
||
| 308 | * @return string O ID da NFe numero de 44 digitos extraido do arquivo XML |
||
| 309 | */ |
||
| 310 | View Code Duplication | public function montaDACTE( |
|
| 512 | |||
| 513 | /** |
||
| 514 | * printDACTE |
||
| 515 | * Esta função envia a DACTE em PDF criada para o dispositivo informado. |
||
| 516 | * O destino da impressão pode ser : |
||
| 517 | * I-browser |
||
| 518 | * D-browser com download |
||
| 519 | * F-salva em um arquivo local com o nome informado |
||
| 520 | * S-retorna o documento como uma string e o nome é ignorado. |
||
| 521 | * Para enviar o pdf diretamente para uma impressora indique o |
||
| 522 | * nome da impressora e o destino deve ser 'S'. |
||
| 523 | * |
||
| 524 | * @param string $nome Path completo com o nome do arquivo pdf |
||
| 525 | * @param string $destino Direção do envio do PDF |
||
| 526 | * @param string $printer Identificação da impressora no sistema |
||
| 527 | * @return string Caso o destino seja S o pdf é retornado como uma string |
||
| 528 | * @todo Rotina de impressão direta do arquivo pdf criado |
||
| 529 | */ |
||
| 530 | public function printDACTE($nome = '', $destino = 'I', $printer = '') |
||
| 538 | |||
| 539 | /** |
||
| 540 | * zCabecalho |
||
| 541 | * Monta o cabelhalho da DACTE ( retrato e paisagem ) |
||
| 542 | * |
||
| 543 | * @param number $x Posição horizontal inicial, canto esquerdo |
||
| 544 | * @param number $y Posição vertical inicial, canto superior |
||
| 545 | * @param number $pag Número da Página |
||
| 546 | * @param number $totPag Total de páginas |
||
| 547 | * @return number Posição vertical final |
||
| 548 | */ |
||
| 549 | protected function zCabecalho($x = 0, $y = 0, $pag = '1', $totPag = '1') |
||
| 550 | { |
||
| 551 | $oldX = $x; |
||
| 552 | $oldY = $y; |
||
| 553 | View Code Duplication | if ($this->orientacao == 'P') { |
|
| 554 | $maxW = $this->wPrint; |
||
| 555 | } else { |
||
| 556 | if ($pag == 1) { |
||
| 557 | // primeira página |
||
| 558 | $maxW = $this->wPrint - $this->wCanhoto; |
||
| 559 | } else { |
||
| 560 | // páginas seguintes |
||
| 561 | $maxW = $this->wPrint; |
||
| 562 | } |
||
| 563 | } |
||
| 564 | //################################################################## |
||
| 565 | //coluna esquerda identificação do emitente |
||
| 566 | $w = round($maxW * 0.42); |
||
| 567 | View Code Duplication | if ($this->orientacao == 'P') { |
|
| 568 | $aFont = array( |
||
| 569 | 'font' => $this->fontePadrao, |
||
| 570 | 'size' => 6, |
||
| 571 | 'style' => ''); |
||
| 572 | } else { |
||
| 573 | $aFont = $this->formatNegrito; |
||
| 574 | } |
||
| 575 | $w1 = $w; |
||
| 576 | $h = 35; |
||
| 577 | $oldY += $h; |
||
| 578 | //desenha a caixa |
||
| 579 | $this->pTextBox($x, $y, $w + 2, $h + 1); |
||
| 580 | // coloca o logo |
||
| 581 | View Code Duplication | if (is_file($this->logomarca)) { |
|
| 582 | $logoInfo = getimagesize($this->logomarca); |
||
| 583 | //largura da imagem em mm |
||
| 584 | $logoWmm = ($logoInfo[0] / 72) * 25.4; |
||
| 585 | //altura da imagem em mm |
||
| 586 | $logoHmm = ($logoInfo[1] / 72) * 25.4; |
||
| 587 | if ($this->logoAlign == 'L') { |
||
| 588 | $nImgW = round($w / 3, 0); |
||
| 589 | $nImgH = round($logoHmm * ($nImgW / $logoWmm), 0); |
||
| 590 | $xImg = $x + 1; |
||
| 591 | $yImg = round(($h - $nImgH) / 2, 0) + $y; |
||
| 592 | //estabelecer posições do texto |
||
| 593 | $x1 = round($xImg + $nImgW + 1, 0); |
||
| 594 | $y1 = round($h / 3 + $y, 0); |
||
| 595 | $tw = round(2 * $w / 3, 0); |
||
| 596 | } elseif ($this->logoAlign == 'C') { |
||
| 597 | $nImgH = round($h / 3, 0); |
||
| 598 | $nImgW = round($logoWmm * ($nImgH / $logoHmm), 0); |
||
| 599 | $xImg = round(($w - $nImgW) / 2 + $x, 0); |
||
| 600 | $yImg = $y + 3; |
||
| 601 | $x1 = $x; |
||
| 602 | $y1 = round($yImg + $nImgH + 1, 0); |
||
| 603 | $tw = $w; |
||
| 604 | } elseif ($this->logoAlign == 'R') { |
||
| 605 | $nImgW = round($w / 3, 0); |
||
| 606 | $nImgH = round($logoHmm * ($nImgW / $logoWmm), 0); |
||
| 607 | $xImg = round($x + ($w - (1 + $nImgW)), 0); |
||
| 608 | $yImg = round(($h - $nImgH) / 2, 0) + $y; |
||
| 609 | $x1 = $x; |
||
| 610 | $y1 = round($h / 3 + $y, 0); |
||
| 611 | $tw = round(2 * $w / 3, 0); |
||
| 612 | } |
||
| 613 | $this->pdf->Image($this->logomarca, $xImg, $yImg, $nImgW, $nImgH, 'jpeg'); |
||
| 614 | } else { |
||
| 615 | $x1 = $x; |
||
| 616 | $y1 = round($h / 3 + $y, 0); |
||
| 617 | $tw = $w; |
||
| 618 | } |
||
| 619 | //Nome emitente |
||
| 620 | $aFont = array( |
||
| 621 | 'font' => $this->fontePadrao, |
||
| 622 | 'size' => 9, |
||
| 623 | 'style' => 'B'); |
||
| 624 | $texto = $this->pSimpleGetValue($this->emit, "xNome"); |
||
| 625 | $this->pTextBox($x1, $y1, $tw, 8, $texto, $aFont, 'T', 'C', 0, ''); |
||
| 626 | //endereço |
||
| 627 | $y1 = $y1 + 3; |
||
| 628 | $aFont = array( |
||
| 629 | 'font' => $this->fontePadrao, |
||
| 630 | 'size' => 7, |
||
| 631 | 'style' => ''); |
||
| 632 | $fone = $this->pSimpleGetValue($this->enderEmit, "fone")!=""? $this->zFormatFone($this->enderEmit):''; |
||
| 633 | $lgr = $this->pSimpleGetValue($this->enderEmit, "xLgr"); |
||
| 634 | $nro = $this->pSimpleGetValue($this->enderEmit, "nro"); |
||
| 635 | $cpl = $this->pSimpleGetValue($this->enderEmit, "xCpl"); |
||
| 636 | $bairro = $this->pSimpleGetValue($this->enderEmit, "xBairro"); |
||
| 637 | $CEP = $this->pSimpleGetValue($this->enderEmit, "CEP"); |
||
| 638 | $CEP = $this->pFormat($CEP, "#####-###"); |
||
| 639 | $mun = $this->pSimpleGetValue($this->enderEmit, "xMun"); |
||
| 640 | $UF = $this->pSimpleGetValue($this->enderEmit, "UF"); |
||
| 641 | $xPais = $this->pSimpleGetValue($this->enderEmit, "xPais"); |
||
| 642 | $texto = $lgr . "," . $nro . "\n" . $bairro . " - " |
||
| 643 | . $CEP . " - " . $mun . " - " . $UF . " " . $xPais |
||
| 644 | . "\n Fone/Fax: " . $fone; |
||
| 645 | $this->pTextBox($x1 - 5, $y1 + 2, $tw + 5, 8, $texto, $aFont, 'T', 'C', 0, ''); |
||
| 646 | //CNPJ/CPF IE |
||
| 647 | $cpfCnpj = $this->zFormatCNPJCPF($this->emit); |
||
| 648 | $ie = $this->pSimpleGetValue($this->emit, "IE"); |
||
| 649 | $texto = 'CNPJ/CPF: ' . $cpfCnpj . ' Insc.Estadual: ' . $ie; |
||
| 650 | $this->pTextBox($x1 - 1, $y1 + 12, $tw + 5, 8, $texto, $aFont, 'T', 'C', 0, ''); |
||
| 651 | //outra caixa |
||
| 652 | $h1 = 17.5; |
||
| 653 | $y1 = $y + $h + 1; |
||
| 654 | $this->pTextBox($x, $y1, $w + 2, $h1); |
||
| 655 | //TIPO DO CT-E |
||
| 656 | $texto = 'TIPO DO CTE'; |
||
| 657 | $wa = 37; |
||
| 658 | $aFont = array( |
||
| 659 | 'font' => $this->fontePadrao, |
||
| 660 | 'size' => 8, |
||
| 661 | 'style' => ''); |
||
| 662 | $this->pTextBox($x, $y1, $w * 0.5, $h1, $texto, $aFont, 'T', 'C', 0, ''); |
||
| 663 | $tpCTe = $this->pSimpleGetValue($this->ide, "tpCTe"); |
||
| 664 | //0 - CT-e Normal,1 - CT-e de Complemento de Valores, |
||
| 665 | //2 - CT-e de Anulação de Valores,3 - CT-e Substituto |
||
| 666 | switch ($tpCTe) { |
||
| 667 | case '0': |
||
| 668 | $texto = 'Normal'; |
||
| 669 | break; |
||
| 670 | case '1': |
||
| 671 | $texto = 'Complemento de Valores'; |
||
| 672 | break; |
||
| 673 | case '2': |
||
| 674 | $texto = 'Anulação de Valores'; |
||
| 675 | break; |
||
| 676 | case '3': |
||
| 677 | $texto = 'Substituto'; |
||
| 678 | break; |
||
| 679 | default: |
||
| 680 | $texto = 'ERRO' . $tpCTe . $tpServ; |
||
| 681 | } |
||
| 682 | $aFont = $this->formatNegrito; |
||
| 683 | $this->pTextBox($x, $y1 + 3, $w * 0.5, $h1, $texto, $aFont, 'T', 'C', 0, '', false); |
||
| 684 | //TIPO DO SERVIÇO |
||
| 685 | $texto = 'TIPO DO SERVIÇO'; |
||
| 686 | $wb = 36; |
||
| 687 | $aFont = array( |
||
| 688 | 'font' => $this->fontePadrao, |
||
| 689 | 'size' => 8, |
||
| 690 | 'style' => ''); |
||
| 691 | $this->pTextBox($x + $wa + 4.5, $y1, $w * 0.5, $h1, $texto, $aFont, 'T', 'C', 0, ''); |
||
| 692 | $tpServ = $this->pSimpleGetValue($this->ide, "tpServ"); |
||
| 693 | //0 - Normal;1 - Subcontratação;2 - Redespacho;3 - Redespacho Intermediário |
||
| 694 | switch ($tpServ) { |
||
| 695 | case '0': |
||
| 696 | $texto = 'Normal'; |
||
| 697 | break; |
||
| 698 | case '1': |
||
| 699 | $texto = 'Subcontratação'; |
||
| 700 | break; |
||
| 701 | case '2': |
||
| 702 | $texto = 'Redespacho'; |
||
| 703 | break; |
||
| 704 | case '3': |
||
| 705 | $texto = 'Redespacho Intermediário'; |
||
| 706 | break; |
||
| 707 | default: |
||
| 708 | $texto = 'ERRO' . $tpServ; |
||
| 709 | } |
||
| 710 | $aFont = $this->formatNegrito; |
||
| 711 | $this->pTextBox($x + $wa + 4.5, $y1 + 3, $w * 0.5, $h1, $texto, $aFont, 'T', 'C', 0, '', false); |
||
| 712 | $this->pdf->Line($w * 0.5, $y1, $w * 0.5, $y1 + $h1); |
||
| 713 | //TOMADOR DO SERVIÇO |
||
| 714 | $texto = 'INDICADOR DO CT-E GLOBALIZADO'; |
||
| 715 | $wc = 37; |
||
| 716 | $y2 = $y1 + 8; |
||
| 717 | $aFont = array( |
||
| 718 | 'font' => $this->fontePadrao, |
||
| 719 | 'size' => 6, |
||
| 720 | 'style' => ''); |
||
| 721 | $this->pTextBox($x, $y2, $w * 0.5, $h1, $texto, $aFont, 'T', 'C', 0, ''); |
||
| 722 | $this->pdf->Line($x, $y1 + 8, $w + 3, $y1 + 8); |
||
| 723 | $toma = $this->pSimpleGetValue($this->ide, "indGlobalizado"); |
||
| 724 | //0-Remetente;1-Expedidor;2-Recebedor;3-Destinatário;4 - Outros |
||
| 725 | if ($toma==1) { |
||
| 726 | $aFont = array( |
||
| 727 | 'font' => $this->fontePadrao, |
||
| 728 | 'size' => 11, |
||
| 729 | 'style' => ''); |
||
| 730 | $this->pTextBox($x-14.5, $y2 + 3.5, $w * 0.5, $h1, 'X', $aFont, 'T', 'C', 0, '', false); |
||
| 731 | } else { |
||
| 732 | $aFont = array( |
||
| 733 | 'font' => $this->fontePadrao, |
||
| 734 | 'size' => 11, |
||
| 735 | 'style' => ''); |
||
| 736 | $this->pTextBox($x+3.5, $y2 + 3.5, $w * 0.5, $h1, 'X', $aFont, 'T', 'C', 0, '', false); |
||
| 737 | } |
||
| 738 | $aFont = $this->formatNegrito; |
||
| 739 | $this->pdf->Line($x+5, $x+48, $x+5, $x+52); |
||
| 740 | $this->pdf->Line($x+10, $x+48, $x+10, $x+52); |
||
| 741 | $this->pdf->Line($x+5, $x+48, $x+10, $x+48); |
||
| 742 | $this->pdf->Line($x+5, $x+52, $x+10, $x+52); |
||
| 743 | $this->pTextBox($x-9, $y2+1.4 + 3, $w * 0.5, $h1, 'SIM', $aFont, 'T', 'C', 0, '', false); |
||
| 744 | |||
| 745 | $this->pdf->Line($x+23, $x+48, $x+23, $x+52); |
||
| 746 | $this->pdf->Line($x+28, $x+48, $x+28, $x+52); |
||
| 747 | $this->pdf->Line($x+23, $x+48, $x+28, $x+48); |
||
| 748 | $this->pdf->Line($x+23, $x+52, $x+28, $x+52); |
||
| 749 | $this->pTextBox($x+9.8, $y2+1.4 + 3, $w * 0.5, $h1, 'NÃO', $aFont, 'T', 'C', 0, '', false); |
||
| 750 | |||
| 751 | //FORMA DE PAGAMENTO |
||
| 752 | $texto = 'NFORMAÇÕES DO CT-E GLOBALIZADO'; |
||
| 753 | $wd = 36; |
||
| 754 | $aFont = array( |
||
| 755 | 'font' => $this->fontePadrao, |
||
| 756 | 'size' => 8, |
||
| 757 | 'style' => ''); |
||
| 758 | $this->pTextBox($x+2 + $wa + 4.5, $y2-0.7, $w * 0.5, $h1, $texto, $aFont, 'T', 'C', 0, ''); |
||
| 759 | $forma = $this->pSimpleGetValue($this->ide, "forPag"); |
||
| 760 | //################################################################## |
||
| 761 | //coluna direita |
||
| 762 | $x += $w + 2; |
||
| 763 | $w = round($maxW * 0.335); |
||
| 764 | $w1 = $w; |
||
| 765 | $h = 11; |
||
| 766 | $this->pTextBox($x, $y, $w + 2, $h + 1); |
||
| 767 | $texto = "DACTE"; |
||
| 768 | $aFont = array( |
||
| 769 | 'font' => $this->fontePadrao, |
||
| 770 | 'size' => 10, |
||
| 771 | 'style' => 'B'); |
||
| 772 | $this->pTextBox($x, $y + 1, $w, $h, $texto, $aFont, 'T', 'C', 0, ''); |
||
| 773 | $aFont = array( |
||
| 774 | 'font' => $this->fontePadrao, |
||
| 775 | 'size' => 8, |
||
| 776 | 'style' => ''); |
||
| 777 | $texto = "Documento Auxiliar do Conhecimento\nde Transporte Eletrônico"; |
||
| 778 | $h = 10; |
||
| 779 | $this->pTextBox($x, $y + 4, $w, $h, $texto, $aFont, 'T', 'C', 0, '', false); |
||
| 780 | $x1 = $x + $w + 2; |
||
| 781 | $w = round($maxW * 0.22, 0); |
||
| 782 | $w2 = $w; |
||
| 783 | $h = 11; |
||
| 784 | $this->pTextBox($x1, $y, $w + 0.5, $h + 1); |
||
| 785 | $texto = "MODAL"; |
||
| 786 | $aFont = array( |
||
| 787 | 'font' => $this->fontePadrao, |
||
| 788 | 'size' => 8, |
||
| 789 | 'style' => ''); |
||
| 790 | $this->pTextBox($x1, $y + 1, $w, $h, $texto, $aFont, 'T', 'C', 0, ''); |
||
| 791 | switch ($this->modal) { |
||
| 792 | case '1': |
||
| 793 | $texto = 'Rodoviário'; |
||
| 794 | break; |
||
| 795 | case '2': |
||
| 796 | $texto = 'Aéreo'; |
||
| 797 | break; |
||
| 798 | case '3': |
||
| 799 | $texto = 'Aquaviário'; |
||
| 800 | break; |
||
| 801 | case '4': |
||
| 802 | $texto = 'Ferroviário'; |
||
| 803 | break; |
||
| 804 | case '5': |
||
| 805 | $texto = 'Dutoviário'; |
||
| 806 | break; |
||
| 807 | } |
||
| 808 | $aFont = array( |
||
| 809 | 'font' => $this->fontePadrao, |
||
| 810 | 'size' => 10, |
||
| 811 | 'style' => 'B'); |
||
| 812 | $this->pTextBox($x1, $y + 5, $w, $h, $texto, $aFont, 'T', 'C', 0, ''); |
||
| 813 | //outra caixa |
||
| 814 | $y += 12; |
||
| 815 | $h = 9; |
||
| 816 | $w = $w1 + $w2 + 2; |
||
| 817 | $this->pTextBox($x, $y, $w + 0.5, $h + 1); |
||
| 818 | //modelo |
||
| 819 | $wa = 12; |
||
| 820 | $xa = $x; |
||
| 821 | $texto = 'MODELO'; |
||
| 822 | $aFont = array( |
||
| 823 | 'font' => $this->fontePadrao, |
||
| 824 | 'size' => 8, |
||
| 825 | 'style' => ''); |
||
| 826 | $this->pTextBox($xa, $y + 1, $wa, $h, $texto, $aFont, 'T', 'C', 0, ''); |
||
| 827 | $texto = $this->pSimpleGetValue($this->ide, "mod"); |
||
| 828 | $aFont = $this->formatNegrito; |
||
| 829 | $this->pTextBox($xa, $y + 5, $wa, $h, $texto, $aFont, 'T', 'C', 0, ''); |
||
| 830 | $this->pdf->Line($x + $wa, $y, $x + $wa, $y + $h + 1); |
||
| 831 | //serie |
||
| 832 | $xa += $wa; |
||
| 833 | $texto = 'SÉRIE'; |
||
| 834 | $aFont = array( |
||
| 835 | 'font' => $this->fontePadrao, |
||
| 836 | 'size' => 8, |
||
| 837 | 'style' => ''); |
||
| 838 | $this->pTextBox($xa, $y + 1, $wa, $h, $texto, $aFont, 'T', 'C', 0, ''); |
||
| 839 | $texto = $this->pSimpleGetValue($this->ide, "serie"); |
||
| 840 | $aFont = $this->formatNegrito; |
||
| 841 | $this->pTextBox($xa, $y + 5, $wa, $h, $texto, $aFont, 'T', 'C', 0, ''); |
||
| 842 | $this->pdf->Line($xa + $wa, $y, $xa + $wa, $y + $h + 1); |
||
| 843 | //numero |
||
| 844 | $xa += $wa; |
||
| 845 | $wa = 20; |
||
| 846 | $texto = 'NÚMERO'; |
||
| 847 | $aFont = array( |
||
| 848 | 'font' => $this->fontePadrao, |
||
| 849 | 'size' => 8, |
||
| 850 | 'style' => ''); |
||
| 851 | $this->pTextBox($xa, $y + 1, $wa, $h, $texto, $aFont, 'T', 'C', 0, ''); |
||
| 852 | $texto = $this->pSimpleGetValue($this->ide, "nCT"); |
||
| 853 | $aFont = $this->formatNegrito; |
||
| 854 | $this->pTextBox($xa, $y + 5, $wa, $h, $texto, $aFont, 'T', 'C', 0, ''); |
||
| 855 | $this->pdf->Line($xa + $wa, $y, $xa + $wa, $y + $h + 1); |
||
| 856 | //folha |
||
| 857 | $xa += $wa; |
||
| 858 | $wa = 12; |
||
| 859 | $texto = 'FL'; |
||
| 860 | $aFont = array( |
||
| 861 | 'font' => $this->fontePadrao, |
||
| 862 | 'size' => 8, |
||
| 863 | 'style' => ''); |
||
| 864 | $this->pTextBox($xa, $y + 1, $wa, $h, $texto, $aFont, 'T', 'C', 0, ''); |
||
| 865 | //$texto = '1/1'; |
||
| 866 | $texto = $pag."/".$totPag; |
||
| 867 | $aFont = $this->formatNegrito; |
||
| 868 | $this->pTextBox($xa, $y + 5, $wa, $h, $texto, $aFont, 'T', 'C', 0, ''); |
||
| 869 | $this->pdf->Line($xa + $wa, $y, $xa + $wa, $y + $h + 1); |
||
| 870 | //data hora de emissão |
||
| 871 | $xa += $wa; |
||
| 872 | $wa = 30; |
||
| 873 | $texto = 'DATA E HORA DE EMISSÃO'; |
||
| 874 | $aFont = array( |
||
| 875 | 'font' => $this->fontePadrao, |
||
| 876 | 'size' => 8, |
||
| 877 | 'style' => ''); |
||
| 878 | $this->pTextBox($xa, $y + 1, $wa, $h, $texto, $aFont, 'T', 'C', 0, ''); |
||
| 879 | $texto = !empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ? |
||
| 880 | date('d/m/Y H:i:s', $this->pConvertTime($this->pSimpleGetValue($this->ide, "dhEmi"))) : ''; |
||
| 881 | $aFont = $this->formatNegrito; |
||
| 882 | $this->pTextBox($xa, $y + 5, $wa, $h, $texto, $aFont, 'T', 'C', 0, ''); |
||
| 883 | $this->pdf->Line($xa + $wa, $y, $xa + $wa, $y + $h + 1); |
||
| 884 | //ISUF |
||
| 885 | $xa += $wa; |
||
| 886 | $wa = 32; |
||
| 887 | $texto = 'INSC. SUFRAMA DO DESTINATÁRIO'; |
||
| 888 | $aFont = $this->formatPadrao; |
||
| 889 | $this->pTextBox($xa, $y + 1, $wa, $h, $texto, $aFont, 'T', 'C', 0, ''); |
||
| 890 | $texto = $this->pSimpleGetValue($this->dest, "ISUF"); |
||
| 891 | $aFont = array( |
||
| 892 | 'font' => $this->fontePadrao, |
||
| 893 | 'size' => 7, |
||
| 894 | 'style' => 'B'); |
||
| 895 | $this->pTextBox($xa, $y + 5, $wa, $h, $texto, $aFont, 'T', 'C', 0, ''); |
||
| 896 | //outra caixa |
||
| 897 | $y += $h + 1; |
||
| 898 | $h = 23; |
||
| 899 | $h1 = 14; |
||
| 900 | $this->pTextBox($x, $y, $w + 0.5, $h1); |
||
| 901 | //CODIGO DE BARRAS |
||
| 902 | $chave_acesso = str_replace('CTe', '', $this->infCte->getAttribute("Id")); |
||
| 903 | $bW = 85; |
||
| 904 | $bH = 10; |
||
| 905 | //codigo de barras |
||
| 906 | $this->pdf->SetFillColor(0, 0, 0); |
||
| 907 | $this->pdf->Code128($x + (($w - $bW) / 2), $y + 2, $chave_acesso, $bW, $bH); |
||
| 908 | $this->pTextBox($x, $y + $h1, $w + 0.5, $h1 - 6); |
||
| 909 | $texto = 'CHAVE DE ACESSO'; |
||
| 910 | $aFont = $this->formatPadrao; |
||
| 911 | $this->pTextBox($x, $y + $h1, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 912 | $aFont = $this->formatNegrito; |
||
| 913 | $texto = $this->pFormat($chave_acesso, '##.####.##.###.###/####-##-##-###-###.###.###-###.###.###-#'); |
||
| 914 | $this->pTextBox($x, $y + $h1 + 3, $w, $h, $texto, $aFont, 'T', 'C', 0, ''); |
||
| 915 | $this->pTextBox($x, $y + $h1 + 8, $w + 0.5, $h1 - 4.5); |
||
| 916 | $texto = "Consulta de autenticidade no portal nacional do CT-e, "; |
||
| 917 | $texto .= "no site da Sefaz Autorizadora, \r\n ou em http://www.cte.fazenda.gov.br"; |
||
| 918 | View Code Duplication | if ($this->tpEmis == 5 || $this->tpEmis == 7 || $this->tpEmis == 8) { |
|
| 919 | $texto = ""; |
||
| 920 | $this->pdf->SetFillColor(0, 0, 0); |
||
| 921 | if ($this->tpEmis == 5) { |
||
| 922 | $chaveContingencia = $this->zGeraChaveAdicCont(); |
||
| 923 | $this->pdf->Code128($x + 20, $y1 + 10, $chaveContingencia, $bW * .9, $bH / 2); |
||
| 924 | } else { |
||
| 925 | $chaveContingencia = $this->pSimpleGetValue($this->protCTe, "nProt"); |
||
| 926 | $this->pdf->Code128($x + 40, $y1 + 10, $chaveContingencia, $bW * .4, $bH / 2); |
||
| 927 | } |
||
| 928 | //codigo de barras |
||
| 929 | } |
||
| 930 | $aFont = array( |
||
| 931 | 'font' => $this->fontePadrao, |
||
| 932 | 'size' => 8, |
||
| 933 | 'style' => ''); |
||
| 934 | $this->pTextBox($x, $y + $h1 + 9, $w, $h, $texto, $aFont, 'T', 'C', 0, ''); |
||
| 935 | //outra caixa |
||
| 936 | $y += $h + 1; |
||
| 937 | $h = 8.5; |
||
| 938 | $wa = $w; |
||
| 939 | $this->pTextBox($x, $y + 7.5, $w + 0.5, $h); |
||
| 940 | View Code Duplication | if ($this->zCteDPEC()) { |
|
| 941 | $texto = 'NÚMERO DE REGISTRO DPEC'; |
||
| 942 | } elseif ($this->tpEmis == 5 || $this->tpEmis == 7 || $this->tpEmis == 8) { |
||
| 943 | $texto = "DADOS DO CT-E"; |
||
| 944 | } else { |
||
| 945 | $texto = 'PROTOCOLO DE AUTORIZAÇÃO DE USO'; |
||
| 946 | } |
||
| 947 | $aFont = $this->formatPadrao; |
||
| 948 | $this->pTextBox($x, $y + 7.5, $wa, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 949 | View Code Duplication | if ($this->zCteDPEC()) { |
|
| 950 | $texto = $this->numero_registro_dpec; |
||
| 951 | } elseif ($this->tpEmis == 5) { |
||
| 952 | $chaveContingencia = $this->zGeraChaveAdicCont(); |
||
| 953 | $aFont = array( |
||
| 954 | 'font' => $this->fontePadrao, |
||
| 955 | 'size' => 8, |
||
| 956 | 'style' => 'B'); |
||
| 957 | $texto = $this->pFormat($chaveContingencia, "#### #### #### #### #### #### #### #### ####"); |
||
| 958 | $cStat = ''; |
||
| 959 | } else { |
||
| 960 | $texto = $this->pSimpleGetValue($this->protCTe, "nProt") . " - "; |
||
| 961 | // empty($volume->getElementsByTagName("qVol")->item(0)->nodeValue) |
||
| 962 | if (!empty($this->protCTe) |
||
| 963 | && !empty($this->protCTe->getElementsByTagName("dhRecbto")->item(0)->nodeValue) |
||
| 964 | ) { |
||
| 965 | $texto .= date( |
||
| 966 | 'd/m/Y H:i:s', |
||
| 967 | $this->pConvertTime($this->pSimpleGetValue($this->protCTe, "dhRecbto")) |
||
| 968 | ); |
||
| 969 | } |
||
| 970 | $texto = $this->pSimpleGetValue($this->protCTe, "nProt") == '' ? '' : $texto; |
||
| 971 | } |
||
| 972 | $aFont = $this->formatNegrito; |
||
| 973 | $this->pTextBox($x, $y + 12, $wa, $h, $texto, $aFont, 'T', 'C', 0, ''); |
||
| 974 | //CFOP |
||
| 975 | $x = $oldX; |
||
| 976 | $h = 8.5; |
||
| 977 | $w = round($maxW * 0.42); |
||
| 978 | $y1 = $y + 7.5; |
||
| 979 | $this->pTextBox($x, $y1, $w + 2, $h); |
||
| 980 | $texto = 'CFOP - NATUREZA DA PRESTAÇÃO'; |
||
| 981 | $aFont = array( |
||
| 982 | 'font' => $this->fontePadrao, |
||
| 983 | 'size' => 8, |
||
| 984 | 'style' => ''); |
||
| 985 | $this->pTextBox($x, $y1, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 986 | $texto = $this->pSimpleGetValue($this->ide, "CFOP") . ' - ' . $this->pSimpleGetValue($this->ide, "natOp"); |
||
| 987 | $aFont = $this->formatNegrito; |
||
| 988 | $this->pTextBox($x, $y1 + 3.5, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 989 | //ORIGEM DA PRESTAÇÃO |
||
| 990 | $y += $h + 7.5; |
||
| 991 | $x = $oldX; |
||
| 992 | $h = 8; |
||
| 993 | $w = ($maxW * 0.5); |
||
| 994 | $this->pTextBox($x, $y, $w + 0.5, $h); |
||
| 995 | $texto = 'INÍCIO DA PRESTAÇÃO'; |
||
| 996 | $aFont = array( |
||
| 997 | 'font' => $this->fontePadrao, |
||
| 998 | 'size' => 8, |
||
| 999 | 'style' => ''); |
||
| 1000 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1001 | $texto = $this->pSimpleGetValue($this->ide, "xMunIni") . ' - ' . $this->pSimpleGetValue($this->ide, "UFIni"); |
||
| 1002 | $aFont = $this->formatNegrito; |
||
| 1003 | $this->pTextBox($x, $y + 3.5, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1004 | //DESTINO DA PRESTAÇÃO |
||
| 1005 | $x = $oldX + $w + 1; |
||
| 1006 | $h = 8; |
||
| 1007 | $w = $w - 1.3; |
||
| 1008 | $this->pTextBox($x - 0.5, $y, $w + 0.5, $h); |
||
| 1009 | $texto = 'TÉRMINO DA PRESTAÇÃO'; |
||
| 1010 | $aFont = array( |
||
| 1011 | 'font' => $this->fontePadrao, |
||
| 1012 | 'size' => 8, |
||
| 1013 | 'style' => ''); |
||
| 1014 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1015 | $texto = $this->pSimpleGetValue($this->ide, "xMunFim") . ' - ' . $this->pSimpleGetValue($this->ide, "UFFim"); |
||
| 1016 | $aFont = $this->formatNegrito; |
||
| 1017 | $this->pTextBox($x, $y + 3.5, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1018 | //######################################################################### |
||
| 1019 | //Indicação de CTe Homologação, cancelamento e falta de protocolo |
||
| 1020 | $tpAmb = $this->ide->getElementsByTagName('tpAmb')->item(0)->nodeValue; |
||
| 1021 | //indicar cancelamento |
||
| 1022 | $cStat = $this->pSimpleGetValue($this->cteProc, "cStat"); |
||
| 1023 | View Code Duplication | if ($cStat == '101' || $cStat == '135' || $this->situacao_externa == self::NFEPHP_SITUACAO_EXTERNA_CANCELADA) { |
|
| 1024 | //101 Cancelamento |
||
| 1025 | $x = 10; |
||
| 1026 | $y = $this->hPrint - 130; |
||
| 1027 | $h = 25; |
||
| 1028 | $w = $maxW - (2 * $x); |
||
| 1029 | $this->pdf->SetTextColor(90, 90, 90); |
||
| 1030 | $texto = "CTe CANCELADO"; |
||
| 1031 | $aFont = array( |
||
| 1032 | 'font' => $this->fontePadrao, |
||
| 1033 | 'size' => 48, |
||
| 1034 | 'style' => 'B'); |
||
| 1035 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, ''); |
||
| 1036 | $this->pdf->SetTextColor(0, 0, 0); |
||
| 1037 | } |
||
| 1038 | $cStat = $this->pSimpleGetValue($this->cteProc, "cStat"); |
||
| 1039 | View Code Duplication | if ($cStat == '110' || |
|
| 1040 | $cStat == '301' || |
||
| 1041 | $cStat == '302' || |
||
| 1042 | $this->situacao_externa == self::NFEPHP_SITUACAO_EXTERNA_DENEGADA |
||
| 1043 | ) { |
||
| 1044 | //110 Denegada |
||
| 1045 | $x = 10; |
||
| 1046 | $y = $this->hPrint - 130; |
||
| 1047 | $h = 25; |
||
| 1048 | $w = $maxW - (2 * $x); |
||
| 1049 | $this->pdf->SetTextColor(90, 90, 90); |
||
| 1050 | $texto = "CTe USO DENEGADO"; |
||
| 1051 | $aFont = array( |
||
| 1052 | 'font' => $this->fontePadrao, |
||
| 1053 | 'size' => 48, |
||
| 1054 | 'style' => 'B'); |
||
| 1055 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, ''); |
||
| 1056 | $y += $h; |
||
| 1057 | $h = 5; |
||
| 1058 | $w = $maxW - (2 * $x); |
||
| 1059 | $texto = "SEM VALOR FISCAL"; |
||
| 1060 | $aFont = array( |
||
| 1061 | 'font' => $this->fontePadrao, |
||
| 1062 | 'size' => 48, |
||
| 1063 | 'style' => 'B'); |
||
| 1064 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, ''); |
||
| 1065 | $this->pdf->SetTextColor(0, 0, 0); |
||
| 1066 | } |
||
| 1067 | //indicar sem valor |
||
| 1068 | View Code Duplication | if ($tpAmb != 1 && $this->preVisualizar=='0') { // caso não seja uma DA de produção |
|
| 1069 | $x = 10; |
||
| 1070 | if ($this->orientacao == 'P') { |
||
| 1071 | $y = round($this->hPrint * 2 / 3, 0); |
||
| 1072 | } else { |
||
| 1073 | $y = round($this->hPrint / 2, 0); |
||
| 1074 | } |
||
| 1075 | $h = 5; |
||
| 1076 | $w = $maxW - (2 * $x); |
||
| 1077 | $this->pdf->SetTextColor(90, 90, 90); |
||
| 1078 | $texto = "SEM VALOR FISCAL"; |
||
| 1079 | $aFont = array( |
||
| 1080 | 'font' => $this->fontePadrao, |
||
| 1081 | 'size' => 48, |
||
| 1082 | 'style' => 'B'); |
||
| 1083 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, ''); |
||
| 1084 | $aFont = array( |
||
| 1085 | 'font' => $this->fontePadrao, |
||
| 1086 | 'size' => 30, |
||
| 1087 | 'style' => 'B'); |
||
| 1088 | $texto = "AMBIENTE DE HOMOLOGAÇÃO"; |
||
| 1089 | $this->pTextBox($x, $y + 14, $w, $h, $texto, $aFont, 'C', 'C', 0, ''); |
||
| 1090 | $this->pdf->SetTextColor(0, 0, 0); |
||
| 1091 | } elseif ($this->preVisualizar=='1') { // caso seja uma DA de Pré-Visualização |
||
| 1092 | $h = 5; |
||
| 1093 | $w = $maxW - (2 * 10); |
||
| 1094 | $x = 55; |
||
| 1095 | $y = 240; |
||
| 1096 | $this->pdf->SetTextColor(255, 100, 100); |
||
| 1097 | $aFont = array( |
||
| 1098 | 'font' => $this->fontePadrao, |
||
| 1099 | 'size' => 40, |
||
| 1100 | 'style' => 'B'); |
||
| 1101 | $texto = "Pré-visualização"; |
||
| 1102 | $this->pTextBox90($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, ''); |
||
| 1103 | $this->pdf->SetTextColor(255, 100, 100); |
||
| 1104 | $aFont = array( |
||
| 1105 | 'font' => $this->fontePadrao, |
||
| 1106 | 'size' => 41, |
||
| 1107 | 'style' => 'B'); |
||
| 1108 | $texto = "Sem Validade Jurídica"; |
||
| 1109 | $this->pTextBox90($x+20, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, ''); |
||
| 1110 | $this->pdf->SetTextColor(90, 90, 90); |
||
| 1111 | $texto = "SEM VALOR FISCAL"; |
||
| 1112 | $aFont = array( |
||
| 1113 | 'font' => $this->fontePadrao, |
||
| 1114 | 'size' => 48, |
||
| 1115 | 'style' => 'B'); |
||
| 1116 | $this->pTextBox90($x+40, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, ''); |
||
| 1117 | $this->pdf->SetTextColor(0, 0, 0); // voltar a cor default |
||
| 1118 | } else { |
||
| 1119 | $x = 10; |
||
| 1120 | if ($this->orientacao == 'P') { |
||
| 1121 | $y = round($this->hPrint * 2 / 3, 0); |
||
| 1122 | } else { |
||
| 1123 | $y = round($this->hPrint / 2, 0); |
||
| 1124 | } //fim orientacao |
||
| 1125 | $h = 5; |
||
| 1126 | $w = $maxW - (2 * $x); |
||
| 1127 | $this->pdf->SetTextColor(90, 90, 90); |
||
| 1128 | //indicar FALTA DO PROTOCOLO se NFe não for em contingência |
||
| 1129 | if (($this->tpEmis == 5 || $this->tpEmis == 7 || $this->tpEmis == 8) && !$this->zCteDPEC()) { |
||
| 1130 | //Contingência |
||
| 1131 | $texto = "DACTE Emitido em Contingência"; |
||
| 1132 | $aFont = array( |
||
| 1133 | 'font' => $this->fontePadrao, |
||
| 1134 | 'size' => 48, |
||
| 1135 | 'style' => 'B'); |
||
| 1136 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, ''); |
||
| 1137 | $aFont = array( |
||
| 1138 | 'font' => $this->fontePadrao, |
||
| 1139 | 'size' => 30, |
||
| 1140 | 'style' => 'B'); |
||
| 1141 | $texto = "devido à problemas técnicos"; |
||
| 1142 | $this->pTextBox($x, $y + 12, $w, $h, $texto, $aFont, 'C', 'C', 0, ''); |
||
| 1143 | } else { |
||
| 1144 | if (!isset($this->protCTe)) { |
||
| 1145 | if (!$this->zCteDPEC()) { |
||
| 1146 | $texto = "SEM VALOR FISCAL"; |
||
| 1147 | $aFont = array( |
||
| 1148 | 'font' => $this->fontePadrao, |
||
| 1149 | 'size' => 48, |
||
| 1150 | 'style' => 'B'); |
||
| 1151 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, ''); |
||
| 1152 | } |
||
| 1153 | $aFont = array( |
||
| 1154 | 'font' => $this->fontePadrao, |
||
| 1155 | 'size' => 30, |
||
| 1156 | 'style' => 'B'); |
||
| 1157 | $texto = "FALTA PROTOCOLO DE APROVAÇÃO DA SEFAZ"; |
||
| 1158 | if (!$this->zCteDPEC()) { |
||
| 1159 | $this->pTextBox($x, $y + 12, $w, $h, $texto, $aFont, 'C', 'C', 0, ''); |
||
| 1160 | } else { |
||
| 1161 | $this->pTextBox($x, $y + 25, $w, $h, $texto, $aFont, 'C', 'C', 0, ''); |
||
| 1162 | } |
||
| 1163 | } //fim cteProc |
||
| 1164 | if ($this->tpEmis == 4) { |
||
| 1165 | //DPEC |
||
| 1166 | $x = 10; |
||
| 1167 | $y = $this->hPrint - 130; |
||
| 1168 | $h = 25; |
||
| 1169 | $w = $maxW - (2 * $x); |
||
| 1170 | $this->pdf->SetTextColor(200, 200, 200); // 90,90,90 é muito escuro |
||
| 1171 | $texto = "DACTE impresso em contingência -\n" |
||
| 1172 | . "DPEC regularmente recebido pela Receita\n" |
||
| 1173 | . "Federal do Brasil"; |
||
| 1174 | $aFont = array( |
||
| 1175 | 'font' => $this->fontePadrao, |
||
| 1176 | 'size' => 48, |
||
| 1177 | 'style' => 'B'); |
||
| 1178 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, ''); |
||
| 1179 | $this->pdf->SetTextColor(0, 0, 0); |
||
| 1180 | } |
||
| 1181 | } //fim tpEmis |
||
| 1182 | $this->pdf->SetTextColor(0, 0, 0); |
||
| 1183 | } |
||
| 1184 | return $oldY; |
||
| 1185 | } //fim zCabecalho |
||
| 1186 | |||
| 1187 | /** |
||
| 1188 | * rodapeDACTE |
||
| 1189 | * Monta o rodape no final da DACTE ( retrato e paisagem ) |
||
| 1190 | * |
||
| 1191 | * @param number $xInic Posição horizontal canto esquerdo |
||
| 1192 | * @param number $yFinal Posição vertical final para impressão |
||
| 1193 | */ |
||
| 1194 | View Code Duplication | protected function zRodape($x, $y) |
|
| 1195 | { |
||
| 1196 | $texto = "Impresso em " . date('d/m/Y H:i:s'); |
||
| 1197 | $w = $this->wPrint - 4; |
||
| 1198 | $aFont = array( |
||
| 1199 | 'font' => $this->fontePadrao, |
||
| 1200 | 'size' => 6, |
||
| 1201 | 'style' => ''); |
||
| 1202 | $this->pTextBox($x, $y, $w, 4, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1203 | $texto = "DacteNFePHP ver. " . $this->version . " Powered by NFePHP (GNU/GPLv3 GNU/LGPLv3) © www.nfephp.org"; |
||
| 1204 | $aFont = array( |
||
| 1205 | 'font' => $this->fontePadrao, |
||
| 1206 | 'size' => 6, |
||
| 1207 | 'style' => ''); |
||
| 1208 | $this->pTextBox($x, $y, $w, 4, $texto, $aFont, 'T', 'R', 0, 'http://www.nfephp.org'); |
||
| 1209 | } //fim zRodape |
||
| 1210 | |||
| 1211 | /** |
||
| 1212 | * zRemetente |
||
| 1213 | * Monta o campo com os dados do remetente na DACTE. ( retrato e paisagem ) |
||
| 1214 | * |
||
| 1215 | * @param number $x Posição horizontal canto esquerdo |
||
| 1216 | * @param number $y Posição vertical canto superior |
||
| 1217 | * @return number Posição vertical final |
||
| 1218 | */ |
||
| 1219 | protected function zRemetente($x = 0, $y = 0) |
||
| 1220 | { |
||
| 1221 | $oldX = $x; |
||
| 1222 | $oldY = $y; |
||
| 1223 | if ($this->orientacao == 'P') { |
||
| 1224 | $maxW = $this->wPrint; |
||
| 1225 | } else { |
||
| 1226 | $maxW = $this->wPrint - $this->wCanhoto; |
||
| 1227 | } |
||
| 1228 | $w = $maxW * 0.5 + 0.5; |
||
| 1229 | $h = 19; |
||
| 1230 | $x1 = $x + 16; |
||
| 1231 | $texto = 'REMETENTE'; |
||
| 1232 | $aFont = $this->formatPadrao; |
||
| 1233 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, ''); |
||
| 1234 | $aFont = $this->formatNegrito; |
||
| 1235 | $texto = $this->pSimpleGetValue($this->rem, "xNome"); |
||
| 1236 | $this->pTextBox($x1, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1237 | $y += 3; |
||
| 1238 | $texto = 'ENDEREÇO'; |
||
| 1239 | $aFont = $this->formatPadrao; |
||
| 1240 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1241 | $aFont = $this->formatNegrito; |
||
| 1242 | $texto = $this->pSimpleGetValue($this->enderReme, "xLgr") . ','; |
||
| 1243 | $texto .= $this->pSimpleGetValue($this->enderReme, "nro"); |
||
| 1244 | $texto .= ($this->pSimpleGetValue($this->enderReme, "xCpl") != "") ? |
||
| 1245 | ' - ' . $this->pSimpleGetValue($this->enderReme, "xCpl") : ''; |
||
| 1246 | $this->pTextBox($x1, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1247 | $y += 3; |
||
| 1248 | $texto = $this->pSimpleGetValue($this->enderReme, "xBairro"); |
||
| 1249 | $this->pTextBox($x1, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1250 | $y += 3; |
||
| 1251 | $texto = 'MUNICÍPIO'; |
||
| 1252 | $aFont = $this->formatPadrao; |
||
| 1253 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1254 | $texto = $this->pSimpleGetValue($this->enderReme, "xMun") . ' - '; |
||
| 1255 | $texto .= $this->pSimpleGetValue($this->enderReme, "UF"); |
||
| 1256 | $aFont = $this->formatNegrito; |
||
| 1257 | $this->pTextBox($x1, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1258 | $x = $w - 18; |
||
| 1259 | $texto = 'CEP'; |
||
| 1260 | $aFont = $this->formatPadrao; |
||
| 1261 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1262 | $texto = $this->pFormat($this->pSimpleGetValue($this->enderReme, "CEP"), "#####-###"); |
||
| 1263 | $aFont = $this->formatNegrito; |
||
| 1264 | $this->pTextBox($x + 6, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1265 | $x = $oldX; |
||
| 1266 | $y += 3; |
||
| 1267 | $texto = 'CNPJ/CPF'; |
||
| 1268 | $aFont = $this->formatPadrao; |
||
| 1269 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1270 | $cpfCnpj = $this->zFormatCNPJCPF($this->rem); |
||
| 1271 | $aFont = $this->formatNegrito; |
||
| 1272 | $this->pTextBox($x1, $y, $w, $h, $cpfCnpj, $aFont, 'T', 'L', 0, ''); |
||
| 1273 | $x = $w - 45; |
||
| 1274 | $texto = 'INSCRIÇÃO ESTADUAL'; |
||
| 1275 | $aFont = $this->formatPadrao; |
||
| 1276 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1277 | $texto = $this->pSimpleGetValue($this->rem, "IE"); |
||
| 1278 | $aFont = $this->formatNegrito; |
||
| 1279 | $this->pTextBox($x + 28, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1280 | $x = $oldX; |
||
| 1281 | $y += 3; |
||
| 1282 | $texto = 'PAÍS'; |
||
| 1283 | $aFont = $this->formatPadrao; |
||
| 1284 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1285 | $texto = $this->pSimpleGetValue($this->rem, "xPais") != "" ? |
||
| 1286 | $this->pSimpleGetValue($this->rem, "xPais") : 'BRASIL'; |
||
| 1287 | $aFont = $this->formatNegrito; |
||
| 1288 | $this->pTextBox($x1, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1289 | $x = $w - 25; |
||
| 1290 | $texto = 'FONE'; |
||
| 1291 | $aFont = $this->formatPadrao; |
||
| 1292 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1293 | //$texto = $this->zFormatFone($this->rem); |
||
| 1294 | $texto = $this->pSimpleGetValue($this->rem, "fone")!=""? $this->zFormatFone($this->rem):''; |
||
| 1295 | $aFont = $this->formatNegrito; |
||
| 1296 | $this->pTextBox($x + 8, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1297 | } //fim da função remetenteDACTE |
||
| 1298 | |||
| 1299 | /** |
||
| 1300 | * zDestinatario |
||
| 1301 | * Monta o campo com os dados do destinatário na DACTE. |
||
| 1302 | * |
||
| 1303 | * @param number $x Posição horizontal canto esquerdo |
||
| 1304 | * @param number $y Posição vertical canto superior |
||
| 1305 | * @return number Posição vertical final |
||
| 1306 | */ |
||
| 1307 | protected function zDestinatario($x = 0, $y = 0) |
||
| 1308 | { |
||
| 1309 | $oldX = $x; |
||
| 1310 | $oldY = $y; |
||
| 1311 | if ($this->orientacao == 'P') { |
||
| 1312 | $maxW = $this->wPrint; |
||
| 1313 | } else { |
||
| 1314 | $maxW = $this->wPrint - $this->wCanhoto; |
||
| 1315 | } |
||
| 1316 | $w = ($maxW * 0.5) - 0.7; |
||
| 1317 | $h = 19; |
||
| 1318 | $x1 = $x + 19; |
||
| 1319 | $texto = 'DESTINATÁRIO'; |
||
| 1320 | $aFont = $this->formatPadrao; |
||
| 1321 | $this->pTextBox($x - 0.5, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, ''); |
||
| 1322 | $aFont = $this->formatNegrito; |
||
| 1323 | $texto = $this->pSimpleGetValue($this->dest, "xNome"); |
||
| 1324 | $this->pTextBox($x1, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1325 | $y += 3; |
||
| 1326 | $texto = 'ENDEREÇO'; |
||
| 1327 | $aFont = $this->formatPadrao; |
||
| 1328 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1329 | $aFont = $this->formatNegrito; |
||
| 1330 | $texto = $this->pSimpleGetValue($this->enderDest, "xLgr") . ','; |
||
| 1331 | $texto .= $this->pSimpleGetValue($this->enderDest, "nro"); |
||
| 1332 | $texto .= $this->pSimpleGetValue($this->enderDest, "xCpl") != "" ? |
||
| 1333 | ' - ' . $this->pSimpleGetValue($this->enderDest, "xCpl") : ''; |
||
| 1334 | $this->pTextBox($x1, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1335 | $y += 3; |
||
| 1336 | $texto = $this->pSimpleGetValue($this->enderDest, "xBairro"); |
||
| 1337 | $this->pTextBox($x1, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1338 | $y += 3; |
||
| 1339 | $texto = 'MUNICÍPIO'; |
||
| 1340 | $aFont = $this->formatPadrao; |
||
| 1341 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1342 | $texto = $this->pSimpleGetValue($this->enderDest, "xMun") . ' - '; |
||
| 1343 | $texto .= $this->pSimpleGetValue($this->enderDest, "UF"); |
||
| 1344 | $aFont = $this->formatNegrito; |
||
| 1345 | $this->pTextBox($x1, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1346 | $x = $w - 19 + $oldX; |
||
| 1347 | $texto = 'CEP'; |
||
| 1348 | $aFont = $this->formatPadrao; |
||
| 1349 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1350 | $texto = $this->pFormat($this->pSimpleGetValue($this->enderDest, "CEP"), "#####-###"); |
||
| 1351 | $aFont = $this->formatNegrito; |
||
| 1352 | $this->pTextBox($x + 5, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1353 | $x = $oldX; |
||
| 1354 | $y += 3; |
||
| 1355 | $texto = 'CNPJ/CPF'; |
||
| 1356 | $aFont = $this->formatPadrao; |
||
| 1357 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1358 | $cpfCnpj = $this->zFormatCNPJCPF($this->dest); |
||
| 1359 | $aFont = $this->formatNegrito; |
||
| 1360 | $this->pTextBox($x1, $y, $w, $h, $cpfCnpj, $aFont, 'T', 'L', 0, ''); |
||
| 1361 | $x = $w - 47.5 + $oldX; |
||
| 1362 | $texto = 'INSCRIÇÃO ESTADUAL'; |
||
| 1363 | $aFont = $this->formatPadrao; |
||
| 1364 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1365 | $texto = $this->pSimpleGetValue($this->dest, "IE"); |
||
| 1366 | $aFont = $this->formatNegrito; |
||
| 1367 | $this->pTextBox($x + 28, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1368 | $x = $oldX; |
||
| 1369 | $y += 3; |
||
| 1370 | $texto = 'PAÍS'; |
||
| 1371 | $aFont = $this->formatPadrao; |
||
| 1372 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1373 | $texto = $this->pSimpleGetValue($this->dest, "xPais"); |
||
| 1374 | $aFont = $this->formatNegrito; |
||
| 1375 | $this->pTextBox($x1, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1376 | $x = $w - 27 + $oldX; |
||
| 1377 | $texto = 'FONE'; |
||
| 1378 | $aFont = $this->formatPadrao; |
||
| 1379 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1380 | //$texto = $this->zFormatFone($this->dest); |
||
| 1381 | $texto = $this->pSimpleGetValue($this->dest, "fone")!=""? $this->zFormatFone($this->dest):''; |
||
| 1382 | $aFont = $this->formatNegrito; |
||
| 1383 | $this->pTextBox($x + 8, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1384 | } //fim da função destinatarioDACTE |
||
| 1385 | |||
| 1386 | /** |
||
| 1387 | * zExpedidor |
||
| 1388 | * Monta o campo com os dados do remetente na DACTE. ( retrato e paisagem ) |
||
| 1389 | * |
||
| 1390 | * @param number $x Posição horizontal canto esquerdo |
||
| 1391 | * @param number $y Posição vertical canto superior |
||
| 1392 | * @return number Posição vertical final |
||
| 1393 | */ |
||
| 1394 | protected function zExpedidor($x = 0, $y = 0) |
||
| 1395 | { |
||
| 1396 | $oldX = $x; |
||
| 1397 | $oldY = $y; |
||
| 1398 | if ($this->orientacao == 'P') { |
||
| 1399 | $maxW = $this->wPrint; |
||
| 1400 | } else { |
||
| 1401 | $maxW = $this->wPrint - $this->wCanhoto; |
||
| 1402 | } |
||
| 1403 | $w = $maxW * 0.5 + 0.5; |
||
| 1404 | $h = 19; |
||
| 1405 | $x1 = $x + 16; |
||
| 1406 | $texto = 'EXPEDIDOR'; |
||
| 1407 | $aFont = $this->formatPadrao; |
||
| 1408 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, ''); |
||
| 1409 | $aFont = $this->formatNegrito; |
||
| 1410 | $texto = $this->pSimpleGetValue($this->exped, "xNome"); |
||
| 1411 | $this->pTextBox($x1, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1412 | $y += 3; |
||
| 1413 | $texto = 'ENDEREÇO'; |
||
| 1414 | $aFont = $this->formatPadrao; |
||
| 1415 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1416 | $aFont = $this->formatNegrito; |
||
| 1417 | View Code Duplication | if (isset($this->enderExped)) { |
|
| 1418 | $texto = $this->pSimpleGetValue($this->enderExped, "xLgr") . ', '; |
||
| 1419 | $texto .= $this->pSimpleGetValue($this->enderExped, "nro"); |
||
| 1420 | $texto .= $this->pSimpleGetValue($this->enderExped, "xCpl") != "" ? |
||
| 1421 | ' - ' . $this->pSimpleGetValue($this->enderExped, "xCpl") : |
||
| 1422 | ''; |
||
| 1423 | } else { |
||
| 1424 | $texto = ''; |
||
| 1425 | } |
||
| 1426 | $this->pTextBox($x1, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1427 | $y += 3; |
||
| 1428 | $texto = $this->pSimpleGetValue($this->enderExped, "xBairro"); |
||
| 1429 | $this->pTextBox($x1, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1430 | $y += 3; |
||
| 1431 | $texto = 'MUNICÍPIO'; |
||
| 1432 | $aFont = $this->formatPadrao; |
||
| 1433 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1434 | View Code Duplication | if (isset($this->enderExped)) { |
|
| 1435 | $texto = $this->pSimpleGetValue($this->enderExped, "xMun") . ' - '; |
||
| 1436 | $texto .= $this->pSimpleGetValue($this->enderExped, "UF"); |
||
| 1437 | } else { |
||
| 1438 | $texto = ''; |
||
| 1439 | } |
||
| 1440 | $aFont = $this->formatNegrito; |
||
| 1441 | $this->pTextBox($x1, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1442 | $x = $w - 18; |
||
| 1443 | $texto = 'CEP'; |
||
| 1444 | $aFont = $this->formatPadrao; |
||
| 1445 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1446 | $texto = $this->pFormat($this->pSimpleGetValue($this->enderExped, "CEP"), "#####-###"); |
||
| 1447 | $aFont = $this->formatNegrito; |
||
| 1448 | $this->pTextBox($x + 6, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1449 | $x = $oldX; |
||
| 1450 | $y += 3; |
||
| 1451 | $texto = 'CNPJ/CPF'; |
||
| 1452 | $aFont = $this->formatPadrao; |
||
| 1453 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1454 | $cpfCnpj = $this->zFormatCNPJCPF($this->exped); |
||
| 1455 | $aFont = $this->formatNegrito; |
||
| 1456 | $this->pTextBox($x1, $y, $w, $h, $cpfCnpj, $aFont, 'T', 'L', 0, ''); |
||
| 1457 | $x = $w - 45; |
||
| 1458 | $texto = 'INSCRIÇÃO ESTADUAL'; |
||
| 1459 | $aFont = $this->formatPadrao; |
||
| 1460 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1461 | $texto = $this->pSimpleGetValue($this->exped, "IE"); |
||
| 1462 | $aFont = $this->formatNegrito; |
||
| 1463 | $this->pTextBox($x + 28, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1464 | $x = $oldX; |
||
| 1465 | $y += 3; |
||
| 1466 | $texto = 'PAÍS'; |
||
| 1467 | $aFont = $this->formatPadrao; |
||
| 1468 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1469 | $texto = $this->pSimpleGetValue($this->exped, "xPais"); |
||
| 1470 | $aFont = $this->formatNegrito; |
||
| 1471 | $this->pTextBox($x1, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1472 | $x = $w - 25; |
||
| 1473 | $texto = 'FONE'; |
||
| 1474 | $aFont = $this->formatPadrao; |
||
| 1475 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1476 | View Code Duplication | if (isset($this->exped)) { |
|
| 1477 | $texto = $this->pSimpleGetValue($this->exped, "fone")!=""? $this->zFormatFone($this->exped):''; |
||
| 1478 | $aFont = $this->formatNegrito; |
||
| 1479 | $this->pTextBox($x + 8, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1480 | } |
||
| 1481 | } //fim da função remetenteDACTE |
||
| 1482 | |||
| 1483 | /** |
||
| 1484 | * zRecebedor |
||
| 1485 | * Monta o campo com os dados do remetente na DACTE. ( retrato e paisagem ) |
||
| 1486 | * |
||
| 1487 | * @param number $x Posição horizontal canto esquerdo |
||
| 1488 | * @param number $y Posição vertical canto superior |
||
| 1489 | * @return number Posição vertical final |
||
| 1490 | */ |
||
| 1491 | protected function zRecebedor($x = 0, $y = 0) |
||
| 1492 | { |
||
| 1493 | $oldX = $x; |
||
| 1494 | $oldY = $y; |
||
| 1495 | if ($this->orientacao == 'P') { |
||
| 1496 | $maxW = $this->wPrint; |
||
| 1497 | } else { |
||
| 1498 | $maxW = $this->wPrint - $this->wCanhoto; |
||
| 1499 | } |
||
| 1500 | $w = ($maxW * 0.5) - 0.7; |
||
| 1501 | $h = 19; |
||
| 1502 | $x1 = $x + 19; |
||
| 1503 | $texto = 'RECEBEDOR'; |
||
| 1504 | $aFont = $this->formatPadrao; |
||
| 1505 | $this->pTextBox($x - 0.5, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, ''); |
||
| 1506 | $aFont = $this->formatNegrito; |
||
| 1507 | $texto = $this->pSimpleGetValue($this->receb, "xNome"); |
||
| 1508 | $this->pTextBox($x1, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1509 | $y += 3; |
||
| 1510 | $texto = 'ENDEREÇO'; |
||
| 1511 | $aFont = $this->formatPadrao; |
||
| 1512 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1513 | $aFont = $this->formatNegrito; |
||
| 1514 | View Code Duplication | if (isset($this->enderReceb)) { |
|
| 1515 | $texto = $this->pSimpleGetValue($this->enderReceb, "xLgr") . ', '; |
||
| 1516 | $texto .= $this->pSimpleGetValue($this->enderReceb, "nro"); |
||
| 1517 | $texto .= ($this->pSimpleGetValue($this->enderReceb, "xCpl") != "") ? |
||
| 1518 | ' - ' . $this->pSimpleGetValue($this->enderReceb, "xCpl") : |
||
| 1519 | ''; |
||
| 1520 | } else { |
||
| 1521 | $texto = ''; |
||
| 1522 | } |
||
| 1523 | $this->pTextBox($x1, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1524 | $y += 3; |
||
| 1525 | $texto = $this->pSimpleGetValue($this->enderReceb, "xBairro"); |
||
| 1526 | $this->pTextBox($x1, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1527 | $y += 3; |
||
| 1528 | $texto = 'MUNICÍPIO'; |
||
| 1529 | $aFont = $this->formatPadrao; |
||
| 1530 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1531 | View Code Duplication | if (isset($this->enderReceb)) { |
|
| 1532 | $texto = $this->pSimpleGetValue($this->enderReceb, "xMun") . ' - '; |
||
| 1533 | $texto .= $this->pSimpleGetValue($this->enderReceb, "UF"); |
||
| 1534 | } else { |
||
| 1535 | $texto = ''; |
||
| 1536 | } |
||
| 1537 | $aFont = $this->formatNegrito; |
||
| 1538 | $this->pTextBox($x1, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1539 | $x = $w - 19 + $oldX; |
||
| 1540 | $texto = 'CEP'; |
||
| 1541 | $aFont = $this->formatPadrao; |
||
| 1542 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1543 | $texto = $this->pFormat($this->pSimpleGetValue($this->enderReceb, "CEP"), "#####-###"); |
||
| 1544 | $aFont = $this->formatNegrito; |
||
| 1545 | $this->pTextBox($x + 5, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1546 | $x = $oldX; |
||
| 1547 | $y += 3; |
||
| 1548 | $texto = 'CNPJ/CPF'; |
||
| 1549 | $aFont = $this->formatPadrao; |
||
| 1550 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1551 | $texto = $this->zFormatCNPJCPF($this->receb); |
||
| 1552 | $aFont = $this->formatNegrito; |
||
| 1553 | $this->pTextBox($x1, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1554 | $x = $w - 47 + $oldX; |
||
| 1555 | $texto = 'INSCRIÇÃO ESTADUAL'; |
||
| 1556 | $aFont = $this->formatPadrao; |
||
| 1557 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1558 | $texto = $this->pSimpleGetValue($this->receb, "IE"); |
||
| 1559 | $aFont = $this->formatNegrito; |
||
| 1560 | $this->pTextBox($x + 28, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1561 | $x = $oldX; |
||
| 1562 | $y += 3; |
||
| 1563 | $texto = 'PAÍS'; |
||
| 1564 | $aFont = $this->formatPadrao; |
||
| 1565 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1566 | $texto = $this->pSimpleGetValue($this->receb, "xPais"); |
||
| 1567 | $aFont = $this->formatNegrito; |
||
| 1568 | $this->pTextBox($x1, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1569 | $x = $w - 27 + $oldX; |
||
| 1570 | $texto = 'FONE'; |
||
| 1571 | $aFont = $this->formatPadrao; |
||
| 1572 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1573 | View Code Duplication | if (isset($this->receb)) { |
|
| 1574 | $texto = $this->pSimpleGetValue($this->receb, "fone")!=""? $this->zFormatFone($this->receb):''; |
||
| 1575 | $aFont = $this->formatNegrito; |
||
| 1576 | $this->pTextBox($x + 8, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1577 | } |
||
| 1578 | } //fim da função recebedorDACTE |
||
| 1579 | |||
| 1580 | /** |
||
| 1581 | * zTomador |
||
| 1582 | * Monta o campo com os dados do remetente na DACTE. ( retrato e paisagem ) |
||
| 1583 | * |
||
| 1584 | * @param number $x Posição horizontal canto esquerdo |
||
| 1585 | * @param number $y Posição vertical canto superior |
||
| 1586 | * @return number Posição vertical final |
||
| 1587 | */ |
||
| 1588 | protected function zTomador($x = 0, $y = 0) |
||
| 1589 | { |
||
| 1590 | $oldX = $x; |
||
| 1591 | $oldY = $y; |
||
| 1592 | if ($this->orientacao == 'P') { |
||
| 1593 | $maxW = $this->wPrint; |
||
| 1594 | } else { |
||
| 1595 | $maxW = $this->wPrint - $this->wCanhoto; |
||
| 1596 | } |
||
| 1597 | $w = $maxW; |
||
| 1598 | $h = 10; |
||
| 1599 | $texto = 'TOMADOR DO SERVIÇO'; |
||
| 1600 | $aFont = $this->formatPadrao; |
||
| 1601 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, ''); |
||
| 1602 | $aFont = $this->formatNegrito; |
||
| 1603 | $texto = $this->pSimpleGetValue($this->toma, "xNome"); |
||
| 1604 | $this->pTextBox($x + 29, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1605 | $x = $maxW * 0.60; |
||
| 1606 | $texto = 'MUNICÍPIO'; |
||
| 1607 | $aFont = $this->formatPadrao; |
||
| 1608 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1609 | $texto = $this->pSimpleGetValue($this->toma, "xMun"); |
||
| 1610 | $aFont = $this->formatNegrito; |
||
| 1611 | $this->pTextBox($x + 15, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1612 | $x = $maxW * 0.85; |
||
| 1613 | $texto = 'UF'; |
||
| 1614 | $aFont = $this->formatPadrao; |
||
| 1615 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1616 | $texto = $this->pSimpleGetValue($this->toma, "UF"); |
||
| 1617 | $aFont = $this->formatNegrito; |
||
| 1618 | $this->pTextBox($x + 4, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1619 | $x = $w - 18; |
||
| 1620 | $texto = 'CEP'; |
||
| 1621 | $aFont = $this->formatPadrao; |
||
| 1622 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1623 | $texto = $this->pFormat($this->pSimpleGetValue($this->toma, "CEP"), "#####-###"); |
||
| 1624 | $aFont = $this->formatNegrito; |
||
| 1625 | $this->pTextBox($x + 6, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1626 | $y += 3; |
||
| 1627 | $x = $oldX; |
||
| 1628 | $texto = 'ENDEREÇO'; |
||
| 1629 | $aFont = $this->formatPadrao; |
||
| 1630 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1631 | $aFont = $this->formatNegrito; |
||
| 1632 | $texto = $this->pSimpleGetValue($this->toma, "xLgr") . ','; |
||
| 1633 | $texto .= $this->pSimpleGetValue($this->toma, "nro"); |
||
| 1634 | $texto .= ($this->pSimpleGetValue($this->toma, "xCpl") != "") ? |
||
| 1635 | ' - ' . $this->pSimpleGetValue($this->toma, "xCpl") : ''; |
||
| 1636 | $texto .= ' - ' . $this->pSimpleGetValue($this->toma, "xBairro"); |
||
| 1637 | $this->pTextBox($x + 16, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1638 | $y += 3; |
||
| 1639 | $texto = 'CNPJ/CPF'; |
||
| 1640 | $aFont = $this->formatPadrao; |
||
| 1641 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1642 | $texto = $this->zFormatCNPJCPF($this->toma); |
||
| 1643 | $aFont = $this->formatNegrito; |
||
| 1644 | $this->pTextBox($x + 13, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1645 | $x = $x + 65; |
||
| 1646 | $texto = 'INSCRIÇÃO ESTADUAL'; |
||
| 1647 | $aFont = $this->formatPadrao; |
||
| 1648 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1649 | $texto = $this->pSimpleGetValue($this->toma, "IE"); |
||
| 1650 | $aFont = $this->formatNegrito; |
||
| 1651 | $this->pTextBox($x + 28, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1652 | $x = $w * 0.75; |
||
| 1653 | $texto = 'PAÍS'; |
||
| 1654 | $aFont = $this->formatPadrao; |
||
| 1655 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1656 | $texto = $this->pSimpleGetValue($this->toma, "xPais") != "" ? |
||
| 1657 | $this->pSimpleGetValue($this->toma, "xPais") : 'BRASIL'; |
||
| 1658 | $aFont = $this->formatNegrito; |
||
| 1659 | $this->pTextBox($x + 6, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1660 | $x = $w - 27; |
||
| 1661 | $texto = 'FONE'; |
||
| 1662 | $aFont = $this->formatPadrao; |
||
| 1663 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1664 | $texto = $this->pSimpleGetValue($this->toma, "fone")!=""? $this->zFormatFone($this->toma):''; |
||
| 1665 | $aFont = $this->formatNegrito; |
||
| 1666 | $this->pTextBox($x + 8, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1667 | } //fim da função tomadorDACTE |
||
| 1668 | |||
| 1669 | /** |
||
| 1670 | * zDescricaoCarga |
||
| 1671 | * Monta o campo com os dados do remetente na DACTE. ( retrato e paisagem ) |
||
| 1672 | * |
||
| 1673 | * @param number $x Posição horizontal canto esquerdo |
||
| 1674 | * @param number $y Posição vertical canto superior |
||
| 1675 | * @return number Posição vertical final |
||
| 1676 | */ |
||
| 1677 | protected function zDescricaoCarga($x = 0, $y = 0) |
||
| 1678 | { |
||
| 1679 | $oldX = $x; |
||
| 1680 | $oldY = $y; |
||
| 1681 | if ($this->orientacao == 'P') { |
||
| 1682 | $maxW = $this->wPrint; |
||
| 1683 | } else { |
||
| 1684 | $maxW = $this->wPrint - $this->wCanhoto; |
||
| 1685 | } |
||
| 1686 | $w = $maxW; |
||
| 1687 | $h = 17; |
||
| 1688 | $texto = 'PRODUTO PREDOMINANTE'; |
||
| 1689 | $aFont = array( |
||
| 1690 | 'font' => $this->fontePadrao, |
||
| 1691 | 'size' => 6, |
||
| 1692 | 'style' => ''); |
||
| 1693 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, ''); |
||
| 1694 | $texto = $this->pSimpleGetValue($this->infCarga, "proPred"); |
||
| 1695 | $aFont = $this->formatNegrito; |
||
| 1696 | $this->pTextBox($x, $y + 2.8, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1697 | $x = $w * 0.56; |
||
| 1698 | $this->pdf->Line($x, $y, $x, $y + 8); |
||
| 1699 | $aFont = $this->formatPadrao; |
||
| 1700 | $texto = 'OUTRAS CARACTERÍSTICAS DA CARGA'; |
||
| 1701 | $this->pTextBox($x + 1, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1702 | $texto = $this->pSimpleGetValue($this->infCarga, "xOutCat"); |
||
| 1703 | $aFont = $this->formatNegrito; |
||
| 1704 | $this->pTextBox($x + 1, $y + 3, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1705 | $x = $w * 0.8; |
||
| 1706 | $this->pdf->Line($x, $y, $x, $y + 8); |
||
| 1707 | $aFont = $this->formatPadrao; |
||
| 1708 | $texto = 'VALOR TOTAL DA CARGA'; |
||
| 1709 | $this->pTextBox($x + 1, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1710 | $texto = $this->pSimpleGetValue($this->infCarga, "vCarga") == "" ? |
||
| 1711 | $this->pSimpleGetValue($this->infCarga, "vMerc") : $this->pSimpleGetValue($this->infCarga, "vCarga"); |
||
| 1712 | $texto = number_format($texto, 2, ",", "."); |
||
| 1713 | $aFont = $this->formatNegrito; |
||
| 1714 | $this->pTextBox($x + 1, $y + 3, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1715 | $y += 8; |
||
| 1716 | $x = $oldX; |
||
| 1717 | $this->pdf->Line($x, $y, $w + 1, $y); |
||
| 1718 | $texto = 'PESO BRUTO (KG)'; |
||
| 1719 | $aFont = array( |
||
| 1720 | 'font' => $this->fontePadrao, |
||
| 1721 | 'size' => 5, |
||
| 1722 | 'style' => ''); |
||
| 1723 | $this->pTextBox($x+8, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1724 | //$texto = $this->pSimpleGetValue($this->infQ->item(0), "qCarga") . "\r\n"; |
||
| 1725 | $texto = number_format( |
||
| 1726 | $this->pSimpleGetValue( |
||
| 1727 | $this->infQ->item(0), |
||
| 1728 | "qCarga" |
||
| 1729 | ), |
||
| 1730 | 3, |
||
| 1731 | ",", |
||
| 1732 | "." |
||
| 1733 | ); |
||
| 1734 | //$texto .= ' ' . $this->zUnidade($this->pSimpleGetValue($this->infQ->item(0), "cUnid")); |
||
| 1735 | $aFont = array( |
||
| 1736 | 'font' => $this->fontePadrao, |
||
| 1737 | 'size' => 7, |
||
| 1738 | 'style' => 'B'); |
||
| 1739 | $this->pTextBox($x+2, $y + 3, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1740 | $x = $w * 0.12; |
||
| 1741 | $this->pdf->Line($x+13.5, $y, $x+13.5, $y + 9); |
||
| 1742 | $texto = 'PESO BASE CÁLCULO (KG)'; |
||
| 1743 | $aFont = array( |
||
| 1744 | 'font' => $this->fontePadrao, |
||
| 1745 | 'size' => 5, |
||
| 1746 | 'style' => ''); |
||
| 1747 | $this->pTextBox($x+20, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1748 | $texto = number_format( |
||
| 1749 | $this->pSimpleGetValue( |
||
| 1750 | $this->infQ->item(0), |
||
| 1751 | "qCarga" |
||
| 1752 | ), |
||
| 1753 | 3, |
||
| 1754 | ",", |
||
| 1755 | "." |
||
| 1756 | ); |
||
| 1757 | $aFont = array( |
||
| 1758 | 'font' => $this->fontePadrao, |
||
| 1759 | 'size' => 7, |
||
| 1760 | 'style' => 'B'); |
||
| 1761 | $this->pTextBox($x+17, $y + 3, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1762 | $x = $w * 0.24; |
||
| 1763 | $this->pdf->Line($x+25, $y, $x+25, $y + 9); |
||
| 1764 | $texto = 'PESO AFERIDO (KG)'; |
||
| 1765 | $aFont = array( |
||
| 1766 | 'font' => $this->fontePadrao, |
||
| 1767 | 'size' => 5, |
||
| 1768 | 'style' => ''); |
||
| 1769 | $this->pTextBox($x+35, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1770 | $texto = number_format( |
||
| 1771 | $this->pSimpleGetValue( |
||
| 1772 | $this->infQ->item(0), |
||
| 1773 | "qCarga" |
||
| 1774 | ), |
||
| 1775 | 3, |
||
| 1776 | ",", |
||
| 1777 | "." |
||
| 1778 | ); |
||
| 1779 | $aFont = array( |
||
| 1780 | 'font' => $this->fontePadrao, |
||
| 1781 | 'size' => 7, |
||
| 1782 | 'style' => 'B'); |
||
| 1783 | $this->pTextBox($x+28, $y + 3, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1784 | $x = $w * 0.36; |
||
| 1785 | $this->pdf->Line($x+41.3, $y, $x+41.3, $y + 9); |
||
| 1786 | $texto = 'CUBAGEM(M3)'; |
||
| 1787 | $aFont = $this->formatPadrao; |
||
| 1788 | $this->pTextBox($x+60, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1789 | View Code Duplication | if ($this->pSimpleGetValue($this->infQ->item(0), "cUnid") == '00') { |
|
| 1790 | $qCarga = $this->pSimpleGetValue($this->infQ->item(0), "qCarga"); |
||
| 1791 | $texto = !empty($qCarga) ? number_format($qCarga, 3, ",", ".") : ''; |
||
| 1792 | } else { |
||
| 1793 | $texto = ''; |
||
| 1794 | } |
||
| 1795 | $aFont = array( |
||
| 1796 | 'font' => $this->fontePadrao, |
||
| 1797 | 'size' => 7, |
||
| 1798 | 'style' => 'B'); |
||
| 1799 | $this->pTextBox($x+50, $y + 3, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1800 | $x = $w * 0.45; |
||
| 1801 | //$this->pdf->Line($x+37, $y, $x+37, $y + 9); |
||
| 1802 | $texto = 'QTDE(VOL)'; |
||
| 1803 | $aFont = $this->formatPadrao; |
||
| 1804 | $this->pTextBox($x+85, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1805 | $qCarga = $this->pSimpleGetValue($this->infQ->item(3), "qCarga"); |
||
| 1806 | $texto = !empty($qCarga) ? number_format($qCarga, 3, ",", ".") : ''; |
||
| 1807 | $aFont = array( |
||
| 1808 | 'font' => $this->fontePadrao, |
||
| 1809 | 'size' => 7, |
||
| 1810 | 'style' => 'B'); |
||
| 1811 | $this->pTextBox($x+85, $y + 3, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1812 | $x = $w * 0.53; |
||
| 1813 | $this->pdf->Line($x+56, $y, $x+56, $y + 9); |
||
| 1814 | /*$texto = 'NOME DA SEGURADORA'; |
||
| 1815 | $aFont = $this->formatPadrao; |
||
| 1816 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1817 | $texto = $this->pSimpleGetValue($this->seg, "xSeg"); |
||
| 1818 | $aFont = array( |
||
| 1819 | 'font' => $this->fontePadrao, |
||
| 1820 | 'size' => 7, |
||
| 1821 | 'style' => 'B'); |
||
| 1822 | $this->pTextBox($x + 31, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1823 | $y += 3; |
||
| 1824 | $this->pdf->Line($x, $y, $w + 1, $y); |
||
| 1825 | $texto = 'RESPONSÁVEL'; |
||
| 1826 | $aFont = $this->formatPadrao; |
||
| 1827 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1828 | $texto = $this->respSeg; |
||
| 1829 | $aFont = array( |
||
| 1830 | 'font' => $this->fontePadrao, |
||
| 1831 | 'size' => 7, |
||
| 1832 | 'style' => 'B'); |
||
| 1833 | $this->pTextBox($x, $y + 3, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1834 | $x = $w * 0.68; |
||
| 1835 | $this->pdf->Line($x, $y, $x, $y + 6); |
||
| 1836 | $texto = 'NÚMERO DA APOLICE'; |
||
| 1837 | $aFont = $this->formatPadrao; |
||
| 1838 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1839 | $texto = $this->pSimpleGetValue($this->seg, "nApol"); |
||
| 1840 | $aFont = array( |
||
| 1841 | 'font' => $this->fontePadrao, |
||
| 1842 | 'size' => 7, |
||
| 1843 | 'style' => 'B'); |
||
| 1844 | $this->pTextBox($x, $y + 3, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1845 | $x = $w * 0.85; |
||
| 1846 | $this->pdf->Line($x, $y, $x, $y + 6); |
||
| 1847 | $texto = 'NÚMERO DA AVERBAÇÃO'; |
||
| 1848 | $aFont = $this->formatPadrao; |
||
| 1849 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1850 | $texto = $this->pSimpleGetValue($this->seg, "nAver"); |
||
| 1851 | $aFont = array( |
||
| 1852 | 'font' => $this->fontePadrao, |
||
| 1853 | 'size' => 7, |
||
| 1854 | 'style' => 'B'); |
||
| 1855 | $this->pTextBox($x, $y + 3, $w, $h, $texto, $aFont, 'T', 'L', 0, '');*/ |
||
| 1856 | } //fim da função zDescricaoCarga |
||
| 1857 | |||
| 1858 | /** |
||
| 1859 | * zCompValorServ |
||
| 1860 | * Monta o campo com os componentes da prestação de serviços. |
||
| 1861 | * |
||
| 1862 | * @param number $x Posição horizontal canto esquerdo |
||
| 1863 | * @param number $y Posição vertical canto superior |
||
| 1864 | * @return number Posição vertical final |
||
| 1865 | */ |
||
| 1866 | View Code Duplication | protected function zCompValorServ($x = 0, $y = 0) |
|
| 1867 | { |
||
| 1868 | $oldX = $x; |
||
| 1869 | $oldY = $y; |
||
| 1870 | if ($this->orientacao == 'P') { |
||
| 1871 | $maxW = $this->wPrint; |
||
| 1872 | } else { |
||
| 1873 | $maxW = $this->wPrint - $this->wCanhoto; |
||
| 1874 | } |
||
| 1875 | $w = $maxW; |
||
| 1876 | $h = 25; |
||
| 1877 | $texto = 'COMPONENTES DO VALOR DA PRESTAÇÃO DO SERVIÇO'; |
||
| 1878 | $aFont = $this->formatPadrao; |
||
| 1879 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'C', 1, ''); |
||
| 1880 | $y += 3.4; |
||
| 1881 | $this->pdf->Line($x, $y, $w + 1, $y); |
||
| 1882 | $texto = 'NOME'; |
||
| 1883 | $aFont = $this->formatPadrao; |
||
| 1884 | $this->pTextBox($x, $y, $w * 0.14, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1885 | $yIniDados = $y; |
||
| 1886 | $x = $w * 0.14; |
||
| 1887 | $texto = 'VALOR'; |
||
| 1888 | $aFont = $this->formatPadrao; |
||
| 1889 | $this->pTextBox($x, $y, $w * 0.14, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1890 | $x = $w * 0.28; |
||
| 1891 | $this->pdf->Line($x, $y, $x, $y + 21.5); |
||
| 1892 | $texto = 'NOME'; |
||
| 1893 | $aFont = $this->formatPadrao; |
||
| 1894 | $this->pTextBox($x, $y, $w * 0.14, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1895 | $x = $w * 0.42; |
||
| 1896 | $texto = 'VALOR'; |
||
| 1897 | $aFont = $this->formatPadrao; |
||
| 1898 | $this->pTextBox($x, $y, $w * 0.14, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1899 | $x = $w * 0.56; |
||
| 1900 | $this->pdf->Line($x, $y, $x, $y + 21.5); |
||
| 1901 | $texto = 'NOME'; |
||
| 1902 | $aFont = $this->formatPadrao; |
||
| 1903 | $this->pTextBox($x, $y, $w * 0.14, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1904 | $x = $w * 0.70; |
||
| 1905 | $texto = 'VALOR'; |
||
| 1906 | $aFont = $this->formatPadrao; |
||
| 1907 | $this->pTextBox($x, $y, $w * 0.14, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1908 | $x = $w * 0.86; |
||
| 1909 | $this->pdf->Line($x, $y, $x, $y + 21.5); |
||
| 1910 | $y += 1; |
||
| 1911 | $texto = 'VALOR TOTAL DO SERVIÇO'; |
||
| 1912 | $aFont = $this->formatPadrao; |
||
| 1913 | $this->pTextBox($x, $y, $w * 0.14, $h, $texto, $aFont, 'T', 'C', 0, ''); |
||
| 1914 | $texto = number_format($this->pSimpleGetValue($this->vPrest, "vTPrest"), 2, ",", "."); |
||
| 1915 | $aFont = array( |
||
| 1916 | 'font' => $this->fontePadrao, |
||
| 1917 | 'size' => 9, |
||
| 1918 | 'style' => 'B'); |
||
| 1919 | $this->pTextBox($x, $y + 4, $w * 0.14, $h, $texto, $aFont, 'T', 'C', 0, ''); |
||
| 1920 | $y += 10; |
||
| 1921 | $this->pdf->Line($x, $y, $w + 1, $y); |
||
| 1922 | $y += 1; |
||
| 1923 | $texto = 'VALOR A RECEBER'; |
||
| 1924 | $aFont = $this->formatPadrao; |
||
| 1925 | $this->pTextBox($x, $y, $w * 0.14, $h, $texto, $aFont, 'T', 'C', 0, ''); |
||
| 1926 | $texto = number_format($this->pSimpleGetValue($this->vPrest, "vRec"), 2, ",", "."); |
||
| 1927 | $aFont = array( |
||
| 1928 | 'font' => $this->fontePadrao, |
||
| 1929 | 'size' => 9, |
||
| 1930 | 'style' => 'B'); |
||
| 1931 | $this->pTextBox($x, $y + 4, $w * 0.14, $h, $texto, $aFont, 'T', 'C', 0, ''); |
||
| 1932 | $auxX = $oldX; |
||
| 1933 | $yIniDados += 4; |
||
| 1934 | foreach ($this->Comp as $k => $d) { |
||
| 1935 | $nome = $this->Comp->item($k)->getElementsByTagName('xNome')->item(0)->nodeValue; |
||
| 1936 | $valor = number_format( |
||
| 1937 | $this->Comp->item($k)->getElementsByTagName('vComp')->item(0)->nodeValue, |
||
| 1938 | 2, |
||
| 1939 | ",", |
||
| 1940 | "." |
||
| 1941 | ); |
||
| 1942 | if ($auxX > $w * 0.60) { |
||
| 1943 | $yIniDados = $yIniDados + 4; |
||
| 1944 | $auxX = $oldX; |
||
| 1945 | } |
||
| 1946 | $texto = $nome; |
||
| 1947 | $aFont = $this->formatPadrao; |
||
| 1948 | $this->pTextBox($auxX, $yIniDados, $w * 0.14, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1949 | $auxX += $w * 0.14; |
||
| 1950 | $texto = $valor; |
||
| 1951 | $aFont = $this->formatPadrao; |
||
| 1952 | $this->pTextBox($auxX, $yIniDados, $w * 0.14, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1953 | $auxX += $w * 0.14; |
||
| 1954 | } |
||
| 1955 | } //fim da função compValorDACTE |
||
| 1956 | |||
| 1957 | /** |
||
| 1958 | * zImpostos |
||
| 1959 | * Monta o campo com os dados do remetente na DACTE. ( retrato e paisagem ) |
||
| 1960 | * |
||
| 1961 | * @param number $x Posição horizontal canto esquerdo |
||
| 1962 | * @param number $y Posição vertical canto superior |
||
| 1963 | * @return number Posição vertical final |
||
| 1964 | */ |
||
| 1965 | View Code Duplication | protected function zImpostos($x = 0, $y = 0) |
|
| 1966 | { |
||
| 1967 | $oldX = $x; |
||
| 1968 | $oldY = $y; |
||
| 1969 | if ($this->orientacao == 'P') { |
||
| 1970 | $maxW = $this->wPrint; |
||
| 1971 | } else { |
||
| 1972 | $maxW = $this->wPrint - $this->wCanhoto; |
||
| 1973 | } |
||
| 1974 | $w = $maxW; |
||
| 1975 | $h = 13; |
||
| 1976 | $texto = 'INFORMAÇÕES RELATIVAS AO IMPOSTO'; |
||
| 1977 | $aFont = $this->formatPadrao; |
||
| 1978 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'C', 1, ''); |
||
| 1979 | |||
| 1980 | $y += 3.4; |
||
| 1981 | $this->pdf->Line($x, $y, $w + 1, $y); |
||
| 1982 | $texto = 'SITUAÇÃO TRIBUTÁRIA'; |
||
| 1983 | $aFont = $this->formatPadrao; |
||
| 1984 | $this->pTextBox($x, $y, $w * 0.26, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1985 | |||
| 1986 | $x += $w * 0.26; |
||
| 1987 | $this->pdf->Line($x, $y, $x, $y + 9.5); |
||
| 1988 | $texto = 'BASE DE CALCULO'; |
||
| 1989 | $aFont = $this->formatPadrao; |
||
| 1990 | $this->pTextBox($x, $y, $w * 0.14, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1991 | |||
| 1992 | $wCol02=0.18; |
||
| 1993 | $x += $w * $wCol02; |
||
| 1994 | $this->pdf->Line($x, $y, $x, $y + 9.5); |
||
| 1995 | $texto = 'ALÍQ ICMS'; |
||
| 1996 | $aFont = $this->formatPadrao; |
||
| 1997 | $this->pTextBox($x, $y, $w * $wCol02, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 1998 | |||
| 1999 | $x += $w * $wCol02; |
||
| 2000 | $this->pdf->Line($x, $y, $x, $y + 9.5); |
||
| 2001 | $texto = 'VALOR ICMS'; |
||
| 2002 | $aFont = $this->formatPadrao; |
||
| 2003 | $this->pTextBox($x, $y, $w * $wCol02, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 2004 | |||
| 2005 | $x += $w * $wCol02; |
||
| 2006 | $this->pdf->Line($x, $y, $x, $y + 9.5); |
||
| 2007 | $texto = '% RED. BC ICMS'; |
||
| 2008 | $aFont = $this->formatPadrao; |
||
| 2009 | $this->pTextBox($x, $y, $w * $wCol02, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 2010 | |||
| 2011 | /*$x += $w * 0.14; |
||
| 2012 | $this->pdf->Line($x, $y, $x, $y + 9.5); |
||
| 2013 | $texto = 'ICMS ST'; |
||
| 2014 | $aFont = $this->formatPadrao; |
||
| 2015 | $this->pTextBox($x, $y, $w * 0.14, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 2016 | * */ |
||
| 2017 | |||
| 2018 | $x = $oldX; |
||
| 2019 | $y = $y + 4; |
||
| 2020 | $texto = $this->pSimpleGetValue($this->ICMS, "CST"); |
||
| 2021 | switch ($texto) { |
||
| 2022 | case '00': |
||
| 2023 | $texto = "00 - Tributação normal ICMS"; |
||
| 2024 | break; |
||
| 2025 | case '20': |
||
| 2026 | $texto = "20 - Tributação com BC reduzida do ICMS"; |
||
| 2027 | break; |
||
| 2028 | case '40': |
||
| 2029 | $texto = "40 - ICMS isenção"; |
||
| 2030 | break; |
||
| 2031 | case '41': |
||
| 2032 | $texto = "41 - ICMS não tributada"; |
||
| 2033 | break; |
||
| 2034 | case '51': |
||
| 2035 | $texto = "51 - ICMS diferido"; |
||
| 2036 | break; |
||
| 2037 | case '60': |
||
| 2038 | $texto = "60 - ICMS cobrado anteriormente por substituição tributária"; |
||
| 2039 | break; |
||
| 2040 | case '90': |
||
| 2041 | $texto = "90 - ICMS outros"; |
||
| 2042 | break; |
||
| 2043 | } |
||
| 2044 | $texto .= $this->pSimpleGetValue($this->ICMSSN, "indSN"); |
||
| 2045 | $texto = $texto == 1 ? 'Simples Nacional' : $texto; |
||
| 2046 | $aFont = $this->formatNegrito; |
||
| 2047 | $this->pTextBox($x, $y, $w * 0.26, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 2048 | $x += $w * 0.26; |
||
| 2049 | |||
| 2050 | $texto = !empty($this->ICMS->getElementsByTagName("vBC")->item(0)->nodeValue) ? |
||
| 2051 | number_format($this->pSimpleGetValue($this->ICMS, "vBC"), 2, ",", ".") : ''; |
||
| 2052 | $aFont = $this->formatNegrito; |
||
| 2053 | $this->pTextBox($x, $y, $w * $wCol02, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 2054 | $x += $w * $wCol02; |
||
| 2055 | |||
| 2056 | $texto = !empty($this->ICMS->getElementsByTagName("pICMS")->item(0)->nodeValue) ? |
||
| 2057 | number_format($this->pSimpleGetValue($this->ICMS, "pICMS"), 2, ",", ".") : ''; |
||
| 2058 | $aFont = $this->formatNegrito; |
||
| 2059 | $this->pTextBox($x, $y, $w * $wCol02, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 2060 | $x += $w * $wCol02; |
||
| 2061 | |||
| 2062 | $texto = !empty($this->ICMS->getElementsByTagName("vICMS")->item(0)->nodeValue) ? |
||
| 2063 | number_format($this->pSimpleGetValue($this->ICMS, "vICMS"), 2, ",", ".") : ''; |
||
| 2064 | $aFont = $this->formatNegrito; |
||
| 2065 | $this->pTextBox($x, $y, $w * $wCol02, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 2066 | $x += $w * $wCol02; |
||
| 2067 | |||
| 2068 | $texto = !empty($this->ICMS->getElementsByTagName("pRedBC")->item(0)->nodeValue) ? |
||
| 2069 | number_format($this->pSimpleGetValue($this->ICMS, "pRedBC"), 2, ",", ".").'%' :''; |
||
| 2070 | $aFont = $this->formatNegrito; |
||
| 2071 | $this->pTextBox($x, $y, $w * $wCol02, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 2072 | |||
| 2073 | /*$x += $w * 0.14; |
||
| 2074 | $texto = ''; |
||
| 2075 | $aFont = $this->formatNegrito; |
||
| 2076 | $this->pTextBox($x, $y, $w * 0.14, $h, $texto, $aFont, 'T', 'L', 0, '');*/ |
||
| 2077 | } //fim da função compValorDACTE |
||
| 2078 | |||
| 2079 | /** |
||
| 2080 | * zGeraChaveAdicCont |
||
| 2081 | * |
||
| 2082 | * @return string chave |
||
| 2083 | */ |
||
| 2084 | View Code Duplication | protected function zGeraChaveAdicCont() |
|
| 2085 | { |
||
| 2086 | //cUF tpEmis CNPJ vNF ICMSp ICMSs DD DV |
||
| 2087 | // Quantidade de caracteres 02 01 14 14 01 01 02 01 |
||
| 2088 | $forma = "%02d%d%s%014d%01d%01d%02d"; |
||
| 2089 | $cUF = $this->ide->getElementsByTagName('cUF')->item(0)->nodeValue; |
||
| 2090 | $CNPJ = "00000000000000" . $this->emit->getElementsByTagName('CNPJ')->item(0)->nodeValue; |
||
| 2091 | $CNPJ = substr($CNPJ, -14); |
||
| 2092 | $vCT = number_format($this->pSimpleGetValue($this->vPrest, "vRec"), 2, "", "") * 100; |
||
| 2093 | $ICMS_CST = $this->pSimpleGetValue($this->ICMS, "CST"); |
||
| 2094 | switch ($ICMS_CST) { |
||
| 2095 | case '00': |
||
| 2096 | case '20': |
||
| 2097 | $ICMSp = '1'; |
||
| 2098 | $ICMSs = '2'; |
||
| 2099 | break; |
||
| 2100 | case '40': |
||
| 2101 | case '41': |
||
| 2102 | case '51': |
||
| 2103 | case '90': |
||
| 2104 | $ICMSp = '2'; |
||
| 2105 | $ICMSs = '2'; |
||
| 2106 | break; |
||
| 2107 | case '60': |
||
| 2108 | $ICMSp = '2'; |
||
| 2109 | $ICMSs = '1'; |
||
| 2110 | break; |
||
| 2111 | } |
||
| 2112 | $dd = $this->ide->getElementsByTagName('dEmi')->item(0)->nodeValue; |
||
| 2113 | $rpos = strrpos($dd, '-'); |
||
| 2114 | $dd = substr($dd, $rpos + 1); |
||
| 2115 | $chave = sprintf($forma, $cUF, $this->tpEmis, $CNPJ, $vCT, $ICMSp, $ICMSs, $dd); |
||
| 2116 | $chave = $chave . $this->pModulo11($chave); |
||
| 2117 | return $chave; |
||
| 2118 | } //fim zGeraChaveAdicCont |
||
| 2119 | |||
| 2120 | /** |
||
| 2121 | * zDocOrig |
||
| 2122 | * Monta o campo com os documentos originarios. |
||
| 2123 | * |
||
| 2124 | * @param number $x Posição horizontal canto esquerdo |
||
| 2125 | * @param number $y Posição vertical canto superior |
||
| 2126 | * @return number Posição vertical final |
||
| 2127 | */ |
||
| 2128 | View Code Duplication | protected function zDocOrig($x = 0, $y = 0) |
|
| 2129 | { |
||
| 2130 | $oldX = $x; |
||
| 2131 | $oldY = $y; |
||
| 2132 | if ($this->orientacao == 'P') { |
||
| 2133 | $maxW = $this->wPrint; |
||
| 2134 | } else { |
||
| 2135 | $maxW = $this->wPrint - $this->wCanhoto; |
||
| 2136 | } |
||
| 2137 | $w = $maxW; |
||
| 2138 | |||
| 2139 | // SE FOR RODOVIARIO ( BTR-SEMPRE SERÁ ) |
||
| 2140 | if ($this->modal == '1') { |
||
| 2141 | // 0 - Não; 1 - Sim Será lotação quando houver um único conhecimento de transporte por veículo, |
||
| 2142 | // ou combinação veicular, e por viagem |
||
| 2143 | $h = $this->lota == 1 ? 35 : 53; |
||
| 2144 | } elseif ($this->modal == '3') { |
||
| 2145 | $h = 37.6; |
||
| 2146 | } else { |
||
| 2147 | $h = 35; |
||
| 2148 | } |
||
| 2149 | $texto = 'DOCUMENTOS ORIGINÁRIOS'; |
||
| 2150 | $aFont = $this->formatPadrao; |
||
| 2151 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'C', 1, ''); |
||
| 2152 | $descr1 = 'TIPO DOC'; |
||
| 2153 | $descr2 = 'CNPJ/CHAVE/OBS'; |
||
| 2154 | $descr3 = 'SÉRIE/NRO. DOCUMENTO'; |
||
| 2155 | |||
| 2156 | $y += 3.4; |
||
| 2157 | $this->pdf->Line($x, $y, $w + 1, $y); // LINHA ABAIXO DO TEXTO: "DOCUMENTOS ORIGINÁRIOS |
||
| 2158 | $texto = $descr1; |
||
| 2159 | $aFont = $this->formatPadrao; |
||
| 2160 | $this->pTextBox($x, $y, $w * 0.10, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 2161 | $yIniDados = $y; |
||
| 2162 | |||
| 2163 | $x += $w * 0.07; |
||
| 2164 | $texto = $descr2; |
||
| 2165 | $aFont = $this->formatPadrao; |
||
| 2166 | $this->pTextBox($x, $y, $w * 0.23, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 2167 | |||
| 2168 | $x += $w * 0.28; |
||
| 2169 | $texto = $descr3; |
||
| 2170 | $aFont = $this->formatPadrao; |
||
| 2171 | $this->pTextBox($x, $y, $w * 0.13, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 2172 | |||
| 2173 | $x += $w * 0.14; |
||
| 2174 | if ($this->modal == '1') { |
||
| 2175 | if ($this->lota == 1) { |
||
| 2176 | $this->pdf->Line($x, $y, $x, $y + 31.5); // TESTE |
||
| 2177 | } else { |
||
| 2178 | $this->pdf->Line($x, $y, $x, $y + 49.5); // TESTE |
||
| 2179 | } |
||
| 2180 | } elseif ($this->modal == '3') { |
||
| 2181 | $this->pdf->Line($x, $y, $x, $y + 34.1); |
||
| 2182 | } else { |
||
| 2183 | $this->pdf->Line($x, $y, $x, $y + 21.5); |
||
| 2184 | } |
||
| 2185 | $texto = $descr1; |
||
| 2186 | $aFont = $this->formatPadrao; |
||
| 2187 | $this->pTextBox($x, $y, $w * 0.10, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 2188 | |||
| 2189 | $x += $w * 0.08; |
||
| 2190 | $texto = $descr2; |
||
| 2191 | $aFont = $this->formatPadrao; |
||
| 2192 | $this->pTextBox($x, $y, $w * 0.23, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 2193 | |||
| 2194 | $x += $w * 0.28; // COLUNA SÉRIE/NRO.DOCUMENTO DA DIREITA |
||
| 2195 | $texto = $descr3; |
||
| 2196 | $aFont = $this->formatPadrao; |
||
| 2197 | $this->pTextBox($x, $y, $w * 0.13, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 2198 | $auxX = $oldX; |
||
| 2199 | $yIniDados += 3; |
||
| 2200 | foreach ($this->infNF as $k => $d) { |
||
| 2201 | $mod = $this->infNF->item($k)->getElementsByTagName('mod'); |
||
| 2202 | $tp = ($mod && $mod->length > 0) ? $mod->item(0)->nodeValue : ''; |
||
| 2203 | $cnpj = $this->zFormatCNPJCPF($this->rem); |
||
| 2204 | $doc = $this->infNF->item($k)->getElementsByTagName('serie')->item(0)->nodeValue; |
||
| 2205 | $doc .= '/' . $this->infNF->item($k)->getElementsByTagName('nDoc')->item(0)->nodeValue; |
||
| 2206 | if ($auxX > $w * 0.90) { |
||
| 2207 | $yIniDados = $yIniDados + 3; |
||
| 2208 | $auxX = $oldX; |
||
| 2209 | } |
||
| 2210 | $texto = $tp; |
||
| 2211 | $aFont = array( |
||
| 2212 | 'font' => $this->fontePadrao, |
||
| 2213 | 'size' => 8, |
||
| 2214 | 'style' => ''); |
||
| 2215 | $this->pTextBox($auxX, $yIniDados, $w * 0.23, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 2216 | $auxX += $w * 0.07; |
||
| 2217 | $texto = $cnpj; |
||
| 2218 | $aFont = array( |
||
| 2219 | 'font' => $this->fontePadrao, |
||
| 2220 | 'size' => 8, |
||
| 2221 | 'style' => ''); |
||
| 2222 | $this->pTextBox($auxX, $yIniDados, $w * 0.23, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 2223 | $auxX += $w * 0.28; |
||
| 2224 | $texto = $doc; |
||
| 2225 | $aFont = array( |
||
| 2226 | 'font' => $this->fontePadrao, |
||
| 2227 | 'size' => 8, |
||
| 2228 | 'style' => ''); |
||
| 2229 | $this->pTextBox($auxX, $yIniDados, $w * 0.13, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 2230 | $auxX += $w * 0.15; |
||
| 2231 | } |
||
| 2232 | |||
| 2233 | foreach ($this->infNFe as $k => $d) { |
||
| 2234 | $chaveNFe = $this->infNFe->item($k)->getElementsByTagName('chave')->item(0)->nodeValue; |
||
| 2235 | $this->arrayNFe[] = $chaveNFe; |
||
| 2236 | } |
||
| 2237 | if (count($this->arrayNFe) >15) { |
||
| 2238 | $this->flagDocOrigContinuacao = 1; |
||
| 2239 | $totPag = '2'; |
||
| 2240 | } else { |
||
| 2241 | $totPag = '1'; |
||
| 2242 | } |
||
| 2243 | $totPag = count($this->arrayNFe) >15 ? '2' : '1'; |
||
| 2244 | $r = $this->zCabecalho(1, 1, '1', $totPag); |
||
| 2245 | $contador = 0; |
||
| 2246 | while ($contador < count($this->arrayNFe)) { |
||
| 2247 | if ($contador == 15) { |
||
| 2248 | break; |
||
| 2249 | } |
||
| 2250 | $tp = 'NF-e'; |
||
| 2251 | $chaveNFe = $this->arrayNFe[$contador]; |
||
| 2252 | $numNFe = substr($chaveNFe, 25, 9); |
||
| 2253 | $serieNFe = substr($chaveNFe, 22, 3); |
||
| 2254 | $doc = $serieNFe . '/' . $numNFe; |
||
| 2255 | if ($auxX > $w * 0.90) { |
||
| 2256 | $yIniDados = $yIniDados + 3.5; |
||
| 2257 | $auxX = $oldX; |
||
| 2258 | } |
||
| 2259 | $texto = $tp; |
||
| 2260 | $aFont = array( |
||
| 2261 | 'font' => $this->fontePadrao, |
||
| 2262 | 'size' => 7, |
||
| 2263 | 'style' => ''); |
||
| 2264 | $this->pTextBox($auxX, $yIniDados, $w * 0.10, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 2265 | $auxX += $w * 0.07; |
||
| 2266 | $texto = $chaveNFe; |
||
| 2267 | $aFont = array( |
||
| 2268 | 'font' => $this->fontePadrao, |
||
| 2269 | 'size' => 7, |
||
| 2270 | 'style' => ''); |
||
| 2271 | $this->pTextBox($auxX, $yIniDados, $w * 0.27, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 2272 | $auxX += $w * 0.28; |
||
| 2273 | $texto = $doc; |
||
| 2274 | $aFont = array( |
||
| 2275 | 'font' => $this->fontePadrao, |
||
| 2276 | 'size' => 7, |
||
| 2277 | 'style' => ''); |
||
| 2278 | $this->pTextBox($auxX, $yIniDados, $w * 0.30, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 2279 | $auxX += $w * 0.15; |
||
| 2280 | $contador++; |
||
| 2281 | } |
||
| 2282 | |||
| 2283 | foreach ($this->infOutros as $k => $d) { |
||
| 2284 | $temp = $this->infOutros->item($k); |
||
| 2285 | $tpDoc = $this->pSimpleGetValue($temp, "tpDoc"); |
||
| 2286 | $descOutros = $this->pSimpleGetValue($temp, "descOutros"); |
||
| 2287 | $nDoc = $this->pSimpleGetValue($temp, "nDoc"); |
||
| 2288 | $dEmi = $this->pSimpleGetDate($temp, "dEmi", "Emissão: "); |
||
| 2289 | $vDocFisc = $this->pSimpleGetValue($temp, "vDocFisc", "Valor: "); |
||
| 2290 | $dPrev = $this->pSimpleGetDate($temp, "dPrev", "Entrega: "); |
||
| 2291 | switch ($tpDoc) { |
||
| 2292 | case "00": |
||
| 2293 | $tpDoc = "00 - Declaração"; |
||
| 2294 | break; |
||
| 2295 | case "10": |
||
| 2296 | $tpDoc = "10 - Dutoviário"; |
||
| 2297 | break; |
||
| 2298 | case "99": |
||
| 2299 | $tpDoc = "99 - Outros: [" . $descOutros . "]"; |
||
| 2300 | break; |
||
| 2301 | default: |
||
| 2302 | break; |
||
| 2303 | } |
||
| 2304 | $numeroDocumento = $nDoc; |
||
| 2305 | $cnpjChave = $dEmi . " " . $vDocFisc . " " . $dPrev; |
||
| 2306 | if ($auxX > $w * 0.90) { |
||
| 2307 | $yIniDados = $yIniDados + 4; |
||
| 2308 | $auxX = $oldX; |
||
| 2309 | } |
||
| 2310 | $this->pTextBox($auxX, $yIniDados, $w * 0.10, $h, $tpDoc, $aFont, 'T', 'L', 0, ''); |
||
| 2311 | $auxX += $w * 0.09; |
||
| 2312 | $this->pTextBox($auxX, $yIniDados, $w * 0.27, $h, $cnpjChave, $aFont, 'T', 'L', 0, ''); |
||
| 2313 | $auxX += $w * 0.28; |
||
| 2314 | $this->pTextBox($auxX, $yIniDados, $w * 0.30, $h, $nDoc, $aFont, 'T', 'L', 0, ''); |
||
| 2315 | $auxX += $w * 0.14; |
||
| 2316 | } |
||
| 2317 | } //fim da função zDocOrig |
||
| 2318 | |||
| 2319 | /** |
||
| 2320 | * zDocOrigContinuacao |
||
| 2321 | * Monta o campo com os documentos originarios. |
||
| 2322 | * |
||
| 2323 | * @param number $x Posição horizontal canto esquerdo |
||
| 2324 | * @param number $y Posição vertical canto superior |
||
| 2325 | * @return number Posição vertical final |
||
| 2326 | */ |
||
| 2327 | View Code Duplication | protected function zDocOrigContinuacao($x = 0, $y = 0) |
|
| 2328 | { |
||
| 2329 | $this->pdf->AddPage($this->orientacao, $this->papel); |
||
| 2330 | $r = $this->zCabecalho(1, 1, '2', '2'); |
||
| 2331 | $oldX = $x; |
||
| 2332 | $oldY = $y; |
||
| 2333 | if ($this->orientacao == 'P') { |
||
| 2334 | $maxW = $this->wPrint; |
||
| 2335 | } else { |
||
| 2336 | $maxW = $this->wPrint - $this->wCanhoto; |
||
| 2337 | } |
||
| 2338 | $w = $maxW; |
||
| 2339 | |||
| 2340 | //$h = 6; // de sub-titulo |
||
| 2341 | //$h = 6 + 3; // de altura do texto (primeira linha |
||
| 2342 | //$h = 9 + 3.5 ;// segunda linha |
||
| 2343 | //$h = 9 + 3.5+ 3.5 ;// segunda linha |
||
| 2344 | $h = (( ( count($this->arrayNFe)/2 ) - 9) * 3.5)+9; |
||
| 2345 | if (count($this->arrayNFe)%2 !=0) { |
||
| 2346 | $h = $h+3.5; |
||
| 2347 | } // Caso tenha apenas 1 registro na ultima linha |
||
| 2348 | |||
| 2349 | $texto = 'DOCUMENTOS ORIGINÁRIOS - CONTINUACÃO'; |
||
| 2350 | $aFont = $this->formatPadrao; |
||
| 2351 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'C', 1, ''); |
||
| 2352 | $descr1 = 'TIPO DOC'; |
||
| 2353 | $descr2 = 'CNPJ/CHAVE/OBS'; |
||
| 2354 | $descr3 = 'SÉRIE/NRO. DOCUMENTO'; |
||
| 2355 | |||
| 2356 | $y += 3.4; |
||
| 2357 | $this->pdf->Line($x, $y, $w + 1, $y); |
||
| 2358 | $texto = $descr1; |
||
| 2359 | $aFont = $this->formatPadrao; |
||
| 2360 | $this->pTextBox($x, $y, $w * 0.10, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 2361 | $yIniDados = $y; |
||
| 2362 | |||
| 2363 | $x += $w * 0.07; // COLUNA CNPJ/CHAVE/OBS |
||
| 2364 | $texto = $descr2; |
||
| 2365 | $aFont = $this->formatPadrao; |
||
| 2366 | $this->pTextBox($x, $y, $w * 0.23, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 2367 | |||
| 2368 | $x += $w * 0.28; |
||
| 2369 | $texto = $descr3; |
||
| 2370 | $aFont = $this->formatPadrao; |
||
| 2371 | $this->pTextBox($x, $y, $w * 0.13, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 2372 | |||
| 2373 | $x += $w * 0.14; |
||
| 2374 | if ($this->modal == '1') { |
||
| 2375 | if ($this->lota == 1) { |
||
| 2376 | $this->pdf->Line($x, $y, $x, $y + 31.5); |
||
| 2377 | } else { |
||
| 2378 | $this->pdf->Line($x, $y, $x, $y + 49.5); |
||
| 2379 | } |
||
| 2380 | } elseif ($this->modal == '3') { |
||
| 2381 | $this->pdf->Line($x, $y, $x, $y + 34.1); |
||
| 2382 | } else { |
||
| 2383 | $this->pdf->Line($x, $y, $x, $y + 21.5); |
||
| 2384 | } |
||
| 2385 | $texto = $descr1; |
||
| 2386 | $aFont = $this->formatPadrao; |
||
| 2387 | $this->pTextBox($x, $y, $w * 0.10, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 2388 | |||
| 2389 | $x += $w * 0.08; |
||
| 2390 | $texto = $descr2; |
||
| 2391 | $aFont = $this->formatPadrao; |
||
| 2392 | $this->pTextBox($x, $y, $w * 0.23, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 2393 | |||
| 2394 | $x += $w * 0.28; // COLUNA SÉRIE/NRO.DOCUMENTO DA DIREITA |
||
| 2395 | $texto = $descr3; |
||
| 2396 | $aFont = $this->formatPadrao; |
||
| 2397 | $this->pTextBox($x, $y, $w * 0.13, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 2398 | $auxX = $oldX; |
||
| 2399 | $yIniDados += 3; |
||
| 2400 | |||
| 2401 | $contador = 16; |
||
| 2402 | for ($contador = 16; $contador < count($this->arrayNFe); $contador++) { |
||
| 2403 | $tp = 'NF-e'; |
||
| 2404 | $chaveNFe = $this->arrayNFe[$contador]; |
||
| 2405 | $numNFe = substr($chaveNFe, 25, 9); |
||
| 2406 | $serieNFe = substr($chaveNFe, 22, 3); |
||
| 2407 | $doc = $serieNFe . '/' . $numNFe; |
||
| 2408 | if ($auxX > $w * 0.90) { |
||
| 2409 | $yIniDados = $yIniDados + 3.5; |
||
| 2410 | $auxX = $oldX; |
||
| 2411 | } |
||
| 2412 | $texto = $tp; |
||
| 2413 | $aFont = array( |
||
| 2414 | 'font' => $this->fontePadrao, |
||
| 2415 | 'size' => 7, |
||
| 2416 | 'style' => ''); |
||
| 2417 | $this->pTextBox($auxX, $yIniDados, $w * 0.10, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 2418 | $auxX += $w * 0.07; |
||
| 2419 | $texto = $chaveNFe; |
||
| 2420 | $aFont = array( |
||
| 2421 | 'font' => $this->fontePadrao, |
||
| 2422 | 'size' => 7, |
||
| 2423 | 'style' => ''); |
||
| 2424 | $this->pTextBox($auxX, $yIniDados, $w * 0.27, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 2425 | $auxX += $w * 0.28; |
||
| 2426 | $texto = $doc; |
||
| 2427 | $aFont = array( |
||
| 2428 | 'font' => $this->fontePadrao, |
||
| 2429 | 'size' => 7, |
||
| 2430 | 'style' => ''); |
||
| 2431 | $this->pTextBox($auxX, $yIniDados, $w * 0.30, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 2432 | $auxX += $w * 0.15; |
||
| 2433 | } |
||
| 2434 | } //fim da função zDocOrigContinuacao |
||
| 2435 | |||
| 2436 | /** |
||
| 2437 | * zDocCompl |
||
| 2438 | * Monta o campo com os dados do remetente na DACTE. |
||
| 2439 | * |
||
| 2440 | * @param number $x Posição horizontal canto esquerdo |
||
| 2441 | * @param number $y Posição vertical canto superior |
||
| 2442 | * @return number Posição vertical final |
||
| 2443 | */ |
||
| 2444 | View Code Duplication | protected function zDocCompl($x = 0, $y = 0) |
|
| 2445 | { |
||
| 2446 | $oldX = $x; |
||
| 2447 | $oldY = $y; |
||
| 2448 | if ($this->orientacao == 'P') { |
||
| 2449 | $maxW = $this->wPrint; |
||
| 2450 | } else { |
||
| 2451 | $maxW = $this->wPrint - $this->wCanhoto; |
||
| 2452 | } |
||
| 2453 | $w = $maxW; |
||
| 2454 | $h = 80; |
||
| 2455 | $texto = 'DETALHAMENTO DO CT-E COMPLEMENTADO'; |
||
| 2456 | $aFont = $this->formatPadrao; |
||
| 2457 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'C', 1, ''); |
||
| 2458 | $descr1 = 'CHAVE DO CT-E COMPLEMENTADO'; |
||
| 2459 | $descr2 = 'VALOR COMPLEMENTADO'; |
||
| 2460 | $y += 3.4; |
||
| 2461 | $this->pdf->Line($x, $y, $w + 1, $y); |
||
| 2462 | $texto = $descr1; |
||
| 2463 | $aFont = $this->formatPadrao; |
||
| 2464 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 2465 | $yIniDados = $y; |
||
| 2466 | $x += $w * 0.37; |
||
| 2467 | $texto = $descr2; |
||
| 2468 | $aFont = $this->formatPadrao; |
||
| 2469 | $this->pTextBox($x - 8, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 2470 | $x += $w * 0.13; |
||
| 2471 | $this->pdf->Line($x, $y, $x, $y + 76.5); |
||
| 2472 | $texto = $descr1; |
||
| 2473 | $aFont = $this->formatPadrao; |
||
| 2474 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 2475 | $x += $w * 0.3; |
||
| 2476 | $texto = $descr2; |
||
| 2477 | $aFont = $this->formatPadrao; |
||
| 2478 | $this->pTextBox($x + 8, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 2479 | $auxX = $oldX; |
||
| 2480 | $yIniDados += 4; |
||
| 2481 | if ($auxX > $w * 0.90) { |
||
| 2482 | $yIniDados = $yIniDados + 4; |
||
| 2483 | $auxX = $oldX; |
||
| 2484 | } |
||
| 2485 | $texto = $this->chaveCTeRef; |
||
| 2486 | $aFont = array( |
||
| 2487 | 'font' => $this->fontePadrao, |
||
| 2488 | 'size' => 8, |
||
| 2489 | 'style' => ''); |
||
| 2490 | $this->pTextBox($auxX, $yIniDados, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 2491 | $texto = number_format($this->pSimpleGetValue($this->vPrest, "vTPrest"), 2, ",", "."); |
||
| 2492 | $aFont = array( |
||
| 2493 | 'font' => $this->fontePadrao, |
||
| 2494 | 'size' => 8, |
||
| 2495 | 'style' => ''); |
||
| 2496 | $this->pTextBox($w * 0.40, $yIniDados, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 2497 | } //fim da função zDocCompl |
||
| 2498 | |||
| 2499 | /** |
||
| 2500 | * zObs |
||
| 2501 | * Monta o campo com os dados do remetente na DACTE. |
||
| 2502 | * |
||
| 2503 | * @param number $x Posição horizontal canto esquerdo |
||
| 2504 | * @param number $y Posição vertical canto superior |
||
| 2505 | * @return number Posição vertical final |
||
| 2506 | */ |
||
| 2507 | protected function zObs($x = 0, $y = 0) |
||
| 2508 | { |
||
| 2509 | $oldX = $x; |
||
| 2510 | $oldY = $y; |
||
| 2511 | if ($this->orientacao == 'P') { |
||
| 2512 | $maxW = $this->wPrint; |
||
| 2513 | } else { |
||
| 2514 | $maxW = $this->wPrint - $this->wCanhoto; |
||
| 2515 | } |
||
| 2516 | $w = $maxW; |
||
| 2517 | //$h = 18; |
||
| 2518 | $h = 18.8; |
||
| 2519 | $texto = 'OBSERVAÇÕES'; |
||
| 2520 | $aFont = $this->formatPadrao; |
||
| 2521 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'C', 1, ''); |
||
| 2522 | $y += 3.4; |
||
| 2523 | $this->pdf->Line($x, $y, $w + 1, $y); |
||
| 2524 | $auxX = $oldX; |
||
| 2525 | $yIniDados = $y; |
||
| 2526 | $texto = ''; |
||
| 2527 | View Code Duplication | foreach ($this->compl as $k => $d) { |
|
| 2528 | $xObs = $this->pSimpleGetValue($this->compl->item($k), "xObs"); |
||
| 2529 | $texto .= $xObs; |
||
| 2530 | } |
||
| 2531 | $textoObs = explode("Motorista:", $texto); |
||
| 2532 | $textoObs[1] = isset($textoObs[1]) ? "Motorista: ".$textoObs[1]: ''; |
||
| 2533 | $texto .= $this->pSimpleGetValue($this->imp, "infAdFisco", "\r\n"); |
||
| 2534 | $texto .= $this->zLocalEntrega(); |
||
| 2535 | $aFont = array( |
||
| 2536 | 'font' => $this->fontePadrao, |
||
| 2537 | 'size' => 7.5, |
||
| 2538 | 'style' => ''); |
||
| 2539 | $this->pTextBox($x, $y, $w, $h, $textoObs[0], $aFont, 'T', 'L', 0, '', false); |
||
| 2540 | $this->pTextBox($x, $y+11.5, $w, $h, $textoObs[1], $aFont, 'T', 'L', 0, '', false); |
||
| 2541 | } //fim da função obsDACTE |
||
| 2542 | |||
| 2543 | /** |
||
| 2544 | * zLocalEntrega |
||
| 2545 | * |
||
| 2546 | * @return string |
||
| 2547 | */ |
||
| 2548 | View Code Duplication | protected function zLocalEntrega() |
|
| 2549 | { |
||
| 2550 | $locEntX = $this->dest->getElementsByTagName('locEnt'); |
||
| 2551 | if ($locEntX->length > 0) { |
||
| 2552 | $locEnt = $locEntX->item(0); |
||
| 2553 | $output = "Entrega: " . $output = $this->zFormatCNPJCPF($locEnt); |
||
| 2554 | $output .= $this->pSimpleGetValue($locEnt, "CPF") . " "; |
||
| 2555 | $output .= $this->pSimpleGetValue($locEnt, "xNome") . " "; |
||
| 2556 | $output .= $this->pSimpleGetValue($locEnt, "xLgr") . " "; |
||
| 2557 | $output .= $this->pSimpleGetValue($locEnt, "nro ") . " "; |
||
| 2558 | $output .= $this->pSimpleGetValue($locEnt, "xCpl") . " "; |
||
| 2559 | $output .= $this->pSimpleGetValue($locEnt, "xBairro") . " "; |
||
| 2560 | $output .= $this->pSimpleGetValue($locEnt, "xMun") . " "; |
||
| 2561 | $output .= $this->pSimpleGetValue($locEnt, "UF") . " "; |
||
| 2562 | return $output; |
||
| 2563 | } |
||
| 2564 | return ""; |
||
| 2565 | } //fim zLocalEntrega |
||
| 2566 | |||
| 2567 | /** |
||
| 2568 | * zModalRod |
||
| 2569 | * Monta o campo com os dados do remetente na DACTE. ( retrato e paisagem ) |
||
| 2570 | * |
||
| 2571 | * @param number $x Posição horizontal canto esquerdo |
||
| 2572 | * @param number $y Posição vertical canto superior |
||
| 2573 | * @return number Posição vertical final |
||
| 2574 | */ |
||
| 2575 | protected function zModalRod($x = 0, $y = 0) |
||
| 2576 | { |
||
| 2577 | $oldX = $x; |
||
| 2578 | $oldY = $y; |
||
| 2579 | $lotacao = ''; |
||
| 2580 | if ($this->orientacao == 'P') { |
||
| 2581 | $maxW = $this->wPrint; |
||
| 2582 | } else { |
||
| 2583 | $maxW = $this->wPrint - $this->wCanhoto; |
||
| 2584 | } |
||
| 2585 | $w = $maxW; |
||
| 2586 | $h = 18.5; |
||
| 2587 | $texto = 'DADOS ESPECÍFICOS DO MODAL RODOVIÁRIO'; |
||
| 2588 | $aFont = $this->formatPadrao; |
||
| 2589 | $this->pTextBox($x, $y, $w, $h * 3.2, $texto, $aFont, 'T', 'C', 1, ''); |
||
| 2590 | View Code Duplication | if ($this->lota == 1) { |
|
| 2591 | $this->pdf->Line($x, $y + 12, $w + 1, $y + 12); // LINHA DE BAIXO |
||
| 2592 | } |
||
| 2593 | $y += 3.4; |
||
| 2594 | $this->pdf->Line($x, $y, $w + 1, $y); // LINHA DE CIMA |
||
| 2595 | $texto = 'RNTRC DA EMPRESA'; |
||
| 2596 | $aFont = $this->formatPadrao; |
||
| 2597 | $this->pTextBox($x, $y, $w * 0.23, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 2598 | $texto = $this->pSimpleGetValue($this->rodo, "RNTRC"); |
||
| 2599 | $aFont = $this->formatNegrito; |
||
| 2600 | $this->pTextBox($x, $y + 3, $w * 0.23, $h, $texto, $aFont, 'T', 'L', 0, ''); |
||
| 2601 | $x += $w * 0.23; |
||
| 2602 | |||
| 2603 | $this->pdf->Line($x-20, $y, $x-20, $y + 8.5); // LINHA A FRENTE DA RNTRC DA EMPRESA |
||
| 2604 | |||
| 2605 | $texto = 'ESTE CONHECIMENTO DE TRANSPORTE ATENDE À LEGISLAÇÃO DE TRANSPORTE RODOVIÁRIO EM VIGOR'; |
||
| 2606 | $aFont = $this->formatPadrao; |
||
| 2607 | $this->pTextBox($x-20, $y + 3, $w * 0.50, $h, $texto, $aFont, 'T', 'C', 0, ''); |
||
| 2608 | } //fim da função zModalRod |
||
| 2609 | |||
| 2610 | /** |
||
| 2611 | * zModalAquaviario |
||
| 2612 | * Monta o campo com os dados do remetente na DACTE. ( retrato e paisagem ) |
||
| 2613 | * |
||
| 2614 | * @param number $x Posição horizontal canto esquerdo |
||
| 2615 | * @param number $y Posição vertical canto superior |
||
| 2616 | * @return number Posição vertical final |
||
| 2617 | */ |
||
| 2618 | View Code Duplication | protected function zModalAquaviario($x = 0, $y = 0) |
|
| 2779 | |||
| 2780 | /** |
||
| 2781 | * zModalFerr |
||
| 2782 | * Monta o campo com os dados do remetente na DACTE. ( retrato e paisagem ) |
||
| 2783 | * |
||
| 2784 | * @param number $x Posição horizontal canto esquerdo |
||
| 2785 | * @param number $y Posição vertical canto superior |
||
| 2786 | * @return number Posição vertical final |
||
| 2787 | */ |
||
| 2788 | View Code Duplication | protected function zModalFerr($x = 0, $y = 0) |
|
| 3057 | |||
| 3058 | /** |
||
| 3059 | * zCanhoto |
||
| 3060 | * Monta o campo com os dados do remetente na DACTE. |
||
| 3061 | * |
||
| 3062 | * @param number $x Posição horizontal canto esquerdo |
||
| 3063 | * @param number $y Posição vertical canto superior |
||
| 3064 | * @return number Posição vertical final |
||
| 3065 | */ |
||
| 3066 | View Code Duplication | protected function zCanhoto($x = 0, $y = 0) |
|
| 3142 | |||
| 3143 | /** |
||
| 3144 | * zDadosAdic |
||
| 3145 | * Coloca o grupo de dados adicionais da DACTE. |
||
| 3146 | * |
||
| 3147 | * @param number $x Posição horizontal canto esquerdo |
||
| 3148 | * @param number $y Posição vertical canto superior |
||
| 3149 | * @param number $h altura do campo |
||
| 3150 | * @return number Posição vertical final |
||
| 3151 | */ |
||
| 3152 | View Code Duplication | protected function zDadosAdic($x, $y, $pag, $h) |
|
| 3225 | |||
| 3226 | /** |
||
| 3227 | * zhDashedLine |
||
| 3228 | * Desenha uma linha horizontal tracejada com o FPDF |
||
| 3229 | * |
||
| 3230 | * @param number $x Posição horizontal inicial, em mm |
||
| 3231 | * @param number $y Posição vertical inicial, em mm |
||
| 3232 | * @param number $w Comprimento da linha, em mm |
||
| 3233 | * @param number $h Espessura da linha, em mm |
||
| 3234 | * @param number $n Numero de traços na seção da linha com o comprimento $w |
||
| 3235 | * @return none |
||
| 3236 | */ |
||
| 3237 | View Code Duplication | protected function zhDashedLine($x, $y, $w, $h, $n) |
|
| 3249 | |||
| 3250 | /** |
||
| 3251 | * zhDashedVerticalLine |
||
| 3252 | * Desenha uma linha vertical tracejada com o FPDF |
||
| 3253 | * |
||
| 3254 | * @param number $x Posição horizontal inicial, em mm |
||
| 3255 | * @param number $y Posição vertical inicial, em mm |
||
| 3256 | * @param number $w Comprimento da linha, em mm |
||
| 3257 | * @param number $yfinal Espessura da linha, em mm |
||
| 3258 | * @param number $n Numero de traços na seção da linha com o comprimento $w |
||
| 3259 | * @return none |
||
| 3260 | */ |
||
| 3261 | View Code Duplication | protected function zhDashedVerticalLine($x, $y, $w, $yfinal, $n) |
|
| 3276 | |||
| 3277 | /** |
||
| 3278 | * zFormatCNPJCPF |
||
| 3279 | * Formata campo CnpjCpf contida na CTe |
||
| 3280 | * |
||
| 3281 | * @param string $field campo cnpjCpf da CT-e |
||
| 3282 | * @return string |
||
| 3283 | */ |
||
| 3284 | View Code Duplication | protected function zFormatCNPJCPF($field) |
|
| 3299 | |||
| 3300 | /** |
||
| 3301 | * zFormatFone |
||
| 3302 | * Formata campo fone contida na CTe |
||
| 3303 | * |
||
| 3304 | * @param string $field campo fone da CT-e |
||
| 3305 | * @return string |
||
| 3306 | */ |
||
| 3307 | View Code Duplication | protected function zFormatFone($field) |
|
| 3308 | { |
||
| 3309 | try { |
||
| 3310 | $fone = !empty($field->getElementsByTagName("fone")->item(0)->nodeValue) ? |
||
| 3311 | $field->getElementsByTagName("fone")->item(0)->nodeValue : ''; |
||
| 3312 | $foneLen = strlen($fone); |
||
| 3313 | if ($foneLen > 0) { |
||
| 3314 | $fone2 = substr($fone, 0, $foneLen - 4); |
||
| 3315 | $fone1 = substr($fone, 0, $foneLen - 8); |
||
| 3316 | $fone = '(' . $fone1 . ') ' . substr($fone2, -4) . '-' . substr($fone, -4); |
||
| 3325 | |||
| 3326 | /** |
||
| 3327 | * zUnidade |
||
| 3328 | * Converte a imformação de peso contida na CTe |
||
| 3329 | * |
||
| 3330 | * @param string $c unidade de trafego extraida da CTe |
||
| 3331 | * @return string |
||
| 3332 | */ |
||
| 3333 | View Code Duplication | protected function zUnidade($c = '') |
|
| 3359 | |||
| 3360 | /** |
||
| 3361 | * zConvertUnidTrafego |
||
| 3362 | * Converte a imformação de peso contida na CTe |
||
| 3363 | * |
||
| 3364 | * @param string $U Informação de trafego extraida da CTe |
||
| 3365 | * @return string |
||
| 3366 | */ |
||
| 3367 | View Code Duplication | protected function zConvertUnidTrafego($U = '') |
|
| 3387 | |||
| 3388 | /** |
||
| 3389 | * zMultiUniPeso |
||
| 3390 | * Fornece a imformação multiplicação de peso contida na CTe |
||
| 3391 | * |
||
| 3392 | * @param interger $U Informação de peso extraida da CTe |
||
| 3393 | * @return interger |
||
| 3394 | */ |
||
| 3395 | protected function zMultiUniPeso($U = '') |
||
| 3404 | } |
||
| 3405 |
Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a mixed type is assigned to a property that is type hinted more strictly.
For example, imagine you have a variable
$accountIdthat can either hold an Id object or false (if there is no account id yet). Your code now assigns that value to theidproperty of an instance of theAccountclass. This class holds a proper account, so the id value must no longer be false.Either this assignment is in error or a type check should be added for that assignment.