we are making a expense calculator.We have a function which checks whether the expense exceeds the budget which is set in advance.But we realised that the function BudgetNote wont get executed while debugging.The debugger ignores the function call or the emulator crashes right in the beginning.
void CExpListBox::AddExpenseL()
/*this function is used to add a new expense to the database*/
{
BudgetNote();//to check whether the expense exceeds the budget
CExpForm* form= CExpForm::NewL(NULL);
form->PrepareLC(R_EXP_FORM_EXP_FORM);
form->SetAddFlag();
form->RunLD();
LoadExpListL();
}
void CExpListBox::BudgetNote()
{
CexpDatabase* expDb = CexpDatabase::NewL();
CexpbDatabase* expbDb = CexpbDatabase::NewL();
CexpListBoxView* list;
TexpbTableItem iexpbTableItem;
TexpbTableItem Bnew;
TInt count = 0;
TBuf<32> buf,buf1,buf2;
TBufC<32> msg, msg2;
TInt amt=0;
TexpTableItem iexpTableItem;
RArray<TexpTableItem> aexpTableItemArray;
msg = _L("Expense exceeds budget");
CleanupStack::PushL(expDb);
expDb->GetexpTableCountL(count);
if(count==0)
{
CleanupStack::PopAndDestroy();
return;
}
TBool first = expDb->GetexpTableFirstRecordL(iexpTableItem);
buf1=iexpTableItem.iexpAmt;
amt=amt+TInt(buf1);
TBool next = EFalse;
TBuf<32> aBuffer;
if(first)
{
do
{
next = expDb->GetexpTableNextRecordL(iexpTableItem);
buf2=iexpTableItem.iexpAmt;
amt=amt+TInt(buf2);
}
while(next);
CleanupStack::PopAndDestroy(expDb);
CleanupStack::PushL(expbDb);
Bnew= expbDb->GetexpbTableLastRecordL(iexpbTableItem);
buf=Bnew.iexpbBgt;
if(amt>=TInt(buf))
{
list->RunNote2L(&msg);
}
CleanupStack::PopAndDestroy(expbDb);
}
else
{
CleanupStack::PopAndDestroy(expbDb);
CleanupStack::PopAndDestroy(expDb);
}
}



