CORREÇÕES - Relatório de Trecho Vendido Por Agência
git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@29522 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
20545734a0
commit
0656751020
|
@ -1,7 +1,10 @@
|
|||
package com.rjconsultores.ventaboletos.web.gui.controladores.relatorios;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.GregorianCalendar;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -13,7 +16,6 @@ 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;
|
||||
|
@ -39,6 +41,8 @@ import com.trg.search.Filter;
|
|||
public class RelatorioTrechoVendidoController extends MyGenericForwardComposer {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final String TODOS = "TODAS";
|
||||
private static final String TODOS_VALUE = new Integer(-1).toString();
|
||||
|
||||
private static Logger log = Logger.getLogger(RelatorioTrechoVendidoController.class);
|
||||
|
||||
|
@ -48,8 +52,7 @@ public class RelatorioTrechoVendidoController extends MyGenericForwardComposer {
|
|||
@Autowired
|
||||
private EmpresaService empresaService;
|
||||
|
||||
private ArrayList<String> lsNumPuntoVenta = new ArrayList<String>();
|
||||
private ArrayList<String> lsNumEmpresa = new ArrayList<String>();
|
||||
private ArrayList<PuntoVenta> lsNumPuntoVenta = new ArrayList<PuntoVenta>();
|
||||
|
||||
@Autowired
|
||||
private transient PagedListWrapper<PuntoVenta> plwPuntoVenta;
|
||||
|
@ -65,19 +68,56 @@ public class RelatorioTrechoVendidoController extends MyGenericForwardComposer {
|
|||
|
||||
private void executarRelatorio() throws Exception {
|
||||
|
||||
if (lsNumPuntoVenta.size() > 0) {
|
||||
Map<String, Object> parametros = new HashMap<String, Object>();
|
||||
parametros.put("DATA_INICIO", new java.sql.Date(((java.util.Date) this.datInicial.getValue()).getTime()));
|
||||
parametros.put("DATA_FINAL", new java.sql.Date(((java.util.Date) this.datFinal.getValue()).getTime()));
|
||||
|
||||
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());
|
||||
|
||||
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;
|
||||
|
||||
auxDataInicio.set(year, month, date, hourOfDay, minute, second);
|
||||
dataInicio = new Timestamp(auxDataInicio.getTimeInMillis());
|
||||
|
||||
GregorianCalendar auxDataFinal = (GregorianCalendar) GregorianCalendar.getInstance();
|
||||
auxDataFinal.setTimeInMillis(dataFinal.getTime());
|
||||
|
||||
hourOfDay = 23;
|
||||
minute = 59;
|
||||
second = 59;
|
||||
|
||||
auxDataFinal.set(year, month, date, hourOfDay, minute, second);
|
||||
dataFinal = new Timestamp(auxDataFinal.getTimeInMillis());
|
||||
}
|
||||
|
||||
parametros.put("DATA_INICIO", dataInicio);
|
||||
parametros.put("DATA_FINAL", dataFinal);
|
||||
|
||||
if (lsNumPuntoVenta.size() > 0) {
|
||||
Integer puntuVentaId = null;
|
||||
try {
|
||||
puntuVentaId = Integer.parseInt(lsNumPuntoVenta.iterator().next());
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
String puntoVentaExpression = null;
|
||||
for (PuntoVenta p : lsNumPuntoVenta) {
|
||||
if (lsNumPuntoVenta.indexOf(p) == 0) {
|
||||
puntoVentaExpression = p.getPuntoventaId().toString();
|
||||
} else {
|
||||
puntoVentaExpression += ", " + p.getPuntoventaId().toString();
|
||||
}
|
||||
parametros.put("PUNTOVENTA_ID", puntuVentaId);
|
||||
}
|
||||
System.out.println(puntoVentaExpression);
|
||||
parametros.put("PUNTOVENTA_ID", puntoVentaExpression);
|
||||
parametros.put("PUNTOVENTA", puntoVentaExpression);
|
||||
} else {
|
||||
parametros.put("PUNTOVENTA_ID", TODOS_VALUE);
|
||||
parametros.put("PUNTOVENTA", TODOS);
|
||||
}
|
||||
|
||||
String empresa = "";
|
||||
|
@ -106,14 +146,6 @@ public class RelatorioTrechoVendidoController extends MyGenericForwardComposer {
|
|||
|
||||
openWindow("/component/reportView.zul",
|
||||
Labels.getLabel("relatorioTrechoVendidoController.window.title"), args, MODAL);
|
||||
} else {
|
||||
try {
|
||||
Messagebox.show(Labels.getLabel("relatorioTrechoVendidoController.no.agencia"),
|
||||
Labels.getLabel("relatorioTrechoVendidoController.window.title"),
|
||||
Messagebox.OK, Messagebox.INFORMATION);
|
||||
} catch (InterruptedException ex) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onSelect$puntoVentaList(Event ev) {
|
||||
|
@ -124,7 +156,7 @@ public class RelatorioTrechoVendidoController extends MyGenericForwardComposer {
|
|||
lsNumPuntoVenta.clear();
|
||||
for (Object objPuntoVenta : lsSelecionados) {
|
||||
strListPuntoVenta = ((PuntoVenta) objPuntoVenta).getNombpuntoventa() + " " + strListPuntoVenta;
|
||||
lsNumPuntoVenta.add(((PuntoVenta) objPuntoVenta).getPuntoventaId().toString());
|
||||
lsNumPuntoVenta.add(((PuntoVenta) objPuntoVenta));
|
||||
}
|
||||
this.bbPesquisaPuntoVenta.setValue(strListPuntoVenta);
|
||||
}
|
||||
|
@ -161,14 +193,14 @@ 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("relatorioTrechoVendidoController.window.title"),
|
||||
// Messagebox.OK, Messagebox.INFORMATION);
|
||||
// } catch (InterruptedException ex) {
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -186,22 +218,6 @@ public class RelatorioTrechoVendidoController extends MyGenericForwardComposer {
|
|||
this.dataSource = dataSource;
|
||||
}
|
||||
|
||||
public ArrayList<String> getLsNumPuntoVenta() {
|
||||
return lsNumPuntoVenta;
|
||||
}
|
||||
|
||||
public void setLsNumPuntoVenta(ArrayList<String> lsNumPuntoVenta) {
|
||||
this.lsNumPuntoVenta = lsNumPuntoVenta;
|
||||
}
|
||||
|
||||
public ArrayList<String> getLsNumEmpresa() {
|
||||
return lsNumEmpresa;
|
||||
}
|
||||
|
||||
public void setLsNumEmpresa(ArrayList<String> lsNumEmpresa) {
|
||||
this.lsNumEmpresa = lsNumEmpresa;
|
||||
}
|
||||
|
||||
public List<Empresa> getLsEmpresa() {
|
||||
return lsEmpresa;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue