Merge pull request 'AL-3404' (!332) from AL-3404 into master
Reviewed-on: adm/VentaBoletosAdm#332 Reviewed-by: Célio de Souza Ribeiro JR <celio@rjconsultores.com.br>master 1.34.13
commit
bf85b1fdeb
4
pom.xml
4
pom.xml
|
@ -1,10 +1,10 @@
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd ">
|
||||||
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>br.com.rjconsultores</groupId>
|
<groupId>br.com.rjconsultores</groupId>
|
||||||
<artifactId>ventaboletosadm</artifactId>
|
<artifactId>ventaboletosadm</artifactId>
|
||||||
<version>1.34.12</version>
|
<version>1.34.13</version>
|
||||||
<packaging>war</packaging>
|
<packaging>war</packaging>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
|
|
|
@ -5,6 +5,8 @@ package com.rjconsultores.ventaboletos.web.gui.controladores.relatorios;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Comparator;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -12,8 +14,8 @@ import java.util.Map.Entry;
|
||||||
|
|
||||||
import javax.sql.DataSource;
|
import javax.sql.DataSource;
|
||||||
|
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
|
@ -21,13 +23,18 @@ import org.zkoss.util.resource.Labels;
|
||||||
import org.zkoss.zhtml.Messagebox;
|
import org.zkoss.zhtml.Messagebox;
|
||||||
import org.zkoss.zk.ui.Component;
|
import org.zkoss.zk.ui.Component;
|
||||||
import org.zkoss.zk.ui.event.Event;
|
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.Comboitem;
|
||||||
import org.zkoss.zul.Datebox;
|
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.Radiogroup;
|
||||||
import org.zkoss.zul.Row;
|
|
||||||
import org.zkoss.zul.Textbox;
|
import org.zkoss.zul.Textbox;
|
||||||
|
|
||||||
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente;
|
||||||
import com.rjconsultores.ventaboletos.entidad.Ruta;
|
import com.rjconsultores.ventaboletos.entidad.Ruta;
|
||||||
import com.rjconsultores.ventaboletos.relatorios.impl.RelatorioAproveitamentoFinanceiro;
|
import com.rjconsultores.ventaboletos.relatorios.impl.RelatorioAproveitamentoFinanceiro;
|
||||||
import com.rjconsultores.ventaboletos.relatorios.impl.RelatorioAproveitamentoFinanceiroTrecho;
|
import com.rjconsultores.ventaboletos.relatorios.impl.RelatorioAproveitamentoFinanceiroTrecho;
|
||||||
|
@ -58,7 +65,6 @@ public class RelatorioAproveitamentoFinanceiroController extends MyGenericForwar
|
||||||
private Datebox datFinal;
|
private Datebox datFinal;
|
||||||
private MyComboboxEstandar cmbEmpresa;
|
private MyComboboxEstandar cmbEmpresa;
|
||||||
private List<Empresa> lsEmpresa;
|
private List<Empresa> lsEmpresa;
|
||||||
private ArrayList<RutaVO> rutaVO = new ArrayList<RutaVO>();
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private RutaService rutaService;
|
private RutaService rutaService;
|
||||||
|
|
||||||
|
@ -68,7 +74,6 @@ public class RelatorioAproveitamentoFinanceiroController extends MyGenericForwar
|
||||||
private Textbox txtPalavraPesquisaLinha;
|
private Textbox txtPalavraPesquisaLinha;
|
||||||
private ArrayList<Ruta> lsNumLinha = new ArrayList<Ruta>();
|
private ArrayList<Ruta> lsNumLinha = new ArrayList<Ruta>();
|
||||||
private Radiogroup rgLayout;
|
private Radiogroup rgLayout;
|
||||||
private Row rowTrecho;
|
|
||||||
private Map<Integer, List<RutaVO>> mapRutaTrecho = new HashMap<>();
|
private Map<Integer, List<RutaVO>> mapRutaTrecho = new HashMap<>();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -77,11 +82,67 @@ public class RelatorioAproveitamentoFinanceiroController extends MyGenericForwar
|
||||||
|
|
||||||
lsEmpresa = UsuarioLogado.getUsuarioLogado().getEmpresa();
|
lsEmpresa = UsuarioLogado.getUsuarioLogado().getEmpresa();
|
||||||
linhaList.setItemRenderer(new RenderRelatorioAproveitamentoFinanceiro());
|
linhaList.setItemRenderer(new RenderRelatorioAproveitamentoFinanceiro());
|
||||||
linhaListSelList.setItemRenderer(new RenderRelatorioAproveitamentoFinanceiro());
|
renderizarListRuta();
|
||||||
trechoList.setItemRenderer(new RenderRelatorioAproveitamentoFinanceiroTrecho());
|
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) {
|
public void carregarTramos(Ruta rutaSelecionada) {
|
||||||
|
|
||||||
List<RutaVO> lsRutaVO = rutaService.buscaRutaParadas(rutaSelecionada.getRutaId());
|
List<RutaVO> lsRutaVO = rutaService.buscaRutaParadas(rutaSelecionada.getRutaId());
|
||||||
|
@ -113,7 +174,11 @@ public class RelatorioAproveitamentoFinanceiroController extends MyGenericForwar
|
||||||
|
|
||||||
public void onDoubleClick$linhaList(Event ev) {
|
public void onDoubleClick$linhaList(Event ev) {
|
||||||
Ruta rutaAux = (Ruta) linhaList.getSelected();
|
Ruta rutaAux = (Ruta) linhaList.getSelected();
|
||||||
|
if(rutaAux == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
linhaListSelList.addItemNovo(rutaAux);
|
linhaListSelList.addItemNovo(rutaAux);
|
||||||
|
|
||||||
carregarTramos(rutaAux);
|
carregarTramos(rutaAux);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,6 +195,13 @@ public class RelatorioAproveitamentoFinanceiroController extends MyGenericForwar
|
||||||
} catch (InterruptedException ex) {
|
} catch (InterruptedException ex) {
|
||||||
log.error(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());
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -86,15 +86,15 @@
|
||||||
<listhead>
|
<listhead>
|
||||||
<listheader
|
<listheader
|
||||||
label="${c:l('relatorioAproveitamentoFinanceiroController.lbNumRuta.label')}"
|
label="${c:l('relatorioAproveitamentoFinanceiroController.lbNumRuta.label')}"
|
||||||
width="18%" />
|
width="18%" sort="auto(numRuta)" />
|
||||||
<listheader
|
<listheader
|
||||||
label="${c:l('relatorioLinhasHorarioController.lbPrefixo.label')}"
|
label="${c:l('relatorioLinhasHorarioController.lbPrefixo.label')}"
|
||||||
width="20%" />
|
width="20%" sort="auto(prefixo)" />
|
||||||
<listheader
|
<listheader
|
||||||
label="${c:l('lb.dec')}" width="35%" />
|
label="${c:l('lb.dec')}" width="35%" sort="auto(descruta)"/>
|
||||||
<listheader
|
<listheader
|
||||||
label="${c:l('relatorioLinhasHorarioController.lbOrgao.label')}"
|
label="${c:l('relatorioLinhasHorarioController.lbOrgao.label')}"
|
||||||
width="27%" />
|
width="27%" sort="auto(orgaoConcedente.descOrgao)"/>
|
||||||
</listhead>
|
</listhead>
|
||||||
</listbox>
|
</listbox>
|
||||||
<paging id="pagingLinha" pageSize="10" />
|
<paging id="pagingLinha" pageSize="10" />
|
||||||
|
|
Loading…
Reference in New Issue