private void print() { int year = moFieldYear.getInteger(); Cursor cursor = getCursor(); Map<String, Object> map = null; JasperPrint jasperPrint = null; JasperViewer jasperViewer = null; SDataBizPartner bizPartner = null; SDataBizPartnerCategory bizPartnerCategory = null; try { setCursor(new Cursor(Cursor.WAIT_CURSOR)); bizPartner = (SDataBizPartner) SDataUtilities.readRegistry( miClient, SDataConstants.BPSU_BP, moFieldBizPartner.getKeyAsIntArray(), SLibConstants.EXEC_MODE_VERBOSE); map = miClient.createReportParams(); map.put("nSysMoveCatId", manSysMoveTypeKey[0]); map.put("nSysMoveTypeId", manSysMoveTypeKey[1]); map.put("sBizPartnerCat", msBizPartnerCatSng.toUpperCase()); map.put("sBizPartnerCatPlural", msBizPartnerCatPlr.toUpperCase()); map.put( "nLocalCurrencyId", miClient.getSessionXXX().getParamsErp().getDbmsDataCurrency().getPkCurrencyId()); map.put( "sLocalCurrency", miClient.getSessionXXX().getParamsErp().getDbmsDataCurrency().getCurrency()); map.put("nYear", year); map.put( "tDate", jckShowPayDays.isSelected() ? moFieldDateRef.getDate() : SLibTimeUtilities.createDate(year, 12, 31)); map.put("nBizPartnerId", bizPartner.getPkBizPartnerId()); map.put("sBizPartner", bizPartner.getBizPartner()); switch (mnBizPartnerCategoryId) { case SDataConstantsSys.BPSS_CT_BP_SUP: bizPartnerCategory = bizPartner.getDbmsCategorySettingsSup(); break; case SDataConstantsSys.BPSS_CT_BP_CUS: bizPartnerCategory = bizPartner.getDbmsCategorySettingsCus(); break; default: } map.put("dCreditLimit", bizPartnerCategory.getEffectiveCreditLimit()); map.put("nDaysCredit", bizPartnerCategory.getEffectiveDaysOfCredit()); map.put("nDaysGrace", bizPartnerCategory.getEffectiveDaysOfGrace()); map.put( "sCreditType", SDataReadDescriptions.getCatalogueDescription( miClient, SDataConstants.BPSS_TP_CRED, new int[] {bizPartnerCategory.getEffectiveCreditTypeId()})); jasperPrint = SDataUtilities.fillReport( miClient, jckShowPayDays.isSelected() ? SDataConstantsSys.REP_FIN_BPS_ACC_MOV_DAY : SDataConstantsSys.REP_FIN_BPS_ACC_MOV, map); jasperViewer = new JasperViewer(jasperPrint, false); jasperViewer.setTitle(getTitle()); jasperViewer.setVisible(true); } catch (Exception e) { SLibUtilities.renderException(this, e); } finally { setCursor(cursor); } }
@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 "); } }