{
select firstonly ledgerJournalTrans
where ledgerJournalTrans.RecId == bankAccountStatementTmp.SourceRecId;
bankAccountStatementTmp.XTSCredit = ledgerJournalTrans.AmountCurCredit;
ttsbegin;
if(bankaccountstatementtmp.XTSCredit)
{
bankAccountStatementTmp.XTSCorrectedAmountCur = PrevBalance - bankAccountStatementTmp.XTSCredit;
}
else if(bankAccountStatementTmp.XTSDebit)
{
bankAccountStatementTmp.XTSCorrectedAmountCur = PrevBalance + bankAccountStatementTmp.XTSDebit;
}
else
{
bankAccountStatementTmp.XTSCorrectedAmountCur = PrevBalance - bankAccountStatementTmp.XTSDebit + bankAccountStatementTmp.XTSDebit;
}
PrevBalance = bankAccountStatementTmp.CurrentBalance - bankAccountStatementTmp.XTSCorrectedAmountCur;
bankAccountStatementTmp.update();
ttscommit;
}