diff --git a/pom.xml b/pom.xml
index 3ed1b3ddd..150cbc012 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
4.0.0
br.com.rjconsultores
ventaboletosadm
- 1.49.2
+ 1.50.0
war
diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioBilhetesVendidos.java b/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioBilhetesVendidos.java
index 3b129c150..c2b7ff1c2 100644
--- a/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioBilhetesVendidos.java
+++ b/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioBilhetesVendidos.java
@@ -23,6 +23,11 @@ import com.rjconsultores.ventaboletos.web.utilerias.NamedParameterStatement;
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 parametros, Connection conexao) throws Exception {
super(parametros, conexao);
@@ -70,7 +75,6 @@ public class RelatorioBilhetesVendidos extends Relatorio {
sql.append(" B.NOMBPASAJERO AS PASSAGEIRO, ");
sql.append(" B.DESCNUMDOC AS DOC, ");
sql.append(" COALESCE(b.NUMOPERACION, bo.NUMOPERACION) AS LOCALIZADOR ");
-
sql.append(" FROM caja B ");
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(" (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"))) {
+ if (parametros.get(DATA_INICIAL) != null && parametros.get(DATA_FINAL) != null) {
+ if (parametros.get(TIPO_DATA) != null) {
+ if ((parametros.get(TIPO_DATA).toString().equals(DATA_VENDA))) {
sql.append(" and b.FECHORVENTA_H >= :DATA_INICIAL ");
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_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(" (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"))) {
+ if (parametros.get(DATA_INICIAL) != null && parametros.get(DATA_FINAL) != null) {
+ if (parametros.get(TIPO_DATA) != null) {
+ if ((parametros.get(TIPO_DATA).toString().equals(DATA_VENDA))) {
sql.append(" and b.FECHORVENTA_H >= :DATA_INICIAL ");
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_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());
stmt.setInt("EMPRESA_ID", Integer.valueOf(parametros.get("EMPRESA_ID").toString()));
- 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_FINAL", new Timestamp(DateUtil.fimFecha((Date) parametros.get("DATA_FINAL")).getTime()));
+ 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_FINAL, new Timestamp(DateUtil.fimFecha((Date) parametros.get(DATA_FINAL)).getTime()));
}
ResultSet rset = stmt.executeQuery();
@@ -258,7 +276,7 @@ public class RelatorioBilhetesVendidos extends Relatorio {
dataResult.put("DESTINO", rset.getString("DESTINO"));
dataResult.put("NOME_AGENCIA", rset.getString("NOME_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_VIAGEM", rset.getDate("DATA_VIAGEM"));
dataResult.put("SERVICO", rset.getString("SERVICO"));
diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioBilhetesVendidosNovoLayout.java b/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioBilhetesVendidosNovoLayout.java
index 070411ad1..4b4394caa 100644
--- a/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioBilhetesVendidosNovoLayout.java
+++ b/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioBilhetesVendidosNovoLayout.java
@@ -32,6 +32,10 @@ import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource;
*
*/
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 parametros, Connection conexao) throws Exception {
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 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 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(" and ei.estado_id = est.estado_id");
sql.append(" where ");
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 ei.activo = 1");
- if (parametros.get("NUMPUNTOVENTA") != null && !parametros.get("NUMPUNTOVENTA").equals("-1")) {
- sql.append(" and pv.PUNTOVENTA_ID IN (" + parametros.get("NUMPUNTOVENTA").toString() + ")");
+ if (parametros.get(NUMPUNTOVENTA) != null && !parametros.get(NUMPUNTOVENTA).equals("-1")) {
+ sql.append(" and pv.PUNTOVENTA_ID IN (" + parametros.get(NUMPUNTOVENTA).toString() + ")");
}
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") );
}
- if (parametros.get("STATUS") != null) {
- if (parametros.get("STATUS").toString().contains("V") && parametros.get("STATUS").toString().contains("C")) {
+ if (parametros.get(STATUS) != null) {
+ 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)) ");
- } 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 ");
- } 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 ");
}
}
@@ -140,8 +160,8 @@ public class RelatorioBilhetesVendidosNovoLayout extends Relatorio {
NamedParameterStatement stmt = new NamedParameterStatement(conexao, sql.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_FINAL", new Timestamp(DateUtil.fimFecha((Date) parametros.get("DATA_FINAL")).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()));
ResultSet rset = stmt.executeQuery();
lsDadosRelatorio = new ArrayList();
diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/utilitarios/Relatorio.java b/src/java/com/rjconsultores/ventaboletos/relatorios/utilitarios/Relatorio.java
index 0e252c188..867ef0f67 100644
--- a/src/java/com/rjconsultores/ventaboletos/relatorios/utilitarios/Relatorio.java
+++ b/src/java/com/rjconsultores/ventaboletos/relatorios/utilitarios/Relatorio.java
@@ -28,6 +28,9 @@ public abstract class Relatorio {
protected static final String FEC_INICIO = "fecInicio";
protected static final String EMPRESA_ID = "empresaId";
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";
private Connection conexao;
diff --git a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioBilhetesVendidosController.java b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioBilhetesVendidosController.java
index 0db78c6f8..40307b0a3 100644
--- a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioBilhetesVendidosController.java
+++ b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioBilhetesVendidosController.java
@@ -229,12 +229,9 @@ public class RelatorioBilhetesVendidosController extends MyGenericForwardCompose
} else {
filtro.append(" Todas;");
}
- if(rgLayout.getSelectedItem().getValue().equals("DATA_VENDA")) {
- parametros.put("TIPO_DATA", "DATA_VENDA");
- }else {
- rgLayout.getSelectedItem().getValue().equals("DATA_EMISSAO");
- parametros.put("TIPO_DATA", "DATA_EMISSAO");
- }
+
+ parametros.put("TIPO_DATA", rgLayout.getSelectedItem().getValue());
+
Comboitem itemEstado = cmbEstado.getSelectedItem();
if (itemEstado != null) {
Estado estado = (Estado) itemEstado.getValue();
diff --git a/web/WEB-INF/i3-label_en.label b/web/WEB-INF/i3-label_en.label
index 516b44fe4..59bfe75c3 100644
--- a/web/WEB-INF/i3-label_en.label
+++ b/web/WEB-INF/i3-label_en.label
@@ -8362,6 +8362,7 @@ relatorioBilhetesVendidosController.cancelado.label = Cancelado
relatorioBilhetesVendidosController.IdaVolta.label = Ida/Volta
relatorioBilhetesVendidosController.dataVenda.label = Data Venda
relatorioBilhetesVendidosController.dataEmissao.label = Data Emissão
+relatorioBilhetesVendidosController.dataViagem.label = Data Viagem
relatorioBilhetesVendidosController.transferido.label = Transferido
relatorioBilhetesVendidosController.entregue.label = Entregue
relatorioBilhetesVendidosController.reservado.label = Reservado
diff --git a/web/WEB-INF/i3-label_es_MX.label b/web/WEB-INF/i3-label_es_MX.label
index 59f768325..289a7042e 100644
--- a/web/WEB-INF/i3-label_es_MX.label
+++ b/web/WEB-INF/i3-label_es_MX.label
@@ -584,6 +584,7 @@ relatorioBilhetesVendidosController.cancelado.label = Cancelado
relatorioBilhetesVendidosController.IdaVolta.label = Ida/Volta
relatorioBilhetesVendidosController.dataVenda.label = Data Venda
relatorioBilhetesVendidosController.dataEmissao.label = Data Emissão
+relatorioBilhetesVendidosController.dataViagem.label = Data Viagem
relatorioBilhetesVendidosController.transferido.label = Transferido
relatorioBilhetesVendidosController.entregue.label = Entregue
relatorioBilhetesVendidosController.reservado.label = Reservado
diff --git a/web/WEB-INF/i3-label_pt_BR.label b/web/WEB-INF/i3-label_pt_BR.label
index 3c1193a3d..180769eca 100644
--- a/web/WEB-INF/i3-label_pt_BR.label
+++ b/web/WEB-INF/i3-label_pt_BR.label
@@ -8422,6 +8422,7 @@ relatorioBilhetesVendidosController.cancelado.label = Cancelado
relatorioBilhetesVendidosController.IdaVolta.label = Ida/Volta
relatorioBilhetesVendidosController.dataVenda.label = Data Venda
relatorioBilhetesVendidosController.dataEmissao.label = Data Emissão
+relatorioBilhetesVendidosController.dataViagem.label = Data Viagem
relatorioBilhetesVendidosController.transferido.label = Transferido
relatorioBilhetesVendidosController.entregue.label = Entregue
relatorioBilhetesVendidosController.reservado.label = Reservado
diff --git a/web/gui/relatorios/filtroRelatorioBilhetesVendidos.zul b/web/gui/relatorios/filtroRelatorioBilhetesVendidos.zul
index 1748be100..f2aa750d8 100644
--- a/web/gui/relatorios/filtroRelatorioBilhetesVendidos.zul
+++ b/web/gui/relatorios/filtroRelatorioBilhetesVendidos.zul
@@ -122,10 +122,9 @@
-
-
-
-
+
+
+