fixed bug #7278 - Relatório Gratuidade: criação de filtros de origem, destino e tipo de gratuidade
git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@54299 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
b9233fe55a
commit
ace0c68246
|
@ -35,8 +35,11 @@ public class RelatorioGratuidade extends Relatorio {
|
|||
String empresa = parametros.get("empresa") != null ? parametros.get("empresa").toString() : "";
|
||||
String agencia = parametros.get("agencia") != null ? parametros.get("agencia").toString() : "";
|
||||
String ruta = parametros.get("ruta") != null ? parametros.get("ruta").toString() : "";
|
||||
String origem = parametros.get("origem") != null ? parametros.get("origem").toString() : "";
|
||||
String destino = parametros.get("destino") != null ? parametros.get("destino").toString() : "";
|
||||
String categoria = parametros.get("categoria") != null ? parametros.get("categoria").toString() : "";
|
||||
|
||||
String sql = getSql(empresa, agencia, ruta, fecInicio, fecFinal);
|
||||
String sql = getSql(empresa, agencia, ruta, fecInicio, fecFinal, origem, destino, categoria);
|
||||
|
||||
System.out.println(sql);
|
||||
|
||||
|
@ -44,15 +47,24 @@ public class RelatorioGratuidade extends Relatorio {
|
|||
NamedParameterStatement stmt = new NamedParameterStatement(conexao, sql);
|
||||
stmt.setTimestamp("fecInicio", new java.sql.Timestamp(sdf.parse(fecInicio).getTime()));
|
||||
stmt.setTimestamp("fecFinal", new java.sql.Timestamp(sdf.parse(fecFinal).getTime()));
|
||||
if (empresa != null && !empresa.equals("")){
|
||||
if(empresa != null && !empresa.equals("")){
|
||||
stmt.setInt("empresa_id", Integer.parseInt(empresa));
|
||||
}
|
||||
if (agencia != null && !agencia.equals("")){
|
||||
if(agencia != null && !agencia.equals("")){
|
||||
stmt.setInt("puntoventa_id", Integer.parseInt(agencia));
|
||||
}
|
||||
if (ruta != null && !ruta.equals("")){
|
||||
if(ruta != null && !ruta.equals("")){
|
||||
stmt.setInt("ruta_id", Integer.parseInt(ruta));
|
||||
}
|
||||
if(origem != null && !origem.equals("")){
|
||||
stmt.setInt("origem_id", Integer.parseInt(origem));
|
||||
}
|
||||
if(destino != null && !destino.equals("")){
|
||||
stmt.setInt("destino_id", Integer.parseInt(destino));
|
||||
}
|
||||
if(categoria != null && !categoria.equals("")){
|
||||
stmt.setInt("categoria_id", Integer.parseInt(categoria));
|
||||
}
|
||||
|
||||
ResultSet rset = null;
|
||||
|
||||
|
@ -97,7 +109,7 @@ public class RelatorioGratuidade extends Relatorio {
|
|||
protected void processaParametros() throws Exception {
|
||||
}
|
||||
|
||||
private String getSql(String empresa, String agencia, String ruta, String fecInicio, String fecFinal) {
|
||||
private String getSql(String empresa, String agencia, String ruta, String fecInicio, String fecFinal, String origem, String destino, String categoria) {
|
||||
StringBuffer sql = new StringBuffer();
|
||||
sql.append("SELECT b.feccorrida, ori.cveparada origen, des.cveparada destino, ");
|
||||
sql.append("b.numkmviaje, r.descruta, b.corrida_id, b.fechorviaje, ");
|
||||
|
@ -133,6 +145,15 @@ public class RelatorioGratuidade extends Relatorio {
|
|||
if (!ruta.isEmpty()){
|
||||
sql.append(" AND b.ruta_id = :ruta_id ");
|
||||
}
|
||||
if(!origem.isEmpty()){
|
||||
sql.append(" AND ori.parada_id = :origem_id ");
|
||||
}
|
||||
if(!destino.isEmpty()){
|
||||
sql.append(" AND des.parada_id = :destino_id ");
|
||||
}
|
||||
if(!categoria.isEmpty()){
|
||||
sql.append(" AND c.categoria_id = :categoria_id ");
|
||||
}
|
||||
|
||||
return sql.toString();
|
||||
}
|
||||
|
|
|
@ -16,15 +16,19 @@ import org.zkoss.zk.ui.Component;
|
|||
import org.zkoss.zk.ui.event.Event;
|
||||
import org.zkoss.zul.Datebox;
|
||||
|
||||
import com.rjconsultores.ventaboletos.entidad.Categoria;
|
||||
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
||||
import com.rjconsultores.ventaboletos.entidad.Parada;
|
||||
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
|
||||
import com.rjconsultores.ventaboletos.entidad.Ruta;
|
||||
import com.rjconsultores.ventaboletos.relatorios.impl.RelatorioGratuidade;
|
||||
import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio;
|
||||
import com.rjconsultores.ventaboletos.service.CategoriaService;
|
||||
import com.rjconsultores.ventaboletos.service.EmpresaService;
|
||||
import com.rjconsultores.ventaboletos.service.PuntoVentaService;
|
||||
import com.rjconsultores.ventaboletos.service.RutaService;
|
||||
import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEstandar;
|
||||
import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxParada;
|
||||
import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxPuntoVenta;
|
||||
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||
|
||||
|
@ -36,24 +40,27 @@ public class RelatorioGratuidadeController extends MyGenericForwardComposer {
|
|||
|
||||
@Autowired
|
||||
private DataSource dataSourceRead;
|
||||
|
||||
@Autowired
|
||||
private EmpresaService empresaService;
|
||||
|
||||
@Autowired
|
||||
private PuntoVentaService puntoVentaService;
|
||||
|
||||
@Autowired
|
||||
private RutaService rutaService;
|
||||
@Autowired
|
||||
private CategoriaService categoriaService;
|
||||
|
||||
private Datebox datInicial;
|
||||
private Datebox datFinal;
|
||||
private MyComboboxEstandar cmbTeste;
|
||||
private MyComboboxPuntoVenta cmbAgencia;
|
||||
private MyComboboxEstandar cmbLinha;
|
||||
private MyComboboxParada cmbOrigem;
|
||||
private MyComboboxParada cmbDestino;
|
||||
private MyComboboxEstandar cmbTipoGratuidade;
|
||||
|
||||
private List<Empresa> lsEmpresas;
|
||||
private List<Ruta> lsLinhas;
|
||||
private List<Categoria> lsCategorias;
|
||||
|
||||
private void executarRelatorio() throws Exception {
|
||||
|
||||
|
@ -72,6 +79,15 @@ public class RelatorioGratuidadeController extends MyGenericForwardComposer {
|
|||
if (cmbLinha.getSelectedIndex() != -1) {
|
||||
parametros.put("ruta", ((Ruta) cmbLinha.getSelectedItem().getValue()).getRutaId());
|
||||
}
|
||||
if(cmbOrigem.getSelectedIndex() != -1){
|
||||
parametros.put("origem", ((Parada) cmbOrigem.getSelectedItem().getValue()).getParadaId());
|
||||
}
|
||||
if(cmbDestino.getSelectedIndex() != -1){
|
||||
parametros.put("destino", ((Parada) cmbDestino.getSelectedItem().getValue()).getParadaId());
|
||||
}
|
||||
if(cmbTipoGratuidade.getSelectedIndex() != -1){
|
||||
parametros.put("categoria", ((Categoria) cmbTipoGratuidade.getSelectedItem().getValue()).getCategoriaId());
|
||||
}
|
||||
|
||||
parametros.put("TITULO", Labels.getLabel("relatorioGratuidadeController.window.title"));
|
||||
|
||||
|
@ -94,6 +110,7 @@ public class RelatorioGratuidadeController extends MyGenericForwardComposer {
|
|||
|
||||
lsLinhas = rutaService.obtenerTodos();
|
||||
lsEmpresas = empresaService.obtenerTodos();
|
||||
lsCategorias = categoriaService.obtenerTodos();
|
||||
|
||||
super.doAfterCompose(comp);
|
||||
}
|
||||
|
@ -114,6 +131,14 @@ public class RelatorioGratuidadeController extends MyGenericForwardComposer {
|
|||
this.lsLinhas = lsLinhas;
|
||||
}
|
||||
|
||||
public List<Categoria> getLsCategorias() {
|
||||
return lsCategorias;
|
||||
}
|
||||
|
||||
public void setLsCategorias(List<Categoria> lsCategorias) {
|
||||
this.lsCategorias = lsCategorias;
|
||||
}
|
||||
|
||||
public Datebox getDatInicial() {
|
||||
return datInicial;
|
||||
}
|
||||
|
@ -146,4 +171,28 @@ public class RelatorioGratuidadeController extends MyGenericForwardComposer {
|
|||
this.cmbLinha = cmbLinha;
|
||||
}
|
||||
|
||||
public MyComboboxParada getCmbOrigem() {
|
||||
return cmbOrigem;
|
||||
}
|
||||
|
||||
public void setCmbOrigem(MyComboboxParada cmbOrigem) {
|
||||
this.cmbOrigem = cmbOrigem;
|
||||
}
|
||||
|
||||
public MyComboboxParada getCmbDestino() {
|
||||
return cmbDestino;
|
||||
}
|
||||
|
||||
public void setCmbDestino(MyComboboxParada cmbDestino) {
|
||||
this.cmbDestino = cmbDestino;
|
||||
}
|
||||
|
||||
public MyComboboxEstandar getCmbTipoGratuidade() {
|
||||
return cmbTipoGratuidade;
|
||||
}
|
||||
|
||||
public void setCmbTipoGratuidade(MyComboboxEstandar cmbTipoGratuidade) {
|
||||
this.cmbTipoGratuidade = cmbTipoGratuidade;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -5754,6 +5754,9 @@ relatorioGratuidadeController.window.title = Reporte Gratuidade
|
|||
relatorioGratuidadeController.lbEmpresa.value = Empresa
|
||||
relatorioGratuidadeController.lbAgencia.value = Punto Venta
|
||||
relatorioGratuidadeController.lbLinhas.value = Ruta
|
||||
relatorioGratuidadeController.lbOrigem.value = Origem
|
||||
relatorioGratuidadeController.lbDestino.value = Destino
|
||||
relatorioGratuidadeController.lbTipoGratuidade.value = Tipo de Gratuidade
|
||||
relatorioGratuidadeController.lbDataIni.value = Fecha Inicio
|
||||
relatorioGratuidadeController.lbDataFin.value = Fecha Final
|
||||
|
||||
|
|
|
@ -5840,6 +5840,9 @@ relatorioGratuidadeController.window.title = Relatório Gratuidade
|
|||
relatorioGratuidadeController.lbEmpresa.value = Empresa
|
||||
relatorioGratuidadeController.lbAgencia.value = Agência
|
||||
relatorioGratuidadeController.lbLinhas.value = Linha
|
||||
relatorioGratuidadeController.lbOrigem.value = Origem
|
||||
relatorioGratuidadeController.lbDestino.value = Destino
|
||||
relatorioGratuidadeController.lbTipoGratuidade.value = Tipo de Gratuidade
|
||||
relatorioGratuidadeController.lbDataIni.value = Data Inicio
|
||||
relatorioGratuidadeController.lbDataFin.value = Data Final
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<zk xmlns="http://www.zkoss.org/2005/zul">
|
||||
<window id="winFiltroRelatorioGratuidade"
|
||||
apply="${relatorioGratuidadeController}"
|
||||
contentStyle="overflow:auto" height="225px" width="550px"
|
||||
contentStyle="overflow:auto" height="320px" width="550px"
|
||||
border="normal">
|
||||
|
||||
<grid fixedLayout="true">
|
||||
|
@ -40,6 +40,32 @@
|
|||
use="com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEstandar"
|
||||
model="@{winFiltroRelatorioGratuidade$composer.lsLinhas}" />
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<label
|
||||
value="${c:l('relatorioGratuidadeController.lbOrigem.value')}" />
|
||||
<combobox id="cmbOrigem" width="70%"
|
||||
maxlength="60" mold="rounded" buttonVisible="true"
|
||||
use="com.rjconsultores.ventaboletos.web.utilerias.MyComboboxParada"/>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<label
|
||||
value="${c:l('relatorioGratuidadeController.lbDestino.value')}" />
|
||||
<combobox id="cmbDestino" width="70%"
|
||||
maxlength="60" mold="rounded" buttonVisible="true"
|
||||
use="com.rjconsultores.ventaboletos.web.utilerias.MyComboboxParada"/>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<label
|
||||
value="${c:l('relatorioGratuidadeController.lbTipoGratuidade.value')}" />
|
||||
<combobox id="cmbTipoGratuidade" width="70%"
|
||||
maxlength="60" mold="rounded" buttonVisible="true"
|
||||
use="com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEstandar"
|
||||
model="@{winFiltroRelatorioGratuidade$composer.lsCategorias}"/>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<label
|
||||
value="${c:l('relatorioGratuidadeController.lbDataIni.value')}" />
|
||||
|
|
Loading…
Reference in New Issue