Skip to content

Commit

Permalink
Merge branch 'master' of github.com:nfephp-org/sped-da
Browse files Browse the repository at this point in the history
  • Loading branch information
icompsoftcleiton committed Dec 12, 2024
2 parents f0e42f5 + b0e6c38 commit 4ddf2d6
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 84 deletions.
8 changes: 7 additions & 1 deletion src/CTe/DacteOS.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class DacteOS extends DaCommon
protected $veic;
protected $ferrov;
protected $Comp;
protected $ObsFisco;
protected $infNF;
protected $infNFe;
protected $compl;
Expand Down Expand Up @@ -130,6 +131,7 @@ private function loadDoc($xml)
$this->chaveCTeRef = $this->getTagValue($this->infCteComp, "chave");
$this->vPrest = $this->dom->getElementsByTagName("vPrest")->item(0);
$this->Comp = $this->dom->getElementsByTagName("Comp");
$this->ObsFisco = $this->dom->getElementsByTagName("ObsFisco");
$this->infNF = $this->dom->getElementsByTagName("infNF");
$this->infNFe = $this->dom->getElementsByTagName("infNFe");
$this->infOutros = $this->dom->getElementsByTagName("infOutros");
Expand All @@ -144,8 +146,12 @@ private function loadDoc($xml)
$vTrib = 0;
}
$textoAdic = number_format($vTrib, 2, ",", ".");
$textoObsFisco = "";
foreach($this->ObsFisco as $obsFisco){
$textoObsFisco .= $this->getTagValue($obsFisco, "xTexto").". ";
}
$this->textoAdic = "o valor aproximado de tributos incidentes sobre o preço deste serviço é de R$"
.$textoAdic;
.$textoAdic.'. '.$textoObsFisco;
$this->toma = $this->dom->getElementsByTagName("toma")->item(0);
$this->enderToma = $this->getTagValue($this->toma, "enderToma");
//modal aquaviário
Expand Down
114 changes: 56 additions & 58 deletions src/MDFe/Damdfe.php
Original file line number Diff line number Diff line change
Expand Up @@ -1038,73 +1038,71 @@ private function bodyMDFe($x, $y)
$aFont = array('font' => $this->fontePadrao, 'size' => 8, 'style' => '');
$this->pdf->textBox($x1, $y, $x2 - 1, 8, $texto, $aFont, 'T', 'L', 0, '', false);
}
$x1 = round($maxW / 2, 0) + 7;
$x2 = ($maxW / 6);
$y = $yCabecalhoLinha;
$this->quantidadeChavesLayout = 21;
if ($this->orientacao == 'L') {
$x1 = 225;
$y = $yold - 5;
$this->quantidadeChavesLayout = 17;
}
$texto = 'Chaves de acesso';
}
$x1 = round($maxW / 2, 0) + 7;
$x2 = ($maxW / 6);
$this->quantidadeChavesLayout = 21;
if ($this->orientacao == 'L') {
$x1 = 225;
$y = $yold - 5;
$this->quantidadeChavesLayout = 17;
}
$texto = 'Chaves de acesso';
$aFont = array('font' => $this->fontePadrao, 'size' => 8, 'style' => '');
$this->pdf->textBox($x1, $y, $x2, 8, $texto, $aFont, 'T', 'L', 0, '', false);
$y = $y + 2;
$chavesNFe = $this->dom->getElementsByTagName('infDoc')->item(0)->getElementsByTagName('chNFe');
$chavesCTe = $this->dom->getElementsByTagName('infDoc')->item(0)->getElementsByTagName('chCTe');
$chavesMDFe = $this->dom->getElementsByTagName('infDoc')->item(0)->getElementsByTagName('chMDFe');
$chaves = [];
for ($i = 0; $i < $chavesNFe->length; $i++) {
$chaves[] = $chavesNFe->item($i)->nodeValue;
}
for ($i = 0; $i < $chavesCTe->length; $i++) {
$chaves[] = $chavesCTe->item($i)->nodeValue;
}
for ($i = 0; $i < $chavesMDFe->length; $i++) {
$chaves[] = $chavesMDFe->item($i)->nodeValue;
}
$this->chaves = array_slice($chaves, $this->quantidadeChavesLayout);
$contadorChaves = 0;
for ($i = 0; $i < $chavesNFe->length; $i++) {
$y += 4;
$texto = $chavesNFe->item($i)->nodeValue;
$aFont = array('font' => $this->fontePadrao, 'size' => 8, 'style' => '');
$this->pdf->textBox($x1, $y, $x2, 8, $texto, $aFont, 'T', 'L', 0, '', false);
$y = $y + 2;
$chavesNFe = $this->dom->getElementsByTagName('infDoc')->item(0)->getElementsByTagName('chNFe');
$chavesCTe = $this->dom->getElementsByTagName('infDoc')->item(0)->getElementsByTagName('chCTe');
$chavesMDFe = $this->dom->getElementsByTagName('infDoc')->item(0)->getElementsByTagName('chMDFe');
$chaves = [];
for ($i = 0; $i < $chavesNFe->length; $i++) {
$chaves[] = $chavesNFe->item($i)->nodeValue;
$this->pdf->textBox($x1, $y, 70, 8, $texto, $aFont, 'T', 'L', 0, '', false);
$contadorChaves++;
if ($contadorChaves >= $this->quantidadeChavesLayout) {
$this->flagDocs = true;
break;
}
for ($i = 0; $i < $chavesCTe->length; $i++) {
$chaves[] = $chavesCTe->item($i)->nodeValue;
}
for ($i = 0; $i < $chavesMDFe->length; $i++) {
$chaves[] = $chavesMDFe->item($i)->nodeValue;
}
$this->chaves = array_slice($chaves, $this->quantidadeChavesLayout);
$contadorChaves = 0;
for ($i = 0; $i < $chavesNFe->length; $i++) {
$y += 4;
$texto = $chavesNFe->item($i)->nodeValue;
$aFont = array('font' => $this->fontePadrao, 'size' => 8, 'style' => '');
$this->pdf->textBox($x1, $y, 70, 8, $texto, $aFont, 'T', 'L', 0, '', false);
$contadorChaves++;
if ($contadorChaves >= $this->quantidadeChavesLayout) {
$this->flagDocs = true;
break;
}
}
for ($i = 0; $i < $chavesCTe->length; $i++) {
$y += 4;
$texto = $chavesCTe->item($i)->nodeValue;
$aFont = array('font' => $this->fontePadrao, 'size' => 8, 'style' => '');
$this->pdf->textBox($x1, $y, 70, 8, $texto, $aFont, 'T', 'L', 0, '', false);
$contadorChaves++;
if ($contadorChaves >= $this->quantidadeChavesLayout) {
$this->flagDocs = true;
break;
}
}
for ($i = 0; $i < $chavesCTe->length; $i++) {
$y += 4;
$texto = $chavesCTe->item($i)->nodeValue;
$aFont = array('font' => $this->fontePadrao, 'size' => 8, 'style' => '');
$this->pdf->textBox($x1, $y, 70, 8, $texto, $aFont, 'T', 'L', 0, '', false);
$contadorChaves++;
if ($contadorChaves >= $this->quantidadeChavesLayout) {
$this->flagDocs = true;
break;
}
for ($i = 0; $i < $chavesMDFe->length; $i++) {
$y += 4;
$texto = $chavesMDFe->item($i)->nodeValue;
$aFont = array('font' => $this->fontePadrao, 'size' => 8, 'style' => '');
$this->pdf->textBox($x1, $y, 70, 8, $texto, $aFont, 'T', 'L', 0, '', false);
$contadorChaves++;
if ($contadorChaves >= $this->quantidadeChavesLayout) {
$this->flagDocs = true;
break;
}
}
for ($i = 0; $i < $chavesMDFe->length; $i++) {
$y += 4;
$texto = $chavesMDFe->item($i)->nodeValue;
$aFont = array('font' => $this->fontePadrao, 'size' => 8, 'style' => '');
$this->pdf->textBox($x1, $y, 70, 8, $texto, $aFont, 'T', 'L', 0, '', false);
$contadorChaves++;
if ($contadorChaves >= $this->quantidadeChavesLayout) {
$this->flagDocs = true;
break;
}
}

if ($this->aereo) {
$altura = $y + 4;
}

if ($this->aquav) {
$x1 = $x;
$x2 = $maxW;
Expand Down
9 changes: 9 additions & 0 deletions src/NFe/Danfe.php
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,13 @@ class Danfe extends DaCommon
*/
protected $obsshow = true;

protected $title = '';

public function setTitle($title)
{
$this->title = $title;
}

/**
* __construct
* @param string $xml Conteúdo XML da NF-e (com ou sem a tag nfeProc)
Expand Down Expand Up @@ -491,6 +498,7 @@ protected function monta(
$logo = ''
) {
$this->pdf = '';

$this->logomarca = $this->adjustImage($logo);
//se a orientação estiver em branco utilizar o padrão estabelecido na NF
if (empty($this->orientacao)) {
Expand Down Expand Up @@ -536,6 +544,7 @@ protected function monta(
$this->pdf->setFillColor(255, 255, 255);
// inicia o documento
$this->pdf->open();
$this->pdf->setTitle($this->title);
// adiciona a primeira página
$this->pdf->addPage($this->orientacao, $this->papel);
$this->pdf->setLineWidth(0.1);
Expand Down
25 changes: 0 additions & 25 deletions src/NFe/Traits/TraitDadosAdicionaisNfeOutras.php

This file was deleted.

8 changes: 8 additions & 0 deletions src/NFe/Traits/TraitVeicProd.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php

namespace NFePHP\DA\NFe\Traits;

trait TraitVeicProd
{

}

0 comments on commit 4ddf2d6

Please sign in to comment.