fixes bug#23882

dev: Lucas
qua: 

git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@111371 d1611594-4594-4d17-8e1d-87c2c4800839
master
julio 2022-03-17 20:52:03 +00:00
parent b3e603c7a2
commit c69855358c
8 changed files with 683 additions and 100 deletions

View File

@ -23,8 +23,8 @@ import com.rjconsultores.ventaboletos.web.utilerias.NamedParameterStatement;
import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource; import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource;
public class RelatorioVendasCartoes extends Relatorio { public class RelatorioVendasCartoes extends Relatorio {
private static Logger log = Logger.getLogger(RelatorioMovimentacaoEstoque.class); private static Logger log = Logger.getLogger(RelatorioVendasCartoes.class);
List<RelatorioVendasCartoesBean> list = null; List<RelatorioVendasCartoesBean> list = null;
@ -36,10 +36,10 @@ public class RelatorioVendasCartoes extends Relatorio {
public void initDados() throws Exception { public void initDados() throws Exception {
Connection conexao = this.relatorio.getConexao(); Connection conexao = this.relatorio.getConexao();
Map<String, Object> parametros = this.relatorio.getParametros(); Map<String, Object> parametros = this.relatorio.getParametros();
NamedParameterStatement stmt = null; NamedParameterStatement stmt = null;
ResultSet rset = null; ResultSet rset = null;
String dataInicial = parametros.get("DATA_INICIAL").toString() + " 00:00:00"; String dataInicial = parametros.get("DATA_INICIAL").toString() + " 00:00:00";
String dataFinal = parametros.get("DATA_FINAL").toString() + " 23:59:59"; String dataFinal = parametros.get("DATA_FINAL").toString() + " 23:59:59";
Empresa empresa = (Empresa) parametros.get("EMPRESA"); Empresa empresa = (Empresa) parametros.get("EMPRESA");
@ -47,28 +47,29 @@ public class RelatorioVendasCartoes extends Relatorio {
Usuario usuario = (Usuario) parametros.get("USUARIO"); Usuario usuario = (Usuario) parametros.get("USUARIO");
Estacion estacao = (Estacion) parametros.get("ESTACION"); Estacion estacao = (Estacion) parametros.get("ESTACION");
String tipoAgencias = (String) parametros.get("TIPOPUNTOVENTA"); String tipoAgencias = (String) parametros.get("TIPOPUNTOVENTA");
String sql = getSql(dataInicial, dataFinal, empresa, puntoVenta, tipoAgencias, usuario, estacao, buscarPorDataDaVenda); String sql = getSql(dataInicial, dataFinal, empresa, puntoVenta, tipoAgencias, usuario, estacao, buscarPorDataDaVenda);
log.info("query= " + sql);
try { try {
stmt = new NamedParameterStatement(conexao, sql); stmt = new NamedParameterStatement(conexao, sql);
if(empresa != null){ if (empresa != null) {
stmt.setInt("empresaId", empresa.getEmpresaId()); stmt.setInt("empresaId", empresa.getEmpresaId());
} }
if(puntoVenta != null){ if (puntoVenta != null) {
stmt.setInt("puntoventaId", puntoVenta.getPuntoventaId()); stmt.setInt("puntoventaId", puntoVenta.getPuntoventaId());
} }
if(dataInicial != null){ if (dataInicial != null) {
stmt.setString("dataInicial",dataInicial); stmt.setString("dataInicial", dataInicial);
} }
if(dataFinal != null){ if (dataFinal != null) {
stmt.setString("dataFinal", dataFinal); stmt.setString("dataFinal", dataFinal);
} }
if(estacao != null){ if (estacao != null) {
stmt.setInt("estacionId", estacao.getEstacionId()); stmt.setInt("estacionId", estacao.getEstacionId());
} }
if(usuario != null){ if (usuario != null) {
stmt.setInt("usuarioId", usuario.getUsuarioId()); stmt.setInt("usuarioId", usuario.getUsuarioId());
} }
@ -77,50 +78,50 @@ public class RelatorioVendasCartoes extends Relatorio {
list = new ArrayList<RelatorioVendasCartoesBean>(); list = new ArrayList<RelatorioVendasCartoesBean>();
BigDecimal valorTotal = BigDecimal.ZERO; BigDecimal valorTotal = BigDecimal.ZERO;
while (rset.next()) { while (rset.next()) {
RelatorioVendasCartoesBean bean = new RelatorioVendasCartoesBean(); RelatorioVendasCartoesBean bean = new RelatorioVendasCartoesBean();
bean.setDataVenda(rset.getDate("dataVenda")); bean.setDataVenda(rset.getDate("dataVenda"));
bean.setDataOperacao(rset.getString("dataOperacao") != null ? DateUtil.getDateFromString(rset.getString("dataOperacao"), "ddMMyy") : null); bean.setDataOperacao(rset.getString("dataOperacao") != null ? DateUtil.getDateFromString(rset.getString("dataOperacao"), "ddMMyy") : null);
bean.setDescPagamento(rset.getString("descPagamento") != null ? rset.getString("descPagamento") : null); bean.setDescPagamento(rset.getString("descPagamento") != null ? rset.getString("descPagamento") : null);
bean.setValor(rset.getBigDecimal("valor") != null ? rset.getBigDecimal("valor") : null); bean.setValor(rset.getBigDecimal("valor") != null ? rset.getBigDecimal("valor") : null);
bean.setAutorizacao(rset.getString("autorizacao") != null ? rset.getString("autorizacao") : null); bean.setAutorizacao(rset.getString("autorizacao") != null ? rset.getString("autorizacao") : null);
bean.setQtdParcelas(rset.getInt("qtdParcelas")); bean.setQtdParcelas(rset.getInt("qtdParcelas"));
bean.setNumeroPuntoVenta(rset.getInt("numeroPuntoVenta")); bean.setNumeroPuntoVenta(rset.getInt("numeroPuntoVenta"));
bean.setNomePuntoVenta(rset.getString("nomePuntoVenta") != null ? rset.getString("nomePuntoVenta") : null); bean.setNomePuntoVenta(rset.getString("nomePuntoVenta") != null ? rset.getString("nomePuntoVenta") : null);
bean.setDescOperadoraCartao(rset.getString("descOperadoraCartao") != null ? rset.getString("descOperadoraCartao") : null); bean.setDescOperadoraCartao(rset.getString("descOperadoraCartao") != null ? rset.getString("descOperadoraCartao") : null);
bean.setNSU(rset.getString("nsu") != null ? rset.getString("nsu") : null); bean.setNSU(rset.getString("nsu") != null ? rset.getString("nsu") : null);
bean.setNumeroCartao(rset.getString("numeroCartao") != null ? rset.getString("numeroCartao") : null); bean.setNumeroCartao(rset.getString("numeroCartao") != null ? rset.getString("numeroCartao") : null);
bean.setBandeira(rset.getString("bandeira") != null ? rset.getString("bandeira") : null); bean.setBandeira(rset.getString("bandeira") != null ? rset.getString("bandeira") : null);
bean.setEstabelecimento(rset.getString("estabelecimento") != null ? rset.getString("estabelecimento") : null); bean.setEstabelecimento(rset.getString("estabelecimento") != null ? rset.getString("estabelecimento") : null);
bean.setTerminal(rset.getString("terminal") != null ? rset.getString("terminal") : null); bean.setTerminal(rset.getString("terminal") != null ? rset.getString("terminal") : null);
valorTotal = valorTotal.add(bean.getValor() != null ? bean.getValor() : BigDecimal.ZERO); valorTotal = valorTotal.add(bean.getValor() != null ? bean.getValor() : BigDecimal.ZERO);
bean.setValorTotal(valorTotal); bean.setValorTotal(valorTotal);
list.add(bean); list.add(bean);
} }
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
} finally { } finally {
if(rset != null && !rset.isClosed()) { if (rset != null && !rset.isClosed()) {
rset.close(); rset.close();
} }
if(stmt != null && !stmt.isClosed()) { if (stmt != null && !stmt.isClosed()) {
stmt.close(); stmt.close();
} }
} }
} }
}); });
this.setCollectionDataSource(new JRBeanCollectionDataSource(list)); this.setCollectionDataSource(new JRBeanCollectionDataSource(list));
} }
private RelatorioVendasCartoesBean calcTotalValor(RelatorioVendasCartoesBean bean) { // private RelatorioVendasCartoesBean calcTotalValor(RelatorioVendasCartoesBean bean) {
BigDecimal valorTotal = bean.getValorTotal().add(bean.getValorTotal()); // BigDecimal valorTotal = bean.getValorTotal().add(bean.getValorTotal());
bean.setValorTotal(valorTotal); // bean.setValorTotal(valorTotal);
return bean; // return bean;
} // }
@Override @Override
protected void processaParametros() throws Exception { protected void processaParametros() throws Exception {
} }
@ -128,9 +129,9 @@ public class RelatorioVendasCartoes extends Relatorio {
private String getSql(String dataInicial, String dataFinal, Empresa empresa, PuntoVenta puntoVenta, String tipoAgencias, Usuario usuario, Estacion estacion, Boolean buscarPorDataDaVenda) { private String getSql(String dataInicial, String dataFinal, Empresa empresa, PuntoVenta puntoVenta, String tipoAgencias, Usuario usuario, Estacion estacion, Boolean buscarPorDataDaVenda) {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append("SELECT caja.descpago as descPagamento,"); sb.append("SELECT caja.descpago as descPagamento,");
sb.append(" to_char(caja.dataoperacao, 'ddMMyyyy') as dataOperacao,"); sb.append(" to_char(caja.dataoperacao, 'ddMMyyyy') as dataOperacao,");
sb.append(" caja.autorizacao as autorizacao,"); sb.append(" caja.autorizacao as autorizacao,");
sb.append(" coalesce(caja.qtdparcelas, 1) as qtdParcelas ,"); sb.append(" coalesce(caja.qtdparcelas, 1) as qtdParcelas ,");
sb.append(" caja.datavenda as dataVenda, "); sb.append(" caja.datavenda as dataVenda, ");
@ -150,8 +151,8 @@ public class RelatorioVendasCartoes extends Relatorio {
sb.append(" ct.cantparcelas AS qtdparcelas,"); sb.append(" ct.cantparcelas AS qtdparcelas,");
sb.append(" c.fechorventa AS datavenda,"); sb.append(" c.fechorventa AS datavenda,");
sb.append(" case when c.motivocancelacion_id is null then cfp.importe else cfp.importe * -1 end AS preco,"); sb.append(" case when c.motivocancelacion_id is null then cfp.importe else cfp.importe * -1 end AS preco,");
sb.append(" pt.numpuntoventa as numeroPuntoVenta, "); sb.append(" pt.numpuntoventa as numeroPuntoVenta, ");
sb.append("pt.nombpuntoventa as nomePuntoVenta, "); sb.append("pt.nombpuntoventa as nomePuntoVenta, ");
sb.append("ct.descoperadoracartao as descoperadoracartao, "); sb.append("ct.descoperadoracartao as descoperadoracartao, ");
sb.append("ct.nsu as NSU, "); sb.append("ct.nsu as NSU, ");
sb.append(" ct.numtarjeta as numeroCartao, "); sb.append(" ct.numtarjeta as numeroCartao, ");
@ -169,38 +170,36 @@ public class RelatorioVendasCartoes extends Relatorio {
sb.append(" LEFT JOIN estacion_sitef estsitef ON ( estsitef.estacion_id = c.estacion_id and estsitef.activo = 1) "); sb.append(" LEFT JOIN estacion_sitef estsitef ON ( estsitef.estacion_id = c.estacion_id and estsitef.activo = 1) ");
sb.append(" WHERE c.indreimpresion = 0 "); sb.append(" WHERE c.indreimpresion = 0 ");
if(empresa!= null){ if (empresa != null) {
sb.append("and ma.empresa_id = :empresaId "); sb.append("and ma.empresa_id = :empresaId ");
} }
if(puntoVenta != null){ if (puntoVenta != null) {
sb.append("AND c.puntoventa_id = :puntoventaId "); sb.append("AND c.puntoventa_id = :puntoventaId ");
} }
if(estacion!= null){ if (estacion != null) {
sb.append("AND c.estacion_id = :estacionId "); sb.append("AND c.estacion_id = :estacionId ");
} }
if(usuario!= null){ if (usuario != null) {
sb.append(" and c.usuario_id = :usuarioId "); sb.append(" and c.usuario_id = :usuarioId ");
} }
if(dataInicial != null && buscarPorDataDaVenda){ if (dataInicial != null && buscarPorDataDaVenda) {
sb.append("AND c.fechorventa >= TO_DATE(:dataInicial, 'DD/MM/YYYY HH24:MI:SS') "); sb.append("AND c.fechorventa >= TO_DATE(:dataInicial, 'DD/MM/YYYY HH24:MI:SS') ");
} else if (dataInicial != null && !buscarPorDataDaVenda) { } else if (dataInicial != null && !buscarPorDataDaVenda) {
sb.append("AND c.feccorte >= TO_DATE(:dataInicial, 'DD/MM/YYYY HH24:MI:SS') "); sb.append("AND c.feccorte >= TO_DATE(:dataInicial, 'DD/MM/YYYY HH24:MI:SS') ");
} }
if(dataFinal != null && buscarPorDataDaVenda){ if (dataFinal != null && buscarPorDataDaVenda) {
sb.append("AND c.fechorventa <= TO_DATE(:dataFinal, 'DD/MM/YYYY HH24:MI:SS') "); sb.append("AND c.fechorventa <= TO_DATE(:dataFinal, 'DD/MM/YYYY HH24:MI:SS') ");
} else if (dataInicial != null && !buscarPorDataDaVenda) { } else if (dataInicial != null && !buscarPorDataDaVenda) {
sb.append("AND c.feccorte <= TO_DATE(:dataFinal, 'DD/MM/YYYY HH24:MI:SS') "); sb.append("AND c.feccorte <= TO_DATE(:dataFinal, 'DD/MM/YYYY HH24:MI:SS') ");
} }
sb.append(tipoAgencias.equals("-1") || tipoAgencias.equals("TODAS") ? "" : " and pt.tipoptovta_id not in (" + tipoAgencias + ") "); sb.append(tipoAgencias.equals("-1") || tipoAgencias.equals("TODAS") ? "" : " and pt.tipoptovta_id not in (" + tipoAgencias + ") ");
sb.append(" AND fp.formapago_id IN(2,3)"); sb.append(" AND fp.formapago_id IN(2,3)");
sb.append(" AND c.activo = 1) caja "); sb.append(" AND c.activo = 1) caja ");
sb.append("GROUP BY caja.descpago,"); sb.append("GROUP BY caja.descpago,");
@ -217,7 +216,7 @@ public class RelatorioVendasCartoes extends Relatorio {
sb.append(" caja.estabelecimento, "); sb.append(" caja.estabelecimento, ");
sb.append(" caja.terminal "); sb.append(" caja.terminal ");
sb.append("ORDER BY caja.nomePuntoVenta, caja.datavenda "); sb.append("ORDER BY caja.nomePuntoVenta, caja.datavenda ");
return sb.toString(); return sb.toString();
} }

View File

@ -0,0 +1,240 @@
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.utilerias.DateUtil;
import com.rjconsultores.ventaboletos.web.utilerias.NamedParameterStatement;
import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource;
public class RelatorioVendasCartoesAlternativo extends Relatorio {
private static Logger log = Logger.getLogger(RelatorioVendasCartoesAlternativo.class);
List<RelatorioVendasCartoesBean> list = null;
public RelatorioVendasCartoesAlternativo(Map<String, Object> parametros, Connection conexao, final Boolean buscarPorDataDaVenda) 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 tipoAgencias = (String) parametros.get("TIPOPUNTOVENTA");
String sql = getSql(dataInicial, dataFinal, empresa, puntoVenta, tipoAgencias, usuario, estacao, buscarPorDataDaVenda);
log.info("query=" + sql);
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.getString("dataOperacao") != null ? DateUtil.getDateFromString(rset.getString("dataOperacao"), "ddMMyy") : null);
bean.setDescPagamento(rset.getString("descPagamento") != null ? rset.getString("descPagamento") : null);
bean.setValor(rset.getBigDecimal("valor") != null ? rset.getBigDecimal("valor") : null);
bean.setAutorizacao(rset.getString("autorizacao") != null ? rset.getString("autorizacao") : null);
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, String tipoAgencias, Usuario usuario, Estacion estacion, Boolean buscarPorDataDaVenda) {
StringBuilder sb = new StringBuilder();
sb.append("SELECT caja.descpago as descPagamento,");
sb.append(" to_char(caja.dataoperacao, 'ddMMyyyy') as dataOperacao,");
sb.append(" caja.autorizacao as autorizacao,");
sb.append(" coalesce(caja.qtdparcelas, 1) as qtdParcelas ,");
sb.append(" trunc(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(" case when c.motivocancelacion_id is null then cfp.importe else cfp.importe * -1 end AS preco");
sb.append(" FROM caja c");
sb.append(" INNER JOIN caja_formapago cfp ON c.caja_id=cfp.caja_id AND cfp.activo = 1 ");
sb.append(" INNER JOIN marca ma on ma.marca_id = c.marca_id ");
sb.append(" INNER JOIN forma_pago fp ON cfp.formapago_id=fp.formapago_id");
sb.append(" LEFT JOIN caja_det_pago cdp ON (c.caja_id = cdp.caja_id and cdp.cajaformapago_id = cfp.cajaformapago_id)");
sb.append(" LEFT JOIN caja_tarjeta ct ON (ct.cajadetpago_id = cdp.cajadetpago_id)");
sb.append(" INNER JOIN punto_venta pt ON (pt.puntoventa_id = c.puntoventa_id) ");
sb.append(" WHERE c.indreimpresion = 0 ");
if (empresa != null) {
sb.append("and ma.empresa_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 && buscarPorDataDaVenda) {
sb.append("AND c.fechorventa >= TO_DATE(:dataInicial, 'DD/MM/YYYY HH24:MI:SS') ");
} else if (dataInicial != null && !buscarPorDataDaVenda) {
sb.append("AND c.feccorte >= TO_DATE(:dataInicial, 'DD/MM/YYYY HH24:MI:SS') ");
}
if (dataFinal != null && buscarPorDataDaVenda) {
sb.append("AND c.fechorventa <= TO_DATE(:dataFinal, 'DD/MM/YYYY HH24:MI:SS') ");
} else if (dataInicial != null && !buscarPorDataDaVenda) {
sb.append("AND c.feccorte <= TO_DATE(:dataFinal, 'DD/MM/YYYY HH24:MI:SS') ");
}
sb.append(tipoAgencias.equals("-1") || tipoAgencias.equals("TODAS") ? "" : " and pt.tipoptovta_id not in (" + tipoAgencias + ") ");
sb.append(" AND fp.formapago_id IN(2,3)");
sb.append(" AND c.activo = 1 ");
sb.append(" UNION ");
sb.append(" SELECT ");
sb.append(" fp.descpago as descpago, ");
sb.append(" ct.fecoperacion as dataoperacao, ");
sb.append(" ct.numautorizacion as autorizacao, ");
sb.append(" coalesce(ct.cantparcelas, 1) as qtdparcelas, ");
sb.append(" coalesce(c.fechorventa, cd.fechorvta) as datavenda, ");
sb.append(" case when cdp.importe < 0 and fp.formapago_id in (3, 2) then 0 else cdp.importe end as preco ");
sb.append(" FROM caja_diversos cd ");
sb.append(" JOIN caja_diversos_pago cdp on cdp.cajadiversos_id = cd.cajadiversos_id ");
sb.append(" INNER JOIN forma_pago fp on fp.formapago_id = cdp.formapago_id ");
sb.append(" INNER JOIN evento_extra ee on ee.eventoextra_id = cd.eventoextra_id ");
sb.append(" LEFT JOIN boleto c on c.boleto_id = ee.boleto_id ");
sb.append(" LEFT JOIN caja_tarjeta ct on ( cdp.cajatarjeta_id = ct.cajatarjeta_id) ");
sb.append(" WHERE cd.activo = 1 ");
sb.append(" AND (ee.boleto_id is null or ee.boleto_id = c.boleto_id) ");
sb.append(" AND fp.formapago_id in (3, 2) ");
if (empresa != null) {
sb.append("and ee.empresa_id = :empresaId ");
}
if (puntoVenta != null) {
sb.append("AND cd.puntoventa_id = :puntoventaId ");
}
if (estacion != null) {
sb.append("AND cd.estacion_id = :estacionId ");
}
if (usuario != null) {
sb.append(" AND cd.usuario_id = :usuarioId ");
}
if (dataInicial != null && buscarPorDataDaVenda) {
sb.append(" AND cd.fechorvta >= TO_DATE(:dataInicial, 'DD/MM/YYYY HH24:MI:SS') ");
} else if (dataInicial != null && !buscarPorDataDaVenda) {
sb.append(" AND cd.feccorte >= TO_DATE(:dataInicial, 'DD/MM/YYYY HH24:MI:SS') ");
}
if (dataFinal != null && buscarPorDataDaVenda) {
sb.append(" AND cd.fechorvta <= TO_DATE(:dataFinal, 'DD/MM/YYYY HH24:MI:SS') ");
} else if (dataInicial != null && !buscarPorDataDaVenda) {
sb.append(" AND cd.feccorte <= TO_DATE(:dataFinal, 'DD/MM/YYYY HH24:MI:SS') ");
}
sb.append(tipoAgencias.equals("-1") || tipoAgencias.equals("TODAS") ? "" : " and pt.tipoptovta_id not in (" + tipoAgencias + ") ");
sb.append(" ) caja ");
sb.append("GROUP BY caja.descpago,");
sb.append(" to_char(caja.dataoperacao, 'ddMMyyyy'),");
sb.append(" caja.autorizacao,");
sb.append(" caja.qtdparcelas,");
sb.append(" trunc(caja.datavenda) ");
sb.append("ORDER BY caja.descpago, trunc(caja.datavenda), caja.autorizacao");
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="RelatorioVendasCartoesAlternativoAlternativoAlternativoAlternativoAlternativoAlternativoAlternativoAlternativoAlternativoAlternativoAlternativoAlternativoAlternativoAlternativoAlternativoAlternativoAlternativoAlternativoAlternativoAlternativoAlternativoAlternativoAlternativoAlternativoAlternativoAlternativoAlternativoAlternativoAlternativoAlternativoAlternativoAlternativoAlternativoAlternativoAlternativoAlternativoAlternativoAlternativoAlternativo" 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="2573"/>
<property name="ireport.y" value="78"/>
<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="132" 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="780" 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="300" 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="132" 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="132" 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="780" height="20" uuid="3429e199-e682-4e28-b2ce-1bc9f2d031b2"/>
<textFieldExpression><![CDATA[$R{msg.noData}]]></textFieldExpression>
</textField>
</band>
</noData>
</jasperReport>

View File

@ -28,6 +28,7 @@ import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
import com.rjconsultores.ventaboletos.entidad.TipoPuntoVenta; import com.rjconsultores.ventaboletos.entidad.TipoPuntoVenta;
import com.rjconsultores.ventaboletos.entidad.Usuario; import com.rjconsultores.ventaboletos.entidad.Usuario;
import com.rjconsultores.ventaboletos.relatorios.impl.RelatorioVendasCartoes; import com.rjconsultores.ventaboletos.relatorios.impl.RelatorioVendasCartoes;
import com.rjconsultores.ventaboletos.relatorios.impl.RelatorioVendasCartoesAlternativo;
import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio; import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio;
import com.rjconsultores.ventaboletos.service.TipoPuntoVentaService; import com.rjconsultores.ventaboletos.service.TipoPuntoVentaService;
import com.rjconsultores.ventaboletos.utilerias.DateUtil; import com.rjconsultores.ventaboletos.utilerias.DateUtil;
@ -40,7 +41,6 @@ import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox; import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.HibernateSearchObject; import com.rjconsultores.ventaboletos.web.utilerias.paginacion.HibernateSearchObject;
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.PagedListWrapper; import com.rjconsultores.ventaboletos.web.utilerias.paginacion.PagedListWrapper;
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderPuntoVentaSimple;
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderTipoPuntoVenta; import com.rjconsultores.ventaboletos.web.utilerias.render.RenderTipoPuntoVenta;
import com.trg.search.Filter; import com.trg.search.Filter;
@ -51,7 +51,7 @@ public class RelatorioVendasCartoesController extends MyGenericForwardComposer {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private Datebox dataInicial; private Datebox dataInicial;
private Datebox dataFinal; private Datebox dataFinal;
private MyComboboxEstandar cmbEmpresa; private MyComboboxEstandar cmbEmpresa;
private MyComboboxPuntoVenta cmbPuntoVenta; private MyComboboxPuntoVenta cmbPuntoVenta;
private MyComboboxEstacion cmbEstacion; private MyComboboxEstacion cmbEstacion;
@ -69,16 +69,16 @@ public class RelatorioVendasCartoesController extends MyGenericForwardComposer {
private static final String TODOS_VALUE = new Integer(-1).toString(); private static final String TODOS_VALUE = new Integer(-1).toString();
private static final String TODOS = "TODAS"; private static final String TODOS = "TODAS";
private Bandbox bbPesquisaPuntoVenta; private Bandbox bbPesquisaPuntoVenta;
private Radio radioDataVenda; private Radio radioDataVenda;
@Autowired @Autowired
private DataSource dataSourceRead; private DataSource dataSourceRead;
@Override @Override
public void doAfterCompose(Component comp) throws Exception { public void doAfterCompose(Component comp) throws Exception {
super.doAfterCompose(comp); super.doAfterCompose(comp);
lsEmpresa = UsuarioLogado.getUsuarioLogado().getEmpresa(); lsEmpresa = UsuarioLogado.getUsuarioLogado().getEmpresa();
lsTipoPuntoVenta = tipoPuntoVentaService.obtenerTodos(); lsTipoPuntoVenta = tipoPuntoVentaService.obtenerTodos();
tipoPuntoVentaSelList.setItemRenderer(new RenderTipoPuntoVenta()); tipoPuntoVentaSelList.setItemRenderer(new RenderTipoPuntoVenta());
@ -89,18 +89,17 @@ public class RelatorioVendasCartoesController extends MyGenericForwardComposer {
* *
*/ */
@SuppressWarnings({ "rawtypes", "unchecked" }) @SuppressWarnings({ "rawtypes", "unchecked" })
private void executarRelatorio() throws Exception { private void executarRelatorio(boolean isLayoutAlternatico) throws Exception {
Map<String, Object> parametros = new HashMap<String, Object>(); Map<String, Object> parametros = new HashMap<String, Object>();
if(dataInicial.getValue() == null){ if (dataInicial.getValue() == null) {
return; return;
} }
if(dataFinal.getValue() == null){ if (dataFinal.getValue() == null) {
return; return;
} }
parametros.put("NOME_RELATORIO", Labels.getLabel("relatorioVendasCartoesController.window.title")); parametros.put("NOME_RELATORIO", Labels.getLabel("relatorioVendasCartoesController.window.title"));
lsTipoPuntoVenta = new ArrayList(Arrays.asList(tipoPuntoVentaSelList.getData())); lsTipoPuntoVenta = new ArrayList(Arrays.asList(tipoPuntoVentaSelList.getData()));
if (lsTipoPuntoVenta.size() > 0) { if (lsTipoPuntoVenta.size() > 0) {
@ -118,13 +117,13 @@ public class RelatorioVendasCartoesController extends MyGenericForwardComposer {
parametros.put("TIPOPUNTOVENTA_ID", TODOS_VALUE); parametros.put("TIPOPUNTOVENTA_ID", TODOS_VALUE);
parametros.put("TIPOPUNTOVENTA", TODOS); parametros.put("TIPOPUNTOVENTA", TODOS);
} }
StringBuilder filtro = new StringBuilder("Filtros\n"); StringBuilder filtro = new StringBuilder("Filtros\n");
Comboitem itemEmpresa = cmbEmpresa.getSelectedItem(); Comboitem itemEmpresa = cmbEmpresa.getSelectedItem();
if (itemEmpresa != null) { if (itemEmpresa != null) {
Empresa empresa = (Empresa) itemEmpresa.getValue(); Empresa empresa = (Empresa) itemEmpresa.getValue();
if(empresa.getEmpresaId() > -1) { if (empresa.getEmpresaId() > -1) {
parametros.put("EMPRESA", empresa); parametros.put("EMPRESA", empresa);
parametros.put("NOME_EMPRESA", empresa.getNombempresa()); parametros.put("NOME_EMPRESA", empresa.getNombempresa());
filtro.append(empresa.getNombempresa()); filtro.append(empresa.getNombempresa());
@ -134,48 +133,56 @@ public class RelatorioVendasCartoesController extends MyGenericForwardComposer {
} else { } else {
filtro.append("Todas"); filtro.append("Todas");
} }
Comboitem itemPuntoVenta = cmbPuntoVenta.getSelectedItem(); Comboitem itemPuntoVenta = cmbPuntoVenta.getSelectedItem();
if (itemPuntoVenta != null) { if (itemPuntoVenta != null) {
PuntoVenta puntoVenta = (PuntoVenta) itemPuntoVenta.getValue(); PuntoVenta puntoVenta = (PuntoVenta) itemPuntoVenta.getValue();
if(puntoVenta.getPuntoventaId() > -1) { if (puntoVenta.getPuntoventaId() > -1) {
parametros.put("PUNTOVENTA", puntoVenta); parametros.put("PUNTOVENTA", puntoVenta);
parametros.put("NOME_AGENCIA", puntoVenta.getNombpuntoventa()); parametros.put("NOME_AGENCIA", puntoVenta.getNombpuntoventa());
} else { } else {
parametros.put("NOME_AGENCIA", "Todas"); parametros.put("NOME_AGENCIA", "Todas");
} }
}else { } else {
parametros.put("NOME_AGENCIA", "Todas"); parametros.put("NOME_AGENCIA", "Todas");
} }
Comboitem cbiUsuario = cmbUsuario.getSelectedItem(); Comboitem cbiUsuario = cmbUsuario.getSelectedItem();
if (cbiUsuario != null) { if (cbiUsuario != null) {
Usuario usuario = (Usuario) cbiUsuario.getValue(); Usuario usuario = (Usuario) cbiUsuario.getValue();
if(usuario.getUsuarioId() > -1) { if (usuario.getUsuarioId() > -1) {
parametros.put("USUARIO", usuario); parametros.put("USUARIO", usuario);
parametros.put("NOME_USUARIO", usuario.getNombUsuarioCompleto()); parametros.put("NOME_USUARIO", usuario.getNombUsuarioCompleto());
} else { } else {
parametros.put("NOME_USUARIO", "Todos"); parametros.put("NOME_USUARIO", "Todos");
} }
}else { } else {
parametros.put("NOME_USUARIO", "Todos"); parametros.put("NOME_USUARIO", "Todos");
} }
Comboitem itemEstacion = cmbEstacion.getSelectedItem(); Comboitem itemEstacion = cmbEstacion.getSelectedItem();
if (itemEstacion != null) { if (itemEstacion != null) {
Estacion estacion = (Estacion) itemEstacion.getValue(); Estacion estacion = (Estacion) itemEstacion.getValue();
if(estacion.getEstacionId() > -1) { if (estacion.getEstacionId() > -1) {
parametros.put("ESTACION", estacion); parametros.put("ESTACION", estacion);
parametros.put("ESTACAO", estacion.getDescestacion()); parametros.put("ESTACAO", estacion.getDescestacion());
} } else {
else {
parametros.put("ESTACAO", "Todas"); parametros.put("ESTACAO", "Todas");
} }
}else { } else {
parametros.put("ESTACAO", "Todas"); parametros.put("ESTACAO", "Todas");
} }
parametros.put("DATA_INICIAL", DateUtil.getStringDate(dataInicial.getValue(), "dd/MM/yyyy")); parametros.put("DATA_INICIAL", DateUtil.getStringDate(dataInicial.getValue(), "dd/MM/yyyy"));
parametros.put("DATA_FINAL", DateUtil.getStringDate(dataFinal.getValue(), "dd/MM/yyyy")); parametros.put("DATA_FINAL", DateUtil.getStringDate(dataFinal.getValue(), "dd/MM/yyyy"));
parametros.put("FILTROS", filtro.toString()); parametros.put("FILTROS", filtro.toString());
Relatorio relatorio = new RelatorioVendasCartoes(parametros, dataSourceRead.getConnection(), radioDataVenda.isSelected()); Relatorio relatorio = null;
if (isLayoutAlternatico) {
relatorio = new RelatorioVendasCartoesAlternativo(parametros, dataSourceRead.getConnection(), radioDataVenda.isSelected());
} else {
relatorio = new RelatorioVendasCartoes(parametros, dataSourceRead.getConnection(), radioDataVenda.isSelected());
}
Map args = new HashMap(); Map args = new HashMap();
args.put("relatorio", relatorio); args.put("relatorio", relatorio);
@ -183,8 +190,7 @@ public class RelatorioVendasCartoesController extends MyGenericForwardComposer {
openWindow("/component/reportView.zul", openWindow("/component/reportView.zul",
Labels.getLabel("relatorioVendasCartoesController.window.title"), args, MODAL); Labels.getLabel("relatorioVendasCartoesController.window.title"), args, MODAL);
} }
public void onClick$btnPesquisa(Event ev) { public void onClick$btnPesquisa(Event ev) {
executarPesquisa(); executarPesquisa();
} }
@ -193,7 +199,7 @@ public class RelatorioVendasCartoesController extends MyGenericForwardComposer {
HibernateSearchObject<TipoPuntoVenta> tipoPuntoVentaBusqueda = new HibernateSearchObject<TipoPuntoVenta>(TipoPuntoVenta.class, HibernateSearchObject<TipoPuntoVenta> tipoPuntoVentaBusqueda = new HibernateSearchObject<TipoPuntoVenta>(TipoPuntoVenta.class,
pagingtipoPuntoVenta.getPageSize()); pagingtipoPuntoVenta.getPageSize());
tipoPuntoVentaBusqueda.addFilterOr(Filter.like("desctipo", "%" + txtPalavraPesquisa.getText().trim().toUpperCase().concat("%")), Filter.like("desctipo", "%" + txtPalavraPesquisa.getText().trim().toUpperCase().concat("%"))); tipoPuntoVentaBusqueda.addFilterOr(Filter.like("desctipo", "%" + txtPalavraPesquisa.getText().trim().toUpperCase().concat("%")), Filter.like("desctipo", "%" + txtPalavraPesquisa.getText().trim().toUpperCase().concat("%")));
tipoPuntoVentaBusqueda.addSortAsc("desctipo"); tipoPuntoVentaBusqueda.addSortAsc("desctipo");
@ -211,27 +217,26 @@ public class RelatorioVendasCartoesController extends MyGenericForwardComposer {
} }
} }
} }
public void onClick$btnExecutarRelatorio(Event ev) throws Exception{
executarRelatorio();
}
public void onDoubleClick$tipoPuntoVentaList(Event ev) {
public void onClick$btnExecutarRelatorio(Event ev) throws Exception {
executarRelatorio(false);
}
public void onClick$btnExecutarRelatorioAlternativo(Event ev) throws Exception {
executarRelatorio(true);
}
public void onDoubleClick$tipoPuntoVentaList(Event ev) {
TipoPuntoVenta puntoVentaSel = (TipoPuntoVenta) tipoPuntoVentaList.getSelected(); TipoPuntoVenta puntoVentaSel = (TipoPuntoVenta) tipoPuntoVentaList.getSelected();
tipoPuntoVentaSelList.addItemNovo(puntoVentaSel); tipoPuntoVentaSelList.addItemNovo(puntoVentaSel);
} }
public void onDoubleClick$tipoPuntoVentaSelList(Event ev) {
public void onDoubleClick$tipoPuntoVentaSelList(Event ev) {
TipoPuntoVenta puntoVentaSel = (TipoPuntoVenta) tipoPuntoVentaSelList.getSelected(); TipoPuntoVenta puntoVentaSel = (TipoPuntoVenta) tipoPuntoVentaSelList.getSelected();
tipoPuntoVentaSelList.removeItem(puntoVentaSel); tipoPuntoVentaSelList.removeItem(puntoVentaSel);
} }
private void limparPesquisaTipoAgencia() { private void limparPesquisaTipoAgencia() {
tipoPuntoVentaList.clearSelection(); tipoPuntoVentaList.clearSelection();
lsTipoPuntoVenta.clear(); lsTipoPuntoVenta.clear();
this.bbPesquisaPuntoVenta.setValue(""); this.bbPesquisaPuntoVenta.setValue("");
@ -240,12 +245,11 @@ public class RelatorioVendasCartoesController extends MyGenericForwardComposer {
public Datebox getDatInicial() { public Datebox getDatInicial() {
return dataInicial; return dataInicial;
} }
public void onClick$btnLimpar(Event ev) { public void onClick$btnLimpar(Event ev) {
limparPesquisaTipoAgencia(); limparPesquisaTipoAgencia();
} }
public void setDatInicial(Datebox datInicial) { public void setDatInicial(Datebox datInicial) {
this.dataInicial = datInicial; this.dataInicial = datInicial;
} }

View File

@ -124,6 +124,8 @@
<toolbar> <toolbar>
<button id="btnExecutarRelatorio" image="/gui/img/find.png" <button id="btnExecutarRelatorio" image="/gui/img/find.png"
label="${c:l('relatorio.lb.btnExecutarRelatorio')}" /> label="${c:l('relatorio.lb.btnExecutarRelatorio')}" />
<button id="btnExecutarRelatorioAlternativo" image="/gui/img/find.png"
label="Layout Alternativo" />
</toolbar> </toolbar>
</window> </window>
</zk> </zk>