fixed bug #7112 - alterações relatório de tabela de preços

git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@53178 d1611594-4594-4d17-8e1d-87c2c4800839
master
frederico 2016-02-23 17:24:57 +00:00
parent 722e63a8d3
commit 98e910c33b
9 changed files with 263 additions and 226 deletions

View File

@ -2,14 +2,11 @@ package com.rjconsultores.ventaboletos.relatorios.impl;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Timestamp;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import com.rjconsultores.ventaboletos.relatorios.utilitarios.ArrayDataSource;
import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio;
import com.rjconsultores.ventaboletos.utilerias.DateUtil;
import com.rjconsultores.ventaboletos.web.utilerias.NamedParameterStatement;
public class RelatorioTabelaPreco extends Relatorio {
@ -21,12 +18,8 @@ public class RelatorioTabelaPreco extends Relatorio {
public void initDados() throws Exception {
Connection conexao = this.relatorio.getConexao();
Map<String, Object> parametros = this.relatorio.getParametros();
NamedParameterStatement stmt = new NamedParameterStatement(conexao, getSql());
stmt.setTimestamp("dataInicial", new Timestamp(DateUtil.inicioFecha((Date) parametros.get("DATA_INICIAL")).getTime()));
stmt.setTimestamp("dataFinal", new Timestamp(DateUtil.fimFecha((Date) parametros.get("DATA_FINAL")).getTime()));
ResultSet rset = stmt.executeQuery();
while (rset.next()) {
@ -43,6 +36,8 @@ public class RelatorioTabelaPreco extends Relatorio {
dataResult.put("linha", rset.getString("linha"));
dataResult.put("empresa", rset.getString("empresa"));
dataResult.put("dataVigencia", rset.getString("dataVigencia"));
dataResult.put("idLinha", rset.getInt("idLinha"));
dataResult.put("idVigencia", rset.getInt("idVigencia"));
this.dados.add(dataResult);
}
@ -69,7 +64,10 @@ public class RelatorioTabelaPreco extends Relatorio {
sql.append(" cs.DESCCLASE as tipoClasse, ");
sql.append(" r.DESCRUTA as linha, ");
sql.append(" e.NOMBEMPRESA as empresa, ");
sql.append(" vt.FECINICIOVIGENCIA || ' à ' || vt.FECFINVIGENCIA as dataVigencia ");
sql.append(" vt.FECINICIOVIGENCIA || ' à ' || vt.FECFINVIGENCIA as dataVigencia, ");
sql.append(" vt.VIGENCIATARIFA_ID as idVigencia, ");
sql.append(" vt.FECINICIOVIGENCIA as dataVigenciaInicial, ");
sql.append(" r.RUTA_ID as idLinha ");
sql.append("FROM TARIFA t ");
sql.append("INNER JOIN PARADA pOrigem ON t.ORIGEN_ID = pOrigem.PARADA_ID ");
sql.append("INNER JOIN PARADA pDestino ON t.DESTINO_ID = pDestino.PARADA_ID ");
@ -78,8 +76,11 @@ public class RelatorioTabelaPreco extends Relatorio {
sql.append("INNER JOIN MARCA m ON m.MARCA_ID = t.MARCA_ID ");
sql.append("INNER JOIN EMPRESA e ON e.EMPRESA_ID = m.EMPRESA_ID ");
sql.append("INNER JOIN VIGENCIA_TARIFA vt ON vt.VIGENCIATARIFA_ID = t.VIGENCIATARIFA_ID ");
sql.append("WHERE (:dataInicial BETWEEN vt.FECINICIOVIGENCIA AND vt.FECFINVIGENCIA ) ");
sql.append("AND (:dataFinal BETWEEN vt.FECINICIOVIGENCIA AND vt.FECFINVIGENCIA ) ");
sql.append("WHERE (1 = 1) AND ROWNUM < 101 ");
if(parametros.get("VIGENCIA_ID") != null){
sql.append(" AND vt.VIGENCIATARIFA_ID = " + parametros.get("VIGENCIA_ID"));
}
if (parametros.get("EMPRESA_ID") != null) {
sql.append(" AND e.empresa_id = " + parametros.get("EMPRESA_ID"));
@ -89,6 +90,8 @@ public class RelatorioTabelaPreco extends Relatorio {
sql.append(" AND r.RUTA_ID = " + parametros.get("RUTA_ID"));
}
sql.append( "ORDER BY r.RUTA_ID, vt.FECINICIOVIGENCIA ");
return sql.toString();
}

View File

@ -23,3 +23,4 @@ label.tipoClasse=Classe
label.linha=Linha
label.empresa=Empresa
label.dataVigencia=Vigência
label.total = Total

View File

@ -23,3 +23,4 @@ label.tipoClasse=Classe
label.linha=Linha
label.empresa=Empresa
label.dataVigencia=Vigência
label.total = Total

View File

@ -1,15 +1,20 @@
<?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="RelatorioTabelaPreco" pageWidth="842" pageHeight="595" orientation="Landscape" whenNoDataType="NoDataSection" columnWidth="802" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="c092ef85-9334-4225-93d7-1acb7cf4d021">
<property name="ireport.zoom" value="1.2100000000000055"/>
<property name="ireport.x" value="112"/>
<property name="ireport.y" value="0"/>
<property name="ireport.zoom" value="1.5"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="68"/>
<property name="net.sf.jasperreports.export.xls.exclude.origin.keep.first.band.2" value="pageHeader"/>
<property name="net.sf.jasperreports.export.xls.exclude.origin.keep.first.band.1" value="columnHeader"/>
<parameter name="NOME_RELATORIO" class="java.lang.String"/>
<parameter name="DATA_INICIAL" class="java.util.Date"/>
<parameter name="DATA_FINAL" class="java.util.Date"/>
<parameter name="USUARIO" class="java.lang.String"/>
<parameter name="FILTROS" class="java.lang.String"/>
<parameter name="EMPRESA_ID" class="java.lang.Integer"/>
<parameter name="EMPRESA" class="java.lang.String"/>
<parameter name="RUTA_ID" class="java.lang.Integer"/>
<parameter name="RUTA" class="java.lang.String"/>
<parameter name="VIGENCIA_INICIAL" class="java.util.Date"/>
<parameter name="VIGENCIA_FINAL" class="java.util.Date"/>
<parameter name="VIGENCIA_ID" class="java.lang.Integer"/>
<queryString>
<![CDATA[]]>
</queryString>
@ -24,11 +29,38 @@
<field name="empresa" class="java.lang.String"/>
<field name="dataVigencia" class="java.lang.String"/>
<field name="taxaEmbarque" class="java.math.BigDecimal"/>
<background>
<band splitType="Stretch"/>
</background>
<pageHeader>
<band height="75" splitType="Stretch">
<field name="idVigencia" class="java.lang.Integer"/>
<field name="idLinha" class="java.lang.Integer"/>
<group name="ruta">
<groupExpression><![CDATA[$F{linha}]]></groupExpression>
<groupHeader>
<band height="18">
<textField isStretchWithOverflow="true">
<reportElement uuid="e3c11bc0-5229-4925-b7fe-6a1e572ce946" x="0" y="0" width="559" height="18"/>
<textElement>
<font size="14" isBold="true" pdfFontName="Helvetica-Bold"/>
</textElement>
<textFieldExpression><![CDATA[$F{idLinha}.toString() + " - " + $F{linha}]]></textFieldExpression>
</textField>
</band>
</groupHeader>
</group>
<group name="vigencia">
<groupExpression><![CDATA[$F{dataVigencia}]]></groupExpression>
<groupHeader>
<band height="18">
<textField isStretchWithOverflow="true" pattern="dd/MM/yyyy">
<reportElement uuid="5c9ae216-19d0-48f6-a405-6ee51dcd55ef" x="0" y="0" width="322" height="18"/>
<textElement>
<font size="9" isBold="true" pdfFontName="Helvetica-Bold"/>
</textElement>
<textFieldExpression><![CDATA[$F{dataVigencia}]]></textFieldExpression>
</textField>
</band>
</groupHeader>
</group>
<title>
<band height="124">
<textField pattern="" isBlankWhenNull="false">
<reportElement uuid="136a5066-d141-4362-af36-0780f0d16542" mode="Transparent" x="0" y="0" width="457" height="35" forecolor="#000000" backcolor="#FFFFFF"/>
<textElement textAlignment="Left" verticalAlignment="Top" rotation="None" markup="none">
@ -37,38 +69,6 @@
</textElement>
<textFieldExpression><![CDATA[$P{NOME_RELATORIO}]]></textFieldExpression>
</textField>
<textField pattern="" isBlankWhenNull="false">
<reportElement uuid="3dca1764-758d-4e1c-80c0-85cc02e47813" mode="Transparent" x="0" y="42" width="46" height="15" forecolor="#000000" backcolor="#FFFFFF"/>
<textElement textAlignment="Left" verticalAlignment="Top" rotation="None" markup="none">
<font fontName="SansSerif" size="9" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
<paragraph lineSpacing="Single"/>
</textElement>
<textFieldExpression><![CDATA[$R{cabecalho.periodo}]]></textFieldExpression>
</textField>
<textField pattern="" isBlankWhenNull="false">
<reportElement uuid="8948c0fc-e878-45e2-8505-7934add98ab9" mode="Transparent" x="116" y="42" width="10" height="15" forecolor="#000000" backcolor="#FFFFFF"/>
<textElement textAlignment="Left" verticalAlignment="Top" rotation="None" markup="none">
<font fontName="SansSerif" size="9" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
<paragraph lineSpacing="Single"/>
</textElement>
<textFieldExpression><![CDATA[$R{cabecalho.periodoA}]]></textFieldExpression>
</textField>
<textField pattern="dd/MM/yyyy" isBlankWhenNull="false">
<reportElement uuid="7f1b9715-baaf-4e20-9a9d-a7ec4c696587" mode="Transparent" x="46" y="42" width="62" height="15" forecolor="#000000" backcolor="#FFFFFF"/>
<textElement textAlignment="Left" verticalAlignment="Top" rotation="None" markup="none">
<font fontName="SansSerif" size="9" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
<paragraph lineSpacing="Single"/>
</textElement>
<textFieldExpression><![CDATA[$P{DATA_INICIAL}]]></textFieldExpression>
</textField>
<textField pattern="dd/MM/yyyy" isBlankWhenNull="false">
<reportElement uuid="64632058-9466-479c-ae28-0a11c9ed2c7f" mode="Transparent" x="132" y="42" width="62" height="15" forecolor="#000000" backcolor="#FFFFFF"/>
<textElement textAlignment="Left" verticalAlignment="Top" rotation="None" markup="none">
<font fontName="SansSerif" size="9" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
<paragraph lineSpacing="Single"/>
</textElement>
<textFieldExpression><![CDATA[$P{DATA_FINAL}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="a9d471fb-1e1d-4d9a-9783-bbf988931192" x="615" y="0" width="100" height="25"/>
<textElement textAlignment="Right">
@ -108,27 +108,107 @@
</textElement>
<textFieldExpression><![CDATA[$R{cabecalho.impressorPor}+" "+$P{USUARIO}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="b29d0494-2695-420b-bdc1-b13c08bdbcda" x="0" y="59" width="801" height="14"/>
<box leftPadding="2">
<topPen lineWidth="1.0"/>
<leftPen lineWidth="1.0"/>
<bottomPen lineWidth="1.0"/>
<rightPen lineWidth="1.0"/>
<textField isStretchWithOverflow="true">
<reportElement uuid="64027797-62dc-4e02-8e40-958ac1511e0a" x="0" y="57" width="102" height="18" isPrintWhenDetailOverflows="true"/>
<box>
<bottomPen lineWidth="0.0"/>
</box>
<textElement verticalAlignment="Middle">
<font size="8"/>
<textElement textAlignment="Right" verticalAlignment="Top">
<font size="10" isBold="true" pdfFontName="Helvetica-Bold"/>
</textElement>
<textFieldExpression><![CDATA[$P{FILTROS}]]></textFieldExpression>
<textFieldExpression><![CDATA[$R{label.empresa} + ":"]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="bcd47f18-94dc-4d33-96db-6d89795188d3" x="102" y="57" width="513" height="18"/>
<textElement/>
<textFieldExpression><![CDATA[$P{EMPRESA_ID} == null ?
"Todas" :
($P{EMPRESA_ID}.toString() + " - " + $P{EMPRESA}) ]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true">
<reportElement uuid="049832ef-f634-42f9-95b1-ac2e1fe23b10" x="0" y="75" width="102" height="18" isPrintWhenDetailOverflows="true"/>
<box>
<bottomPen lineWidth="0.0"/>
</box>
<textElement textAlignment="Right" verticalAlignment="Top">
<font size="10" isBold="true" pdfFontName="Helvetica-Bold"/>
</textElement>
<textFieldExpression><![CDATA[$R{label.linha} + ":"]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="df6b8946-988c-479c-8eeb-c8d40c94734b" x="102" y="75" width="511" height="18"/>
<textElement/>
<textFieldExpression><![CDATA[$P{RUTA_ID} == null ?
"Todas" :
($P{RUTA_ID}.toString() + " - " + $P{RUTA})]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true">
<reportElement uuid="2d048310-1ec5-4711-b402-75ef3d3500d4" x="0" y="93" width="102" height="18" isPrintWhenDetailOverflows="true"/>
<box>
<bottomPen lineWidth="0.0"/>
</box>
<textElement textAlignment="Right" verticalAlignment="Top">
<font size="10" isBold="true" pdfFontName="Helvetica-Bold"/>
</textElement>
<textFieldExpression><![CDATA[$R{label.dataVigencia} + ":"]]></textFieldExpression>
</textField>
<textField pattern="dd/MM/yyyy">
<reportElement uuid="40c47b73-ef86-4b76-a4bb-ec284d4e6f59" x="102" y="93" width="56" height="18">
<printWhenExpression><![CDATA[new Boolean($P{VIGENCIA_ID} != null)]]></printWhenExpression>
</reportElement>
<textElement/>
<textFieldExpression><![CDATA[$P{VIGENCIA_INICIAL}]]></textFieldExpression>
</textField>
<textField pattern="dd/MM/yyyy">
<reportElement uuid="12564f32-d986-46a6-a184-23b23ba50bcb" x="176" y="93" width="56" height="18">
<printWhenExpression><![CDATA[new Boolean($P{VIGENCIA_ID} != null)]]></printWhenExpression>
</reportElement>
<textElement/>
<textFieldExpression><![CDATA[$P{VIGENCIA_FINAL}]]></textFieldExpression>
</textField>
<staticText>
<reportElement uuid="bdfc1a2c-9e77-418f-8169-50c67ad7f116" x="158" y="93" width="18" height="18">
<printWhenExpression><![CDATA[new Boolean($P{VIGENCIA_ID} != null)]]></printWhenExpression>
</reportElement>
<textElement textAlignment="Center"/>
<text><![CDATA[à]]></text>
</staticText>
<staticText>
<reportElement uuid="1bba53bd-7d81-491b-b1de-11a0c570c5c7" x="102" y="93" width="130" height="18">
<printWhenExpression><![CDATA[new Boolean($P{VIGENCIA_ID} == null)]]></printWhenExpression>
</reportElement>
<textElement/>
<text><![CDATA[Todas]]></text>
</staticText>
<textField>
<reportElement uuid="82e75550-fae7-4cea-acf9-f9f56f083400" x="688" y="93" width="93" height="18">
<printWhenExpression><![CDATA[false]]></printWhenExpression>
</reportElement>
<box>
<topPen lineWidth="1.0"/>
<bottomPen lineWidth="0.0"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Top">
<font size="10"/>
</textElement>
<textFieldExpression><![CDATA[$R{label.empresa}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true">
<reportElement uuid="abf746f7-be60-48af-9882-6723c50f4ae1" x="688" y="75" width="93" height="20">
<printWhenExpression><![CDATA[false]]></printWhenExpression>
</reportElement>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[$F{empresa}]]></textFieldExpression>
</textField>
</band>
</pageHeader>
</title>
<columnHeader>
<band height="18" splitType="Stretch">
<band height="20" splitType="Stretch">
<textField isStretchWithOverflow="true">
<reportElement uuid="337f441e-ca7f-402c-8407-f3406ec2b4b0" x="0" y="0" width="102" height="18" isPrintWhenDetailOverflows="true"/>
<reportElement uuid="337f441e-ca7f-402c-8407-f3406ec2b4b0" x="0" y="0" width="151" height="18" isPrintWhenDetailOverflows="true"/>
<box>
<bottomPen lineWidth="1.0"/>
<topPen lineWidth="1.0"/>
<bottomPen lineWidth="0.0"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Top">
<font size="10"/>
@ -136,29 +216,10 @@
<textFieldExpression><![CDATA[$R{label.origem}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="0ddedacd-7ebc-4aa7-9535-2f5695ee9c8c" x="568" y="0" width="88" height="18"/>
<reportElement uuid="859d4892-377e-4313-8a88-6454a88ce936" x="656" y="0" width="65" height="18"/>
<box>
<bottomPen lineWidth="1.0"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Top">
<font size="10"/>
</textElement>
<textFieldExpression><![CDATA[$R{label.linha}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="8506ac47-d72f-4ef5-b53a-da3970fb7edc" x="479" y="0" width="89" height="18"/>
<box>
<bottomPen lineWidth="1.0"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Top">
<font size="10"/>
</textElement>
<textFieldExpression><![CDATA[$R{label.tipoClasse}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="859d4892-377e-4313-8a88-6454a88ce936" x="424" y="0" width="55" height="18"/>
<box>
<bottomPen lineWidth="1.0"/>
<topPen lineWidth="1.0"/>
<bottomPen lineWidth="0.0"/>
</box>
<textElement textAlignment="Right" verticalAlignment="Top">
<font size="10"/>
@ -166,9 +227,10 @@
<textFieldExpression><![CDATA[$R{label.outros}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="d9a2225c-8883-4a35-9c16-8af9bcfe6577" x="259" y="0" width="55" height="18"/>
<reportElement uuid="d9a2225c-8883-4a35-9c16-8af9bcfe6577" x="461" y="0" width="65" height="18"/>
<box>
<bottomPen lineWidth="1.0"/>
<topPen lineWidth="1.0"/>
<bottomPen lineWidth="0.0"/>
</box>
<textElement textAlignment="Right" verticalAlignment="Top">
<font size="10"/>
@ -176,9 +238,10 @@
<textFieldExpression><![CDATA[$R{label.pedagio}]]></textFieldExpression>
</textField>
<textField pattern="" isBlankWhenNull="false">
<reportElement uuid="0583701e-920a-473b-b1e4-6137f8d022df" mode="Transparent" x="204" y="0" width="55" height="18" forecolor="#000000" backcolor="#FFFFFF"/>
<reportElement uuid="0583701e-920a-473b-b1e4-6137f8d022df" mode="Transparent" x="396" y="0" width="65" height="18" forecolor="#000000" backcolor="#FFFFFF"/>
<box>
<bottomPen lineWidth="1.0"/>
<topPen lineWidth="1.0"/>
<bottomPen lineWidth="0.0"/>
</box>
<textElement textAlignment="Right" verticalAlignment="Top" rotation="None" markup="none">
<font fontName="SansSerif" size="10" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
@ -186,20 +249,11 @@
</textElement>
<textFieldExpression><![CDATA[$R{label.tarifa}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="82e75550-fae7-4cea-acf9-f9f56f083400" x="656" y="0" width="93" height="18"/>
<box>
<bottomPen lineWidth="1.0"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Top">
<font size="10"/>
</textElement>
<textFieldExpression><![CDATA[$R{label.empresa}]]></textFieldExpression>
</textField>
<textField pattern="" isBlankWhenNull="false">
<reportElement uuid="f9ea7239-48e1-4207-b957-dc4aadcaa590" mode="Transparent" x="102" y="0" width="102" height="18" forecolor="#000000" backcolor="#FFFFFF"/>
<reportElement uuid="f9ea7239-48e1-4207-b957-dc4aadcaa590" mode="Transparent" x="151" y="0" width="151" height="18" forecolor="#000000" backcolor="#FFFFFF"/>
<box>
<bottomPen lineWidth="1.0"/>
<topPen lineWidth="1.0"/>
<bottomPen lineWidth="0.0"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Top" rotation="None" markup="none">
<font fontName="SansSerif" size="10" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
@ -208,9 +262,10 @@
<textFieldExpression><![CDATA[$R{label.destino}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="876fa163-5ff5-4eef-b32c-0f5b6b40672c" x="314" y="0" width="55" height="18"/>
<reportElement uuid="876fa163-5ff5-4eef-b32c-0f5b6b40672c" x="526" y="0" width="65" height="18"/>
<box>
<bottomPen lineWidth="1.0"/>
<topPen lineWidth="1.0"/>
<bottomPen lineWidth="0.0"/>
</box>
<textElement textAlignment="Right" verticalAlignment="Top">
<font size="10"/>
@ -218,9 +273,10 @@
<textFieldExpression><![CDATA[$R{label.taxaEmbarque}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="77a2f088-9771-472c-bffe-cd1345050e51" x="369" y="0" width="55" height="18"/>
<reportElement uuid="77a2f088-9771-472c-bffe-cd1345050e51" x="591" y="0" width="65" height="18"/>
<box>
<bottomPen lineWidth="1.0"/>
<topPen lineWidth="1.0"/>
<bottomPen lineWidth="0.0"/>
</box>
<textElement textAlignment="Right" verticalAlignment="Top">
<font size="10"/>
@ -228,83 +284,87 @@
<textFieldExpression><![CDATA[$R{label.seguro}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="2daa8450-9151-4464-abd8-29d744df1e26" x="749" y="0" width="53" height="18"/>
<reportElement uuid="8506ac47-d72f-4ef5-b53a-da3970fb7edc" x="302" y="0" width="94" height="18"/>
<box>
<bottomPen lineWidth="1.0"/>
<topPen lineWidth="1.0"/>
<bottomPen lineWidth="0.0"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Top">
<font size="10"/>
</textElement>
<textFieldExpression><![CDATA[$R{label.dataVigencia}]]></textFieldExpression>
<textFieldExpression><![CDATA[$R{label.tipoClasse}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="5860d60c-cf3f-4f05-a3e4-756baba65aba" x="721" y="0" width="81" height="18"/>
<box>
<topPen lineWidth="1.0"/>
<bottomPen lineWidth="0.0"/>
</box>
<textElement textAlignment="Right" verticalAlignment="Top">
<font size="10"/>
</textElement>
<textFieldExpression><![CDATA[$R{label.total}]]></textFieldExpression>
</textField>
</band>
</columnHeader>
<detail>
<band height="20" splitType="Stretch">
<textField isStretchWithOverflow="true">
<reportElement uuid="4a0efda0-b112-4092-8164-292ab7fb1950" x="0" y="0" width="102" height="20"/>
<reportElement uuid="4a0efda0-b112-4092-8164-292ab7fb1950" x="0" y="0" width="151" height="20"/>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[$F{origem}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true">
<reportElement uuid="f544e769-3f8c-4200-86ed-01f6c4024334" x="102" y="0" width="102" height="20"/>
<reportElement uuid="f544e769-3f8c-4200-86ed-01f6c4024334" x="151" y="0" width="151" height="20"/>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[$F{destino}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" pattern="">
<reportElement uuid="b81fcb18-2337-4514-be27-fe7d3c88acc5" x="204" y="0" width="55" height="20"/>
<textField isStretchWithOverflow="true" pattern="#,##0.00">
<reportElement uuid="b81fcb18-2337-4514-be27-fe7d3c88acc5" x="396" y="0" width="65" height="20"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$F{tarifa}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" pattern="">
<reportElement uuid="8a545d22-875e-46cd-8011-444a8e884bca" x="259" y="0" width="55" height="20"/>
<textField isStretchWithOverflow="true" pattern="#,##0.00">
<reportElement uuid="8a545d22-875e-46cd-8011-444a8e884bca" x="461" y="0" width="65" height="20"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$F{pedagio}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" pattern="">
<reportElement uuid="6f76912d-0eef-439c-9fb8-236181d94033" x="424" y="0" width="55" height="20"/>
<textField isStretchWithOverflow="true" pattern="#,##0.00">
<reportElement uuid="6f76912d-0eef-439c-9fb8-236181d94033" x="656" y="0" width="65" height="20"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$F{outros}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" pattern="">
<reportElement uuid="ac958e4e-b8ad-4abc-b58a-1aaca4992db6" x="314" y="0" width="55" height="20"/>
<textField isStretchWithOverflow="true" pattern="#,##0.00">
<reportElement uuid="ac958e4e-b8ad-4abc-b58a-1aaca4992db6" x="526" y="0" width="65" height="20"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$F{taxaEmbarque}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" pattern="">
<reportElement uuid="72858663-765d-4843-bc51-ec6a80a0b7d0" x="369" y="0" width="55" height="20"/>
<textField isStretchWithOverflow="true" pattern="#,##0.00">
<reportElement uuid="72858663-765d-4843-bc51-ec6a80a0b7d0" x="591" y="0" width="65" height="20"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$F{seguro}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true">
<reportElement uuid="11f32d65-9824-47f6-95f5-482cce626d4b" x="479" y="0" width="89" height="20"/>
<reportElement uuid="11f32d65-9824-47f6-95f5-482cce626d4b" x="302" y="0" width="94" height="20"/>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[$F{tipoClasse}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true">
<reportElement uuid="e3c11bc0-5229-4925-b7fe-6a1e572ce946" x="568" y="0" width="88" height="20"/>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[$F{linha}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true">
<reportElement uuid="abf746f7-be60-48af-9882-6723c50f4ae1" x="656" y="0" width="93" height="20"/>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[$F{empresa}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" pattern="dd/MM/yyyy">
<reportElement uuid="5c9ae216-19d0-48f6-a405-6ee51dcd55ef" x="749" y="0" width="52" height="20"/>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[$F{dataVigencia}]]></textFieldExpression>
<textField isStretchWithOverflow="true" pattern="#,##0.00">
<reportElement uuid="722229cf-1b78-459d-92fc-1a30615054a2" x="721" y="0" width="81" height="20"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$F{tarifa}.doubleValue() +
$F{pedagio}.doubleValue() +
$F{pedagio}.doubleValue() +
$F{taxaEmbarque}.doubleValue() +
$F{seguro}.doubleValue() +
$F{outros}.doubleValue()]]></textFieldExpression>
</textField>
</band>
</detail>
<summary>
<band splitType="Stretch"/>
</summary>
<noData>
<band height="26">
<band height="29">
<textField>
<reportElement uuid="6f13c961-dd50-4e44-ba73-65e0752b8b83" x="0" y="0" width="802" height="26"/>
<reportElement uuid="6f13c961-dd50-4e44-ba73-65e0752b8b83" x="-101" y="0" width="802" height="26"/>
<textElement textAlignment="Center" markup="none">
<font size="11" isBold="true"/>
</textElement>

View File

@ -1,6 +1,5 @@
package com.rjconsultores.ventaboletos.web.gui.controladores.relatorios;
import java.util.Calendar;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -11,18 +10,18 @@ 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 com.rjconsultores.ventaboletos.entidad.Empresa;
import com.rjconsultores.ventaboletos.entidad.Ruta;
import com.rjconsultores.ventaboletos.entidad.VigenciaTarifa;
import com.rjconsultores.ventaboletos.relatorios.impl.RelatorioTabelaPreco;
import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio;
import com.rjconsultores.ventaboletos.service.EmpresaService;
import com.rjconsultores.ventaboletos.service.RutaService;
import com.rjconsultores.ventaboletos.service.VigenciaTarifaService;
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEstandar;
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
@ -33,13 +32,15 @@ public class RelatorioTabelaPrecoController extends MyGenericForwardComposer {
private static final long serialVersionUID = 1L;
private Datebox datInicial;
private Datebox datFinal;
private MyComboboxEstandar cmbVigencia;
private List<VigenciaTarifa> lsVigencia;
private MyComboboxEstandar cmbEmpresa;
private List<Empresa> lsEmpresa;
private MyComboboxEstandar cmbRuta;
private List<Ruta> lsRuta;
@Autowired
private VigenciaTarifaService vigenciaTarifaService;
@Autowired
private EmpresaService empresaService;
@Autowired
@ -49,6 +50,7 @@ public class RelatorioTabelaPrecoController extends MyGenericForwardComposer {
@Override
public void doAfterCompose(Component comp) throws Exception {
lsVigencia = vigenciaTarifaService.obtenerTodos();
lsEmpresa = empresaService.obtenerTodos();
lsRuta = rutaService.obtenerTodos();
super.doAfterCompose(comp);
@ -61,63 +63,36 @@ public class RelatorioTabelaPrecoController extends MyGenericForwardComposer {
@SuppressWarnings({ "rawtypes", "unchecked" })
private void executarRelatorio() throws Exception {
{
if (datInicial != null && datFinal != null && datFinal.getValue().compareTo(datInicial.getValue()) < 0) {
try {
Messagebox.show(Labels.getLabel("MSG.ningunRegistro"),
Labels.getLabel("relatorioTabelaPrecoController.window.title"),
Messagebox.OK, Messagebox.INFORMATION);
} catch (InterruptedException ex) {
ex.printStackTrace();
}
} else
{
Relatorio relatorio;
Map<String, Object> parametros = new HashMap<String, Object>();
StringBuilder filtro = new StringBuilder();
filtro.append("Início período: ");
Calendar cal = Calendar.getInstance();
cal.setTime(datInicial.getValue());
filtro.append(cal.get(Calendar.DATE) + "/");
filtro.append((cal.get(Calendar.MONTH) + 1) + "/");
filtro.append(cal.get(Calendar.YEAR) + "; ");
filtro.append("Fim período: ");
cal.setTime(datFinal.getValue());
filtro.append(cal.get(Calendar.DATE) + "/");
filtro.append((cal.get(Calendar.MONTH) + 1) + "/");
filtro.append(cal.get(Calendar.YEAR) + "; ");
parametros.put("DATA_INICIAL", (java.util.Date) datInicial.getValue());
parametros.put("DATA_FINAL", (java.util.Date) datFinal.getValue());
parametros.put("NOME_RELATORIO", Labels.getLabel("relatorioTabelaPrecoController.window.title"));
parametros.put("USUARIO", UsuarioLogado.getUsuarioLogado().getUsuarioId().toString());
parametros.put("USUARIO_NOME", UsuarioLogado.getUsuarioLogado().getNombusuario());
filtro.append("Empresa: ");
Comboitem itemVigencia = cmbVigencia.getSelectedItem();
if(itemVigencia != null){
VigenciaTarifa vigencia = (VigenciaTarifa) itemVigencia.getValue();
parametros.put("VIGENCIA_ID", vigencia.getVigenciatarifaId());
parametros.put("VIGENCIA_INICIAL", vigencia.getFeciniciovigencia());
parametros.put("VIGENCIA_FINAL", vigencia.getFecfinvigencia());
}
Comboitem itemEmpresa = cmbEmpresa.getSelectedItem();
if (itemEmpresa != null) {
Empresa empresa = (Empresa) itemEmpresa.getValue();
parametros.put("EMPRESA_ID", empresa.getEmpresaId());
filtro.append(empresa.getNombempresa() + ";");
} else {
filtro.append(" Todas;");
parametros.put("EMPRESA", empresa.getNombempresa());
}
filtro.append("Linha: ");
Comboitem itemRuta = cmbRuta.getSelectedItem();
if (itemRuta != null) {
Ruta ruta = (Ruta) itemRuta.getValue();
parametros.put("RUTA_ID", ruta.getRutaId());
filtro.append(ruta.getDescruta() + ";");
} else {
filtro.append(" Todas;");
parametros.put("RUTA", ruta.getDescruta());
}
parametros.put("FILTROS", filtro.toString());
relatorio = new RelatorioTabelaPreco(parametros, dataSourceRead.getConnection());
Map args = new HashMap();
@ -126,7 +101,7 @@ public class RelatorioTabelaPrecoController extends MyGenericForwardComposer {
openWindow("/component/reportView.zul",
Labels.getLabel("relatorioTabelaPrecoController.window.title"), args, MODAL);
}
}
}
public void onClick$btnExecutarRelatorio(Event ev) throws Exception{
@ -134,22 +109,6 @@ public class RelatorioTabelaPrecoController extends MyGenericForwardComposer {
}
public Datebox getDatInicial() {
return datInicial;
}
public void setDatInicial(Datebox datInicial) {
this.datInicial = datInicial;
}
public Datebox getDatFinal() {
return datFinal;
}
public void setDatFinal(Datebox datFinal) {
this.datFinal = datFinal;
}
public List<Empresa> getLsEmpresa() {
return lsEmpresa;
}
@ -182,4 +141,22 @@ public class RelatorioTabelaPrecoController extends MyGenericForwardComposer {
this.lsRuta = lsRuta;
}
public MyComboboxEstandar getCmbVigencia() {
return cmbVigencia;
}
public void setCmbVigencia(MyComboboxEstandar cmbVigencia) {
this.cmbVigencia = cmbVigencia;
}
public List<VigenciaTarifa> getLsVigencia() {
return lsVigencia;
}
public void setLsVigencia(List<VigenciaTarifa> lsVigencia) {
this.lsVigencia = lsVigencia;
}
}

View File

@ -4191,8 +4191,7 @@ relatorioCancelamentoTransacaoController.lbBilheteiro.value = Bilheteiro
#Relatorio de Tabela Preco
relatorioTabelaPrecoController.window.title = Relatório de Tabela de Preços
relatorioTabelaPrecoController.dataInicial.value = Data Inicial
relatorioTabelaPrecoController.dataFinal.value = Data Final
relatorioTabelaPrecoController.vigencia = Vigência
relatorioTabelaPrecoController.lbEmpresa.value = Empresa
relatorioTabelaPrecoController.lbLinha.value = Linha

View File

@ -4253,8 +4253,7 @@ relatorioCancelamentoTransacaoController.lbBilheteiro.value = Bilheteiro
#Relatorio de Tabela Preco
relatorioTabelaPrecoController.window.title = Relatório de Tabela de Preços
relatorioTabelaPrecoController.dataInicial.value = Data Inicial
relatorioTabelaPrecoController.dataFinal.value = Data Final
relatorioTabelaPrecoController.vigencia = Vigência
relatorioTabelaPrecoController.lbEmpresa.value = Empresa
relatorioTabelaPrecoController.lbLinha.value = Linha

View File

@ -7,7 +7,7 @@
<zk xmlns="http://www.zkoss.org/2005/zul">
<window id="winFiltroRelatorioTabelaPreco"
apply="${relatorioTabelaPrecoController}" contentStyle="overflow:auto"
height="285px" width="550px" border="normal">
height="150px" width="550px" border="normal">
<grid fixedLayout="true">
<columns>
<column width="25%" />
@ -16,19 +16,16 @@
<column width="30%" />
</columns>
<rows>
<row>
<row spans="1,3">
<label
value="${c:l('relatorioTabelaPrecoController.dataInicial.value')}" />
<datebox id="datInicial" format="dd/MM/yyyy"
width="90%" lenient="true" constraint="no empty"
maxlength="10" />
<label
value="${c:l('relatorioTabelaPrecoController.dataFinal.value')}" />
<datebox id="datFinal" format="dd/MM/yyyy"
width="90%" lenient="true" constraint="no empty"
maxlength="10" />
value="${c:l('relatorioTabelaPrecoController.vigencia')}" />
<combobox id="cmbVigencia"
buttonVisible="true"
use="com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEstandar"
model="@{winFiltroRelatorioTabelaPreco$composer.lsVigencia}"
width="100%" />
</row>
<row spans="1,3">
<label
value="${c:l('relatorioTabelaPrecoController.lbEmpresa.value')}" />