X++:
/// <summary>
/// Settles the transactions associated with the specified parameters.
/// </summary>
/// <param name="_company">
/// The spec company of the <c>SpecTrans</c> records to find.
/// </param>
/// <param name="_tableId">
/// The spec table ID of the <c>SpecTrans</c> records to find.
/// </param>
/// <param name="_recId">
/// The spec record ID of the <c>SpecTrans</c> records to find.
/// </param>
/// <param name="_balancePostingProfile">
/// A flag indicating whether to create additional transactions when the transaction have different posting profiles.
/// </param>
/// <remarks>
/// This method is the starting point of the settlement process.
/// </remarks>
/// <exception cref="Exception::Error">
/// The transaction was oversettled.
/// </exception>
public void settleNow(dataAreaId _company, tableId _tableId, RecId _recId, boolean _balancePostingProfile = true)
{
CurrencyExchHelper currencyHelper;
boolean areDebitsDone = false; // Are all debit (invoice) transactions read?
boolean areCreditsDone = false; // Are all credit (payment) transactions read?
AmountCur settleAmountCurDebit; // Amount to settle in debit transaction currency
AmountCur settleAmountCurCredit; // Amount to settle in credit transaction currency
AmountMST settleAmountMstDebit; // Amount to settle in MST currency for debit transaction
AmountMST settleAmountMstCredit; // Amount to settle in MST currency for credit transaction
boolean isDebitTransFullySettled; // Flag indicating if debit transaction is fully settled.
boolean isCreditTransFullySettled; // Flag indicating if credit transaction is fully settled.
SpecTrans specTransToDelete; // Table buffer to use when deleting the specTrans records.
Percent settledFactorDebit; // Percent of total debit transaction that is being settled.
Percent settledFactorCredit; // Percent of total credit transaction that is being settled.
AmountCur origRemainDebitCur; // Original amount remaining for debit transaction
AmountMST realizedExchAdjAmount; // Amount of realized exchange adjustment gain or loss
AmountMST unrealizedExchAdjAmountDebit; // Amount of unrealized exchange adjustment to reverse on debit transaction.
AmountMST unrealizedExchAdjAmountCredit; // Amount of unrealized exchange adjustment to reverse on credit transaction.
AmountCur roundedSettleAmountCurDebit;
AmountCur roundedSettleAmountCurCredit;
AmountMST roundedSettleAmountMstDebit; // Amount to settle in MST currency for debit transaction
AmountMST roundedSettleAmountMstCredit; // Amount to settle in MST currency for credit transaction
...