From d903650d7ad28144419990feeaea9fea1889d554 Mon Sep 17 00:00:00 2001 From: Cleiton Perin Date: Tue, 7 Nov 2023 12:05:16 -0300 Subject: [PATCH] Incluido nos calculos de ICMS e ICMS ST os valores do FCP nos totais. --- src/NFe/Danfe.php | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/src/NFe/Danfe.php b/src/NFe/Danfe.php index 45000db7..26b6004d 100644 --- a/src/NFe/Danfe.php +++ b/src/NFe/Danfe.php @@ -142,13 +142,13 @@ class Danfe extends DaCommon protected $qtdeItensProc; /* * NF-e processada - * + * * @var \DOMNode */ protected $nfeProc; /* * Grupo de detalhamento da forma de pagamento - * + * * @var \DOMNode */ protected $detPag; @@ -419,7 +419,7 @@ protected function calculoEspacoVericalDadosAdicionais() // EXIBE EMAIL DO DESTINATÁRIO if($this->exibirEmailDestinatario){ $this->textoAdic .= $this->getTagValue($this->dest, "email", ' Email do Destinatário: '); - } + } $this->textoAdic .= !empty($this->getTagValue($this->infAdic, "infAdFisco")) ? "\n Inf. fisco: " . $this->getTagValue($this->infAdic, "infAdFisco") @@ -2237,14 +2237,24 @@ protected function pagamento($x, $y) */ protected function impostoHelper($x, $y, $w, $h, $titulo, $campoImposto) { - $valorImposto = '0,00'; - $the_field = $this->ICMSTot->getElementsByTagName($campoImposto)->item(0); + $value = 0; + $value2 = 0; + $the_field = $this->ICMSTot->getElementsByTagName($campoImposto)->item(0); if (isset($the_field)) { - $the_value = $the_field->nodeValue; - if (!empty($the_value)) { - $valorImposto = number_format($the_value, 2, ",", "."); + $value = $the_field->nodeValue; + if ($campoImposto == 'vICMS') { // soma junto ao ICMS o FCP + $the_field_aux = $this->ICMSTot->getElementsByTagName('vFCP')->item(0); + if (isset($the_field_aux)) { + $value2 = $the_field_aux->nodeValue; + } + } else if ($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; + } } } + $valorImposto = number_format($value + $value2, 2, ",", "."); $fontTitulo = ['font' => $this->fontePadrao, 'size' => 6, 'style' => '']; $fontValor = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];