public static void deleteSalaryHead(Event event, String salaryHeadId) { System.out.println("****************SubmitClaim Event Called*********"); try { Component applySalaryHeadWindow = event.getTarget(); GenericValue userLogin = (GenericValue) Executions.getCurrent().getDesktop().getSession().getAttribute("userLogin"); GenericDelegator delegator = HrmsInfrastructure.getDelegator(); // GenericDelegator.getGenericDelegator("default"); LocalDispatcher dispatcher = HrmsInfrastructure .getDispatcher(); // GenericDispatcher.getLocalDispatcher("default", delegator); Map submitDelete = null; submitDelete = UtilMisc.toMap("userLogin", userLogin, "salaryHeadId", salaryHeadId); dispatcher.runSync("deleteSalaryHead", submitDelete); Events.postEvent( "onClick$searchButton", applySalaryHeadWindow.getPage().getFellow("searchPanel"), null); Messagebox.show("Salary Head Successfully Deleted", "Success", 1, null); } catch (Exception e) { e.printStackTrace(); } }
public static void EditSalaryHead(Event event) { System.out.println("****************SubmitClaim Event Called*********"); try { Component salaryHeadWindow = event.getTarget(); GenericValue userLogin = (GenericValue) Executions.getCurrent().getDesktop().getSession().getAttribute("userLogin"); GenericDelegator delegator = HrmsInfrastructure.getDelegator(); // GenericDelegator.getGenericDelegator("default"); LocalDispatcher dispatcher = HrmsInfrastructure .getDispatcher(); // GenericDispatcher.getLocalDispatcher("default", delegator); Map submitUpdate = null; String salaryHeadId = (String) ((Textbox) salaryHeadWindow.getFellow("salaryHeadId")).getValue(); String hrName = (String) ((Textbox) salaryHeadWindow.getFellow("applyHrName")).getValue(); Listitem isCrListItem = (Listitem) ((Listbox) salaryHeadWindow.getFellow("applyCredit")).getSelectedItem(); String isCr = (String) isCrListItem.getValue(); Listitem salaryHeadTypeIdListItem = (Listitem) ((Listbox) salaryHeadWindow.getFellow("applySalaryHeadType")).getSelectedItem(); String salaryHeadTypeId = (String) salaryHeadTypeIdListItem.getValue(); /* * String geoId = (String) ((Bandbox) salaryHeadWindow * .getFellow("searchPanel")).getValue(); */ Combobox countryBox = ((Combobox) salaryHeadWindow.getFellow("countrybandbox")); String geoId = (String) (countryBox.getSelectedItem() == null ? countryBox.getValue() : countryBox.getSelectedItem().getValue()); Listitem isTaxableListItem = (Listitem) ((Listbox) salaryHeadWindow.getFellow("applyTaxable")).getSelectedItem(); String isTaxable = (String) isTaxableListItem.getValue(); Listitem isMandatoryListItem = (Listitem) ((Listbox) salaryHeadWindow.getFellow("applyMandatory")).getSelectedItem(); String isMandatory = (String) isMandatoryListItem.getValue(); Listitem currencyUomIdListItem = (Listitem) ((Listbox) salaryHeadWindow.getFellow("applyCurrencyUomId")).getSelectedItem(); String currencyUomId = (String) currencyUomIdListItem.getValue(); Listitem salaryComputationTypeIdListItem = (Listitem) ((Listbox) salaryHeadWindow.getFellow("applyComputationType")).getSelectedItem(); String salaryComputationTypeId = (String) salaryComputationTypeIdListItem.getValue(); submitUpdate = UtilMisc.toMap( "userLogin", userLogin, "salaryHeadId", salaryHeadId, "hrName", hrName, "isCr", isCr, "salaryHeadTypeId", salaryHeadTypeId, "geoId", geoId, "isTaxable", isTaxable, "isMandatory", isMandatory, "currencyUomId", currencyUomId, "salaryComputationTypeId", salaryComputationTypeId); Map<String, Object> result = dispatcher.runSync("updateSalaryHead", submitUpdate); Messagebox messageBox = new Messagebox(); String err = ""; err = (String) result.get("responseMessage"); if (err != null && err.equals("error")) messageBox.show((String) result.get("errorMessage"), "Error", 1, null); else messageBox.show( "Salary Head" + " " + hrName + " " + "Successfully Updated", "Success", 1, null); Events.postEvent( "onClick$searchButton", salaryHeadWindow.getPage().getFellow("searchPanel"), null); } catch (Exception e) { e.printStackTrace(); } }