Evidencia em anexa,
Relatorio tirado apontado para o ambiente do cliente. fixes bug#AL-1590 qua: dev: git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@115066 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
286244d34d
commit
e5cc21975b
|
@ -21,6 +21,7 @@ import com.rjconsultores.ventaboletos.entidad.Empresa;
|
||||||
import com.rjconsultores.ventaboletos.relatorios.utilitarios.DataSource;
|
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.RelatorioIndiceIRKBean;
|
import com.rjconsultores.ventaboletos.relatorios.utilitarios.RelatorioIndiceIRKBean;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.DateUtil;
|
||||||
import com.rjconsultores.ventaboletos.web.utilerias.NamedParameterStatement;
|
import com.rjconsultores.ventaboletos.web.utilerias.NamedParameterStatement;
|
||||||
|
|
||||||
import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource;
|
import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource;
|
||||||
|
@ -53,7 +54,7 @@ public class RelatorioIndiceIRK extends Relatorio {
|
||||||
String corridasIds = parametros.get("SERVICO_FILTRO") != null ? (parametros.get("SERVICO_FILTRO").toString()) : null;
|
String corridasIds = parametros.get("SERVICO_FILTRO") != null ? (parametros.get("SERVICO_FILTRO").toString()) : null;
|
||||||
|
|
||||||
// Executa query relatório e preenche objeto relatório
|
// Executa query relatório e preenche objeto relatório
|
||||||
lsDadosRelatorio= preencheAgrupaRelatorioBean(preparaExecutaQuery(parametros, conexao, rutaId, empresa, grupoRutaId, rutaIds, corridasIds));
|
lsDadosRelatorio= preencheAgrupaRelatorioBean(preparaExecutaQuery(parametros, conexao, rutaId, empresa, grupoRutaId, rutaIds, corridasIds), parametros);
|
||||||
|
|
||||||
// Ordena pela Desc Linha
|
// Ordena pela Desc Linha
|
||||||
Collections.sort(lsDadosRelatorio, new Comparator<RelatorioIndiceIRKBean>() {
|
Collections.sort(lsDadosRelatorio, new Comparator<RelatorioIndiceIRKBean>() {
|
||||||
|
@ -144,7 +145,7 @@ public class RelatorioIndiceIRK extends Relatorio {
|
||||||
sb.append(" gruporuta,");
|
sb.append(" gruporuta,");
|
||||||
sb.append(" indiceirkminimo,");
|
sb.append(" indiceirkminimo,");
|
||||||
sb.append(" hora,");
|
sb.append(" hora,");
|
||||||
sb.append(" extensao,");
|
sb.append(" (extensao) AS extensao,");
|
||||||
sb.append(" SUM(seguro) AS seguro,");
|
sb.append(" SUM(seguro) AS seguro,");
|
||||||
sb.append(" SUM(txembarque) AS txembarque,");
|
sb.append(" SUM(txembarque) AS txembarque,");
|
||||||
sb.append(" SUM(pedagio) AS pedagio,");
|
sb.append(" SUM(pedagio) AS pedagio,");
|
||||||
|
@ -230,8 +231,14 @@ public class RelatorioIndiceIRK extends Relatorio {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<RelatorioIndiceIRKBean> preencheAgrupaRelatorioBean(ResultSet rset) throws SQLException {
|
private List<RelatorioIndiceIRKBean> preencheAgrupaRelatorioBean(ResultSet rset, Map<String, Object> parametros) throws SQLException {
|
||||||
|
|
||||||
lsDadosRelatorio = new ArrayList<RelatorioIndiceIRKBean>();
|
lsDadosRelatorio = new ArrayList<RelatorioIndiceIRKBean>();
|
||||||
|
Date dataInicio = (Date) parametros.get("DATA_INICIO");
|
||||||
|
Date dataFinal = (Date) parametros.get("DATA_FINAL");
|
||||||
|
|
||||||
|
int diferenciaDeDiasFiltroData = calcularQuantidadeDeDiasFiltroData(dataInicio, dataFinal);
|
||||||
|
|
||||||
while (rset.next()) {
|
while (rset.next()) {
|
||||||
RelatorioIndiceIRKBean relatorioIndiceIRK = new RelatorioIndiceIRKBean();
|
RelatorioIndiceIRKBean relatorioIndiceIRK = new RelatorioIndiceIRKBean();
|
||||||
relatorioIndiceIRK.setServico((Integer) rset.getInt("servico"));
|
relatorioIndiceIRK.setServico((Integer) rset.getInt("servico"));
|
||||||
|
@ -242,7 +249,7 @@ public class RelatorioIndiceIRK extends Relatorio {
|
||||||
relatorioIndiceIRK.setIrkMinimo((BigDecimal) rset.getObject("indiceirkminimo"));
|
relatorioIndiceIRK.setIrkMinimo((BigDecimal) rset.getObject("indiceirkminimo"));
|
||||||
relatorioIndiceIRK.setHora((String) rset.getObject("hora"));
|
relatorioIndiceIRK.setHora((String) rset.getObject("hora"));
|
||||||
relatorioIndiceIRK.setExtensao((BigDecimal) rset.getObject("extensao"));
|
relatorioIndiceIRK.setExtensao((BigDecimal) rset.getObject("extensao"));
|
||||||
relatorioIndiceIRK.setKmRodado((BigDecimal) rset.getObject("extensao"));
|
relatorioIndiceIRK.setKmRodado(((BigDecimal) rset.getObject("extensao")).multiply(new BigDecimal(diferenciaDeDiasFiltroData)));
|
||||||
relatorioIndiceIRK.setSeguro((BigDecimal) rset.getObject("seguro"));
|
relatorioIndiceIRK.setSeguro((BigDecimal) rset.getObject("seguro"));
|
||||||
relatorioIndiceIRK.setTxEmbarque((BigDecimal) rset.getObject("txembarque"));
|
relatorioIndiceIRK.setTxEmbarque((BigDecimal) rset.getObject("txembarque"));
|
||||||
relatorioIndiceIRK.setPedagio((BigDecimal) rset.getObject("pedagio"));
|
relatorioIndiceIRK.setPedagio((BigDecimal) rset.getObject("pedagio"));
|
||||||
|
@ -259,4 +266,13 @@ public class RelatorioIndiceIRK extends Relatorio {
|
||||||
return lsDadosRelatorio;
|
return lsDadosRelatorio;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int calcularQuantidadeDeDiasFiltroData(Date dataInicial, Date dataFInal) {
|
||||||
|
|
||||||
|
if (dataInicial != null && dataFInal != null) {
|
||||||
|
int diferencaDias = DateUtil.diferencaEntreDatasEmdias(dataInicial, dataFInal)+1;
|
||||||
|
return diferencaDias;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue