Ejemplo n.º 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;
  }
Ejemplo n.º 2
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;
  }