erp.type | erp.entity |
---|---|
front-end-business-rule |
Logistics.Procurement.ReceivingOrderLines |
+----------------------+-----------------------------------------------------------------------------------------------+
| Code | 30505-13 |
+----------------------+-----------------------------------------------------------------------------------------------+
| Entity | @Logistics.Procurement.ReceivingOrderLines |
+----------------------+-----------------------------------------------------------------------------------------------+
| Name | SetPricePerUnitFromLineAmount |
+----------------------+-----------------------------------------------------------------------------------------------+
| Attribute | PricePerUnit |
+----------------------+-----------------------------------------------------------------------------------------------+
| Layer | Front-End |
+----------------------+-----------------------------------------------------------------------------------------------+
| Events | AttributeChanged(LineAmount) |
+----------------------+-----------------------------------------------------------------------------------------------+
| Priority | Normal |
+----------------------+-----------------------------------------------------------------------------------------------+
| Modify | YES |
+----------------------+-----------------------------------------------------------------------------------------------+
| Action | if (ReceivingOrder.AdjustedDocument == null)
|
| | , then check: |
| |
|
| | if ((ConfirmedQuantity ?? Quantity) != 0)
|
| | PricePerUnit = (LineAmount.Round() / (ConfirmedQuantity ?? Quantity)).RoundUnitPrice()
|
| | ELSE
|
| | PricePerUnit = null |
| |
|
| | *ConfirmedQuantity ?? Quantity - means the following:
|
| | - if (ConfirmedQuantity != null), then get the value from ConfirmedQuantity
|
| | - if (ConfirmedQuantity == null), then get the value from Quantity |
| |
|
| | *RoundUnitPrice() is rounding with precision 5 - this is for Unit Prices and Price Per Unit |
| |
|
| | *Round() is rounding with precision depending on the currency precision which is 2 - this is |
| | for Line Amounts |
+----------------------+-----------------------------------------------------------------------------------------------+
| Description | When Line Amount is changed, Price Per Unit should be calculated as the result of dividing |
| | Line Amount:
|
| | - by Quantity (if Confirmed Quantity is null) or
|
| | - by Confirmed Quantity (if Confirmed Quantity is not null)
|
| | If Quantity is 0 and Confirmed Quantity is null, Price Per Unit is null.
|
| | If Confirmed Quantity is 0, Price Per Unit is null. |
+----------------------+-----------------------------------------------------------------------------------------------+
| Message | |
+----------------------+-----------------------------------------------------------------------------------------------+
| Version | Introduced: 2020.1
|
| | Updated: v.24 |
+----------------------+-----------------------------------------------------------------------------------------------+
| Revocable | YES |
+----------------------+-----------------------------------------------------------------------------------------------+
* For more information about the Business Rules Documentation Template and a short explanation of each column, see topic System Business Rules.