R30966-1 PaymentTransfer - Set Destination Amount

Code R30966-1
Entity Finance.Payments.Transfers Entity
Name SetDestinationAmount
Attribute DestinationAmount
Layer Front-End
Events AttributeChanged(SourceAmount, SourcePaymentAccount, DestinationPaymentAccount, CurrencyDirectory)
Priority Normal
Modify NO
Applicable Legislations ALL // no condition needed
Action IF

(SourcePaymentAccount!=null

AND

DestinationPaymentAccount!=null

AND

OldValue(DestinationPaymentAccount.Currency) != NewValue(DestinationPaymentAccount.Currency)

AND

OldValue(SourcePaymentAccount.Currency) != NewValue(SourcePaymentAccount.Currency) )

{

IF(SourcePaymentAccount.Currency = DestinationPaymentAccount.Currency)

{DestinationAmount = SourceAmount}

, else if (CurrencyDirectory = null)

{DestinationAmount = null}

, else {DestinationAmount = SourceAmount.ConvertTo(DestinationPaymentAccount.Currency,CurrencyDirectory)}

}
Description When the Source Amount, the Currencies (depending on the Payment Accounts) or the Currency Directory of the document are changed, Destination Amount is recalculated based on all of the components.

The recalculation is performed only if both Payment Accounts are filled in. If the rule is triggered by a change of a Payment Account the recalculation will be performed only if the currencies of the old and new payment accounts are different.
Message -
Version Introduced: 2020.1

Updated: -
Revocable YES

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