fixes bug #9608
git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@73667 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
621fa614af
commit
09a5421b55
|
@ -3971,10 +3971,10 @@ public class FiscalHibernateDAO extends HibernateDaoSupport implements FiscalDAO
|
||||||
sql.append(" coalesce(b.importeoutros, 0) as outros, ");
|
sql.append(" coalesce(b.importeoutros, 0) as outros, ");
|
||||||
sql.append(" coalesce(r2.numserie20, imp.numserie20) as ecf, ");
|
sql.append(" coalesce(r2.numserie20, imp.numserie20) as ecf, ");
|
||||||
sql.append(" to_char(b.feccreacion, 'YYYYMMDD') as datamov, ");
|
sql.append(" to_char(b.feccreacion, 'YYYYMMDD') as datamov, ");
|
||||||
sql.append(" case when r2.numserie20 is null then '1' else r2.coo end as coo, ");
|
sql.append(" case when r2.numserie20 is null then '000001' else r2.coo end as coo, ");
|
||||||
sql.append(" '000000' as ccf, ");
|
sql.append(" '000000' as ccf, ");
|
||||||
sql.append(" null as totalFiscal, ");
|
sql.append(" null as totalFiscal, ");
|
||||||
sql.append(" case when r2.numserie20 is null then '1' else r2.coo end as cooredz, ");
|
sql.append(" case when r2.numserie20 is null then '000001' else r2.coo end as cooredz, ");
|
||||||
sql.append(" epv.cveestado as estadoImpressora ");
|
sql.append(" epv.cveestado as estadoImpressora ");
|
||||||
sql.append("from caja b ");
|
sql.append("from caja b ");
|
||||||
sql.append(" join fiscal_impressora imp on imp.numserie = b.serieimpfiscal ");
|
sql.append(" join fiscal_impressora imp on imp.numserie = b.serieimpfiscal ");
|
||||||
|
@ -4012,6 +4012,7 @@ public class FiscalHibernateDAO extends HibernateDaoSupport implements FiscalDAO
|
||||||
sql.append(" left join aidf a on a.aidf_id = b.aidf_id ");
|
sql.append(" left join aidf a on a.aidf_id = b.aidf_id ");
|
||||||
sql.append("where b.tipoventa_id <> 3 ");
|
sql.append("where b.tipoventa_id <> 3 ");
|
||||||
sql.append(" and b.rmd_id is null ");
|
sql.append(" and b.rmd_id is null ");
|
||||||
|
sql.append(" and b.preciopagado > 0 ");
|
||||||
sql.append(" and b.serieimpfiscal is not null and r4.caja_id is null ");
|
sql.append(" and b.serieimpfiscal is not null and r4.caja_id is null ");
|
||||||
sql.append(" and ((b.indreimpresion = 0 and b.motivocancelacion_id is null and b.numfoliosistema is not null) ");
|
sql.append(" and ((b.indreimpresion = 0 and b.motivocancelacion_id is null and b.numfoliosistema is not null) ");
|
||||||
sql.append(" or (b.indstatusboleto = 'E' and b.indreimpresion = 1)) ");
|
sql.append(" or (b.indstatusboleto = 'E' and b.indreimpresion = 1)) ");
|
||||||
|
@ -4120,10 +4121,7 @@ public class FiscalHibernateDAO extends HibernateDaoSupport implements FiscalDAO
|
||||||
ufs = ufs + ",'" + estado.getCveestado() + "'";
|
ufs = ufs + ",'" + estado.getCveestado() + "'";
|
||||||
}
|
}
|
||||||
|
|
||||||
List<DetalhadoFiscal> list = montaRelatorioRDI(connection, inicio, fim, empresaId, ufs, false);
|
List<DetalhadoFiscal> list = montaRelatorioRDI(connection, inicio, fim, empresaId, ufs);
|
||||||
|
|
||||||
list.addAll(montaRelatorioRDI(connection, inicio, fim, empresaId, ufs, true));
|
|
||||||
|
|
||||||
List<FiscalRdi> rdis = calcularRelatorioRDI(list, isReceitaTerceiros);
|
List<FiscalRdi> rdis = calcularRelatorioRDI(list, isReceitaTerceiros);
|
||||||
return agrupaRdi(rdis);
|
return agrupaRdi(rdis);
|
||||||
}
|
}
|
||||||
|
@ -4300,19 +4298,17 @@ public class FiscalHibernateDAO extends HibernateDaoSupport implements FiscalDAO
|
||||||
return total;
|
return total;
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<DetalhadoFiscal> montaRelatorioRDI(Connection connection, Date inicio, Date fim, Integer empresaId,
|
private List<DetalhadoFiscal> montaRelatorioRDI(Connection connection, Date inicio, Date fim, Integer empresaId, String ufs) {
|
||||||
String ufs, boolean isCancelados) {
|
|
||||||
|
|
||||||
List<DetalhadoFiscal> list = new ArrayList<DetalhadoFiscal>();
|
List<DetalhadoFiscal> list = new ArrayList<DetalhadoFiscal>();
|
||||||
try {
|
try {
|
||||||
|
|
||||||
String sql = null;
|
StringBuilder sql = new StringBuilder();
|
||||||
if (isCancelados)
|
sql.append(sqlRelatorioRDIVendidos(ufs));
|
||||||
sql = sqlRelatorioRDICancelados(ufs);
|
sql.append(" union ");
|
||||||
else
|
sql.append(sqlRelatorioRDICancelados(ufs));
|
||||||
sql = sqlRelatorioRDIVendidos(ufs);
|
|
||||||
|
|
||||||
NamedParameterStatement ps = new NamedParameterStatement(connection, sql);
|
NamedParameterStatement ps = new NamedParameterStatement(connection, sql.toString());
|
||||||
ps.setLong("EMPRESA_ID", Long.valueOf(empresaId));
|
ps.setLong("EMPRESA_ID", Long.valueOf(empresaId));
|
||||||
|
|
||||||
ps.setTimestamp("DATE_INICIO", new java.sql.Timestamp(DateUtil.inicioFecha(inicio).getTime()));
|
ps.setTimestamp("DATE_INICIO", new java.sql.Timestamp(DateUtil.inicioFecha(inicio).getTime()));
|
||||||
|
@ -4426,10 +4422,11 @@ public class FiscalHibernateDAO extends HibernateDaoSupport implements FiscalDAO
|
||||||
sql.append(" and ei.estado_id = coalesce(eos.estado_id, eo.estado_id) and ei.activo = 1 ");
|
sql.append(" and ei.estado_id = coalesce(eos.estado_id, eo.estado_id) and ei.activo = 1 ");
|
||||||
sql.append("where ((b.serieimpfiscal is not null and b.tipoventa_id <> 3) or b.tipoventa_id = 3 ) ");
|
sql.append("where ((b.serieimpfiscal is not null and b.tipoventa_id <> 3) or b.tipoventa_id = 3 ) ");
|
||||||
sql.append(" and b.indcancelacion = 0 ");
|
sql.append(" and b.indcancelacion = 0 ");
|
||||||
|
sql.append(" and b.motivocancelacion_id is null ");
|
||||||
|
sql.append(" and b.numseriepreimpresa is not null ");
|
||||||
sql.append(" and e.empresa_id = :EMPRESA_ID ");
|
sql.append(" and e.empresa_id = :EMPRESA_ID ");
|
||||||
sql.append(" and b.feccreacion between :DATE_INICIO and :DATE_FIM ");
|
sql.append(" and b.feccreacion between :DATE_INICIO and :DATE_FIM ");
|
||||||
sql.append(" and coalesce(eos.cveestado, eo.cveestado) in ( ").append(ufs).append(" ) ");
|
sql.append(" and coalesce(eos.cveestado, eo.cveestado) in ( ").append(ufs).append(" ) ");
|
||||||
sql.append("order by estadoId, isInterEstadual ");
|
|
||||||
|
|
||||||
return sql.toString();
|
return sql.toString();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue