fixed bug #7107 - Criação de relatório de depósitos detalhados.

git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@53019 d1611594-4594-4d17-8e1d-87c2c4800839
master
thiago 2016-02-17 20:22:17 +00:00
parent 91ae1fbe02
commit 251e2369f7
8 changed files with 131 additions and 68 deletions

View File

@ -33,6 +33,7 @@ public class RelatorioDepositosDetalhado extends Relatorio {
private Timestamp fecInicio;
private Timestamp fecFinal;
private Integer marcaId;
private Integer instFinanceira;
public RelatorioDepositosDetalhado(Map<String, Object> parametros, Connection conexao) throws Exception {
super(parametros, conexao);
@ -47,6 +48,9 @@ public class RelatorioDepositosDetalhado extends Relatorio {
if(parametros.get("MARCA_ID")!=null){
marcaId = Integer.valueOf(parametros.get("MARCA_ID").toString());
}
if(parametros.get("INST_FINANCEIRA")!=null){
instFinanceira = Integer.valueOf(parametros.get("INST_FINANCEIRA").toString());
}
Connection conexao = this.relatorio.getConexao();
processarDepositosDetalhados(conexao);
@ -95,6 +99,9 @@ public class RelatorioDepositosDetalhado extends Relatorio {
if(marcaId != null){
stmt.setInt("MARCA_ID", marcaId);
}
if(instFinanceira != null){
stmt.setInt("INST_FINANCEIRA", instFinanceira);
}
return stmt;
}
@ -118,73 +125,76 @@ public class RelatorioDepositosDetalhado extends Relatorio {
StringBuilder sQuery = new StringBuilder();
sQuery.append(" SELECT ");
sQuery.append(" E.NOMBEMPRESA Empresa, ");
sQuery.append(" PV.NOMBPUNTOVENTA Ponto_de_venda, ");
sQuery.append(" TO_CHAR(FD.FECHA_DEPOSITO,'dd/MM/yyyy') data_deposito, ");
sQuery.append(" FD.NUMDEPOSITO Numero_deposito, ");
sQuery.append(" TO_CHAR(FD.FECMODIF,'dd/MM/yyyy') DATA_LANCAMENTO_DEPOSITO, ");
sQuery.append(" if.NOME Banco, ");
sQuery.append(" EC.NUMCONTA Conta, ");
sQuery.append(" EC.NUMAGENCIA Agencia, ");
sQuery.append(" FD.VALOR valor_deposito ");
sQuery.append(" FROM ");
sQuery.append(" FECHAMENTO_DEPOSITO fd ");
sQuery.append(" JOIN FECHAMENTO_CCT_DEPOSITO fcd ");
sQuery.append(" ON ");
sQuery.append(" FCD.FECHAMENTODEPOSITO_ID = FD.FECHAMENTODEPOSITO_ID ");
sQuery.append(" JOIN FECHAMENTO_CNTCORRENTE fc ");
sQuery.append(" ON ");
sQuery.append(" FCD.FECHAMENTOCNTCORRENTE_ID = FC.FECHAMENTOCNTCORRENTE_ID ");
sQuery.append(" JOIN EMPRESA e ");
sQuery.append(" ON ");
sQuery.append(" E.EMPRESA_ID = FC.EMPRESA_ID ");
sQuery.append(" JOIN PUNTO_VENTA pv ");
sQuery.append(" ON ");
sQuery.append(" PV.PUNTOVENTA_ID = FC.PUNTOVENTA_ID ");
sQuery.append(" LEFT JOIN PTOVTA_EMPRESA pve ");
sQuery.append(" ON ");
sQuery.append(" PVE.EMPRESA_ID = e.empresa_id ");
sQuery.append(" AND PVE.PUNTOVENTA_ID = PV.PUNTOVENTA_ID ");
sQuery.append(" AND PVE.activo = 1 ");
sQuery.append(" LEFT OUTER JOIN EMPRESA_CONTABANCARIA ec ");
sQuery.append(" ON ");
sQuery.append(" EC.EMPRESA_ID = PVE.EMPRESA_ID ");
sQuery.append(" AND EC.EMPRESACONTABANCARIA_ID = PVE.EMPRESACONTABANCARIA_ID ");
sQuery.append(" AND EC.ACTIVO = 1 ");
sQuery.append(" LEFT JOIN INSTI_FINANCEIRA IF ");
sQuery.append(" ON ");
sQuery.append(" if.INSTIFINANCEIRA_ID = EC.INSTIFINANCEIRA_ID ");
sQuery.append(" WHERE ");
sQuery.append(" FD.ACTIVO = 1 ");
sQuery.append(" AND FCD.ACTIVO = 1 ");
sQuery.append(" AND FC.ACTIVO = 1 ");
sQuery.append(" AND E.ACTIVO = 1 ");
sQuery.append(" AND PV.ACTIVO = 1 ");
sQuery.append(" E.NOMBEMPRESA Empresa, ");
sQuery.append(" PV.NOMBPUNTOVENTA Ponto_de_venda, ");
sQuery.append(" TO_CHAR(FD.FECHA_DEPOSITO,'dd/MM/yyyy') data_deposito, ");
sQuery.append(" FD.NUMDEPOSITO Numero_deposito, ");
sQuery.append(" TO_CHAR(FD.FECMODIF,'dd/MM/yyyy') DATA_LANCAMENTO_DEPOSITO, ");
sQuery.append(" if.NOME Banco, ");
sQuery.append(" EC.NUMCONTA Conta, ");
sQuery.append(" EC.NUMAGENCIA Agencia, ");
sQuery.append(" FD.VALOR valor_deposito ");
sQuery.append(" FROM ");
sQuery.append(" FECHAMENTO_DEPOSITO fd ");
sQuery.append(" JOIN FECHAMENTO_CCT_DEPOSITO fcd ");
sQuery.append(" ON ");
sQuery.append(" FCD.FECHAMENTODEPOSITO_ID = FD.FECHAMENTODEPOSITO_ID ");
sQuery.append(" JOIN FECHAMENTO_CNTCORRENTE fc ");
sQuery.append(" ON ");
sQuery.append(" FCD.FECHAMENTOCNTCORRENTE_ID = FC.FECHAMENTOCNTCORRENTE_ID ");
sQuery.append(" JOIN EMPRESA e ");
sQuery.append(" ON ");
sQuery.append(" E.EMPRESA_ID = FC.EMPRESA_ID ");
sQuery.append(" JOIN PUNTO_VENTA pv ");
sQuery.append(" ON ");
sQuery.append(" PV.PUNTOVENTA_ID = FC.PUNTOVENTA_ID ");
sQuery.append(" JOIN INSTI_FINANCEIRA IF ");
sQuery.append(" ON ");
sQuery.append(" if.INSTIFINANCEIRA_ID = FD.INSTIFINANCEIRA_ID ");
sQuery.append(" JOIN EMPRESA_CONTABANCARIA ec ");
sQuery.append(" ON ");
sQuery.append(" EC.EMPRESA_ID = FC.EMPRESA_ID ");
sQuery.append(" AND EC.INSTIFINANCEIRA_ID = if.INSTIFINANCEIRA_ID ");
sQuery.append(" AND EC.ACTIVO = 1 ");
sQuery.append(" JOIN PTOVTA_EMPRESA pve ");
sQuery.append(" ON ");
sQuery.append(" PVE.EMPRESA_ID = e.empresa_id ");
sQuery.append(" AND PVE.PUNTOVENTA_ID = PV.PUNTOVENTA_ID ");
sQuery.append(" and EC.EMPRESACONTABANCARIA_ID = PVE.EMPRESACONTABANCARIA_ID ");
sQuery.append(" AND PVE.activo = 1 ");
sQuery.append(" WHERE ");
sQuery.append(" FD.ACTIVO = 1 ");
sQuery.append(" AND FCD.ACTIVO = 1 ");
sQuery.append(" AND FC.ACTIVO = 1 ");
sQuery.append(" AND E.ACTIVO = 1 ");
sQuery.append(" AND PV.ACTIVO = 1 ");
if(parametros.get("MARCA_ID")!= null){
sQuery.append(" and e.empresa_id =:MARCA_ID ");
sQuery.append(" and e.empresa_id =:MARCA_ID ");
}
if(parametros.get("INST_FINANCEIRA")!= null){
sQuery.append(" and if.INSTIFINANCEIRA_ID =:INST_FINANCEIRA ");
}
sQuery.append(" and FD.FECMODIF between :fecInicio and :fecFinal");
sQuery.append(" GROUP BY ");
sQuery.append(" E.NOMBEMPRESA, ");
sQuery.append(" PV.NOMBPUNTOVENTA, ");
sQuery.append(" FD.FECHA_DEPOSITO, ");
sQuery.append(" FD.NUMDEPOSITO, ");
sQuery.append(" FD.FECMODIF, ");
sQuery.append(" if.NOME, ");
sQuery.append(" EC.NUMCONTA, ");
sQuery.append(" EC.NUMAGENCIA, ");
sQuery.append(" FD.VALOR ");
sQuery.append(" ORDER BY ");
sQuery.append(" E.NOMBEMPRESA, ");
sQuery.append(" FD.FECHA_DEPOSITO, ");
sQuery.append(" FD.FECMODIF, ");
sQuery.append(" PV.NOMBPUNTOVENTA, ");
sQuery.append(" FD.NUMDEPOSITO, ");
sQuery.append(" if.NOME, ");
sQuery.append(" EC.NUMCONTA, ");
sQuery.append(" EC.NUMAGENCIA, ");
sQuery.append(" FD.VALOR ");
sQuery.append(" GROUP BY ");
sQuery.append(" E.NOMBEMPRESA, ");
sQuery.append(" PV.NOMBPUNTOVENTA, ");
sQuery.append(" FD.FECHA_DEPOSITO, ");
sQuery.append(" FD.NUMDEPOSITO, ");
sQuery.append(" FD.FECMODIF, ");
sQuery.append(" if.NOME, ");
sQuery.append(" EC.NUMCONTA, ");
sQuery.append(" EC.NUMAGENCIA, ");
sQuery.append(" FD.VALOR ");
sQuery.append(" ORDER BY ");
sQuery.append(" FD.FECHA_DEPOSITO, ");
sQuery.append(" FD.FECMODIF, ");
sQuery.append(" E.NOMBEMPRESA, ");
sQuery.append(" PV.NOMBPUNTOVENTA, ");
sQuery.append(" FD.NUMDEPOSITO, ");
sQuery.append(" if.NOME, ");
sQuery.append(" EC.NUMCONTA, ");
sQuery.append(" EC.NUMAGENCIA, ");
sQuery.append(" FD.VALOR ");
return sQuery.toString();
}

View File

@ -1,12 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="RelatorioVendasComissao" pageWidth="842" pageHeight="595" orientation="Landscape" whenNoDataType="NoDataSection" columnWidth="802" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="84b9dfcf-8ec5-4f51-80cc-7339e3b158b4">
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="131"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<parameter name="fecInicio" class="java.lang.String"/>
<parameter name="fecFinal" class="java.lang.String"/>
<parameter name="noDataRelatorio" class="java.lang.String"/>
<parameter name="empresa" class="java.lang.String"/>
<parameter name="banco" class="java.lang.String"/>
<queryString>
<![CDATA[]]>
</queryString>
@ -26,7 +27,7 @@
<band splitType="Stretch"/>
</background>
<title>
<band height="61" splitType="Stretch">
<band height="82" splitType="Stretch">
<textField>
<reportElement uuid="43b2c28d-4760-4890-b00d-25e931e79c74" x="0" y="0" width="620" height="20"/>
<textElement markup="none">
@ -58,6 +59,16 @@
<textElement/>
<text><![CDATA[Empresa:]]></text>
</staticText>
<textField>
<reportElement uuid="a0d7c1c5-7a17-477e-929a-b0d9665b409c" x="53" y="61" width="263" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$P{banco}]]></textFieldExpression>
</textField>
<staticText>
<reportElement uuid="2a1c0967-7154-4aa5-bc93-577d682a1e5a" x="0" y="61" width="53" height="20"/>
<textElement/>
<text><![CDATA[Banco:]]></text>
</staticText>
</band>
</title>
<pageHeader>

View File

@ -29,7 +29,6 @@ import com.rjconsultores.integracaoreceitadespesa.dao.Totalbus;
import com.rjconsultores.ventaboletos.entidad.Empresa;
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEmpresa;
import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxParada;
import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxPuntoVenta;
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
@ -124,7 +123,8 @@ public class RelatorioArquivoBGMController extends MyGenericForwardComposer {
origem.close();
saida.close();
} catch(IOException e) {
throw new IOException(e.getMessage());
log.error(e.getMessage());
throw new IOException(e.getMessage());
}
}

View File

@ -23,9 +23,11 @@ import org.zkoss.zul.Datebox;
import org.zkoss.zul.Messagebox;
import com.rjconsultores.ventaboletos.entidad.Empresa;
import com.rjconsultores.ventaboletos.entidad.InstiFinanceira;
import com.rjconsultores.ventaboletos.relatorios.impl.RelatorioDepositosDetalhado;
import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio;
import com.rjconsultores.ventaboletos.service.EmpresaService;
import com.rjconsultores.ventaboletos.service.InstiFinanceiraService;
import com.rjconsultores.ventaboletos.utilerias.DateUtil;
import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEstandar;
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
@ -46,8 +48,13 @@ private static final long serialVersionUID = 1L;
@Autowired
private EmpresaService empresaService;
@Autowired
private InstiFinanceiraService ptovtaBancoService;
private MyComboboxEstandar cmbEmpresa;
private List<Empresa> lsEmpresa;
private MyComboboxEstandar cmbBanco;
private List<InstiFinanceira> lsBanco;
private Datebox dataInicial;
private Datebox dataFinal;
@ -55,6 +62,7 @@ private static final long serialVersionUID = 1L;
@Override
public void doAfterCompose(Component comp) throws Exception {
setLsEmpresa(empresaService.obtenerTodos());
setLsBanco(ptovtaBancoService.obtenerTodos());
super.doAfterCompose(comp);
}
@ -63,6 +71,7 @@ private static final long serialVersionUID = 1L;
Date dataDe = dataInicial.getValue();
Date dataAte = dataFinal.getValue();
Timestamp fecVentaInicial = new Timestamp(DateUtil.inicioFecha(dataDe).getTime());
Timestamp fecVentaFinal = new Timestamp(DateUtil.fimFecha(dataAte).getTime());
@ -82,6 +91,7 @@ private static final long serialVersionUID = 1L;
parametros.put("dataFiltroFinal", fecVentaFinal);
Comboitem itemEmpresa = cmbEmpresa.getSelectedItem();
if (itemEmpresa != null) {
Empresa empresa = (Empresa) itemEmpresa.getValue();
parametros.put("MARCA_ID", empresa.getEmpresaId());
@ -89,6 +99,14 @@ private static final long serialVersionUID = 1L;
} else{
parametros.put("empresa", "Todas;");
}
Comboitem itemBanco = cmbBanco.getSelectedItem();
if (itemBanco != null) {
InstiFinanceira banco = (InstiFinanceira) itemBanco.getValue();
parametros.put("INST_FINANCEIRA", banco.getInstFinanceiraId());
parametros.put("banco", banco.getNome());
} else{
parametros.put("banco", "Todos;");
}
Relatorio relatorio = new RelatorioDepositosDetalhado(parametros, dataSourceRead.getConnection());
@ -113,4 +131,18 @@ private static final long serialVersionUID = 1L;
this.lsEmpresa = lsEmpresa;
}
/**
* @return the lsBanco
*/
public List<InstiFinanceira> getLsBanco() {
return lsBanco;
}
/**
* @param lsBanco the lsBanco to set
*/
public void setLsBanco(List<InstiFinanceira> lsBanco) {
this.lsBanco = lsBanco;
}
}

View File

@ -5931,6 +5931,9 @@ relatorioVendasComissaoController.lbEmpresa.value = Empresa
relatorioDepositosDetalhadosController.lbDataIni.value = Fecha Inicio
relatorioDepositosDetalhadosController.lbDataFin.value = Fecha Final
relatorioDepositosDetalhadosController.lbEmpresa.value = Empresa
relatorioDepositosDetalhadosController.lbBanco.value = Banco
relatorioDepositosDetalhadosController.window.title=Depositos Detallados
relatorioDepositosDetalhadosController.MSG.busquedaPeriodo = Fecha de inicio retrasado hasta la fecha final.
# Calculo Comissao
busquedaCalculoComissaoController.window.title = Cálculo de Comisión

View File

@ -6074,6 +6074,7 @@ relatorioVendasComissaoController.lbEmpresa.value = Empresa
relatorioDepositosDetalhadosController.lbDataIni.value = Data Início
relatorioDepositosDetalhadosController.lbDataFin.value = Data Final
relatorioDepositosDetalhadosController.lbEmpresa.value = Empresa
relatorioDepositosDetalhadosController.lbBanco.value = Banco
relatorioDepositosDetalhadosController.window.title=Depósitos Detalhados
relatorioDepositosDetalhadosController.MSG.busquedaPeriodo = Data de início posterior a data Final.

View File

@ -37,6 +37,12 @@
model="@{winFiltroRelatorioDepositosDetalhados$composer.lsEmpresa}"
width="95%" />
</row>
<row>
<label
value="${c:l('relatorioDepositosDetalhadosController.lbBanco.value')}" />
<combobox id="cmbBanco" use="com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEstandar"
width="95%" model="@{winFiltroRelatorioDepositosDetalhados$composer.lsBanco}" />
</row>
</rows>
</grid>
<toolbar>