diff --git a/addons/ar-arca-v4.mdx b/addons/ar-arca-v4.mdx index a239424..a0f6b82 100644 --- a/addons/ar-arca-v4.mdx +++ b/addons/ar-arca-v4.mdx @@ -317,6 +317,10 @@ The VAT status is validated against the document type: ## Validation Rules +Validation rules check each struct against a set of assertions and report any +failures with a unique code and message. +[Read more about validation](/overview/validation). + diff --git a/addons/br-nfe-v4.mdx b/addons/br-nfe-v4.mdx index 5d67408..afddc53 100644 --- a/addons/br-nfe-v4.mdx +++ b/addons/br-nfe-v4.mdx @@ -6,26 +6,19 @@ Key: `br-nfe-v4` ## Scenarios -### bill/invoice +Scenarios attach notes and extensions to a document when its filters match. +[Read more about scenarios](/overview/scenarios). - - -**Filters:** -- **Types:** `standard`, `credit-note`, `debit-note` - -**Output:** -- **Extensions:** `br-nfe-model:55` - - - + + -**Filters:** -- **Types:** `standard`, `credit-note`, `debit-note` -- **Tags:** `simplified` +| Tags | Type | Output | +| --- | --- | --- | +| - | `standard`
`credit-note`
`debit-note` | {
  "ext": {
    "br-nfe-model": "55"
  }
}
| +| `simplified` | `standard`
`credit-note`
`debit-note` | {
  "ext": {
    "br-nfe-model": "65"
  }
}
| -**Output:** -- **Extensions:** `br-nfe-model:65`
+
## Extensions ### Fiscal Document Model Code @@ -136,6 +129,10 @@ Indicates a special tax regime that a party is subject to. ## Validation Rules +Validation rules check each struct against a set of assertions and report any +failures with a unique code and message. +[Read more about validation](/overview/validation). + diff --git a/addons/br-nfse-v1.mdx b/addons/br-nfse-v1.mdx index b362424..41c295d 100644 --- a/addons/br-nfse-v1.mdx +++ b/addons/br-nfse-v1.mdx @@ -152,6 +152,10 @@ Pattern: `^\d{6}$` ## Validation Rules +Validation rules check each struct against a set of assertions and report any +failures with a unique code and message. +[Read more about validation](/overview/validation). + diff --git a/addons/co-dian-v2.mdx b/addons/co-dian-v2.mdx index e087941..7f5f2c1 100644 --- a/addons/co-dian-v2.mdx +++ b/addons/co-dian-v2.mdx @@ -336,6 +336,10 @@ For example: ## Validation Rules +Validation rules check each struct against a set of assertions and report any +failures with a unique code and message. +[Read more about validation](/overview/validation). + diff --git a/addons/de-xrechnung-v3.mdx b/addons/de-xrechnung-v3.mdx index 8da5aba..3a131db 100644 --- a/addons/de-xrechnung-v3.mdx +++ b/addons/de-xrechnung-v3.mdx @@ -13,6 +13,10 @@ For more information on XRechnung, visit [www.xrechnung.de](https://www.xrechnun ## Validation Rules +Validation rules check each struct against a set of assertions and report any +failures with a unique code and message. +[Read more about validation](/overview/validation). + diff --git a/addons/es-facturae-v3.mdx b/addons/es-facturae-v3.mdx index 1a968d3..d302e35 100644 --- a/addons/es-facturae-v3.mdx +++ b/addons/es-facturae-v3.mdx @@ -17,91 +17,26 @@ options. See the [Extensions](#extensions) section for possible values. ## Scenarios -### bill/invoice +Scenarios attach notes and extensions to a document when its filters match. +[Read more about scenarios](/overview/scenarios). - - -**Filters:** -- **Types:** `standard`, `corrective`, `credit-note`, `debit-note` - -**Output:** -- **Extensions:** `es-facturae-doc-type:FC` - - - - -**Filters:** -- **Tags:** `simplified` - -**Output:** -- **Extensions:** `es-facturae-doc-type:FA` - - - - -**Filters:** -- **Tags:** `self-billed` - -**Output:** -- **Extensions:** `es-facturae-doc-type:AF` - - - - -**Filters:** -- **Types:** `standard` - -**Output:** -- **Extensions:** `es-facturae-invoice-class:OO` - - - - -**Filters:** -- **Types:** `corrective`, `credit-note`, `debit-note` - -**Output:** -- **Extensions:** `es-facturae-invoice-class:OR` - - - - -**Filters:** -- **Tags:** `summary` - -**Output:** -- **Extensions:** `es-facturae-invoice-class:OC` - - - - -**Filters:** -- **Types:** `standard` -- **Tags:** `copy` - -**Output:** -- **Extensions:** `es-facturae-invoice-class:CO` - - - - -**Filters:** -- **Types:** `corrective` -- **Tags:** `copy` - -**Output:** -- **Extensions:** `es-facturae-invoice-class:CR` - - - - -**Filters:** -- **Types:** `standard` -- **Tags:** `copy`, `summary` + + + +| Tags | Type | Output | +| --- | --- | --- | +| - | `standard`
`corrective`
`credit-note`
`debit-note` | {
  "ext": {
    "es-facturae-doc-type": "FC"
  }
}
| +| `simplified` | - | {
  "ext": {
    "es-facturae-doc-type": "FA"
  }
}
| +| `self-billed` | - | {
  "ext": {
    "es-facturae-doc-type": "AF"
  }
}
| +| - | `standard` | {
  "ext": {
    "es-facturae-invoice-class": "OO"
  }
}
| +| - | `corrective`
`credit-note`
`debit-note` | {
  "ext": {
    "es-facturae-invoice-class": "OR"
  }
}
| +| `summary` | - | {
  "ext": {
    "es-facturae-invoice-class": "OC"
  }
}
| +| `copy` | `standard` | {
  "ext": {
    "es-facturae-invoice-class": "CO"
  }
}
| +| `copy` | `corrective` | {
  "ext": {
    "es-facturae-invoice-class": "CR"
  }
}
| +| `copy`
`summary` | `standard` | {
  "ext": {
    "es-facturae-invoice-class": "CC"
  }
}
| -**Output:** -- **Extensions:** `es-facturae-invoice-class:CC`
+
## Extensions ### FacturaE: Document Type @@ -161,6 +96,10 @@ FacturaE requires a specific and single code that explains why the previous invo ## Validation Rules +Validation rules check each struct against a set of assertions and report any +failures with a unique code and message. +[Read more about validation](/overview/validation). + diff --git a/addons/es-sii-v1.mdx b/addons/es-sii-v1.mdx index 36d8339..08e62a2 100644 --- a/addons/es-sii-v1.mdx +++ b/addons/es-sii-v1.mdx @@ -20,46 +20,21 @@ options. See the [Extensions](#extensions) section for possible values. ## Scenarios -### bill/invoice +Scenarios attach notes and extensions to a document when its filters match. +[Read more about scenarios](/overview/scenarios). - - -**Filters:** -- **Types:** `standard` - -**Output:** -- **Extensions:** `es-sii-doc-type:F1` - - - - -**Filters:** -- **Types:** `standard` -- **Tags:** `simplified` - -**Output:** -- **Extensions:** `es-sii-doc-type:F2` - - - - -**Filters:** -- **Types:** `standard` -- **Tags:** `replacement` - -**Output:** -- **Extensions:** `es-sii-doc-type:F3` - - - + + -**Filters:** -- **Types:** `corrective`, `credit-note`, `debit-note` -- **Tags:** `simplified` +| Tags | Type | Output | +| --- | --- | --- | +| - | `standard` | {
  "ext": {
    "es-sii-doc-type": "F1"
  }
}
| +| `simplified` | `standard` | {
  "ext": {
    "es-sii-doc-type": "F2"
  }
}
| +| `replacement` | `standard` | {
  "ext": {
    "es-sii-doc-type": "F3"
  }
}
| +| `simplified` | `corrective`
`credit-note`
`debit-note` | {
  "ext": {
    "es-sii-doc-type": "R5"
  }
}
| -**Output:** -- **Extensions:** `es-sii-doc-type:R5`
+
## Extensions ### Invoice Type @@ -337,6 +312,10 @@ Doesn't map directly to any field. Used internally to structure the breakdown da ## Validation Rules +Validation rules check each struct against a set of assertions and report any +failures with a unique code and message. +[Read more about validation](/overview/validation). + diff --git a/addons/es-tbai-v1.mdx b/addons/es-tbai-v1.mdx index bfe5b12..c316bde 100644 --- a/addons/es-tbai-v1.mdx +++ b/addons/es-tbai-v1.mdx @@ -102,6 +102,10 @@ data. ## Validation Rules +Validation rules check each struct against a set of assertions and report any +failures with a unique code and message. +[Read more about validation](/overview/validation). + diff --git a/addons/es-verifactu-v1.mdx b/addons/es-verifactu-v1.mdx index 9b82953..9e44c58 100644 --- a/addons/es-verifactu-v1.mdx +++ b/addons/es-verifactu-v1.mdx @@ -20,46 +20,21 @@ options. See the [Extensions](#extensions) section for possible values. ## Scenarios -### bill/invoice +Scenarios attach notes and extensions to a document when its filters match. +[Read more about scenarios](/overview/scenarios). - - -**Filters:** -- **Types:** `standard` - -**Output:** -- **Extensions:** `es-verifactu-doc-type:F1` - - - - -**Filters:** -- **Types:** `standard` -- **Tags:** `simplified` - -**Output:** -- **Extensions:** `es-verifactu-doc-type:F2` - - - - -**Filters:** -- **Types:** `standard` -- **Tags:** `replacement` - -**Output:** -- **Extensions:** `es-verifactu-doc-type:F3` - - - + + -**Filters:** -- **Types:** `corrective`, `credit-note`, `debit-note` -- **Tags:** `simplified` +| Tags | Type | Output | +| --- | --- | --- | +| - | `standard` | {
  "ext": {
    "es-verifactu-doc-type": "F1"
  }
}
| +| `simplified` | `standard` | {
  "ext": {
    "es-verifactu-doc-type": "F2"
  }
}
| +| `replacement` | `standard` | {
  "ext": {
    "es-verifactu-doc-type": "F3"
  }
}
| +| `simplified` | `corrective`
`credit-note`
`debit-note` | {
  "ext": {
    "es-verifactu-doc-type": "R5"
  }
}
| -**Output:** -- **Extensions:** `es-verifactu-doc-type:R5`
+
## Extensions ### Invoice Type Code @@ -315,6 +290,10 @@ extension will be set to `T`. ## Validation Rules +Validation rules check each struct against a set of assertions and report any +failures with a unique code and message. +[Read more about validation](/overview/validation). + diff --git a/addons/eu-en16931-v2017.mdx b/addons/eu-en16931-v2017.mdx index 8a9dff8..5ce4d2d 100644 --- a/addons/eu-en16931-v2017.mdx +++ b/addons/eu-en16931-v2017.mdx @@ -48,115 +48,35 @@ exemption note covering it. ## Scenarios -### bill/invoice +Scenarios attach notes and extensions to a document when its filters match. +[Read more about scenarios](/overview/scenarios). - - -**Filters:** -- **Types:** `standard` - -**Output:** -- **Extensions:** `untdid-document-type:380` - - - - -**Filters:** -- **Types:** `credit-note` - -**Output:** -- **Extensions:** `untdid-document-type:381` - - - - -**Filters:** -- **Types:** `debit-note` - -**Output:** -- **Extensions:** `untdid-document-type:383` - - - - -**Filters:** -- **Types:** `corrective` - -**Output:** -- **Extensions:** `untdid-document-type:384` - - - - -**Filters:** -- **Types:** `proforma` - -**Output:** -- **Extensions:** `untdid-document-type:325` - - - - -**Filters:** -- **Types:** `standard` -- **Tags:** `partial` - -**Output:** -- **Extensions:** `untdid-document-type:326` - - - - -**Filters:** -- **Types:** `standard` -- **Tags:** `self-billed` - -**Output:** -- **Extensions:** `untdid-document-type:389` - - - - -**Filters:** -- **Types:** `credit-note` -- **Tags:** `self-billed` - -**Output:** -- **Extensions:** `untdid-document-type:261` - - - - -**Filters:** -- **Types:** `standard` -- **Tags:** `prepayment` - -**Output:** -- **Extensions:** `untdid-document-type:386` - - - - -**Filters:** -- **Types:** `standard` -- **Tags:** `factoring` - -**Output:** -- **Extensions:** `untdid-document-type:393` - - - + + -**Filters:** -- **Types:** `credit-note` -- **Tags:** `factoring` +| Tags | Type | Output | +| --- | --- | --- | +| - | `standard` | {
  "ext": {
    "untdid-document-type": "380"
  }
}
| +| - | `credit-note` | {
  "ext": {
    "untdid-document-type": "381"
  }
}
| +| - | `debit-note` | {
  "ext": {
    "untdid-document-type": "383"
  }
}
| +| - | `corrective` | {
  "ext": {
    "untdid-document-type": "384"
  }
}
| +| - | `proforma` | {
  "ext": {
    "untdid-document-type": "325"
  }
}
| +| `partial` | `standard` | {
  "ext": {
    "untdid-document-type": "326"
  }
}
| +| `self-billed` | `standard` | {
  "ext": {
    "untdid-document-type": "389"
  }
}
| +| `self-billed` | `credit-note` | {
  "ext": {
    "untdid-document-type": "261"
  }
}
| +| `prepayment` | `standard` | {
  "ext": {
    "untdid-document-type": "386"
  }
}
| +| `factoring` | `standard` | {
  "ext": {
    "untdid-document-type": "393"
  }
}
| +| `factoring` | `credit-note` | {
  "ext": {
    "untdid-document-type": "396"
  }
}
| -**Output:** -- **Extensions:** `untdid-document-type:396`
+
## Validation Rules +Validation rules check each struct against a set of assertions and report any +failures with a unique code and message. +[Read more about validation](/overview/validation). + diff --git a/addons/fr-choruspro-v1.mdx b/addons/fr-choruspro-v1.mdx index b529cb9..5073261 100644 --- a/addons/fr-choruspro-v1.mdx +++ b/addons/fr-choruspro-v1.mdx @@ -70,6 +70,10 @@ replaced by GOBL during normalization. ## Validation Rules +Validation rules check each struct against a set of assertions and report any +failures with a unique code and message. +[Read more about validation](/overview/validation). + diff --git a/addons/fr-ctc-flow2-v1.mdx b/addons/fr-ctc-flow2-v1.mdx index a8f865b..fd9d75d 100644 --- a/addons/fr-ctc-flow2-v1.mdx +++ b/addons/fr-ctc-flow2-v1.mdx @@ -59,6 +59,10 @@ The numeric suffix indicates the payment type (1=deposit, 2=already paid, ## Validation Rules +Validation rules check each struct against a set of assertions and report any +failures with a unique code and message. +[Read more about validation](/overview/validation). + diff --git a/addons/gr-mydata-v1.mdx b/addons/gr-mydata-v1.mdx index b476f77..09a73e5 100644 --- a/addons/gr-mydata-v1.mdx +++ b/addons/gr-mydata-v1.mdx @@ -14,145 +14,31 @@ generate the myDATA XML reporting files. ## Scenarios -### bill/invoice +Scenarios attach notes and extensions to a document when its filters match. +[Read more about scenarios](/overview/scenarios). - - -**Filters:** -- **Types:** `standard` - -**Output:** -- **Extensions:** `gr-mydata-invoice-type:2.1` - - - - -**Filters:** -- **Types:** `standard` -- **Tags:** `goods` - -**Output:** -- **Extensions:** `gr-mydata-invoice-type:1.1` - - - - -**Filters:** -- **Types:** `standard` -- **Tags:** `goods`, `export` - -**Output:** -- **Extensions:** `gr-mydata-invoice-type:1.3` - - - - -**Filters:** -- **Types:** `standard` -- **Tags:** `goods`, `export`, `eu` - -**Output:** -- **Extensions:** `gr-mydata-invoice-type:1.2` - - - - -**Filters:** -- **Types:** `standard` -- **Tags:** `goods`, `self-billed` - -**Output:** -- **Extensions:** `gr-mydata-invoice-type:1.4` - - - - -**Filters:** -- **Types:** `standard` -- **Tags:** `services` - -**Output:** -- **Extensions:** `gr-mydata-invoice-type:2.1` - - - - -**Filters:** -- **Types:** `standard` -- **Tags:** `services`, `export` - -**Output:** -- **Extensions:** `gr-mydata-invoice-type:2.3` - - - - -**Filters:** -- **Types:** `standard` -- **Tags:** `services`, `export`, `eu` - -**Output:** -- **Extensions:** `gr-mydata-invoice-type:2.2` - - - - -**Filters:** -- **Types:** `credit-note` - -**Output:** -- **Extensions:** `gr-mydata-invoice-type:5.1` - - - - -**Filters:** -- **Types:** `standard` -- **Tags:** `simplified` - -**Output:** -- **Extensions:** `gr-mydata-invoice-type:11.3` - - - - -**Filters:** -- **Types:** `standard` -- **Tags:** `goods`, `simplified` - -**Output:** -- **Extensions:** `gr-mydata-invoice-type:11.1` - - - - -**Filters:** -- **Types:** `standard` -- **Tags:** `services`, `simplified` - -**Output:** -- **Extensions:** `gr-mydata-invoice-type:11.2` - - - - -**Filters:** -- **Types:** `credit-note` -- **Tags:** `simplified` - -**Output:** -- **Extensions:** `gr-mydata-invoice-type:11.4` - - - - -**Filters:** -- **Types:** `credit-note` -- **Tags:** `goods`, `simplified`, `self-billed` + + + +| Tags | Type | Output | +| --- | --- | --- | +| - | `standard` | {
  "ext": {
    "gr-mydata-invoice-type": "2.1"
  }
}
| +| `goods` | `standard` | {
  "ext": {
    "gr-mydata-invoice-type": "1.1"
  }
}
| +| `goods`
`export` | `standard` | {
  "ext": {
    "gr-mydata-invoice-type": "1.3"
  }
}
| +| `goods`
`export`
`eu` | `standard` | {
  "ext": {
    "gr-mydata-invoice-type": "1.2"
  }
}
| +| `goods`
`self-billed` | `standard` | {
  "ext": {
    "gr-mydata-invoice-type": "1.4"
  }
}
| +| `services` | `standard` | {
  "ext": {
    "gr-mydata-invoice-type": "2.1"
  }
}
| +| `services`
`export` | `standard` | {
  "ext": {
    "gr-mydata-invoice-type": "2.3"
  }
}
| +| `services`
`export`
`eu` | `standard` | {
  "ext": {
    "gr-mydata-invoice-type": "2.2"
  }
}
| +| - | `credit-note` | {
  "ext": {
    "gr-mydata-invoice-type": "5.1"
  }
}
| +| `simplified` | `standard` | {
  "ext": {
    "gr-mydata-invoice-type": "11.3"
  }
}
| +| `goods`
`simplified` | `standard` | {
  "ext": {
    "gr-mydata-invoice-type": "11.1"
  }
}
| +| `services`
`simplified` | `standard` | {
  "ext": {
    "gr-mydata-invoice-type": "11.2"
  }
}
| +| `simplified` | `credit-note` | {
  "ext": {
    "gr-mydata-invoice-type": "11.4"
  }
}
| +| `goods`
`simplified`
`self-billed` | `credit-note` | {
  "ext": {
    "gr-mydata-invoice-type": "11.5"
  }
}
| -**Output:** -- **Extensions:** `gr-mydata-invoice-type:11.5`
+
## Extensions ### VAT rate @@ -694,6 +580,10 @@ For example: ## Validation Rules +Validation rules check each struct against a set of assertions and report any +failures with a unique code and message. +[Read more about validation](/overview/validation). + diff --git a/addons/it-sdi-v1.mdx b/addons/it-sdi-v1.mdx index 7499855..748c98a 100644 --- a/addons/it-sdi-v1.mdx +++ b/addons/it-sdi-v1.mdx @@ -6,242 +6,41 @@ Key: `it-sdi-v1` ## Scenarios -### bill/invoice +Scenarios attach notes and extensions to a document when its filters match. +[Read more about scenarios](/overview/scenarios). - - -**Filters:** -- *(none)* - -**Output:** -- **Extensions:** `it-sdi-format:FPR12` - - - - -**Filters:** -- **Tags:** `b2g` - -**Output:** -- **Extensions:** `it-sdi-format:FPA12` - - - - -**Filters:** -- **Types:** `standard` - -**Output:** -- **Extensions:** `it-sdi-document-type:TD01` - - - - -**Filters:** -- **Types:** `standard` -- **Tags:** `partial` - -**Output:** -- **Extensions:** `it-sdi-document-type:TD02` - - - - -**Filters:** -- **Types:** `credit-note` - -**Output:** -- **Extensions:** `it-sdi-document-type:TD04` - - - - -**Filters:** -- **Types:** `debit-note` - -**Output:** -- **Extensions:** `it-sdi-document-type:TD05` - - - - -**Filters:** -- **Types:** `standard` -- **Tags:** `freelance` - -**Output:** -- **Extensions:** `it-sdi-document-type:TD06` - - - - -**Filters:** -- **Types:** `standard` -- **Tags:** `partial`, `freelance` - -**Output:** -- **Extensions:** `it-sdi-document-type:TD03` - - - - -**Filters:** -- **Types:** `standard` -- **Tags:** `simplified` - -**Output:** -- **Extensions:** `it-sdi-document-type:TD07` - - - - -**Filters:** -- **Types:** `credit-note` -- **Tags:** `simplified` - -**Output:** -- **Extensions:** `it-sdi-document-type:TD08` - - - - -**Filters:** -- **Types:** `debit-note` -- **Tags:** `simplified` - -**Output:** -- **Extensions:** `it-sdi-document-type:TD09` - - - - -**Filters:** -- **Types:** `standard` -- **Tags:** `self-billed` - -**Output:** -- **Extensions:** `it-sdi-document-type:TD27` - - - - -**Filters:** -- **Types:** `standard` -- **Tags:** `self-billed`, `reverse-charge` - -**Output:** -- **Extensions:** `it-sdi-document-type:TD16` - - - - -**Filters:** -- **Types:** `standard` -- **Tags:** `self-billed`, `import` - -**Output:** -- **Extensions:** `it-sdi-document-type:TD17` - - - - -**Filters:** -- **Types:** `standard` -- **Tags:** `self-billed`, `import`, `goods-eu` - -**Output:** -- **Extensions:** `it-sdi-document-type:TD18` - - - - -**Filters:** -- **Types:** `standard` -- **Tags:** `self-billed`, `import`, `goods` - -**Output:** -- **Extensions:** `it-sdi-document-type:TD19` - - - - -**Filters:** -- **Types:** `standard` -- **Tags:** `self-billed`, `regularization` - -**Output:** -- **Extensions:** `it-sdi-document-type:TD20` - - - - -**Filters:** -- **Types:** `standard` -- **Tags:** `self-billed`, `ceiling-exceeded` - -**Output:** -- **Extensions:** `it-sdi-document-type:TD21` - - - - -**Filters:** -- **Types:** `standard` -- **Tags:** `self-billed`, `goods-extracted` - -**Output:** -- **Extensions:** `it-sdi-document-type:TD22` - - - - -**Filters:** -- **Types:** `standard` -- **Tags:** `self-billed`, `goods-with-tax` - -**Output:** -- **Extensions:** `it-sdi-document-type:TD23` - - - - -**Filters:** -- **Types:** `standard` -- **Tags:** `deferred` - -**Output:** -- **Extensions:** `it-sdi-document-type:TD24` - - - - -**Filters:** -- **Types:** `standard` -- **Tags:** `deferred`, `third-period` - -**Output:** -- **Extensions:** `it-sdi-document-type:TD25` - - - - -**Filters:** -- **Types:** `standard` -- **Tags:** `depreciable-assets` - -**Output:** -- **Extensions:** `it-sdi-document-type:TD26` - - - - -**Filters:** -- **Types:** `standard` -- **Tags:** `self-billed`, `san-marino-paper` - -**Output:** -- **Extensions:** `it-sdi-document-type:TD28` - + + + +| Tags | Type | Output | +| --- | --- | --- | +| - | - | {
  "ext": {
    "it-sdi-format": "FPR12"
  }
}
| +| `b2g` | - | {
  "ext": {
    "it-sdi-format": "FPA12"
  }
}
| +| - | `standard` | {
  "ext": {
    "it-sdi-document-type": "TD01"
  }
}
| +| `partial` | `standard` | {
  "ext": {
    "it-sdi-document-type": "TD02"
  }
}
| +| - | `credit-note` | {
  "ext": {
    "it-sdi-document-type": "TD04"
  }
}
| +| - | `debit-note` | {
  "ext": {
    "it-sdi-document-type": "TD05"
  }
}
| +| `freelance` | `standard` | {
  "ext": {
    "it-sdi-document-type": "TD06"
  }
}
| +| `partial`
`freelance` | `standard` | {
  "ext": {
    "it-sdi-document-type": "TD03"
  }
}
| +| `simplified` | `standard` | {
  "ext": {
    "it-sdi-document-type": "TD07"
  }
}
| +| `simplified` | `credit-note` | {
  "ext": {
    "it-sdi-document-type": "TD08"
  }
}
| +| `simplified` | `debit-note` | {
  "ext": {
    "it-sdi-document-type": "TD09"
  }
}
| +| `self-billed` | `standard` | {
  "ext": {
    "it-sdi-document-type": "TD27"
  }
}
| +| `self-billed`
`reverse-charge` | `standard` | {
  "ext": {
    "it-sdi-document-type": "TD16"
  }
}
| +| `self-billed`
`import` | `standard` | {
  "ext": {
    "it-sdi-document-type": "TD17"
  }
}
| +| `self-billed`
`import`
`goods-eu` | `standard` | {
  "ext": {
    "it-sdi-document-type": "TD18"
  }
}
| +| `self-billed`
`import`
`goods` | `standard` | {
  "ext": {
    "it-sdi-document-type": "TD19"
  }
}
| +| `self-billed`
`regularization` | `standard` | {
  "ext": {
    "it-sdi-document-type": "TD20"
  }
}
| +| `self-billed`
`ceiling-exceeded` | `standard` | {
  "ext": {
    "it-sdi-document-type": "TD21"
  }
}
| +| `self-billed`
`goods-extracted` | `standard` | {
  "ext": {
    "it-sdi-document-type": "TD22"
  }
}
| +| `self-billed`
`goods-with-tax` | `standard` | {
  "ext": {
    "it-sdi-document-type": "TD23"
  }
}
| +| `deferred` | `standard` | {
  "ext": {
    "it-sdi-document-type": "TD24"
  }
}
| +| `deferred`
`third-period` | `standard` | {
  "ext": {
    "it-sdi-document-type": "TD25"
  }
}
| +| `depreciable-assets` | `standard` | {
  "ext": {
    "it-sdi-document-type": "TD26"
  }
}
| +| `self-billed`
`san-marino-paper` | `standard` | {
  "ext": {
    "it-sdi-document-type": "TD28"
  }
}
| + +
+
## Extensions ### SDI Transmission Format @@ -456,6 +255,10 @@ used to determine the correct schema to use when validating the document. ## Validation Rules +Validation rules check each struct against a set of assertions and report any +failures with a unique code and message. +[Read more about validation](/overview/validation). + diff --git a/addons/it-ticket-v1.mdx b/addons/it-ticket-v1.mdx index 5f4f1df..dfa1e01 100644 --- a/addons/it-ticket-v1.mdx +++ b/addons/it-ticket-v1.mdx @@ -68,6 +68,10 @@ Reference code provided by the AdE to be able to identify the specific line in c ## Validation Rules +Validation rules check each struct against a set of assertions and report any +failures with a unique code and message. +[Read more about validation](/overview/validation). + diff --git a/addons/mx-cfdi-v4.mdx b/addons/mx-cfdi-v4.mdx index 6f5db94..116b207 100644 --- a/addons/mx-cfdi-v4.mdx +++ b/addons/mx-cfdi-v4.mdx @@ -6,45 +6,21 @@ Key: `mx-cfdi-v4` ## Scenarios -### bill/invoice +Scenarios attach notes and extensions to a document when its filters match. +[Read more about scenarios](/overview/scenarios). - - -**Filters:** -- **Types:** `standard` - -**Output:** -- **Extensions:** `mx-cfdi-doc-type:I` - - - - -**Filters:** -- **Types:** `credit-note` - -**Output:** -- **Extensions:** `mx-cfdi-rel-type:01`, `mx-cfdi-doc-type:E` - - - - -**Filters:** -- **Types:** `standard`, `credit-note` -- **Filter:** *(custom)* - -**Output:** -- **Extensions:** `mx-cfdi-payment-method:PUE` - - - + + -**Filters:** -- **Types:** `standard`, `credit-note` -- **Filter:** *(custom)* +| Tags | Type | Output | +| --- | --- | --- | +| - | `standard` | {
  "ext": {
    "mx-cfdi-doc-type": "I"
  }
}
| +| - | `credit-note` | {
  "ext": {
    "mx-cfdi-doc-type": "E",
    "mx-cfdi-rel-type": "01"
  }
}
| +| [custom](https://github.com/invopop/gobl/blob/v0.401.0/addons/mx/cfdi/scenarios.go#L32) | `standard`
`credit-note` | {
  "ext": {
    "mx-cfdi-payment-method": "PUE"
  }
}
| +| [custom](https://github.com/invopop/gobl/blob/v0.401.0/addons/mx/cfdi/scenarios.go#L45) | `standard`
`credit-note` | {
  "ext": {
    "mx-cfdi-payment-method": "PPD"
  }
}
| -**Output:** -- **Extensions:** `mx-cfdi-payment-method:PPD`
+
## Extensions ### Document Type @@ -252,6 +228,10 @@ Pattern: `\d{4}` ## Validation Rules +Validation rules check each struct against a set of assertions and report any +failures with a unique code and message. +[Read more about validation](/overview/validation). + diff --git a/addons/pl-favat-v3.mdx b/addons/pl-favat-v3.mdx index 09fe7b0..fe97373 100644 --- a/addons/pl-favat-v3.mdx +++ b/addons/pl-favat-v3.mdx @@ -21,75 +21,24 @@ Stamp keys from the previous invoice that need to be referenced: ## Scenarios -### bill/invoice +Scenarios attach notes and extensions to a document when its filters match. +[Read more about scenarios](/overview/scenarios). - - -**Filters:** -- **Types:** `standard` - -**Output:** -- **Extensions:** `pl-favat-invoice-type:VAT` - - - - -**Filters:** -- **Types:** `standard` -- **Tags:** `partial` - -**Output:** -- **Extensions:** `pl-favat-invoice-type:ZAL` - - - - -**Filters:** -- **Types:** `standard` -- **Tags:** `settlement` - -**Output:** -- **Extensions:** `pl-favat-invoice-type:ROZ` - - - - -**Filters:** -- **Types:** `standard` -- **Tags:** `simplified` - -**Output:** -- **Extensions:** `pl-favat-invoice-type:UPR` - - - - -**Filters:** -- **Types:** `credit-note` - -**Output:** -- **Extensions:** `pl-favat-invoice-type:KOR` - - - - -**Filters:** -- **Types:** `credit-note` -- **Tags:** `partial` - -**Output:** -- **Extensions:** `pl-favat-invoice-type:KOR_ZAL` - - - - -**Filters:** -- **Types:** `credit-note` -- **Tags:** `settlement` + + + +| Tags | Type | Output | +| --- | --- | --- | +| - | `standard` | {
  "ext": {
    "pl-favat-invoice-type": "VAT"
  }
}
| +| `partial` | `standard` | {
  "ext": {
    "pl-favat-invoice-type": "ZAL"
  }
}
| +| `settlement` | `standard` | {
  "ext": {
    "pl-favat-invoice-type": "ROZ"
  }
}
| +| `simplified` | `standard` | {
  "ext": {
    "pl-favat-invoice-type": "UPR"
  }
}
| +| - | `credit-note` | {
  "ext": {
    "pl-favat-invoice-type": "KOR"
  }
}
| +| `partial` | `credit-note` | {
  "ext": {
    "pl-favat-invoice-type": "KOR_ZAL"
  }
}
| +| `settlement` | `credit-note` | {
  "ext": {
    "pl-favat-invoice-type": "KOR_ROZ"
  }
}
| -**Output:** -- **Extensions:** `pl-favat-invoice-type:KOR_ROZ`
+
## Extensions ### Tax categories for KSeF @@ -751,6 +700,10 @@ Example of a credit note effective on correction date: ## Validation Rules +Validation rules check each struct against a set of assertions and report any +failures with a unique code and message. +[Read more about validation](/overview/validation). + diff --git a/addons/pt-saft-v1.mdx b/addons/pt-saft-v1.mdx index 040d8b1..5bdfd90 100644 --- a/addons/pt-saft-v1.mdx +++ b/addons/pt-saft-v1.mdx @@ -32,63 +32,23 @@ The types of invoices that can be created with a preceding definition: ## Scenarios -### bill/invoice +Scenarios attach notes and extensions to a document when its filters match. +[Read more about scenarios](/overview/scenarios). - - -**Filters:** -- **Types:** `standard` - -**Output:** -- **Extensions:** `pt-saft-invoice-type:FT` - - - - -**Filters:** -- **Types:** `standard` -- **Tags:** `simplified` - -**Output:** -- **Extensions:** `pt-saft-invoice-type:FS` - - - - -**Filters:** -- **Types:** `standard` -- **Filter:** *(custom)* - -**Output:** -- **Extensions:** `pt-saft-invoice-type:FR` - - - - -**Filters:** -- **Types:** `debit-note` - -**Output:** -- **Extensions:** `pt-saft-invoice-type:ND` - - - - -**Filters:** -- **Types:** `credit-note` - -**Output:** -- **Extensions:** `pt-saft-invoice-type:NC` - - - + + -**Filters:** -- **Types:** `proforma` +| Tags | Type | Output | +| --- | --- | --- | +| - | `standard` | {
  "ext": {
    "pt-saft-invoice-type": "FT"
  }
}
| +| `simplified` | `standard` | {
  "ext": {
    "pt-saft-invoice-type": "FS"
  }
}
| +| [custom](https://github.com/invopop/gobl/blob/v0.401.0/addons/pt/saft/scenarios.go#L32) | `standard` | {
  "ext": {
    "pt-saft-invoice-type": "FR"
  }
}
| +| - | `debit-note` | {
  "ext": {
    "pt-saft-invoice-type": "ND"
  }
}
| +| - | `credit-note` | {
  "ext": {
    "pt-saft-invoice-type": "NC"
  }
}
| +| - | `proforma` | {
  "ext": {
    "pt-saft-work-type": "PF"
  }
}
| -**Output:** -- **Extensions:** `pt-saft-work-type:PF`
+
## Extensions ### Invoice Type @@ -597,6 +557,10 @@ Example: ## Validation Rules +Validation rules check each struct against a set of assertions and report any +failures with a unique code and message. +[Read more about validation](/overview/validation). + diff --git a/cmd/generate/addons.go b/cmd/generate/addons.go index 70d6bbf..0a92e2c 100644 --- a/cmd/generate/addons.go +++ b/cmd/generate/addons.go @@ -29,7 +29,7 @@ func newAddonGenerator(a *tax.AddonDef) *addonGenerator { "joinKeys": joinKeys, "codeMap": codeMap, "extMap": extMap, - "scenarioTitle": scenarioTitle, + "scenarioTable": scenarioTable, "codeMessage": codeMessage, "testList": testList, "fieldCell": fieldCell, @@ -97,52 +97,17 @@ func (g *addonGenerator) scenarios() error { ## Scenarios - {{- range .Scenarios }} - - ### {{ .Schema }} - - {{- range .List }} - - - - **Filters:** - - {{- if .Types }} - - **Types:** {{ joinKeys .Types }} - {{- end }} - {{- if .Tags }} - - **Tags:** {{ joinKeys .Tags }} - {{- end }} - {{- if .ExtKey }} - - **Extension Key:** ~{{ .ExtKey }}~ - {{- end }} - {{- if .ExtCode }} - - **Extension Code:** ~{{ .ExtCode }}~ - {{- end }} - {{- if .Filter }} - - **Filter:** *(custom)* - {{- end }} - {{- if not .Types }}{{ if not .Tags }}{{ if not .ExtKey }}{{ if not .Filter }} - - *(none)* - {{- end }}{{ end }}{{ end }}{{ end }} + Scenarios attach notes and extensions to a document when its filters match. + [Read more about scenarios](/overview/scenarios). - **Output:** + + {{- range .Scenarios }} + - {{- if .Note }} - - **Note:** {{ .Note.Text }}{{ if .Note.Key }} ({{ .Note.Key }}){{ end }} - {{- end }} - {{- if .Codes }} - - **Codes:** {{ codeMap .Codes }} - {{- end }} - {{- if .Ext }} - - **Extensions:** {{ extMap .Ext }} - {{- end }} - {{- if not .Note }}{{ if not .Codes }}{{ if not .Ext }} - - *(none)* - {{- end }}{{ end }}{{ end }} + {{ scenarioTable . }} {{- end }} - {{- end }} + `)) } diff --git a/cmd/generate/generator.go b/cmd/generate/generator.go index b428bb5..ce4a75f 100644 --- a/cmd/generate/generator.go +++ b/cmd/generate/generator.go @@ -130,6 +130,10 @@ func (g *generator) validationRules(sections []RuleSection) error { ## Validation Rules + Validation rules check each struct against a set of assertions and report any + failures with a unique code and message. + [Read more about validation](/overview/validation). + {{- range .}} {{- $sec := .}} diff --git a/cmd/generate/regimes.go b/cmd/generate/regimes.go index 278160a..8e5d791 100644 --- a/cmd/generate/regimes.go +++ b/cmd/generate/regimes.go @@ -49,7 +49,7 @@ func newRegimeGenerator(r *tax.RegimeDef) *regimeGenerator { "joinKeys": joinKeys, "codeMap": codeMap, "extMap": extMap, - "scenarioTitle": scenarioTitle, + "scenarioTable": scenarioTable, "codeMessage": codeMessage, "testList": testList, "fieldCell": fieldCell, @@ -368,52 +368,17 @@ func (g *regimeGenerator) scenarios() error { ## Scenarios - {{- range .Scenarios }} - - ### {{ .Schema }} - - {{- range .List }} - - - - **Filters:** - - {{- if .Types }} - - **Types:** {{ joinKeys .Types }} - {{- end }} - {{- if .Tags }} - - **Tags:** {{ joinKeys .Tags }} - {{- end }} - {{- if .ExtKey }} - - **Extension Key:** ~{{ .ExtKey }}~ - {{- end }} - {{- if .ExtCode }} - - **Extension Code:** ~{{ .ExtCode }}~ - {{- end }} - {{- if .Filter }} - - **Filter:** *(custom)* - {{- end }} - {{- if not .Types }}{{ if not .Tags }}{{ if not .ExtKey }}{{ if not .Filter }} - - *(none)* - {{- end }}{{ end }}{{ end }}{{ end }} + Scenarios attach notes and extensions to a document when its filters match. + [Read more about scenarios](/overview/scenarios). - **Output:** + + {{- range .Scenarios }} + - {{- if .Note }} - - **Note:** {{ .Note.Text }}{{ if .Note.Key }} ({{ .Note.Key }}){{ end }} - {{- end }} - {{- if .Codes }} - - **Codes:** {{ codeMap .Codes }} - {{- end }} - {{- if .Ext }} - - **Extensions:** {{ extMap .Ext }} - {{- end }} - {{- if not .Note }}{{ if not .Codes }}{{ if not .Ext }} - - *(none)* - {{- end }}{{ end }}{{ end }} + {{ scenarioTable . }} {{- end }} - {{- end }} + `)) } diff --git a/cmd/generate/utils.go b/cmd/generate/utils.go index 8c0552f..c5e9e34 100644 --- a/cmd/generate/utils.go +++ b/cmd/generate/utils.go @@ -1,8 +1,11 @@ package main import ( + "encoding/json" "fmt" "html" + "reflect" + "runtime" "strings" "github.com/invopop/gobl/cbc" @@ -91,29 +94,181 @@ func testList(parts []string, calculated bool) string { return buf.String() } -// scenarioTitle builds a concise title for a scenario accordion. -func scenarioTitle(sc *tax.Scenario) string { - if sc.Name != nil { - if n := sc.Name.String(); n != "" { - return n - } +// customFilterLabel produces the marker shown in the Tags column for a scenario +// that uses a custom Filter function. It prefers the scenario's own Desc/Name +// (i18n strings the GOBL data model exposes for documentation) and falls back +// to a "(custom)" link pointing at the function's source on GitHub so an +// author who forgot to fill in Desc still gives readers somewhere to look. +func customFilterLabel(sc *tax.Scenario) string { + if desc := sc.Desc.String(); desc != "" { + return fmt.Sprintf("*%s*", desc) } - var parts []string - for _, t := range sc.Types { - parts = append(parts, t.String()) + if name := sc.Name.String(); name != "" { + return fmt.Sprintf("*%s*", name) + } + if src := customFilterSource(sc.Filter); src != "" { + return fmt.Sprintf("[custom](%s)", src) + } + return "custom" +} + +// customFilterSource returns a GitHub permalink (pinned at the gobl version +// this generator is built against) to the source location of the supplied +// custom filter function, or "" if the source can't be resolved. +func customFilterSource(filter func(doc any) bool) string { + if filter == nil { + return "" + } + pc := reflect.ValueOf(filter).Pointer() + fn := runtime.FuncForPC(pc) + if fn == nil { + return "" + } + file, line := fn.FileLine(pc) + const marker = "github.com/invopop/gobl@" + idx := strings.Index(file, marker) + if idx < 0 { + return "" + } + rest := file[idx+len(marker):] + parts := strings.SplitN(rest, "/", 2) + if len(parts) != 2 { + return "" } + return fmt.Sprintf("https://github.com/invopop/gobl/blob/%s/%s#L%d", parts[0], parts[1], line) +} + +// scenarioTagsCell renders the Tags column of a scenario row, including any +// ExtKey/ExtCode filter or custom-filter marker so no filter information is +// silently dropped. +func scenarioTagsCell(sc *tax.Scenario) string { + var parts []string for _, t := range sc.Tags { - parts = append(parts, "#"+t.String()) + parts = append(parts, fmt.Sprintf("`%s`", t.String())) } if sc.ExtKey != "" { label := sc.ExtKey.String() if sc.ExtCode != "" { label += "=" + sc.ExtCode.String() } - parts = append(parts, label) + parts = append(parts, fmt.Sprintf("`%s`", label)) + } + if sc.Filter != nil { + parts = append(parts, customFilterLabel(sc)) } if len(parts) == 0 { - return "Scenario" + return "-" + } + return strings.Join(parts, "
") +} + +func scenarioTypesCell(sc *tax.Scenario) string { + if len(sc.Types) == 0 { + return "-" + } + var s []string + for _, t := range sc.Types { + s = append(s, fmt.Sprintf("`%s`", t.String())) + } + return strings.Join(s, "
") +} + +func scenarioCategoriesCell(sc *tax.Scenario) string { + if len(sc.Categories) == 0 { + return "-" + } + var s []string + for _, c := range sc.Categories { + s = append(s, fmt.Sprintf("`%s`", c.String())) + } + return strings.Join(s, "
") +} + +// scenarioOutputJSON is used to marshal scenario outputs in a stable field +// order (note → codes → ext) regardless of which fields are present. +type scenarioOutputJSON struct { + Note *tax.Note `json:"note,omitempty"` + Codes cbc.CodeMap `json:"codes,omitempty"` + Ext tax.Extensions `json:"ext,omitempty"` +} + +// scenarioOutputCell renders the Output column as an indented JSON snippet +// showing the scenario outputs in the shape GOBL emits when applying them to a +// document. Newlines are rendered as
and leading spaces as   so the +// content fits on a single source line in a markdown table cell while +// preserving indentation. Braces and pipes are escaped so MDX and the table +// parser don't choke. +func scenarioOutputCell(sc *tax.Scenario) string { + if sc.Note == nil && len(sc.Codes) == 0 && len(sc.Ext) == 0 { + return "-" + } + out := scenarioOutputJSON{Note: sc.Note, Codes: sc.Codes, Ext: sc.Ext} + raw, _ := json.MarshalIndent(out, "", " ") + lines := strings.Split(string(raw), "\n") + for i, line := range lines { + n := 0 + for n < len(line) && line[n] == ' ' { + n++ + } + content := line[n:] + content = strings.ReplaceAll(content, "&", "&") + content = strings.ReplaceAll(content, "<", "<") + content = strings.ReplaceAll(content, ">", ">") + content = strings.ReplaceAll(content, "{", "{") + content = strings.ReplaceAll(content, "}", "}") + lines[i] = strings.Repeat(" ", n) + content + } + body := strings.Join(lines, "
") + body = strings.ReplaceAll(body, "|", "\\|") + return `` + body + "" +} + +// scenarioTable renders a complete markdown table for a scenario set, omitting +// any filter columns whose values are empty across all rows. +func scenarioTable(set *tax.ScenarioSet) string { + if set == nil || len(set.List) == 0 { + return "" + } + var showTags, showTypes, showCategories bool + for _, sc := range set.List { + if len(sc.Tags) > 0 || sc.ExtKey != "" || sc.Filter != nil { + showTags = true + } + if len(sc.Types) > 0 { + showTypes = true + } + if len(sc.Categories) > 0 { + showCategories = true + } + } + var headers []string + if showTags { + headers = append(headers, "Tags") + } + if showTypes { + headers = append(headers, "Type") + } + if showCategories { + headers = append(headers, "Categories") + } + headers = append(headers, "Output") + + var b strings.Builder + b.WriteString("| " + strings.Join(headers, " | ") + " |\n") + b.WriteString("|" + strings.Repeat(" --- |", len(headers)) + "\n") + for _, sc := range set.List { + var cells []string + if showTags { + cells = append(cells, scenarioTagsCell(sc)) + } + if showTypes { + cells = append(cells, scenarioTypesCell(sc)) + } + if showCategories { + cells = append(cells, scenarioCategoriesCell(sc)) + } + cells = append(cells, scenarioOutputCell(sc)) + b.WriteString("| " + strings.Join(cells, " | ") + " |\n") } - return strings.Join(parts, ", ") + return b.String() } diff --git a/docs.json b/docs.json index aa4b518..45e5fc7 100644 --- a/docs.json +++ b/docs.json @@ -47,6 +47,7 @@ "overview/canonicalization", "overview/support", "overview/inside", + "overview/scenarios", "overview/validation" ] }, diff --git a/overview/scenarios.mdx b/overview/scenarios.mdx new file mode 100644 index 0000000..255d981 --- /dev/null +++ b/overview/scenarios.mdx @@ -0,0 +1,56 @@ +--- +title: "Scenarios" +--- + +Scenarios are how GOBL applies tax-regime and addon-specific output to a document at build time without you having to write it yourself. Each [tax regime](/regimes/overview) and [addon](/addons/overview) declares a list of scenarios; whenever a document is built, GOBL evaluates them and merges any matching outputs into the document. + +## Anatomy of a scenario + +A scenario has two parts: + +- **Filters** decide whether the scenario applies to a given document. +- **Outputs** describe what to attach to the document when the filters match. + +Both regimes and addons can define scenarios. Scenarios are organised per schema (for example `bill/invoice`), so a regime can hold one set of scenarios for invoices and a different set for orders or payments. + +## Filters + +A scenario matches when **every** filter it defines is satisfied by the document. An empty filter is treated as "any value is fine", so a scenario with no filters matches every document of the configured schema. + +| Filter | Matches against | +| --- | --- | +| **Type** | The document's [`type`](/draft-0/bill/invoice#type) (e.g. `standard`, `corrective`, `credit-note`). | +| **Tags** | Tags applied to the document via [`$tags`](/draft-0/bill/invoice#tags) (e.g. `reverse-charge`, `simplified`, `self-billed`). | +| **Categories** | The set of [tax categories](/draft-0/tax/category_def) present across the document's line, charge, and discount taxes (e.g. `VAT`, `IGIC`). | +| **Extension key / code** | A specific [tax extension](/draft-0/tax/extensions) being present, optionally with a specific value. | +| **Custom filter** | A regime- or addon-defined function for cases the basic filters can't express. | + +The **Categories** filter is what allows a country with multiple tax categories — like Spain (mainland VAT and Canary IGIC) — to express *"this note applies to reverse-charge invoices, but only when the lines are using VAT"*. The same scenario can then be paired with another that scopes the note to IGIC. + +Note that category matching looks at the document's lines, charges, and discounts: even though scenario outputs always land at the document level, the *applicability* is determined by what's used inside the document. + +## Outputs + +When a scenario matches, GOBL applies its outputs to the document: + +| Output | Where it lands | +| --- | --- | +| **Note** | Appended to the document's [`tax.notes`](/draft-0/bill/invoice#tax) array. The note carries its own `cat` (category) and `key`, and notes with the same category-and-key pair are deduplicated. | +| **Extensions** | Merged into the document's [`tax.ext`](/draft-0/bill/invoice#tax) map. Useful for addons that need to attach a code identifying the document under a reporting standard. | +| **Codes** | Made available through the scenario summary for downstream conversion processes; not auto-merged onto the document itself. | + +Outputs always land on the document, never on individual lines. That keeps the document model simple: a scenario filter may inspect line-level details to decide whether to fire, but the resulting note or extension belongs to the invoice as a whole. + +## How matching works + +When you build a document: + +1. GOBL collects every scenario defined by the document's regime and any enabled addons for the document's schema. +2. Each scenario is evaluated against the document. All filters must match for the scenario to apply. +3. For every matching scenario, the outputs are merged into the document. Notes are deduplicated by `cat` + `key`; extensions overwrite any earlier value for the same key. + +This means multiple scenarios can fire on the same document — a Spanish reverse-charge invoice using both VAT and IGIC will receive both the VAT-scoped note and the IGIC-scoped one. + +## Where to see them + +Each [regime](/regimes/overview) and [addon](/addons/overview) page has a **Scenarios** section listing every scenario it defines, broken down by schema. The columns shown depend on which filters that regime or addon actually uses — empty filter columns are hidden so the table stays focused on the values that matter for that country or standard. diff --git a/regimes/ae.mdx b/regimes/ae.mdx index f0ee51b..df7fcef 100644 --- a/regimes/ae.mdx +++ b/regimes/ae.mdx @@ -47,28 +47,26 @@ The types of invoices that can be created with a preceding definition: ## Scenarios -### bill/invoice +Scenarios attach notes and extensions to a document when its filters match. +[Read more about scenarios](/overview/scenarios). - - -**Filters:** -- **Tags:** `reverse-charge` - -**Output:** -- **Note:** Reverse Charge (reverse-charge) - - - + + -**Filters:** -- **Tags:** `simplified` +| Tags | Categories | Output | +| --- | --- | --- | +| `reverse-charge` | `VAT` | {
  "note": {
    "cat": "VAT",
    "key": "reverse-charge",
    "text": "Reverse Charge"
  }
}
| +| `simplified` | `VAT` | {
  "note": {
    "cat": "VAT",
    "key": "simplified",
    "text": "Simplified Tax Invoice"
  }
}
| -**Output:** -- **Note:** Simplified Tax Invoice (simplified)
+
## Validation Rules +Validation rules check each struct against a set of assertions and report any +failures with a unique code and message. +[Read more about validation](/overview/validation). + diff --git a/regimes/ar.mdx b/regimes/ar.mdx index e21ef56..7843728 100644 --- a/regimes/ar.mdx +++ b/regimes/ar.mdx @@ -72,6 +72,10 @@ The types of invoices that can be created with a preceding definition: ## Validation Rules +Validation rules check each struct against a set of assertions and report any +failures with a unique code and message. +[Read more about validation](/overview/validation). + diff --git a/regimes/at.mdx b/regimes/at.mdx index 6acd832..78863dd 100644 --- a/regimes/at.mdx +++ b/regimes/at.mdx @@ -45,19 +45,25 @@ The types of invoices that can be created with a preceding definition: ## Scenarios -### bill/invoice +Scenarios attach notes and extensions to a document when its filters match. +[Read more about scenarios](/overview/scenarios). - + + -**Filters:** -- **Tags:** `reverse-charge` +| Tags | Categories | Output | +| --- | --- | --- | +| `reverse-charge` | `VAT` | {
  "note": {
    "cat": "VAT",
    "key": "reverse-charge",
    "text": "Reverse charge: Customer to account for VAT to the relevant tax authority."
  }
}
| -**Output:** -- **Note:** Reverse charge: Customer to account for VAT to the relevant tax authority. (reverse-charge)
+
## Validation Rules +Validation rules check each struct against a set of assertions and report any +failures with a unique code and message. +[Read more about validation](/overview/validation). + diff --git a/regimes/be.mdx b/regimes/be.mdx index f993e77..362eaba 100644 --- a/regimes/be.mdx +++ b/regimes/be.mdx @@ -49,19 +49,25 @@ The types of invoices that can be created with a preceding definition: ## Scenarios -### bill/invoice +Scenarios attach notes and extensions to a document when its filters match. +[Read more about scenarios](/overview/scenarios). - + + -**Filters:** -- **Tags:** `reverse-charge` +| Tags | Categories | Output | +| --- | --- | --- | +| `reverse-charge` | `VAT` | {
  "note": {
    "cat": "VAT",
    "key": "reverse-charge",
    "text": "Reverse charge: Customer to account for VAT to the relevant tax authority."
  }
}
| -**Output:** -- **Note:** Reverse charge: Customer to account for VAT to the relevant tax authority. (reverse-charge)
+
## Validation Rules +Validation rules check each struct against a set of assertions and report any +failures with a unique code and message. +[Read more about validation](/overview/validation). + diff --git a/regimes/br.mdx b/regimes/br.mdx index 12a790f..334c28c 100644 --- a/regimes/br.mdx +++ b/regimes/br.mdx @@ -69,6 +69,10 @@ Pattern: `^\d{7}$` ## Validation Rules +Validation rules check each struct against a set of assertions and report any +failures with a unique code and message. +[Read more about validation](/overview/validation). + diff --git a/regimes/ch.mdx b/regimes/ch.mdx index d4416c1..6fbdad6 100644 --- a/regimes/ch.mdx +++ b/regimes/ch.mdx @@ -51,19 +51,25 @@ The types of invoices that can be created with a preceding definition: ## Scenarios -### bill/invoice +Scenarios attach notes and extensions to a document when its filters match. +[Read more about scenarios](/overview/scenarios). - + + -**Filters:** -- **Tags:** `reverse-charge` +| Tags | Categories | Output | +| --- | --- | --- | +| `reverse-charge` | `VAT` | {
  "note": {
    "cat": "VAT",
    "key": "reverse-charge",
    "text": "Reverse charge: Customer to account for VAT to the relevant tax authority."
  }
}
| -**Output:** -- **Note:** Reverse charge: Customer to account for VAT to the relevant tax authority. (reverse-charge)
+
## Validation Rules +Validation rules check each struct against a set of assertions and report any +failures with a unique code and message. +[Read more about validation](/overview/validation). + diff --git a/regimes/co.mdx b/regimes/co.mdx index c3e7c96..8527faa 100644 --- a/regimes/co.mdx +++ b/regimes/co.mdx @@ -62,6 +62,10 @@ The types of invoices that can be created with a preceding definition: ## Validation Rules +Validation rules check each struct against a set of assertions and report any +failures with a unique code and message. +[Read more about validation](/overview/validation). + diff --git a/regimes/de.mdx b/regimes/de.mdx index b477cbe..681ea28 100644 --- a/regimes/de.mdx +++ b/regimes/de.mdx @@ -49,19 +49,25 @@ The types of invoices that can be created with a preceding definition: ## Scenarios -### bill/invoice +Scenarios attach notes and extensions to a document when its filters match. +[Read more about scenarios](/overview/scenarios). - + + -**Filters:** -- **Tags:** `reverse-charge` +| Tags | Categories | Output | +| --- | --- | --- | +| `reverse-charge` | `VAT` | {
  "note": {
    "cat": "VAT",
    "key": "reverse-charge",
    "text": "Reverse Charge / Umkehr der Steuerschuld."
  }
}
| -**Output:** -- **Note:** Reverse Charge / Umkehr der Steuerschuld. (reverse-charge)
+
## Validation Rules +Validation rules check each struct against a set of assertions and report any +failures with a unique code and message. +[Read more about validation](/overview/validation). + diff --git a/regimes/dk.mdx b/regimes/dk.mdx index e0648bd..d685b42 100644 --- a/regimes/dk.mdx +++ b/regimes/dk.mdx @@ -47,6 +47,10 @@ The types of invoices that can be created with a preceding definition: ## Validation Rules +Validation rules check each struct against a set of assertions and report any +failures with a unique code and message. +[Read more about validation](/overview/validation). + diff --git a/regimes/el.mdx b/regimes/el.mdx index 6e6b34d..b0c6e0a 100644 --- a/regimes/el.mdx +++ b/regimes/el.mdx @@ -61,13 +61,15 @@ Stamp keys from the previous invoice that need to be referenced: ## Scenarios -### bill/invoice +Scenarios attach notes and extensions to a document when its filters match. +[Read more about scenarios](/overview/scenarios). - + + -**Filters:** -- **Tags:** `reverse-charge` +| Tags | Categories | Output | +| --- | --- | --- | +| `reverse-charge` | `VAT` | {
  "note": {
    "cat": "VAT",
    "key": "reverse-charge",
    "text": "Reverse Charge / Αντίστροφη φόρτιση"
  }
}
| -**Output:** -- **Note:** Reverse Charge / Αντίστροφη φόρτιση (reverse-charge) -
\ No newline at end of file +
+
\ No newline at end of file diff --git a/regimes/es.mdx b/regimes/es.mdx index a7946b1..17fda76 100644 --- a/regimes/es.mdx +++ b/regimes/es.mdx @@ -86,136 +86,38 @@ The types of invoices that can be created with a preceding definition: ## Scenarios -### bill/invoice +Scenarios attach notes and extensions to a document when its filters match. +[Read more about scenarios](/overview/scenarios). - - -**Filters:** -- **Tags:** `reverse-charge` - -**Output:** -- **Note:** Reverse Charge / Inversión del sujeto pasivo. (reverse-charge) - - - - -**Filters:** -- **Tags:** `reverse-charge` - -**Output:** -- **Note:** Reverse Charge / Inversión del sujeto pasivo. (reverse-charge) - - - - -**Filters:** -- **Tags:** `simplified-scheme` - -**Output:** -- **Note:** Factura expedida por contribuyente en régimen simplificado. (simplified-scheme) - - - - -**Filters:** -- **Tags:** `self-billed` - -**Output:** -- **Note:** Facturación por el destinatario. (self-billed) - - - - -**Filters:** -- **Tags:** `travel-agency` - -**Output:** -- **Note:** Régimen especial de las agencias de viajes. (travel-agency) - - - - -**Filters:** -- **Tags:** `travel-agency` - -**Output:** -- **Note:** Régimen especial de las agencias de viajes. (travel-agency) - - - - -**Filters:** -- **Tags:** `second-hand-goods` - -**Output:** -- **Note:** Régimen especial de los bienes usados. (second-hand-goods) - - - - -**Filters:** -- **Tags:** `second-hand-goods` - -**Output:** -- **Note:** Régimen especial de los bienes usados. (second-hand-goods) - - - - -**Filters:** -- **Tags:** `art` - -**Output:** -- **Note:** Régimen especial de los objetos de arte. (art) - - - - -**Filters:** -- **Tags:** `art` - -**Output:** -- **Note:** Régimen especial de los objetos de arte. (art) - - - - -**Filters:** -- **Tags:** `antiques` - -**Output:** -- **Note:** Régimen especial de las antigüedades y objetos de colección. (antiques) - - - - -**Filters:** -- **Tags:** `antiques` - -**Output:** -- **Note:** Régimen especial de las antigüedades y objetos de colección. (antiques) - - - - -**Filters:** -- **Tags:** `cash-basis` - -**Output:** -- **Note:** Régimen especial del criterio de caja. (cash-basis) - - - - -**Filters:** -- **Tags:** `cash-basis` - -**Output:** -- **Note:** Régimen especial del criterio de caja. (cash-basis) - + + + +| Tags | Categories | Output | +| --- | --- | --- | +| `reverse-charge` | `VAT` | {
  "note": {
    "cat": "VAT",
    "key": "reverse-charge",
    "text": "Reverse Charge / Inversión del sujeto pasivo."
  }
}
| +| `reverse-charge` | `IGIC` | {
  "note": {
    "cat": "IGIC",
    "key": "reverse-charge",
    "text": "Reverse Charge / Inversión del sujeto pasivo."
  }
}
| +| `simplified-scheme` | `VAT` | {
  "note": {
    "cat": "VAT",
    "key": "simplified-scheme",
    "text": "Factura expedida por contribuyente en régimen simplificado."
  }
}
| +| `self-billed` | - | {
  "note": {
    "key": "self-billed",
    "text": "Facturación por el destinatario."
  }
}
| +| `travel-agency` | `VAT` | {
  "note": {
    "cat": "VAT",
    "key": "travel-agency",
    "text": "Régimen especial de las agencias de viajes."
  }
}
| +| `travel-agency` | `IGIC` | {
  "note": {
    "cat": "IGIC",
    "key": "travel-agency",
    "text": "Régimen especial de las agencias de viajes."
  }
}
| +| `second-hand-goods` | `VAT` | {
  "note": {
    "cat": "VAT",
    "key": "second-hand-goods",
    "text": "Régimen especial de los bienes usados."
  }
}
| +| `second-hand-goods` | `IGIC` | {
  "note": {
    "cat": "IGIC",
    "key": "second-hand-goods",
    "text": "Régimen especial de los bienes usados."
  }
}
| +| `art` | `VAT` | {
  "note": {
    "cat": "VAT",
    "key": "art",
    "text": "Régimen especial de los objetos de arte."
  }
}
| +| `art` | `IGIC` | {
  "note": {
    "cat": "IGIC",
    "key": "art",
    "text": "Régimen especial de los objetos de arte."
  }
}
| +| `antiques` | `VAT` | {
  "note": {
    "cat": "VAT",
    "key": "antiques",
    "text": "Régimen especial de las antigüedades y objetos de colección."
  }
}
| +| `antiques` | `IGIC` | {
  "note": {
    "cat": "IGIC",
    "key": "antiques",
    "text": "Régimen especial de las antigüedades y objetos de colección."
  }
}
| +| `cash-basis` | `VAT` | {
  "note": {
    "cat": "VAT",
    "key": "cash-basis",
    "text": "Régimen especial del criterio de caja."
  }
}
| +| `cash-basis` | `IGIC` | {
  "note": {
    "cat": "IGIC",
    "key": "cash-basis",
    "text": "Régimen especial del criterio de caja."
  }
}
| + +
+
## Validation Rules +Validation rules check each struct against a set of assertions and report any +failures with a unique code and message. +[Read more about validation](/overview/validation). + diff --git a/regimes/fr.mdx b/regimes/fr.mdx index 5c97875..45020a1 100644 --- a/regimes/fr.mdx +++ b/regimes/fr.mdx @@ -56,19 +56,25 @@ The types of invoices that can be created with a preceding definition: ## Scenarios -### bill/invoice +Scenarios attach notes and extensions to a document when its filters match. +[Read more about scenarios](/overview/scenarios). - + + -**Filters:** -- **Tags:** `reverse-charge` +| Tags | Categories | Output | +| --- | --- | --- | +| `reverse-charge` | `VAT` | {
  "note": {
    "cat": "VAT",
    "key": "reverse-charge",
    "text": "Reverse Charge / Autoliquidation de la TVA - Article 283-1 du CGI. Le client est redevable de la TVA."
  }
}
| -**Output:** -- **Note:** Reverse Charge / Autoliquidation de la TVA - Article 283-1 du CGI. Le client est redevable de la TVA. (reverse-charge)
+
## Validation Rules +Validation rules check each struct against a set of assertions and report any +failures with a unique code and message. +[Read more about validation](/overview/validation). + diff --git a/regimes/gb.mdx b/regimes/gb.mdx index b124bc2..846ebad 100644 --- a/regimes/gb.mdx +++ b/regimes/gb.mdx @@ -50,19 +50,25 @@ The types of invoices that can be created with a preceding definition: ## Scenarios -### bill/invoice +Scenarios attach notes and extensions to a document when its filters match. +[Read more about scenarios](/overview/scenarios). - + + -**Filters:** -- **Tags:** `reverse-charge` +| Tags | Categories | Output | +| --- | --- | --- | +| `reverse-charge` | `VAT` | {
  "note": {
    "cat": "VAT",
    "key": "reverse-charge",
    "text": "Reverse charge: Customer to account for VAT to the relevant tax authority."
  }
}
| -**Output:** -- **Note:** Reverse charge: Customer to account for VAT to the relevant tax authority. (reverse-charge)
+
## Validation Rules +Validation rules check each struct against a set of assertions and report any +failures with a unique code and message. +[Read more about validation](/overview/validation). + diff --git a/regimes/ie.mdx b/regimes/ie.mdx index 584234c..86155e2 100644 --- a/regimes/ie.mdx +++ b/regimes/ie.mdx @@ -40,19 +40,25 @@ PEPPOL is supported for B2G transactions. ## Scenarios -### bill/invoice +Scenarios attach notes and extensions to a document when its filters match. +[Read more about scenarios](/overview/scenarios). - + + -**Filters:** -- **Tags:** `reverse-charge` +| Tags | Categories | Output | +| --- | --- | --- | +| `reverse-charge` | `VAT` | {
  "note": {
    "cat": "VAT",
    "key": "reverse-charge",
    "text": "Reverse charge: Customer to account for VAT to the relevant tax authority."
  }
}
| -**Output:** -- **Note:** Reverse charge: Customer to account for VAT to the relevant tax authority. (reverse-charge)
+
## Validation Rules +Validation rules check each struct against a set of assertions and report any +failures with a unique code and message. +[Read more about validation](/overview/validation). + diff --git a/regimes/in.mdx b/regimes/in.mdx index ecccddc..3b26a45 100644 --- a/regimes/in.mdx +++ b/regimes/in.mdx @@ -52,28 +52,26 @@ The types of invoices that can be created with a preceding definition: ## Scenarios -### bill/invoice +Scenarios attach notes and extensions to a document when its filters match. +[Read more about scenarios](/overview/scenarios). - - -**Filters:** -- **Tags:** `reverse-charge` - -**Output:** -- **Note:** Reverse Charge (reverse-charge) - - - + + -**Filters:** -- **Tags:** `simplified` +| Tags | Output | +| --- | --- | +| `reverse-charge` | {
  "note": {
    "key": "reverse-charge",
    "text": "Reverse Charge"
  }
}
| +| `simplified` | {
  "note": {
    "key": "simplified",
    "text": "Simplified Tax Invoice"
  }
}
| -**Output:** -- **Note:** Simplified Tax Invoice (simplified)
+
## Validation Rules +Validation rules check each struct against a set of assertions and report any +failures with a unique code and message. +[Read more about validation](/overview/validation). + diff --git a/regimes/it.mdx b/regimes/it.mdx index 09575fc..57f736a 100644 --- a/regimes/it.mdx +++ b/regimes/it.mdx @@ -64,19 +64,25 @@ The types of invoices that can be created with a preceding definition: ## Scenarios -### bill/invoice +Scenarios attach notes and extensions to a document when its filters match. +[Read more about scenarios](/overview/scenarios). - + + -**Filters:** -- **Tags:** `reverse-charge` +| Tags | Categories | Output | +| --- | --- | --- | +| `reverse-charge` | `VAT` | {
  "note": {
    "cat": "VAT",
    "key": "reverse-charge",
    "text": "Reverse Charge / Inversione del soggetto passivo"
  }
}
| -**Output:** -- **Note:** Reverse Charge / Inversione del soggetto passivo (reverse-charge)
+
## Validation Rules +Validation rules check each struct against a set of assertions and report any +failures with a unique code and message. +[Read more about validation](/overview/validation). + diff --git a/regimes/mx.mdx b/regimes/mx.mdx index 7df6c6b..6153204 100644 --- a/regimes/mx.mdx +++ b/regimes/mx.mdx @@ -65,6 +65,10 @@ Stamp keys from the previous invoice that need to be referenced: ## Validation Rules +Validation rules check each struct against a set of assertions and report any +failures with a unique code and message. +[Read more about validation](/overview/validation). + diff --git a/regimes/nl.mdx b/regimes/nl.mdx index dba9340..0932314 100644 --- a/regimes/nl.mdx +++ b/regimes/nl.mdx @@ -51,19 +51,25 @@ The types of invoices that can be created with a preceding definition: ## Scenarios -### bill/invoice +Scenarios attach notes and extensions to a document when its filters match. +[Read more about scenarios](/overview/scenarios). - + + -**Filters:** -- **Tags:** `reverse-charge` +| Tags | Categories | Output | +| --- | --- | --- | +| `reverse-charge` | `VAT` | {
  "note": {
    "cat": "VAT",
    "key": "reverse-charge",
    "text": "Reverse charge: Customer to account for VAT to the relevant tax authority."
  }
}
| -**Output:** -- **Note:** Reverse charge: Customer to account for VAT to the relevant tax authority. (reverse-charge)
+
## Validation Rules +Validation rules check each struct against a set of assertions and report any +failures with a unique code and message. +[Read more about validation](/overview/validation). + diff --git a/regimes/pl.mdx b/regimes/pl.mdx index 7b7d06d..52eed81 100644 --- a/regimes/pl.mdx +++ b/regimes/pl.mdx @@ -41,6 +41,10 @@ E-invoicing via PEPPOL is used for cross-border and B2G transactions. ## Validation Rules +Validation rules check each struct against a set of assertions and report any +failures with a unique code and message. +[Read more about validation](/overview/validation). + diff --git a/regimes/pt.mdx b/regimes/pt.mdx index 938ee5b..d3e53c0 100644 --- a/regimes/pt.mdx +++ b/regimes/pt.mdx @@ -357,6 +357,10 @@ For example: ## Validation Rules +Validation rules check each struct against a set of assertions and report any +failures with a unique code and message. +[Read more about validation](/overview/validation). + diff --git a/regimes/se.mdx b/regimes/se.mdx index a0d872f..09994d4 100644 --- a/regimes/se.mdx +++ b/regimes/se.mdx @@ -47,19 +47,25 @@ for transactions up to 4000 SEK. ## Scenarios -### bill/invoice +Scenarios attach notes and extensions to a document when its filters match. +[Read more about scenarios](/overview/scenarios). - + + -**Filters:** -- **Tags:** `reverse-charge` +| Tags | Categories | Output | +| --- | --- | --- | +| `reverse-charge` | `VAT` | {
  "note": {
    "cat": "VAT",
    "key": "reverse-charge",
    "text": "Reverse charge: Customer to account for VAT to the relevant tax authority."
  }
}
| -**Output:** -- **Note:** Reverse charge: Customer to account for VAT to the relevant tax authority. (reverse-charge)
+
## Validation Rules +Validation rules check each struct against a set of assertions and report any +failures with a unique code and message. +[Read more about validation](/overview/validation). + diff --git a/regimes/sg.mdx b/regimes/sg.mdx index 05cf645..f409a26 100644 --- a/regimes/sg.mdx +++ b/regimes/sg.mdx @@ -50,6 +50,10 @@ The types of invoices that can be created with a preceding definition: ## Validation Rules +Validation rules check each struct against a set of assertions and report any +failures with a unique code and message. +[Read more about validation](/overview/validation). + diff --git a/style.css b/style.css index 41f116d..0686694 100644 --- a/style.css +++ b/style.css @@ -6,6 +6,11 @@ margin: 0 0 0.4em -0.5em; } +.prose table tr td code.code-block { + display: block; +} + + /* repurpose bullets in test lists to indicate required vs conditional */ .prose table tr td ul.gobl-test li { padding-left: 1em !important;