fixes bug#0011731

dev: lucas
qua: renato

Implementação do relatório de histórico de compras

git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@84145 d1611594-4594-4d17-8e1d-87c2c4800839
master
emerson 2018-08-10 19:44:05 +00:00
parent ec1296bcd0
commit 7b7930a706
24 changed files with 1386 additions and 15 deletions

View File

@ -0,0 +1,142 @@
package com.rjconsultores.ventaboletos.relatorios.impl;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import com.rjconsultores.ventaboletos.relatorios.utilitarios.ArrayDataSource;
import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio;
import com.rjconsultores.ventaboletos.utilerias.DateUtil;
import com.rjconsultores.ventaboletos.utils.FormataUtil;
import com.rjconsultores.ventaboletos.web.utilerias.NamedParameterStatement;
public class RelatorioHistoricoCompras extends Relatorio {
public RelatorioHistoricoCompras(Map<String, Object> parametros, Connection conexao) {
super(parametros, conexao);
}
@Override
protected void processaParametros() throws Exception {
setCustomDataSource(new ArrayCustomDataSource(this));
}
private final class ArrayCustomDataSource extends ArrayDataSource {
private ArrayCustomDataSource(Relatorio relatorio) throws Exception {
super(relatorio);
}
@Override
public void initDados() throws Exception {
Connection conexao = this.relatorio.getConexao();
Map<String, Object> parametros = this.relatorio.getParametros();
String sql = getSql(parametros);
NamedParameterStatement stmt = new NamedParameterStatement(conexao, sql);
setParametrosConsultaSql(parametros, stmt);
ResultSet rset = stmt.executeQuery();
while (rset.next()) {
Map<String, Object> dataResult = new HashMap<String, Object>();
dataResult.put("venda", FormataUtil.formataDataToString((Date)rset.getTimestamp("venda"), "", "dd/MM/yyyy hh:mm"));
dataResult.put("bilhete", rset.getString("bilhete"));
dataResult.put("servico", rset.getString("servico"));
dataResult.put("origem", rset.getString("origem"));
dataResult.put("destino", rset.getString("destino"));
dataResult.put("operador", rset.getString("operador"));
dataResult.put("valor", rset.getBigDecimal("valor"));
dataResult.put("viagem", FormataUtil.formataDataToString((Date)rset.getTimestamp("viagem"), "", "dd/MM/yyyy hh:mm"));
dataResult.put("poltrona", rset.getString("poltrona"));
dataResult.put("agencia", rset.getString("agencia"));
dataResult.put("celular", rset.getString("celular"));
dataResult.put("telefone", rset.getString("telefone"));
dataResult.put("comercial", rset.getString("comercial"));
dataResult.put("nome", rset.getString("nome"));
dataResult.put("cpf", rset.getString("cpf"));
this.dados.add(dataResult);
}
this.resultSet = rset;
}
private void setParametrosConsultaSql(Map<String, Object> parametros, NamedParameterStatement stmt) throws SQLException {
if (parametros.get("dtVendaInicial") != null) {
stmt.setTimestamp("dt_venda_inicio", new Timestamp(DateUtil.inicioFecha((Date) parametros.get("dtVendaInicial")).getTime()));
stmt.setTimestamp("dt_venda_fim", new Timestamp(DateUtil.fimFecha((Date) parametros.get("dtVendaFinal")).getTime()));
}
if (parametros.get("dtEmbarqueInicial") != null) {
stmt.setTimestamp("dt_embarque_inicio", new Timestamp(DateUtil.inicioFecha((Date) parametros.get("dtEmbarqueInicial")).getTime()));
stmt.setTimestamp("dt_embarque_fim", new Timestamp(DateUtil.fimFecha((Date) parametros.get("dtEmbarqueFinal")).getTime()));
}
}
private String getSql(Map<String, Object> parametros) {
StringBuilder sql = new StringBuilder();
sql.append(" SELECT ");
sql.append(" ca.fechorventa_h venda, ");
sql.append(" ca.numfoliosistema bilhete, ");
sql.append(" ca.corrida_id servico, ");
sql.append(" o.descparada origem, ");
sql.append(" d.descparada destino, ");
sql.append(" u.nombusuario operador, ");
sql.append(" ca.preciopagado valor, ");
sql.append(" ca.fechorviaje viagem, ");
sql.append(" ca.numasiento poltrona, ");
sql.append(" pv.nombpuntoventa agencia, ");
sql.append(" cli.numtelefonodos celular, ");
sql.append(" cli.numtelefono telefone, ");
sql.append(" cli.numfax comercial, ");
sql.append(" cli.nombcliente nome, ");
sql.append(" CASE ");
sql.append(" WHEN cli.tipoidentificauno_id = 2 THEN cli.numidentificauno ");
sql.append(" WHEN cli.tipoidentificados_id = 2 THEN cli.numidentificados ");
sql.append(" ELSE NULL ");
sql.append(" END ");
sql.append(" cpf ");
sql.append(" FROM ");
sql.append(" caja ca ");
sql.append(" INNER JOIN cliente cli ON ca.cliente_id = cli.cliente_id ");
sql.append(" INNER JOIN usuario u ON ca.usuario_id = u.usuario_id ");
sql.append(" INNER JOIN punto_venta pv ON ca.puntoventa_id = pv.puntoventa_id ");
sql.append(" INNER JOIN corrida co ON ca.corrida_id = co.corrida_id ");
sql.append(" AND ca.feccorrida = co.feccorrida ");
sql.append(" LEFT JOIN parada o ON co.origen_id = o.parada_id ");
sql.append(" LEFT JOIN parada d ON co.destino_id = d.parada_id ");
if (parametros.get("dtVendaInicial") != null
&& parametros.get("dtEmbarqueInicial") != null) {
sql.append(" WHERE ca.fechorventa_h BETWEEN :dt_venda_inicio and :dt_venda_fim ");
sql.append(" and ca.fechorviaje BETWEEN :dt_embarque_inicio and :dt_embarque_fim ");
} else if (parametros.get("dtVendaInicial") != null) {
sql.append(" WHERE ca.fechorventa_h BETWEEN :dt_venda_inicio and :dt_venda_fim ");
} else {
sql.append(" WHERE ca.fechorviaje BETWEEN :dt_embarque_inicio and :dt_embarque_fim ");
}
if (parametros.get("puntoVentaId") != null) {
sql.append(" and pv.puntoventa_id in("+parametros.get("puntoVentaId")+") ");
}
if (parametros.get("rutaId") != null) {
sql.append(" and ca.ruta_id in("+parametros.get("rutaId")+") ");
}
if (parametros.get("clienteId") != null) {
sql.append(" and cli.cliente_id in("+parametros.get("clienteId")+") ");
}
sql.append("order by ca.fechorventa_h");
return sql.toString();
}
}
}

View File

@ -0,0 +1,12 @@
#geral
msg.noData=No fue posible obtener datos con los parámetros informados.
#Labels cabeçalho
cabecalho.relatorio=Relatório:
cabecalho.periodo=Período:
cabecalho.periodoA=à
cabecalho.dataHora=Data/Hora:
cabecalho.impressorPor=Impressor por:
cabecalho.pagina=Página
cabecalho.de=de
cabecalho.filtros=Filtros:

View File

@ -0,0 +1,12 @@
#geral
msg.noData=Não foi possivel obter dados com os parâmetros informados.
#Labels cabeçalho
cabecalho.relatorio=Relatório:
cabecalho.periodo=Período:
cabecalho.periodoA=à
cabecalho.dataHora=Data/Hora:
cabecalho.impressorPor=Impresso por:
cabecalho.pagina=Página
cabecalho.de=de
cabecalho.filtros=Filtros:

View File

@ -0,0 +1,276 @@
<?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="RelatorioHistoricoCompras" pageWidth="842" pageHeight="595" orientation="Landscape" columnWidth="832" leftMargin="5" rightMargin="5" topMargin="5" bottomMargin="5" uuid="704929c0-c799-46a5-9ca8-3e21a3f3f8b3">
<property name="ireport.zoom" value="1.1"/>
<property name="ireport.x" value="152"/>
<property name="ireport.y" value="0"/>
<parameter name="NOME_RELATORIO" class="java.lang.String"/>
<field name="venda" class="java.lang.String"/>
<field name="bilhete" class="java.lang.String"/>
<field name="servico" class="java.lang.String"/>
<field name="origem" class="java.lang.String"/>
<field name="destino" class="java.lang.String"/>
<field name="operador" class="java.lang.String"/>
<field name="valor" class="java.math.BigDecimal"/>
<field name="viagem" class="java.lang.String"/>
<field name="poltrona" class="java.lang.String"/>
<field name="agencia" class="java.lang.String"/>
<field name="celular" class="java.lang.String"/>
<field name="telefone" class="java.lang.String"/>
<field name="comercial" class="java.lang.String"/>
<field name="nome" class="java.lang.String"/>
<field name="cpf" class="java.lang.String"/>
<background>
<band splitType="Stretch"/>
</background>
<pageHeader>
<band height="62" splitType="Stretch">
<textField pattern="" isBlankWhenNull="false">
<reportElement uuid="fb13ecbc-e8ae-4663-9c10-fc9e3df409c6" mode="Transparent" x="0" y="16" width="382" height="35" forecolor="#000000" backcolor="#FFFFFF"/>
<textElement textAlignment="Left" verticalAlignment="Top" rotation="None" markup="none">
<font fontName="SansSerif" size="15" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
<paragraph lineSpacing="Single"/>
</textElement>
<textFieldExpression><![CDATA[$P{NOME_RELATORIO}]]></textFieldExpression>
</textField>
</band>
</pageHeader>
<columnHeader>
<band height="39" splitType="Stretch">
<staticText>
<reportElement uuid="bc37af37-9b2d-46dc-969d-800271b9247b" x="310" y="9" width="45" height="25"/>
<textElement textAlignment="Left">
<font size="8" isBold="true"/>
</textElement>
<text><![CDATA[Operador]]></text>
</staticText>
<staticText>
<reportElement uuid="05f6b0c4-65f5-4413-814f-5f3f5171bb89" x="0" y="9" width="65" height="25"/>
<textElement textAlignment="Left">
<font size="8" isBold="true"/>
</textElement>
<text><![CDATA[Venda]]></text>
</staticText>
<staticText>
<reportElement uuid="8b901287-2a27-4555-a9ec-fc89e5b29701" x="150" y="9" width="80" height="25"/>
<textElement textAlignment="Left">
<font size="8" isBold="true"/>
</textElement>
<text><![CDATA[Origem]]></text>
</staticText>
<staticText>
<reportElement uuid="127050d6-089c-4486-bffc-0dd6603debd4" x="65" y="9" width="40" height="25"/>
<textElement textAlignment="Left">
<font size="8" isBold="true"/>
</textElement>
<text><![CDATA[Bilhete]]></text>
</staticText>
<staticText>
<reportElement uuid="9f01f9d0-b086-40f4-aa5d-57fa216a2955" x="105" y="9" width="45" height="25" isPrintWhenDetailOverflows="true"/>
<textElement textAlignment="Left">
<font size="8" isBold="true"/>
</textElement>
<text><![CDATA[Cod.
Serviço]]></text>
</staticText>
<staticText>
<reportElement uuid="b376832e-c8b6-47f9-b26b-5e0dbe81a34d" x="230" y="9" width="80" height="25"/>
<textElement textAlignment="Left">
<font size="8" isBold="true"/>
</textElement>
<text><![CDATA[Destino]]></text>
</staticText>
<staticText>
<reportElement uuid="f43caf02-0714-4e25-93b8-f6251b0473af" x="355" y="9" width="30" height="25"/>
<textElement textAlignment="Left">
<font size="8" isBold="true"/>
</textElement>
<text><![CDATA[Valor]]></text>
</staticText>
<staticText>
<reportElement uuid="02096d93-5c1a-436a-8bb3-b13b76f0d04f" x="385" y="9" width="65" height="25"/>
<textElement textAlignment="Left">
<font size="8" isBold="true"/>
</textElement>
<text><![CDATA[Viagem]]></text>
</staticText>
<staticText>
<reportElement uuid="4b2a91fe-ac98-4b7c-b02e-d98862580cf4" x="450" y="9" width="20" height="25"/>
<textElement textAlignment="Left">
<font size="8" isBold="true"/>
</textElement>
<text><![CDATA[Poltr]]></text>
</staticText>
<staticText>
<reportElement uuid="6f895f9e-f2dd-404f-adf2-125732738753" x="470" y="9" width="70" height="25"/>
<textElement textAlignment="Left">
<font size="8" isBold="true"/>
</textElement>
<text><![CDATA[Agência Venda]]></text>
</staticText>
<line>
<reportElement uuid="917f4346-87f6-4040-b8ec-781e8e14be30" x="0" y="7" width="825" height="2"/>
</line>
<line>
<reportElement uuid="56a46a13-901c-4cf2-b143-0ebd53e0f257" x="0" y="35" width="825" height="2"/>
</line>
<staticText>
<reportElement uuid="1ea05f32-6d68-463c-9f7b-d2927bab1854" x="540" y="9" width="60" height="25"/>
<textElement textAlignment="Left">
<font size="8" isBold="true"/>
</textElement>
<text><![CDATA[Celular]]></text>
</staticText>
<staticText>
<reportElement uuid="e61f7709-d34b-42da-8394-f5dbfcdcac08" x="600" y="9" width="60" height="25"/>
<textElement textAlignment="Left">
<font size="8" isBold="true"/>
</textElement>
<text><![CDATA[Telefone]]></text>
</staticText>
<staticText>
<reportElement uuid="2b6350da-3278-4348-974e-529acf12addf" x="660" y="9" width="60" height="25"/>
<textElement textAlignment="Left">
<font size="8"/>
</textElement>
<text><![CDATA[Tel. Com.]]></text>
</staticText>
<staticText>
<reportElement uuid="d687bf48-89bf-4df8-a222-16f30996587e" x="720" y="9" width="50" height="25"/>
<textElement>
<font size="8"/>
</textElement>
<text><![CDATA[Nome]]></text>
</staticText>
<staticText>
<reportElement uuid="e2e9fd80-1ca7-4f89-a95e-d8d89e37c095" x="770" y="9" width="55" height="25"/>
<textElement>
<font size="8"/>
</textElement>
<text><![CDATA[CPF]]></text>
</staticText>
</band>
</columnHeader>
<detail>
<band height="24" splitType="Stretch">
<textField isStretchWithOverflow="true" pattern="">
<reportElement uuid="63e7f691-3da7-403b-b3c0-428204cd300b" x="470" y="0" width="70" height="20"/>
<textElement>
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{agencia}]]></textFieldExpression>
</textField>
<textField pattern="dd/MM/yyyy" isBlankWhenNull="true">
<reportElement uuid="f328e3a4-f1d7-46f6-9d02-9bfd4ad1d512" x="105" y="0" width="45" height="20"/>
<textElement textAlignment="Left">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{servico}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" pattern="" isBlankWhenNull="true">
<reportElement uuid="e5de48ac-118a-416c-a88e-b42b7dc64e40" x="65" y="1" width="40" height="20"/>
<textElement>
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{bilhete}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" pattern="">
<reportElement uuid="cec35341-5bcd-4d7c-a59e-76434bc6d4fe" x="150" y="0" width="80" height="20"/>
<textElement textAlignment="Left">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{origem}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" pattern="">
<reportElement uuid="2b3cb9a8-6893-4bdf-b9eb-2853038a9258" x="230" y="0" width="80" height="20"/>
<textElement textAlignment="Left">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{destino}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" pattern="">
<reportElement uuid="c3ec1906-8357-49ca-bbe6-4bb7f927d668" x="310" y="0" width="45" height="20"/>
<textElement textAlignment="Left">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{operador}]]></textFieldExpression>
</textField>
<textField pattern="#,##0.00">
<reportElement uuid="a7933cd7-a8da-40c1-b4fe-7c499fbddcb6" x="355" y="0" width="30" height="20"/>
<textElement textAlignment="Left">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{valor}]]></textFieldExpression>
</textField>
<textField pattern="">
<reportElement uuid="0abd4d65-b47b-4bb5-9db2-fc1b08842641" x="385" y="0" width="65" height="20"/>
<textElement textAlignment="Left">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{viagem}]]></textFieldExpression>
</textField>
<textField pattern="">
<reportElement uuid="18f38bde-1e97-481b-8f10-bdfe51bc8492" x="450" y="0" width="20" height="20"/>
<textElement textAlignment="Center">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{poltrona}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="fc9fe78f-59b8-40bd-8d49-1996da4c1952" x="0" y="1" width="65" height="20"/>
<textElement>
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{venda}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true">
<reportElement uuid="1166e37c-7c52-4d7b-ba6b-d6ae47181144" x="540" y="0" width="60" height="20"/>
<textElement>
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{celular}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true">
<reportElement uuid="2471b6f6-ede2-4163-aca6-73054f093f8b" x="600" y="0" width="60" height="20"/>
<textElement>
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{telefone}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true">
<reportElement uuid="15ec1323-6b11-41e2-aa4d-57f5e3fd0a96" x="660" y="0" width="60" height="20"/>
<textElement>
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{comercial}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement uuid="b44da132-4555-4070-91e8-96b444b996ba" x="720" y="0" width="50" height="20"/>
<textElement>
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{nome}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true">
<reportElement uuid="a68083d7-956e-40f2-ba18-d3622f0696a8" x="770" y="0" width="55" height="20"/>
<textElement>
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{cpf}]]></textFieldExpression>
</textField>
</band>
</detail>
<summary>
<band height="34" splitType="Stretch"/>
</summary>
<noData>
<band height="50">
<textField>
<reportElement uuid="b6953c35-eeee-4652-907d-2d9e415750dd" x="14" y="14" width="530" height="26"/>
<textElement markup="none">
<font size="11" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$R{msg.noData}]]></textFieldExpression>
</textField>
</band>
</noData>
</jasperReport>

View File

@ -0,0 +1,32 @@
package com.rjconsultores.ventaboletos.relatorios.utilitarios;
import org.zkoss.zul.Paging;
import com.rjconsultores.ventaboletos.entidad.Cliente;
import com.rjconsultores.ventaboletos.entidad.TipoIdentificacion;
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
import com.rjconsultores.ventaboletos.web.utilerias.MyTextbox;
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.HibernateSearchObject;
import com.trg.search.Filter;
public class PagedListCliente extends PagedListGenerico<Cliente> {
private static final int TIPO_DOCUMENTO_CPF = 2;
public PagedListCliente(MyListbox listBox, MyTextbox txtPesquisa, Paging paging) {
super(listBox, txtPesquisa, paging);
super.setHibernateSearchObject(new HibernateSearchObject<Cliente>(Cliente.class, getPaging().getPageSize()));
}
@Override
protected void personalizarBusca() {
HibernateSearchObject<Cliente> clienteSearch = getHibernateSearchObject();
TipoIdentificacion tipoIdentificacion = new TipoIdentificacion();
tipoIdentificacion.setTipoIdentificacionId(TIPO_DOCUMENTO_CPF);
clienteSearch.addFilterAnd(Filter.or(
Filter.and(Filter.ilike("numIdentificaUno", "%" + getTxtPesquisa().getValue() + "%"), Filter.equal("tipoIdentificacionUno", tipoIdentificacion)),
Filter.and(Filter.ilike("numIdentificaDos", "%" + getTxtPesquisa().getValue() + "%"), Filter.equal("tipoIdentificacionDos", tipoIdentificacion))));
clienteSearch.addFilterEqual("activo", true);
}
}

View File

@ -0,0 +1,91 @@
package com.rjconsultores.ventaboletos.relatorios.utilitarios;
import java.util.ArrayList;
import org.zkoss.zul.Paging;
import com.rjconsultores.ventaboletos.web.utilerias.MensagensUtils;
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
import com.rjconsultores.ventaboletos.web.utilerias.MyTextbox;
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.HibernateSearchObject;
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.PagedListWrapper;
public abstract class PagedListGenerico<T> {
private static final String MSG_NENHUM_REGISTRO = "MSG.ningunRegistro";
private Paging paging;
private MyListbox listBox;
private MyTextbox txtPesquisa;
private HibernateSearchObject<T> hibernateSearchObject;
public PagedListGenerico(MyListbox listBox, MyTextbox txtPesquisa, Paging paging) {
this.listBox = listBox;
this.txtPesquisa = txtPesquisa;
this.paging = paging;
}
public void buscarDadosPagedList(PagedListWrapper<T> pagedList) {
buscarDados(pagedList);
}
private void buscarDados(PagedListWrapper<T> pagedList) {
personalizarBusca();
pagedList.init(getHibernateSearchObject(), getListBox(), getPaging());
}
protected abstract void personalizarBusca();
public void limparPesquisaListBox() {
limparPesquisaListBox(listBox, txtPesquisa);
}
public static void limparPesquisaListBox(MyListbox listBox, MyTextbox txtPesquisa) {
listBox.setData(new ArrayList<Object>());
txtPesquisa.setText("");
}
public void validarPagedListSemRegistro(String tituloRelatorio) {
validarPagedListSemRegistro(listBox, tituloRelatorio);
}
public static void validarPagedListSemRegistro(MyListbox listBox, String tituloRelatorio) {
if (listBox.getData().length == 0) {
MensagensUtils.showMessageInformation(MSG_NENHUM_REGISTRO, tituloRelatorio);
}
}
public Paging getPaging() {
return paging;
}
public void setPaging(Paging paging) {
this.paging = paging;
}
public MyListbox getListBox() {
return listBox;
}
public void setListBox(MyListbox listBox) {
this.listBox = listBox;
}
public MyTextbox getTxtPesquisa() {
return txtPesquisa;
}
public void setTxtPesquisa(MyTextbox txtPesquisa) {
this.txtPesquisa = txtPesquisa;
}
public HibernateSearchObject<T> getHibernateSearchObject() {
return hibernateSearchObject;
}
public void setHibernateSearchObject(HibernateSearchObject<T> hibernateSearchObject) {
this.hibernateSearchObject = hibernateSearchObject;
}
}

View File

@ -0,0 +1,25 @@
package com.rjconsultores.ventaboletos.relatorios.utilitarios;
import org.zkoss.zul.Paging;
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
import com.rjconsultores.ventaboletos.web.utilerias.MyTextbox;
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.HibernateSearchObject;
public class PagedListPuntoVenta extends PagedListGenerico<PuntoVenta> {
public PagedListPuntoVenta(MyListbox listBox, MyTextbox txtPesquisa, Paging paging) {
super(listBox, txtPesquisa, paging);
super.setHibernateSearchObject(new HibernateSearchObject<PuntoVenta>(PuntoVenta.class, getPaging().getPageSize()));
}
@Override
protected void personalizarBusca() {
HibernateSearchObject<PuntoVenta> puntoVentaBusqueda = getHibernateSearchObject();
puntoVentaBusqueda.addFilterILike("nombpuntoventa", "%" + getTxtPesquisa().getValue() + "%");
puntoVentaBusqueda.addFilterEqual("activo", true);
puntoVentaBusqueda.addFilterNotEqual("puntoventaId", -1);
puntoVentaBusqueda.addSortAsc("nombpuntoventa");
}
}

View File

@ -0,0 +1,70 @@
package com.rjconsultores.ventaboletos.relatorios.utilitarios;
import org.zkoss.zul.Datebox;
import com.rjconsultores.ventaboletos.web.utilerias.MensagensUtils;
public class ValidarDatas {
private Datebox dataInicial;
private Datebox dataFinal;
public ValidarDatas(Datebox dataInicial, Datebox dataFinal) {
this.dataInicial = dataInicial;
this.dataFinal = dataFinal;
}
public boolean isPeriodoNaoInformado() {
return isPeriodoInicialNaoInformado()
&& isPeriodoFinalNaoInformado();
}
public boolean isPeriodoParcialmenteInformado() {
return (!isPeriodoInicialNaoInformado() && isPeriodoFinalNaoInformado())
|| (isPeriodoInicialNaoInformado() && !isPeriodoFinalNaoInformado());
}
public boolean isPeriodoFinalNaoInformado() {
return dataFinal.getValue() == null;
}
public boolean isPeriodoInicialNaoInformado() {
return dataInicial.getValue() == null;
}
public boolean possuiDataInicioMaiorQueTermino() {
return dataInicial.getValue().after(dataFinal.getValue());
}
public boolean validarPeriodoNaoInformado(String labelMensagem, String tituloMenssagem) {
if (isPeriodoNaoInformado()) {
MensagensUtils.showMessageInformation(labelMensagem, tituloMenssagem);
return true;
}
return false;
}
public boolean validarPeriodoInicialNaoInformado(String labelMensagem, String tituloMenssagem) {
if (isPeriodoInicialNaoInformado()) {
MensagensUtils.showMessageInformation(labelMensagem, tituloMenssagem);
return true;
}
return false;
}
public boolean validarPeriodoFinalNaoInformado(String labelMensagem, String tituloMenssagem) {
if (isPeriodoFinalNaoInformado()) {
MensagensUtils.showMessageInformation(labelMensagem, tituloMenssagem);
return true;
}
return false;
}
public boolean validarDataInicioMaiorQueTermino(String labelMensagem, String tituloMenssagem) {
if (possuiDataInicioMaiorQueTermino()) {
MensagensUtils.showMessageInformation(labelMensagem, tituloMenssagem);
return true;
}
return false;
}
}

View File

@ -33,7 +33,7 @@ import org.zkoss.zul.Radio;
import org.zkoss.zul.Row;
import org.zkoss.zul.Textbox;
import com.rjconsultores.ventaboletos.constantes.Constantes;
import com.rjconsultores.ventaboletos.constantes.ConstantesFuncionSistema;
import com.rjconsultores.ventaboletos.entidad.Categoria;
import com.rjconsultores.ventaboletos.entidad.Ciudad;
import com.rjconsultores.ventaboletos.entidad.ComEmpCategoria;
@ -1265,7 +1265,7 @@ public class EditarEmpresaController extends MyGenericForwardComposer {
}
public Boolean getGeneraNumfoliosistemaVtaInternetImp() {
return UsuarioLogado.getUsuarioLogado().isPermisoClave(Constantes.CLAVE_GENERA_FOLIOSISTEMA_VTA_INT_IMP_POSTERIOR);
return UsuarioLogado.getUsuarioLogado().isPermisoClave(ConstantesFuncionSistema.CLAVE_GENERA_FOLIOSISTEMA_VTA_INT_IMP_POSTERIOR);
}
public Checkbox getChkHabilitarFidelidade() {
@ -1304,7 +1304,7 @@ public class EditarEmpresaController extends MyGenericForwardComposer {
public Boolean isPermissaoVendaSemReducaoZ() {
return !UsuarioLogado.getUsuarioLogado().isPermisoClave(Constantes.CLAVE_EDITAR_VENDA_SEM_REDUCAO_Z);
return !UsuarioLogado.getUsuarioLogado().isPermisoClave(ConstantesFuncionSistema.CLAVE_EDITAR_VENDA_SEM_REDUCAO_Z);
}

View File

@ -25,11 +25,9 @@ import org.zkoss.zul.Messagebox;
import org.zkoss.zul.Paging;
import org.zkoss.zul.Tab;
import com.rjconsultores.ventaboletos.constantes.Constantes;
import com.rjconsultores.ventaboletos.entidad.ContaCorrentePtoVta;
import com.rjconsultores.ventaboletos.constantes.ConstantesFuncionSistema;
import com.rjconsultores.ventaboletos.entidad.ContaMD;
import com.rjconsultores.ventaboletos.entidad.DescontoComissao;
import com.rjconsultores.ventaboletos.entidad.FechamentoParamptovta;
import com.rjconsultores.ventaboletos.entidad.ItemDesconto;
import com.rjconsultores.ventaboletos.entidad.PtovtaComissao;
import com.rjconsultores.ventaboletos.entidad.PtovtaContaMD;
@ -39,7 +37,6 @@ import com.rjconsultores.ventaboletos.service.ItemDescontoService;
import com.rjconsultores.ventaboletos.service.PtovtaComissaoService;
import com.rjconsultores.ventaboletos.service.PtovtaContaMDService;
import com.rjconsultores.ventaboletos.service.PuntoVentaService;
import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties;
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEstandar;
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
@ -436,11 +433,11 @@ public class EditarPuntoVentaComissaoController extends MyGenericForwardComposer
}
public Boolean isPermissaoEditarComissao() {
return UsuarioLogado.getUsuarioLogado().isPermisoClave(Constantes.CLAVE_EDITAR_COMISSAO);
return UsuarioLogado.getUsuarioLogado().isPermisoClave(ConstantesFuncionSistema.CLAVE_EDITAR_COMISSAO);
}
public Boolean isPermissaoEditarPorcentagem() {
return UsuarioLogado.getUsuarioLogado().isPermisoClave(Constantes.CLAVE_EXIBIR_TAB_COMISSAO_CONTA);
return UsuarioLogado.getUsuarioLogado().isPermisoClave(ConstantesFuncionSistema.CLAVE_EXIBIR_TAB_COMISSAO_CONTA);
}
public List<ItemDesconto> getLsItemDesconto() {

View File

@ -67,6 +67,7 @@ import org.zkoss.zul.Textbox;
import org.zkoss.zul.api.Timebox;
import com.rjconsultores.ventaboletos.constantes.Constantes;
import com.rjconsultores.ventaboletos.constantes.ConstantesFuncionSistema;
import com.rjconsultores.ventaboletos.entidad.Categoria;
import com.rjconsultores.ventaboletos.entidad.CategoriaBloqueioImpPosterior;
import com.rjconsultores.ventaboletos.entidad.Ciudad;
@ -3413,7 +3414,7 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
}
public Boolean isPermissaoEditarComissao() {
return UsuarioLogado.getUsuarioLogado().isPermisoClave(Constantes.CLAVE_EDITAR_COMISSAO);
return UsuarioLogado.getUsuarioLogado().isPermisoClave(ConstantesFuncionSistema.CLAVE_EDITAR_COMISSAO);
}
public List<EmpresaContaBancaria> getLsEmpresaContaBancarias() {

View File

@ -21,6 +21,7 @@ import org.zkoss.zul.Datebox;
import org.zkoss.zul.Messagebox;
import com.rjconsultores.ventaboletos.constantes.Constantes;
import com.rjconsultores.ventaboletos.constantes.ConstantesFuncionSistema;
import com.rjconsultores.ventaboletos.entidad.Constante;
import com.rjconsultores.ventaboletos.entidad.Empresa;
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
@ -217,7 +218,7 @@ public class BusquedaRetencaoDiariaComissaoController extends MyGenericForwardCo
}
public Boolean isPermissaoCalculoDiarioComissaoTodasAsAgencias() {
return UsuarioLogado.getUsuarioLogado().isPermisoClave(Constantes.CLAVE_CALCULODIARIOCOMISSAO_AUTORIZACAOCALCULOTODASAGENCIAS);
return UsuarioLogado.getUsuarioLogado().isPermisoClave(ConstantesFuncionSistema.CLAVE_CALCULODIARIOCOMISSAO_AUTORIZACAOCALCULOTODASAGENCIAS);
}
}

View File

@ -30,7 +30,7 @@ import org.zkoss.zul.Radio;
import org.zkoss.zul.Row;
import org.zkoss.zul.Tab;
import com.rjconsultores.ventaboletos.constantes.Constantes;
import com.rjconsultores.ventaboletos.constantes.ConstantesFuncionSistema;
import com.rjconsultores.ventaboletos.entidad.Conferencia;
import com.rjconsultores.ventaboletos.entidad.ConferenciaPendencia;
import com.rjconsultores.ventaboletos.entidad.Empresa;
@ -1442,11 +1442,11 @@ public class ConferenciaController extends MyGenericForwardComposer {
}
public Boolean isPermissaoEncerrarMovimento() {
return UsuarioLogado.getUsuarioLogado().isPermisoClave(Constantes.CLAVE_ENCERRAR_MOVIMENTODIARIO);
return UsuarioLogado.getUsuarioLogado().isPermisoClave(ConstantesFuncionSistema.CLAVE_ENCERRAR_MOVIMENTODIARIO);
}
public Boolean isPermissaoReabrirMovimento() {
return UsuarioLogado.getUsuarioLogado().isPermisoClave(Constantes.CLAVE_REABRIR_MOVIMENTODIARIO);
return UsuarioLogado.getUsuarioLogado().isPermisoClave(ConstantesFuncionSistema.CLAVE_REABRIR_MOVIMENTODIARIO);
}
public Boolean isExibirBotaoReabrirMovimento() {

View File

@ -23,6 +23,7 @@ import org.zkoss.zul.Messagebox;
import org.zkoss.zul.Textbox;
import com.rjconsultores.ventaboletos.constantes.Constantes;
import com.rjconsultores.ventaboletos.constantes.ConstantesFuncionSistema;
import com.rjconsultores.ventaboletos.entidad.MotivoCancelacion;
import com.rjconsultores.ventaboletos.service.MotivoCancelacionService;
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
@ -200,7 +201,7 @@ public class EditarMotivoCancelacionController extends MyGenericForwardComposer
}
public Boolean isPermissaoAlteraExibecancel() {
return UsuarioLogado.getUsuarioLogado().isPermisoClave(Constantes.CLAVE_EDITAR_ALTERA_EXIBECANCEL);
return UsuarioLogado.getUsuarioLogado().isPermisoClave(ConstantesFuncionSistema.CLAVE_EDITAR_ALTERA_EXIBECANCEL);
}
}

View File

@ -0,0 +1,50 @@
package com.rjconsultores.ventaboletos.web.gui.controladores.relatorios;
import java.lang.reflect.InvocationTargetException;
import java.util.Arrays;
import java.util.List;
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
public class EspecializaLista<T> {
private Class<T> classe;
private MyListbox listBox;
private String nomeMetodoPk;
public EspecializaLista(Class<T> classe, MyListbox listBox, String nomeMetodoPk) {
this.classe = classe;
this.listBox = listBox;
this.nomeMetodoPk = nomeMetodoPk;
}
public List<T> getLista() {
return (List<T>)(Object)Arrays.asList(listBox.getData());
}
public String obtemIds() {
StringBuilder ids = new StringBuilder();
for (T objeto : getLista()) {
try {
String valorPk = classe.getMethod(nomeMetodoPk).invoke(objeto).toString();
ids.append(valorPk);
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (SecurityException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
} catch (NoSuchMethodException e) {
e.printStackTrace();
}
ids.append(", ");
}
return removeUltimoCaratere(ids);
}
public static String removeUltimoCaratere(StringBuilder ids) {
return ids.substring(0, ids.length()-2);
}
}

View File

@ -0,0 +1,242 @@
package com.rjconsultores.ventaboletos.web.gui.controladores.relatorios;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.sql.DataSource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.zkoss.util.resource.Labels;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zul.Datebox;
import org.zkoss.zul.Paging;
import com.rjconsultores.ventaboletos.entidad.Cliente;
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
import com.rjconsultores.ventaboletos.entidad.Ruta;
import com.rjconsultores.ventaboletos.relatorios.impl.RelatorioHistoricoCompras;
import com.rjconsultores.ventaboletos.relatorios.utilitarios.PagedListCliente;
import com.rjconsultores.ventaboletos.relatorios.utilitarios.PagedListGenerico;
import com.rjconsultores.ventaboletos.relatorios.utilitarios.PagedListPuntoVenta;
import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio;
import com.rjconsultores.ventaboletos.relatorios.utilitarios.ValidarDatas;
import com.rjconsultores.ventaboletos.service.RutaService;
import com.rjconsultores.ventaboletos.web.utilerias.MensagensUtils;
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
import com.rjconsultores.ventaboletos.web.utilerias.MyTextbox;
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.PagedListWrapper;
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderPersonalizado;
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderRelatorioLinhaHorario;
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderRelatorioVendasBilheteiro;
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderRelatorioVendasBilheteiroSelecionados;
@Controller("relatorioHistoricoComprasController")
@Scope("prototype")
public class RelatorioHistoricoComprasController extends MyGenericForwardComposer {
private static final String MSG_DATA_INICIAL_EMBARQUE_MAIOR_FINAL = "relatorioHistoricoComprasController.MSG.dataInicialEmbarqueMaiorFinal";
private static final String MSG_DATA_INICIAL_VENDA_MAIOR_FINAL = "relatorioHistoricoComprasController.MSG.dataInicialVendaMaiorFinal";
private static final String MSG_PERIODO_VENDA_INCOMPLETO = "relatorioHistoricoComprasController.MSG.informarDataVenda";
private static final String MSG_PERIODO_EMBARQUE_INCOMPLETO = "relatorioHistoricoComprasController.MSG.informarDataEmbarque";
private static final String TITULO_RELATORIO = "relatorioHistoricoComprasController.window.title";
private static final String MSG_FILTRO_SEM_PERIODO = "relatorioHistoricoComprasController.MSG.informarFiltroData";
private static final long serialVersionUID = 1L;
private Datebox dtVendaInicial;
private Datebox dtVendaFinal;
private Datebox dtEmbarqueInicial;
private Datebox dtEmbarqueFinal;
private MyTextbox txtNombrePuntoVenta;
private MyListbox puntoVentaList;
private MyListbox puntoVentaSelList;
private Paging pagingPuntoVenta;
private MyListbox linhaList;
private MyListbox linhaSelList;
private MyTextbox txtPalavraPesquisaLinha;
private MyListbox cpfList;
private MyListbox cpfSelList;
private MyTextbox txtCpfPesquisa;
private Paging pagingCpfCliente;
@Autowired
private transient PagedListWrapper<PuntoVenta> pagedListPuntoVenta;
@Autowired
private transient PagedListWrapper<Cliente> pagedListCliente;
@Autowired
private RutaService rutaService;
@Autowired
private DataSource dataSource;
@Override
public void doAfterCompose(Component comp) throws Exception {
super.doAfterCompose(comp);
configuraRenders();
}
private void configuraRenders() {
puntoVentaList.setItemRenderer(new RenderRelatorioVendasBilheteiro());
puntoVentaSelList.setItemRenderer(new RenderRelatorioVendasBilheteiroSelecionados());
linhaList.setItemRenderer(new RenderRelatorioLinhaHorario());
linhaSelList.setItemRenderer(new RenderRelatorioLinhaHorario());
List<String> colunasClienteRender = Arrays.asList("numIdentificaUno", "nombcliente");
cpfList.setItemRenderer(new RenderPersonalizado<Cliente>(colunasClienteRender));
cpfSelList.setItemRenderer(new RenderPersonalizado<Cliente>(colunasClienteRender).comBotaoExcluir(true));
}
public void onClick$btnPesquisaPuntoVenta(Event ev) throws Exception {
PagedListPuntoVenta pageList = new PagedListPuntoVenta(puntoVentaList, txtNombrePuntoVenta, pagingPuntoVenta);
pageList.buscarDadosPagedList(pagedListPuntoVenta);
pageList.validarPagedListSemRegistro(TITULO_RELATORIO);
}
public void onClick$btnLimpar(Event ev) {
PagedListGenerico.limparPesquisaListBox(puntoVentaList, txtNombrePuntoVenta);
}
public void onDoubleClick$puntoVentaSelList(Event ev) {
puntoVentaSelList.removeItem((PuntoVenta) puntoVentaSelList.getSelected());
}
public void onDoubleClick$puntoVentaList(Event ev) {
validarInclusaoLista((PuntoVenta) puntoVentaList.getSelected(), puntoVentaSelList);
}
public void onClick$btnPesquisaLinha(Event ev) {
linhaList.setData(rutaService.buscaRuta(txtPalavraPesquisaLinha.getText()));
PagedListGenerico.validarPagedListSemRegistro(linhaList, TITULO_RELATORIO);
}
public void onClick$btnLimparLinha(Event ev) {
PagedListGenerico.limparPesquisaListBox(linhaList, txtPalavraPesquisaLinha);
}
public void onDoubleClick$linhaSelList(Event ev) {
linhaSelList.removeItem((Ruta) linhaSelList.getSelected());
}
public void onDoubleClick$linhaList(Event ev) {
validarInclusaoLista((Ruta) linhaList.getSelected(), linhaSelList);
}
public void onClick$btnPesquisaCpf(Event ev) {
PagedListCliente pageListCliente = new PagedListCliente(cpfList, txtCpfPesquisa, pagingCpfCliente);
pageListCliente.buscarDadosPagedList(pagedListCliente);
pageListCliente.validarPagedListSemRegistro(TITULO_RELATORIO);
}
public void onClick$btnLimparCpf(Event ev) {
PagedListCliente.limparPesquisaListBox(cpfList, txtCpfPesquisa);
}
public void onDoubleClick$cpfSelList(Event ev) {
cpfSelList.removeItem((Cliente) cpfSelList.getSelected());
}
public void onDoubleClick$cpfList(Event ev) {
validarInclusaoLista((Cliente) cpfList.getSelected(), cpfSelList);
}
public void onClick$btnExecutarRelatorio(Event ev) throws Exception {
if (isDatasValidas()) {
Relatorio relatorio = new RelatorioHistoricoCompras(getParametros(), dataSource.getConnection());
Map<Object, Object> args = new HashMap<Object, Object>();
args.put("relatorio", relatorio);
openWindow("/component/reportView.zul",
Labels.getLabel(TITULO_RELATORIO), args, MODAL);
}
}
private Map<String, Object> getParametros() {
Map<String, Object> parametros = new HashMap<String, Object>();
parametros.put("NOME_RELATORIO", Labels.getLabel(TITULO_RELATORIO));
parametros.put("dtVendaInicial", dtVendaInicial.getValue());
parametros.put("dtVendaFinal", dtVendaFinal.getValue());
parametros.put("dtEmbarqueInicial", dtEmbarqueInicial.getValue());
parametros.put("dtEmbarqueFinal", dtEmbarqueFinal.getValue());
getParametroPuntoVenta(parametros);
getParametroLinha(parametros);
getParametroCliente(parametros);
return parametros;
}
private void getParametroCliente(Map<String, Object> parametros) {
EspecializaLista<Cliente> especializaLista = new EspecializaLista<Cliente>(Cliente.class, cpfSelList, "getClienteId");
if (!especializaLista.getLista().isEmpty()) {
parametros.put("clienteId", especializaLista.obtemIds());
}
}
private void getParametroLinha(Map<String, Object> parametros) {
EspecializaLista<Ruta> especializaLista = new EspecializaLista<Ruta>(Ruta.class, linhaSelList, "getRutaId");
if (!especializaLista.getLista().isEmpty()) {
parametros.put("rutaId", especializaLista.obtemIds());
}
}
private void getParametroPuntoVenta(Map<String, Object> parametros) {
EspecializaLista<PuntoVenta> especializaLista = new EspecializaLista<PuntoVenta>(PuntoVenta.class, puntoVentaSelList, "getPuntoventaId");
if (!especializaLista.getLista().isEmpty()) {
parametros.put("puntoVentaId", especializaLista.obtemIds());
}
}
private void validarInclusaoLista(Object objeto, MyListbox listBox) {
if (objeto != null &&
!Arrays.asList(listBox.getData()).contains(objeto)) {
listBox.addItemNovo(objeto);
}
}
private boolean isDatasValidas() {
ValidarDatas validarDtVenda = new ValidarDatas(dtVendaInicial, dtVendaFinal);
ValidarDatas validarDtEmbarque = new ValidarDatas(dtEmbarqueInicial, dtEmbarqueFinal);
if (isDatasPeriodosNaoInformados(validarDtVenda, validarDtEmbarque)) {
MensagensUtils.showMessageInformation(MSG_FILTRO_SEM_PERIODO, TITULO_RELATORIO);
return false;
}
if (validarDtVenda.isPeriodoParcialmenteInformado()) {
MensagensUtils.showMessageInformation(MSG_PERIODO_VENDA_INCOMPLETO, TITULO_RELATORIO);
return false;
}
if (validarDtEmbarque.isPeriodoParcialmenteInformado()) {
MensagensUtils.showMessageInformation(MSG_PERIODO_EMBARQUE_INCOMPLETO, TITULO_RELATORIO);
return false;
}
if (!validarDtVenda.isPeriodoInicialNaoInformado()
&& validarDtVenda.validarDataInicioMaiorQueTermino(MSG_DATA_INICIAL_VENDA_MAIOR_FINAL, TITULO_RELATORIO)) {
return false;
}
if (!validarDtEmbarque.isPeriodoNaoInformado()) {
return !validarDtEmbarque.validarDataInicioMaiorQueTermino(MSG_DATA_INICIAL_EMBARQUE_MAIOR_FINAL, TITULO_RELATORIO);
}
return true;
}
private boolean isDatasPeriodosNaoInformados(ValidarDatas validarDtVenda, ValidarDatas validarDtEmbarque) {
return validarDtVenda.isPeriodoNaoInformado() && validarDtEmbarque.isPeriodoNaoInformado();
}
}

View File

@ -0,0 +1,21 @@
package com.rjconsultores.ventaboletos.web.utilerias;
import org.zkoss.util.resource.Labels;
import org.zkoss.zhtml.Messagebox;
public class MensagensUtils {
private MensagensUtils() {
}
public static void showMessageInformation(String labelMensagem, String tituloMenssagem) {
try {
Messagebox.show(
Labels.getLabel(labelMensagem),
Labels.getLabel(tituloMenssagem),
Messagebox.OK, Messagebox.INFORMATION);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
}
}

View File

@ -0,0 +1,26 @@
package com.rjconsultores.ventaboletos.web.utilerias.menu.item.relatorios;
import org.zkoss.util.resource.Labels;
import com.rjconsultores.ventaboletos.constantes.ConstantesFuncionSistema;
import com.rjconsultores.ventaboletos.web.utilerias.PantallaUtileria;
import com.rjconsultores.ventaboletos.web.utilerias.menu.DefaultItemMenuSistema;
public class ItemMenuRelatorioHistoricoCompras extends DefaultItemMenuSistema {
public ItemMenuRelatorioHistoricoCompras() {
super("indexController.mniRelatorioHistoricoCompras.label");
}
@Override
public String getClaveMenu() {
return ConstantesFuncionSistema.CLAVE_HISTORICO_COMPRAS;
}
@Override
public void ejecutar() {
PantallaUtileria.openWindow("/gui/relatorios/filtroRelatorioHistoricoCompras.zul",
Labels.getLabel("relatorioHistoricoComprasController.window.title"), getArgs(), desktop);
}
}

View File

@ -139,6 +139,7 @@ analitico.gerenciais.remDev=com.rjconsultores.ventaboletos.web.utilerias.menu.it
analitico.gerenciais.tabPreco=com.rjconsultores.ventaboletos.web.utilerias.menu.item.relatorios.ItemMenuRelatorioTabelaPreco
analitico.gerenciais.trip=com.rjconsultores.ventaboletos.web.utilerias.menu.item.relatorios.ItemRelatorioTripulacao
analitico.gerenciais.relatorioImpressaoPosterior=com.rjconsultores.ventaboletos.web.utilerias.menu.item.relatorios.ItemMenuRelatorioImpressaoPosterior
analitico.gerenciais.relatorioHistoricoCompras=com.rjconsultores.ventaboletos.web.utilerias.menu.item.relatorios.ItemMenuRelatorioHistoricoCompras
analitico.gerenciais.operacionais=com.rjconsultores.ventaboletos.web.utilerias.menu.item.analitico.gerenciais.operacionais.SubMenuRelatorioOperacionais
analitico.gerenciais.operacionais.aproveitamento=com.rjconsultores.ventaboletos.web.utilerias.menu.item.relatorios.ItemMenuRelatorioAproveitamento
analitico.gerenciais.operacionais.resumoLinhas=com.rjconsultores.ventaboletos.web.utilerias.menu.item.relatorios.ItemMenuRelatorioResumoLinhas

View File

@ -0,0 +1,92 @@
package com.rjconsultores.ventaboletos.web.utilerias.render;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zul.Button;
import org.zkoss.zul.Listcell;
import org.zkoss.zul.Listitem;
import org.zkoss.zul.ListitemRenderer;
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
/**
* @author emerson
*
* Este render exibirá as colunas que forem informadas no construtor.
* O nome das colunas deverão ter o mesmo nome do campo da classe.
*
*/
public class RenderPersonalizado<T> implements ListitemRenderer {
List<String> colunas = new ArrayList<String>();
Boolean addBotaoExcluir = false;
public RenderPersonalizado(List<String> colunas) {
this.colunas = colunas;
}
public RenderPersonalizado<T> comBotaoExcluir(Boolean addBotaoExcluir) {
this.addBotaoExcluir = addBotaoExcluir;
return this;
}
@Override
public void render(Listitem item, Object objeto) throws Exception {
incluirColunasRender(item, objeto);
if (addBotaoExcluir) {
Listcell lc = new Listcell();
lc.setParent(item);
lc.appendChild(criaBotaoExcluir());
}
item.setAttribute("data", (T)objeto);
}
protected void incluirColunasRender(Listitem item, Object objeto) throws IllegalAccessException, InvocationTargetException {
incluirColunasSelecionadas(item, objeto);
}
private void incluirColunasSelecionadas(Listitem item, Object objeto) throws IllegalAccessException, InvocationTargetException {
Method[] methods = objeto.getClass().getDeclaredMethods();
for (String coluna : colunas) {
String nomeMetodo = obtemMetodoGet(coluna);
for (Method method : methods) {
if (method.getName().equals(nomeMetodo)) {
Listcell lc = new Listcell(method.invoke((T)objeto).toString());
lc.setParent(item);
break;
}
}
}
}
private Button criaBotaoExcluir() {
Button botaoExcluir = new Button();
botaoExcluir.setWidth("16");
botaoExcluir.setHeight("16");
botaoExcluir.setImage("/gui/img/remove.png");
botaoExcluir.addEventListener("onClick", new EventListenerExcluirRegistroRender());
return botaoExcluir;
}
private String obtemMetodoGet(String coluna) {
return "get".concat(coluna.substring(0, 1).toUpperCase().concat(coluna.substring(1)));
}
private final class EventListenerExcluirRegistroRender implements EventListener {
@Override
public void onEvent(Event event) throws Exception {
MyListbox listBox = (MyListbox) event.getTarget().getParent().getParent().getParent();
Listitem listItem = (Listitem) event.getTarget().getParent().getParent();
listBox.removeItem(listItem.getAttribute("data"));
}
}
}

View File

@ -305,6 +305,7 @@ indexController.mniRelatorioImpressaoPosterior.label=Impresión posterior
indexController.mniRelatorioServicoBloqueadoVendaInternet.label = Corrida bloqueada en venta internet
indexController.mniRelatorioDocumentosFiscais.label = Report Documentos Fiscais
indexController.mniRelatorioVendasConexao.label = Reporte Ventas Conexion
indexController.mniRelatorioHistoricoCompras.label = Reporte Histórico de Compras
indexController.mniRelatorioRemessaCNAB.label = Remessa de Lote (CNAB 400)
@ -816,6 +817,29 @@ relatorioServicoBloqueadoVendaInternetController.lbDatFinal.value = Fecha final
relatorioServicoBloqueadoVendaInternetController.lbEmpresa.value = Empresa
relatorioServicoBloqueadoVendaInternetController.lbAgencia.value = Agencia
#Relatorio Historico Compras
relatorioHistoricoComprasController.window.title = Reporte Histórico de Compras
relatorioHistoricoComprasController.lblDataVendaIni.value = Data Venda Inicial
relatorioHistoricoComprasController.lblDataVendaFin.value = Data Venda Final
relatorioHistoricoComprasController.lblDataEmbarqueIni.value = Data Embarque Inicial
relatorioHistoricoComprasController.lblDataEmbarqueFin.value = Data Embarque Final
relatorioHistoricoComprasController.lbPuntoVenta.value = Agência
relatorioHistoricoComprasController.lbEmpresa.value = Empresa
relatorioHistoricoComprasController.lbNumero.value = Número Agência
relatorioHistoricoComprasController.lbLinha.label = Linha
relatorioHistoricoComprasController.lbNumRuta.label = Num. Linha
relatorioHistoricoComprasController.lbPrefixo.label = Prefixo
relatorioHistoricoComprasController.lbOrgao.label = Orgão Concedente
relatorioHistoricoComprasController.lbCpf.label = CPF Cliente
relatorioHistoricoComprasController.nomeCliente.value = Cliente
relatorioHistoricoComprasController.MSG.informarDataVenda = Favor informar o período completo de venda.
relatorioHistoricoComprasController.MSG.informarDataEmbarque = Favor informar o período completo de embarque.
relatorioHistoricoComprasController.MSG.informarFiltroData = Favor informar um filtro de data.
relatorioHistoricoComprasController.MSG.dataInicialVendaMaiorFinal = Data inicial da venda maior que final.
relatorioHistoricoComprasController.MSG.dataInicialEmbarqueMaiorFinal = Data inicial do embarque maior que final.
relatorioHistoricoComprasController.btnPesquisa.label = Pesquisar
relatorioHistoricoComprasController.btnLimpar.label = Limpar
#Relatório Documentos Fiscais
relatorioDocumentosFiscaisController.window.title = Reporte Documentos Fiscais
relatorioDocumentosFiscaisController.lbDatInicial.value = Fecha Inicial

View File

@ -323,6 +323,7 @@ indexController.mniRelatorioImpressaoPosterior.label=Impressão Posterior
indexController.mniRelatorioServicoBloqueadoVendaInternet.label = Serviço Bloqueado na Venda Internet
indexController.mniRelatorioDocumentosFiscais.label = Relatório Documentos Fiscais
indexController.mniRelatorioVendasConexao.label = Relatório Vendas de Conexão
indexController.mniRelatorioHistoricoCompras.label = Relatório Histórico de Compras
indexController.mnSubMenuImpressaoFiscal.label=Impressão Fiscal
indexController.mnSubMenuRelatorioImpressaoFiscal.label=Importação Fiscal
@ -915,6 +916,29 @@ relatorioServicoBloqueadoVendaInternetController.lbDatFinal.value = Data Final
relatorioServicoBloqueadoVendaInternetController.lbEmpresa.value = Empresa
relatorioServicoBloqueadoVendaInternetController.lbAgencia.value = Agência
#Relatorio Historico Compras
relatorioHistoricoComprasController.window.title = Relatório Histórico de Compras
relatorioHistoricoComprasController.lblDataVendaIni.value = Data Venda Inicial
relatorioHistoricoComprasController.lblDataVendaFin.value = Data Venda Final
relatorioHistoricoComprasController.lblDataEmbarqueIni.value = Data Embarque Inicial
relatorioHistoricoComprasController.lblDataEmbarqueFin.value = Data Embarque Final
relatorioHistoricoComprasController.lbPuntoVenta.value = Agência
relatorioHistoricoComprasController.lbEmpresa.value = Empresa
relatorioHistoricoComprasController.lbNumero.value = Número Agência
relatorioHistoricoComprasController.lbLinha.label = Linha
relatorioHistoricoComprasController.lbNumRuta.label = Num. Linha
relatorioHistoricoComprasController.lbPrefixo.label = Prefixo
relatorioHistoricoComprasController.lbOrgao.label = Orgão Concedente
relatorioHistoricoComprasController.lbCpf.label = CPF Cliente
relatorioHistoricoComprasController.nomeCliente.value = Cliente
relatorioHistoricoComprasController.MSG.informarDataVenda = Favor informar o período completo de venda.
relatorioHistoricoComprasController.MSG.informarDataEmbarque = Favor informar o período completo de embarque.
relatorioHistoricoComprasController.MSG.informarFiltroData = Favor informar um filtro de data.
relatorioHistoricoComprasController.MSG.dataInicialVendaMaiorFinal = Data inicial da venda maior que final.
relatorioHistoricoComprasController.MSG.dataInicialEmbarqueMaiorFinal = Data inicial do embarque maior que final.
relatorioHistoricoComprasController.btnPesquisa.label = Pesquisar
relatorioHistoricoComprasController.btnLimpar.label = Limpar
# Pantalla Editar Classe
editarClaseServicioController.window.title = Tipo de Classe
editarClaseServicioController.btnApagar.tooltiptext = Eliminar

View File

@ -0,0 +1,231 @@
<?xml version="1.0" encoding="UTF-8"?>
<?page contentType="text/html;charset=UTF-8"?>
<?variable-resolver class="org.zkoss.zkplus.spring.DelegatingVariableResolver"?>
<?init class="org.zkoss.zkplus.databind.AnnotateDataBinderInit" arg0="winFiltroRelatorioHistoricoCompras"?>
<?taglib uri="http://www.zkoss.org/dsp/web/core" prefix="c"?>
<zk xmlns="http://www.zkoss.org/2005/zul">
<window id="winFiltroRelatorioHistoricoCompras" apply="${relatorioHistoricoComprasController}"
contentStyle="overflow:auto"
height="570px" width="728px" border="normal">
<grid fixedLayout="true">
<columns>
<column width="25%" />
<column width="30%" />
<column width="15%" />
<column width="30%" />
</columns>
<rows>
<row>
<label
value="${c:l('relatorioHistoricoComprasController.lblDataVendaIni.value')}" />
<datebox id="dtVendaInicial" width="100%" mold="rounded"
format="dd/MM/yyyy" maxlength="10" />
<label
value="${c:l('relatorioHistoricoComprasController.lblDataVendaFin.value')}" />
<datebox id="dtVendaFinal" width="100%" mold="rounded"
format="dd/MM/yyyy" maxlength="10" />
</row>
<row>
<label
value="${c:l('relatorioHistoricoComprasController.lblDataEmbarqueIni.value')}" />
<datebox id="dtEmbarqueInicial" width="100%" mold="rounded"
format="dd/MM/yyyy" maxlength="10" />
<label
value="${c:l('relatorioHistoricoComprasController.lblDataEmbarqueFin.value')}" />
<datebox id="dtEmbarqueFinal" width="100%" mold="rounded"
format="dd/MM/yyyy" maxlength="10" />
</row>
<row spans="1,3">
<label value="Agencia" />
<bandbox id="bbPesquisaPuntoVenta" width="100%"
mold="rounded" readonly="true">
<bandpopup>
<vbox>
<hbox>
<label
value="${c:l('relatorioHistoricoComprasController.lbPuntoVenta.value')}" />
<textbox id="txtNombrePuntoVenta"
use="com.rjconsultores.ventaboletos.web.utilerias.MyTextbox"
width="300px" mold="rounded" />
<button id="btnPesquisaPuntoVenta"
image="/gui/img/find.png"
label="${c:l('relatorioHistoricoComprasController.btnPesquisa.label')}" />
<button id="btnLimpar"
image="/gui/img/eraser.png"
label="${c:l('relatorioHistoricoComprasController.btnLimpar.label')}" />
</hbox>
<paging id="pagingPuntoVenta"
pageSize="10" />
<listbox id="puntoVentaList"
mold="paging"
use="com.rjconsultores.ventaboletos.web.utilerias.MyListbox"
vflex="true" height="100%" width="700px">
<listhead>
<listheader
label="${c:l('relatorioHistoricoComprasController.lbPuntoVenta.value')}" />
<listheader width="35%"
label="${c:l('relatorioHistoricoComprasController.lbEmpresa.value')}" />
<listheader width="20%"
label="${c:l('relatorioHistoricoComprasController.lbNumero.value')}" />
</listhead>
</listbox>
</vbox>
</bandpopup>
</bandbox>
</row>
<row spans="4">
<listbox id="puntoVentaSelList" mold="paging"
use="com.rjconsultores.ventaboletos.web.utilerias.MyListbox"
vflex="true" height="100px" width="100%">
<listhead>
<listheader
label="${c:l('relatorioHistoricoComprasController.lbPuntoVenta.value')}" />
<listheader width="35%"
label="${c:l('relatorioHistoricoComprasController.lbEmpresa.value')}" />
<listheader width="20%"
label="${c:l('relatorioHistoricoComprasController.lbNumero.value')}" />
<listheader width="15%" />
</listhead>
</listbox>
<paging id="pagingSelPuntoVenta" pageSize="10" />
</row>
<row spans="1,3">
<label value="${c:l('relatorioHistoricoComprasController.lbLinha.label')}" />
<bandbox id="bbPesquisaLinha" width="100%"
mold="rounded" readonly="true">
<bandpopup>
<vbox>
<hbox>
<label value="${c:l('relatorioHistoricoComprasController.lbLinha.label')}" />
<textbox id="txtPalavraPesquisaLinha"
use="com.rjconsultores.ventaboletos.web.utilerias.MyTextbox"
width="300px" mold="rounded" />
<button id="btnPesquisaLinha"
image="/gui/img/find.png"
label="${c:l('relatorioHistoricoComprasController.btnPesquisa.label')}" />
<button id="btnLimparLinha"
image="/gui/img/eraser.png"
label="${c:l('relatorioHistoricoComprasController.btnLimpar.label')}" />
</hbox>
<listbox id="linhaList" mold="paging"
use="com.rjconsultores.ventaboletos.web.utilerias.MyListbox"
vflex="true" height="100%" width="700px">
<listhead>
<listheader
label="${c:l('relatorioHistoricoComprasController.lbNumRuta.label')}"
width="18%" />
<listheader
label="${c:l('relatorioHistoricoComprasController.lbPrefixo.label')}"
width="20%" />
<listheader
label="${c:l('lb.dec')}" width="35%" />
<listheader
label="${c:l('relatorioHistoricoComprasController.lbOrgao.label')}"
width="27%" />
</listhead>
</listbox>
<paging id="pagingLinha" pageSize="10" />
</vbox>
</bandpopup>
</bandbox>
</row>
<row>
<cell colspan="4">
<borderlayout height="100px">
<center border="0">
<listbox id="linhaSelList"
mold="paging"
use="com.rjconsultores.ventaboletos.web.utilerias.MyListbox"
vflex="true" height="100%" width="700px">
<listhead>
<listheader
label="${c:l('relatorioHistoricoComprasController.lbNumRuta.label')}"
width="18%" />
<listheader
label="${c:l('relatorioHistoricoComprasController.lbPrefixo.label')}"
width="20%" />
<listheader
label="${c:l('lb.dec')}" width="30%" />
<listheader
label="${c:l('relatorioHistoricoComprasController.lbOrgao.label')}"
width="22%" />
<listheader width="10%" />
</listhead>
</listbox>
</center>
</borderlayout>
</cell>
</row>
<row spans="1,3">
<label value="${c:l('relatorioHistoricoComprasController.lbCpf.label')}" />
<bandbox id="bbPesquisaCpf" width="100%"
mold="rounded" readonly="true">
<bandpopup>
<vbox>
<hbox>
<label value="${c:l('relatorioHistoricoComprasController.lbCpf.label')}"/>
<textbox id="txtCpfPesquisa"
use="com.rjconsultores.ventaboletos.web.utilerias.MyTextbox"
width="300px" mold="rounded" />
<button id="btnPesquisaCpf"
image="/gui/img/find.png"
label="${c:l('relatorioHistoricoComprasController.btnPesquisa.label')}" />
<button id="btnLimparCpf"
image="/gui/img/eraser.png"
label="${c:l('relatorioHistoricoComprasController.btnLimpar.label')}" />
</hbox>
<paging id="pagingCpfCliente" pageSize="10" />
<listbox id="cpfList" mold="paging"
use="com.rjconsultores.ventaboletos.web.utilerias.MyListbox"
vflex="true" height="100%" width="700px">
<listhead>
<listheader
label="${c:l('relatorioHistoricoComprasController.lbCpf.label')}"
width="25%" />
<listheader
label="${c:l('relatorioHistoricoComprasController.nomeCliente.value')}"
width="75%" />
</listhead>
</listbox>
</vbox>
</bandpopup>
</bandbox>
</row>
<row>
<cell colspan="4">
<borderlayout height="100px">
<center border="0">
<listbox id="cpfSelList"
mold="paging"
use="com.rjconsultores.ventaboletos.web.utilerias.MyListbox"
vflex="true" multiple="true" height="60%" width="100%">
<listhead>
<listheader
label="${c:l('relatorioHistoricoComprasController.lbCpf.label')}"
width="25%" />
<listheader
label="${c:l('relatorioHistoricoComprasController.nomeCliente.value')}"
width="65%" />
<listheader width="10%" />
</listhead>
</listbox>
</center>
</borderlayout>
</cell>
</row>
</rows>
</grid>
<toolbar>
<button id="btnExecutarRelatorio" image="/gui/img/find.png"
label="${c:l('relatorio.lb.btnExecutarRelatorio')}" />
</toolbar>
</window>
</zk>