@@ -280,8 +280,6 @@ discard block |
||
| 280 | 280 | * __construct |
| 281 | 281 | * |
| 282 | 282 | * @name __construct |
| 283 | - * @param string $docXML Conteúdo XML da NF-e (com ou sem a tag nfeProc) |
|
| 284 | - * @param string $logoimage Caminho para o arquivo do logo |
|
| 285 | 283 | */ |
| 286 | 284 | public function __construct( |
| 287 | 285 | $xml |
@@ -862,8 +860,8 @@ discard block |
||
| 862 | 860 | *cabecalhoDANFE |
| 863 | 861 | * Monta o cabelhalho da DANFE (retrato e paisagem) |
| 864 | 862 | * |
| 865 | - * @param number $x Posição horizontal inicial, canto esquerdo |
|
| 866 | - * @param number $y Posição vertical inicial, canto superior |
|
| 863 | + * @param integer $x Posição horizontal inicial, canto esquerdo |
|
| 864 | + * @param integer $y Posição vertical inicial, canto superior |
|
| 867 | 865 | * @param number $pag Número da Página |
| 868 | 866 | * @param number $totPag Total de páginas |
| 869 | 867 | * @return number Posição vertical final |
@@ -1329,8 +1327,8 @@ discard block |
||
| 1329 | 1327 | * Monta o campo com os dados do destinatário na DANFE. (retrato e paisagem) |
| 1330 | 1328 | * |
| 1331 | 1329 | * @name destinatarioDANFE |
| 1332 | - * @param number $x Posição horizontal canto esquerdo |
|
| 1333 | - * @param number $y Posição vertical canto superior |
|
| 1330 | + * @param integer $x Posição horizontal canto esquerdo |
|
| 1331 | + * @param integer $y Posição vertical canto superior |
|
| 1334 | 1332 | * @return number Posição vertical final |
| 1335 | 1333 | */ |
| 1336 | 1334 | protected function destinatarioDANFE($x = 0, $y = 0) |
@@ -1530,7 +1528,7 @@ discard block |
||
| 1530 | 1528 | * Gera a String do Texto da Fatura |
| 1531 | 1529 | * |
| 1532 | 1530 | * @name getTextoFatura |
| 1533 | - * @return uma String com o texto ou ""; |
|
| 1531 | + * @return string String com o texto ou ""; |
|
| 1534 | 1532 | */ |
| 1535 | 1533 | protected function getTextoFatura() |
| 1536 | 1534 | { |
@@ -1584,8 +1582,8 @@ discard block |
||
| 1584 | 1582 | * Monta o campo de duplicatas da DANFE (retrato e paisagem) |
| 1585 | 1583 | * |
| 1586 | 1584 | * @name faturaDANFE |
| 1587 | - * @param number $x Posição horizontal canto esquerdo |
|
| 1588 | - * @param number $y Posição vertical canto superior |
|
| 1585 | + * @param integer $x Posição horizontal canto esquerdo |
|
| 1586 | + * @param double $y Posição vertical canto superior |
|
| 1589 | 1587 | * @return number Posição vertical final |
| 1590 | 1588 | */ |
| 1591 | 1589 | protected function faturaDANFE($x, $y) |
@@ -1692,8 +1690,8 @@ discard block |
||
| 1692 | 1690 | * Monta o campo de pagamentos da DANFE (retrato e paisagem) (foi baseada na faturaDANFE) |
| 1693 | 1691 | * |
| 1694 | 1692 | * @name pagamentoDANFE |
| 1695 | - * @param number $x Posição horizontal canto esquerdo |
|
| 1696 | - * @param number $y Posição vertical canto superior |
|
| 1693 | + * @param integer $x Posição horizontal canto esquerdo |
|
| 1694 | + * @param double $y Posição vertical canto superior |
|
| 1697 | 1695 | * @return number Posição vertical final |
| 1698 | 1696 | */ |
| 1699 | 1697 | protected function pagamentoDANFE($x, $y) |
@@ -1799,6 +1797,8 @@ discard block |
||
| 1799 | 1797 | * @param float $h Altura do campo |
| 1800 | 1798 | * @param float $h Título do campo |
| 1801 | 1799 | * @param float $h Valor do imposto |
| 1800 | + * @param string $titulo |
|
| 1801 | + * @param string $campoImposto |
|
| 1802 | 1802 | * @return float Sugestão do $x do próximo imposto |
| 1803 | 1803 | */ |
| 1804 | 1804 | protected function impostoDanfeHelper($x, $y, $w, $h, $titulo, $campoImposto) |
@@ -1825,9 +1825,9 @@ discard block |
||
| 1825 | 1825 | * impostoDANFE |
| 1826 | 1826 | * Monta o campo de impostos e totais da DANFE (retrato e paisagem) |
| 1827 | 1827 | * |
| 1828 | - * @param number $x Posição horizontal canto esquerdo |
|
| 1829 | - * @param number $y Posição vertical canto superior |
|
| 1830 | - * @return number Posição vertical final |
|
| 1828 | + * @param integer $x Posição horizontal canto esquerdo |
|
| 1829 | + * @param double $y Posição vertical canto superior |
|
| 1830 | + * @return double Posição vertical final |
|
| 1831 | 1831 | */ |
| 1832 | 1832 | protected function impostoDANFE($x, $y) |
| 1833 | 1833 | { |
@@ -2209,6 +2209,10 @@ discard block |
||
| 2209 | 2209 | |
| 2210 | 2210 | |
| 2211 | 2211 | |
| 2212 | + /** |
|
| 2213 | + * @param string $campo |
|
| 2214 | + * @param string $formato |
|
| 2215 | + */ |
|
| 2212 | 2216 | protected function descricaoProdutoHelper($origem, $campo, $formato) |
| 2213 | 2217 | { |
| 2214 | 2218 | $valor_original = $origem->getElementsByTagName($campo)->item(0); |
@@ -2312,7 +2316,6 @@ discard block |
||
| 2312 | 2316 | * @param float $x Posição horizontal canto esquerdo |
| 2313 | 2317 | * @param float $y Posição vertical canto superior |
| 2314 | 2318 | * @param float $nInicio Número do item inicial |
| 2315 | - * @param float $max Número do item final |
|
| 2316 | 2319 | * @param float $hmax Altura máxima do campo de itens em mm |
| 2317 | 2320 | * @return float Posição vertical final |
| 2318 | 2321 | */ |
@@ -2953,8 +2956,7 @@ discard block |
||
| 2953 | 2956 | * sobre a API NfePHP |
| 2954 | 2957 | * |
| 2955 | 2958 | * @name rodape |
| 2956 | - * @param float $xInic Posição horizontal canto esquerdo |
|
| 2957 | - * @param float $yFinal Posição vertical final para impressão |
|
| 2959 | + * @param integer $x |
|
| 2958 | 2960 | * @return void |
| 2959 | 2961 | */ |
| 2960 | 2962 | protected function rodape($x, $y) |
@@ -2977,7 +2979,7 @@ discard block |
||
| 2977 | 2979 | * Monta o canhoto da DANFE (retrato e paisagem) |
| 2978 | 2980 | * |
| 2979 | 2981 | * @name canhotoDANFE |
| 2980 | - * @param number $x Posição horizontal canto esquerdo |
|
| 2982 | + * @param integer $x Posição horizontal canto esquerdo |
|
| 2981 | 2983 | * @param number $y Posição vertical canto superior |
| 2982 | 2984 | * @return number Posição vertical final |
| 2983 | 2985 | * |
@@ -3309,6 +3311,9 @@ discard block |
||
| 3309 | 3311 | } |
| 3310 | 3312 | } |
| 3311 | 3313 | |
| 3314 | + /** |
|
| 3315 | + * @param string $original |
|
| 3316 | + */ |
|
| 3312 | 3317 | private function imagePNGtoJPG($original) |
| 3313 | 3318 | { |
| 3314 | 3319 | $image = imagecreatefrompng($original); |
@@ -2,7 +2,6 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace NFePHP\DA\NFe; |
| 4 | 4 | |
| 5 | -use InvalidArgumentException; |
|
| 6 | 5 | use NFePHP\DA\Legacy\Dom; |
| 7 | 6 | use NFePHP\DA\Legacy\Pdf; |
| 8 | 7 | use NFePHP\DA\Legacy\Common; |
@@ -393,10 +393,10 @@ discard block |
||
| 393 | 393 | //total inicial de paginas |
| 394 | 394 | $totPag = 1; |
| 395 | 395 | //largura imprimivel em mm: largura da folha menos as margens esq/direita |
| 396 | - $this->wPrint = $maxW-($margEsq * 2); |
|
| 396 | + $this->wPrint = $maxW - ($margEsq * 2); |
|
| 397 | 397 | //comprimento (altura) imprimivel em mm: altura da folha menos as margens |
| 398 | 398 | //superior e inferior |
| 399 | - $this->hPrint = $maxH-$margSup-$margInf; |
|
| 399 | + $this->hPrint = $maxH - $margSup - $margInf; |
|
| 400 | 400 | // estabelece contagem de paginas |
| 401 | 401 | $this->pdf->aliasNbPages(); |
| 402 | 402 | // fixa as margens |
@@ -434,9 +434,9 @@ discard block |
||
| 434 | 434 | } |
| 435 | 435 | //calcular a altura necessária para os dados adicionais |
| 436 | 436 | if ($this->orientacao == 'P') { |
| 437 | - $this->wAdic = round($this->wPrint*0.66, 0); |
|
| 437 | + $this->wAdic = round($this->wPrint * 0.66, 0); |
|
| 438 | 438 | } else { |
| 439 | - $this->wAdic = round(($this->wPrint-$this->wCanhoto)*0.5, 0); |
|
| 439 | + $this->wAdic = round(($this->wPrint - $this->wCanhoto) * 0.5, 0); |
|
| 440 | 440 | } |
| 441 | 441 | $fontProduto = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'']; |
| 442 | 442 | $this->textoAdic = ''; |
@@ -448,8 +448,8 @@ discard block |
||
| 448 | 448 | $txRetxBairro = $this->getTagValue($this->retirada, "xBairro"); |
| 449 | 449 | $txRetxMun = $this->getTagValue($this->retirada, "xMun"); |
| 450 | 450 | $txRetUF = $this->getTagValue($this->retirada, "UF"); |
| 451 | - $this->textoAdic .= "LOCAL DE RETIRADA : ". |
|
| 452 | - $txRetCNPJ. |
|
| 451 | + $this->textoAdic .= "LOCAL DE RETIRADA : " . |
|
| 452 | + $txRetCNPJ . |
|
| 453 | 453 | '-' . |
| 454 | 454 | $txRetxLgr . |
| 455 | 455 | ', ' . |
@@ -476,8 +476,8 @@ discard block |
||
| 476 | 476 | if ($this->textoAdic != '') { |
| 477 | 477 | $this->textoAdic .= ". \r\n"; |
| 478 | 478 | } |
| 479 | - $this->textoAdic .= "LOCAL DE ENTREGA : ".$txRetCNPJ.'-'.$txRetxLgr.', '.$txRetnro.' '.$txRetxCpl. |
|
| 480 | - ' - '.$txRetxBairro.' '.$txRetxMun.' - '.$txRetUF."\r\n"; |
|
| 479 | + $this->textoAdic .= "LOCAL DE ENTREGA : " . $txRetCNPJ . '-' . $txRetxLgr . ', ' . $txRetnro . ' ' . $txRetxCpl . |
|
| 480 | + ' - ' . $txRetxBairro . ' ' . $txRetxMun . ' - ' . $txRetUF . "\r\n"; |
|
| 481 | 481 | } |
| 482 | 482 | //informações adicionais |
| 483 | 483 | $this->textoAdic .= $this->geraInformacoesDasNotasReferenciadas(); |
@@ -486,7 +486,7 @@ discard block |
||
| 486 | 486 | if ($this->textoAdic != '') { |
| 487 | 487 | $this->textoAdic .= ". \r\n"; |
| 488 | 488 | } |
| 489 | - $this->textoAdic .= ! empty($this->getTagValue($this->infAdic, "infCpl")) ? |
|
| 489 | + $this->textoAdic .= !empty($this->getTagValue($this->infAdic, "infCpl")) ? |
|
| 490 | 490 | 'Inf. Contribuinte: ' . |
| 491 | 491 | $this->anfaveaDANFE($this->getTagValue($this->infAdic, "infCpl")) : ''; |
| 492 | 492 | $infPedido = $this->geraInformacoesDaTagCompra(); |
@@ -494,14 +494,14 @@ discard block |
||
| 494 | 494 | $this->textoAdic .= $infPedido; |
| 495 | 495 | } |
| 496 | 496 | $this->textoAdic .= $this->getTagValue($this->dest, "email", ' Email do Destinatário: '); |
| 497 | - $this->textoAdic .= ! empty($this->getTagValue($this->infAdic, "infAdFisco")) ? |
|
| 497 | + $this->textoAdic .= !empty($this->getTagValue($this->infAdic, "infAdFisco")) ? |
|
| 498 | 498 | "\r\n Inf. fisco: " . |
| 499 | 499 | $this->getTagValue($this->infAdic, "infAdFisco") : ''; |
| 500 | 500 | $obsCont = $this->infAdic->getElementsByTagName("obsCont"); |
| 501 | 501 | if (isset($obsCont)) { |
| 502 | 502 | foreach ($obsCont as $obs) { |
| 503 | - $campo = $obsCont->item($i)->getAttribute("xCampo"); |
|
| 504 | - $xTexto = ! empty($obsCont->item($i)->getElementsByTagName("xTexto")->item(0)->nodeValue) ? |
|
| 503 | + $campo = $obsCont->item($i)->getAttribute("xCampo"); |
|
| 504 | + $xTexto = !empty($obsCont->item($i)->getElementsByTagName("xTexto")->item(0)->nodeValue) ? |
|
| 505 | 505 | $obsCont->item($i)->getElementsByTagName("xTexto")->item(0)->nodeValue : ''; |
| 506 | 506 | $this->textoAdic .= "\r\n" . $campo . ': ' . trim($xTexto); |
| 507 | 507 | $i++; |
@@ -529,37 +529,37 @@ discard block |
||
| 529 | 529 | foreach ($alinhas as $linha) { |
| 530 | 530 | $numlinhasdados += $this->pdf->getNumLines($linha, $this->wAdic, $fontProduto); |
| 531 | 531 | } |
| 532 | - $hdadosadic = round(($numlinhasdados+3) * $this->pdf->fontSize, 0); |
|
| 532 | + $hdadosadic = round(($numlinhasdados + 3) * $this->pdf->fontSize, 0); |
|
| 533 | 533 | if ($hdadosadic < 10) { |
| 534 | 534 | $hdadosadic = 10; |
| 535 | 535 | } |
| 536 | 536 | //altura disponivel para os campos da DANFE |
| 537 | - $hcabecalho = 47;//para cabeçalho |
|
| 538 | - $hdestinatario = 25;//para destinatario |
|
| 539 | - $hduplicatas = 12;//para cada grupo de 7 duplicatas |
|
| 540 | - $himposto = 18;// para imposto |
|
| 541 | - $htransporte = 25;// para transporte |
|
| 542 | - $hissqn = 11;// para issqn |
|
| 543 | - $hfooter = 5;// para rodape |
|
| 544 | - $hCabecItens = 4;//cabeçalho dos itens |
|
| 537 | + $hcabecalho = 47; //para cabeçalho |
|
| 538 | + $hdestinatario = 25; //para destinatario |
|
| 539 | + $hduplicatas = 12; //para cada grupo de 7 duplicatas |
|
| 540 | + $himposto = 18; // para imposto |
|
| 541 | + $htransporte = 25; // para transporte |
|
| 542 | + $hissqn = 11; // para issqn |
|
| 543 | + $hfooter = 5; // para rodape |
|
| 544 | + $hCabecItens = 4; //cabeçalho dos itens |
|
| 545 | 545 | //alturas disponiveis para os dados |
| 546 | 546 | $hDispo1 = $this->hPrint - 10 - ($hcabecalho + |
| 547 | 547 | $hdestinatario + ($linhasDup * $hduplicatas) + $himposto + $htransporte + |
| 548 | 548 | ($linhaISSQN * $hissqn) + $hdadosadic + $hfooter + $hCabecItens + |
| 549 | 549 | $this->sizeExtraTextoFatura()); |
| 550 | 550 | if ($this->orientacao == 'P') { |
| 551 | - $hDispo1 -= 24 * $this->qCanhoto;//para canhoto |
|
| 551 | + $hDispo1 -= 24 * $this->qCanhoto; //para canhoto |
|
| 552 | 552 | $w = $this->wPrint; |
| 553 | 553 | } else { |
| 554 | - $hcanhoto = $this->hPrint;//para canhoto |
|
| 554 | + $hcanhoto = $this->hPrint; //para canhoto |
|
| 555 | 555 | $w = $this->wPrint - $this->wCanhoto; |
| 556 | 556 | } |
| 557 | - $hDispo2 = $this->hPrint - 10 - ($hcabecalho + $hfooter + $hCabecItens)-4; |
|
| 557 | + $hDispo2 = $this->hPrint - 10 - ($hcabecalho + $hfooter + $hCabecItens) - 4; |
|
| 558 | 558 | //Contagem da altura ocupada para impressão dos itens |
| 559 | 559 | $fontProduto = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'']; |
| 560 | 560 | $numlinhas = 0; |
| 561 | 561 | $hUsado = $hCabecItens; |
| 562 | - $w2 = round($w*0.28, 0); |
|
| 562 | + $w2 = round($w * 0.28, 0); |
|
| 563 | 563 | $hDispo = $hDispo1; |
| 564 | 564 | $totPag = 1; |
| 565 | 565 | $i = 0; |
@@ -572,7 +572,7 @@ discard block |
||
| 572 | 572 | $hDispo = $hDispo2; |
| 573 | 573 | $hUsado = $hCabecItens; |
| 574 | 574 | // Remove canhoto para páginas secundárias em modo paisagem ('L') |
| 575 | - $w2 = round($this->wPrint*0.28, 0); |
|
| 575 | + $w2 = round($this->wPrint * 0.28, 0); |
|
| 576 | 576 | $i--; // decrementa para readicionar o item que não coube nessa pagina na outra. |
| 577 | 577 | } |
| 578 | 578 | $i++; |
@@ -596,7 +596,7 @@ discard block |
||
| 596 | 596 | //coloca o cabeçalho |
| 597 | 597 | $y = $this->cabecalhoDANFE($x, $y, $pag, $totPag); |
| 598 | 598 | //coloca os dados do destinatário |
| 599 | - $y = $this->destinatarioDANFE($x, $y+1); |
|
| 599 | + $y = $this->destinatarioDANFE($x, $y + 1); |
|
| 600 | 600 | |
| 601 | 601 | |
| 602 | 602 | //Verifica as formas de pagamento da nota fiscal |
@@ -610,29 +610,29 @@ discard block |
||
| 610 | 610 | } |
| 611 | 611 | //caso tenha boleto imprimir fatura |
| 612 | 612 | if ($this->dup->length > 0) { |
| 613 | - $y = $this->faturaDANFE($x, $y+1); |
|
| 613 | + $y = $this->faturaDANFE($x, $y + 1); |
|
| 614 | 614 | } else { |
| 615 | 615 | //Se somente tiver a forma de pagamento sem pagamento ou outros não imprimir nada |
| 616 | - if (count($formaPag)=='1' && (isset($formaPag[90]) || isset($formaPag[99]))) { |
|
| 616 | + if (count($formaPag) == '1' && (isset($formaPag[90]) || isset($formaPag[99]))) { |
|
| 617 | 617 | $y = $y; |
| 618 | 618 | } else { |
| 619 | 619 | //caso tenha mais de uma forma de pagamento ou seja diferente de boleto exibe a |
| 620 | 620 | //forma de pagamento e o valor |
| 621 | - $y = $this->pagamentoDANFE($x, $y+1); |
|
| 621 | + $y = $this->pagamentoDANFE($x, $y + 1); |
|
| 622 | 622 | } |
| 623 | 623 | } |
| 624 | 624 | //coloca os dados dos impostos e totais da NFe |
| 625 | - $y = $this->impostoDANFE($x, $y+1); |
|
| 625 | + $y = $this->impostoDANFE($x, $y + 1); |
|
| 626 | 626 | //coloca os dados do trasnporte |
| 627 | - $y = $this->transporteDANFE($x, $y+1); |
|
| 627 | + $y = $this->transporteDANFE($x, $y + 1); |
|
| 628 | 628 | //itens da DANFE |
| 629 | 629 | $nInicial = 0; |
| 630 | 630 | |
| 631 | - $y = $this->itensDANFE($x, $y+1, $nInicial, $hDispo1, $pag, $totPag, $hCabecItens); |
|
| 631 | + $y = $this->itensDANFE($x, $y + 1, $nInicial, $hDispo1, $pag, $totPag, $hCabecItens); |
|
| 632 | 632 | |
| 633 | 633 | //coloca os dados do ISSQN |
| 634 | 634 | if ($linhaISSQN == 1) { |
| 635 | - $y = $this->issqnDANFE($x, $y+4); |
|
| 635 | + $y = $this->issqnDANFE($x, $y + 4); |
|
| 636 | 636 | } else { |
| 637 | 637 | $y += 4; |
| 638 | 638 | } |
@@ -640,7 +640,7 @@ discard block |
||
| 640 | 640 | $y = $this->dadosAdicionaisDANFE($x, $y, $hdadosadic); |
| 641 | 641 | //coloca o rodapé da página |
| 642 | 642 | if ($this->orientacao == 'P') { |
| 643 | - $this->rodape($xInic, $y-1); |
|
| 643 | + $this->rodape($xInic, $y - 1); |
|
| 644 | 644 | } else { |
| 645 | 645 | $this->rodape($xInic, $this->hPrint + 1); |
| 646 | 646 | } |
@@ -661,7 +661,7 @@ discard block |
||
| 661 | 661 | //coloca o cabeçalho na página adicional |
| 662 | 662 | $y = $this->cabecalhoDANFE($x, $y, $n, $totPag); |
| 663 | 663 | //coloca os itens na página adicional |
| 664 | - $y = $this->itensDANFE($x, $y+1, $nInicial, $hDispo2, $n, $totPag, $hCabecItens); |
|
| 664 | + $y = $this->itensDANFE($x, $y + 1, $nInicial, $hDispo2, $n, $totPag, $hCabecItens); |
|
| 665 | 665 | //coloca o rodapé da página |
| 666 | 666 | if ($this->orientacao == 'P') { |
| 667 | 667 | $this->rodape($xInic, $y + 4); |
@@ -698,7 +698,7 @@ discard block |
||
| 698 | 698 | if ($startPos === false) { |
| 699 | 699 | return $cdata; |
| 700 | 700 | } |
| 701 | - for ($x=$len; $x>0; $x--) { |
|
| 701 | + for ($x = $len; $x > 0; $x--) { |
|
| 702 | 702 | if (substr($cdata, $x, 1) == '>') { |
| 703 | 703 | $endPos = $x; |
| 704 | 704 | break; |
@@ -709,15 +709,15 @@ discard block |
||
| 709 | 709 | } else { |
| 710 | 710 | $parte1 = ''; |
| 711 | 711 | } |
| 712 | - $parte2 = substr($cdata, $startPos, $endPos-$startPos+1); |
|
| 712 | + $parte2 = substr($cdata, $startPos, $endPos - $startPos + 1); |
|
| 713 | 713 | if ($endPos < $len) { |
| 714 | 714 | $parte3 = substr($cdata, $endPos + 1, $len - $endPos - 1); |
| 715 | 715 | } else { |
| 716 | 716 | $parte3 = ''; |
| 717 | 717 | } |
| 718 | - $texto = trim($parte1).' '.trim($parte3); |
|
| 718 | + $texto = trim($parte1) . ' ' . trim($parte3); |
|
| 719 | 719 | if (strpos($parte2, '<CDATA>') === false) { |
| 720 | - $cdata = '<CDATA>'.$parte2.'</CDATA>'; |
|
| 720 | + $cdata = '<CDATA>' . $parte2 . '</CDATA>'; |
|
| 721 | 721 | } else { |
| 722 | 722 | $cdata = $parte2; |
| 723 | 723 | } |
@@ -791,15 +791,15 @@ discard block |
||
| 791 | 791 | //grupo CADATA infCpl |
| 792 | 792 | $t = $dom->getElementsByTagName('transmissor')->item(0); |
| 793 | 793 | $r = $dom->getElementsByTagName('receptor')->item(0); |
| 794 | - $versao = ! empty($dom->getElementsByTagName('versao')->item(0)->nodeValue) ? |
|
| 795 | - 'Versao:'.$dom->getElementsByTagName('versao')->item(0)->nodeValue.' ' : ''; |
|
| 796 | - $especieNF = ! empty($dom->getElementsByTagName('especieNF')->item(0)->nodeValue) ? |
|
| 797 | - 'Especie:'.$dom->getElementsByTagName('especieNF')->item(0)->nodeValue.' ' : ''; |
|
| 798 | - $fabEntrega = ! empty($dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue) ? |
|
| 799 | - 'Entrega:'.$dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue.' ' : ''; |
|
| 800 | - $dca = ! empty($dom->getElementsByTagName('dca')->item(0)->nodeValue) ? |
|
| 801 | - 'dca:'.$dom->getElementsByTagName('dca')->item(0)->nodeValue.' ' : ''; |
|
| 802 | - $texto .= "".$versao.$especieNF.$fabEntrega.$dca; |
|
| 794 | + $versao = !empty($dom->getElementsByTagName('versao')->item(0)->nodeValue) ? |
|
| 795 | + 'Versao:' . $dom->getElementsByTagName('versao')->item(0)->nodeValue . ' ' : ''; |
|
| 796 | + $especieNF = !empty($dom->getElementsByTagName('especieNF')->item(0)->nodeValue) ? |
|
| 797 | + 'Especie:' . $dom->getElementsByTagName('especieNF')->item(0)->nodeValue . ' ' : ''; |
|
| 798 | + $fabEntrega = !empty($dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue) ? |
|
| 799 | + 'Entrega:' . $dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue . ' ' : ''; |
|
| 800 | + $dca = !empty($dom->getElementsByTagName('dca')->item(0)->nodeValue) ? |
|
| 801 | + 'dca:' . $dom->getElementsByTagName('dca')->item(0)->nodeValue . ' ' : ''; |
|
| 802 | + $texto .= "" . $versao . $especieNF . $fabEntrega . $dca; |
|
| 803 | 803 | if (isset($t)) { |
| 804 | 804 | if ($t->hasAttributes()) { |
| 805 | 805 | $texto .= " Transmissor "; |
@@ -883,14 +883,14 @@ discard block |
||
| 883 | 883 | } |
| 884 | 884 | //#################################################################################### |
| 885 | 885 | //coluna esquerda identificação do emitente |
| 886 | - $w = round($maxW*0.41, 0); |
|
| 886 | + $w = round($maxW * 0.41, 0); |
|
| 887 | 887 | if ($this->orientacao == 'P') { |
| 888 | 888 | $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>'I']; |
| 889 | 889 | } else { |
| 890 | 890 | $aFont = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B']; |
| 891 | 891 | } |
| 892 | 892 | $w1 = $w; |
| 893 | - $h=32; |
|
| 893 | + $h = 32; |
|
| 894 | 894 | $oldY += $h; |
| 895 | 895 | $this->pdf->textBox($x, $y, $w, $h); |
| 896 | 896 | $texto = 'IDENTIFICAÇÃO DO EMITENTE'; |
@@ -911,39 +911,39 @@ discard block |
||
| 911 | 911 | $type == 'jpg'; |
| 912 | 912 | } |
| 913 | 913 | //largura da imagem em mm |
| 914 | - $logoWmm = ($logoInfo[0]/72)*25.4; |
|
| 914 | + $logoWmm = ($logoInfo[0] / 72) * 25.4; |
|
| 915 | 915 | //altura da imagem em mm |
| 916 | - $logoHmm = ($logoInfo[1]/72)*25.4; |
|
| 917 | - if ($this->logoAlign=='L') { |
|
| 918 | - $nImgW = round($w/3, 0); |
|
| 919 | - $nImgH = round($logoHmm * ($nImgW/$logoWmm), 0); |
|
| 920 | - $xImg = $x+1; |
|
| 921 | - $yImg = round(($h-$nImgH)/2, 0)+$y; |
|
| 916 | + $logoHmm = ($logoInfo[1] / 72) * 25.4; |
|
| 917 | + if ($this->logoAlign == 'L') { |
|
| 918 | + $nImgW = round($w / 3, 0); |
|
| 919 | + $nImgH = round($logoHmm * ($nImgW / $logoWmm), 0); |
|
| 920 | + $xImg = $x + 1; |
|
| 921 | + $yImg = round(($h - $nImgH) / 2, 0) + $y; |
|
| 922 | 922 | //estabelecer posições do texto |
| 923 | - $x1 = round($xImg + $nImgW +1, 0); |
|
| 924 | - $y1 = round($h/3+$y, 0); |
|
| 925 | - $tw = round(2*$w/3, 0); |
|
| 926 | - } elseif ($this->logoAlign=='C') { |
|
| 927 | - $nImgH = round($h/3, 0); |
|
| 928 | - $nImgW = round($logoWmm * ($nImgH/$logoHmm), 0); |
|
| 929 | - $xImg = round(($w-$nImgW)/2+$x, 0); |
|
| 930 | - $yImg = $y+3; |
|
| 923 | + $x1 = round($xImg + $nImgW + 1, 0); |
|
| 924 | + $y1 = round($h / 3 + $y, 0); |
|
| 925 | + $tw = round(2 * $w / 3, 0); |
|
| 926 | + } elseif ($this->logoAlign == 'C') { |
|
| 927 | + $nImgH = round($h / 3, 0); |
|
| 928 | + $nImgW = round($logoWmm * ($nImgH / $logoHmm), 0); |
|
| 929 | + $xImg = round(($w - $nImgW) / 2 + $x, 0); |
|
| 930 | + $yImg = $y + 3; |
|
| 931 | 931 | $x1 = $x; |
| 932 | 932 | $y1 = round($yImg + $nImgH + 1, 0); |
| 933 | 933 | $tw = $w; |
| 934 | - } elseif ($this->logoAlign=='R') { |
|
| 935 | - $nImgW = round($w/3, 0); |
|
| 936 | - $nImgH = round($logoHmm * ($nImgW/$logoWmm), 0); |
|
| 937 | - $xImg = round($x+($w-(1+$nImgW)), 0); |
|
| 938 | - $yImg = round(($h-$nImgH)/2, 0)+$y; |
|
| 934 | + } elseif ($this->logoAlign == 'R') { |
|
| 935 | + $nImgW = round($w / 3, 0); |
|
| 936 | + $nImgH = round($logoHmm * ($nImgW / $logoWmm), 0); |
|
| 937 | + $xImg = round($x + ($w - (1 + $nImgW)), 0); |
|
| 938 | + $yImg = round(($h - $nImgH) / 2, 0) + $y; |
|
| 939 | 939 | $x1 = $x; |
| 940 | - $y1 = round($h/3+$y, 0); |
|
| 941 | - $tw = round(2*$w/3, 0); |
|
| 942 | - } elseif ($this->logoAlign=='F') { |
|
| 943 | - $nImgH = round($h-5, 0); |
|
| 944 | - $nImgW = round($logoWmm * ($nImgH/$logoHmm), 0); |
|
| 945 | - $xImg = round(($w-$nImgW)/2+$x, 0); |
|
| 946 | - $yImg = $y+3; |
|
| 940 | + $y1 = round($h / 3 + $y, 0); |
|
| 941 | + $tw = round(2 * $w / 3, 0); |
|
| 942 | + } elseif ($this->logoAlign == 'F') { |
|
| 943 | + $nImgH = round($h - 5, 0); |
|
| 944 | + $nImgW = round($logoWmm * ($nImgH / $logoHmm), 0); |
|
| 945 | + $xImg = round(($w - $nImgW) / 2 + $x, 0); |
|
| 946 | + $yImg = $y + 3; |
|
| 947 | 947 | $x1 = $x; |
| 948 | 948 | $y1 = round($yImg + $nImgH + 1, 0); |
| 949 | 949 | $tw = $w; |
@@ -952,7 +952,7 @@ discard block |
||
| 952 | 952 | $this->pdf->Image($this->logomarca, $xImg, $yImg, $nImgW, $nImgH, $type); |
| 953 | 953 | } else { |
| 954 | 954 | $x1 = $x; |
| 955 | - $y1 = round($h/3+$y, 0); |
|
| 955 | + $y1 = round($h / 3 + $y, 0); |
|
| 956 | 956 | $tw = $w; |
| 957 | 957 | } |
| 958 | 958 | // monta as informações apenas se diferente de full logo |
@@ -962,9 +962,9 @@ discard block |
||
| 962 | 962 | $texto = $this->emit->getElementsByTagName("xNome")->item(0)->nodeValue; |
| 963 | 963 | $this->pdf->textBox($x1, $y1, $tw, 8, $texto, $aFont, 'T', 'C', 0, ''); |
| 964 | 964 | //endereço |
| 965 | - $y1 = $y1+5; |
|
| 965 | + $y1 = $y1 + 5; |
|
| 966 | 966 | $aFont = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>'']; |
| 967 | - $fone = ! empty($this->enderEmit->getElementsByTagName("fone")->item(0)->nodeValue) |
|
| 967 | + $fone = !empty($this->enderEmit->getElementsByTagName("fone")->item(0)->nodeValue) |
|
| 968 | 968 | ? $this->enderEmit->getElementsByTagName("fone")->item(0)->nodeValue |
| 969 | 969 | : ''; |
| 970 | 970 | $lgr = $this->getTagValue($this->enderEmit, "xLgr"); |
@@ -984,34 +984,34 @@ discard block |
||
| 984 | 984 | //#################################################################################### |
| 985 | 985 | //coluna central Danfe |
| 986 | 986 | $x += $w; |
| 987 | - $w=round($maxW * 0.17, 0);//35; |
|
| 987 | + $w = round($maxW * 0.17, 0); //35; |
|
| 988 | 988 | $w2 = $w; |
| 989 | 989 | $h = 32; |
| 990 | 990 | $this->pdf->textBox($x, $y, $w, $h); |
| 991 | 991 | |
| 992 | 992 | $texto = "DANFE"; |
| 993 | 993 | $aFont = ['font'=>$this->fontePadrao, 'size'=>14, 'style'=>'B']; |
| 994 | - $this->pdf->textBox($x, $y+1, $w, $h, $texto, $aFont, 'T', 'C', 0, ''); |
|
| 994 | + $this->pdf->textBox($x, $y + 1, $w, $h, $texto, $aFont, 'T', 'C', 0, ''); |
|
| 995 | 995 | $aFont = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>'']; |
| 996 | 996 | $texto = 'Documento Auxiliar da Nota Fiscal Eletrônica'; |
| 997 | 997 | $h = 20; |
| 998 | - $this->pdf->textBox($x, $y+6, $w, $h, $texto, $aFont, 'T', 'C', 0, '', false); |
|
| 998 | + $this->pdf->textBox($x, $y + 6, $w, $h, $texto, $aFont, 'T', 'C', 0, '', false); |
|
| 999 | 999 | |
| 1000 | 1000 | |
| 1001 | 1001 | $aFont = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>'']; |
| 1002 | 1002 | $texto = '0 - ENTRADA'; |
| 1003 | 1003 | $y1 = $y + 14; |
| 1004 | 1004 | $h = 8; |
| 1005 | - $this->pdf->textBox($x+2, $y1, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
| 1005 | + $this->pdf->textBox($x + 2, $y1, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
| 1006 | 1006 | $texto = '1 - SAÍDA'; |
| 1007 | 1007 | $y1 = $y + 17; |
| 1008 | - $this->pdf->textBox($x+2, $y1, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
| 1008 | + $this->pdf->textBox($x + 2, $y1, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
| 1009 | 1009 | //tipo de nF |
| 1010 | 1010 | $aFont = ['font'=>$this->fontePadrao, 'size'=>12, 'style'=>'B']; |
| 1011 | 1011 | $y1 = $y + 13; |
| 1012 | 1012 | $h = 7; |
| 1013 | 1013 | $texto = $this->ide->getElementsByTagName('tpNF')->item(0)->nodeValue; |
| 1014 | - $this->pdf->textBox($x+27, $y1, 5, $h, $texto, $aFont, 'C', 'C', 1, ''); |
|
| 1014 | + $this->pdf->textBox($x + 27, $y1, 5, $h, $texto, $aFont, 'C', 'C', 1, ''); |
|
| 1015 | 1015 | //numero da NF |
| 1016 | 1016 | $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B']; |
| 1017 | 1017 | $y1 = $y + 20; |
@@ -1033,7 +1033,7 @@ discard block |
||
| 1033 | 1033 | //#################################################################################### |
| 1034 | 1034 | //coluna codigo de barras |
| 1035 | 1035 | $x += $w; |
| 1036 | - $w = ($maxW-$w1-$w2);//85; |
|
| 1036 | + $w = ($maxW - $w1 - $w2); //85; |
|
| 1037 | 1037 | $w3 = $w; |
| 1038 | 1038 | $h = 32; |
| 1039 | 1039 | $this->pdf->textBox($x, $y, $w, $h); |
@@ -1042,22 +1042,22 @@ discard block |
||
| 1042 | 1042 | $bW = 75; |
| 1043 | 1043 | $bH = 12; |
| 1044 | 1044 | //codigo de barras |
| 1045 | - $this->pdf->code128($x+(($w-$bW)/2), $y+2, $chave_acesso, $bW, $bH); |
|
| 1045 | + $this->pdf->code128($x + (($w - $bW) / 2), $y + 2, $chave_acesso, $bW, $bH); |
|
| 1046 | 1046 | //linhas divisorias |
| 1047 | - $this->pdf->line($x, $y+4+$bH, $x+$w, $y+4+$bH); |
|
| 1048 | - $this->pdf->line($x, $y+12+$bH, $x+$w, $y+12+$bH); |
|
| 1047 | + $this->pdf->line($x, $y + 4 + $bH, $x + $w, $y + 4 + $bH); |
|
| 1048 | + $this->pdf->line($x, $y + 12 + $bH, $x + $w, $y + 12 + $bH); |
|
| 1049 | 1049 | $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>'']; |
| 1050 | - $y1 = $y+4+$bH; |
|
| 1050 | + $y1 = $y + 4 + $bH; |
|
| 1051 | 1051 | $h = 7; |
| 1052 | 1052 | $texto = 'CHAVE DE ACESSO'; |
| 1053 | 1053 | $this->pdf->textBox($x, $y1, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
| 1054 | 1054 | $aFont = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B']; |
| 1055 | - $y1 = $y+8+$bH; |
|
| 1055 | + $y1 = $y + 8 + $bH; |
|
| 1056 | 1056 | $texto = $this->formatField($chave_acesso, $this->formatoChave); |
| 1057 | - $this->pdf->textBox($x+2, $y1, $w-2, $h, $texto, $aFont, 'T', 'C', 0, ''); |
|
| 1058 | - $y1 = $y+12+$bH; |
|
| 1057 | + $this->pdf->textBox($x + 2, $y1, $w - 2, $h, $texto, $aFont, 'T', 'C', 0, ''); |
|
| 1058 | + $y1 = $y + 12 + $bH; |
|
| 1059 | 1059 | $aFont = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>'']; |
| 1060 | - $chaveContingencia=""; |
|
| 1060 | + $chaveContingencia = ""; |
|
| 1061 | 1061 | if ($this->notaDpec()) { |
| 1062 | 1062 | $cabecalhoProtoAutorizacao = 'NÚMERO DE REGISTRO DPEC'; |
| 1063 | 1063 | } else { |
@@ -1068,16 +1068,16 @@ discard block |
||
| 1068 | 1068 | $chaveContingencia = $this->geraChaveAdicionalDeContingencia(); |
| 1069 | 1069 | $this->pdf->setFillColor(0, 0, 0); |
| 1070 | 1070 | //codigo de barras |
| 1071 | - $this->pdf->code128($x+11, $y1+1, $chaveContingencia, $bW*.9, $bH/2); |
|
| 1071 | + $this->pdf->code128($x + 11, $y1 + 1, $chaveContingencia, $bW * .9, $bH / 2); |
|
| 1072 | 1072 | } else { |
| 1073 | 1073 | $texto = 'Consulta de autenticidade no portal nacional da NF-e'; |
| 1074 | - $this->pdf->textBox($x+2, $y1, $w-2, $h, $texto, $aFont, 'T', 'C', 0, ''); |
|
| 1075 | - $y1 = $y+16+$bH; |
|
| 1074 | + $this->pdf->textBox($x + 2, $y1, $w - 2, $h, $texto, $aFont, 'T', 'C', 0, ''); |
|
| 1075 | + $y1 = $y + 16 + $bH; |
|
| 1076 | 1076 | $texto = 'www.nfe.fazenda.gov.br/portal ou no site da Sefaz Autorizadora'; |
| 1077 | 1077 | $this->pdf->textBox( |
| 1078 | - $x+2, |
|
| 1078 | + $x + 2, |
|
| 1079 | 1079 | $y1, |
| 1080 | - $w-2, |
|
| 1080 | + $w - 2, |
|
| 1081 | 1081 | $h, |
| 1082 | 1082 | $texto, |
| 1083 | 1083 | $aFont, |
@@ -1093,7 +1093,7 @@ discard block |
||
| 1093 | 1093 | //natureza da operação |
| 1094 | 1094 | $texto = 'NATUREZA DA OPERAÇÃO'; |
| 1095 | 1095 | $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>'']; |
| 1096 | - $w = $w1+$w2; |
|
| 1096 | + $w = $w1 + $w2; |
|
| 1097 | 1097 | $y = $oldY; |
| 1098 | 1098 | $oldY += $h; |
| 1099 | 1099 | $x = $oldX; |
@@ -1123,7 +1123,7 @@ discard block |
||
| 1123 | 1123 | $cStat = ''; |
| 1124 | 1124 | } else { |
| 1125 | 1125 | if (isset($this->nfeProc)) { |
| 1126 | - $texto = ! empty($this->nfeProc->getElementsByTagName("nProt")->item(0)->nodeValue) ? |
|
| 1126 | + $texto = !empty($this->nfeProc->getElementsByTagName("nProt")->item(0)->nodeValue) ? |
|
| 1127 | 1127 | $this->nfeProc->getElementsByTagName("nProt")->item(0)->nodeValue : ''; |
| 1128 | 1128 | $tsHora = $this->convertTime($this->nfeProc->getElementsByTagName("dhRecbto")->item(0)->nodeValue); |
| 1129 | 1129 | if ($texto != '') { |
@@ -1154,25 +1154,25 @@ discard block |
||
| 1154 | 1154 | $texto = 'INSCRIÇÃO ESTADUAL DO SUBST. TRIBUT.'; |
| 1155 | 1155 | $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>'']; |
| 1156 | 1156 | $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, ''); |
| 1157 | - $texto = ! empty($this->emit->getElementsByTagName("IEST")->item(0)->nodeValue) |
|
| 1157 | + $texto = !empty($this->emit->getElementsByTagName("IEST")->item(0)->nodeValue) |
|
| 1158 | 1158 | ? $this->emit->getElementsByTagName("IEST")->item(0)->nodeValue |
| 1159 | 1159 | : ''; |
| 1160 | 1160 | $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B']; |
| 1161 | 1161 | $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, ''); |
| 1162 | 1162 | //CNPJ |
| 1163 | 1163 | $x += $w; |
| 1164 | - $w = ($maxW-(2*$w)); |
|
| 1164 | + $w = ($maxW - (2 * $w)); |
|
| 1165 | 1165 | $texto = 'CNPJ / CPF'; |
| 1166 | 1166 | $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>'']; |
| 1167 | 1167 | $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, ''); |
| 1168 | 1168 | //Pegando valor do CPF/CNPJ |
| 1169 | - if (! empty($this->emit->getElementsByTagName("CNPJ")->item(0)->nodeValue)) { |
|
| 1169 | + if (!empty($this->emit->getElementsByTagName("CNPJ")->item(0)->nodeValue)) { |
|
| 1170 | 1170 | $texto = $this->formatField( |
| 1171 | 1171 | $this->emit->getElementsByTagName("CNPJ")->item(0)->nodeValue, |
| 1172 | 1172 | "###.###.###/####-##" |
| 1173 | 1173 | ); |
| 1174 | 1174 | } else { |
| 1175 | - $texto = ! empty($this->emit->getElementsByTagName("CPF")->item(0)->nodeValue) ? |
|
| 1175 | + $texto = !empty($this->emit->getElementsByTagName("CPF")->item(0)->nodeValue) ? |
|
| 1176 | 1176 | $this->formatField( |
| 1177 | 1177 | $this->emit->getElementsByTagName("CPF")->item(0)->nodeValue, |
| 1178 | 1178 | "###.###.###-##" |
@@ -1188,22 +1188,22 @@ discard block |
||
| 1188 | 1188 | $resp = $this->statusNFe(); |
| 1189 | 1189 | if (!$resp['status']) { |
| 1190 | 1190 | $x = 10; |
| 1191 | - $y = $this->hPrint-130; |
|
| 1191 | + $y = $this->hPrint - 130; |
|
| 1192 | 1192 | $h = 25; |
| 1193 | - $w = $maxW-(2*$x); |
|
| 1193 | + $w = $maxW - (2 * $x); |
|
| 1194 | 1194 | $this->pdf->setTextColor(90, 90, 90); |
| 1195 | 1195 | $texto = $resp['message']; |
| 1196 | 1196 | $aFont = ['font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B']; |
| 1197 | 1197 | $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, ''); |
| 1198 | 1198 | $y += $h; |
| 1199 | 1199 | $h = 5; |
| 1200 | - $w = $maxW-(2*$x); |
|
| 1200 | + $w = $maxW - (2 * $x); |
|
| 1201 | 1201 | if (isset($this->infProt) && $resp['status']) { |
| 1202 | 1202 | $xMotivo = $this->infProt->getElementsByTagName("xMotivo")->item(0)->nodeValue; |
| 1203 | 1203 | } else { |
| 1204 | 1204 | $xMotivo = ''; |
| 1205 | 1205 | } |
| 1206 | - $texto = "SEM VALOR FISCAL\n".$xMotivo; |
|
| 1206 | + $texto = "SEM VALOR FISCAL\n" . $xMotivo; |
|
| 1207 | 1207 | $aFont = ['font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B']; |
| 1208 | 1208 | $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, ''); |
| 1209 | 1209 | $this->pdf->setTextColor(0, 0, 0); |
@@ -1226,12 +1226,12 @@ discard block |
||
| 1226 | 1226 | if ($this->notaDpec() || $this->tpEmis == 4) { |
| 1227 | 1227 | //DPEC |
| 1228 | 1228 | $x = 10; |
| 1229 | - $y = $this->hPrint-130; |
|
| 1229 | + $y = $this->hPrint - 130; |
|
| 1230 | 1230 | $h = 25; |
| 1231 | - $w = $maxW-(2*$x); |
|
| 1231 | + $w = $maxW - (2 * $x); |
|
| 1232 | 1232 | $this->pdf->SetTextColor(200, 200, 200); |
| 1233 | - $texto = "DANFE impresso em contingência -\n". |
|
| 1234 | - "DPEC regularmente recebido pela Receita\n". |
|
| 1233 | + $texto = "DANFE impresso em contingência -\n" . |
|
| 1234 | + "DPEC regularmente recebido pela Receita\n" . |
|
| 1235 | 1235 | "Federal do Brasil"; |
| 1236 | 1236 | $aFont = ['font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B']; |
| 1237 | 1237 | $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, ''); |
@@ -1350,7 +1350,7 @@ discard block |
||
| 1350 | 1350 | $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B']; |
| 1351 | 1351 | $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
| 1352 | 1352 | //NOME / RAZÃO SOCIAL |
| 1353 | - $w = round($maxW*0.61, 0); |
|
| 1353 | + $w = round($maxW * 0.61, 0); |
|
| 1354 | 1354 | $w1 = $w; |
| 1355 | 1355 | $y += 3; |
| 1356 | 1356 | $texto = 'NOME / RAZÃO SOCIAL'; |
@@ -1365,19 +1365,19 @@ discard block |
||
| 1365 | 1365 | } |
| 1366 | 1366 | //CNPJ / CPF |
| 1367 | 1367 | $x += $w; |
| 1368 | - $w = round($maxW*0.23, 0); |
|
| 1368 | + $w = round($maxW * 0.23, 0); |
|
| 1369 | 1369 | $w2 = $w; |
| 1370 | 1370 | $texto = 'CNPJ / CPF'; |
| 1371 | 1371 | $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>'']; |
| 1372 | 1372 | $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, ''); |
| 1373 | 1373 | //Pegando valor do CPF/CNPJ |
| 1374 | - if (! empty($this->dest->getElementsByTagName("CNPJ")->item(0)->nodeValue)) { |
|
| 1374 | + if (!empty($this->dest->getElementsByTagName("CNPJ")->item(0)->nodeValue)) { |
|
| 1375 | 1375 | $texto = $this->formatField( |
| 1376 | 1376 | $this->dest->getElementsByTagName("CNPJ")->item(0)->nodeValue, |
| 1377 | 1377 | "###.###.###/####-##" |
| 1378 | 1378 | ); |
| 1379 | 1379 | } else { |
| 1380 | - $texto = ! empty($this->dest->getElementsByTagName("CPF")->item(0)->nodeValue) ? |
|
| 1380 | + $texto = !empty($this->dest->getElementsByTagName("CPF")->item(0)->nodeValue) ? |
|
| 1381 | 1381 | $this->formatField( |
| 1382 | 1382 | $this->dest->getElementsByTagName("CPF")->item(0)->nodeValue, |
| 1383 | 1383 | "###.###.###-##" |
@@ -1387,15 +1387,15 @@ discard block |
||
| 1387 | 1387 | $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, ''); |
| 1388 | 1388 | //DATA DA EMISSÃO |
| 1389 | 1389 | $x += $w; |
| 1390 | - $w = $maxW-($w1+$w2); |
|
| 1390 | + $w = $maxW - ($w1 + $w2); |
|
| 1391 | 1391 | $wx = $w; |
| 1392 | 1392 | $texto = 'DATA DA EMISSÃO'; |
| 1393 | 1393 | $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>'']; |
| 1394 | 1394 | $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, ''); |
| 1395 | - $dEmi = ! empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ? |
|
| 1395 | + $dEmi = !empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ? |
|
| 1396 | 1396 | $this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue : ''; |
| 1397 | 1397 | if ($dEmi == '') { |
| 1398 | - $dEmi = ! empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ? |
|
| 1398 | + $dEmi = !empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ? |
|
| 1399 | 1399 | $this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue : ''; |
| 1400 | 1400 | $aDemi = explode('T', $dEmi); |
| 1401 | 1401 | $dEmi = $aDemi[0]; |
@@ -1408,7 +1408,7 @@ discard block |
||
| 1408 | 1408 | $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 1, ''); |
| 1409 | 1409 | } |
| 1410 | 1410 | //ENDEREÇO |
| 1411 | - $w = round($maxW*0.47, 0); |
|
| 1411 | + $w = round($maxW * 0.47, 0); |
|
| 1412 | 1412 | $w1 = $w; |
| 1413 | 1413 | $y += $h; |
| 1414 | 1414 | $x = $oldX; |
@@ -1423,7 +1423,7 @@ discard block |
||
| 1423 | 1423 | $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 0, '', true); |
| 1424 | 1424 | //BAIRRO / DISTRITO |
| 1425 | 1425 | $x += $w; |
| 1426 | - $w = round($maxW*0.21, 0); |
|
| 1426 | + $w = round($maxW * 0.21, 0); |
|
| 1427 | 1427 | $w2 = $w; |
| 1428 | 1428 | $texto = 'BAIRRO / DISTRITO'; |
| 1429 | 1429 | $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>'']; |
@@ -1433,12 +1433,12 @@ discard block |
||
| 1433 | 1433 | $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, ''); |
| 1434 | 1434 | //CEP |
| 1435 | 1435 | $x += $w; |
| 1436 | - $w = $maxW-$w1-$w2-$wx; |
|
| 1436 | + $w = $maxW - $w1 - $w2 - $wx; |
|
| 1437 | 1437 | $w2 = $w; |
| 1438 | 1438 | $texto = 'CEP'; |
| 1439 | 1439 | $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>'']; |
| 1440 | 1440 | $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, ''); |
| 1441 | - $texto = ! empty($this->dest->getElementsByTagName("CEP")->item(0)->nodeValue) ? |
|
| 1441 | + $texto = !empty($this->dest->getElementsByTagName("CEP")->item(0)->nodeValue) ? |
|
| 1442 | 1442 | $this->dest->getElementsByTagName("CEP")->item(0)->nodeValue : ''; |
| 1443 | 1443 | $texto = $this->formatField($texto, "#####-###"); |
| 1444 | 1444 | $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B']; |
@@ -1449,10 +1449,10 @@ discard block |
||
| 1449 | 1449 | $texto = 'DATA DA SAÍDA/ENTRADA'; |
| 1450 | 1450 | $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>'']; |
| 1451 | 1451 | $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, ''); |
| 1452 | - $dSaiEnt = ! empty($this->ide->getElementsByTagName("dSaiEnt")->item(0)->nodeValue) ? |
|
| 1452 | + $dSaiEnt = !empty($this->ide->getElementsByTagName("dSaiEnt")->item(0)->nodeValue) ? |
|
| 1453 | 1453 | $this->ide->getElementsByTagName("dSaiEnt")->item(0)->nodeValue : ''; |
| 1454 | 1454 | if ($dSaiEnt == '') { |
| 1455 | - $dSaiEnt = ! empty($this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue) ? |
|
| 1455 | + $dSaiEnt = !empty($this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue) ? |
|
| 1456 | 1456 | $this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue : ''; |
| 1457 | 1457 | $aDsaient = explode('T', $dSaiEnt); |
| 1458 | 1458 | $dSaiEnt = $aDsaient[0]; |
@@ -1469,7 +1469,7 @@ discard block |
||
| 1469 | 1469 | $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, ''); |
| 1470 | 1470 | $texto = $this->dest->getElementsByTagName("xMun")->item(0)->nodeValue; |
| 1471 | 1471 | if (strtoupper(trim($texto)) == "EXTERIOR" && $this->dest->getElementsByTagName("xPais")->length > 0) { |
| 1472 | - $texto .= " - " . $this->dest->getElementsByTagName("xPais")->item(0)->nodeValue; |
|
| 1472 | + $texto .= " - " . $this->dest->getElementsByTagName("xPais")->item(0)->nodeValue; |
|
| 1473 | 1473 | } |
| 1474 | 1474 | $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B']; |
| 1475 | 1475 | $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 0, ''); |
@@ -1484,18 +1484,18 @@ discard block |
||
| 1484 | 1484 | $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, ''); |
| 1485 | 1485 | //FONE / FAX |
| 1486 | 1486 | $x += $w; |
| 1487 | - $w = round(($maxW -$w1-$wx-8)/2, 0); |
|
| 1487 | + $w = round(($maxW - $w1 - $wx - 8) / 2, 0); |
|
| 1488 | 1488 | $w3 = $w; |
| 1489 | 1489 | $texto = 'FONE / FAX'; |
| 1490 | 1490 | $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>'']; |
| 1491 | 1491 | $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, ''); |
| 1492 | - $texto = ! empty($this->dest->getElementsByTagName("fone")->item(0)->nodeValue) ? |
|
| 1492 | + $texto = !empty($this->dest->getElementsByTagName("fone")->item(0)->nodeValue) ? |
|
| 1493 | 1493 | $this->dest->getElementsByTagName("fone")->item(0)->nodeValue : ''; |
| 1494 | 1494 | $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B']; |
| 1495 | 1495 | $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, ''); |
| 1496 | 1496 | //INSCRIÇÃO ESTADUAL |
| 1497 | 1497 | $x += $w; |
| 1498 | - $w = $maxW -$w1-$wx-8-$w3; |
|
| 1498 | + $w = $maxW - $w1 - $wx - 8 - $w3; |
|
| 1499 | 1499 | $texto = 'INSCRIÇÃO ESTADUAL'; |
| 1500 | 1500 | $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>'']; |
| 1501 | 1501 | $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, ''); |
@@ -1509,10 +1509,10 @@ discard block |
||
| 1509 | 1509 | $texto = 'HORA DA SAÍDA/ENTRADA'; |
| 1510 | 1510 | $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>'']; |
| 1511 | 1511 | $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, ''); |
| 1512 | - $hSaiEnt = ! empty($this->ide->getElementsByTagName("hSaiEnt")->item(0)->nodeValue) ? |
|
| 1512 | + $hSaiEnt = !empty($this->ide->getElementsByTagName("hSaiEnt")->item(0)->nodeValue) ? |
|
| 1513 | 1513 | $this->ide->getElementsByTagName("hSaiEnt")->item(0)->nodeValue : ''; |
| 1514 | 1514 | if ($hSaiEnt == '') { |
| 1515 | - $dhSaiEnt = ! empty($this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue) ? |
|
| 1515 | + $dhSaiEnt = !empty($this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue) ? |
|
| 1516 | 1516 | $this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue : ''; |
| 1517 | 1517 | $tsDhSaiEnt = $this->convertTime($dhSaiEnt); |
| 1518 | 1518 | if ($tsDhSaiEnt != '') { |
@@ -1591,7 +1591,7 @@ discard block |
||
| 1591 | 1591 | protected function faturaDANFE($x, $y) |
| 1592 | 1592 | { |
| 1593 | 1593 | $linha = 1; |
| 1594 | - $h = 8+3; |
|
| 1594 | + $h = 8 + 3; |
|
| 1595 | 1595 | $oldx = $x; |
| 1596 | 1596 | $textoFatura = $this->getTextoFatura(); |
| 1597 | 1597 | //verificar se existem duplicatas |
@@ -1612,27 +1612,27 @@ discard block |
||
| 1612 | 1612 | $dupcont = 0; |
| 1613 | 1613 | $nFat = $this->dup->length; |
| 1614 | 1614 | if ($textoFatura !== "" && $this->exibirTextoFatura) { |
| 1615 | - $myH=6; |
|
| 1615 | + $myH = 6; |
|
| 1616 | 1616 | $myW = $this->wPrint; |
| 1617 | 1617 | if ($this->orientacao == 'L') { |
| 1618 | 1618 | $myW -= $this->wCanhoto; |
| 1619 | 1619 | } |
| 1620 | 1620 | $aFont = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>'']; |
| 1621 | 1621 | $this->pdf->textBox($x, $y, $myW, $myH, $textoFatura, $aFont, 'C', 'L', 1, ''); |
| 1622 | - $y+=$myH+1; |
|
| 1622 | + $y += $myH + 1; |
|
| 1623 | 1623 | } |
| 1624 | 1624 | if ($this->orientacao == 'P') { |
| 1625 | - $w = round($this->wPrint/7.018, 0)-1; |
|
| 1625 | + $w = round($this->wPrint / 7.018, 0) - 1; |
|
| 1626 | 1626 | } else { |
| 1627 | 1627 | $w = 28; |
| 1628 | 1628 | } |
| 1629 | 1629 | $increm = 1; |
| 1630 | 1630 | foreach ($this->dup as $k => $d) { |
| 1631 | - $nDup = ! empty($this->dup->item($k)->getElementsByTagName('nDup')->item(0)->nodeValue) ? |
|
| 1631 | + $nDup = !empty($this->dup->item($k)->getElementsByTagName('nDup')->item(0)->nodeValue) ? |
|
| 1632 | 1632 | $this->dup->item($k)->getElementsByTagName('nDup')->item(0)->nodeValue : ''; |
| 1633 | - $dDup = ! empty($this->dup->item($k)->getElementsByTagName('dVenc')->item(0)->nodeValue) ? |
|
| 1633 | + $dDup = !empty($this->dup->item($k)->getElementsByTagName('dVenc')->item(0)->nodeValue) ? |
|
| 1634 | 1634 | $this->ymdTodmy($this->dup->item($k)->getElementsByTagName('dVenc')->item(0)->nodeValue) : ''; |
| 1635 | - $vDup = ! empty($this->dup->item($k)->getElementsByTagName('vDup')->item(0)->nodeValue) ? |
|
| 1635 | + $vDup = !empty($this->dup->item($k)->getElementsByTagName('vDup')->item(0)->nodeValue) ? |
|
| 1636 | 1636 | 'R$ ' . number_format( |
| 1637 | 1637 | $this->dup->item($k)->getElementsByTagName('vDup')->item(0)->nodeValue, |
| 1638 | 1638 | 2, |
@@ -1641,14 +1641,14 @@ discard block |
||
| 1641 | 1641 | ) : ''; |
| 1642 | 1642 | $h = 8; |
| 1643 | 1643 | $texto = ''; |
| 1644 | - if ($nDup!='0' && $nDup!='') { |
|
| 1644 | + if ($nDup != '0' && $nDup != '') { |
|
| 1645 | 1645 | $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>'']; |
| 1646 | 1646 | $this->pdf->textBox($x, $y, $w, $h, 'Num.', $aFont, 'T', 'L', 1, ''); |
| 1647 | 1647 | $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B']; |
| 1648 | 1648 | $this->pdf->textBox($x, $y, $w, $h, $nDup, $aFont, 'T', 'R', 0, ''); |
| 1649 | 1649 | } else { |
| 1650 | 1650 | $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>'']; |
| 1651 | - $this->pdf->textBox($x, $y, $w, $h, ($dupcont+1)."", $aFont, 'T', 'L', 1, ''); |
|
| 1651 | + $this->pdf->textBox($x, $y, $w, $h, ($dupcont + 1) . "", $aFont, 'T', 'L', 1, ''); |
|
| 1652 | 1652 | } |
| 1653 | 1653 | $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>'']; |
| 1654 | 1654 | $this->pdf->textBox($x, $y, $w, $h, 'Venc.', $aFont, 'C', 'L', 0, ''); |
@@ -1658,7 +1658,7 @@ discard block |
||
| 1658 | 1658 | $this->pdf->textBox($x, $y, $w, $h, 'Valor', $aFont, 'B', 'L', 0, ''); |
| 1659 | 1659 | $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B']; |
| 1660 | 1660 | $this->pdf->textBox($x, $y, $w, $h, $vDup, $aFont, 'B', 'R', 0, ''); |
| 1661 | - $x += $w+$increm; |
|
| 1661 | + $x += $w + $increm; |
|
| 1662 | 1662 | $dupcont += 1; |
| 1663 | 1663 | if ($this->orientacao == 'P') { |
| 1664 | 1664 | $maxDupCont = 6; |
@@ -1680,10 +1680,10 @@ discard block |
||
| 1680 | 1680 | $y -= 9; |
| 1681 | 1681 | $linha--; |
| 1682 | 1682 | } |
| 1683 | - return ($y+$h); |
|
| 1683 | + return ($y + $h); |
|
| 1684 | 1684 | } else { |
| 1685 | 1685 | $linha = 0; |
| 1686 | - return ($y-2); |
|
| 1686 | + return ($y - 2); |
|
| 1687 | 1687 | } |
| 1688 | 1688 | } //fim da função faturaDANFE |
| 1689 | 1689 | |
@@ -1699,7 +1699,7 @@ discard block |
||
| 1699 | 1699 | protected function pagamentoDANFE($x, $y) |
| 1700 | 1700 | { |
| 1701 | 1701 | $linha = 1; |
| 1702 | - $h = 8+3; |
|
| 1702 | + $h = 8 + 3; |
|
| 1703 | 1703 | $oldx = $x; |
| 1704 | 1704 | //verificar se existem cobranças definidas |
| 1705 | 1705 | if (isset($this->detPag) && $this->detPag->length > 0) { |
@@ -1718,7 +1718,7 @@ discard block |
||
| 1718 | 1718 | $dups = ""; |
| 1719 | 1719 | $dupcont = 0; |
| 1720 | 1720 | if ($this->orientacao == 'P') { |
| 1721 | - $w = round($this->wPrint/7.018, 0)-1; |
|
| 1721 | + $w = round($this->wPrint / 7.018, 0) - 1; |
|
| 1722 | 1722 | } else { |
| 1723 | 1723 | $w = 28; |
| 1724 | 1724 | } |
@@ -1728,16 +1728,16 @@ discard block |
||
| 1728 | 1728 | $maxDupCont = 8; |
| 1729 | 1729 | } |
| 1730 | 1730 | $increm = 1; |
| 1731 | - $formaPagamento = ['01'=>'Dinheiro','02'=>'Cheque','03'=>'Cartão de Crédito', |
|
| 1732 | - '04'=>'Cartão de Débito','05'=>'Crédito Loja','10'=>'Vale Alimentação', |
|
| 1733 | - '11'=>'Vale Refeição','12'=>'Vale Presente','13'=>'Vale Combustível', |
|
| 1734 | - '14'=>'Duplicata Mercantil','15'=>'Boleto','90'=>'Sem pagamento','99'=>'Outros']; |
|
| 1735 | - $bandeira = ['01'=>'Visa','02'=>'Mastercard','03'=>'American','04'=>'Sorocred','05'=>'Diners', |
|
| 1736 | - '06'=>'Elo','07'=>'Hipercard','08'=>'Aura','09'=>'Cabal','99'=>'Outros']; |
|
| 1731 | + $formaPagamento = ['01'=>'Dinheiro', '02'=>'Cheque', '03'=>'Cartão de Crédito', |
|
| 1732 | + '04'=>'Cartão de Débito', '05'=>'Crédito Loja', '10'=>'Vale Alimentação', |
|
| 1733 | + '11'=>'Vale Refeição', '12'=>'Vale Presente', '13'=>'Vale Combustível', |
|
| 1734 | + '14'=>'Duplicata Mercantil', '15'=>'Boleto', '90'=>'Sem pagamento', '99'=>'Outros']; |
|
| 1735 | + $bandeira = ['01'=>'Visa', '02'=>'Mastercard', '03'=>'American', '04'=>'Sorocred', '05'=>'Diners', |
|
| 1736 | + '06'=>'Elo', '07'=>'Hipercard', '08'=>'Aura', '09'=>'Cabal', '99'=>'Outros']; |
|
| 1737 | 1737 | foreach ($this->detPag as $k => $d) { |
| 1738 | 1738 | $fPag = !empty($this->detPag->item($k)->getElementsByTagName('tPag')->item(0)->nodeValue) |
| 1739 | 1739 | ? $this->detPag->item($k)->getElementsByTagName('tPag')->item(0)->nodeValue : '0'; |
| 1740 | - $vPag = ! empty($this->detPag->item($k)->getElementsByTagName('vPag')->item(0)->nodeValue) |
|
| 1740 | + $vPag = !empty($this->detPag->item($k)->getElementsByTagName('vPag')->item(0)->nodeValue) |
|
| 1741 | 1741 | ? 'R$ ' . number_format( |
| 1742 | 1742 | $this->detPag->item($k)->getElementsByTagName('vPag')->item(0)->nodeValue, |
| 1743 | 1743 | 2, |
@@ -1748,7 +1748,7 @@ discard block |
||
| 1748 | 1748 | $texto = ''; |
| 1749 | 1749 | if (isset($formaPagamento[$fPag])) { |
| 1750 | 1750 | /*Exibir Item sem pagamento ou outros?*/ |
| 1751 | - if ($fPag=='90' || $fPag=='99') { |
|
| 1751 | + if ($fPag == '90' || $fPag == '99') { |
|
| 1752 | 1752 | continue; |
| 1753 | 1753 | } |
| 1754 | 1754 | $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>'']; |
@@ -1757,16 +1757,16 @@ discard block |
||
| 1757 | 1757 | $this->pdf->textBox($x, $y, $w, $h, $formaPagamento[$fPag], $aFont, 'T', 'R', 0, ''); |
| 1758 | 1758 | } else { |
| 1759 | 1759 | $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'']; |
| 1760 | - $this->pdf->textBox($x, $y, $w, $h, "Forma ".$fPag." não encontrado", $aFont, 'T', 'L', 1, ''); |
|
| 1760 | + $this->pdf->textBox($x, $y, $w, $h, "Forma " . $fPag . " não encontrado", $aFont, 'T', 'L', 1, ''); |
|
| 1761 | 1761 | } |
| 1762 | 1762 | $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>'']; |
| 1763 | 1763 | $this->pdf->textBox($x, $y, $w, $h, 'Valor', $aFont, 'B', 'L', 0, ''); |
| 1764 | 1764 | $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B']; |
| 1765 | 1765 | $this->pdf->textBox($x, $y, $w, $h, $vPag, $aFont, 'B', 'R', 0, ''); |
| 1766 | - $x += $w+$increm; |
|
| 1766 | + $x += $w + $increm; |
|
| 1767 | 1767 | $dupcont += 1; |
| 1768 | 1768 | |
| 1769 | - if ($dupcont>$maxDupCont) { |
|
| 1769 | + if ($dupcont > $maxDupCont) { |
|
| 1770 | 1770 | $y += 9; |
| 1771 | 1771 | $x = $oldx; |
| 1772 | 1772 | $dupcont = 0; |
@@ -1781,10 +1781,10 @@ discard block |
||
| 1781 | 1781 | $y -= 9; |
| 1782 | 1782 | $linha--; |
| 1783 | 1783 | } |
| 1784 | - return ($y+$h); |
|
| 1784 | + return ($y + $h); |
|
| 1785 | 1785 | } else { |
| 1786 | 1786 | $linha = 0; |
| 1787 | - return ($y-2); |
|
| 1787 | + return ($y - 2); |
|
| 1788 | 1788 | } |
| 1789 | 1789 | } //fim da função pagamentoDANFE |
| 1790 | 1790 | |
@@ -1896,7 +1896,7 @@ discard block |
||
| 1896 | 1896 | } |
| 1897 | 1897 | $x = $this->impostoDanfeHelper($x, $y, $w, $h, "V. TOTAL DA NOTA", "vNF"); |
| 1898 | 1898 | |
| 1899 | - return ($y+$h); |
|
| 1899 | + return ($y + $h); |
|
| 1900 | 1900 | } //fim impostoDANFE |
| 1901 | 1901 | |
| 1902 | 1902 | /** |
@@ -1924,13 +1924,13 @@ discard block |
||
| 1924 | 1924 | $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B']; |
| 1925 | 1925 | $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
| 1926 | 1926 | //NOME / RAZÃO SOCIAL |
| 1927 | - $w1 = $maxW*0.29; |
|
| 1927 | + $w1 = $maxW * 0.29; |
|
| 1928 | 1928 | $y += 3; |
| 1929 | 1929 | $texto = 'NOME / RAZÃO SOCIAL'; |
| 1930 | 1930 | $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>'']; |
| 1931 | 1931 | $this->pdf->textBox($x, $y, $w1, $h, $texto, $aFont, 'T', 'L', 1, ''); |
| 1932 | 1932 | if (isset($this->transporta)) { |
| 1933 | - $texto = ! empty($this->transporta->getElementsByTagName("xNome")->item(0)->nodeValue) ? |
|
| 1933 | + $texto = !empty($this->transporta->getElementsByTagName("xNome")->item(0)->nodeValue) ? |
|
| 1934 | 1934 | $this->transporta->getElementsByTagName("xNome")->item(0)->nodeValue : ''; |
| 1935 | 1935 | } else { |
| 1936 | 1936 | $texto = ''; |
@@ -1939,11 +1939,11 @@ discard block |
||
| 1939 | 1939 | $this->pdf->textBox($x, $y, $w1, $h, $texto, $aFont, 'B', 'L', 0, ''); |
| 1940 | 1940 | //FRETE POR CONTA |
| 1941 | 1941 | $x += $w1; |
| 1942 | - $w2 = $maxW*0.15; |
|
| 1942 | + $w2 = $maxW * 0.15; |
|
| 1943 | 1943 | $texto = 'FRETE'; |
| 1944 | 1944 | $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>'']; |
| 1945 | 1945 | $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, ''); |
| 1946 | - $tipoFrete = ! empty($this->transp->getElementsByTagName("modFrete")->item(0)->nodeValue) ? |
|
| 1946 | + $tipoFrete = !empty($this->transp->getElementsByTagName("modFrete")->item(0)->nodeValue) ? |
|
| 1947 | 1947 | $this->transp->getElementsByTagName("modFrete")->item(0)->nodeValue : '0'; |
| 1948 | 1948 | switch ($tipoFrete) { |
| 1949 | 1949 | case 0: |
@@ -1973,7 +1973,7 @@ discard block |
||
| 1973 | 1973 | $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>'']; |
| 1974 | 1974 | $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, ''); |
| 1975 | 1975 | if (isset($this->veicTransp)) { |
| 1976 | - $texto = ! empty($this->veicTransp->getElementsByTagName("RNTC")->item(0)->nodeValue) ? |
|
| 1976 | + $texto = !empty($this->veicTransp->getElementsByTagName("RNTC")->item(0)->nodeValue) ? |
|
| 1977 | 1977 | $this->veicTransp->getElementsByTagName("RNTC")->item(0)->nodeValue : ''; |
| 1978 | 1978 | } else { |
| 1979 | 1979 | $texto = ''; |
@@ -1986,10 +1986,10 @@ discard block |
||
| 1986 | 1986 | $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>'']; |
| 1987 | 1987 | $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, ''); |
| 1988 | 1988 | if (isset($this->veicTransp)) { |
| 1989 | - $texto = ! empty($this->veicTransp->getElementsByTagName("placa")->item(0)->nodeValue) ? |
|
| 1989 | + $texto = !empty($this->veicTransp->getElementsByTagName("placa")->item(0)->nodeValue) ? |
|
| 1990 | 1990 | $this->veicTransp->getElementsByTagName("placa")->item(0)->nodeValue : ''; |
| 1991 | 1991 | } elseif (isset($this->reboque)) { |
| 1992 | - $texto = ! empty($this->reboque->getElementsByTagName("placa")->item(0)->nodeValue) ? |
|
| 1992 | + $texto = !empty($this->reboque->getElementsByTagName("placa")->item(0)->nodeValue) ? |
|
| 1993 | 1993 | $this->reboque->getElementsByTagName("placa")->item(0)->nodeValue : ''; |
| 1994 | 1994 | } else { |
| 1995 | 1995 | $texto = ''; |
@@ -1998,15 +1998,15 @@ discard block |
||
| 1998 | 1998 | $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'B', 'C', 0, ''); |
| 1999 | 1999 | //UF |
| 2000 | 2000 | $x += $w2; |
| 2001 | - $w3 = round($maxW*0.04, 0); |
|
| 2001 | + $w3 = round($maxW * 0.04, 0); |
|
| 2002 | 2002 | $texto = 'UF'; |
| 2003 | 2003 | $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>'']; |
| 2004 | 2004 | $this->pdf->textBox($x, $y, $w3, $h, $texto, $aFont, 'T', 'L', 1, ''); |
| 2005 | 2005 | if (isset($this->veicTransp)) { |
| 2006 | - $texto = ! empty($this->veicTransp->getElementsByTagName("UF")->item(0)->nodeValue) ? |
|
| 2006 | + $texto = !empty($this->veicTransp->getElementsByTagName("UF")->item(0)->nodeValue) ? |
|
| 2007 | 2007 | $this->veicTransp->getElementsByTagName("UF")->item(0)->nodeValue : ''; |
| 2008 | 2008 | } elseif (isset($this->reboque)) { |
| 2009 | - $texto = ! empty($this->reboque->getElementsByTagName("UF")->item(0)->nodeValue) ? |
|
| 2009 | + $texto = !empty($this->reboque->getElementsByTagName("UF")->item(0)->nodeValue) ? |
|
| 2010 | 2010 | $this->reboque->getElementsByTagName("UF")->item(0)->nodeValue : ''; |
| 2011 | 2011 | } else { |
| 2012 | 2012 | $texto = ''; |
@@ -2015,18 +2015,18 @@ discard block |
||
| 2015 | 2015 | $this->pdf->textBox($x, $y, $w3, $h, $texto, $aFont, 'B', 'C', 0, ''); |
| 2016 | 2016 | //CNPJ / CPF |
| 2017 | 2017 | $x += $w3; |
| 2018 | - $w = $maxW-($w1+3*$w2+$w3); |
|
| 2018 | + $w = $maxW - ($w1 + 3 * $w2 + $w3); |
|
| 2019 | 2019 | $texto = 'CNPJ / CPF'; |
| 2020 | 2020 | $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>'']; |
| 2021 | 2021 | $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, ''); |
| 2022 | 2022 | if (isset($this->transporta)) { |
| 2023 | - $texto = ! empty($this->transporta->getElementsByTagName("CNPJ")->item(0)->nodeValue) ? |
|
| 2023 | + $texto = !empty($this->transporta->getElementsByTagName("CNPJ")->item(0)->nodeValue) ? |
|
| 2024 | 2024 | $this->formatField( |
| 2025 | 2025 | $this->transporta->getElementsByTagName("CNPJ")->item(0)->nodeValue, |
| 2026 | 2026 | "##.###.###/####-##" |
| 2027 | 2027 | ) : ''; |
| 2028 | 2028 | if ($texto == '') { |
| 2029 | - $texto = ! empty($this->transporta->getElementsByTagName("CPF")->item(0)->nodeValue) ? |
|
| 2029 | + $texto = !empty($this->transporta->getElementsByTagName("CPF")->item(0)->nodeValue) ? |
|
| 2030 | 2030 | $this->formatField( |
| 2031 | 2031 | $this->transporta->getElementsByTagName("CPF")->item(0)->nodeValue, |
| 2032 | 2032 | "###.###.###-##" |
@@ -2042,12 +2042,12 @@ discard block |
||
| 2042 | 2042 | $y += $h; |
| 2043 | 2043 | $x = $oldX; |
| 2044 | 2044 | $h = 7; |
| 2045 | - $w1 = $maxW*0.44; |
|
| 2045 | + $w1 = $maxW * 0.44; |
|
| 2046 | 2046 | $texto = 'ENDEREÇO'; |
| 2047 | 2047 | $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>'']; |
| 2048 | 2048 | $this->pdf->textBox($x, $y, $w1, $h, $texto, $aFont, 'T', 'L', 1, ''); |
| 2049 | 2049 | if (isset($this->transporta)) { |
| 2050 | - $texto = ! empty($this->transporta->getElementsByTagName("xEnder")->item(0)->nodeValue) ? |
|
| 2050 | + $texto = !empty($this->transporta->getElementsByTagName("xEnder")->item(0)->nodeValue) ? |
|
| 2051 | 2051 | $this->transporta->getElementsByTagName("xEnder")->item(0)->nodeValue : ''; |
| 2052 | 2052 | } else { |
| 2053 | 2053 | $texto = ''; |
@@ -2056,12 +2056,12 @@ discard block |
||
| 2056 | 2056 | $this->pdf->textBox($x, $y, $w1, $h, $texto, $aFont, 'B', 'L', 0, ''); |
| 2057 | 2057 | //MUNICÍPIO |
| 2058 | 2058 | $x += $w1; |
| 2059 | - $w2 = round($maxW*0.30, 0); |
|
| 2059 | + $w2 = round($maxW * 0.30, 0); |
|
| 2060 | 2060 | $texto = 'MUNICÍPIO'; |
| 2061 | 2061 | $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>'']; |
| 2062 | 2062 | $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, ''); |
| 2063 | 2063 | if (isset($this->transporta)) { |
| 2064 | - $texto = ! empty($this->transporta->getElementsByTagName("xMun")->item(0)->nodeValue) ? |
|
| 2064 | + $texto = !empty($this->transporta->getElementsByTagName("xMun")->item(0)->nodeValue) ? |
|
| 2065 | 2065 | $this->transporta->getElementsByTagName("xMun")->item(0)->nodeValue : ''; |
| 2066 | 2066 | } else { |
| 2067 | 2067 | $texto = ''; |
@@ -2070,12 +2070,12 @@ discard block |
||
| 2070 | 2070 | $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'B', 'C', 0, ''); |
| 2071 | 2071 | //UF |
| 2072 | 2072 | $x += $w2; |
| 2073 | - $w3 = round($maxW*0.04, 0); |
|
| 2073 | + $w3 = round($maxW * 0.04, 0); |
|
| 2074 | 2074 | $texto = 'UF'; |
| 2075 | 2075 | $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>'']; |
| 2076 | 2076 | $this->pdf->textBox($x, $y, $w3, $h, $texto, $aFont, 'T', 'L', 1, ''); |
| 2077 | 2077 | if (isset($this->transporta)) { |
| 2078 | - $texto = ! empty($this->transporta->getElementsByTagName("UF")->item(0)->nodeValue) ? |
|
| 2078 | + $texto = !empty($this->transporta->getElementsByTagName("UF")->item(0)->nodeValue) ? |
|
| 2079 | 2079 | $this->transporta->getElementsByTagName("UF")->item(0)->nodeValue : ''; |
| 2080 | 2080 | } else { |
| 2081 | 2081 | $texto = ''; |
@@ -2084,13 +2084,13 @@ discard block |
||
| 2084 | 2084 | $this->pdf->textBox($x, $y, $w3, $h, $texto, $aFont, 'B', 'C', 0, ''); |
| 2085 | 2085 | //INSCRIÇÃO ESTADUAL |
| 2086 | 2086 | $x += $w3; |
| 2087 | - $w = $maxW-($w1+$w2+$w3); |
|
| 2087 | + $w = $maxW - ($w1 + $w2 + $w3); |
|
| 2088 | 2088 | $texto = 'INSCRIÇÃO ESTADUAL'; |
| 2089 | 2089 | $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>'']; |
| 2090 | 2090 | $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, ''); |
| 2091 | 2091 | $texto = ''; |
| 2092 | 2092 | if (isset($this->transporta)) { |
| 2093 | - if (! empty($this->transporta->getElementsByTagName("IE")->item(0)->nodeValue)) { |
|
| 2093 | + if (!empty($this->transporta->getElementsByTagName("IE")->item(0)->nodeValue)) { |
|
| 2094 | 2094 | $texto = $this->transporta->getElementsByTagName("IE")->item(0)->nodeValue; |
| 2095 | 2095 | } |
| 2096 | 2096 | } |
@@ -2103,16 +2103,16 @@ discard block |
||
| 2103 | 2103 | $marca = ''; |
| 2104 | 2104 | $numero = ''; |
| 2105 | 2105 | $texto = ''; |
| 2106 | - $pesoBruto=0; |
|
| 2107 | - $pesoLiquido=0; |
|
| 2106 | + $pesoBruto = 0; |
|
| 2107 | + $pesoLiquido = 0; |
|
| 2108 | 2108 | foreach ($volumes as $volume) { |
| 2109 | - $quantidade += ! empty($volume->getElementsByTagName("qVol")->item(0)->nodeValue) ? |
|
| 2109 | + $quantidade += !empty($volume->getElementsByTagName("qVol")->item(0)->nodeValue) ? |
|
| 2110 | 2110 | $volume->getElementsByTagName("qVol")->item(0)->nodeValue : 0; |
| 2111 | - $pesoBruto += ! empty($volume->getElementsByTagName("pesoB")->item(0)->nodeValue) ? |
|
| 2111 | + $pesoBruto += !empty($volume->getElementsByTagName("pesoB")->item(0)->nodeValue) ? |
|
| 2112 | 2112 | $volume->getElementsByTagName("pesoB")->item(0)->nodeValue : 0; |
| 2113 | - $pesoLiquido += ! empty($volume->getElementsByTagName("pesoL")->item(0)->nodeValue) ? |
|
| 2113 | + $pesoLiquido += !empty($volume->getElementsByTagName("pesoL")->item(0)->nodeValue) ? |
|
| 2114 | 2114 | $volume->getElementsByTagName("pesoL")->item(0)->nodeValue : 0; |
| 2115 | - $texto = ! empty($this->transp->getElementsByTagName("esp")->item(0)->nodeValue) ? |
|
| 2115 | + $texto = !empty($this->transp->getElementsByTagName("esp")->item(0)->nodeValue) ? |
|
| 2116 | 2116 | $this->transp->getElementsByTagName("esp")->item(0)->nodeValue : ''; |
| 2117 | 2117 | if ($texto != $especie && $especie != '') { |
| 2118 | 2118 | //tem várias especies |
@@ -2120,7 +2120,7 @@ discard block |
||
| 2120 | 2120 | } else { |
| 2121 | 2121 | $especie = $texto; |
| 2122 | 2122 | } |
| 2123 | - $texto = ! empty($this->transp->getElementsByTagName("marca")->item(0)->nodeValue) ? |
|
| 2123 | + $texto = !empty($this->transp->getElementsByTagName("marca")->item(0)->nodeValue) ? |
|
| 2124 | 2124 | $this->transp->getElementsByTagName("marca")->item(0)->nodeValue : ''; |
| 2125 | 2125 | if ($texto != $marca && $marca != '') { |
| 2126 | 2126 | //tem várias especies |
@@ -2128,7 +2128,7 @@ discard block |
||
| 2128 | 2128 | } else { |
| 2129 | 2129 | $marca = $texto; |
| 2130 | 2130 | } |
| 2131 | - $texto = ! empty($this->transp->getElementsByTagName("nVol")->item(0)->nodeValue) ? |
|
| 2131 | + $texto = !empty($this->transp->getElementsByTagName("nVol")->item(0)->nodeValue) ? |
|
| 2132 | 2132 | $this->transp->getElementsByTagName("nVol")->item(0)->nodeValue : ''; |
| 2133 | 2133 | if ($texto != $numero && $numero != '') { |
| 2134 | 2134 | //tem várias especies |
@@ -2143,7 +2143,7 @@ discard block |
||
| 2143 | 2143 | $y += $h; |
| 2144 | 2144 | $x = $oldX; |
| 2145 | 2145 | $h = 7; |
| 2146 | - $w1 = round($maxW*0.10, 0); |
|
| 2146 | + $w1 = round($maxW * 0.10, 0); |
|
| 2147 | 2147 | $texto = 'QUANTIDADE'; |
| 2148 | 2148 | $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>'']; |
| 2149 | 2149 | $this->pdf->textBox($x, $y, $w1, $h, $texto, $aFont, 'T', 'L', 1, ''); |
@@ -2154,7 +2154,7 @@ discard block |
||
| 2154 | 2154 | } |
| 2155 | 2155 | //ESPÉCIE |
| 2156 | 2156 | $x += $w1; |
| 2157 | - $w2 = round($maxW*0.17, 0); |
|
| 2157 | + $w2 = round($maxW * 0.17, 0); |
|
| 2158 | 2158 | $texto = 'ESPÉCIE'; |
| 2159 | 2159 | $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>'']; |
| 2160 | 2160 | $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, ''); |
@@ -2166,7 +2166,7 @@ discard block |
||
| 2166 | 2166 | $texto = 'MARCA'; |
| 2167 | 2167 | $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>'']; |
| 2168 | 2168 | $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, ''); |
| 2169 | - $texto = ! empty($this->transp->getElementsByTagName("marca")->item(0)->nodeValue) ? |
|
| 2169 | + $texto = !empty($this->transp->getElementsByTagName("marca")->item(0)->nodeValue) ? |
|
| 2170 | 2170 | $this->transp->getElementsByTagName("marca")->item(0)->nodeValue : ''; |
| 2171 | 2171 | $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B']; |
| 2172 | 2172 | $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'B', 'C', 0, ''); |
@@ -2180,7 +2180,7 @@ discard block |
||
| 2180 | 2180 | $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'B', 'C', 0, ''); |
| 2181 | 2181 | //PESO BRUTO |
| 2182 | 2182 | $x += $w2; |
| 2183 | - $w3 = round($maxW*0.20, 0); |
|
| 2183 | + $w3 = round($maxW * 0.20, 0); |
|
| 2184 | 2184 | $texto = 'PESO BRUTO'; |
| 2185 | 2185 | $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>'']; |
| 2186 | 2186 | $this->pdf->textBox($x, $y, $w3, $h, $texto, $aFont, 'T', 'L', 1, ''); |
@@ -2193,7 +2193,7 @@ discard block |
||
| 2193 | 2193 | $this->pdf->textBox($x, $y, $w3, $h, $texto, $aFont, 'B', 'R', 0, ''); |
| 2194 | 2194 | //PESO LÍQUIDO |
| 2195 | 2195 | $x += $w3; |
| 2196 | - $w = $maxW -($w1+3*$w2+$w3); |
|
| 2196 | + $w = $maxW - ($w1 + 3 * $w2 + $w3); |
|
| 2197 | 2197 | $texto = 'PESO LÍQUIDO'; |
| 2198 | 2198 | $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>'']; |
| 2199 | 2199 | $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, ''); |
@@ -2204,7 +2204,7 @@ discard block |
||
| 2204 | 2204 | } |
| 2205 | 2205 | $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B']; |
| 2206 | 2206 | $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'R', 0, ''); |
| 2207 | - return ($y+$h); |
|
| 2207 | + return ($y + $h); |
|
| 2208 | 2208 | } //fim transporteDANFE |
| 2209 | 2209 | |
| 2210 | 2210 | |
@@ -2216,7 +2216,7 @@ discard block |
||
| 2216 | 2216 | return ""; |
| 2217 | 2217 | } |
| 2218 | 2218 | $valor_original = $valor_original->nodeValue; |
| 2219 | - $valor = ! empty($valor_original) ? number_format($valor_original, 2, ",", ".") : ''; |
|
| 2219 | + $valor = !empty($valor_original) ? number_format($valor_original, 2, ",", ".") : ''; |
|
| 2220 | 2220 | |
| 2221 | 2221 | if ($valor != "") { |
| 2222 | 2222 | return sprintf($formato, $valor); |
@@ -2263,18 +2263,18 @@ discard block |
||
| 2263 | 2263 | $impostos .= $this->descricaoProdutoHelper($ICMSUFDest, "vICMSUFDest", " vICMSUFDest=%s"); |
| 2264 | 2264 | $impostos .= $this->descricaoProdutoHelper($ICMSUFDest, "vICMSUFRemet", " vICMSUFRemet=%s"); |
| 2265 | 2265 | } |
| 2266 | - $infAdProd = ! empty($itemProd->getElementsByTagName('infAdProd')->item(0)->nodeValue) |
|
| 2266 | + $infAdProd = !empty($itemProd->getElementsByTagName('infAdProd')->item(0)->nodeValue) |
|
| 2267 | 2267 | ? substr( |
| 2268 | 2268 | $this->anfaveaDANFE($itemProd->getElementsByTagName('infAdProd')->item(0)->nodeValue), |
| 2269 | 2269 | 0, |
| 2270 | 2270 | 500 |
| 2271 | 2271 | ) |
| 2272 | 2272 | : ''; |
| 2273 | - if (! empty($infAdProd)) { |
|
| 2273 | + if (!empty($infAdProd)) { |
|
| 2274 | 2274 | $infAdProd = trim($infAdProd); |
| 2275 | 2275 | $infAdProd .= ' '; |
| 2276 | 2276 | } |
| 2277 | - $loteTxt =''; |
|
| 2277 | + $loteTxt = ''; |
|
| 2278 | 2278 | $rastro = $prod->getElementsByTagName("med"); |
| 2279 | 2279 | if (!empty($prod->getElementsByTagName("rastro"))) { |
| 2280 | 2280 | $rastro = $prod->getElementsByTagName("rastro"); |
@@ -2288,14 +2288,14 @@ discard block |
||
| 2288 | 2288 | $i++; |
| 2289 | 2289 | } |
| 2290 | 2290 | if ($loteTxt != '') { |
| 2291 | - $loteTxt.= ' '; |
|
| 2291 | + $loteTxt .= ' '; |
|
| 2292 | 2292 | } |
| 2293 | 2293 | } |
| 2294 | 2294 | //NT2013.006 FCI |
| 2295 | - $nFCI = (! empty($itemProd->getElementsByTagName('nFCI')->item(0)->nodeValue)) ? |
|
| 2296 | - ' FCI:'.$itemProd->getElementsByTagName('nFCI')->item(0)->nodeValue : ''; |
|
| 2297 | - $tmp_ad=$infAdProd . ($this->descProdInfoComplemento ? $loteTxt . $impostos . $nFCI : ''); |
|
| 2298 | - $texto = $prod->getElementsByTagName("xProd")->item(0)->nodeValue . (strlen($tmp_ad)!=0?"\n ".$tmp_ad:''); |
|
| 2295 | + $nFCI = (!empty($itemProd->getElementsByTagName('nFCI')->item(0)->nodeValue)) ? |
|
| 2296 | + ' FCI:' . $itemProd->getElementsByTagName('nFCI')->item(0)->nodeValue : ''; |
|
| 2297 | + $tmp_ad = $infAdProd . ($this->descProdInfoComplemento ? $loteTxt . $impostos . $nFCI : ''); |
|
| 2298 | + $texto = $prod->getElementsByTagName("xProd")->item(0)->nodeValue . (strlen($tmp_ad) != 0 ? "\n " . $tmp_ad : ''); |
|
| 2299 | 2299 | //decodifica os caracteres html no xml |
| 2300 | 2300 | $texto = html_entity_decode($texto); |
| 2301 | 2301 | if ($this->descProdQuebraLinha) { |
@@ -2345,104 +2345,104 @@ discard block |
||
| 2345 | 2345 | // cabecalho LOOP COM OS DADOS DOS PRODUTOS |
| 2346 | 2346 | //CÓDIGO PRODUTO |
| 2347 | 2347 | $texto = "CÓDIGO PRODUTO"; |
| 2348 | - $w1 = round($w*0.09, 0); |
|
| 2348 | + $w1 = round($w * 0.09, 0); |
|
| 2349 | 2349 | $h = 4; |
| 2350 | 2350 | $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>'']; |
| 2351 | 2351 | $this->pdf->textBox($x, $y, $w1, $h, $texto, $aFont, 'C', 'C', 0, '', false); |
| 2352 | - $this->pdf->line($x+$w1, $y, $x+$w1, $y+$hmax); |
|
| 2352 | + $this->pdf->line($x + $w1, $y, $x + $w1, $y + $hmax); |
|
| 2353 | 2353 | //DESCRIÇÃO DO PRODUTO / SERVIÇO |
| 2354 | 2354 | $x += $w1; |
| 2355 | - $w2 = round($w*0.28, 0); |
|
| 2355 | + $w2 = round($w * 0.28, 0); |
|
| 2356 | 2356 | $texto = 'DESCRIÇÃO DO PRODUTO / SERVIÇO'; |
| 2357 | 2357 | $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>'']; |
| 2358 | 2358 | $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'C', 'C', 0, '', false); |
| 2359 | - $this->pdf->line($x+$w2, $y, $x+$w2, $y+$hmax); |
|
| 2359 | + $this->pdf->line($x + $w2, $y, $x + $w2, $y + $hmax); |
|
| 2360 | 2360 | //NCM/SH |
| 2361 | 2361 | $x += $w2; |
| 2362 | - $w3 = round($w*0.06, 0); |
|
| 2362 | + $w3 = round($w * 0.06, 0); |
|
| 2363 | 2363 | $texto = 'NCM/SH'; |
| 2364 | 2364 | $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>'']; |
| 2365 | 2365 | $this->pdf->textBox($x, $y, $w3, $h, $texto, $aFont, 'C', 'C', 0, '', false); |
| 2366 | - $this->pdf->line($x+$w3, $y, $x+$w3, $y+$hmax); |
|
| 2366 | + $this->pdf->line($x + $w3, $y, $x + $w3, $y + $hmax); |
|
| 2367 | 2367 | //O/CST ou O/CSOSN |
| 2368 | 2368 | $x += $w3; |
| 2369 | - $w4 = round($w*0.05, 0); |
|
| 2370 | - $texto = 'O/CSOSN';//Regime do Simples CRT = 1 ou CRT = 2 |
|
| 2369 | + $w4 = round($w * 0.05, 0); |
|
| 2370 | + $texto = 'O/CSOSN'; //Regime do Simples CRT = 1 ou CRT = 2 |
|
| 2371 | 2371 | if ($this->getTagValue($this->emit, 'CRT') == '3') { |
| 2372 | - $texto = 'O/CST';//Regime Normal |
|
| 2372 | + $texto = 'O/CST'; //Regime Normal |
|
| 2373 | 2373 | } |
| 2374 | 2374 | $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>'']; |
| 2375 | 2375 | $this->pdf->textBox($x, $y, $w4, $h, $texto, $aFont, 'C', 'C', 0, '', false); |
| 2376 | - $this->pdf->line($x+$w4, $y, $x+$w4, $y+$hmax); |
|
| 2376 | + $this->pdf->line($x + $w4, $y, $x + $w4, $y + $hmax); |
|
| 2377 | 2377 | //CFOP |
| 2378 | 2378 | $x += $w4; |
| 2379 | - $w5 = round($w*0.04, 0); |
|
| 2379 | + $w5 = round($w * 0.04, 0); |
|
| 2380 | 2380 | $texto = 'CFOP'; |
| 2381 | 2381 | $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>'']; |
| 2382 | 2382 | $this->pdf->textBox($x, $y, $w5, $h, $texto, $aFont, 'C', 'C', 0, '', false); |
| 2383 | - $this->pdf->line($x+$w5, $y, $x+$w5, $y+$hmax); |
|
| 2383 | + $this->pdf->line($x + $w5, $y, $x + $w5, $y + $hmax); |
|
| 2384 | 2384 | //UN |
| 2385 | 2385 | $x += $w5; |
| 2386 | - $w6 = round($w*0.03, 0); |
|
| 2386 | + $w6 = round($w * 0.03, 0); |
|
| 2387 | 2387 | $texto = 'UN'; |
| 2388 | 2388 | $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>'']; |
| 2389 | 2389 | $this->pdf->textBox($x, $y, $w6, $h, $texto, $aFont, 'C', 'C', 0, '', false); |
| 2390 | - $this->pdf->line($x+$w6, $y, $x+$w6, $y+$hmax); |
|
| 2390 | + $this->pdf->line($x + $w6, $y, $x + $w6, $y + $hmax); |
|
| 2391 | 2391 | //QUANT |
| 2392 | 2392 | $x += $w6; |
| 2393 | - $w7 = round($w*0.07, 0); |
|
| 2393 | + $w7 = round($w * 0.07, 0); |
|
| 2394 | 2394 | $texto = 'QUANT'; |
| 2395 | 2395 | $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>'']; |
| 2396 | 2396 | $this->pdf->textBox($x, $y, $w7, $h, $texto, $aFont, 'C', 'C', 0, '', false); |
| 2397 | - $this->pdf->line($x+$w7, $y, $x+$w7, $y+$hmax); |
|
| 2397 | + $this->pdf->line($x + $w7, $y, $x + $w7, $y + $hmax); |
|
| 2398 | 2398 | //VALOR UNIT |
| 2399 | 2399 | $x += $w7; |
| 2400 | - $w8 = round($w*0.06, 0); |
|
| 2400 | + $w8 = round($w * 0.06, 0); |
|
| 2401 | 2401 | $texto = 'VALOR UNIT'; |
| 2402 | 2402 | $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>'']; |
| 2403 | 2403 | $this->pdf->textBox($x, $y, $w8, $h, $texto, $aFont, 'C', 'C', 0, '', false); |
| 2404 | - $this->pdf->line($x+$w8, $y, $x+$w8, $y+$hmax); |
|
| 2404 | + $this->pdf->line($x + $w8, $y, $x + $w8, $y + $hmax); |
|
| 2405 | 2405 | //VALOR TOTAL |
| 2406 | 2406 | $x += $w8; |
| 2407 | - $w9 = round($w*0.06, 0); |
|
| 2407 | + $w9 = round($w * 0.06, 0); |
|
| 2408 | 2408 | $texto = 'VALOR TOTAL'; |
| 2409 | 2409 | $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>'']; |
| 2410 | 2410 | $this->pdf->textBox($x, $y, $w9, $h, $texto, $aFont, 'C', 'C', 0, '', false); |
| 2411 | - $this->pdf->line($x+$w9, $y, $x+$w9, $y+$hmax); |
|
| 2411 | + $this->pdf->line($x + $w9, $y, $x + $w9, $y + $hmax); |
|
| 2412 | 2412 | //B.CÁLC ICMS |
| 2413 | 2413 | $x += $w9; |
| 2414 | - $w10 = round($w*0.06, 0); |
|
| 2414 | + $w10 = round($w * 0.06, 0); |
|
| 2415 | 2415 | $texto = 'B.CÁLC ICMS'; |
| 2416 | 2416 | $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>'']; |
| 2417 | 2417 | $this->pdf->textBox($x, $y, $w10, $h, $texto, $aFont, 'C', 'C', 0, '', false); |
| 2418 | - $this->pdf->line($x+$w10, $y, $x+$w10, $y+$hmax); |
|
| 2418 | + $this->pdf->line($x + $w10, $y, $x + $w10, $y + $hmax); |
|
| 2419 | 2419 | //VALOR ICMS |
| 2420 | 2420 | $x += $w10; |
| 2421 | - $w11 = round($w*0.06, 0); |
|
| 2421 | + $w11 = round($w * 0.06, 0); |
|
| 2422 | 2422 | $texto = 'VALOR ICMS'; |
| 2423 | 2423 | $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>'']; |
| 2424 | 2424 | $this->pdf->textBox($x, $y, $w11, $h, $texto, $aFont, 'C', 'C', 0, '', false); |
| 2425 | - $this->pdf->line($x+$w11, $y, $x+$w11, $y+$hmax); |
|
| 2425 | + $this->pdf->line($x + $w11, $y, $x + $w11, $y + $hmax); |
|
| 2426 | 2426 | //VALOR IPI |
| 2427 | 2427 | $x += $w11; |
| 2428 | - $w12 = round($w*0.05, 0); |
|
| 2428 | + $w12 = round($w * 0.05, 0); |
|
| 2429 | 2429 | $texto = 'VALOR IPI'; |
| 2430 | 2430 | $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>'']; |
| 2431 | 2431 | $this->pdf->textBox($x, $y, $w12, $h, $texto, $aFont, 'C', 'C', 0, '', false); |
| 2432 | - $this->pdf->line($x+$w12, $y, $x+$w12, $y+$hmax); |
|
| 2432 | + $this->pdf->line($x + $w12, $y, $x + $w12, $y + $hmax); |
|
| 2433 | 2433 | //ALÍQ. ICMS |
| 2434 | 2434 | $x += $w12; |
| 2435 | - $w13 = round($w*0.035, 0); |
|
| 2435 | + $w13 = round($w * 0.035, 0); |
|
| 2436 | 2436 | $texto = 'ALÍQ. ICMS'; |
| 2437 | 2437 | $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>'']; |
| 2438 | 2438 | $this->pdf->textBox($x, $y, $w13, $h, $texto, $aFont, 'C', 'C', 0, '', false); |
| 2439 | - $this->pdf->line($x+$w13, $y, $x+$w13, $y+$hmax); |
|
| 2439 | + $this->pdf->line($x + $w13, $y, $x + $w13, $y + $hmax); |
|
| 2440 | 2440 | //ALÍQ. IPI |
| 2441 | 2441 | $x += $w13; |
| 2442 | - $w14 = $w-($w1+$w2+$w3+$w4+$w5+$w6+$w7+$w8+$w9+$w10+$w11+$w12+$w13); |
|
| 2442 | + $w14 = $w - ($w1 + $w2 + $w3 + $w4 + $w5 + $w6 + $w7 + $w8 + $w9 + $w10 + $w11 + $w12 + $w13); |
|
| 2443 | 2443 | $texto = 'ALÍQ. IPI'; |
| 2444 | 2444 | $this->pdf->textBox($x, $y, $w14, $h, $texto, $aFont, 'C', 'C', 0, '', false); |
| 2445 | - $this->pdf->line($oldX, $y+$h+1, $oldX + $w, $y+$h+1); |
|
| 2445 | + $this->pdf->line($oldX, $y + $h + 1, $oldX + $w, $y + $h + 1); |
|
| 2446 | 2446 | $y += 5; |
| 2447 | 2447 | //################################################################################## |
| 2448 | 2448 | // LOOP COM OS DADOS DOS PRODUTOS |
@@ -2460,7 +2460,7 @@ discard block |
||
| 2460 | 2460 | $textoProduto = trim($this->descricaoProduto($thisItem)); |
| 2461 | 2461 | |
| 2462 | 2462 | $linhaDescr = $this->pdf->getNumLines($textoProduto, $w2, $aFont); |
| 2463 | - $h = round(($linhaDescr * $this->pdf->fontSize)+ ($linhaDescr * 0.5), 2); |
|
| 2463 | + $h = round(($linhaDescr * $this->pdf->fontSize) + ($linhaDescr * 0.5), 2); |
|
| 2464 | 2464 | $hUsado += $h; |
| 2465 | 2465 | |
| 2466 | 2466 | $diffH = $hmax - $hUsado; |
@@ -2473,11 +2473,11 @@ discard block |
||
| 2473 | 2473 | break; |
| 2474 | 2474 | } |
| 2475 | 2475 | } |
| 2476 | - $y_linha=$y+$h; |
|
| 2476 | + $y_linha = $y + $h; |
|
| 2477 | 2477 | // linha entre itens |
| 2478 | 2478 | $this->pdf->dashedHLine($oldX, $y_linha, $w, 0.1, 120); |
| 2479 | 2479 | //corrige o x |
| 2480 | - $x=$oldX; |
|
| 2480 | + $x = $oldX; |
|
| 2481 | 2481 | //codigo do produto |
| 2482 | 2482 | $texto = $prod->getElementsByTagName("cProd")->item(0)->nodeValue; |
| 2483 | 2483 | $this->pdf->textBox($x, $y, $w1, $h, $texto, $aFont, 'T', 'C', 0, ''); |
@@ -2490,16 +2490,16 @@ discard block |
||
| 2490 | 2490 | } |
| 2491 | 2491 | $x += $w2; |
| 2492 | 2492 | //NCM |
| 2493 | - $texto = ! empty($prod->getElementsByTagName("NCM")->item(0)->nodeValue) ? |
|
| 2493 | + $texto = !empty($prod->getElementsByTagName("NCM")->item(0)->nodeValue) ? |
|
| 2494 | 2494 | $prod->getElementsByTagName("NCM")->item(0)->nodeValue : ''; |
| 2495 | 2495 | $this->pdf->textBox($x, $y, $w3, $h, $texto, $aFont, 'T', 'C', 0, ''); |
| 2496 | 2496 | $x += $w3; |
| 2497 | 2497 | //CST |
| 2498 | 2498 | if (isset($ICMS)) { |
| 2499 | - $origem = $this->getTagValue($ICMS, "orig"); |
|
| 2500 | - $cst = $this->getTagValue($ICMS, "CST"); |
|
| 2501 | - $csosn = $this->getTagValue($ICMS, "CSOSN"); |
|
| 2502 | - $texto = $origem.$cst.$csosn; |
|
| 2499 | + $origem = $this->getTagValue($ICMS, "orig"); |
|
| 2500 | + $cst = $this->getTagValue($ICMS, "CST"); |
|
| 2501 | + $csosn = $this->getTagValue($ICMS, "CSOSN"); |
|
| 2502 | + $texto = $origem . $cst . $csosn; |
|
| 2503 | 2503 | $this->pdf->textBox($x, $y, $w4, $h, $texto, $aFont, 'T', 'C', 0, ''); |
| 2504 | 2504 | } |
| 2505 | 2505 | //CFOP |
@@ -2533,7 +2533,7 @@ discard block |
||
| 2533 | 2533 | //Valor da Base de calculo |
| 2534 | 2534 | $x += $w9; |
| 2535 | 2535 | if (isset($ICMS)) { |
| 2536 | - $texto = ! empty($ICMS->getElementsByTagName("vBC")->item(0)->nodeValue) ? |
|
| 2536 | + $texto = !empty($ICMS->getElementsByTagName("vBC")->item(0)->nodeValue) ? |
|
| 2537 | 2537 | number_format( |
| 2538 | 2538 | $ICMS->getElementsByTagName("vBC")->item(0)->nodeValue, |
| 2539 | 2539 | 2, |
@@ -2545,7 +2545,7 @@ discard block |
||
| 2545 | 2545 | //Valor do ICMS |
| 2546 | 2546 | $x += $w10; |
| 2547 | 2547 | if (isset($ICMS)) { |
| 2548 | - $texto = ! empty($ICMS->getElementsByTagName("vICMS")->item(0)->nodeValue) ? |
|
| 2548 | + $texto = !empty($ICMS->getElementsByTagName("vICMS")->item(0)->nodeValue) ? |
|
| 2549 | 2549 | number_format( |
| 2550 | 2550 | $ICMS->getElementsByTagName("vICMS")->item(0)->nodeValue, |
| 2551 | 2551 | 2, |
@@ -2557,8 +2557,8 @@ discard block |
||
| 2557 | 2557 | //Valor do IPI |
| 2558 | 2558 | $x += $w11; |
| 2559 | 2559 | if (isset($IPI)) { |
| 2560 | - $texto = ! empty($IPI->getElementsByTagName("vIPI")->item(0)->nodeValue) ? |
|
| 2561 | - number_format($IPI->getElementsByTagName("vIPI")->item(0)->nodeValue, 2, ",", ".") :''; |
|
| 2560 | + $texto = !empty($IPI->getElementsByTagName("vIPI")->item(0)->nodeValue) ? |
|
| 2561 | + number_format($IPI->getElementsByTagName("vIPI")->item(0)->nodeValue, 2, ",", ".") : ''; |
|
| 2562 | 2562 | } else { |
| 2563 | 2563 | $texto = ''; |
| 2564 | 2564 | } |
@@ -2566,7 +2566,7 @@ discard block |
||
| 2566 | 2566 | // %ICMS |
| 2567 | 2567 | $x += $w12; |
| 2568 | 2568 | if (isset($ICMS)) { |
| 2569 | - $texto = ! empty($ICMS->getElementsByTagName("pICMS")->item(0)->nodeValue) ? |
|
| 2569 | + $texto = !empty($ICMS->getElementsByTagName("pICMS")->item(0)->nodeValue) ? |
|
| 2570 | 2570 | number_format( |
| 2571 | 2571 | $ICMS->getElementsByTagName("pICMS")->item(0)->nodeValue, |
| 2572 | 2572 | 2, |
@@ -2578,7 +2578,7 @@ discard block |
||
| 2578 | 2578 | //%IPI |
| 2579 | 2579 | $x += $w13; |
| 2580 | 2580 | if (isset($IPI)) { |
| 2581 | - $texto = ! empty($IPI->getElementsByTagName("pIPI")->item(0)->nodeValue) ? |
|
| 2581 | + $texto = !empty($IPI->getElementsByTagName("pIPI")->item(0)->nodeValue) ? |
|
| 2582 | 2582 | number_format($IPI->getElementsByTagName("pIPI")->item(0)->nodeValue, 2, ",", ".") : ''; |
| 2583 | 2583 | } else { |
| 2584 | 2584 | $texto = ''; |
@@ -2603,7 +2603,7 @@ discard block |
||
| 2603 | 2603 | $i++; |
| 2604 | 2604 | } |
| 2605 | 2605 | } |
| 2606 | - return $oldY+$hmax; |
|
| 2606 | + return $oldY + $hmax; |
|
| 2607 | 2607 | } |
| 2608 | 2608 | |
| 2609 | 2609 | |
@@ -2637,7 +2637,7 @@ discard block |
||
| 2637 | 2637 | |
| 2638 | 2638 | $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'']; |
| 2639 | 2639 | |
| 2640 | - $w1 = round($w*0.09, 0); |
|
| 2640 | + $w1 = round($w * 0.09, 0); |
|
| 2641 | 2641 | |
| 2642 | 2642 | // Tabela Renavam Combustivel |
| 2643 | 2643 | $renavamCombustivel = [ |
@@ -2732,54 +2732,54 @@ discard block |
||
| 2732 | 2732 | |
| 2733 | 2733 | $yVeic = $y + $h; |
| 2734 | 2734 | $texto = 'Chassi: ............: ' . $veiculoChassi; |
| 2735 | - $this->pdf->textBox($x, $yVeic, $w1+40, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
| 2735 | + $this->pdf->textBox($x, $yVeic, $w1 + 40, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
| 2736 | 2736 | $yVeic += $h; |
| 2737 | 2737 | $texto = 'Cor...................: ' . $veiculoCor; |
| 2738 | - $this->pdf->textBox($x, $yVeic, $w1+40, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
| 2738 | + $this->pdf->textBox($x, $yVeic, $w1 + 40, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
| 2739 | 2739 | $yVeic += $h; |
| 2740 | 2740 | $texto = 'Cilindrada........: ' . $veiculoCilindrada; |
| 2741 | - $this->pdf->textBox($x, $yVeic, $w1+40, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
| 2741 | + $this->pdf->textBox($x, $yVeic, $w1 + 40, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
| 2742 | 2742 | $yVeic += $h; |
| 2743 | 2743 | $texto = 'Cmkg...............: ' . $veiculoCmkg; |
| 2744 | - $this->pdf->textBox($x, $yVeic, $w1+40, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
| 2744 | + $this->pdf->textBox($x, $yVeic, $w1 + 40, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
| 2745 | 2745 | $yVeic += $h; |
| 2746 | 2746 | $texto = 'Tipo.................: ' . ($renavamTiposVeiculos[intval($veiculoTipo)] ?? $veiculoTipo); |
| 2747 | - $this->pdf->textBox($x, $yVeic, $w1+40, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
| 2747 | + $this->pdf->textBox($x, $yVeic, $w1 + 40, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
| 2748 | 2748 | $yVeic = $y + $h; |
| 2749 | 2749 | $xVeic = $x + 65; |
| 2750 | 2750 | $texto = 'Nº Motor: .........: ' . $veiculoMotor; |
| 2751 | - $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
| 2751 | + $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
| 2752 | 2752 | $yVeic += $h; |
| 2753 | 2753 | $texto = 'Renavam...........: ' . $veiculoRenavam; |
| 2754 | - $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
| 2754 | + $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
| 2755 | 2755 | $yVeic += $h; |
| 2756 | 2756 | $texto = 'HP.....................: ' . $veiculoHp; |
| 2757 | - $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
| 2757 | + $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
| 2758 | 2758 | $yVeic += $h; |
| 2759 | 2759 | $texto = 'Placa.................: ' . $veiculoPlaca; |
| 2760 | - $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
| 2760 | + $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
| 2761 | 2761 | $yVeic += $h; |
| 2762 | 2762 | $texto = 'Tipo Pintura......: ' . ($renavamEspecie[intval($veiculoTipoPintura)] ?? $veiculoTipoPintura); |
| 2763 | - $this->pTextBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
| 2763 | + $this->pTextBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
| 2764 | 2764 | $yVeic = $y + $h; |
| 2765 | 2765 | $xVeic = $xVeic + 55; |
| 2766 | 2766 | $texto = 'Marca / Modelo.....: ' . $veiculoMarcaModelo; |
| 2767 | - $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
| 2767 | + $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
| 2768 | 2768 | $yVeic += $h; |
| 2769 | 2769 | $texto = 'Especie..................: ' . ($renavamEspecie[intval($veiculoEspecie)] ?? $veiculoEspecie); |
| 2770 | - $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
| 2770 | + $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
| 2771 | 2771 | $yVeic += $h; |
| 2772 | 2772 | $texto = 'Combustivel..........: ' . ($renavamCombustivel[intval($veiculoCombustivel)] ?? $veiculoCombustivel); |
| 2773 | - $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
| 2773 | + $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
| 2774 | 2774 | $yVeic += $h; |
| 2775 | 2775 | $texto = 'Serial.....................: ' . $veiculoSerial; |
| 2776 | - $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
| 2776 | + $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
| 2777 | 2777 | $yVeic += $h; |
| 2778 | - $texto = 'Ano Fab/Mod........: '. $veiculoFabricacao . '/' . $veiculoModelo; |
|
| 2779 | - $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
| 2778 | + $texto = 'Ano Fab/Mod........: ' . $veiculoFabricacao . '/' . $veiculoModelo; |
|
| 2779 | + $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
| 2780 | 2780 | $yVeic += $h; |
| 2781 | - $texto = 'Distancia Entre Eixos(mm)..: '. $veiculoDistancia; |
|
| 2782 | - $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
| 2781 | + $texto = 'Distancia Entre Eixos(mm)..: ' . $veiculoDistancia; |
|
| 2782 | + $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
| 2783 | 2783 | } |
| 2784 | 2784 | |
| 2785 | 2785 | /** |
@@ -2803,12 +2803,12 @@ discard block |
||
| 2803 | 2803 | $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
| 2804 | 2804 | //INSCRIÇÃO MUNICIPAL |
| 2805 | 2805 | $y += 3; |
| 2806 | - $w = round($this->wPrint*0.23, 0); |
|
| 2806 | + $w = round($this->wPrint * 0.23, 0); |
|
| 2807 | 2807 | $texto = 'INSCRIÇÃO MUNICIPAL'; |
| 2808 | 2808 | $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>'']; |
| 2809 | 2809 | $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, ''); |
| 2810 | 2810 | //inscrição municipal |
| 2811 | - $texto = ! empty($this->emit->getElementsByTagName("IM")->item(0)->nodeValue) ? |
|
| 2811 | + $texto = !empty($this->emit->getElementsByTagName("IM")->item(0)->nodeValue) ? |
|
| 2812 | 2812 | $this->emit->getElementsByTagName("IM")->item(0)->nodeValue : ''; |
| 2813 | 2813 | $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B']; |
| 2814 | 2814 | $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 0, ''); |
@@ -2818,7 +2818,7 @@ discard block |
||
| 2818 | 2818 | $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>'']; |
| 2819 | 2819 | $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, ''); |
| 2820 | 2820 | if (isset($this->ISSQNtot)) { |
| 2821 | - $texto = ! empty($this->ISSQNtot->getElementsByTagName("vServ")->item(0)->nodeValue) ? |
|
| 2821 | + $texto = !empty($this->ISSQNtot->getElementsByTagName("vServ")->item(0)->nodeValue) ? |
|
| 2822 | 2822 | $this->ISSQNtot->getElementsByTagName("vServ")->item(0)->nodeValue : ''; |
| 2823 | 2823 | $texto = number_format($texto, 2, ",", "."); |
| 2824 | 2824 | } else { |
@@ -2832,9 +2832,9 @@ discard block |
||
| 2832 | 2832 | $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>'']; |
| 2833 | 2833 | $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, ''); |
| 2834 | 2834 | if (isset($this->ISSQNtot)) { |
| 2835 | - $texto = ! empty($this->ISSQNtot->getElementsByTagName("vBC")->item(0)->nodeValue) ? |
|
| 2835 | + $texto = !empty($this->ISSQNtot->getElementsByTagName("vBC")->item(0)->nodeValue) ? |
|
| 2836 | 2836 | $this->ISSQNtot->getElementsByTagName("vBC")->item(0)->nodeValue : ''; |
| 2837 | - $texto = ! empty($texto) ? number_format($texto, 2, ",", ".") : ''; |
|
| 2837 | + $texto = !empty($texto) ? number_format($texto, 2, ",", ".") : ''; |
|
| 2838 | 2838 | } else { |
| 2839 | 2839 | $texto = ''; |
| 2840 | 2840 | } |
@@ -2845,21 +2845,21 @@ discard block |
||
| 2845 | 2845 | if ($this->orientacao == 'P') { |
| 2846 | 2846 | $w = $this->wPrint - (3 * $w); |
| 2847 | 2847 | } else { |
| 2848 | - $w = $this->wPrint - (3 * $w)-$this->wCanhoto; |
|
| 2848 | + $w = $this->wPrint - (3 * $w) - $this->wCanhoto; |
|
| 2849 | 2849 | } |
| 2850 | 2850 | $texto = 'VALOR TOTAL DO ISSQN'; |
| 2851 | 2851 | $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>'']; |
| 2852 | 2852 | $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, ''); |
| 2853 | 2853 | if (isset($this->ISSQNtot)) { |
| 2854 | - $texto = ! empty($this->ISSQNtot->getElementsByTagName("vISS")->item(0)->nodeValue) ? |
|
| 2854 | + $texto = !empty($this->ISSQNtot->getElementsByTagName("vISS")->item(0)->nodeValue) ? |
|
| 2855 | 2855 | $this->ISSQNtot->getElementsByTagName("vISS")->item(0)->nodeValue : ''; |
| 2856 | - $texto = ! empty($texto) ? number_format($texto, 2, ",", ".") : ''; |
|
| 2856 | + $texto = !empty($texto) ? number_format($texto, 2, ",", ".") : ''; |
|
| 2857 | 2857 | } else { |
| 2858 | 2858 | $texto = ''; |
| 2859 | 2859 | } |
| 2860 | 2860 | $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B']; |
| 2861 | 2861 | $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'R', 0, ''); |
| 2862 | - return ($y+$h+1); |
|
| 2862 | + return ($y + $h + 1); |
|
| 2863 | 2863 | } |
| 2864 | 2864 | |
| 2865 | 2865 | /** |
@@ -2880,7 +2880,7 @@ discard block |
||
| 2880 | 2880 | if ($this->orientacao == 'P') { |
| 2881 | 2881 | $w = $this->wPrint; |
| 2882 | 2882 | } else { |
| 2883 | - $w = $this->wPrint-$this->wCanhoto; |
|
| 2883 | + $w = $this->wPrint - $this->wCanhoto; |
|
| 2884 | 2884 | } |
| 2885 | 2885 | $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B']; |
| 2886 | 2886 | $this->pdf->textBox($x, $y, $w, 8, $texto, $aFont, 'T', 'L', 0, ''); |
@@ -2896,15 +2896,15 @@ discard block |
||
| 2896 | 2896 | //$this->textoAdic com o texto completo do campo |
| 2897 | 2897 | $y += 1; |
| 2898 | 2898 | $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'']; |
| 2899 | - $this->pdf->textBox($x, $y+2, $w-2, $h-3, $this->textoAdic, $aFont, 'T', 'L', 0, '', false); |
|
| 2899 | + $this->pdf->textBox($x, $y + 2, $w - 2, $h - 3, $this->textoAdic, $aFont, 'T', 'L', 0, '', false); |
|
| 2900 | 2900 | //RESERVADO AO FISCO |
| 2901 | 2901 | $texto = "RESERVADO AO FISCO"; |
| 2902 | 2902 | $x += $w; |
| 2903 | 2903 | $y -= 1; |
| 2904 | 2904 | if ($this->orientacao == 'P') { |
| 2905 | - $w = $this->wPrint-$w; |
|
| 2905 | + $w = $this->wPrint - $w; |
|
| 2906 | 2906 | } else { |
| 2907 | - $w = $this->wPrint-$w-$this->wCanhoto; |
|
| 2907 | + $w = $this->wPrint - $w - $this->wCanhoto; |
|
| 2908 | 2908 | } |
| 2909 | 2909 | $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>'B']; |
| 2910 | 2910 | $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, ''); |
@@ -2943,8 +2943,8 @@ discard block |
||
| 2943 | 2943 | } |
| 2944 | 2944 | $y += 2; |
| 2945 | 2945 | $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'']; |
| 2946 | - $this->pdf->textBox($x, $y, $w-2, $h-3, $texto, $aFont, 'T', 'L', 0, '', false); |
|
| 2947 | - return $y+$h; |
|
| 2946 | + $this->pdf->textBox($x, $y, $w - 2, $h - 3, $texto, $aFont, 'T', 'L', 0, '', false); |
|
| 2947 | + return $y + $h; |
|
| 2948 | 2948 | } |
| 2949 | 2949 | |
| 2950 | 2950 | /** |
@@ -2962,13 +2962,13 @@ discard block |
||
| 2962 | 2962 | if ($this->orientacao == 'P') { |
| 2963 | 2963 | $w = $this->wPrint; |
| 2964 | 2964 | } else { |
| 2965 | - $w = $this->wPrint-$this->wCanhoto; |
|
| 2965 | + $w = $this->wPrint - $this->wCanhoto; |
|
| 2966 | 2966 | $x = $this->wCanhoto; |
| 2967 | 2967 | } |
| 2968 | 2968 | $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>'I']; |
| 2969 | - $texto = "Impresso em ". date('d/m/Y') . " as " . date('H:i:s'); |
|
| 2969 | + $texto = "Impresso em " . date('d/m/Y') . " as " . date('H:i:s'); |
|
| 2970 | 2970 | $this->pdf->textBox($x, $y, $w, 0, $texto, $aFont, 'T', 'L', false); |
| 2971 | - $texto = $this->creditos . " Powered by NFePHP®"; |
|
| 2971 | + $texto = $this->creditos . " Powered by NFePHP®"; |
|
| 2972 | 2972 | $this->pdf->textBox($x, $y, $w, 0, $texto, $aFont, 'T', 'R', false, ''); |
| 2973 | 2973 | } |
| 2974 | 2974 | |
@@ -3021,9 +3021,9 @@ discard block |
||
| 3021 | 3021 | } else { |
| 3022 | 3022 | //linha separadora do canhoto - 238 |
| 3023 | 3023 | //posicao altura |
| 3024 | - $y = $this->wPrint-85; |
|
| 3024 | + $y = $this->wPrint - 85; |
|
| 3025 | 3025 | //altura |
| 3026 | - $w = $this->wPrint-85-24; |
|
| 3026 | + $w = $this->wPrint - 85 - 24; |
|
| 3027 | 3027 | } |
| 3028 | 3028 | $h = 10; |
| 3029 | 3029 | //desenha caixa |
@@ -3046,21 +3046,21 @@ discard block |
||
| 3046 | 3046 | $texto .= "AO LADO"; |
| 3047 | 3047 | } |
| 3048 | 3048 | $texto .= ". EMISSÃO: "; |
| 3049 | - $dEmi = ! empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ? |
|
| 3049 | + $dEmi = !empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ? |
|
| 3050 | 3050 | $this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue : ''; |
| 3051 | 3051 | if ($dEmi == '') { |
| 3052 | - $dEmi = ! empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ? |
|
| 3052 | + $dEmi = !empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ? |
|
| 3053 | 3053 | $this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue : ''; |
| 3054 | 3054 | $aDemi = explode('T', $dEmi); |
| 3055 | 3055 | $dEmi = $aDemi[0]; |
| 3056 | 3056 | } |
| 3057 | - $texto .= $this->ymdTodmy($dEmi) ." "; |
|
| 3057 | + $texto .= $this->ymdTodmy($dEmi) . " "; |
|
| 3058 | 3058 | $texto .= "VALOR TOTAL: R$ "; |
| 3059 | 3059 | $texto .= number_format($this->ICMSTot->getElementsByTagName("vNF")->item(0)->nodeValue, 2, ",", ".") . " "; |
| 3060 | 3060 | $texto .= "DESTINATÁRIO: "; |
| 3061 | 3061 | $texto .= $destinatario; |
| 3062 | 3062 | if ($this->orientacao == 'P') { |
| 3063 | - $this->pdf->textBox($x, $y, $w-1, $h, $texto, $aFont, 'C', 'L', 0, '', false); |
|
| 3063 | + $this->pdf->textBox($x, $y, $w - 1, $h, $texto, $aFont, 'C', 'L', 0, '', false); |
|
| 3064 | 3064 | $x1 = $x + $w; |
| 3065 | 3065 | $w1 = $this->wPrint - $w; |
| 3066 | 3066 | $texto = "NF-e"; |
@@ -3073,12 +3073,12 @@ discard block |
||
| 3073 | 3073 | //DATA DE RECEBIMENTO |
| 3074 | 3074 | $texto = "DATA DE RECEBIMENTO"; |
| 3075 | 3075 | $y += $h; |
| 3076 | - $w2 = round($this->wPrint*0.17, 0); //35; |
|
| 3076 | + $w2 = round($this->wPrint * 0.17, 0); //35; |
|
| 3077 | 3077 | $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>'']; |
| 3078 | 3078 | $this->pdf->textBox($x, $y, $w2, 8, $texto, $aFont, 'T', 'L', 1, ''); |
| 3079 | 3079 | //IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR |
| 3080 | 3080 | $x += $w2; |
| 3081 | - $w3 = $w-$w2; |
|
| 3081 | + $w3 = $w - $w2; |
|
| 3082 | 3082 | $texto = "IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR"; |
| 3083 | 3083 | $this->pdf->textBox($x, $y, $w3, 8, $texto, $aFont, 'T', 'L', 1, ''); |
| 3084 | 3084 | $x = $oldX; |
@@ -3088,7 +3088,7 @@ discard block |
||
| 3088 | 3088 | return $y; |
| 3089 | 3089 | } else { |
| 3090 | 3090 | $x--; |
| 3091 | - $x = $this->pdf->textBox90($x, $y, $w-1, $h, $texto, $aFontSmall, 'C', 'L', 0, '', false); |
|
| 3091 | + $x = $this->pdf->textBox90($x, $y, $w - 1, $h, $texto, $aFontSmall, 'C', 'L', 0, '', false); |
|
| 3092 | 3092 | //NUMERO DA NOTA FISCAL LOGO NFE |
| 3093 | 3093 | $w1 = 18; |
| 3094 | 3094 | $x1 = $oldX; |
@@ -3102,18 +3102,18 @@ discard block |
||
| 3102 | 3102 | $this->pdf->textBox($x1, $y, $w1, 18, $texto, $aFont, 'C', 'C', 1, ''); |
| 3103 | 3103 | //DATA DO RECEBIMENTO |
| 3104 | 3104 | $texto = "DATA DO RECEBIMENTO"; |
| 3105 | - $y = $this->wPrint-85; |
|
| 3105 | + $y = $this->wPrint - 85; |
|
| 3106 | 3106 | $x = 12; |
| 3107 | - $w2 = round($this->wPrint*0.17, 0); //35; |
|
| 3107 | + $w2 = round($this->wPrint * 0.17, 0); //35; |
|
| 3108 | 3108 | $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>'']; |
| 3109 | 3109 | $this->pdf->textBox90($x, $y, $w2, 8, $texto, $aFont, 'T', 'L', 1, ''); |
| 3110 | 3110 | //IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR |
| 3111 | 3111 | $y -= $w2; |
| 3112 | - $w3 = $w-$w2; |
|
| 3112 | + $w3 = $w - $w2; |
|
| 3113 | 3113 | $texto = "IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR"; |
| 3114 | 3114 | $aFont = ['font'=>$this->fontePadrao, 'size'=>5.7, 'style'=>'']; |
| 3115 | 3115 | $x = $this->pdf->textBox90($x, $y, $w3, 8, $texto, $aFont, 'T', 'L', 1, ''); |
| 3116 | - $this->pdf->DashedVLine(23, $oldY, 0.1, $this->wPrint-20, 67); |
|
| 3116 | + $this->pdf->DashedVLine(23, $oldY, 0.1, $this->wPrint - 20, 67); |
|
| 3117 | 3117 | return $x; |
| 3118 | 3118 | } |
| 3119 | 3119 | } |
@@ -3130,13 +3130,13 @@ discard block |
||
| 3130 | 3130 | { |
| 3131 | 3131 | $saida = ""; |
| 3132 | 3132 | if (isset($this->compra)) { |
| 3133 | - if (! empty($this->compra->getElementsByTagName("xNEmp")->item(0)->nodeValue)) { |
|
| 3133 | + if (!empty($this->compra->getElementsByTagName("xNEmp")->item(0)->nodeValue)) { |
|
| 3134 | 3134 | $saida .= " Nota de Empenho: " . $this->compra->getElementsByTagName("xNEmp")->item(0)->nodeValue; |
| 3135 | 3135 | } |
| 3136 | - if (! empty($this->compra->getElementsByTagName("xPed")->item(0)->nodeValue)) { |
|
| 3136 | + if (!empty($this->compra->getElementsByTagName("xPed")->item(0)->nodeValue)) { |
|
| 3137 | 3137 | $saida .= " Pedido: " . $this->compra->getElementsByTagName("xPed")->item(0)->nodeValue; |
| 3138 | 3138 | } |
| 3139 | - if (! empty($this->compra->getElementsByTagName("xCont")->item(0)->nodeValue)) { |
|
| 3139 | + if (!empty($this->compra->getElementsByTagName("xCont")->item(0)->nodeValue)) { |
|
| 3140 | 3140 | $saida .= " Contrato: " . $this->compra->getElementsByTagName("xCont")->item(0)->nodeValue; |
| 3141 | 3141 | } |
| 3142 | 3142 | } |
@@ -3162,21 +3162,21 @@ discard block |
||
| 3162 | 3162 | if ($vICMS > 0) { |
| 3163 | 3163 | $vICMS = 1; |
| 3164 | 3164 | } |
| 3165 | - $icmss = $this->ICMSTot->getElementsByTagName("vBC")->item(0)->nodeValue; |
|
| 3165 | + $icmss = $this->ICMSTot->getElementsByTagName("vBC")->item(0)->nodeValue; |
|
| 3166 | 3166 | if ($icmss > 0) { |
| 3167 | 3167 | $icmss = 1; |
| 3168 | 3168 | } |
| 3169 | - $dEmi = ! empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ? |
|
| 3169 | + $dEmi = !empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ? |
|
| 3170 | 3170 | $this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue : ''; |
| 3171 | 3171 | if ($dEmi == '') { |
| 3172 | - $dEmi = ! empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ? |
|
| 3172 | + $dEmi = !empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ? |
|
| 3173 | 3173 | $this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue : ''; |
| 3174 | 3174 | $aDemi = explode('T', $dEmi); |
| 3175 | 3175 | $dEmi = $aDemi[0]; |
| 3176 | 3176 | } |
| 3177 | 3177 | $dd = $dEmi; |
| 3178 | 3178 | $rpos = strrpos($dd, '-'); |
| 3179 | - $dd = substr($dd, $rpos +1); |
|
| 3179 | + $dd = substr($dd, $rpos + 1); |
|
| 3180 | 3180 | $chave = sprintf($forma, $cUF, $this->tpEmis, $CNPJ, $vNF, $vICMS, $icmss, $dd); |
| 3181 | 3181 | $chave = $chave . $this->modulo11($chave); |
| 3182 | 3182 | return $chave; |
@@ -3197,7 +3197,7 @@ discard block |
||
| 3197 | 3197 | $formaNfRef = "\r\nNF Ref.: série:%d numero:%d emit:%s em %s modelo: %d"; |
| 3198 | 3198 | $formaECFRef = "\r\nECF Ref.: modelo: %s ECF:%d COO:%d"; |
| 3199 | 3199 | $formaNfpRef = "\r\nNFP Ref.: série:%d número:%d emit:%s em %s modelo: %d IE:%s"; |
| 3200 | - $saida=''; |
|
| 3200 | + $saida = ''; |
|
| 3201 | 3201 | $nfRefs = $this->ide->getElementsByTagName('NFref'); |
| 3202 | 3202 | if (0 === $nfRefs->length) { |
| 3203 | 3203 | return $saida; |
@@ -3213,7 +3213,7 @@ discard block |
||
| 3213 | 3213 | foreach ($refNFe as $chave_acessoRef) { |
| 3214 | 3214 | $chave_acesso = $chave_acessoRef->nodeValue; |
| 3215 | 3215 | $chave_acessoF = $this->formatField($chave_acesso, $this->formatoChave); |
| 3216 | - $data = substr($chave_acesso, 4, 2)."/20".substr($chave_acesso, 2, 2); |
|
| 3216 | + $data = substr($chave_acesso, 4, 2) . "/20" . substr($chave_acesso, 2, 2); |
|
| 3217 | 3217 | $cnpj = $this->formatField(substr($chave_acesso, 6, 14), "##.###.###/####-##"); |
| 3218 | 3218 | $serie = substr($chave_acesso, 22, 3); |
| 3219 | 3219 | $numero = substr($chave_acesso, 25, 9); |
@@ -3234,7 +3234,7 @@ discard block |
||
| 3234 | 3234 | foreach ($refCTe as $chave_acessoRef) { |
| 3235 | 3235 | $chave_acesso = $chave_acessoRef->nodeValue; |
| 3236 | 3236 | $chave_acessoF = $this->formatField($chave_acesso, $this->formatoChave); |
| 3237 | - $data = substr($chave_acesso, 4, 2)."/20".substr($chave_acesso, 2, 2); |
|
| 3237 | + $data = substr($chave_acesso, 4, 2) . "/20" . substr($chave_acesso, 2, 2); |
|
| 3238 | 3238 | $cnpj = $this->formatField(substr($chave_acesso, 6, 14), "##.###.###/####-##"); |
| 3239 | 3239 | $serie = substr($chave_acesso, 22, 3); |
| 3240 | 3240 | $numero = substr($chave_acesso, 25, 9); |
@@ -3250,10 +3250,9 @@ discard block |
||
| 3250 | 3250 | $refNFP = $nfRef->getElementsByTagName('refNFP'); |
| 3251 | 3251 | foreach ($refNFP as $umaRefNFe) { |
| 3252 | 3252 | $data = $umaRefNFe->getElementsByTagName('AAMM')->item(0)->nodeValue; |
| 3253 | - $cnpj = ! empty($umaRefNFe->getElementsByTagName('CNPJ')->item(0)->nodeValue) ? |
|
| 3254 | - $umaRefNFe->getElementsByTagName('CNPJ')->item(0)->nodeValue : |
|
| 3255 | - ''; |
|
| 3256 | - $cpf = ! empty($umaRefNFe->getElementsByTagName('CPF')->item(0)->nodeValue) ? |
|
| 3253 | + $cnpj = !empty($umaRefNFe->getElementsByTagName('CNPJ')->item(0)->nodeValue) ? |
|
| 3254 | + $umaRefNFe->getElementsByTagName('CNPJ')->item(0)->nodeValue : ''; |
|
| 3255 | + $cpf = !empty($umaRefNFe->getElementsByTagName('CPF')->item(0)->nodeValue) ? |
|
| 3257 | 3256 | $umaRefNFe->getElementsByTagName('CPF')->item(0)->nodeValue : ''; |
| 3258 | 3257 | $mod = $umaRefNFe->getElementsByTagName('mod')->item(0)->nodeValue; |
| 3259 | 3258 | $serie = $umaRefNFe->getElementsByTagName('serie')->item(0)->nodeValue; |
@@ -3317,6 +3316,6 @@ discard block |
||
| 3317 | 3316 | imagedestroy($image); |
| 3318 | 3317 | $stringdata = ob_get_contents(); // read from buffer |
| 3319 | 3318 | ob_end_clean(); |
| 3320 | - return 'data://text/plain;base64,'.base64_encode($stringdata); |
|
| 3319 | + return 'data://text/plain;base64,' . base64_encode($stringdata); |
|
| 3321 | 3320 | } |
| 3322 | 3321 | } |
@@ -9,64 +9,64 @@ discard block |
||
| 9 | 9 | const FPDF_VERSION = '1.6'; |
| 10 | 10 | const FPDF_FONTPATH = '/font/'; |
| 11 | 11 | |
| 12 | - public $page; //current page number |
|
| 13 | - public $n; //current object number |
|
| 14 | - public $offsets; //array of object offsets |
|
| 15 | - public $buffer; //buffer holding in-memory PDF |
|
| 16 | - public $pages; //array containing pages |
|
| 17 | - public $state; //current document state |
|
| 18 | - public $compress; //compression flag |
|
| 19 | - public $k; //scale factor (number of points in user unit) |
|
| 20 | - public $defOrientation; //default orientation |
|
| 21 | - public $curOrientation; //current orientation |
|
| 22 | - public $pageFormats; //available page formats |
|
| 23 | - public $defPageFormat; //default page format |
|
| 24 | - public $curPageFormat; //current page format |
|
| 25 | - public $pageSizes; //array storing non-default page sizes |
|
| 12 | + public $page; //current page number |
|
| 13 | + public $n; //current object number |
|
| 14 | + public $offsets; //array of object offsets |
|
| 15 | + public $buffer; //buffer holding in-memory PDF |
|
| 16 | + public $pages; //array containing pages |
|
| 17 | + public $state; //current document state |
|
| 18 | + public $compress; //compression flag |
|
| 19 | + public $k; //scale factor (number of points in user unit) |
|
| 20 | + public $defOrientation; //default orientation |
|
| 21 | + public $curOrientation; //current orientation |
|
| 22 | + public $pageFormats; //available page formats |
|
| 23 | + public $defPageFormat; //default page format |
|
| 24 | + public $curPageFormat; //current page format |
|
| 25 | + public $pageSizes; //array storing non-default page sizes |
|
| 26 | 26 | public $wPt; |
| 27 | - public $hPt; //dimensions of current page in points |
|
| 27 | + public $hPt; //dimensions of current page in points |
|
| 28 | 28 | public $w; |
| 29 | - public $h; //dimensions of current page in user unit |
|
| 30 | - public $lMargin; //left margin |
|
| 31 | - public $tMargin; //top margin |
|
| 32 | - public $rMargin; //right margin |
|
| 33 | - public $bMargin; //page break margin |
|
| 34 | - public $cMargin; //cell margin |
|
| 29 | + public $h; //dimensions of current page in user unit |
|
| 30 | + public $lMargin; //left margin |
|
| 31 | + public $tMargin; //top margin |
|
| 32 | + public $rMargin; //right margin |
|
| 33 | + public $bMargin; //page break margin |
|
| 34 | + public $cMargin; //cell margin |
|
| 35 | 35 | public $x; |
| 36 | - public $y; //current position in user unit |
|
| 37 | - public $lasth; //height of last printed cell |
|
| 38 | - public $lineWidth; //line width in user unit |
|
| 39 | - public $coreFonts; //array of standard font names |
|
| 40 | - public $fonts; //array of used fonts |
|
| 41 | - public $fontFiles; //array of font files |
|
| 42 | - public $diffs; //array of encoding differences |
|
| 43 | - public $fontFamily; //current font family |
|
| 44 | - public $fontStyle; //current font style |
|
| 45 | - public $underline; //underlining flag |
|
| 46 | - public $currentFont; //current font info |
|
| 47 | - public $fontSizePt; //current font size in points |
|
| 48 | - public $fontSize; //current font size in user unit |
|
| 49 | - public $drawColor; //commands for drawing color |
|
| 50 | - public $fillColor; //commands for filling color |
|
| 51 | - public $textColor; //commands for text color |
|
| 52 | - public $colorFlag; //indicates whether fill and text colors are different |
|
| 53 | - public $ws; //word spacing |
|
| 54 | - public $images; //array of used images |
|
| 55 | - public $PageLinks; //array of links in pages |
|
| 56 | - public $links; //array of internal links |
|
| 57 | - public $autoPageBreak; //automatic page breaking |
|
| 58 | - public $pageBreakTrigger; //threshold used to trigger page breaks |
|
| 59 | - public $inHeader; //flag set when processing header |
|
| 60 | - public $inFooter; //flag set when processing footer |
|
| 61 | - public $zoomMode; //zoom display mode |
|
| 62 | - public $layoutMode; //layout display mode |
|
| 63 | - public $title; //title |
|
| 64 | - public $subject; //subject |
|
| 65 | - public $author; //author |
|
| 66 | - public $keywords; //keywords |
|
| 67 | - public $creator; //creator |
|
| 68 | - public $aliasNbPages; //alias for total number of pages |
|
| 69 | - public $pdfVersion; //PDF version number |
|
| 36 | + public $y; //current position in user unit |
|
| 37 | + public $lasth; //height of last printed cell |
|
| 38 | + public $lineWidth; //line width in user unit |
|
| 39 | + public $coreFonts; //array of standard font names |
|
| 40 | + public $fonts; //array of used fonts |
|
| 41 | + public $fontFiles; //array of font files |
|
| 42 | + public $diffs; //array of encoding differences |
|
| 43 | + public $fontFamily; //current font family |
|
| 44 | + public $fontStyle; //current font style |
|
| 45 | + public $underline; //underlining flag |
|
| 46 | + public $currentFont; //current font info |
|
| 47 | + public $fontSizePt; //current font size in points |
|
| 48 | + public $fontSize; //current font size in user unit |
|
| 49 | + public $drawColor; //commands for drawing color |
|
| 50 | + public $fillColor; //commands for filling color |
|
| 51 | + public $textColor; //commands for text color |
|
| 52 | + public $colorFlag; //indicates whether fill and text colors are different |
|
| 53 | + public $ws; //word spacing |
|
| 54 | + public $images; //array of used images |
|
| 55 | + public $PageLinks; //array of links in pages |
|
| 56 | + public $links; //array of internal links |
|
| 57 | + public $autoPageBreak; //automatic page breaking |
|
| 58 | + public $pageBreakTrigger; //threshold used to trigger page breaks |
|
| 59 | + public $inHeader; //flag set when processing header |
|
| 60 | + public $inFooter; //flag set when processing footer |
|
| 61 | + public $zoomMode; //zoom display mode |
|
| 62 | + public $layoutMode; //layout display mode |
|
| 63 | + public $title; //title |
|
| 64 | + public $subject; //subject |
|
| 65 | + public $author; //author |
|
| 66 | + public $keywords; //keywords |
|
| 67 | + public $creator; //creator |
|
| 68 | + public $aliasNbPages; //alias for total number of pages |
|
| 69 | + public $pdfVersion; //PDF version number |
|
| 70 | 70 | |
| 71 | 71 | public function __construct($orientation = 'P', $unit = 'mm', $format = 'A4') |
| 72 | 72 | { |
@@ -117,21 +117,21 @@ discard block |
||
| 117 | 117 | if ($unit == 'pt') { |
| 118 | 118 | $this->k = 1; |
| 119 | 119 | } elseif ($unit == 'mm') { |
| 120 | - $this->k = 72/25.4; |
|
| 120 | + $this->k = 72 / 25.4; |
|
| 121 | 121 | } elseif ($unit == 'cm') { |
| 122 | - $this->k = 72/2.54; |
|
| 122 | + $this->k = 72 / 2.54; |
|
| 123 | 123 | } elseif ($unit == 'in') { |
| 124 | 124 | $this->k = 72; |
| 125 | 125 | } else { |
| 126 | - $this->error('Incorrect unit: '.$unit); |
|
| 126 | + $this->error('Incorrect unit: ' . $unit); |
|
| 127 | 127 | } |
| 128 | 128 | //Page format |
| 129 | 129 | $this->pageFormats = [ |
| 130 | - 'a3' => [841.89,1190.55], |
|
| 131 | - 'a4' => [595.28,841.89], |
|
| 132 | - 'a5' => [420.94,595.28], |
|
| 133 | - 'letter' => [612,792], |
|
| 134 | - 'legal' => [612,1008] |
|
| 130 | + 'a3' => [841.89, 1190.55], |
|
| 131 | + 'a4' => [595.28, 841.89], |
|
| 132 | + 'a5' => [420.94, 595.28], |
|
| 133 | + 'letter' => [612, 792], |
|
| 134 | + 'legal' => [612, 1008] |
|
| 135 | 135 | ]; |
| 136 | 136 | if (is_string($format)) { |
| 137 | 137 | $format = $this->getpageformat($format); |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | //Page orientation |
| 142 | 142 | $orientation = strtolower($orientation); |
| 143 | 143 | if ($orientation == 'p' || $orientation == 'portrait') { |
| 144 | - $this->defOrientation='P'; |
|
| 144 | + $this->defOrientation = 'P'; |
|
| 145 | 145 | $this->w = $this->defPageFormat[0]; |
| 146 | 146 | $this->h = $this->defPageFormat[1]; |
| 147 | 147 | } elseif ($orientation == 'l' || $orientation == 'landscape') { |
@@ -149,26 +149,26 @@ discard block |
||
| 149 | 149 | $this->w = $this->defPageFormat[1]; |
| 150 | 150 | $this->h = $this->defPageFormat[0]; |
| 151 | 151 | } else { |
| 152 | - $this->error('Incorrect orientation: '.$orientation); |
|
| 152 | + $this->error('Incorrect orientation: ' . $orientation); |
|
| 153 | 153 | } |
| 154 | 154 | $this->curOrientation = $this->defOrientation; |
| 155 | - $this->wPt = $this->w*$this->k; |
|
| 156 | - $this->hPt = $this->h*$this->k; |
|
| 155 | + $this->wPt = $this->w * $this->k; |
|
| 156 | + $this->hPt = $this->h * $this->k; |
|
| 157 | 157 | //Page margins (1 cm) |
| 158 | - $margin = 28.35/$this->k; |
|
| 158 | + $margin = 28.35 / $this->k; |
|
| 159 | 159 | $this->setMargins($margin, $margin); |
| 160 | 160 | //Interior cell margin (1 mm) |
| 161 | - $this->cMargin = $margin/10; |
|
| 161 | + $this->cMargin = $margin / 10; |
|
| 162 | 162 | //Line width (0.2 mm) |
| 163 | - $this->lineWidth = .567/$this->k; |
|
| 163 | + $this->lineWidth = .567 / $this->k; |
|
| 164 | 164 | //Automatic page break |
| 165 | - $this->setAutoPageBreak(true, 2*$margin); |
|
| 165 | + $this->setAutoPageBreak(true, 2 * $margin); |
|
| 166 | 166 | //Full width display mode |
| 167 | 167 | $this->setDisplayMode('fullwidth'); |
| 168 | 168 | //Enable compression |
| 169 | 169 | $this->setCompression(true); |
| 170 | 170 | //Set default PDF version number |
| 171 | - $this->pdfVersion='1.3'; |
|
| 171 | + $this->pdfVersion = '1.3'; |
|
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | public function setMargins($left, $top, $right = null) |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | if ($right === null) { |
| 180 | 180 | $right = $left; |
| 181 | 181 | } |
| 182 | - $this->rMargin=$right; |
|
| 182 | + $this->rMargin = $right; |
|
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | public function setLeftMargin($margin) |
@@ -208,21 +208,21 @@ discard block |
||
| 208 | 208 | //Set auto page break mode and triggering margin |
| 209 | 209 | $this->autoPageBreak = $auto; |
| 210 | 210 | $this->bMargin = $margin; |
| 211 | - $this->pageBreakTrigger = $this->h-$margin; |
|
| 211 | + $this->pageBreakTrigger = $this->h - $margin; |
|
| 212 | 212 | } |
| 213 | 213 | |
| 214 | 214 | public function setDisplayMode($zoom, $layout = 'continuous') |
| 215 | 215 | { |
| 216 | 216 | //Set display mode in viewer |
| 217 | - if ($zoom=='fullpage' || $zoom=='fullwidth' || $zoom=='real' || $zoom=='default' || !is_string($zoom)) { |
|
| 217 | + if ($zoom == 'fullpage' || $zoom == 'fullwidth' || $zoom == 'real' || $zoom == 'default' || !is_string($zoom)) { |
|
| 218 | 218 | $this->zoomMode = $zoom; |
| 219 | 219 | } else { |
| 220 | - $this->error('Incorrect zoom display mode: '.$zoom); |
|
| 220 | + $this->error('Incorrect zoom display mode: ' . $zoom); |
|
| 221 | 221 | } |
| 222 | - if ($layout=='single' || $layout=='continuous' || $layout=='two' || $layout=='default') { |
|
| 222 | + if ($layout == 'single' || $layout == 'continuous' || $layout == 'two' || $layout == 'default') { |
|
| 223 | 223 | $this->layoutMode = $layout; |
| 224 | 224 | } else { |
| 225 | - $this->error('Incorrect layout display mode: '.$layout); |
|
| 225 | + $this->error('Incorrect layout display mode: ' . $layout); |
|
| 226 | 226 | } |
| 227 | 227 | } |
| 228 | 228 | |
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | if ($isUTF8) { |
| 261 | 261 | $author = $this->utf8Toutf16($author); |
| 262 | 262 | } |
| 263 | - $this->author=$author; |
|
| 263 | + $this->author = $author; |
|
| 264 | 264 | } |
| 265 | 265 | |
| 266 | 266 | public function setKeywords($keywords, $isUTF8 = false) |
@@ -284,7 +284,7 @@ discard block |
||
| 284 | 284 | public function aliasNbPages($alias = '{nb}') |
| 285 | 285 | { |
| 286 | 286 | //Define an alias for total number of pages |
| 287 | - $this->aliasNbPages=$alias; |
|
| 287 | + $this->aliasNbPages = $alias; |
|
| 288 | 288 | } |
| 289 | 289 | |
| 290 | 290 | public function error($msg) |
@@ -323,7 +323,7 @@ discard block |
||
| 323 | 323 | $this->open(); |
| 324 | 324 | } |
| 325 | 325 | $family = $this->fontFamily; |
| 326 | - $style = $this->fontStyle.($this->underline ? 'U' : ''); |
|
| 326 | + $style = $this->fontStyle . ($this->underline ? 'U' : ''); |
|
| 327 | 327 | $size = $this->fontSizePt; |
| 328 | 328 | $lw = $this->lineWidth; |
| 329 | 329 | $dc = $this->drawColor; |
@@ -344,14 +344,14 @@ discard block |
||
| 344 | 344 | $this->out('2 J'); |
| 345 | 345 | //Set line width |
| 346 | 346 | $this->lineWidth = $lw; |
| 347 | - $this->out(sprintf('%.2F w', $lw*$this->k)); |
|
| 347 | + $this->out(sprintf('%.2F w', $lw * $this->k)); |
|
| 348 | 348 | //Set font |
| 349 | 349 | if ($family) { |
| 350 | 350 | $this->setFont($family, $style, $size); |
| 351 | 351 | } |
| 352 | 352 | //Set colors |
| 353 | 353 | $this->drawColor = $dc; |
| 354 | - if ($dc!='0 G') { |
|
| 354 | + if ($dc != '0 G') { |
|
| 355 | 355 | $this->out($dc); |
| 356 | 356 | } |
| 357 | 357 | $this->fillColor = $fc; |
@@ -367,7 +367,7 @@ discard block |
||
| 367 | 367 | //Restore line width |
| 368 | 368 | if ($this->lineWidth != $lw) { |
| 369 | 369 | $this->lineWidth = $lw; |
| 370 | - $this->out(sprintf('%.2F w', $lw*$this->k)); |
|
| 370 | + $this->out(sprintf('%.2F w', $lw * $this->k)); |
|
| 371 | 371 | } |
| 372 | 372 | //Restore font |
| 373 | 373 | if ($family) { |
@@ -405,10 +405,10 @@ discard block |
||
| 405 | 405 | public function setDrawColor($r, $g = null, $b = null) |
| 406 | 406 | { |
| 407 | 407 | //Set color for all stroking operations |
| 408 | - if (($r==0 && $g==0 && $b==0) || $g===null) { |
|
| 409 | - $this->drawColor = sprintf('%.3F G', $r/255); |
|
| 408 | + if (($r == 0 && $g == 0 && $b == 0) || $g === null) { |
|
| 409 | + $this->drawColor = sprintf('%.3F G', $r / 255); |
|
| 410 | 410 | } else { |
| 411 | - $this->drawColor = sprintf('%.3F %.3F %.3F RG', $r/255, $g/255, $b/255); |
|
| 411 | + $this->drawColor = sprintf('%.3F %.3F %.3F RG', $r / 255, $g / 255, $b / 255); |
|
| 412 | 412 | } |
| 413 | 413 | if ($this->page > 0) { |
| 414 | 414 | $this->out($this->drawColor); |
@@ -418,10 +418,10 @@ discard block |
||
| 418 | 418 | public function setFillColor($r, $g = null, $b = null) |
| 419 | 419 | { |
| 420 | 420 | //Set color for all filling operations |
| 421 | - if (($r==0 && $g==0 && $b==0) || $g===null) { |
|
| 422 | - $this->fillColor = sprintf('%.3F g', $r/255); |
|
| 421 | + if (($r == 0 && $g == 0 && $b == 0) || $g === null) { |
|
| 422 | + $this->fillColor = sprintf('%.3F g', $r / 255); |
|
| 423 | 423 | } else { |
| 424 | - $this->fillColor = sprintf('%.3F %.3F %.3F rg', $r/255, $g/255, $b/255); |
|
| 424 | + $this->fillColor = sprintf('%.3F %.3F %.3F rg', $r / 255, $g / 255, $b / 255); |
|
| 425 | 425 | } |
| 426 | 426 | $this->colorFlag = ($this->fillColor != $this->textColor); |
| 427 | 427 | if ($this->page > 0) { |
@@ -432,10 +432,10 @@ discard block |
||
| 432 | 432 | public function settextColor($r, $g = null, $b = null) |
| 433 | 433 | { |
| 434 | 434 | //Set color for text |
| 435 | - if (($r==0 && $g==0 && $b==0) || $g===null) { |
|
| 436 | - $this->textColor = sprintf('%.3F g', $r/255); |
|
| 435 | + if (($r == 0 && $g == 0 && $b == 0) || $g === null) { |
|
| 436 | + $this->textColor = sprintf('%.3F g', $r / 255); |
|
| 437 | 437 | } else { |
| 438 | - $this->textColor = sprintf('%.3F %.3F %.3F rg', $r/255, $g/255, $b/255); |
|
| 438 | + $this->textColor = sprintf('%.3F %.3F %.3F rg', $r / 255, $g / 255, $b / 255); |
|
| 439 | 439 | } |
| 440 | 440 | $this->colorFlag = ($this->fillColor != $this->textColor); |
| 441 | 441 | } |
@@ -443,14 +443,14 @@ discard block |
||
| 443 | 443 | public function getStringWidth($s) |
| 444 | 444 | { |
| 445 | 445 | //Get width of a string in the current font |
| 446 | - $s = (string)$s; |
|
| 447 | - $cw =& $this->currentFont['cw']; |
|
| 446 | + $s = (string) $s; |
|
| 447 | + $cw = & $this->currentFont['cw']; |
|
| 448 | 448 | $w = 0; |
| 449 | 449 | $l = strlen($s); |
| 450 | - for ($i=0; $i<$l; $i++) { |
|
| 450 | + for ($i = 0; $i < $l; $i++) { |
|
| 451 | 451 | $w += $cw[$s[$i]]; |
| 452 | 452 | } |
| 453 | - return $w*$this->fontSize/1000; |
|
| 453 | + return $w * $this->fontSize / 1000; |
|
| 454 | 454 | } |
| 455 | 455 | |
| 456 | 456 | public function setLineWidth($width) |
@@ -458,7 +458,7 @@ discard block |
||
| 458 | 458 | //Set line width |
| 459 | 459 | $this->lineWidth = $width; |
| 460 | 460 | if ($this->page > 0) { |
| 461 | - $this->out(sprintf('%.2F w', $width*$this->k)); |
|
| 461 | + $this->out(sprintf('%.2F w', $width * $this->k)); |
|
| 462 | 462 | } |
| 463 | 463 | } |
| 464 | 464 | |
@@ -468,10 +468,10 @@ discard block |
||
| 468 | 468 | $this->out( |
| 469 | 469 | sprintf( |
| 470 | 470 | '%.2F %.2F m %.2F %.2F l S', |
| 471 | - $x1*$this->k, |
|
| 472 | - ($this->h-$y1)*$this->k, |
|
| 473 | - $x2*$this->k, |
|
| 474 | - ($this->h-$y2)*$this->k |
|
| 471 | + $x1 * $this->k, |
|
| 472 | + ($this->h - $y1) * $this->k, |
|
| 473 | + $x2 * $this->k, |
|
| 474 | + ($this->h - $y2) * $this->k |
|
| 475 | 475 | ) |
| 476 | 476 | ); |
| 477 | 477 | } |
@@ -489,10 +489,10 @@ discard block |
||
| 489 | 489 | $this->out( |
| 490 | 490 | sprintf( |
| 491 | 491 | '%.2F %.2F %.2F %.2F re %s', |
| 492 | - $x*$this->k, |
|
| 493 | - ($this->h-$y)*$this->k, |
|
| 494 | - $w*$this->k, |
|
| 495 | - -$h*$this->k, |
|
| 492 | + $x * $this->k, |
|
| 493 | + ($this->h - $y) * $this->k, |
|
| 494 | + $w * $this->k, |
|
| 495 | + -$h * $this->k, |
|
| 496 | 496 | $op |
| 497 | 497 | ) |
| 498 | 498 | ); |
@@ -503,24 +503,24 @@ discard block |
||
| 503 | 503 | //Add a TrueType or Type1 font |
| 504 | 504 | $family = strtolower($family); |
| 505 | 505 | if ($file == '') { |
| 506 | - $file = str_replace(' ', '', $family).strtolower($style).'.php'; |
|
| 506 | + $file = str_replace(' ', '', $family) . strtolower($style) . '.php'; |
|
| 507 | 507 | } |
| 508 | - if ($family=='arial') { |
|
| 509 | - $family='helvetica'; |
|
| 508 | + if ($family == 'arial') { |
|
| 509 | + $family = 'helvetica'; |
|
| 510 | 510 | } |
| 511 | 511 | $style = strtoupper($style); |
| 512 | 512 | if ($style == 'IB') { |
| 513 | 513 | $style = 'BI'; |
| 514 | 514 | } |
| 515 | - $fontkey = $family.$style; |
|
| 515 | + $fontkey = $family . $style; |
|
| 516 | 516 | if (isset($this->fonts[$fontkey])) { |
| 517 | 517 | return; |
| 518 | 518 | } |
| 519 | - include $this->getFontPath().$file; |
|
| 519 | + include $this->getFontPath() . $file; |
|
| 520 | 520 | if (!isset($name)) { |
| 521 | 521 | $this->error('Could not include font definition file'); |
| 522 | 522 | } |
| 523 | - $i = count($this->fonts)+1; |
|
| 523 | + $i = count($this->fonts) + 1; |
|
| 524 | 524 | $this->fonts[$fontkey] = [ |
| 525 | 525 | 'i'=>$i, |
| 526 | 526 | 'type'=>$type, |
@@ -536,20 +536,20 @@ discard block |
||
| 536 | 536 | //Search existing encodings |
| 537 | 537 | $d = 0; |
| 538 | 538 | $nb = count($this->diffs); |
| 539 | - for ($i=1; $i<=$nb; $i++) { |
|
| 539 | + for ($i = 1; $i <= $nb; $i++) { |
|
| 540 | 540 | if ($this->diffs[$i] == $diff) { |
| 541 | 541 | $d = $i; |
| 542 | 542 | break; |
| 543 | 543 | } |
| 544 | 544 | } |
| 545 | 545 | if ($d == 0) { |
| 546 | - $d = $nb+1; |
|
| 546 | + $d = $nb + 1; |
|
| 547 | 547 | $this->diffs[$d] = $diff; |
| 548 | 548 | } |
| 549 | 549 | $this->fonts[$fontkey]['diff'] = $d; |
| 550 | 550 | } |
| 551 | 551 | if ($file) { |
| 552 | - if ($type=='TrueType') { |
|
| 552 | + if ($type == 'TrueType') { |
|
| 553 | 553 | $this->fontFiles[$file] = ['length1'=>$originalsize]; |
| 554 | 554 | } else { |
| 555 | 555 | $this->fontFiles[$file] = ['length1'=>$size1, 'length2'=>$size2]; |
@@ -584,39 +584,39 @@ discard block |
||
| 584 | 584 | $size = $this->fontSizePt; |
| 585 | 585 | } |
| 586 | 586 | //Test if font is already selected |
| 587 | - if ($this->fontFamily==$family && $this->fontStyle==$style && $this->fontSizePt==$size) { |
|
| 587 | + if ($this->fontFamily == $family && $this->fontStyle == $style && $this->fontSizePt == $size) { |
|
| 588 | 588 | return; |
| 589 | 589 | } |
| 590 | 590 | //Test if used for the first time |
| 591 | - $fontkey = $family.$style; |
|
| 591 | + $fontkey = $family . $style; |
|
| 592 | 592 | if (!isset($this->fonts[$fontkey])) { |
| 593 | 593 | //Check if one of the standard fonts |
| 594 | 594 | if (isset($this->coreFonts[$fontkey])) { |
| 595 | 595 | if (!isset($fpdf_charwidths[$fontkey])) { |
| 596 | 596 | //Load metric file |
| 597 | - $file=$family; |
|
| 598 | - if ($family=='times' || $family=='helvetica') { |
|
| 597 | + $file = $family; |
|
| 598 | + if ($family == 'times' || $family == 'helvetica') { |
|
| 599 | 599 | $file .= strtolower($style); |
| 600 | 600 | } |
| 601 | - include $this->getFontPath().$file.'.php'; |
|
| 601 | + include $this->getFontPath() . $file . '.php'; |
|
| 602 | 602 | if (!isset($fpdf_charwidths[$fontkey])) { |
| 603 | 603 | $this->error('Could not include font metric file'); |
| 604 | 604 | } |
| 605 | 605 | } |
| 606 | - $i = count($this->fonts)+1; |
|
| 606 | + $i = count($this->fonts) + 1; |
|
| 607 | 607 | $name = $this->coreFonts[$fontkey]; |
| 608 | 608 | $cw = $fpdf_charwidths[$fontkey]; |
| 609 | 609 | $this->fonts[$fontkey] = ['i'=>$i, 'type'=>'core', 'name'=>$name, 'up'=>-100, 'ut'=>50, 'cw'=>$cw]; |
| 610 | 610 | } else { |
| 611 | - $this->error('Undefined font: '.$family.' '.$style); |
|
| 611 | + $this->error('Undefined font: ' . $family . ' ' . $style); |
|
| 612 | 612 | } |
| 613 | 613 | } |
| 614 | 614 | //Select it |
| 615 | 615 | $this->fontFamily = $family; |
| 616 | 616 | $this->fontStyle = $style; |
| 617 | 617 | $this->fontSizePt = $size; |
| 618 | - $this->fontSize = $size/$this->k; |
|
| 619 | - $this->currentFont =& $this->fonts[$fontkey]; |
|
| 618 | + $this->fontSize = $size / $this->k; |
|
| 619 | + $this->currentFont = & $this->fonts[$fontkey]; |
|
| 620 | 620 | if ($this->page > 0) { |
| 621 | 621 | $this->out(sprintf('BT /F%d %.2F Tf ET', $this->currentFont['i'], $this->fontSizePt)); |
| 622 | 622 | } |
@@ -629,7 +629,7 @@ discard block |
||
| 629 | 629 | return; |
| 630 | 630 | } |
| 631 | 631 | $this->fontSizePt = $size; |
| 632 | - $this->fontSize = $size/$this->k; |
|
| 632 | + $this->fontSize = $size / $this->k; |
|
| 633 | 633 | if ($this->page > 0) { |
| 634 | 634 | $this->out(sprintf('BT /F%d %.2F Tf ET', $this->currentFont['i'], $this->fontSizePt)); |
| 635 | 635 | } |
@@ -638,7 +638,7 @@ discard block |
||
| 638 | 638 | public function addlink() |
| 639 | 639 | { |
| 640 | 640 | //Create a new internal link |
| 641 | - $n = count($this->links)+1; |
|
| 641 | + $n = count($this->links) + 1; |
|
| 642 | 642 | $this->links[$n] = [0, 0]; |
| 643 | 643 | return $n; |
| 644 | 644 | } |
@@ -659,10 +659,10 @@ discard block |
||
| 659 | 659 | { |
| 660 | 660 | //Put a link on the page |
| 661 | 661 | $this->PageLinks[$this->page][] = [ |
| 662 | - $x*$this->k, |
|
| 663 | - $this->hPt-$y*$this->k, |
|
| 664 | - $w*$this->k, |
|
| 665 | - $h*$this->k, |
|
| 662 | + $x * $this->k, |
|
| 663 | + $this->hPt - $y * $this->k, |
|
| 664 | + $w * $this->k, |
|
| 665 | + $h * $this->k, |
|
| 666 | 666 | $link |
| 667 | 667 | ]; |
| 668 | 668 | } |
@@ -670,12 +670,12 @@ discard block |
||
| 670 | 670 | public function text($x, $y, $txt) |
| 671 | 671 | { |
| 672 | 672 | //Output a string |
| 673 | - $s = sprintf('BT %.2F %.2F Td (%s) Tj ET', $x*$this->k, ($this->h-$y)*$this->k, $this->escape($txt)); |
|
| 674 | - if ($this->underline && $txt!='') { |
|
| 675 | - $s .= ' '.$this->doUnderLine($x, $y, $txt); |
|
| 673 | + $s = sprintf('BT %.2F %.2F Td (%s) Tj ET', $x * $this->k, ($this->h - $y) * $this->k, $this->escape($txt)); |
|
| 674 | + if ($this->underline && $txt != '') { |
|
| 675 | + $s .= ' ' . $this->doUnderLine($x, $y, $txt); |
|
| 676 | 676 | } |
| 677 | 677 | if ($this->colorFlag) { |
| 678 | - $s = 'q '.$this->textColor.' '.$s.' Q'; |
|
| 678 | + $s = 'q ' . $this->textColor . ' ' . $s . ' Q'; |
|
| 679 | 679 | } |
| 680 | 680 | $this->out($s); |
| 681 | 681 | } |
@@ -690,7 +690,7 @@ discard block |
||
| 690 | 690 | { |
| 691 | 691 | //Output a cell |
| 692 | 692 | $k = $this->k; |
| 693 | - if ($this->y+$h > $this->pageBreakTrigger |
|
| 693 | + if ($this->y + $h > $this->pageBreakTrigger |
|
| 694 | 694 | && !$this->InHeader |
| 695 | 695 | && !$this->InFooter |
| 696 | 696 | && $this->acceptPageBreak() |
@@ -706,77 +706,77 @@ discard block |
||
| 706 | 706 | $this->x = $x; |
| 707 | 707 | if ($ws > 0) { |
| 708 | 708 | $this->ws = $ws; |
| 709 | - $this->out(sprintf('%.3F Tw', $ws*$k)); |
|
| 709 | + $this->out(sprintf('%.3F Tw', $ws * $k)); |
|
| 710 | 710 | } |
| 711 | 711 | } |
| 712 | 712 | if ($w == 0) { |
| 713 | - $w = $this->w-$this->rMargin-$this->x; |
|
| 713 | + $w = $this->w - $this->rMargin - $this->x; |
|
| 714 | 714 | } |
| 715 | - $s=''; |
|
| 716 | - if ($fill || $border==1) { |
|
| 715 | + $s = ''; |
|
| 716 | + if ($fill || $border == 1) { |
|
| 717 | 717 | if ($fill) { |
| 718 | - $op=($border==1) ? 'B' : 'f'; |
|
| 718 | + $op = ($border == 1) ? 'B' : 'f'; |
|
| 719 | 719 | } else { |
| 720 | - $op='S'; |
|
| 720 | + $op = 'S'; |
|
| 721 | 721 | } |
| 722 | - $s=sprintf('%.2F %.2F %.2F %.2F re %s ', $this->x*$k, ($this->h-$this->y)*$k, $w*$k, -$h*$k, $op); |
|
| 722 | + $s = sprintf('%.2F %.2F %.2F %.2F re %s ', $this->x * $k, ($this->h - $this->y) * $k, $w * $k, -$h * $k, $op); |
|
| 723 | 723 | } |
| 724 | 724 | if (is_string($border)) { |
| 725 | 725 | $x = $this->x; |
| 726 | 726 | $y = $this->y; |
| 727 | 727 | if (strpos($border, 'L') !== false) { |
| 728 | - $s .= sprintf('%.2F %.2F m %.2F %.2F l S ', $x*$k, ($this->h-$y)*$k, $x*$k, ($this->h-($y+$h))*$k); |
|
| 728 | + $s .= sprintf('%.2F %.2F m %.2F %.2F l S ', $x * $k, ($this->h - $y) * $k, $x * $k, ($this->h - ($y + $h)) * $k); |
|
| 729 | 729 | } |
| 730 | 730 | if (strpos($border, 'T') !== false) { |
| 731 | - $s .= sprintf('%.2F %.2F m %.2F %.2F l S ', $x*$k, ($this->h-$y)*$k, ($x+$w)*$k, ($this->h-$y)*$k); |
|
| 731 | + $s .= sprintf('%.2F %.2F m %.2F %.2F l S ', $x * $k, ($this->h - $y) * $k, ($x + $w) * $k, ($this->h - $y) * $k); |
|
| 732 | 732 | } |
| 733 | 733 | if (strpos($border, 'R') !== false) { |
| 734 | 734 | $s .= sprintf( |
| 735 | 735 | '%.2F %.2F m %.2F %.2F l S ', |
| 736 | - ($x+$w)*$k, |
|
| 737 | - ($this->h-$y)*$k, |
|
| 738 | - ($x+$w)*$k, |
|
| 739 | - ($this->h-($y+$h))*$k |
|
| 736 | + ($x + $w) * $k, |
|
| 737 | + ($this->h - $y) * $k, |
|
| 738 | + ($x + $w) * $k, |
|
| 739 | + ($this->h - ($y + $h)) * $k |
|
| 740 | 740 | ); |
| 741 | 741 | } |
| 742 | 742 | if (strpos($border, 'B') !== false) { |
| 743 | 743 | $s .= sprintf( |
| 744 | 744 | '%.2F %.2F m %.2F %.2F l S ', |
| 745 | - $x*$k, |
|
| 746 | - ($this->h-($y+$h))*$k, |
|
| 747 | - ($x+$w)*$k, |
|
| 748 | - ($this->h-($y+$h))*$k |
|
| 745 | + $x * $k, |
|
| 746 | + ($this->h - ($y + $h)) * $k, |
|
| 747 | + ($x + $w) * $k, |
|
| 748 | + ($this->h - ($y + $h)) * $k |
|
| 749 | 749 | ); |
| 750 | 750 | } |
| 751 | 751 | } |
| 752 | 752 | if ($txt !== '') { |
| 753 | 753 | if ($align == 'R') { |
| 754 | - $dx = $w-$this->cMargin-$this->getStringWidth($txt); |
|
| 754 | + $dx = $w - $this->cMargin - $this->getStringWidth($txt); |
|
| 755 | 755 | } elseif ($align == 'C') { |
| 756 | - $dx = ($w-$this->getStringWidth($txt))/2; |
|
| 756 | + $dx = ($w - $this->getStringWidth($txt)) / 2; |
|
| 757 | 757 | } else { |
| 758 | 758 | $dx = $this->cMargin; |
| 759 | 759 | } |
| 760 | 760 | if ($this->colorFlag) { |
| 761 | - $s .= 'q '.$this->textColor.' '; |
|
| 761 | + $s .= 'q ' . $this->textColor . ' '; |
|
| 762 | 762 | } |
| 763 | 763 | $txt2 = str_replace(')', '\\)', str_replace('(', '\\(', str_replace('\\', '\\\\', $txt))); |
| 764 | 764 | $s .= sprintf( |
| 765 | 765 | 'BT %.2F %.2F Td (%s) Tj ET', |
| 766 | - ($this->x+$dx)*$k, |
|
| 767 | - ($this->h-($this->y+.5*$h+.3*$this->fontSize))*$k, |
|
| 766 | + ($this->x + $dx) * $k, |
|
| 767 | + ($this->h - ($this->y + .5 * $h + .3 * $this->fontSize)) * $k, |
|
| 768 | 768 | $txt2 |
| 769 | 769 | ); |
| 770 | 770 | if ($this->underline) { |
| 771 | - $s .= ' '.$this->doUnderLine($this->x+$dx, $this->y+.5*$h+.3*$this->fontSize, $txt); |
|
| 771 | + $s .= ' ' . $this->doUnderLine($this->x + $dx, $this->y + .5 * $h + .3 * $this->fontSize, $txt); |
|
| 772 | 772 | } |
| 773 | 773 | if ($this->colorFlag) { |
| 774 | - $s.=' Q'; |
|
| 774 | + $s .= ' Q'; |
|
| 775 | 775 | } |
| 776 | 776 | if ($link) { |
| 777 | 777 | $this->link( |
| 778 | - $this->x+$dx, |
|
| 779 | - $this->y+.5*$h-.5*$this->fontSize, |
|
| 778 | + $this->x + $dx, |
|
| 779 | + $this->y + .5 * $h - .5 * $this->fontSize, |
|
| 780 | 780 | $this->getStringWidth($txt), |
| 781 | 781 | $this->fontSize, |
| 782 | 782 | $link |
@@ -801,14 +801,14 @@ discard block |
||
| 801 | 801 | public function multicell($w, $h, $txt, $border = 0, $align = 'J', $fill = false) |
| 802 | 802 | { |
| 803 | 803 | //Output text with automatic or explicit line breaks |
| 804 | - $cw =& $this->currentFont['cw']; |
|
| 804 | + $cw = & $this->currentFont['cw']; |
|
| 805 | 805 | if ($w == 0) { |
| 806 | - $w = $this->w-$this->rMargin-$this->x; |
|
| 806 | + $w = $this->w - $this->rMargin - $this->x; |
|
| 807 | 807 | } |
| 808 | - $wmax = ($w-2*$this->cMargin)*1000/$this->fontSize; |
|
| 808 | + $wmax = ($w - 2 * $this->cMargin) * 1000 / $this->fontSize; |
|
| 809 | 809 | $s = str_replace("\r", '', $txt); |
| 810 | 810 | $nb = strlen($s); |
| 811 | - if ($nb>0 && $s[$nb-1] == "\n") { |
|
| 811 | + if ($nb > 0 && $s[$nb - 1] == "\n") { |
|
| 812 | 812 | $nb--; |
| 813 | 813 | } |
| 814 | 814 | $b = 0; |
@@ -825,7 +825,7 @@ discard block |
||
| 825 | 825 | if (strpos($border, 'R') !== false) { |
| 826 | 826 | $b2 .= 'R'; |
| 827 | 827 | } |
| 828 | - $b=(strpos($border, 'T') !== false) ? $b2.'T' : $b2; |
|
| 828 | + $b = (strpos($border, 'T') !== false) ? $b2 . 'T' : $b2; |
|
| 829 | 829 | } |
| 830 | 830 | } |
| 831 | 831 | $sep = -1; |
@@ -834,7 +834,7 @@ discard block |
||
| 834 | 834 | $l = 0; |
| 835 | 835 | $ns = 0; |
| 836 | 836 | $nl = 1; |
| 837 | - while ($i<$nb) { |
|
| 837 | + while ($i < $nb) { |
|
| 838 | 838 | //Get next character |
| 839 | 839 | $c = $s[$i]; |
| 840 | 840 | if ($c == "\n") { |
@@ -843,7 +843,7 @@ discard block |
||
| 843 | 843 | $this->ws = 0; |
| 844 | 844 | $this->out('0 Tw'); |
| 845 | 845 | } |
| 846 | - $this->cell($w, $h, substr($s, $j, $i-$j), $b, 2, $align, $fill); |
|
| 846 | + $this->cell($w, $h, substr($s, $j, $i - $j), $b, 2, $align, $fill); |
|
| 847 | 847 | $i++; |
| 848 | 848 | $sep = -1; |
| 849 | 849 | $j = $i; |
@@ -851,7 +851,7 @@ discard block |
||
| 851 | 851 | $ns = 0; |
| 852 | 852 | $nl++; |
| 853 | 853 | if ($border && $nl == 2) { |
| 854 | - $b=$b2; |
|
| 854 | + $b = $b2; |
|
| 855 | 855 | } |
| 856 | 856 | continue; |
| 857 | 857 | } |
@@ -871,14 +871,14 @@ discard block |
||
| 871 | 871 | $this->ws = 0; |
| 872 | 872 | $this->out('0 Tw'); |
| 873 | 873 | } |
| 874 | - $this->cell($w, $h, substr($s, $j, $i-$j), $b, 2, $align, $fill); |
|
| 874 | + $this->cell($w, $h, substr($s, $j, $i - $j), $b, 2, $align, $fill); |
|
| 875 | 875 | } else { |
| 876 | - if ($align=='J') { |
|
| 877 | - $this->ws = ($ns>1) ? ($wmax-$ls)/1000*$this->fontSize/($ns-1) : 0; |
|
| 878 | - $this->out(sprintf('%.3F Tw', $this->ws*$this->k)); |
|
| 876 | + if ($align == 'J') { |
|
| 877 | + $this->ws = ($ns > 1) ? ($wmax - $ls) / 1000 * $this->fontSize / ($ns - 1) : 0; |
|
| 878 | + $this->out(sprintf('%.3F Tw', $this->ws * $this->k)); |
|
| 879 | 879 | } |
| 880 | - $this->cell($w, $h, substr($s, $j, $sep-$j), $b, 2, $align, $fill); |
|
| 881 | - $i = $sep+1; |
|
| 880 | + $this->cell($w, $h, substr($s, $j, $sep - $j), $b, 2, $align, $fill); |
|
| 881 | + $i = $sep + 1; |
|
| 882 | 882 | } |
| 883 | 883 | $sep = -1; |
| 884 | 884 | $j = $i; |
@@ -897,10 +897,10 @@ discard block |
||
| 897 | 897 | $this->ws = 0; |
| 898 | 898 | $this->out('0 Tw'); |
| 899 | 899 | } |
| 900 | - if ($border && strpos($border, 'B')!==false) { |
|
| 900 | + if ($border && strpos($border, 'B') !== false) { |
|
| 901 | 901 | $b .= 'B'; |
| 902 | 902 | } |
| 903 | - $this->cell($w, $h, substr($s, $j, $i-$j), $b, 2, $align, $fill); |
|
| 903 | + $this->cell($w, $h, substr($s, $j, $i - $j), $b, 2, $align, $fill); |
|
| 904 | 904 | $this->x = $this->lMargin; |
| 905 | 905 | } |
| 906 | 906 | |
@@ -908,9 +908,9 @@ discard block |
||
| 908 | 908 | public function write($h, $txt, $link = '') |
| 909 | 909 | { |
| 910 | 910 | //Output text in flowing mode |
| 911 | - $cw =& $this->currentFont['cw']; |
|
| 912 | - $w = $this->w-$this->rMargin-$this->x; |
|
| 913 | - $wmax = ($w-2*$this->cMargin)*1000/$this->fontSize; |
|
| 911 | + $cw = & $this->currentFont['cw']; |
|
| 912 | + $w = $this->w - $this->rMargin - $this->x; |
|
| 913 | + $wmax = ($w - 2 * $this->cMargin) * 1000 / $this->fontSize; |
|
| 914 | 914 | $s = str_replace("\r", '', $txt); |
| 915 | 915 | $nb = strlen($s); |
| 916 | 916 | $sep = -1; |
@@ -920,18 +920,18 @@ discard block |
||
| 920 | 920 | $nl = 1; |
| 921 | 921 | while ($i < $nb) { |
| 922 | 922 | //Get next character |
| 923 | - $c=$s[$i]; |
|
| 924 | - if ($c=="\n") { |
|
| 923 | + $c = $s[$i]; |
|
| 924 | + if ($c == "\n") { |
|
| 925 | 925 | //Explicit line break |
| 926 | - $this->cell($w, $h, substr($s, $j, $i-$j), 0, 2, '', 0, $link); |
|
| 926 | + $this->cell($w, $h, substr($s, $j, $i - $j), 0, 2, '', 0, $link); |
|
| 927 | 927 | $i++; |
| 928 | 928 | $sep = -1; |
| 929 | 929 | $j = $i; |
| 930 | 930 | $l = 0; |
| 931 | 931 | if ($nl == 1) { |
| 932 | 932 | $this->x = $this->lMargin; |
| 933 | - $w = $this->w-$this->rMargin-$this->x; |
|
| 934 | - $wmax = ($w-2*$this->cMargin)*1000/$this->fontSize; |
|
| 933 | + $w = $this->w - $this->rMargin - $this->x; |
|
| 934 | + $wmax = ($w - 2 * $this->cMargin) * 1000 / $this->fontSize; |
|
| 935 | 935 | } |
| 936 | 936 | $nl++; |
| 937 | 937 | continue; |
@@ -947,8 +947,8 @@ discard block |
||
| 947 | 947 | //Move to next line |
| 948 | 948 | $this->x = $this->lMargin; |
| 949 | 949 | $this->y += $h; |
| 950 | - $w = $this->w-$this->rMargin-$this->x; |
|
| 951 | - $wmax = ($w-2*$this->cMargin)*1000/$this->fontSize; |
|
| 950 | + $w = $this->w - $this->rMargin - $this->x; |
|
| 951 | + $wmax = ($w - 2 * $this->cMargin) * 1000 / $this->fontSize; |
|
| 952 | 952 | $i++; |
| 953 | 953 | $nl++; |
| 954 | 954 | continue; |
@@ -956,18 +956,18 @@ discard block |
||
| 956 | 956 | if ($i == $j) { |
| 957 | 957 | $i++; |
| 958 | 958 | } |
| 959 | - $this->cell($w, $h, substr($s, $j, $i-$j), 0, 2, '', 0, $link); |
|
| 959 | + $this->cell($w, $h, substr($s, $j, $i - $j), 0, 2, '', 0, $link); |
|
| 960 | 960 | } else { |
| 961 | - $this->cell($w, $h, substr($s, $j, $sep-$j), 0, 2, '', 0, $link); |
|
| 962 | - $i = $sep+1; |
|
| 961 | + $this->cell($w, $h, substr($s, $j, $sep - $j), 0, 2, '', 0, $link); |
|
| 962 | + $i = $sep + 1; |
|
| 963 | 963 | } |
| 964 | 964 | $sep = -1; |
| 965 | 965 | $j = $i; |
| 966 | 966 | $l = 0; |
| 967 | 967 | if ($nl == 1) { |
| 968 | 968 | $this->x = $this->lMargin; |
| 969 | - $w = $this->w-$this->rMargin-$this->x; |
|
| 970 | - $wmax = ($w-2*$this->cMargin)*1000/$this->fontSize; |
|
| 969 | + $w = $this->w - $this->rMargin - $this->x; |
|
| 970 | + $wmax = ($w - 2 * $this->cMargin) * 1000 / $this->fontSize; |
|
| 971 | 971 | } |
| 972 | 972 | $nl++; |
| 973 | 973 | } else { |
@@ -976,7 +976,7 @@ discard block |
||
| 976 | 976 | } |
| 977 | 977 | //Last chunk |
| 978 | 978 | if ($i != $j) { |
| 979 | - $this->cell($l/1000*$this->fontSize, $h, substr($s, $j), 0, 0, '', 0, $link); |
|
| 979 | + $this->cell($l / 1000 * $this->fontSize, $h, substr($s, $j), 0, 0, '', 0, $link); |
|
| 980 | 980 | } |
| 981 | 981 | } |
| 982 | 982 | |
@@ -999,20 +999,20 @@ discard block |
||
| 999 | 999 | if ($type == '') { |
| 1000 | 1000 | $pos = strrpos($file, '.'); |
| 1001 | 1001 | if (!$pos) { |
| 1002 | - $this->error('Image file has no extension and no type was specified: '.$file); |
|
| 1002 | + $this->error('Image file has no extension and no type was specified: ' . $file); |
|
| 1003 | 1003 | } |
| 1004 | - $type = substr($file, $pos+1); |
|
| 1004 | + $type = substr($file, $pos + 1); |
|
| 1005 | 1005 | } |
| 1006 | 1006 | $type = strtolower($type); |
| 1007 | 1007 | if ($type == 'jpeg') { |
| 1008 | 1008 | $type = 'jpg'; |
| 1009 | 1009 | } |
| 1010 | - $mtd = 'parse'.strtoupper($type); |
|
| 1010 | + $mtd = 'parse' . strtoupper($type); |
|
| 1011 | 1011 | if (!method_exists($this, $mtd)) { |
| 1012 | - $this->error('Unsupported image type: '.$type); |
|
| 1012 | + $this->error('Unsupported image type: ' . $type); |
|
| 1013 | 1013 | } |
| 1014 | 1014 | $info = $this->$mtd($file); |
| 1015 | - $info['i'] = count($this->images)+1; |
|
| 1015 | + $info['i'] = count($this->images) + 1; |
|
| 1016 | 1016 | $this->images[$file] = $info; |
| 1017 | 1017 | } else { |
| 1018 | 1018 | $info = $this->images[$file]; |
@@ -1020,16 +1020,16 @@ discard block |
||
| 1020 | 1020 | //Automatic width and height calculation if needed |
| 1021 | 1021 | if ($w == 0 && $h == 0) { |
| 1022 | 1022 | //Put image at 72 dpi |
| 1023 | - $w = $info['w']/$this->k; |
|
| 1024 | - $h = $info['h']/$this->k; |
|
| 1023 | + $w = $info['w'] / $this->k; |
|
| 1024 | + $h = $info['h'] / $this->k; |
|
| 1025 | 1025 | } elseif ($w == 0) { |
| 1026 | - $w = $h*$info['w']/$info['h']; |
|
| 1026 | + $w = $h * $info['w'] / $info['h']; |
|
| 1027 | 1027 | } elseif ($h == 0) { |
| 1028 | - $h = $w*$info['h']/$info['w']; |
|
| 1028 | + $h = $w * $info['h'] / $info['w']; |
|
| 1029 | 1029 | } |
| 1030 | 1030 | //Flowing mode |
| 1031 | 1031 | if ($y === null) { |
| 1032 | - if ($this->y+$h > $this->pageBreakTrigger |
|
| 1032 | + if ($this->y + $h > $this->pageBreakTrigger |
|
| 1033 | 1033 | && !$this->inHeader |
| 1034 | 1034 | && !$this->inFooter |
| 1035 | 1035 | && $this->acceptPageBreak() |
@@ -1048,10 +1048,10 @@ discard block |
||
| 1048 | 1048 | $this->out( |
| 1049 | 1049 | sprintf( |
| 1050 | 1050 | 'q %.2F 0 0 %.2F %.2F %.2F cm /I%d Do Q', |
| 1051 | - $w*$this->k, |
|
| 1052 | - $h*$this->k, |
|
| 1053 | - $x*$this->k, |
|
| 1054 | - ($this->h-($y+$h))*$this->k, |
|
| 1051 | + $w * $this->k, |
|
| 1052 | + $h * $this->k, |
|
| 1053 | + $x * $this->k, |
|
| 1054 | + ($this->h - ($y + $h)) * $this->k, |
|
| 1055 | 1055 | $info['i'] |
| 1056 | 1056 | ) |
| 1057 | 1057 | ); |
@@ -1074,7 +1074,7 @@ discard block |
||
| 1074 | 1074 | if ($x >= 0) { |
| 1075 | 1075 | $this->x = $x; |
| 1076 | 1076 | } else { |
| 1077 | - $this->x = $this->w+$x; |
|
| 1077 | + $this->x = $this->w + $x; |
|
| 1078 | 1078 | } |
| 1079 | 1079 | } |
| 1080 | 1080 | |
@@ -1093,7 +1093,7 @@ discard block |
||
| 1093 | 1093 | if ($y >= 0) { |
| 1094 | 1094 | $this->y = $y; |
| 1095 | 1095 | } else { |
| 1096 | - $this->y = $this->h+$y; |
|
| 1096 | + $this->y = $this->h + $y; |
|
| 1097 | 1097 | } |
| 1098 | 1098 | } |
| 1099 | 1099 | |
@@ -1140,8 +1140,8 @@ discard block |
||
| 1140 | 1140 | if (headers_sent()) { |
| 1141 | 1141 | $this->error('Some data has already been output, can\'t send PDF file'); |
| 1142 | 1142 | } |
| 1143 | - header('Content-Length: '.strlen($this->buffer)); |
|
| 1144 | - header('Content-Disposition: inline; filename="'.$name.'"'); |
|
| 1143 | + header('Content-Length: ' . strlen($this->buffer)); |
|
| 1144 | + header('Content-Disposition: inline; filename="' . $name . '"'); |
|
| 1145 | 1145 | header('Cache-Control: private, max-age=0, must-revalidate'); |
| 1146 | 1146 | header('Pragma: public'); |
| 1147 | 1147 | ini_set('zlib.output_compression', '0'); |
@@ -1157,8 +1157,8 @@ discard block |
||
| 1157 | 1157 | if (headers_sent()) { |
| 1158 | 1158 | $this->error('Some data has already been output, can\'t send PDF file'); |
| 1159 | 1159 | } |
| 1160 | - header('Content-Length: '.strlen($this->buffer)); |
|
| 1161 | - header('Content-Disposition: attachment; filename="'.$name.'"'); |
|
| 1160 | + header('Content-Length: ' . strlen($this->buffer)); |
|
| 1161 | + header('Content-Disposition: attachment; filename="' . $name . '"'); |
|
| 1162 | 1162 | header('Cache-Control: private, max-age=0, must-revalidate'); |
| 1163 | 1163 | header('Pragma: public'); |
| 1164 | 1164 | ini_set('zlib.output_compression', '0'); |
@@ -1166,9 +1166,9 @@ discard block |
||
| 1166 | 1166 | break; |
| 1167 | 1167 | case 'F': |
| 1168 | 1168 | //Save to local file |
| 1169 | - $f=fopen($name, 'wb'); |
|
| 1169 | + $f = fopen($name, 'wb'); |
|
| 1170 | 1170 | if (!$f) { |
| 1171 | - $this->error('Unable to create output file: '.$name); |
|
| 1171 | + $this->error('Unable to create output file: ' . $name); |
|
| 1172 | 1172 | } |
| 1173 | 1173 | fwrite($f, $this->buffer, strlen($this->buffer)); |
| 1174 | 1174 | fclose($f); |
@@ -1177,7 +1177,7 @@ discard block |
||
| 1177 | 1177 | //Return as a string |
| 1178 | 1178 | return $this->buffer; |
| 1179 | 1179 | default: |
| 1180 | - $this->error('Incorrect output destination: '.$dest); |
|
| 1180 | + $this->error('Incorrect output destination: ' . $dest); |
|
| 1181 | 1181 | } |
| 1182 | 1182 | return ''; |
| 1183 | 1183 | } |
@@ -1186,7 +1186,7 @@ discard block |
||
| 1186 | 1186 | protected function dochecks() |
| 1187 | 1187 | { |
| 1188 | 1188 | //Check availability of %F |
| 1189 | - if (sprintf('%.1F', 1.0)!='1.0') { |
|
| 1189 | + if (sprintf('%.1F', 1.0) != '1.0') { |
|
| 1190 | 1190 | $this->error('This version of PHP is not supported'); |
| 1191 | 1191 | } |
| 1192 | 1192 | //Check mbstring overloading |
@@ -1198,12 +1198,12 @@ discard block |
||
| 1198 | 1198 | |
| 1199 | 1199 | protected function getpageformat($format) |
| 1200 | 1200 | { |
| 1201 | - $format=strtolower($format); |
|
| 1201 | + $format = strtolower($format); |
|
| 1202 | 1202 | if (!isset($this->pageFormats[$format])) { |
| 1203 | - $this->error('Unknown page format: '.$format); |
|
| 1203 | + $this->error('Unknown page format: ' . $format); |
|
| 1204 | 1204 | } |
| 1205 | - $a=$this->pageFormats[$format]; |
|
| 1206 | - return [$a[0]/$this->k, $a[1]/$this->k]; |
|
| 1205 | + $a = $this->pageFormats[$format]; |
|
| 1206 | + return [$a[0] / $this->k, $a[1] / $this->k]; |
|
| 1207 | 1207 | } |
| 1208 | 1208 | |
| 1209 | 1209 | |
@@ -1231,12 +1231,12 @@ discard block |
||
| 1231 | 1231 | $format = $this->defPageFormat; |
| 1232 | 1232 | } else { |
| 1233 | 1233 | if (is_string($format)) { |
| 1234 | - $format=$this->getpageformat($format); |
|
| 1234 | + $format = $this->getpageformat($format); |
|
| 1235 | 1235 | } |
| 1236 | 1236 | } |
| 1237 | 1237 | if ($orientation != $this->curOrientation |
| 1238 | - || $format[0]!=$this->curPageFormat[0] |
|
| 1239 | - || $format[1]!=$this->curPageFormat[1] |
|
| 1238 | + || $format[0] != $this->curPageFormat[0] |
|
| 1239 | + || $format[1] != $this->curPageFormat[1] |
|
| 1240 | 1240 | ) { |
| 1241 | 1241 | //New size |
| 1242 | 1242 | if ($orientation == 'P') { |
@@ -1246,9 +1246,9 @@ discard block |
||
| 1246 | 1246 | $this->w = $format[1]; |
| 1247 | 1247 | $this->h = $format[0]; |
| 1248 | 1248 | } |
| 1249 | - $this->wPt = $this->w*$this->k; |
|
| 1250 | - $this->hPt = $this->h*$this->k; |
|
| 1251 | - $this->pageBreakTrigger = $this->h-$this->bMargin; |
|
| 1249 | + $this->wPt = $this->w * $this->k; |
|
| 1250 | + $this->hPt = $this->h * $this->k; |
|
| 1251 | + $this->pageBreakTrigger = $this->h - $this->bMargin; |
|
| 1252 | 1252 | $this->curOrientation = $orientation; |
| 1253 | 1253 | $this->curPageFormat = $format; |
| 1254 | 1254 | } |
@@ -1281,7 +1281,7 @@ discard block |
||
| 1281 | 1281 | protected function textString($s) |
| 1282 | 1282 | { |
| 1283 | 1283 | //Format a text string |
| 1284 | - return '('.$this->escape($s).')'; |
|
| 1284 | + return '(' . $this->escape($s) . ')'; |
|
| 1285 | 1285 | } |
| 1286 | 1286 | |
| 1287 | 1287 | |
@@ -1297,16 +1297,16 @@ discard block |
||
| 1297 | 1297 | //3-byte character |
| 1298 | 1298 | $c2 = ord($s[$i++]); |
| 1299 | 1299 | $c3 = ord($s[$i++]); |
| 1300 | - $res .= chr((($c1 & 0x0F)<<4) + (($c2 & 0x3C)>>2)); |
|
| 1301 | - $res .= chr((($c2 & 0x03)<<6) + ($c3 & 0x3F)); |
|
| 1300 | + $res .= chr((($c1 & 0x0F) << 4) + (($c2 & 0x3C) >> 2)); |
|
| 1301 | + $res .= chr((($c2 & 0x03) << 6) + ($c3 & 0x3F)); |
|
| 1302 | 1302 | } elseif ($c1 >= 192) { |
| 1303 | 1303 | //2-byte character |
| 1304 | 1304 | $c2 = ord($s[$i++]); |
| 1305 | - $res .= chr(($c1 & 0x1C)>>2); |
|
| 1306 | - $res .= chr((($c1 & 0x03)<<6) + ($c2 & 0x3F)); |
|
| 1305 | + $res .= chr(($c1 & 0x1C) >> 2); |
|
| 1306 | + $res .= chr((($c1 & 0x03) << 6) + ($c2 & 0x3F)); |
|
| 1307 | 1307 | } else { |
| 1308 | 1308 | //Single-byte character |
| 1309 | - $res .= "\0".chr($c1); |
|
| 1309 | + $res .= "\0" . chr($c1); |
|
| 1310 | 1310 | } |
| 1311 | 1311 | } |
| 1312 | 1312 | return $res; |
@@ -1318,13 +1318,13 @@ discard block |
||
| 1318 | 1318 | //Underline text |
| 1319 | 1319 | $up = $this->currentFont['up']; |
| 1320 | 1320 | $ut = $this->currentFont['ut']; |
| 1321 | - $w = $this->getStringWidth($txt)+$this->ws*substr_count($txt, ' '); |
|
| 1321 | + $w = $this->getStringWidth($txt) + $this->ws * substr_count($txt, ' '); |
|
| 1322 | 1322 | return sprintf( |
| 1323 | 1323 | '%.2F %.2F %.2F %.2F re f', |
| 1324 | - $x*$this->k, |
|
| 1325 | - ($this->h-($y-$up/1000*$this->fontSize))*$this->k, |
|
| 1326 | - $w*$this->k, |
|
| 1327 | - -$ut/1000*$this->fontSizePt |
|
| 1324 | + $x * $this->k, |
|
| 1325 | + ($this->h - ($y - $up / 1000 * $this->fontSize)) * $this->k, |
|
| 1326 | + $w * $this->k, |
|
| 1327 | + -$ut / 1000 * $this->fontSizePt |
|
| 1328 | 1328 | ); |
| 1329 | 1329 | } |
| 1330 | 1330 | |
@@ -1334,17 +1334,17 @@ discard block |
||
| 1334 | 1334 | //Extract info from a JPEG file |
| 1335 | 1335 | $a = getImageSize($file); |
| 1336 | 1336 | if (!$a) { |
| 1337 | - $this->error('Missing or incorrect image file: '.$file); |
|
| 1337 | + $this->error('Missing or incorrect image file: ' . $file); |
|
| 1338 | 1338 | } |
| 1339 | - if ($a[2]!=2) { |
|
| 1340 | - $this->error('Not a JPEG file: '.$file); |
|
| 1339 | + if ($a[2] != 2) { |
|
| 1340 | + $this->error('Not a JPEG file: ' . $file); |
|
| 1341 | 1341 | } |
| 1342 | 1342 | if (!isset($a['channels']) || $a['channels'] == 3) { |
| 1343 | 1343 | $colspace = 'DeviceRGB'; |
| 1344 | 1344 | } elseif ($a['channels'] == 4) { |
| 1345 | 1345 | $colspace = 'DeviceCMYK'; |
| 1346 | 1346 | } else { |
| 1347 | - $colspace='DeviceGray'; |
|
| 1347 | + $colspace = 'DeviceGray'; |
|
| 1348 | 1348 | } |
| 1349 | 1349 | $bpc = isset($a['bits']) ? $a['bits'] : 8; |
| 1350 | 1350 | //Read whole file |
@@ -1363,22 +1363,22 @@ discard block |
||
| 1363 | 1363 | //Extract info from a PNG file |
| 1364 | 1364 | $f = fopen($file, 'rb'); |
| 1365 | 1365 | if (!$f) { |
| 1366 | - $this->error('Can\'t open image file: '.$file); |
|
| 1366 | + $this->error('Can\'t open image file: ' . $file); |
|
| 1367 | 1367 | } |
| 1368 | 1368 | //Check signature |
| 1369 | - if ($this->readstream($f, 8)!=chr(137).'PNG'.chr(13).chr(10).chr(26).chr(10)) { |
|
| 1370 | - $this->error('Not a PNG file: '.$file); |
|
| 1369 | + if ($this->readstream($f, 8) != chr(137) . 'PNG' . chr(13) . chr(10) . chr(26) . chr(10)) { |
|
| 1370 | + $this->error('Not a PNG file: ' . $file); |
|
| 1371 | 1371 | } |
| 1372 | 1372 | //Read header chunk |
| 1373 | 1373 | $this->readstream($f, 4); |
| 1374 | - if ($this->readstream($f, 4)!='IHDR') { |
|
| 1375 | - $this->error('Incorrect PNG file: '.$file); |
|
| 1374 | + if ($this->readstream($f, 4) != 'IHDR') { |
|
| 1375 | + $this->error('Incorrect PNG file: ' . $file); |
|
| 1376 | 1376 | } |
| 1377 | 1377 | $w = $this->readint($f); |
| 1378 | 1378 | $h = $this->readint($f); |
| 1379 | 1379 | $bpc = ord($this->readstream($f, 1)); |
| 1380 | - if ($bpc>8) { |
|
| 1381 | - $this->error('16-bit depth not supported: '.$file); |
|
| 1380 | + if ($bpc > 8) { |
|
| 1381 | + $this->error('16-bit depth not supported: ' . $file); |
|
| 1382 | 1382 | } |
| 1383 | 1383 | $ct = ord($this->readstream($f, 1)); |
| 1384 | 1384 | if ($ct == 0) { |
@@ -1388,20 +1388,20 @@ discard block |
||
| 1388 | 1388 | } elseif ($ct == 3) { |
| 1389 | 1389 | $colspace = 'Indexed'; |
| 1390 | 1390 | } else { |
| 1391 | - $this->error('Alpha channel not supported: '.$file); |
|
| 1391 | + $this->error('Alpha channel not supported: ' . $file); |
|
| 1392 | 1392 | } |
| 1393 | 1393 | if (ord($this->readstream($f, 1)) != 0) { |
| 1394 | - $this->error('Unknown compression method: '.$file); |
|
| 1394 | + $this->error('Unknown compression method: ' . $file); |
|
| 1395 | 1395 | } |
| 1396 | 1396 | if (ord($this->readstream($f, 1)) != 0) { |
| 1397 | - $this->error('Unknown filter method: '.$file); |
|
| 1397 | + $this->error('Unknown filter method: ' . $file); |
|
| 1398 | 1398 | } |
| 1399 | 1399 | if (ord($this->readstream($f, 1)) != 0) { |
| 1400 | - $this->error('Interlacing not supported: '.$file); |
|
| 1400 | + $this->error('Interlacing not supported: ' . $file); |
|
| 1401 | 1401 | } |
| 1402 | 1402 | $this->readstream($f, 4); |
| 1403 | 1403 | $parms = '/DecodeParms <</Predictor 15 /Colors ' |
| 1404 | - . ($ct==2 ? 3 : 1) |
|
| 1404 | + . ($ct == 2 ? 3 : 1) |
|
| 1405 | 1405 | . ' /BitsPerComponent ' |
| 1406 | 1406 | . $bpc |
| 1407 | 1407 | . ' /Columns ' |
@@ -1439,11 +1439,11 @@ discard block |
||
| 1439 | 1439 | } elseif ($type == 'IEND') { |
| 1440 | 1440 | break; |
| 1441 | 1441 | } else { |
| 1442 | - $this->readstream($f, $n+4); |
|
| 1442 | + $this->readstream($f, $n + 4); |
|
| 1443 | 1443 | } |
| 1444 | 1444 | } while ($n); |
| 1445 | 1445 | if ($colspace == 'Indexed' && empty($pal)) { |
| 1446 | - $this->error('Missing palette in '.$file); |
|
| 1446 | + $this->error('Missing palette in ' . $file); |
|
| 1447 | 1447 | } |
| 1448 | 1448 | fclose($f); |
| 1449 | 1449 | return [ |
@@ -1463,9 +1463,9 @@ discard block |
||
| 1463 | 1463 | protected function readstream($f, $n) |
| 1464 | 1464 | { |
| 1465 | 1465 | //Read n bytes from stream |
| 1466 | - $res=''; |
|
| 1466 | + $res = ''; |
|
| 1467 | 1467 | while ($n > 0 && !feof($f)) { |
| 1468 | - $s=fread($f, $n); |
|
| 1468 | + $s = fread($f, $n); |
|
| 1469 | 1469 | if ($s === false) { |
| 1470 | 1470 | $this->error('Error while reading stream'); |
| 1471 | 1471 | } |
@@ -1498,7 +1498,7 @@ discard block |
||
| 1498 | 1498 | } |
| 1499 | 1499 | $im = imagecreatefromgif($file); |
| 1500 | 1500 | if (!$im) { |
| 1501 | - $this->error('Missing or incorrect image file: '.$file); |
|
| 1501 | + $this->error('Missing or incorrect image file: ' . $file); |
|
| 1502 | 1502 | } |
| 1503 | 1503 | imageinterlace($im, 0); |
| 1504 | 1504 | $tmp = tempnam('.', 'gif'); |
@@ -1509,7 +1509,7 @@ discard block |
||
| 1509 | 1509 | $this->error('Error while saving to temporary file'); |
| 1510 | 1510 | } |
| 1511 | 1511 | imagedestroy($im); |
| 1512 | - $info=$this->parsePNG($tmp); |
|
| 1512 | + $info = $this->parsePNG($tmp); |
|
| 1513 | 1513 | unlink($tmp); |
| 1514 | 1514 | return $info; |
| 1515 | 1515 | } |
@@ -1520,7 +1520,7 @@ discard block |
||
| 1520 | 1520 | //Begin a new object |
| 1521 | 1521 | $this->n++; |
| 1522 | 1522 | $this->offsets[$this->n] = strlen($this->buffer); |
| 1523 | - $this->out($this->n.' 0 obj'); |
|
| 1523 | + $this->out($this->n . ' 0 obj'); |
|
| 1524 | 1524 | } |
| 1525 | 1525 | |
| 1526 | 1526 | |
@@ -1536,9 +1536,9 @@ discard block |
||
| 1536 | 1536 | { |
| 1537 | 1537 | //Add a line to the document |
| 1538 | 1538 | if ($this->state == 2) { |
| 1539 | - $this->pages[$this->page].=$s."\n"; |
|
| 1539 | + $this->pages[$this->page] .= $s . "\n"; |
|
| 1540 | 1540 | } else { |
| 1541 | - $this->buffer .= $s."\n"; |
|
| 1541 | + $this->buffer .= $s . "\n"; |
|
| 1542 | 1542 | } |
| 1543 | 1543 | } |
| 1544 | 1544 | |
@@ -1548,19 +1548,19 @@ discard block |
||
| 1548 | 1548 | $nb = $this->page; |
| 1549 | 1549 | if (!empty($this->aliasNbPages)) { |
| 1550 | 1550 | //Replace number of pages |
| 1551 | - for ($n=1; $n<=$nb; $n++) { |
|
| 1551 | + for ($n = 1; $n <= $nb; $n++) { |
|
| 1552 | 1552 | $this->pages[$n] = str_replace($this->aliasNbPages, $nb, $this->pages[$n]); |
| 1553 | 1553 | } |
| 1554 | 1554 | } |
| 1555 | 1555 | if ($this->defOrientation == 'P') { |
| 1556 | - $wPt = $this->defPageFormat[0]*$this->k; |
|
| 1557 | - $hPt = $this->defPageFormat[1]*$this->k; |
|
| 1556 | + $wPt = $this->defPageFormat[0] * $this->k; |
|
| 1557 | + $hPt = $this->defPageFormat[1] * $this->k; |
|
| 1558 | 1558 | } else { |
| 1559 | - $wPt = $this->defPageFormat[1]*$this->k; |
|
| 1560 | - $hPt = $this->defPageFormat[0]*$this->k; |
|
| 1559 | + $wPt = $this->defPageFormat[1] * $this->k; |
|
| 1560 | + $hPt = $this->defPageFormat[0] * $this->k; |
|
| 1561 | 1561 | } |
| 1562 | 1562 | $filter = ($this->compress) ? '/Filter /FlateDecode ' : ''; |
| 1563 | - for ($n=1; $n<=$nb; $n++) { |
|
| 1563 | + for ($n = 1; $n <= $nb; $n++) { |
|
| 1564 | 1564 | //Page |
| 1565 | 1565 | $this->newObj(); |
| 1566 | 1566 | $this->out('<</Type /Page'); |
@@ -1573,37 +1573,37 @@ discard block |
||
| 1573 | 1573 | //Links |
| 1574 | 1574 | $annots = '/Annots ['; |
| 1575 | 1575 | foreach ($this->PageLinks[$n] as $pl) { |
| 1576 | - $rect = sprintf('%.2F %.2F %.2F %.2F', $pl[0], $pl[1], $pl[0]+$pl[2], $pl[1]-$pl[3]); |
|
| 1577 | - $annots .= '<</Type /Annot /Subtype /Link /Rect ['.$rect.'] /Border [0 0 0] '; |
|
| 1576 | + $rect = sprintf('%.2F %.2F %.2F %.2F', $pl[0], $pl[1], $pl[0] + $pl[2], $pl[1] - $pl[3]); |
|
| 1577 | + $annots .= '<</Type /Annot /Subtype /Link /Rect [' . $rect . '] /Border [0 0 0] '; |
|
| 1578 | 1578 | if (is_string($pl[4])) { |
| 1579 | - $annots .= '/A <</S /URI /URI '.$this->textString($pl[4]).'>>>>'; |
|
| 1579 | + $annots .= '/A <</S /URI /URI ' . $this->textString($pl[4]) . '>>>>'; |
|
| 1580 | 1580 | } else { |
| 1581 | 1581 | $l = $this->links[$pl[4]]; |
| 1582 | 1582 | $h = isset($this->PageSizes[$l[0]]) ? $this->PageSizes[$l[0]][1] : $hPt; |
| 1583 | - $annots .= sprintf('/Dest [%d 0 R /XYZ 0 %.2F null]>>', 1+2*$l[0], $h-$l[1]*$this->k); |
|
| 1583 | + $annots .= sprintf('/Dest [%d 0 R /XYZ 0 %.2F null]>>', 1 + 2 * $l[0], $h - $l[1] * $this->k); |
|
| 1584 | 1584 | } |
| 1585 | 1585 | } |
| 1586 | - $this->out($annots.']'); |
|
| 1586 | + $this->out($annots . ']'); |
|
| 1587 | 1587 | } |
| 1588 | - $this->out('/Contents '.($this->n+1).' 0 R>>'); |
|
| 1588 | + $this->out('/Contents ' . ($this->n + 1) . ' 0 R>>'); |
|
| 1589 | 1589 | $this->out('endobj'); |
| 1590 | 1590 | //Page content |
| 1591 | - $p=($this->compress) ? gzcompress($this->pages[$n]) : $this->pages[$n]; |
|
| 1591 | + $p = ($this->compress) ? gzcompress($this->pages[$n]) : $this->pages[$n]; |
|
| 1592 | 1592 | $this->newObj(); |
| 1593 | - $this->out('<<'.$filter.'/Length '.strlen($p).'>>'); |
|
| 1593 | + $this->out('<<' . $filter . '/Length ' . strlen($p) . '>>'); |
|
| 1594 | 1594 | $this->putStream($p); |
| 1595 | 1595 | $this->out('endobj'); |
| 1596 | 1596 | } |
| 1597 | 1597 | //Pages root |
| 1598 | - $this->offsets[1]=strlen($this->buffer); |
|
| 1598 | + $this->offsets[1] = strlen($this->buffer); |
|
| 1599 | 1599 | $this->out('1 0 obj'); |
| 1600 | 1600 | $this->out('<</Type /Pages'); |
| 1601 | 1601 | $kids = '/Kids ['; |
| 1602 | - for ($i=0; $i<$nb; $i++) { |
|
| 1603 | - $kids .= (3+2*$i).' 0 R '; |
|
| 1602 | + for ($i = 0; $i < $nb; $i++) { |
|
| 1603 | + $kids .= (3 + 2 * $i) . ' 0 R '; |
|
| 1604 | 1604 | } |
| 1605 | - $this->out($kids.']'); |
|
| 1606 | - $this->out('/Count '.$nb); |
|
| 1605 | + $this->out($kids . ']'); |
|
| 1606 | + $this->out('/Count ' . $nb); |
|
| 1607 | 1607 | $this->out(sprintf('/MediaBox [0 0 %.2F %.2F]', $wPt, $hPt)); |
| 1608 | 1608 | $this->out('>>'); |
| 1609 | 1609 | $this->out('endobj'); |
@@ -1616,41 +1616,41 @@ discard block |
||
| 1616 | 1616 | foreach ($this->diffs as $diff) { |
| 1617 | 1617 | //Encodings |
| 1618 | 1618 | $this->newObj(); |
| 1619 | - $this->out('<</Type /Encoding /BaseEncoding /WinAnsiEncoding /Differences ['.$diff.']>>'); |
|
| 1619 | + $this->out('<</Type /Encoding /BaseEncoding /WinAnsiEncoding /Differences [' . $diff . ']>>'); |
|
| 1620 | 1620 | $this->out('endobj'); |
| 1621 | 1621 | } |
| 1622 | 1622 | foreach ($this->fontFiles as $file => $info) { |
| 1623 | 1623 | //Font file embedding |
| 1624 | 1624 | $this->newObj(); |
| 1625 | - $this->fontFiles[$file]['n']=$this->n; |
|
| 1626 | - $font=''; |
|
| 1627 | - $f = fopen($this->getFontPath().$file, 'rb', 1); |
|
| 1625 | + $this->fontFiles[$file]['n'] = $this->n; |
|
| 1626 | + $font = ''; |
|
| 1627 | + $f = fopen($this->getFontPath() . $file, 'rb', 1); |
|
| 1628 | 1628 | if (!$f) { |
| 1629 | 1629 | $this->error('Font file not found'); |
| 1630 | 1630 | } |
| 1631 | 1631 | while (!feof($f)) { |
| 1632 | - $font.=fread($f, 8192); |
|
| 1632 | + $font .= fread($f, 8192); |
|
| 1633 | 1633 | } |
| 1634 | 1634 | fclose($f); |
| 1635 | - $compressed = (substr($file, -2)=='.z'); |
|
| 1635 | + $compressed = (substr($file, -2) == '.z'); |
|
| 1636 | 1636 | if (!$compressed && isset($info['length2'])) { |
| 1637 | - $header = (ord($font[0])==128); |
|
| 1637 | + $header = (ord($font[0]) == 128); |
|
| 1638 | 1638 | if ($header) { |
| 1639 | 1639 | //Strip first binary header |
| 1640 | 1640 | $font = substr($font, 6); |
| 1641 | 1641 | } |
| 1642 | 1642 | if ($header && ord($font[$info['length1']]) == 128) { |
| 1643 | 1643 | //Strip second binary header |
| 1644 | - $font = substr($font, 0, $info['length1']).substr($font, $info['length1']+6); |
|
| 1644 | + $font = substr($font, 0, $info['length1']) . substr($font, $info['length1'] + 6); |
|
| 1645 | 1645 | } |
| 1646 | 1646 | } |
| 1647 | - $this->out('<</Length '.strlen($font)); |
|
| 1647 | + $this->out('<</Length ' . strlen($font)); |
|
| 1648 | 1648 | if ($compressed) { |
| 1649 | 1649 | $this->out('/Filter /FlateDecode'); |
| 1650 | 1650 | } |
| 1651 | - $this->out('/Length1 '.$info['length1']); |
|
| 1651 | + $this->out('/Length1 ' . $info['length1']); |
|
| 1652 | 1652 | if (isset($info['length2'])) { |
| 1653 | - $this->out('/Length2 '.$info['length2'].' /Length3 0'); |
|
| 1653 | + $this->out('/Length2 ' . $info['length2'] . ' /Length3 0'); |
|
| 1654 | 1654 | } |
| 1655 | 1655 | $this->out('>>'); |
| 1656 | 1656 | $this->putStream($font); |
@@ -1658,32 +1658,32 @@ discard block |
||
| 1658 | 1658 | } |
| 1659 | 1659 | foreach ($this->fonts as $k => $font) { |
| 1660 | 1660 | //Font objects |
| 1661 | - $this->fonts[$k]['n']=$this->n+1; |
|
| 1661 | + $this->fonts[$k]['n'] = $this->n + 1; |
|
| 1662 | 1662 | $type = $font['type']; |
| 1663 | 1663 | $name = $font['name']; |
| 1664 | 1664 | if ($type == 'core') { |
| 1665 | 1665 | //Standard font |
| 1666 | 1666 | $this->newObj(); |
| 1667 | 1667 | $this->out('<</Type /Font'); |
| 1668 | - $this->out('/BaseFont /'.$name); |
|
| 1668 | + $this->out('/BaseFont /' . $name); |
|
| 1669 | 1669 | $this->out('/Subtype /Type1'); |
| 1670 | 1670 | if ($name != 'Symbol' && $name != 'ZapfDingbats') { |
| 1671 | 1671 | $this->out('/Encoding /WinAnsiEncoding'); |
| 1672 | 1672 | } |
| 1673 | 1673 | $this->out('>>'); |
| 1674 | 1674 | $this->out('endobj'); |
| 1675 | - } elseif ($type=='Type1' || $type=='TrueType') { |
|
| 1675 | + } elseif ($type == 'Type1' || $type == 'TrueType') { |
|
| 1676 | 1676 | //Additional Type1 or TrueType font |
| 1677 | 1677 | $this->newObj(); |
| 1678 | 1678 | $this->out('<</Type /Font'); |
| 1679 | - $this->out('/BaseFont /'.$name); |
|
| 1680 | - $this->out('/Subtype /'.$type); |
|
| 1679 | + $this->out('/BaseFont /' . $name); |
|
| 1680 | + $this->out('/Subtype /' . $type); |
|
| 1681 | 1681 | $this->out('/FirstChar 32 /LastChar 255'); |
| 1682 | - $this->out('/Widths '.($this->n+1).' 0 R'); |
|
| 1683 | - $this->out('/FontDescriptor '.($this->n+2).' 0 R'); |
|
| 1682 | + $this->out('/Widths ' . ($this->n + 1) . ' 0 R'); |
|
| 1683 | + $this->out('/FontDescriptor ' . ($this->n + 2) . ' 0 R'); |
|
| 1684 | 1684 | if ($font['enc']) { |
| 1685 | 1685 | if (isset($font['diff'])) { |
| 1686 | - $this->out('/Encoding '.($nf+$font['diff']).' 0 R'); |
|
| 1686 | + $this->out('/Encoding ' . ($nf + $font['diff']) . ' 0 R'); |
|
| 1687 | 1687 | } else { |
| 1688 | 1688 | $this->out('/Encoding /WinAnsiEncoding'); |
| 1689 | 1689 | } |
@@ -1692,30 +1692,30 @@ discard block |
||
| 1692 | 1692 | $this->out('endobj'); |
| 1693 | 1693 | //Widths |
| 1694 | 1694 | $this->newObj(); |
| 1695 | - $cw =& $font['cw']; |
|
| 1695 | + $cw = & $font['cw']; |
|
| 1696 | 1696 | $s = '['; |
| 1697 | - for ($i=32; $i<=255; $i++) { |
|
| 1698 | - $s .= $cw[chr($i)].' '; |
|
| 1697 | + for ($i = 32; $i <= 255; $i++) { |
|
| 1698 | + $s .= $cw[chr($i)] . ' '; |
|
| 1699 | 1699 | } |
| 1700 | - $this->out($s.']'); |
|
| 1700 | + $this->out($s . ']'); |
|
| 1701 | 1701 | $this->out('endobj'); |
| 1702 | 1702 | //Descriptor |
| 1703 | 1703 | $this->newObj(); |
| 1704 | - $s='<</Type /FontDescriptor /FontName /'.$name; |
|
| 1704 | + $s = '<</Type /FontDescriptor /FontName /' . $name; |
|
| 1705 | 1705 | foreach ($font['desc'] as $k => $v) { |
| 1706 | - $s .= ' /'.$k.' '.$v; |
|
| 1706 | + $s .= ' /' . $k . ' ' . $v; |
|
| 1707 | 1707 | } |
| 1708 | - $file=$font['file']; |
|
| 1708 | + $file = $font['file']; |
|
| 1709 | 1709 | if ($file) { |
| 1710 | - $s .= ' /FontFile'.($type=='Type1' ? '' : '2').' '.$this->fontFiles[$file]['n'].' 0 R'; |
|
| 1710 | + $s .= ' /FontFile' . ($type == 'Type1' ? '' : '2') . ' ' . $this->fontFiles[$file]['n'] . ' 0 R'; |
|
| 1711 | 1711 | } |
| 1712 | - $this->out($s.'>>'); |
|
| 1712 | + $this->out($s . '>>'); |
|
| 1713 | 1713 | $this->out('endobj'); |
| 1714 | 1714 | } else { |
| 1715 | 1715 | //Allow for additional types |
| 1716 | - $mtd='_put'.strtolower($type); |
|
| 1716 | + $mtd = '_put' . strtolower($type); |
|
| 1717 | 1717 | if (!method_exists($this, $mtd)) { |
| 1718 | - $this->error('Unsupported font type: '.$type); |
|
| 1718 | + $this->error('Unsupported font type: ' . $type); |
|
| 1719 | 1719 | } |
| 1720 | 1720 | $this->$mtd($font); |
| 1721 | 1721 | } |
@@ -1733,39 +1733,39 @@ discard block |
||
| 1733 | 1733 | $this->images[$file]['n'] = $this->n; |
| 1734 | 1734 | $this->out('<</Type /XObject'); |
| 1735 | 1735 | $this->out('/Subtype /Image'); |
| 1736 | - $this->out('/Width '.$info['w']); |
|
| 1737 | - $this->out('/Height '.$info['h']); |
|
| 1738 | - if ($info['cs']=='Indexed') { |
|
| 1739 | - $this->out('/ColorSpace [/Indexed /DeviceRGB '.(strlen($info['pal'])/3-1).' '.($this->n+1).' 0 R]'); |
|
| 1736 | + $this->out('/Width ' . $info['w']); |
|
| 1737 | + $this->out('/Height ' . $info['h']); |
|
| 1738 | + if ($info['cs'] == 'Indexed') { |
|
| 1739 | + $this->out('/ColorSpace [/Indexed /DeviceRGB ' . (strlen($info['pal']) / 3 - 1) . ' ' . ($this->n + 1) . ' 0 R]'); |
|
| 1740 | 1740 | } else { |
| 1741 | - $this->out('/ColorSpace /'.$info['cs']); |
|
| 1742 | - if ($info['cs']=='DeviceCMYK') { |
|
| 1741 | + $this->out('/ColorSpace /' . $info['cs']); |
|
| 1742 | + if ($info['cs'] == 'DeviceCMYK') { |
|
| 1743 | 1743 | $this->out('/Decode [1 0 1 0 1 0 1 0]'); |
| 1744 | 1744 | } |
| 1745 | 1745 | } |
| 1746 | - $this->out('/BitsPerComponent '.$info['bpc']); |
|
| 1746 | + $this->out('/BitsPerComponent ' . $info['bpc']); |
|
| 1747 | 1747 | if (isset($info['f'])) { |
| 1748 | - $this->out('/Filter /'.$info['f']); |
|
| 1748 | + $this->out('/Filter /' . $info['f']); |
|
| 1749 | 1749 | } |
| 1750 | 1750 | if (isset($info['parms'])) { |
| 1751 | 1751 | $this->out($info['parms']); |
| 1752 | 1752 | } |
| 1753 | 1753 | if (isset($info['trns']) && is_array($info['trns'])) { |
| 1754 | 1754 | $trns = ''; |
| 1755 | - for ($i=0; $i<count($info['trns']); $i++) { |
|
| 1756 | - $trns.=$info['trns'][$i].' '.$info['trns'][$i].' '; |
|
| 1755 | + for ($i = 0; $i < count($info['trns']); $i++) { |
|
| 1756 | + $trns .= $info['trns'][$i] . ' ' . $info['trns'][$i] . ' '; |
|
| 1757 | 1757 | } |
| 1758 | - $this->out('/Mask ['.$trns.']'); |
|
| 1758 | + $this->out('/Mask [' . $trns . ']'); |
|
| 1759 | 1759 | } |
| 1760 | - $this->out('/Length '.strlen($info['data']).'>>'); |
|
| 1760 | + $this->out('/Length ' . strlen($info['data']) . '>>'); |
|
| 1761 | 1761 | $this->putStream($info['data']); |
| 1762 | 1762 | unset($this->images[$file]['data']); |
| 1763 | 1763 | $this->out('endobj'); |
| 1764 | 1764 | //Palette |
| 1765 | 1765 | if ($info['cs'] == 'Indexed') { |
| 1766 | 1766 | $this->newObj(); |
| 1767 | - $pal=($this->compress) ? gzcompress($info['pal']) : $info['pal']; |
|
| 1768 | - $this->out('<<'.$filter.'/Length '.strlen($pal).'>>'); |
|
| 1767 | + $pal = ($this->compress) ? gzcompress($info['pal']) : $info['pal']; |
|
| 1768 | + $this->out('<<' . $filter . '/Length ' . strlen($pal) . '>>'); |
|
| 1769 | 1769 | $this->putStream($pal); |
| 1770 | 1770 | $this->out('endobj'); |
| 1771 | 1771 | } |
@@ -1775,7 +1775,7 @@ discard block |
||
| 1775 | 1775 | protected function putXobjectDict() |
| 1776 | 1776 | { |
| 1777 | 1777 | foreach ($this->images as $image) { |
| 1778 | - $this->out('/I'.$image['i'].' '.$image['n'].' 0 R'); |
|
| 1778 | + $this->out('/I' . $image['i'] . ' ' . $image['n'] . ' 0 R'); |
|
| 1779 | 1779 | } |
| 1780 | 1780 | } |
| 1781 | 1781 | |
@@ -1784,7 +1784,7 @@ discard block |
||
| 1784 | 1784 | $this->out('/ProcSet [/PDF /Text /ImageB /ImageC /ImageI]'); |
| 1785 | 1785 | $this->out('/Font <<'); |
| 1786 | 1786 | foreach ($this->fonts as $font) { |
| 1787 | - $this->out('/F'.$font['i'].' '.$font['n'].' 0 R'); |
|
| 1787 | + $this->out('/F' . $font['i'] . ' ' . $font['n'] . ' 0 R'); |
|
| 1788 | 1788 | } |
| 1789 | 1789 | $this->out('>>'); |
| 1790 | 1790 | $this->out('/XObject <<'); |
@@ -1807,57 +1807,57 @@ discard block |
||
| 1807 | 1807 | |
| 1808 | 1808 | protected function putInfo() |
| 1809 | 1809 | { |
| 1810 | - $this->out('/Producer '.$this->textString('FPDF '. self::FPDF_VERSION)); |
|
| 1810 | + $this->out('/Producer ' . $this->textString('FPDF ' . self::FPDF_VERSION)); |
|
| 1811 | 1811 | if (!empty($this->title)) { |
| 1812 | - $this->out('/Title '.$this->textString($this->title)); |
|
| 1812 | + $this->out('/Title ' . $this->textString($this->title)); |
|
| 1813 | 1813 | } |
| 1814 | 1814 | if (!empty($this->subject)) { |
| 1815 | - $this->out('/Subject '.$this->textString($this->subject)); |
|
| 1815 | + $this->out('/Subject ' . $this->textString($this->subject)); |
|
| 1816 | 1816 | } |
| 1817 | 1817 | if (!empty($this->author)) { |
| 1818 | - $this->out('/Author '.$this->textString($this->author)); |
|
| 1818 | + $this->out('/Author ' . $this->textString($this->author)); |
|
| 1819 | 1819 | } |
| 1820 | 1820 | if (!empty($this->keywords)) { |
| 1821 | - $this->out('/Keywords '.$this->textString($this->keywords)); |
|
| 1821 | + $this->out('/Keywords ' . $this->textString($this->keywords)); |
|
| 1822 | 1822 | } |
| 1823 | 1823 | if (!empty($this->creator)) { |
| 1824 | - $this->out('/Creator '.$this->textString($this->creator)); |
|
| 1824 | + $this->out('/Creator ' . $this->textString($this->creator)); |
|
| 1825 | 1825 | } |
| 1826 | - $this->out('/CreationDate '.$this->textString('D:'.@date('YmdHis'))); |
|
| 1826 | + $this->out('/CreationDate ' . $this->textString('D:' . @date('YmdHis'))); |
|
| 1827 | 1827 | } |
| 1828 | 1828 | |
| 1829 | 1829 | protected function putCatalog() |
| 1830 | 1830 | { |
| 1831 | 1831 | $this->out('/Type /Catalog'); |
| 1832 | 1832 | $this->out('/Pages 1 0 R'); |
| 1833 | - if ($this->zoomMode=='fullpage') { |
|
| 1833 | + if ($this->zoomMode == 'fullpage') { |
|
| 1834 | 1834 | $this->out('/OpenAction [3 0 R /Fit]'); |
| 1835 | - } elseif ($this->zoomMode=='fullwidth') { |
|
| 1835 | + } elseif ($this->zoomMode == 'fullwidth') { |
|
| 1836 | 1836 | $this->out('/OpenAction [3 0 R /FitH null]'); |
| 1837 | - } elseif ($this->zoomMode=='real') { |
|
| 1837 | + } elseif ($this->zoomMode == 'real') { |
|
| 1838 | 1838 | $this->out('/OpenAction [3 0 R /XYZ null null 1]'); |
| 1839 | 1839 | } elseif (!is_string($this->zoomMode)) { |
| 1840 | - $this->out('/OpenAction [3 0 R /XYZ null null '.($this->zoomMode/100).']'); |
|
| 1840 | + $this->out('/OpenAction [3 0 R /XYZ null null ' . ($this->zoomMode / 100) . ']'); |
|
| 1841 | 1841 | } |
| 1842 | - if ($this->layoutMode=='single') { |
|
| 1842 | + if ($this->layoutMode == 'single') { |
|
| 1843 | 1843 | $this->out('/PageLayout /SinglePage'); |
| 1844 | - } elseif ($this->layoutMode=='continuous') { |
|
| 1844 | + } elseif ($this->layoutMode == 'continuous') { |
|
| 1845 | 1845 | $this->out('/PageLayout /OneColumn'); |
| 1846 | - } elseif ($this->layoutMode=='two') { |
|
| 1846 | + } elseif ($this->layoutMode == 'two') { |
|
| 1847 | 1847 | $this->out('/PageLayout /TwoColumnLeft'); |
| 1848 | 1848 | } |
| 1849 | 1849 | } |
| 1850 | 1850 | |
| 1851 | 1851 | protected function putHeader() |
| 1852 | 1852 | { |
| 1853 | - $this->out('%PDF-'.$this->pdfVersion); |
|
| 1853 | + $this->out('%PDF-' . $this->pdfVersion); |
|
| 1854 | 1854 | } |
| 1855 | 1855 | |
| 1856 | 1856 | protected function putTrailer() |
| 1857 | 1857 | { |
| 1858 | - $this->out('/Size '.($this->n+1)); |
|
| 1859 | - $this->out('/Root '.$this->n.' 0 R'); |
|
| 1860 | - $this->out('/Info '.($this->n-1).' 0 R'); |
|
| 1858 | + $this->out('/Size ' . ($this->n + 1)); |
|
| 1859 | + $this->out('/Root ' . $this->n . ' 0 R'); |
|
| 1860 | + $this->out('/Info ' . ($this->n - 1) . ' 0 R'); |
|
| 1861 | 1861 | } |
| 1862 | 1862 | |
| 1863 | 1863 | protected function endDoc() |
@@ -1878,11 +1878,11 @@ discard block |
||
| 1878 | 1878 | $this->out('>>'); |
| 1879 | 1879 | $this->out('endobj'); |
| 1880 | 1880 | //Cross-ref |
| 1881 | - $o=strlen($this->buffer); |
|
| 1881 | + $o = strlen($this->buffer); |
|
| 1882 | 1882 | $this->out('xref'); |
| 1883 | - $this->out('0 '.($this->n+1)); |
|
| 1883 | + $this->out('0 ' . ($this->n + 1)); |
|
| 1884 | 1884 | $this->out('0000000000 65535 f '); |
| 1885 | - for ($i=1; $i<=$this->n; $i++) { |
|
| 1885 | + for ($i = 1; $i <= $this->n; $i++) { |
|
| 1886 | 1886 | $this->out(sprintf('%010d 00000 n ', $this->offsets[$i])); |
| 1887 | 1887 | } |
| 1888 | 1888 | //Trailer |
@@ -1893,6 +1893,6 @@ discard block |
||
| 1893 | 1893 | $this->out('startxref'); |
| 1894 | 1894 | $this->out($o); |
| 1895 | 1895 | $this->out('%%EOF'); |
| 1896 | - $this->state=3; |
|
| 1896 | + $this->state = 3; |
|
| 1897 | 1897 | } |
| 1898 | 1898 | } |