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