bug #6445
git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@48029 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
c5d2330393
commit
787df6d0cd
|
@ -42,21 +42,8 @@ public class RelatorioAgenciasNaoImportadas extends Relatorio {
|
||||||
ResultSet rs = null;
|
ResultSet rs = null;
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss");
|
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss");
|
||||||
|
|
||||||
Calendar c = Calendar.getInstance();
|
|
||||||
c.setTime(sdf.parse(fecInicio));
|
|
||||||
c.add(Calendar.DAY_OF_MONTH, 1);
|
|
||||||
Date di = c.getTime();
|
|
||||||
|
|
||||||
c.setTime(sdf.parse(fecFinal));
|
|
||||||
c.add(Calendar.DAY_OF_MONTH, 1);
|
|
||||||
Date df = c.getTime();
|
|
||||||
|
|
||||||
stmt.setTimestamp(1, new java.sql.Timestamp(sdf.parse(fecInicio).getTime()));
|
stmt.setTimestamp(1, new java.sql.Timestamp(sdf.parse(fecInicio).getTime()));
|
||||||
stmt.setTimestamp(2, new java.sql.Timestamp(sdf.parse(fecFinal).getTime()));
|
stmt.setTimestamp(2, new java.sql.Timestamp(sdf.parse(fecFinal).getTime()));
|
||||||
stmt.setTimestamp(3, new java.sql.Timestamp(sdf.parse(fecInicio).getTime()));
|
|
||||||
stmt.setTimestamp(4, new java.sql.Timestamp(sdf.parse(fecFinal).getTime()));
|
|
||||||
stmt.setTimestamp(5, new java.sql.Timestamp(di.getTime()));
|
|
||||||
stmt.setTimestamp(6, new java.sql.Timestamp(df.getTime()));
|
|
||||||
|
|
||||||
rs = stmt.executeQuery();
|
rs = stmt.executeQuery();
|
||||||
|
|
||||||
|
@ -112,51 +99,11 @@ public class RelatorioAgenciasNaoImportadas extends Relatorio {
|
||||||
|
|
||||||
// Custo da query: 40
|
// Custo da query: 40
|
||||||
StringBuilder sql = new StringBuilder();
|
StringBuilder sql = new StringBuilder();
|
||||||
sql.append(" select distinct pu.numpuntoventa, pu.nombpuntoventa, t.fecha from ");
|
sql.append(" select distinct p.numpuntoventa, p.nombpuntoventa, t.feccorte ");
|
||||||
sql.append(" punto_venta pu ");
|
sql.append(" from punto_venta p ");
|
||||||
sql.append(" inner join ( ");
|
sql.append(" inner join titulo_integracion t on t.puntoventa_id = p.puntoventa_id ");
|
||||||
sql.append(" select ");
|
sql.append(" where t.feccorte between ? AND ? and t.fecintegracion is null ");
|
||||||
sql.append(" p.puntoventa_id puntoventa_id, ");
|
sql.append(" order by t.feccorte, p.nombpuntoventa ");
|
||||||
sql.append(" TRUNC(c.fechorventa ) fecha ");
|
|
||||||
sql.append(" from ");
|
|
||||||
sql.append(" punto_venta p ");
|
|
||||||
sql.append(" inner join caja c on c.puntoventa_id = p.puntoventa_id ");
|
|
||||||
sql.append(" inner join marca m on c.marca_id = m.marca_id ");
|
|
||||||
sql.append(" where ");
|
|
||||||
sql.append(" c.fecintegracion is null ");
|
|
||||||
sql.append(" and c.FECHORVENTA between ? AND ? ");
|
|
||||||
sql.append(" and c.activo = 1 ");
|
|
||||||
sql.append(" and m.empresa_id in (" + empresas + ") ");
|
|
||||||
sql.append(" and (c.motivocancelacion_id is null or c.motivocancelacion_id <> 35) ");
|
|
||||||
sql.append(" union all ");
|
|
||||||
sql.append(" select ");
|
|
||||||
sql.append(" p.puntoventa_id puntoventa_id, ");
|
|
||||||
sql.append(" TRUNC(cd.fechorvta ) fecha ");
|
|
||||||
sql.append(" from ");
|
|
||||||
sql.append(" punto_venta p ");
|
|
||||||
sql.append(" inner join caja_diversos cd on cd.puntoventa_id = p.puntoventa_id ");
|
|
||||||
sql.append(" left join evento_extra ev on ev.eventoextra_id = cd.eventoextra_id ");
|
|
||||||
sql.append(" where ");
|
|
||||||
sql.append(" cd.fecintegracion is null ");
|
|
||||||
sql.append(" and cd.FECHORVTA between ? AND ? ");
|
|
||||||
sql.append(" and cd.activo = 1 ");
|
|
||||||
sql.append(" and ev.empresa_id in (" + empresas + ") ");
|
|
||||||
sql.append(" union all ");
|
|
||||||
sql.append(" select ");
|
|
||||||
sql.append(" p.puntoventa_id puntoventa_id, ");
|
|
||||||
sql.append(" TRUNC(fb.fecdocumento ) fecha ");
|
|
||||||
sql.append(" from ");
|
|
||||||
sql.append(" punto_venta p ");
|
|
||||||
sql.append(" inner join fechamento_cntcorrente fc on fc.puntoventa_id = p.puntoventa_id ");
|
|
||||||
sql.append(" inner join fechamento_boleto fb on fb.FECHAMENTOCNTCORRENTE_ID = fc.FECHAMENTOCNTCORRENTE_ID ");
|
|
||||||
sql.append(" where ");
|
|
||||||
sql.append(" fb.fecintegracion is null ");
|
|
||||||
sql.append(" and fb.fecdocumento between ? AND ? ");
|
|
||||||
sql.append(" and fb.activo = 1 ");
|
|
||||||
sql.append(" and fc.empresa_id in (" + empresas + ") ");
|
|
||||||
sql.append(" ) t on t.puntoventa_id = pu.puntoventa_id ");
|
|
||||||
sql.append(" order by ");
|
|
||||||
sql.append(" t.fecha, pu.nombpuntoventa ");
|
|
||||||
|
|
||||||
return sql.toString();
|
return sql.toString();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue