fixes bug #7191
git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@53863 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
99151ae0a2
commit
b0dcf15aa2
|
@ -30,17 +30,20 @@ public class RelatorioGratuidadeIdosoDeficiente extends Relatorio {
|
|||
|
||||
String fecha = parametros.get("fecha").toString();
|
||||
String categoriaId = parametros.get("categoria") != null ? parametros.get("categoria").toString() : "";
|
||||
String empresaId = parametros.get("empresa") != null ? parametros.get("empresa").toString() : "";
|
||||
|
||||
String sql = getSql(categoriaId, fecha);
|
||||
String sql = getSql(categoriaId, fecha, empresaId);
|
||||
|
||||
System.out.println(sql);
|
||||
|
||||
NamedParameterStatement stmt = new NamedParameterStatement(conexao, sql);
|
||||
stmt.setString("fecha", fecha);
|
||||
if (categoriaId != null && !categoriaId.equals("")){
|
||||
stmt.setInt("categoriaId", Integer.parseInt(categoriaId));
|
||||
stmt.setString("categoriaId", categoriaId);
|
||||
}
|
||||
if (empresaId != null && !empresaId.equals("")){
|
||||
stmt.setString("empresaId", empresaId);
|
||||
}
|
||||
|
||||
ResultSet rset = null;
|
||||
|
||||
rset = stmt.executeQuery();
|
||||
|
@ -77,7 +80,7 @@ public class RelatorioGratuidadeIdosoDeficiente extends Relatorio {
|
|||
protected void processaParametros() throws Exception {
|
||||
}
|
||||
|
||||
private String getSql(String categoriaId, String fecha) {
|
||||
private String getSql(String categoriaId, String fecha, String empresaId) {
|
||||
StringBuffer sql = new StringBuffer();
|
||||
sql.append("select distinct ");
|
||||
sql.append(" b.nombpasajero, ");
|
||||
|
@ -101,14 +104,19 @@ public class RelatorioGratuidadeIdosoDeficiente extends Relatorio {
|
|||
sql.append(" and t.marca_id = b.marca_id ");
|
||||
sql.append(" join vigencia_tarifa vt on vt.vigenciatarifa_id = t.vigenciatarifa_id ");
|
||||
sql.append(" and b.fechorviaje between vt.feciniciovigencia and vt.fecfinvigencia ");
|
||||
sql.append(" join marca m on m.marca_id = b.marca_id ");
|
||||
sql.append(" join empresa e on e.empresa_id = m.empresa_id ");
|
||||
sql.append("where ");
|
||||
if (!categoriaId.isEmpty()){
|
||||
sql.append(" c.categoria_id = :categoriaId ");
|
||||
}
|
||||
if (!empresaId.isEmpty()){
|
||||
sql.append(" and e.empresa_id = :empresaId ");
|
||||
}
|
||||
if (!fecha.isEmpty()){
|
||||
sql.append("AND to_char(b.feccorrida, 'MM/YYYY') = :fecha ");
|
||||
}
|
||||
sql.append(" and b.motivocancelacion_id is not null ");
|
||||
sql.append(" and b.motivocancelacion_id is null ");
|
||||
sql.append(" and b.activo <> 0 ");
|
||||
sql.append("order by b.feccorrida, b.nombpasajero");
|
||||
|
||||
|
|
|
@ -17,9 +17,11 @@ 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.relatorios.impl.RelatorioGratuidadeIdosoDeficiente;
|
||||
import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio;
|
||||
import com.rjconsultores.ventaboletos.service.CategoriaService;
|
||||
import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEmpresa;
|
||||
import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEstandar;
|
||||
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||
|
||||
|
@ -37,6 +39,7 @@ public class RelatorioGratuidadeIdosoDeficienteController extends MyGenericForwa
|
|||
|
||||
private Datebox data;
|
||||
private MyComboboxEstandar cmbCategoria;
|
||||
private MyComboboxEmpresa cmbEmpresa;
|
||||
|
||||
private List<Categoria> lsCategorias;
|
||||
|
||||
|
@ -51,6 +54,10 @@ public class RelatorioGratuidadeIdosoDeficienteController extends MyGenericForwa
|
|||
parametros.put("categoria", ((Categoria) cmbCategoria.getSelectedItem().getValue()).getCategoriaId());
|
||||
}
|
||||
|
||||
if (cmbEmpresa.getSelectedIndex() != -1) {
|
||||
parametros.put("empresa", ((Empresa) cmbEmpresa.getSelectedItem().getValue()).getEmpresaId());
|
||||
}
|
||||
|
||||
parametros.put("TITULO", Labels.getLabel("relatorioGratuidadeIdosoDeficienteController.window.title"));
|
||||
|
||||
Relatorio relatorio = new RelatorioGratuidadeIdosoDeficiente(parametros, dataSourceRead.getConnection());
|
||||
|
|
|
@ -6226,3 +6226,4 @@ relatorioObservacaoConferenciaMovimentoController.lbPuntoVenta.value = Punto ven
|
|||
relatorioGratuidadeIdosoDeficienteController.window.title = Relatório Gratuidade Idoso/Deficiente
|
||||
relatorioGratuidadeIdosoDeficienteController.lbCategoria.value = Categoria
|
||||
relatorioGratuidadeIdosoDeficienteController.lbData.value = Mês
|
||||
relatorioGratuidadeIdosoDeficienteController.lbEmpresa.value=Empresa
|
|
@ -6357,3 +6357,4 @@ relatorioObservacaoConferenciaMovimentoController.lbPuntoVenta.value = Punto ven
|
|||
relatorioGratuidadeIdosoDeficienteController.window.title = Relatório Gratuidade Idoso/Deficiente
|
||||
relatorioGratuidadeIdosoDeficienteController.lbCategoria.value = Categoria
|
||||
relatorioGratuidadeIdosoDeficienteController.lbData.value = Mês
|
||||
relatorioGratuidadeIdosoDeficienteController.lbEmpresa.value=Empresa
|
|
@ -30,6 +30,13 @@
|
|||
format="MM/yyyy" lenient="false" constraint="no empty"
|
||||
maxlength="10" />
|
||||
</row>
|
||||
<row>
|
||||
<label
|
||||
value="${c:l('relatorioGratuidadeIdosoDeficienteController.lbEmpresa.value')}" />
|
||||
<combobox id="cmbEmpresa" width="70%" maxlength="60"
|
||||
mold="rounded" buttonVisible="true"
|
||||
use="com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEmpresa" />
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
<toolbar>
|
||||
|
|
Loading…
Reference in New Issue