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