Skip to content

Commit

Permalink
Merge pull request #604 from Emerson-Gabriel/master
Browse files Browse the repository at this point in the history
Correção para exibição individual das unidades med
  • Loading branch information
cleitonperin authored Jun 14, 2024
2 parents 026b1c4 + 6dd61c0 commit e54e5de
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions src/CTe/Dacte.php
Original file line number Diff line number Diff line change
Expand Up @@ -1569,10 +1569,19 @@ protected function descricaoCarga($x = 0, $y = 0)
//Identifica código da unidade
//01 = KG (QUILOS)
$qCarga = 0;
$qCargaPesoBruto = 0;
$qCargaPesoBaseCalculo = 0;
$qCargaPesoAferido = 0;
foreach ($this->infQ as $infQ) {
if (in_array($this->getTagValue($infQ, "cUnid"), array('01', '02'))) {
$qCarga += $this->getTagValue($infQ, "cUnid") == '01' ?
$this->getTagValue($infQ, "qCarga") : $this->getTagValue($infQ, "qCarga") * 1000;
if ($this->getTagValue($infQ, "tpMed") == 'PESO BRUTO')
$qCargaPesoBruto += $this->getTagValue($infQ, "cUnid") == '01' ? $this->getTagValue($infQ, "qCarga") : $this->getTagValue($infQ, "qCarga") * 1000;
else if ($this->getTagValue($infQ, "tpMed") == 'PESO BASE DE CALCULO')
$qCargaPesoBaseCalculo += $this->getTagValue($infQ, "cUnid") == '01' ? $this->getTagValue($infQ, "qCarga") : $this->getTagValue($infQ, "qCarga") * 1000;
else
$qCargaPesoAferido += $this->getTagValue($infQ, "cUnid") == '01' ? $this->getTagValue($infQ, "qCarga") : $this->getTagValue($infQ, "qCarga") * 1000;
} else {
$qCarga += $this->getTagValue($infQ, "qCarga");
}
}
$texto = 'PESO BRUTO (KG)';
Expand All @@ -1581,7 +1590,7 @@ protected function descricaoCarga($x = 0, $y = 0)
'size' => 5,
'style' => '');
$this->pdf->textBox($x + 8, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
$texto = number_format($qCarga, 3, ",", ".");
$texto = number_format($qCargaPesoBruto, 3, ",", ".");
$aFont = array(
'font' => $this->fontePadrao,
'size' => 7,
Expand All @@ -1595,7 +1604,7 @@ protected function descricaoCarga($x = 0, $y = 0)
'size' => 5,
'style' => '');
$this->pdf->textBox($x + 20, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
$texto = number_format($qCarga, 3, ",", ".");
$texto = number_format($qCargaPesoBaseCalculo, 3, ",", ".");
$aFont = array(
'font' => $this->fontePadrao,
'size' => 7,
Expand All @@ -1609,7 +1618,7 @@ protected function descricaoCarga($x = 0, $y = 0)
'size' => 5,
'style' => '');
$this->pdf->textBox($x + 35, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
$texto = number_format($qCarga, 3, ",", ".");
$texto = number_format($qCargaPesoAferido, 3, ",", ".");
$aFont = array(
'font' => $this->fontePadrao,
'size' => 7,
Expand Down

0 comments on commit e54e5de

Please sign in to comment.