Example #1
0
  // ver 1.1 starts here
  public ActionForward showPriviewData(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws AppException {
    ActionForward forward = null;

    WcrForm wcrForm = (WcrForm) form;
    int j = 0;
    double amt = 0;
    CommonManager commonManager = new CommonManager();
    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);
        if (wr.getBillingCheck().equalsIgnoreCase("true")) {
          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;
  }
Example #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;
  }
Example #3
0
  // ver 1.1 ends here
  public ActionForward submitWcr(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws AppException {
    CommonManager commonManager = new CommonManager();
    ActionForward forward = null;
    HttpSession session = request.getSession();
    String returnMsg = "Success";
    String user = (String) session.getAttribute("empId");
    WcrForm wcrForm = (WcrForm) form;
    WcrManager wcrManager = new WcrManager();
    WcrAdd wcrAdd = new WcrAdd();

    wcrAdd.setUser(user);
    retainFormFieldsForSubmit(request, wcrForm.getMilestoneDtlsList()); // ver 1.1
    formToEntity(wcrForm, wcrAdd);
    NumberFormat nf = NumberFormat.getInstance(Locale.ENGLISH); // ver 1.1
    nf.setGroupingUsed(true); // ver 1.1

    try {
      returnMsg = wcrManager.submitWCR(wcrAdd);

      System.out.println("returnMsg in action==>" + returnMsg);
      wcrForm.setMsg(returnMsg);

    } catch (Exception ex) {
      ex.printStackTrace();
      // ver 1.1 starts here
      if ("C".equalsIgnoreCase(wcrAdd.getFlowFlag())) {
        forward = mapping.findForward("WCRjsp");
      } else {
        forward = mapping.findForward("EditWcrJsp");
      }
      // ver 1.1 ends here
    }
    // ver 1.1 starts here
    if (wcrForm.getMsg().equalsIgnoreCase("WCR Created Successfully")
        || wcrForm.getMsg().equalsIgnoreCase("WCR Edited Successfully")) {
      int j = 0;
      double amt = 0;

      if (wcrAdd.getMilestoneDtlsList() != null && wcrAdd.getMilestoneDtlsList().size() > 0) {
        for (int i = 0; i < wcrAdd.getMilestoneDtlsList().size(); i++) {

          WcrAdd wr = (WcrAdd) wcrAdd.getMilestoneDtlsList().get(i);
          System.out.println("wr.getBillingCheck()" + wr.getBillingCheck());
          System.out.println("wr.getBillStatus()" + wr.getBillStatus());
          if (wr.getBillingCheck().equalsIgnoreCase("true")
              && wr.getBillStatus().equalsIgnoreCase("on")) {
            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");
    } else {
      // ver 1.1 ends here
      /*if("C".equalsIgnoreCase(wcrAdd.getFlowFlag())){
      	forward=mapping.findForward("WCRjsp");
      } else {
      	forward=mapping.findForward("EditWcrJsp");
      }*/

    } // ver 1.1
    return forward;
  }