correcao (bug 5885)

git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@40094 d1611594-4594-4d17-8e1d-87c2c4800839
master
lucas.taia 2014-12-02 12:50:26 +00:00
parent c20bb50eaf
commit 99f5950d1b
2 changed files with 239 additions and 236 deletions

View File

@ -3,22 +3,21 @@ package com.rjconsultores.ventaboletos.relatorios.impl;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource;
import org.zkoss.util.resource.Labels;
import org.zkoss.zhtml.Messagebox;
import com.rjconsultores.ventaboletos.entidad.Corrida;
import com.rjconsultores.ventaboletos.entidad.Empresa;
import com.rjconsultores.ventaboletos.entidad.GrupoRuta;
import com.rjconsultores.ventaboletos.entidad.Ruta;
import com.rjconsultores.ventaboletos.relatorios.utilitarios.DataSource;
import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio;
import com.rjconsultores.ventaboletos.relatorios.utilitarios.RelatorioLinhasHorarioBean;
import com.rjconsultores.ventaboletos.web.utilerias.NamedParameterStatement;
public class RelatorioLinhasHorario extends Relatorio {
@ -27,208 +26,212 @@ public class RelatorioLinhasHorario extends Relatorio {
public RelatorioLinhasHorario(Map<String, Object> parametros, Connection conexao) throws Exception {
super(parametros, conexao);
this.setCustomDataSource(new DataSource(this) {
@Override
public void initDados() throws Exception {
Messagebox.show(Labels.getLabel("MSG.Error"),
Labels.getLabel("relatorioAcompanhamentoEquivalentesController.window.title"),
Messagebox.OK, Messagebox.INFORMATION);
Connection conexao = this.relatorio.getConexao();
Map<String, Object> parametros = this.relatorio.getParametros();
@SuppressWarnings("unchecked")
ArrayList<Ruta> lsNumLinha = (ArrayList<Ruta>) parametros.get("lsNumLinha");
@SuppressWarnings("unchecked")
ArrayList<Corrida> lsNumServico = (ArrayList<Corrida>) parametros.get("lsNumServico");
String servicoFiltro = "";
if (lsNumServico.size() > 0) {
for (Corrida corrida : lsNumServico) {
if (lsNumServico.indexOf(corrida) == 0) {
servicoFiltro = "" + corrida.getId().getCorridaId();
} else {
servicoFiltro += ", " + corrida.getId().getCorridaId();
}
}
} else {
servicoFiltro = "TODOS";
}
parametros.put("SERVICO_FILTRO", servicoFiltro);
String linhaFiltro = "";
if (lsNumLinha.size() > 0) {
for (Ruta ruta : lsNumLinha) {
if (lsNumLinha.indexOf(ruta) == 0) {
linhaFiltro = "" + ruta.getRutaId();
} else {
linhaFiltro += ", " + ruta.getRutaId();
}
}
} else {
linhaFiltro = "TODOS";
}
parametros.put("LINHA_FILTRO", linhaFiltro);
Empresa empresa = (Empresa) parametros.get("EMPRESA");
GrupoRuta grupoRuta = (GrupoRuta) parametros.get("GRUPORUTA");
Integer tipoServico = (Integer) parametros.get("TIPOSERVICIO_ID");
String sql = getSql(lsNumLinha, lsNumServico, empresa, tipoServico, grupoRuta);
System.out.println(sql);
NamedParameterStatement stmt = new NamedParameterStatement(conexao, sql);
ResultSet rset = null;
stmt.setTimestamp("DATA_INICIO", (Timestamp) parametros.get("DATA_INICIO"));
stmt.setTimestamp("DATA_FINAL", (Timestamp) parametros.get("DATA_FINAL"));
rset = stmt.executeQuery();
lsDadosRelatorio = new ArrayList<RelatorioLinhasHorarioBean>();
BigDecimal totalPassagens = BigDecimal.ZERO;
BigDecimal totalSeguro = BigDecimal.ZERO;
BigDecimal totalBagagens = BigDecimal.ZERO;
BigDecimal totalSeuroOpcional = BigDecimal.ZERO;
BigDecimal totalTotal = BigDecimal.ZERO;
BigDecimal totalOrdinario = BigDecimal.ZERO;
BigDecimal totalExtra = BigDecimal.ZERO;
BigDecimal totalViagem = BigDecimal.ZERO;
BigDecimal totalKmRodado = BigDecimal.ZERO;
BigDecimal totalAbsoluto = BigDecimal.ZERO;
BigDecimal totalEquivalente = BigDecimal.ZERO;
BigDecimal mediaMPA = BigDecimal.ZERO;
BigDecimal mediaMPE = BigDecimal.ZERO;
BigDecimal mediaRsPorKm = BigDecimal.ZERO;
BigDecimal totalEQ = BigDecimal.ZERO;
BigDecimal mediaRSPorViagem = BigDecimal.ZERO;
BigDecimal totalPaxKMOfertado = BigDecimal.ZERO;
BigDecimal totalPaxKMTransportado = BigDecimal.ZERO;
BigDecimal totalIAP = BigDecimal.ZERO;
BigDecimal totalTxEmbarque = BigDecimal.ZERO;
BigDecimal totalPedagio = BigDecimal.ZERO;
String group = null;
while (rset.next()) {
RelatorioLinhasHorarioBean horarioBean = new RelatorioLinhasHorarioBean();
group = ((String) rset.getObject("GRUPO_RUTA"));
horarioBean.setGrupoRuta(group);
horarioBean.setTipoLinha((String) rset.getObject("TIPO_LINHA"));
horarioBean.setHora((String) rset.getObject("HORA"));
horarioBean.setServico((BigDecimal) rset.getObject("SERVICO"));
if (rset.getObject("SENTIDO") != null)
horarioBean.convetSentido((BigDecimal) rset.getObject("SENTIDO"));
else
horarioBean.convetSentido(null);
horarioBean.setLot((BigDecimal) rset.getObject("LOT"));
horarioBean.setCla((String) rset.getObject("CLA"));
horarioBean.setExtensao((BigDecimal) rset.getObject("EXTENSAO"));
horarioBean.setTarifa((BigDecimal) rset.getObject("TARIFA"));
horarioBean.setPassagens((BigDecimal) rset.getObject("PASSAGENS"));
horarioBean.setSeguro((BigDecimal) rset.getObject("SEGURO"));
horarioBean.setBagagens((BigDecimal) rset.getObject("BAGAGENS"));
horarioBean.setTxEmbarque((BigDecimal) rset.getObject("TX_EMBARQUE"));
horarioBean.setPedagio((BigDecimal) rset.getObject("PEDAGIO"));
// Substituir a coluna Seg. Opcional por Tx. Embarque
horarioBean.setSegOpc(horarioBean.getTxEmbarque());
horarioBean.setOrd((BigDecimal) rset.getObject("ORD"));
horarioBean.setExtra((BigDecimal) rset.getObject("EXTRA"));
horarioBean.setAbsol((BigDecimal) rset.getObject("ABSOL"));
horarioBean.setOrigem((String) rset.getObject("ORIGEM"));
horarioBean.setDestino((String) rset.getObject("DESTINO"));
horarioBean.setSomaExtensaoTrecho((BigDecimal) rset.getObject("EXTENSAO_TRECHO"));
horarioBean = trecho(horarioBean);
horarioBean = calcTotal(horarioBean);
horarioBean = calcMediaReceitaTotal(horarioBean);
horarioBean = calcTotalViagem(horarioBean);
horarioBean = calcKmRodado(horarioBean);
horarioBean = calcEquivalente(horarioBean);
horarioBean = calcMpa(horarioBean);
horarioBean = calcMpe(horarioBean);
horarioBean = calcRsKm(horarioBean);
horarioBean = calcEq(horarioBean);
horarioBean = calcRsViagem(horarioBean);
horarioBean = calcPaxKmOfertado(horarioBean);
horarioBean = calcPaxKmTransportado(horarioBean);
horarioBean = calcIap(horarioBean);
lsDadosRelatorio.add(horarioBean);
totalPassagens = totalPassagens.add(horarioBean.getPassagens() != null ? horarioBean.getPassagens() : BigDecimal.ZERO);
totalSeguro = totalSeguro.add(horarioBean.getSeguro() != null ? horarioBean.getSeguro() : BigDecimal.ZERO);
totalBagagens = totalBagagens.add(horarioBean.getBagagens() != null ? horarioBean.getBagagens() : BigDecimal.ZERO);
totalSeuroOpcional = totalSeuroOpcional.add(horarioBean.getSegOpc() != null ? horarioBean.getSegOpc() : BigDecimal.ZERO);
totalTotal = totalTotal.add(horarioBean.getTotal() != null ? horarioBean.getTotal() : BigDecimal.ZERO);
totalOrdinario = totalOrdinario.add(horarioBean.getOrd() != null ? horarioBean.getOrd() : BigDecimal.ZERO);
totalExtra = totalExtra.add(horarioBean.getExtra() != null ? horarioBean.getExtra() : BigDecimal.ZERO);
totalViagem = totalViagem.add(horarioBean.getTotalViagem() != null ? horarioBean.getTotalViagem() : BigDecimal.ZERO);
totalKmRodado = totalKmRodado.add(horarioBean.getKmRodado() != null ? horarioBean.getKmRodado() : BigDecimal.ZERO);
totalAbsoluto = totalAbsoluto.add(horarioBean.getAbsol() != null ? horarioBean.getAbsol() : BigDecimal.ZERO);
totalEquivalente = totalEquivalente.add(horarioBean.getEquivalente() != null ? horarioBean.getEquivalente() : BigDecimal.ZERO);
totalTxEmbarque = totalTxEmbarque.add(horarioBean.getTxEmbarque() != null ? horarioBean.getTxEmbarque() : BigDecimal.ZERO);
totalPedagio = totalPedagio.add(horarioBean.getPedagio() != null ? horarioBean.getPedagio() : BigDecimal.ZERO);
mediaMPA = mediaMPA.add(horarioBean.getMpa() != null ? horarioBean.getMpa() : BigDecimal.ZERO);
mediaMPE = mediaMPE.add(horarioBean.getMpe() != null ? horarioBean.getMpe() : BigDecimal.ZERO);
mediaRsPorKm = mediaRsPorKm.add(horarioBean.getRsKm() != null ? horarioBean.getRsKm() : BigDecimal.ZERO);
totalEQ = totalEQ.add(horarioBean.getEq() != null ? horarioBean.getEq() : BigDecimal.ZERO);
mediaRSPorViagem = mediaRSPorViagem.add(horarioBean.getRsViagem() != null ? horarioBean.getRsViagem() : BigDecimal.ZERO);
totalPaxKMOfertado = totalPaxKMOfertado.add(horarioBean.getPaxKmOfertado() != null ? horarioBean.getPaxKmOfertado() : BigDecimal.ZERO);
totalPaxKMTransportado = totalPaxKMTransportado.add(horarioBean.getPaxKmTransportado() != null ? horarioBean.getPaxKmTransportado() : BigDecimal.ZERO);
totalIAP = calcTotalIap(totalPaxKMTransportado, totalPaxKMOfertado);
}
BigDecimal qtdeRegistros = new BigDecimal(lsDadosRelatorio.size());
if (lsDadosRelatorio.size() > 0) {
setLsDadosRelatorio(lsDadosRelatorio);
parametros.put("TOTAL_PASSAGENS", totalPassagens);
parametros.put("TOTAL_SEGURO", totalSeguro);
parametros.put("TOTAL_BAGAGENS", totalBagagens);
parametros.put("TOTAL_SEURO_OPCIONAL", totalSeuroOpcional);
parametros.put("TOTAL_TOTAL", totalTotal);
parametros.put("TOTAL_ORDINARIO", totalOrdinario);
parametros.put("TOTAL_EXTRA", totalExtra);
parametros.put("TOTAL_VIAGEM", totalViagem);
parametros.put("TOTAL_KM_RODADO", totalKmRodado);
parametros.put("TOTAL_ABSOLUTO", totalAbsoluto);
parametros.put("TOTAL_EQUIVALENTE", totalEquivalente);
parametros.put("MEDIA_MPA", mediaMPA.divide(qtdeRegistros, 2, RoundingMode.HALF_EVEN));
parametros.put("MEDIA_MPE", mediaMPE.divide(qtdeRegistros, 2, RoundingMode.HALF_EVEN));
parametros.put("MEDIA_RS_POR_KM", mediaRsPorKm.divide(qtdeRegistros, 2, RoundingMode.HALF_EVEN));
parametros.put("TOTAL_EQ", totalEQ);
parametros.put("TOTAL_TX_EMBARQUE", totalTxEmbarque);
parametros.put("TOTAL_PEDAGIO", totalPedagio);
parametros.put("MEDIA_RS_POR_VIAGEM", mediaRSPorViagem.divide(qtdeRegistros, 2, RoundingMode.HALF_EVEN));
parametros.put("TOTAL_PAX_KM_OFERTADO", totalPaxKMOfertado);
parametros.put("TOTAL_PAX_KM_TRANSPORTADO", totalPaxKMTransportado);
parametros.put("TOTAL_IAP", totalIAP);
}
}
});
// this.setCustomDataSource(new DataSource(this) {
// @Override
// public void initDados() throws Exception {
//
// Connection conexao = this.relatorio.getConexao();
//
// Map<String, Object> parametros = this.relatorio.getParametros();
//
// @SuppressWarnings("unchecked")
// ArrayList<Ruta> lsNumLinha = (ArrayList<Ruta>) parametros.get("lsNumLinha");
// @SuppressWarnings("unchecked")
// ArrayList<Corrida> lsNumServico = (ArrayList<Corrida>) parametros.get("lsNumServico");
//
// String servicoFiltro = "";
// if (lsNumServico.size() > 0) {
// for (Corrida corrida : lsNumServico) {
// if (lsNumServico.indexOf(corrida) == 0) {
// servicoFiltro = "" + corrida.getId().getCorridaId();
// } else {
// servicoFiltro += ", " + corrida.getId().getCorridaId();
// }
// }
// } else {
// servicoFiltro = "TODOS";
// }
// parametros.put("SERVICO_FILTRO", servicoFiltro);
//
// String linhaFiltro = "";
// if (lsNumLinha.size() > 0) {
// for (Ruta ruta : lsNumLinha) {
// if (lsNumLinha.indexOf(ruta) == 0) {
// linhaFiltro = "" + ruta.getRutaId();
// } else {
// linhaFiltro += ", " + ruta.getRutaId();
// }
// }
// } else {
// linhaFiltro = "TODOS";
// }
// parametros.put("LINHA_FILTRO", linhaFiltro);
//
// Empresa empresa = (Empresa) parametros.get("EMPRESA");
//
// GrupoRuta grupoRuta = (GrupoRuta) parametros.get("GRUPORUTA");
//
// Integer tipoServico = (Integer) parametros.get("TIPOSERVICIO_ID");
// String sql = getSql(lsNumLinha, lsNumServico, empresa, tipoServico, grupoRuta);
//
// System.out.println(sql);
//
// NamedParameterStatement stmt = new NamedParameterStatement(conexao, sql);
// ResultSet rset = null;
//
// stmt.setTimestamp("DATA_INICIO", (Timestamp) parametros.get("DATA_INICIO"));
// stmt.setTimestamp("DATA_FINAL", (Timestamp) parametros.get("DATA_FINAL"));
//
// rset = stmt.executeQuery();
//
// lsDadosRelatorio = new ArrayList<RelatorioLinhasHorarioBean>();
//
// BigDecimal totalPassagens = BigDecimal.ZERO;
// BigDecimal totalSeguro = BigDecimal.ZERO;
// BigDecimal totalBagagens = BigDecimal.ZERO;
// BigDecimal totalSeuroOpcional = BigDecimal.ZERO;
// BigDecimal totalTotal = BigDecimal.ZERO;
// BigDecimal totalOrdinario = BigDecimal.ZERO;
// BigDecimal totalExtra = BigDecimal.ZERO;
// BigDecimal totalViagem = BigDecimal.ZERO;
// BigDecimal totalKmRodado = BigDecimal.ZERO;
// BigDecimal totalAbsoluto = BigDecimal.ZERO;
// BigDecimal totalEquivalente = BigDecimal.ZERO;
// BigDecimal mediaMPA = BigDecimal.ZERO;
// BigDecimal mediaMPE = BigDecimal.ZERO;
// BigDecimal mediaRsPorKm = BigDecimal.ZERO;
// BigDecimal totalEQ = BigDecimal.ZERO;
// BigDecimal mediaRSPorViagem = BigDecimal.ZERO;
// BigDecimal totalPaxKMOfertado = BigDecimal.ZERO;
// BigDecimal totalPaxKMTransportado = BigDecimal.ZERO;
// BigDecimal totalIAP = BigDecimal.ZERO;
//
// BigDecimal totalTxEmbarque = BigDecimal.ZERO;
// BigDecimal totalPedagio = BigDecimal.ZERO;
//
// String group = null;
// while (rset.next()) {
// RelatorioLinhasHorarioBean horarioBean = new RelatorioLinhasHorarioBean();
//
// group = ((String) rset.getObject("GRUPO_RUTA"));
//
// horarioBean.setGrupoRuta(group);
//
// horarioBean.setTipoLinha((String) rset.getObject("TIPO_LINHA"));
//
// horarioBean.setHora((String) rset.getObject("HORA"));
// horarioBean.setServico((BigDecimal) rset.getObject("SERVICO"));
//
// if (rset.getObject("SENTIDO") != null)
// horarioBean.convetSentido((BigDecimal) rset.getObject("SENTIDO"));
// else
// horarioBean.convetSentido(null);
// horarioBean.setLot((BigDecimal) rset.getObject("LOT"));
// horarioBean.setCla((String) rset.getObject("CLA"));
// horarioBean.setExtensao((BigDecimal) rset.getObject("EXTENSAO"));
// horarioBean.setTarifa((BigDecimal) rset.getObject("TARIFA"));
// horarioBean.setPassagens((BigDecimal) rset.getObject("PASSAGENS"));
// horarioBean.setSeguro((BigDecimal) rset.getObject("SEGURO"));
// horarioBean.setBagagens((BigDecimal) rset.getObject("BAGAGENS"));
//
// horarioBean.setTxEmbarque((BigDecimal) rset.getObject("TX_EMBARQUE"));
// horarioBean.setPedagio((BigDecimal) rset.getObject("PEDAGIO"));
//
// // Substituir a coluna Seg. Opcional por Tx. Embarque
// horarioBean.setSegOpc(horarioBean.getTxEmbarque());
//
// horarioBean.setOrd((BigDecimal) rset.getObject("ORD"));
// horarioBean.setExtra((BigDecimal) rset.getObject("EXTRA"));
// horarioBean.setAbsol((BigDecimal) rset.getObject("ABSOL"));
//
// horarioBean.setOrigem((String) rset.getObject("ORIGEM"));
// horarioBean.setDestino((String) rset.getObject("DESTINO"));
//
// horarioBean.setSomaExtensaoTrecho((BigDecimal) rset.getObject("EXTENSAO_TRECHO"));
// horarioBean = trecho(horarioBean);
//
// horarioBean = calcTotal(horarioBean);
// horarioBean = calcMediaReceitaTotal(horarioBean);
//
// horarioBean = calcTotalViagem(horarioBean);
// horarioBean = calcKmRodado(horarioBean);
// horarioBean = calcEquivalente(horarioBean);
// horarioBean = calcMpa(horarioBean);
// horarioBean = calcMpe(horarioBean);
// horarioBean = calcRsKm(horarioBean);
// horarioBean = calcEq(horarioBean);
// horarioBean = calcRsViagem(horarioBean);
// horarioBean = calcPaxKmOfertado(horarioBean);
// horarioBean = calcPaxKmTransportado(horarioBean);
// horarioBean = calcIap(horarioBean);
//
// lsDadosRelatorio.add(horarioBean);
//
// totalPassagens = totalPassagens.add(horarioBean.getPassagens() != null ? horarioBean.getPassagens() : BigDecimal.ZERO);
// totalSeguro = totalSeguro.add(horarioBean.getSeguro() != null ? horarioBean.getSeguro() : BigDecimal.ZERO);
// totalBagagens = totalBagagens.add(horarioBean.getBagagens() != null ? horarioBean.getBagagens() : BigDecimal.ZERO);
// totalSeuroOpcional = totalSeuroOpcional.add(horarioBean.getSegOpc() != null ? horarioBean.getSegOpc() : BigDecimal.ZERO);
// totalTotal = totalTotal.add(horarioBean.getTotal() != null ? horarioBean.getTotal() : BigDecimal.ZERO);
// totalOrdinario = totalOrdinario.add(horarioBean.getOrd() != null ? horarioBean.getOrd() : BigDecimal.ZERO);
// totalExtra = totalExtra.add(horarioBean.getExtra() != null ? horarioBean.getExtra() : BigDecimal.ZERO);
// totalViagem = totalViagem.add(horarioBean.getTotalViagem() != null ? horarioBean.getTotalViagem() : BigDecimal.ZERO);
// totalKmRodado = totalKmRodado.add(horarioBean.getKmRodado() != null ? horarioBean.getKmRodado() : BigDecimal.ZERO);
// totalAbsoluto = totalAbsoluto.add(horarioBean.getAbsol() != null ? horarioBean.getAbsol() : BigDecimal.ZERO);
// totalEquivalente = totalEquivalente.add(horarioBean.getEquivalente() != null ? horarioBean.getEquivalente() : BigDecimal.ZERO);
//
// totalTxEmbarque = totalTxEmbarque.add(horarioBean.getTxEmbarque() != null ? horarioBean.getTxEmbarque() : BigDecimal.ZERO);
// totalPedagio = totalPedagio.add(horarioBean.getPedagio() != null ? horarioBean.getPedagio() : BigDecimal.ZERO);
//
// mediaMPA = mediaMPA.add(horarioBean.getMpa() != null ? horarioBean.getMpa() : BigDecimal.ZERO);
// mediaMPE = mediaMPE.add(horarioBean.getMpe() != null ? horarioBean.getMpe() : BigDecimal.ZERO);
//
// mediaRsPorKm = mediaRsPorKm.add(horarioBean.getRsKm() != null ? horarioBean.getRsKm() : BigDecimal.ZERO);
//
// totalEQ = totalEQ.add(horarioBean.getEq() != null ? horarioBean.getEq() : BigDecimal.ZERO);
//
// mediaRSPorViagem = mediaRSPorViagem.add(horarioBean.getRsViagem() != null ? horarioBean.getRsViagem() : BigDecimal.ZERO);
//
// totalPaxKMOfertado = totalPaxKMOfertado.add(horarioBean.getPaxKmOfertado() != null ? horarioBean.getPaxKmOfertado() : BigDecimal.ZERO);
// totalPaxKMTransportado = totalPaxKMTransportado.add(horarioBean.getPaxKmTransportado() != null ? horarioBean.getPaxKmTransportado() : BigDecimal.ZERO);
//
// totalIAP = calcTotalIap(totalPaxKMTransportado, totalPaxKMOfertado);
//
// }
//
// BigDecimal qtdeRegistros = new BigDecimal(lsDadosRelatorio.size());
//
// if (lsDadosRelatorio.size() > 0) {
//
// setLsDadosRelatorio(lsDadosRelatorio);
// parametros.put("TOTAL_PASSAGENS", totalPassagens);
// parametros.put("TOTAL_SEGURO", totalSeguro);
// parametros.put("TOTAL_BAGAGENS", totalBagagens);
// parametros.put("TOTAL_SEURO_OPCIONAL", totalSeuroOpcional);
// parametros.put("TOTAL_TOTAL", totalTotal);
// parametros.put("TOTAL_ORDINARIO", totalOrdinario);
// parametros.put("TOTAL_EXTRA", totalExtra);
// parametros.put("TOTAL_VIAGEM", totalViagem);
// parametros.put("TOTAL_KM_RODADO", totalKmRodado);
// parametros.put("TOTAL_ABSOLUTO", totalAbsoluto);
// parametros.put("TOTAL_EQUIVALENTE", totalEquivalente);
// parametros.put("MEDIA_MPA", mediaMPA.divide(qtdeRegistros, 2, RoundingMode.HALF_EVEN));
// parametros.put("MEDIA_MPE", mediaMPE.divide(qtdeRegistros, 2, RoundingMode.HALF_EVEN));
// parametros.put("MEDIA_RS_POR_KM", mediaRsPorKm.divide(qtdeRegistros, 2, RoundingMode.HALF_EVEN));
// parametros.put("TOTAL_EQ", totalEQ);
// parametros.put("TOTAL_TX_EMBARQUE", totalTxEmbarque);
// parametros.put("TOTAL_PEDAGIO", totalPedagio);
// parametros.put("MEDIA_RS_POR_VIAGEM", mediaRSPorViagem.divide(qtdeRegistros, 2, RoundingMode.HALF_EVEN));
// parametros.put("TOTAL_PAX_KM_OFERTADO", totalPaxKMOfertado);
// parametros.put("TOTAL_PAX_KM_TRANSPORTADO", totalPaxKMTransportado);
// parametros.put("TOTAL_IAP", totalIAP);
//
// }
// }
// });
}

View File

@ -4,9 +4,7 @@
*/
package com.rjconsultores.ventaboletos.web.gui.controladores.relatorios;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.sql.DataSource;
@ -14,15 +12,13 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
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.zul.Comboitem;
import org.zkoss.zul.Datebox;
import org.zkoss.zul.Radiogroup;
import com.rjconsultores.ventaboletos.entidad.Empresa;
import com.rjconsultores.ventaboletos.relatorios.impl.RelatorioAcompanhamentoEquivalentes;
import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio;
import com.rjconsultores.ventaboletos.service.EmpresaService;
import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEstandar;
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
@ -61,31 +57,35 @@ public class RelatorioAcompanhamentoEquivalentesController extends MyGenericForw
*/
private void executarRelatorio() throws Exception {
Relatorio relatorio;
Map<String, Object> parametros = new HashMap<String, Object>();
Messagebox.show(Labels.getLabel("MSG.Error"),
Labels.getLabel("relatorioAcompanhamentoEquivalentesController.window.title"),
Messagebox.OK, Messagebox.INFORMATION);
parametros.put("DATA_MES", (java.util.Date) this.datMes.getValue());
parametros.put("NOME_RELATORIO", Labels.getLabel("relatorioAcompanhamentoEquivalentesController.window.title"));
parametros.put("INDICADOR", Integer.parseInt(rdGroupIndicador.getSelectedItem().getValue()));
parametros.put("INDICADOR_NOME", rdGroupIndicador.getSelectedItem().getLabel());
Comboitem itemEmpresa = cmbEmpresa.getSelectedItem();
if (itemEmpresa != null) {
Empresa empresa = (Empresa) itemEmpresa.getValue();
parametros.put("EMPRESA_ID", empresa.getEmpresaId());
parametros.put("EMPRESA", empresa.getNombempresa());
}
if (rdGroupServico.getSelectedItem() != null && !rdGroupServico.getSelectedItem().getValue().equals("-1"))
parametros.put("TIPOSERVICIO_ID", Integer.parseInt(rdGroupServico.getSelectedItem().getValue()));
relatorio = new RelatorioAcompanhamentoEquivalentes(parametros, dataSource.getConnection());
Map<String, Relatorio> args = new HashMap<String, Relatorio>();
args.put("relatorio", relatorio);
openWindow("/component/reportView.zul",
Labels.getLabel("relatorioAcompanhamentoEquivalentesController.window.title"), args, MODAL);
// Relatorio relatorio;
// Map<String, Object> parametros = new HashMap<String, Object>();
//
// parametros.put("DATA_MES", (java.util.Date) this.datMes.getValue());
// parametros.put("NOME_RELATORIO", Labels.getLabel("relatorioAcompanhamentoEquivalentesController.window.title"));
// parametros.put("INDICADOR", Integer.parseInt(rdGroupIndicador.getSelectedItem().getValue()));
// parametros.put("INDICADOR_NOME", rdGroupIndicador.getSelectedItem().getLabel());
//
// Comboitem itemEmpresa = cmbEmpresa.getSelectedItem();
// if (itemEmpresa != null) {
// Empresa empresa = (Empresa) itemEmpresa.getValue();
// parametros.put("EMPRESA_ID", empresa.getEmpresaId());
// parametros.put("EMPRESA", empresa.getNombempresa());
// }
//
// if (rdGroupServico.getSelectedItem() != null && !rdGroupServico.getSelectedItem().getValue().equals("-1"))
// parametros.put("TIPOSERVICIO_ID", Integer.parseInt(rdGroupServico.getSelectedItem().getValue()));
//
// relatorio = new RelatorioAcompanhamentoEquivalentes(parametros, dataSource.getConnection());
//
// Map<String, Relatorio> args = new HashMap<String, Relatorio>();
// args.put("relatorio", relatorio);
//
// openWindow("/component/reportView.zul",
// Labels.getLabel("relatorioAcompanhamentoEquivalentesController.window.title"), args, MODAL);
}