diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioBPe.java b/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioBPe.java
index c0ce54baf..4cfb729dd 100644
--- a/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioBPe.java
+++ b/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioBPe.java
@@ -1,7 +1,6 @@
package com.rjconsultores.ventaboletos.relatorios.impl;
import java.sql.Connection;
-import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.Date;
import java.util.HashMap;
@@ -13,6 +12,7 @@ import com.rjconsultores.ventaboletos.relatorios.utilitarios.ArrayDataSource;
import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio;
import com.rjconsultores.ventaboletos.service.ConstanteService;
import com.rjconsultores.ventaboletos.utilerias.DateUtil;
+import com.rjconsultores.ventaboletos.web.utilerias.NamedParameterStatement;
import com.rjconsultores.ventaboletos.web.utilerias.spring.AppContext;
public class RelatorioBPe extends Relatorio {
@@ -31,10 +31,22 @@ public class RelatorioBPe extends Relatorio {
Date dtInicio = (Date) parametros.get("DATA_INICIO");
Date dtFim = (Date) parametros.get("DATA_FIM");
+ String chBpe = (String) parametros.get("CHBPE");
+ String numBpe = (String) parametros.get("NUMBPE");
- PreparedStatement ps = conexao.prepareStatement(sql.toString());
- ps.setString(1, DateUtil.getStringDate(dtInicio, "dd/MM/yyyy") + " 00:00:00");
- ps.setString(2, DateUtil.getStringDate(dtFim, "dd/MM/yyyy") + " 23:59:59");
+ NamedParameterStatement ps = new NamedParameterStatement(conexao, sql.toString());
+ if(dtInicio != null && dtFim != null) {
+ ps.setString("dataInicio", DateUtil.getStringDate(dtInicio, "dd/MM/yyyy") + " 00:00:00");
+ ps.setString("dataFinal", DateUtil.getStringDate(dtFim, "dd/MM/yyyy") + " 23:59:59");
+ }
+
+ if(StringUtils.isNotBlank(chBpe)) {
+ ps.setString("chbpe", chBpe);
+ }
+
+ if(StringUtils.isNotBlank(numBpe)) {
+ ps.setString("numbpe",numBpe);
+ }
ResultSet rset = ps.executeQuery();
@@ -75,6 +87,10 @@ public class RelatorioBPe extends Relatorio {
String estados = (String) parametros.get("ESTADOS_ID");
Integer empresaId = (Integer) parametros.get("EMPRESA_ID");
String status = (String) parametros.get("STATUS");
+ String chBpe = (String) parametros.get("CHBPE");
+ String numBpe = (String) parametros.get("NUMBPE");
+ Date dtInicio = (Date) parametros.get("DATA_INICIO");
+ Date dtFim = (Date) parametros.get("DATA_FIM");
sql.append("SELECT");
sql.append(" TO_CHAR(COALESCE(bpe.DT_VENDA,bol.FECHORVENTA),'dd/mm/yyyy') as dtvenda, ");
@@ -114,6 +130,10 @@ public class RelatorioBPe extends Relatorio {
sql.append(" ) ");
sql.append(" when '150' then 'Aut.Conting.' ");
+ sql.append(" when '-1' then 'Pendente Envio' ");
+ sql.append(" when '-2' then 'Pendente Envio' ");
+ sql.append(" when '-10' then 'Rejeitado Envio Contingência' ");
+ sql.append(" when '-20' then 'Rejeitado Envio Contingência' ");
sql.append(" else 'Rejeitado' ");
sql.append(" end as status, ");
@@ -150,20 +170,32 @@ public class RelatorioBPe extends Relatorio {
} else if (status != null && status.equals("NE")) {//Nao Embarcado
sql.append(" AND bpe.CODSTAT = '135' AND bpe.TIPOEVENTO = '110115' AND bol.ACTIVO = 1 ");
} else if (status != null && status.equals("R")) {//Rejeitado
- sql.append(" AND bpe.CODSTAT NOT IN ('100','135','102','150') ");
+ sql.append(" AND bpe.CODSTAT NOT IN ('100','135','102','150','-1','-2') ");
}else if (status != null && status.equals("AA")) {//Autorizado Contingencia
sql.append(" AND bpe.CODSTAT = '150' AND bol.ACTIVO = 1 ");
}else if (status != null && status.equals("RC")) {//Rejeitado Envio Contingencia
sql.append(" AND bpe.CODSTAT IN ('-10','-20') AND bol.ACTIVO = 1 ");
+ } else if (status != null && status.equals("PE")) {//Pendente Envio
+ sql.append(" AND bpe.CODSTAT IN ('-1','-2') ");
}
- if(StringUtils.isNotBlank(constanteService.buscarPorNomeConstante("RELATORIO_BPE_OTIMIZADO").getValorconstante()) && Boolean.parseBoolean(constanteService.buscarPorNomeConstante("RELATORIO_BPE_OTIMIZADO").getValorconstante())) {
- sql.append(" AND bol.FECHORVENTA >= TO_DATE(?,'DD/MM/YYYY HH24:MI:SS') ");
- sql.append(" AND bol.FECHORVENTA <= TO_DATE(?,'DD/MM/YYYY HH24:MI:SS') ");
- }else {
- sql.append(" AND COALESCE(bpe.DT_VENDA,bol.FECHORVENTA) >= TO_DATE(?,'DD/MM/YYYY HH24:MI:SS') ");
- sql.append(" AND COALESCE(bpe.DT_VENDA,bol.FECHORVENTA) <= TO_DATE(?,'DD/MM/YYYY HH24:MI:SS') ");
+
+ if(dtInicio != null && dtFim != null) {
+ if(StringUtils.isNotBlank(constanteService.buscarPorNomeConstante("RELATORIO_BPE_OTIMIZADO").getValorconstante()) && Boolean.parseBoolean(constanteService.buscarPorNomeConstante("RELATORIO_BPE_OTIMIZADO").getValorconstante())) {
+ sql.append(" AND bol.FECHORVENTA >= TO_DATE(:dataInicio,'DD/MM/YYYY HH24:MI:SS') ");
+ sql.append(" AND bol.FECHORVENTA <= TO_DATE(:dataFinal,'DD/MM/YYYY HH24:MI:SS') ");
+ }else {
+ sql.append(" AND COALESCE(bpe.DT_VENDA,bol.FECHORVENTA) >= TO_DATE(:dataInicio,'DD/MM/YYYY HH24:MI:SS') ");
+ sql.append(" AND COALESCE(bpe.DT_VENDA,bol.FECHORVENTA) <= TO_DATE(:dataFinal,'DD/MM/YYYY HH24:MI:SS') ");
+ }
}
+ if(StringUtils.isNotBlank(chBpe)) {
+ sql.append(" AND bpe.CHBPE = :chbpe ");
+ }
+
+ if(StringUtils.isNotBlank(numBpe)) {
+ sql.append(" AND bol.NUM_BPE = :numbpe ");
+ }
sql.append(" ORDER BY bol.NUM_BPE, COALESCE(bol.NUMSERIE_BPE, '1') ASC ");
diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioBPe.jasper b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioBPe.jasper
index 571dc1274..7c89a0afe 100644
Binary files a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioBPe.jasper and b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioBPe.jasper differ
diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioBPe.jrxml b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioBPe.jrxml
index 9060dbf3d..855efd327 100644
--- a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioBPe.jrxml
+++ b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioBPe.jrxml
@@ -50,7 +50,7 @@
-
+
diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioBPeRejeitadoEnvioContingencia.jasper b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioBPeRejeitadoEnvioContingencia.jasper
index 5b80f1745..1df6558ce 100644
Binary files a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioBPeRejeitadoEnvioContingencia.jasper and b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioBPeRejeitadoEnvioContingencia.jasper differ
diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioBPeRejeitadoEnvioContingencia.jrxml b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioBPeRejeitadoEnvioContingencia.jrxml
index f51be8a1b..1a4daa29b 100644
--- a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioBPeRejeitadoEnvioContingencia.jrxml
+++ b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioBPeRejeitadoEnvioContingencia.jrxml
@@ -1,7 +1,7 @@
-
+
@@ -51,7 +51,7 @@
-
+
diff --git a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioBPeController.java b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioBPeController.java
index aa1af1264..caa499665 100644
--- a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioBPeController.java
+++ b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioBPeController.java
@@ -1,12 +1,12 @@
package com.rjconsultores.ventaboletos.web.gui.controladores.relatorios;
-import java.text.SimpleDateFormat;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.sql.DataSource;
+import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
@@ -19,6 +19,7 @@ import org.zkoss.zul.Comboitem;
import org.zkoss.zul.Datebox;
import org.zkoss.zul.Radio;
import org.zkoss.zul.Radiogroup;
+import org.zkoss.zul.Textbox;
import com.rjconsultores.ventaboletos.entidad.Empresa;
import com.rjconsultores.ventaboletos.entidad.Estado;
@@ -27,6 +28,7 @@ import com.rjconsultores.ventaboletos.relatorios.impl.RelatorioBPeRejeitadoEnvio
import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio;
import com.rjconsultores.ventaboletos.service.EmpresaService;
import com.rjconsultores.ventaboletos.service.EstadoService;
+import com.rjconsultores.ventaboletos.utilerias.DateUtil;
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEstandar;
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
@@ -46,6 +48,8 @@ public class RelatorioBPeController extends MyGenericForwardComposer {
private Radio rdbStatus;
private Radiogroup rdbGroup;
private MyListbox estadoList;
+ private Textbox txtChBpe;
+ private Textbox txtNumBpe;
private List lsEmpresa;
private List lsEstado;
@@ -71,22 +75,21 @@ public class RelatorioBPeController extends MyGenericForwardComposer {
private void executarRelatorio() throws Exception {
Map parametros = new HashMap();
StringBuilder filtro = new StringBuilder();
- SimpleDateFormat format = new SimpleDateFormat("dd/MM/yyyy");
if (!validar()) {
return;
}
- if (dtInicio.getValue() != null) {
+ if (dtInicio.getValue() != null && dtFim.getValue() != null) {
filtro.append("Data: ")
- .append(format.format(dtInicio.getValue()))
+ .append(DateUtil.getStringDate(dtInicio.getValue(), "dd/MM/yyyy"))
.append(" - ")
- .append(format.format(dtFim.getValue()))
+ .append(DateUtil.getStringDate(dtFim.getValue(), "dd/MM/yyyy"))
.append(";");
+ parametros.put("DATA_INICIO", (java.util.Date) dtInicio.getValue());
+ parametros.put("DATA_FIM", (java.util.Date) dtFim.getValue());
}
- parametros.put("DATA_INICIO", (java.util.Date) dtInicio.getValue());
- parametros.put("DATA_FIM", (java.util.Date) dtFim.getValue());
parametros.put("NOME_RELATORIO", Labels.getLabel("relatorioBPeController.window.title"));
parametros.put("USUARIO", UsuarioLogado.getUsuarioLogado().getUsuarioId().toString());
@@ -117,18 +120,30 @@ public class RelatorioBPeController extends MyGenericForwardComposer {
if (itemEmpresa != null) {
Empresa empresa = (Empresa) itemEmpresa.getValue();
parametros.put("EMPRESA_ID", empresa.getEmpresaId());
- filtro.append(empresa.getNombempresa() + ";");
+ filtro.append(empresa.getNombempresa()).append(";");
} else {
filtro.append(" Todas; ");
}
- filtro.append(" Status: " + rdbGroup.getSelectedItem().getLabel());
+ filtro.append(" Status: ").append(rdbGroup.getSelectedItem().getLabel()).append("; ");
parametros.put("STATUS", rdbGroup.getSelectedItem().getValue());
+ txtChBpe.getValue();
+ if(StringUtils.isNotBlank(txtChBpe.getValue())) {
+ filtro.append("Chave BP-e: ").append(txtChBpe.getValue()).append("; ");
+ parametros.put("CHBPE", txtChBpe.getValue());
+ }
+
+ txtNumBpe.getValue();
+ if(StringUtils.isNotBlank(txtNumBpe.getValue())) {
+ filtro.append("Número BP-e: ").append(txtNumBpe.getValue()).append("; ");
+ parametros.put("NUMBPE", txtNumBpe.getValue());
+ }
+
parametros.put("FILTROS", filtro.toString());
Relatorio relatorio = null;
- if(rdbGroup.getSelectedItem().getValue().equals("RC")) {
+ if(rdbGroup.getSelectedItem().getValue().equals("RC") || rdbGroup.getSelectedItem().getValue().equals("R")) {
relatorio = new RelatorioBPeRejeitadoEnvioContingencia(parametros, dataSourceRead.getConnection());
} else {
relatorio = new RelatorioBPe(parametros, dataSourceRead.getConnection());
@@ -143,18 +158,25 @@ public class RelatorioBPeController extends MyGenericForwardComposer {
private boolean validar() {
try {
- if (dtInicio.getValue() == null || dtFim.getValue() == null) {
- Messagebox.show(Labels.getLabel("relatorioBPeController.MSG.informarData"),
- Labels.getLabel("relatorioBPeController.window.title"),
- Messagebox.OK, Messagebox.INFORMATION);
- return false;
- }
+ txtChBpe.getValue();
+ txtNumBpe.getValue();
- if(dtInicio.getValue().after(dtFim.getValue())){
- Messagebox.show(Labels.getLabel("relatorioBPeController.MSG.dataInicialMaiorQueFinal"),
- Labels.getLabel("relatorioBPeController.window.title"),
- Messagebox.OK, Messagebox.INFORMATION);
- return false;
+ boolean isFiltroChbpeOrNumbpe = StringUtils.isNotBlank(txtChBpe.getValue()) || StringUtils.isNotBlank(txtNumBpe.getValue());
+
+ if(!isFiltroChbpeOrNumbpe) {
+ if (dtInicio.getValue() == null || dtFim.getValue() == null) {
+ Messagebox.show(Labels.getLabel("relatorioBPeController.MSG.informarData"),
+ Labels.getLabel("relatorioBPeController.window.title"),
+ Messagebox.OK, Messagebox.INFORMATION);
+ return false;
+ }
+
+ if(dtInicio.getValue().after(dtFim.getValue())){
+ Messagebox.show(Labels.getLabel("relatorioBPeController.MSG.dataInicialMaiorQueFinal"),
+ Labels.getLabel("relatorioBPeController.window.title"),
+ Messagebox.OK, Messagebox.INFORMATION);
+ return false;
+ }
}
} catch (InterruptedException ex) {
diff --git a/web/WEB-INF/i3-label_es_MX.label b/web/WEB-INF/i3-label_es_MX.label
index 78a6c5e35..af3484b0c 100644
--- a/web/WEB-INF/i3-label_es_MX.label
+++ b/web/WEB-INF/i3-label_es_MX.label
@@ -8034,6 +8034,11 @@ relatorioBPeController.lbAutorConting.value = Autorizado em ContingĂȘncia
relatorioBPeController.lbAutorConting.value.tooltiptext = Exibe os bilhetes Autorizados em ContingĂȘncia
relatorioBPeController.lbRejeitadoEnvioContingencia.value = Rejeitado Envio em ContingĂȘncia
relatorioBPeController.lbRejeitadoEnvioContingencia.value.tooltiptext = Exibe os bilhetes Rejeitados com Envio em ContingĂȘncia
+relatorioBPeController.lbPendenteEnvio.value = Pendente Envio ContingĂȘncia
+relatorioBPeController.lbPendenteEnvio.value.tooltiptext = Exibe os bilhetes na fila para Envio em ContingĂȘncia
+relatorioBPeController.lbChbpe.value = Chave BP-e
+relatorioBPeController.lbNumbpe.value = NĂșmero BP-e
+
relatorioBPeController.MSG.informarData = Favor informar data inicial e final.
relatorioBPeController.MSG.dataInicialMaiorQueFinal = Data de inicio nĂŁo pode ser maior do que a final.
diff --git a/web/WEB-INF/i3-label_pt_BR.label b/web/WEB-INF/i3-label_pt_BR.label
index 51f72217d..e3a974089 100644
--- a/web/WEB-INF/i3-label_pt_BR.label
+++ b/web/WEB-INF/i3-label_pt_BR.label
@@ -8562,6 +8562,10 @@ relatorioBPeController.lbAutorConting.value = Autorizado em ContingĂȘncia
relatorioBPeController.lbAutorConting.value.tooltiptext = Exibe os bilhetes Autorizados em ContingĂȘncia
relatorioBPeController.lbRejeitadoEnvioContingencia.value = Rejeitado Envio em ContingĂȘncia
relatorioBPeController.lbRejeitadoEnvioContingencia.value.tooltiptext = Exibe os bilhetes Rejeitados com Envio em ContingĂȘncia
+relatorioBPeController.lbPendenteEnvio.value = Pendente Envio ContingĂȘncia
+relatorioBPeController.lbPendenteEnvio.value.tooltiptext = Exibe os bilhetes na fila para Envio em ContingĂȘncia
+relatorioBPeController.lbChbpe.value = Chave BP-e
+relatorioBPeController.lbNumbpe.value = NĂșmero BP-e
relatorioBPeController.MSG.informarData = Favor informar data inicial e final.
relatorioBPeController.MSG.dataInicialMaiorQueFinal = Data de inicio nĂŁo pode ser maior do que a final.
diff --git a/web/gui/relatorios/filtroRelatorioBPe.zul b/web/gui/relatorios/filtroRelatorioBPe.zul
index 72d0ca962..1021e76c8 100644
--- a/web/gui/relatorios/filtroRelatorioBPe.zul
+++ b/web/gui/relatorios/filtroRelatorioBPe.zul
@@ -7,13 +7,13 @@
+ height="450px" width="520px" border="normal">
-
+
+
+
-
-
@@ -58,8 +58,20 @@
+
+
+
+
+
+
+
+
+
+