desenvolvimento relatorio (fixes bug 6116)

git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@42584 d1611594-4594-4d17-8e1d-87c2c4800839
master
lucas.taia 2015-03-27 14:18:52 +00:00
parent 90fc1445eb
commit e78c27ba3a
7 changed files with 391 additions and 128 deletions

View File

@ -5,14 +5,13 @@ import java.sql.Connection;
import java.sql.ResultSet;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang.math.NumberUtils;
import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource;
import org.apache.commons.lang.math.NumberUtils;
import com.rjconsultores.ventaboletos.relatorios.utilitarios.DataSource;
import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio;
import com.rjconsultores.ventaboletos.relatorios.utilitarios.RelatorioAgenciaFechamentoBean;
@ -36,59 +35,34 @@ public class RelatorioAgenciaFechamento extends Relatorio {
String fecInicio = parametros.get("fecInicio").toString() + " 00:00:00";
String fecFinal = parametros.get("fecFinal").toString() + " 23:59:59";
String empresa = parametros.get("empresa") != null ? parametros.get("empresa").toString() : "";
String empresaNome = parametros.get("empresaNome") != null ? parametros.get("empresaNome").toString() : "";
String puntoVenta = parametros.get("NUMPUNTOVENTA") != null ? parametros.get("NUMPUNTOVENTA").toString() : null;
String sql = carregaAgenciasComVenda();
String nomeEmpresa = null;
RelatorioAgenciaFechamentoBean agenciaFechamento = new RelatorioAgenciaFechamentoBean();
lsDadosRelatorio = new ArrayList<RelatorioAgenciaFechamentoBean>();
Boolean existeRegistro = Boolean.FALSE;
String sql = carregarDadosTotaisdeVenda(puntoVenta);
System.out.println(sql);
NamedParameterStatement stmt = new NamedParameterStatement(conexao, sql);
ResultSet rset = null;
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss");
stmt.setTimestamp("de", new java.sql.Timestamp(sdf.parse(fecInicio).getTime()));
stmt.setTimestamp("ate", new java.sql.Timestamp(sdf.parse(fecFinal).getTime()));
if (empresa != null && !empresa.equals("")){
stmt.setInt("empresaId", Integer.parseInt(empresa));
}
rset = stmt.executeQuery();
lsDadosRelatorio = new ArrayList<RelatorioAgenciaFechamentoBean>();
List<Integer> puntoVentas = new ArrayList<Integer>();
while (rset.next()) {
puntoVentas.add(rset.getInt("PUNTOVENTA_ID"));
}
stmt = new NamedParameterStatement(conexao, carregarNomeEmpresa());
if (empresa != null && !empresa.equals("")){
stmt.setInt("empresaId", Integer.parseInt(empresa));
}
rset = stmt.executeQuery();
while (rset.next()) {
nomeEmpresa = rset.getString("NOMBEMPRESA");
}
for (Iterator iterator = puntoVentas.iterator(); iterator.hasNext();) {
RelatorioAgenciaFechamentoBean agenciaFechamento = new RelatorioAgenciaFechamentoBean();
Boolean existeRegistro = Boolean.FALSE;
Integer integer = (Integer) iterator.next();
BigDecimal total = BigDecimal.ZERO;
BigDecimal vendido = BigDecimal.ZERO;
NamedParameterStatement stmt = new NamedParameterStatement(conexao, sql);
ResultSet rset = null;
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss");
stmt = new NamedParameterStatement(conexao, carregarDadosTotaisdeVenda());
stmt = new NamedParameterStatement(conexao, sql);
stmt.setTimestamp("de", new java.sql.Timestamp(sdf.parse(fecInicio).getTime()));
stmt.setTimestamp("ate", new java.sql.Timestamp(sdf.parse(fecFinal).getTime()));
stmt.setInt("puntoVentaId", integer);
if (empresa != null && !empresa.equals("")){
if (empresa != null && !empresa.equals("")) {
stmt.setInt("empresaId", Integer.parseInt(empresa));
}
System.out.println(carregarDadosTotaisdeVenda());
if (puntoVenta != null && !puntoVenta.equals("-1")) {
stmt.setString("puntoVentaId", puntoVenta);
}
rset = stmt.executeQuery();
@ -107,7 +81,7 @@ public class RelatorioAgenciaFechamento extends Relatorio {
BigDecimal anulado = rset.getBigDecimal("anulado");
BigDecimal devolvido = rset.getBigDecimal("devolvido");
agenciaFechamento.setEmpresa(nomeEmpresa);
agenciaFechamento.setEmpresa(empresaNome);
agenciaFechamento.setCodigo(rset.getString("codigo"));
agenciaFechamento.setDescricao(rset.getString("descricao"));
@ -117,8 +91,8 @@ public class RelatorioAgenciaFechamento extends Relatorio {
agenciaFechamento.setQtdeAnulado(qtdeAnulado != null ? qtdeAnulado : NumberUtils.INTEGER_ZERO);
agenciaFechamento.setQtdeDevolvido(qtdeDevolvido != null ? qtdeDevolvido : NumberUtils.INTEGER_ZERO);
qtdeTotal = ((qtdevendido != null ? qtdevendido : NumberUtils.INTEGER_ZERO)+(qtdedigitado != null ? qtdedigitado : NumberUtils.INTEGER_ZERO))
- ((qtdeAnulado != null ? qtdeAnulado : NumberUtils.INTEGER_ZERO)+(qtdeDevolvido != null ? qtdeDevolvido : NumberUtils.INTEGER_ZERO));
qtdeTotal = ((qtdevendido != null ? qtdevendido : NumberUtils.INTEGER_ZERO) + (qtdedigitado != null ? qtdedigitado : NumberUtils.INTEGER_ZERO))
- ((qtdeAnulado != null ? qtdeAnulado : NumberUtils.INTEGER_ZERO) + (qtdeDevolvido != null ? qtdeDevolvido : NumberUtils.INTEGER_ZERO));
agenciaFechamento.setQtdeTotal(qtdeTotal);
@ -133,15 +107,20 @@ public class RelatorioAgenciaFechamento extends Relatorio {
}
if(existeRegistro){
if (existeRegistro) {
stmt = new NamedParameterStatement(conexao, carregarDadosReceitaDespesa());
stmt = new NamedParameterStatement(conexao, carregarDadosReceitaDespesa(puntoVenta));
stmt.setTimestamp("de", new java.sql.Timestamp(sdf.parse(fecInicio).getTime()));
stmt.setTimestamp("ate", new java.sql.Timestamp(sdf.parse(fecFinal).getTime()));
stmt.setInt("puntoVentaId", integer);
if (empresa != null && !empresa.equals("")){
if (empresa != null && !empresa.equals("")) {
stmt.setInt("empresaId", Integer.parseInt(empresa));
}
if (puntoVenta != null && !puntoVenta.equals("-1")) {
stmt.setString("puntoVentaId", puntoVenta);
}
rset = stmt.executeQuery();
while (rset.next()) {
@ -168,12 +147,11 @@ public class RelatorioAgenciaFechamento extends Relatorio {
lsDadosRelatorio.add(agenciaFechamento);
}
}
if (lsDadosRelatorio.size() > 0) {
setLsDadosRelatorio(lsDadosRelatorio);
}
}
});
}
@ -187,7 +165,7 @@ public class RelatorioAgenciaFechamento extends Relatorio {
protected void processaParametros() throws Exception {
}
private String carregarDadosTotaisdeVenda() {
private String carregarDadosTotaisdeVenda(String puntoVenta) {
StringBuilder sql = new StringBuilder();
sql.append(" SELECT ");
@ -206,7 +184,9 @@ public class RelatorioAgenciaFechamento extends Relatorio {
sql.append(" INNER JOIN PUNTO_VENTA pv ON c.PUNTOVENTA_ID = pv.PUNTOVENTA_ID ");
sql.append(" WHERE c.TURNO_ID IS NOT NULL ");
sql.append(" AND c.FECCORTE BETWEEN :de AND :ate ");
if(puntoVenta != null && !puntoVenta.equals("-1")){
sql.append(" AND c.PUNTOVENTA_ID =:puntoVentaId ");
}
sql.append(" AND c.TIPOVENTA_ID <> 6 ");
sql.append(" AND ((c.EMPRESACORRIDA_ID IS NULL ) OR (c.EMPRESACORRIDA_ID IS NOT NULL AND c.EMPRESACORRIDA_ID = :empresaId )) ");
sql.append(" GROUP BY pv.PUNTOVENTA_ID , pv.nombpuntoventa ");
@ -228,7 +208,7 @@ public class RelatorioAgenciaFechamento extends Relatorio {
}
private String carregarDadosReceitaDespesa() {
private String carregarDadosReceitaDespesa(String puntoVenta) {
StringBuilder sql = new StringBuilder();
sql.append(" SELECT ");
@ -244,7 +224,9 @@ public class RelatorioAgenciaFechamento extends Relatorio {
sql.append(" AND ee.activo = 1 ");
sql.append(" AND cd.TURNO_ID IS NOT NULL ");
sql.append(" AND cd.FECCORTE BETWEEN :de AND :ate ");
if(puntoVenta != null && !puntoVenta.equals("-1")){
sql.append(" AND cd.PUNTOVENTA_ID = :puntoVentaId ");
}
sql.append(" AND ee.EMPRESA_ID=:empresaId ");
return sql.toString();
@ -262,7 +244,4 @@ public class RelatorioAgenciaFechamento extends Relatorio {
return sql.toString();
}
}

View File

@ -18,5 +18,6 @@ header.total=Total
detail.agencia=AGÊNCIA
detail.quantidade=QUANTIDADE
detail.valor=VALOR
detail.totalGeral=TOTAL GERAL
linhas=Linhas

View File

@ -18,5 +18,6 @@ header.total=Total
detail.agencia=AGÊNCIA
detail.quantidade=QUANTIDADE
detail.valor=VALOR
detail.totalGeral=TOTAL GERAL
linhas=Linhas

View File

@ -1,8 +1,8 @@
<?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="RelatorioAgenciaFechamento" pageWidth="842" pageHeight="595" orientation="Landscape" whenNoDataType="NoDataSection" columnWidth="802" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" whenResourceMissingType="Empty" uuid="94834362-0ecc-46da-b0a2-5cdee355da3e">
<property name="ireport.zoom" value="2.1961500000000007"/>
<property name="ireport.x" value="1013"/>
<property name="ireport.y" value="0"/>
<property name="ireport.x" value="503"/>
<property name="ireport.y" value="99"/>
<parameter name="fecInicio" class="java.lang.String">
<defaultValueExpression><![CDATA[]]></defaultValueExpression>
</parameter>
@ -27,6 +27,45 @@
<field name="despesa" class="java.math.BigDecimal"/>
<field name="total" class="java.math.BigDecimal"/>
<field name="qtdeTotal" class="java.lang.Integer"/>
<variable name="sum.qtdeVendido" class="java.lang.Integer" calculation="Sum">
<variableExpression><![CDATA[$F{qtdeVendido}]]></variableExpression>
</variable>
<variable name="sum.qtdeDigitado" class="java.lang.Integer" calculation="Sum">
<variableExpression><![CDATA[$F{qtdeDigitado}]]></variableExpression>
</variable>
<variable name="sum.qtdeAnulado" class="java.lang.Integer" calculation="Sum">
<variableExpression><![CDATA[$F{qtdeAnulado}]]></variableExpression>
</variable>
<variable name="sum.qtdeDespesa" class="java.lang.Integer" calculation="Sum">
<variableExpression><![CDATA[$F{qtdeDespesa}]]></variableExpression>
</variable>
<variable name="sum.qtdeDevolvido" class="java.lang.Integer" calculation="Sum">
<variableExpression><![CDATA[$F{qtdeDevolvido}]]></variableExpression>
</variable>
<variable name="sum.qtdeTotal" class="java.lang.Integer" calculation="Sum">
<variableExpression><![CDATA[$F{qtdeTotal}]]></variableExpression>
</variable>
<variable name="sum.vendido" class="java.math.BigDecimal" calculation="Sum">
<variableExpression><![CDATA[$F{vendido}]]></variableExpression>
</variable>
<variable name="sum.digitado" class="java.math.BigDecimal" calculation="Sum">
<variableExpression><![CDATA[$F{digitado}]]></variableExpression>
</variable>
<variable name="sum.anulado" class="java.math.BigDecimal" calculation="Sum">
<variableExpression><![CDATA[$F{anulado}]]></variableExpression>
</variable>
<variable name="sum.devolvido" class="java.math.BigDecimal" calculation="Sum">
<variableExpression><![CDATA[$F{devolvido}]]></variableExpression>
</variable>
<variable name="sum.receita" class="java.math.BigDecimal" calculation="Sum">
<variableExpression><![CDATA[$F{receita}]]></variableExpression>
</variable>
<variable name="sum.despesa" class="java.math.BigDecimal" calculation="Sum">
<variableExpression><![CDATA[$F{despesa}]]></variableExpression>
</variable>
<variable name="sum.total" class="java.math.BigDecimal" calculation="Sum">
<variableExpression><![CDATA[$F{total}]]></variableExpression>
</variable>
<background>
<band splitType="Stretch"/>
</background>
@ -88,14 +127,14 @@
<reportElement x="0" y="39" width="802" height="1" uuid="ee05e1fa-6963-4ff9-b3c8-c6cd1bb54e94"/>
</line>
<textField isBlankWhenNull="true">
<reportElement x="181" y="41" width="182" height="19" isPrintWhenDetailOverflows="true" uuid="2cbc8ddc-38e5-4914-8189-5761ddeb2ce9"/>
<reportElement x="25" y="41" width="182" height="19" isPrintWhenDetailOverflows="true" uuid="2cbc8ddc-38e5-4914-8189-5761ddeb2ce9"/>
<textElement textAlignment="Center" markup="none">
<font size="10" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$R{detail.agencia}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true">
<reportElement x="498" y="41" width="144" height="19" isPrintWhenDetailOverflows="true" uuid="7965e761-2e24-4f17-84eb-9431c98ce72c"/>
<reportElement x="301" y="41" width="144" height="19" isPrintWhenDetailOverflows="true" uuid="7965e761-2e24-4f17-84eb-9431c98ce72c"/>
<textElement textAlignment="Right" markup="none">
<font size="10" isBold="true"/>
</textElement>
@ -334,6 +373,112 @@
</textField>
</band>
</detail>
<columnFooter>
<band height="21">
<textField isBlankWhenNull="true">
<reportElement x="180" y="3" width="45" height="17" uuid="f9fc3c96-035d-4560-a6b7-4b1694a78d65"/>
<textElement textAlignment="Right">
<font size="8" isBold="false"/>
</textElement>
<textFieldExpression><![CDATA[$V{sum.qtdeVendido}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true">
<reportElement x="225" y="3" width="45" height="17" uuid="ce427a1a-d640-4060-85c9-690eacd95175"/>
<textElement textAlignment="Right">
<font size="8" isBold="false"/>
</textElement>
<textFieldExpression><![CDATA[$V{sum.qtdeDigitado}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true">
<reportElement x="270" y="3" width="45" height="17" uuid="b6810f0c-87c7-42c7-86c7-f011efd30571"/>
<textElement textAlignment="Right">
<font size="8" isBold="false"/>
</textElement>
<textFieldExpression><![CDATA[$V{sum.qtdeAnulado}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true">
<reportElement x="315" y="3" width="45" height="17" uuid="d37852e4-2683-4181-b336-20c1b9e923d7"/>
<textElement textAlignment="Right">
<font size="8" isBold="false"/>
</textElement>
<textFieldExpression><![CDATA[$V{sum.qtdeDespesa}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true">
<reportElement x="360" y="3" width="45" height="17" uuid="54b8507c-0d48-4f4c-860b-b1057ebbcc2c"/>
<textElement textAlignment="Right">
<font size="8" isBold="false"/>
</textElement>
<textFieldExpression><![CDATA[$V{sum.qtdeDevolvido}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true">
<reportElement x="405" y="3" width="45" height="17" uuid="63cd03cf-dfc9-4f36-a19f-e9dda994881b"/>
<textElement textAlignment="Right">
<font size="8" isBold="false"/>
</textElement>
<textFieldExpression><![CDATA[$V{sum.qtdeTotal}]]></textFieldExpression>
</textField>
<textField pattern="#,##0.00" isBlankWhenNull="true">
<reportElement mode="Transparent" x="450" y="3" width="48" height="17" forecolor="#000000" backcolor="#FFFFFF" uuid="00457524-e86e-4bb3-b1fe-4abe0b17f187"/>
<textElement textAlignment="Right" verticalAlignment="Top" rotation="None" markup="none">
<font fontName="SansSerif" size="8" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
<paragraph lineSpacing="Single"/>
</textElement>
<textFieldExpression><![CDATA[$V{sum.vendido}]]></textFieldExpression>
</textField>
<textField pattern="#,##0.00" isBlankWhenNull="true">
<reportElement x="498" y="3" width="48" height="17" uuid="e923470b-ac0e-43fa-a70b-1d9a98554d60"/>
<textElement textAlignment="Right">
<font size="8" isBold="false"/>
</textElement>
<textFieldExpression><![CDATA[$V{sum.digitado}]]></textFieldExpression>
</textField>
<textField pattern="#,##0.00" isBlankWhenNull="true">
<reportElement x="546" y="3" width="48" height="17" uuid="48f8733b-29be-4a8b-aecf-e064fcbc0a2b"/>
<textElement textAlignment="Right">
<font size="8" isBold="false"/>
</textElement>
<textFieldExpression><![CDATA[$V{sum.anulado}]]></textFieldExpression>
</textField>
<textField pattern="#,##0.00" isBlankWhenNull="true">
<reportElement x="594" y="3" width="48" height="17" uuid="0740115f-b366-459a-afd6-a08a277b248e"/>
<textElement textAlignment="Right">
<font size="8" isBold="false"/>
</textElement>
<textFieldExpression><![CDATA[$V{sum.devolvido}]]></textFieldExpression>
</textField>
<textField pattern="#,##0.00" isBlankWhenNull="true">
<reportElement x="642" y="3" width="48" height="17" uuid="fa77631c-b045-42d8-a192-091dae493739"/>
<textElement textAlignment="Right">
<font size="8" isBold="false"/>
</textElement>
<textFieldExpression><![CDATA[$V{sum.receita}]]></textFieldExpression>
</textField>
<textField pattern="#,##0.00" isBlankWhenNull="true">
<reportElement x="691" y="3" width="48" height="17" uuid="12b45f25-3417-4b90-95e5-1cbd1435030b"/>
<textElement textAlignment="Right">
<font size="8" isBold="false"/>
</textElement>
<textFieldExpression><![CDATA[$V{sum.despesa}]]></textFieldExpression>
</textField>
<textField pattern="#,##0.00" isBlankWhenNull="true">
<reportElement x="739" y="3" width="61" height="17" uuid="60cb5ef9-121c-4fb9-b425-7bc9b301d62d"/>
<textElement textAlignment="Right">
<font size="8" isBold="false"/>
</textElement>
<textFieldExpression><![CDATA[$V{sum.total}]]></textFieldExpression>
</textField>
<line>
<reportElement x="0" y="1" width="802" height="1" uuid="1653e342-87ec-40f2-94ad-5d27b1020c3a"/>
</line>
<textField>
<reportElement x="3" y="3" width="127" height="17" uuid="f0f7fc52-26be-4c51-8c78-3c55375be4aa"/>
<textElement textAlignment="Right" markup="none">
<font size="7"/>
</textElement>
<textFieldExpression><![CDATA[$R{detail.totalGeral}]]></textFieldExpression>
</textField>
</band>
</columnFooter>
<noData>
<band height="20">
<textField>

View File

@ -1,6 +1,8 @@
package com.rjconsultores.ventaboletos.web.gui.controladores.relatorios;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -12,17 +14,26 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.zkoss.util.resource.Labels;
import org.zkoss.zhtml.Messagebox;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zul.Bandbox;
import org.zkoss.zul.Datebox;
import org.zkoss.zul.Paging;
import com.rjconsultores.ventaboletos.entidad.Empresa;
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
import com.rjconsultores.ventaboletos.relatorios.impl.RelatorioAgenciaFechamento;
import com.rjconsultores.ventaboletos.relatorios.impl.RelatorioEmpresaCorrida;
import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio;
import com.rjconsultores.ventaboletos.service.EmpresaService;
import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEstandar;
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
import com.rjconsultores.ventaboletos.web.utilerias.MyTextbox;
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.HibernateSearchObject;
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.PagedListWrapper;
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderRelatorioVendasBilheteiro;
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderRelatorioVendasBilheteiroSelecionados;
@Controller("relatorioAgenciaFechamentoController")
@Scope("prototype")
@ -38,6 +49,13 @@ public class RelatorioAgenciaFechamentoController extends MyGenericForwardCompos
private Datebox datInicial;
private Datebox datFinal;
private MyComboboxEstandar cmbEmpresa;
private Bandbox bbPesquisaPuntoVenta;
@Autowired
private transient PagedListWrapper<PuntoVenta> plwPuntoVenta;
private MyTextbox txtNombrePuntoVenta;
private MyListbox puntoVentaList;
private MyListbox puntoVentaSelList;
private Paging pagingPuntoVenta;
private List<Empresa> lsEmpresas;
@ -52,9 +70,29 @@ public class RelatorioAgenciaFechamentoController extends MyGenericForwardCompos
parametros.put("fecFinal", sdf.format(this.datFinal.getValue()));
if (empresa != null){
parametros.put("empresa", empresa.getEmpresaId());
parametros.put("empresaNome", empresa.getNombempresa());
}
parametros.put("TITULO", Labels.getLabel("indexController.mniRelatorioAgenciaFechamento.label"));
String puntoVentaIds = "";
String puntoVentas = "";
List<PuntoVenta> lsPuntoVentaSelecionados = new ArrayList(Arrays.asList(puntoVentaSelList.getData()));
if (lsPuntoVentaSelecionados.isEmpty()) {
puntoVentas = "Todas";
} else {
for (int i = 0; i < lsPuntoVentaSelecionados.size(); i++) {
PuntoVenta puntoVenta = lsPuntoVentaSelecionados.get(i);
puntoVentas = puntoVentas + puntoVenta.getNombpuntoventa() + ",";
puntoVentaIds = puntoVentaIds + puntoVenta.getPuntoventaId() + ",";
}
// removendo ultima virgula
puntoVentaIds = puntoVentaIds.substring(0, puntoVentaIds.length() - 1);
puntoVentas = puntoVentas.substring(0, puntoVentas.length() - 1);
parametros.put("NUMPUNTOVENTA", puntoVentaIds);
}
Relatorio relatorio = new RelatorioAgenciaFechamento(parametros, dataSource.getConnection());
Map<String, Object> args = new HashMap<String, Object>();
@ -73,8 +111,54 @@ public class RelatorioAgenciaFechamentoController extends MyGenericForwardCompos
public void doAfterCompose(Component comp) throws Exception {
lsEmpresas = empresaService.obtenerTodos();
super.doAfterCompose(comp);
puntoVentaList.setItemRenderer(new RenderRelatorioVendasBilheteiro());
puntoVentaSelList.setItemRenderer(new RenderRelatorioVendasBilheteiroSelecionados());
}
private void executarPesquisa() {
HibernateSearchObject<PuntoVenta> puntoVentaBusqueda =
new HibernateSearchObject<PuntoVenta>(PuntoVenta.class, pagingPuntoVenta.getPageSize());
puntoVentaBusqueda.addFilterILike("nombpuntoventa", "%" + txtNombrePuntoVenta.getValue() + "%");
puntoVentaBusqueda.addFilterEqual("activo", Boolean.TRUE);
puntoVentaBusqueda.addSortAsc("nombpuntoventa");
puntoVentaBusqueda.addFilterEqual("activo", Boolean.TRUE);
plwPuntoVenta.init(puntoVentaBusqueda, puntoVentaList, pagingPuntoVenta);
if (puntoVentaList.getData().length == 0) {
try {
Messagebox.show(Labels.getLabel("MSG.ningunRegistro"),
Labels.getLabel("relatorioVendasBilheteiroController.window.title"),
Messagebox.OK, Messagebox.INFORMATION);
} catch (InterruptedException ex) {
}
}
}
public void onClick$btnPesquisa(Event ev) {
executarPesquisa();
}
public void onDoubleClick$puntoVentaSelList(Event ev) {
PuntoVenta puntoVenta = (PuntoVenta) puntoVentaSelList.getSelected();
puntoVentaSelList.removeItem(puntoVenta);
}
public void onDoubleClick$puntoVentaList(Event ev) {
PuntoVenta puntoVenta = (PuntoVenta) puntoVentaList.getSelected();
puntoVentaSelList.addItemNovo(puntoVenta);
}
public void onClick$btnLimpar(Event ev) {
puntoVentaList.setData(new ArrayList<PuntoVenta>());
bbPesquisaPuntoVenta.setText("");
}
public MyComboboxEstandar getCmbEmpresa() {
return cmbEmpresa;
}

View File

@ -7,7 +7,7 @@
<zk xmlns="http://www.zkoss.org/2005/zul">
<window id="winRelatorioAgenciaFechamento"
apply="${relatorioAgenciaFechamentoController}"
contentStyle="overflow:auto" height="125px" width="550px"
contentStyle="overflow:auto" height="250px" width="560px"
border="normal">
<grid fixedLayout="true">
@ -38,6 +38,59 @@
mold="rounded" buttonVisible="true"
width="70%" model="@{winRelatorioAgenciaFechamento$composer.lsEmpresas}"
constraint="no empty" />
<label
value="Agencia" />
<bandbox id="bbPesquisaPuntoVenta" width="100%"
mold="rounded" readonly="true">
<bandpopup>
<vbox>
<hbox>
<label
value="${c:l('relatorioVendasBilheteiroController.lbPuntoVenta.value')}" />
<textbox id="txtNombrePuntoVenta"
use="com.rjconsultores.ventaboletos.web.utilerias.MyTextbox"
width="300px" mold="rounded" />
<button id="btnPesquisa"
image="/gui/img/find.png"
label="${c:l('relatorioLinhaOperacionalController.btnPesquisa.label')}" />
<button id="btnLimpar"
image="/gui/img/eraser.png"
label="${c:l('relatorioLinhaOperacionalController.btnLimpar.label')}" />
</hbox>
<paging id="pagingPuntoVenta"
pageSize="10" />
<listbox id="puntoVentaList"
mold="paging"
use="com.rjconsultores.ventaboletos.web.utilerias.MyListbox"
vflex="true" height="100%" width="700px">
<listhead>
<listheader
label="${c:l('relatorioVendasBilheteiroController.lbPuntoVenta.value')}" />
<listheader width="35%"
label="${c:l('relatorioVendasBilheteiroController.lbEmpresa.value')}" />
<listheader width="20%"
label="${c:l('relatorioVendasBilheteiroController.lbNumero.value')}" />
</listhead>
</listbox>
</vbox>
</bandpopup>
</bandbox>
</row>
<row spans="4">
<listbox id="puntoVentaSelList" mold="paging"
use="com.rjconsultores.ventaboletos.web.utilerias.MyListbox"
vflex="true" height="100px" width="100%">
<listhead>
<listheader
label="${c:l('relatorioVendasBilheteiroController.lbPuntoVenta.value')}" />
<listheader width="35%"
label="${c:l('relatorioVendasBilheteiroController.lbEmpresa.value')}" />
<listheader width="20%"
label="${c:l('relatorioVendasBilheteiroController.lbNumero.value')}" />
<listheader width="5%" />
</listhead>
</listbox>
<paging id="pagingSelPuntoVenta" pageSize="10" />
</row>
</rows>
</grid>