Skip to content

Commit

Permalink
Retirada de validações sobre NCM e CRT=4 e CSONSN, tais vallidações d…
Browse files Browse the repository at this point in the history
…evem ser feitas no aplicativo emissor
  • Loading branch information
robmachado committed Oct 16, 2024
1 parent 6c3f3e2 commit b632784
Showing 1 changed file with 23 additions and 13 deletions.
36 changes: 23 additions & 13 deletions src/Make.php
Original file line number Diff line number Diff line change
Expand Up @@ -791,15 +791,25 @@ public function tagide(stdClass $std): DOMElement
/**
* Chave de acesso da NF-e referenciada BA02 pai BA01
* tag NFe/infNFe/ide/NFref/refNFe
* @param stdClass $std
* @return DOMElement
* @throws \DOMException
*/
public function tagrefNFe(stdClass $std): DOMElement
{
$possible = ['refNFe'];
$possible = ['refNFe', 'refNFeSig'];
$std = $this->equilizeParameters($std, $possible);

if (empty($std->refNFe) && empty($std->refNFe)) {
return $this->dom->createElement("refNFe", '');
}
$num = $this->buildNFref();
$refNFe = $this->dom->createElement("refNFe", $std->refNFe);
$this->dom->appChild($this->aNFref[$num - 1], $refNFe);
if (!empty($std->refNFe)) {
$refNFe = $this->dom->createElement("refNFe", $std->refNFe);
$this->dom->appChild($this->aNFref[$num - 1], $refNFe);
} else {
$refNFe = $this->dom->createElement("refNFeSig", $std->refNFeSig);
$this->dom->appChild($this->aNFref[$num - 1], $refNFe);
}
return $refNFe;
}

Expand Down Expand Up @@ -1864,6 +1874,7 @@ public function tagprod(stdClass $std): DOMElement
}
}

/*
$CRT = null;
if (!empty($this->emit->getElementsByTagName("CRT")->item(0))) {
$CRT = (int) $this->emit->getElementsByTagName("CRT")->item(0)->nodeValue;
Expand All @@ -1879,7 +1890,7 @@ public function tagprod(stdClass $std): DOMElement
if ($allowEmptyNcm && empty($std->NCM)) {
$std->NCM = '00000000';
}

*/
$identificador = 'I01 <prod> - ';
$prod = $this->dom->createElement("prod");
$this->dom->addChild(
Expand Down Expand Up @@ -4785,6 +4796,7 @@ public function tagICMSSN(stdClass $std): DOMElement
$this->stdTot->vFCPST += (float) !empty($std->vFCPST) ? $std->vFCPST : 0;
$this->stdTot->vFCPSTRet += (float) !empty($std->vFCPSTRet) ? $std->vFCPSTRet : 0;

/*
$CRT = null;
if (!empty($this->emit->getElementsByTagName("CRT")->item(0))) {
$CRT = (int) $this->emit->getElementsByTagName("CRT")->item(0)->nodeValue;
Expand All @@ -4793,7 +4805,7 @@ public function tagICMSSN(stdClass $std): DOMElement
$allowEmptyOrig = $CRT == 4 && in_array($std->CSOSN, [
'102', '103', '300', '400', '900',
]);

*/
switch ($std->CSOSN) {
case '101':
$icmsSN = $this->dom->createElement("ICMSSN101");
Expand Down Expand Up @@ -4835,10 +4847,9 @@ public function tagICMSSN(stdClass $std): DOMElement
$this->dom->addChild(
$icmsSN,
'orig',
$std->orig,
!$allowEmptyOrig,
"[item $std->item] Origem da mercadoria",
$allowEmptyOrig,
$std->orig ?? null, //poderá ser null caso CRT=4 e 102
false,
"[item $std->item] Origem da mercadoria"
);
$this->dom->addChild(
$icmsSN,
Expand Down Expand Up @@ -5141,10 +5152,9 @@ public function tagICMSSN(stdClass $std): DOMElement
$this->dom->addChild(
$icmsSN,
'orig',
$std->orig,
!$allowEmptyOrig,
$std->orig ?? null, //poderá ser null caso CRT=4 e 900
false,
"[item $std->item] Origem da mercadoria",
$allowEmptyOrig,
);
$this->dom->addChild(
$icmsSN,
Expand Down

0 comments on commit b632784

Please sign in to comment.