{
Card crdTemp=enCards.nextElement();
Enumeration<Transaction> enTrans =crdTemp.getAllTransactions();
while(enTrans.hasMoreElements())
{
Transaction tmpTrans=enTrans.nextElement();
if((tmpTrans.getDate().before(dtBegin))||((tmpTrans.getDate().after(dtEnd))))
continue;
for(int i=mitTimer.getIterationNumber(); mitTimer.hasNext(); mitTimer.next())
{
i=mitTimer.getIterationNumber();
if(mitTimer.isInCurrentMonth(tmpTrans.getDate()))
{
for(int k=0; k<strGroups.length; k++)
{
if(strGroups[k].equals(mwcMain.getProfile().getReasons().get(tmpTrans.strReason.trim().toLowerCase())))
dblMonthSpent[k][i]-=tmpTrans.amount;
}
}
}
mitTimer.reset();
for(int i=0; i<strGroups.length; i++)
{
if(tmpTrans.amount>0)
continue;
if((strGroups[i].equals(mwcMain.getProfile().getReasons().get(tmpTrans.strReason.trim().toLowerCase())))&&(!tmpTrans.strReason.equals(TransferController.TransferMinus)))
dblValues[i]+=tmpTrans.amount;
}
if(tmpTrans.amount<0)
dblTotal-=tmpTrans.amount;
}
}
//circular diagram 0 tab
jtpAnalisys.addTab("Resourse distribution", new CircularDiagram(strGroups, dblValues));
//jtpAnalisys.setToolTipTextAt(0, "Resourse distribution");
//fill the dates
String[] strDates=new String[mitTimer.getIterationCount()];
for(Date t=mitTimer.getDateOfIteration(); mitTimer.hasNext(); mitTimer.next())
strDates[mitTimer.getIterationNumber()]=DateTool.getDateStr(mitTimer.getDateOfIteration(), "MM.yyyy");
mitTimer.reset();
//Calculade all data
enCards=mwcMain.getProfile().getCards();
int intCardPointer=mwcMain.getProfile().getCardNumber()-1;
double dblMonthBalance;
while(enCards.hasMoreElements())
{
Card crdTemp=enCards.nextElement();
strCardNames[intCardPointer]=crdTemp.getName();
dblMonthBalance=crdTemp.getInitialBalance();
Enumeration<Transaction> enInitTrans=crdTemp.getAllTransactions();
while(enInitTrans.hasMoreElements())
{
Transaction trTemp=enInitTrans.nextElement();
if(trTemp.getDate().before(dtBegin))
dblMonthBalance+=trTemp.amount;
}
while(mitTimer.hasNext())
{
Enumeration<Transaction> enTranCr=crdTemp.getAllTransactions();
while(enTranCr.hasMoreElements())
{
Transaction trans=enTranCr.nextElement();
if(mitTimer.isInCurrentMonth(trans.getDate()))
{
dblMonthBalance+=trans.amount;
}
}
dblCardRemainings[intCardPointer][mitTimer.getIterationNumber()]=dblMonthBalance;