AttestwireRule referenceATW-DECLARED-TOTAL-NOT-A-NUMBER

ATW-DECLARED-TOTAL-NOT-A-NUMBER A stated document total must be a number with a decimal point

noun · Attestwire · fatal · BT-115

For a sample invoice, the library reports: The Amount due for payment (BT-115) is present in this document but could not be read as a number: the element holds "12,34".

Business term
BT-115
Severity
fatal

The fix

Write the amount with a dot decimal separator and no thousands separator: "12.34" rather than "12,34". Formatting for a human reader belongs in the rendered invoice, never in the XML.

A passing value

the shape this field expects
<cbc:PayableAmount>1891.79</cbc:PayableAmount>

What the library returns

The full error returned by @attestwire/en16931. It includes the rule ID, affected field and suggested correction. Developers can use this object in their application:

TeachingError
{
  "rule": "ATW-DECLARED-TOTAL-NOT-A-NUMBER",
  "field": "BT-115",
  "severity": "fatal",
  "message": "The Amount due for payment (BT-115) is present in this document but could not be read as a number: the element holds \"12,34\". That is a decimal comma, which is how most of continental Europe writes an amount and is not how EN 16931 writes one: every monetary amount in both syntaxes is an xs:decimal, and xs:decimal has exactly one decimal separator, the dot. The value was left out of the invoice rather than guessed at, so nothing further compares it — BR-CO-15 and BR-CO-16 need a number on both sides. This is a finding of ours, not a rule of the regulation: the official validator rejects the same document one step earlier, at XML Schema validation, as cvc-datatype-valid.1.2.1.",
  "fix": "Write the amount with a dot decimal separator and no thousands separator: \"12.34\" rather than \"12,34\". Formatting for a human reader belongs in the rendered invoice, never in the XML.",
  "example": "<cbc:PayableAmount>1891.79</cbc:PayableAmount>",
  "xpath": "/ubl:Invoice/cac:LegalMonetaryTotal/cbc:PayableAmount",
  "docsUrl": "https://github.com/attestwire/en16931#not-implemented-yet"
}

xpath is always a UBL path. On a CII invoice, look for the matching CII field instead.