Package com.centraview.sale.opportunity

Examples of com.centraview.sale.opportunity.OpportunityVO


      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.
      if (CVUtility.notEmpty(opportunity)) {
        String requestURL = "/sales/view_opportunity.do?TYPEOFOPERATION=EDIT&rowId=";
        requestURL += opportunity.getOpportunityID();
        HomeDisplayItem item = new HomeDisplayItem();
        item.setTitle(opportunity.getTitle());
        item.setUrl(requestURL);
        item.setRelatedTitle(opportunity.getEntityname());
        item.setRelatedId(opportunity.getEntityID());
        item.setIcon("icon_sale.gif");
        opportunityDisplayList.add(item);
      }
    }
    request.setAttribute("opportunityDisplayList", opportunityDisplayList);
View Full Code Here


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

      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());
    }
   
    AccountFacadeHome accountFacadeHome = (AccountFacadeHome)CVUtility.getHomeObject("com.centraview.account.accountfacade.AccountFacadeHome","AccountFacade");
    AccountFacade accountFacade =(AccountFacade)accountFacadeHome.create();
    accountFacade.setDataSource(dataSource);
View Full Code Here

    try {
      SaleFacade remote = mfh.create();
      remote.setDataSource(dataSource);

      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());
      activityVO.setCreatedBy(ownerId);
      activityVO.setOwner(ownerId);

      opportunityVO.setActivityVO(activityVO);
      opportunityVO.setTitle(opportunityForm.getTitle());
      opportunityVO.setDescription(opportunityForm.getDescription());

      int entityIdInt = 0;
      String entityId = opportunityForm.getEntityid();
      try {
        entityIdInt = Integer.parseInt(entityId);
      } catch (NumberFormatException nfe) {}

      if (entityIdInt <= 0) {
        allErrors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(
            "error.general.requiredField", "Entity"));
      }

      opportunityVO.setEntityID(entityIdInt);

      if (!opportunityForm.getIndividualid().trim().equals("")) {
        opportunityVO.setIndividualID(Integer.parseInt(opportunityForm.getIndividualid()));
      }

      opportunityVO.setOpportunityTypeID(Integer.parseInt(opportunityForm.getOpportunitytypeid()));
      opportunityVO.setStatusID(Integer.parseInt(opportunityForm.getStatusid()));
      opportunityVO.setStageID(Integer.parseInt(opportunityForm.getStageid()));

      if (!opportunityForm.getTotalamount().trim().equals("")) {
        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));
      }

      String ForecastedAmount = opportunityForm.getForecastedamount();
      if (ForecastedAmount != null) {
        ForecastedAmount = ForecastedAmount.replaceAll(" ", "");// remove empty
                                                                // spaces
        NumberFormat nf = NumberFormat.getInstance();
        ForecastedAmount = nf.parse(ForecastedAmount).toString();
      }
      opportunityVO.setForecastedAmount(Float.parseFloat(ForecastedAmount));
      opportunityVO.setProbability(Integer.parseInt(opportunityForm.getProbabilityid()));

      if ((opportunityForm.getSourceid() != null)
          && ((opportunityForm.getSourceid()).length() > 0)) {
        opportunityVO.setSourceID(Integer.parseInt(opportunityForm.getSourceid()));
      }
      opportunityVO.setSource(opportunityForm.getSourcename());

      if (opportunityForm.getAcctmgrid() != null
          && !opportunityForm.getAcctmgrid().trim().equals("")
          && !opportunityForm.getAcctmgrid().trim().equals("0")) {
        opportunityVO.setAcctMgr(Integer.parseInt(opportunityForm.getAcctmgrid()));
      } else {
        opportunityVO.setAcctMgr(ownerId);
      }

      if (!opportunityForm.getAcctteamid().trim().equals("")) {
        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 {
          Timestamp eClose = DateUtility.createTimestamp(estimatedcloseyear, estimatedclosemonth,
              estimatedcloseday);
          opportunityVO.setEstimatedClose(eClose);
        } catch (Exception e) {
          logger.error("[execute]: Exception", e);
        }
      }
View Full Code Here

      }

     
      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"));
     
     
      oForm.setTitle(oVO.getTitle());
      String description = oVO.getDescription();
      oForm.setDescription(description);
      oForm.setEntityid(new Integer(oVO.getEntityID()).toString());
      oForm.setEntityname(oVO.getEntityname());
      request.setAttribute("parentId", String.valueOf(oVO.getEntityID()));
      request.setAttribute("parentName", java.net.URLEncoder.encode(oVO.getEntityname(), "ISO-8859-1"));
      oForm.setIndividualid(new Integer(oVO.getIndividualID()).toString());
      oForm.setIndividualname(oVO.getIndividualname());
      oForm.setAcctmgrid(new Integer(oVO.getAcctMgr()).toString());
      oForm.setAcctmgrname(oVO.getManagerName());
      oForm.setAcctteamid(new Integer(oVO.getAcctTeam()).toString());
      oForm.setAcctteamname(oVO.getTeamName());
      oForm.setSourceid(new Integer(oVO.getSourceID()).toString());
      oForm.setStageid(new Integer(oVO.getStageID()).toString());
      oForm.setStatusid(new Integer(oVO.getStatusID()).toString());
      oForm.setSourcename(oVO.getSource());
     
      if (oVO.getEstimatedClose() != null) {
        Timestamp date = (Timestamp)oVO.getEstimatedClose();
        String strMonth = String.valueOf(date.getMonth() + 1);
        String strDay = String.valueOf(date.getDate());
        String strYear = String.valueOf(date.getYear() + 1900);
        oForm.setEstimatedcloseday(strDay);
        oForm.setEstimatedclosemonth(strMonth);
        oForm.setEstimatedcloseyear(strYear);
      }
     
      if (oVO.getActualclose() != null) {
        Timestamp date = (Timestamp)oVO.getActualclose();
        String strMonth = String.valueOf(date.getMonth() + 1);
        String strDay = String.valueOf(date.getDate());
        String strYear = String.valueOf(date.getYear() + 1900);
        oForm.setActualcloseday(strDay);
        oForm.setActualclosemonth(strMonth);
        oForm.setActualcloseyear(strYear);
      }
     
      oForm.setOpportunitytypeid((new Integer(oVO.getOpportunityTypeID())).toString());
      oForm.setProbabilityid((new Integer(oVO.getProbability())).toString());
      DecimalFormat currencyFormat = new DecimalFormat("###,###,##0.00");
      String actualAmount = currencyFormat.format(oVO.getActualAmount());
      oForm.setTotalamount(actualAmount);
     
      String forecast = currencyFormat.format(oVO.getForecastedAmount());
      oForm.setForecastedamount(forecast);
     
      if (oVO.getCreateddate() != null) {
        Timestamp date = (Timestamp)oVO.getCreateddate();
       
        String strMonth = String.valueOf(date.getMonth() + 1);
        String strDay = String.valueOf(date.getDate());
        String strYear = String.valueOf(date.getYear() + 1900);
        String strHours = String.valueOf(date.getHours());
        String strMins = String.valueOf(date.getMinutes());
        int hhmm[] = new int[2];
        hhmm[0] = Integer.parseInt(strHours.trim());
        hhmm[1] = Integer.parseInt(strMins.trim());
        String strTime = CVUtility.convertTime24HrsFormatToStr(hhmm);
        oForm.setCreateddate(strMonth + "/" + strDay + "/" + strYear + " - " + strTime + " ");
      }
     
      if (oVO.getModifieddate() != null) {
        Timestamp date = (Timestamp)oVO.getModifieddate();
       
        String strMonth = String.valueOf(date.getMonth() + 1);
        String strDay = String.valueOf(date.getDate());
        String strYear = String.valueOf(date.getYear() + 1900);
        String strHours = String.valueOf(date.getHours());
        String strMins = String.valueOf(date.getMinutes());
       
        int hhmm[] = new int[2];
        hhmm[0] = Integer.parseInt(strHours.trim());
        hhmm[1] = Integer.parseInt(strMins.trim());
        String strTime = CVUtility.convertTime24HrsFormatToStr(hhmm);
        oForm.setModifieddate(strMonth + "/" + strDay + "/" + strYear + " - " + strTime + " ");
      }
     
      oForm.setCreatedbyname(oVO.getCreatedbyname());
      oForm.setModifiedbyname(oVO.getModifiedbyname());
      oForm.setActivityid(String.valueOf(oVO.getActivityID()));
     
      ActivityVO activityVO = oVO.getActivityVO();

      form = (ActionForm) oForm;

      request.setAttribute(SaleConstantKeys.CURRENTTAB, SaleConstantKeys.DETAIL);
      request.setAttribute(SaleConstantKeys.TYPEOFOPERATION, SaleConstantKeys.EDIT);
      request.setAttribute(SaleConstantKeys.WINDOWID, newWindowId);
      request.setAttribute("opportunityform", form);
      request.setAttribute("hasproposal",new Boolean(oVO.getHasProposal()));
      request.setAttribute("hasProposalInForcast",new Boolean(oVO.getHasProposalInForcast()));

      if (request.getParameter("Duplicate") != null) {
        if (request.getParameter("Duplicate").equals("true")) {
          FORWARD_final = FORWARD_newOpportunity;
        }else{
View Full Code Here

        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);
     
      PrintTemplateVO ptVO = (PrintTemplateVO)PTRemote.getPrintTemplate(2);

      String proposalCompose = ptVO.getPtData();

      //Setting the Proposal Name
      String title = proposallistform.getProposal();
      if (title == null || title.equals("null"))
      {
        title = "";
      }

      //Setting the Entity Name
      String Company = "";
      if (opportunityVO != null)
      {
        Company = opportunityVO.getEntityname();
        if (Company == null || Company.equals("null"))
        {
          Company = "";
        }
      }

      GlobalMasterLists gml = GlobalMasterLists.getGlobalMasterLists(dataSource);

      Vector termVec = new Vector();
      if (gml.get("AllSaleTerm") != null)
      {
        termVec = (Vector)gml.get("AllSaleTerm");
      }

      Iterator itTerms = termVec.iterator();

      String PaymentTerms = "";

      String paymentTerms = proposallistform.getTerms();
      int termsID = 0 ;

      if (paymentTerms != null )
      {
        termsID = Integer.parseInt(paymentTerms);
      }

      while (itTerms.hasNext())
      {
        DDNameValue nameValue = (DDNameValue) itTerms.next();
        // if name matches, then...
        if (termsID == nameValue.getId())
        {
          // ... get the ID
          PaymentTerms = nameValue.getName();
        }
      }


      String AccountManager = "";
      if (opportunityVO != null)
      {
        AccountManager = opportunityVO.getManagerName();
        if (AccountManager == null || AccountManager.equals("null"))
        {
          AccountManager = "";
        }
      }
View Full Code Here

        proposalListForm.setOpportunity(oppTitle);
        SaleFacade remote = (SaleFacade)sfh.create();
        remote.setDataSource(dataSource);
       
        int opportunityId = (new Integer(oppId)).intValue();
        OpportunityVO oppVO = remote.getOpportunity(individualID, opportunityId);
        proposalListForm.setIndividualid(String.valueOf(oppVO.getIndividualID()));
        proposalListForm.setIndividual(oppVO.getIndividualname());
        proposalListForm.setEntityID(oppVO.getEntityID());
        proposalListForm.setEntity(oppVO.getEntityname());
      }

      AccountFacadeHome accountFacadeHome = (AccountFacadeHome)CVUtility.getHomeObject("com.centraview.account.accountfacade.AccountFacadeHome","AccountFacade");
      AccountFacade accountFacade = (AccountFacade)accountFacadeHome.create();
      accountFacade.setDataSource(dataSource);
View Full Code Here

        proposallistform.setItemLines((ItemLines) hm.get("itemLines"));
        int iOpportunityId;
        iOpportunityId = Integer.parseInt(proposallistform.getOpportunityid());

        // **************** set the opportunity form bean start *************
        OpportunityVO opportunityVO = remote.getOpportunity(individualID, iOpportunityId);
        OpportunityForm opportunityForm = new OpportunityForm();

        if (opportunityVO != null) {
          opportunityForm.setEntityid("" + opportunityVO.getEntityID());
          opportunityForm.setTitle(opportunityVO.getTitle());
          opportunityForm.setDescription(opportunityVO.getDescription());
          opportunityForm.setEntityname(opportunityVO.getEntityname());
          opportunityForm.setOpportunityid(new Integer(opportunityVO.getOpportunityID()).toString());
          opportunityForm.setStatusname(opportunityVO.getStatus());
          opportunityForm.setStagename(opportunityVO.getStage());
          opportunityForm.setOpportunitytypename(opportunityVO.getOpportunityType());
          opportunityForm.setForecastedamount(currencyFormat.format(new Float(opportunityVO.getForecastedAmount())));
          opportunityForm.setAcctmgrname(opportunityVO.getManagerName());
        } // end of if statement (opportunityVO != null)
        request.setAttribute("opportunityForm", opportunityForm);
        session.setAttribute("opportunityForm", opportunityForm);
        // **************** set the opportunity form bean end *************
      } // end of if statement
View Full Code Here

  {
    if (!CVUtility.canPerformRecordOperation(userId, "Opportunities", opportunityId,
        ModuleFieldRightMatrix.VIEW_RIGHT, this.dataSource))
      throw new AuthorizationFailedException("Opportunities - getOpportunity");

    OpportunityVO oVO = null;
    try {
      InitialContext ic = CVUtility.getInitialContext();
      OpportunityLocalHome home = (OpportunityLocalHome)ic.lookup("local/Opportunity");
      OpportunityLocal remote = home.create();
      remote.setDataSource(this.dataSource);
View Full Code Here

        Iterator i = result.iterator();
        while (i.hasNext()) {
          HashMap resultRow = (HashMap)i.next();
          Number opportunityId = (Number)resultRow.get("oppId");
          try {
            OpportunityVO opportunity = opportunityBean.getOpportunity(individualId, opportunityId
                .intValue());
            opportunityList.add(opportunity);
          } catch (AuthorizationFailedException afe) {
            // no reason to completely fail here, it will just be one less thing
            // on our list. dump it in the logs, because it is indicative of an
View Full Code Here

TOP

Related Classes of com.centraview.sale.opportunity.OpportunityVO

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.