fixes bug#17064
dev:fred qua: git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@98690 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
d1acfb4ca2
commit
c04d753704
|
@ -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 ");
|
||||
}
|
||||
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') ");
|
||||
} else if (status != null && status.equals("PE")) {//Pendente Envio
|
||||
sql.append(" AND bpe.CODSTAT IN ('-1','-2') ");
|
||||
}
|
||||
|
||||
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 ");
|
||||
|
||||
|
|
Binary file not shown.
|
@ -50,7 +50,7 @@
|
|||
</textField>
|
||||
<textField pattern="dd/MM/yyyy HH:mm" isBlankWhenNull="false">
|
||||
<reportElement mode="Transparent" x="1206" y="0" width="104" height="25" forecolor="#000000" backcolor="#FFFFFF" uuid="ad4bbfb8-582d-4aa2-904d-8dfe60e54442"/>
|
||||
<textElement textAlignment="Left" verticalAlignment="Top" rotation="None" markup="none">
|
||||
<textElement textAlignment="Right" verticalAlignment="Top" rotation="None" markup="none">
|
||||
<font fontName="SansSerif" size="9" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
|
||||
<paragraph lineSpacing="Single"/>
|
||||
</textElement>
|
||||
|
|
Binary file not shown.
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="RelatorioBPeRejeitadoEnvioContingencia" pageWidth="1700" pageHeight="842" whenNoDataType="NoDataSection" columnWidth="1660" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="2de20ee0-535e-49d2-a7be-c24a30351d9f">
|
||||
<property name="ireport.zoom" value="1.0"/>
|
||||
<property name="ireport.x" value="378"/>
|
||||
<property name="ireport.x" value="964"/>
|
||||
<property name="ireport.y" value="0"/>
|
||||
<property name="net.sf.jasperreports.export.xls.exclude.origin.band.1" value="title"/>
|
||||
<property name="net.sf.jasperreports.export.xls.exclude.origin.keep.first.band.2" value="columnHeader"/>
|
||||
|
@ -51,7 +51,7 @@
|
|||
</textField>
|
||||
<textField pattern="dd/MM/yyyy HH:mm" isBlankWhenNull="false">
|
||||
<reportElement mode="Transparent" x="1556" y="0" width="104" height="25" forecolor="#000000" backcolor="#FFFFFF" uuid="ad4bbfb8-582d-4aa2-904d-8dfe60e54442"/>
|
||||
<textElement textAlignment="Left" verticalAlignment="Top" rotation="None" markup="none">
|
||||
<textElement textAlignment="Right" verticalAlignment="Top" rotation="None" markup="none">
|
||||
<font fontName="SansSerif" size="9" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
|
||||
<paragraph lineSpacing="Single"/>
|
||||
</textElement>
|
||||
|
|
|
@ -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<Empresa> lsEmpresa;
|
||||
private List<Estado> lsEstado;
|
||||
|
@ -71,22 +75,21 @@ public class RelatorioBPeController extends MyGenericForwardComposer {
|
|||
private void executarRelatorio() throws Exception {
|
||||
Map<String, Object> parametros = new HashMap<String, Object>();
|
||||
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) {
|
||||
|
|
|
@ -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.
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -7,13 +7,13 @@
|
|||
<zk xmlns="http://www.zkoss.org/2005/zul">
|
||||
<window id="winFiltroRelatorioBPe" apply="${relatorioBPeController}"
|
||||
contentStyle="overflow:auto"
|
||||
height="375px" width="600px" border="normal">
|
||||
height="450px" width="520px" border="normal">
|
||||
<grid fixedLayout="true">
|
||||
<columns>
|
||||
<column width="10%" />
|
||||
<column width="17%" />
|
||||
<column width="35%" />
|
||||
<column width="13%" />
|
||||
<column width="35%" />
|
||||
<column width="15%" />
|
||||
<column width="40%" />
|
||||
</columns>
|
||||
<rows>
|
||||
<row>
|
||||
|
@ -58,9 +58,21 @@
|
|||
<radio id="rdbNaoEmbarcado" value="NE" label="${c:l('relatorioBPeController.lbNaoEmbarcado.value')}" tooltiptext="${c:l('relatorioBPeController.lbNaoEmbarcado.value.tooltiptext')}" />
|
||||
<radio id="rdbAutorConting" value="AA" label="${c:l('relatorioBPeController.lbAutorConting.value')}" tooltiptext="${c:l('relatorioBPeController.lbAutorConting.value.tooltiptext')}" />
|
||||
<radio id="rdbRejeitadoEnvioContingencia" value="RC" label="${c:l('relatorioBPeController.lbRejeitadoEnvioContingencia.value')}" tooltiptext="${c:l('relatorioBPeController.lbRejeitadoEnvioContingencia.value.tooltiptext')}" />
|
||||
<radio id="rdbPendenteEnvio" value="PE" label="${c:l('relatorioBPeController.lbPendenteEnvio.value')}" tooltiptext="${c:l('relatorioBPeController.lbPendenteEnvio.value.tooltiptext')}" />
|
||||
</radiogroup>
|
||||
</row>
|
||||
|
||||
<row spans="1, 3">
|
||||
<label
|
||||
value="${c:l('relatorioBPeController.lbChbpe.value')}" />
|
||||
<textbox id="txtChBpe" width="95%"/>
|
||||
</row>
|
||||
<row spans="1, 3">
|
||||
<label
|
||||
value="${c:l('relatorioBPeController.lbNumbpe.value')}" />
|
||||
<textbox id="txtNumBpe" />
|
||||
</row>
|
||||
|
||||
</rows>
|
||||
</grid>
|
||||
|
||||
|
|
Loading…
Reference in New Issue