leonardo 2017-10-17 19:56:35 +00:00
parent 8effa12772
commit d118ea2d53
1 changed files with 9 additions and 6 deletions

View File

@ -44,8 +44,8 @@ public class RelatorioEmpresaCorrida extends Relatorio {
ResultSet rset = null; ResultSet rset = null;
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss"); SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss");
stmt.setTimestamp("fecInicio", new java.sql.Timestamp(sdf.parse(fecInicio).getTime())); stmt.setString("fecInicio", fecInicio);
stmt.setTimestamp("fecFinal", new java.sql.Timestamp(sdf.parse(fecFinal).getTime())); stmt.setString("fecFinal", fecFinal);
if (empresa != null && !empresa.equals("")) { if (empresa != null && !empresa.equals("")) {
stmt.setInt("empresa_id", Integer.parseInt(empresa)); stmt.setInt("empresa_id", Integer.parseInt(empresa));
} }
@ -138,13 +138,14 @@ public class RelatorioEmpresaCorrida extends Relatorio {
sql.append(" COUNT(b.boleto_id) passageirosTransp "); sql.append(" COUNT(b.boleto_id) passageirosTransp ");
sql.append("FROM ruta r "); sql.append("FROM ruta r ");
sql.append("LEFT JOIN corrida c ON c.ruta_id = r.ruta_id "); sql.append("LEFT JOIN corrida c ON c.ruta_id = r.ruta_id ");
sql.append("INNER JOIN empresa e ON c.marca_id = e.empresa_id "); sql.append("INNER JOIN marca m ON m.marca_id = c.marca_id ");
sql.append("INNER JOIN empresa e ON e.empresa_id = m.empresa_id ");
sql.append("LEFT JOIN boleto b ON b.corrida_id = c.corrida_id AND b.feccorrida = c.feccorrida AND b.motivocancelacion_id IS NULL "); sql.append("LEFT JOIN boleto b ON b.corrida_id = c.corrida_id AND b.feccorrida = c.feccorrida AND b.motivocancelacion_id IS NULL ");
sql.append("LEFT JOIN categoria cat ON cat.categoria_id = b.categoria_id "); sql.append("LEFT JOIN categoria cat ON cat.categoria_id = b.categoria_id ");
sql.append("WHERE c.activo <> 0 "); sql.append("WHERE c.activo <> 0 ");
sql.append("AND r.activo = 1 "); sql.append("AND r.activo = 1 ");
sql.append(StringUtils.isBlank(empresa) ? "" : "AND c.marca_id = :empresa_id "); sql.append(StringUtils.isBlank(empresa) ? "" : "AND e.empresa_id = :empresa_id ");
sql.append("AND c.FECCORRIDA BETWEEN :fecInicio AND :fecFinal "); sql.append("AND c.FECCORRIDA BETWEEN to_date(:fecInicio, 'DD/MM/YYYY HH24:Mi:SS') AND to_date(:fecFinal, 'DD/MM/YYYY HH24:Mi:SS') ");
sql.append("GROUP BY "); sql.append("GROUP BY ");
sql.append(" e.empresa_id, "); sql.append(" e.empresa_id, ");
sql.append(" e.nombempresa, "); sql.append(" e.nombempresa, ");
@ -167,9 +168,11 @@ public class RelatorioEmpresaCorrida extends Relatorio {
sql.append("INNER JOIN corrida_tramo ct ON ct.corrida_id = c.corrida_id AND c.feccorrida = ct.feccorrida "); sql.append("INNER JOIN corrida_tramo ct ON ct.corrida_id = c.corrida_id AND c.feccorrida = ct.feccorrida ");
sql.append("INNER JOIN tramo t ON t.tramo_id = ct.tramo_id "); sql.append("INNER JOIN tramo t ON t.tramo_id = ct.tramo_id ");
sql.append("INNER JOIN autobus a ON a.autobus_id = ct.autobus_id "); sql.append("INNER JOIN autobus a ON a.autobus_id = ct.autobus_id ");
sql.append("INNER JOIN marca m ON m.marca_id = c.marca_id ");
sql.append("INNER JOIN empresa e ON e.empresa_id = m.empresa_id ");
sql.append("WHERE c.activo <> 0 "); sql.append("WHERE c.activo <> 0 ");
sql.append("AND ct.activo = 1 "); sql.append("AND ct.activo = 1 ");
sql.append(StringUtils.isBlank(empresa) ? "" : "AND c.marca_id = :empresa_id "); sql.append(StringUtils.isBlank(empresa) ? "" : "AND e.empresa_id = :empresa_id ");
sql.append("AND c.FECCORRIDA BETWEEN :fecInicio AND :fecFinal "); sql.append("AND c.FECCORRIDA BETWEEN :fecInicio AND :fecFinal ");
sql.append("GROUP BY c.ruta_id "); sql.append("GROUP BY c.ruta_id ");
sql.append("ORDER BY c.ruta_id "); sql.append("ORDER BY c.ruta_id ");