Criado o relatorio vendas de cartoes

fixes bug#11948
dev:julio
qua:marcelo

git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@85139 d1611594-4594-4d17-8e1d-87c2c4800839
master
walace 2018-09-05 21:43:04 +00:00
parent 0b53573cf5
commit 2ce8ffa773
11 changed files with 875 additions and 0 deletions

View File

@ -0,0 +1,181 @@
package com.rjconsultores.ventaboletos.relatorios.impl;
import java.math.BigDecimal;
import java.sql.Connection;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.apache.log4j.Logger;
import com.rjconsultores.ventaboletos.entidad.Empresa;
import com.rjconsultores.ventaboletos.entidad.Estacion;
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
import com.rjconsultores.ventaboletos.entidad.Usuario;
import com.rjconsultores.ventaboletos.relatorios.utilitarios.DataSource;
import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio;
import com.rjconsultores.ventaboletos.relatorios.utilitarios.RelatorioVendasCartoesBean;
import com.rjconsultores.ventaboletos.web.utilerias.NamedParameterStatement;
import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource;
public class RelatorioVendasCartoes extends Relatorio {
private static Logger log = Logger.getLogger(RelatorioMovimentacaoEstoque.class);
List<RelatorioVendasCartoesBean> list = null;
public RelatorioVendasCartoes(Map<String, Object> parametros, Connection conexao) throws Exception {
super(parametros, conexao);
this.setCustomDataSource(new DataSource(this) {
public void initDados() throws Exception {
Connection conexao = this.relatorio.getConexao();
Map<String, Object> parametros = this.relatorio.getParametros();
NamedParameterStatement stmt = null;
ResultSet rset = null;
String dataInicial = parametros.get("DATA_INICIAL").toString() + " 00:00:00";
String dataFinal = parametros.get("DATA_FINAL").toString() + " 23:59:59";
Empresa empresa = (Empresa) parametros.get("EMPRESA");
PuntoVenta puntoVenta = (PuntoVenta) parametros.get("PUNTOVENTA");
Usuario usuario = (Usuario) parametros.get("USUARIO");
Estacion estacao = (Estacion) parametros.get("ESTACION");
String sql = getSql(dataInicial, dataFinal, empresa, puntoVenta, usuario, estacao);
try {
stmt = new NamedParameterStatement(conexao, sql);
if(empresa != null){
stmt.setInt("empresaId", empresa.getEmpresaId());
}
if(puntoVenta != null){
stmt.setInt("puntoventaId", puntoVenta.getPuntoventaId());
}
if(dataInicial != null){
stmt.setString("dataInicial",dataInicial);
}
if(dataFinal != null){
stmt.setString("dataFinal", dataFinal);
}
if(estacao != null){
stmt.setInt("estacionId", estacao.getEstacionId());
}
if(usuario != null){
stmt.setInt("usuarioId", usuario.getUsuarioId());
}
rset = stmt.executeQuery();
list = new ArrayList<RelatorioVendasCartoesBean>();
BigDecimal valorTotal = BigDecimal.ZERO;
while (rset.next()) {
RelatorioVendasCartoesBean bean = new RelatorioVendasCartoesBean();
bean.setDataVenda(rset.getDate("dataVenda"));
bean.setDataOperacao(rset.getDate("dataOperacao"));
bean.setDescPagamento(rset.getString("descPagamento"));
bean.setValor(rset.getBigDecimal("valor"));
bean.setAutorizacao(rset.getString("autorizacao"));
bean.setQtdParcelas(rset.getInt("qtdParcelas"));
valorTotal = valorTotal.add(bean.getValor() != null ? bean.getValor() : BigDecimal.ZERO);
bean.setValorTotal(valorTotal);
list.add(bean);
}
} catch (Exception e) {
log.error(e.getMessage(), e);
} finally {
if(rset != null && !rset.isClosed()) {
rset.close();
}
if(stmt != null && !stmt.isClosed()) {
stmt.close();
}
}
}
});
this.setCollectionDataSource(new JRBeanCollectionDataSource(list));
}
private RelatorioVendasCartoesBean calcTotalValor(RelatorioVendasCartoesBean bean) {
BigDecimal valorTotal = bean.getValorTotal().add(bean.getValorTotal());
bean.setValorTotal(valorTotal);
return bean;
}
@Override
protected void processaParametros() throws Exception {
}
private String getSql(String dataInicial, String dataFinal, Empresa empresa, PuntoVenta puntoVenta, Usuario usuario, Estacion estacion) {
StringBuilder sb = new StringBuilder();
sb.append("SELECT caja.descpago as descPagamento,");
sb.append(" caja.dataoperacao as dataOperacao,");
sb.append(" caja.autorizacao as autorizacao,");
sb.append(" caja.qtdparcelas as qtdParcelas,");
sb.append(" caja.datavenda as dataVenda, ");
sb.append(" sum(caja.preco) as valor ");
sb.append("FROM");
sb.append(" (SELECT fp.descpago AS descpago,");
sb.append(" ct.fecoperacion AS dataoperacao,");
sb.append(" ct.numautorizacion AS autorizacao,");
sb.append(" ct.cantparcelas AS qtdparcelas,");
sb.append(" c.fechorventa AS datavenda,");
sb.append(" c.preciopagado AS preco");
sb.append(" FROM caja c");
sb.append(" INNER JOIN caja_formapago cfp ON c.caja_id=cfp.caja_id");
sb.append(" AND cfp.activo = 1");
sb.append(" INNER JOIN forma_pago fp ON cfp.formapago_id=fp.formapago_id");
sb.append(" INNER JOIN caja_det_pago cdp ON (c.caja_id = cdp.caja_id)");
sb.append(" INNER JOIN caja_tarjeta ct ON (ct.cajadetpago_id = cdp.cajadetpago_id)");
sb.append(" WHERE ");
if(empresa!= null){
sb.append("c.empresacorrida_id = :empresaId ");
}
if(puntoVenta != null){
sb.append("AND c.puntoventa_id = :puntoventaId ");
}
if(estacion!= null){
sb.append("AND c.estacion_id = :estacionId ");
}
if(usuario!= null){
sb.append(" and c.usuario_id = :usuarioId ");
}
if(dataInicial != null){
sb.append("AND c.fechorventa >= TO_DATE(:dataInicial, 'DD/MM/YYYY HH24:MI:SS') ");
}
if(dataFinal != null){
sb.append("AND c.fechorventa <= TO_DATE(:dataFinal, 'DD/MM/YYYY HH24:MI:SS') ");
}
sb.append(" AND fp.formapago_id IN(2,3)");
sb.append(" AND c.activo = 1) caja ");
sb.append("GROUP BY caja.descpago,");
sb.append(" caja.dataoperacao,");
sb.append(" caja.autorizacao,");
sb.append(" caja.qtdparcelas,");
sb.append(" caja.datavenda,");
sb.append(" caja.preco ");
sb.append("ORDER BY caja.descpago, caja.datavenda");
return sb.toString();
}
}

View File

@ -0,0 +1,35 @@
#geral
msg.noData=Não foi possivel obter dados com os parâmetros informados.
msg.a=à
#Labels header
header.titulo.relatorio=Relatório Vendas de Cartões
header.periodo=Per\u00EDodo\:
header.data.hora=Data/Hora\:
header.pagina=P\u00E1gina\:
header.filtro=Filtro\:
header.filtro.servico=Servi\u00E7o\:
header.filtro.empresa=Empresa:
header.filtro.agencia=Agência:
header.filtro.estacao=Estação:
header.filtro.bilheteiro=Bilheteiro:
header.filtro.grupo=Grupo de Linhas\:
#Labels detail
detail.dataOperacao=Data Operação
detail.dataVenda=Data Venda
detail.autorizacao=Autorização
detail.qtdParcelas=Quantidade Parcelas
detail.valorTotal=Valor Total
detail.valor=Valor R$
#Group
group.total=Total Geral:
sub.total=Sub Total:
total.debito=Total Débito:
total.credito=Total Crédito:
linhas=Linhas

View File

@ -0,0 +1,35 @@
#geral
msg.noData=Não foi possivel obter dados com os parâmetros informados.
msg.a=à
#Labels header
header.titulo.relatorio=Relatório Vendas de Cartões
header.periodo=Per\u00EDodo\:
header.data.hora=Data/Hora\:
header.pagina=P\u00E1gina\:
header.filtro=Filtro\:
header.filtro.servico=Servi\u00E7o\:
header.filtro.empresa=Empresa:
header.filtro.agencia=Agência:
header.filtro.estacao=Estação:
header.filtro.bilheteiro=Bilheteiro:
header.filtro.grupo=Grupo de Linhas\:
#Labels detail
detail.dataOperacao=Data Operação
detail.dataVenda=Data Venda
detail.autorizacao=Autorização
detail.qtdParcelas=Quantidade Parcelas
detail.valorTotal=Valor Total
detail.valor=Valor R$
#Group
group.total=Total Geral:
sub.total=Sub Total:
total.debito=Total Débito:
total.credito=Total Crédito:
linhas=Linhas

View File

@ -0,0 +1,268 @@
<?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="RelatorioVendasCartoes" pageWidth="842" pageHeight="595" orientation="Landscape" whenNoDataType="NoDataSection" columnWidth="802" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="ae2cbb01-bc79-4d18-8206-3b59273fe793">
<property name="ireport.zoom" value="4.177248169415656"/>
<property name="ireport.x" value="1210"/>
<property name="ireport.y" value="192"/>
<parameter name="NOMBEMPRESA" class="java.lang.String"/>
<parameter name="DATA_INICIAL" class="java.lang.String">
<defaultValueExpression><![CDATA[]]></defaultValueExpression>
</parameter>
<parameter name="DATA_FINAL" class="java.lang.String"/>
<parameter name="LINHA_FILTRO" class="java.lang.String"/>
<parameter name="SERVICO_FILTRO" class="java.lang.String"/>
<parameter name="TOTAL_PASSAGENS" class="java.math.BigDecimal"/>
<parameter name="DESCGRUPO" class="java.lang.String"/>
<parameter name="NOME_EMPRESA" class="java.lang.String"/>
<parameter name="ESTACAO" class="java.lang.String"/>
<parameter name="NOME_USUARIO" class="java.lang.String"/>
<parameter name="NOME_AGENCIA" class="java.lang.String"/>
<queryString>
<![CDATA[]]>
</queryString>
<field name="valorTotal" class="java.math.BigDecimal"/>
<field name="descPagamento" class="java.lang.String"/>
<field name="dataOperacao" class="java.util.Date"/>
<field name="autorizacao" class="java.lang.String"/>
<field name="qtdParcelas" class="java.lang.Integer"/>
<field name="dataVenda" class="java.util.Date"/>
<field name="valor" class="java.math.BigDecimal"/>
<variable name="total_group" class="java.math.BigDecimal" resetType="Group" resetGroup="groupRuta" calculation="Sum">
<variableExpression><![CDATA[$F{valorTotal}]]></variableExpression>
</variable>
<variable name="TOTAL" class="java.math.BigDecimal" calculation="Sum">
<variableExpression><![CDATA[$F{valor}]]></variableExpression>
</variable>
<variable name="TOTAL_TIPO_CARTAO" class="java.math.BigDecimal" resetType="Group" resetGroup="groupRuta" calculation="Sum">
<variableExpression><![CDATA[$F{valor}]]></variableExpression>
</variable>
<group name="groupRuta">
<groupExpression><![CDATA[$F{descPagamento}]]></groupExpression>
<groupHeader>
<band height="19">
<textField isBlankWhenNull="true">
<reportElement x="0" y="0" width="179" height="16" uuid="f1171f5c-2175-4176-82b0-c1a31f78f1d3"/>
<textElement>
<font size="12" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$F{descPagamento}]]></textFieldExpression>
</textField>
<line>
<reportElement x="0" y="0" width="803" height="1" uuid="b6bdef50-f793-4c23-b188-505c0fb7bf18"/>
</line>
<line>
<reportElement x="0" y="15" width="802" height="1" uuid="6e1204b5-dc16-40df-b592-9046e0b31a14"/>
</line>
</band>
</groupHeader>
<groupFooter>
<band height="25">
<line>
<reportElement positionType="Float" x="0" y="0" width="803" height="1" uuid="8dd18564-6d32-4232-a0fd-f39054849109"/>
</line>
<textField>
<reportElement x="0" y="1" width="218" height="23" uuid="a7c33cf2-944b-4bd1-bb55-72ab698cc599"/>
<textElement>
<font size="12" isBold="true" isItalic="false"/>
</textElement>
<textFieldExpression><![CDATA[$F{descPagamento}.equals("CRÉDITO") ? $R{total.credito} : $R{total.debito}]]></textFieldExpression>
</textField>
<textField pattern="#,##0.00;-#,##0.00" isBlankWhenNull="true">
<reportElement x="349" y="1" width="38" height="10" uuid="27802809-5617-44e5-a89b-cc64e8bde961"/>
<textElement textAlignment="Right">
<font size="10"/>
</textElement>
<textFieldExpression><![CDATA[$V{total_group}]]></textFieldExpression>
</textField>
<textField pattern="¤ #,##0.00" isBlankWhenNull="true">
<reportElement x="648" y="1" width="77" height="23" uuid="b3279060-d361-41c6-bc5c-a02d9d08774c"/>
<textElement textAlignment="Right">
<font size="10"/>
</textElement>
<textFieldExpression><![CDATA[$V{TOTAL_TIPO_CARTAO}]]></textFieldExpression>
</textField>
</band>
</groupFooter>
</group>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band splitType="Stretch"/>
</title>
<pageHeader>
<band height="110" splitType="Stretch">
<textField>
<reportElement x="0" y="20" width="349" height="20" uuid="2523431f-2c2c-4a2b-a34f-785b8ea8f9dd"/>
<textElement textAlignment="Center">
<font size="15"/>
</textElement>
<textFieldExpression><![CDATA[$R{header.titulo.relatorio}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="0" y="40" width="112" height="20" uuid="9bb1d24c-1a5c-4281-b900-d35779e00807"/>
<textElement>
<font size="12"/>
</textElement>
<textFieldExpression><![CDATA[$R{header.periodo}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="648" y="0" width="56" height="20" uuid="77235663-6b8a-411f-89be-24b315b65adb"/>
<textFieldExpression><![CDATA[$R{header.data.hora}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="704" y="20" width="52" height="20" uuid="cf1bcbcf-84b8-4d90-bbc7-22d9c7186952"/>
<textFieldExpression><![CDATA[$R{header.pagina}]]></textFieldExpression>
</textField>
<textField pattern="dd/MM/yyyy HH:mm">
<reportElement x="704" y="0" width="98" height="20" uuid="efdae9bf-3550-4620-acd0-20c9c7b0e3b1"/>
<textElement textAlignment="Left"/>
<textFieldExpression><![CDATA[new java.util.Date()]]></textFieldExpression>
</textField>
<textField>
<reportElement x="756" y="20" width="24" height="20" uuid="4070d457-cdcc-434e-8e50-5494a05815f9"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$V{PAGE_NUMBER}+" de"]]></textFieldExpression>
</textField>
<textField evaluationTime="Report">
<reportElement x="780" y="20" width="22" height="20" uuid="26156964-8733-4ad1-96fd-2ae8414636b7"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[" " + $V{PAGE_NUMBER}]]></textFieldExpression>
</textField>
<line>
<reportElement x="0" y="60" width="802" height="1" uuid="27a77abc-db13-4836-9261-8208f3825802"/>
</line>
<textField>
<reportElement x="0" y="61" width="802" height="20" uuid="06a43567-1fd2-4c86-a0cc-443618ddf965"/>
<textElement>
<font size="11"/>
</textElement>
<textFieldExpression><![CDATA[$R{header.filtro} + $R{header.filtro.empresa} + " ( " + $P{NOME_EMPRESA} + " ) " + $R{header.filtro.agencia} + " ( " + $P{NOME_AGENCIA} + " ) " + $R{header.filtro.estacao} + " ( " + $P{ESTACAO} + " ) "+ $R{header.filtro.bilheteiro} + " ( " + $P{NOME_USUARIO} + " ) "]]></textFieldExpression>
</textField>
<line>
<reportElement x="0" y="85" width="803" height="1" uuid="48a39edc-ed2a-40cb-8bfb-6e97bcb9088a"/>
</line>
<textField>
<reportElement x="0" y="86" width="179" height="23" uuid="c0f124b2-3691-4f49-9b86-69d76f249584"/>
<textElement textAlignment="Right" markup="none">
<font size="12" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$R{detail.dataOperacao}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="179" y="86" width="170" height="23" uuid="5faeb20b-f423-4bfa-bb2e-1f4f4aed6627"/>
<textElement textAlignment="Center" markup="none">
<font size="12" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$R{detail.autorizacao}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="349" y="86" width="131" height="23" uuid="824877eb-7028-4256-9503-7045d7eaee3c"/>
<textElement textAlignment="Right" markup="none">
<font size="12" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$R{detail.qtdParcelas}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="480" y="86" width="168" height="23" uuid="b9d303b2-5ea9-4cf0-845b-142089ac8f4d"/>
<textElement textAlignment="Right" markup="none">
<font size="12" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$R{detail.dataVenda}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="480" y="86" width="276" height="23" uuid="c5d483c4-89a2-4724-ad57-731676551f0f"/>
<textElement textAlignment="Right" markup="none">
<font size="12" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$R{detail.valor}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="112" y="40" width="237" height="20" uuid="cb391edc-e0b3-4fbb-a58f-f26191bc1c16"/>
<textElement>
<font size="12"/>
</textElement>
<textFieldExpression><![CDATA[$P{DATA_INICIAL} + " a " + $P{DATA_FINAL} ]]></textFieldExpression>
</textField>
</band>
</pageHeader>
<columnHeader>
<band splitType="Stretch"/>
</columnHeader>
<detail>
<band height="15" splitType="Stretch">
<textField pattern="¤ #,##0.00" isBlankWhenNull="true">
<reportElement x="648" y="0" width="108" height="15" uuid="80a57c70-9f34-49b9-86f9-14bb27c462ca"/>
<textElement textAlignment="Right">
<font size="10"/>
</textElement>
<textFieldExpression><![CDATA[$F{valor}]]></textFieldExpression>
</textField>
<textField pattern="dd/MM/yyyy" isBlankWhenNull="true">
<reportElement x="480" y="0" width="168" height="15" uuid="70f7c504-926b-4c12-ae8a-5c7fe4a9e45f"/>
<textElement textAlignment="Right">
<font size="10"/>
</textElement>
<textFieldExpression><![CDATA[$F{dataVenda}]]></textFieldExpression>
</textField>
<textField pattern="dd/MM/yyyy" isBlankWhenNull="true">
<reportElement x="0" y="0" width="179" height="15" uuid="ec2db54b-37be-4aba-95a3-d2e3067ee3e5"/>
<textElement textAlignment="Right">
<font size="10"/>
</textElement>
<textFieldExpression><![CDATA[$F{dataOperacao}]]></textFieldExpression>
</textField>
<textField pattern="" isBlankWhenNull="true">
<reportElement x="179" y="1" width="170" height="14" uuid="9e67df94-d0f8-4a04-86c0-4862a331d448"/>
<textElement textAlignment="Center">
<font size="10"/>
</textElement>
<textFieldExpression><![CDATA[$F{autorizacao}]]></textFieldExpression>
</textField>
<textField pattern="" isBlankWhenNull="true">
<reportElement x="349" y="1" width="131" height="14" uuid="e2737ee4-a6ee-4f1f-9a57-974c926a5d0d"/>
<textElement textAlignment="Center">
<font size="10"/>
</textElement>
<textFieldExpression><![CDATA[$F{qtdParcelas}]]></textFieldExpression>
</textField>
</band>
</detail>
<columnFooter>
<band splitType="Stretch"/>
</columnFooter>
<pageFooter>
<band splitType="Stretch"/>
</pageFooter>
<lastPageFooter>
<band/>
</lastPageFooter>
<summary>
<band height="22" splitType="Stretch">
<textField>
<reportElement x="0" y="1" width="112" height="21" uuid="6813f5a3-1810-4b53-82ea-3df08df9548f"/>
<textElement>
<font size="12" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$R{group.total}]]></textFieldExpression>
</textField>
<line>
<reportElement positionType="Float" x="0" y="0" width="803" height="1" uuid="d9792af6-b583-4b6e-bb69-7edd7f78fdfa"/>
</line>
<textField pattern="¤ #,##0.00" isBlankWhenNull="true">
<reportElement x="648" y="1" width="77" height="21" uuid="7ef31b82-e8a2-4baa-821a-174d5ca113fe"/>
<textElement textAlignment="Right">
<font size="10"/>
</textElement>
<textFieldExpression><![CDATA[$V{TOTAL}]]></textFieldExpression>
</textField>
</band>
</summary>
<noData>
<band height="20">
<textField>
<reportElement x="0" y="0" width="791" height="20" uuid="3429e199-e682-4e28-b2ce-1bc9f2d031b2"/>
<textFieldExpression><![CDATA[$R{msg.noData}]]></textFieldExpression>
</textField>
</band>
</noData>
</jasperReport>

View File

@ -0,0 +1,72 @@
package com.rjconsultores.ventaboletos.relatorios.utilitarios;
import java.math.BigDecimal;
import java.util.Date;
public class RelatorioVendasCartoesBean {
private Date dataVenda;
private Date dataOperacao;
private String autorizacao;
private String descPagamento;
private Integer qtdParcelas;
private BigDecimal valor;
private BigDecimal valorTotal;
public Date getDataVenda() {
return dataVenda;
}
public void setDataVenda(Date dataVenda) {
this.dataVenda = dataVenda;
}
public String getAutorizacao() {
return autorizacao;
}
public void setAutorizacao(String autorizacao) {
this.autorizacao = autorizacao;
}
public Integer getQtdParcelas() {
return qtdParcelas;
}
public void setQtdParcelas(Integer qtdParcelas) {
this.qtdParcelas = qtdParcelas;
}
public BigDecimal getValor() {
return valor;
}
public void setValor(BigDecimal valor) {
this.valor = valor;
}
public BigDecimal getValorTotal() {
return valorTotal;
}
public void setValorTotal(BigDecimal valorTotal) {
this.valorTotal = valorTotal;
}
public String getDescPagamento() {
return descPagamento;
}
public void setDescPagamento(String descPagamento) {
this.descPagamento = descPagamento;
}
public Date getDataOperacao() {
return dataOperacao;
}
public void setDataOperacao(Date dataOperacao) {
this.dataOperacao = dataOperacao;
}
}

View File

@ -0,0 +1,173 @@
package com.rjconsultores.ventaboletos.web.gui.controladores.relatorios;
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.Comboitem;
import org.zkoss.zul.Datebox;
import com.rjconsultores.ventaboletos.entidad.Empresa;
import com.rjconsultores.ventaboletos.entidad.Estacion;
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
import com.rjconsultores.ventaboletos.entidad.Usuario;
import com.rjconsultores.ventaboletos.relatorios.impl.RelatorioMovimentacaoEstoque;
import com.rjconsultores.ventaboletos.relatorios.impl.RelatorioVendasCartoes;
import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio;
import com.rjconsultores.ventaboletos.utilerias.DateUtil;
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEstacion;
import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEstandar;
import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxPuntoVenta;
import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxUsuario;
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
@Controller("relatorioVendasCartoesController")
@Scope("prototype")
public class RelatorioVendasCartoesController extends MyGenericForwardComposer {
private static final long serialVersionUID = 1L;
private Datebox dataInicial;
private Datebox dataFinal;
private MyComboboxEstandar cmbEmpresa;
private MyComboboxPuntoVenta cmbPuntoVenta;
private MyComboboxEstacion cmbEstacion;
private MyComboboxUsuario cmbUsuario;
private List<Empresa> lsEmpresa;
@Autowired
private DataSource dataSourceRead;
@Override
public void doAfterCompose(Component comp) throws Exception {
lsEmpresa = UsuarioLogado.getUsuarioLogado().getEmpresa();
super.doAfterCompose(comp);
}
/**
* @throws Exception
*
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
private void executarRelatorio() throws Exception {
Map<String, Object> parametros = new HashMap<String, Object>();
if(dataInicial.getValue() == null){
return;
}
if(dataFinal.getValue() == null){
return;
}
parametros.put("NOME_RELATORIO", Labels.getLabel("relatorioVendasCartoesController.window.title"));
StringBuilder filtro = new StringBuilder("Filtros\n");
Comboitem itemEmpresa = cmbEmpresa.getSelectedItem();
if (itemEmpresa != null) {
Empresa empresa = (Empresa) itemEmpresa.getValue();
if(empresa.getEmpresaId() > -1) {
parametros.put("EMPRESA", empresa);
parametros.put("NOME_EMPRESA", empresa.getNombempresa());
filtro.append(empresa.getNombempresa());
} else {
filtro.append("Todas");
}
} else {
filtro.append("Todas");
}
Comboitem itemPuntoVenta = cmbPuntoVenta.getSelectedItem();
if (itemPuntoVenta != null) {
PuntoVenta puntoVenta = (PuntoVenta) itemPuntoVenta.getValue();
if(puntoVenta.getPuntoventaId() > -1) {
parametros.put("PUNTOVENTA", puntoVenta);
parametros.put("NOME_AGENCIA", puntoVenta.getNombpuntoventa());
} else {
parametros.put("NOME_AGENCIA", "Todas");
}
}else {
parametros.put("NOME_AGENCIA", "Todas");
}
Comboitem cbiUsuario = cmbUsuario.getSelectedItem();
if (cbiUsuario != null) {
Usuario usuario = (Usuario) cbiUsuario.getValue();
if(usuario.getUsuarioId() > -1) {
parametros.put("USUARIO", usuario);
parametros.put("NOME_USUARIO", usuario.getNombUsuarioCompleto());
} else {
parametros.put("NOME_USUARIO", "Todos");
}
}else {
parametros.put("NOME_USUARIO", "Todos");
}
Comboitem itemEstacion = cmbEstacion.getSelectedItem();
if (itemEstacion != null) {
Estacion estacion = (Estacion) itemEstacion.getValue();
if(estacion.getEstacionId() > -1) {
parametros.put("ESTACION", estacion);
parametros.put("ESTACAO", estacion.getDescestacion());
}
else {
parametros.put("ESTACAO", "Todas");
}
}else {
parametros.put("ESTACAO", "Todas");
}
parametros.put("DATA_INICIAL", DateUtil.getStringDate(dataInicial.getValue(), "dd/MM/yyyy"));
parametros.put("DATA_FINAL", DateUtil.getStringDate(dataFinal.getValue(), "dd/MM/yyyy"));
parametros.put("FILTROS", filtro.toString());
Relatorio relatorio = new RelatorioVendasCartoes(parametros, dataSourceRead.getConnection());
Map args = new HashMap();
args.put("relatorio", relatorio);
openWindow("/component/reportView.zul",
Labels.getLabel("relatorioVendasCartoesController.window.title"), args, MODAL);
}
public void onClick$btnExecutarRelatorio(Event ev) throws Exception{
executarRelatorio();
}
public Datebox getDatInicial() {
return dataInicial;
}
public void setDatInicial(Datebox datInicial) {
this.dataInicial = datInicial;
}
public Datebox getDatFinal() {
return dataFinal;
}
public void setDatFinal(Datebox datFinal) {
this.dataFinal = datFinal;
}
public List<Empresa> getLsEmpresa() {
return lsEmpresa;
}
public void setLsEmpresa(List<Empresa> lsEmpresa) {
this.lsEmpresa = lsEmpresa;
}
public MyComboboxEstandar getCmbEmpresa() {
return cmbEmpresa;
}
public void setCmbEmpresa(MyComboboxEstandar cmbEmpresa) {
this.cmbEmpresa = cmbEmpresa;
}
}

View File

@ -0,0 +1,24 @@
package com.rjconsultores.ventaboletos.web.utilerias.menu.item.relatorios;
import org.zkoss.util.resource.Labels;
import com.rjconsultores.ventaboletos.web.utilerias.PantallaUtileria;
import com.rjconsultores.ventaboletos.web.utilerias.menu.DefaultItemMenuSistema;
public class ItemMenuRelatorioVendasCartoes extends DefaultItemMenuSistema {
public ItemMenuRelatorioVendasCartoes() {
super("indexController.mniRelatorioVendasCartoes.label");
}
@Override
public String getClaveMenu() {
return "COM.RJCONSULTORES.ADMINISTRACION.GUI.RELATORIOS.MENU.RELATORIOVENDASCARTOES";
}
@Override
public void ejecutar() {
PantallaUtileria.openWindow("/gui/relatorios/filtroRelatorioVendasCartoes.zul",
Labels.getLabel("relatorioVendasCartoesController.window.title"), getArgs(), desktop);
}
}

View File

@ -171,6 +171,7 @@ analitico.gerenciais.financeiro.receitaServico=com.rjconsultores.ventaboletos.we
analitico.gerenciais.financeiro.agenciaFechamento=com.rjconsultores.ventaboletos.web.utilerias.menu.item.relatorios.ItemMenuRelatorioAgenciaFechamento
analitico.gerenciais.financeiro.cancelamentoVendaCartao=com.rjconsultores.ventaboletos.web.utilerias.menu.item.relatorios.ItemMenuRelatorioCancelamentoVendaCartao
analitico.gerenciais.financeiro.estornoCartao=com.rjconsultores.ventaboletos.web.utilerias.menu.item.relatorios.ItemMenuRelatorioEstornoCartao
analitico.gerenciais.financeiro.vendasCartoes=com.rjconsultores.ventaboletos.web.utilerias.menu.item.relatorios.ItemMenuRelatorioVendasCartoes
analitico.gerenciais.financeiro.j3=com.rjconsultores.ventaboletos.web.utilerias.menu.item.relatorios.ItemMenuRelatorioCancelamentoTransacao
analitico.gerenciais.financeiro.descontos=com.rjconsultores.ventaboletos.web.utilerias.menu.item.relatorios.ItemMenuRelatorioDescontos
analitico.gerenciais.financeiro.vendasComissao=com.rjconsultores.ventaboletos.web.utilerias.menu.item.relatorios.ItemMenuRelatorioVendasComissao

View File

@ -7657,6 +7657,15 @@ relatorioMovimentacaoEstoqueController.lb.puntoventaRec = Punto Venta Recibimien
relatorioMovimentacaoEstoqueController.lb.estacionEnv = Estacion Envio
relatorioMovimentacaoEstoqueController.lb.estacionRec = Estacion Recibimiento
#Relatorio Vendas Cartões Estoque
relatorioVendasCartoesController.lbEmpresa.value = Empresa
relatorioVendasCartoesController.window.title = Reporte Vendas Cartões
relatorioVendasCartoesController.lb.puntoVenta.value = Punto Venta
relatorioVendasCartoesController.lb.estacao.value = Estacion
relatorioVendasCartoesController.lbDatInicial.value = Fecha Inicio
relatorioVendasCartoesController.lbDatFinal.value = Fecha Final
relatorioVendasCartoesController.lb.usuario.value = Agente de Pasajes
# Reporte Exportacao Idoso ARTESP
relatorioGratuidadeARTESPController.window.title = Reporte Gratuidad ARTESP
relatorioGratuidadeARTESPController.data.obrigatoria = Es necesario rellenar la fecha inicial y final

View File

@ -296,6 +296,7 @@ indexController.mniRelatorioReceitaServico.label = Receita por Serviço
indexController.mniRelatorioReceitaEmbarcadaServico.label =Receita Embarcada
indexController.mniRelatorioCancelamentoVendaCartao.label = Cancelamento Venda a Cartão
indexController.mniRelatorioEstornoCartao.label=Estorno Cartão
indexController.mniRelatorioVendasCartoes.label=Vendas Cartões
indexController.mniRelatorioCancelamentoTransacao.label = Cancelamento J3
indexController.mniRelatorioTabelaPreco.label = Tabela de Preços
indexController.mniRelatorioAIDF.label = AIDF
@ -862,6 +863,15 @@ relatorioMovimentacaoEstoqueController.lb.puntoventaRec = Agência Recebimento
relatorioMovimentacaoEstoqueController.lb.estacionEnv = Estação Envio
relatorioMovimentacaoEstoqueController.lb.estacionRec = Estação Recebimento
#Relatorio Vendas Cartões
relatorioVendasCartoesController.window.title = Relatório Vendas Cartões
relatorioVendasCartoesController.lbEmpresa.value = Empresa
relatorioVendasCartoesController.lb.puntoVenta.value = Agência
relatorioVendasCartoesController.lb.estacao.value = Estação
relatorioVendasCartoesController.lbDatInicial.value = Data Inicial
relatorioVendasCartoesController.lbDatFinal.value = Data Final
relatorioVendasCartoesController.lb.usuario.value = Bilheteiro
#Relatório de Vendas PTA
relatorioVendasPTAController.window.title = Relatório de Vendas PTA
relatorioVendasPTAController.lbDatInicial.value = Data Inicial

View File

@ -0,0 +1,67 @@
<?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="winFiltroRelatorioVendasCartoes"?>
<?taglib uri="http://www.zkoss.org/dsp/web/core" prefix="c"?>
<zk xmlns="http://www.zkoss.org/2005/zul">
<window id="winFiltroRelatorioVendasCartoes"
apply="${relatorioVendasCartoesController}"
contentStyle="overflow:auto" height="220px" width="600px"
border="normal">
<grid fixedLayout="true">
<columns>
<column width="20%" />
<column width="30%" />
<column width="20%" />
<column width="30%" />
</columns>
<rows>
<row>
<label
value="${c:l('relatorioVendasCartoesController.lbDatInicial.value')}" />
<datebox id="datInicial" width="100%" mold="rounded"
format="dd/MM/yyyy" constraint="no empty" maxlength="10" />
<label
value="${c:l('relatorioVendasCartoesController.lbDatFinal.value')}" />
<datebox id="datFinal" width="100%" mold="rounded"
format="dd/MM/yyyy" constraint="no empty" maxlength="10" />
</row>
<row>
<label
value="${c:l('relatorioVendasCartoesController.lbEmpresa.value')}" />
<combobox id="cmbEmpresa" buttonVisible="true"
use="com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEstandar"
model="@{winFiltroRelatorioVendasCartoes$composer.lsEmpresa}"
constraint="no empty" width="100%" />
</row>
<row>
<label
value="${c:l('relatorioVendasCartoesController.lb.puntoVenta.value')}" />
<combobox id="cmbPuntoVenta"
use="com.rjconsultores.ventaboletos.web.utilerias.MyComboboxPuntoVenta"
width="100%" mold="rounded" buttonVisible="true" />
</row>
<row>
<label
value="${c:l('relatorioVendasCartoesController.lb.estacao.value')}" />
<combobox id="cmbEstacion"
use="com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEstacion"
width="100%" mold="rounded" buttonVisible="true" />
</row>
<row>
<label
value="${c:l('relatorioVendasCartoesController.lb.usuario.value')}" />
<combobox id="cmbUsuario"
use="com.rjconsultores.ventaboletos.web.utilerias.MyComboboxUsuario"
mold="rounded" buttonVisible="true" width="100%" />
</row>
</rows>
</grid>
<toolbar>
<button id="btnExecutarRelatorio" image="/gui/img/find.png"
label="${c:l('relatorio.lb.btnExecutarRelatorio')}" />
</toolbar>
</window>
</zk>