0010833: Cancelamento pede dados do Cliente - debito

fixes bug#0010833
dev:fabio
qua:wallysson

git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@81613 d1611594-4594-4d17-8e1d-87c2c4800839
master
daniel.zauli 2018-05-04 19:22:56 +00:00
parent e31a824a81
commit 46f05b0dbf
8 changed files with 663 additions and 5 deletions

View File

@ -0,0 +1,107 @@
/**
*
*/
package com.rjconsultores.ventaboletos.relatorios.impl;
import java.sql.Connection;
import java.sql.ResultSet;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource;
import com.rjconsultores.ventaboletos.relatorios.utilitarios.ArrayDataSource;
import com.rjconsultores.ventaboletos.relatorios.utilitarios.RelatorioFormaPagamentoAgenciaRutaTramoBean;
import com.rjconsultores.ventaboletos.web.utilerias.NamedParameterStatement;
public class RelatorioFormaPagamentoAgenciaRutaTramo extends RelatorioDemandas {
private List<RelatorioFormaPagamentoAgenciaRutaTramoBean> lsDadosRelatorio;
public RelatorioFormaPagamentoAgenciaRutaTramo(Map<String, Object> parametros, Connection conexao) throws Exception {
super(parametros, conexao);
this.setCustomDataSource(new ArrayDataSource(this) {
@Override
public void initDados() throws Exception {
SimpleDateFormat format = new SimpleDateFormat("dd/MM/yyyy");
Connection conexao = this.relatorio.getConexao();
Map<String, Object> parametros = this.relatorio.getParametros();
String dataIncial = (String) parametros.get("DATA_INICIAL");
String dataFinal = (String) parametros.get("DATA_FINAL");
Integer empresa = (Integer) parametros.get("EMPRESA");
String rutaId = (String) parametros.get("RUTAS_IDS");
Integer agencia = (Integer) parametros.get("AGENCIA");
StringBuilder sql = new StringBuilder();
sql.append(" select rc.RUTACOMBINACION_ID as rc_RUTACOMBINACION_ID, rc.ruta_id as rc_ruta_id, r.descruta as r_descruta, rc.tramo_id as rc_tramo_id , ");
sql.append(" t.desctramo as t_desctramo, t.origen_id as t_origen_id, t.destino_id as t_destino_id , ");// b.caja_id as b_caja_id , ");
sql.append(" fp.DESCPAGO as fp_DESCPAGO, sum(cfp.importe) as cfp_importe, sum(b.IMPORTEPEDAGIO) as b_IMPORTEPEDAGIO, ");
sql.append(" sum(b.IMPORTESEGURO) as b_IMPORTESEGURO, sum(b.IMPORTETAXAEMBARQUE) as b_IMPORTETAXAEMBARQUE ,TO_DATE(TO_CHAR(b.fechorventa,'DD-MON-YYYY'),'DD-MON-YYYY' ) as b_fechorventa, pv.NOMBPUNTOVENTA as pv_NOMBPUNTOVENTA, count(b.caja_id) AS QTD ");
sql.append(" from ruta_combinacion RC ");
sql.append(" inner join tramo t on t.tramo_id = rc.tramo_id ");
sql.append(" inner join ruta r on r.ruta_id = rc.ruta_id ");
sql.append(" left join caja b on (b.ORIGEN_ID = t.ORIGEN_ID and b.DESTINO_ID = t.DESTINO_ID and b.RUTA_ID = rc.ruta_id ");
sql.append(" and b.fechorventa BETWEEN to_date('" + dataIncial + " 00:00:00','dd/MM/yyyy hh24:mi:ss') AND to_date('" + dataFinal + " 23:59:59','dd/MM/yyyy hh24:mi:ss') AND b.RUTA_ID in ("+rutaId+") ");//AND b.CORRIDA_ID = 86300 ");
//sql.append(" and b.feccorrida BETWEEN to_date('" + format.format(dataIncial) + " 00:00:00','dd/MM/yyyy hh24:mi:ss') AND to_date('" + format.format(dataFinal) + " 00:00:00','dd/MM/yyyy hh24:mi:ss') AND b.RUTA_ID = "+rutaId+" ");//AND b.CORRIDA_ID = 86300 ");
sql.append(" ) ");
sql.append(" left join caja_formapago cfp on cfp.CAJA_ID = b.CAJA_ID ");
sql.append(" left join forma_pago fp on fp.FORMAPAGO_ID = cfp.FORMAPAGO_ID ");
sql.append(" left join punto_venta pv on pv.PUNTOVENTA_ID = b.puntoventa_id ");
sql.append(" WHERE RC.RUTA_ID in ("+rutaId+") and rc.activo = 1 and t.activo =1 AND B.EMPRESACORRIDA_ID = "+empresa+" ");
if( agencia != null){
sql.append("AND pv.PUNTOVENTA_ID = "+agencia+" ");
}
sql.append(" GROUP BY TO_DATE(TO_CHAR(B.fechorventa,'DD-MON-YYYY'),'DD-MON-YYYY' ),T.DESCTRAMO,FP.DESCPAGO, RC.RUTACOMBINACION_ID, r.descruta, RC.RUTA_ID, RC.TRAMO_ID, T.ORIGEN_ID, T.DESTINO_ID, PV.NOMBPUNTOVENTA ");
sql.append(" order by RC_ruta_ID , RC_tramo_ID , b_fechorventa ");
NamedParameterStatement stmt = new NamedParameterStatement(conexao, sql.toString());
ResultSet rset = stmt.executeQuery();
lsDadosRelatorio = new ArrayList<RelatorioFormaPagamentoAgenciaRutaTramoBean>();
RelatorioFormaPagamentoAgenciaRutaTramoBean r ;
SimpleDateFormat dt = new SimpleDateFormat("dd/MM/yy");
while (rset.next()) {
r= new RelatorioFormaPagamentoAgenciaRutaTramoBean();
r.setDescRuta("desc ruta");
r.setPeriodo("periodo");
r.setDescFormaPag(rset.getString("fp_DESCPAGO"));
r.setDescTramo(rset.getString("t_desctramo"));
r.setDescRuta(rset.getString("r_descruta"));
r.setData(dt.format(rset.getDate("b_fechorventa")));
r.setAgencia(rset.getString("pv_NOMBPUNTOVENTA"));
r.setTarifa(rset.getDouble("cfp_importe"));
r.setPedagio(rset.getDouble("b_IMPORTEPEDAGIO"));
r.setSeguro(rset.getDouble("b_IMPORTESEGURO"));
r.setTaxas(rset.getDouble("b_IMPORTETAXAEMBARQUE"));
r.setTotal(rset.getDouble("b_IMPORTETAXAEMBARQUE") +rset.getDouble("b_IMPORTESEGURO") + rset.getDouble("cfp_importe") + rset.getDouble("b_IMPORTEPEDAGIO"));
r.setQuantidade(rset.getInt("QTD"));
lsDadosRelatorio.add(r);
}
setLsDadosRelatorio(lsDadosRelatorio);
}
});
}
public List<RelatorioFormaPagamentoAgenciaRutaTramoBean> getLsDadosRelatorio() {
return lsDadosRelatorio;
}
public void setLsDadosRelatorio(List<RelatorioFormaPagamentoAgenciaRutaTramoBean> lsDadosRelatorio) {
this.setCollectionDataSource(new JRBeanCollectionDataSource(lsDadosRelatorio));
this.lsDadosRelatorio = lsDadosRelatorio;
}
}

View File

@ -0,0 +1 @@
msg.noData=Não foi possivel obter dados com os parâmetros informados.

View File

@ -0,0 +1,284 @@
<?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="RelatorioFormaPagamentoAgenciaRutaTramo" pageWidth="842" pageHeight="595" orientation="Landscape" columnWidth="802" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="e1b2cfdf-ea1f-4502-bac1-9cf4ce1916e7">
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<property name="net.sf.jasperreports.export.xls.exclude.origin.band.2" value="pageHeader"/>
<property name="net.sf.jasperreports.export.xls.exclude.origin.keep.first.band.2" value="title"/>
<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="DATA_INICIAL" class="java.lang.String" isForPrompting="false"/>
<parameter name="DATA_FINAL" class="java.lang.String" isForPrompting="false"/>
<field name="descFormaPag" class="java.lang.String"/>
<field name="descRuta" class="java.lang.String"/>
<field name="data" class="java.lang.String"/>
<field name="agencia" class="java.lang.String"/>
<field name="seguro" class="java.lang.Double"/>
<field name="pedagio" class="java.lang.Double"/>
<field name="taxas" class="java.lang.Double"/>
<field name="tarifa" class="java.lang.Double"/>
<field name="descTramo" class="java.lang.String"/>
<field name="quantidade" class="java.lang.Integer"/>
<field name="total" class="java.lang.Double"/>
<variable name="soma" class="java.lang.String"/>
<variable name="PEDAGIO" class="java.lang.Double" resetType="Group" resetGroup="tramoGroup" calculation="Sum">
<variableExpression><![CDATA[$F{pedagio}]]></variableExpression>
</variable>
<variable name="SEGURO" class="java.lang.Double" resetType="Group" resetGroup="tramoGroup" calculation="Sum">
<variableExpression><![CDATA[$F{seguro}]]></variableExpression>
</variable>
<variable name="TAXA" class="java.lang.Double" resetType="Group" resetGroup="tramoGroup" calculation="Sum">
<variableExpression><![CDATA[$F{taxas}]]></variableExpression>
</variable>
<variable name="TOTAL" class="java.lang.Double" resetType="Group" resetGroup="tramoGroup" calculation="Sum">
<variableExpression><![CDATA[$F{total}]]></variableExpression>
</variable>
<variable name="TARIFA" class="java.lang.Double" resetType="Group" resetGroup="tramoGroup" calculation="Sum">
<variableExpression><![CDATA[$F{tarifa}]]></variableExpression>
</variable>
<variable name="QTDE" class="java.lang.Integer" resetType="Group" resetGroup="tramoGroup" calculation="Sum">
<variableExpression><![CDATA[$F{quantidade}]]></variableExpression>
</variable>
<group name="rutaGroup">
<groupExpression><![CDATA[$F{descRuta}]]></groupExpression>
<groupHeader>
<band height="46">
<textField>
<reportElement uuid="e7ef7383-b8f7-4711-a161-3be25c1e5b3e" x="110" y="10" width="484" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{descRuta}]]></textFieldExpression>
</textField>
<staticText>
<reportElement uuid="e2248ab9-1416-4529-b4a5-937d2a5d13ce" x="0" y="10" width="85" height="20"/>
<textElement textAlignment="Right">
<font isBold="true"/>
</textElement>
<text><![CDATA[Linha:]]></text>
</staticText>
<line>
<reportElement uuid="392330f2-abd8-45dc-ba6e-2c62f795c5da" x="0" y="45" width="801" height="1"/>
</line>
</band>
</groupHeader>
</group>
<group name="tramoGroup">
<groupExpression><![CDATA[$F{descTramo}]]></groupExpression>
<groupHeader>
<band height="48">
<staticText>
<reportElement uuid="3421d610-67f9-4213-8362-0ab68419e8fb" x="740" y="26" width="49" height="20"/>
<textElement textAlignment="Right">
<font isBold="true"/>
</textElement>
<text><![CDATA[QTDE]]></text>
</staticText>
<staticText>
<reportElement uuid="e5b8830b-b391-46f6-a2a8-d5612f38f429" x="655" y="26" width="85" height="20"/>
<textElement textAlignment="Right">
<font isBold="true"/>
</textElement>
<text><![CDATA[TOTAL]]></text>
</staticText>
<staticText>
<reportElement uuid="5e90b545-5ccd-4c17-890a-aa9828d504ea" x="594" y="26" width="60" height="20"/>
<textElement textAlignment="Right">
<font isBold="true"/>
</textElement>
<text><![CDATA[TAXAS]]></text>
</staticText>
<staticText>
<reportElement uuid="1d2dea2d-69c0-42b6-8637-1fe26cb97bea" x="380" y="26" width="107" height="20"/>
<textElement textAlignment="Right">
<font isBold="true"/>
</textElement>
<text><![CDATA[PEDÁGIO]]></text>
</staticText>
<staticText>
<reportElement uuid="16204ddc-8276-45c7-b2b6-8909cc1741ae" x="66" y="26" width="108" height="20"/>
<textElement textAlignment="Right">
<font isBold="true"/>
</textElement>
<text><![CDATA[AGÊNCIA]]></text>
</staticText>
<staticText>
<reportElement uuid="f86347ff-3b9f-4a22-b5f2-99c6e6861d5b" x="487" y="26" width="107" height="20"/>
<textElement textAlignment="Right">
<font isBold="true"/>
</textElement>
<text><![CDATA[SEGURO]]></text>
</staticText>
<staticText>
<reportElement uuid="22fcdcd3-8805-4788-b90e-69bc0e082a54" x="0" y="26" width="66" height="20"/>
<textElement>
<font isBold="true"/>
</textElement>
<text><![CDATA[DATA]]></text>
</staticText>
<staticText>
<reportElement uuid="11488a18-aeb7-4388-837a-4f2c9a7dfe99" x="174" y="26" width="115" height="20"/>
<textElement textAlignment="Right">
<font isBold="true"/>
</textElement>
<text><![CDATA[FORMA DE PAG.]]></text>
</staticText>
<staticText>
<reportElement uuid="be84298d-9f0a-41bf-8b4b-b615e476a26e" x="289" y="26" width="91" height="20"/>
<textElement textAlignment="Right">
<font isBold="true"/>
</textElement>
<text><![CDATA[TARIFA]]></text>
</staticText>
<textField>
<reportElement uuid="3d7a1947-b8d3-4258-9e07-4e765656395a" x="110" y="6" width="100" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{descTramo}]]></textFieldExpression>
</textField>
<staticText>
<reportElement uuid="559e0316-1393-4897-91b2-c75a393e535b" x="0" y="6" width="85" height="20"/>
<textElement textAlignment="Right">
<font isBold="true"/>
</textElement>
<text><![CDATA[Trecho:]]></text>
</staticText>
<line>
<reportElement uuid="f79f5067-4c31-465b-bda5-25ca6037a699" x="0" y="45" width="802" height="1"/>
</line>
</band>
</groupHeader>
<groupFooter>
<band height="27">
<staticText>
<reportElement uuid="3cf1fe09-a07f-498f-9034-a10dcf6f5789" x="198" y="0" width="91" height="20"/>
<textElement textAlignment="Right">
<font isBold="true"/>
</textElement>
<text><![CDATA[Total]]></text>
</staticText>
<textField pattern="#,##0.00" isBlankWhenNull="true">
<reportElement uuid="9029ef1c-d195-41f5-aac5-0e2eef9d65be" x="594" y="0" width="60" height="20"/>
<textElement textAlignment="Right" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$V{TAXA}]]></textFieldExpression>
</textField>
<textField pattern="#,##0.00" isBlankWhenNull="true">
<reportElement uuid="2aa3e35d-32be-4d7b-a65c-c098df18c3a1" x="380" y="0" width="107" height="20"/>
<textElement textAlignment="Right" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$V{PEDAGIO}]]></textFieldExpression>
</textField>
<textField pattern="#,##0.00" isBlankWhenNull="true">
<reportElement uuid="a7759151-581b-4cef-94dc-7b81e0393e69" x="655" y="0" width="85" height="20"/>
<textElement textAlignment="Right" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$V{TOTAL}]]></textFieldExpression>
</textField>
<textField pattern="###0" isBlankWhenNull="true">
<reportElement uuid="bdd9f446-5880-4c04-9701-49ca090f2c9f" x="740" y="0" width="49" height="20"/>
<textElement textAlignment="Right" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$V{QTDE}]]></textFieldExpression>
</textField>
<textField pattern="#,##0.00" isBlankWhenNull="true">
<reportElement uuid="0882ba46-d6e5-4133-8be4-54405f376912" x="487" y="0" width="107" height="20"/>
<textElement textAlignment="Right" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$V{SEGURO}]]></textFieldExpression>
</textField>
<textField pattern="#,##0.00" isBlankWhenNull="true">
<reportElement uuid="a8d7aa6a-5e9f-4c21-8d70-19a4647797dd" x="289" y="0" width="91" height="20"/>
<textElement textAlignment="Right" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$V{TARIFA}]]></textFieldExpression>
</textField>
</band>
</groupFooter>
</group>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band height="79" splitType="Stretch">
<staticText>
<reportElement uuid="f1ec38fc-f846-43f2-b9a4-338eb5d19aa2" x="39" y="10" width="802" height="20"/>
<textElement textAlignment="Center">
<font size="14" isBold="true"/>
</textElement>
<text><![CDATA[Relatório de Forma de Pagamento por Linha]]></text>
</staticText>
<textField>
<reportElement uuid="d3de6210-3d3e-4ef1-a080-bcbf232792a7" x="10" y="48" width="247" height="20"/>
<textElement>
<font isBold="true"/>
</textElement>
<textFieldExpression><![CDATA["Período: " + $P{DATA_INICIAL} + " a " + $P{DATA_FINAL}]]></textFieldExpression>
</textField>
</band>
</title>
<pageHeader>
<band height="5" splitType="Stretch"/>
</pageHeader>
<detail>
<band height="24" splitType="Stretch">
<textField>
<reportElement uuid="4ec9cb1d-eecb-483d-9260-0ce1ab2cb9c4" x="174" y="0" width="115" height="20"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$F{descFormaPag}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="0a26c191-ba8b-4fea-ba9c-baf34336d235" x="380" y="0" width="107" height="20"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$F{pedagio}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="dc2d737e-fe81-4294-9f1e-1ef1cfadb373" x="289" y="0" width="91" height="20"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$F{tarifa}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="96bed67b-2854-4ab7-92a9-cc568182e5ee" x="487" y="0" width="107" height="20"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$F{seguro}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="5d6b0aa8-742f-4456-b4d1-338ebc7d78a2" x="594" y="0" width="60" height="20"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$F{taxas}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="9190f9f6-d27a-4da2-9889-f2e963cbfa91" x="0" y="0" width="66" height="20"/>
<textElement textAlignment="Left"/>
<textFieldExpression><![CDATA[$F{data}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="484e43ce-7b7d-436a-a744-3ab9cdd28cdc" x="66" y="0" width="108" height="20"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$F{agencia}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="5d066b77-e5a2-4061-a136-ff9692f0b990" x="740" y="1" width="49" height="20"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$F{quantidade}]]></textFieldExpression>
</textField>
<textField pattern="#,##0.00">
<reportElement uuid="c51218d2-6975-4fe0-9e47-1c100b07e9fe" x="654" y="1" width="86" height="20"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$F{total}]]></textFieldExpression>
</textField>
</band>
</detail>
<columnFooter>
<band height="26" splitType="Stretch"/>
</columnFooter>
<pageFooter>
<band height="28" splitType="Stretch"/>
</pageFooter>
<summary>
<band height="26" splitType="Stretch"/>
</summary>
</jasperReport>

View File

@ -0,0 +1,129 @@
package com.rjconsultores.ventaboletos.relatorios.utilitarios;
import java.util.ArrayList;
import java.util.List;
public class RelatorioFormaPagamentoAgenciaRutaTramoBean {
private String periodo;
private String descRuta;
private String data;
private String agencia;
private String descFormaPag;
private double tarifa;
private double pedagio;
private double seguro;
private double taxas;
private double total;
private Integer quantidade;
private String descTramo;
private String totalTarifa;
private String totalSeguro;
private String totalPedagio;
private String totalGeral;
private String totalQtd;
public String getPeriodo() {
return periodo;
}
public void setPeriodo(String periodo) {
this.periodo = periodo;
}
public String getDescRuta() {
return descRuta;
}
public void setDescRuta(String descRuta) {
this.descRuta = descRuta;
}
public String getData() {
return data;
}
public void setData(String data) {
this.data = data;
}
public String getAgencia() {
return agencia;
}
public void setAgencia(String agencia) {
this.agencia = agencia;
}
public String getDescFormaPag() {
return descFormaPag;
}
public void setDescFormaPag(String descFormaPag) {
this.descFormaPag = descFormaPag;
}
public double getTarifa() {
return tarifa;
}
public void setTarifa(double tarifa) {
this.tarifa = tarifa;
}
public double getPedagio() {
return pedagio;
}
public void setPedagio(double pedagio) {
this.pedagio = pedagio;
}
public double getSeguro() {
return seguro;
}
public void setSeguro(double seguro) {
this.seguro = seguro;
}
public double getTaxas() {
return taxas;
}
public void setTaxas(double taxas) {
this.taxas = taxas;
}
public double getTotal() {
return total;
}
public void setTotal(double total) {
this.total = total;
}
public Integer getQuantidade() {
return quantidade;
}
public void setQuantidade(Integer quantidade) {
this.quantidade = quantidade;
}
public String getTotalTarifa() {
return totalTarifa;
}
public void setTotalTarifa(String totalTarifa) {
this.totalTarifa = totalTarifa;
}
public String getTotalSeguro() {
return totalSeguro;
}
public void setTotalSeguro(String totalSeguro) {
this.totalSeguro = totalSeguro;
}
public String getTotalPedagio() {
return totalPedagio;
}
public void setTotalPedagio(String totalPedagio) {
this.totalPedagio = totalPedagio;
}
public String getTotalGeral() {
return totalGeral;
}
public void setTotalGeral(String totalGeral) {
this.totalGeral = totalGeral;
}
public String getTotalQtd() {
return totalQtd;
}
public void setTotalQtd(String totalQtd) {
this.totalQtd = totalQtd;
}
public String getDescTramo() {
return descTramo;
}
public void setDescTramo(String descTramo) {
this.descTramo = descTramo;
}
}

View File

@ -4,6 +4,8 @@
*/ */
package com.rjconsultores.ventaboletos.web.gui.controladores.financeiro; package com.rjconsultores.ventaboletos.web.gui.controladores.financeiro;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@ -17,16 +19,21 @@ import org.springframework.stereotype.Controller;
import org.zkoss.util.resource.Labels; import org.zkoss.util.resource.Labels;
import org.zkoss.zk.ui.Component; import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.event.Event; import org.zkoss.zk.ui.event.Event;
import org.zkoss.zul.Checkbox;
import org.zkoss.zul.Datebox; import org.zkoss.zul.Datebox;
import com.rjconsultores.ventaboletos.entidad.PuntoVenta; import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
import com.rjconsultores.ventaboletos.entidad.Empresa; import com.rjconsultores.ventaboletos.entidad.Empresa;
import com.rjconsultores.ventaboletos.entidad.Ruta;
import com.rjconsultores.ventaboletos.relatorios.impl.RelatorioFormaPagamentoAgencia; import com.rjconsultores.ventaboletos.relatorios.impl.RelatorioFormaPagamentoAgencia;
import com.rjconsultores.ventaboletos.relatorios.impl.RelatorioFormaPagamentoAgenciaRutaTramo;
import com.rjconsultores.ventaboletos.service.FormaPagamentoAgenciaService; import com.rjconsultores.ventaboletos.service.FormaPagamentoAgenciaService;
import com.rjconsultores.ventaboletos.service.RutaService;
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEstandar; import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEstandar;
import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxPuntoVenta; import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxPuntoVenta;
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer; import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
/** /**
* *
@ -38,6 +45,8 @@ public class FormaPagamentoAgenciaController extends MyGenericForwardComposer {
@Autowired @Autowired
private FormaPagamentoAgenciaService financeiroService; private FormaPagamentoAgenciaService financeiroService;
@Autowired
private RutaService rutaService;
@Autowired @Autowired
private DataSource dataSourceRead; private DataSource dataSourceRead;
@ -49,12 +58,22 @@ public class FormaPagamentoAgenciaController extends MyGenericForwardComposer {
private List<Empresa> lsEmpresas; private List<Empresa> lsEmpresas;
private MyComboboxPuntoVenta cmbAgencia; private MyComboboxPuntoVenta cmbAgencia;
private Checkbox considerarRuta;
private MyComboboxEstandar cmbRuta;
private List<Ruta> lsRuta;
private List<Ruta> listSelectedRutas;
private MyListbox selectedRutasList;
@Override @Override
public void doAfterCompose(Component comp) throws Exception { public void doAfterCompose(Component comp) throws Exception {
lsEmpresas = UsuarioLogado.getUsuarioLogado().getEmpresa(); lsEmpresas = UsuarioLogado.getUsuarioLogado().getEmpresa();
lsRuta = rutaService.obtenerTodos();
listSelectedRutas = new ArrayList<Ruta>();
super.doAfterCompose(comp); super.doAfterCompose(comp);
} }
@ -121,9 +140,17 @@ public class FormaPagamentoAgenciaController extends MyGenericForwardComposer {
Date dataInicio = fecInicio.getValue(); Date dataInicio = fecInicio.getValue();
Date dataFinal = fecFinal.getValue(); Date dataFinal = fecFinal.getValue();
SimpleDateFormat dt = new SimpleDateFormat("dd/MM/yyyy");
Map argsInforme = new HashMap(); Map argsInforme = new HashMap();
if(!considerarRuta.isChecked()){
argsInforme.put("DATA_INICIAL", dataInicio); argsInforme.put("DATA_INICIAL", dataInicio);
argsInforme.put("DATA_FINAL", dataFinal); argsInforme.put("DATA_FINAL", dataFinal);
}else{
argsInforme.put("DATA_INICIAL", dt.format(dataInicio));
argsInforme.put("DATA_FINAL", dt.format(dataFinal));
}
if (cmbEmpresa.isValid() && cmbEmpresa.getSelectedItem() != null) { if (cmbEmpresa.isValid() && cmbEmpresa.getSelectedItem() != null) {
Integer empresaId = ((Empresa)cmbEmpresa.getSelectedItem().getValue()).getEmpresaId(); Integer empresaId = ((Empresa)cmbEmpresa.getSelectedItem().getValue()).getEmpresaId();
@ -135,13 +162,76 @@ public class FormaPagamentoAgenciaController extends MyGenericForwardComposer {
argsInforme.put("AGENCIA", agencia); argsInforme.put("AGENCIA", agencia);
} }
RelatorioFormaPagamentoAgencia relatorio = new RelatorioFormaPagamentoAgencia(argsInforme, dataSourceRead.getConnection()); if (considerarRuta.isChecked() && listSelectedRutas != null && !listSelectedRutas.isEmpty()) {
String idsRutas = "";
for(Ruta r : listSelectedRutas){
idsRutas = idsRutas + r.getRutaId()+",";
}
argsInforme.put("RUTAS_IDS", idsRutas.substring(0, idsRutas.length()-1));
}
RelatorioFormaPagamentoAgencia relatorio =null;
RelatorioFormaPagamentoAgenciaRutaTramo relatorioRutaTramo =null;
if(!considerarRuta.isChecked()){
relatorio = new RelatorioFormaPagamentoAgencia(argsInforme, dataSourceRead.getConnection());
}else{
relatorioRutaTramo = new RelatorioFormaPagamentoAgenciaRutaTramo(argsInforme, dataSourceRead.getConnection());
}
Map args = new HashMap(); Map args = new HashMap();
if(!considerarRuta.isChecked()){
args.put("relatorio", relatorio); args.put("relatorio", relatorio);
}else{
args.put("relatorio", relatorioRutaTramo);
}
openWindow("/component/reportView.zul", openWindow("/component/reportView.zul",
Labels.getLabel("formaPagamentoAgenciaController.window.title"), args, MODAL); Labels.getLabel("formaPagamentoAgenciaController.window.title"), args, MODAL);
} }
public void onClick$btnAddRuta(Event ev) throws InterruptedException {
if (cmbRuta.getSelectedItem() != null) {
listSelectedRutas.add((Ruta) cmbRuta.getSelectedItem().getValue());
selectedRutasList.setData(listSelectedRutas);
cmbRuta.setSelectedItem(null);
}
}
public void onClick$btnRemoveRuta(Event ev) throws InterruptedException {
Ruta ruta = (Ruta) selectedRutasList.getSelected();
listSelectedRutas.remove(ruta);
selectedRutasList.setData(listSelectedRutas);
}
public List<Ruta> getLsRuta() {
return lsRuta;
}
public void setLsRuta(List<Ruta> lsRuta) {
this.lsRuta = lsRuta;
}
public List<Ruta> getListSelectedRutas() {
return listSelectedRutas;
}
public void setListSelectedRutas(List<Ruta> listSelectedRutas) {
this.listSelectedRutas = listSelectedRutas;
}
public MyListbox getSelectedRutasList() {
return selectedRutasList;
}
public void setSelectedRutasList(MyListbox selectedRutasList) {
this.selectedRutasList = selectedRutasList;
}
} }

View File

@ -399,6 +399,7 @@ formaPagamentoAgenciaController.lbAgencia.value = Agência
formaPagamentoAgenciaController.lbDataIni.value = Data Início formaPagamentoAgenciaController.lbDataIni.value = Data Início
formaPagamentoAgenciaController.lbDataFin.value = Data Fim formaPagamentoAgenciaController.lbDataFin.value = Data Fim
formaPagamentoAgenciaController.lbEmpresa.value = Empresa formaPagamentoAgenciaController.lbEmpresa.value = Empresa
formaPagamentoAgenciaController.lbConsideraRuta.value = Considerar Ruta
# Relatório Financeiro por Grupo de Linhas # Relatório Financeiro por Grupo de Linhas
financeiroGrupoLinhasController.mniRelatorioFinanceiro.label = Financeiro por Grupo de Linhas financeiroGrupoLinhasController.mniRelatorioFinanceiro.label = Financeiro por Grupo de Linhas

View File

@ -44,8 +44,54 @@
width="70%" width="70%"
model="@{winFormaPagamentoAgencia$composer.lsEmpresas}"/> model="@{winFormaPagamentoAgencia$composer.lsEmpresas}"/>
</row> </row>
<row>
<label
value="${c:l('editarConfiguracionCorridaController.cmbRuta.value')}" />
<grid fixedLayout="true">
<columns>
<column width="10%" />
<column width="90%" />
</columns>
<rows>
<row>
<checkbox id="considerarRuta">
<attribute name="onCheck">
cmbRuta.setVisible(!cmbRuta.isVisible());
toolbar.setVisible(!toolbar.isVisible());
selectedRutasList.setVisible(!selectedRutasList.isVisible());
</attribute>
</checkbox>
<combobox id="cmbRuta" visible="false"
use="com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEstandar"
mold="rounded" buttonVisible="true" width="90%"
model="@{winFormaPagamentoAgencia$composer.lsRuta}" />
</row>
</rows> </rows>
</grid> </grid>
</row>
</rows>
</grid>
<toolbar id="toolbar" visible="false">
<button id="btnRemoveRuta" height="20"
image="/gui/img/remove.png" width="35px"
tooltiptext="${c:l('generarTarifaOrgaoController.labelRemoveRuta.value')}" />
<button id="btnAddRuta" height="20"
image="/gui/img/add.png" width="35px"
tooltiptext="${c:l('generarTarifaOrgaoController.labelAddRuta.value')}" />
</toolbar>
<listbox id="selectedRutasList" visible="false"
use="com.rjconsultores.ventaboletos.web.utilerias.MyListbox"
multiple="false">
<listhead sizable="true">
<listheader image="/gui/img/builder.gif"
label="${c:l('generarTarifaOrgaoController.labelRuta.value')}" width="70%"/>
<listheader image="/gui/img/builder.gif"
label="${c:l('generarTarifaOrgaoController.labelOrgao.value')}" />
</listhead>
</listbox>
<toolbar> <toolbar>
<button id="btnInforme" height="20" image="/gui/img/vis.png" width="35px"/> <button id="btnInforme" height="20" image="/gui/img/vis.png" width="35px"/>