Package com.centraview.account.purchaseorder

Examples of com.centraview.account.purchaseorder.PurchaseOrderList


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

    int beginIndex = 0;

    PurchaseOrderList poList = new PurchaseOrderList();

    poList.setSortMember(strSortMem);

    CVDal cvdl = new CVDal(dataSource);

    Collection colList = null;

    String sortType = "ASC";

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



    String selectQuery =
      "  select purchaseorder.PurchaseOrderID,purchaseorder.purchaseorderdate as Created, individual.IndividualID, concat(individual.firstname,' ',individual.lastname) as Creator,entity.EntityID,entity.name as  Entity ,purchaseorder.SubTotal,purchaseorder.Tax, purchaseorder.Total, accstatus.title as Status";
    String fromQuery =
      " from purchaseorder left outer join individual on purchaseorder.creator = individual.individualid left outer join entity on purchaseorder.entity = entity.entityid left outer join accountingstatus accstatus on purchaseorder.status = accstatus.statusid";
    String whereQuery =
      " where 1=1 and purchaseorder.purchaseorderstatus !=  'Deleted' ";
    String groupByQuery =
      " group by purchaseorder.PurchaseOrderID,purchaseorder.Created,Creator,Entity,purchaseorder.SubTotal,purchaseorder.Tax, purchaseorder.Total ,Status";
    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  purchaseorder.PurchaseOrderID like '%" + strSearch
        + "%'   OR purchaseorder.Created like '%" + strSearch
        + "%' OR concat(individual.firstname,' ',individual.lastname) like  '%"
        + strSearch + "%' OR entity.name like  '%" + strSearch
        + "%' OR purchaseorder.SubTotal like '%" + strSearch
        + "%' OR purchaseorder.Tax like '%" + strSearch
        + "%' OR purchaseorder.Total like '%" + strSearch
        + "%' OR accstatus.title like '%" + strSearch + "%' ";
    }

    String advSearchstr = strSearch;

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

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

      strSearch =
        "create TEMPORARY TABLE purchaseorderlistsearch " + advSearchstr;

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

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

      fromQuery = fromQuery + " ,purchaseorderlistsearch";
      whereQuery =
        whereQuery
        + " AND  purchaseorder.PurchaseOrderID = purchaseorderlistsearch.PurchaseOrderID";
    }

    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 purchaseorderlistsearch");
      cvdl.executeUpdate();
      cvdl.clearParameters();
    }

    cvdl.destroy();

    //System.out.println("colList " +colList);
    if (colList != null)
    {
      Iterator it = colList.iterator();

      int i = 0;

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

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

        int poID = Integer.parseInt((hm.get("PurchaseOrderID")).toString());

        int indID = 0;

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

        int entityID = 0;

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

        Double subTotal = null;

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

        Double tax = null;

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

        Double total = null;

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

        try
        {
          IntMember intPOID =
            new IntMember("PurchaseOrderID", poID, 10, null, 'T', true, 10);
          IntMember intIndID =
            new IntMember("IndividualID", indID, 10, null, 'T', true, 10);
          IntMember intEntityID =
            new IntMember("EntityID", entityID, 10, null, 'T', true, 10);

          DoubleMember dblSubTotal =
            new DoubleMember("SubTotal", subTotal, 10, "", 'T', false, 10);
          DoubleMember dblTax =
            new DoubleMember("Tax", tax, 10, "", 'T', false, 10);
          DoubleMember dblTotal =
            new DoubleMember("Total", total, 10, "", 'T', false, 10);

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

          StringMember strEntity = null;

          if ((hm.get("Entity") != null))
          {
            strEntity =
              new StringMember("Entity", (String) hm.get("Entity"), 10, null,
                'T', true);
          }
          else
          {
            strEntity = new StringMember("Entity", 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);
          }

          PurchaseOrderListElement poListElement =
            new PurchaseOrderListElement(poID);

          poListElement.put("PurchaseOrderID", intPOID);
          poListElement.put("SubTotal", dblSubTotal);
          poListElement.put("Tax", dblTax);
          poListElement.put("Total", dblTotal);
          poListElement.put("Created", date);
          poListElement.put("Entity", strEntity);
          poListElement.put("Status", strStatus);
          poListElement.put("Creator", strCreator);

          poListElement.put("IndividualID", intIndID);
          poListElement.put("EntityID", intEntityID);

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

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

          //e.printStackTrace();
        }
      }
    }

    poList.setTotalNoOfRecords(poList.size());
    poList.setListType("PurchaseOrder");
    poList.setBeginIndex(beginIndex);

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

    return poList;
  }
View Full Code Here


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

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

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

      return this.getPurchaseOrderList(individualID, dl);

    } else {
      PurchaseOrderList 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.getPurchaseOrderList(individualID, hm);
        } catch (Exception e) {
          System.out.println("[Exception][MarketingListEJB] Exception thrown in x: " + e);
        }

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

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

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

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

   */
  public PurchaseOrderList getPurchaseOrderList(int individualID, DisplayList DLparam)
      throws CommunicationException, NamingException
  {

    PurchaseOrderList returnDL = null;
    PurchaseOrderList paramDL = (PurchaseOrderList)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.getPurchaseOrderList(individualID, hm);
    } catch (Exception e) {
      System.out.println("[Exception][MarketingListEJB] Exception thrown in x: " + e);
    }

    returnDL.setListType("PurchaseOrder");
    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 PurchaseOrderList createEmptyObject(PurchaseOrderList list)
  {
    PurchaseOrderList dummy = new PurchaseOrderList();
    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

TOP

Related Classes of com.centraview.account.purchaseorder.PurchaseOrderList

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.