leonardo 2016-03-14 20:23:57 +00:00
parent 99151ae0a2
commit b0dcf15aa2
5 changed files with 31 additions and 7 deletions

View File

@ -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");

View File

@ -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());

View File

@ -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

View File

@ -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

View File

@ -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>