Skip to content

Commit

Permalink
danfce formas de pagamento em maiusculas
Browse files Browse the repository at this point in the history
  • Loading branch information
robmachado committed Apr 6, 2024
1 parent 5c0f82d commit c52c213
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 22 deletions.
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"php": ">= 7.4",
"ext-dom": "*",
"ext-gd": "*",
"ext-mbstring": "*",
"tecnickcom/tc-lib-barcode": "^1",
"nfephp-org/sped-common": "^5.1.0"
},
Expand Down
1 change: 1 addition & 0 deletions examples/nfe/danfesimples.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
try {
$danfe = new DanfeSimples($xml);
$danfe->debugMode(false);

$pdf = $danfe->render();
header('Content-Type: application/pdf');
echo $pdf;
Expand Down
6 changes: 2 additions & 4 deletions src/CTe/Daevento.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,7 @@ protected function loadDoc($xml)
*/
protected function monta(
$logo = ''
)
{
) {
if (!empty($logo)) {
$this->logomarca = $this->adjustImage($logo);
}
Expand Down Expand Up @@ -189,8 +188,7 @@ private function header(
$x,
$y,
$pag
)
{
) {
$oldX = $x;
$oldY = $y;
$maxW = $this->wPrint;
Expand Down
6 changes: 3 additions & 3 deletions src/Legacy/Pdf.php
Original file line number Diff line number Diff line change
Expand Up @@ -806,7 +806,7 @@ public function dashedHLine($x, $y, $w, $h, $n)
*/
public function dashedVLine($x, $y, $w, $yfinal, $n)
{
$this->setDrawColor(150,150,150);
$this->setDrawColor(150, 150, 150);
$this->setLineWidth($w);
if ($y > $yfinal) {
$aux = $yfinal;
Expand Down Expand Up @@ -1124,8 +1124,8 @@ public function textBox90(
* @param string $text
* @return string
*/
private function convertToIso($text) {
private function convertToIso($text)
{
return mb_convert_encoding($text, 'ISO-8859-1', ['UTF-8', 'windows-1252']);
}

}
4 changes: 2 additions & 2 deletions src/NFe/Danfe.php
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ protected function calculoEspacoVericalDadosAdicionais()
$this->textoAdic .= $infPedido;
}
// EXIBE EMAIL DO DESTINATÁRIO
if($this->exibirEmailDestinatario){
if ($this->exibirEmailDestinatario) {
$this->textoAdic .= $this->getTagValue($this->dest, "email", ' Email do Destinatário: ');
}

Expand Down Expand Up @@ -2245,7 +2245,7 @@ protected function impostoHelper($x, $y, $w, $h, $titulo, $campoImposto)
if (isset($the_field_aux)) {
$value2 = $the_field_aux->nodeValue;
}
} else if ($campoImposto == 'vST') { // soma junto ao ICMS ST o FCP ST
} elseif ($campoImposto == 'vST') { // soma junto ao ICMS ST o FCP ST
$the_field_aux = $this->ICMSTot->getElementsByTagName('vFCPST')->item(0);
if (isset($the_field_aux)) {
$value2 = $the_field_aux->nodeValue;
Expand Down
31 changes: 20 additions & 11 deletions src/NFe/DanfeSimples.php
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,6 @@ public function __construct($xml, $orientacao = 'P')
$this->loadDoc($xml);
$this->orientacao = $orientacao;
}

private function loadDoc($xml)
{
$this->xml = $xml;
Expand Down Expand Up @@ -263,7 +262,9 @@ protected function monta($logo = null)
$pesoB = 0.000;
$totalVolumes = 0;

if( isset($this->nfeArray['NFe']['infNFe']['transp']) && isset($this->nfeArray['NFe']['infNFe']['transp']['vol']) ) {
if (isset($this->nfeArray['NFe']['infNFe']['transp'])
&& isset($this->nfeArray['NFe']['infNFe']['transp']['vol'])
) {
// Normalizar o array de volumes quando tem apenas 1 volumes
if (!isset($this->nfeArray['NFe']['infNFe']['transp']['vol'][0])) {
$this->nfeArray['NFe']['infNFe']['transp']['vol'] = [
Expand Down Expand Up @@ -300,7 +301,7 @@ protected function monta($logo = null)
'C',
1
);
}
}

// LINHA 2
$dataEmissao = date('d/m/Y', strtotime("{$this->nfeArray['NFe']['infNFe']['ide']['dhEmi']}"));
Expand Down Expand Up @@ -392,11 +393,13 @@ protected function monta($logo = null)
? $this->nfeArray['NFe']['infNFe']['emit']['CNPJ']
:$this->nfeArray['NFe']['infNFe']['emit']['CPF']);
$this->pdf->cell(($c1 * 2), $pequeno ? 4 : 5, "CNPJ/CPF {$cpfCnpj}", 1, 0, 'C', 1);

$this->pdf->cell(
($c1 * 2),
$pequeno ? 4 : 5,
isset($this->nfeArray['NFe']['infNFe']['emit']['IE']) ? "RG/IE {$this->nfeArray['NFe']['infNFe']['emit']['IE']}" : "RG/IE: Nenhum",
isset($this->nfeArray['NFe']['infNFe']['emit']['IE'])
? "RG/IE {$this->nfeArray['NFe']['infNFe']['emit']['IE']}"
: "RG/IE: Nenhum",
1,
1,
'C',
Expand Down Expand Up @@ -431,11 +434,13 @@ protected function monta($logo = null)
? $this->nfeArray['NFe']['infNFe']['dest']['CNPJ']
:$this->nfeArray['NFe']['infNFe']['dest']['CPF']);
$this->pdf->cell(($c1 * 2), $pequeno ? 4 : 5, "CNPJ/CPF {$cpfCnpj}", 1, 0, 'C', 1);

$this->pdf->cell(
($c1 * 2),
$pequeno ? 4 : 5,
isset($this->nfeArray['NFe']['infNFe']['dest']['IE']) ? "RG/IE {$this->nfeArray['NFe']['infNFe']['dest']['IE']}" : "RG/IE: Nenhum",
isset($this->nfeArray['NFe']['infNFe']['dest']['IE'])
? "RG/IE {$this->nfeArray['NFe']['infNFe']['dest']['IE']}"
: "RG/IE: Nenhum",
1,
1,
'C',
Expand All @@ -453,7 +458,9 @@ protected function monta($logo = null)
}
$enderecoLinha2 .= "{$this->nfeArray['NFe']['infNFe']['entrega']['xMun']}"
. " / {$this->nfeArray['NFe']['infNFe']['entrega']['UF']}"
. (isset($this->nfeArray['NFe']['infNFe']['entrega']['CEP']) ? " - CEP {$this->nfeArray['NFe']['infNFe']['entrega']['CEP']}" : null);
. (isset($this->nfeArray['NFe']['infNFe']['entrega']['CEP'])
? " - CEP {$this->nfeArray['NFe']['infNFe']['entrega']['CEP']}"
: null);
} else {
$enderecoLinha1 = "{$this->nfeArray['NFe']['infNFe']['dest']['enderDest']['xLgr']}";
if (!empty($this->nfeArray['NFe']['infNFe']['dest']['enderDest']['nro'])) {
Expand All @@ -465,7 +472,9 @@ protected function monta($logo = null)
}
$enderecoLinha2 .= "{$this->nfeArray['NFe']['infNFe']['dest']['enderDest']['xMun']}"
. " / {$this->nfeArray['NFe']['infNFe']['dest']['enderDest']['UF']}"
. (isset($this->nfeArray['NFe']['infNFe']['entrega']['CEP']) ? " - CEP {$this->nfeArray['NFe']['infNFe']['dest']['enderDest']['CEP']}" : null);
. (isset($this->nfeArray['NFe']['infNFe']['entrega']['CEP'])
? " - CEP {$this->nfeArray['NFe']['infNFe']['dest']['enderDest']['CEP']}"
: null);
}

$this->pdf->setFont('Arial', '', $pequeno ? 9 : 10);
Expand Down Expand Up @@ -540,8 +549,8 @@ protected function monta($logo = null)
}
}

private function convertToIso($text) {
private function convertToIso($text)
{
return mb_convert_encoding($text, 'ISO-8859-1', ['UTF-8', 'windows-1252']);
}

}
3 changes: 1 addition & 2 deletions src/NFe/Traits/TraitBlocoV.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ protected function blocoV($y)
$texto = !empty($this->vTroco) ? number_format((float) $this->vTroco, 2, ',', '.') : '0,00';
$y1 = $this->pdf->textBox($this->margem, $z, $this->wPrint, 3, $texto, $aFont, 'T', 'R', false, '', false);


$this->pdf->dashedHLine($this->margem, $this->bloco5H+$y, $this->wPrint, 0.1, 30);
return $this->bloco5H + $y;
}
Expand All @@ -86,7 +85,7 @@ protected function pagType($type)
90 => 'Sem pagamento',
99 => 'Outros',
];
return $lista[$type];
return mb_strtoupper($lista[$type]);
}

protected function calculateHeightPag()
Expand Down

0 comments on commit c52c213

Please sign in to comment.