Skip to content

Commit

Permalink
Update Danfe.php
Browse files Browse the repository at this point in the history
  • Loading branch information
emersondiegofeltrin committed Nov 13, 2019
1 parent f587da4 commit cfbeb13
Showing 1 changed file with 42 additions and 42 deletions.
84 changes: 42 additions & 42 deletions src/NFe/Danfe.php
Original file line number Diff line number Diff line change
Expand Up @@ -1603,31 +1603,31 @@ protected function pLocalEntregaDANFE($x = 0, $y = 0)
$h = 7;
$texto = 'INFORMAÇÕES DO LOCAL DE ENTREGA';
$aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
$this->pdf->textBo($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
$this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
//NOME / RAZÃO SOCIAL
$w = round($maxW*0.61, 0);
$w1 = $w;
$y += 3;
$texto = 'NOME / RAZÃO SOCIAL';
$aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
$this->pdf->textBo($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
$this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
$texto = '';
if ($this->entrega->getElementsByTagName("xNome")->item(0)) {
$texto = $this->entrega->getElementsByTagName("xNome")->item(0)->nodeValue;
}
$aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
if ($this->orientacao == 'P') {
$this->pdf->textBo($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 0, '');
$this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 0, '');
} else {
$this->pdf->textBo($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 1, '');
$this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 1, '');
}
//CNPJ / CPF
$x += $w;
$w = round($maxW*0.23, 0);
$w2 = $w;
$texto = 'CNPJ / CPF';
$aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
$this->pdf->textBo($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
$this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
//Pegando valor do CPF/CNPJ
if (! empty($this->entrega->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
$texto = $this->pFormat(
Expand All @@ -1642,23 +1642,23 @@ protected function pLocalEntregaDANFE($x = 0, $y = 0)
) : '';
}
$aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
$this->pdf->textBo($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
$this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
//INSCRIÇÃO ESTADUAL
$x += $w;
$w = $maxW-($w1+$w2);
$wx = $w;
$texto = 'INSCRIÇÃO ESTADUAL';
$aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
$this->pdf->textBo($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
$this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
$texto = '';
if ($this->entrega->getElementsByTagName("IE")->item(0)) {
$texto = $this->entrega->getElementsByTagName("IE")->item(0)->nodeValue;
}
$aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
if ($this->orientacao == 'P') {
$this->pdf->textBo($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
$this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
} else {
$this->pdf->textBo($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 1, '');
$this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 1, '');
}
//ENDEREÇO
$w = round($maxW*0.355, 0) + $wx;
Expand All @@ -1667,66 +1667,66 @@ protected function pLocalEntregaDANFE($x = 0, $y = 0)
$x = $oldX;
$texto = 'ENDEREÇO';
$aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
$this->pdf->textBo($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
$this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
$texto = $this->entrega->getElementsByTagName("xLgr")->item(0)->nodeValue;
$texto .= ', ' . $this->entrega->getElementsByTagName("nro")->item(0)->nodeValue;
$texto .= $this->getTagValue($this->entrega, "xCpl", " - ");
$aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
$this->pdf->textBo($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 0, '', true);
$this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 0, '', true);
//BAIRRO / DISTRITO
$x += $w;
$w = round($maxW*0.335, 0);
$w2 = $w;
$texto = 'BAIRRO / DISTRITO';
$aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
$this->pdf->textBo($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
$this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
$texto = $this->entrega->getElementsByTagName("xBairro")->item(0)->nodeValue;
$aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
$this->pdf->textBo($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
$this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
//CEP
$x += $w;
$w = $maxW-($w1+$w2);
$texto = 'CEP';
$aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
$this->pdf->textBo($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
$this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
$texto = ! empty($this->entrega->getElementsByTagName("CEP")->item(0)->nodeValue) ?
$this->entrega->getElementsByTagName("CEP")->item(0)->nodeValue : '';
$texto = $this->pFormat($texto, "#####-###");
$aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
$this->pdf->textBo($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
$this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
//MUNICÍPIO
$w = round($maxW*0.805, 0);
$w1 = $w;
$y += $h;
$x = $oldX;
$texto = 'MUNICÍPIO';
$aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
$this->pdf->textBo($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
$this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
$texto = $this->entrega->getElementsByTagName("xMun")->item(0)->nodeValue;
if (strtoupper(trim($texto)) == "EXTERIOR" && $this->entrega->getElementsByTagName("xPais")->length > 0) {
$texto .= " - " . $this->entrega->getElementsByTagName("xPais")->item(0)->nodeValue;
}
$aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
$this->pdf->textBo($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 0, '');
$this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 0, '');
//UF
$x += $w;
$w = 8;
$texto = 'UF';
$aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
$this->pdf->textBo($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
$this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
$texto = $this->entrega->getElementsByTagName("UF")->item(0)->nodeValue;
$aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
$this->pdf->textBo($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
$this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
//FONE / FAX
$x += $w;
$w = $maxW-$w-$w1;
$texto = 'FONE / FAX';
$aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
$this->pdf->textBo($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
$this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
$texto = ! empty($this->entrega->getElementsByTagName("fone")->item(0)->nodeValue) ?
$this->entrega->getElementsByTagName("fone")->item(0)->nodeValue : '';
$aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
$this->pdf->textBo($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
$this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
return ($y + $h);
} //fim da função localEntregaDANFE

Expand All @@ -1753,31 +1753,31 @@ protected function pLocalRetiradaDANFE($x = 0, $y = 0)
$h = 7;
$texto = 'INFORMAÇÕES DO LOCAL DE RETIRADA';
$aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
$this->pdf->textBo($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
$this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
//NOME / RAZÃO SOCIAL
$w = round($maxW*0.61, 0);
$w1 = $w;
$y += 3;
$texto = 'NOME / RAZÃO SOCIAL';
$aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
$this->pdf->textBo($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
$this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
$texto = '';
if ($this->retirada->getElementsByTagName("xNome")->item(0)) {
$texto = $this->retirada->getElementsByTagName("xNome")->item(0)->nodeValue;
}
$aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
if ($this->orientacao == 'P') {
$this->pdf->textBo($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 0, '');
$this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 0, '');
} else {
$this->pdf->textBo($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 1, '');
$this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 1, '');
}
//CNPJ / CPF
$x += $w;
$w = round($maxW*0.23, 0);
$w2 = $w;
$texto = 'CNPJ / CPF';
$aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
$this->pdf->textBo($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
$this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
//Pegando valor do CPF/CNPJ
if (! empty($this->retirada->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
$texto = $this->pFormat(
Expand All @@ -1792,23 +1792,23 @@ protected function pLocalRetiradaDANFE($x = 0, $y = 0)
) : '';
}
$aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
$this->pdf->textBo($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
$this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
//INSCRIÇÃO ESTADUAL
$x += $w;
$w = $maxW-($w1+$w2);
$wx = $w;
$texto = 'INSCRIÇÃO ESTADUAL';
$aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
$this->pdf->textBo($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
$this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
$texto = '';
if ($this->retirada->getElementsByTagName("IE")->item(0)) {
$texto = $this->retirada->getElementsByTagName("IE")->item(0)->nodeValue;
}
$aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
if ($this->orientacao == 'P') {
$this->pdf->textBo($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
$this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
} else {
$this->pdf->textBo($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 1, '');
$this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 1, '');
}
//ENDEREÇO
$w = round($maxW*0.355, 0) + $wx;
Expand All @@ -1817,66 +1817,66 @@ protected function pLocalRetiradaDANFE($x = 0, $y = 0)
$x = $oldX;
$texto = 'ENDEREÇO';
$aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
$this->pdf->textBo($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
$this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
$texto = $this->retirada->getElementsByTagName("xLgr")->item(0)->nodeValue;
$texto .= ', ' . $this->retirada->getElementsByTagName("nro")->item(0)->nodeValue;
$texto .= $this->getTagValue($this->retirada, "xCpl", " - ");
$aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
$this->pdf->textBo($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 0, '', true);
$this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 0, '', true);
//BAIRRO / DISTRITO
$x += $w;
$w = round($maxW*0.335, 0);
$w2 = $w;
$texto = 'BAIRRO / DISTRITO';
$aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
$this->pdf->textBo($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
$this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
$texto = $this->retirada->getElementsByTagName("xBairro")->item(0)->nodeValue;
$aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
$this->pdf->textBo($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
$this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
//CEP
$x += $w;
$w = $maxW-($w1+$w2);
$texto = 'CEP';
$aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
$this->pdf->textBo($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
$this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
$texto = ! empty($this->retirada->getElementsByTagName("CEP")->item(0)->nodeValue) ?
$this->retirada->getElementsByTagName("CEP")->item(0)->nodeValue : '';
$texto = $this->pFormat($texto, "#####-###");
$aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
$this->pdf->textBo($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
$this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
//MUNICÍPIO
$w = round($maxW*0.805, 0);
$w1 = $w;
$y += $h;
$x = $oldX;
$texto = 'MUNICÍPIO';
$aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
$this->pdf->textBo($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
$this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
$texto = $this->retirada->getElementsByTagName("xMun")->item(0)->nodeValue;
if (strtoupper(trim($texto)) == "EXTERIOR" && $this->retirada->getElementsByTagName("xPais")->length > 0) {
$texto .= " - " . $this->retirada->getElementsByTagName("xPais")->item(0)->nodeValue;
}
$aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
$this->pdf->textBo($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 0, '');
$this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 0, '');
//UF
$x += $w;
$w = 8;
$texto = 'UF';
$aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
$this->pdf->textBo($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
$this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
$texto = $this->retirada->getElementsByTagName("UF")->item(0)->nodeValue;
$aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
$this->pdf->textBo($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
$this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
//FONE / FAX
$x += $w;
$w = $maxW-$w-$w1;
$texto = 'FONE / FAX';
$aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
$this->pdf->textBo($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
$this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
$texto = ! empty($this->retirada->getElementsByTagName("fone")->item(0)->nodeValue) ?
$this->retirada->getElementsByTagName("fone")->item(0)->nodeValue : '';
$aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
$this->pdf->textBo($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
$this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
return ($y + $h);
} //fim da função localRetiradaDANFE

Expand Down

0 comments on commit cfbeb13

Please sign in to comment.