fixes bug #10624
git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@78952 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
d253f37f78
commit
17b1dd9111
|
@ -49,13 +49,16 @@ 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").equals(-1) ? 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() : "";
|
||||
orgaoConcedenteId = parametros.get("orgao_concedente_id") != null ? (Integer) parametros.get("orgao_concedente_id") : null;
|
||||
|
||||
|
||||
|
||||
String sql = getSql(empresa, agencia, fecInicioViagem, fecFinalViagem, fecInicioVenda, fecFinalVenda, categoria);
|
||||
|
||||
System.out.println(sql);
|
||||
|
||||
String sql = getSql(empresa, agencia, ruta, fecInicioViagem, fecFinalViagem, fecInicioVenda, fecFinalVenda, origem, destino, categoria);
|
||||
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss");
|
||||
NamedParameterStatement stmt = new NamedParameterStatement(conexao, sql);
|
||||
if (fecInicioViagem != null) {
|
||||
|
@ -76,9 +79,15 @@ public class RelatorioGratuidade extends Relatorio {
|
|||
if(agencia != null && !agencia.equals("")){
|
||||
stmt.setInt("puntoventa_id", Integer.parseInt(agencia));
|
||||
}
|
||||
// if(categoria != null && !categoria.equals("")){
|
||||
// stmt.setInt("categoria_id", Integer.parseInt(categoria));
|
||||
// }
|
||||
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(orgaoConcedenteId != null){
|
||||
stmt.setInt("orgao_concedente_id", orgaoConcedenteId);
|
||||
}
|
||||
|
@ -146,7 +155,7 @@ public class RelatorioGratuidade extends Relatorio {
|
|||
protected void processaParametros() throws Exception {
|
||||
}
|
||||
|
||||
private String getSql(String empresa, String agencia, String fecInicioViagem, String fecFinalViagem, String fecInicioVenda, String fecFinalVenda, String categoria) {
|
||||
private String getSql(String empresa, String agencia, String ruta, String fecInicioViagem, String fecFinalViagem, String fecInicioVenda, String fecFinalVenda, String origem, String destino, String categoria) {
|
||||
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
@ -226,9 +235,21 @@ public class RelatorioGratuidade extends Relatorio {
|
|||
if (!agencia.isEmpty() && !agencia.equals("-1")){
|
||||
sb.append(" AND b.puntoventa_id = :puntoventa_id ");
|
||||
}
|
||||
if (!ruta.isEmpty() && !ruta.equals("-1")){
|
||||
sb.append(" AND b.ruta_id = :ruta_id ");
|
||||
}
|
||||
if(!origem.isEmpty()){
|
||||
sb.append(" AND ori.parada_id = :origem_id ");
|
||||
}
|
||||
if(!destino.isEmpty()){
|
||||
sb.append(" AND des.parada_id = :destino_id ");
|
||||
}
|
||||
if(!categoria.isEmpty()){
|
||||
sb.append(" AND ca.categoria_id in ("+ categoria +") ");
|
||||
}
|
||||
if(orgaoConcedenteId != null){
|
||||
sb.append(" AND r.orgaoconcedente_id = :orgao_concedente_id ");
|
||||
}
|
||||
sb.append(" ");
|
||||
sb.append(" UNION ALL ");
|
||||
sb.append(" ");
|
||||
|
@ -302,10 +323,22 @@ public class RelatorioGratuidade extends Relatorio {
|
|||
sb.append("AND c.empresacorrida_id = :empresa_id ");
|
||||
}
|
||||
if (!agencia.isEmpty() && !agencia.equals("-1")){
|
||||
sb.append(" AND c.puntoventa_id = :puntoventa_id ");
|
||||
sb.append("AND c.puntoventa_id = :puntoventa_id ");
|
||||
}
|
||||
if (!ruta.isEmpty() && !ruta.equals("-1")){
|
||||
sb.append("AND c.ruta_id = :ruta_id ");
|
||||
}
|
||||
if(!origem.isEmpty()){
|
||||
sb.append("AND ori.parada_id = :origem_id ");
|
||||
}
|
||||
if(!destino.isEmpty()){
|
||||
sb.append("AND des.parada_id = :destino_id ");
|
||||
}
|
||||
if(!categoria.isEmpty()){
|
||||
sb.append(" AND ca.categoria_id in ("+ categoria +") ");
|
||||
sb.append("AND ca.categoria_id in ("+ categoria +") ");
|
||||
}
|
||||
if(orgaoConcedenteId != null){
|
||||
sb.append("AND r.orgaoconcedente_id = :orgao_concedente_id ");
|
||||
}
|
||||
sb.append(") ");
|
||||
sb.append("ORDER BY 5,15");
|
||||
|
|
|
@ -46,6 +46,10 @@ public class RelatorioGratuidadeController extends MyGenericForwardComposer {
|
|||
private EmpresaService empresaService;
|
||||
@Autowired
|
||||
private CategoriaService categoriaService;
|
||||
@Autowired
|
||||
private RutaService rutaService;
|
||||
@Autowired
|
||||
private OrgaoConcedenteService orgaocConcedenteService;
|
||||
|
||||
private Datebox datInicialViagem;
|
||||
private Datebox datFinalViagem;
|
||||
|
@ -54,12 +58,18 @@ public class RelatorioGratuidadeController extends MyGenericForwardComposer {
|
|||
private MyComboboxEstandar cmbEmpresa;
|
||||
private MyComboboxPuntoVenta cmbAgencia;
|
||||
private MyComboboxEstandar cmbTipoGratuidade;
|
||||
private MyComboboxEstandar cmbOrgaoConcedente;
|
||||
private MyComboboxEstandar cmbLinha;
|
||||
private MyComboboxParada cmbOrigem;
|
||||
private MyComboboxParada cmbDestino;
|
||||
|
||||
private List<Empresa> lsEmpresas;
|
||||
private List<Categoria> lsCategorias;
|
||||
private List<Ruta> lsLinhas;
|
||||
|
||||
private MyListbox selectedTipoGratuidadeList;
|
||||
private List<Categoria> listSelectedTipoGratuidade;
|
||||
private List<OrgaoConcedente> lsOrgaoConcedente;
|
||||
|
||||
|
||||
public void onClick$btnRemoveTipoGratuidade(Event ev) throws InterruptedException {
|
||||
|
@ -146,6 +156,34 @@ public class RelatorioGratuidadeController extends MyGenericForwardComposer {
|
|||
if (cmbAgencia.getSelectedIndex() != -1) {
|
||||
parametros.put("agencia", ((PuntoVenta) cmbAgencia.getSelectedItem().getValue()).getPuntoventaId());
|
||||
}
|
||||
if (cmbLinha.getSelectedItem() != null) {
|
||||
if (!cmbLinha.getSelectedItem().getValue().equals("-1")) {
|
||||
parametros.put("ruta", ((Ruta) cmbLinha.getSelectedItem().getValue()).getRutaId());
|
||||
}
|
||||
}
|
||||
if (cmbOrigem.getSelectedItem() != null) {
|
||||
if (!cmbOrigem.getSelectedItem().getValue().equals("-1")) {
|
||||
parametros.put("origem", ((Parada) cmbOrigem.getSelectedItem().getValue()).getParadaId());
|
||||
}
|
||||
}
|
||||
if (cmbDestino.getSelectedItem() != null) {
|
||||
if (!cmbDestino.getSelectedItem().getValue().equals("-1")) {
|
||||
parametros.put("destino", ((Parada) cmbDestino.getSelectedItem().getValue()).getParadaId());
|
||||
}
|
||||
}
|
||||
if (cmbTipoGratuidade.getSelectedItem() != null) {
|
||||
if (!cmbTipoGratuidade.getSelectedItem().getValue().equals("-1")) {
|
||||
parametros.put("categoria", ((Categoria) cmbTipoGratuidade.getSelectedItem().getValue()).getCategoriaId());
|
||||
}
|
||||
}
|
||||
|
||||
if (cmbOrgaoConcedente.getSelectedItem() != null) {
|
||||
if(!cmbOrgaoConcedente.getSelectedItem().getValue().equals("-1")){
|
||||
OrgaoConcedente orgaoConcedente = (OrgaoConcedente) cmbOrgaoConcedente.getSelectedItem().getValue();
|
||||
parametros.put("orgao_concedente_id", orgaoConcedente.getOrgaoConcedenteId());
|
||||
parametros.put("orgao_concedente_desc", orgaoConcedente.getDescOrgao());
|
||||
}
|
||||
}
|
||||
if(cmbTipoGratuidade.getSelectedIndex() != -1){
|
||||
if (listSelectedTipoGratuidade.size() > 0) {
|
||||
String categoriasExpression = null;
|
||||
|
@ -179,8 +217,10 @@ public class RelatorioGratuidadeController extends MyGenericForwardComposer {
|
|||
public void doAfterCompose(Component comp) throws Exception {
|
||||
|
||||
|
||||
lsLinhas = rutaService.obtenerTodos();
|
||||
lsEmpresas = empresaService.obtenerTodos();
|
||||
lsCategorias = categoriaService.obtenerTodos();
|
||||
lsOrgaoConcedente = orgaocConcedenteService.obtenerTodos();
|
||||
listSelectedTipoGratuidade = new ArrayList<Categoria>();
|
||||
|
||||
super.doAfterCompose(comp);
|
||||
|
@ -198,7 +238,14 @@ public class RelatorioGratuidadeController extends MyGenericForwardComposer {
|
|||
public List<Categoria> getLsCategorias() {
|
||||
return lsCategorias;
|
||||
}
|
||||
public List<Ruta> getLsLinhas() {
|
||||
return lsLinhas;
|
||||
}
|
||||
|
||||
public void setLsLinhas(List<Ruta> lsLinhas) {
|
||||
this.lsLinhas = lsLinhas;
|
||||
}
|
||||
|
||||
public void setLsCategorias(List<Categoria> lsCategorias) {
|
||||
this.lsCategorias = lsCategorias;
|
||||
}
|
||||
|
@ -227,6 +274,14 @@ public class RelatorioGratuidadeController extends MyGenericForwardComposer {
|
|||
this.datInicialVenda = datInicialVenda;
|
||||
}
|
||||
|
||||
public List<OrgaoConcedente> getLsOrgaoConcedente() {
|
||||
return lsOrgaoConcedente;
|
||||
}
|
||||
|
||||
public void setLsOrgaoConcedente(List<OrgaoConcedente> lsOrgaoConcedente) {
|
||||
this.lsOrgaoConcedente = lsOrgaoConcedente;
|
||||
}
|
||||
|
||||
public Datebox getDatFinalVenda() {
|
||||
return datFinalVenda;
|
||||
}
|
||||
|
|
|
@ -6,9 +6,8 @@
|
|||
|
||||
<zk xmlns="http://www.zkoss.org/2005/zul">
|
||||
<window id="winFiltroRelatorioGratuidade"
|
||||
apply="${relatorioGratuidadeController}"
|
||||
contentStyle="overflow:auto" height="335px" width="550px"
|
||||
border="normal">
|
||||
apply="${relatorioGratuidadeController}" contentStyle="overflow:auto"
|
||||
height="460px" width="550px" border="normal">
|
||||
|
||||
<grid fixedLayout="true">
|
||||
<columns>
|
||||
|
@ -19,7 +18,8 @@
|
|||
</columns>
|
||||
<rows>
|
||||
<row>
|
||||
<label value="${c:l('relatorioGratuidadeController.lvViagem')}" />
|
||||
<label
|
||||
value="${c:l('relatorioGratuidadeController.lvViagem')}" />
|
||||
<label value=" " />
|
||||
<label value=" " />
|
||||
<label value=" " />
|
||||
|
@ -27,17 +27,16 @@
|
|||
<row>
|
||||
<label
|
||||
value="${c:l('relatorioGratuidadeController.lbDataIniViagem.value')}" />
|
||||
<datebox id="datInicialViagem" width="100%" mold="rounded"
|
||||
format="dd/MM/yyyy"
|
||||
maxlength="10" />
|
||||
<datebox id="datInicialViagem" width="100%"
|
||||
mold="rounded" format="dd/MM/yyyy" maxlength="10" />
|
||||
<label
|
||||
value="${c:l('relatorioGratuidadeController.lbDataFinViagem.value')}" />
|
||||
<datebox id="datFinalViagem" width="100%" mold="rounded"
|
||||
format="dd/MM/yyyy"
|
||||
maxlength="10" />
|
||||
</row>
|
||||
<datebox id="datFinalViagem" width="100%"
|
||||
mold="rounded" format="dd/MM/yyyy" maxlength="10" />
|
||||
</row>
|
||||
<row>
|
||||
<label value="${c:l('relatorioGratuidadeController.lvVenda')}" />
|
||||
<label
|
||||
value="${c:l('relatorioGratuidadeController.lvVenda')}" />
|
||||
<label value=" " />
|
||||
<label value=" " />
|
||||
<label value=" " />
|
||||
|
@ -45,15 +44,13 @@
|
|||
<row>
|
||||
<label
|
||||
value="${c:l('relatorioGratuidadeController.lbDataIniVenda.value')}" />
|
||||
<datebox id="datInicialVenda" width="100%" mold="rounded"
|
||||
format="dd/MM/yyyy"
|
||||
maxlength="10" />
|
||||
<datebox id="datInicialVenda" width="100%"
|
||||
mold="rounded" format="dd/MM/yyyy" maxlength="10" />
|
||||
<label
|
||||
value="${c:l('relatorioGratuidadeController.lbDataFinVenda.value')}" />
|
||||
<datebox id="datFinalVenda" width="100%" mold="rounded"
|
||||
format="dd/MM/yyyy"
|
||||
maxlength="10" />
|
||||
</row>
|
||||
<datebox id="datFinalVenda" width="100%"
|
||||
mold="rounded" format="dd/MM/yyyy" maxlength="10" />
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
<grid fixedLayout="true">
|
||||
|
@ -65,25 +62,60 @@
|
|||
<row>
|
||||
<label
|
||||
value="${c:l('relatorioGratuidadeController.lbEmpresa.value')}" />
|
||||
<combobox id="cmbEmpresa" width="70%"
|
||||
maxlength="60" mold="rounded" buttonVisible="true"
|
||||
<combobox id="cmbEmpresa" width="70%" maxlength="60"
|
||||
mold="rounded" buttonVisible="true"
|
||||
use="com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEstandar"
|
||||
model="@{winFiltroRelatorioGratuidade$composer.lsEmpresas}" />
|
||||
</row>
|
||||
<row>
|
||||
<label
|
||||
value="${c:l('relatorioGratuidadeController.lbAgencia.value')}" />
|
||||
<combobox id="cmbAgencia" width="70%"
|
||||
maxlength="60" mold="rounded" buttonVisible="true"
|
||||
use="com.rjconsultores.ventaboletos.web.utilerias.MyComboboxPuntoVenta"
|
||||
/>
|
||||
</row>
|
||||
<combobox id="cmbAgencia" width="70%" maxlength="60"
|
||||
mold="rounded" buttonVisible="true"
|
||||
use="com.rjconsultores.ventaboletos.web.utilerias.MyComboboxPuntoVenta" />
|
||||
</row>
|
||||
<row>
|
||||
<label value="${c:l('relatorioGratuidadeController.lbTipoGratuidade.value')}" />
|
||||
<label
|
||||
value="${c:l('relatorioGratuidadeController.lbLinhas.value')}" />
|
||||
<combobox id="cmbLinha" width="70%" mold="rounded"
|
||||
buttonVisible="true"
|
||||
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('relatorioTabelaPrecoController.orgaoConcedente.value')}" />
|
||||
<combobox id="cmbOrgaoConcedente"
|
||||
buttonVisible="true"
|
||||
use="com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEstandar"
|
||||
model="@{winFiltroRelatorioGratuidade$composer.lsOrgaoConcedente}"
|
||||
width="70%" />
|
||||
</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}"/>
|
||||
model="@{winFiltroRelatorioGratuidade$composer.lsCategorias}" />
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
|
@ -97,8 +129,8 @@
|
|||
<button id="btnRemoveTipoGratuidade" height="20"
|
||||
image="/gui/img/remove.png" width="35px"
|
||||
tooltiptext="${c:l('generarTarifaOrgaoController.labelRemoveRuta.value')}" />
|
||||
<button id="btnAddTipoTipoGratuidade" height="20"
|
||||
image="/gui/img/add.png" width="35px"
|
||||
<button id="btnAddTipoTipoGratuidade"
|
||||
height="20" image="/gui/img/add.png" width="35px"
|
||||
tooltiptext="${c:l('generarTarifaOrgaoController.labelAddRuta.value')}" />
|
||||
</toolbar>
|
||||
</row>
|
||||
|
@ -108,10 +140,11 @@
|
|||
multiple="false">
|
||||
<listhead sizable="true">
|
||||
<listheader image="/gui/img/builder.gif"
|
||||
label="${c:l('generarTarifaOrgaoController.labelEmpresa.value')}" width="100%"/>
|
||||
label="${c:l('generarTarifaOrgaoController.labelEmpresa.value')}"
|
||||
width="100%" />
|
||||
</listhead>
|
||||
</listbox>
|
||||
</row>
|
||||
</listbox>
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
<toolbar>
|
||||
|
|
Loading…
Reference in New Issue