Package com.centraview.account.expense

Examples of com.centraview.account.expense.ExpenseList


      expenseColumns.addElement("Reference");
      expenseColumns.addElement("Amount");
      expenseColumns.addElement("Created");
      expenseColumns.addElement("Creator");

      ExpenseList expenselist = new ExpenseList();

      String searchExpenseString =
        "ADVANCE:select expense.ExpenseID,expense.Amount,expense.Created,entity.name as Reference ,expense.Status, concat(individual.firstname,' ',individual.lastname) as Creator,individual.IndividualID "
          + "from expense left outer join individual on expense.creator = individual.individualid left outer join entity on expense.entityid = entity.entityid "
          + " where expense.linestatus != 'deleted'  and expense.ticket="
View Full Code Here


      expenseColumns.addElement("Reference");
      expenseColumns.addElement("Amount");
      expenseColumns.addElement("Created");
      expenseColumns.addElement("Creator");

      ExpenseList expenselist = new ExpenseList();

      String searchExpenseString = "ADVANCE:select expense.ExpenseID,expense.Amount,expense.Created," + "entity.name as Reference ,expense.Status, concat(individual.firstname,' ',individual.lastname) " + "as Creator,individual.IndividualID " + "from expense left outer join individual on expense.creator = individual.individualid "
          + "left outer join entity on expense.entityid = entity.entityid " + " where expense.linestatus != 'deleted' and expense.ticket=" + ticketID + " group by expense.ExpenseID,expense.Amount," + "expense.Created,Reference ,expense.Status, Creator";

      expenselist = (ExpenseList)lg.getExpenseList(individualID, 1, 200, searchExpenseString, "Reference");
View Full Code Here

   */
  public ExpenseList getExpenseList(int individualID, int startATparam, int EndAtparam,
      String searchString, String sortColumn) throws CommunicationException, NamingException
  {
    if ((searchString != null) && ((searchString.trim()).length() > 0)) {
      ExpenseList dl = new ExpenseList();
      dl.setStartAT(startATparam);
      dl.setEndAT(EndAtparam);
      dl.setSortMember(sortColumn);
      dl.setSortType('A');
      dl.setSearchString(searchString);
      dl.setListType("Expense");

      long currentListID = this.getNextListID();
      dl.setListID(currentListID);

      displayLists.put(new Long(currentListID), dl);

      return this.getExpenseList(individualID, dl);

    } else {
      ExpenseList returnDL = null;
      AccountListHome aa = (AccountListHome)CVUtility.getHomeObject(
          "com.centraview.account.accountlist.AccountListHome", "AccountList");

      try {
        HashMap hm = new HashMap();
        hm.put("startATparam", new Integer(startATparam));
        hm.put("EndAtparam", new Integer(EndAtparam));
        hm.put("searchString", searchString);
        hm.put("sortmem", sortColumn);
        hm.put("sortType", new Character('A'));

        AccountList remote = (AccountList)aa.create();
        remote.setDataSource(this.dataSource);

        try {
          returnDL = remote.getExpenseList(individualID, hm);
        } catch (Exception e) {
          System.out.println("[Exception][MarketingListEJB] Exception thrown in x: " + e);
        }

        returnDL.setListType("Expense");
        returnDL.setTotalNoOfRecords(returnDL.size());

        long currentListID = this.getNextListID();
        returnDL.setListID(currentListID);
        returnDL.setStartAT(startATparam);
        returnDL.setEndAT(EndAtparam);

        ExpenseList emptyDL = createEmptyObject(returnDL);
        emptyDL.setTotalNoOfRecords(returnDL.getTotalNoOfRecords());
        emptyDL.setListID(currentListID);
        emptyDL.setListType("Expense");
        emptyDL.setStartAT(returnDL.getStartAT());
        emptyDL.setEndAT(returnDL.getEndAT());
        displayLists.put(new Long(currentListID), emptyDL);

      } catch (Exception e) {
        e.printStackTrace();
      }
View Full Code Here

   */
  public ExpenseList getExpenseList(int individualID, DisplayList DLparam)
      throws CommunicationException, NamingException
  {

    ExpenseList returnDL = null;
    ExpenseList paramDL = (ExpenseList)DLparam;
    int listSize = paramDL.getTotalNoOfRecords();
    int startAT = paramDL.getStartAT();
    int EndAt = paramDL.getEndAT();

    String powerString = paramDL.getPowerString();
    String searchString = paramDL.getSearchString();
    String sortColumn = paramDL.getSortMember();

    HashMap hm = new HashMap();
    hm.put("startATparam", new Integer(startAT));
    hm.put("EndAtparam", new Integer(EndAt));
    hm.put("searchString", searchString);
    hm.put("sortmem", DLparam.getSortMember());
    hm.put("sortType", new Character(DLparam.getSortType()));
    AccountListHome aa = (AccountListHome)CVUtility.getHomeObject(
        "com.centraview.account.accountlist.AccountListHome", "AccountList");

    try {
      AccountList remote = (AccountList)aa.create();
      remote.setDataSource(this.dataSource);

      returnDL = remote.getExpenseList(individualID, hm);
    } catch (Exception e) {
      System.out.println("[Exception][MarketingListEJB] Exception thrown in x: " + e);
    }

    returnDL.setListType("Expense");
    returnDL.setListID(paramDL.getListID());
    returnDL.setStartAT(paramDL.getStartAT());
    returnDL.setEndAT(paramDL.getEndAT());
    returnDL.setSortType(paramDL.getSortType());
    returnDL.setSearchString(searchString);
    returnDL.setPowerString(powerString);

    if (searchString != null && searchString.startsWith("SIMPLE :"))
      returnDL.search();
View Full Code Here

   * @param list
   * @return
   */
  public ExpenseList createEmptyObject(ExpenseList list)
  {
    ExpenseList dummy = new ExpenseList();
    dummy.setListType(list.getListType());
    dummy.setPrimaryMemberType(list.getPrimaryMemberType());
    dummy.setPrimaryTable(list.getPrimaryTable());
    dummy.setSortMember(list.getSortMember());
    dummy.setSortType(list.getSortType());
    dummy.setPrimaryMember(list.getPrimaryMember());
    dummy.setStartAT(list.getStartAT());
    dummy.setEndAT(list.getEndAT());
    dummy.setBeginIndex(0);
    dummy.setEndIndex(0);
    return dummy;
  }// end of createEmptyObject
View Full Code Here

    int intStartParam = intStart.intValue();
    int intEndParam = intEnd.intValue();

    int beginIndex = 0;

    ExpenseList expList = new ExpenseList();

    expList.setSortMember(strSortMem);

    CVDal cvdl = new CVDal(dataSource);

    Collection colList = null;

    String sortType = "ASC";

    if (charSort == 'D')
    {
      sortType = "DESC";
    }

    String selectQuery =
      "  select expense.ExpenseID,expense.Amount,expense.Created,entity.name as Reference ,expense.Status, concat(individual.firstname,' ',individual.lastname) as Creator,individual.IndividualID";
    String fromQuery =
      " from expense left outer join individual on expense.owner = individual.individualid left outer join entity on expense.entityid = entity.entityid";
    String whereQuery = " where expense.linestatus != 'deleted'";
    String groupByQuery =
      " group by expense.ExpenseID,expense.Amount,expense.Created,Reference ,expense.Status, Creator";
    String orderByQuery = " order by '" + strSortMem + "' " + sortType;

    String listQuery =
      selectQuery + fromQuery + whereQuery + groupByQuery + orderByQuery;

    if ((strSearch != null) && strSearch.startsWith("SIMPLE :"))
    {
      strSearch = strSearch.substring(8);

      whereQuery =
        whereQuery + "AND  expense.ExpenseID like '%" + strSearch
        + "%'   OR expense.Amount like '%" + strSearch
        + "%' OR expense.Created like  '%" + strSearch
        + "%' OR entity.name like  '%" + strSearch
        + "%' OR expense.Status like '%" + strSearch
        + "%' OR concat(individual.firstname,' ',individual.lastname) like'%"
        + strSearch + "%' ";
    }

    String advSearchstr = strSearch;

    if ((advSearchstr != null) && advSearchstr.startsWith("ADVANCE:"))
    {
      String tmpAdvSearchstr = advSearchstr.substring(8);

      cvdl.setSqlQueryToNull();
      cvdl.setSqlQuery("DROP TABLE IF EXISTS `expenselistsearch`;");
      cvdl.executeUpdate();
      cvdl.clearParameters();
      cvdl.setSqlQueryToNull();

      strSearch = "create TEMPORARY TABLE expenselistsearch " + tmpAdvSearchstr;

      cvdl.setSqlQuery(strSearch);
      cvdl.executeUpdate();

      cvdl.setSqlQueryToNull();
      cvdl.clearParameters();

      fromQuery = fromQuery + " ,expenselistsearch";
      whereQuery =
        whereQuery + " AND expense.ExpenseID = expenselistsearch.ExpenseID";
    }

    listQuery =
      selectQuery + fromQuery + whereQuery + groupByQuery + orderByQuery;

    cvdl.setSqlQuery(listQuery);
    colList = cvdl.executeQuery();
    cvdl.clearParameters();

    if ((advSearchstr != null) && advSearchstr.startsWith("ADVANCE:"))
    {
      cvdl.setSqlQueryToNull();
      cvdl.setSqlQuery("DROP TABLE expenselistsearch");
      cvdl.executeUpdate();
      cvdl.clearParameters();
    }

    cvdl.destroy();

    if (colList != null)
    {
      Iterator it = colList.iterator();

      int i = 0;

      while (it.hasNext())
      {
        i++;

        HashMap hm = (HashMap) it.next();

        int expenseID = Integer.parseInt(hm.get("ExpenseID").toString());
        int indID = 0;

        if ((hm.get("IndividualID") != null))
        {
          indID = Integer.parseInt(hm.get("IndividualID").toString());
        }

        Double amount = null;

        if (hm.get("Amount") != null)
        {
          amount = new Double(Double.parseDouble(hm.get("Amount").toString()));
        }

        try
        {
          IntMember intExpID =
            new IntMember("ExpenseID", expenseID, 10, null, 'T', true, 10);
          IntMember intIndID =
            new IntMember("IndividualID", indID, 10, null, 'T', false, 10);
          DoubleMember dblAmount =
            new DoubleMember("Amount", amount, 10, "", 'T', false, 10);

          DateMember submitedDt =
            new DateMember("Created", (Date) hm.get("Created"), 10, "", 'T',
              false, 1, "EST");

          StringMember strReference = null;

          if ((hm.get("Reference") != null))
          {
            strReference =
              new StringMember("Reference", (String) hm.get("Reference"), 10,
                null, 'T', false);
          }
          else
          {
            strReference =
              new StringMember("Reference", null, 10, null, 'T', false);
          }

          StringMember strStatus =
            new StringMember("Status", (String) hm.get("Status"), 10, null,
              'T', false);

          StringMember strCreator = null;

          if ((hm.get("Creator") != null))
          {
            strCreator =
              new StringMember("Creator", (String) hm.get("Creator"), 10, null,
                'T', true);
          }
          else
          {
            strCreator =
              new StringMember("Creator", null, 10, null, 'T', false);
          }

          ExpenseListElement expListElement = new ExpenseListElement(expenseID);

          expListElement.put("ExpenseID", intExpID);
          expListElement.put("Amount", dblAmount);
          expListElement.put("Created", submitedDt);
          expListElement.put("Reference", strReference);
          expListElement.put("Status", strStatus);
          expListElement.put("Creator", strCreator);

          expListElement.put("IndividualID", intIndID);

          StringBuffer stringbuffer = new StringBuffer("00000000000");
          stringbuffer.setLength(11);

          String s3 = (new Integer(i)).toString();
          stringbuffer.replace(stringbuffer.length() - s3.length(),
            stringbuffer.length(), s3);

          String s4 = stringbuffer.toString();

          expList.put(s4, expListElement);
        }
        catch (Exception e)
        {
          System.out.println(" Exception in packing data " + e);

          //e.printStackTrace();
        }
      }
    }

    expList.setTotalNoOfRecords(expList.size());
    expList.setListType("Expense");
    expList.setBeginIndex(beginIndex);

    //expList.setEndIndex(endIndex);
    expList.setEndIndex(expList.size());

    return expList;
  }
View Full Code Here

TOP

Related Classes of com.centraview.account.expense.ExpenseList

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.