Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,487 changes: 1,487 additions & 0 deletions examples/nfe_v4.00_PL_010B.xml

Large diffs are not rendered by default.

1,496 changes: 1,496 additions & 0 deletions examples/nfe_v4.00_PL_010C.xml

Large diffs are not rendered by default.

110 changes: 101 additions & 9 deletions schemes/PL_010_V1.30/leiauteNFe_v4.00.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,13 @@ Campo preenchido somente quando “indPres = 5 (Operação presencial, fora do e
</xs:element>
<xs:element name="tpNFDebito" type="TTpNFDebito" minOccurs="0">
<xs:annotation>
<xs:documentation>Tipo de Nota de Débito</xs:documentation>
<xs:documentation>Tipo de Nota de Débito:
01=Transferência de créditos para Cooperativas;
02=Anulação de Crédito por Saídas Imunes/Isentas;
03=Débitos de notas fiscais não processadas na apuração;
04=Multa e juros;
05=Transferência de crédito de sucessão.
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="tpNFCredito" type="TTpNFCredito" minOccurs="0">
Expand Down Expand Up @@ -501,7 +507,7 @@ Preencher com &quot;2B&quot;, quando se tratar de Cupom Fiscal emitido por máqu
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="refNFe" type="TChNFe" minOccurs="1" maxOccurs="99">
<xs:element name="refNFe" type="TChNFe" maxOccurs="99">
<xs:annotation>
<xs:documentation>Chave de acesso da NF-e de antecipação de pagamento</xs:documentation>
</xs:annotation>
Expand Down Expand Up @@ -2555,13 +2561,15 @@ ambiente.</xs:documentation>
</xs:element>
<xs:element name="motDesICMS">
<xs:annotation>
<xs:documentation>Motivo da desoneração do ICMS:3-Uso na agropecuária;9-Outros;12-Fomento agropecuário</xs:documentation>
<xs:documentation>Motivo da desoneração do ICMS:3-Uso na agropecuária;9-Outros; 10=Deficiente Condutor (Convênio ICMS 38/12); 11=Deficiente Não Condutor (Convênio ICMS 38/12); 12-Fomento agropecuário</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:whiteSpace value="preserve"/>
<xs:enumeration value="3"/>
<xs:enumeration value="9"/>
<xs:enumeration value="10"/>
<xs:enumeration value="11"/>
<xs:enumeration value="12"/>
</xs:restriction>
</xs:simpleType>
Expand Down Expand Up @@ -3395,11 +3403,39 @@ Informar o motivo da desoneração:
<xs:documentation>Percentual de redução da BC</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="cBenefRBC" minOccurs="0">
<xs:annotation>
<xs:documentation>Código de Benefício Fiscal na UF aplicado ao item quando houver RBC.</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:whiteSpace value="preserve"/>
<xs:pattern value="[!-ÿ]{8}|[!-ÿ]{10}"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="pICMS" type="TDec_0302a04">
<xs:annotation>
<xs:documentation>Alíquota do ICMS</xs:documentation>
</xs:annotation>
</xs:element>
<xs:sequence minOccurs="0">
<xs:element name="vICMSOp" type="TDec_1302">
<xs:annotation>
<xs:documentation>Valor do ICMS da Operação</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="pDif" type="TDec_0302a04Max100">
<xs:annotation>
<xs:documentation>Percentual do diferemento</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="vICMSDif" type="TDec_1302">
<xs:annotation>
<xs:documentation>Valor do ICMS da diferido</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
<xs:element name="vICMS" type="TDec_1302">
<xs:annotation>
<xs:documentation>Valor do ICMS</xs:documentation>
Expand All @@ -3422,6 +3458,23 @@ Informar o motivo da desoneração:
</xs:annotation>
</xs:element>
</xs:sequence>
<xs:sequence minOccurs="0">
<xs:element name="pFCPDif" type="TDec_0302a04Opc">
<xs:annotation>
<xs:documentation>Percentual do diferimento do ICMS relativo ao Fundo de Combate à Pobreza (FCP).</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="vFCPDif" type="TDec_1302">
<xs:annotation>
<xs:documentation>Valor do ICMS relativo ao Fundo de Combate à Pobreza (FCP) diferido.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="vFCPEfet" type="TDec_1302" minOccurs="0">
<xs:annotation>
<xs:documentation>Valor efetivo do ICMS relativo ao Fundo de Combate à Pobreza (FCP).</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:sequence>
<xs:sequence minOccurs="0">
<xs:element name="modBCST">
Expand Down Expand Up @@ -3569,12 +3622,14 @@ Operação interestadual para consumidor final com partilha do ICMS devido na o
<xs:annotation>
<xs:documentation>Tributação pelo ICMS
10 - Tributada e com cobrança do ICMS por substituição tributária;
20 – Redução de base de cálculo
90 – Outros.</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:whiteSpace value="preserve"/>
<xs:enumeration value="10"/>
<xs:enumeration value="20"/>
<xs:enumeration value="90"/>
</xs:restriction>
</xs:simpleType>
Expand Down Expand Up @@ -3693,6 +3748,43 @@ Operação interestadual para consumidor final com partilha do ICMS devido na o
<xs:documentation>Sigla da UF para qual é devido o ICMS ST da operação.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:sequence minOccurs="0">
<xs:annotation>
<xs:documentation>Grupo desoneração</xs:documentation>
</xs:annotation>
<xs:element name="vICMSDeson" type="TDec_1302">
<xs:annotation>
<xs:documentation>Valor do ICMS de desoneração</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="motDesICMS">
<xs:annotation>
<xs:documentation>Motivo da desoneração do ICMS:9-Outros;10=Deficiente Condutor (Convênio ICMS 38/12) 11=Deficiente Não Condutor (Convênio ICMS 38/12)</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:whiteSpace value="preserve"/>
<xs:enumeration value="9"/>
<xs:enumeration value="10"/>
<xs:enumeration value="11"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="indDeduzDeson" minOccurs="0">
<xs:annotation>
<xs:documentation>Indica se o valor do ICMS desonerado (vICMSDeson) deduz do valor do item (vProd):
0=Valor do ICMS desonerado (vICMSDeson) não deduz do valor do item (vProd) / total da NF-e;
1=Valor do ICMS desonerado (vICMSDeson) deduz do valor do item (vProd) / total da NF-e.</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:whiteSpace value="preserve"/>
<xs:enumeration value="0"/>
<xs:enumeration value="1"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:sequence>
</xs:complexType>
</xs:element>
Expand Down Expand Up @@ -6518,16 +6610,16 @@ tipo de ato concessório:
<xs:whiteSpace value="preserve"/>
<xs:minLength value="60"/>
<xs:maxLength value="1000"/>
<!--QRCODE V1-->
<xs:pattern value="((HTTPS?|https?)://.*\?chNFe=[0-9]{44}&amp;nVersao=100&amp;tpAmb=[1-2](&amp;cDest=([A-Za-z0-9.:+-/)(]{0}|[A-Za-z0-9.:+-/)(]{5,20})?)?&amp;dhEmi=[A-Fa-f0-9]{50}&amp;vNF=(0|0\.[0-9]{2}|[1-9]{1}[0-9]{0,12}(\.[0-9]{2})?)&amp;vICMS=(0|0\.[0-9]{2}|[1-9]{1}[0-9]{0,12}(\.[0-9]{2})?)&amp;digVal=[A-Fa-f0-9]{56}&amp;cIdToken=[0-9]{6}&amp;cHashQRCode=[A-Fa-f0-9]{40})"/>
<!--QRCODE V2 ONLINE-->
<xs:pattern value="((HTTPS?|https?)://.*\?p=([0-9]{34}(1|3|4)[0-9]{9})\|[2]\|[1-2]\|(0|[1-9]{1}([0-9]{1,5})?)\|[A-Fa-f0-9]{40})"/>
<!--QRCODE V2 OFFLINE-->
<xs:pattern value="((HTTPS?|https?)://.*\?p=([0-9]{34}9[0-9]{9})\|[2]\|[1-2]\|([0]{1}[1-9]{1}|[1-2]{1}[0-9]{1}|[3]{1}[0-1]{1})\|(0|0\.[0-9]{2}|[1-9]{1}[0-9]{0,12}(\.[0-9]{2})?)\|[A-Fa-f0-9]{56}\|(0|[1-9]{1}([0-9]{1,5})?)\|[A-Fa-f0-9]{40})"/>
<!--QRCODE V3 ONLINE-->
<xs:pattern value="((HTTPS?|https?)://.*\?p=([0-9]{34}(1|3|4)[0-9]{9})\|[3]\|[1-2])"/>
<!--QRCODE V3 OFFLINE-->
<xs:pattern value="((HTTPS?|https?)://.*\?p=([0-9]{34}(9)[0-9]{9})\|[3]\|[1-2]\|([0]{1}[1-9]{1}|[1-2]{1}[0-9]{1}|[3]{1}[0-1]{1})\|(0|0\.[0-9]{2}|[1-9]{1}[0-9]{0,12}(\.[0-9]{2})?)\|((1|2|3)?)\|(([0-9]{3,14})?)\|([a-zA-Z0-9+/]+[=]{0,2}))"/>
<!--QRCODE V1-->
<!--QRCODE V2 ONLINE-->
<!--QRCODE V2 OFFLINE-->
<!--QRCODE V3 ONLINE-->
<!--QRCODE V3 OFFLINE-->
</xs:restriction>
</xs:simpleType>
</xs:element>
Expand Down Expand Up @@ -7576,4 +7668,4 @@ alterado para tamanho variavel 1-4. (NT2011/004)</xs:documentation>
</xs:choice>
</xs:sequence>
</xs:complexType>
</xs:schema>
</xs:schema>
2 changes: 1 addition & 1 deletion src/Tools.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ public function sefazConsultaChave(string $chave, ?int $tpAmb = null): string
if (empty($chave)) {
throw new InvalidArgumentException('Consulta chave: a chave esta vazia!');
}
if (strlen($chave) != 44 || !is_numeric($chave)) {
if (strlen($chave) != 44) {
throw new InvalidArgumentException("Consulta chave: chave \"$chave\" invalida!");
}
$uf = UFList::getUFByCode((int)substr($chave, 0, 2));
Expand Down
1 change: 1 addition & 0 deletions src/Traits/TraitTagCana.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ public function tagforDia(stdClass $std): DOMElement
/**
* Grupo Deduções – Taxas e Contribuições ZC10 pai ZC01
* tag NFe/infNFe/cana/deduc (opcional)
* A partir de 06/06/2026 não será mais usado DEDUC
* @param stdClass $std
* @return DOMElement
* @throws DOMException
Expand Down
140 changes: 70 additions & 70 deletions src/Traits/TraitTagDetICMS.php
Original file line number Diff line number Diff line change
Expand Up @@ -1275,13 +1275,13 @@ public function tagICMS(stdClass $std): DOMElement
"$identificador Percentual da Redução de BC"
);
//campo adicionado NT 2022.002 v1.30
// $this->dom->addChild(
// $icms,
// 'cBenefRBC',
// $std->cBenefRBC ?? null,
// false,
// "$identificador Código de Benefício Fiscal na UF aplicado ao item quando houver RBC"
// );
$this->dom->addChild(
$icms,
'cBenefRBC',
$std->cBenefRBC ?? null,
false,
"$identificador Código de Benefício Fiscal na UF aplicado ao item quando houver RBC"
);
$this->dom->addChild(
$icms,
'pICMS',
Expand All @@ -1291,27 +1291,27 @@ public function tagICMS(stdClass $std): DOMElement
);
//grupo EXTRA NT 2022.002 v1.30
//estes 3 campos serão obrigatórios a partir de 06/06/2026
// $this->dom->addChild(
// $icms,
// 'vICMSOp',
// $this->conditionalNumberFormatting($std->vICMSOp),
// false,
// "$identificador Valor do ICMS da Operação"
// );
// $this->dom->addChild(
// $icms,
// 'pDif',
// $this->conditionalNumberFormatting($std->pDif ?? null, 4),
// false,
// "$identificador Percentual do diferimento"
// );
// $this->dom->addChild(
// $icms,
// 'vICMSDif',
// $this->conditionalNumberFormatting($std->vICMSDif ?? null),
// false,
// "$identificador Valor do ICMS diferido"
// );
$this->dom->addChild(
$icms,
'vICMSOp',
$this->conditionalNumberFormatting($std->vICMSOp),
false,
"$identificador Valor do ICMS da Operação"
);
$this->dom->addChild(
$icms,
'pDif',
$this->conditionalNumberFormatting($std->pDif ?? null, 4),
false,
"$identificador Percentual do diferimento"
);
$this->dom->addChild(
$icms,
'vICMSDif',
$this->conditionalNumberFormatting($std->vICMSDif ?? null),
false,
"$identificador Valor do ICMS diferido"
);
//fim grupo adicional
$this->dom->addChild(
$icms,
Expand Down Expand Up @@ -1344,27 +1344,27 @@ public function tagICMS(stdClass $std): DOMElement
);
//grupo adicional NT 2022.002 v1.30
//os dois primeiros campos serão obrigatórios a partir de 06/06/2026
// $this->dom->addChild(
// $icms,
// 'pFCPDif',
// $this->conditionalNumberFormatting($std->pFCPDif ?? null, 4),
// false,
// "$identificador Percentual do diferimento do ICMS relativo ao Fundo de Combate à Pobreza"
// );
// $this->dom->addChild(
// $icms,
// 'vFCPDif',
// $this->conditionalNumberFormatting($std->vFCPDif ?? null),
// false,
// "$identificador Valor do ICMS relativo ao Fundo de Combate à Pobreza (FCP) diferido"
// );
// $this->dom->addChild(
// $icms,
// 'vFCPEfet',
// $this->conditionalNumberFormatting($std->vFCPEfet ?? null),
// false,
// "$identificador Valor efetivo do ICMS relativo ao Fundo de Combate à Pobreza (FCP)"
// );
$this->dom->addChild(
$icms,
'pFCPDif',
$this->conditionalNumberFormatting($std->pFCPDif ?? null, 4),
false,
"$identificador Percentual do diferimento do ICMS relativo ao Fundo de Combate à Pobreza"
);
$this->dom->addChild(
$icms,
'vFCPDif',
$this->conditionalNumberFormatting($std->vFCPDif ?? null),
false,
"$identificador Valor do ICMS relativo ao Fundo de Combate à Pobreza (FCP) diferido"
);
$this->dom->addChild(
$icms,
'vFCPEfet',
$this->conditionalNumberFormatting($std->vFCPEfet ?? null),
false,
"$identificador Valor efetivo do ICMS relativo ao Fundo de Combate à Pobreza (FCP)"
);
//fim do grupo adicional
$this->dom->addChild(
$icms,
Expand Down Expand Up @@ -1644,27 +1644,27 @@ public function tagICMSPart(stdClass $std): DOMElement
"$identificador UF para qual é devido o ICMS ST"
);
//grupo adicional NT 2022.002 v1.30
// $this->dom->addChild(
// $icmsPart,
// 'vICMSDeson',
// $this->conditionalNumberFormatting($std->vICMSDeson ?? null),
// false,
// "$identificador Valor do ICMS desonerado"
// );
// $this->dom->addChild(
// $icmsPart,
// 'motDesICMS',
// $std->motDesICMS ?? null,
// false,
// "$identificador Motivo da desoneração do ICMS"
// );
// $this->dom->addChild(
// $icmsPart,
// 'indDeduzDeson',
// $std->indDeduzDeson ?? null,
// false,
// "$identificador Indica se o valor do ICMS desonerado (vICMSDeson) deduz do valor do item (vProd)."
// );
$this->dom->addChild(
$icmsPart,
'vICMSDeson',
$this->conditionalNumberFormatting($std->vICMSDeson ?? null),
false,
"$identificador Valor do ICMS desonerado"
);
$this->dom->addChild(
$icmsPart,
'motDesICMS',
$std->motDesICMS ?? null,
false,
"$identificador Motivo da desoneração do ICMS"
);
$this->dom->addChild(
$icmsPart,
'indDeduzDeson',
$std->indDeduzDeson ?? null,
false,
"$identificador Indica se o valor do ICMS desonerado (vICMSDeson) deduz do valor do item (vProd)."
);
$this->aICMSPart[$std->item] = $icmsPart;
return $icmsPart;
}
Expand Down
4 changes: 2 additions & 2 deletions tests/TaxCoverageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ public function testICMS70WithoutSTDeson(): void

public function testICMS90Full(): void
{
$this->markTestSkipped('Campos estarão disponíveis a partir de junho/2026, aguardando publicação do XSD.');
//$this->markTestSkipped('Campos estarão disponíveis a partir de junho/2026, aguardando publicação do XSD.');
$std = new \stdClass();
$std->item = 1;
$std->orig = 0;
Expand Down Expand Up @@ -580,7 +580,7 @@ public function testICMS90Minimal(): void

public function testICMSPart(): void
{
$this->markTestSkipped('Campos estarão disponíveis a partir de junho/2026, aguardando publicação do XSD.');
//$this->markTestSkipped('Campos estarão disponíveis a partir de junho/2026, aguardando publicação do XSD.');
// Initialize stdTot->vICMSST which the trait accesses but Make's constructor does not set
if (!isset($this->make->stdTot->vICMSST)) {
$this->make->stdTot->vICMSST = 0;
Expand Down
Loading
Loading