fixes bug#21770
qua: dev: git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@107009 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
0cdb3a4cc1
commit
3818b692e7
|
@ -0,0 +1,245 @@
|
|||
package com.rjconsultores.ventaboletos.relatorios.impl;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
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.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
||||
import com.rjconsultores.ventaboletos.relatorios.utilitarios.ArrayDataSource;
|
||||
import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio;
|
||||
|
||||
public class RelatorioQuadroDemonstrativoMovimentoPassageirosNovoLayout extends Relatorio {
|
||||
|
||||
public RelatorioQuadroDemonstrativoMovimentoPassageirosNovoLayout(Map<String, Object> parametros, Connection conexao) throws Exception {
|
||||
super(parametros, conexao);
|
||||
|
||||
this.setCustomDataSource(new ArrayDataSource(this) {
|
||||
|
||||
public void initDados() throws Exception {
|
||||
Connection conexao = this.relatorio.getConexao();
|
||||
Map<String, Object> parametros = this.relatorio.getParametros();
|
||||
|
||||
String dataDe = (String) parametros.get("DATA_DE");
|
||||
|
||||
String dataAte = (String) parametros.get("DATA_ATE");
|
||||
|
||||
|
||||
String linhasIds = (String) parametros.get("LINHAS");
|
||||
String empresaId = (String) parametros.get("EMPRESA_IDS");
|
||||
|
||||
String sql = getSql(dataDe, dataAte, linhasIds, empresaId);
|
||||
|
||||
PreparedStatement ps = conexao.prepareStatement(sql.toString());
|
||||
|
||||
ResultSet rset = ps.executeQuery();
|
||||
BigDecimal lugaresOfertados = BigDecimal.ZERO;
|
||||
|
||||
|
||||
while (rset.next()) {
|
||||
boolean agrupar = false;
|
||||
Map<String, Object> dataResult = new HashMap<String, Object>();
|
||||
|
||||
dataResult.put("tarifa", rset.getBigDecimal("tarifa"));
|
||||
dataResult.put("origem", rset.getString("origem"));
|
||||
dataResult.put("destino", rset.getString("destino"));
|
||||
dataResult.put("km", rset.getFloat("km"));
|
||||
dataResult.put("totalida", rset.getLong("totalida"));
|
||||
dataResult.put("totalvolta", rset.getLong("totalvolta"));
|
||||
dataResult.put("totalReceita", rset.getBigDecimal("totalReceita"));
|
||||
|
||||
for (Iterator iterator = dados.iterator(); iterator.hasNext();) {
|
||||
|
||||
Map<String, Object> map = (Map<String, Object>) iterator.next();
|
||||
String origem = map.get("origem").toString();
|
||||
String destino = map.get("destino").toString();
|
||||
Long ida = (Long) map.get("totalida");
|
||||
Long volta = (Long) map.get("totalvolta");
|
||||
|
||||
|
||||
if (origem.equals(rset.getString("destino")) && destino.equals(rset.getString("origem"))) {
|
||||
agrupar = true;
|
||||
if (ida == 0) {
|
||||
map.put("totalida", rset.getLong("totalida"));
|
||||
}
|
||||
if (volta == 0) {
|
||||
map.put("totalvolta", rset.getLong("totalvolta"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!agrupar) {
|
||||
this.dados.add(dataResult);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
this.resultSet = rset;
|
||||
}
|
||||
|
||||
private void ordenarTrechosSentidoIda(List<Map<String, Object>> dados, String linhasIds) {
|
||||
|
||||
List<String> listOrigemDestino = this.buscarSequenciaOrigemDestinoIda(linhasIds);
|
||||
|
||||
if (listOrigemDestino.isEmpty()){
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
List<Map<String, Object>> dadosOrdenados = new ArrayList<Map<String,Object>>();
|
||||
|
||||
|
||||
for(Map<String, Object> dado : dados){
|
||||
|
||||
Map<String, Object> dataResult = new HashMap<String, Object>();
|
||||
|
||||
String origemAtual = dado.get("origemId").toString();
|
||||
String destinoAtual = dado.get("destinoId").toString();
|
||||
|
||||
String trecho = origemAtual.concat("|").concat(destinoAtual);
|
||||
|
||||
if (!listOrigemDestino.contains(trecho) ){
|
||||
origemAtual = dado.get("destino").toString();
|
||||
destinoAtual = dado.get("origem").toString();
|
||||
}
|
||||
|
||||
dataResult.put("origem", origemAtual);
|
||||
dataResult.put("destino", destinoAtual);
|
||||
dataResult.put("km", dado.get("km"));
|
||||
dataResult.put("totalida", dado.get("totalida"));
|
||||
dataResult.put("totalvolta", dado.get("totalvolta"));
|
||||
|
||||
dadosOrdenados.add(dataResult);
|
||||
}
|
||||
|
||||
dados.clear();
|
||||
dados.addAll(dadosOrdenados);
|
||||
|
||||
|
||||
}
|
||||
|
||||
private List<String> buscarSequenciaOrigemDestinoIda(String linhasIds) {
|
||||
StringBuilder query = new StringBuilder();
|
||||
query.append("SELECT ");
|
||||
query.append("ori.parada_id || '|' || des.parada_id AS trecho ");
|
||||
query.append("FROM ");
|
||||
query.append("ruta r ");
|
||||
query.append("JOIN RUTA_combinacion rc ON rc.ruta_id = r.ruta_id ");
|
||||
query.append("JOIN RUTA_secuencia rs ON rs.ruta_id = r.ruta_id ");
|
||||
query.append("INNER JOIN tramo tr ON tr.TRAMO_ID =rc.TRAMO_ID AND tr.ACTIVO = 1 ");
|
||||
query.append("JOIN parada ori ON\tori.parada_id = tr.origen_id ");
|
||||
query.append("JOIN parada des ON\tdes.parada_id = tr.destino_id ");
|
||||
query.append(" ");
|
||||
query.append("WHERE ");
|
||||
query.append(" r.NUMRUTA = '").append(linhasIds).append("' ");
|
||||
query.append("AND r.INDSENTIDOIDA =1 ");
|
||||
query.append("AND rc.ACTIVO =1 and rs.ACTIVO =1");
|
||||
query.append("AND r.ACTIVO =1 ");
|
||||
query.append("ORDER BY Rs.numsecuencia ");
|
||||
|
||||
List<String> listOrigemDestino = new ArrayList<String>();
|
||||
|
||||
try {
|
||||
|
||||
Connection conexao = this.relatorio.getConexao();
|
||||
PreparedStatement ps= conexao.prepareStatement(query.toString());
|
||||
|
||||
ResultSet rset = ps.executeQuery();
|
||||
|
||||
while (rset.next()) {
|
||||
listOrigemDestino.add(rset.getString("trecho"));
|
||||
}
|
||||
|
||||
rset.close();
|
||||
ps.close();
|
||||
|
||||
} catch (SQLException e) {
|
||||
throw new RuntimeException("Erro ao buscar sequencia da linha",e);
|
||||
}
|
||||
return listOrigemDestino;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void processaParametros() throws Exception {
|
||||
}
|
||||
|
||||
private String getSql(String dataDe, String dataAte, String linhasIds,
|
||||
String empresaId) {
|
||||
StringBuilder sql = new StringBuilder();
|
||||
|
||||
sql.append(" SELECT DISTINCT ");
|
||||
sql.append(" sum(b.preciopagado + b.importepedagio) as totalReceita, ");
|
||||
sql.append(" tar.precio as tarifa, ");
|
||||
sql.append(" e.nombempresa empresa, ");
|
||||
sql.append(" r.descruta linha, ");
|
||||
sql.append(" ori.descparada AS origem, ");
|
||||
sql.append(" des.descparada AS destino, ");
|
||||
sql.append(" MAX(tr.CANTKMREAL) as km, ");
|
||||
sql.append(" COUNT( DISTINCT ");
|
||||
sql.append(" CASE ");
|
||||
sql.append(" WHEN(r.indsentidoida = 1) THEN b.boleto_id ");
|
||||
sql.append(" ELSE NULL ");
|
||||
sql.append(" END ");
|
||||
sql.append(" ) AS totalida, ");
|
||||
sql.append(" COUNT( DISTINCT ");
|
||||
sql.append(" CASE ");
|
||||
sql.append(" WHEN(r.indsentidoida = 0) THEN b.boleto_id ");
|
||||
sql.append(" ELSE NULL ");
|
||||
sql.append(" END ");
|
||||
sql.append(" ) AS totalvolta, ");
|
||||
sql.append(" rc.rutacombinacion_id rutaCombinacionId ");
|
||||
sql.append(" FROM ");
|
||||
sql.append(" boleto b ");
|
||||
sql.append(" JOIN empresa e ON e.empresa_id = b.empresacorrida_id ");
|
||||
sql.append(" JOIN marca m ON m.empresa_id = b.empresacorrida_id ");
|
||||
sql.append(" JOIN categoria ca ON b.categoria_id = ca.categoria_id ");
|
||||
sql.append(" JOIN parada ori ON ori.parada_id = b.origen_id ");
|
||||
sql.append(" JOIN parada des ON des.parada_id = b.destino_id ");
|
||||
sql.append(" JOIN ruta r ON r.ruta_id = b.ruta_id ");
|
||||
sql.append(" JOIN RUTA_COMBINACION rc ON rc.ruta_id = r.ruta_id and rc.activo = 1 ");
|
||||
sql.append(" INNER JOIN tramo tr ON tr.TRAMO_ID =rc.TRAMO_ID AND tr.ORIGEN_ID = ori.PARADA_ID AND tr.DESTINO_ID = des.PARADA_ID AND tr.ACTIVO = 1 ");
|
||||
sql.append(" JOIN clase_servicio cs ON (b.claseservicio_id = cs.claseservicio_id ) ") ;
|
||||
sql.append(" INNER JOIN vigencia_tarifa vt ON b.fechorventa BETWEEN vt.feciniciovigencia AND vt.fecfinvigencia AND vt.activo = 1 ");
|
||||
sql.append(" INNER JOIN tarifa tar ON (tar.ruta_id = b.ruta_id ");
|
||||
sql.append(" AND tar.marca_id = m.marca_id ");
|
||||
sql.append(" AND tar.claseservicio_id = b.claseservicio_id ");
|
||||
sql.append(" AND tar.vigenciatarifa_id = vt.vigenciatarifa_id ");
|
||||
sql.append(" AND tar.origen_id = b.origen_id ");
|
||||
sql.append(" AND tar.destino_id = b.destino_id ");
|
||||
sql.append("AND tar.activo = 1 ) ");
|
||||
sql.append(" WHERE b.empresacorrida_id IN (").append(empresaId).append(") ");
|
||||
|
||||
sql.append(" AND b.motivocancelacion_id is null ");
|
||||
|
||||
if (!StringUtils.isBlank(linhasIds)) {
|
||||
sql.append(" AND r.NUMRUTA = '").append(linhasIds).append("' ");
|
||||
}
|
||||
|
||||
sql.append(" AND b.feccorrida BETWEEN To_date('").append(dataDe).append("', 'dd/mm/yyyy') ");
|
||||
sql.append(" AND To_date('").append(dataAte).append("', 'dd/mm/yyyy') ");
|
||||
|
||||
sql.append(" GROUP BY ");
|
||||
sql.append(" tar.precio, ");
|
||||
sql.append(" e.nombempresa, ");
|
||||
sql.append(" r.numruta, ");
|
||||
sql.append(" r.descruta, ");
|
||||
sql.append(" ori.descparada, ");
|
||||
sql.append(" des.descparada, rc.rutacombinacion_id ");
|
||||
sql.append(" ORDER BY ");
|
||||
sql.append(" r.descruta, ");
|
||||
sql.append(" rc.rutacombinacion_id ");
|
||||
|
||||
return sql.toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
#geral
|
||||
msg.noData=No se pudo obtener datos con los parámetros reportados.
|
||||
msg.a=a
|
||||
linhas=Linhas
|
|
@ -0,0 +1,4 @@
|
|||
#geral
|
||||
msg.noData=No se pudo obtener datos con los parámetros reportados.
|
||||
msg.a=a
|
||||
linhas=Linhas
|
Binary file not shown.
|
@ -0,0 +1,291 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="RelatorioBPe" pageWidth="800" pageHeight="842" whenNoDataType="NoDataSection" columnWidth="760" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20">
|
||||
<property name="ireport.zoom" value="3.8906136901500026"/>
|
||||
<property name="ireport.x" value="993"/>
|
||||
<property name="ireport.y" value="529"/>
|
||||
<property name="net.sf.jasperreports.export.xls.exclude.origin.band.1" value="title"/>
|
||||
<property name="net.sf.jasperreports.export.xls.exclude.origin.keep.first.band.2" value="columnHeader"/>
|
||||
<property name="net.sf.jasperreports.export.xls.remove.empty.space.between.rows" value="true"/>
|
||||
<property name="net.sf.jasperreports.export.xls.remove.empty.space.between.columns" value="true"/>
|
||||
<parameter name="USUARIO" class="java.lang.String"/>
|
||||
<parameter name="NOME_RELATORIO" class="java.lang.String"/>
|
||||
<parameter name="FILTROS" class="java.lang.String"/>
|
||||
<parameter name="STR_ESPECIE" class="java.lang.String"/>
|
||||
<parameter name="DESC_LINHAS_SELECIONADAS" class="java.lang.String"/>
|
||||
<parameter name="EMPRESA" class="java.lang.String"/>
|
||||
<parameter name="CANTASIENTOS" class="java.lang.String"/>
|
||||
<parameter name="DATA_DE" class="java.lang.String"/>
|
||||
<parameter name="DATA_ATE" class="java.lang.String"/>
|
||||
<parameter name="LINHAS" class="java.lang.String"/>
|
||||
<field name="cantasientos" class="java.lang.String"/>
|
||||
<field name="empresa" class="java.lang.String"/>
|
||||
<field name="linha" class="java.lang.String"/>
|
||||
<field name="origem" class="java.lang.String"/>
|
||||
<field name="destino" class="java.lang.String"/>
|
||||
<field name="km" class="java.lang.Float"/>
|
||||
<field name="totalida" class="java.lang.Long"/>
|
||||
<field name="totalvolta" class="java.lang.Long"/>
|
||||
<field name="tarifa" class="java.math.BigDecimal"/>
|
||||
<field name="totalReceita" class="java.math.BigDecimal"/>
|
||||
<variable name="SOMA_KM" class="java.lang.Float" calculation="Sum">
|
||||
<variableExpression><![CDATA[$F{km}]]></variableExpression>
|
||||
</variable>
|
||||
<variable name="SOMA_IDA" class="java.lang.Long" calculation="Sum">
|
||||
<variableExpression><![CDATA[$F{totalida}]]></variableExpression>
|
||||
</variable>
|
||||
<variable name="SOMA_VOLTA" class="java.lang.Long" calculation="Sum">
|
||||
<variableExpression><![CDATA[$F{totalvolta}]]></variableExpression>
|
||||
</variable>
|
||||
<variable name="SOMA_TOTAL_RECEITA" class="java.math.BigDecimal" calculation="Sum">
|
||||
<variableExpression><![CDATA[$F{totalReceita}]]></variableExpression>
|
||||
</variable>
|
||||
<title>
|
||||
<band height="176" splitType="Stretch">
|
||||
<staticText>
|
||||
<reportElement mode="Transparent" x="0" y="0" width="570" height="41" forecolor="#000000" backcolor="#FFFFFF"/>
|
||||
<textElement textAlignment="Left" verticalAlignment="Top" rotation="None" lineSpacing="Single" markup="none">
|
||||
<font fontName="SansSerif" size="16" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
|
||||
</textElement>
|
||||
<text><![CDATA[QUADRO DEMONSTRATIVO DO MOVIMENTO DE PASSAGEIROS]]></text>
|
||||
</staticText>
|
||||
<textField pattern="dd/MM/yyyy HH:mm" isBlankWhenNull="false">
|
||||
<reportElement mode="Transparent" x="654" y="0" width="95" height="25" forecolor="#000000" backcolor="#FFFFFF"/>
|
||||
<textElement textAlignment="Left" verticalAlignment="Top" rotation="None" lineSpacing="Single" markup="none">
|
||||
<font fontName="SansSerif" size="9" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
|
||||
</textElement>
|
||||
<textFieldExpression class="java.lang.String"><![CDATA[new java.util.Date()]]></textFieldExpression>
|
||||
</textField>
|
||||
<textField pattern="" isBlankWhenNull="false">
|
||||
<reportElement mode="Transparent" x="570" y="25" width="84" height="16" forecolor="#000000" backcolor="#FFFFFF"/>
|
||||
<textElement textAlignment="Right" verticalAlignment="Top" rotation="None" lineSpacing="Single" markup="none">
|
||||
<font fontName="SansSerif" size="9" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
|
||||
</textElement>
|
||||
<textFieldExpression class="java.lang.String"><![CDATA["Página " + $V{PAGE_NUMBER}+ " de " + $V{PAGE_NUMBER}]]></textFieldExpression>
|
||||
</textField>
|
||||
<line>
|
||||
<reportElement x="-1" y="48" width="750" height="1"/>
|
||||
</line>
|
||||
<line>
|
||||
<reportElement positionType="Float" x="-1" y="160" width="750" height="1"/>
|
||||
</line>
|
||||
<staticText>
|
||||
<reportElement x="-1" y="49" width="63" height="22"/>
|
||||
<textElement lineSpacing="Single">
|
||||
<font isBold="true"/>
|
||||
</textElement>
|
||||
<text><![CDATA[Empresa:]]></text>
|
||||
</staticText>
|
||||
<textField>
|
||||
<reportElement x="62" y="49" width="509" height="22"/>
|
||||
<textElement lineSpacing="Single"/>
|
||||
<textFieldExpression class="java.lang.String"><![CDATA[$P{EMPRESA}]]></textFieldExpression>
|
||||
</textField>
|
||||
<textField>
|
||||
<reportElement x="0" y="71" width="251" height="20"/>
|
||||
<textElement lineSpacing="Single">
|
||||
<font isBold="true"/>
|
||||
</textElement>
|
||||
<textFieldExpression class="java.lang.String"><![CDATA["Período: " + $P{DATA_DE} + " a " + $P{DATA_ATE}]]></textFieldExpression>
|
||||
</textField>
|
||||
<staticText>
|
||||
<reportElement x="0" y="133" width="50" height="20"/>
|
||||
<textElement lineSpacing="Single">
|
||||
<font isBold="true"/>
|
||||
</textElement>
|
||||
<text><![CDATA[Linha:]]></text>
|
||||
</staticText>
|
||||
<textField>
|
||||
<reportElement x="150" y="133" width="425" height="20"/>
|
||||
<textElement lineSpacing="Single"/>
|
||||
<textFieldExpression class="java.lang.String"><![CDATA[$P{DESC_LINHAS_SELECIONADAS}]]></textFieldExpression>
|
||||
</textField>
|
||||
<staticText>
|
||||
<reportElement x="0" y="91" width="77" height="20"/>
|
||||
<textElement lineSpacing="Single">
|
||||
<font isBold="true"/>
|
||||
</textElement>
|
||||
<text><![CDATA[Tipo de Data:]]></text>
|
||||
</staticText>
|
||||
<staticText>
|
||||
<reportElement x="77" y="91" width="73" height="20"/>
|
||||
<textElement lineSpacing="Single">
|
||||
<font isBold="false"/>
|
||||
</textElement>
|
||||
<text><![CDATA[SERVIÇO]]></text>
|
||||
</staticText>
|
||||
<staticText>
|
||||
<reportElement x="0" y="111" width="77" height="20"/>
|
||||
<textElement lineSpacing="Single">
|
||||
<font isBold="true"/>
|
||||
</textElement>
|
||||
<text><![CDATA[Lugar Ofer:]]></text>
|
||||
</staticText>
|
||||
<textField isBlankWhenNull="true">
|
||||
<reportElement x="77" y="113" width="498" height="20"/>
|
||||
<textElement lineSpacing="Single"/>
|
||||
<textFieldExpression class="java.lang.String"><![CDATA[$P{CANTASIENTOS}]]></textFieldExpression>
|
||||
</textField>
|
||||
<textField isBlankWhenNull="true">
|
||||
<reportElement x="50" y="133" width="100" height="20"/>
|
||||
<textElement lineSpacing="Single"/>
|
||||
<textFieldExpression class="java.lang.String"><![CDATA[$P{LINHAS}]]></textFieldExpression>
|
||||
</textField>
|
||||
</band>
|
||||
</title>
|
||||
<columnHeader>
|
||||
<band height="17">
|
||||
<staticText>
|
||||
<reportElement x="0" y="0" width="150" height="15"/>
|
||||
<textElement textAlignment="Left" lineSpacing="Single" markup="none">
|
||||
<font size="10" isBold="true" pdfFontName="Helvetica-Bold"/>
|
||||
</textElement>
|
||||
<text><![CDATA[Origem]]></text>
|
||||
</staticText>
|
||||
<staticText>
|
||||
<reportElement x="150" y="0" width="156" height="15"/>
|
||||
<textElement textAlignment="Left" lineSpacing="Single" markup="none">
|
||||
<font size="10" isBold="true" pdfFontName="Helvetica-Bold"/>
|
||||
</textElement>
|
||||
<text><![CDATA[Destino]]></text>
|
||||
</staticText>
|
||||
<staticText>
|
||||
<reportElement x="399" y="0" width="82" height="15"/>
|
||||
<textElement textAlignment="Left" lineSpacing="Single" markup="none">
|
||||
<font size="10" isBold="true" pdfFontName="Helvetica-Bold"/>
|
||||
</textElement>
|
||||
<text><![CDATA[Extensão KM]]></text>
|
||||
</staticText>
|
||||
<staticText>
|
||||
<reportElement x="481" y="0" width="89" height="15"/>
|
||||
<textElement textAlignment="Left" lineSpacing="Single" markup="none">
|
||||
<font size="10" isBold="true" pdfFontName="Helvetica-Bold"/>
|
||||
</textElement>
|
||||
<text><![CDATA[Pagantes Ida]]></text>
|
||||
</staticText>
|
||||
<staticText>
|
||||
<reportElement x="570" y="0" width="84" height="15"/>
|
||||
<textElement textAlignment="Left" lineSpacing="Single" markup="none">
|
||||
<font size="10" isBold="true" pdfFontName="Helvetica-Bold"/>
|
||||
</textElement>
|
||||
<text><![CDATA[Pagantes Volta]]></text>
|
||||
</staticText>
|
||||
<staticText>
|
||||
<reportElement x="306" y="0" width="93" height="15"/>
|
||||
<textElement textAlignment="Left" lineSpacing="Single" markup="none">
|
||||
<font size="10" isBold="true" pdfFontName="Helvetica-Bold"/>
|
||||
</textElement>
|
||||
<text><![CDATA[Tarifa]]></text>
|
||||
</staticText>
|
||||
<staticText>
|
||||
<reportElement x="654" y="0" width="95" height="15"/>
|
||||
<textElement textAlignment="Center" lineSpacing="Single" markup="none">
|
||||
<font size="10" isBold="true" pdfFontName="Helvetica-Bold"/>
|
||||
</textElement>
|
||||
<text><![CDATA[Total Receita]]></text>
|
||||
</staticText>
|
||||
</band>
|
||||
</columnHeader>
|
||||
<detail>
|
||||
<band height="25" splitType="Stretch">
|
||||
<textField isBlankWhenNull="true">
|
||||
<reportElement x="0" y="0" width="150" height="15"/>
|
||||
<textElement lineSpacing="Single">
|
||||
<font size="10"/>
|
||||
</textElement>
|
||||
<textFieldExpression class="java.lang.String"><![CDATA[$F{origem}]]></textFieldExpression>
|
||||
</textField>
|
||||
<textField isBlankWhenNull="true">
|
||||
<reportElement x="570" y="0" width="84" height="15"/>
|
||||
<textElement lineSpacing="Single">
|
||||
<font size="10"/>
|
||||
</textElement>
|
||||
<textFieldExpression class="java.lang.String"><![CDATA[$F{totalvolta}]]></textFieldExpression>
|
||||
</textField>
|
||||
<textField isBlankWhenNull="true">
|
||||
<reportElement x="150" y="0" width="156" height="15"/>
|
||||
<textElement lineSpacing="Single">
|
||||
<font size="10"/>
|
||||
</textElement>
|
||||
<textFieldExpression class="java.lang.String"><![CDATA[$F{destino}]]></textFieldExpression>
|
||||
</textField>
|
||||
<textField isBlankWhenNull="true">
|
||||
<reportElement x="399" y="0" width="82" height="15"/>
|
||||
<textElement lineSpacing="Single">
|
||||
<font size="10"/>
|
||||
</textElement>
|
||||
<textFieldExpression class="java.lang.String"><![CDATA[$F{km}]]></textFieldExpression>
|
||||
</textField>
|
||||
<textField isBlankWhenNull="true">
|
||||
<reportElement x="481" y="0" width="89" height="15"/>
|
||||
<textElement lineSpacing="Single">
|
||||
<font size="10"/>
|
||||
</textElement>
|
||||
<textFieldExpression class="java.lang.String"><![CDATA[$F{totalida}]]></textFieldExpression>
|
||||
</textField>
|
||||
<textField pattern=" #,##0.00" isBlankWhenNull="true">
|
||||
<reportElement x="306" y="0" width="93" height="15"/>
|
||||
<textElement lineSpacing="Single">
|
||||
<font size="10"/>
|
||||
</textElement>
|
||||
<textFieldExpression class="java.math.BigDecimal"><![CDATA[$F{tarifa}]]></textFieldExpression>
|
||||
</textField>
|
||||
<textField pattern=" #,##0.00" isBlankWhenNull="true">
|
||||
<reportElement x="654" y="0" width="95" height="15"/>
|
||||
<textElement textAlignment="Center" lineSpacing="Single">
|
||||
<font size="10"/>
|
||||
</textElement>
|
||||
<textFieldExpression class="java.lang.String"><![CDATA[$F{totalReceita}]]></textFieldExpression>
|
||||
</textField>
|
||||
</band>
|
||||
</detail>
|
||||
<columnFooter>
|
||||
<band height="27">
|
||||
<textField isBlankWhenNull="true">
|
||||
<reportElement x="399" y="0" width="82" height="15"/>
|
||||
<textElement lineSpacing="Single">
|
||||
<font size="10"/>
|
||||
</textElement>
|
||||
<textFieldExpression class="java.lang.String"><![CDATA[$V{SOMA_KM}]]></textFieldExpression>
|
||||
</textField>
|
||||
<textField isBlankWhenNull="true">
|
||||
<reportElement x="481" y="0" width="89" height="15"/>
|
||||
<textElement lineSpacing="Single">
|
||||
<font size="10"/>
|
||||
</textElement>
|
||||
<textFieldExpression class="java.lang.String"><![CDATA[$V{SOMA_IDA}]]></textFieldExpression>
|
||||
</textField>
|
||||
<textField isBlankWhenNull="true">
|
||||
<reportElement x="570" y="0" width="84" height="15"/>
|
||||
<textElement lineSpacing="Single">
|
||||
<font size="10"/>
|
||||
</textElement>
|
||||
<textFieldExpression class="java.lang.String"><![CDATA[$V{SOMA_VOLTA}]]></textFieldExpression>
|
||||
</textField>
|
||||
<staticText>
|
||||
<reportElement x="0" y="0" width="399" height="15"/>
|
||||
<textElement textAlignment="Center" lineSpacing="Single">
|
||||
<font isBold="true"/>
|
||||
</textElement>
|
||||
<text><![CDATA[TOTAL]]></text>
|
||||
</staticText>
|
||||
<textField pattern="#,##0.00" isBlankWhenNull="true">
|
||||
<reportElement x="654" y="0" width="95" height="15"/>
|
||||
<textElement textAlignment="Center" lineSpacing="Single">
|
||||
<font size="10"/>
|
||||
</textElement>
|
||||
<textFieldExpression class="java.lang.String"><![CDATA[$V{SOMA_TOTAL_RECEITA}]]></textFieldExpression>
|
||||
</textField>
|
||||
</band>
|
||||
</columnFooter>
|
||||
<noData>
|
||||
<band height="50">
|
||||
<staticText>
|
||||
<reportElement x="0" y="24" width="654" height="26"/>
|
||||
<textElement lineSpacing="Single" markup="none">
|
||||
<font size="11" isBold="true"/>
|
||||
</textElement>
|
||||
<text><![CDATA[Não foi possivel obter dados com os parâmetros informados.]]></text>
|
||||
</staticText>
|
||||
</band>
|
||||
</noData>
|
||||
</jasperReport>
|
|
@ -1,5 +1,6 @@
|
|||
package com.rjconsultores.ventaboletos.web.gui.controladores.relatorios;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
|
@ -21,6 +22,7 @@ import org.zkoss.zul.Datebox;
|
|||
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
||||
import com.rjconsultores.ventaboletos.entidad.Ruta;
|
||||
import com.rjconsultores.ventaboletos.relatorios.impl.RelatorioQuadroDemonstrativoMovimentoPassageiros;
|
||||
import com.rjconsultores.ventaboletos.relatorios.impl.RelatorioQuadroDemonstrativoMovimentoPassageirosNovoLayout;
|
||||
import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio;
|
||||
import com.rjconsultores.ventaboletos.service.EmpresaService;
|
||||
import com.rjconsultores.ventaboletos.service.RutaService;
|
||||
|
@ -53,9 +55,15 @@ public class RelatorioQuadroDemonstrativoMovimentoPassageirosController extends
|
|||
super.doAfterCompose(comp);
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public void onClick$btnExecutarRelatorio(Event ev) throws InterruptedException, Exception {
|
||||
|
||||
executarRelatorio(1);
|
||||
}
|
||||
public void onClick$btnExecutarRelatorioNovoLayout(Event ev) throws InterruptedException, Exception {
|
||||
executarRelatorio(2);
|
||||
}
|
||||
|
||||
private void executarRelatorio(int tipo) throws SQLException, Exception {
|
||||
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
|
||||
Date dataDe = datInicial.getValue();
|
||||
Date dataAte = datFinal.getValue();
|
||||
|
@ -71,6 +79,8 @@ public class RelatorioQuadroDemonstrativoMovimentoPassageirosController extends
|
|||
parametros.put("LINHAS", (ruta.getNumRuta()));
|
||||
parametros.put("DESC_LINHAS_SELECIONADAS", (ruta.getDescruta()));
|
||||
parametros.put("CANTASIENTOS", (ruta.getCantAsientos() != null ? ruta.getCantAsientos().toString() : ""));
|
||||
}else {
|
||||
parametros.put("DESC_LINHAS_SELECIONADAS", "Todas");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -90,14 +100,18 @@ public class RelatorioQuadroDemonstrativoMovimentoPassageirosController extends
|
|||
}
|
||||
parametros.put("EMPRESA", empresaDesc);
|
||||
parametros.put("EMPRESA_IDS", empresaId);
|
||||
|
||||
Relatorio relatorio = new RelatorioQuadroDemonstrativoMovimentoPassageiros(parametros, dataSourceRead.getConnection());
|
||||
|
||||
Relatorio relatorio = null;
|
||||
Map<String, Object> args = new HashMap<String, Object>();
|
||||
args.put("relatorio", relatorio);
|
||||
|
||||
openWindow("/component/reportView.zul",
|
||||
Labels.getLabel("indexController.mniRelatorioQuadroDemonstrativoMovimentoPassageiros.label"), args, MODAL);
|
||||
|
||||
if(tipo == 1) {
|
||||
relatorio = new RelatorioQuadroDemonstrativoMovimentoPassageiros(parametros, dataSourceRead.getConnection());
|
||||
args.put("relatorio", relatorio);
|
||||
openWindow("/component/reportView.zul", Labels.getLabel("indexController.mniRelatorioQuadroDemonstrativoMovimentoPassageiros.label"), args, MODAL);
|
||||
}else {
|
||||
relatorio = new RelatorioQuadroDemonstrativoMovimentoPassageirosNovoLayout(parametros, dataSourceRead.getConnection());
|
||||
args.put("relatorio", relatorio);
|
||||
openWindow("/component/reportView.zul", Labels.getLabel("indexController.mniRelatorioQuadroDemonstrativoMovimentoPassageiros.label"), args, MODAL);
|
||||
}
|
||||
}
|
||||
|
||||
public DataSource getDataSourceRead() {
|
||||
|
|
|
@ -52,6 +52,8 @@
|
|||
<toolbar>
|
||||
<button id="btnExecutarRelatorio" image="/gui/img/find.png"
|
||||
label="${c:l('relatorio.lb.btnExecutarRelatorio')}" />
|
||||
<button id="btnExecutarRelatorioNovoLayout" image="/gui/img/find.png"
|
||||
label="${c:l('relatorioQuadroDemonstrativoMovimentoPassageirosController.relatorio.lb.btnExecutarRelatorioNovoLayout')}" />
|
||||
</toolbar>
|
||||
</window>
|
||||
</zk>
|
||||
|
|
Loading…
Reference in New Issue