R30505-7 ReceivingOrder - Convert Line Prices

Code 30505-7
Entity Logistics.Procurement.ReceivingOrders Entity
Name ConvertLinePrices
Attribute line.PricePerUnit
Layer Front-End
Events AttributeChanged(DocumentCurrency)
Priority Normal
Modify YES
Applicable Legislations ALL // no condition needed
Action if (oldCurrency != null && newCurrency != null && oldCurrency != newCurrency ){ foreach (line in ReceivingOrder.Lines){

if (line.PricePerUnit.Value != 0){ convertedPricePerUnit = Amount(PricePerUnit, oldCurrency).ConvertToOrDefault(newCurrency, CurrencyDirectory); if (convertedPricePerUnit == null) fail = true; else PricePerUnit = convertedPricePerUnit .RoundUnitPrice();

} if (fail) IssueWarning once
Description When Document Currency is changed, Price per Unit should be converted to the new currency for each of the lines in the document. If Currency Directory is necessary for the conversion and it is missing, a warning is issued.
Message Failed to convert Currency. Please check the Currency Directory.
Version Introduced: 2020.1
Revocable YES

* For more information about the Business Rules Documentation Template and a short explanation of each column, see topic System Business Rules.