From 5bcf2cee74d15888ed8dfbb9db15ae2b90208c28 Mon Sep 17 00:00:00 2001 From: julio Date: Tue, 30 Jul 2013 19:02:01 +0000 Subject: [PATCH] =?UTF-8?q?CORRE=C3=87=C3=95ES=20RELATORIO=20TRECHO=20VEND?= =?UTF-8?q?IDO?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@29586 d1611594-4594-4d17-8e1d-87c2c4800839 --- .../RelatorioTrechoVendidoController.java | 89 +++++++++++-------- 1 file changed, 51 insertions(+), 38 deletions(-) diff --git a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioTrechoVendidoController.java b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioTrechoVendidoController.java index 50aff0866..d9ff56326 100644 --- a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioTrechoVendidoController.java +++ b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioTrechoVendidoController.java @@ -2,6 +2,7 @@ package com.rjconsultores.ventaboletos.web.gui.controladores.relatorios; import java.sql.Timestamp; import java.util.ArrayList; +import java.util.Arrays; import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; @@ -16,6 +17,7 @@ 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; @@ -63,6 +65,8 @@ public class RelatorioTrechoVendidoController extends MyGenericForwardComposer { private Datebox datInicial; private Datebox datFinal; + private MyListbox puntoVentaSelList; + private Combobox cmbEmpresa; private List lsEmpresa; @@ -73,36 +77,39 @@ public class RelatorioTrechoVendidoController extends MyGenericForwardComposer { Timestamp dataInicio = new Timestamp(((java.util.Date) this.datInicial.getValue()).getTime()); Timestamp dataFinal = new Timestamp(((java.util.Date) this.datFinal.getValue()).getTime()); - if (dataInicio.equals(dataFinal)) { + GregorianCalendar auxDataInicio = (GregorianCalendar) GregorianCalendar.getInstance(); + auxDataInicio.setTimeInMillis(dataInicio.getTime()); - GregorianCalendar auxDataInicio = (GregorianCalendar) GregorianCalendar.getInstance(); - auxDataInicio.setTimeInMillis(dataInicio.getTime()); + int year = auxDataInicio.get(Calendar.YEAR); + int month = auxDataInicio.get(Calendar.MONTH); + int date = auxDataInicio.get(Calendar.DATE); - int year = auxDataInicio.get(Calendar.YEAR); - int month = auxDataInicio.get(Calendar.MONTH); - int date = auxDataInicio.get(Calendar.DATE); + int hourOfDay = 00; + int minute = 00; + int second = 00; - int hourOfDay = 00; - int minute = 00; - int second = 00; + auxDataInicio.set(year, month, date, hourOfDay, minute, second); + dataInicio = new Timestamp(auxDataInicio.getTimeInMillis()); - auxDataInicio.set(year, month, date, hourOfDay, minute, second); - dataInicio = new Timestamp(auxDataInicio.getTimeInMillis()); + GregorianCalendar auxDataFinal = (GregorianCalendar) GregorianCalendar.getInstance(); + auxDataFinal.setTimeInMillis(dataFinal.getTime()); - GregorianCalendar auxDataFinal = (GregorianCalendar) GregorianCalendar.getInstance(); - auxDataFinal.setTimeInMillis(dataFinal.getTime()); + year = auxDataFinal.get(Calendar.YEAR); + month = auxDataFinal.get(Calendar.MONTH); + date = auxDataFinal.get(Calendar.DATE); - hourOfDay = 23; - minute = 59; - second = 59; + hourOfDay = 23; + minute = 59; + second = 59; - auxDataFinal.set(year, month, date, hourOfDay, minute, second); - dataFinal = new Timestamp(auxDataFinal.getTimeInMillis()); - } + auxDataFinal.set(year, month, date, hourOfDay, minute, second); + dataFinal = new Timestamp(auxDataFinal.getTimeInMillis()); parametros.put("DATA_INICIO", dataInicio); parametros.put("DATA_FINAL", dataFinal); + lsNumPuntoVenta = new ArrayList(Arrays.asList(puntoVentaSelList.getData())); + if (lsNumPuntoVenta.size() > 0) { String puntoVentaExpression = null; for (PuntoVenta p : lsNumPuntoVenta) { @@ -112,7 +119,6 @@ public class RelatorioTrechoVendidoController extends MyGenericForwardComposer { puntoVentaExpression += ", " + p.getPuntoventaId().toString(); } } - System.out.println(puntoVentaExpression); parametros.put("PUNTOVENTA_ID", puntoVentaExpression); parametros.put("PUNTOVENTA", puntoVentaExpression); } else { @@ -148,17 +154,22 @@ public class RelatorioTrechoVendidoController extends MyGenericForwardComposer { Labels.getLabel("relatorioTrechoVendidoController.window.title"), args, MODAL); } + public void onDoubleClick$puntoVentaList(Event ev) { + + PuntoVenta puntoVentaSel = (PuntoVenta) puntoVentaList.getSelected(); + puntoVentaSelList.addItemNovo(puntoVentaSel); + + } + + public void onDoubleClick$puntoVentaSelList(Event ev) { + + PuntoVenta puntoVentaSel = (PuntoVenta) puntoVentaSelList.getSelected(); + puntoVentaSelList.removeItem(puntoVentaSel); + + } + public void onSelect$puntoVentaList(Event ev) { - String strListPuntoVenta = new String(); - ArrayList lsSelecionados = (ArrayList) puntoVentaList.getSelectedsItens(); - - lsNumPuntoVenta.clear(); - for (Object objPuntoVenta : lsSelecionados) { - strListPuntoVenta = ((PuntoVenta) objPuntoVenta).getNombpuntoventa() + " " + strListPuntoVenta; - lsNumPuntoVenta.add(((PuntoVenta) objPuntoVenta)); - } - this.bbPesquisaPuntoVenta.setValue(strListPuntoVenta); } public void onClick$btnLimpar(Event ev) { @@ -193,21 +204,23 @@ public class RelatorioTrechoVendidoController extends MyGenericForwardComposer { plwPuntoVenta.init(puntoVentaBusqueda, puntoVentaList, pagingPuntoVenta); - // if (puntoVentaList.getData().length == 0) { - // try { - // Messagebox.show(Labels.getLabel("MSG.ningunRegistro"), - // Labels.getLabel("relatorioTrechoVendidoController.window.title"), - // Messagebox.OK, Messagebox.INFORMATION); - // } catch (InterruptedException ex) { - // } - // } + if (puntoVentaList.getData().length == 0) { + try { + Messagebox.show(Labels.getLabel("MSG.ningunRegistro"), + Labels.getLabel("relatorioReceitaDiariaAgenciaController.window.title"), + Messagebox.OK, Messagebox.INFORMATION); + } catch (InterruptedException ex) { + } + } } @Override public void doAfterCompose(Component comp) throws Exception { super.doAfterCompose(comp); - puntoVentaList.setItemRenderer(new RenderPuntoVentaSimple()); lsEmpresa = empresaService.obtenerTodos(); + + puntoVentaList.setItemRenderer(new RenderPuntoVentaSimple()); + puntoVentaSelList.setItemRenderer(new RenderPuntoVentaSimple()); } public DataSource getDataSource() {