R30383-29 InvoiceLine - Calculate Sales Order Amount
| Code | 30383-29 |
| Entity | Crm.Invoicing.InvoiceLines Entity |
| Name | CalculateSalesOrderAmount |
| Attribute | SalesOrderAmount |
| Layer | Front-End |
| Events | AttributeChanged(Quantity, QuantityUnit) |
| Priority | Normal |
| Modify | YES |
| Applicable Legislations | ALL // no condition needed |
| Action | if (InvoiceLine.SalesOrderAmount != null)
{
IF( InvoiceLine.Product is not NULL AND oldQuantity != newQuantity - considering its Value and QuantityUnit) {oldQuantity = oldQuantity .ConvertTo(newQuantity .Unit, InvoiceLine.Product); - old Quantity is converted to newQuantity's Unit var divisor => IF(oldQuantity == 0 ) then divisor =1 else divisor = oldQuantity ; InvoiceLine.SalesOrderAmount = (InvoiceLine.SalesOrderAmount * newQuantity ) / divisor;} } |
| Description | When the value in Product, SalesOrder or ParentSalesOrderLine is changed to a different than the previous value in the same field, SalesOrder Amount should become null. |
| Message | |
| Version | Introduced: 2020 |
| Revocable | YES |
* For more information about the Business Rules Documentation Template and a short explanation of each column, see topic System Business Rules.