fixes bug#AL-3404
parent
578cbb425c
commit
cf1af88d55
2
pom.xml
2
pom.xml
|
@ -4,7 +4,7 @@
|
|||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>br.com.rjconsultores</groupId>
|
||||
<artifactId>ventaboletosadm</artifactId>
|
||||
<version>1.34.12</version>
|
||||
<version>1.34.13</version>
|
||||
<packaging>war</packaging>
|
||||
|
||||
<properties>
|
||||
|
|
|
@ -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<Empresa> lsEmpresa;
|
||||
private ArrayList<RutaVO> rutaVO = new ArrayList<RutaVO>();
|
||||
@Autowired
|
||||
private RutaService rutaService;
|
||||
|
||||
|
@ -68,7 +74,6 @@ public class RelatorioAproveitamentoFinanceiroController extends MyGenericForwar
|
|||
private Textbox txtPalavraPesquisaLinha;
|
||||
private ArrayList<Ruta> lsNumLinha = new ArrayList<Ruta>();
|
||||
private Radiogroup rgLayout;
|
||||
private Row rowTrecho;
|
||||
private Map<Integer, List<RutaVO>> 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<RutaVO> lsRutaVOAux = new ArrayList<>(trechoList.getListData());
|
||||
Ruta ruta = (Ruta) listItem.getAttribute("data");
|
||||
for (RutaVO rutaVO : (List<RutaVO> )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<Ruta>() {
|
||||
@Override
|
||||
public int compare(Ruta m1, Ruta m2) {
|
||||
return m1.getDescruta().compareTo(m2.getDescruta());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -84,17 +84,17 @@
|
|||
use="com.rjconsultores.ventaboletos.web.utilerias.MyListbox"
|
||||
vflex="true" multiple="false" height="60%" width="410px">
|
||||
<listhead>
|
||||
<listheader
|
||||
<listheader
|
||||
label="${c:l('relatorioAproveitamentoFinanceiroController.lbNumRuta.label')}"
|
||||
width="18%" />
|
||||
width="18%" sort="auto(numRuta)" />
|
||||
<listheader
|
||||
label="${c:l('relatorioLinhasHorarioController.lbPrefixo.label')}"
|
||||
width="20%" />
|
||||
width="20%" sort="auto(prefixo)" />
|
||||
<listheader
|
||||
label="${c:l('lb.dec')}" width="35%" />
|
||||
label="${c:l('lb.dec')}" width="35%" sort="auto(descruta)"/>
|
||||
<listheader
|
||||
label="${c:l('relatorioLinhasHorarioController.lbOrgao.label')}"
|
||||
width="27%" />
|
||||
width="27%" sort="auto(orgaoConcedente.descOrgao)"/>
|
||||
</listhead>
|
||||
</listbox>
|
||||
<paging id="pagingLinha" pageSize="10" />
|
||||
|
|
Loading…
Reference in New Issue