fixes bug #6369
git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@44950 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
eeb6840043
commit
5a2401a6b7
|
@ -0,0 +1,232 @@
|
|||
package com.rjconsultores.ventaboletos.relatorios.impl;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.Date;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.rjconsultores.ventaboletos.relatorios.utilitarios.DataSource;
|
||||
import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio;
|
||||
import com.rjconsultores.ventaboletos.relatorios.utilitarios.RelatorioAproveitamentoBean;
|
||||
import com.rjconsultores.ventaboletos.relatorios.utilitarios.RelatorioVendasPacotesBean;
|
||||
import com.rjconsultores.ventaboletos.web.utilerias.NamedParameterStatement;
|
||||
|
||||
public class RelatorioVendasPacotesResumido extends Relatorio {
|
||||
|
||||
private static Logger log = Logger.getLogger(RelatorioVendasPacotesBean.class);
|
||||
|
||||
private SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
|
||||
|
||||
private List<RelatorioVendasPacotesBean> lsDadosRelatorio;
|
||||
|
||||
private Date fecInicio;
|
||||
private Date fecFinal;
|
||||
private Integer empresaId;
|
||||
|
||||
public RelatorioVendasPacotesResumido(Map<String, Object> parametros, Connection conexao) throws Exception {
|
||||
super(parametros, conexao);
|
||||
|
||||
this.setCustomDataSource(new DataSource(this) {
|
||||
@Override
|
||||
public void initDados() throws Exception {
|
||||
Map<String, Object> parametros = this.relatorio.getParametros();
|
||||
fecInicio = new java.sql.Date(sdf.parse(parametros.get("fecInicio").toString()).getTime());
|
||||
fecFinal = new java.sql.Date(sdf.parse(parametros.get("fecFinal").toString()).getTime());
|
||||
empresaId = parametros.get("empresaId") != null && parametros.get("empresaId").equals("null") ? Integer.valueOf(parametros.get("empresaId").toString()) : null;
|
||||
|
||||
Connection conexao = this.relatorio.getConexao();
|
||||
processarTotalPacote(conexao);
|
||||
processarTotalBoletos(conexao);
|
||||
|
||||
setLsDadosRelatorio(lsDadosRelatorio);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void processarTotalPacote(Connection conexao) {
|
||||
ResultSet rset = null;
|
||||
NamedParameterStatement stmt = null;
|
||||
|
||||
try {
|
||||
String sql = getSqlPacotes();
|
||||
|
||||
log.info(sql);
|
||||
|
||||
stmt = new NamedParameterStatement(conexao, sql);
|
||||
|
||||
if(fecInicio != null) {
|
||||
stmt.setDate("fecInicio", fecInicio);
|
||||
}
|
||||
if(fecFinal != null) {
|
||||
stmt.setDate("fecFinal", fecFinal);
|
||||
}
|
||||
if (empresaId != null){
|
||||
stmt.setInt("empresaId", empresaId);
|
||||
}
|
||||
|
||||
rset = stmt.executeQuery();
|
||||
|
||||
if(lsDadosRelatorio == null) {
|
||||
lsDadosRelatorio = new ArrayList<RelatorioVendasPacotesBean>();
|
||||
}
|
||||
|
||||
while (rset.next()) {
|
||||
RelatorioVendasPacotesBean relatorioVendasPacotesBean = new RelatorioVendasPacotesBean();
|
||||
relatorioVendasPacotesBean.setPacoteId(rset.getLong("pacote_id"));
|
||||
relatorioVendasPacotesBean.setNompacote(rset.getString("nompacote"));
|
||||
relatorioVendasPacotesBean.setTotalPacotes(rset.getBigDecimal("totalpacote"));
|
||||
relatorioVendasPacotesBean.setQtdePacotes(rset.getLong("qtdepacote"));
|
||||
lsDadosRelatorio.add(relatorioVendasPacotesBean);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
} finally {
|
||||
try {
|
||||
if(rset != null) {
|
||||
rset.close();
|
||||
}
|
||||
if(stmt != null) {
|
||||
stmt.close();
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void processarTotalBoletos(Connection conexao) {
|
||||
ResultSet rset = null;
|
||||
NamedParameterStatement stmt = null;
|
||||
|
||||
try {
|
||||
String sql = getSqlBoletos();
|
||||
|
||||
log.info(sql);
|
||||
|
||||
stmt = new NamedParameterStatement(conexao, sql);
|
||||
|
||||
if(fecInicio != null) {
|
||||
stmt.setDate("fecInicio", fecInicio);
|
||||
}
|
||||
if(fecFinal != null) {
|
||||
stmt.setDate("fecFinal", fecFinal);
|
||||
}
|
||||
if (empresaId != null){
|
||||
stmt.setInt("empresaId", empresaId);
|
||||
}
|
||||
|
||||
rset = stmt.executeQuery();
|
||||
|
||||
if(lsDadosRelatorio == null) {
|
||||
lsDadosRelatorio = new ArrayList<RelatorioVendasPacotesBean>();
|
||||
}
|
||||
|
||||
while (rset.next()) {
|
||||
RelatorioVendasPacotesBean relatorioVendasPacotesBean = new RelatorioVendasPacotesBean();
|
||||
relatorioVendasPacotesBean.setPacoteId(rset.getLong("pacote_id"));
|
||||
relatorioVendasPacotesBean.setNompacote(rset.getString("nompacote"));
|
||||
relatorioVendasPacotesBean.setTotalBoletos(rset.getBigDecimal("totalboletos"));
|
||||
|
||||
if(lsDadosRelatorio.contains(relatorioVendasPacotesBean)) {
|
||||
RelatorioVendasPacotesBean relatorioVendasPacotesBeanAux = lsDadosRelatorio.get(lsDadosRelatorio.indexOf(relatorioVendasPacotesBean));
|
||||
relatorioVendasPacotesBeanAux.setTotalBoletos(relatorioVendasPacotesBean.getTotalBoletos());
|
||||
} else {
|
||||
lsDadosRelatorio.add(relatorioVendasPacotesBean);
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
} finally {
|
||||
try {
|
||||
if(rset != null) {
|
||||
rset.close();
|
||||
}
|
||||
if(stmt != null) {
|
||||
stmt.close();
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private String getSqlPacotes() {
|
||||
StringBuilder sQuery = new StringBuilder();
|
||||
|
||||
sQuery.append("SELECT P.PACOTE_ID, P.NOMPACOTE, COUNT(P.PACOTE_ID) AS QTDEPACOTE, SUM(VP.TOTAL) AS TOTALPACOTE ")
|
||||
.append("FROM VENDA_PACOTE VP ")
|
||||
.append("LEFT JOIN PACOTE P ON P.PACOTE_ID = VP.PACOTE_ID ")
|
||||
.append("WHERE P.ACTIVO = 1 ");
|
||||
|
||||
if(empresaId != null) {
|
||||
sQuery.append("AND P.EMPRESA_ID = :empresaId ");
|
||||
}
|
||||
|
||||
if(fecInicio != null) {
|
||||
sQuery.append("AND VP.DATAPACOTE >= :fecInicio ");
|
||||
}
|
||||
|
||||
if(fecFinal != null) {
|
||||
sQuery.append("AND VP.DATAPACOTE <= :fecFinal ");
|
||||
}
|
||||
|
||||
sQuery.append("GROUP BY P.PACOTE_ID, P.NOMPACOTE ");
|
||||
|
||||
return sQuery.toString();
|
||||
}
|
||||
|
||||
private String getSqlBoletos() {
|
||||
StringBuilder sQuery = new StringBuilder();
|
||||
|
||||
sQuery.append("SELECT P.PACOTE_ID, P.NOMPACOTE, SUM(TVP.VALOR) AS TOTALBOLETOS ")
|
||||
.append("FROM VENDA_PACOTE VP ")
|
||||
.append("LEFT JOIN PACOTE P ON P.PACOTE_ID = VP.PACOTE_ID ")
|
||||
.append("LEFT JOIN TARIFA_VENDA_PACOTE TVP ON TVP.VENDAPACOTE_ID = VP.VENDAPACOTE_ID ")
|
||||
.append("LEFT JOIN BOLETO B ON B.BOLETO_ID = TVP.BOLETO_ID ")
|
||||
.append("WHERE P.ACTIVO = 1 ")
|
||||
.append("AND B.ACTIVO = 1 ")
|
||||
.append("AND B.INDSTATUSBOLETO = 'V' ");
|
||||
|
||||
if(empresaId != null) {
|
||||
sQuery.append("AND P.EMPRESA_ID = :empresaId ");
|
||||
}
|
||||
|
||||
if(fecInicio != null) {
|
||||
sQuery.append("AND VP.DATAPACOTE >= :fecInicio ");
|
||||
}
|
||||
|
||||
if(fecFinal != null) {
|
||||
sQuery.append("AND VP.DATAPACOTE <= :fecFinal ");
|
||||
}
|
||||
|
||||
sQuery.append("GROUP BY P.PACOTE_ID, P.NOMPACOTE ");
|
||||
|
||||
return sQuery.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void processaParametros() throws Exception {
|
||||
}
|
||||
|
||||
public List<RelatorioVendasPacotesBean> getLsDadosRelatorio() {
|
||||
return lsDadosRelatorio;
|
||||
}
|
||||
|
||||
public void setLsDadosRelatorio(List<RelatorioVendasPacotesBean> lsDadosRelatorio) {
|
||||
this.setCollectionDataSource(new JRBeanCollectionDataSource(lsDadosRelatorio));
|
||||
this.lsDadosRelatorio = lsDadosRelatorio;
|
||||
}
|
||||
|
||||
}
|
Binary file not shown.
|
@ -0,0 +1,175 @@
|
|||
<?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="RelatorioVendasPacotesResumido" pageWidth="595" pageHeight="842" whenNoDataType="NoDataSection" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="84b9dfcf-8ec5-4f51-80cc-7339e3b158b4">
|
||||
<property name="ireport.zoom" value="1.0"/>
|
||||
<property name="ireport.x" value="0"/>
|
||||
<property name="ireport.y" value="0"/>
|
||||
<parameter name="empresa" class="java.lang.String"/>
|
||||
<parameter name="fecInicio" class="java.lang.String"/>
|
||||
<parameter name="fecFinal" class="java.lang.String"/>
|
||||
<parameter name="noDataRelatorio" class="java.lang.String"/>
|
||||
<queryString>
|
||||
<![CDATA[]]>
|
||||
</queryString>
|
||||
<field name="nompacote" class="java.lang.String"/>
|
||||
<field name="qtdePacotes" class="java.lang.Long"/>
|
||||
<field name="totalBoletos" class="java.math.BigDecimal"/>
|
||||
<field name="totalPacotes" class="java.math.BigDecimal"/>
|
||||
<variable name="vTotalQtdePacotes" class="java.lang.Long" calculation="Sum">
|
||||
<variableExpression><![CDATA[$F{qtdePacotes}]]></variableExpression>
|
||||
</variable>
|
||||
<variable name="vTotalBoletos" class="java.math.BigDecimal" calculation="Sum">
|
||||
<variableExpression><![CDATA[$F{totalBoletos}]]></variableExpression>
|
||||
</variable>
|
||||
<variable name="vTotalPacotes" class="java.math.BigDecimal" calculation="Sum">
|
||||
<variableExpression><![CDATA[$F{totalPacotes}]]></variableExpression>
|
||||
</variable>
|
||||
<background>
|
||||
<band splitType="Stretch"/>
|
||||
</background>
|
||||
<title>
|
||||
<band height="62" splitType="Stretch">
|
||||
<staticText>
|
||||
<reportElement x="0" y="0" width="301" height="20" uuid="58b5b133-43e0-42f0-a904-5cc3645d3df3"/>
|
||||
<textElement>
|
||||
<font size="14" isBold="true"/>
|
||||
</textElement>
|
||||
<text><![CDATA[Relatório Vendas de Pacotes - Resumido]]></text>
|
||||
</staticText>
|
||||
<textField pattern="dd/MM/yyyy HH:mm">
|
||||
<reportElement x="391" y="0" width="164" height="20" uuid="4d1bcd65-c9a6-44b4-8dca-cc3c4c20c9a5"/>
|
||||
<textElement textAlignment="Right">
|
||||
<font isBold="true"/>
|
||||
</textElement>
|
||||
<textFieldExpression><![CDATA[new java.util.Date()]]></textFieldExpression>
|
||||
</textField>
|
||||
<textField>
|
||||
<reportElement x="0" y="20" width="301" height="20" uuid="a16eb33b-78ca-4fb4-80c2-f5c85a0d09c3"/>
|
||||
<textElement>
|
||||
<font isBold="true"/>
|
||||
</textElement>
|
||||
<textFieldExpression><![CDATA["Empresa: " + $P{empresa}]]></textFieldExpression>
|
||||
</textField>
|
||||
<textField>
|
||||
<reportElement x="0" y="40" width="301" height="20" uuid="fd05bd35-30d9-4baf-aa56-f8e5d3c3268b"/>
|
||||
<textElement>
|
||||
<font isBold="true"/>
|
||||
</textElement>
|
||||
<textFieldExpression><![CDATA["Período: " + $P{fecInicio} + " a " + $P{fecFinal}]]></textFieldExpression>
|
||||
</textField>
|
||||
</band>
|
||||
</title>
|
||||
<pageHeader>
|
||||
<band height="21" splitType="Stretch">
|
||||
<line>
|
||||
<reportElement x="0" y="19" width="555" height="1" uuid="4f39b5b4-849a-4fe2-9365-06930866fbaa"/>
|
||||
</line>
|
||||
<textField>
|
||||
<reportElement x="391" y="0" width="164" height="20" uuid="6a8a0843-7236-40a3-98ae-5fbf59b4cfec"/>
|
||||
<textElement textAlignment="Right">
|
||||
<font isBold="true"/>
|
||||
</textElement>
|
||||
<textFieldExpression><![CDATA["Página " + $V{PAGE_NUMBER}+ " de " + $V{PAGE_NUMBER}]]></textFieldExpression>
|
||||
</textField>
|
||||
</band>
|
||||
</pageHeader>
|
||||
<columnHeader>
|
||||
<band height="21" splitType="Stretch">
|
||||
<staticText>
|
||||
<reportElement x="0" y="1" width="255" height="20" uuid="7e956f7e-4695-4ff8-8f89-b090996e764a"/>
|
||||
<textElement verticalAlignment="Middle">
|
||||
<font isBold="true"/>
|
||||
</textElement>
|
||||
<text><![CDATA[Pacote]]></text>
|
||||
</staticText>
|
||||
<staticText>
|
||||
<reportElement x="255" y="1" width="100" height="20" uuid="48a03698-b397-4b02-82c2-dbee7b2bca24"/>
|
||||
<textElement textAlignment="Center" verticalAlignment="Middle">
|
||||
<font isBold="true"/>
|
||||
</textElement>
|
||||
<text><![CDATA[Quantidade]]></text>
|
||||
</staticText>
|
||||
<staticText>
|
||||
<reportElement x="355" y="1" width="100" height="20" uuid="43c84fe9-c50e-464d-875d-6c181ce522cd"/>
|
||||
<textElement textAlignment="Right" verticalAlignment="Middle">
|
||||
<font isBold="true"/>
|
||||
</textElement>
|
||||
<text><![CDATA[Total Bilhetes]]></text>
|
||||
</staticText>
|
||||
<staticText>
|
||||
<reportElement x="455" y="1" width="100" height="20" uuid="aff4b650-74dc-4613-ba06-d13532986c77"/>
|
||||
<textElement textAlignment="Right" verticalAlignment="Middle">
|
||||
<font isBold="true"/>
|
||||
</textElement>
|
||||
<text><![CDATA[Total Pacotes]]></text>
|
||||
</staticText>
|
||||
</band>
|
||||
</columnHeader>
|
||||
<detail>
|
||||
<band height="21" splitType="Stretch">
|
||||
<textField isBlankWhenNull="true">
|
||||
<reportElement stretchType="RelativeToTallestObject" x="0" y="1" width="255" height="20" isPrintWhenDetailOverflows="true" uuid="752263b1-e76b-41c5-a728-c17367094dab"/>
|
||||
<textElement verticalAlignment="Middle"/>
|
||||
<textFieldExpression><![CDATA[$F{nompacote}]]></textFieldExpression>
|
||||
</textField>
|
||||
<textField>
|
||||
<reportElement stretchType="RelativeToTallestObject" x="255" y="1" width="100" height="20" uuid="4d1f1dc7-c08b-4323-a5cf-4c40fe757da0"/>
|
||||
<textElement textAlignment="Center" verticalAlignment="Middle"/>
|
||||
<textFieldExpression><![CDATA[$F{qtdePacotes}]]></textFieldExpression>
|
||||
</textField>
|
||||
<textField pattern="#,##0.00">
|
||||
<reportElement stretchType="RelativeToTallestObject" x="355" y="1" width="100" height="20" uuid="923c045e-f2b7-409f-ae52-600a307d7cb5"/>
|
||||
<textElement textAlignment="Right" verticalAlignment="Middle"/>
|
||||
<textFieldExpression><![CDATA[$F{totalBoletos}]]></textFieldExpression>
|
||||
</textField>
|
||||
<textField pattern="#,##0.00">
|
||||
<reportElement stretchType="RelativeToTallestObject" x="455" y="1" width="100" height="20" uuid="1063f040-0be4-4c44-8248-90e8b6c0ce64"/>
|
||||
<textElement textAlignment="Right" verticalAlignment="Middle"/>
|
||||
<textFieldExpression><![CDATA[$F{totalPacotes}]]></textFieldExpression>
|
||||
</textField>
|
||||
</band>
|
||||
</detail>
|
||||
<columnFooter>
|
||||
<band splitType="Stretch"/>
|
||||
</columnFooter>
|
||||
<pageFooter>
|
||||
<band splitType="Stretch"/>
|
||||
</pageFooter>
|
||||
<summary>
|
||||
<band height="24" splitType="Stretch">
|
||||
<staticText>
|
||||
<reportElement x="0" y="3" width="255" height="20" uuid="65160df0-a209-4c01-9c49-4de2a1ea7ea0"/>
|
||||
<textElement textAlignment="Right" verticalAlignment="Middle">
|
||||
<font isBold="true"/>
|
||||
</textElement>
|
||||
<text><![CDATA[Total]]></text>
|
||||
</staticText>
|
||||
<textField isBlankWhenNull="true">
|
||||
<reportElement x="255" y="3" width="100" height="20" uuid="d2d44ea4-14ce-497c-91e5-e4ddca94794a"/>
|
||||
<textElement textAlignment="Center" verticalAlignment="Middle">
|
||||
<font isBold="true"/>
|
||||
</textElement>
|
||||
<textFieldExpression><![CDATA[$V{vTotalQtdePacotes}]]></textFieldExpression>
|
||||
</textField>
|
||||
<textField pattern="#,##0.00" isBlankWhenNull="true">
|
||||
<reportElement x="355" y="3" width="100" height="20" uuid="2c84e21c-fe3f-499b-ac8a-6c0fbae60639"/>
|
||||
<textElement textAlignment="Right" verticalAlignment="Middle">
|
||||
<font isBold="true"/>
|
||||
</textElement>
|
||||
<textFieldExpression><![CDATA[$V{vTotalBoletos}]]></textFieldExpression>
|
||||
</textField>
|
||||
<textField pattern="#,##0.00" isBlankWhenNull="true">
|
||||
<reportElement x="455" y="3" width="100" height="20" uuid="f147fee0-a325-4b6b-8925-893b117ada8d"/>
|
||||
<textElement textAlignment="Right" verticalAlignment="Middle">
|
||||
<font isBold="true"/>
|
||||
</textElement>
|
||||
<textFieldExpression><![CDATA[$V{vTotalPacotes}]]></textFieldExpression>
|
||||
</textField>
|
||||
<line>
|
||||
<reportElement x="0" y="1" width="555" height="1" uuid="0397e455-c3e6-4708-be2f-75efb51443a5"/>
|
||||
</line>
|
||||
</band>
|
||||
</summary>
|
||||
<noData>
|
||||
<band height="31"/>
|
||||
</noData>
|
||||
</jasperReport>
|
|
@ -0,0 +1,78 @@
|
|||
package com.rjconsultores.ventaboletos.relatorios.utilitarios;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
public class RelatorioVendasPacotesBean {
|
||||
|
||||
private Long pacoteId;
|
||||
private String nompacote;
|
||||
private Long qtdePacotes;
|
||||
private BigDecimal totalBoletos;
|
||||
private BigDecimal totalPacotes;
|
||||
|
||||
public Long getPacoteId() {
|
||||
return pacoteId;
|
||||
}
|
||||
|
||||
public void setPacoteId(Long pacoteId) {
|
||||
this.pacoteId = pacoteId;
|
||||
}
|
||||
|
||||
public String getNompacote() {
|
||||
return nompacote;
|
||||
}
|
||||
|
||||
public void setNompacote(String nompacote) {
|
||||
this.nompacote = nompacote;
|
||||
}
|
||||
|
||||
public BigDecimal getTotalBoletos() {
|
||||
return totalBoletos;
|
||||
}
|
||||
|
||||
public void setTotalBoletos(BigDecimal totalBoletos) {
|
||||
this.totalBoletos = totalBoletos;
|
||||
}
|
||||
|
||||
public BigDecimal getTotalPacotes() {
|
||||
return totalPacotes;
|
||||
}
|
||||
|
||||
public void setTotalPacotes(BigDecimal totalPacotes) {
|
||||
this.totalPacotes = totalPacotes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((pacoteId == null) ? 0 : pacoteId.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
RelatorioVendasPacotesBean other = (RelatorioVendasPacotesBean) obj;
|
||||
if (pacoteId == null) {
|
||||
if (other.pacoteId != null)
|
||||
return false;
|
||||
} else if (!pacoteId.equals(other.pacoteId))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public Long getQtdePacotes() {
|
||||
return qtdePacotes;
|
||||
}
|
||||
|
||||
public void setQtdePacotes(Long qtdePacotes) {
|
||||
this.qtdePacotes = qtdePacotes;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,96 @@
|
|||
package com.rjconsultores.ventaboletos.web.gui.controladores.relatorios;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
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.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.relatorios.impl.RelatorioVendasPacotesResumido;
|
||||
import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio;
|
||||
import com.rjconsultores.ventaboletos.service.EmpresaService;
|
||||
import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEstandar;
|
||||
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||
|
||||
@Controller("relatorioVendasPacotesResumidoController")
|
||||
@Scope("prototype")
|
||||
public class RelatorioVendasPacotesResumidoController extends MyGenericForwardComposer {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Autowired
|
||||
private DataSource dataSourceRead;
|
||||
|
||||
@Autowired
|
||||
private EmpresaService empresaService;
|
||||
|
||||
private List<Empresa> lsEmpresa;
|
||||
private Datebox dataInicial;
|
||||
private Datebox dataFinal;
|
||||
private MyComboboxEstandar cmbEmpresa;
|
||||
|
||||
public List<Empresa> getLsEmpresa() {
|
||||
return lsEmpresa;
|
||||
}
|
||||
|
||||
public void setLsEmpresa(List<Empresa> lsEmpresa) {
|
||||
this.lsEmpresa = lsEmpresa;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doAfterCompose(Component comp) throws Exception {
|
||||
lsEmpresa = empresaService.obtenerTodos();
|
||||
super.doAfterCompose(comp);
|
||||
}
|
||||
|
||||
private void executarPesquisa() {
|
||||
}
|
||||
|
||||
public void onClick$btnLimpar(Event ev) {
|
||||
}
|
||||
|
||||
public void onClick$btnPesquisa(Event ev) {
|
||||
executarPesquisa();
|
||||
}
|
||||
|
||||
public void onClick$btnExecutarRelatorio(Event ev) throws Exception {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
|
||||
Date dataDe = dataInicial.getValue();
|
||||
Date dataAte = dataFinal.getValue();
|
||||
|
||||
Map<String, Object> parametros = new HashMap<String, Object>();
|
||||
parametros.put("fecInicio", sdf.format(dataDe));
|
||||
parametros.put("fecFinal", sdf.format(dataAte));
|
||||
|
||||
Comboitem cbiEmpresa = cmbEmpresa.getSelectedItem();
|
||||
String empresaId = null;
|
||||
parametros.put("empresa", "");
|
||||
if (cbiEmpresa != null) {
|
||||
Empresa empresa = (Empresa) cbiEmpresa.getValue();
|
||||
empresaId = empresa.getEmpresaId().toString();
|
||||
parametros.put("empresa", empresa.getNombempresa());
|
||||
}
|
||||
parametros.put("empresaId", empresaId);
|
||||
|
||||
Relatorio relatorio = new RelatorioVendasPacotesResumido(parametros, dataSourceRead.getConnection());
|
||||
|
||||
Map<String, Object> args = new HashMap<String, Object>();
|
||||
args.put("relatorio", relatorio);
|
||||
|
||||
openWindow("/component/reportView.zul",
|
||||
Labels.getLabel("relatorioVendasPacotesResumidoController.window.title"), args, MODAL);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package com.rjconsultores.ventaboletos.web.utilerias.menu.item.relatorios;
|
||||
|
||||
import org.zkoss.util.resource.Labels;
|
||||
|
||||
import com.rjconsultores.ventaboletos.web.utilerias.PantallaUtileria;
|
||||
import com.rjconsultores.ventaboletos.web.utilerias.menu.DefaultItemMenuSistema;
|
||||
|
||||
/**
|
||||
* @author Wilian Domingues
|
||||
*
|
||||
*/
|
||||
public class ItemMenuRelatorioVendasPacotesResumido extends DefaultItemMenuSistema {
|
||||
|
||||
public ItemMenuRelatorioVendasPacotesResumido() {
|
||||
super("indexController.mniRelatorioVendasPacotesResumido.label");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getClaveMenu() {
|
||||
return "COM.RJCONSULTORES.ADMINISTRACION.GUI.RELATORIOS.MENU.RELATORIOVENDASPACOTESRESUMIDO";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ejecutar() {
|
||||
PantallaUtileria.openWindow("/gui/relatorios/filtroRelatorioVendasPacotesResumido.zul",
|
||||
Labels.getLabel("relatorioVendasPacotesResumidoController.window.title"), getArgs() ,desktop);
|
||||
}
|
||||
|
||||
}
|
|
@ -241,6 +241,7 @@ indexController.mniFechamentoParamptovta.label = Fechamento Conta Corrente Agên
|
|||
indexController.mniRelatorioCorridas.label = Reporte de Corridas
|
||||
indexController.mniRelatorioDemandas.label = Reporte de Demandas
|
||||
indexController.mniPrecoApanhe.label = Preço Apanhe
|
||||
indexController.mniRelatorioVendasPacotesResumido.label = Ventas de Paquetes Resumido
|
||||
|
||||
indexController.mniSubMenuClientePacote.label=Pacote
|
||||
indexController.mniAlterarEnderecoApanhe.label=Alterar Endereço Apanhe
|
||||
|
@ -5263,4 +5264,10 @@ editarAlterarEnderecoApanheController.lhCep.label = Cep
|
|||
editarAlterarEnderecoApanheController.lhEndereco.label = Logradouro
|
||||
editarAlterarEnderecoApanheController.lhReferencia.label = Referencia
|
||||
editarAlterarEnderecoApanheController.lhNumoperacion.label = Num Operacion
|
||||
editarAlterarEnderecoApanheController.lhDataPacote.label = Fecha Pacote
|
||||
editarAlterarEnderecoApanheController.lhDataPacote.label = Fecha Pacote
|
||||
|
||||
# Relatorio Vendas Pacotes Resumido
|
||||
relatorioVendasPacotesResumidoController.window.title = Relatório Vendas de Pacotes Resumido
|
||||
relatorioVendasPacotesResumidoController.lbDataIni.value = Fecha Inicio
|
||||
relatorioVendasPacotesResumidoController.lbDataFin.value = Fecha Final
|
||||
relatorioVendasPacotesResumidoController.lblEmpresa.value = Empresa
|
|
@ -246,6 +246,7 @@ indexController.mniRelatorioCorridas.label = Relatório de Serviços
|
|||
indexController.mniRelatorioCorridas.label = Relatório de Serviços
|
||||
indexController.mniRelatorioDemandas.label = Relatório de Demandas
|
||||
indexController.mniPrecoApanhe.label = Preço Apanhe
|
||||
indexController.mniRelatorioVendasPacotesResumido.label = Vendas de Pacotes Resumido
|
||||
|
||||
indexController.mnSubMenuImpressaoFiscal.label=Impressão Fiscal
|
||||
indexController.mniTotnaofiscalEmpresa.label=Totalizadoes Não-fiscais
|
||||
|
@ -5390,4 +5391,10 @@ editarAlterarEnderecoApanheController.lhCep.label = Cep
|
|||
editarAlterarEnderecoApanheController.lhEndereco.label = Logradouro
|
||||
editarAlterarEnderecoApanheController.lhReferencia.label = Referência
|
||||
editarAlterarEnderecoApanheController.lhNumoperacion.label = Localizador
|
||||
editarAlterarEnderecoApanheController.lhDataPacote.label = Data Pacote
|
||||
editarAlterarEnderecoApanheController.lhDataPacote.label = Data Pacote
|
||||
|
||||
# Relatorio Vendas Pacotes Resumido
|
||||
relatorioVendasPacotesResumidoController.window.title = Relatório Vendas de Pacotes Resumido
|
||||
relatorioVendasPacotesResumidoController.lbDataIni.value = Data Inicial
|
||||
relatorioVendasPacotesResumidoController.lbDataFin.value = Data Final
|
||||
relatorioVendasPacotesResumidoController.lblEmpresa.value = Empresa
|
|
@ -0,0 +1,48 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?page contentType="text/html;charset=UTF-8"?>
|
||||
<?variable-resolver class="org.zkoss.zkplus.spring.DelegatingVariableResolver"?>
|
||||
<?init class="org.zkoss.zkplus.databind.AnnotateDataBinderInit" arg0="winFiltroRelatorioVendasPacotesResumido"?>
|
||||
<?taglib uri="http://www.zkoss.org/dsp/web/core" prefix="c"?>
|
||||
|
||||
<zk xmlns="http://www.zkoss.org/2005/zul">
|
||||
<window id="winFiltroRelatorioVendasPacotesResumido"
|
||||
apply="${relatorioVendasPacotesResumidoController}"
|
||||
contentStyle="overflow:auto" width="700px" border="normal">
|
||||
<grid fixedLayout="true">
|
||||
<columns>
|
||||
<column width="20%" />
|
||||
<column width="30%" />
|
||||
<column width="20%" />
|
||||
<column width="30%" />
|
||||
</columns>
|
||||
<rows>
|
||||
<row spans="1,3">
|
||||
<label
|
||||
value="${c:l('relatorioVendasPacotesResumidoController.lblEmpresa.value')}" />
|
||||
<combobox id="cmbEmpresa" constraint="no empty"
|
||||
use="com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEstandar"
|
||||
mold="rounded" buttonVisible="true" width="80%"
|
||||
model="@{winFiltroRelatorioVendasPacotesResumido$composer.lsEmpresa}" />
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<label
|
||||
value="${c:l('relatorioVendasPacotesResumidoController.lbDataIni.value')}" />
|
||||
<datebox id="dataInicial" width="100%" mold="rounded"
|
||||
format="dd/MM/yyyy" lenient="false" constraint="no empty"
|
||||
maxlength="10" />
|
||||
<label
|
||||
value="${c:l('relatorioVendasPacotesResumidoController.lbDataFin.value')}" />
|
||||
<datebox id="dataFinal" width="100%" mold="rounded"
|
||||
format="dd/MM/yyyy" lenient="false" constraint="no empty"
|
||||
maxlength="10" />
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
<toolbar>
|
||||
<button id="btnExecutarRelatorio" image="/gui/img/find.png"
|
||||
label="${c:l('relatorio.lb.btnExecutarRelatorio')}" />
|
||||
</toolbar>
|
||||
</window>
|
||||
</zk>
|
||||
|
Loading…
Reference in New Issue