private void actionEnableFieldsDates() { if (moRadFilterTypePeriod.isSelected()) { moIntPeriodYear.setEnabled(true); moIntPeriodStart.setEnabled(true); moIntPeriodEnd.setEnabled(true); moDateDateStart.setEnabled(false); moDateDateEnd.setEnabled(false); moPanelHrsFilterPayrollStatus.setSelectedAll(); } else if (moRadFilterTypeDate.isSelected() || moRadFilterTypeDatePay.isSelected()) { moIntPeriodYear.setEnabled(false); moIntPeriodStart.setEnabled(false); moIntPeriodEnd.setEnabled(false); moDateDateStart.setEnabled(true); moDateDateEnd.setEnabled(true); if (moRadFilterTypeDatePay.isSelected()) { moPanelHrsFilterPayrollStatus.setSelectedClose(); } else { moPanelHrsFilterPayrollStatus.setSelectedAll(); } } }
@Override public void createParamsMap() { SDataBizPartner bizPartnerCompany = null; String sSqlWhere = ""; String sSqlInnerIssue = ""; String sDepartamentsId = ""; String sDepartamentsName = ""; int payrollStatus = (int) moPanelHrsFilterPayrollStatus.getValue(SLibConsts.UNDEFINED); bizPartnerCompany = new SDataBizPartner(); bizPartnerCompany.read( new int[] {((SClientInterface) miClient).getSessionXXX().getCompany().getPkCompanyId()}, miClient.getSession().getStatement()); sDepartamentsId = (String) moPanelHrsDepartaments.getValue(SGuiConsts.PARAM_KEY); sDepartamentsName = (String) moPanelHrsDepartaments.getValue(SGuiConsts.PARAM_ITEM); moParamsMap = miClient.createReportParams(); sSqlWhere += moKeyEmployee.getSelectedIndex() > 0 ? " AND emp.id_emp = " + moKeyEmployee.getValue()[0] : ""; sSqlWhere += moKeyPaymentType.getSelectedIndex() > 0 ? " AND p.fk_tp_pay = " + moKeyPaymentType.getValue()[0] : ""; sSqlWhere += sDepartamentsId.isEmpty() ? "" : " AND dep.id_dep IN(" + sDepartamentsId + ") "; if (payrollStatus != SPanelHrsFilterPayrollStatus.STATUS_UNDEF) { if (payrollStatus == SPanelHrsFilterPayrollStatus.STATUS_CLOSE) { sSqlWhere += " AND p.b_clo = 1 "; } else if (payrollStatus == SPanelHrsFilterPayrollStatus.STATUS_OPEN) { sSqlWhere += " AND p.b_clo = 0 "; } } if (moRadFilterTypeDatePay.isSelected()) { sSqlInnerIssue = "INNER JOIN hrs_pay_rcp_iss AS rcp_iss ON rcp_iss.id_pay = rcp.id_pay AND rcp_iss.id_emp = rcp.id_emp "; } moParamsMap.put( "sTitle", "REPORTE DE PERCEPCIONES Y DEDUCCIONES" + (moRadIsSummary.isSelected() ? " (RESUMEN)" : " (DETALLE)")); if (moRadFilterTypePeriod.isSelected()) { moParamsMap.put("bByPeriod", true); moParamsMap.put("nPeriodYear", moIntPeriodYear.getValue()); moParamsMap.put("nPeriodStart", moIntPeriodStart.getValue()); moParamsMap.put("nPeriodEnd", moIntPeriodEnd.getValue()); sSqlWhere += " AND p.per_year = " + moIntPeriodYear.getValue() + " AND p.per BETWEEN " + moIntPeriodStart.getValue() + " AND " + moIntPeriodEnd.getValue() + " "; } else if (moRadFilterTypeDate.isSelected()) { moParamsMap.put("bByPeriod", false); moParamsMap.put("tDateStart", moDateDateStart.getValue()); moParamsMap.put("tDateEnd", moDateDateEnd.getValue()); sSqlWhere += " AND p.dt_sta >= '" + SLibUtils.DbmsDateFormatDate.format(moDateDateStart.getValue()) + "' AND p.dt_end <= '" + SLibUtils.DbmsDateFormatDate.format(moDateDateEnd.getValue()) + "' "; } else if (moRadFilterTypeDatePay.isSelected()) { moParamsMap.put("bByPeriod", false); moParamsMap.put("tDateStart", moDateDateStart.getValue()); moParamsMap.put("tDateEnd", moDateDateEnd.getValue()); sSqlWhere += "AND rcp_iss.dt_pay BETWEEN '" + SLibUtils.DbmsDateFormatDate.format(moDateDateStart.getValue()) + "' AND '" + SLibUtils.DbmsDateFormatDate.format(moDateDateEnd.getValue()) + "' AND rcp_iss.b_del = 0 AND rcp_iss.fk_st_rcp <> " + SModSysConsts.TRNS_ST_DPS_ANNULED + " "; } moParamsMap.put( "RegistroPatronal", ((SClientInterface) miClient).getSessionXXX().getParamsCompany().getRegistrySs()); moParamsMap.put("sEmiRfc", bizPartnerCompany.getFiscalId()); moParamsMap.put( "sEmployee", moKeyEmployee.getSelectedIndex() > 0 ? moKeyEmployee.getSelectedItem() : "(TODOS)"); moParamsMap.put( "sEarning", !moKeyEarning.isEnabled() ? "(TODAS)" : moKeyEarning.getSelectedIndex() > 0 ? moKeyEarning.getSelectedItem() : "(TODAS)"); moParamsMap.put( "sDeduction", !moKeyDeduction.isEnabled() ? "(TODAS)" : moKeyDeduction.getSelectedIndex() > 0 ? moKeyDeduction.getSelectedItem() : "(TODAS)"); moParamsMap.put( "sPaymentType", moKeyPaymentType.getSelectedIndex() > 0 ? moKeyPaymentType.getSelectedItem() : "(TODOS)"); moParamsMap.put( "sDepartaments", sDepartamentsName.isEmpty() || (boolean) moPanelHrsDepartaments.getValue(SGuiConsts.PARAM_ROWS) ? "(TODOS)" : sDepartamentsName + " "); moParamsMap.put("bIsEarDedOnly", moRadReportTypeEarDed.isSelected()); moParamsMap.put("bIsSummary", moRadIsSummary.isSelected()); moParamsMap.put("sColumnsEar", getColumSelect(1)); moParamsMap.put("sColumnsDed", getColumSelect(2)); moParamsMap.put("sSqlWhere", sSqlWhere); moParamsMap.put("sSqlInnerIssue", sSqlInnerIssue); if (moRadShowEarDed.isSelected()) { moParamsMap.put( "sSqlWhereEarning", moKeyEarning.getSelectedIndex() > 0 ? " AND ear.id_ear = " + moKeyEarning.getValue()[0] : ""); moParamsMap.put( "sSqlWhereDeduction", moKeyDeduction.getSelectedIndex() > 0 ? " AND ded.id_ded = " + moKeyDeduction.getValue()[0] : ""); } else { moParamsMap.put( "sSqlWhereEarning", !moKeyEarning.isEnabled() ? " AND ear.id_ear = 0 " : moKeyEarning.getSelectedIndex() > 0 ? " AND ear.id_ear = " + moKeyEarning.getValue()[0] : ""); moParamsMap.put( "sSqlWhereDeduction", !moKeyDeduction.isEnabled() ? " AND ded.id_ded = 0 " : moKeyDeduction.getSelectedIndex() > 0 ? " AND ded.id_ded = " + moKeyDeduction.getValue()[0] : ""); } if (moRadIsDetailPayroll.isSelected()) { mnFormType = SModConsts.HRSR_PAY_EAR_DED; moParamsMap.put("sSqlOrderBy", getOrderBy()); } else if (moRadIsDetailEmployee.isSelected()) { mnFormType = SModConsts.HRSR_PAY_AUX_EAR_DED; moParamsMap.put("bIsSummary", false); moParamsMap.put("bShowEmployees", true); moParamsMap.put( "sSqlOrderBy", "ORDER BY f_tp_ear_ded, f_ear_ded_id, f_ear_ded, id_dep, f_dep_code, f_dep_name, id_bp, f_emp_num, bp "); } }
private void initComponentsCustom() { SGuiUtils.setWindowBounds(this, 1024, 640); mnFilterEmpStatus = SLibConsts.UNDEFINED; moPanelHrsDepartaments = new SPanelHrsDepartaments(miClient); moPanelHrsFilterPayrollStatus = new SPanelHrsFilterPayrollStatus(miClient); moRadReportTypeEarDed.setBooleanSettings( SGuiUtils.getLabelName(moRadReportTypeEarDed.getText()), true); moRadReportTypeEmployee.setBooleanSettings( SGuiUtils.getLabelName(moRadReportTypeEmployee.getText()), false); moRadReportTypeEmployeeDep.setBooleanSettings( SGuiUtils.getLabelName(moRadReportTypeEmployeeDep.getText()), false); moRadReportTypeDepartament.setBooleanSettings( SGuiUtils.getLabelName(moRadReportTypeDepartament.getText()), false); moRadReportTypeDepartamentEmp.setBooleanSettings( SGuiUtils.getLabelName(moRadReportTypeDepartamentEmp.getText()), false); moRadShowEarDed.setBooleanSettings(SGuiUtils.getLabelName(moRadShowEarDed.getText()), true); moRadShowEar.setBooleanSettings(SGuiUtils.getLabelName(moRadShowEar.getText()), false); moKeyEarning.setKeySettings(miClient, SGuiUtils.getLabelName(moRadShowEar.getText()), false); moRadShowDed.setBooleanSettings(SGuiUtils.getLabelName(moRadShowDed.getText()), false); moKeyDeduction.setKeySettings(miClient, SGuiUtils.getLabelName(moRadShowDed.getText()), false); moKeyPaymentType.setKeySettings( miClient, SGuiUtils.getLabelName(jlPaymentType.getText()), false); moKeyEmployee.setKeySettings(miClient, SGuiUtils.getLabelName(jlEmployee.getText()), false); moRadIsSummary.setBooleanSettings(SGuiUtils.getLabelName(moRadIsSummary.getText()), true); moRadIsDetailPayroll.setBooleanSettings( SGuiUtils.getLabelName(moRadIsDetailPayroll.getText()), false); moRadFilterTypePeriod.setBooleanSettings( SGuiUtils.getLabelName(moRadFilterTypePeriod.getText()), true); moRadFilterTypeDate.setBooleanSettings( SGuiUtils.getLabelName(moRadFilterTypeDate.getText()), false); moIntPeriodYear.setCalendarSettings(SGuiUtils.getLabelName(jlYear.getText())); moIntPeriodStart.setCalendarSettings(SGuiUtils.getLabelName(jlPeriodStart.getText())); moIntPeriodEnd.setCalendarSettings(SGuiUtils.getLabelName(jlPeriodEnd.getText())); moDateDateStart.setDateSettings(miClient, SGuiUtils.getLabelName(jlDateStart.getText()), true); moDateDateEnd.setDateSettings(miClient, SGuiUtils.getLabelName(jlDateEnd.getText()), true); moRadOrderByNumEmployee.setBooleanSettings( SGuiUtils.getLabelName(moRadOrderByNumEmployee.getText()), false); moRadOrderByNameEmployee.setBooleanSettings( SGuiUtils.getLabelName(moRadOrderByNameEmployee.getText()), true); moRadOrderByNumDepartament.setBooleanSettings( SGuiUtils.getLabelName(moRadOrderByNumDepartament.getText()), false); moRadOrderByNameDepartament.setBooleanSettings( SGuiUtils.getLabelName(moRadOrderByNameDepartament.getText()), true); jPanel3.add(moPanelHrsDepartaments, BorderLayout.CENTER); jpFilterStatusPay.add(moPanelHrsFilterPayrollStatus, BorderLayout.CENTER); moPanelHrsFilterPayrollStatus.setSelectedAll(); moFields.addField(moRadReportTypeEarDed); moFields.addField(moRadReportTypeEmployee); moFields.addField(moRadReportTypeEmployeeDep); moFields.addField(moRadReportTypeDepartament); moFields.addField(moRadReportTypeDepartamentEmp); moFields.addField(moRadShowEarDed); moFields.addField(moRadShowEar); moFields.addField(moKeyEarning); moFields.addField(moRadShowDed); moFields.addField(moKeyDeduction); moFields.addField(moKeyPaymentType); moFields.addField(moKeyEmployee); moFields.addField(moRadIsSummary); moFields.addField(moRadIsDetailPayroll); moFields.addField(moRadFilterTypePeriod); moFields.addField(moRadFilterTypeDate); moFields.addField(moIntPeriodYear); moFields.addField(moIntPeriodStart); moFields.addField(moIntPeriodEnd); moFields.addField(moDateDateStart); moFields.addField(moDateDateEnd); moFields.addField(moRadOrderByNumEmployee); moFields.addField(moRadOrderByNameEmployee); moFields.addField(moRadOrderByNumDepartament); moFields.addField(moRadOrderByNameDepartament); moFields.setFormButton(jbPrint); moRadReportTypeEmployee.addChangeListener(this); moRadReportTypeEarDed.addChangeListener(this); moRadFilterTypePeriod.addChangeListener(this); moRadFilterTypeDate.addChangeListener(this); moRadFilterTypeDatePay.addChangeListener(this); moRadShowEarDed.addChangeListener(this); moRadShowEar.addChangeListener(this); moRadShowDed.addChangeListener(this); jtbEmployeeActive.addItemListener(this); moRadReportTypeEarDed.setSelected(true); moRadShowEarDed.setSelected(true); moRadFilterTypePeriod.setSelected(true); moRadOrderByNameEmployee.setSelected(true); moRadOrderByNameDepartament.setSelected(true); jtbEmployeeActive.setSelected(false); moRadIsSummary.setSelected(true); moIntPeriodYear.setValue(miClient.getSession().getCurrentYear()); moIntPeriodStart.setValue(SLibTimeUtils.digestMonth(miClient.getSession().getCurrentDate())[1]); moIntPeriodEnd.setValue(SLibTimeUtils.digestMonth(miClient.getSession().getCurrentDate())[1]); moDateDateStart.setValue(SLibTimeUtils.getBeginOfYear(miClient.getSession().getCurrentDate())); moDateDateEnd.setValue(SLibTimeUtils.getEndOfYear(miClient.getSession().getCurrentDate())); reloadCatalogues(); actionEnableFieldsDates(); actionEnableFieldsEarDed(); }