public ActionForward showWcr( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws AppException { ActionForward forward = null; WcrForm wcrForm = (WcrForm) form; WcrManager wcrManager = new WcrManager(); wcrForm.reset(); try { wcrForm.setWcrRefId(wcrManager.getWcrId()); System.out.println("WCR REF ID ==>" + wcrForm.getWcrRefId()); } catch (Exception ex) { ex.printStackTrace(); } forward = mapping.findForward("WCRjsp"); return forward; }
public ActionForward getWcrDetailsForInvoice( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws AppException { ActionForward forward = null; WcrForm wcrForm = (WcrForm) form; WcrAdd wcrAdd = new WcrAdd(); WcrManager wcrMgr = new WcrManager(); CommonManager cmgr = new CommonManager(); String flag = "S"; String mode = wcrForm.getMode(); wcrAdd.setInvoiceMode("Billed"); String buttonFlag = wcrForm.getButtonFlag(); wcrAdd.setButtonFlag(buttonFlag); System.out.println(wcrForm.getMode()); wcrAdd.setSowName(wcrForm.getSowName()); wcrAdd.setWonNo(wcrForm.getWonNo()); wcrAdd.setPoNo(wcrForm.getPoNo()); if (!(wcrAdd.getWonNo().equals("")) && !(wcrAdd.getPoNo().equals(""))) { flag = "SWP"; } else if ((wcrAdd.getPoNo().equals("") && !(wcrAdd.getWonNo().equals("")))) { flag = "SW"; } try { wcrForm.setWcrDetailsList(wcrMgr.getWcrDetails(wcrAdd, flag)); wcrForm.setTotalSize(wcrForm.getWcrDetailsList().size()); } catch (Exception ex) { ex.printStackTrace(); } if ("SWP".equalsIgnoreCase(flag)) { 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)); } else if ("SW".equalsIgnoreCase(flag)) { String[] inParams = {wcrAdd.getSowName()}; System.out.println("array length" + inParams.length); wcrForm.setWonList(cmgr.getDropdownValuesByQuery("wonQuery", inParams)); } wcrForm.setVisibility("true"); wcrForm.setDisplayFlag(""); forward = mapping.findForward("BilledWCRJsp"); return forward; }
public ActionForward setBilledWcr( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws AppException { ActionForward forward = null; WcrForm wcrForm = (WcrForm) form; WcrManager wcrManager = new WcrManager(); List list = new ArrayList(); String key = "Wcr.billedQuery"; String maxLimit = request.getParameter("maxCount"); String maxListLimit[] = maxLimit.split(","); wcrForm.setMode("Billed"); try { List dataList = retainFormFieldsforBillingWCR(request); int count[] = wcrManager.setBilledWcr(key, dataList); for (int i = 0; i < count.length; i++) { if (maxListLimit[i] == null) { maxListLimit[i] = "0"; } else if (maxListLimit[i].equalsIgnoreCase("")) maxListLimit[i] = "0"; WcrAdd wcrAdd = (WcrAdd) wcrForm.getWcrDetailsList().get(Integer.parseInt(maxListLimit[i])); if (count[i] != 0) { wcrAdd.setBilledFlag("Billed Successfully"); } else { wcrAdd.setBilledFlag("Billed Unsuccessfully"); } list.add(wcrAdd); } wcrForm.setWcrDetailsList(list); } catch (Exception e) { e.printStackTrace(); } wcrForm.setDisplayFlag("display"); forward = mapping.findForward("BilledWCRJsp"); return forward; }
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; }
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; }
// 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; }