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 fecha = parametros.get("fecha").toString();
String categoriaId = parametros.get("categoria") != null ? parametros.get("categoria").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); System.out.println(sql);
NamedParameterStatement stmt = new NamedParameterStatement(conexao, sql); NamedParameterStatement stmt = new NamedParameterStatement(conexao, sql);
stmt.setString("fecha", fecha); stmt.setString("fecha", fecha);
if (categoriaId != null && !categoriaId.equals("")){ 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; ResultSet rset = null;
rset = stmt.executeQuery(); rset = stmt.executeQuery();
@ -77,7 +80,7 @@ public class RelatorioGratuidadeIdosoDeficiente extends Relatorio {
protected void processaParametros() throws Exception { 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(); StringBuffer sql = new StringBuffer();
sql.append("select distinct "); sql.append("select distinct ");
sql.append(" b.nombpasajero, "); sql.append(" b.nombpasajero, ");
@ -101,14 +104,19 @@ public class RelatorioGratuidadeIdosoDeficiente extends Relatorio {
sql.append(" and t.marca_id = b.marca_id "); sql.append(" and t.marca_id = b.marca_id ");
sql.append(" join vigencia_tarifa vt on vt.vigenciatarifa_id = t.vigenciatarifa_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(" 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 "); sql.append("where ");
if (!categoriaId.isEmpty()){ if (!categoriaId.isEmpty()){
sql.append(" c.categoria_id = :categoriaId "); sql.append(" c.categoria_id = :categoriaId ");
} }
if (!empresaId.isEmpty()){
sql.append(" and e.empresa_id = :empresaId ");
}
if (!fecha.isEmpty()){ if (!fecha.isEmpty()){
sql.append("AND to_char(b.feccorrida, 'MM/YYYY') = :fecha "); 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(" and b.activo <> 0 ");
sql.append("order by b.feccorrida, b.nombpasajero"); 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 org.zkoss.zul.Datebox;
import com.rjconsultores.ventaboletos.entidad.Categoria; import com.rjconsultores.ventaboletos.entidad.Categoria;
import com.rjconsultores.ventaboletos.entidad.Empresa;
import com.rjconsultores.ventaboletos.relatorios.impl.RelatorioGratuidadeIdosoDeficiente; import com.rjconsultores.ventaboletos.relatorios.impl.RelatorioGratuidadeIdosoDeficiente;
import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio; import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio;
import com.rjconsultores.ventaboletos.service.CategoriaService; 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.MyComboboxEstandar;
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer; import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
@ -37,6 +39,7 @@ public class RelatorioGratuidadeIdosoDeficienteController extends MyGenericForwa
private Datebox data; private Datebox data;
private MyComboboxEstandar cmbCategoria; private MyComboboxEstandar cmbCategoria;
private MyComboboxEmpresa cmbEmpresa;
private List<Categoria> lsCategorias; private List<Categoria> lsCategorias;
@ -50,6 +53,10 @@ public class RelatorioGratuidadeIdosoDeficienteController extends MyGenericForwa
if (cmbCategoria.getSelectedIndex() != -1) { if (cmbCategoria.getSelectedIndex() != -1) {
parametros.put("categoria", ((Categoria) cmbCategoria.getSelectedItem().getValue()).getCategoriaId()); 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")); parametros.put("TITULO", Labels.getLabel("relatorioGratuidadeIdosoDeficienteController.window.title"));

View File

@ -6225,4 +6225,5 @@ relatorioObservacaoConferenciaMovimentoController.lbPuntoVenta.value = Punto ven
# Relatório Gratuidade Idoso Deficiente # Relatório Gratuidade Idoso Deficiente
relatorioGratuidadeIdosoDeficienteController.window.title = Relatório Gratuidade Idoso/Deficiente relatorioGratuidadeIdosoDeficienteController.window.title = Relatório Gratuidade Idoso/Deficiente
relatorioGratuidadeIdosoDeficienteController.lbCategoria.value = Categoria relatorioGratuidadeIdosoDeficienteController.lbCategoria.value = Categoria
relatorioGratuidadeIdosoDeficienteController.lbData.value = Mês relatorioGratuidadeIdosoDeficienteController.lbData.value = Mês
relatorioGratuidadeIdosoDeficienteController.lbEmpresa.value=Empresa

View File

@ -6356,4 +6356,5 @@ relatorioObservacaoConferenciaMovimentoController.lbPuntoVenta.value = Punto ven
# Relatório Gratuidade Idoso Deficiente # Relatório Gratuidade Idoso Deficiente
relatorioGratuidadeIdosoDeficienteController.window.title = Relatório Gratuidade Idoso/Deficiente relatorioGratuidadeIdosoDeficienteController.window.title = Relatório Gratuidade Idoso/Deficiente
relatorioGratuidadeIdosoDeficienteController.lbCategoria.value = Categoria relatorioGratuidadeIdosoDeficienteController.lbCategoria.value = Categoria
relatorioGratuidadeIdosoDeficienteController.lbData.value = Mês relatorioGratuidadeIdosoDeficienteController.lbData.value = Mês
relatorioGratuidadeIdosoDeficienteController.lbEmpresa.value=Empresa

View File

@ -30,6 +30,13 @@
format="MM/yyyy" lenient="false" constraint="no empty" format="MM/yyyy" lenient="false" constraint="no empty"
maxlength="10" /> maxlength="10" />
</row> </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> </rows>
</grid> </grid>
<toolbar> <toolbar>