Atendimento da demanda 6361 - Adicionando arquivos

git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@44991 d1611594-4594-4d17-8e1d-87c2c4800839
master
daniel.zauli 2015-06-15 18:12:32 +00:00
parent ba7d10c8c5
commit 91c658b15f
6 changed files with 777 additions and 0 deletions

View File

@ -0,0 +1,144 @@
package com.rjconsultores.ventaboletos.relatorios.impl;
import java.math.BigDecimal;
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.negocio.CalculoImposto;
import com.rjconsultores.ventaboletos.relatorios.utilitarios.ArrayDataSource;
import com.rjconsultores.ventaboletos.relatorios.utilitarios.ExceptionConfiguracao;
import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio;
import com.rjconsultores.ventaboletos.utilerias.DateUtil;
import com.rjconsultores.ventaboletos.web.utilerias.NamedParameterStatement;
public class RelatorioReceitaServico extends Relatorio {
public RelatorioReceitaServico(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 puntosVentaIds = (String) parametros.get("NUMPUNTOVENTA");
String sql = getSql(
(parametros.get("ORIGEN_ID") != null && parametros.get("ORIGEN_ID") != "" ) ,
(parametros.get("DESTINO_ID") != null && parametros.get("DESTINO_ID") != "" )
);
NamedParameterStatement stmt = new NamedParameterStatement(conexao, sql);
// stmt.setTimestamp("DATA_INICIAL", new Timestamp(DateUtil.inicioFecha((Date) parametros.get("DATA_INICIAL")).getTime()));
// stmt.setTimestamp("DATA_FINAL", new Timestamp(DateUtil.fimFecha((Date) parametros.get("DATA_FINAL")).getTime()));
stmt.setTimestamp("DATA_INICIAL", new Timestamp(((Date) parametros.get("DATA_INICIAL")).getTime()));
stmt.setTimestamp("DATA_FINAL", new Timestamp(((Date) parametros.get("DATA_FINAL")).getTime()));
if (parametros.get("ORIGEN_ID") != null)
stmt.setInt("ORIGEN_ID", (Integer) parametros.get("ORIGEN_ID"));
else{}
// stmt.setNull("ORIGEN_ID", java.sql.Types.INTEGER);
if (parametros.get("DESTINO_ID") != null)
stmt.setInt("DESTINO_ID", (Integer) parametros.get("DESTINO_ID"));
else{}
//stmt.setNull("DESTINO_ID", java.sql.Types.INTEGER);
if (parametros.get("EMPRESA_ID") != null)
stmt.setInt("EMPRESA_ID", (Integer) parametros.get("EMPRESA_ID"));
else
stmt.setNull("EMPRESA_ID", java.sql.Types.INTEGER);
if (parametros.get("CLASESERVICIO_ID") != null)
stmt.setInt("CLASESERVICIO_ID", (Short) parametros.get("CLASESERVICIO_ID"));
else
stmt.setNull("CLASESERVICIO_ID", java.sql.Types.INTEGER);
ResultSet rset = stmt.executeQuery();
while (rset.next()) {
Map<String, Object> dataResult = new HashMap<String, Object>();
dataResult.put("data", rset.getDate("data"));
dataResult.put("servico", rset.getString("servico"));
dataResult.put("empresa", rset.getString("empresa"));
dataResult.put("origem", rset.getString("origem"));
dataResult.put("destino", rset.getString("destino"));
dataResult.put("classe", rset.getString("classe"));
dataResult.put("tarifa", rset.getString("tarifa"));
dataResult.put("tut", rset.getBigDecimal("tut"));
dataResult.put("pedagio", rset.getBigDecimal("pedagio"));
dataResult.put("total", rset.getBigDecimal("total"));
dataResult.put("tipo", rset.getString("tipo"));
dataResult.put("agencia", rset.getString("agencia"));
dataResult.put("dataHoraCompra", rset.getDate("dataHoraCompra"));
dataResult.put("passageiro", rset.getString("passageiro"));
dataResult.put("nrBilhete", rset.getString("nrBilhete"));
this.dados.add(dataResult);
}
this.resultSet = rset;
}
});
}
@Override
protected void processaParametros() throws Exception {
}
private String getSql(boolean origemSelected , boolean destinoSelected) {
StringBuilder sql = new StringBuilder();
sql.append(" select c.feccorrida as data, ");
sql.append(" c.CORRIDA_ID as servico , ");
sql.append(" e.nombempresa as empresa, ");
sql.append(" pOrig.cveparada as origem, ");
sql.append(" pDest.cveparada as destino, ");
sql.append(" cs.descclase as classe, ");
sql.append(" cj.preciopagado as tarifa, ");
sql.append(" cj.importetaxaembarque as tut, ");
sql.append(" cj.importepedagio as pedagio, ");
sql.append(" (cj.preciopagado + cj.importetaxaembarque + cj.importepedagio ) as total, ");
sql.append(" CAT.desccategoria as tipo, ");
sql.append(" pv.nombpuntoventa as agencia, ");
sql.append(" cj.fechorventa as dataHoraCompra, ");
sql.append(" cj.nombpasajero as passageiro, ");
sql.append(" cj.NUMFOLIOPREIMPRESO as nrBilhete ");
sql.append(" from corrida c ");
sql.append(" inner join marca m on c.marca_id = m.marca_id ");
sql.append(" inner join empresa e on m.empresa_id = e.empresa_id ");
sql.append(" inner join caja cj on cj.corrida_id = c.corrida_id ");
sql.append(" inner join parada pOrig on pOrig.parada_id = cj.origen_id ");
sql.append(" inner join parada pDest on pDest.parada_id = cj.destino_id ");
sql.append(" inner join CLASE_SERVICIO cs on cs.CLASESERVICIO_ID = cj.CLASESERVICIO_ID ");
sql.append(" inner join CATEGORIA CAT on cj.usuario_id = CAT.usuario_id ");
sql.append(" inner join punto_venta pv on cj.puntoventa_id = pv.puntoventa_id ");
sql.append(" where c.feccorrida >= :DATA_INICIAL ");
sql.append(" and c.feccorrida <= :DATA_FINAL ");
if(origemSelected){ sql.append(" and pOrig.PARADA_ID IN (:ORIGEN_ID) "); }
else{ sql.append(" and pOrig.PARADA_ID IN ( select p.PARADA_ID from parada p ) "); }
if(destinoSelected){ sql.append(" and pDest.PARADA_ID IN (:DESTINO_ID) "); }
else{ sql.append(" and pDest.PARADA_ID IN ( select p.PARADA_ID from parada p) "); }
sql.append(" and e.EMPRESA_ID = :EMPRESA_ID ");
sql.append(" and CLASESERVICIO_ID = :CLASESERVICIO_ID ");
return sql.toString();
}
}

View File

@ -0,0 +1,12 @@
#geral
msg.noData=Não foi possivel obter dados com os parâmetros informados.
#Labels cabeçalho
cabecalho.relatorio=Relatório:
cabecalho.periodo=Período:
cabecalho.periodoA=à
cabecalho.dataHora=Data/Hora:
cabecalho.impressorPor=Impressor por:
cabecalho.pagina=Página
cabecalho.de=de
cabecalho.filtros=Filtros:

View File

@ -0,0 +1,12 @@
#geral
msg.noData=Não foi possivel obter dados com os parâmetros informados.
#Labels cabeçalho
cabecalho.relatorio=Relatório:
cabecalho.periodo=Período:
cabecalho.periodoA=à
cabecalho.dataHora=Data/Hora:
cabecalho.impressorPor=Impressor por:
cabecalho.pagina=Página
cabecalho.de=de
cabecalho.filtros=Filtros:

View File

@ -0,0 +1,274 @@
<?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="RelatorioReceitaServico" pageWidth="842" pageHeight="595" orientation="Landscape" columnWidth="802" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="c092ef85-9334-4225-93d7-1acb7cf4d021">
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<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"/>
<queryString>
<![CDATA[]]>
</queryString>
<field name="data" class="java.util.Date"/>
<field name="servico" class="java.lang.String"/>
<field name="empresa" class="java.lang.String"/>
<field name="origem" class="java.lang.String"/>
<field name="destino" class="java.lang.String"/>
<field name="classe" class="java.lang.String"/>
<field name="tarifa" class="java.lang.String"/>
<field name="tut" class="java.math.BigDecimal"/>
<field name="pedagio" class="java.math.BigDecimal"/>
<field name="total" class="java.math.BigDecimal"/>
<field name="tipo" class="java.lang.String"/>
<field name="agencia" class="java.lang.String"/>
<field name="dataHoraCompra" class="java.util.Date"/>
<field name="passageiro" class="java.lang.String"/>
<field name="nrBilhete" class="java.lang.String"/>
<background>
<band splitType="Stretch"/>
</background>
<pageHeader>
<band height="82" splitType="Stretch">
<textField pattern="" isBlankWhenNull="false">
<reportElement mode="Transparent" x="11" y="0" width="257" height="35" forecolor="#000000" backcolor="#FFFFFF" uuid="136a5066-d141-4362-af36-0780f0d16542"/>
<textElement textAlignment="Left" verticalAlignment="Top" rotation="None" markup="none">
<font fontName="SansSerif" size="15" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
<paragraph lineSpacing="Single"/>
</textElement>
<textFieldExpression><![CDATA[$P{NOME_RELATORIO}]]></textFieldExpression>
</textField>
<textField pattern="" isBlankWhenNull="false">
<reportElement mode="Transparent" x="11" y="35" width="72" height="14" forecolor="#000000" backcolor="#FFFFFF" uuid="3dca1764-758d-4e1c-80c0-85cc02e47813"/>
<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 mode="Transparent" x="134" y="35" width="10" height="14" forecolor="#000000" backcolor="#FFFFFF" uuid="8948c0fc-e878-45e2-8505-7934add98ab9"/>
<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 mode="Transparent" x="83" y="35" width="51" height="14" forecolor="#000000" backcolor="#FFFFFF" uuid="7f1b9715-baaf-4e20-9a9d-a7ec4c696587"/>
<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 mode="Transparent" x="144" y="35" width="51" height="14" forecolor="#000000" backcolor="#FFFFFF" uuid="64632058-9466-479c-ae28-0a11c9ed2c7f"/>
<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 x="554" y="0" width="122" height="25" uuid="a9d471fb-1e1d-4d9a-9783-bbf988931192"/>
<textElement textAlignment="Right">
<font size="9" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$R{cabecalho.dataHora}]]></textFieldExpression>
</textField>
<textField pattern="dd/MM/yyyy HH:mm" isBlankWhenNull="false">
<reportElement mode="Transparent" x="676" y="0" width="89" height="25" forecolor="#000000" backcolor="#FFFFFF" uuid="0d200750-aabf-4c7e-b27b-c0e7af4802a9"/>
<textElement textAlignment="Right" 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[new java.util.Date()]]></textFieldExpression>
</textField>
<line>
<reportElement x="0" y="54" width="802" height="5" uuid="bbf33a72-515f-42fc-8c79-e859aebca31d"/>
</line>
<textField pattern="" isBlankWhenNull="false">
<reportElement mode="Transparent" x="645" y="27" width="105" height="15" forecolor="#000000" backcolor="#FFFFFF" uuid="bae9bec6-8c42-4bee-a070-34b0a7f1aee4"/>
<textElement textAlignment="Right" 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.pagina}+" "+$V{PAGE_NUMBER}+" "+$R{cabecalho.de}]]></textFieldExpression>
</textField>
<textField evaluationTime="Report" pattern="" isBlankWhenNull="false">
<reportElement mode="Transparent" x="750" y="27" width="15" height="15" forecolor="#000000" backcolor="#FFFFFF" uuid="314e312c-8f24-42de-8354-3c1f7241a985"/>
<textElement textAlignment="Center" 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[$V{PAGE_NUMBER}]]></textFieldExpression>
</textField>
<textField pattern="" isBlankWhenNull="false">
<reportElement mode="Transparent" x="544" y="42" width="221" height="12" forecolor="#000000" backcolor="#FFFFFF" uuid="4e030613-9cee-443e-9eaa-b19fa3090976"/>
<textElement textAlignment="Right" verticalAlignment="Top" rotation="None" markup="none">
<font fontName="SansSerif" size="7" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
<paragraph lineSpacing="Single"/>
</textElement>
<textFieldExpression><![CDATA[$R{cabecalho.impressorPor}+" "+$P{USUARIO}]]></textFieldExpression>
</textField>
<line>
<reportElement x="0" y="77" width="802" height="5" uuid="6ca45088-a58d-43b3-b196-8fc26e128fbf"/>
</line>
<textField>
<reportElement x="0" y="59" width="802" height="14" uuid="b29d0494-2695-420b-bdc1-b13c08bdbcda"/>
<textElement verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$P{FILTROS}]]></textFieldExpression>
</textField>
</band>
</pageHeader>
<columnHeader>
<band height="61" splitType="Stretch">
<staticText>
<reportElement x="0" y="33" width="62" height="28" uuid="5f9a0ea4-15d3-4bad-953a-0dc6f3f6ef51"/>
<textElement textAlignment="Center"/>
<text><![CDATA[Data]]></text>
</staticText>
<staticText>
<reportElement x="62" y="33" width="49" height="28" uuid="fa0a31b5-6a94-4b0c-b730-4b6ef8f2304c"/>
<text><![CDATA[Serviço]]></text>
</staticText>
<staticText>
<reportElement x="111" y="33" width="58" height="28" uuid="a797bc17-1810-47b7-a3e1-510cc6403454"/>
<text><![CDATA[Empresa]]></text>
</staticText>
<staticText>
<reportElement x="169" y="33" width="47" height="28" uuid="765ebd99-b6de-4c8e-910d-b3e5bf9db573"/>
<text><![CDATA[Origem]]></text>
</staticText>
<staticText>
<reportElement x="216" y="33" width="52" height="28" uuid="2f3b9ac0-165c-4718-96c8-a37f005b5b82"/>
<text><![CDATA[Destino]]></text>
</staticText>
<staticText>
<reportElement x="268" y="33" width="56" height="28" uuid="9eb87b55-da02-478a-b21d-c7b727dbaafe"/>
<text><![CDATA[Classe]]></text>
</staticText>
<staticText>
<reportElement x="324" y="33" width="37" height="28" uuid="fe1e6ace-6d95-4089-8f28-d926554bf65d"/>
<text><![CDATA[Tarifa]]></text>
</staticText>
<staticText>
<reportElement x="361" y="33" width="37" height="28" uuid="52d26417-4766-44b3-aaa7-b468c124feda"/>
<text><![CDATA[TUT]]></text>
</staticText>
<staticText>
<reportElement x="398" y="33" width="46" height="28" uuid="3f6afcbf-9dfe-4f1b-b937-45dbc9ace8a2"/>
<text><![CDATA[Pedágio]]></text>
</staticText>
<staticText>
<reportElement x="444" y="33" width="37" height="28" uuid="182474d6-668a-4847-9db6-ba65c41119aa"/>
<text><![CDATA[Total]]></text>
</staticText>
<staticText>
<reportElement x="481" y="33" width="46" height="28" uuid="a7b14fa8-3b89-4f4d-b265-63eb3d930b04"/>
<text><![CDATA[Tipo]]></text>
</staticText>
<staticText>
<reportElement x="527" y="33" width="48" height="28" uuid="10f27b7d-5cc9-423c-a196-330c78cdb69e"/>
<text><![CDATA[Agência]]></text>
</staticText>
<staticText>
<reportElement x="575" y="33" width="86" height="28" uuid="f2097833-6bd3-4523-b457-44ed6cc4abd6"/>
<text><![CDATA[DataHoraCompra ]]></text>
</staticText>
<staticText>
<reportElement x="661" y="33" width="53" height="28" uuid="44b2bf55-871a-4eaa-97d4-74bee2a89769"/>
<text><![CDATA[Passageiro]]></text>
</staticText>
<staticText>
<reportElement x="714" y="33" width="51" height="28" uuid="2abbc372-a813-4da6-8ce1-e5901a15b430"/>
<text><![CDATA[Nr bilhete ]]></text>
</staticText>
<staticText>
<reportElement x="765" y="33" width="37" height="28" uuid="2bd47a58-e591-4b32-bdd4-fa43ece0c581"/>
<text><![CDATA[Status]]></text>
</staticText>
<line>
<reportElement x="0" y="56" width="802" height="5" uuid="a11636cc-5ee1-44cc-8cd1-cbe2ebc47abb"/>
</line>
</band>
</columnHeader>
<detail>
<band height="23" splitType="Stretch">
<textField>
<reportElement x="62" y="0" width="49" height="20" uuid="b15ada19-a1c0-4feb-9734-3a6c624bbfe6"/>
<textFieldExpression><![CDATA[$F{servico}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="62" y="0" width="49" height="20" uuid="c6117592-2455-494b-bfde-de6a35504d7e"/>
<textFieldExpression><![CDATA[$F{servico}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="111" y="0" width="58" height="20" uuid="c35afacb-b160-4ace-b7be-c2e2f54ac1c0"/>
<textFieldExpression><![CDATA[$F{empresa}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="169" y="0" width="47" height="20" uuid="fd8ae360-3ae2-4adc-8c3a-fcfb19551d22"/>
<textFieldExpression><![CDATA[$F{origem}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="216" y="0" width="52" height="20" uuid="29ae3fa8-9db1-46c8-bcf7-cb9aa7bc6eb3"/>
<textFieldExpression><![CDATA[$F{destino}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="268" y="0" width="56" height="20" uuid="7265d085-4188-44a0-8e04-e5efdb0d5ccf"/>
<textFieldExpression><![CDATA[$F{classe}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="324" y="0" width="37" height="20" uuid="6430daa4-d318-4f4a-87ff-2ea4de9d492e"/>
<textFieldExpression><![CDATA[$F{tarifa}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="361" y="0" width="37" height="20" uuid="49faea3b-2ce4-469a-b07c-3b4869aaa9e5"/>
<textFieldExpression><![CDATA[$F{tut}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="398" y="0" width="46" height="20" uuid="16461919-04ea-48df-af5c-7f0d7dcb7fab"/>
<textFieldExpression><![CDATA[$F{pedagio}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="444" y="0" width="37" height="20" uuid="97be07ba-bdb1-4bf2-91af-554b580ee3fa"/>
<textFieldExpression><![CDATA[$F{total}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="481" y="0" width="46" height="20" uuid="8cf0c102-4e42-4f6d-8922-8edc808fdc0f"/>
<textFieldExpression><![CDATA[$F{tipo}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="527" y="0" width="48" height="20" uuid="0ecedfc0-febb-40e0-b5ca-168b5a296646"/>
<textFieldExpression><![CDATA[$F{agencia}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="575" y="0" width="86" height="20" uuid="8229beec-daa6-4357-a4c9-f475d7a873aa"/>
<textFieldExpression><![CDATA[$F{dataHoraCompra}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="661" y="0" width="53" height="20" uuid="8e67c346-5c72-4a92-beee-9dd9ad647bb1"/>
<textFieldExpression><![CDATA[$F{passageiro}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="712" y="0" width="53" height="20" uuid="9a639996-146c-42c9-a8fd-f947a59310f4"/>
<textFieldExpression><![CDATA[$F{nrBilhete}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="0" y="0" width="62" height="20" uuid="bfb9d635-bbc1-4e92-890a-df8299bc8daa"/>
<textFieldExpression><![CDATA[$F{data}]]></textFieldExpression>
</textField>
</band>
</detail>
<pageFooter>
<band height="54" splitType="Stretch"/>
</pageFooter>
<summary>
<band height="42" splitType="Stretch"/>
</summary>
</jasperReport>

View File

@ -0,0 +1,335 @@
package com.rjconsultores.ventaboletos.web.gui.controladores.relatorios;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.sql.DataSource;
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.ComboitemRenderer;
import org.zkoss.zul.Datebox;
import com.rjconsultores.ventaboletos.entidad.ClaseServicio;
import com.rjconsultores.ventaboletos.entidad.Empresa;
import com.rjconsultores.ventaboletos.entidad.GrupoRuta;
import com.rjconsultores.ventaboletos.entidad.Parada;
import com.rjconsultores.ventaboletos.entidad.Ruta;
import com.rjconsultores.ventaboletos.relatorios.impl.RelatorioOCDNaoResgatadaEmpresa;
import com.rjconsultores.ventaboletos.relatorios.impl.RelatorioReceitaServico;
import com.rjconsultores.ventaboletos.relatorios.impl.RelatorioResumoLinhas;
import com.rjconsultores.ventaboletos.relatorios.impl.RelatorioResumoLinhasAnalitico;
import com.rjconsultores.ventaboletos.relatorios.impl.RelatorioTaxasLinha;
import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio;
import com.rjconsultores.ventaboletos.service.ClaseServicioService;
import com.rjconsultores.ventaboletos.service.EmpresaService;
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEstandar;
import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxParada;
import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxParadaCve;
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
@Controller("relatorioReceitaServicoController")
@Scope("prototype")
public class RelatorioReceitaServicoController extends MyGenericForwardComposer {
private static final long serialVersionUID = 1L;
private Datebox datInicial;
private Datebox datFinal;
private MyComboboxParada cmbParadaOrigem;
private MyComboboxParadaCve cmbParadaOrigemCve;
private MyComboboxParada cmbParadaDestino;
private MyComboboxParadaCve cmbParadaDestinoCve;
private List<Empresa> lsEmpresa;
private List<ClaseServicio> lsClase;
private MyComboboxEstandar cmbEmpresa;
private MyComboboxEstandar cmbClase;
@Autowired
private EmpresaService empresaService;
@Autowired
private ClaseServicioService claseService;
@Autowired
private DataSource dataSourceRead;
@Override
public void doAfterCompose(Component comp) throws Exception {
lsEmpresa = empresaService.obtenerTodos();
lsClase = claseService.obtenerTodos();
super.doAfterCompose(comp);
cmbParadaOrigemCve.setItemRenderer(new ComboitemRenderer() {
@Override
public void render(Comboitem cmbtm, Object o) throws Exception {
Parada parada = (Parada) o;
cmbtm.setLabel(parada.getCveparada());
cmbtm.setValue(parada);
}
});
cmbParadaDestinoCve.setItemRenderer(new ComboitemRenderer() {
@Override
public void render(Comboitem cmbtm, Object o) throws Exception {
Parada parada = (Parada) o;
cmbtm.setLabel(parada.getCveparada());
cmbtm.setValue(parada);
}
});
}
public void onSelect$cmbParadaOrigemCve(Event ev) {
if (cmbParadaOrigemCve.getSelectedItem() != null) {
cmbParadaOrigem.setComboItemByParada((Parada) cmbParadaOrigemCve.getSelectedItem().getValue());
}
}
public void onSelect$cmbParadaOrigem(Event ev) {
if (cmbParadaOrigem.getSelectedItem() != null)
cmbParadaOrigemCve.setComboItemByParada((Parada) cmbParadaOrigem.getSelectedItem().getValue());
}
public void onSelect$cmbParadaDestinoCve(Event ev) {
if (cmbParadaDestinoCve.getSelectedItem() != null) {
cmbParadaDestino.setComboItemByParada((Parada) cmbParadaDestinoCve.getSelectedItem().getValue());
}
}
public void onSelect$cmbParadaDestino(Event ev) {
if (cmbParadaDestino.getSelectedItem() != null) {
cmbParadaDestinoCve.setComboItemByParada((Parada) cmbParadaDestino.getSelectedItem().getValue());
}
}
/**
* @throws Exception
*
*/
@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("relatorioReceitaServicoController.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());
Comboitem cbiOrigem = cmbParadaOrigem.getSelectedItem();
if (cbiOrigem != null) {
Parada origem = (Parada) cbiOrigem.getValue();
parametros.put("ORIGEN_ID", origem.getParadaId());
filtro.append("Origem: "+origem.getCveparada()+"; ");
//filtro.append(origem.getCveparada() + ";");
} else {
parametros.put("ORIGEN_ID", null);//
filtro.append("Origem: Todos; ");
}
Comboitem cbiDestino = cmbParadaDestino.getSelectedItem();
if (cbiDestino != null) {
Parada destino = (Parada) cbiDestino.getValue();
parametros.put("DESTINO_ID", destino.getParadaId());
filtro.append("Destino: "+destino.getCveparada()+"; ");
//filtro.append(destino.getCveparada() + ";");
} else {
parametros.put("DESTINO_ID", null);
filtro.append("Destino: Todos; ");
}
Comboitem itemEmpresa = cmbEmpresa.getSelectedItem();
if (itemEmpresa != null) {
Empresa empresa = (Empresa) itemEmpresa.getValue();
parametros.put("EMPRESA_ID", empresa.getEmpresaId());
filtro.append("Empresa: "+empresa.getNombempresa()+"; ");
//filtro.append(empresa.getNombempresa() + ";");
} else {
parametros.put("EMPRESA_ID", "");
}
Comboitem itemClasse = cmbClase.getSelectedItem();
if (itemClasse != null) {
ClaseServicio clase = (ClaseServicio) itemClasse.getValue();
parametros.put("CLASESERVICIO_ID", clase.getClaseservicioId());
filtro.append("Classe: "+clase.getDescclase()+"; ");
//filtro.append(empresa.getNombempresa() + ";");
} else {
parametros.put("CLASESERVICIO_ID", "");
}
parametros.put("FILTROS", filtro.toString());
parametros.put("NOME_RELATORIO", Labels.getLabel("relatorioReceitaServicoController.window.title"));
parametros.put("USUARIO", UsuarioLogado.getUsuarioLogado().getUsuarioId().toString());
relatorio = new RelatorioReceitaServico(parametros, dataSourceRead.getConnection());
if(relatorio.getCustomDataSource().next())
{
Map args = new HashMap();
args.put("relatorio", relatorio);
openWindow("/component/reportView.zul",
Labels.getLabel("relatorioReceitaServicoController.window.title"), args, MODAL);
}else
{
try {
Messagebox.show(Labels.getLabel("MSG.ningunRegistro"),
Labels.getLabel("relatorioReceitaServicoController.window.title"),
Messagebox.OK, Messagebox.INFORMATION);
} catch (InterruptedException ex) {
ex.printStackTrace();
}
}
}
}
public void onClick$btnExecutarRelatorio(Event ev) throws Exception {
executarRelatorio();
}
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;
}
public void setLsEmpresa(List<Empresa> lsEmpresa) {
this.lsEmpresa = lsEmpresa;
}
public EmpresaService getEmpresaService() {
return empresaService;
}
public void setEmpresaService(EmpresaService empresaService) {
this.empresaService = empresaService;
}
public List<ClaseServicio> getLsClase() {
return lsClase;
}
public void setLsClase(List<ClaseServicio> lsClase) {
this.lsClase = lsClase;
}
public MyComboboxEstandar getCmbEmpresa() {
return cmbEmpresa;
}
public void setCmbEmpresa(MyComboboxEstandar cmbEmpresa) {
this.cmbEmpresa = cmbEmpresa;
}
public ClaseServicioService getClaseService() {
return claseService;
}
public void setClaseService(ClaseServicioService claseService) {
this.claseService = claseService;
}
public MyComboboxEstandar getCmbClase() {
return cmbClase;
}
public void setCmbClase(MyComboboxEstandar cmbClase) {
this.cmbClase = cmbClase;
}
public MyComboboxParada getCmbParadaOrigem() {
return cmbParadaOrigem;
}
public void setCmbParadaOrigem(MyComboboxParada cmbParadaOrigem) {
this.cmbParadaOrigem = cmbParadaOrigem;
}
public MyComboboxParadaCve getCmbParadaOrigemCve() {
return cmbParadaOrigemCve;
}
public void setCmbParadaOrigemCve(MyComboboxParadaCve cmbParadaOrigemCve) {
this.cmbParadaOrigemCve = cmbParadaOrigemCve;
}
public MyComboboxParada getCmbParadaDestino() {
return cmbParadaDestino;
}
public void setCmbParadaDestino(MyComboboxParada cmbParadaDestino) {
this.cmbParadaDestino = cmbParadaDestino;
}
public MyComboboxParadaCve getCmbParadaDestinoCve() {
return cmbParadaDestinoCve;
}
public void setCmbParadaDestinoCve(MyComboboxParadaCve cmbParadaDestinoCve) {
this.cmbParadaDestinoCve = cmbParadaDestinoCve;
}
}