Package com.centraview.account.glaccount

Examples of com.centraview.account.glaccount.GLAccountList


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

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

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

      return this.getGLAccountList(individualID, dl);

    } else {
      GLAccountList returnDL = null;
      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'));

        try {
          AccountListHome aa = (AccountListHome)CVUtility.getHomeObject(
              "com.centraview.account.accountlist.AccountListHome", "AccountList");
          AccountList remote = (AccountList)aa.create();
          remote.setDataSource(this.dataSource);
          returnDL = remote.getGLAccountList(individualID, hm);
        } catch (Exception e) {
          System.out.println("[Exception] ListGenerator.getGLAccountList: " + e.toString());
          // e.printStackTrace();
        }

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

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

        GLAccountList emptyDL = createEmptyObject(returnDL);
        emptyDL.setTotalNoOfRecords(returnDL.getTotalNoOfRecords());
        emptyDL.setListID(currentListID);
        emptyDL.setListType("GLAccount");
        emptyDL.setStartAT(returnDL.getStartAT());
        emptyDL.setEndAT(returnDL.getEndAT());

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

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


   * @return
   */
  public GLAccountList getGLAccountList(int individualID, DisplayList DLparam)
  {

    GLAccountList returnDL = new GLAccountList();
    GLAccountList paramDL = (GLAccountList)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()));

    try {
      AccountListHome aa = (AccountListHome)CVUtility.getHomeObject(
          "com.centraview.account.accountlist.AccountListHome", "AccountList");
      AccountList remote = (AccountList)aa.create();
      remote.setDataSource(this.dataSource);
      returnDL = remote.getGLAccountList(individualID, hm);
    } catch (Exception e) {
      System.out.println("[Exception] ListGenerator.getGLAccountList: " + e.toString());
      // e.printStackTrace();
    }

    returnDL.setListType("GLAccount");
    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 GLAccountList createEmptyObject(GLAccountList list)
  {
    GLAccountList dummy = new GLAccountList();
    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;
  }
View Full Code Here

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

    int beginIndex = 0;

    GLAccountList glList = new GLAccountList();

    glList.setSortMember(strSortMem);

    CVDal cvdl = new CVDal(dataSource);

    Collection colList = null;

    String sortType = "ASC";

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

    //SELECT gla.glaccountsid GLAccountsID,gla.title Name ,gla.accounttype Type ,gla.Balance Balance ,gla1.title ParentAccount FROM glaccount gla left outer join glaccount gla1 on gla.parent = gla1.glaccountsid
    String selectQuery =
      " SELECT gla.glaccountsid GLAccountsID,gla.title Name ,gla.glaccounttype Type ,gla.Balance Balance ,gla1.title ParentAccount ";
    String fromQuery =
      " FROM glaccount gla left outer join glaccount gla1 on gla.parent = gla1.glaccountsid";
    String whereQuery = " where 1=1 ";
    String groupByQuery =
      " group by GLAccountsID,Name,Type,Balance,ParentAccount";
    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  gla.glaccountsid like '%" + strSearch
        + "%'   OR gla.title like '%" + strSearch
        + "%' OR gla.accounttype like  '%" + strSearch
        + "%' OR gla.Balance like  '%" + strSearch + "%' OR gla1.title like '%"
        + strSearch + "%' ";
    }

    String advSearchstr = strSearch;

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

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

      strSearch = "create TEMPORARY TABLE glaccountlistsearch " + advSearchstr;

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

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

      fromQuery = fromQuery + " ,glaccountlistsearch";
      whereQuery =
        whereQuery + " AND gla.glaccountsid = glaccountlistsearch.glaccountsid";
    }

    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 glaccountlistsearch");
      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 glAccID = ((Long) hm.get("GLAccountsID")).intValue();

        String strGLAccountID = new String();
        strGLAccountID = String.valueOf(glAccID);

        try
        {
          StringMember strName = null;

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

          StringMember strType =
            new StringMember("Type", (String) hm.get("Type"), 10, "", 'T', false);

          DoubleMember dblBalance =
            new DoubleMember("Balance",
              new Double(Double.parseDouble(hm.get("Balance").toString())), 10,
              "", 'T', false, 10);

          StringMember strParentAccount =
            new StringMember("ParentAccount", (String) hm.get("ParentAccount"),
              10, "", 'T', false);

          GLAccountListElement glListElement =
            new GLAccountListElement(glAccID);

          glListElement.put("GLAccountsID", strGLAccountID);
          glListElement.put("Name", strName);
          glListElement.put("Type", strType);
          glListElement.put("Balance", dblBalance);
          glListElement.put("ParentAccount", strParentAccount);

          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();

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

          //e.printStackTrace();
        }
      }
    }

    glList.setTotalNoOfRecords(glList.size());
    glList.setListType("GLAccount");
    glList.setBeginIndex(beginIndex);

    //filelist.setEndIndex(endIndex);
    glList.setEndIndex(glList.size());

    return glList;
  }
View Full Code Here

TOP

Related Classes of com.centraview.account.glaccount.GLAccountList

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.