diff --git a/pom.xml b/pom.xml
index 90c6f096a..4f2d0291e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
4.0.0
br.com.rjconsultores
ventaboletosadm
- 1.34.12
+ 1.34.13
war
diff --git a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioAproveitamentoFinanceiroController.java b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioAproveitamentoFinanceiroController.java
index bec569972..0f9762e50 100644
--- a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioAproveitamentoFinanceiroController.java
+++ b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioAproveitamentoFinanceiroController.java
@@ -5,6 +5,8 @@ package com.rjconsultores.ventaboletos.web.gui.controladores.relatorios;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collections;
+import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -12,8 +14,8 @@ import java.util.Map.Entry;
import javax.sql.DataSource;
-import org.apache.log4j.Logger;
-
+import org.apache.commons.lang.StringUtils;
+import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
@@ -21,13 +23,18 @@ import org.zkoss.util.resource.Labels;
import org.zkoss.zhtml.Messagebox;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.event.Event;
+import org.zkoss.zk.ui.event.EventListener;
+import org.zkoss.zul.Button;
import org.zkoss.zul.Comboitem;
import org.zkoss.zul.Datebox;
+import org.zkoss.zul.Listcell;
+import org.zkoss.zul.Listitem;
+import org.zkoss.zul.ListitemRenderer;
import org.zkoss.zul.Radiogroup;
-import org.zkoss.zul.Row;
import org.zkoss.zul.Textbox;
import com.rjconsultores.ventaboletos.entidad.Empresa;
+import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente;
import com.rjconsultores.ventaboletos.entidad.Ruta;
import com.rjconsultores.ventaboletos.relatorios.impl.RelatorioAproveitamentoFinanceiro;
import com.rjconsultores.ventaboletos.relatorios.impl.RelatorioAproveitamentoFinanceiroTrecho;
@@ -58,7 +65,6 @@ public class RelatorioAproveitamentoFinanceiroController extends MyGenericForwar
private Datebox datFinal;
private MyComboboxEstandar cmbEmpresa;
private List lsEmpresa;
- private ArrayList rutaVO = new ArrayList();
@Autowired
private RutaService rutaService;
@@ -68,7 +74,6 @@ public class RelatorioAproveitamentoFinanceiroController extends MyGenericForwar
private Textbox txtPalavraPesquisaLinha;
private ArrayList lsNumLinha = new ArrayList();
private Radiogroup rgLayout;
- private Row rowTrecho;
private Map> mapRutaTrecho = new HashMap<>();
@Override
@@ -77,10 +82,66 @@ public class RelatorioAproveitamentoFinanceiroController extends MyGenericForwar
lsEmpresa = UsuarioLogado.getUsuarioLogado().getEmpresa();
linhaList.setItemRenderer(new RenderRelatorioAproveitamentoFinanceiro());
- linhaListSelList.setItemRenderer(new RenderRelatorioAproveitamentoFinanceiro());
+ renderizarListRuta();
trechoList.setItemRenderer(new RenderRelatorioAproveitamentoFinanceiroTrecho());
}
+
+ private void renderizarListRuta() {
+ linhaListSelList.setItemRenderer(new ListitemRenderer() {
+ @Override
+ public void render(Listitem lstm, Object o) throws Exception {
+
+ Ruta ruta = (Ruta) o;
+ if(ruta == null) {
+ return;
+ }
+
+ Listcell lc = new Listcell(ruta.getNumRuta() != null ? ruta.getNumRuta().toString() : "");
+ lc.setParent(lstm);
+ lc = new Listcell(ruta.getPrefixo());
+ lc.setParent(lstm);
+ lc = new Listcell(ruta.getDescruta());
+ lc.setParent(lstm);
+
+ OrgaoConcedente orgaoConcedente = ruta.getOrgaoConcedente();
+ if (orgaoConcedente != null) {
+ lc = new Listcell(orgaoConcedente.getDescOrgao());
+ } else {
+ lc = new Listcell("-");
+ }
+ lc.setParent(lstm);
+
+ Button btn = new Button();
+ lc = new Listcell();
+ lc.setParent(lstm);
+
+ btn.setWidth("16");
+ btn.setHeight("16");
+ btn.setImage("/gui/img/remove.png");
+
+ btn.addEventListener("onClick", new EventListener() {
+ @Override
+ public void onEvent(Event event) throws Exception {
+ MyListbox listBox = (MyListbox) event.getTarget().getParent().getParent().getParent();
+ Listitem listItem = (Listitem) event.getTarget().getParent().getParent();
+ listBox.removeItem((Ruta) listItem.getAttribute("data"));
+ List lsRutaVOAux = new ArrayList<>(trechoList.getListData());
+ Ruta ruta = (Ruta) listItem.getAttribute("data");
+ for (RutaVO rutaVO : (List )trechoList.getListData()) {
+ if(StringUtils.isNotBlank(ruta.getNumRuta()) && StringUtils.isNotBlank(rutaVO.getNumRuta()) && ruta.getNumRuta().equals(rutaVO.getNumRuta())) {
+ lsRutaVOAux.remove(rutaVO);
+ mapRutaTrecho.remove(rutaVO.getRutaId().intValue());
+ }
+ }
+ trechoList.setData(lsRutaVOAux);
+ }
+ });
+ lc.appendChild(btn);
+ lstm.setAttribute("data", ruta);
+ }
+ });
+ }
public void carregarTramos(Ruta rutaSelecionada) {
@@ -113,7 +174,11 @@ public class RelatorioAproveitamentoFinanceiroController extends MyGenericForwar
public void onDoubleClick$linhaList(Event ev) {
Ruta rutaAux = (Ruta) linhaList.getSelected();
+ if(rutaAux == null) {
+ return;
+ }
linhaListSelList.addItemNovo(rutaAux);
+
carregarTramos(rutaAux);
}
@@ -130,6 +195,13 @@ public class RelatorioAproveitamentoFinanceiroController extends MyGenericForwar
} catch (InterruptedException ex) {
log.error(ex);
}
+ }else {
+ Collections.sort(linhaList.getListData(), new Comparator() {
+ @Override
+ public int compare(Ruta m1, Ruta m2) {
+ return m1.getDescruta().compareTo(m2.getDescruta());
+ }
+ });
}
}
diff --git a/web/gui/relatorios/filtroRelatorioAproveitamentoFinanceiro.zul b/web/gui/relatorios/filtroRelatorioAproveitamentoFinanceiro.zul
index 43e619249..b8402f5fc 100644
--- a/web/gui/relatorios/filtroRelatorioAproveitamentoFinanceiro.zul
+++ b/web/gui/relatorios/filtroRelatorioAproveitamentoFinanceiro.zul
@@ -84,17 +84,17 @@
use="com.rjconsultores.ventaboletos.web.utilerias.MyListbox"
vflex="true" multiple="false" height="60%" width="410px">
-
+ width="18%" sort="auto(numRuta)" />
+ width="20%" sort="auto(prefixo)" />
+ label="${c:l('lb.dec')}" width="35%" sort="auto(descruta)"/>
+ width="27%" sort="auto(orgaoConcedente.descOrgao)"/>