fixes bug#14017
dev:lucas qua: git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@92962 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
33ce1754ec
commit
0e68eb10fb
|
@ -28,6 +28,7 @@ public class RelatorioVendasRequisicao extends Relatorio {
|
||||||
private Timestamp fecFinal;
|
private Timestamp fecFinal;
|
||||||
private Integer empresaId;
|
private Integer empresaId;
|
||||||
private Integer puntoventaId;
|
private Integer puntoventaId;
|
||||||
|
private Integer secretariaId;
|
||||||
|
|
||||||
public RelatorioVendasRequisicao(Map<String, Object> parametros, Connection conexao) throws Exception {
|
public RelatorioVendasRequisicao(Map<String, Object> parametros, Connection conexao) throws Exception {
|
||||||
super(parametros, conexao);
|
super(parametros, conexao);
|
||||||
|
@ -45,6 +46,9 @@ public class RelatorioVendasRequisicao extends Relatorio {
|
||||||
if(parametros.get("PUNTOVENTA_ID")!=null){
|
if(parametros.get("PUNTOVENTA_ID")!=null){
|
||||||
puntoventaId = Integer.valueOf(parametros.get("PUNTOVENTA_ID").toString());
|
puntoventaId = Integer.valueOf(parametros.get("PUNTOVENTA_ID").toString());
|
||||||
}
|
}
|
||||||
|
if(parametros.get("SECRETARIA_ID")!=null){
|
||||||
|
secretariaId = Integer.valueOf(parametros.get("SECRETARIA_ID").toString());
|
||||||
|
}
|
||||||
|
|
||||||
Connection conexao = this.relatorio.getConexao();
|
Connection conexao = this.relatorio.getConexao();
|
||||||
processarVendasRequisicao(conexao);
|
processarVendasRequisicao(conexao);
|
||||||
|
@ -132,6 +136,9 @@ public class RelatorioVendasRequisicao extends Relatorio {
|
||||||
if(puntoventaId != null && puntoventaId > -1) {
|
if(puntoventaId != null && puntoventaId > -1) {
|
||||||
stmt.setInt("PUNTOVENTA_ID", puntoventaId);
|
stmt.setInt("PUNTOVENTA_ID", puntoventaId);
|
||||||
}
|
}
|
||||||
|
if(secretariaId != null && secretariaId > -1) {
|
||||||
|
stmt.setInt("SECRETARIA_ID", secretariaId);
|
||||||
|
}
|
||||||
|
|
||||||
return stmt;
|
return stmt;
|
||||||
}
|
}
|
||||||
|
@ -164,6 +171,9 @@ public class RelatorioVendasRequisicao extends Relatorio {
|
||||||
if(puntoventaId != null && puntoventaId > -1) {
|
if(puntoventaId != null && puntoventaId > -1) {
|
||||||
sQuery.append("AND C.PUNTOVENTA_ID = :PUNTOVENTA_ID ");
|
sQuery.append("AND C.PUNTOVENTA_ID = :PUNTOVENTA_ID ");
|
||||||
}
|
}
|
||||||
|
if(secretariaId != null && secretariaId > -1) {
|
||||||
|
sQuery.append("AND SEC.SECRETARIA_ID = :SECRETARIA_ID ");
|
||||||
|
}
|
||||||
|
|
||||||
sQuery.append("GROUP BY CDP.NUMDOCUMENTO, SEC.CVESECRETARIA, SEC.DESCSECRETARIA,PV.NOMBPUNTOVENTA, PV.NOMBPUNTOVENTA, E.NOMBEMPRESA, E.EMPRESA_ID, FP.DESCPAGO, CFP.FORMAPAGO_ID, ORI.DESCPARADA, DES.DESCPARADA, CFP.IMPORTE, ORI.CVEPARADA, DES.CVEPARADA, PV.PUNTOVENTA_ID ")
|
sQuery.append("GROUP BY CDP.NUMDOCUMENTO, SEC.CVESECRETARIA, SEC.DESCSECRETARIA,PV.NOMBPUNTOVENTA, PV.NOMBPUNTOVENTA, E.NOMBEMPRESA, E.EMPRESA_ID, FP.DESCPAGO, CFP.FORMAPAGO_ID, ORI.DESCPARADA, DES.DESCPARADA, CFP.IMPORTE, ORI.CVEPARADA, DES.CVEPARADA, PV.PUNTOVENTA_ID ")
|
||||||
.append("ORDER BY SEC.DESCSECRETARIA, PV.NOMBPUNTOVENTA, FP.DESCPAGO");
|
.append("ORDER BY SEC.DESCSECRETARIA, PV.NOMBPUNTOVENTA, FP.DESCPAGO");
|
||||||
|
|
|
@ -21,13 +21,14 @@ import org.zkoss.zul.Datebox;
|
||||||
|
|
||||||
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
||||||
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
|
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
|
||||||
import com.rjconsultores.ventaboletos.relatorios.impl.RelatorioVendasConexao;
|
import com.rjconsultores.ventaboletos.entidad.Secretaria;
|
||||||
import com.rjconsultores.ventaboletos.relatorios.impl.RelatorioVendasRequisicao;
|
import com.rjconsultores.ventaboletos.relatorios.impl.RelatorioVendasRequisicao;
|
||||||
import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio;
|
import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio;
|
||||||
import com.rjconsultores.ventaboletos.utilerias.DateUtil;
|
import com.rjconsultores.ventaboletos.utilerias.DateUtil;
|
||||||
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.MyComboboxPuntoVenta;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxSecretaria;
|
||||||
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||||
|
|
||||||
@Controller("relatorioVendasRequisicaoController")
|
@Controller("relatorioVendasRequisicaoController")
|
||||||
|
@ -46,6 +47,7 @@ public class RelatorioVendasRequisicaoController extends MyGenericForwardCompose
|
||||||
private Datebox dataFinal;
|
private Datebox dataFinal;
|
||||||
|
|
||||||
private MyComboboxPuntoVenta cmbPuntoVenta;
|
private MyComboboxPuntoVenta cmbPuntoVenta;
|
||||||
|
private MyComboboxSecretaria cmbSecretaria;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doAfterCompose(Component comp) throws Exception {
|
public void doAfterCompose(Component comp) throws Exception {
|
||||||
|
@ -96,6 +98,19 @@ public class RelatorioVendasRequisicaoController extends MyGenericForwardCompose
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Comboitem itemSecretaria = cmbSecretaria.getSelectedItem();
|
||||||
|
if(itemSecretaria != null) {
|
||||||
|
Secretaria secretaria = (Secretaria) itemSecretaria.getValue();
|
||||||
|
if(secretaria.getSecretariaId() > -1) {
|
||||||
|
parametros.put("SECRETARIA_ID", secretaria.getSecretariaId());
|
||||||
|
parametros.put("secretaria", secretaria.getDescsecretaria());
|
||||||
|
} else {
|
||||||
|
parametros.put("secretaria", "Todas;");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
parametros.put("secretaria", "Todas;");
|
||||||
|
}
|
||||||
|
|
||||||
Map<String, Object> args = new HashMap<String, Object>();
|
Map<String, Object> args = new HashMap<String, Object>();
|
||||||
Relatorio relatorio = new RelatorioVendasRequisicao(parametros, dataSourceRead.getConnection());
|
Relatorio relatorio = new RelatorioVendasRequisicao(parametros, dataSourceRead.getConnection());
|
||||||
args.put("relatorio", relatorio);
|
args.put("relatorio", relatorio);
|
||||||
|
|
|
@ -0,0 +1,131 @@
|
||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.rjconsultores.ventaboletos.web.utilerias;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.zkoss.util.resource.Labels;
|
||||||
|
import org.zkoss.zk.ui.WrongValueException;
|
||||||
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
import org.zkoss.zk.ui.event.EventListener;
|
||||||
|
import org.zkoss.zk.ui.event.InputEvent;
|
||||||
|
import org.zkoss.zkplus.databind.BindingListModel;
|
||||||
|
import org.zkoss.zkplus.databind.BindingListModelList;
|
||||||
|
import org.zkoss.zkplus.spring.SpringUtil;
|
||||||
|
import org.zkoss.zul.Combobox;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Secretaria;
|
||||||
|
import com.rjconsultores.ventaboletos.service.SecretariaService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Lucas
|
||||||
|
*/
|
||||||
|
public class MyComboboxSecretaria extends Combobox {
|
||||||
|
|
||||||
|
private SecretariaService secretariaService;
|
||||||
|
private List<Secretaria> lsSecretaria;
|
||||||
|
private Secretaria initialValue;
|
||||||
|
private Integer indiceSelected = null;
|
||||||
|
private boolean sinTodos = false;
|
||||||
|
|
||||||
|
public MyComboboxSecretaria() {
|
||||||
|
super();
|
||||||
|
|
||||||
|
secretariaService = (SecretariaService) SpringUtil.getBean("secretariaService");
|
||||||
|
lsSecretaria = new ArrayList<Secretaria>();
|
||||||
|
|
||||||
|
this.setAutodrop(false);
|
||||||
|
this.setAutocomplete(false);
|
||||||
|
|
||||||
|
|
||||||
|
this.addEventListener("onOK", new EventListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEvent(Event event) throws Exception {
|
||||||
|
String strSecretaria = MyComboboxSecretaria.this.getText().toUpperCase();
|
||||||
|
if (strSecretaria.length() < MyComboboxParada.minLength) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!strSecretaria.isEmpty()) {
|
||||||
|
lsSecretaria = secretariaService.buscaLike(strSecretaria);
|
||||||
|
|
||||||
|
BindingListModel listModelSecretaria = new BindingListModelList(lsSecretaria, true);
|
||||||
|
MyComboboxSecretaria.this.setModel(listModelSecretaria);
|
||||||
|
indiceSelected = null;
|
||||||
|
if (!lsSecretaria.isEmpty()) {
|
||||||
|
indiceSelected = 0;
|
||||||
|
}
|
||||||
|
MyComboboxSecretaria.this.open();
|
||||||
|
} else {
|
||||||
|
lsSecretaria.clear();
|
||||||
|
|
||||||
|
BindingListModel listModelPuntoVenta = new BindingListModelList(lsSecretaria, true);
|
||||||
|
MyComboboxSecretaria.this.setModel(listModelPuntoVenta);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.addEventListener("onChanging", new EventListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEvent(Event event) throws Exception {
|
||||||
|
InputEvent ev = (InputEvent) event;
|
||||||
|
String strSecretaria = ev.getValue();
|
||||||
|
if (strSecretaria.length() < 2) {
|
||||||
|
lsSecretaria.clear();
|
||||||
|
|
||||||
|
BindingListModel listModelSecretaria = new BindingListModelList(lsSecretaria, true);
|
||||||
|
MyComboboxSecretaria.this.setModel(listModelSecretaria);
|
||||||
|
|
||||||
|
MyComboboxSecretaria.this.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public Secretaria getInitialValue() {
|
||||||
|
return initialValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setInitialValue(Secretaria initialValue) {
|
||||||
|
if (initialValue == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
List<Secretaria> ls = new ArrayList<Secretaria>();
|
||||||
|
ls.add(initialValue);
|
||||||
|
|
||||||
|
this.setModel(new BindingListModelList(ls, false));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void getValue(boolean checaBusqueda) throws WrongValueException {
|
||||||
|
if (checaBusqueda) {
|
||||||
|
Secretaria p = (Secretaria) (this.getSelectedItem() == null ? null : this.getSelectedItem().getValue());
|
||||||
|
|
||||||
|
if (p == null) {
|
||||||
|
throw new WrongValueException(this, Labels.getLabel("MSG.Error.combobox.hacerBusqueda"));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
super.getValue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isSinTodos() {
|
||||||
|
return sinTodos;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSinTodos(boolean sinTodos) {
|
||||||
|
this.sinTodos = sinTodos;
|
||||||
|
}
|
||||||
|
|
||||||
|
public <T> T getSelecteObject(Class<T> cType) {
|
||||||
|
if (this.getSelectedItem() != null) {
|
||||||
|
return cType.cast(this.getSelectedItem().getValue());
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -47,6 +47,15 @@
|
||||||
format="dd/MM/yyyy" constraint="no empty"
|
format="dd/MM/yyyy" constraint="no empty"
|
||||||
maxlength="10" />
|
maxlength="10" />
|
||||||
</row>
|
</row>
|
||||||
|
|
||||||
|
<row>
|
||||||
|
<label
|
||||||
|
value="${c:l('busquedaSecretariaController.window.title')}" />
|
||||||
|
<combobox id="cmbSecretaria"
|
||||||
|
use="com.rjconsultores.ventaboletos.web.utilerias.MyComboboxSecretaria"
|
||||||
|
mold="rounded" buttonVisible="true" width="90%"
|
||||||
|
/>
|
||||||
|
</row>
|
||||||
</rows>
|
</rows>
|
||||||
</grid>
|
</grid>
|
||||||
<toolbar>
|
<toolbar>
|
||||||
|
|
Loading…
Reference in New Issue