julio 2017-07-06 14:16:49 +00:00
parent de45921635
commit 62549d54c3
9 changed files with 662 additions and 16 deletions

View File

@ -0,0 +1,321 @@
package com.rjconsultores.ventaboletos.relatorios.impl;
import java.math.BigDecimal;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
import com.rjconsultores.ventaboletos.constantes.Constantes;
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
import com.rjconsultores.ventaboletos.relatorios.utilitarios.DataSource;
import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio;
import com.rjconsultores.ventaboletos.relatorios.utilitarios.RelatorioVendasComissaoBean;
import com.rjconsultores.ventaboletos.relatorios.utilitarios.RelatorioVendasComissaoCancelamentoBean;
import com.rjconsultores.ventaboletos.web.utilerias.NamedParameterStatement;
import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource;
public class RelatorioVendasComissaoEstavel extends Relatorio {
private static Logger log = Logger.getLogger(RelatorioVendasComissaoEstavel.class);
private List<RelatorioVendasComissaoBean> lsDadosRelatorio;
private List<RelatorioVendasComissaoCancelamentoBean> lsDadosRelatorioCancelamento;
private Timestamp fecInicio;
private Timestamp fecFinal;
private Integer empresaId;
private Boolean apenasCancelados;
private String stringLsPuntoVentaId;
public RelatorioVendasComissaoEstavel(Map<String, Object> parametros, Connection conexao) throws Exception {
super(parametros, conexao);
this.setCustomDataSource(new DataSource(this) {
@SuppressWarnings("unchecked")
@Override
public void initDados() throws Exception {
Map<String, Object> parametros = this.relatorio.getParametros();
fecInicio = (Timestamp) parametros.get("dataFiltroInicial");
fecFinal = (Timestamp) parametros.get("dataFiltroFinal");
if(parametros.get("EMPRESA_ID")!=null){
empresaId = Integer.valueOf(parametros.get("EMPRESA_ID").toString());
}
apenasCancelados = (Boolean) parametros.get("apenasCancelados");
List<PuntoVenta> lsPuntoVentaParam = (List<PuntoVenta>) parametros.get("lsPuntoVenta");
List<String> lsNombPuntoVenta = new ArrayList<String>();
List<String> lsPuntoVentaId = new ArrayList<String>();
for (PuntoVenta puntoVenta : lsPuntoVentaParam) {
lsPuntoVentaId.add("'" + String.valueOf(puntoVenta.getPuntoventaId()) + "'");
lsNombPuntoVenta.add(puntoVenta.getNombpuntoventa());
}
stringLsPuntoVentaId = StringUtils.join(lsPuntoVentaId.toArray(new String[0]), ',');
String nombPuntoVenta = !lsNombPuntoVenta.isEmpty() ? StringUtils.join(lsNombPuntoVenta.toArray(new String[0]), ',') : "Todas;";
parametros.put("nombPuntoVenta", nombPuntoVenta);
Connection conexao = this.relatorio.getConexao();
processarVendasComissao(conexao);
if (apenasCancelados) {
setCollectionDataSource(new JRBeanCollectionDataSource(lsDadosRelatorioCancelamento));
} else {
setCollectionDataSource(new JRBeanCollectionDataSource(lsDadosRelatorio));
}
}
});
}
private void processarVendasComissao(Connection conexao) {
ResultSet rset = null;
NamedParameterStatement stmt = null;
try {
/* Processando vendas normais */
stmt = carregarNamedParameterStatement(conexao);
rset = stmt.executeQuery();
if (apenasCancelados) {
processarResultadoCancelamento(rset);
} else {
processarResultado(rset);
}
fecharConexaoBanco(stmt, rset);
} catch (Exception e) {
log.error(e.getMessage(), e);
}
}
private void fecharConexaoBanco(NamedParameterStatement stmt, ResultSet rset) {
try {
if(rset != null) {
rset.close();
}
if(stmt != null) {
stmt.close();
}
} catch (SQLException e) {
log.error(e.getMessage(), e);
}
}
private void processarResultado(ResultSet rset) throws SQLException {
if(lsDadosRelatorio == null) {
lsDadosRelatorio = new ArrayList<RelatorioVendasComissaoBean>();
}
while (rset.next()) {
RelatorioVendasComissaoBean relatorioVendaComissao = new RelatorioVendasComissaoBean();
relatorioVendaComissao.setNumPuntoVenta(rset.getString("NUMPUNTOVENTA"));
relatorioVendaComissao.setNombPuntoVenta(rset.getString("NOMBPUNTOVENTA"));
boolean indreimpresion = rset.getBoolean("INDREIMPRESION");
String indstatusboleto = rset.getString("INDSTATUSBOLETO");
Long motivocancelacionId = rset.getLong("MOTIVOCANCELACION_ID");
if(isDevolucaoOrCancelamentoCaja(indstatusboleto, motivocancelacionId, indreimpresion) && StringUtils.isNotBlank(rset.getString("NUMPTOVTAVENTA"))) {
relatorioVendaComissao.setNumPuntoVenta(rset.getString("NUMPTOVTAVENTA"));
relatorioVendaComissao.setNombPuntoVenta(rset.getString("NOMBPTOVTAVENTA"));
}
int indice = lsDadosRelatorio.indexOf(relatorioVendaComissao);
if(indice > -1) {
relatorioVendaComissao = lsDadosRelatorio.get(indice);
}
BigDecimal total = rset.getBigDecimal("TOTAL");
BigDecimal totalTaxas = rset.getBigDecimal("TOTAL_TAXAS");
if(isVenda(indstatusboleto, indreimpresion) || isTroca(indstatusboleto, indreimpresion)) {
relatorioVendaComissao.setTotalVendas(relatorioVendaComissao.getTotalVendas().add(total));
relatorioVendaComissao.setTotalTaxasVendas(relatorioVendaComissao.getTotalTaxasVendas().add(totalTaxas));
} else if(isCancelamentoCaja(indstatusboleto, motivocancelacionId, indreimpresion)) {
relatorioVendaComissao.setTotalVendasCanceladas(relatorioVendaComissao.getTotalVendasCanceladas().add(total));
relatorioVendaComissao.setTotalTaxasVendasCanceladas(relatorioVendaComissao.getTotalTaxasVendasCanceladas().add(totalTaxas));
} else if(isDevolucaoCaja(indstatusboleto, motivocancelacionId, indreimpresion) ||
isDevolucaoOcdCaja(indstatusboleto, motivocancelacionId, indreimpresion) ||
isDevolucaoTrocaCaja(indstatusboleto, motivocancelacionId, indreimpresion)) {
relatorioVendaComissao.setTotalVendasDevolucao(relatorioVendaComissao.getTotalVendasDevolucao().add(total));
relatorioVendaComissao.setTotalTaxasVendasDevolucao(relatorioVendaComissao.getTotalTaxasVendasDevolucao().add(totalTaxas));
}
if(indice == -1) {
lsDadosRelatorio.add(relatorioVendaComissao);
}
}
}
private void processarResultadoCancelamento(ResultSet rset) throws SQLException {
if(lsDadosRelatorioCancelamento == null) {
lsDadosRelatorioCancelamento = new ArrayList<RelatorioVendasComissaoCancelamentoBean>();
}
while (rset.next()) {
RelatorioVendasComissaoCancelamentoBean relatorioVendaComissao = new RelatorioVendasComissaoCancelamentoBean();
relatorioVendaComissao.setNumFolioSistema(rset.getString("NUMFOLIOSISTEMA"));
relatorioVendaComissao.setCorridaId(rset.getInt("CORRIDA_ID"));
relatorioVendaComissao.setFecHorViaje(rset.getTimestamp("FECHORVIAJE"));
relatorioVendaComissao.setNumAsiento(rset.getString("NUMASIENTO"));
relatorioVendaComissao.setPrecioTotalPagado(rset.getBigDecimal("TOTAL"));
relatorioVendaComissao.setFecHorVenta(rset.getTimestamp("FECHORVENTA"));
relatorioVendaComissao.setNombPuntoVenta(rset.getString("NOMBPUNTOVENTA"));
lsDadosRelatorioCancelamento.add(relatorioVendaComissao);
}
}
private boolean isCancelamento(String indstatusboleto) {
return "C".equals(indstatusboleto);
}
private boolean isVenda(String indstatusboleto, boolean indreimpresion) {
return "V".equals(indstatusboleto) && !indreimpresion;
}
private boolean isTroca(String indstatusboleto, boolean indreimpresion) {
return "T".equals(indstatusboleto) && !indreimpresion;
}
private boolean isCancelamentoCaja(String indstatusboleto, Long motivocancelacionId, boolean indreimpresion) {
return isCancelamento(indstatusboleto) && Constantes.MVO_CANCEL_CANCELACION.equals(motivocancelacionId) && !indreimpresion;
}
private boolean isDevolucaoCaja(String indstatusboleto, Long motivocancelacionId, boolean indreimpresion) {
return isCancelamento(indstatusboleto) && Constantes.MVO_CANCEL_DEVOLUCAO.equals(motivocancelacionId) && !indreimpresion;
}
private boolean isDevolucaoTrocaCaja(String indstatusboleto, Long motivocancelacionId, boolean indreimpresion) {
return isCancelamento(indstatusboleto) && Constantes.MVO_CANCEL_TROCA.equals(motivocancelacionId) && !indreimpresion;
}
private boolean isDevolucaoOcdCaja(String indstatusboleto, Long motivocancelacionId, boolean indreimpresion) {
return isCancelamento(indstatusboleto) && Constantes.MVO_CANCEL_GERACAO_OCD.equals(motivocancelacionId) && !indreimpresion;
}
private boolean isDevolucaoOrCancelamentoCaja(String indstatusboleto, Long motivocancelacionId, boolean indreimpresion) {
return isCancelamentoCaja(indstatusboleto, motivocancelacionId, indreimpresion) ||
isDevolucaoCaja(indstatusboleto, motivocancelacionId, indreimpresion) ||
isDevolucaoOcdCaja(indstatusboleto, motivocancelacionId, indreimpresion) ||
isDevolucaoTrocaCaja(indstatusboleto, motivocancelacionId, indreimpresion);
}
private NamedParameterStatement carregarNamedParameterStatement(Connection conexao) throws SQLException {
String sql = apenasCancelados ? getSqlCancelados() : getSql();
log.info(sql);
NamedParameterStatement stmt = new NamedParameterStatement(conexao, sql);
if(fecInicio != null) {
stmt.setTimestamp("fecInicio", fecInicio);
}
if(fecFinal != null) {
stmt.setTimestamp("fecFinal", fecFinal);
}
if(empresaId != null){
stmt.setInt("EMPRESA_ID", empresaId);
}
return stmt;
}
protected String getSql() {
String query = "SELECT PV.PUNTOVENTA_ID, PV.NUMPUNTOVENTA, PV.NOMBPUNTOVENTA, C.PTOVTAVENTA_ID, PV1.NUMPUNTOVENTA as NUMPTOVTAVENTA, PV1.NOMBPUNTOVENTA AS NOMBPTOVTAVENTA, C.INDSTATUSBOLETO, C.MOTIVOCANCELACION_ID, C.INDREIMPRESION, "
+ "SUM(COALESCE (C.PRECIOPAGADO,0) + COALESCE (C.IMPORTETAXAEMBARQUE,0) + COALESCE (C.IMPORTESEGURO,0) + COALESCE (C.IMPORTEPEDAGIO,0) + COALESCE (C.IMPORTEOUTROS,0)) AS TOTAL, "
+ "SUM(COALESCE (C.IMPORTETAXAEMBARQUE,0) + COALESCE (C.IMPORTESEGURO,0) + COALESCE (C.IMPORTEPEDAGIO,0) + COALESCE (C.IMPORTEOUTROS,0)) AS TOTAL_TAXAS "
+ "FROM CAJA C "
+ "JOIN PUNTO_VENTA PV ON PV.PUNTOVENTA_ID = C.PUNTOVENTA_ID "
+ "JOIN MARCA M ON M.MARCA_ID = C.MARCA_ID "
+ "LEFT JOIN PUNTO_VENTA PV1 ON PV1.PUNTOVENTA_ID = C.PTOVTAVENTA_ID "
+ "WHERE ((C.INDSTATUSBOLETO = 'V' AND C.INDREIMPRESION = 0) "
+ "OR (C.INDSTATUSBOLETO = 'T' AND C.INDREIMPRESION = 0) "
+ "OR (C.INDCANCELACION = 1 AND C.INDSTATUSBOLETO = 'C')) "
+ "AND (C.MOTIVOCANCELACION_ID IS NULL OR C.MOTIVOCANCELACION_ID NOT IN (10, 32, 99)) "
+ "AND C.FECHORVENTA BETWEEN CAST (:fecInicio AS DATE) AND CAST(:fecFinal AS DATE) ";
if (StringUtils.isNotBlank(stringLsPuntoVentaId)) {
query += "AND C.PUNTOVENTA_ID IN(" + stringLsPuntoVentaId + ") ";
}
if(parametros.get("EMPRESA_ID")!= null){
query += "AND M.EMPRESA_ID =:EMPRESA_ID ";
}
//foi adicionado indreimpresion = 0 para boleto. Foi analisado e chegou-se ao entendimento que os registros de boleto são sempre válidos
query += "GROUP BY PV.PUNTOVENTA_ID, PV.NUMPUNTOVENTA, PV.NOMBPUNTOVENTA, C.PTOVTAVENTA_ID, PV1.NUMPUNTOVENTA, PV1.NOMBPUNTOVENTA, C.INDSTATUSBOLETO, C.MOTIVOCANCELACION_ID, C.INDREIMPRESION "
+ "UNION "
+ "SELECT PV3.PUNTOVENTA_ID, PV3.NUMPUNTOVENTA, PV3.NOMBPUNTOVENTA, B.PTOVTAVENTA_ID, PV4.NUMPUNTOVENTA as NUMPTOVTAVENTA, PV4.NOMBPUNTOVENTA AS NOMBPTOVTAVENTA, B.INDSTATUSBOLETO, B.MOTIVOCANCELACION_ID, 0, "
+ "COALESCE (B.PRECIOPAGADO,0) + COALESCE (B.IMPORTETAXAEMBARQUE,0) + COALESCE (B.IMPORTESEGURO,0) + COALESCE (B.IMPORTEPEDAGIO,0) + COALESCE (B.IMPORTEOUTROS,0) AS TOTAL, "
+ "COALESCE (B.IMPORTETAXAEMBARQUE,0) + COALESCE (B.IMPORTESEGURO,0) + COALESCE (B.IMPORTEPEDAGIO,0) + COALESCE (B.IMPORTEOUTROS,0) AS TOTAL_TAXAS "
+ "FROM BOLETO B "
+ "JOIN PUNTO_VENTA PV3 ON PV3.PUNTOVENTA_ID = B.PUNTOVENTA_ID "
+ "LEFT JOIN PUNTO_VENTA PV4 ON PV4.PUNTOVENTA_ID = B.PTOVTAVENTA_ID "
+ "JOIN MARCA M2 ON M2.MARCA_ID = B.MARCA_ID "
+ "WHERE B.INDSTATUSBOLETO = 'C' "
+ "AND B.MOTIVOCANCELACION_ID IN(10, 32, 99) "
+ "AND B.FECHORVENTA BETWEEN CAST (:fecInicio AS DATE) AND CAST(:fecFinal AS DATE) ";
if (StringUtils.isNotBlank(stringLsPuntoVentaId)) {
query += "AND B.PUNTOVENTA_ID IN(" + stringLsPuntoVentaId + ") ";
}
if(parametros.get("EMPRESA_ID")!= null){
query += "AND M2.EMPRESA_ID = :EMPRESA_ID ";
}
query += "ORDER BY NUMPUNTOVENTA, NUMPTOVTAVENTA, INDSTATUSBOLETO ";
return query;
}
protected String getSqlCancelados() {
String query = "SELECT B.NUMFOLIOSISTEMA, B.CORRIDA_ID, B.FECHORVIAJE, B.NUMASIENTO, B.PRECIOPAGADO, B.FECHORVENTA, COALESCE(PV2.NOMBPUNTOVENTA, PV1.NOMBPUNTOVENTA) NOMBPUNTOVENTA, "
+ "(COALESCE (B.PRECIOPAGADO,0) + COALESCE (B.IMPORTETAXAEMBARQUE,0) + COALESCE (B.IMPORTESEGURO,0) + COALESCE (B.IMPORTEPEDAGIO,0) + COALESCE (B.IMPORTEOUTROS,0)) AS TOTAL "
+ "FROM BOLETO B "
+ "JOIN MARCA M ON M.MARCA_ID = B.MARCA_ID "
+ "LEFT JOIN PUNTO_VENTA PV1 ON PV1.PUNTOVENTA_ID = B.PUNTOVENTA_ID "
+ "LEFT JOIN PUNTO_VENTA PV2 ON PV2.PUNTOVENTA_ID = B.PTOVTAVENTA_ID "
+ "WHERE B.INDSTATUSBOLETO = 'C' "
+ "AND (B.MOTIVOCANCELACION_ID IN(10, 32, 99)) "
+ "AND B.FECHORVENTA BETWEEN CAST (:fecInicio AS DATE) AND CAST(:fecFinal AS DATE) ";
if(parametros.get("EMPRESA_ID")!= null) {
query += "AND M.EMPRESA_ID =:EMPRESA_ID ";
}
if (StringUtils.isNotBlank(stringLsPuntoVentaId)) {
query += "AND B.PUNTOVENTA_ID IN(" + stringLsPuntoVentaId + ") ";
}
return query;
}
@Override
protected void processaParametros() throws Exception {
}
public List<RelatorioVendasComissaoBean> getLsDadosRelatorio() {
return lsDadosRelatorio;
}
@Override
public String getNome() {
if (apenasCancelados) {
return "RelatorioVendasComissaoCancelamento";
}
return super.getNome();
}
}

View File

@ -0,0 +1,24 @@
#geral
msg.noData=Não foi possivel obter dados com os parâmetros informados.
#Labels cabeçalho
cabecalho.nome=Relatório Vendas para Comissão
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:
cabecalho.usuario=Usuário:
label.numPuntoVenta=Número Agência
label.nombPuntoVenta=Nome Agência
label.totalVendas=Vendas
label.totalTaxasVendas=Taxas Vendas
label.totalVendasCanceladas=Anulação
label.totalTaxasVendasCanceladas=Taxas Anulação
label.totalVendasDevolucao=Devolução
label.totalTaxasVendasDevolucao=Taxas Devolução
label.total=Total
label.puntoVenta=Agência:

View File

@ -0,0 +1,24 @@
#geral
msg.noData=Não foi possivel obter dados com os parâmetros informados.
#Labels cabeçalho
cabecalho.nome=Relatório Vendas para Comissão
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:
cabecalho.usuario=Usuário:
label.numPuntoVenta=Número Agência
label.nombPuntoVenta=Nome Agência
label.totalVendas=Vendas
label.totalTaxasVendas=Taxas Vendas
label.totalVendasCanceladas=Anulação
label.totalTaxasVendasCanceladas=Taxas Anulação
label.totalVendasDevolucao=Devolução
label.totalTaxasVendasDevolucao=Taxas Devolução
label.total=Total
label.puntoVenta=Agência:

View File

@ -0,0 +1,259 @@
<?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="RelatorioVendasComissao" pageWidth="842" pageHeight="595" orientation="Landscape" whenNoDataType="NoDataSection" columnWidth="802" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="84b9dfcf-8ec5-4f51-80cc-7339e3b158b4">
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<parameter name="fecInicio" class="java.lang.String"/>
<parameter name="fecFinal" class="java.lang.String"/>
<parameter name="noDataRelatorio" class="java.lang.String"/>
<parameter name="empresa" class="java.lang.String"/>
<parameter name="nombPuntoVenta" class="java.lang.String"/>
<queryString>
<![CDATA[]]>
</queryString>
<field name="numPuntoVenta" class="java.lang.String"/>
<field name="totalVendas" class="java.math.BigDecimal"/>
<field name="totalTaxasVendas" class="java.math.BigDecimal"/>
<field name="totalVendasCanceladas" class="java.math.BigDecimal"/>
<field name="totalTaxasVendasCanceladas" class="java.math.BigDecimal"/>
<field name="totalVendasDevolucao" class="java.math.BigDecimal"/>
<field name="totalTaxasVendasDevolucao" class="java.math.BigDecimal"/>
<field name="nombPuntoVenta" class="java.lang.String"/>
<variable name="vTotalVendas" class="java.math.BigDecimal" calculation="Sum">
<variableExpression><![CDATA[$F{totalVendas}]]></variableExpression>
</variable>
<variable name="vTotalTaxasVendas" class="java.math.BigDecimal" calculation="Sum">
<variableExpression><![CDATA[$F{totalTaxasVendas}]]></variableExpression>
</variable>
<variable name="vTotalVendasCanceladas" class="java.math.BigDecimal" calculation="Sum">
<variableExpression><![CDATA[$F{totalVendasCanceladas}]]></variableExpression>
</variable>
<variable name="vTotalTaxasVendasCanceladas" class="java.math.BigDecimal" calculation="Sum">
<variableExpression><![CDATA[$F{totalTaxasVendasCanceladas}]]></variableExpression>
</variable>
<variable name="vTotalVendasDevolucao" class="java.math.BigDecimal" calculation="Sum">
<variableExpression><![CDATA[$F{totalVendasDevolucao}]]></variableExpression>
</variable>
<variable name="vTotalTaxasVendasDevolucao" class="java.math.BigDecimal" calculation="Sum">
<variableExpression><![CDATA[$F{totalTaxasVendasDevolucao}]]></variableExpression>
</variable>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band height="81" splitType="Stretch">
<textField>
<reportElement uuid="43b2c28d-4760-4890-b00d-25e931e79c74" x="0" y="0" width="620" height="20"/>
<textElement markup="none">
<font size="14" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$R{cabecalho.nome}]]></textFieldExpression>
</textField>
<textField pattern="dd/MM/yyyy HH:mm">
<reportElement uuid="4d1bcd65-c9a6-44b4-8dca-cc3c4c20c9a5" x="638" y="0" width="164" height="20"/>
<textElement textAlignment="Right">
<font isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[new java.util.Date()]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="fd05bd35-30d9-4baf-aa56-f8e5d3c3268b" x="0" y="20" width="620" height="20"/>
<textElement>
<font isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$R{cabecalho.periodo} + " " + $P{fecInicio} + " " + $R{cabecalho.periodoA} + " " + $P{fecFinal}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="8fa1c53b-1da7-4d4d-a75c-ab1543acae2a" x="53" y="41" width="139" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$P{empresa}]]></textFieldExpression>
</textField>
<staticText>
<reportElement uuid="a91f6081-4740-4e36-8965-41b6cde4cc20" x="0" y="41" width="53" height="20"/>
<textElement/>
<text><![CDATA[Empresa:]]></text>
</staticText>
<textField>
<reportElement uuid="1a29d731-e121-4507-8c0b-e93f437e8d80" x="0" y="61" width="53" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$R{label.puntoVenta}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="53d53aa5-d8c9-43c6-b17d-1e6b49697237" x="53" y="61" width="748" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$P{nombPuntoVenta}]]></textFieldExpression>
</textField>
</band>
</title>
<pageHeader>
<band height="21" splitType="Stretch">
<textField>
<reportElement uuid="6a8a0843-7236-40a3-98ae-5fbf59b4cfec" x="607" y="0" width="195" height="20"/>
<textElement textAlignment="Right">
<font isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$R{cabecalho.pagina} + " " + $V{PAGE_NUMBER}+ " " + $R{cabecalho.de} + " " + $V{PAGE_NUMBER}]]></textFieldExpression>
</textField>
</band>
</pageHeader>
<columnHeader>
<band height="23" splitType="Stretch">
<textField>
<reportElement uuid="a3dea313-f2a7-4388-bd91-5c02e8612b8e" x="0" y="0" width="102" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$R{label.numPuntoVenta}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="8a39b1b1-6ebd-4f33-adea-c28a9988eaae" x="311" y="0" width="80" height="20"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$R{label.totalVendas}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="d9e0c815-b91e-4bc9-8a1a-1fa77aaabcb3" x="393" y="0" width="80" height="20"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$R{label.totalTaxasVendas}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="2d666aaf-65a6-4c3f-acd3-e65483a78256" x="475" y="0" width="80" height="20"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$R{label.totalVendasCanceladas}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="a2ea7cea-d8ab-4c0e-bee0-4dafb3866c1f" x="557" y="0" width="80" height="20"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$R{label.totalTaxasVendasCanceladas}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="43d6ee75-8459-4b9e-8cbe-ca2819d3198a" x="721" y="0" width="80" height="20"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$R{label.totalTaxasVendasDevolucao}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="12a7a0b1-f60c-4819-972a-2ea87f1f07b3" x="639" y="0" width="80" height="20"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$R{label.totalVendasDevolucao}]]></textFieldExpression>
</textField>
<line>
<reportElement uuid="811af238-a027-48e9-bd6f-eee885474929" positionType="Float" x="0" y="21" width="802" height="1"/>
</line>
<textField>
<reportElement uuid="cfac237e-06b7-4c98-b7f1-285f5ec2c8b3" x="104" y="0" width="205" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$R{label.nombPuntoVenta}]]></textFieldExpression>
</textField>
</band>
</columnHeader>
<detail>
<band height="22" splitType="Stretch">
<textField isStretchWithOverflow="true" pattern="#,##0.00" isBlankWhenNull="true">
<reportElement uuid="2e83e648-f95f-42ae-9069-862e6ad79b21" stretchType="RelativeToTallestObject" x="639" y="0" width="80" height="20" isPrintWhenDetailOverflows="true"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$F{totalVendasDevolucao}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" pattern="#,##0.00" isBlankWhenNull="true">
<reportElement uuid="8cdbdd14-c9f1-45d8-bf41-a4066930f5a4" stretchType="RelativeToTallestObject" x="311" y="0" width="80" height="20" isPrintWhenDetailOverflows="true"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$F{totalVendas}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement uuid="c98526c0-c36f-42df-9308-452ac671044c" stretchType="RelativeToTallestObject" x="0" y="0" width="102" height="20" isPrintWhenDetailOverflows="true"/>
<textElement/>
<textFieldExpression><![CDATA[$F{numPuntoVenta}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" pattern="#,##0.00" isBlankWhenNull="true">
<reportElement uuid="040c8de3-f836-40bc-96bd-761a7f5b46ef" stretchType="RelativeToTallestObject" x="721" y="0" width="80" height="20" isPrintWhenDetailOverflows="true"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$F{totalTaxasVendasDevolucao}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" pattern="#,##0.00" isBlankWhenNull="true">
<reportElement uuid="b18fae2e-6454-42b0-a68c-04cf790ddfd6" stretchType="RelativeToTallestObject" x="557" y="0" width="80" height="20" isPrintWhenDetailOverflows="true"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$F{totalTaxasVendasCanceladas}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" pattern="#,##0.00" isBlankWhenNull="true">
<reportElement uuid="09b0cd36-1946-406f-923a-172b8a4f1ac6" stretchType="RelativeToTallestObject" x="475" y="0" width="80" height="20" isPrintWhenDetailOverflows="true"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$F{totalVendasCanceladas}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" pattern="#,##0.00" isBlankWhenNull="true">
<reportElement uuid="8810c4af-e2ba-438f-a553-0143938c5f15" stretchType="RelativeToTallestObject" x="393" y="0" width="80" height="20" isPrintWhenDetailOverflows="true"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$F{totalTaxasVendas}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement uuid="cebb836f-d485-4d50-98e0-0678bb715fb9" stretchType="RelativeToTallestObject" x="104" y="0" width="205" height="20" isPrintWhenDetailOverflows="true"/>
<textElement/>
<textFieldExpression><![CDATA[$F{nombPuntoVenta}]]></textFieldExpression>
</textField>
</band>
</detail>
<columnFooter>
<band splitType="Stretch"/>
</columnFooter>
<pageFooter>
<band splitType="Stretch"/>
</pageFooter>
<summary>
<band height="26" splitType="Stretch">
<textField isStretchWithOverflow="true" pattern="#,##0.00" isBlankWhenNull="true">
<reportElement uuid="5de9b146-8a5d-4972-bd9c-7147f05137ef" stretchType="RelativeToTallestObject" x="475" y="5" width="80" height="20" isPrintWhenDetailOverflows="true"/>
<textElement textAlignment="Right">
<font isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$V{vTotalVendasCanceladas}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" pattern="#,##0.00" isBlankWhenNull="true">
<reportElement uuid="f22b1a6f-2e0b-4771-acf3-b7460874f730" stretchType="RelativeToTallestObject" x="557" y="5" width="80" height="20" isPrintWhenDetailOverflows="true"/>
<textElement textAlignment="Right">
<font isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$V{vTotalTaxasVendasCanceladas}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" pattern="#,##0.00" isBlankWhenNull="true">
<reportElement uuid="353f7f71-1413-4dd6-82d7-23cd3944819f" stretchType="RelativeToTallestObject" x="639" y="5" width="80" height="20" isPrintWhenDetailOverflows="true"/>
<textElement textAlignment="Right">
<font isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$V{vTotalVendasDevolucao}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" pattern="#,##0.00" isBlankWhenNull="true">
<reportElement uuid="417ed1de-ce71-42fa-8108-33a37f6a0626" stretchType="RelativeToTallestObject" x="721" y="5" width="80" height="20" isPrintWhenDetailOverflows="true"/>
<textElement textAlignment="Right">
<font isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$V{vTotalTaxasVendasDevolucao}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" pattern="#,##0.00" isBlankWhenNull="true">
<reportElement uuid="3325e0ca-40a5-4f6d-be63-a1fdc0f0d36c" stretchType="RelativeToTallestObject" x="393" y="5" width="80" height="20" isPrintWhenDetailOverflows="true"/>
<textElement textAlignment="Right">
<font isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$V{vTotalTaxasVendas}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" pattern="#,##0.00" isBlankWhenNull="true">
<reportElement uuid="7d8e9f80-020d-4dc9-b7ce-e5213b42f920" stretchType="RelativeToTallestObject" x="311" y="5" width="80" height="20" isPrintWhenDetailOverflows="true"/>
<textElement textAlignment="Right">
<font isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$V{vTotalVendas}]]></textFieldExpression>
</textField>
<line>
<reportElement uuid="c8dfd524-14cc-454c-afc0-3ce9f8d0ead8" positionType="Float" x="0" y="2" width="802" height="1"/>
</line>
<textField>
<reportElement uuid="38a0f957-1b50-46f9-b79f-c631baf8937b" x="104" y="5" width="205" height="20"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$R{label.total}]]></textFieldExpression>
</textField>
</band>
</summary>
<noData>
<band height="24">
<textField isBlankWhenNull="true">
<reportElement uuid="d7df66c6-4dc0-4f3b-88f4-b22094d29091" positionType="Float" x="0" y="0" width="555" height="20" isPrintWhenDetailOverflows="true"/>
<textElement verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$R{msg.noData}]]></textFieldExpression>
</textField>
</band>
</noData>
</jasperReport>

View File

@ -1,5 +1,6 @@
package com.rjconsultores.ventaboletos.web.gui.controladores.relatorios;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
@ -26,6 +27,7 @@ import org.zkoss.zul.Paging;
import com.rjconsultores.ventaboletos.entidad.Empresa;
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
import com.rjconsultores.ventaboletos.relatorios.impl.RelatorioVendasComissao;
import com.rjconsultores.ventaboletos.relatorios.impl.RelatorioVendasComissaoEstavel;
import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio;
import com.rjconsultores.ventaboletos.service.EmpresaService;
import com.rjconsultores.ventaboletos.utilerias.DateUtil;
@ -69,8 +71,16 @@ public class RelatorioVendasComissaoController extends MyGenericForwardComposer
super.doAfterCompose(comp);
}
@SuppressWarnings({ "unchecked", "rawtypes" })
public void onClick$btnExecutarRelatorio(Event ev) throws Exception {
excutarRelatorios(false);
}
public void onClick$btnExecutarRelatorioEstavel(Event ev) throws Exception {
excutarRelatorios(true);
}
@SuppressWarnings({ "unchecked", "rawtypes" })
public void excutarRelatorios(boolean versionestable) throws SQLException, Exception {
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
Date dataDe = dataInicial.getValue();
@ -100,13 +110,18 @@ public class RelatorioVendasComissaoController extends MyGenericForwardComposer
List<PuntoVenta> lsPuntoVentaSelecionados = new ArrayList(Arrays.asList(puntoVentaSelList.getData()));
parametros.put("lsPuntoVenta", lsPuntoVentaSelecionados);
Relatorio relatorio = new RelatorioVendasComissao(parametros, dataSourceRead.getConnection());
Map<String, Object> args = new HashMap<String, Object>();
if (versionestable) {
Relatorio relatorio = new RelatorioVendasComissaoEstavel(parametros, dataSourceRead.getConnection());
args.put("relatorio", relatorio);
} else {
Relatorio relatorio = new RelatorioVendasComissao(parametros, dataSourceRead.getConnection());
args.put("relatorio", relatorio);
}
openWindow("/component/reportView.zul",
Labels.getLabel("indexController.mniRelatorioVendasComissao.label"), args, MODAL);
}
public void onClick$btnPesquisa(Event ev) {

View File

@ -72,7 +72,7 @@ relatorio.lb.btnSalvarRelatorio = Guardar reporte
relatorio.lb.btnSalvarRelatorioPdf = Guardar reporte en PDF
relatorio.lb.btnSalvarRelatorioXls = Guardar reporte en XLS
relatorio.parametro.msgNoData = No fue posible obtener datos con los parámetros informados.
relatorio.lb.btnExecutarRelatorioEstavel = Ejecutar reporte - Versión Estable
# tooltip botões
tooltiptext.btnFechar = Cerrar

View File

@ -74,7 +74,7 @@ relatorio.lb.btnSalvarRelatorio = Salvar Relatório
relatorio.lb.btnSalvarRelatorioPdf = Salvar Relatório em PDF
relatorio.lb.btnSalvarRelatorioXls = Salvar Relatório em XLS
relatorio.parametro.msgNoData = Não foi possivel obter dados com os parâmetros informados.
relatorio.lb.btnExecutarRelatorioEstavel = Executar Relatório - Versão Estável
# tooltip botões
tooltiptext.btnFechar = Fechar

View File

@ -98,8 +98,11 @@
</rows>
</grid>
<toolbar>
<button id="btnExecutarRelatorio" image="/gui/img/find.png"
<button id="btnExecutarRelatorio" image="/gui/img/enginer.png"
label="${c:l('relatorio.lb.btnExecutarRelatorio')}" />
<button id="btnExecutarRelatorioEstavel" image="/gui/img/enginer.png"
label="${c:l('relatorio.lb.btnExecutarRelatorioEstavel')}" />
</toolbar>
</window>
</zk>