igor.rodrigo 2015-08-21 17:49:53 +00:00
parent 6e7f779a39
commit 5d2d02711d
13 changed files with 802 additions and 3 deletions

View File

@ -0,0 +1,92 @@
package com.rjconsultores.ventaboletos.relatorios.impl;
import java.sql.Connection;
import java.sql.ResultSet;
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.web.utilerias.NamedParameterStatement;
public class RelatorioCancelamentoVendaCartao extends Relatorio {
public RelatorioCancelamentoVendaCartao(Map<String, Object> parametros, Connection conexao) throws Exception
{
super(parametros, conexao);
this.setCustomDataSource(new ArrayDataSource(this) {
public void initDados() throws Exception {
Connection conexao = this.relatorio.getConexao();
Map<String, Object> parametros = this.relatorio.getParametros();
String usuario = (String) parametros.get("USUARIO");
final Integer CARTAO_CREDITO = 2;
final Integer CARTAO_DEBITO = 3;
String sql = getSql();
NamedParameterStatement stmt = new NamedParameterStatement(conexao, sql);
stmt.setTimestamp("data_inicial", new Timestamp(DateUtil.inicioFecha((Date) parametros.get("DATA_INICIAL")).getTime()));
stmt.setTimestamp("data_final", new Timestamp(DateUtil.fimFecha((Date) parametros.get("DATA_FINAL")).getTime()));
stmt.setInt("formaPago1", CARTAO_CREDITO);
stmt.setInt("formaPago2", CARTAO_DEBITO);
//FIXME: Retirar valor fixo
stmt.setString("usuario", usuario);
ResultSet rset = stmt.executeQuery();
while (rset.next()) {
Map<String, Object> dataResult = new HashMap<String, Object>();
dataResult.put("estabelecimento", rset.getString("nombpuntoventa"));
dataResult.put("cartao", rset.getString("descpago"));
dataResult.put("datavenda", rset.getDate("fechorventa"));
dataResult.put("valorvenda", rset.getBigDecimal("valor_venda"));
dataResult.put("valorcancelar", rset.getBigDecimal("valor_cancelar"));
dataResult.put("autorizacao", rset.getString("numautorizacion"));
dataResult.put("motivo", rset.getString("descmotivo"));
dataResult.put("numerositef", rset.getString("numsitef"));
this.dados.add(dataResult);
}
this.resultSet = rset;
}
});
}
@Override
protected void processaParametros() throws Exception {
}
private String getSql() {
StringBuilder sql = new StringBuilder();
sql.append(" select distinct c.caja_id, p.nombpuntoventa, f.descpago, c.fechorventa, ptovta.numsitef,");
sql.append(" (coalesce(c.preciopagado,0) + coalesce(c.importeoutros,0)+ coalesce(c.importepedagio,0)+ coalesce(c.importeseguro,0) + coalesce(c.importetaxaembarque,0)) as valor_venda,");
sql.append(" cf.importe as valor_cancelar, u.nombusuario, m.descmotivo, ctj.numautorizacion numautorizacion ");
sql.append(" from caja c inner join punto_venta p on c.puntoventa_id = p.puntoventa_id ");
sql.append(" inner join caja_formapago cf on c.caja_id = cf.caja_id ");
sql.append(" inner join forma_pago f on cf.formapago_id = f.formapago_id ");
sql.append(" inner join usuario u on c.usuario_id = u.usuario_id");
sql.append(" inner join ptovta_empresa ptovta on c.puntoventa_id = ptovta.puntoventa_id");
sql.append(" inner join motivo_cancelacion m ");
sql.append(" on c.motivocancelacion_id = m.motivocancelacion_id ");
sql.append(" and u.usuario_id = :usuario ");
if(parametros.get("EMPRESA_ID") != null){
sql.append(" inner join empresa e on p.empresa_id = e.empresa_id and p.empresa_id = " + parametros.get("EMPRESA_ID") );
}
sql.append(" and f.formapago_id in (:formaPago1, :formaPago2) ");
sql.append(" inner join caja_det_pago cdt on cdt.caja_id = c.caja_id ");
sql.append(" inner join caja_tarjeta ctj on cdt.cajadetpago_id = ctj.cajadetpago_id ");
sql.append(" and c.fechorventa >= :data_inicial and c.fechorventa <= :data_final ");
if (parametros.get("NUMPUNTOVENTA") != null) {
sql.append(" and p.puntoventa_id IN (" + parametros.get("NUMPUNTOVENTA").toString() + ")");
}
sql.append(" and p.empresa_id = ptovta.empresa_id ");
sql.append(" order by c.fechorventa ");
return sql.toString();
}
}

View File

@ -0,0 +1,22 @@
#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=Impressor por:
cabecalho.pagina=Página
cabecalho.de=de
cabecalho.filtros=Filtros:
#Labels header
label.Estabelecimento=Estabelecimento
label.cartao=Cartão
label.data=Data
label.valor.venda=Valor da venda
label.valor.cancelar=Valor a cancelar
label.autorizacao=Autorização
label.motivo=Motivo Cancelamento
label.sitef=Sitef

View File

@ -0,0 +1,22 @@
#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=Impressor por:
cabecalho.pagina=Página
cabecalho.de=de
cabecalho.filtros=Filtros:
#Labels header
label.Estabelecimento=Estabelecimento
label.cartao=Cartão
label.data=Data
label.valor.venda=Valor da venda
label.valor.cancelar=Valor a cancelar
label.autorizacao=Autorização
label.motivo=Motivo do Cancelamento
label.sitef=Sitef

View File

@ -0,0 +1,265 @@
<?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="RelatorioCancelamentoVendaCartao" pageWidth="842" pageHeight="595" orientation="Landscape" whenNoDataType="NoDataSection" columnWidth="802" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="c092ef85-9334-4225-93d7-1acb7cf4d021">
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<property name="net.sf.jasperreports.export.xls.exclude.origin.keep.first.band.2" value="pageHeader"/>
<property name="net.sf.jasperreports.export.xls.exclude.origin.keep.first.band.1" value="columnHeader"/>
<parameter name="NOME_RELATORIO" class="java.lang.String"/>
<parameter name="DATA_INICIAL" class="java.util.Date"/>
<parameter name="DATA_FINAL" class="java.util.Date"/>
<parameter name="USUARIO" class="java.lang.String"/>
<parameter name="FILTROS" class="java.lang.String"/>
<queryString>
<![CDATA[]]>
</queryString>
<field name="estabelecimento" class="java.lang.String"/>
<field name="cartao" class="java.lang.String"/>
<field name="empresa" class="java.lang.String"/>
<field name="datavenda" class="java.util.Date"/>
<field name="valorvenda" class="java.math.BigDecimal"/>
<field name="valorcancelar" class="java.math.BigDecimal"/>
<field name="autorizacao" class="java.lang.String"/>
<field name="motivo" class="java.lang.String"/>
<field name="numerositef" class="java.lang.String"/>
<background>
<band splitType="Stretch"/>
</background>
<pageHeader>
<band height="84" splitType="Stretch">
<textField pattern="" isBlankWhenNull="false">
<reportElement uuid="136a5066-d141-4362-af36-0780f0d16542" mode="Transparent" x="0" y="0" width="457" height="35" forecolor="#000000" backcolor="#FFFFFF"/>
<textElement textAlignment="Left" verticalAlignment="Top" rotation="None" markup="none">
<font fontName="SansSerif" size="12" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
<paragraph lineSpacing="Single"/>
</textElement>
<textFieldExpression><![CDATA[$P{NOME_RELATORIO}]]></textFieldExpression>
</textField>
<textField pattern="" isBlankWhenNull="false">
<reportElement uuid="3dca1764-758d-4e1c-80c0-85cc02e47813" mode="Transparent" x="0" y="35" width="46" height="14" forecolor="#000000" backcolor="#FFFFFF"/>
<textElement textAlignment="Left" 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>
<textFieldExpression><![CDATA[$R{cabecalho.periodo}]]></textFieldExpression>
</textField>
<textField pattern="" isBlankWhenNull="false">
<reportElement uuid="8948c0fc-e878-45e2-8505-7934add98ab9" mode="Transparent" x="107" y="35" width="10" height="14" forecolor="#000000" backcolor="#FFFFFF"/>
<textElement textAlignment="Left" 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>
<textFieldExpression><![CDATA[$R{cabecalho.periodoA}]]></textFieldExpression>
</textField>
<textField pattern="dd/MM/yyyy" isBlankWhenNull="false">
<reportElement uuid="7f1b9715-baaf-4e20-9a9d-a7ec4c696587" mode="Transparent" x="46" y="35" width="51" height="14" forecolor="#000000" backcolor="#FFFFFF"/>
<textElement textAlignment="Left" 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>
<textFieldExpression><![CDATA[$P{DATA_INICIAL}]]></textFieldExpression>
</textField>
<textField pattern="dd/MM/yyyy" isBlankWhenNull="false">
<reportElement uuid="64632058-9466-479c-ae28-0a11c9ed2c7f" mode="Transparent" x="132" y="35" width="51" height="14" forecolor="#000000" backcolor="#FFFFFF"/>
<textElement textAlignment="Left" 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>
<textFieldExpression><![CDATA[$P{DATA_FINAL}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="a9d471fb-1e1d-4d9a-9783-bbf988931192" x="628" y="0" width="100" height="25"/>
<textElement textAlignment="Right">
<font size="9" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$R{cabecalho.dataHora}]]></textFieldExpression>
</textField>
<textField pattern="dd/MM/yyyy HH:mm" isBlankWhenNull="false">
<reportElement uuid="0d200750-aabf-4c7e-b27b-c0e7af4802a9" mode="Transparent" x="728" y="0" width="73" height="25" forecolor="#000000" backcolor="#FFFFFF"/>
<textElement textAlignment="Left" 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>
<textFieldExpression><![CDATA[new java.util.Date()]]></textFieldExpression>
</textField>
<line>
<reportElement uuid="bbf33a72-515f-42fc-8c79-e859aebca31d" x="0" y="57" width="802" height="1"/>
</line>
<textField pattern="" isBlankWhenNull="false">
<reportElement uuid="bae9bec6-8c42-4bee-a070-34b0a7f1aee4" mode="Transparent" x="683" y="26" width="112" height="15" forecolor="#000000" backcolor="#FFFFFF"/>
<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>
<textFieldExpression><![CDATA[$R{cabecalho.pagina}+" "+$V{PAGE_NUMBER}+" "+$R{cabecalho.de}]]></textFieldExpression>
</textField>
<textField evaluationTime="Report" pattern="" isBlankWhenNull="false">
<reportElement uuid="314e312c-8f24-42de-8354-3c1f7241a985" mode="Transparent" x="796" y="26" width="5" height="15" forecolor="#000000" backcolor="#FFFFFF"/>
<textElement textAlignment="Center" 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>
<textFieldExpression><![CDATA[$V{PAGE_NUMBER}]]></textFieldExpression>
</textField>
<textField pattern="" isBlankWhenNull="false">
<reportElement uuid="4e030613-9cee-443e-9eaa-b19fa3090976" mode="Transparent" x="701" y="42" width="100" height="15" forecolor="#000000" backcolor="#FFFFFF"/>
<textElement textAlignment="Right" verticalAlignment="Top" rotation="None" markup="none">
<font fontName="SansSerif" size="7" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
<paragraph lineSpacing="Single"/>
</textElement>
<textFieldExpression><![CDATA[$R{cabecalho.impressorPor}+" "+$P{USUARIO}]]></textFieldExpression>
</textField>
<line>
<reportElement uuid="6ca45088-a58d-43b3-b196-8fc26e128fbf" x="0" y="77" width="802" height="1"/>
</line>
<textField>
<reportElement uuid="b29d0494-2695-420b-bdc1-b13c08bdbcda" x="0" y="59" width="802" height="14"/>
<textElement verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$P{FILTROS}]]></textFieldExpression>
</textField>
</band>
</pageHeader>
<columnHeader>
<band height="40" splitType="Stretch">
<line>
<reportElement uuid="a11636cc-5ee1-44cc-8cd1-cbe2ebc47abb" x="1" y="34" width="802" height="1"/>
</line>
<textField>
<reportElement uuid="337f441e-ca7f-402c-8407-f3406ec2b4b0" x="2" y="15" width="151" height="21"/>
<textElement>
<font size="12"/>
</textElement>
<textFieldExpression><![CDATA[$R{label.Estabelecimento}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="0ddedacd-7ebc-4aa7-9535-2f5695ee9c8c" x="562" y="15" width="143" height="21"/>
<textElement>
<font size="12"/>
</textElement>
<textFieldExpression><![CDATA[$R{label.motivo}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="8506ac47-d72f-4ef5-b53a-da3970fb7edc" x="459" y="15" width="92" height="21"/>
<textElement>
<font size="12"/>
</textElement>
<textFieldExpression><![CDATA[$R{label.valor.cancelar}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="859d4892-377e-4313-8a88-6454a88ce936" x="361" y="15" width="92" height="21"/>
<textElement>
<font size="12"/>
</textElement>
<textFieldExpression><![CDATA[$R{label.valor.venda}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="d9a2225c-8883-4a35-9c16-8af9bcfe6577" x="282" y="15" width="80" height="21"/>
<textElement>
<font size="12"/>
</textElement>
<textFieldExpression><![CDATA[$R{label.data}]]></textFieldExpression>
</textField>
<textField pattern="" isBlankWhenNull="false">
<reportElement uuid="0583701e-920a-473b-b1e4-6137f8d022df" mode="Transparent" x="203" y="15" width="79" height="21" forecolor="#000000" backcolor="#FFFFFF"/>
<textElement textAlignment="Left" verticalAlignment="Top" rotation="None" markup="none">
<font fontName="SansSerif" size="12" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
<paragraph lineSpacing="Single"/>
</textElement>
<textFieldExpression><![CDATA[$R{label.cartao}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="82e75550-fae7-4cea-acf9-f9f56f083400" x="707" y="15" width="91" height="21"/>
<textElement>
<font size="12"/>
</textElement>
<textFieldExpression><![CDATA[$R{label.autorizacao}]]></textFieldExpression>
</textField>
<textField pattern="" isBlankWhenNull="false">
<reportElement uuid="f9ea7239-48e1-4207-b957-dc4aadcaa590" mode="Transparent" x="152" y="15" width="50" height="20" forecolor="#000000" backcolor="#FFFFFF"/>
<textElement textAlignment="Left" verticalAlignment="Top" rotation="None" markup="none">
<font fontName="SansSerif" size="12" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
<paragraph lineSpacing="Single"/>
</textElement>
<textFieldExpression><![CDATA[$R{label.sitef}]]></textFieldExpression>
</textField>
</band>
</columnHeader>
<detail>
<band height="28" splitType="Stretch">
<textField>
<reportElement uuid="c35afacb-b160-4ace-b7be-c2e2f54ac1c0" x="203" y="-3" width="79" height="20"/>
<textElement>
<font size="11" isBold="false" isItalic="false"/>
</textElement>
<textFieldExpression><![CDATA[$F{cartao}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true">
<reportElement uuid="73582b2a-b21b-4637-990c-aff7423a8e27" x="136" y="-4" width="49" height="20"/>
<textElement>
<font size="11" isBold="false" isItalic="false"/>
</textElement>
<textFieldExpression><![CDATA[$F{numerositef}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" pattern="dd/MM/yyyy" isBlankWhenNull="true">
<reportElement uuid="29ae3fa8-9db1-46c8-bcf7-cb9aa7bc6eb3" mode="Transparent" x="282" y="-4" width="80" height="20" forecolor="#000000" backcolor="#FFFFFF"/>
<textElement verticalAlignment="Top" rotation="None" markup="none">
<font fontName="SansSerif" size="11" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
<paragraph lineSpacing="Single"/>
</textElement>
<textFieldExpression><![CDATA[$F{datavenda}]]></textFieldExpression>
</textField>
<textField pattern="¤ #,##0.00">
<reportElement uuid="49faea3b-2ce4-469a-b07c-3b4869aaa9e5" x="707" y="-1" width="91" height="20"/>
<textElement>
<font size="11" isBold="false" isItalic="false"/>
</textElement>
<textFieldExpression><![CDATA[$F{autorizacao}]]></textFieldExpression>
</textField>
<textField pattern="dd/MM/yyyy">
<reportElement uuid="bfb9d635-bbc1-4e92-890a-df8299bc8daa" x="2" y="-3" width="151" height="20"/>
<textElement>
<font size="11" isBold="false" isItalic="false"/>
</textElement>
<textFieldExpression><![CDATA[$F{estabelecimento}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" pattern="¤ #,##0.00" isBlankWhenNull="true">
<reportElement uuid="48c368c2-dd11-4724-a5e9-b3f139464d4a" x="475" y="-4" width="69" height="20"/>
<textElement textAlignment="Right">
<font size="11" isBold="false" isItalic="false"/>
</textElement>
<textFieldExpression><![CDATA[$F{valorcancelar}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" pattern="¤ #,##0.00" isBlankWhenNull="true">
<reportElement uuid="22208383-347b-421f-9528-08d231f9acd3" mode="Transparent" x="368" y="-3" width="72" height="20" forecolor="#000000" backcolor="#FFFFFF"/>
<textElement textAlignment="Right" verticalAlignment="Top" rotation="None" markup="none">
<font fontName="SansSerif" size="11" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
<paragraph lineSpacing="Single"/>
</textElement>
<textFieldExpression><![CDATA[$F{valorvenda}]]></textFieldExpression>
</textField>
<textField pattern="¤ #,##0.00">
<reportElement uuid="a40b0fab-d6bd-4673-a150-d85c0c576816" x="561" y="-2" width="143" height="20"/>
<textElement>
<font size="11" isBold="false" isItalic="false"/>
</textElement>
<textFieldExpression><![CDATA[$F{motivo}]]></textFieldExpression>
</textField>
</band>
</detail>
<summary>
<band height="100" splitType="Stretch"/>
</summary>
<noData>
<band height="50">
<textField>
<reportElement uuid="6f13c961-dd50-4e44-ba73-65e0752b8b83" x="46" y="24" 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

@ -325,6 +325,7 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
private Radio radIndPermisoTasaEmbarqueNo;
private Checkbox checkPtoVtaEmpresaIndTerceirizada;
private Checkbox checkPtoVtaEmpresaIndBloqueada;
private Textbox txtNumeroSitef;
private Checkbox ckIsento;
private Checkbox checkSimulaIntegracion;
private Checkbox checkTodosPuntosVenta;
@ -1694,6 +1695,7 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
ptovtaEmpresa.setFecmodif(Calendar.getInstance().getTime());
ptovtaEmpresa.setIndTerceirizada(checkPtoVtaEmpresaIndTerceirizada.isChecked());
ptovtaEmpresa.setIndBloqueada(checkPtoVtaEmpresaIndBloqueada.isChecked());
ptovtaEmpresa.setNumeroSitef(txtNumeroSitef.getText());
lsPtovtaEmpresa.add(ptovtaEmpresa);

View File

@ -0,0 +1,230 @@
package com.rjconsultores.ventaboletos.web.gui.controladores.relatorios;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
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.zhtml.Messagebox;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zul.Comboitem;
import org.zkoss.zul.Datebox;
import org.zkoss.zul.Paging;
import com.rjconsultores.ventaboletos.entidad.Empresa;
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
import com.rjconsultores.ventaboletos.relatorios.impl.RelatorioCancelamentoVendaCartao;
import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio;
import com.rjconsultores.ventaboletos.service.EmpresaService;
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEstandar;
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.HibernateSearchObject;
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.PagedListWrapper;
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderRelatorioVendasBilheteiro;
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderRelatorioVendasBilheteiroSelecionados;
@Controller("relatorioCancelamentoVendaCartaoController")
@Scope("prototype")
public class RelatorioCancelamentoVendaCartaoController extends MyGenericForwardComposer {
private static final long serialVersionUID = 1L;
private Datebox datInicial;
private Datebox datFinal;
private MyComboboxEstandar cmbEmpresa;
private List<Empresa> lsEmpresa;
private Paging pagingPuntoVenta;
private MyTextbox txtNombrePuntoVenta;
private MyListbox puntoVentaList;
private MyListbox puntoVentaSelList;
@Autowired
private EmpresaService empresaService;
@Autowired
private DataSource dataSourceRead;
@Autowired
private transient PagedListWrapper<PuntoVenta> plwPuntoVenta;
@Override
public void doAfterCompose(Component comp) throws Exception {
lsEmpresa = empresaService.obtenerTodos();
super.doAfterCompose(comp);
puntoVentaList.setItemRenderer(new RenderRelatorioVendasBilheteiro());
puntoVentaSelList.setItemRenderer(new RenderRelatorioVendasBilheteiroSelecionados());
}
/**
* @throws Exception
*
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
private void executarRelatorio() throws Exception {
{
if (datInicial != null && datFinal != null && datFinal.getValue().compareTo(datInicial.getValue()) < 0) {
try {
Messagebox.show(Labels.getLabel("MSG.ningunRegistro"),
Labels.getLabel("relatorioCancelamentoVendaCartaoController.window.title"),
Messagebox.OK, Messagebox.INFORMATION);
} catch (InterruptedException ex) {
ex.printStackTrace();
}
} else
{
Relatorio relatorio;
Map<String, Object> parametros = new HashMap<String, Object>();
StringBuilder filtro = new StringBuilder();
filtro.append("Início período: ");
Calendar cal = Calendar.getInstance();
cal.setTime(datInicial.getValue());
filtro.append(cal.get(Calendar.DATE) + "/");
filtro.append((cal.get(Calendar.MONTH) + 1) + "/");
filtro.append(cal.get(Calendar.YEAR) + "; ");
filtro.append("Fim período: ");
cal.setTime(datFinal.getValue());
filtro.append(cal.get(Calendar.DATE) + "/");
filtro.append((cal.get(Calendar.MONTH) + 1) + "/");
filtro.append(cal.get(Calendar.YEAR) + "; ");
parametros.put("DATA_INICIAL", (java.util.Date) datInicial.getValue());
parametros.put("DATA_FINAL", (java.util.Date) datFinal.getValue());
parametros.put("NOME_RELATORIO", Labels.getLabel("relatorioCancelamentoVendaCartaoController.window.title"));
parametros.put("USUARIO", UsuarioLogado.getUsuarioLogado().getUsuarioId().toString());
parametros.put("USUARIO_NOME", UsuarioLogado.getUsuarioLogado().getNombusuario());
filtro.append("Empresa: ");
Comboitem itemEmpresa = cmbEmpresa.getSelectedItem();
if (itemEmpresa != null) {
Empresa empresa = (Empresa) itemEmpresa.getValue();
parametros.put("EMPRESA_ID", empresa.getEmpresaId());
filtro.append(empresa.getNombempresa() + ";");
} else {
filtro.append(" Todas;");
}
filtro.append("Agência: ");
String puntoVentaIds = "";
String puntoVentas = "";
List<PuntoVenta> lsPuntoVentaSelecionados = new ArrayList(Arrays.asList(puntoVentaSelList.getData()));
if (lsPuntoVentaSelecionados.isEmpty()) {
puntoVentas = "Todas";
} else {
for (int i = 0; i < lsPuntoVentaSelecionados.size(); i++) {
PuntoVenta puntoVenta = lsPuntoVentaSelecionados.get(i);
puntoVentas = puntoVentas + puntoVenta.getNombpuntoventa() + ",";
puntoVentaIds = puntoVentaIds + puntoVenta.getPuntoventaId() + ",";
}
// removendo ultima virgula
puntoVentaIds = puntoVentaIds.substring(0, puntoVentaIds.length() - 1);
puntoVentas = puntoVentas.substring(0, puntoVentas.length() - 1);
parametros.put("NUMPUNTOVENTA", puntoVentaIds);
}
filtro.append(puntoVentas).append(";");
parametros.put("FILTROS", filtro.toString());
relatorio = new RelatorioCancelamentoVendaCartao(parametros, dataSourceRead.getConnection());
Map args = new HashMap();
args.put("relatorio", relatorio);
openWindow("/component/reportView.zul",
Labels.getLabel("relatorioCancelamentoVendaCartaoController.window.title"), args, MODAL);
}
}
}
public void onClick$btnExecutarRelatorio(Event ev) throws Exception{
executarRelatorio();
}
private void executarPesquisa() {
HibernateSearchObject<PuntoVenta> puntoVentaBusqueda =
new HibernateSearchObject<PuntoVenta>(PuntoVenta.class, pagingPuntoVenta.getPageSize());
puntoVentaBusqueda.addFilterILike("nombpuntoventa", "%" + txtNombrePuntoVenta.getValue() + "%");
puntoVentaBusqueda.addFilterEqual("activo", Boolean.TRUE);
puntoVentaBusqueda.addSortAsc("nombpuntoventa");
puntoVentaBusqueda.addFilterEqual("activo", Boolean.TRUE);
plwPuntoVenta.init(puntoVentaBusqueda, puntoVentaList, pagingPuntoVenta);
if (puntoVentaList.getData().length == 0) {
try {
Messagebox.show(Labels.getLabel("MSG.ningunRegistro"),
Labels.getLabel("relatorioVendasBilheteiroController.window.title"),
Messagebox.OK, Messagebox.INFORMATION);
} catch (InterruptedException ex) {
ex.printStackTrace();
}
}
}
public void onClick$btnPesquisa(Event ev) {
executarPesquisa();
}
public void onClick$btnLimpar(Event ev) {
puntoVentaList.setData(new ArrayList<PuntoVenta>());
txtNombrePuntoVenta.setText("");
}
public void onDoubleClick$puntoVentaSelList(Event ev) {
PuntoVenta puntoVenta = (PuntoVenta) puntoVentaSelList.getSelected();
puntoVentaSelList.removeItem(puntoVenta);
}
public void onDoubleClick$puntoVentaList(Event ev) {
PuntoVenta puntoVenta = (PuntoVenta) puntoVentaList.getSelected();
puntoVentaSelList.addItemNovo(puntoVenta);
}
public Datebox getDatInicial() {
return datInicial;
}
public void setDatInicial(Datebox datInicial) {
this.datInicial = datInicial;
}
public Datebox getDatFinal() {
return datFinal;
}
public void setDatFinal(Datebox datFinal) {
this.datFinal = 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,25 @@
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 ItemMenuRelatorioCancelamentoVendaCartao extends DefaultItemMenuSistema {
public ItemMenuRelatorioCancelamentoVendaCartao() {
super("indexController.mniRelatorioCancelamentoVendaCartao.label");
}
@Override
public String getClaveMenu() {
return "COM.RJCONSULTORES.ADMINISTRACION.GUI.RELATORIOS.MENU.RELATORIOCANCELAMENTOPASSAGEMCARTAO";
}
@Override
public void ejecutar() {
PantallaUtileria.openWindow("/gui/relatorios/filtroRelatorioCancelamentoVendaCartao.zul",
Labels.getLabel("relatorioCancelamentoVendaCartaoController.window.title"), getArgs(), desktop);
}
}

View File

@ -29,6 +29,9 @@ public class PtovtaEmpresaRender implements ListitemRenderer {
lc = new Listcell(ptoVta.getIndBloqueada() != null && ptoVta.getIndBloqueada() ? Labels.getLabel("MSG.SI") : Labels.getLabel("MSG.NO"));
lc.setParent(lstm);
lc = new Listcell(ptoVta.getIndBloqueada() != null ? ptoVta.getNumeroSitef() : "");
lc.setParent(lstm);
lstm.setAttribute("data", ptoVta);
}

View File

@ -243,6 +243,7 @@ indexController.mniFechamentoParamptovta.label = Fechamento Conta Corrente Agên
indexController.mniRelatorioCorridas.label = Reporte de Corridas
indexController.mniRelatorioDemandas.label = Reporte de Demandas
indexController.mniRelatorioReceitaServico.label = Relatório de Receita por Serviço
indexController.mniRelatorioCancelamentoVendaCartao.label = Relatório Cancelamento de Venda de Cartão
indexController.mniPrecoApanhe.label = Preço Apanhe
indexController.mniRelatorioVendasPacotesResumido.label = Ventas de Paquetes - Resumido
indexController.mniRelatorioVendasPacotesDetalhado.label = Ventas de Paquetes - Detalhado
@ -498,6 +499,17 @@ relatorioDemandasController.lbTipoRelatorioDetalhado.value = Detalhado
relatorioDemandasController.lbTipoRelatorioDiario.value = Diário
relatorioDemandasController.lbTipoRelatorioConsolidado.value = Consolidado
#Relatorio de Cancelamento de Passagem por Cartão
relatorioCancelamentoVendaCartaoController.window.title = Relatório de Cancelamento de Venda por Cartão
relatorioCancelamentoVendaCartaoController.datainicial.value = Data Inicial
relatorioCancelamentoVendaCartaoController.dataFinal.value = Data Final
relatorioCancelamentoVendaCartaoController.lbPuntoVenta.value = Agência
relatorioCancelamentoVendaCartaoController.lbEmpresa.value = Empresa
relatorioCancelamentoVendaCartaoController.btnPesquisa.label = Buscar
relatorioCancelamentoVendaCartaoController.btnLimpar.label = Limpar
relatorioCancelamentoVendaCartaoController.lbNumero.value = Número Agência
relatorioCancelamentoVendaCartaoController.lbBilheteiro.value = Bilheteiro
# Pantalla Editar clase
editarClaseServicioController.window.title = Clase de servicio
editarClaseServicioController.btnApagar.tooltiptext = Eliminar
@ -842,6 +854,7 @@ editarPuntoVentaController.lbIndDatosTarjeta.value = Base de datos
editarPuntoVentaController.lbNodo.value = Servidor
editarPuntoVentaController.lbEmpresa.value = Empresa
editarPuntoVentaController.lbEmpresaBloqueada.value = Bloqueada
editarPuntoVentaController.lbNumeroSitef.value = Número SITEF
editarPuntoVentaController.lbEmpresaTerceirizada.value = Terceirizada
editarPuntoVentaController.lbparada.value = Parada
editarPuntoVentaController.lbTpoPtoVta.value = Canal de venta

View File

@ -248,6 +248,7 @@ indexController.mniRelatorioCorridas.label = Relatório de Serviços
indexController.mniRelatorioCorridas.label = Relatório de Serviços
indexController.mniRelatorioDemandas.label = Relatório de Demandas
indexController.mniRelatorioReceitaServico.label = Relatório de Receita por Serviço
indexController.mniRelatorioCancelamentoVendaCartao.label = Relatório Cancelamento de Venda de Cartão
indexController.mniPrecoApanhe.label = Preço Apanhe
indexController.mniRelatorioVendasPacotesResumido.label = Vendas de Pacotes - Resumido
indexController.mniRelatorioVendasPacotesDetalhado.label = Vendas de Pacotes - Detalhado
@ -534,6 +535,17 @@ relatorioDemandasController.lbTipoRelatorioDetalhado.value = Detalhado
relatorioDemandasController.lbTipoRelatorioDiario.value = Diário
relatorioDemandasController.lbTipoRelatorioConsolidado.value = Consolidado
#Relatorio de Cancelamento de Passagem por Cartão
relatorioCancelamentoVendaCartaoController.window.title = Relatório de Cancelamento de Venda por Cartão
relatorioCancelamentoVendaCartaoController.datainicial.value = Data Inicial
relatorioCancelamentoVendaCartaoController.dataFinal.value = Data Final
relatorioCancelamentoVendaCartaoController.lbPuntoVenta.value = Agência
relatorioCancelamentoVendaCartaoController.lbEmpresa.value = Empresa
relatorioCancelamentoVendaCartaoController.btnPesquisa.label = Buscar
relatorioCancelamentoVendaCartaoController.btnLimpar.label = Limpar
relatorioCancelamentoVendaCartaoController.lbNumero.value = Número Agência
relatorioCancelamentoVendaCartaoController.lbBilheteiro.value = Bilheteiro
# Pantalla Editar Classe
editarClaseServicioController.window.title = Tipo de Classe
editarClaseServicioController.btnApagar.tooltiptext = Eliminar
@ -880,6 +892,7 @@ editarPuntoVentaController.lbIndDatosTarjeta.value = Base de dados
editarPuntoVentaController.lbNodo.value = Servidor
editarPuntoVentaController.lbEmpresa.value = Empresa
editarPuntoVentaController.lbEmpresaBloqueada.value = Bloqueada
editarPuntoVentaController.lbNumeroSitef.value = Número SITEF
editarPuntoVentaController.lbEmpresaTerceirizada.value = Terceirizada
editarPuntoVentaController.lbparada.value = Localidade
editarPuntoVentaController.lbTpoPtoVta.value = Canal de Venda

View File

@ -929,6 +929,13 @@
<checkbox id="checkPtoVtaEmpresaIndBloqueada"
checked="false" />
</row>
<row>
<label
value="${c:l('editarPuntoVentaController.lbNumeroSitef.value')}" />
<textbox id="txtNumeroSitef"
use="com.rjconsultores.ventaboletos.web.utilerias.MyTextbox"
maxlength="10" />
</row>
</rows>
</grid>
@ -950,11 +957,13 @@
vflex="true" multiple="false">
<listhead sizable="true">
<listheader image="/gui/img/builder.gif"
label="${c:l('editarPuntoVentaController.lbEmpresa.value')}" />
label="${c:l('editarPuntoVentaController.lbEmpresa.value')}" width="40%"/>
<listheader image="/gui/img/builder.gif"
label="${c:l('editarPuntoVentaController.lbEmpresaTerceirizada.value')}" />
label="${c:l('editarPuntoVentaController.lbEmpresaTerceirizada.value')}" width="20%" />
<listheader image="/gui/img/builder.gif"
label="${c:l('editarPuntoVentaController.lbEmpresaBloqueada.value')}" />
label="${c:l('editarPuntoVentaController.lbEmpresaBloqueada.value')}" width="20%" />
<listheader image="/gui/img/builder.gif"
label="${c:l('editarPuntoVentaController.lbNumeroSitef.value')}" width="20%" />
</listhead>
</listbox>
</tabpanel>

View File

@ -0,0 +1,103 @@
<?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="winFiltroRelatorioCancelamentoVendaCartao"?>
<?taglib uri="http://www.zkoss.org/dsp/web/core" prefix="c"?>
<zk xmlns="http://www.zkoss.org/2005/zul">
<window id="winFiltroRelatorioCancelamentoVendaCartao"
apply="${relatorioCancelamentoVendaCartaoController}" contentStyle="overflow:auto"
height="285px" width="550px" 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('relatorioCancelamentoVendaCartaoController.datainicial.value')}" />
<datebox id="datInicial" format="dd/MM/yyyy"
width="90%" lenient="true" constraint="no empty"
maxlength="10" />
<label
value="${c:l('relatorioCancelamentoVendaCartaoController.dataFinal.value')}" />
<datebox id="datFinal" format="dd/MM/yyyy"
width="90%" lenient="true" constraint="no empty"
maxlength="10" />
</row>
<row spans="1,3">
<label
value="${c:l('relatorioCancelamentoVendaCartaoController.lbEmpresa.value')}" />
<combobox id="cmbEmpresa"
buttonVisible="true"
use="com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEstandar"
model="@{winFiltroRelatorioCancelamentoVendaCartao$composer.lsEmpresa}"
width="100%" />
</row>
<row spans="1,3">
<label
value="${c:l('relatorioCancelamentoVendaCartaoController.lbPuntoVenta.value')}"/>
<bandbox id="bbPesquisaPuntoVenta" width="100%"
mold="rounded" readonly="true">
<bandpopup>
<vbox>
<hbox>
<label
value="${c:l('relatorioCancelamentoVendaCartaoController.lbPuntoVenta.value')}" />
<textbox id="txtNombrePuntoVenta"
use="com.rjconsultores.ventaboletos.web.utilerias.MyTextbox"
width="300px" mold="rounded" />
<button id="btnPesquisa"
image="/gui/img/find.png"
label="${c:l('relatorioCancelamentoVendaCartaoController.btnPesquisa.label')}" />
<button id="btnLimpar"
image="/gui/img/eraser.png"
label="${c:l('relatorioCancelamentoVendaCartaoController.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('relatorioCancelamentoVendaCartaoController.lbPuntoVenta.value')}" />
<listheader width="35%"
label="${c:l('relatorioCancelamentoVendaCartaoController.lbEmpresa.value')}" />
<listheader width="20%"
label="${c:l('relatorioCancelamentoVendaCartaoController.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('relatorioCancelamentoVendaCartaoController.lbPuntoVenta.value')}" />
<listheader width="35%"
label="${c:l('relatorioCancelamentoVendaCartaoController.lbEmpresa.value')}" />
<listheader width="20%"
label="${c:l('relatorioCancelamentoVendaCartaoController.lbNumero.value')}" />
<listheader width="8%" />
</listhead>
</listbox>
<paging id="pagingSelPuntoVenta" pageSize="10" />
</row>
</rows>
</grid>
<toolbar>
<button id="btnExecutarRelatorio" image="/gui/img/find.png"
label="${c:l('relatorio.lb.btnExecutarRelatorio')}" />
</toolbar>
</window>
</zk>