NFE-678

Rejeição: NF referenciada com UF diferente desta NF-e (cUF …).

In English The referenced document of a complementary NF-e or credit note is from another state than the issuer.

error: the document is invalid

What the rule checks

As the rule set's publisher wrote it. The rule runs on every element the context matches, and fails where the test is false; the validator reports the line of that element.

Context
nfe:infNFe
Test
not($fin = '2' or $credit = ('03', '04')) or ((every $k in $refs/nfe:refNFe satisfies substring($k, 1, 2) = string($ide/nfe:cUF)) and (every $n in $refs/nfe:refNF satisfies string($n/nfe:cUF) = string($ide/nfe:cUF)))

Checked with NF-e 4.00, NF-e 4.00 with authorisation protocol