Invoice Line Calculation
This workflow is included in the Financial Accounts and Invoicing module.
Description
This workflow has no description.
Properties
This workflow has the following properties.
| Property | Value |
|---|---|
| Name | Invoice Line Calculation |
| Code | workflows_invoiceLineCalculation |
| Type | Workflow |
| Context | Module |
| Enabled | Yes |
Trigger
The system triggers this workflow when items of the design below are edited. Where attributes are listed, an edit to anything else is ignored.
| Property | Value |
|---|---|
| Workflow type | Event workflow |
| Applies to | Account Invoice Lines |
| Events | Edit |
| Collections | Live |
| Attributes listened for | attributes_accountInvoiceLinesSubTotal (Sub Total)attributes_accountInvoiceLinesTaxRate (Tax Rate) |
Actions
This workflow runs 5 actions, in the order shown in this simplified diagram. Every action's full settings are in the configuration below.
Configuration
The full configuration of this workflow, including every action's parameters.
Show configuration (156 lines)
{
"trigger": {
"dodiCode": "designInterfaces_accountInvoiceLines",
"collections": [
"Live"
],
"events": [
"Edit"
],
"attributesListeningFor": [
"attributes_accountInvoiceLinesSubTotal",
"attributes_accountInvoiceLinesTaxRate"
]
},
"actions": [
{
"actionId": "5fbe8c1938709266c44cfac4",
"designCode": "designs_workflowRelationAction",
"parameters": [
{
"attribute": {
"attributeCode": "attributes_workflowRelationActionsAqsPath",
"value": "root.attributes_accountInvoiceLinesTaxRate"
}
}
],
"variables": [],
"actions": []
},
{
"actionId": "5fbe8c7538709266c44cfac5",
"designCode": "designs_workflowEditItemAction",
"parameters": [
{
"attributeCode": "attributes_accountInvoiceLinesTax",
"attributeType": "Number",
"value": {
"script": "return taxAmount;"
}
},
{
"attributeCode": "attributes_accountInvoiceLinesTotal",
"attributeType": "Number",
"value": {
"script": "return taxAmount + subtotal;"
}
}
],
"variables": [
{
"name": "taxRate",
"value": {
"outputAction": "5fbe8c1938709266c44cfac4",
"itemValue": {
"attributeCode": "attributes_taxRatesRate"
}
}
},
{
"name": "subtotal",
"value": {
"inputParent": 0,
"itemValue": {
"attributeCode": "attributes_accountInvoiceLinesSubTotal"
}
}
},
{
"name": "taxAmount",
"value": {
"script": "return taxRate != null ? (taxRate * subtotal)/100.0 : 0.0;"
}
}
],
"actions": [
{
"actionId": "5fbe921c38709266c44cfac6",
"designCode": "designs_workflowRelationAction",
"parameters": [
{
"attribute": {
"attributeCode": "attributes_workflowRelationActionsAqsPath",
"value": "root^attributes_accountInvoicesInvoiceLines"
}
}
],
"variables": [],
"actions": [
{
"actionId": "5fbe922038709266c44cfac7",
"designCode": "designs_workflowRelationAction",
"parameters": [
{
"attribute": {
"attributeCode": "attributes_workflowRelationActionsAqsPath",
"value": "root.attributes_accountInvoicesInvoiceLines"
}
}
],
"variables": [],
"actions": []
},
{
"actionId": "5fbe929838709266c44cfac8",
"designCode": "designs_workflowEditItemAction",
"parameters": [
{
"attributeCode": "attributes_accountInvoicesSubTotal",
"attributeType": "Number",
"value": {
"script": "return Variables.invoiceLinesSubtotal.AllValues.Values.Sum(x => x.SingleValue);"
}
},
{
"attributeCode": "attributes_accountInvoicesTax",
"attributeType": "Number",
"value": {
"script": "return Variables.invoiceLinesTax.AllValues.Values.Sum(x => x.SingleValue);"
}
},
{
"attributeCode": "attributes_accountTransactionsAmount",
"attributeType": "Number",
"value": {
"script": "return Variables.invoiceLinesSubtotal.AllValues.Values.Sum(x => x.SingleValue) + Variables.invoiceLinesTax.AllValues.Values.Sum(x => x.SingleValue);"
}
}
],
"variables": [
{
"name": "invoiceLinesSubtotal",
"value": {
"outputAction": "5fbe922038709266c44cfac7",
"itemValue": {
"attributeCode": "attributes_accountInvoiceLinesSubTotal"
}
}
},
{
"name": "invoiceLinesTax",
"value": {
"outputAction": "5fbe922038709266c44cfac7",
"itemValue": {
"attributeCode": "attributes_accountInvoiceLinesTax"
}
}
}
],
"actions": []
}
]
}
]
}
]
}