diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioDepositos.java b/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioDepositos.java index 7ff1dfc55..8fd2b0886 100644 --- a/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioDepositos.java +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioDepositos.java @@ -163,39 +163,30 @@ public class RelatorioDepositos extends Relatorio { sql.append(" SUM(NVL(fd.valor_pago,0)) AS vrfechamento , "); sql.append(" f.total AS vrdeposito, "); sql.append(" f.FECHAMENTOCNTCORRENTE_ID, "); -// sql.append(" fdp.NUMDEPOSITO as numdeposito, "); - sql.append(" null as numdeposito, "); -// sql.append(" ifin.CODIGO as codinstfin, "); - sql.append(" null as codinstfin, "); -// sql.append(" ifin.NOME as nomeinstfin "); - sql.append(" null as nomeinstfin "); + sql.append(" fdp.NUMDEPOSITO as numdeposito, "); + sql.append(" ifin.CODIGO as codinstfin, "); + sql.append(" ifin.NOME as nomeinstfin "); sql.append(" FROM fechamento_cntcorrente f "); - // Join com PuntoVenta sql.append(" LEFT JOIN punto_venta p "); - sql.append(" ON p.puntoventa_id = f.puntoventa_id "); - // Join com empresa + sql.append(" ON p.puntoventa_id = f.puntoventa_id "); sql.append(" LEFT JOIN empresa e "); - sql.append(" ON e.empresa_id = f.empresa_id "); - // Join com fechamento_cct_deposito + sql.append(" ON e.empresa_id = f.empresa_id "); sql.append(" LEFT JOIN fechamento_cct_deposito fd "); - sql.append(" ON fd.fechamentocntcorrente_id = f.fechamentocntcorrente_id "); - sql.append(" AND fd.activo = 1 "); - // Join com FECHAMENTO_DEPOSITO + sql.append(" ON fd.fechamentocntcorrente_id = f.fechamentocntcorrente_id "); + sql.append(" AND fd.activo = 1 "); sql.append(" LEFT JOIN FECHAMENTO_DEPOSITO fdp "); - sql.append(" ON fdp.FECHAMENTODEPOSITO_ID = fd.FECHAMENTODEPOSITO_ID "); - sql.append(" AND fdp.activo = 1 "); - // Join com empresa_contabancaria + sql.append(" ON fdp.FECHAMENTODEPOSITO_ID = fd.FECHAMENTODEPOSITO_ID "); + sql.append(" AND fdp.activo = 1 "); sql.append(" LEFT JOIN empresa_contabancaria ecb "); - sql.append(" ON ecb.EMPRESACONTABANCARIA_ID = fdp.EMPRESACONTABANCARIA_ID "); - sql.append(" AND ecb.activo = 1 "); - // Join com INSTI_FINANCEIRA + sql.append(" ON ecb.EMPRESACONTABANCARIA_ID = fdp.EMPRESACONTABANCARIA_ID "); + sql.append(" AND ecb.activo = 1 "); sql.append(" LEFT JOIN INSTI_FINANCEIRA ifin "); - sql.append(" ON ifin.INSTIFINANCEIRA_ID = ecb.INSTIFINANCEIRA_ID "); - sql.append(" AND ifin.activo = 1 "); + sql.append(" ON ifin.INSTIFINANCEIRA_ID = ecb.INSTIFINANCEIRA_ID "); + sql.append(" AND ifin.activo = 1 "); sql.append(" WHERE f.fecfechamento BETWEEN ? AND ? "); - sql.append(" AND f.activo = 1 "); - sql.append(" AND e.activo = 1 "); - sql.append(" AND p.activo = 1 "); + sql.append(" AND f.activo = 1 "); + sql.append(" AND e.activo = 1 "); + sql.append(" AND p.activo = 1 "); if (puntoVentaId != null && puntoVentaId != -1){ sql.append(" and f.puntoventa_id = " + puntoVentaId); @@ -209,12 +200,9 @@ public class RelatorioDepositos extends Relatorio { sql.append(" f.fecfechamento, "); sql.append(" f.FECHAMENTOCNTCORRENTE_ID, "); sql.append(" f.total, "); -// sql.append(" fdp.NUMDEPOSITO, "); - sql.append(" null, "); -// sql.append(" ifin.CODIGO, "); - sql.append(" null, "); -// sql.append(" ifin.NOME ) tmp "); - sql.append(" null ) tmp "); + sql.append(" fdp.NUMDEPOSITO, "); + sql.append(" ifin.CODIGO, "); + sql.append(" ifin.NOME ) tmp "); if (filtrarPendentes){ sql.append(" where "); sql.append(" tmp.saldo < tmp.vrdeposito and tmp.saldo <> 0"); diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioDepositosNovo.java b/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioDepositosNovo.java new file mode 100644 index 000000000..3cb8cdefe --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioDepositosNovo.java @@ -0,0 +1,171 @@ +package com.rjconsultores.ventaboletos.relatorios.impl; + +import java.math.BigDecimal; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.apache.log4j.Logger; + +import com.rjconsultores.ventaboletos.relatorios.utilitarios.DataSource; +import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio; +import com.rjconsultores.ventaboletos.relatorios.utilitarios.RelatorioDepositoBean; + +import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource; + +public class RelatorioDepositosNovo extends Relatorio { + + private static Logger log = Logger.getLogger(RelatorioDepositosNovo.class); + + private List lsDadosRelatorio; + + public RelatorioDepositosNovo(Map parametros, Connection conexao) { + super(parametros, conexao); + + try { + this.setCustomDataSource(new DataSource(this) { + @Override + public void initDados() throws Exception { + + Connection conexao = this.relatorio.getConexao(); + + Map parametros = this.relatorio.getParametros(); + + Integer puntoventaId = parametros.get("puntoventaId") != null ? Integer.parseInt(parametros.get("puntoventaId").toString()) : null; + Integer empresaId = parametros.get("empresaId") != null ? Integer.parseInt(parametros.get("empresaId").toString()) : null; + Boolean filtrarPendentes = parametros.get("filtrarPendentes") != null ? Boolean.parseBoolean(parametros.get("filtrarPendentes").toString()) : false; + String fecInicio = parametros.get("fecInicio").toString() + " 00:00:00"; + String fecFinal = parametros.get("fecFinal").toString() + " 23:59:59"; + + String sql = getSQL(puntoventaId, empresaId, filtrarPendentes); + + PreparedStatement stmt = conexao.prepareStatement(sql); + + ResultSet rs = null; + SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss"); + + stmt.setTimestamp(1, new java.sql.Timestamp(sdf.parse(fecInicio).getTime())); + stmt.setTimestamp(2, new java.sql.Timestamp(sdf.parse(fecFinal).getTime())); + + rs = stmt.executeQuery(); + + lsDadosRelatorio = new ArrayList(); + + while (rs.next()) { + + RelatorioDepositoBean deposito = new RelatorioDepositoBean(); + deposito.setNombempresa(rs.getString(1)); + deposito.setNombpuntoventa(rs.getString(2)); + deposito.setNumpuntoventa(rs.getString(3)); + deposito.setDtmotivo(rs.getDate(4)); + deposito.setSaldo(rs.getBigDecimal(5).multiply(BigDecimal.valueOf(-1))); + deposito.setVrdeposito(rs.getBigDecimal(6)); + deposito.setVrfechamento(rs.getBigDecimal(7)); + deposito.setNumdeposito(rs.getString(8)); + deposito.setCodigoInstFinanceira(rs.getString(9)); + deposito.setNomeInstFinanceira(rs.getString(10)); + + lsDadosRelatorio.add(deposito); + } + + if (lsDadosRelatorio.size() > 0) { + setLsDadosRelatorio(lsDadosRelatorio); + } + } + + }); + } catch (Exception e) { + log.error("", e); + } + } + + public void setLsDadosRelatorio(List lsDadosRelatorio) { + this.setCollectionDataSource(new JRBeanCollectionDataSource(lsDadosRelatorio)); + this.lsDadosRelatorio = lsDadosRelatorio; + } + + @Override + protected void processaParametros() throws Exception { + } + + private String getSQL(Integer puntoVentaId, Integer empresaId, boolean filtrarPendentes) { + + StringBuilder sql = new StringBuilder(); + + sql.append(" SELECT DISTINCT tmp.nombempresa, "); + sql.append(" tmp.nombpuntoventa, "); + sql.append(" tmp.numpuntoventa, "); + sql.append(" tmp.dtmotivo, "); + sql.append(" tmp.saldo, "); + sql.append(" tmp.vrfechamento, "); + sql.append(" tmp.vrdeposito, "); + sql.append(" tmp.numdeposito, "); + sql.append(" tmp.codinstfin, "); + sql.append(" tmp.nomeinstfin "); + sql.append(" FROM "); + sql.append(" ( SELECT DISTINCT e.nombempresa, "); + sql.append(" p.nombpuntoventa, "); + sql.append(" p.numpuntoventa, "); + sql.append(" f.fecfechamento AS dtmotivo, "); + sql.append(" ( SUM(NVL(fd.valor_pago,0)) - f.total ) AS saldo, "); + sql.append(" SUM(NVL(fd.valor_pago,0)) AS vrfechamento , "); + sql.append(" f.total AS vrdeposito, "); + sql.append(" f.FECHAMENTOCNTCORRENTE_ID, "); + sql.append(" fdp.NUMDEPOSITO as numdeposito, "); + sql.append(" ifin.CODIGO as codinstfin, "); + sql.append(" NVL(ifin.NOME,'') as nomeinstfin "); + sql.append(" FROM fechamento_cntcorrente f "); + sql.append(" LEFT JOIN punto_venta p "); + sql.append(" ON p.puntoventa_id = f.puntoventa_id "); + sql.append(" LEFT JOIN empresa e "); + sql.append(" ON e.empresa_id = f.empresa_id "); + sql.append(" LEFT JOIN fechamento_cct_deposito fd "); + sql.append(" ON fd.fechamentocntcorrente_id = f.fechamentocntcorrente_id "); + sql.append(" AND fd.activo = 1 "); + sql.append(" LEFT JOIN FECHAMENTO_DEPOSITO fdp "); + sql.append(" ON fdp.FECHAMENTODEPOSITO_ID = fd.FECHAMENTODEPOSITO_ID "); + sql.append(" AND fdp.activo = 1 "); + sql.append(" LEFT JOIN empresa_contabancaria ecb "); + sql.append(" ON ecb.EMPRESACONTABANCARIA_ID = fdp.EMPRESACONTABANCARIA_ID "); + sql.append(" AND ecb.activo = 1 "); + sql.append(" LEFT JOIN INSTI_FINANCEIRA ifin "); + sql.append(" ON ifin.INSTIFINANCEIRA_ID = ecb.INSTIFINANCEIRA_ID "); + sql.append(" AND ifin.activo = 1 "); + sql.append(" WHERE f.fecfechamento BETWEEN ? AND ? "); + sql.append(" AND f.activo = 1 "); + sql.append(" AND e.activo = 1 "); + sql.append(" AND p.activo = 1 "); + + if (puntoVentaId != null && puntoVentaId != -1){ + sql.append(" and f.puntoventa_id = " + puntoVentaId); + } + if (empresaId != null && empresaId != -1){ + sql.append(" and e.empresa_id = " + empresaId); + } + sql.append(" GROUP BY e.nombempresa, "); + sql.append(" p.nombpuntoventa, "); + sql.append(" p.numpuntoventa, "); + sql.append(" f.fecfechamento, "); + sql.append(" f.FECHAMENTOCNTCORRENTE_ID, "); + sql.append(" f.total, "); + sql.append(" fdp.NUMDEPOSITO, "); + sql.append(" ifin.CODIGO, "); + sql.append(" ifin.NOME ) tmp "); + + if (filtrarPendentes){ + sql.append(" where "); + sql.append(" tmp.saldo < tmp.vrdeposito and tmp.saldo <> 0 "); + } + sql.append(" ORDER BY tmp.nombempresa, "); + sql.append(" tmp.nomeinstfin, "); + sql.append(" tmp.nombpuntoventa, "); + sql.append(" tmp.dtmotivo, "); + sql.append(" tmp.vrdeposito "); + + return sql.toString(); + } +} diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioDepositosNovo_es.properties b/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioDepositosNovo_es.properties new file mode 100644 index 000000000..4bfe7f5f7 --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioDepositosNovo_es.properties @@ -0,0 +1,29 @@ +#geral +msg.noData=No se pudo obtener datos con los parámetros reportados. +msg.a=a + +#Labels header +header.data.hora=Data/Hora +header.pagina=Página +header.de= de +header.filtros=Filtros +header.banco=Banco +header.numdeposito=Nº Depósito +header.dataDeposito=Data +header.valorDeposito=Valor +header.empresa=Empresa: +header.data=Período: +header.agencia=Agência +header.dtmotivo=Data Fechamento +header.fechamento=Fechamento +header.saldo=Pendente +header.vrdeposito=Vr. Depósito +header.vrfechamento=Vr. Fechamento +header.usuario=Usuário +header.numdeposito=Num. Depósito +header.numeroAgencia=Número + +#Labels Footer +footer.totalBanco=Total por Banco +footer.totalEmpresa=Total por Empresa +footer.total=Total Geral \ No newline at end of file diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioDepositosNovo_pt_BR.properties b/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioDepositosNovo_pt_BR.properties new file mode 100644 index 000000000..deff2f084 --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioDepositosNovo_pt_BR.properties @@ -0,0 +1,29 @@ +#geral +msg.noData=Não foi possivel obter dados com os parâmetros informados. +msg.a=a + +#Labels header +header.data.hora=Data/Hora +header.pagina=Página +header.de= de +header.filtros=Filtros +header.banco=Banco +header.numdeposito=Nº Depósito +header.dataDeposito=Data +header.valorDeposito=Valor +header.empresa=Empresa: +header.data=Período: +header.agencia=Agência +header.dtmotivo=Data Fechamento +header.fechamento=Fechamento +header.saldo=Pendente +header.vrdeposito=Vr. Depósito +header.vrfechamento=Vr. Fechamento +header.usuario=Usuário +header.numdeposito=Num. Depósito +header.numeroAgencia=Número + +#Labels Footer +footer.totalBanco=Total por Banco +footer.totalEmpresa=Total por Empresa +footer.total=Total Geral \ No newline at end of file diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/Modelo.jrxml b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/Modelo.jrxml new file mode 100644 index 000000000..19dd166a7 --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/Modelo.jrxml @@ -0,0 +1,150 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <band height="56"> + <frame> + <reportElement mode="Opaque" x="-10" y="-12" width="595" height="40" backcolor="#006699" uuid="0054fd73-707a-4615-8bae-2c2a29f606b3"/> + <textField> + <reportElement x="10" y="10" width="575" height="24" forecolor="#FFFFFF" uuid="558af18f-0344-4d19-b3c8-3ae165b7c91d"/> + <textElement textAlignment="Justified" verticalAlignment="Middle" markup="styled"> + <font fontName="SansSerif" size="18" isBold="true" isPdfEmbedded="true"/> + </textElement> + <textFieldExpression><![CDATA[$P{TITULO}]]></textFieldExpression> + </textField> + </frame> + <textField isStretchWithOverflow="true" isBlankWhenNull="true"> + <reportElement stretchType="RelativeToTallestObject" x="65" y="42" width="510" height="14" forecolor="#333333" uuid="5dd823a7-3377-42a1-8e6f-977270e9bd79"/> + <textFieldExpression><![CDATA[$P{FILTROS}]]></textFieldExpression> + </textField> + <textField> + <reportElement x="65" y="28" width="510" height="14" forecolor="#000000" uuid="0840bea7-0cea-4e77-bb5d-969baeaf8a92"/> + <textElement> + <font size="10" isBold="true"/> + <paragraph lineSpacing="Single"/> + </textElement> + <textFieldExpression><![CDATA[$P{fecInicio} + " à " + $P{fecFinal}]]></textFieldExpression> + </textField> + <textField> + <reportElement x="0" y="28" width="65" height="14" forecolor="#000000" uuid="8fe00f0a-6663-4f7e-9324-666a3dc60f77"/> + <textElement> + <font size="10" isBold="true"/> + <paragraph lineSpacing="Single"/> + </textElement> + <textFieldExpression><![CDATA[$R{header.data}]]></textFieldExpression> + </textField> + <textField> + <reportElement x="0" y="42" width="65" height="14" forecolor="#000000" uuid="a448c17f-6960-4fb3-8a96-c964c5baabf1"/> + <textElement> + <font size="10" isBold="false"/> + <paragraph lineSpacing="Single"/> + </textElement> + <textFieldExpression><![CDATA[$R{header.filtros}]]></textFieldExpression> + </textField> + </band> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioAgenciaFechamento.jrxml b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioAgenciaFechamento.jrxml index 383f58c75..fe2003bd3 100644 --- a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioAgenciaFechamento.jrxml +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioAgenciaFechamento.jrxml @@ -80,14 +80,14 @@ - + - + @@ -96,15 +96,18 @@ - + - + - + + + + @@ -125,7 +128,7 @@ - + diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioDepositos.jrxml b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioDepositos.jrxml index 687835403..54f6162be 100644 --- a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioDepositos.jrxml +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioDepositos.jrxml @@ -2,7 +2,12 @@ - + + + + + + @@ -75,9 +80,9 @@ - + - + @@ -91,7 +96,7 @@ - + @@ -105,7 +110,7 @@ - + @@ -119,7 +124,7 @@ - + @@ -133,7 +138,7 @@ - + @@ -147,7 +152,7 @@ - + @@ -161,7 +166,7 @@ - + @@ -175,7 +180,7 @@ - + @@ -210,7 +215,7 @@ - + @@ -226,9 +231,9 @@ - + - + @@ -244,7 +249,7 @@ - + @@ -252,7 +257,7 @@ - + @@ -260,7 +265,7 @@ - + @@ -268,15 +273,15 @@ - + - + - + @@ -311,7 +316,7 @@ - + @@ -366,7 +371,7 @@ - + @@ -395,7 +400,7 @@ - + diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioDepositosNovo.jasper b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioDepositosNovo.jasper new file mode 100644 index 000000000..db8e371cf Binary files /dev/null and b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioDepositosNovo.jasper differ diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioDepositosNovo.jrxml b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioDepositosNovo.jrxml new file mode 100644 index 000000000..87cacb362 --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioDepositosNovo.jrxml @@ -0,0 +1,562 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <band height="56"> + <frame> + <reportElement mode="Opaque" x="-10" y="-12" width="595" height="40" backcolor="#006699" uuid="0054fd73-707a-4615-8bae-2c2a29f606b3"/> + <textField> + <reportElement x="10" y="10" width="575" height="24" forecolor="#FFFFFF" uuid="558af18f-0344-4d19-b3c8-3ae165b7c91d"/> + <textElement textAlignment="Justified" verticalAlignment="Middle" markup="styled"> + <font fontName="SansSerif" size="18" isBold="true" isPdfEmbedded="true"/> + </textElement> + <textFieldExpression><![CDATA[$P{TITULO}]]></textFieldExpression> + </textField> + </frame> + <textField isStretchWithOverflow="true" isBlankWhenNull="true"> + <reportElement stretchType="RelativeToTallestObject" x="52" y="42" width="523" height="14" forecolor="#333333" uuid="5dd823a7-3377-42a1-8e6f-977270e9bd79"/> + <textFieldExpression><![CDATA[$P{FILTROS}]]></textFieldExpression> + </textField> + <textField> + <reportElement x="52" y="28" width="523" height="14" forecolor="#000000" uuid="0840bea7-0cea-4e77-bb5d-969baeaf8a92"/> + <textElement> + <font size="10" isBold="true"/> + <paragraph lineSpacing="Single"/> + </textElement> + <textFieldExpression><![CDATA[$P{fecInicio} + " à " + $P{fecFinal}]]></textFieldExpression> + </textField> + <textField> + <reportElement x="0" y="28" width="52" height="14" forecolor="#000000" uuid="8fe00f0a-6663-4f7e-9324-666a3dc60f77"/> + <textElement> + <font size="10" isBold="true"/> + <paragraph lineSpacing="Single"/> + </textElement> + <textFieldExpression><![CDATA[$R{header.data}]]></textFieldExpression> + </textField> + <textField> + <reportElement x="0" y="42" width="52" height="14" forecolor="#000000" uuid="a448c17f-6960-4fb3-8a96-c964c5baabf1"/> + <textElement> + <font size="10" isBold="false"/> + <paragraph lineSpacing="Single"/> + </textElement> + <textFieldExpression><![CDATA[$R{header.filtros}]]></textFieldExpression> + </textField> + </band> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/contacorrente/RelatorioDepositosController.java b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/contacorrente/RelatorioDepositosController.java index 7366047ac..450869cbe 100644 --- a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/contacorrente/RelatorioDepositosController.java +++ b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/contacorrente/RelatorioDepositosController.java @@ -6,7 +6,6 @@ import java.util.Map; import javax.sql.DataSource; -import org.apache.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Controller; @@ -20,6 +19,7 @@ import org.zkoss.zul.api.Datebox; import com.rjconsultores.ventaboletos.entidad.Empresa; import com.rjconsultores.ventaboletos.entidad.PuntoVenta; import com.rjconsultores.ventaboletos.relatorios.impl.RelatorioDepositos; +import com.rjconsultores.ventaboletos.relatorios.impl.RelatorioDepositosNovo; import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio; import com.rjconsultores.ventaboletos.utilerias.DateUtil; import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer; @@ -29,7 +29,6 @@ import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer; public class RelatorioDepositosController extends MyGenericForwardComposer { private static final long serialVersionUID = 1L; - private static Logger log = Logger.getLogger(RelatorioDepositosController.class); @Autowired private DataSource dataSourceRead; @@ -44,26 +43,30 @@ public class RelatorioDepositosController extends MyGenericForwardComposer { private void executarRelatorio() throws Exception { Map parametros = new HashMap(); - + StringBuilder filtro = new StringBuilder(); - if (cmbPuntoventa.getSelectedIndex() != -1){ - parametros.put("puntoventaId", ((PuntoVenta)cmbPuntoventa.getSelectedItem().getValue()).getPuntoventaId()); + filtro.append("Empresa: "); + if (cmbEmpresa.getSelectedIndex() != -1){ + Empresa empresa = ((Empresa)cmbEmpresa.getSelectedItem().getValue()); + parametros.put("empresaId", empresa.getEmpresaId()); + filtro.append(empresa.getNombempresa() + ";"); + }else { + filtro.append(" Todas; "); } - if (cmbEmpresa.getSelectedIndex() != -1){ - parametros.put("empresaId", ((Empresa)cmbEmpresa.getSelectedItem().getValue()).getEmpresaId()); + filtro.append("Ponto de Venda: "); + if (cmbPuntoventa.getSelectedIndex() != -1){ + PuntoVenta puntoVenta = ((PuntoVenta)cmbPuntoventa.getSelectedItem().getValue()); + parametros.put("puntoventaId", puntoVenta.getPuntoventaId()); + filtro.append(puntoVenta.getNombpuntoventa() + ";"); + }else { + filtro.append(" Todos; "); } if (chkFiltrarPendentes.isChecked()){ parametros.put("filtrarPendentes", true); } - if (chkClassificarBanco.isChecked()) { - parametros.put("isClassificaPorBanco", true); - }else { - parametros.put("isClassificaPorBanco", false); - } - int dias = DateUtil.diferencaEntreDatasEmdias(this.datInicial.getValue(), this.datFinal.getValue()); // Período maior que 360 dias (1 ano), para não deixar um range de daods muito grande e não "travar" o relatório. if (dias > 360) { @@ -76,9 +79,18 @@ public class RelatorioDepositosController extends MyGenericForwardComposer { parametros.put("fecFinal", sdf.format(this.datFinal.getValue())); parametros.put("TITULO", Labels.getLabel("indexController.mniRelatorioDepositos.label")); + parametros.put("FILTROS", filtro.toString()); - Relatorio relatorio = new RelatorioDepositos(parametros, dataSourceRead.getConnection(), "RelatorioDepositos_subreport"); - + Relatorio relatorio = null; + if (chkClassificarBanco.isChecked()) { + parametros.put("isClassificaPorBanco", true); + relatorio = new RelatorioDepositosNovo(parametros, dataSourceRead.getConnection()); + }else { + parametros.put("isClassificaPorBanco", false); + relatorio = new RelatorioDepositos(parametros, dataSourceRead.getConnection(), "RelatorioDepositos_subreport"); + + } + Map args = new HashMap(); args.put("relatorio", relatorio); @@ -87,14 +99,6 @@ public class RelatorioDepositosController extends MyGenericForwardComposer { } - public void onClick$chkFiltrarPendentes() { - if (chkFiltrarPendentes.isChecked()) { - chkClassificarBanco.setDisabled(false); - } else { - chkClassificarBanco.setChecked(false); - chkClassificarBanco.setDisabled(true); - } - } public void onClick$btnExecutarRelatorio(Event ev) throws Exception { executarRelatorio(); diff --git a/web/gui/relatorios/filtroRelatorioDepositos.zul b/web/gui/relatorios/filtroRelatorioDepositos.zul index 9d2129812..f6c589a90 100644 --- a/web/gui/relatorios/filtroRelatorioDepositos.zul +++ b/web/gui/relatorios/filtroRelatorioDepositos.zul @@ -47,7 +47,7 @@