> ## Documentation Index
> Fetch the complete documentation index at: https://docs.abbyy.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Validation rules for commercial invoices

> Preset validation rules for the Commercial Invoice Document Definition: amount checks, currency handling, and database lookups for vendors and consignees.

A Commercial Invoice Document Definition contains preset automatic verification rules for checking commercial invoices. Any of these rules can be enabled and disabled from the **Rules** tab in the **Document Definition Settings** dialog. You can also set up custom [rules](/flexi-capture/templates/rules).

<Note>
  The rules below are applied in the same order in which they are listed.
</Note>

| Rule                                                      | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| --------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Suggest weight UoM**                                    | Suggests values for empty **GrossWeightUoM**, **NetWeightUoM**, and **Weight UoM** fields if the corresponding **Weight** and **NetWeight** fields are filled in. Values are suggested based on non-empty **NetWeightUoM** and **GrossWeightUoM** fields.                                                                                                                                                                                                                                                |
| **Check Total Weight Script**                             | Checks the value of the **Weight** field.<br /><br />If the **GrossWeight** column is not empty and if the **Weight** field is either empty or does not correspond to the sum of the values in the **GrossWeight** column, the rule suggests filling in the **Weight** field with the sum of all **GrossWeight** fields.<br /><br />If the **Weight** field is not empty and the **GrossWeight** column is, the value of the **Weight** field is suggested for any line from the **GrossWeight** column. |
| **Total amount check**                                    | Checks that the sum of all line item costs and all additional charges is equal to the total invoiced amount as calculated by adding the sum of the values in the **TotalPrice** column (**LineItems** group) to the value of the **Amount** field in the **AdditionalCosts** group.                                                                                                                                                                                                                      |
| **Separate currency from amount in Total field**          | Splits the currency symbol from the amount in the **Total** field if a currency symbol was merged with the amount during recognition. The currency value is copied over to the **Currency** field if the latter is not filled in.                                                                                                                                                                                                                                                                        |
| **Check item amount**                                     | Checks that for every entry in the **LineItems** group, the product of **Quantity** and **Unit Price** corresponds to the value of **Total Price**. If one of the values is missing, suggests a value for it based on the two other values (product of **Quantity** and **Unit Price** suggested for **Total Price**, etc.).                                                                                                                                                                             |
| **Separate currency from amount in LI\_UnitPrice field**  | Splits the currency symbol from the amount in the **Unit Price** field if a currency symbol was merged with the amount during recognition. The currency value is copied over to the **Currency** field in the **LineItems** group if the latter is not filled in.                                                                                                                                                                                                                                        |
| **Separate currency from amount in LI\_Total Price**      | Splits the currency symbol from the amount in the **Total Price** field if a currency symbol was merged with the amount during recognition. The currency value is copied over to the **Currency** field in the **LineItems** group if the latter is not filled in.                                                                                                                                                                                                                                       |
| **Hide LineItems currency if Total is empty**             | Deletes the value of the **Currency** field in the **LineItems** group if the primary **Total** field is not filled in.                                                                                                                                                                                                                                                                                                                                                                                  |
| **Hide currency if Total is empty**                       | Deletes the value of the **Currency** field in the entire document if the primary **Total** field is not filled in.                                                                                                                                                                                                                                                                                                                                                                                      |
| **Check LineItems currency value**                        | Checks that the value in the **Currency** field in the **LineItems** group corresponds to an ISO code. If the value in the **Currency** field is valid, copies it over to the **Currency** field in the **LineItems** group. Otherwise, suggests ISO-compliant replacements for each **Currency** field in the **LineItems** group.                                                                                                                                                                      |
| **Vendor must be found in database**                      | Checks whether the vendor detected on the invoice is present in the [Variants](/flexi-capture/ir-ci-columns-vendors) data set. This rule must be enabled when working with databases.                                                                                                                                                                                                                                                                                                                    |
| **Vendor details must be added to database**              | Checks whether a new vendor that was detected on the image and added to the data set was also added to the database. This rule must be enabled when working with databases.                                                                                                                                                                                                                                                                                                                              |
| **Fill Value from INCOValues**                            | Standardizes the detected value for **INCO Term** to the following format: "acronym: expansion". For example: FOB: Free On Board, FAS: Free Alongside Ship.                                                                                                                                                                                                                                                                                                                                              |
| **Detect national currency**                              | Detects the national currency based on the country of the consignee.                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| **Copy currency from LineItems**                          | If the value of the primary **Currency** field is either empty or invalid, copies over a valid currency value from the **LineItems** group, if one is detected.                                                                                                                                                                                                                                                                                                                                          |
| **Copy currency from AdditionalCosts**                    | If the value of the primary **Currency** field is either empty or invalid, copies over a valid currency value from the **AdditionalCosts** group, if one is detected.                                                                                                                                                                                                                                                                                                                                    |
| **Check currency value**                                  | Checks the value of the **Currency** field if **Total** is filled in. If **Currency** contains an invalid value, suggests replacement values in ISO code format.                                                                                                                                                                                                                                                                                                                                         |
| **Information about Consignee must be added to database** | Checks whether a new business unit of the consignee detected on the image and added to the data set was also added to the database. This rule must be enabled when working with databases.                                                                                                                                                                                                                                                                                                               |
| **Consignee must be found in database**                   | Checks whether the consignee business unit was detected in the data set. This rule must be enabled when working with databases.                                                                                                                                                                                                                                                                                                                                                                          |
| **Hide currency if Total is empty2**                      | Deletes the value of the **Currency** field in the **AdditionalCosts** group if the primary **Total** field is not filled in.                                                                                                                                                                                                                                                                                                                                                                            |
| **Check Additional Costs Currency**                       | Checks the value of the **Currency** field in the **AdditionalCosts** group if the **Total** field is filled in. If **Currency** contains an invalid value, suggests replacements in ISO code format.                                                                                                                                                                                                                                                                                                    |
| **Separate money from amount in AdditionalCosts**         | Splits the currency symbol from the amount in the **Amount** field in the **AdditionalCosts** group if a currency symbol was merged with the amount during recognition. The currency is copied over to the **Currency** field in the **AdditionalCosts** group if the latter is not filled in.                                                                                                                                                                                                           |

## Rules and fields disabled by default

The **Suggest weight UoM** and **Check Total Weight Script** rules are disabled by default, along with these weight fields: **GrossWeightUoM**, **NetWeightUoM**, **Weight UoM**, and **GrossWeight**.

Enable the rules from the **Rules** tab. To enable a field:

<Steps>
  <Step title="Select the field">
    Select the appropriate field from the **Fields** list.
  </Step>

  <Step title="Open field properties">
    In the context menu, select **Properties...**.
  </Step>

  <Step title="Enable the field">
    In the dialog box that opens, navigate to the **General** tab and select the following options: **Export field value**, **Show on verification**.
  </Step>
</Steps>
