bug#10939
dev: julio qua: git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@83352 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
fa919b8a27
commit
cae18c4edb
|
@ -2338,7 +2338,8 @@ public class FiscalHibernateDAO extends HibernateDaoSupport implements FiscalDAO
|
|||
sb.append(" left join empresa_imposto eif on eif.activo = 1 and eif.empresa_id = f.empresa_id and eif.estado_id = eof.estado_id");
|
||||
sb.append(" left join inscricao_estadual ie on ie.empresa_id = f.empresa_id and ie.estado_id = eof.estado_id and ie.activo = 1");
|
||||
sb.append(" left join ciudad cie on cie.ciudad_id = ie.ciudad_id");
|
||||
sb.append(" left join caja b on b.activo = 1 and b.rmd_id = (case when coalesce(f.indcancelacion, 0) = 1 then -1 else f.rmd_id end) and b.empresacorrida_id = f.empresa_id and b.foliormd = f.folio and to_char(b.fechorventa, 'ddmmyyyy') = to_char(f.fechorfolio, 'ddmmyyyy')");
|
||||
// sb.append(" left join caja b on b.activo = 1 and b.rmd_id = (case when coalesce(f.indcancelacion, 0) = 1 then -1 else f.rmd_id end) and b.empresacorrida_id = f.empresa_id and b.foliormd = f.folio and to_char(b.fechorventa, 'ddmmyyyy') = to_char(f.fechorfolio, 'ddmmyyyy')");
|
||||
sb.append(" left join caja b on b.activo = 1 and b.rmd_id = f.rmd_id and b.empresacorrida_id = f.empresa_id and b.foliormd = f.folio and to_char(b.fechorventa, 'ddmmyyyy') = to_char(f.fechorfolio, 'ddmmyyyy')");
|
||||
sb.append(" left join parada po on po.parada_id = b.origen_id and po.activo = 1 ");
|
||||
sb.append(" left join ciudad co on co.ciudad_id = po.ciudad_id and co.activo = 1 ");
|
||||
sb.append(" left join estado eo on eo.estado_id = co.estado_id and eo.activo = 1 ");
|
||||
|
@ -2597,7 +2598,6 @@ public class FiscalHibernateDAO extends HibernateDaoSupport implements FiscalDAO
|
|||
sb.append(" and eo.cveestado like ?");
|
||||
sb.append(" and f.indcancelacion = 1 and f.indbpr = 1 and f.activo = 1");
|
||||
|
||||
|
||||
try {
|
||||
PreparedStatement ps = connection.prepareStatement(sb.toString());
|
||||
ps.setLong(1, Long.valueOf(empresaId));
|
||||
|
@ -3205,7 +3205,10 @@ public class FiscalHibernateDAO extends HibernateDaoSupport implements FiscalDAO
|
|||
|
||||
List<String> foliosRmd = new ArrayList<String>();
|
||||
|
||||
inativarFolioConsumoRmd(connection, empresaId, estado.getEstadoId(), aidf.getAidfId(), folioInicial, folioFinal);
|
||||
if (isCancela) {
|
||||
cancelaFolioConsumoRmd(connection, empresaId, estado.getEstadoId(), aidf.getAidfId(), folioInicial, folioFinal, inicio, fim);
|
||||
} else {
|
||||
inativarFolioConsumoRmd(connection, empresaId, estado.getEstadoId(), aidf.getAidfId(), folioInicial, folioFinal, inicio, fim);
|
||||
|
||||
for (DetalhadoRMD brp : buscarRegistroImpressaoBPR(connection, inicio, fim, empresaId, estado.getCveestado(), aidf.getAidfId(),
|
||||
folioInicial, folioFinal, isBPR, isECF, true)) {
|
||||
|
@ -3235,9 +3238,50 @@ public class FiscalHibernateDAO extends HibernateDaoSupport implements FiscalDAO
|
|||
|
||||
marcarRMDCaja(connection, boletos, null, null);
|
||||
}
|
||||
}
|
||||
|
||||
private void cancelaFolioConsumoRmd(Connection connection, Integer empresaId, Integer estadoId,
|
||||
Long rmdId, String folioInicial, String folioFinal, Date inicio, Date fim) {
|
||||
|
||||
PreparedStatement pstmt = null;
|
||||
try {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(" update folio_consumo_rmd ");
|
||||
sb.append(" set activo = 1, fecmodif = sysdate, indcancelacion = 1 ");
|
||||
sb.append(" where activo = 1 ");
|
||||
sb.append(" and indimpresso = 1 ");
|
||||
sb.append(" and rmd_id = ? ");
|
||||
sb.append(" and empresa_id = ? ");
|
||||
sb.append(" and estado_id = ? ");
|
||||
sb.append(" and folio between ? and ? ");
|
||||
sb.append(" and fechorfolio between to_date(?,'dd/MM/yyyy HH24:MI:SS') and to_date(?,'dd/MM/yyyy HH24:MI:SS') ");
|
||||
|
||||
pstmt = connection.prepareStatement(sb.toString());
|
||||
pstmt.setInt(1, rmdId.intValue());
|
||||
pstmt.setInt(2, empresaId);
|
||||
pstmt.setInt(3, estadoId);
|
||||
pstmt.setString(4, folioInicial);
|
||||
pstmt.setString(5, folioFinal);
|
||||
pstmt.setString(6, DateUtil.getStringDate(inicio, DATE_FORMAT_DMY) + " 00:00:00");
|
||||
pstmt.setString(7, DateUtil.getStringDate(fim, DATE_FORMAT_DMY) + " 23:59:59");
|
||||
|
||||
pstmt.executeUpdate();
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("", e);
|
||||
} finally {
|
||||
try {
|
||||
if (pstmt != null && !pstmt.isClosed()) {
|
||||
pstmt.close();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void inativarFolioConsumoRmd(Connection connection, Integer empresaId, Integer estadoId,
|
||||
Long rmdId, String folioInicial, String folioFinal) {
|
||||
Long rmdId, String folioInicial, String folioFinal, Date inicio, Date fim) {
|
||||
|
||||
PreparedStatement pstmt = null;
|
||||
try {
|
||||
|
@ -3250,6 +3294,7 @@ public class FiscalHibernateDAO extends HibernateDaoSupport implements FiscalDAO
|
|||
sb.append(" and empresa_id = ? ");
|
||||
sb.append(" and estado_id = ? ");
|
||||
sb.append(" and folio between ? and ? ");
|
||||
sb.append(" and fechorfolio between to_date(?,'dd/MM/yyyy HH24:MI:SS') and to_date(?,'dd/MM/yyyy HH24:MI:SS') ");
|
||||
|
||||
pstmt = connection.prepareStatement(sb.toString());
|
||||
pstmt.setInt(1, rmdId.intValue());
|
||||
|
@ -3257,6 +3302,8 @@ public class FiscalHibernateDAO extends HibernateDaoSupport implements FiscalDAO
|
|||
pstmt.setInt(3, estadoId);
|
||||
pstmt.setString(4, folioInicial);
|
||||
pstmt.setString(5, folioFinal);
|
||||
pstmt.setString(6, DateUtil.getStringDate(inicio, DATE_FORMAT_DMY) + " 00:00:00");
|
||||
pstmt.setString(7, DateUtil.getStringDate(fim, DATE_FORMAT_DMY) + " 23:59:59");
|
||||
|
||||
pstmt.executeUpdate();
|
||||
|
||||
|
@ -3849,8 +3896,6 @@ public class FiscalHibernateDAO extends HibernateDaoSupport implements FiscalDAO
|
|||
return sql.toString();
|
||||
}
|
||||
|
||||
|
||||
|
||||
private String getSqlImpressaoRMDCancelados() {
|
||||
|
||||
StringBuilder sql = new StringBuilder();
|
||||
|
@ -3868,7 +3913,6 @@ public class FiscalHibernateDAO extends HibernateDaoSupport implements FiscalDAO
|
|||
return sql.toString();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<FiscalRdi> buscarRelatorioRDI(Connection connection, Date inicio, Date fim, Integer empresaId, List<Estado> estados, boolean isReceitaTerceiros) {
|
||||
|
||||
|
|
Loading…
Reference in New Issue