add filtro de data viagem no rel bilhetes vendidos feat bug #AL-3637

master
Fabio 2024-02-09 18:49:01 -03:00
parent e9876a8918
commit ad2ade12d4
8 changed files with 72 additions and 32 deletions

View File

@ -23,6 +23,11 @@ import com.rjconsultores.ventaboletos.web.utilerias.NamedParameterStatement;
public class RelatorioBilhetesVendidos extends Relatorio { public class RelatorioBilhetesVendidos extends Relatorio {
private static final String DATA_VENDA = "DATA_VENDA";
private static final String DATA_FINAL = "DATA_FINAL";
private static final String DATA_INICIAL = "DATA_INICIAL";
private static final String TIPO_DATA = "TIPO_DATA";
public RelatorioBilhetesVendidos(Map<String, Object> parametros, Connection conexao) throws Exception { public RelatorioBilhetesVendidos(Map<String, Object> parametros, Connection conexao) throws Exception {
super(parametros, conexao); super(parametros, conexao);
@ -70,7 +75,6 @@ public class RelatorioBilhetesVendidos extends Relatorio {
sql.append(" B.NOMBPASAJERO AS PASSAGEIRO, "); sql.append(" B.NOMBPASAJERO AS PASSAGEIRO, ");
sql.append(" B.DESCNUMDOC AS DOC, "); sql.append(" B.DESCNUMDOC AS DOC, ");
sql.append(" COALESCE(b.NUMOPERACION, bo.NUMOPERACION) AS LOCALIZADOR "); sql.append(" COALESCE(b.NUMOPERACION, bo.NUMOPERACION) AS LOCALIZADOR ");
sql.append(" FROM caja B "); sql.append(" FROM caja B ");
sql.append(" LEFT JOIN boleto bo ON (bo.boleto_id = b.transacaooriginal_id AND b.indstatusboleto = 'C') "); sql.append(" LEFT JOIN boleto bo ON (bo.boleto_id = b.transacaooriginal_id AND b.indstatusboleto = 'C') ");
@ -90,15 +94,22 @@ public class RelatorioBilhetesVendidos extends Relatorio {
sql.append(" WHERE "); sql.append(" WHERE ");
sql.append(" (b.indreimpresion = 0 OR b.INDSTATUSBOLETO = 'E') "); sql.append(" (b.indreimpresion = 0 OR b.INDSTATUSBOLETO = 'E') ");
sql.append(" and m.EMPRESA_ID = :EMPRESA_ID "); sql.append(" and m.EMPRESA_ID = :EMPRESA_ID ");
if (parametros.get("DATA_INICIAL") != null && parametros.get("DATA_FINAL") != null) { if (parametros.get(DATA_INICIAL) != null && parametros.get(DATA_FINAL) != null) {
if (parametros.get("TIPO_DATA") != null) { if (parametros.get(TIPO_DATA) != null) {
if ((parametros.get("TIPO_DATA").toString().contains("DATA_VENDA"))) { if ((parametros.get(TIPO_DATA).toString().equals(DATA_VENDA))) {
sql.append(" and b.FECHORVENTA_H >= :DATA_INICIAL "); sql.append(" and b.FECHORVENTA_H >= :DATA_INICIAL ");
sql.append(" and b.FECHORVENTA_H <= :DATA_FINAL "); sql.append(" and b.FECHORVENTA_H <= :DATA_FINAL ");
} else { }
if ((parametros.get(TIPO_DATA).toString().equals("DATA_EMISSAO"))) {
sql.append(" and utilizado.FECHORVENTA >= :DATA_INICIAL "); sql.append(" and utilizado.FECHORVENTA >= :DATA_INICIAL ");
sql.append(" and utilizado.FECHORVENTA <= :DATA_FINAL "); sql.append(" and utilizado.FECHORVENTA <= :DATA_FINAL ");
} }
if ((parametros.get(TIPO_DATA).toString().equals("DATA_VIAGEM"))) {
sql.append(" and b.FECCORRIDA >= :DATA_INICIAL ");
sql.append(" and b.FECCORRIDA <= :DATA_FINAL ");
}
} }
} }
@ -175,15 +186,22 @@ public class RelatorioBilhetesVendidos extends Relatorio {
sql.append(" WHERE "); sql.append(" WHERE ");
sql.append(" (b.indreimpresion = 0 OR b.INDSTATUSBOLETO = 'E') "); sql.append(" (b.indreimpresion = 0 OR b.INDSTATUSBOLETO = 'E') ");
sql.append(" and m.EMPRESA_ID = :EMPRESA_ID "); sql.append(" and m.EMPRESA_ID = :EMPRESA_ID ");
if (parametros.get("DATA_INICIAL") != null && parametros.get("DATA_FINAL") != null) { if (parametros.get(DATA_INICIAL) != null && parametros.get(DATA_FINAL) != null) {
if (parametros.get("TIPO_DATA") != null) { if (parametros.get(TIPO_DATA) != null) {
if ((parametros.get("TIPO_DATA").toString().contains("DATA_VENDA"))) { if ((parametros.get(TIPO_DATA).toString().equals(DATA_VENDA))) {
sql.append(" and b.FECHORVENTA_H >= :DATA_INICIAL "); sql.append(" and b.FECHORVENTA_H >= :DATA_INICIAL ");
sql.append(" and b.FECHORVENTA_H <= :DATA_FINAL "); sql.append(" and b.FECHORVENTA_H <= :DATA_FINAL ");
} else { }
if ((parametros.get(TIPO_DATA).toString().equals("DATA_EMISSAO"))) {
sql.append(" and utilizado.FECHORVENTA >= :DATA_INICIAL "); sql.append(" and utilizado.FECHORVENTA >= :DATA_INICIAL ");
sql.append(" and utilizado.FECHORVENTA <= :DATA_FINAL "); sql.append(" and utilizado.FECHORVENTA <= :DATA_FINAL ");
} }
if ((parametros.get(TIPO_DATA).toString().equals("DATA_VIAGEM"))) {
sql.append(" and b.FECCORRIDA >= :DATA_INICIAL ");
sql.append(" and b.FECCORRIDA <= :DATA_FINAL ");
}
} }
} }
@ -228,9 +246,9 @@ public class RelatorioBilhetesVendidos extends Relatorio {
NamedParameterStatement stmt = new NamedParameterStatement(conexao, sql.toString()); NamedParameterStatement stmt = new NamedParameterStatement(conexao, sql.toString());
stmt.setInt("EMPRESA_ID", Integer.valueOf(parametros.get("EMPRESA_ID").toString())); stmt.setInt("EMPRESA_ID", Integer.valueOf(parametros.get("EMPRESA_ID").toString()));
if (parametros.get("DATA_INICIAL") != null && parametros.get("DATA_FINAL") != null){ if (parametros.get(DATA_INICIAL) != null && parametros.get(DATA_FINAL) != null){
stmt.setTimestamp("DATA_INICIAL", new Timestamp(DateUtil.inicioFecha((Date) parametros.get("DATA_INICIAL")).getTime())); stmt.setTimestamp(DATA_INICIAL, new Timestamp(DateUtil.inicioFecha((Date) parametros.get(DATA_INICIAL)).getTime()));
stmt.setTimestamp("DATA_FINAL", new Timestamp(DateUtil.fimFecha((Date) parametros.get("DATA_FINAL")).getTime())); stmt.setTimestamp(DATA_FINAL, new Timestamp(DateUtil.fimFecha((Date) parametros.get(DATA_FINAL)).getTime()));
} }
ResultSet rset = stmt.executeQuery(); ResultSet rset = stmt.executeQuery();
@ -258,7 +276,7 @@ public class RelatorioBilhetesVendidos extends Relatorio {
dataResult.put("DESTINO", rset.getString("DESTINO")); dataResult.put("DESTINO", rset.getString("DESTINO"));
dataResult.put("NOME_AGENCIA", rset.getString("NOME_AGENCIA")); dataResult.put("NOME_AGENCIA", rset.getString("NOME_AGENCIA"));
dataResult.put("COD_AGENCIA", rset.getString("COD_AGENCIA")); dataResult.put("COD_AGENCIA", rset.getString("COD_AGENCIA"));
dataResult.put("DATA_VENDA", rset.getDate("DATA_VENDA")); dataResult.put(DATA_VENDA, rset.getDate(DATA_VENDA));
dataResult.put("DATA_EMISSAO", rset.getDate("DATA_EMISSAO")); dataResult.put("DATA_EMISSAO", rset.getDate("DATA_EMISSAO"));
dataResult.put("DATA_VIAGEM", rset.getDate("DATA_VIAGEM")); dataResult.put("DATA_VIAGEM", rset.getDate("DATA_VIAGEM"));
dataResult.put("SERVICO", rset.getString("SERVICO")); dataResult.put("SERVICO", rset.getString("SERVICO"));

View File

@ -32,6 +32,10 @@ import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource;
* *
*/ */
public class RelatorioBilhetesVendidosNovoLayout extends Relatorio { public class RelatorioBilhetesVendidosNovoLayout extends Relatorio {
private static final String STATUS = "STATUS";
private static final String DATA_VENDA = "DATA_VENDA";
private static final String TIPO_DATA = "TIPO_DATA";
public RelatorioBilhetesVendidosNovoLayout(Map<String, Object> parametros, Connection conexao) throws Exception { public RelatorioBilhetesVendidosNovoLayout(Map<String, Object> parametros, Connection conexao) throws Exception {
super(parametros, conexao); super(parametros, conexao);
@ -105,16 +109,32 @@ public class RelatorioBilhetesVendidosNovoLayout extends Relatorio {
sql.append(" join estado est on est.estado_id = co.estado_id"); sql.append(" join estado est on est.estado_id = co.estado_id");
sql.append(" join empresa_imposto ei on ei.empresa_id = e.empresa_id"); sql.append(" join empresa_imposto ei on ei.empresa_id = e.empresa_id");
sql.append(" LEFT JOIN ALIQUOTA_ESTADO_DESTINO AL ON ei.EMPRESAIMPOSTO_ID = AL.EMPRESAIMPOSTO_ID AND cd.estado_id = AL.ESTADO_ID AND AL.ACTIVO = 1 "); sql.append(" LEFT JOIN ALIQUOTA_ESTADO_DESTINO AL ON ei.EMPRESAIMPOSTO_ID = AL.EMPRESAIMPOSTO_ID AND cd.estado_id = AL.ESTADO_ID AND AL.ACTIVO = 1 ");
sql.append(" LEFT JOIN boleto utilizado ON (utilizado.boleto_id = c.transacaooriginal_id AND c.INDSTATUSBOLETO = 'E') ");
sql.append(" join punto_venta pv on c.puntoventa_id = pv.puntoventa_id"); sql.append(" join punto_venta pv on c.puntoventa_id = pv.puntoventa_id");
sql.append(" and ei.estado_id = est.estado_id"); sql.append(" and ei.estado_id = est.estado_id");
sql.append(" where "); sql.append(" where ");
sql.append(" c.empresacorrida_id = :EMPRESA_ID "); sql.append(" c.empresacorrida_id = :EMPRESA_ID ");
sql.append(" and c.FECHORVENTA >= :DATA_INICIAL and c.FECHORVENTA <= :DATA_FINAL "); if (parametros.get(TIPO_DATA) != null) {
if ((parametros.get(TIPO_DATA).toString().equals(DATA_VENDA))) {
sql.append(" and c.FECHORVENTA_H >= :DATA_INICIAL ");
sql.append(" and c.FECHORVENTA_H <= :DATA_FINAL ");
}
if ((parametros.get(TIPO_DATA).toString().equals("DATA_EMISSAO"))) {
sql.append(" and utilizado.FECHORVENTA >= :DATA_INICIAL ");
sql.append(" and utilizado.FECHORVENTA <= :DATA_FINAL ");
}
if ((parametros.get(TIPO_DATA).toString().equals("DATA_VIAGEM"))) {
sql.append(" and c.FECCORRIDA >= :DATA_INICIAL ");
sql.append(" and c.FECCORRIDA <= :DATA_FINAL ");
}
}
sql.append(" and c.activo = 1"); sql.append(" and c.activo = 1");
sql.append(" and ei.activo = 1"); sql.append(" and ei.activo = 1");
if (parametros.get("NUMPUNTOVENTA") != null && !parametros.get("NUMPUNTOVENTA").equals("-1")) { if (parametros.get(NUMPUNTOVENTA) != null && !parametros.get(NUMPUNTOVENTA).equals("-1")) {
sql.append(" and pv.PUNTOVENTA_ID IN (" + parametros.get("NUMPUNTOVENTA").toString() + ")"); sql.append(" and pv.PUNTOVENTA_ID IN (" + parametros.get(NUMPUNTOVENTA).toString() + ")");
} }
if (parametros.get("ESTADO_ID") != null && !parametros.get("ESTADO_ID").equals("-1")) { if (parametros.get("ESTADO_ID") != null && !parametros.get("ESTADO_ID").equals("-1")) {
@ -125,12 +145,12 @@ public class RelatorioBilhetesVendidosNovoLayout extends Relatorio {
sql.append(" and NVL(c.MONEDA_ID, 1) = "+parametros.get("MOEDA_ID") ); sql.append(" and NVL(c.MONEDA_ID, 1) = "+parametros.get("MOEDA_ID") );
} }
if (parametros.get("STATUS") != null) { if (parametros.get(STATUS) != null) {
if (parametros.get("STATUS").toString().contains("V") && parametros.get("STATUS").toString().contains("C")) { if (parametros.get(STATUS).toString().contains("V") && parametros.get(STATUS).toString().contains("C")) {
sql.append(" and ((c.INDSTATUSBOLETO = 'C' AND c.MOTIVOCANCELACION_ID IS NOT NULL) OR (c.INDSTATUSBOLETO = 'V' AND c.MOTIVOCANCELACION_ID IS NULL)) "); sql.append(" and ((c.INDSTATUSBOLETO = 'C' AND c.MOTIVOCANCELACION_ID IS NOT NULL) OR (c.INDSTATUSBOLETO = 'V' AND c.MOTIVOCANCELACION_ID IS NULL)) ");
} else if (parametros.get("STATUS").toString().contains("C")) { } else if (parametros.get(STATUS).toString().contains("C")) {
sql.append(" and c.INDSTATUSBOLETO = 'C' AND c.MOTIVOCANCELACION_ID IS NOT NULL "); sql.append(" and c.INDSTATUSBOLETO = 'C' AND c.MOTIVOCANCELACION_ID IS NOT NULL ");
} else if (parametros.get("STATUS").toString().contains("V")) { } else if (parametros.get(STATUS).toString().contains("V")) {
sql.append(" and c.INDSTATUSBOLETO = 'V' AND c.MOTIVOCANCELACION_ID IS NULL "); sql.append(" and c.INDSTATUSBOLETO = 'V' AND c.MOTIVOCANCELACION_ID IS NULL ");
} }
} }
@ -140,8 +160,8 @@ public class RelatorioBilhetesVendidosNovoLayout extends Relatorio {
NamedParameterStatement stmt = new NamedParameterStatement(conexao, sql.toString()); NamedParameterStatement stmt = new NamedParameterStatement(conexao, sql.toString());
stmt.setInt("EMPRESA_ID", Integer.valueOf(parametros.get("EMPRESA_ID").toString())); stmt.setInt("EMPRESA_ID", Integer.valueOf(parametros.get("EMPRESA_ID").toString()));
stmt.setTimestamp("DATA_INICIAL", new Timestamp(DateUtil.inicioFecha((Date) parametros.get("DATA_INICIAL")).getTime())); stmt.setTimestamp(DATA_INICIAL, new Timestamp(DateUtil.inicioFecha((Date) parametros.get(DATA_INICIAL)).getTime()));
stmt.setTimestamp("DATA_FINAL", new Timestamp(DateUtil.fimFecha((Date) parametros.get("DATA_FINAL")).getTime())); stmt.setTimestamp(DATA_FINAL, new Timestamp(DateUtil.fimFecha((Date) parametros.get(DATA_FINAL)).getTime()));
ResultSet rset = stmt.executeQuery(); ResultSet rset = stmt.executeQuery();
lsDadosRelatorio = new ArrayList<RelatorioBilhetesVendidosNovoLayoutBean>(); lsDadosRelatorio = new ArrayList<RelatorioBilhetesVendidosNovoLayoutBean>();

View File

@ -28,6 +28,9 @@ public abstract class Relatorio {
protected static final String FEC_INICIO = "fecInicio"; protected static final String FEC_INICIO = "fecInicio";
protected static final String EMPRESA_ID = "empresaId"; protected static final String EMPRESA_ID = "empresaId";
protected static final String PUNTOVENTA_ID = "puntoventaId"; protected static final String PUNTOVENTA_ID = "puntoventaId";
protected static final String NUMPUNTOVENTA = "NUMPUNTOVENTA";
protected static final String DATA_FINAL = "DATA_FINAL";
protected static final String DATA_INICIAL = "DATA_INICIAL";
protected static final String FECHAMENTOCNTCORRENTE_ID = "fechamentocntcorrenteId"; protected static final String FECHAMENTOCNTCORRENTE_ID = "fechamentocntcorrenteId";
private Connection conexao; private Connection conexao;

View File

@ -229,12 +229,9 @@ public class RelatorioBilhetesVendidosController extends MyGenericForwardCompose
} else { } else {
filtro.append(" Todas;"); filtro.append(" Todas;");
} }
if(rgLayout.getSelectedItem().getValue().equals("DATA_VENDA")) {
parametros.put("TIPO_DATA", "DATA_VENDA"); parametros.put("TIPO_DATA", rgLayout.getSelectedItem().getValue());
}else {
rgLayout.getSelectedItem().getValue().equals("DATA_EMISSAO");
parametros.put("TIPO_DATA", "DATA_EMISSAO");
}
Comboitem itemEstado = cmbEstado.getSelectedItem(); Comboitem itemEstado = cmbEstado.getSelectedItem();
if (itemEstado != null) { if (itemEstado != null) {
Estado estado = (Estado) itemEstado.getValue(); Estado estado = (Estado) itemEstado.getValue();

View File

@ -8362,6 +8362,7 @@ relatorioBilhetesVendidosController.cancelado.label = Cancelado
relatorioBilhetesVendidosController.IdaVolta.label = Ida/Volta relatorioBilhetesVendidosController.IdaVolta.label = Ida/Volta
relatorioBilhetesVendidosController.dataVenda.label = Data Venda relatorioBilhetesVendidosController.dataVenda.label = Data Venda
relatorioBilhetesVendidosController.dataEmissao.label = Data Emissão relatorioBilhetesVendidosController.dataEmissao.label = Data Emissão
relatorioBilhetesVendidosController.dataViagem.label = Data Viagem
relatorioBilhetesVendidosController.transferido.label = Transferido relatorioBilhetesVendidosController.transferido.label = Transferido
relatorioBilhetesVendidosController.entregue.label = Entregue relatorioBilhetesVendidosController.entregue.label = Entregue
relatorioBilhetesVendidosController.reservado.label = Reservado relatorioBilhetesVendidosController.reservado.label = Reservado

View File

@ -584,6 +584,7 @@ relatorioBilhetesVendidosController.cancelado.label = Cancelado
relatorioBilhetesVendidosController.IdaVolta.label = Ida/Volta relatorioBilhetesVendidosController.IdaVolta.label = Ida/Volta
relatorioBilhetesVendidosController.dataVenda.label = Data Venda relatorioBilhetesVendidosController.dataVenda.label = Data Venda
relatorioBilhetesVendidosController.dataEmissao.label = Data Emissão relatorioBilhetesVendidosController.dataEmissao.label = Data Emissão
relatorioBilhetesVendidosController.dataViagem.label = Data Viagem
relatorioBilhetesVendidosController.transferido.label = Transferido relatorioBilhetesVendidosController.transferido.label = Transferido
relatorioBilhetesVendidosController.entregue.label = Entregue relatorioBilhetesVendidosController.entregue.label = Entregue
relatorioBilhetesVendidosController.reservado.label = Reservado relatorioBilhetesVendidosController.reservado.label = Reservado

View File

@ -8422,6 +8422,7 @@ relatorioBilhetesVendidosController.cancelado.label = Cancelado
relatorioBilhetesVendidosController.IdaVolta.label = Ida/Volta relatorioBilhetesVendidosController.IdaVolta.label = Ida/Volta
relatorioBilhetesVendidosController.dataVenda.label = Data Venda relatorioBilhetesVendidosController.dataVenda.label = Data Venda
relatorioBilhetesVendidosController.dataEmissao.label = Data Emissão relatorioBilhetesVendidosController.dataEmissao.label = Data Emissão
relatorioBilhetesVendidosController.dataViagem.label = Data Viagem
relatorioBilhetesVendidosController.transferido.label = Transferido relatorioBilhetesVendidosController.transferido.label = Transferido
relatorioBilhetesVendidosController.entregue.label = Entregue relatorioBilhetesVendidosController.entregue.label = Entregue
relatorioBilhetesVendidosController.reservado.label = Reservado relatorioBilhetesVendidosController.reservado.label = Reservado

View File

@ -122,10 +122,9 @@
</row> </row>
<row spans="3"> <row spans="3">
<radiogroup Id="rgLayout" > <radiogroup Id="rgLayout" >
<label value="${c:l('relatorioBilhetesVendidosController.dataVenda.label')}" /> <radio value="DATA_VENDA" label="${c:l('relatorioBilhetesVendidosController.dataVenda.label')}" checked = "true"/>
<radio value="DATA_VENDA" checked = "true"/> <radio value="DATA_EMISSAO" label="${c:l('relatorioBilhetesVendidosController.dataEmissao.label')}" />
<label value="${c:l('relatorioBilhetesVendidosController.dataEmissao.label')}" /> <radio value="DATA_VIAGEM" label="${c:l('relatorioBilhetesVendidosController.dataViagem.label')}" />
<radio value="DATA_EMISSAO" />
</radiogroup> </radiogroup>
</row> </row>
</rows> </rows>