diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/AidfHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/AidfHibernateDAO.java index d24fef681..e7fb4b721 100644 --- a/src/com/rjconsultores/ventaboletos/dao/hibernate/AidfHibernateDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/AidfHibernateDAO.java @@ -160,7 +160,7 @@ public class AidfHibernateDAO extends GenericHibernateDAO implements sb.append(" select max(folio) as ultimo "); sb.append(" from folio_consumo_rmd "); sb.append(" where activo = 1 "); - sb.append(" and (indimpresso = 1 or indcancelacion = 1) "); + sb.append(" and (indimpresso = 1 or indcancelacion = 1) and indinactivo = 0 "); sb.append(" and rmd_id = :rmdId "); sb.append(" and empresa_id = :empresaId "); sb.append(" and estado_id = :estadoId "); @@ -186,7 +186,7 @@ public class AidfHibernateDAO extends GenericHibernateDAO implements sb.append(" select max(folio) as ultimo "); sb.append(" from folio_consumo_rmd "); sb.append(" where activo = 1 "); - sb.append(" and (indimpresso = 1 or indcancelacion = 1) "); + sb.append(" and (indimpresso = 1 or indcancelacion = 1) and indinactivo = 0 "); sb.append(" and rmd_id = :rmdId "); sb.append(" and empresa_id = :empresaId "); sb.append(" and estado_id = :estadoId "); diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/FiscalHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/FiscalHibernateDAO.java index 86475b0a2..6470d9c95 100644 --- a/src/com/rjconsultores/ventaboletos/dao/hibernate/FiscalHibernateDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/FiscalHibernateDAO.java @@ -3189,7 +3189,8 @@ public class FiscalHibernateDAO extends HibernateDaoSupport implements FiscalDAO List foliosRmd = new ArrayList(); - inativarFolioConsumoRmd(connection, empresaId, estado.getEstadoId(), aidf.getAidfId(), folioInicial, folioFinal); + inativarFolioConsumoRmd(connection, empresaId, estado.getEstadoId(), aidf.getAidfId(), folioInicial, folioFinal, + isCancela, isInativa); for (DetalhadoRMD brp : buscarRegistroImpressaoBPR(connection, inicio, fim, empresaId, estado.getCveestado(), aidf.getAidfId(), folioInicial, folioFinal, isBPR, isECF, true)) { @@ -3212,22 +3213,31 @@ public class FiscalHibernateDAO extends HibernateDaoSupport implements FiscalDAO } boletos.add(boletoAgr); - for (String folio : foliosRmd) { - insereConsulmoFolioRMD(connection, inicio, empresaId, estado.getEstadoId(), aidf, folio, - isCancela, isInativa, false, isECF, isBPR, null, null, null, null, null, null); - } +// for (String folio : foliosRmd) { +// insereConsulmoFolioRMD(connection, inicio, empresaId, estado.getEstadoId(), aidf, folio, +// isCancela, isInativa, false, isECF, isBPR, null, null, null, null, null, null); +// } marcarRMDCaja(connection, boletos, null, null); } private void inativarFolioConsumoRmd(Connection connection, Integer empresaId, Integer estadoId, - Long rmdId, String folioInicial, String folioFinal) { + Long rmdId, String folioInicial, String folioFinal, boolean isCancela, boolean isInativa) { PreparedStatement pstmt = null; try { StringBuilder sb = new StringBuilder(); sb.append(" update folio_consumo_rmd "); - sb.append(" set activo = 0, fecmodif = sysdate "); + sb.append(" set fecmodif = sysdate "); + + if (isCancela) { + sb.append(" ,indcancelacion = 1 "); + } else if (isInativa) { + sb.append(" ,indinactivo = 1, indimpresso = 0 "); + } else { + sb.append(" ,activo = 0 "); + } + sb.append(" where activo = 1 "); sb.append(" and indimpresso = 1 "); sb.append(" and rmd_id = ? ");