NFE-353

Rejeição: Valor do ICMS no CST=51 não corresponde a diferença do ICMS operação e ICMS diferido [nItem: …] (vICMS …).

In English With ICMS CST 51, vICMS is not vICMSOp minus vICMSDif.

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/nfe:det
Test
$cst != '51' or not($icms/nfe:vICMSDif or $icms/nfe:vICMS) or br:dec($icms/nfe:vICMS) = br:dec($icms/nfe:vICMSOp) - br:dec($icms/nfe:vICMSDif)

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