Request a demo

How to automatically reconcile multiple orders with a total invoice

Often, several purchase orders are linked to one invoice. It’s important to make sure that all the ordered amounts match the invoiced amounts. We'll show you how it's done. 

If an invoice encompasses different orders, you can automatically compare the amounts with a workflow. 

Here's how: When archiving an invoice, you enter all the associated order numbers in a keyword field. When you automatically query this "order keyword" as part of the workflow, it goes through the list of order numbers and adds the amount associated with each order to add up to a global variable. A global variable is a type of placeholder in a workflow in which values are stored, which can be used again and again. Done!

Here's how the workflow works in detail - your admin team can easily set it up

1.  Create a decimal global variable "TotalPOAmount" with the value "0.00". 

2.  For the loop, you first set a numeric global variable "CurrentPO" to "0". 

3.  Determine how many orders there are to determine the end of the loop. You can use an arithmetic expression to determine the number of orders from the keyword field, such as Count (DW_POKeyword). Assign this number to a numeric global variable called "TotalPOs" so that you can later verify that the end has been reached. In our example, "PO" stands for "Purchase order." 

1-3_Daten zuweisen_EN


4.  Start the loop and determine the order number of the current run. Use an arithmetic expression to determine the order number from the keyword field. Use the CurrentPO global variable to return the appropriate value of this pass, such as DW_POKeyword(GV_CurrentPO). Assign this value to a global text variable "CurrentPONumber". 

4_Daten zuweisen_EN

4_1_Daten zuweisen_EN


5.  Determine the amount of the corresponding purchase order by querying the document with the global variable "CurrentPONumber." Assign the amount of a decimal global variable to CurrentPOAmount. You can query the document in the file cabinet by searching for the "document number" with the global variable "CurrentPONumber" (e.g. DW_DOCUMENT_NUMBER = 'GV_CurrentPONumber') and transferring the "(net) amount" to "CurrentPOAmount." 

5_Daten zuweisen_EN

5_1_Daten zuweisen_EN


6.  Using an arithmetic expression, you add the amount to the global variable "TotalPOAmount," for example: GV_TotalPOAmount + GV_CurrentPOAmount. 

6_Daten zuweisen_EN


7.  Add 1 to the global variable "CurrentPO" by using an arithmetic workflow expression, for example, GV_CurrentPO + 1. 

7_Daten zuweisen_EN


8.  Add a condition to see if you need to repeat steps 3-5 by comparing the number of TotalPOs to the number of CurrentPOs. To do this, use an arithmetic workflow expression, e.g.  GV_TotalPOs = GV_CurrentPO. 

8_Daten zuweisen_EN


9.  If the condition is not met, go back to step 3. 
10.  If the condition is met, compare the " TotalPOAmount" with the total amount of the current invoice. To do this, you use an arithmetic workflow expression, such as GV_TotalPOAmount = DW_TotalAmount. 

9_Daten zuweisen_EN

As global variables, you will need: 

  • TotalPOAmount (decimal) 
  • CurrentPO (numeric) 
  • TotalPOs (numeric) 
  • CurrentPONumber (text) 
  • CurrentPOAmount (decimal) 

 Another article you might find helpful: How to easily avoid duplicate invoices.