Exemplo n.º 1
0
  public ActionForward getMilestoneDetails(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws AppException {

    ActionForward forward = null;
    WcrForm wcrForm = (WcrForm) form;
    WcrManager wcrManager = new WcrManager();
    CommonManager cmgr = new CommonManager();
    WcrAdd wcrAdd = new WcrAdd();
    String Dt[] = new String[3];

    wcrForm.setVisibility("True");

    wcrAdd.setSowName(wcrForm.getSowName());

    try {
      wcrAdd.setWonNo(wcrForm.getWonNo());
      wcrAdd.setPoNo(wcrForm.getPoNo());

      String[] inParams = {wcrAdd.getSowName()};
      System.out.println("array length" + inParams.length);
      wcrForm.setWonList(cmgr.getDropdownValuesByQuery("wonQuery", inParams));
      String[] inParamsPo = {wcrForm.getWonNo()};
      wcrForm.setPoList(cmgr.getDropdownValuesByQuery("poQuery", inParamsPo));

      Calendar currentDate = Calendar.getInstance();
      SimpleDateFormat formatter = new SimpleDateFormat("dd-MMM-yyyy");
      String dateNow = formatter.format(currentDate.getTime());
      System.out.println("Date ====> " + dateNow);

      int lastDate = currentDate.getActualMaximum(Calendar.DATE);

      System.out.println("lastDate ====> " + lastDate);

      Dt = dateNow.split("-");
      String mnth = Dt[1];
      String year = Dt[2];

      wcrForm.setFromDate("1-" + mnth + "-" + year);
      wcrForm.setToDate(lastDate + "-" + mnth + "-" + year);
      wcrAdd.setWcrRefId(wcrForm.getWcrRefId());
      wcrAdd.setFlowFlag(wcrForm.getFlowFlag());
      wcrForm.setMilestoneDtlsList(wcrManager.getMilestones(wcrAdd, null, null, null));
      wcrForm.setTotalSize(wcrForm.getMilestoneDtlsList().size());
      wcrAdd = wcrManager.getPersonDetails(wcrAdd);

      wcrForm.setPreparedBy(wcrAdd.getPreparedBy());
      wcrForm.setApprovedBy(wcrAdd.getApprovedBy());
      wcrForm.setAuthorisedBy(wcrAdd.getAuthorisedBy());
      wcrForm.setAppByDesig(wcrAdd.getAppByDesig());
      wcrForm.setPrepByDesig(wcrAdd.getPrepByDesig());
      wcrForm.setAuthByDesig(wcrAdd.getAuthByDesig());
      //	wcrForm.setBuList(cmgr.getDropdownValuesByQuery(BuQuery,null));

    } catch (Exception ex) {
      ex.printStackTrace();
    }
    forward = mapping.findForward("WCRjsp");

    return forward;
  }
Exemplo n.º 2
0
  public ActionForward previewWcr(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws AppException {
    ActionForward forward = null;
    CommonManager commonManager = new CommonManager();
    WcrForm wcrForm = (WcrForm) form;
    WcrManager wcrMgr = new WcrManager();
    WcrAdd wcrAdd = new WcrAdd();
    WcrAdd wcrAdd1 = new WcrAdd();

    String poNo = (String) request.getParameter("poNo");
    String wonNo = (String) request.getParameter("wonNo");
    String refId = (String) request.getParameter("refId");

    wcrAdd.setSowName(wcrForm.getSowName());
    wcrAdd.setPoNo(poNo);
    wcrAdd.setWonNo(wonNo);
    wcrAdd.setWcrRefId(Integer.parseInt(refId));

    try {
      wcrForm.setMilestoneDtlsList(wcrMgr.getMilestoneDtlsForPrvw(wcrAdd));
      wcrAdd = wcrMgr.getPersonDetails(wcrAdd);
    } catch (Exception ex) {
      ex.printStackTrace();
    }

    wcrAdd1 = (WcrAdd) wcrForm.getMilestoneDtlsList().get(0);
    wcrForm.setFromDate(wcrAdd1.getFromDate());
    wcrForm.setToDate(wcrAdd1.getToDate());
    wcrForm.setWcrRefId(wcrAdd.getWcrRefId());
    wcrForm.setPreparedBy(wcrAdd.getPreparedBy());
    wcrForm.setApprovedBy(wcrAdd.getApprovedBy());
    wcrForm.setAuthorisedBy(wcrAdd.getAuthorisedBy());
    wcrForm.setAppByDesig(wcrAdd.getAppByDesig());
    wcrForm.setPrepByDesig(wcrAdd.getPrepByDesig());
    wcrForm.setAuthByDesig(wcrAdd.getAuthByDesig());
    wcrForm.setVisibility("False");

    int j = 0;
    double amt = 0;
    NumberFormat nf = NumberFormat.getInstance(Locale.ENGLISH); // ver 1.1
    nf.setGroupingUsed(true); // ver 1.1
    if (wcrForm.getMilestoneDtlsList() != null && wcrForm.getMilestoneDtlsList().size() > 0) {
      for (int i = 0; i < wcrForm.getMilestoneDtlsList().size(); i++) {

        WcrAdd wr = (WcrAdd) wcrForm.getMilestoneDtlsList().get(i);

        wr.setMilestoneAmtFormatted(commonManager.amtWithComma(wr.getMilestoneAmnt()));
        j++;
        amt = amt + Double.parseDouble(wr.getMilestoneAmnt());
      }
      String amount = Double.toString(amt);
      // String Totalamount=commonManager.amtWithComma(amount);
      wcrForm.setTotalAmt(amount);
      System.out.println("size of j" + j);
      wcrForm.setListSize(j);
    }

    forward = mapping.findForward("wcrPreviewjsp");
    return forward;
  }