Package com.centraview.sale.salefacade

Examples of com.centraview.sale.salefacade.SaleFacade


  private void setSaleLists()
  {
    try {
      SaleFacadeHome cfh = (SaleFacadeHome)CVUtility.getHomeObject(
          "com.centraview.sale.salefacade.SaleFacadeHome", "SaleFacade");
      SaleFacade remote = cfh.create();
      remote.setDataSource(this.dataSource);

      allSaleStatus = remote.getAllStatus();
      allSaleStage = remote.getAllStage();
      allSaleType = remote.getAllType();
      allSaleProbability = remote.getAllProbability();
      allSaleTerm = remote.getAllTerm();
    } catch (Exception e) {
      logger.error("[setSaleLists] Exception thrown.", e);
    }
  }
View Full Code Here


        if (opportunityID != null && !(opportunityID.equals(""))) {
          int oppID = Integer.parseInt(opportunityID);
          SaleFacadeHome saleFacade = (SaleFacadeHome)CVUtility.getHomeObject(
              "com.centraview.sale.salefacade.SaleFacadeHome", "SaleFacade");
          SaleFacade remote = saleFacade.create();
          remote.setDataSource(dataSource);

          HashMap relatedOpportunityInfo = remote.getOpportunityRelatedInfo(individualID, oppID);

          if (relatedOpportunityInfo != null && relatedOpportunityInfo.size() != 0) {
            String title = (String)relatedOpportunityInfo.get("Title");
            if (title != null && !title.equals("") && !title.equals("NULL")) {
              activityForm.setActivityRelatedFieldValue(title);
View Full Code Here

   
    // opportunity

    ArrayList opportunityDisplayList = new ArrayList();
    // ask the EJB layer to give us a list of relevant TASK VO's
    SaleFacade saleFacade = null;
    try {
      saleFacade = (SaleFacade)CVUtility.setupEJB("SaleFacade",
          "com.centraview.sale.salefacade.SaleFacadeHome", dataSource);
    } catch (Exception e) {
      logger.error("[execute] Exception thrown.", e);
      throw new ServletException(e);
    }
    ArrayList opportunityList = saleFacade.getInterestingOpportunityList(individualId);

    for (int i = 0; i < opportunityList.size(); i++) {
      OpportunityVO opportunity = (OpportunityVO)opportunityList.get(i);
      // somehow a null opportunity can make it's way onto this list, so
      // quick and dirty fix is to check that here.
View Full Code Here

    String dataSource = Settings.getInstance().getSiteInfo(CVUtility.getHostName(super.getServlet().getServletContext())).getDataSource();

    try {
      HttpSession session = request.getSession(true);
      SaleFacadeHome salesFacadeHome = (SaleFacadeHome) CVUtility.getHomeObject("com.centraview.sale.salefacade.SaleFacadeHome", "SaleFacade");
      SaleFacade remote = salesFacadeHome.create();
      remote.setDataSource(dataSource);

      String typeofoperation = SaleConstantKeys.ADD;
      if (request.getParameter(SaleConstantKeys.TYPEOFOPERATION) != null) {
        typeofoperation = request.getParameter(SaleConstantKeys.TYPEOFOPERATION);
      } else if (request.getAttribute(SaleConstantKeys.TYPEOFOPERATION) != null) {
        typeofoperation = (String) request.getAttribute(SaleConstantKeys.TYPEOFOPERATION);
      }

      OpportunityForm opportunityForm = (OpportunityForm) form;

      OpportunityVO opportunityVO = new OpportunityVO();
      ActivityVO activityVO = new ActivityVO();
      activityVO.setStatus(Integer.parseInt(opportunityForm.getStatusid()));
      activityVO.setTitle(opportunityForm.getTitle());
      activityVO.setActivityDetails(opportunityForm.getDescription());

      int ownerId = ((UserObject) session.getAttribute("userobject")).getIndividualID();

      activityVO.setCreatedBy(ownerId);
      activityVO.setOwner(ownerId);
      activityVO.setActivityID(Integer.parseInt(opportunityForm.getActivityid()));
      opportunityVO.setActivityVO(activityVO);
      opportunityVO.setTitle(opportunityForm.getTitle());
      opportunityVO.setDescription(opportunityForm.getDescription());
      opportunityVO.setEntityID(Integer.parseInt(opportunityForm.getEntityid()));
      opportunityVO.setIndividualID(Integer.parseInt(opportunityForm.getIndividualid()));
      opportunityVO.setOpportunityTypeID(Integer.parseInt(opportunityForm.getOpportunitytypeid()));
      opportunityVO.setStatusID(Integer.parseInt(opportunityForm.getStatusid()));
      opportunityVO.setStageID(Integer.parseInt(opportunityForm.getStageid()));
      String Totalamount = opportunityForm.getTotalamount();
      if (Totalamount != null) {
        Totalamount = Totalamount.replaceAll(" ", "");//remove empty spaces
        NumberFormat nf = NumberFormat.getInstance();       
        Totalamount = nf.parse(Totalamount).toString();
      }
      opportunityVO.setActualAmount(Float.parseFloat(Totalamount));
      opportunityVO.setProbability(Integer.parseInt(opportunityForm.getProbabilityid()));
      opportunityVO.setForecastedAmount(Float.parseFloat(Totalamount));
      opportunityVO.setSourceID(Integer.parseInt(opportunityForm.getSourceid()));
      opportunityVO.setSource(opportunityForm.getSourcename());
      opportunityVO.setAcctMgr(Integer.parseInt(opportunityForm.getAcctmgrid()));
      opportunityVO.setAcctTeam(Integer.parseInt(opportunityForm.getAcctteamid()));
      if ((opportunityForm.getEstimatedclosemonth() != null) && (opportunityForm.getEstimatedcloseday() != null)
          && (opportunityForm.getEstimatedcloseyear() != null)) {
        String estimatedclosemonth = opportunityForm.getEstimatedclosemonth();
        String estimatedcloseday = opportunityForm.getEstimatedcloseday();
        String estimatedcloseyear = opportunityForm.getEstimatedcloseyear();
        try {
          int estimatedclosemonth1 = Integer.parseInt(estimatedclosemonth);
          int estimatedcloseday1 = Integer.parseInt(estimatedcloseday);
          int estimatedcloseyear1 = Integer.parseInt(estimatedcloseyear);
          Calendar estimatedClose = new GregorianCalendar();
          estimatedClose.set(estimatedcloseyear1, estimatedclosemonth1 - 1, estimatedcloseday1);
          opportunityVO.setEstimatedClose(new Timestamp(estimatedClose.getTimeInMillis()));
        } catch (NumberFormatException nfe) {
          logger.info("[execute]: blank date fields");
        } catch (Exception e) {
          logger.error("[execute]: Exception");
        }
      }

      if (typeofoperation.equals(SaleConstantKeys.ADD)) {
        remote.addOpportunity(ownerId, opportunityVO);
      } else if (typeofoperation.equals(SaleConstantKeys.EDIT)) {
        String opportunityid = request.getParameter("opportunityid");

        if ((opportunityForm.getActualclosemonth() != null) && (opportunityForm.getActualcloseday() != null)
            && (opportunityForm.getActualcloseyear() != null)) {
          String actualclosemonth = opportunityForm.getActualclosemonth();
          String actualcloseday = opportunityForm.getActualcloseday();
          String actualcloseyear = opportunityForm.getActualcloseyear();

          try {
            int actualclosemonth1 = Integer.parseInt(actualclosemonth);
            int actualcloseday1 = Integer.parseInt(actualcloseday);
            int actualcloseyear1 = Integer.parseInt(actualcloseyear);
            Calendar actualClose = new GregorianCalendar(actualcloseyear1, actualclosemonth1 - 1, actualcloseday1);
            opportunityVO.setActualclose(new Timestamp(actualClose.getTimeInMillis()));
          } catch (NumberFormatException nfe) {
            logger.info("[execute]: blank date fields");
          } catch (Exception e) {
            logger.error("[execute]: Exception", e);
          }
        }
        opportunityVO.setOpportunityID(Integer.parseInt(opportunityid));
        request.setAttribute("recordID", new Integer(opportunityVO.getOpportunityID()).toString());
        request.setAttribute("recordName", opportunityVO.getTitle());
        request.setAttribute("OPPORTUNITYID", new Integer(opportunityVO.getOpportunityID()));
        remote.updateOpportunity(ownerId, opportunityVO);
      }
      request.setAttribute(SaleConstantKeys.CURRENTTAB, SaleConstantKeys.DETAIL);
      request.setAttribute(SaleConstantKeys.TYPEOFOPERATION, SaleConstantKeys.ADD);
      request.setAttribute(SaleConstantKeys.WINDOWID, "1");
      if (request.getParameter("closeornew").equals("close")) {
View Full Code Here

    //DynaActionForm dynaform = (DynaActionForm)form;
    SaleFacadeHome sfh = (SaleFacadeHome)
        CVUtility.getHomeObject("com.centraview.sale.salefacade.SaleFacadeHome", "SaleFacade");
    try
    {
      SaleFacade remote =(SaleFacade) sfh.create();
      remote.setDataSource(dataSource);

      int billingAddressID = 0;
      int jurisdictionID = 0;
      if(proposallistform.getBillingaddressid() != null && !((proposallistform.getBillingaddressid()).equals(""))){
        billingAddressID = Integer.parseInt(proposallistform.getBillingaddressid());
      }//end of if(proposallistform.getBillingaddressid() != null && !((proposallistform.getBillingaddressid()).equals("")))
      jurisdictionID = proposallistform.getJurisdictionID();
      if(billingAddressID != 0 && jurisdictionID != 0){
        remote.setJurisdictionForAddress(billingAddressID,jurisdictionID);
      }//end of if(billingAddressID != 0 && jurisdictionID != 0)


      remote.updateProposal(individualID, proposallistform);
    } //end of try block
    catch(Exception e)
    {
      logger.error("[Exception] UpdateProposal.updateList ", e);
    } //end of catch block (Exception)
View Full Code Here

      ProposalListForm proposallistform = (ProposalListForm) form;
      proposallistform.convertItemLines();

      SaleFacadeHome sfh = (SaleFacadeHome) CVUtility.getHomeObject("com.centraview.sale.salefacade.SaleFacadeHome",
          "SaleFacade");
      SaleFacade remote = (SaleFacade) sfh.create();
      remote.setDataSource(dataSource);

      HashMap hm = (HashMap) remote.viewProposal(individualID, row, proposallistform);
      itemLines = (ItemLines) hm.get("itemLines");
      java.util.Set listkey = itemLines.keySet();
      java.util.Iterator it = listkey.iterator();

      int opportunityID = Integer.parseInt(proposallistform.getOpportunityid());

    OpportunityVO opportunityVO  = remote.getOpportunity(individualID, opportunityID);
    if(opportunityVO != null){
    proposallistform.setOpportunity(opportunityVO.getTitle());
    proposallistform.setEntityID(opportunityVO.getEntityID());
    proposallistform.setEntity(opportunityVO.getEntityname());
    }
View Full Code Here

      int individualID = userObject.getIndividualID();

      OpportunityForm oForm = (OpportunityForm)form;

      SaleFacadeHome saleFacade = (SaleFacadeHome)CVUtility.getHomeObject("com.centraview.sale.salefacade.SaleFacadeHome","SaleFacade");
      SaleFacade remote = (SaleFacade)saleFacade.create();
      remote.setDataSource(dataSource);

      // Check the session for an existing error message (possibly from the delete handler)
      ActionErrors allErrors = (ActionErrors)session.getAttribute("listErrorMessage");
      if (allErrors != null) {
        saveErrors(request, allErrors);
        session.removeAttribute("listErrorMessage");
      }
     
      // set the VO from form bean data
      // set the opportunityVO
      String opportunityID = request.getParameter("OPPORTUNITYID");
      if (opportunityID == null) {
        if (request.getAttribute("OPPORTUNITYID") != null) {
          opportunityID = ((Integer) request.getAttribute("OPPORTUNITYID")).toString();
        }else if (request.getParameter("rowId") != null){
          opportunityID = request.getParameter("rowId");
        }else if (request.getParameter("activityId") != null){
          String activityID = request.getParameter("activityId");
          if (activityID != null && !(activityID.equals(""))) {
            opportunityID = remote.getOpportunityID(Integer.parseInt(activityID));
          }
        }
      }
     
      if (opportunityID == null || opportunityID.trim().length() == 0) {
        opportunityID = "0";
      }

     
      session.setAttribute("rowID", opportunityID);
     
      OpportunityVO oVO = remote.getOpportunity(individualID, Integer.parseInt(opportunityID));

      oForm.setOpportunityid(new Integer(oVO.getOpportunityID()).toString());
      request.setAttribute("recordID", new Integer(oVO.getOpportunityID()).toString());
      request.setAttribute("recordId", String.valueOf(opportunityID));
      request.setAttribute("recordName", java.net.URLEncoder.encode(oVO.getTitle(), "ISO-8859-1"));
View Full Code Here

   
    String rowId[] = request.getParameterValues("rowId");
    SaleFacadeHome saleFacadeHome = (SaleFacadeHome)CVUtility.getHomeObject("com.centraview.sale.salefacade.SaleFacadeHome","SaleFacade");
    try
    {
      SaleFacade remote = (SaleFacade)saleFacadeHome.create();
      remote.setDataSource(dataSource);
      for (int i=0; i<rowId.length; i++)
      {
        if(rowId[i] != null && !rowId[i].equals(""))
        {         
          int elementId = Integer.parseInt(rowId[i]);
          try
          {
            remote.deleteProposal(individualId, elementId);
          } catch(AuthorizationFailedException ae) {
            String errorMessage = ae.getExceptionDescription();
            deleteLog.add(errorMessage);
          }
        }
View Full Code Here

      }catch (Exception ex){
        row = Integer.parseInt(proposallistform.getProposalid());
      }

      SaleFacadeHome sfh = (SaleFacadeHome) CVUtility.getHomeObject("com.centraview.sale.salefacade.SaleFacadeHome","SaleFacade");
      SaleFacade remote =(SaleFacade) sfh.create();
      remote.setDataSource(dataSource);

      HashMap hm  = (HashMap) remote.viewProposal(individualID, row , proposallistform);

      String Items = "";


      String subTotal = "0.00";
      String sTax = "0.00";
      String total = "0.00";

      ItemLines itemLines = (ItemLines) hm.get("itemLines");

      if (itemLines != null)
      {
        itemLines.calculate();
        DecimalFormat currencyFormat = new DecimalFormat("#,##0.00");
        DecimalFormat rawCurrencyFormat = new DecimalFormat("#0.00");
        DecimalFormat wholeNumberFormat = new DecimalFormat("#0");

        java.util.Set listkey = itemLines.keySet();
        java.util.Iterator it =  listkey.iterator();

        int i=1;
        int itemNum = 0;

        if(!it.hasNext()){
          Items = Items + "<tr>\n";
          Items = Items + "<td colspan=\"5\" align=\"center\">No items found</td>\n";
          Items = Items + "</tr>\n";
        }
        while (it.hasNext())
        {
          ItemElement ele  = (ItemElement)itemLines.get(it.next());
          String lineStatus = ele.getLineStatus();
          if (lineStatus == null)
          {
            lineStatus = "";
          } //end of if statement (lineStatus == null)

               if (!lineStatus.equals("Deleted")) {

          IntMember lineid = (IntMember)ele.get("LineId");
          IntMember itemid = (IntMember)ele.get("ItemId");
          StringMember sku = (StringMember)ele.get("SKU");
          IntMember qty   = (IntMember)ele.get("Quantity");
          FloatMember priceEach = (FloatMember)ele.get("Price");
          FloatMember priceExe = (FloatMember)ele.get("PriceExtended");

          StringMember desc  = (StringMember)ele.get("Description");
          FloatMember taxAmount = (FloatMember)ele.get("TaxAmount");

          String quantity;
          String priceEachString;
          try
          {
            float tempFloat = (currencyFormat.parse(qty.getDisplayString())).floatValue();
            quantity = wholeNumberFormat.format(new Float(tempFloat));
          } //end of try block
          catch (Exception exception)
          {
            quantity = "0";
          } //end of catch block (Exception)

          try
          {
            float priceEachValue = ((Float) priceEach.getMemberValue()).floatValue();
            priceEachString = rawCurrencyFormat.format(new Float(priceEachValue));
          } //end of try block
          catch (Exception exception)
          {
            priceEachString = "0.00";
          } //end of catch block (Exception)


          Items = Items + "<tr>\n";
          Items = Items + "<td width=\"15%\">&nbsp;"+sku.getDisplayString()+"</td>\n";
          Items = Items + "<td width=\"40%\">&nbsp;"+desc.getDisplayString()+"</td>\n";
          Items = Items + "<td width=\"15%\">&nbsp;"+quantity+"</td>\n";
          Items = Items + "<td width=\"15%\" align=\"right\">&nbsp;$"+priceEachString+"</td>\n";
          Items = Items + "<td width=\"15%\" align=\"right\">&nbsp;$"+priceExe.getDisplayString()+"</td>\n";
          Items = Items + "</tr>\n";
               }
        }//end of while


        String totalItems;
        try
        {
          totalItems = wholeNumberFormat.format(new Float(itemLines.getTotalItems()));
        } //end of try block
        catch (Exception exception)
        {
          totalItems = "0";
        }

        try
        {
          subTotal = currencyFormat.format(new Float(itemLines.getSubtotal()));
        } //end of try block
        catch (Exception exception)
        {
          subTotal = "0.00";
        } //end of catch block (Exception)


        try
        {
          sTax = currencyFormat.format(new Float(itemLines.getTax()));
        } //end of try block
        catch (Exception exception)
        {
          sTax = "0.00";
        } //end of catch block (Exception)


        try
        {
          total = currencyFormat.format(new Float(itemLines.getTotal()));
        } //end of try block
        catch (Exception exception)
        {
          total = "0.00";
        } //end of catch block (Exception)

      }




      proposallistform = (ProposalListForm) hm.get("dyna");
      if (hm.get("itemLines") != null){
        proposallistform.setItemLines((ItemLines)hm.get("itemLines"));
      }
      int iOpportunityId;
      iOpportunityId = Integer.parseInt(proposallistform.getOpportunityid());

      OpportunityVO opportunityVO  = remote.getOpportunity(individualID, iOpportunityId);
      OpportunityForm opportunityForm = new OpportunityForm();

      PrintTemplateHome PTHome = (PrintTemplateHome)CVUtility.getHomeObject("com.centraview.printtemplate.PrintTemplateHome", "Printtemplate");
      PrintTemplate PTRemote = PTHome.create();
      PTRemote.setDataSource(dataSource);
View Full Code Here

      int individualID = userObject.getIndividualID();
      int opportunityid = Integer.parseInt(request.getParameter("opportunityid"));
     
      SaleFacadeHome aa = (SaleFacadeHome)
        CVUtility.getHomeObject("com.centraview.sale.salefacade.SaleFacadeHome", "SaleFacade");
      SaleFacade remote = (SaleFacade) aa.create();
      remote.setDataSource(dataSource);
      String closeornew = request.getParameter("closeornew");

      String pathParameter = null;
      try
      {
        int result = remote.deleteOpportunity(individualID, opportunityid);
        if(result == -2){
            ActionErrors allErrors = new ActionErrors();
            allErrors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("error.freeForm", "You have to delete first one or more associated proposal."));
            session.setAttribute("listErrorMessage", allErrors);
            FORWARD_final = FORWARD_ViewOpportunity;
View Full Code Here

TOP

Related Classes of com.centraview.sale.salefacade.SaleFacade

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.