lucas.calixto 2017-03-29 12:16:29 +00:00
parent b912535028
commit deb689494f
9 changed files with 484 additions and 0 deletions

View File

@ -0,0 +1,86 @@
package com.rjconsultores.ventaboletos.relatorios.impl;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio;
import com.rjconsultores.ventaboletos.relatorios.utilitarios.RelatorioBaixasVendasInternetBean;
import com.rjconsultores.ventaboletos.web.utilerias.NamedParameterStatement;
import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource;
public class RelatorioBaixasVendasInternet extends Relatorio {
private Date fecInicio;
private Date fecFinal;
private PuntoVenta puntoVenta;
public RelatorioBaixasVendasInternet(Connection conexao, Date fecInicio, Date fecFinal, PuntoVenta puntoVenta) {
super(new HashMap<String, Object>(), conexao);
this.fecInicio = fecInicio;
this.fecFinal = fecFinal;
this.puntoVenta = puntoVenta;
}
@Override
protected void processaParametros() throws Exception {
NamedParameterStatement namedParameterStatement = new NamedParameterStatement(getConexao(), getSql());
namedParameterStatement.setInt("puntoVentaId", puntoVenta.getPuntoventaId());
this.parametros.put("nombPuntoVenta", puntoVenta.getNombpuntoventa());
SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
this.parametros.put("fecInicio", dateFormat.format(fecInicio));
this.parametros.put("fecFinal", dateFormat.format(fecFinal));
namedParameterStatement.setDate("fecInicio", new java.sql.Date(fecInicio.getTime()));
namedParameterStatement.setDate("fecFinal", new java.sql.Date(fecFinal.getTime()));
ResultSet resultSet = namedParameterStatement.executeQuery();
List<RelatorioBaixasVendasInternetBean> resultBean = transformResultSet(resultSet);
setCollectionDataSource(new JRBeanCollectionDataSource(resultBean));
}
private List<RelatorioBaixasVendasInternetBean> transformResultSet(ResultSet resultSet) throws SQLException {
List<RelatorioBaixasVendasInternetBean> resultBean = new ArrayList<RelatorioBaixasVendasInternetBean>();
while (resultSet.next()) {
RelatorioBaixasVendasInternetBean bean = new RelatorioBaixasVendasInternetBean();
bean.setFecImpresion(resultSet.getDate("FECCREACION"));
bean.setNumFolioSistema(resultSet.getString("NUMFOLIOSISTEMA"));
bean.setOrigen(resultSet.getString("ORIGEN"));
bean.setDestino(resultSet.getString("DESTINO"));
bean.setValor(resultSet.getBigDecimal("VALOR"));
bean.setUsuarioId(resultSet.getInt("USUARIO_ID"));
bean.setNombUsuario(resultSet.getString("NOMBUSUARIO"));
resultBean.add(bean);
}
return resultBean;
}
private String getSql() {
String sql = "SELECT DISTINCT B.FECCREACION, B.NUMFOLIOSISTEMA, "
+ "U.USUARIO_ID, U.NOMBUSUARIO, O.DESCPARADA ORIGEN, D.DESCPARADA DESTINO, "
+ "COALESCE((B.PRECIOPAGADO + B.IMPORTETAXAEMBARQUE + B.IMPORTESEGURO + B.IMPORTEPEDAGIO + B.IMPORTEOUTROS), 0) AS VALOR "
+ "FROM BOLETO B "
+ "JOIN PARADA O ON B.ORIGEN_ID = O.PARADA_ID "
+ "JOIN PARADA D ON B.DESTINO_ID = D.PARADA_ID "
+ "JOIN USUARIO U ON B.USUARIO_ID = U.USUARIO_ID "
+ "WHERE B.INDSTATUSBOLETO = 'E' "
+ "AND B.FECCREACION BETWEEN :fecInicio AND :fecFinal "
+ "AND PUNTOVENTA_ID = :puntoVentaId "
+ "ORDER BY U.USUARIO_ID ";
return sql;
}
}

View File

@ -0,0 +1,22 @@
#geral
msg.noData=Não foi possivel obter dados com os parâmetros informados.
#Labels cabeçalho
cabecalho.nome=Relatório Vendas para Comissão
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:
cabecalho.usuario=Usuário:
label.nombPuntoVenta=Punto Venta
label.fecImpresion=Data da Impressão
label.numFolioSistema=Número Folio
label.origen=Origen
label.destino=Destino
label.valor=Valor del Folio
label.total=Total

View File

@ -0,0 +1,22 @@
#geral
msg.noData=Não foi possivel obter dados com os parâmetros informados.
#Labels cabeçalho
cabecalho.nome=Relatório de Baixas Vendas Internet
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:
cabecalho.usuario=Usuário:
label.nombPuntoVenta=Ponto de Venda
label.fecImpresion=Data da Impressão
label.numFolioSistema=Número da Passagem
label.origen=Origem
label.destino=Destino
label.valor=Valor da Passagem
label.total=Total

View File

@ -0,0 +1,166 @@
<?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="RelatorioBaixasVendasInternet" pageWidth="842" pageHeight="595" orientation="Landscape" whenNoDataType="NoDataSection" columnWidth="802" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="84b9dfcf-8ec5-4f51-80cc-7339e3b158b4">
<property name="ireport.zoom" value="2.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="133"/>
<parameter name="fecInicio" class="java.lang.String"/>
<parameter name="fecFinal" class="java.lang.String"/>
<parameter name="noDataRelatorio" class="java.lang.String"/>
<parameter name="empresa" class="java.lang.String"/>
<parameter name="nombPuntoVenta" class="java.lang.String"/>
<queryString>
<![CDATA[]]>
</queryString>
<field name="fecImpresion" class="java.util.Date"/>
<field name="numFolioSistema" class="java.lang.String"/>
<field name="origen" class="java.lang.String"/>
<field name="destino" class="java.lang.String"/>
<field name="valor" class="java.math.BigDecimal"/>
<field name="usuarioId" class="java.lang.Integer"/>
<field name="nombUsuario" class="java.lang.String"/>
<variable name="sumValor" class="java.math.BigDecimal" resetType="Group" resetGroup="group_usuario" calculation="Sum">
<variableExpression><![CDATA[$F{valor}]]></variableExpression>
</variable>
<group name="group_usuario">
<groupExpression><![CDATA[$F{usuarioId}]]></groupExpression>
<groupHeader>
<band height="46">
<line>
<reportElement uuid="811af238-a027-48e9-bd6f-eee885474929" positionType="Float" x="0" y="43" width="802" height="1"/>
</line>
<textField>
<reportElement uuid="5af379ca-85ae-4850-a804-75d512d7cc9d" x="0" y="22" width="160" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$R{label.fecImpresion}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="0349258f-e494-4dff-9ac7-f7d70aa0132c" x="160" y="22" width="160" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$R{label.numFolioSistema}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="3be61cdf-8be1-4b15-8252-482c2339bfad" x="354" y="22" width="140" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$R{label.origen}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="3c02742d-db27-4608-82c1-e6a842310574" x="498" y="22" width="140" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$R{label.destino}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="2f0a3804-fefe-46fd-827d-e777bb23412b" x="642" y="22" width="160" height="20"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$R{label.valor}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="f3f4d85a-499f-4273-ac5f-e1e404f7a538" x="0" y="0" width="181" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$R{cabecalho.usuario} + " " + $F{nombUsuario}]]></textFieldExpression>
</textField>
</band>
</groupHeader>
<groupFooter>
<band height="31">
<line>
<reportElement uuid="c8dfd524-14cc-454c-afc0-3ce9f8d0ead8" positionType="Float" x="0" y="1" width="802" height="1"/>
</line>
<textField>
<reportElement uuid="38a0f957-1b50-46f9-b79f-c631baf8937b" x="516" y="2" width="205" height="20"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$R{label.total}]]></textFieldExpression>
</textField>
<textField pattern="¤ #,##0.00">
<reportElement uuid="d23d67e8-93ae-46ca-8f51-b90574818302" x="721" y="2" width="81" height="20"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$V{sumValor}]]></textFieldExpression>
</textField>
</band>
</groupFooter>
</group>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band height="81" splitType="Stretch">
<textField>
<reportElement uuid="43b2c28d-4760-4890-b00d-25e931e79c74" x="0" y="0" width="620" height="20"/>
<textElement markup="none">
<font size="14" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$R{cabecalho.nome}]]></textFieldExpression>
</textField>
<textField pattern="dd/MM/yyyy HH:mm">
<reportElement uuid="4d1bcd65-c9a6-44b4-8dca-cc3c4c20c9a5" x="638" y="0" width="164" height="20"/>
<textElement textAlignment="Right">
<font isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[new java.util.Date()]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="fd05bd35-30d9-4baf-aa56-f8e5d3c3268b" x="0" y="20" width="620" height="20"/>
<textElement>
<font isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$R{cabecalho.periodo} + " " + $P{fecInicio} + " " + $R{cabecalho.periodoA} + " " + $P{fecFinal}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="a91f6081-4740-4e36-8965-41b6cde4cc20" x="0" y="41" width="263" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$R{label.nombPuntoVenta} + ": " + $P{nombPuntoVenta}]]></textFieldExpression>
</textField>
</band>
</title>
<pageHeader>
<band height="21" splitType="Stretch">
<textField>
<reportElement uuid="6a8a0843-7236-40a3-98ae-5fbf59b4cfec" x="607" y="0" width="195" height="20"/>
<textElement textAlignment="Right">
<font isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$R{cabecalho.pagina} + " " + $V{PAGE_NUMBER}+ " " + $R{cabecalho.de} + " " + $V{PAGE_NUMBER}]]></textFieldExpression>
</textField>
</band>
</pageHeader>
<detail>
<band height="20" splitType="Stretch">
<textField>
<reportElement uuid="c6e24c5c-058d-4eab-8ceb-2ab9bd155da1" x="0" y="0" width="160" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{fecImpresion}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="eb9db181-e228-40df-ada1-10098ca99bfe" x="160" y="0" width="160" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{numFolioSistema}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="cc3db7ec-afda-474d-8e7e-5fb1ba1d499e" x="354" y="0" width="140" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{origen}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="1d2ad720-6a25-43fa-9e41-9a9b6436c036" x="498" y="0" width="140" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{destino}]]></textFieldExpression>
</textField>
<textField pattern="¤ #,##0.00">
<reportElement uuid="a6133da6-d69f-4fca-863c-d71c870c8575" x="642" y="0" width="160" height="20"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$F{valor}]]></textFieldExpression>
</textField>
</band>
</detail>
<pageFooter>
<band splitType="Stretch"/>
</pageFooter>
<noData>
<band height="24">
<textField isBlankWhenNull="true">
<reportElement uuid="d7df66c6-4dc0-4f3b-88f4-b22094d29091" positionType="Float" x="0" y="0" width="555" height="20" isPrintWhenDetailOverflows="true"/>
<textElement verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$R{msg.noData}]]></textFieldExpression>
</textField>
</band>
</noData>
</jasperReport>

View File

@ -0,0 +1,72 @@
package com.rjconsultores.ventaboletos.relatorios.utilitarios;
import java.math.BigDecimal;
import java.util.Date;
public class RelatorioBaixasVendasInternetBean {
private Date fecImpresion;
private String numFolioSistema;
private String origen;
private String destino;
private BigDecimal valor;
private Integer usuarioId;
private String nombUsuario;
public Date getFecImpresion() {
return fecImpresion;
}
public void setFecImpresion(Date fecImpresion) {
this.fecImpresion = fecImpresion;
}
public String getNumFolioSistema() {
return numFolioSistema;
}
public void setNumFolioSistema(String numFolioSistema) {
this.numFolioSistema = numFolioSistema;
}
public String getOrigen() {
return origen;
}
public void setOrigen(String origen) {
this.origen = origen;
}
public String getDestino() {
return destino;
}
public void setDestino(String destino) {
this.destino = destino;
}
public BigDecimal getValor() {
return valor;
}
public void setValor(BigDecimal valor) {
this.valor = valor;
}
public Integer getUsuarioId() {
return usuarioId;
}
public void setUsuarioId(Integer usuarioId) {
this.usuarioId = usuarioId;
}
public String getNombUsuario() {
return nombUsuario;
}
public void setNombUsuario(String nombUsuario) {
this.nombUsuario = nombUsuario;
}
}

View File

@ -0,0 +1,46 @@
package com.rjconsultores.ventaboletos.web.gui.controladores.relatorios;
import java.util.HashMap;
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.event.Event;
import org.zkoss.zul.Datebox;
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
import com.rjconsultores.ventaboletos.relatorios.impl.RelatorioBaixasVendasInternet;
import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxPuntoVenta;
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
@Controller("relatorioBaixasVendasInternetController")
@Scope("prototype")
public class RelatorioBaixasVendasInternetController extends MyGenericForwardComposer {
private static final long serialVersionUID = 722641825753640276L;
private Datebox fecInicio;
private Datebox fecFinal;
private MyComboboxPuntoVenta cmbPuntoVenta;
@Autowired
private DataSource dataSourceRead;
public void onClick$btnExecutarRelatorio(Event ev) throws Exception {
PuntoVenta puntoVenta = (PuntoVenta) cmbPuntoVenta.getSelectedItem().getValue();
RelatorioBaixasVendasInternet relatorio = new RelatorioBaixasVendasInternet(dataSourceRead.getConnection(), fecInicio.getValue(), fecFinal.getValue(), puntoVenta);
Map<String, Object> args = new HashMap<String, Object>();
args.put("relatorio", relatorio);
openWindow("/component/reportView.zul",
Labels.getLabel("indexController.mniRelatorioBaixasVendasInternet.label"), args, MODAL);
}
}

View File

@ -0,0 +1,25 @@
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;
public class ItemMenuRelatorioBaixasVendasInternet extends DefaultItemMenuSistema {
public ItemMenuRelatorioBaixasVendasInternet() {
super("indexController.mniRelatorioBaixasVendasInternet.label");
}
@Override
public String getClaveMenu() {
return "COM.RJCONSULTORES.ADMINISTRACION.GUI.RELATORIOS.MENU.RELATORIOBAIXASVENDASINTERNET";
}
@Override
public void ejecutar() {
PantallaUtileria.openWindow("/gui/relatorios/filtroRelatorioBaixasVendasInternet.zul",
Labels.getLabel("relatorioBaixasVendasInternetController.window.title"), getArgs(), desktop);
}
}

View File

@ -0,0 +1,45 @@
<?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="winFiltroRelatorioBaixasVendasInternet"?>
<?taglib uri="http://www.zkoss.org/dsp/web/core" prefix="c"?>
<zk xmlns="http://www.zkoss.org/2005/zul">
<window id="winFiltroRelatorioBaixasVendasInternet"
apply="${relatorioBaixasVendasInternetController}"
contentStyle="overflow:auto" width="700px" border="normal">
<grid fixedLayout="true">
<columns>
<column width="15%" />
<column width="35%" />
<column width="15%" />
<column width="35%" />
</columns>
<rows>
<row>
<label
value="${c:l('relatorioBaixasVendasInternetController.lbFecInicio.value')}" />
<datebox id="fecInicio" width="100%" mold="rounded"
format="dd/MM/yyyy" constraint="no empty"
maxlength="10" />
<label
value="${c:l('relatorioBaixasVendasInternetController.lbFecFinal.value')}" />
<datebox id="fecFinal" width="100%" mold="rounded"
format="dd/MM/yyyy" constraint="no empty"
maxlength="10" />
</row>
<row>
<label
value="${c:l('relatorioBaixasVendasInternetController.lbPuntoVenta.value')}" />
<combobox id="cmbPuntoVenta" use="com.rjconsultores.ventaboletos.web.utilerias.MyComboboxPuntoVenta"
mold="rounded" buttonVisible="true" width="80%" constraint="no empty" />
</row>
</rows>
</grid>
<toolbar>
<button id="btnExecutarRelatorio" image="/gui/img/find.png"
label="${c:l('relatorio.lb.btnExecutarRelatorio')}" />
</toolbar>
</window>
</zk>