Package Utils

Examples of Utils.Transaction


        double dblAmount=Validate();
        if(dblAmount<0)
            return;
        try
        {
            mwcHost.getTab(lstFrom.getSelectedValue().toString()).addTransaction(new Transaction(Transaction.ID_NOT_SET, -dblAmount, TransferController.TransferMinus,  DateTool.getDate(txtDate.getText())));
            mwcHost.getTab(lstTo.getSelectedValue().toString()).addTransaction(new Transaction(Transaction.ID_NOT_SET, dblAmount, TransferController.TransferPlus,  DateTool.getDate(txtDate.getText())));
        }
        catch(Exception ef)
        {System.out.println(ef.getClass());}
        lstFrom.setSelectedIndex(-1);
        lstTo.setSelectedIndex(-1);
View Full Code Here


    {
        if(Validate())
        {
            try
            {
                cpcCard.addTransaction(new Transaction(Transaction.ID_NOT_SET, Double.parseDouble(cpcCard.getAmount().trim().replace(',', '.')), cpcCard.getPurpose(), DateTool.getDate(cpcCard.getDate())));
            }
            catch(ParseException e1){}
            cpcCard.ClearTransactionBlock();
         //   cpcCard.ReloadReasons();
        }
View Full Code Here

        Enumeration<Transaction> enTrans=crdInfo.getAllTransactions();
        while(enTrans.hasMoreElements())
        {
            Vector vctRow=new Vector();
            vctRow.clear();
            Transaction tmpTransaction=enTrans.nextElement();
            vctRow.add(new Integer(tmpTransaction.getID()));
            vctRow.add(tmpTransaction.getTransactionDate());
            vctRow.add(dfCurrency.format(tmpTransaction.amount));
            vctRow.add(tmpTransaction.strReason);
            if(dtmData.getRowCount()==0)
                dtmData.addRow(vctRow);
            else
            {
                int intPosition=0;
                for(int i=0; i<dtmData.getRowCount(); i++)
                {
                    if(DateTool.getDate((String) dtmData.getValueAt(i, 1)).compareTo(tmpTransaction.getDate())>0)
                    {
                        break;
                    }
                    else if(((String) dtmData.getValueAt(i, 1)).equals(tmpTransaction.getTransactionDate())&&(((Integer)dtmData.getValueAt(i, 0)).intValue()>tmpTransaction.getID()))
                    {
                        break;
                    }
                    intPosition=i+1;
                }
View Full Code Here

            brReader=new BufferedReader(isrReader);
            Vector<Transaction> vctTrans=new Vector<Transaction>();
            String s=brReader.readLine();
            while(s!=null)
            {
                Transaction trans=Parse(s);
                if(trans==null)
                    throw new IOException("Invalid file format!");
                vctTrans.add(trans);
                s=null;
                s=brReader.readLine();
View Full Code Here

            if(i!=strData.length-1)
            {
                sbTemp.append(",");
            }
        }
        return new Transaction(Transaction.ID_NOT_SET, dblAmount, sbTemp.toString(), dtTrans);
    }
View Full Code Here

        {
            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;
View Full Code Here

        double dblAmount=Validate();
        if(dblAmount<0)
            return;
        try
        {
            mwcHost.getTab(lstFrom.getSelectedValue().toString()).addTransaction(new Transaction(Transaction.ID_NOT_SET, -dblAmount, "Transfer (-)",  DateTool.getDate(txtDate.getText())));
            mwcHost.getTab(lstTo.getSelectedValue().toString()).addTransaction(new Transaction(Transaction.ID_NOT_SET, dblAmount, "Transfer (+)",  DateTool.getDate(txtDate.getText())));
        }
        catch(Exception ef)
        {System.out.println(ef.getClass());}
        lstFrom.setSelectedIndex(-1);
        lstTo.setSelectedIndex(-1);
View Full Code Here

        Enumeration<Transaction> enTrans=crdInfo.getAllTransactions();
        while(enTrans.hasMoreElements())
        {
            Vector vctRow=new Vector();
            vctRow.clear();
            Transaction tmpTransaction=enTrans.nextElement();
            vctRow.add(new Integer(tmpTransaction.getID()));
            vctRow.add(tmpTransaction.getTransactionDate());
            vctRow.add(dfCurrency.format(tmpTransaction.amount));
            vctRow.add(tmpTransaction.strReason);
            if(dtmData.getRowCount()==0)
                dtmData.addRow(vctRow);
            else
            {
                int intPosition=0;
                for(int i=0; i<dtmData.getRowCount(); i++)
                {
                    if(DateTool.getDate((String) dtmData.getValueAt(i, 1)).compareTo(tmpTransaction.getDate())>0)
                    {
                        break;
                    }
                    else if(((String) dtmData.getValueAt(i, 1)).equals(tmpTransaction.getTransactionDate())&&(((Integer)dtmData.getValueAt(i, 0)).intValue()>tmpTransaction.getID()))
                    {
                        break;
                    }
                    intPosition=i+1;
                }
View Full Code Here

            brReader=new BufferedReader(isrReader);
            Vector<Transaction> vctTrans=new Vector<Transaction>();
            String s=brReader.readLine();
            while(s!=null)
            {
                Transaction trans=Parse(s);
                if(trans==null)
                    throw new IOException("Invalid file format!");
                vctTrans.add(trans);
                s=null;
                s=brReader.readLine();
View Full Code Here

                    //System.out.println(sbTemp.substring(0, i-1).replaceAll("\"", ""));
                    return null;
                }
            }
        }
        return new Transaction(Transaction.ID_NOT_SET, dblAmount, sbTemp.substring(sbTemp.lastIndexOf("\"")+1, sbTemp.length()), dtTrans);
    }
View Full Code Here

TOP

Related Classes of Utils.Transaction

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.