git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@29665 d1611594-4594-4d17-8e1d-87c2c4800839
parent
5f7e7da4b0
commit
32cd36cb0d
|
@ -1,9 +1,18 @@
|
||||||
package com.rjconsultores.ventaboletos.relatorios.impl;
|
package com.rjconsultores.ventaboletos.relatorios.impl;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.math.RoundingMode;
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
|
import java.sql.PreparedStatement;
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio;
|
import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio;
|
||||||
|
import com.rjconsultores.ventaboletos.relatorios.utilitarios.beans.PesoOperacional;
|
||||||
|
|
||||||
public class RelatorioOrigemDestino extends Relatorio {
|
public class RelatorioOrigemDestino extends Relatorio {
|
||||||
|
|
||||||
|
@ -22,9 +31,101 @@ public class RelatorioOrigemDestino extends Relatorio {
|
||||||
|
|
||||||
String sql = getSQL(empresaIds, corridasIds, dataDe, dataAte, bilhetesGratuitos, trechosSemMovimento);
|
String sql = getSQL(empresaIds, corridasIds, dataDe, dataAte, bilhetesGratuitos, trechosSemMovimento);
|
||||||
|
|
||||||
|
List<PesoOperacional> lsPesoOperacionalRelatorio = getPesoOperacional(corridasIds, dataDe, dataAte);
|
||||||
|
getParametros().put("lsPesoOperacionalRelatorio", lsPesoOperacionalRelatorio);
|
||||||
getParametros().put("SQL", sql);
|
getParametros().put("SQL", sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private List<PesoOperacional> getPesoOperacional(String corridasIds, String dataDe, String dataAte) throws SQLException {
|
||||||
|
StringBuilder sql = new StringBuilder();
|
||||||
|
sql.append(" SELECT ");
|
||||||
|
sql.append(" CA.CORRIDA_ID, ");
|
||||||
|
sql.append(" O.CVEPARADA CVE_ORIGEM, ");
|
||||||
|
sql.append(" O.DESCPARADA ORIGEM, ");
|
||||||
|
sql.append(" D.CVEPARADA CVE_DESTINO, ");
|
||||||
|
sql.append(" D.DESCPARADA DESTINO, ");
|
||||||
|
sql.append(" SUM(CA.PRECIOPAGADO) RECEITA ");
|
||||||
|
sql.append(" FROM CAJA CA INNER JOIN PARADA O ON O.PARADA_ID = CA.ORIGEN_ID ");
|
||||||
|
sql.append(" INNER JOIN PARADA D ON D.PARADA_ID = CA.DESTINO_ID ");
|
||||||
|
sql.append(" WHERE 1=1 ");
|
||||||
|
if (!corridasIds.equals("Todas")) {
|
||||||
|
sql.append(" AND CA.CORRIDA_ID IN (").append(corridasIds).append(")");
|
||||||
|
}
|
||||||
|
sql.append(" AND CA.FECHORVENTA BETWEEN TO_DATE('").append(dataDe).append("','DD/MM/YYYY HH24:MI:SS') AND TO_DATE('").append(dataAte).append("','DD/MM/YYYY HH24:MI:SS') ");
|
||||||
|
sql.append(" GROUP BY ");
|
||||||
|
sql.append(" CA.CORRIDA_ID, ");
|
||||||
|
sql.append(" O.CVEPARADA, ");
|
||||||
|
sql.append(" O.DESCPARADA, ");
|
||||||
|
sql.append(" D.CVEPARADA, ");
|
||||||
|
sql.append(" D.DESCPARADA ");
|
||||||
|
|
||||||
|
Connection conexao = getConexao();
|
||||||
|
|
||||||
|
PreparedStatement stmt = null;
|
||||||
|
stmt = conexao.prepareStatement(sql.toString());
|
||||||
|
|
||||||
|
ResultSet rset = null;
|
||||||
|
rset = stmt.executeQuery();
|
||||||
|
|
||||||
|
Map<String, BigDecimal> mapReceitaSaida = new HashMap<String, BigDecimal>();
|
||||||
|
Map<String, BigDecimal> mapReceitaChegada = new HashMap<String, BigDecimal>();
|
||||||
|
List<String> lsParadas = new ArrayList<String>();
|
||||||
|
BigDecimal totalReceita = BigDecimal.ZERO;
|
||||||
|
while (rset.next()) {
|
||||||
|
BigDecimal receita = rset.getBigDecimal("RECEITA");
|
||||||
|
totalReceita = totalReceita.add(receita);
|
||||||
|
|
||||||
|
String cveOrigem = rset.getString("CVE_ORIGEM");
|
||||||
|
String origem = rset.getString("ORIGEM");
|
||||||
|
String chaveOrigem = cveOrigem + " - " + origem;
|
||||||
|
|
||||||
|
String cveDestino = rset.getString("CVE_DESTINO");
|
||||||
|
String destino = rset.getString("DESTINO");
|
||||||
|
String chaveDestino = cveDestino + " - " + destino;
|
||||||
|
|
||||||
|
if (!lsParadas.contains(chaveOrigem)) {
|
||||||
|
lsParadas.add(chaveOrigem);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!lsParadas.contains(chaveDestino)) {
|
||||||
|
lsParadas.add(chaveDestino);
|
||||||
|
}
|
||||||
|
|
||||||
|
BigDecimal receitaSaida = mapReceitaSaida.get(chaveOrigem);
|
||||||
|
if (receitaSaida != null) {
|
||||||
|
mapReceitaSaida.put(chaveOrigem, receita.add(receitaSaida));
|
||||||
|
} else {
|
||||||
|
mapReceitaSaida.put(chaveOrigem, receita);
|
||||||
|
}
|
||||||
|
|
||||||
|
BigDecimal receitaChegada = mapReceitaChegada.get(chaveDestino);
|
||||||
|
if (receitaChegada != null) {
|
||||||
|
mapReceitaChegada.put(chaveDestino, receita.add(receitaChegada));
|
||||||
|
} else {
|
||||||
|
mapReceitaChegada.put(chaveDestino, receita);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
List<PesoOperacional> lsPesoOperacionalRelatorio = new ArrayList<PesoOperacional>();
|
||||||
|
for (String parada : lsParadas) {
|
||||||
|
BigDecimal receitaSaida = mapReceitaSaida.get(parada) == null ? BigDecimal.ZERO : mapReceitaSaida.get(parada);
|
||||||
|
BigDecimal receitaChegada = mapReceitaChegada.get(parada) == null ? BigDecimal.ZERO : mapReceitaChegada.get(parada);
|
||||||
|
BigDecimal soma = receitaSaida.add(receitaChegada);
|
||||||
|
BigDecimal peso = soma.divide(totalReceita, 2, RoundingMode.HALF_EVEN);
|
||||||
|
|
||||||
|
PesoOperacional pesoOperacional = new PesoOperacional();
|
||||||
|
pesoOperacional.setLocalidade(parada);
|
||||||
|
pesoOperacional.setReceitaSaida(receitaSaida);
|
||||||
|
pesoOperacional.setReceitaChegada(receitaChegada);
|
||||||
|
pesoOperacional.setSoma(soma);
|
||||||
|
pesoOperacional.setPeso(peso);
|
||||||
|
|
||||||
|
lsPesoOperacionalRelatorio.add(pesoOperacional);
|
||||||
|
}
|
||||||
|
|
||||||
|
return lsPesoOperacionalRelatorio;
|
||||||
|
}
|
||||||
|
|
||||||
private String getSQL(String empresaIds, String corridasIds, String dataDe, String dataAte,
|
private String getSQL(String empresaIds, String corridasIds, String dataDe, String dataAte,
|
||||||
Boolean bilhetesGratuitos, Boolean trechosSemMovimento) {
|
Boolean bilhetesGratuitos, Boolean trechosSemMovimento) {
|
||||||
|
|
||||||
|
|
Binary file not shown.
|
@ -3,12 +3,19 @@
|
||||||
<property name="ireport.zoom" value="1.0"/>
|
<property name="ireport.zoom" value="1.0"/>
|
||||||
<property name="ireport.x" value="0"/>
|
<property name="ireport.x" value="0"/>
|
||||||
<property name="ireport.y" value="0"/>
|
<property name="ireport.y" value="0"/>
|
||||||
<subDataset name="dataset1" uuid="882a604d-c16c-48dd-a233-82050b48569b"/>
|
<subDataset name="peso_operacional" uuid="6107709b-669e-4e25-b14f-19ae373fd33c">
|
||||||
|
<field name="localidade" class="java.lang.String"/>
|
||||||
|
<field name="receitaSaida" class="java.math.BigDecimal"/>
|
||||||
|
<field name="receitaChegada" class="java.math.BigDecimal"/>
|
||||||
|
<field name="soma" class="java.math.BigDecimal"/>
|
||||||
|
<field name="peso" class="java.math.BigDecimal"/>
|
||||||
|
</subDataset>
|
||||||
<parameter name="SQL" class="java.lang.String"/>
|
<parameter name="SQL" class="java.lang.String"/>
|
||||||
<parameter name="DATA_DE" class="java.lang.String"/>
|
<parameter name="DATA_DE" class="java.lang.String"/>
|
||||||
<parameter name="DATA_ATE" class="java.lang.String"/>
|
<parameter name="DATA_ATE" class="java.lang.String"/>
|
||||||
<parameter name="EMPRESAS" class="java.lang.String"/>
|
<parameter name="EMPRESAS" class="java.lang.String"/>
|
||||||
<parameter name="CORRIDAS_SELECIONADAS" class="java.lang.String"/>
|
<parameter name="CORRIDAS_SELECIONADAS" class="java.lang.String"/>
|
||||||
|
<parameter name="lsPesoOperacionalRelatorio" class="java.util.List" isForPrompting="false"/>
|
||||||
<queryString>
|
<queryString>
|
||||||
<![CDATA[$P!{SQL}]]>
|
<![CDATA[$P!{SQL}]]>
|
||||||
</queryString>
|
</queryString>
|
||||||
|
@ -238,7 +245,7 @@
|
||||||
</band>
|
</band>
|
||||||
</groupHeader>
|
</groupHeader>
|
||||||
<groupFooter>
|
<groupFooter>
|
||||||
<band height="143">
|
<band height="231">
|
||||||
<textField pattern="#,##0.00">
|
<textField pattern="#,##0.00">
|
||||||
<reportElement uuid="47543add-d41f-4a2d-bd53-424b419773d2" x="226" y="1" width="60" height="20"/>
|
<reportElement uuid="47543add-d41f-4a2d-bd53-424b419773d2" x="226" y="1" width="60" height="20"/>
|
||||||
<textElement textAlignment="Right">
|
<textElement textAlignment="Right">
|
||||||
|
@ -397,8 +404,85 @@
|
||||||
<textFieldExpression><![CDATA[$V{sum_equivalente}]]></textFieldExpression>
|
<textFieldExpression><![CDATA[$V{sum_equivalente}]]></textFieldExpression>
|
||||||
</textField>
|
</textField>
|
||||||
<line>
|
<line>
|
||||||
<reportElement uuid="a8bb0411-9a3c-49da-9ef4-b7d1bc20696e" x="0" y="141" width="555" height="1"/>
|
<reportElement uuid="a8bb0411-9a3c-49da-9ef4-b7d1bc20696e" positionType="Float" x="0" y="230" width="555" height="1"/>
|
||||||
</line>
|
</line>
|
||||||
|
<staticText>
|
||||||
|
<reportElement uuid="d4f3ad63-ee47-44d6-9ffd-966cf144a7d1" x="0" y="170" width="140" height="20"/>
|
||||||
|
<textElement>
|
||||||
|
<font isBold="true"/>
|
||||||
|
</textElement>
|
||||||
|
<text><![CDATA[Localidade]]></text>
|
||||||
|
</staticText>
|
||||||
|
<staticText>
|
||||||
|
<reportElement uuid="4e986dd5-a716-4d02-a723-3e9fbed1d4fd" x="140" y="170" width="74" height="20"/>
|
||||||
|
<textElement>
|
||||||
|
<font isBold="true"/>
|
||||||
|
</textElement>
|
||||||
|
<text><![CDATA[Rec. Saida]]></text>
|
||||||
|
</staticText>
|
||||||
|
<staticText>
|
||||||
|
<reportElement uuid="07c2b3bb-13ef-4862-95d6-da697714905e" x="214" y="170" width="74" height="20"/>
|
||||||
|
<textElement>
|
||||||
|
<font isBold="true"/>
|
||||||
|
</textElement>
|
||||||
|
<text><![CDATA[Rec. Chegada]]></text>
|
||||||
|
</staticText>
|
||||||
|
<staticText>
|
||||||
|
<reportElement uuid="8930f2c6-9cbe-419a-9678-8d72dc141eed" x="288" y="170" width="74" height="20"/>
|
||||||
|
<textElement>
|
||||||
|
<font isBold="true"/>
|
||||||
|
</textElement>
|
||||||
|
<text><![CDATA[Soma]]></text>
|
||||||
|
</staticText>
|
||||||
|
<staticText>
|
||||||
|
<reportElement uuid="64d4208c-4752-4389-aa26-4ca6e97db6ac" x="362" y="170" width="74" height="20"/>
|
||||||
|
<textElement>
|
||||||
|
<font isBold="true"/>
|
||||||
|
</textElement>
|
||||||
|
<text><![CDATA[Peso]]></text>
|
||||||
|
</staticText>
|
||||||
|
<componentElement>
|
||||||
|
<reportElement uuid="fc473644-667d-480e-adf3-0b7abdc99aa5" x="0" y="190" width="436" height="20"/>
|
||||||
|
<jr:list xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd">
|
||||||
|
<datasetRun subDataset="peso_operacional" uuid="3a1016b0-b7f0-420b-9988-a08178b15c62">
|
||||||
|
<dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($P{lsPesoOperacionalRelatorio})]]></dataSourceExpression>
|
||||||
|
</datasetRun>
|
||||||
|
<jr:listContents height="20" width="436">
|
||||||
|
<textField>
|
||||||
|
<reportElement uuid="4ef0b54c-34d5-4bf6-b86c-b807b23e7026" x="0" y="0" width="140" height="20"/>
|
||||||
|
<textElement/>
|
||||||
|
<textFieldExpression><![CDATA[$F{localidade}]]></textFieldExpression>
|
||||||
|
</textField>
|
||||||
|
<textField>
|
||||||
|
<reportElement uuid="06fc754c-d01f-4a92-bd76-7e900d93a69a" x="140" y="0" width="74" height="20"/>
|
||||||
|
<textElement/>
|
||||||
|
<textFieldExpression><![CDATA[$F{receitaSaida}]]></textFieldExpression>
|
||||||
|
</textField>
|
||||||
|
<textField>
|
||||||
|
<reportElement uuid="ceb27078-6808-4d71-882d-c22332c3e5a3" x="214" y="0" width="74" height="20"/>
|
||||||
|
<textElement/>
|
||||||
|
<textFieldExpression><![CDATA[$F{receitaChegada}]]></textFieldExpression>
|
||||||
|
</textField>
|
||||||
|
<textField>
|
||||||
|
<reportElement uuid="d75fc1b6-95f3-453a-8d09-40e9bc7959b8" x="288" y="0" width="74" height="20"/>
|
||||||
|
<textElement/>
|
||||||
|
<textFieldExpression><![CDATA[$F{soma}]]></textFieldExpression>
|
||||||
|
</textField>
|
||||||
|
<textField>
|
||||||
|
<reportElement uuid="fd0a475e-2147-498c-8363-04a4af4031c4" x="362" y="0" width="74" height="20"/>
|
||||||
|
<textElement/>
|
||||||
|
<textFieldExpression><![CDATA[$F{peso}]]></textFieldExpression>
|
||||||
|
</textField>
|
||||||
|
</jr:listContents>
|
||||||
|
</jr:list>
|
||||||
|
</componentElement>
|
||||||
|
<staticText>
|
||||||
|
<reportElement uuid="f65284c0-c782-4168-b4be-867c1fbcdd79" x="0" y="150" width="140" height="20"/>
|
||||||
|
<textElement>
|
||||||
|
<font size="11" isBold="true"/>
|
||||||
|
</textElement>
|
||||||
|
<text><![CDATA[Peso Operacional]]></text>
|
||||||
|
</staticText>
|
||||||
</band>
|
</band>
|
||||||
</groupFooter>
|
</groupFooter>
|
||||||
</group>
|
</group>
|
||||||
|
|
|
@ -0,0 +1,51 @@
|
||||||
|
package com.rjconsultores.ventaboletos.relatorios.utilitarios.beans;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
public class PesoOperacional {
|
||||||
|
private String localidade;
|
||||||
|
private BigDecimal receitaSaida;
|
||||||
|
private BigDecimal receitaChegada;
|
||||||
|
private BigDecimal soma;
|
||||||
|
private BigDecimal peso;
|
||||||
|
|
||||||
|
public String getLocalidade() {
|
||||||
|
return localidade;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLocalidade(String localidade) {
|
||||||
|
this.localidade = localidade;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getReceitaSaida() {
|
||||||
|
return receitaSaida;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setReceitaSaida(BigDecimal receitaSaida) {
|
||||||
|
this.receitaSaida = receitaSaida;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getReceitaChegada() {
|
||||||
|
return receitaChegada;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setReceitaChegada(BigDecimal receitaChegada) {
|
||||||
|
this.receitaChegada = receitaChegada;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getSoma() {
|
||||||
|
return soma;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSoma(BigDecimal soma) {
|
||||||
|
this.soma = soma;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getPeso() {
|
||||||
|
return peso;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPeso(BigDecimal peso) {
|
||||||
|
this.peso = peso;
|
||||||
|
}
|
||||||
|
}
|
|
@ -39,6 +39,7 @@ import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||||
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.HibernateSearchObject;
|
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.HibernateSearchObject;
|
||||||
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.PagedListWrapper;
|
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.PagedListWrapper;
|
||||||
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderRelatorioLinhaOperacionalRuta;
|
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderRelatorioLinhaOperacionalRuta;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderRelatorioLinhaOperacionalRutaSelecionadas;
|
||||||
|
|
||||||
@Controller("relatorioLinhaOperacionalController")
|
@Controller("relatorioLinhaOperacionalController")
|
||||||
@Scope("prototype")
|
@Scope("prototype")
|
||||||
|
@ -56,6 +57,7 @@ public class RelatorioLinhaOperacionalController extends MyGenericForwardCompose
|
||||||
private Datebox datFinal;
|
private Datebox datFinal;
|
||||||
private Paging pagingRuta;
|
private Paging pagingRuta;
|
||||||
private MyListbox rutaList;
|
private MyListbox rutaList;
|
||||||
|
private MyListbox rutaSelList;
|
||||||
private Textbox txtPalavraPesquisa;
|
private Textbox txtPalavraPesquisa;
|
||||||
private Combobox cmbEmpresa;
|
private Combobox cmbEmpresa;
|
||||||
private Combobox cmbEspecie;
|
private Combobox cmbEspecie;
|
||||||
|
@ -89,6 +91,7 @@ public class RelatorioLinhaOperacionalController extends MyGenericForwardCompose
|
||||||
super.doAfterCompose(comp);
|
super.doAfterCompose(comp);
|
||||||
|
|
||||||
rutaList.setItemRenderer(new RenderRelatorioLinhaOperacionalRuta());
|
rutaList.setItemRenderer(new RenderRelatorioLinhaOperacionalRuta());
|
||||||
|
rutaSelList.setItemRenderer(new RenderRelatorioLinhaOperacionalRutaSelecionadas());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void limparPesquisa() {
|
private void limparPesquisa() {
|
||||||
|
@ -127,8 +130,19 @@ public class RelatorioLinhaOperacionalController extends MyGenericForwardCompose
|
||||||
executarPesquisa();
|
executarPesquisa();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void onDoubleClick$rutaSelList(Event ev) {
|
||||||
|
Ruta ruta = (Ruta) rutaSelList.getSelected();
|
||||||
|
rutaSelList.removeItem(ruta);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onDoubleClick$rutaList(Event ev) {
|
||||||
|
Ruta ruta = (Ruta) rutaList.getSelected();
|
||||||
|
rutaSelList.addItemNovo(ruta);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||||
private String getDescRutasSelecionadas() {
|
private String getDescRutasSelecionadas() {
|
||||||
List<Ruta> lsRutasSelecionadas = new ArrayList<Ruta>(Arrays.asList(rutaList.getSelectedsItens().toArray(new Ruta[rutaList.getSelectedsItens().size()])));
|
List<Ruta> lsRutasSelecionadas = new ArrayList(Arrays.asList(rutaSelList.getData()));
|
||||||
StringBuilder selecionadas = new StringBuilder("");
|
StringBuilder selecionadas = new StringBuilder("");
|
||||||
if (!lsRutasSelecionadas.isEmpty()) {
|
if (!lsRutasSelecionadas.isEmpty()) {
|
||||||
for (Ruta ruta : lsRutasSelecionadas) {
|
for (Ruta ruta : lsRutasSelecionadas) {
|
||||||
|
@ -139,12 +153,9 @@ public class RelatorioLinhaOperacionalController extends MyGenericForwardCompose
|
||||||
return selecionadas.toString();
|
return selecionadas.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onClick$bbPesquisaPuntoVenta(Event ev) {
|
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||||
bbPesquisaPuntoVenta.setText(getDescRutasSelecionadas());
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onClick$btnExecutarRelatorio(Event ev) throws InterruptedException, SQLException {
|
public void onClick$btnExecutarRelatorio(Event ev) throws InterruptedException, SQLException {
|
||||||
List<Ruta> lsRutasSelecionadas = new ArrayList<Ruta>(Arrays.asList(rutaList.getSelectedsItens().toArray(new Ruta[rutaList.getSelectedsItens().size()])));
|
List<Ruta> lsRutasSelecionadas = new ArrayList(Arrays.asList(rutaSelList.getData()));
|
||||||
|
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
|
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
|
||||||
Date dataDe = datInicial.getValue();
|
Date dataDe = datInicial.getValue();
|
||||||
|
|
|
@ -36,6 +36,7 @@ import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||||
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.HibernateSearchObject;
|
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.HibernateSearchObject;
|
||||||
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.PagedListWrapper;
|
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.PagedListWrapper;
|
||||||
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderRelatorioOrigemDestinoCorrida;
|
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderRelatorioOrigemDestinoCorrida;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderRelatorioOrigemDestinoCorridaSelecionadas;
|
||||||
import com.trg.search.Filter;
|
import com.trg.search.Filter;
|
||||||
|
|
||||||
@Controller("relatorioOrigemDestinoController")
|
@Controller("relatorioOrigemDestinoController")
|
||||||
|
@ -55,6 +56,7 @@ public class RelatorioOrigemDestinoController extends MyGenericForwardComposer {
|
||||||
private Intbox txtCorridaId;
|
private Intbox txtCorridaId;
|
||||||
private Paging pagingCorrida;
|
private Paging pagingCorrida;
|
||||||
private MyListbox corridaList;
|
private MyListbox corridaList;
|
||||||
|
private MyListbox corridaSelList;
|
||||||
private Combobox cmbEmpresa;
|
private Combobox cmbEmpresa;
|
||||||
private Bandbox bbPesquisaCorrida;
|
private Bandbox bbPesquisaCorrida;
|
||||||
private Checkbox chkBilhetesGratuitos;
|
private Checkbox chkBilhetesGratuitos;
|
||||||
|
@ -74,6 +76,7 @@ public class RelatorioOrigemDestinoController extends MyGenericForwardComposer {
|
||||||
super.doAfterCompose(comp);
|
super.doAfterCompose(comp);
|
||||||
|
|
||||||
corridaList.setItemRenderer(new RenderRelatorioOrigemDestinoCorrida());
|
corridaList.setItemRenderer(new RenderRelatorioOrigemDestinoCorrida());
|
||||||
|
corridaSelList.setItemRenderer(new RenderRelatorioOrigemDestinoCorridaSelecionadas());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void executarPesquisa() {
|
private void executarPesquisa() {
|
||||||
|
@ -112,21 +115,19 @@ public class RelatorioOrigemDestinoController extends MyGenericForwardComposer {
|
||||||
executarPesquisa();
|
executarPesquisa();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onClick$bbPesquisaCorrida(Event ev) {
|
public void onDoubleClick$corridaSelList(Event ev) {
|
||||||
List<Corrida> lsCorridasSelecionadas = new ArrayList<Corrida>(Arrays.asList(corridaList.getSelectedsItens().toArray(new Corrida[corridaList.getSelectedsItens().size()])));
|
Corrida corrida = (Corrida) corridaSelList.getSelected();
|
||||||
|
corridaSelList.removeItem(corrida);
|
||||||
if (!lsCorridasSelecionadas.isEmpty()) {
|
|
||||||
StringBuilder selecionadas = new StringBuilder("");
|
|
||||||
for (Corrida corrida : lsCorridasSelecionadas) {
|
|
||||||
selecionadas.append(corrida.getId().getCorridaId()).append(", ");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bbPesquisaCorrida.setText(selecionadas.toString());
|
public void onDoubleClick$corridaList(Event ev) {
|
||||||
}
|
Corrida corrida = (Corrida) corridaList.getSelected();
|
||||||
|
corridaSelList.addItemNovo(corrida);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||||
public void onClick$btnExecutarRelatorio(Event ev) throws Exception {
|
public void onClick$btnExecutarRelatorio(Event ev) throws Exception {
|
||||||
List<Corrida> lsCorridasSelecionadas = new ArrayList<Corrida>(Arrays.asList(corridaList.getSelectedsItens().toArray(new Corrida[corridaList.getSelectedsItens().size()])));
|
List<Corrida> lsCorridasSelecionadas = new ArrayList(Arrays.asList(corridaSelList.getData()));
|
||||||
|
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
|
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
|
||||||
Date dataDe = datInicial.getValue();
|
Date dataDe = datInicial.getValue();
|
||||||
|
@ -157,7 +158,6 @@ public class RelatorioOrigemDestinoController extends MyGenericForwardComposer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
parametros.put("EMPRESA_IDS", empresaId);
|
parametros.put("EMPRESA_IDS", empresaId);
|
||||||
// parametros.put("EMPRESAS", empresas.substring(1, empresas.length()));
|
|
||||||
parametros.put("EMPRESAS", empresas);
|
parametros.put("EMPRESAS", empresas);
|
||||||
|
|
||||||
String corridaIds = "";
|
String corridaIds = "";
|
||||||
|
|
|
@ -0,0 +1,45 @@
|
||||||
|
package com.rjconsultores.ventaboletos.web.utilerias.render;
|
||||||
|
|
||||||
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
import org.zkoss.zk.ui.event.EventListener;
|
||||||
|
import org.zkoss.zul.Button;
|
||||||
|
import org.zkoss.zul.Listcell;
|
||||||
|
import org.zkoss.zul.Listitem;
|
||||||
|
import org.zkoss.zul.ListitemRenderer;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Ruta;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||||
|
|
||||||
|
public class RenderRelatorioLinhaOperacionalRutaSelecionadas implements ListitemRenderer {
|
||||||
|
|
||||||
|
public void render(Listitem lstm, Object o) throws Exception {
|
||||||
|
Ruta puntoVenta = (Ruta) o;
|
||||||
|
|
||||||
|
Listcell lc = new Listcell(puntoVenta.getRutaId().toString());
|
||||||
|
lc.setParent(lstm);
|
||||||
|
|
||||||
|
lc = new Listcell(puntoVenta.getDescruta());
|
||||||
|
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"));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
lc.appendChild(btn);
|
||||||
|
lstm.setAttribute("data", puntoVenta);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,55 @@
|
||||||
|
package com.rjconsultores.ventaboletos.web.utilerias.render;
|
||||||
|
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
|
||||||
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
import org.zkoss.zk.ui.event.EventListener;
|
||||||
|
import org.zkoss.zul.Button;
|
||||||
|
import org.zkoss.zul.Listcell;
|
||||||
|
import org.zkoss.zul.Listitem;
|
||||||
|
import org.zkoss.zul.ListitemRenderer;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Corrida;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||||
|
|
||||||
|
public class RenderRelatorioOrigemDestinoCorridaSelecionadas implements ListitemRenderer {
|
||||||
|
|
||||||
|
private SimpleDateFormat sdfDia = new SimpleDateFormat("dd/MM/yyyy");
|
||||||
|
|
||||||
|
public void render(Listitem lstm, Object o) throws Exception {
|
||||||
|
Corrida corrida = (Corrida) o;
|
||||||
|
|
||||||
|
Listcell lc = new Listcell(corrida.getId().getCorridaId().toString());
|
||||||
|
lc.setParent(lstm);
|
||||||
|
|
||||||
|
lc = new Listcell(sdfDia.format(corrida.getId().getFeccorrida()));
|
||||||
|
lc.setParent(lstm);
|
||||||
|
|
||||||
|
lc = new Listcell(corrida.getOrigem().getDescparada());
|
||||||
|
lc.setParent(lstm);
|
||||||
|
|
||||||
|
lc = new Listcell(corrida.getDestino().getDescparada());
|
||||||
|
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((Corrida) listItem.getAttribute("data"));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
lc.appendChild(btn);
|
||||||
|
lstm.setAttribute("data", corrida);
|
||||||
|
}
|
||||||
|
}
|
|
@ -78,6 +78,8 @@
|
||||||
<row spans="1,3">
|
<row spans="1,3">
|
||||||
<label
|
<label
|
||||||
value="${c:l('relatorioLinhaOperacionalController.lbRuta.value')}" />
|
value="${c:l('relatorioLinhaOperacionalController.lbRuta.value')}" />
|
||||||
|
|
||||||
|
<vbox>
|
||||||
<bandbox id="bbPesquisaPuntoVenta" width="100%"
|
<bandbox id="bbPesquisaPuntoVenta" width="100%"
|
||||||
mold="rounded" readonly="true">
|
mold="rounded" readonly="true">
|
||||||
<bandpopup>
|
<bandpopup>
|
||||||
|
@ -96,11 +98,12 @@
|
||||||
label="${c:l('relatorioLinhaOperacionalController.btnLimpar.label')}" />
|
label="${c:l('relatorioLinhaOperacionalController.btnLimpar.label')}" />
|
||||||
</hbox>
|
</hbox>
|
||||||
|
|
||||||
<paging id="pagingRuta" pageSize="20" />
|
|
||||||
|
<paging id="pagingRuta"
|
||||||
|
pageSize="20" />
|
||||||
<listbox id="rutaList" mold="paging"
|
<listbox id="rutaList" mold="paging"
|
||||||
checkmark="true"
|
|
||||||
use="com.rjconsultores.ventaboletos.web.utilerias.MyListbox"
|
use="com.rjconsultores.ventaboletos.web.utilerias.MyListbox"
|
||||||
vflex="true" multiple="true" height="100%" width="650px">
|
vflex="true" height="100%" width="650px">
|
||||||
<listhead>
|
<listhead>
|
||||||
<listheader
|
<listheader
|
||||||
label="${c:l('lb.id')}" width="15%" />
|
label="${c:l('lb.id')}" width="15%" />
|
||||||
|
@ -117,6 +120,20 @@
|
||||||
</vbox>
|
</vbox>
|
||||||
</bandpopup>
|
</bandpopup>
|
||||||
</bandbox>
|
</bandbox>
|
||||||
|
|
||||||
|
<listbox id="rutaSelList" mold="paging"
|
||||||
|
use="com.rjconsultores.ventaboletos.web.utilerias.MyListbox"
|
||||||
|
vflex="true" height="100px" width="100%">
|
||||||
|
<listhead>
|
||||||
|
<listheader label="${c:l('lb.id')}"
|
||||||
|
width="15%" />
|
||||||
|
<listheader label="${c:l('lb.dec')}"
|
||||||
|
width="75%" />
|
||||||
|
<listheader width="10%" />
|
||||||
|
</listhead>
|
||||||
|
</listbox>
|
||||||
|
<paging id="pagingSelRuta" pageSize="10" />
|
||||||
|
</vbox>
|
||||||
</row>
|
</row>
|
||||||
|
|
||||||
<row spans="4">
|
<row spans="4">
|
||||||
|
|
|
@ -41,6 +41,8 @@
|
||||||
<row spans="1,3">
|
<row spans="1,3">
|
||||||
<label
|
<label
|
||||||
value="${c:l('relatorioOrigemDestinoController.lbServico.value')}" />
|
value="${c:l('relatorioOrigemDestinoController.lbServico.value')}" />
|
||||||
|
|
||||||
|
<vbox>
|
||||||
<bandbox id="bbPesquisaCorrida" width="100%"
|
<bandbox id="bbPesquisaCorrida" width="100%"
|
||||||
mold="rounded" readonly="true">
|
mold="rounded" readonly="true">
|
||||||
<bandpopup>
|
<bandpopup>
|
||||||
|
@ -59,10 +61,10 @@
|
||||||
</hbox>
|
</hbox>
|
||||||
<paging id="pagingCorrida"
|
<paging id="pagingCorrida"
|
||||||
pageSize="10" />
|
pageSize="10" />
|
||||||
<listbox id="corridaList" mold="paging"
|
<listbox id="corridaList"
|
||||||
checkmark="true"
|
mold="paging"
|
||||||
use="com.rjconsultores.ventaboletos.web.utilerias.MyListbox"
|
use="com.rjconsultores.ventaboletos.web.utilerias.MyListbox"
|
||||||
vflex="true" multiple="true" height="100%" width="700px">
|
vflex="true" height="100%" width="700px">
|
||||||
<listhead>
|
<listhead>
|
||||||
<listheader
|
<listheader
|
||||||
label="${c:l('relatorioOrigemDestinoController.lbServico.value')}"
|
label="${c:l('relatorioOrigemDestinoController.lbServico.value')}"
|
||||||
|
@ -87,6 +89,28 @@
|
||||||
</vbox>
|
</vbox>
|
||||||
</bandpopup>
|
</bandpopup>
|
||||||
</bandbox>
|
</bandbox>
|
||||||
|
|
||||||
|
<listbox id="corridaSelList" mold="paging"
|
||||||
|
use="com.rjconsultores.ventaboletos.web.utilerias.MyListbox"
|
||||||
|
vflex="true" height="100px" width="100%">
|
||||||
|
<listhead>
|
||||||
|
<listheader
|
||||||
|
label="${c:l('relatorioOrigemDestinoController.lbServico.value')}"
|
||||||
|
width="10%" />
|
||||||
|
<listheader
|
||||||
|
label="${c:l('relatorioOrigemDestinoController.lbFecServico.value')}"
|
||||||
|
width="15%" />
|
||||||
|
<listheader
|
||||||
|
label="${c:l('relatorioOrigemDestinoController.origem.label')}"
|
||||||
|
width="33%" />
|
||||||
|
<listheader
|
||||||
|
label="${c:l('relatorioOrigemDestinoController.destino.label')}"
|
||||||
|
width="33%" />
|
||||||
|
<listheader width="9%" />
|
||||||
|
</listhead>
|
||||||
|
</listbox>
|
||||||
|
<paging id="pagingSelCorrida" pageSize="10" />
|
||||||
|
</vbox>
|
||||||
</row>
|
</row>
|
||||||
|
|
||||||
<row spans="4">
|
<row spans="4">
|
||||||
|
|
Loading…
Reference in New Issue