Как-то так:
X++:
custVendTrans.ReasonRefRecId = reasonRefRecID;
// If the amount, which is the total invoice amount, is zero, then the amountMST and amountCur also must be zero
if (amountCur)
{
if (_useSubLedger)
{
// <GIN>
if (TaxWithholdParameters_IN::checkTaxParameters())
{
amountCur += taxWithholdAmount;
}
// </GIN>
custVendTrans.AmountMST = CurrencyExchangeHelper::mstAmount(amountCur, currencyCode, transDate, Currency::noYes2UnknownNoYes(triangulation), exchRate, exchRateSecondary);
}
else
{
// <GEERU>
if (ledgerBalances)
{
custVendTrans.AmountMST = CurrencyExchangeHelper::amount(postedAmountMST, Ledger::accountingCurrency());
}
else
{
// </GEERU>
custVendTrans.AmountMST = CurrencyExchangeHelper::amount(ledgerPostingReference.lastAmountMST(), Ledger::accountingCurrency());
// <GEERU>
}
// </GEERU>
}
}
else
{
custVendTrans.AmountMST = 0;
}
X++:
/// <summary>
/// Calculates the total of the multiple posted balance amount based on
/// the specific currency code and the object of <c>CurrencyExchangeHelper</c>.
/// </summary>
/// <param name = "_curencyCode">The transaction currency originating the conversion.</param>
/// <param name = "_currencyExchangeHelper">The <c>CurrencyExchangeHelper</c> class which manages calculations between currencies.</param>
/// <returns>A container of AmountCur and AmountMst.</returns>
private container calculatePostedMultipleBalanceAmounts_RU(CurrencyCode _curencyCode, CurrencyExchangeHelper _currencyExchangeHelper)
{
int i;
boolean correction;
AmountCur balanceValue;
AmountCur retAmountCur;
amountMST retAmountMst;
for (i = 1; i<=conLen(ledgerBalances); i++)
{
[correction, balanceValue] = conPeek(ledgerBalances, i);
retAmountCur += balanceValue;
retAmountMST += _currencyExchangeHelper.calculateTransactionToAccounting(
_curencyCode,
balanceValue,
true
);
}
return [retAmountCur, retAmountMst];
}
X++:
if (countryRegion_RU)
{
custVoucher.parmSalesInvoicePostingType_RU(custInvoiceJour_RU.InvoicePostingType_RU);
if (this.postBalanceAsManyLedgerTransactions_RU())
{
custVoucher.parmLedgerBalances_RU([[false, salesTotals.totalAmountBySign_RU(false)], [this.parmStorno(), salesTotals.totalAmountBySign_RU(true)]]);
}
}