diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioFinanceiroAnalitico.java b/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioFinanceiroAnalitico.java new file mode 100644 index 000000000..5753918b6 --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioFinanceiroAnalitico.java @@ -0,0 +1,291 @@ +package com.rjconsultores.ventaboletos.relatorios.impl; + +import java.math.BigDecimal; +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Date; +import java.util.List; +import java.util.Map; + +import org.apache.log4j.Logger; + +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Estado; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.entidad.TipoPuntoVenta; +import com.rjconsultores.ventaboletos.relatorios.utilitarios.DataSource; +import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio; +import com.rjconsultores.ventaboletos.utilerias.DateUtil; +import com.rjconsultores.ventaboletos.utilerias.fiscal.vo.FinanceiroAnalitico; +import com.rjconsultores.ventaboletos.web.utilerias.NamedParameterStatement; + +import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource; + +public class RelatorioFinanceiroAnalitico extends Relatorio { + + private static Logger log = Logger.getLogger(RelatorioFinanceiroAnalitico.class); + List listdata = null; + + @SuppressWarnings("unchecked") + public RelatorioFinanceiroAnalitico(final Map parametros, Connection conexao) throws Exception { + super(parametros, conexao); + + this.setCustomDataSource(new DataSource(this) { + @Override + public void initDados() throws Exception { + try { + Date inicio = (Date) parametros.get("inicio"); + Date fim = (Date) parametros.get("fim"); + Empresa empresa = (Empresa) parametros.get("empresa"); + TipoPuntoVenta tipoPuntoVenta = (TipoPuntoVenta) parametros.get("tipoPuntoVenta"); + + List estados = (List) parametros.get("estados"); + String ufs = null; + for (Estado estado : estados) { + if (ufs == null) + ufs = estado.getEstadoId().toString(); + else + ufs = ufs + "," + estado.getEstadoId().toString(); + } + + List agencias = (List) parametros.get("agencias"); + String pdvs = null; + for (PuntoVenta pv : agencias) { + if (pdvs == null) + pdvs = pv.getPuntoventaId().toString(); + else + pdvs = pdvs + "," + pv.getPuntoventaId().toString(); + } + + NamedParameterStatement stmt = new NamedParameterStatement(getConexao(), getSql(ufs, pdvs, tipoPuntoVenta == null ? -1 : tipoPuntoVenta.getTipoptovtaId().intValue())); + stmt.setInt("EMPRESA_ID", empresa.getEmpresaId()); + stmt.setTimestamp("DATE_INICIO", new java.sql.Timestamp(DateUtil.inicioFecha(inicio).getTime())); + stmt.setTimestamp("DATE_FIM", new java.sql.Timestamp(DateUtil.fimFecha(fim).getTime())); + + listdata = new ArrayList(); + ResultSet rset = stmt.executeQuery(); + while (rset.next()) { + FinanceiroAnalitico fs = new FinanceiroAnalitico(); + fs.setUf(rset.getString("uf")); + fs.setCodigoAgencia(rset.getString("codigo")); + fs.setFechorVenta(rset.getDate("fechorVenta")); + + fs.setReceitaBPR(getBigDecimal(rset, "receita_bpr")); + fs.setGapVenda(getBigDecimal(rset, "receita_gap")); + fs.setGapImpressa(getBigDecimal(rset, "entrega_gap")); + + BigDecimal totalVendaPassagens = fs.getReceitaBPR().add(fs.getGapVenda()); + totalVendaPassagens = totalVendaPassagens.subtract(fs.getGapImpressa()); + fs.setTotalVendaPassagens(totalVendaPassagens); + + fs.setReceitaEb(getBigDecimal(rset, "receita_eb")); + fs.setMultaComp(getBigDecimal(rset, "receita_multa")); + fs.setDifTrocaOCD(getBigDecimal(rset, "receita_dif_troca_ocd")); + fs.setDifTarifaMaior(getBigDecimal(rset, "receita_dif_dif_tarifa_maior")); + + BigDecimal totalOutrasReceitas = fs.getReceitaEb().add(fs.getMultaComp()).add(fs.getDifTrocaOCD()).add(fs.getDifTarifaMaior()); + fs.setTotalOutrasReceitas(totalOutrasReceitas); + + fs.setTxEmb(getBigDecimal(rset, "taxaEmbarque")); + fs.setPedagio(getBigDecimal(rset, "pedagio")); + fs.setSegFacult(getBigDecimal(rset, "seguro")); + + BigDecimal totalTerceiros = fs.getTxEmb().add(fs.getPedagio()).add(fs.getSegFacult()); + fs.setTotalTerceiros(totalTerceiros); + + BigDecimal receitaBruta = totalVendaPassagens.add(totalOutrasReceitas).add(totalTerceiros); + fs.setReceitaBruta(receitaBruta); + + fs.setDevolBPR(getBigDecimal(rset, "receita_devol_bpr")); + fs.setDevolGAP(getBigDecimal(rset, "receita_devol_gap")); + + BigDecimal totalDevolucao = fs.getDevolBPR().add(fs.getDevolGAP()); + BigDecimal receitaLiquida = receitaBruta.subtract(totalDevolucao); + fs.setReceitaLiquida(receitaLiquida); + + fs.setDespesas(getBigDecimal(rset, "despesas")); + fs.setPgOCD(getBigDecimal(rset, "receita_ocd_deb")); + fs.setDifTarifaMenor(getBigDecimal(rset, "receita_dif_dif_tarifa_menor")); + fs.setCartaoCredito(getBigDecimal(rset, "cartao_credito")); + fs.setCartaoDebito(getBigDecimal(rset, "cartao_debito")); + fs.setBoletoBancario(getBigDecimal(rset, "boleto_bnc")); + fs.setDeposito(getBigDecimal(rset, "deposito")); + + BigDecimal totalDetalhamento = fs.getDespesas().add(fs.getPgOCD()).add(fs.getDifTarifaMenor()) + .add(fs.getCartaoCredito()).add(fs.getCartaoDebito()).add(fs.getBoletoBancario()) + .add(fs.getDeposito()); + fs.setTotalDetalhamento(totalDetalhamento); + + BigDecimal saldo = totalDetalhamento.subtract(receitaLiquida); + fs.setSaldo(saldo); + + listdata.add(fs); + } + + if (!getConexao().isClosed()) + getConexao().close(); + + Collections.sort(listdata); + + } catch (SQLException e) { + log.error("", e); + } + } + + }); + + this.setCollectionDataSource(new JRBeanCollectionDataSource(listdata)); + } + + static public BigDecimal getBigDecimal(ResultSet rs, String strColName) throws SQLException { + BigDecimal nValue = rs.getBigDecimal(strColName); + return rs.wasNull() ? BigDecimal.ZERO : nValue; + } + + @Override + protected void processaParametros() throws Exception { + } + + private String getSql(String ufs, String pdvs, Integer tipoptovtaId) { + + StringBuilder sql = new StringBuilder(); + sql.append("select * from "); + sql.append(" "); + sql.append("(select "); + sql.append(" cd.estadoOrigem as uf, "); + sql.append(" cd.estadoId, "); + sql.append(" cd.codigo, "); + sql.append(" cd.puntoventaId, "); + sql.append(" cd.empresaId, "); + sql.append(" cd.fechorVenta, "); + sql.append(" sum(case when cd.venda = 1 then cd.taxaEmbarque else 0 end) as taxaEmbarque, "); + sql.append(" sum(case when cd.venda = 1 then cd.pedagio else 0 end) as pedagio, "); + sql.append(" sum(case when cd.venda = 1 then cd.seguro else 0 end) as seguro, "); + sql.append(" sum(case when (cd.venda = 1 and cd.bpr = 1) then cd.tarifa else 0 end) as receita_bpr, "); + sql.append(" sum(case when (cd.venda = 1 and cd.gap = 1) then cd.valorpago else 0 end) as receita_gap, "); + sql.append(" sum(case when (cd.entrega_gap = 1) then cd.valorpago else 0 end) as entrega_gap, "); + sql.append(" sum(case when (cd.indcancelacion = 1 and cd.bpr = 1) then cd.valorpago else 0 end) as receita_devol_bpr, "); + sql.append(" sum(case when (cd.indcancelacion = 1 and cd.gap = 1) then cd.valorpago else 0 end) as receita_devol_gap, "); + sql.append(" sum(case when (cd.venda = 1 and cd.pagamento_credito = 1) then cd.valorpago else 0 end) as cartao_credito, "); + sql.append(" sum(case when (cd.venda = 1 and cd.pagamento_debito = 1) then cd.valorpago else 0 end) as cartao_debito, "); + sql.append(" sum(case when (cd.indcancelacion = 1 and cd.ocd_deb = 1) then cd.valorpago else 0 end) as receita_ocd_deb, "); + sql.append(" sum(case when (cd.ocd_cred = 1) then cd.valorpago else 0 end) as receita_ocd_cred "); + sql.append(" "); + sql.append("from ( "); + sql.append(" select "); + sql.append(" c.caja_id as cajaid, "); + sql.append(" trunc(c.feccreacion) as fechorVenta, "); + sql.append(" e.empresa_id as empresaId, "); + sql.append(" pv.puntoventa_id as puntoventaId, "); + sql.append(" pv.numpuntoventa as codigo, "); + sql.append(" eo.estado_id as estadoId, "); + sql.append(" eo.cveestado as estadoOrigem, "); + sql.append(" c.indstatusboleto, "); + sql.append(" c.indreimpresion, "); + sql.append(" c.indcancelacion, "); + sql.append(" case when c.indstatusboleto = 'V' and c.indcancelacion = 0 and c.indreimpresion = 0 then 1 else 0 end as venda, "); + sql.append(" case when c.tipoventa_id not in (5,12,18,49) then 1 else 0 end as bpr, "); + sql.append(" case when c.tipoventa_id in (5,12,18,49) then 1 else 0 end as gap, "); + sql.append(" case when c.motivocancelacion_id in (35) then 1 else 0 end as ocd_deb, "); + sql.append(" coalesce(cfp.importe, 0) as valorpago, "); + sql.append(" coalesce(c.preciobase, 0) as precobase, "); + sql.append(" coalesce(c.preciopagado, 0) as tarifa, "); + sql.append(" coalesce(c.importetaxaembarque, 0) as taxaEmbarque, "); + sql.append(" coalesce(c.importepedagio, 0) as pedagio, "); + sql.append(" coalesce(c.importeseguro, 0) as seguro, "); + sql.append(" coalesce(c.importeoutros, 0) as outros, "); + sql.append(" cfp.formapago_id, "); + sql.append(" c.motivocancelacion_id as motivocancelacion_id, "); + sql.append(" c.tipoventa_id as tipoventa_id, "); + sql.append(" case when (c.tipoventa_id in (5,12,18,49) and indstatusboleto = 'E') then 1 else 0 end as entrega_gap, "); + sql.append(" case when c.indreimpresion = 1 and indstatusboleto = 'T' then 1 else 0 end as nao_entra_no_caixa, "); + sql.append(" case when cfp.formapago_id = 1 then 1 else 0 end as pagamento_dinheiro, "); + sql.append(" case when cfp.formapago_id in (3,26) then 1 else 0 end as pagamento_debito, "); + sql.append(" case when cfp.formapago_id in (2,25) then 1 else 0 end as pagamento_credito, "); + sql.append(" case when cfp.formapago_id not in (1,2,3,25,26) then 1 else 0 end as pagamento_outro, "); + sql.append(" case when c.motivocancelacion_id in (99) then 1 else 0 end as ocd_cred "); + sql.append(" from caja c "); + sql.append(" inner join caja_formapago cfp on cfp.caja_id = c.caja_id "); + sql.append(" inner join punto_venta pv on pv.puntoventa_id = c.puntoventa_id "); + sql.append(" inner join forma_pago fp on cfp.formapago_id = fp.formapago_id "); + sql.append(" inner join marca m on c.marca_id = m.marca_id "); + sql.append(" inner join empresa e on e.empresa_id = m.empresa_id "); + sql.append(" inner join parada po on po.parada_id = pv.parada_id "); + sql.append(" inner join ciudad co on co.ciudad_id = po.ciudad_id "); + sql.append(" inner join estado eo on eo.estado_id = co.estado_id "); + sql.append(" where c.feccreacion between :DATE_INICIO and :DATE_FIM "); + sql.append(" and e.empresa_id = :EMPRESA_ID "); + sql.append(ufs == null ? "" : "and eo.estado_id in ( " + ufs + " ) "); + sql.append(pdvs == null ? "" : "and pv.puntoventa_id in ( " + pdvs + " ) "); + sql.append(tipoptovtaId == -1 ? "" : "and pv.tipoptovta_id = " + tipoptovtaId); + sql.append(" ) cd "); + sql.append(" where cd.nao_entra_no_caixa = 0 "); + sql.append(" group by cd.estadoOrigem, cd.estadoId, cd.codigo, cd.puntoventaId, cd.empresaId, cd.fechorVenta ) agrc "); + sql.append("left join ( "); + sql.append(" select ed.puntoventaId, ed.estadoId, ed.empresaId, "); + sql.append(" ed.fechorVenta, "); + sql.append(" sum(case when tipoeventoextra_id = 82 and indtipo = 1 then impingreso else 0 end) as receita_eb, "); + sql.append(" sum(case when tipoeventoextra_id in (102,42) and indtipo = 1 then impingreso else 0 end) as receita_multa, "); + sql.append(" sum(case when tipoeventoextra_id in (103,99978,99999) and indtipo = 1 then impingreso else 0 end) as receita_dif_troca_ocd, "); + sql.append(" sum(case when tipoeventoextra_id in (43) and indtipo = 1 then impingreso else 0 end) as receita_dif_dif_tarifa_maior, "); + sql.append(" sum(case when tipoeventoextra_id in (44) and indtipo = 0 then impingreso else 0 end) as receita_dif_dif_tarifa_menor, "); + sql.append(" sum(case when tipoeventoextra_id not in (44) and indtipo = 0 then impingreso else 0 end) as despesas "); + sql.append(" from ( "); + sql.append(" select ee.tipoeventoextra_id, ee.impingreso, tee.indtipo, "); + sql.append(" pv.puntoventa_id as puntoventaId, eo.estado_id as estadoId, ee.empresa_id as empresaId, "); + sql.append(" trunc(ee.fechoringreso) as fechorVenta "); + sql.append(" from evento_extra ee "); + sql.append(" join tipo_evento_extra tee on ee.tipoeventoextra_id = tee.tipoeventoextra_id "); + sql.append(" join punto_venta pv on pv.puntoventa_id = ee.puntoventa_id "); + sql.append(" join parada po on po.parada_id = pv.parada_id "); + sql.append(" join ciudad co on co.ciudad_id = po.ciudad_id "); + sql.append(" join estado eo on eo.estado_id = co.estado_id "); + sql.append(" where ee.activo = 1 and ee.empresa_id = :EMPRESA_ID "); + sql.append(ufs == null ? "" : "and eo.estado_id in ( " + ufs + " ) "); + sql.append(pdvs == null ? "" : "and pv.puntoventa_id in ( " + pdvs + " ) "); + sql.append(tipoptovtaId == -1 ? "" : "and pv.tipoptovta_id = " + tipoptovtaId); + sql.append(" and ee.fechoringreso between :DATE_INICIO and :DATE_FIM "); + sql.append(" ) ed "); + sql.append(" group by ed.puntoventaId, ed.estadoId, ed.empresaId, ed.fechorVenta "); + sql.append(" ) eed on agrc.empresaId = eed.empresaId and agrc.puntoventaId = eed.puntoventaId and agrc.estadoId = eed.estadoId and agrc.fechorVenta = eed.fechorVenta "); + sql.append("left join ( "); + sql.append(" select coalesce(sum(fd.valor), 0) as deposito, pv.puntoventa_id as puntoventaId, fcc.empresa_id as empresaId, eo.estado_id as estadoId, "); + sql.append(" trunc(fd.feccreacion) as fechorVenta "); + sql.append(" from fechamento_cntcorrente fcc "); + sql.append(" join fechamento_cct_deposito fcd on fcd.fechamentocntcorrente_id = fcc.fechamentocntcorrente_id "); + sql.append(" join fechamento_deposito fd on fd.fechamentocntcorrente_id = fcd.fechamentocntcorrente_id "); + sql.append(" join punto_venta pv on pv.puntoventa_id = fcc.puntoventa_id "); + sql.append(" join parada po on po.parada_id = pv.parada_id "); + sql.append(" join ciudad co on co.ciudad_id = po.ciudad_id "); + sql.append(" join estado eo on eo.estado_id = co.estado_id "); + sql.append(" where fcc.activo = 1 and fcc.empresa_id = :EMPRESA_ID "); + sql.append(ufs == null ? "" : "and eo.estado_id in ( " + ufs + " ) "); + sql.append(pdvs == null ? "" : "and pv.puntoventa_id in ( " + pdvs + " ) "); + sql.append(tipoptovtaId == -1 ? "" : "and pv.tipoptovta_id = " + tipoptovtaId); + sql.append(" and fd.feccreacion between :DATE_INICIO and :DATE_FIM "); + sql.append(" group by pv.puntoventa_id, fcc.empresa_id, eo.estado_id, trunc(fd.feccreacion) "); + sql.append(" ) depd on agrc.empresaId = depd.empresaId and agrc.puntoventaId = depd.puntoventaId and agrc.estadoId = depd.estadoId and agrc.fechorVenta = depd.fechorVenta "); + sql.append("left join ( "); + sql.append(" select coalesce(sum(fb.valordocumento), 0) as boleto_bnc , pv.puntoventa_id as puntoventaId, fcc.empresa_id as empresaId, eo.estado_id as estadoId, "); + sql.append(" trunc(fb.fecmodif) as fechorVenta "); + sql.append(" from fechamento_cntcorrente fcc "); + sql.append(" join fechamento_boleto fb on fb.fechamentocntcorrente_id = fcc.fechamentocntcorrente_id "); + sql.append(" join punto_venta pv on pv.puntoventa_id = fcc.puntoventa_id "); + sql.append(" join parada po on po.parada_id = pv.parada_id "); + sql.append(" join ciudad co on co.ciudad_id = po.ciudad_id "); + sql.append(" join estado eo on eo.estado_id = co.estado_id "); + sql.append(" where fcc.activo = 1 and fcc.empresa_id = :EMPRESA_ID "); + sql.append(ufs == null ? "" : "and eo.estado_id in ( " + ufs + " ) "); + sql.append(pdvs == null ? "" : "and pv.puntoventa_id in ( " + pdvs + " ) "); + sql.append(tipoptovtaId == -1 ? "" : "and pv.tipoptovta_id = " + tipoptovtaId); + sql.append(" and fb.fecmodif between :DATE_INICIO and :DATE_FIM "); + sql.append(" group by pv.puntoventa_id, fcc.empresa_id, eo.estado_id, trunc(fb.fecmodif) "); + sql.append(" ) bold on agrc.empresaId = bold.empresaId and agrc.puntoventaId = bold.puntoventaId and agrc.estadoId = bold.estadoId and agrc.fechorVenta = bold.fechorVenta "); + + return sql.toString(); + } + +} diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioFinanceiroSintetico.java b/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioFinanceiroSintetico.java index 2cb82ab3d..5343a7440 100644 --- a/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioFinanceiroSintetico.java +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioFinanceiroSintetico.java @@ -26,7 +26,7 @@ import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource; public class RelatorioFinanceiroSintetico extends Relatorio { - private static Logger log = Logger.getLogger(RelatorioFolioRmd.class); + private static Logger log = Logger.getLogger(RelatorioFinanceiroSintetico.class); List listdata = null; @SuppressWarnings("unchecked") @@ -76,7 +76,8 @@ public class RelatorioFinanceiroSintetico extends Relatorio { fs.setGapVenda(getBigDecimal(rset, "receita_gap")); fs.setGapImpressa(getBigDecimal(rset, "entrega_gap")); - BigDecimal totalVendaPassagens = fs.getReceitaBPR().add(fs.getGapVenda()).add(fs.getGapImpressa()); + BigDecimal totalVendaPassagens = fs.getReceitaBPR().add(fs.getGapVenda()); + totalVendaPassagens = totalVendaPassagens.subtract(fs.getGapImpressa()); fs.setTotalVendaPassagens(totalVendaPassagens); fs.setReceitaEb(getBigDecimal(rset, "receita_eb")); @@ -212,7 +213,7 @@ public class RelatorioFinanceiroSintetico extends Relatorio { sql.append(" inner join parada po on po.parada_id = pv.parada_id "); sql.append(" inner join ciudad co on co.ciudad_id = po.ciudad_id "); sql.append(" inner join estado eo on eo.estado_id = co.estado_id "); - sql.append(" where c.fechorventa between :DATE_INICIO and :DATE_FIM "); + sql.append(" where c.feccreacion between :DATE_INICIO and :DATE_FIM "); sql.append(" and e.empresa_id = :EMPRESA_ID "); sql.append(ufs == null ? "" : "and eo.estado_id in ( " + ufs + " ) "); sql.append(pdvs == null ? "" : "and pv.puntoventa_id in ( " + pdvs + " ) "); diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioFinanceiroAnalitico_es.properties b/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioFinanceiroAnalitico_es.properties new file mode 100644 index 000000000..57daa3700 --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioFinanceiroAnalitico_es.properties @@ -0,0 +1,2 @@ +#geral +msg.noData=Não foi possivel obter dados com os parâmetros informados. \ No newline at end of file diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioFinanceiroAnalitico_pt_BR.properties b/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioFinanceiroAnalitico_pt_BR.properties new file mode 100644 index 000000000..57daa3700 --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioFinanceiroAnalitico_pt_BR.properties @@ -0,0 +1,2 @@ +#geral +msg.noData=Não foi possivel obter dados com os parâmetros informados. \ No newline at end of file diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioFinanceiroAnalitico.jasper b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioFinanceiroAnalitico.jasper new file mode 100644 index 000000000..7ce76f2ce Binary files /dev/null and b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioFinanceiroAnalitico.jasper differ diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioFinanceiroAnalitico.jrxml b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioFinanceiroAnalitico.jrxml new file mode 100644 index 000000000..d325277e0 --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioFinanceiroAnalitico.jrxml @@ -0,0 +1,1032 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioFinanceiroSintetico.jasper b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioFinanceiroSintetico.jasper index f0a40aa50..a99c504f1 100644 Binary files a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioFinanceiroSintetico.jasper and b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioFinanceiroSintetico.jasper differ diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioFinanceiroSintetico.jrxml b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioFinanceiroSintetico.jrxml index 0e1348ccd..fe273f683 100644 --- a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioFinanceiroSintetico.jrxml +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioFinanceiroSintetico.jrxml @@ -1,5 +1,5 @@ - + @@ -152,7 +152,7 @@ - + @@ -173,7 +173,7 @@ - @@ -181,7 +181,7 @@ - @@ -189,7 +189,7 @@ - @@ -205,32 +205,28 @@ - + - + - + - + @@ -245,24 +241,21 @@ - + - + - + @@ -273,7 +266,7 @@ ]]> - + @@ -285,16 +278,14 @@ - + - + @@ -309,56 +300,49 @@ - + - + - + - + - + - + - + @@ -369,7 +353,7 @@ ]]> - + @@ -405,7 +389,7 @@ - + @@ -433,7 +417,103 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -442,6 +522,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -450,26 +566,19 @@ - + - + - - - - - - - @@ -513,7 +622,7 @@ - + @@ -548,7 +657,7 @@ - + @@ -569,7 +678,7 @@ - + @@ -625,23 +734,48 @@ - + - + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -706,14 +840,14 @@ - + - + @@ -734,14 +868,14 @@ - + - + @@ -783,14 +917,14 @@ - + - + @@ -818,14 +952,14 @@ - + - + @@ -837,6 +971,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/impressaofiscal/BusquedaRelatorioFinanceiroController.java b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/impressaofiscal/BusquedaRelatorioFinanceiroController.java index a1680563a..d98700c4f 100644 --- a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/impressaofiscal/BusquedaRelatorioFinanceiroController.java +++ b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/impressaofiscal/BusquedaRelatorioFinanceiroController.java @@ -25,6 +25,7 @@ import com.rjconsultores.ventaboletos.entidad.Empresa; import com.rjconsultores.ventaboletos.entidad.Estado; import com.rjconsultores.ventaboletos.entidad.PuntoVenta; import com.rjconsultores.ventaboletos.entidad.TipoPuntoVenta; +import com.rjconsultores.ventaboletos.relatorios.impl.RelatorioFinanceiroAnalitico; import com.rjconsultores.ventaboletos.relatorios.impl.RelatorioFinanceiroSintetico; import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio; import com.rjconsultores.ventaboletos.service.EmpresaService; @@ -95,7 +96,7 @@ public class BusquedaRelatorioFinanceiroController extends MyGenericForwardCompo } @SuppressWarnings({ "rawtypes", "unchecked" }) - private void executar() throws InterruptedException { + private void executar(boolean isSintetico, boolean isAnalitico) throws InterruptedException { try { Empresa empresa = cmbEmpresa == null ? null : (cmbEmpresa.getSelectedItem() == null ? null : (Empresa) cmbEmpresa.getSelectedItem().getValue()); @@ -117,7 +118,11 @@ public class BusquedaRelatorioFinanceiroController extends MyGenericForwardCompo parametros.put("fim", datFinal.getValue()); parametros.put("usuario", UsuarioLogado.getUsuarioLogado().getClaveUsuario()); - Relatorio relatorio = new RelatorioFinanceiroSintetico(parametros, dataSourceRead.getConnection()); + Relatorio relatorio = null; + if (isSintetico) + relatorio = new RelatorioFinanceiroSintetico(parametros, dataSourceRead.getConnection()); + else + relatorio = new RelatorioFinanceiroAnalitico(parametros, dataSourceRead.getConnection()); Map args = new HashMap(); args.put("relatorio", relatorio); @@ -178,12 +183,12 @@ public class BusquedaRelatorioFinanceiroController extends MyGenericForwardCompo } public void onClick$btnSintetico(Event ev) throws InterruptedException { - executar(); + executar(true, false); } -// public void onClick$btnAnalitico(Event ev) throws InterruptedException { -// executar(); -// } + public void onClick$btnAnalitico(Event ev) throws InterruptedException { + executar(false, true); + } public List getLsEmpresa() { return lsEmpresa; diff --git a/web/gui/impressaofiscal/busquedaRelatorioFinanceiro.zul b/web/gui/impressaofiscal/busquedaRelatorioFinanceiro.zul index 8d04419d6..5622995ad 100644 --- a/web/gui/impressaofiscal/busquedaRelatorioFinanceiro.zul +++ b/web/gui/impressaofiscal/busquedaRelatorioFinanceiro.zul @@ -116,6 +116,9 @@