wilian 2017-10-13 20:28:46 +00:00
parent 7755837a3d
commit b6101aee62
5 changed files with 42 additions and 11 deletions

View File

@ -2,7 +2,6 @@ package com.rjconsultores.ventaboletos.relatorios.impl;
import java.sql.Connection; import java.sql.Connection;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.Timestamp;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@ -30,8 +29,16 @@ public class RelatorioCancelamentoTransacao extends Relatorio {
Map<String, Object> parametros = this.relatorio.getParametros(); Map<String, Object> parametros = this.relatorio.getParametros();
NamedParameterStatement stmt = new NamedParameterStatement(conexao, getSql()); NamedParameterStatement stmt = new NamedParameterStatement(conexao, getSql());
stmt.setTimestamp("dataInicial", new Timestamp(DateUtil.inicioFecha((Date) parametros.get("DATA_INICIAL")).getTime())); stmt.setString("dataInicial", DateUtil.getStringDate( DateUtil.inicioFecha((Date) parametros.get("DATA_INICIAL")), "dd/MM/yyyy HH:mm"));
stmt.setTimestamp("dataFinal", new Timestamp(DateUtil.fimFecha((Date) parametros.get("DATA_FINAL")).getTime())); stmt.setString("dataFinal", DateUtil.getStringDate( DateUtil.fimFecha((Date) parametros.get("DATA_FINAL")), "dd/MM/yyyy HH:mm"));
if (parametros.get("EMPRESA_ID") != null) {
stmt.setInt("empresaId", Integer.valueOf(parametros.get("EMPRESA_ID").toString()));
}
if (parametros.get("PUNTOVENTA_ID") != null) {
stmt.setInt("puntoventaId", Integer.valueOf(parametros.get("PUNTOVENTA_ID").toString()));
}
ResultSet rset = stmt.executeQuery(); ResultSet rset = stmt.executeQuery();
@ -81,7 +88,7 @@ public class RelatorioCancelamentoTransacao extends Relatorio {
.append("INNER JOIN OCD OCD ON OCD.BOLETO_ID = B.BOLETO_ID ") .append("INNER JOIN OCD OCD ON OCD.BOLETO_ID = B.BOLETO_ID ")
.append("INNER JOIN MARCA M ON M.MARCA_ID = B.MARCA_ID ") .append("INNER JOIN MARCA M ON M.MARCA_ID = B.MARCA_ID ")
.append("INNER JOIN EMPRESA E ON E.EMPRESA_ID = M.EMPRESA_ID ") .append("INNER JOIN EMPRESA E ON E.EMPRESA_ID = M.EMPRESA_ID ")
.append("WHERE OCD.FECINC BETWEEN :dataInicial AND :dataFinal "); .append("WHERE OCD.FECINC BETWEEN TO_DATE(:dataInicial,'DD/MM/YYYY HH24:MI') AND TO_DATE(:dataFinal,'DD/MM/YYYY HH24:MI') ");
Constante constante = constanteService.buscarPorNomeConstante("PUNTO_VENTA_J3"); Constante constante = constanteService.buscarPorNomeConstante("PUNTO_VENTA_J3");
if(constante != null if(constante != null
@ -100,7 +107,11 @@ public class RelatorioCancelamentoTransacao extends Relatorio {
} }
if (parametros.get("EMPRESA_ID") != null) { if (parametros.get("EMPRESA_ID") != null) {
sql.append(" AND E.EMPRESA_ID = " + parametros.get("EMPRESA_ID")); sql.append(" AND E.EMPRESA_ID = :empresaId ");
}
if (parametros.get("PUNTOVENTA_ID") != null) {
sql.append(" AND B.PUNTOVENTA_ID = :puntoventaId");
} }
return sql.toString(); return sql.toString();

View File

@ -47,7 +47,7 @@
<textFieldExpression><![CDATA[$R{cabecalho.periodo}]]></textFieldExpression> <textFieldExpression><![CDATA[$R{cabecalho.periodo}]]></textFieldExpression>
</textField> </textField>
<textField pattern="" isBlankWhenNull="false"> <textField pattern="" isBlankWhenNull="false">
<reportElement mode="Transparent" x="116" y="42" width="10" height="15" forecolor="#000000" backcolor="#FFFFFF" uuid="8948c0fc-e878-45e2-8505-7934add98ab9"/> <reportElement mode="Transparent" x="118" y="42" width="10" height="15" forecolor="#000000" backcolor="#FFFFFF" uuid="8948c0fc-e878-45e2-8505-7934add98ab9"/>
<textElement textAlignment="Left" verticalAlignment="Top" rotation="None" markup="none"> <textElement textAlignment="Left" verticalAlignment="Top" rotation="None" markup="none">
<font fontName="SansSerif" size="9" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/> <font fontName="SansSerif" size="9" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
<paragraph lineSpacing="Single"/> <paragraph lineSpacing="Single"/>
@ -55,7 +55,7 @@
<textFieldExpression><![CDATA[$R{cabecalho.periodoA}]]></textFieldExpression> <textFieldExpression><![CDATA[$R{cabecalho.periodoA}]]></textFieldExpression>
</textField> </textField>
<textField pattern="dd/MM/yyyy" isBlankWhenNull="false"> <textField pattern="dd/MM/yyyy" isBlankWhenNull="false">
<reportElement mode="Transparent" x="46" y="42" width="62" height="15" forecolor="#000000" backcolor="#FFFFFF" uuid="7f1b9715-baaf-4e20-9a9d-a7ec4c696587"/> <reportElement mode="Transparent" x="46" y="42" width="68" height="15" forecolor="#000000" backcolor="#FFFFFF" uuid="7f1b9715-baaf-4e20-9a9d-a7ec4c696587"/>
<textElement textAlignment="Left" verticalAlignment="Top" rotation="None" markup="none"> <textElement textAlignment="Left" verticalAlignment="Top" rotation="None" markup="none">
<font fontName="SansSerif" size="9" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/> <font fontName="SansSerif" size="9" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
<paragraph lineSpacing="Single"/> <paragraph lineSpacing="Single"/>
@ -63,7 +63,7 @@
<textFieldExpression><![CDATA[$P{DATA_INICIAL}]]></textFieldExpression> <textFieldExpression><![CDATA[$P{DATA_INICIAL}]]></textFieldExpression>
</textField> </textField>
<textField pattern="dd/MM/yyyy" isBlankWhenNull="false"> <textField pattern="dd/MM/yyyy" isBlankWhenNull="false">
<reportElement mode="Transparent" x="132" y="42" width="62" height="15" forecolor="#000000" backcolor="#FFFFFF" uuid="64632058-9466-479c-ae28-0a11c9ed2c7f"/> <reportElement mode="Transparent" x="132" y="42" width="68" height="15" forecolor="#000000" backcolor="#FFFFFF" uuid="64632058-9466-479c-ae28-0a11c9ed2c7f"/>
<textElement textAlignment="Left" verticalAlignment="Top" rotation="None" markup="none"> <textElement textAlignment="Left" verticalAlignment="Top" rotation="None" markup="none">
<font fontName="SansSerif" size="9" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/> <font fontName="SansSerif" size="9" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
<paragraph lineSpacing="Single"/> <paragraph lineSpacing="Single"/>

View File

@ -25,8 +25,8 @@ import com.rjconsultores.ventaboletos.service.ConstanteService;
import com.rjconsultores.ventaboletos.service.EmpresaService; import com.rjconsultores.ventaboletos.service.EmpresaService;
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEstandar; import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEstandar;
import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxPuntoVenta;
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer; import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.PagedListWrapper;
@Controller("relatorioCancelamentoTransacaoController") @Controller("relatorioCancelamentoTransacaoController")
@Scope("prototype") @Scope("prototype")
@ -38,6 +38,7 @@ public class RelatorioCancelamentoTransacaoController extends MyGenericForwardCo
private Datebox datFinal; private Datebox datFinal;
private MyComboboxEstandar cmbEmpresa; private MyComboboxEstandar cmbEmpresa;
private List<Empresa> lsEmpresa; private List<Empresa> lsEmpresa;
private MyComboboxPuntoVenta cmbPuntoVenta;
@Autowired @Autowired
private EmpresaService empresaService; private EmpresaService empresaService;
@ -69,6 +70,8 @@ public class RelatorioCancelamentoTransacaoController extends MyGenericForwardCo
} }
} else } else
{ {
cmbPuntoVenta.getValue();
Relatorio relatorio; Relatorio relatorio;
Map<String, Object> parametros = new HashMap<String, Object>(); Map<String, Object> parametros = new HashMap<String, Object>();
@ -104,6 +107,16 @@ public class RelatorioCancelamentoTransacaoController extends MyGenericForwardCo
filtro.append(" Todas;"); filtro.append(" Todas;");
} }
filtro.append(" Agência: ");
Comboitem itemPuntoventa = cmbPuntoVenta.getSelectedItem();
if (itemPuntoventa != null) {
PuntoVenta puntoventa = (PuntoVenta) itemPuntoventa.getValue();
parametros.put("PUNTOVENTA_ID", puntoventa.getPuntoventaId());
filtro.append(puntoventa.getNombpuntoventa() + ";");
} else {
filtro.append("Todas;");
}
parametros.put("FILTROS", filtro.toString()); parametros.put("FILTROS", filtro.toString());
relatorio = new RelatorioCancelamentoTransacao(parametros, dataSourceRead.getConnection(), constanteService); relatorio = new RelatorioCancelamentoTransacao(parametros, dataSourceRead.getConnection(), constanteService);

View File

@ -7,7 +7,7 @@
<zk xmlns="http://www.zkoss.org/2005/zul"> <zk xmlns="http://www.zkoss.org/2005/zul">
<window id="winFiltroRelatorioCancelamentoTransacao" <window id="winFiltroRelatorioCancelamentoTransacao"
apply="${relatorioCancelamentoTransacaoController}" contentStyle="overflow:auto" apply="${relatorioCancelamentoTransacaoController}" contentStyle="overflow:auto"
height="125px" width="550px" border="normal"> height="161px" width="550px" border="normal">
<grid fixedLayout="true"> <grid fixedLayout="true">
<columns> <columns>
<column width="25%" /> <column width="25%" />
@ -38,6 +38,13 @@
model="@{winFiltroRelatorioCancelamentoTransacao$composer.lsEmpresa}" model="@{winFiltroRelatorioCancelamentoTransacao$composer.lsEmpresa}"
width="100%" /> width="100%" />
</row> </row>
<row spans="1,3">
<label
value="${c:l('indexController.mniPuntoVenta.label')}" />
<combobox id="cmbPuntoVenta"
use="com.rjconsultores.ventaboletos.web.utilerias.MyComboboxPuntoVenta"
mold="rounded" buttonVisible="true" width="90%" />
</row>
</rows> </rows>
</grid> </grid>
<toolbar> <toolbar>