Hello, here i am going to add balance according to the credit(-ve), debit(+ve) and current balance in bankAccountstatement report
for the first row balance should be calculated as current balance - credit or current balance + debit .
but from the second row balance of the previous row is considered as Prev balance, now the calculation will be PrevBalance +debit or PrevBalance - credit
in the code i have declared PrevBalance is
real PrevBalance;
the code is..........
while select forupdate bankAccountStatementTmp
{
select firstonly ledgerJournalTrans
where ledgerJournalTrans.RecId == bankAccountStatementTmp.SourceRecId;
bankAccountStatementTmp.Txt = ledgerJournalTrans.Txt;
bankAccountStatementTmp.XTSDebit = ledgerJournalTrans.AmountCurDebit;
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;
}
But getting the outpur like this