lucas.calixto 2017-04-28 19:25:02 +00:00
parent 4e90926704
commit 94659ca43c
6 changed files with 99 additions and 23 deletions

View File

@ -16,6 +16,9 @@ import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource;
public class RelatorioGratuidade extends Relatorio {
private Integer orgaoConcedenteId;
private String orgaoConcedenteDesc;
private List<RelatorioGratuidadeBean> lsDadosRelatorio;
public RelatorioGratuidade(Map<String, Object> parametros, Connection conexao) throws Exception {
@ -37,6 +40,8 @@ public class RelatorioGratuidade extends Relatorio {
String origem = parametros.get("origem") != null ? parametros.get("origem").toString() : "";
String destino = parametros.get("destino") != null ? parametros.get("destino").toString() : "";
String categoria = parametros.get("categoria") != null ? parametros.get("categoria").toString() : "";
orgaoConcedenteId = parametros.get("orgao_concedente_id") != null ? (Integer) parametros.get("orgao_concedente_id") : null;
orgaoConcedenteDesc = parametros.get("orgao_concedente_desc") != null ? parametros.get("orgao_concedente_desc").toString() : null;
String sql = getSql(empresa, agencia, ruta, fecInicio, fecFinal, origem, destino, categoria);
@ -64,6 +69,9 @@ public class RelatorioGratuidade extends Relatorio {
if(categoria != null && !categoria.equals("")){
stmt.setInt("categoria_id", Integer.parseInt(categoria));
}
if(orgaoConcedenteId != null){
stmt.setInt("orgao_concedente_id", orgaoConcedenteId);
}
ResultSet rset = null;
@ -90,6 +98,10 @@ public class RelatorioGratuidade extends Relatorio {
gratuidadeBean.setPreciopagado(rset.getBigDecimal("preciopagado"));
gratuidadeBean.setNombempresa(rset.getString("nombempresa"));
gratuidadeBean.setCvecategoria(rset.getString("cvecategoria"));
gratuidadeBean.setNumasiento(rset.getString("numasiento"));
gratuidadeBean.setDescorigen(rset.getString("descorigen"));
gratuidadeBean.setDescdestino(rset.getString("descdestino"));
gratuidadeBean.setNumfoliosistema(rset.getString("numfoliosistema"));
lsDadosRelatorio.add(gratuidadeBean);
}
@ -111,8 +123,8 @@ public class RelatorioGratuidade extends Relatorio {
private String getSql(String empresa, String agencia, String ruta, String fecInicio, String fecFinal, String origem, String destino, String categoria) {
StringBuffer sql = new StringBuffer();
sql.append("SELECT b.feccorrida, ori.cveparada origen, des.cveparada destino, ");
sql.append("b.numkmviaje, r.descruta, b.corrida_id, b.fechorviaje, ");
sql.append("SELECT b.feccorrida, ori.cveparada origen, des.cveparada destino, ori.descparada descorigen, des.descparada descdestino, ");
sql.append("b.numkmviaje, r.descruta, b.corrida_id, b.fechorviaje, b.numasiento, b.numfoliosistema, ");
sql.append("tv.desctipoventa, b.nombpasajero, b.descnumdoc, tar.preciooriginal, ");
sql.append("b.porccategoria, b.preciopagado, u.cveusuario, ag.nombpuntoventa, e.nombempresa, cat.cvecategoria ");
sql.append("FROM boleto b ");
@ -153,6 +165,9 @@ public class RelatorioGratuidade extends Relatorio {
if(!categoria.isEmpty()){
sql.append(" AND c.categoria_id = :categoria_id ");
}
if(orgaoConcedenteId != null){
sql.append(" AND r.orgaoconcedente_id = :orgao_concedente_id ");
}
return sql.toString();
}

View File

@ -35,3 +35,6 @@ detail.total=Total Quantidade:
linhas=Líneas
detail.numfoliosistema=N.Bil
detail.numasiento=Pol

View File

@ -35,4 +35,5 @@ detail.total=Total Quantidade:
linhas=Linhas
detail.numfoliosistema=N.Bil
detail.numasiento=Pol

View File

@ -2,7 +2,7 @@
<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="RelatorioEmpresaCorrida" pageWidth="842" pageHeight="595" orientation="Landscape" whenNoDataType="NoDataSection" columnWidth="822" leftMargin="10" rightMargin="10" topMargin="20" bottomMargin="20" resourceBundle="RelatorioEmpresaCorrida" whenResourceMissingType="Empty" uuid="94834362-0ecc-46da-b0a2-5cdee355da3e">
<property name="ireport.zoom" value="2.196150000000002"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<property name="ireport.y" value="192"/>
<parameter name="fecInicio" class="java.lang.String">
<defaultValueExpression><![CDATA[]]></defaultValueExpression>
</parameter>
@ -32,6 +32,11 @@
<field name="nombpuntoventa" class="java.lang.String"/>
<field name="nombempresa" class="java.lang.String"/>
<field name="cvecategoria" class="java.lang.String"/>
<field name="numasiento" class="java.lang.String"/>
<field name="descorigen" class="java.lang.String"/>
<field name="descdestino" class="java.lang.String"/>
<field name="numfoliosistema" class="java.lang.String"/>
<field name="orgaoConcedente" class="java.lang.String"/>
<variable name="qtde" class="java.lang.Integer" calculation="Count">
<variableExpression><![CDATA[$F{km}]]></variableExpression>
</variable>
@ -88,34 +93,34 @@
<textFieldExpression><![CDATA[$R{detail.hora}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="cc834009-ae90-46d4-8bbb-37578b69f621" x="364" y="40" width="44" height="27"/>
<reportElement uuid="cc834009-ae90-46d4-8bbb-37578b69f621" x="420" y="40" width="44" height="27"/>
<textElement>
<font size="9"/>
</textElement>
<textFieldExpression><![CDATA[$R{detail.tipobilhete}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="842c2e2b-0a9e-4a28-9010-9b0c814c5bcb" x="452" y="51" width="66" height="16"/>
<reportElement uuid="842c2e2b-0a9e-4a28-9010-9b0c814c5bcb" x="508" y="51" width="66" height="16"/>
<textElement/>
<textFieldExpression><![CDATA[$R{detail.pasajero}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="94fe9e9b-e231-43b8-aeb8-7bc3eb2d61af" x="518" y="51" width="44" height="16"/>
<reportElement uuid="94fe9e9b-e231-43b8-aeb8-7bc3eb2d61af" x="574" y="51" width="44" height="16"/>
<textElement/>
<textFieldExpression><![CDATA[$R{detail.documento}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="952c3d60-ade1-4f57-8801-3ef6bc7f2333" x="562" y="51" width="41" height="16"/>
<reportElement uuid="952c3d60-ade1-4f57-8801-3ef6bc7f2333" x="618" y="51" width="28" height="16"/>
<textElement/>
<textFieldExpression><![CDATA[$R{detail.precio}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="e14732be-42a0-4f54-9eb2-52f10ece154b" x="603" y="51" width="46" height="16"/>
<textElement/>
<reportElement uuid="e14732be-42a0-4f54-9eb2-52f10ece154b" x="646" y="51" width="30" height="16"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$R{detail.desconto}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="b34ce751-6969-47b0-aeb7-fff00a5de1e3" x="649" y="51" width="51" height="16"/>
<reportElement uuid="b34ce751-6969-47b0-aeb7-fff00a5de1e3" x="676" y="51" width="24" height="16"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$R{detail.tarifadesconto}]]></textFieldExpression>
</textField>
@ -133,17 +138,27 @@
<reportElement uuid="8e2d6686-e4d7-43d5-b3a9-46adc3e58350" x="1" y="67" width="821" height="1"/>
</line>
<textField>
<reportElement uuid="8fb67bb3-6ff2-40d1-b338-714f199ea7f0" x="1" y="10" width="120" height="20"/>
<reportElement uuid="8fb67bb3-6ff2-40d1-b338-714f199ea7f0" x="1" y="10" width="120" height="16"/>
<textElement/>
<textFieldExpression><![CDATA[$R{header.empresa}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="6b1fac8d-c098-4893-b1dd-7b64573f0173" x="408" y="40" width="44" height="27"/>
<reportElement uuid="6b1fac8d-c098-4893-b1dd-7b64573f0173" x="464" y="40" width="44" height="27"/>
<textElement>
<font size="9"/>
</textElement>
<textFieldExpression><![CDATA[$R{detail.tipopassagem}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="0948a2fc-fc39-4f2d-ab06-d7c97a66df39" x="364" y="51" width="26" height="16"/>
<textElement/>
<textFieldExpression><![CDATA[$R{detail.numasiento}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="c4b5d11d-79a1-4850-8294-8ccaa0898bca" x="390" y="51" width="30" height="16"/>
<textElement/>
<textFieldExpression><![CDATA[$R{detail.numfoliosistema}]]></textFieldExpression>
</textField>
</band>
</groupHeader>
</group>
@ -235,35 +250,35 @@
<textFieldExpression><![CDATA[$F{feccorrida}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement uuid="6cc780bc-645e-4f03-a7d0-b4ecf7d4eb6c" stretchType="RelativeToBandHeight" x="364" y="0" width="44" height="16"/>
<reportElement uuid="6cc780bc-645e-4f03-a7d0-b4ecf7d4eb6c" stretchType="RelativeToBandHeight" x="420" y="0" width="44" height="16"/>
<textElement textAlignment="Center">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{desctipoventa}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement uuid="9c9861ac-780e-4e8b-aab8-9a4f506ce62b" stretchType="RelativeToBandHeight" x="452" y="0" width="66" height="16"/>
<reportElement uuid="9c9861ac-780e-4e8b-aab8-9a4f506ce62b" stretchType="RelativeToBandHeight" x="508" y="0" width="66" height="16"/>
<textElement textAlignment="Left">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{nombpasajero}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement uuid="37fa056d-c401-4268-a455-c5caf5e4eb54" stretchType="RelativeToBandHeight" x="518" y="0" width="44" height="16"/>
<reportElement uuid="37fa056d-c401-4268-a455-c5caf5e4eb54" stretchType="RelativeToBandHeight" x="574" y="0" width="44" height="16"/>
<textElement textAlignment="Left">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{descnumdoc}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" pattern="###0.00;-###0.00" isBlankWhenNull="true">
<reportElement uuid="d7019a40-a617-43c7-9ad2-b7c47fb38d60" stretchType="RelativeToBandHeight" x="603" y="0" width="46" height="16"/>
<reportElement uuid="d7019a40-a617-43c7-9ad2-b7c47fb38d60" stretchType="RelativeToBandHeight" x="646" y="0" width="30" height="16"/>
<textElement textAlignment="Right">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{porccategoria}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" pattern="###0.00;-###0.00" isBlankWhenNull="true">
<reportElement uuid="f0161d55-b853-4318-8028-8aec04c0487d" stretchType="RelativeToBandHeight" x="649" y="0" width="51" height="16"/>
<reportElement uuid="f0161d55-b853-4318-8028-8aec04c0487d" stretchType="RelativeToBandHeight" x="676" y="0" width="24" height="16"/>
<textElement textAlignment="Right">
<font size="8"/>
</textElement>
@ -288,29 +303,43 @@
<textElement textAlignment="Left">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{destino}]]></textFieldExpression>
<textFieldExpression><![CDATA[$F{descdestino}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" pattern="dd/MM/yyyy" isBlankWhenNull="true">
<reportElement uuid="b36dbddb-2fa9-48a5-809e-0e15ad54c529" stretchType="RelativeToBandHeight" x="49" y="0" width="50" height="16"/>
<textElement textAlignment="Left">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{origen}]]></textFieldExpression>
<textFieldExpression><![CDATA[$F{descorigen}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" pattern="###0.00;-###0.00" isBlankWhenNull="true">
<reportElement uuid="695d5bfa-16e3-4163-82a0-36d2a2ba21ed" stretchType="RelativeToBandHeight" x="562" y="0" width="41" height="16"/>
<reportElement uuid="695d5bfa-16e3-4163-82a0-36d2a2ba21ed" stretchType="RelativeToBandHeight" x="618" y="0" width="28" height="16"/>
<textElement textAlignment="Right">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{preciooriginal}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement uuid="f7539e74-4ab5-45e3-b3ca-b66967acc3e2" stretchType="RelativeToBandHeight" x="408" y="0" width="44" height="16"/>
<reportElement uuid="f7539e74-4ab5-45e3-b3ca-b66967acc3e2" stretchType="RelativeToBandHeight" x="464" y="0" width="44" height="16"/>
<textElement textAlignment="Center">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{cvecategoria}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" pattern="###0.00;-###0.00" isBlankWhenNull="true">
<reportElement uuid="8b89e606-e89c-4b3d-a5b5-4dfd339de5df" stretchType="RelativeToBandHeight" x="364" y="0" width="26" height="16"/>
<textElement>
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{numasiento}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" pattern="###0.00;-###0.00" isBlankWhenNull="true">
<reportElement uuid="4177f54f-ba97-4731-8c32-c8fc23ce483a" stretchType="RelativeToBandHeight" x="390" y="0" width="30" height="16"/>
<textElement>
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{numfoliosistema}]]></textFieldExpression>
</textField>
</band>
</detail>
<summary>

View File

@ -6,7 +6,9 @@ import java.util.Date;
public class RelatorioGratuidadeBean {
private Date feccorrida;
private String origen;
private String descorigen;
private String destino;
private String descdestino;
private Integer km;
private String linha;
private String corridaId;
@ -21,6 +23,8 @@ public class RelatorioGratuidadeBean {
private String nombpuntoventa;
private String nombempresa;
private String cvecategoria;
private String numasiento;
private String numfoliosistema;
public Date getFeccorrida() {
return feccorrida;
@ -124,5 +128,29 @@ public class RelatorioGratuidadeBean {
public void setCvecategoria(String cvecategoria) {
this.cvecategoria = cvecategoria;
}
public String getNumasiento() {
return numasiento;
}
public void setNumasiento(String numasiento) {
this.numasiento = numasiento;
}
public String getDescorigen() {
return descorigen;
}
public void setDescorigen(String descorigen) {
this.descorigen = descorigen;
}
public String getDescdestino() {
return descdestino;
}
public void setDescdestino(String descdestino) {
this.descdestino = descdestino;
}
public String getNumfoliosistema() {
return numfoliosistema;
}
public void setNumfoliosistema(String numfoliosistema) {
this.numfoliosistema = numfoliosistema;
}
}