Skip to content

Commit

Permalink
ajustes Grupo Credito Presumido NT2019.001_v1.62
Browse files Browse the repository at this point in the history
  • Loading branch information
robmachado committed Mar 27, 2024
1 parent 49971d4 commit 289d50f
Showing 1 changed file with 33 additions and 20 deletions.
53 changes: 33 additions & 20 deletions src/Make.php
Original file line number Diff line number Diff line change
Expand Up @@ -1745,20 +1745,42 @@ public function taginfAdProd(stdClass $std): DOMElement
* Grupo opcional para informações do Crédito Presumido. Obs.: A exigência do preenchimento das informações
* do crédito presumido fica a critério de cada UF
* tag NFe/infNFe/det[]/prod/[cCredPresumido, pCredPresumido, vCredPresumido]
* NT 2019.001 v1.61
* NT 2019.001 v1.62
* @param stdClass $std
* @return void
*/
public function tagCreditoPresumidoProd(stdClass $std)
{
$possible = ['item', 'cCredPresumido', 'pCredPresumido', 'vCredPresumido'];
$std = $this->equilizeParameters($std, $possible);
$this->aProdCreditoPresumido[] = [
'item' => $std->item,
'cCredPresumido' => $std->cCredPresumido,
'pCredPresumido' => $this->conditionalNumberFormatting($std->pCredPresumido, 4),
'vCredPresumido' => $this->conditionalNumberFormatting($std->vCredPresumido, 2)
];
$identificador = 'I05g <gCred> - ';
$gcred = $this->dom->createElement("gCred");
$this->dom->addChild(
$gcred,
"cCredPresumido",
$std->cCredPresumido,
true,
$identificador . "[item $std->item] cCredPresumido Código de Benefício Fiscal de Crédito "
. "Presumido na UF aplicado ao item",
true
);
$this->dom->addChild(
$gcred,
"pCredPresumido",
$this->conditionalNumberFormatting($std->pCredPresumido, 4),
true,
$identificador . "[item $std->item] pCredPresumido Percentual do Crédito Presumido",
true
);
$this->dom->addChild(
$gcred,
"vCredPresumido",
$this->conditionalNumberFormatting($std->vCredPresumido, 2),
true,
$identificador . "[item $std->item] vCredPresumido Valor do Crédito Presumido",
true
);
$this->aProdCreditoPresumido[$std->item][] = $gcred;
}

/**
Expand Down Expand Up @@ -7868,9 +7890,8 @@ protected function buildDet()
}
//insere credito presumido
$it = 0;
foreach ($this->aProdCreditoPresumido as $cp) {
$scp = (object) $cp;
$prod = $this->aProd[$scp->item];
foreach ($this->aProdCreditoPresumido as $key => $cps) {
$prod = $this->aProd[$key];
$cBenef = $prod->getElementsByTagName("cBenef")->item(0);
if (empty($cBenef)) {
break;
Expand All @@ -7880,17 +7901,9 @@ protected function buildDet()
} else {
$node = $prod->getElementsByTagName("CFOP")->item(0);
}
$it++;
if ($it > 4) {
$this->errors[] = "Item {$scp->item} não pode ter mais de 4 registros de Credito Presumido";
continue;
foreach ($cps as $cp) {
$prod->insertBefore($cp, $node);
}
$ccp = $this->dom->createElement('cCredPresumido', $scp->cCredPresumido);
$pcp = $this->dom->createElement('pCredPresumido', $scp->pCredPresumido);
$vcp = $this->dom->createElement('vCredPresumido', $scp->vCredPresumido);
$prod->insertBefore($ccp, $node);
$prod->insertBefore($pcp, $node);
$prod->insertBefore($vcp, $node);
}
//insere DI
foreach ($this->aDI as $nItem => $aDI) {
Expand Down

0 comments on commit 289d50f

Please sign in to comment.