> For the complete documentation index, see [llms.txt](https://docs.docbits.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.docbits.com/administration-and-setup/workflow/cards-overview/and/compare-with-purchase-order/any-all-charges.md).

# Any / All Charges

<figure><img src="https://578966019-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FT2n2w4uDCJvv7CJ5zrdk%2Fuploads%2Fgit-blob-37163222a1aec38421999d062e686a00c456c5ab%2Fworkflow_card_condition_compare_charges_to_po_v2.png?alt=media" alt="Workflow card Compare with Purchase Order: Any/All charges are Operator tolerances compared with purchase order and tolerances of Tolerance Amount Tolerance Type, version 2" width="634"><figcaption><p>Version 2</p></figcaption></figure>

<figure><img src="https://578966019-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FT2n2w4uDCJvv7CJ5zrdk%2Fuploads%2Fgit-blob-8335a7d10bd814cb912fe44785c500c2ec16d50b%2Fworkflow_card_condition_compare_charges_to_po_v3.png?alt=media" alt="Workflow card Compare with Purchase Order: Any/All charges must be Operator tolerances of Tolerance Amount Tolerance Type compared to the matched purchase order&#x27;s charge, with a setting for charges that exist on only one side, version 3" width="634"><figcaption><p>Version 3</p></figcaption></figure>

<figure><img src="https://578966019-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FT2n2w4uDCJvv7CJ5zrdk%2Fuploads%2Fgit-blob-d784433c725bb5c2752c2e4f617896b4ed335a5a%2Fworkflow_card_condition_compare_charges_to_po_v4.png?alt=media" alt="Workflow card Compare with Purchase Order: Any/All charges must be Operator tolerances of Tolerance Amount Tolerance Type compared to the matched Purchase Order&#x27;s charge; a charge of 0.00 is compared as well. If a charge exists on only one side (document or PO), Missing Data Behaviour, version 4" width="634"><figcaption><p>Version 4</p></figcaption></figure>

## **Purpose:**

This workflow card compares the additional charges on a document against the additional charges on the matched purchase order, within a defined tolerance. It answers one question: do the document and the purchase order agree about the additional costs? Every charge that purchase order matching paired up is compared, so no field name has to be named on the card.

This card is distinct from **Compare Total Charges**, which compares one named document field against a single charge identified by a Charge ID. Use this card when every paired charge on the document should be checked at once.

Purchase order matching has to run before this card. If the document has no matched purchase order the card stops the workflow and reports missing data.

## **Components of the Card:**

1. **Any / All:**
   * **Description**: How the individual charge comparisons are combined into the single result of the card.
   * **Options**:
     * **Any**: at least one charge has to satisfy the comparison.
     * **All**: every charge has to satisfy the comparison.
2. **Operator:**
   * **Description**: How each document charge amount is compared against the purchase order amount for the same charge.
   * **Options**:
     * **Within**: the two amounts have to agree, allowing for the tolerance.
     * **Outside**: the two amounts have to differ by more than the tolerance.
3. **Tolerance Amount:**
   * **Description**: The variance allowed between the document charge and the purchase order charge.
4. **Tolerance Type:**
   * **Description**: How the tolerance amount is interpreted.
   * **Options**:
     * **Percentage**: a percentage of the purchase order charge.
     * **Value**: a fixed amount.
5. **Missing Data Behaviour (versions 3 and 4):**
   * **Description**: What to do when a charge exists on only one side, document or purchase order, so there is no counterpart to compare it against. The option sits at the end of the sentence.
   * **Options**:
     * **treat as a mismatch**: the workflow stops. This is the default.
     * **ignore it and treat as a match**: the workflow continues as if the charge agreed.

## **How the card works:**

The card runs through the following steps.

1. **It requires a matched purchase order.** With no matched purchase order the card stops immediately and reports missing data.
2. **It reads the tolerance** from the **Tolerance Amount** and **Tolerance Type** set on the card.
3. **Versions 3 and 4 sort every matched purchase order line** into one of four situations: charges on both sides, no charges on either side, charges on the document only, or charges on the purchase order only. Version 3 asks only whether each side carries a charge above 0.00. Version 4 looks at each charge pair and counts 0.00 as a value; only a charge with no amount at all counts as missing. See **Version Differences** below. A line that cannot be resolved against the purchase order data on the document is a data error and the card stops.
4. **A charge on one side only settles the whole card.** As soon as one matched line carries charges on one side and none on the other, **Missing Data Behaviour** decides the result and no charge is compared at all, including the charges on lines that are properly paired. The operator and the tolerance are not consulted.
5. **If no line has charges on either side**, both sides agree there are no additional costs. The **Outside** operator is not satisfied by that, because nothing differs beyond the tolerance, so the workflow stops. Any other operator treats the agreement as satisfied and the workflow continues. **Missing Data Behaviour** has no effect here.
6. **Otherwise each charge is compared**, document amount against purchase order amount, using the operator and the tolerance. A charge amount that is not a number stops the card with missing data.
7. **The comparisons are pooled and combined once.** Every charge on every matched line contributes to one set of results, which the **Any / All** setting reduces to the single result of the card. The pooling is document-wide, not per line, so **Any** means any charge anywhere on the document. If the combined result is true the workflow continues, otherwise it stops with an unmet condition.

Three consequences are worth knowing before configuring the card.

* **Within with a tolerance of 0 requires exact equality.** The two amounts have to match to the cent.
* **A charge on one side only overrides everything else.** Because step 4 runs before any comparison, **ignore it and treat as a match** also skips the amount check on every properly paired charge in the document. Keep **treat as a mismatch** if the amounts have to be verified.
* **treat as a mismatch stops the workflow as an error, not as an unmet condition.** Despite the wording, the card reports missing data, which the workflow log and the card test show in red rather than in the orange used for an unmet condition. The workflow stops either way.

## **Setup and Configuration:**

Add the card as an And condition after purchase order matching. Choose whether every charge or any charge has to satisfy the comparison, pick the **Within** or **Outside** operator, and enter the tolerance amount and type. On versions 3 and 4, choose what should happen when charges appear on one side only.

To try a configuration without waiting for a document, open the card menu in the Workflow Builder, choose **Test Card**, pick a document and select **Test on Document**. The card log lists every charge that was compared with both amounts, the operator and the tolerance used, and it also records which **Missing Data Behaviour** value resolved the result when a charge was present on one side only.

## **Example Scenario:**

An order confirmation carries a freight charge of 100.00 and the matched purchase order line carries the same freight charge of 100.00. With **All**, the **Within** operator and a tolerance of 0 as a value, the amounts are equal, the card passes and the workflow continues.

With 120.00 on the order confirmation against 100.00 on the purchase order, the same configuration is not satisfied and the workflow stops with an unmet condition.

If neither the order confirmation nor the purchase order carries any charge, the **Within** operator treats that as agreement and the workflow continues, while the **Outside** operator stops it.

If the order confirmation carries a freight charge and the purchase order carries none, the operator no longer applies. With **treat as a mismatch** the workflow stops so somebody can check why the charge is on one side only.

If the order confirmation shows the freight charge as 0.00 while the purchase order carries 204.00, version 4 compares the two amounts and the workflow stops with an unmet condition. Version 3 would read the 0.00 as "no charge on the document" and leave the result to **Missing Data Behaviour**.

## **Version Differences:**

Version 4 is what new cards use. Versions 2 and 3 remain supported on existing workflows.

### Version 4 compared with version 3

The two versions have the same settings and the same steps. They differ only in how a charge of 0.00 is treated:

* **Version 3 treats 0.00 as no charge.** A document charge of 0.00 paired with a purchase order charge of 204.00 counts as "the purchase order has charges, the document has none", so **Missing Data Behaviour** decides and the amounts are never compared. With **ignore it and treat as a match** the workflow continues, although the amounts differ.
* **Version 4 compares 0.00 as an amount.** The same pair is compared like any other: 0.00 against 204.00 is not within the tolerance, so the workflow stops with an unmet condition. A pair with 0.00 on both sides is compared too and agrees.
* **A charge with no amount is still missing in version 4.** When one side of a pair has no amount at all, for example a charge the purchase order does not carry, **Missing Data Behaviour** decides, as in version 3.

To get this behaviour on an existing workflow, replace the version 3 card with a version 4 card and set the same values.

### Version 2

Version 2 also compares per charge and combines the results document-wide with the **Any / All** setting, but it has no case classification, which changes what happens whenever charges are not present on both sides:

* Version 2 has no **Missing Data Behaviour** option. Its sentence ends after the tolerance type.
* Version 2 does not sort the matched lines, so it does not recognise a charge that exists on one side only. It compares the amount that is there against the 0.00 held for the missing side, and the operator decides: **Within** is not satisfied and the workflow stops, **Outside** is satisfied and the workflow continues. The card log shows the comparison against 0.00.
* With no charges on either side there is nothing for version 2 to compare, so it reports missing data instead of treating the absence on both sides as agreement.

## **Conclusion:**

The "Any / All Charges" card automates the check that the additional costs invoiced or confirmed match the additional costs ordered. Because absence of charges on both sides counts as agreement on versions 3 and 4, documents without additional costs pass without manual intervention, while charges that appear on only one side are held back for review unless that is deliberately allowed.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.docbits.com/administration-and-setup/workflow/cards-overview/and/compare-with-purchase-order/any-all-charges.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
