Merge pull request 'fixes bug#AL-2771' (!234) from AL-2771 into master

Reviewed-on: adm/VentaBoletosAdm#234
Reviewed-by: Valdir Cordeiro <valdir.cordeiro@totvs.com.br>
Reviewed-by: pinheiro <valdevir@rjconsultores.com.br>
master 1.10.8
Gleison da Cruz 2023-07-26 18:27:46 +00:00
commit a0f63f191b
7 changed files with 190 additions and 94 deletions

View File

@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>br.com.rjconsultores</groupId> <groupId>br.com.rjconsultores</groupId>
<artifactId>ventaboletosadm</artifactId> <artifactId>ventaboletosadm</artifactId>
<version>1.10.7</version> <version>1.10.8</version>
<packaging>war</packaging> <packaging>war</packaging>
<properties> <properties>

View File

@ -35,6 +35,89 @@ public class RelatorioBilhetesVendidos extends Relatorio {
StringBuilder sql = new StringBuilder(); StringBuilder sql = new StringBuilder();
if (parametros.get("IDAVOLTA").equals("1")) {
sql.append(" select ");
sql.append(" u.CVEUSUARIO CVEBILHETEIRO, ");
sql.append(" uc.CVEUSUARIO CVEBILHETEIRO_CANCELADO, ");
sql.append(" B.indstatusboleto IMPRESSAO_POSTERIOR, ");
sql.append(" B.NUMFOLIOSISTEMA NUMERO_PASSAGEM, ");
sql.append(" B.NUMSERIEPREIMPRESA SERIE, ");
sql.append(" B.NUMSERIEPREIMPRESA SUB_SERIE, ");
sql.append(" B.NUMFOLIOPREIMPRESO PRE_IMPRESSO, ");
sql.append(" p_origen.PARADA_ID COD_ORIGEM, ");
sql.append(" p_origen.DESCPARADA ORIGEM, ");
sql.append(" p_destino.PARADA_ID COD_DESTINO, ");
sql.append(" p_destino.DESCPARADA DESTINO, ");
sql.append(" pv.NUMPUNTOVENTA COD_AGENCIA, ");
sql.append(" pv.NOMBPUNTOVENTA NOME_AGENCIA, ");
sql.append(" CASE WHEN B.indstatusboleto = 'E' THEN utilizado.fechorventa_h ELSE B.fechorventa_h END DATA_VENDA, ");
sql.append(" CASE WHEN b.fechorventa is null THEN utilizado.fechorventa ELSE b.fechorventa_h END DATA_EMISSAO, ");
sql.append(" B.fechorviaje DATA_VIAGEM, ");
sql.append(" B.CORRIDA_ID SERVICO, ");
sql.append(" to_char(B.fechorviaje, 'hh24:mi:ss') HORA, ");
sql.append(" B.NUMASIENTO NUMASIENTO, ");
sql.append(" ct.DESCCATEGORIA CATEGORIA, ");
sql.append(" R.INDSENTIDOIDA SENTIDO, ");
sql.append(" R.NUMRUTA COD_LINHA, ");
sql.append(" R.DESCRUTA DESC_LINHA, ");
sql.append(" CASE WHEN b.MOTIVOCANCELACION_ID IS NULL THEN 'V' ELSE 'C' END STATUS_PASSAGEM, ");
sql.append(" B.PRECIOPAGADO TARIFA, ");
sql.append(" B.IMPORTETAXAEMBARQUE TX_EMBARQUE, ");
sql.append(" B.IMPORTEPEDAGIO PEDAGIO, ");
sql.append(" B.IMPORTESEGURO SEGURO, ");
sql.append(" u.NOMBUSUARIO BILHETEIRO, ");
sql.append(" uc.NOMBUSUARIO BILHETEIRO_CANCELAMENTO ");
sql.append(" FROM caja B ");
sql.append(" LEFT JOIN boleto bo ON (bo.boleto_id = b.transacaooriginal_id AND b.indstatusboleto = 'C') ");
sql.append(" JOIN RUTA R ON R.RUTA_ID = B.RUTA_ID ");
sql.append(" JOIN PUNTO_VENTA pv on B.PUNTOVENTA_ID = pv.PUNTOVENTA_ID ");
sql.append(" JOIN USUARIO u on u.USUARIO_ID = B.USUARIO_ID ");
sql.append(" LEFT JOIN USUARIO uc ON uc.USUARIO_ID = bo.USUARIO_ID ");
sql.append(" JOIN PARADA p_origen on p_origen.PARADA_ID = B.ORIGEN_ID ");
sql.append(" JOIN PARADA p_destino on p_destino.PARADA_ID = B.DESTINO_ID ");
sql.append(" JOIN CATEGORIA ct on ct.CATEGORIA_ID = B.CATEGORIA_ID ");
sql.append(" JOIN CLASE_SERVICIO cs on cs.CLASESERVICIO_ID = B.CLASESERVICIO_ID ");
sql.append(" JOIN MARCA m on m.marca_id = b.marca_id ");
sql.append(" left join ciudad co ON co.ciudad_id = p_origen.ciudad_id ");
sql.append(" left join estado est ON est.estado_id = co.estado_id ");
sql.append(" LEFT JOIN boleto utilizado ON (utilizado.boleto_id = b.transacaooriginal_id AND b.INDSTATUSBOLETO = 'E') ");
sql.append(" WHERE ");
sql.append(" (b.indreimpresion = 0 OR b.INDSTATUSBOLETO = 'E') ");
sql.append(" and m.EMPRESA_ID = :EMPRESA_ID ");
if (parametros.get("DATA_INICIAL") != null && parametros.get("DATA_FINAL") != null) {
if (parametros.get("TIPO_DATA") != null) {
if ((parametros.get("TIPO_DATA").toString().contains("DATA_VENDA"))) {
sql.append(" and b.FECHORVENTA_H >= :DATA_INICIAL ");
sql.append(" and b.FECHORVENTA_H <= :DATA_FINAL ");
} else {
sql.append(" and utilizado.FECHORVENTA >= :DATA_INICIAL ");
sql.append(" and utilizado.FECHORVENTA <= :DATA_FINAL ");
}
}
}
if (parametros.get("NUMPUNTOVENTA") != null && !parametros.get("NUMPUNTOVENTA").equals("-1")) {
sql.append(" and pv.PUNTOVENTA_ID IN (" + parametros.get("NUMPUNTOVENTA").toString() + ")");
}
if (parametros.get("MOEDA_ID") != null) {
sql.append(" and NVL(B.MONEDA_ID, 1) = "+parametros.get("MOEDA_ID") );
}
if (parametros.get("ESTADO_ID") != null && !parametros.get("ESTADO_ID").equals("-1")) {
sql.append(" and est.estado_id = " + parametros.get("ESTADO_ID").toString() + "");
}
sql.append(" AND b.INDVIAJEREDONDO = 1 ");
}
if (parametros.get("STATUS").toString().contains("C")) {
if (parametros.get("IDAVOLTA").equals("1")) {
sql.append(" UNION ALL ");
}
sql.append(" select "); sql.append(" select ");
sql.append(" u.CVEUSUARIO CVEBILHETEIRO, "); sql.append(" u.CVEUSUARIO CVEBILHETEIRO, ");
sql.append(" uc.CVEUSUARIO CVEBILHETEIRO_CANCELADO, "); sql.append(" uc.CVEUSUARIO CVEBILHETEIRO_CANCELADO, ");
@ -109,7 +192,6 @@ public class RelatorioBilhetesVendidos extends Relatorio {
sql.append(" and est.estado_id = " + parametros.get("ESTADO_ID").toString() + ""); sql.append(" and est.estado_id = " + parametros.get("ESTADO_ID").toString() + "");
} }
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")) ) {
if (parametros.get("STATUS").toString().contains("C")) { if (parametros.get("STATUS").toString().contains("C")) {
sql.append(" AND b.motivocancelacion_id is not null "); sql.append(" AND b.motivocancelacion_id is not null ");
@ -117,21 +199,24 @@ public class RelatorioBilhetesVendidos extends Relatorio {
sql.append(" AND b.motivocancelacion_id is null "); sql.append(" AND b.motivocancelacion_id is null ");
} }
} }
sql.append(" and B.ACTIVO = 1 AND b.INDVIAJEREDONDO IS NULL ");
} }
sql.append(" and B.ACTIVO = 1 ");
sql.append(" order by "); sql.append(" order by ");
sql.append(" utilizado.FECHORVENTA, "); if (parametros.get("IDAVOLTA").equals("1")) {
sql.append(" b.FECHORVENTA , "); sql.append(" BILHETEIRO, ");
sql.append(" u.NOMBUSUARIO, "); sql.append(" DATA_EMISSAO, ");
sql.append(" pv.NUMPUNTOVENTA, "); }else {
sql.append(" pv.NOMBPUNTOVENTA, "); sql.append(" DATA_EMISSAO, ");
sql.append(" B.NUMFOLIOSISTEMA, "); sql.append(" BILHETEIRO, ");
sql.append(" p_origen.DESCPARADA, "); }
sql.append(" p_destino.DESCPARADA, "); sql.append(" COD_AGENCIA, ");
sql.append(" ct.DESCCATEGORIA, "); sql.append(" NOME_AGENCIA, ");
sql.append(" B.INDSTATUSBOLETO, "); sql.append(" NUMERO_PASSAGEM, ");
sql.append(" B.FECCORRIDA, "); sql.append(" ORIGEM, ");
sql.append(" B.CORRIDA_ID "); sql.append(" DESTINO, ");
sql.append(" CATEGORIA, ");
sql.append(" IMPRESSAO_POSTERIOR, ");
sql.append(" SERVICO ");
NamedParameterStatement stmt = new NamedParameterStatement(conexao, sql.toString()); NamedParameterStatement stmt = new NamedParameterStatement(conexao, sql.toString());
@ -141,7 +226,7 @@ public class RelatorioBilhetesVendidos extends Relatorio {
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();
while (rset.next()) { while (rset.next()) {

View File

@ -73,6 +73,7 @@ public class RelatorioBilhetesVendidosController extends MyGenericForwardCompose
private Paging pagingPuntoVenta; private Paging pagingPuntoVenta;
private Checkbox chkVendido; private Checkbox chkVendido;
private Checkbox chkCancelado; private Checkbox chkCancelado;
private Checkbox chkIdaVolta;
private Checkbox chkEmitido; private Checkbox chkEmitido;
private Radiogroup rgLayout; private Radiogroup rgLayout;
@Autowired @Autowired
@ -242,6 +243,12 @@ public class RelatorioBilhetesVendidosController extends MyGenericForwardCompose
} else { } else {
parametros.put("ESTADO", "TODOS"); parametros.put("ESTADO", "TODOS");
} }
if (chkIdaVolta.isChecked()){
parametros.put("IDAVOLTA", "1");
filtro.append(" Ida / Volta;");
}else {
parametros.put("IDAVOLTA", "0");
}
if (novoLayout) { if (novoLayout) {
relatorio = new RelatorioBilhetesVendidosNovoLayout(parametros, dataSourceRead.getConnection()); relatorio = new RelatorioBilhetesVendidosNovoLayout(parametros, dataSourceRead.getConnection());

View File

@ -8296,6 +8296,7 @@ relatorioBilhetesVendidosController.lbStatus.value = Status
relatorioBilhetesVendidosController.lbNumero.value = Número relatorioBilhetesVendidosController.lbNumero.value = Número
relatorioBilhetesVendidosController.vendido.label = Vendido relatorioBilhetesVendidosController.vendido.label = Vendido
relatorioBilhetesVendidosController.cancelado.label = Cancelado relatorioBilhetesVendidosController.cancelado.label = Cancelado
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.transferido.label = Transferido relatorioBilhetesVendidosController.transferido.label = Transferido

View File

@ -557,6 +557,7 @@ relatorioBilhetesVendidosController.lbStatus.value = Status
relatorioBilhetesVendidosController.lbNumero.value = Número relatorioBilhetesVendidosController.lbNumero.value = Número
relatorioBilhetesVendidosController.vendido.label = Vendido relatorioBilhetesVendidosController.vendido.label = Vendido
relatorioBilhetesVendidosController.cancelado.label = Cancelado relatorioBilhetesVendidosController.cancelado.label = Cancelado
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.transferido.label = Transferido relatorioBilhetesVendidosController.transferido.label = Transferido

View File

@ -8319,6 +8319,7 @@ relatorioBilhetesVendidosController.lbStatus.value = Status
relatorioBilhetesVendidosController.lbNumero.value = Número relatorioBilhetesVendidosController.lbNumero.value = Número
relatorioBilhetesVendidosController.vendido.label = Vendido relatorioBilhetesVendidosController.vendido.label = Vendido
relatorioBilhetesVendidosController.cancelado.label = Cancelado relatorioBilhetesVendidosController.cancelado.label = Cancelado
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.transferido.label = Transferido relatorioBilhetesVendidosController.transferido.label = Transferido

View File

@ -104,20 +104,21 @@
</grid> </grid>
<grid fixedLayout="true"> <grid fixedLayout="true">
<columns> <columns>
<column width="40%" /> <column width="30%" />
<column width="40%" /> <column width="30%" />
<column width="30%" />
</columns> </columns>
<rows> <rows>
<row> <row>
<label <label
value="${c:l('relatorioBilhetesVendidosController.lbStatus.value')}" /> value="${c:l('relatorioBilhetesVendidosController.lbStatus.value')}" />
<label value="" /> <label value="" />
<label value="" />
</row> </row>
<row> <row>
<checkbox id="chkVendido" <checkbox id="chkVendido" label="${c:l('relatorioBilhetesVendidosController.vendido.label')}" />
label="${c:l('relatorioBilhetesVendidosController.vendido.label')}" /> <checkbox id="chkCancelado" label="${c:l('relatorioBilhetesVendidosController.cancelado.label')}" />
<checkbox id="chkCancelado" <checkbox id="chkIdaVolta" label="${c:l('relatorioBilhetesVendidosController.IdaVolta.label')}" />
label="${c:l('relatorioBilhetesVendidosController.cancelado.label')}" />
</row> </row>
<row spans="3"> <row spans="3">
<radiogroup Id="rgLayout" > <radiogroup Id="rgLayout" >