0013650: Chamado 66819 - Relatório de Requisição (Ordem de Serviço)

fixes bug#13650
dev:Wallace
qua:Juliane

git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@90293 d1611594-4594-4d17-8e1d-87c2c4800839
master
fabricio.oliveira 2019-02-26 21:57:12 +00:00
parent 5a6d89359d
commit f3da960152
12 changed files with 758 additions and 0 deletions

View File

@ -0,0 +1,188 @@
package com.rjconsultores.ventaboletos.relatorios.impl;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
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.RelatorioVendasConexaoBean;
import com.rjconsultores.ventaboletos.relatorios.utilitarios.RelatorioVendasRequisicaoBean;
import com.rjconsultores.ventaboletos.web.utilerias.NamedParameterStatement;
import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource;
public class RelatorioVendasRequisicao extends Relatorio {
private static Logger log = Logger.getLogger(RelatorioVendasRequisicao.class);
private List<RelatorioVendasRequisicaoBean> lsDadosRelatorio;
private Timestamp fecInicio;
private Timestamp fecFinal;
private Integer empresaId;
private Integer puntoventaId;
public RelatorioVendasRequisicao(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 = (Timestamp) parametros.get("dataFiltroInicial");
fecFinal = (Timestamp) parametros.get("dataFiltroFinal");
if(parametros.get("EMPRESA_ID")!=null){
empresaId = Integer.valueOf(parametros.get("EMPRESA_ID").toString());
}
if(parametros.get("PUNTOVENTA_ID")!=null){
puntoventaId = Integer.valueOf(parametros.get("PUNTOVENTA_ID").toString());
}
Connection conexao = this.relatorio.getConexao();
processarVendasRequisicao(conexao);
setCollectionDataSource(new JRBeanCollectionDataSource(lsDadosRelatorio));
}
});
}
private void processarVendasRequisicao(Connection conexao) {
ResultSet rset = null;
NamedParameterStatement stmt = null;
try {
stmt = carregarNamedParameterStatement(conexao);
rset = stmt.executeQuery();
processarResultado(rset);
fecharConexaoBanco(conexao, stmt, rset);
} catch (Exception e) {
log.error(e.getMessage(), e);
}
}
private void fecharConexaoBanco(Connection conexao, NamedParameterStatement stmt, ResultSet rset) {
try {
if(rset != null && !rset.isClosed()) {
rset.close();
}
if(stmt != null && !stmt.isClosed()) {
stmt.close();
}
if(conexao != null && !conexao.isClosed()) {
conexao.close();
}
} catch (SQLException e) {
log.error(e.getMessage(), e);
}
}
private void processarResultado(ResultSet rset) throws SQLException {
if(lsDadosRelatorio == null) {
lsDadosRelatorio = new ArrayList<RelatorioVendasRequisicaoBean>();
}
while (rset.next()) {
RelatorioVendasRequisicaoBean bean = new RelatorioVendasRequisicaoBean();
bean.setNumdocumento(rset.getString("REQUISICAO"));
bean.setSecretariaId(rset.getInt("SECRETARIA_ID"));
bean.setDescsecretaria(rset.getString("DESCSECRETARIA"));
bean.setPuntoventaId(rset.getInt("PUNTOVENTA_ID"));
bean.setNombpuntoventa(rset.getString("NOMBPUNTOVENTA"));
bean.setNombempresa(rset.getString("NOMBEMPRESA"));
bean.setEmpresaId(rset.getInt("EMPRESA_ID"));
bean.setOrigemId(rset.getString("ORIGEM_ID"));
bean.setOrigem(rset.getString("ORIGEM"));
bean.setDestinoId(rset.getString("DESTINO_ID"));
bean.setDestino(rset.getString("DESTINO"));
bean.setImporte(rset.getBigDecimal("IMPORTE"));
bean.setQtde(rset.getInt("QTDE"));
lsDadosRelatorio.add(bean);
}
}
private NamedParameterStatement carregarNamedParameterStatement(Connection conexao) throws SQLException {
String sql = getSql();
log.info(sql);
NamedParameterStatement stmt = new NamedParameterStatement(conexao, sql);
if(fecInicio != null) {
stmt.setTimestamp("fecInicio", fecInicio);
}
if(fecFinal != null) {
stmt.setTimestamp("fecFinal", fecFinal);
}
if(empresaId != null) {
stmt.setInt("EMPRESA_ID", empresaId);
}
if(puntoventaId != null && puntoventaId > -1) {
stmt.setInt("PUNTOVENTA_ID", puntoventaId);
}
return stmt;
}
protected String getSql() {
StringBuilder sQuery = new StringBuilder();
sQuery.append("SELECT CDP.NUMDOCUMENTO AS REQUISICAO, SEC.SECRETARIA_ID AS SECRETARIA_ID, SEC.DESCSECRETARIA, ORI.CVEPARADA AS ORIGEM_ID, ORI.DESCPARADA AS ORIGEM, DES.CVEPARADA AS DESTINO_ID, DES.DESCPARADA AS DESTINO, PV.PUNTOVENTA_ID AS PUNTOVENTA_ID, PV.NOMBPUNTOVENTA, E.NOMBEMPRESA, E.EMPRESA_ID, FP.DESCPAGO AS DESCPAGO, CFP.FORMAPAGO_ID, COUNT(*) AS QTDE, SUM(CFP.IMPORTE) AS IMPORTE ")
.append("FROM CAJA C ")
.append("JOIN PARADA ORI ON ORI.PARADA_ID = C.ORIGEN_ID ")
.append("JOIN PARADA DES ON DES.PARADA_ID = C.DESTINO_ID ")
.append("JOIN CAJA_FORMAPAGO CFP ON CFP.CAJA_ID = C.CAJA_ID ")
.append("LEFT JOIN CAJA_DET_PAGO CDP ON CDP.CAJAFORMAPAGO_ID = CFP.CAJAFORMAPAGO_ID ")
.append("JOIN SECRETARIA SEC ON CDP.OPCIONAL1 = SEC.SECRETARIA_ID ")
.append("JOIN FORMA_PAGO FP ON FP.FORMAPAGO_ID = CFP.FORMAPAGO_ID ")
.append("JOIN MARCA M ON C.MARCA_ID = M.MARCA_ID ")
.append("JOIN EMPRESA E ON E.EMPRESA_ID = M.EMPRESA_ID ")
.append("JOIN PUNTO_VENTA PV ON PV.PUNTOVENTA_ID = C.PUNTOVENTA_ID ")
.append("WHERE FP.FORMAPAGO_ID = 11 ");
if(fecInicio != null) {
sQuery.append("AND NVL(C.FECHORVENTA_H,C.FECHORVENTA) >= :fecInicio ");
}
if(fecFinal != null) {
sQuery.append("AND NVL(C.FECHORVENTA_H,C.FECHORVENTA) <= :fecFinal ");
}
if(empresaId != null) {
sQuery.append("AND E.EMPRESA_ID = :EMPRESA_ID ");
}
if(puntoventaId != null && puntoventaId > -1) {
sQuery.append("AND C.PUNTOVENTA_ID = :PUNTOVENTA_ID ");
}
sQuery.append("GROUP BY CDP.NUMDOCUMENTO, SEC.SECRETARIA_ID, SEC.DESCSECRETARIA,PV.NOMBPUNTOVENTA, PV.NOMBPUNTOVENTA, E.NOMBEMPRESA, E.EMPRESA_ID, FP.DESCPAGO, CFP.FORMAPAGO_ID, ORI.DESCPARADA, DES.DESCPARADA, CFP.IMPORTE, ORI.CVEPARADA, DES.CVEPARADA, PV.PUNTOVENTA_ID ")
.append("ORDER BY SEC.DESCSECRETARIA, PV.NOMBPUNTOVENTA, FP.DESCPAGO");
return sQuery.toString();
}
@Override
protected void processaParametros() throws Exception {
}
public List<RelatorioVendasRequisicaoBean> getLsDadosRelatorio() {
return lsDadosRelatorio;
}
@Override
public String getNome() {
return super.getNome();
}
}

View File

@ -0,0 +1,18 @@
#geral
msg.noData=Não foi possivel obter dados com os parâmetros informados.
#Labels cabeçalho
cabecalho.nome=Relatório Vendas Requisiçã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=Agência
label.total=Total
label.puntoVenta=Agência:
label.diferenca=Diferença

View File

@ -0,0 +1,18 @@
#geral
msg.noData=Não foi possivel obter dados com os parâmetros informados.
#Labels cabeçalho
cabecalho.nome=Relatório Vendas Requisiçã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=Agência
label.total=Total
label.puntoVenta=Agência:
label.diferenca=Diferença

View File

@ -0,0 +1,232 @@
<?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="RelatorioVendasRequisicao" 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="1.5"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<style name="Crosstab Data Text" hAlign="Center"/>
<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="puntoventa" class="java.lang.String"/>
<queryString>
<![CDATA[]]>
</queryString>
<field name="nombpuntoventa" class="java.lang.String"/>
<field name="nombempresa" class="java.lang.String"/>
<field name="importe" class="java.math.BigDecimal"/>
<field name="origem" class="java.lang.String"/>
<field name="destino" class="java.lang.String"/>
<field name="qtde" class="java.lang.Integer"/>
<field name="origemId" class="java.lang.String"/>
<field name="destinoId" class="java.lang.String"/>
<field name="puntoventaId" class="java.lang.Integer"/>
<field name="secretariaId" class="java.lang.Integer"/>
<field name="descsecretaria" class="java.lang.String"/>
<field name="numdocumento" class="java.lang.String"/>
<variable name="importe_1" class="java.math.BigDecimal" resetType="Group" resetGroup="secretariagroup" calculation="Sum">
<variableExpression><![CDATA[$F{importe}]]></variableExpression>
</variable>
<variable name="qtde" class="java.lang.String"/>
<variable name="qtde_1" class="java.lang.Integer" resetType="Group" resetGroup="secretariagroup" calculation="Sum">
<variableExpression><![CDATA[$F{qtde}]]></variableExpression>
</variable>
<variable name="qtdeTotal" class="java.lang.Integer" calculation="Sum">
<variableExpression><![CDATA[$F{qtde}]]></variableExpression>
</variable>
<variable name="importeTotal" class="java.math.BigDecimal" calculation="Sum">
<variableExpression><![CDATA[$F{importe}]]></variableExpression>
</variable>
<group name="secretariagroup">
<groupExpression><![CDATA[$F{descsecretaria}]]></groupExpression>
<groupHeader>
<band height="40">
<staticText>
<reportElement x="200" y="20" width="210" height="20" uuid="4ab9b047-7e05-40dd-a764-6d4c2f5a9387"/>
<textElement>
<font isBold="true"/>
</textElement>
<text><![CDATA[Origem]]></text>
</staticText>
<textField>
<reportElement x="53" y="0" width="234" height="20" uuid="8fc0dadc-9470-4614-9ed8-588df8f619a5"/>
<textFieldExpression><![CDATA[$F{secretariaId}+" - "+$F{descsecretaria}]]></textFieldExpression>
</textField>
<staticText>
<reportElement x="410" y="20" width="210" height="20" uuid="3a02ce7f-5b2e-415f-a9b9-d744f1c2d3aa"/>
<textElement>
<font isBold="true"/>
</textElement>
<text><![CDATA[Destino]]></text>
</staticText>
<staticText>
<reportElement x="702" y="20" width="100" height="20" uuid="8b2b4d01-a0ed-474d-a721-d2eabbcb5af7"/>
<textElement>
<font isBold="true"/>
</textElement>
<text><![CDATA[Total]]></text>
</staticText>
<staticText>
<reportElement x="620" y="20" width="82" height="20" uuid="86d422e2-4c74-4304-9275-43cf0b9c99bb"/>
<textElement textAlignment="Center">
<font isBold="true"/>
</textElement>
<text><![CDATA[QTDE]]></text>
</staticText>
<staticText>
<reportElement x="0" y="0" width="53" height="20" uuid="17a00e66-3046-44ae-829b-be9d6a6c7cc7"/>
<textElement>
<font isBold="true"/>
</textElement>
<text><![CDATA[CLIENTE:]]></text>
</staticText>
<staticText>
<reportElement x="0" y="20" width="190" height="20" uuid="f7d62619-9506-4382-af1a-aad3081a2ba1"/>
<textElement textAlignment="Right">
<font isBold="true"/>
</textElement>
<text><![CDATA[Req]]></text>
</staticText>
</band>
</groupHeader>
<groupFooter>
<band height="32">
<textField>
<reportElement x="702" y="10" width="100" height="20" uuid="3a5276ac-d393-4a51-b60a-28f8105643d5"/>
<textFieldExpression><![CDATA[$V{importe_1}]]></textFieldExpression>
</textField>
<staticText>
<reportElement x="520" y="10" width="100" height="20" uuid="ab651bcd-8815-40b4-843d-3c675ae94009"/>
<textElement textAlignment="Right">
<font isBold="true"/>
</textElement>
<text><![CDATA[Subtotal:]]></text>
</staticText>
<textField>
<reportElement x="620" y="10" width="82" height="20" uuid="e1424ee9-fbe0-4d10-8153-ac0f5ff0a04b"/>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[$V{qtde_1}]]></textFieldExpression>
</textField>
</band>
</groupFooter>
</group>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band height="78" splitType="Stretch">
<textField>
<reportElement x="0" y="0" width="620" height="20" uuid="43b2c28d-4760-4890-b00d-25e931e79c74"/>
<textElement markup="none">
<font size="14" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$R{cabecalho.nome}]]></textFieldExpression>
</textField>
<textField pattern="dd/MM/yyyy HH:mm">
<reportElement x="638" 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="19" width="620" height="20" uuid="fd05bd35-30d9-4baf-aa56-f8e5d3c3268b"/>
<textElement>
<font isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$R{cabecalho.periodo} + " " + $P{fecInicio} + " " + $R{cabecalho.periodoA} + " " + $P{fecFinal}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="53" y="38" width="748" height="20" uuid="8fa1c53b-1da7-4d4d-a75c-ab1543acae2a"/>
<textFieldExpression><![CDATA[$P{empresa}]]></textFieldExpression>
</textField>
<staticText>
<reportElement x="0" y="38" width="53" height="20" uuid="a91f6081-4740-4e36-8965-41b6cde4cc20"/>
<text><![CDATA[Empresa:]]></text>
</staticText>
<textField>
<reportElement x="0" y="57" width="53" height="20" uuid="1a29d731-e121-4507-8c0b-e93f437e8d80"/>
<textFieldExpression><![CDATA[$R{label.puntoVenta}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="53" y="57" width="748" height="20" uuid="53d53aa5-d8c9-43c6-b17d-1e6b49697237"/>
<textFieldExpression><![CDATA[$P{puntoventa}]]></textFieldExpression>
</textField>
<line>
<reportElement x="0" y="76" width="801" height="1" uuid="3a4eed21-70b4-44c0-8d34-8c53d44de3cf"/>
</line>
</band>
</title>
<pageHeader>
<band height="22">
<textField>
<reportElement x="606" y="1" width="195" height="20" uuid="701a95fd-2c75-40c1-bb18-0e784375e289"/>
<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">
<textField>
<reportElement x="200" y="0" width="210" height="20" uuid="dcb220b3-2b02-4aa7-9e22-c458a53c7be6"/>
<textFieldExpression><![CDATA[$F{origemId}+" - "+$F{origem}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="410" y="0" width="210" height="20" uuid="4f8b2848-6c67-468e-ae96-2a77fa2ffa1f"/>
<textFieldExpression><![CDATA[$F{destinoId}+" - "+$F{destino}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="702" y="0" width="100" height="20" uuid="a373f36c-db6b-4e0f-8351-871d8533f8ec"/>
<textFieldExpression><![CDATA[$F{importe}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="620" y="0" width="82" height="20" uuid="26fb8d06-0109-4496-8428-c300d86b9c74"/>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[$F{qtde}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true">
<reportElement x="0" y="0" width="190" height="20" uuid="f7684292-b49a-4dd3-91be-f216173bb2ef"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$F{numdocumento}]]></textFieldExpression>
</textField>
</band>
</detail>
<columnFooter>
<band splitType="Stretch"/>
</columnFooter>
<summary>
<band height="50">
<textField>
<reportElement x="620" y="19" width="82" height="20" uuid="05274e36-60ad-4390-9f27-3d06d96eb168"/>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[$V{qtdeTotal}]]></textFieldExpression>
</textField>
<staticText>
<reportElement x="520" y="19" width="100" height="20" uuid="ba76f4f2-00f1-4bef-aeef-823589ad8b5b"/>
<textElement textAlignment="Right">
<font isBold="true"/>
</textElement>
<text><![CDATA[TOTAL:]]></text>
</staticText>
<textField>
<reportElement x="702" y="19" width="100" height="20" uuid="36067a9c-e8b0-4f38-808a-0469b3a38d51"/>
<textFieldExpression><![CDATA[$V{importeTotal}]]></textFieldExpression>
</textField>
<line>
<reportElement x="10" y="10" width="801" height="1" uuid="add1375c-df33-44b5-a5e7-fc894b024bc2"/>
</line>
</band>
</summary>
<noData>
<band height="20">
<textField isBlankWhenNull="true">
<reportElement positionType="Float" x="0" y="0" width="555" height="20" isPrintWhenDetailOverflows="true" uuid="d7df66c6-4dc0-4f3b-88f4-b22094d29091"/>
<textElement verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$R{msg.noData}]]></textFieldExpression>
</textField>
</band>
</noData>
</jasperReport>

View File

@ -0,0 +1,100 @@
package com.rjconsultores.ventaboletos.relatorios.utilitarios;
import java.math.BigDecimal;
public class RelatorioVendasRequisicaoBean {
private String numdocumento;
private Integer secretariaId;
private String descsecretaria;
private Integer puntoventaId;
private String nombpuntoventa;
private String nombempresa;
private String origemId;
private String origem;
private String destinoId;
private String destino;
private Integer empresaId;
private BigDecimal importe;
private Integer qtde;
public String getNumdocumento() {
return numdocumento;
}
public void setNumdocumento(String numdocumento) {
this.numdocumento = numdocumento;
}
public Integer getSecretariaId() {
return secretariaId;
}
public void setSecretariaId(Integer secretariaId) {
this.secretariaId = secretariaId;
}
public String getDescsecretaria() {
return descsecretaria;
}
public void setDescsecretaria(String descsecretaria) {
this.descsecretaria = descsecretaria;
}
public Integer getPuntoventaId() {
return puntoventaId;
}
public void setPuntoventaId(Integer puntoventaId) {
this.puntoventaId = puntoventaId;
}
public String getNombpuntoventa() {
return nombpuntoventa;
}
public void setNombpuntoventa(String nombpuntoventa) {
this.nombpuntoventa = nombpuntoventa;
}
public String getNombempresa() {
return nombempresa;
}
public void setNombempresa(String nombempresa) {
this.nombempresa = nombempresa;
}
public String getOrigemId() {
return origemId;
}
public void setOrigemId(String origemId) {
this.origemId = origemId;
}
public String getOrigem() {
return origem;
}
public void setOrigem(String origem) {
this.origem = origem;
}
public String getDestinoId() {
return destinoId;
}
public void setDestinoId(String destinoId) {
this.destinoId = destinoId;
}
public String getDestino() {
return destino;
}
public void setDestino(String destino) {
this.destino = destino;
}
public Integer getEmpresaId() {
return empresaId;
}
public void setEmpresaId(Integer empresaId) {
this.empresaId = empresaId;
}
public BigDecimal getImporte() {
return importe;
}
public void setImporte(BigDecimal importe) {
this.importe = importe;
}
public Integer getQtde() {
return qtde;
}
public void setQtde(Integer qtde) {
this.qtde = qtde;
}
}

View File

@ -0,0 +1,116 @@
package com.rjconsultores.ventaboletos.web.gui.controladores.relatorios;
import java.sql.SQLException;
import java.sql.Timestamp;
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.entidad.PuntoVenta;
import com.rjconsultores.ventaboletos.relatorios.impl.RelatorioVendasConexao;
import com.rjconsultores.ventaboletos.relatorios.impl.RelatorioVendasRequisicao;
import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio;
import com.rjconsultores.ventaboletos.utilerias.DateUtil;
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEstandar;
import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxPuntoVenta;
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
@Controller("relatorioVendasRequisicaoController")
@Scope("prototype")
public class RelatorioVendasRequisicaoController extends MyGenericForwardComposer {
private static final long serialVersionUID = 1L;
@Autowired
private DataSource dataSourceRead;
private MyComboboxEstandar cmbEmpresa;
private List<Empresa> lsEmpresa;
private Datebox dataInicial;
private Datebox dataFinal;
private MyComboboxPuntoVenta cmbPuntoVenta;
@Override
public void doAfterCompose(Component comp) throws Exception {
super.doAfterCompose(comp);
this.lsEmpresa = UsuarioLogado.getUsuarioLogado().getEmpresa();
}
public void onClick$btnExecutarRelatorio(Event ev) throws Exception {
excutarRelatorios();
}
public void excutarRelatorios() throws SQLException, Exception {
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
Date dataDe = dataInicial.getValue();
Date dataAte = dataFinal.getValue();
Timestamp fecVentaInicial = new Timestamp(DateUtil.inicioFecha(dataDe).getTime());
Timestamp fecVentaFinal = new Timestamp(DateUtil.fimFecha(dataAte).getTime());
Map<String, Object> parametros = new HashMap<String, Object>();
parametros.put("fecInicio", sdf.format(dataDe));
parametros.put("fecFinal", sdf.format(dataAte));
parametros.put("dataFiltroInicial", fecVentaInicial);
parametros.put("dataFiltroFinal", fecVentaFinal);
Comboitem itemEmpresa = cmbEmpresa.getSelectedItem();
if (itemEmpresa != null) {
Empresa empresa = (Empresa) itemEmpresa.getValue();
parametros.put("EMPRESA_ID", empresa.getEmpresaId());
parametros.put("empresa", empresa.getNombempresa());
} else {
parametros.put("empresa", "Todas;");
}
Comboitem itemPuntoventa = cmbPuntoVenta.getSelectedItem();
if(itemPuntoventa != null) {
PuntoVenta puntoVenta = (PuntoVenta) itemPuntoventa.getValue();
if(puntoVenta.getPuntoventaId() > -1) {
parametros.put("PUNTOVENTA_ID", puntoVenta.getPuntoventaId());
parametros.put("puntoventa", puntoVenta.getNombpuntoventa());
} else {
parametros.put("puntoventa", "Todas;");
}
} else {
parametros.put("puntoventa", "Todas;");
}
Map<String, Object> args = new HashMap<String, Object>();
Relatorio relatorio = new RelatorioVendasRequisicao(parametros, dataSourceRead.getConnection());
args.put("relatorio", relatorio);
openWindow("/component/reportView.zul",
Labels.getLabel("indexController.mniRelatorioVendasRequisicao.label"), args, MODAL);
}
public List<Empresa> getLsEmpresa() {
return lsEmpresa;
}
public void setLsEmpresa(List<Empresa> lsEmpresa) {
this.lsEmpresa = lsEmpresa;
}
}

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 ItemMenuRelatorioVendasRequisicao extends DefaultItemMenuSistema {
public ItemMenuRelatorioVendasRequisicao() {
super("indexController.mniRelatorioVendasRequisicao.label");
}
@Override
public String getClaveMenu() {
return "COM.RJCONSULTORES.ADMINISTRACION.GUI.RELATORIOS.MENU.RELATORIOVENDASREQUISICAO";
}
@Override
public void ejecutar() {
PantallaUtileria.openWindow("/gui/relatorios/filtroRelatorioVendasRequisicao.zul",
Labels.getLabel("indexController.mniRelatorioVendasRequisicao.label"), getArgs(), desktop);
}
}

View File

@ -196,6 +196,7 @@ analitico.gerenciais.financeiro.relatorioServicoBloqueadoVendaInternet=com.rjcon
analitico.gerenciais.financeiro.relatorioDocumentosFiscais=com.rjconsultores.ventaboletos.web.utilerias.menu.item.relatorios.ItemMenuRelatorioDocumentosFiscais
analitico.gerenciais.financeiro.relatorioVendasPercurso=com.rjconsultores.ventaboletos.web.utilerias.menu.item.relatorios.ItemMenuRelatorioVendasPercurso
analitico.gerenciais.financeiro.vendasConexao=com.rjconsultores.ventaboletos.web.utilerias.menu.item.relatorios.ItemMenuRelatorioVendasConexao
analitico.gerenciais.financeiro.vendasRequisicao=com.rjconsultores.ventaboletos.web.utilerias.menu.item.relatorios.ItemMenuRelatorioVendasRequisicao
analitico.gerenciais.pacote=com.rjconsultores.ventaboletos.web.utilerias.menu.item.analitico.gerenciais.pacote.SubMenuRelatorioPacote
analitico.gerenciais.pacote.boletos=com.rjconsultores.ventaboletos.web.utilerias.menu.item.relatorios.ItemMenuRelatorioVendasPacotesBoletos
analitico.gerenciais.pacote.detalhado=com.rjconsultores.ventaboletos.web.utilerias.menu.item.relatorios.ItemMenuRelatorioVendasPacotesDetalhado

View File

@ -315,6 +315,7 @@ indexController.mniRelatorioImpressaoPosterior.label=Impresión posterior
indexController.mniRelatorioServicoBloqueadoVendaInternet.label = Corrida bloqueada en venta internet
indexController.mniRelatorioDocumentosFiscais.label = Report Documentos Fiscais
indexController.mniRelatorioVendasConexao.label = Reporte Ventas Conexion
indexController.mniRelatorioVendasRequisicao.label = Relatório Vendas Requisição(Ordem de Serviço)
indexController.mniRelatorioHistoricoCompras.label = Reporte Histórico de Compras
indexController.mniRelatorioPosicaoVendaBilheteIdoso.label = Reporte Posición de Venta del Billete Anciano

View File

@ -328,6 +328,7 @@ indexController.mniRelatorioImpressaoPosterior.label=Impressão Posterior
indexController.mniRelatorioServicoBloqueadoVendaInternet.label = Serviço Bloqueado na Venda Internet
indexController.mniRelatorioDocumentosFiscais.label = Relatório Documentos Fiscais
indexController.mniRelatorioVendasConexao.label = Relatório Vendas de Conexão
indexController.mniRelatorioVendasRequisicao.label = Relatório Vendas Requisição(Ordem de Serviço)
indexController.mniRelatorioHistoricoCompras.label = Relatório Histórico de Compras
indexController.mniRelatorioPosicaoVendaBilheteIdoso.label = Relatório Posição de Venda do Bilhete Idoso

View File

@ -0,0 +1,58 @@
<?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="winFiltroRelatorioVendasRequisicao"?>
<?taglib uri="http://www.zkoss.org/dsp/web/core" prefix="c"?>
<zk xmlns="http://www.zkoss.org/2005/zul">
<window id="winFiltroRelatorioVendasRequisicao"
apply="${relatorioVendasRequisicaoController}"
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('lb.empresa')}" />
<combobox id="cmbEmpresa"
buttonVisible="true"
use="com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEstandar"
model="@{winFiltroRelatorioVendasRequisicao$composer.lsEmpresa}"
width="95%"
mold="rounded"
constraint="no empty" />
<label
value="${c:l('lb.puntoventa')}" />
<combobox id="cmbPuntoVenta"
use="com.rjconsultores.ventaboletos.web.utilerias.MyComboboxPuntoVenta"
mold="rounded" buttonVisible="true" width="90%"
constraint="no empty" />
</row>
<row>
<label
value="${c:l('lb.dataIni.value')}" />
<datebox id="dataInicial" width="100%" mold="rounded"
format="dd/MM/yyyy" constraint="no empty"
maxlength="10" />
<label
value="${c:l('lb.dataFin.value')}" />
<datebox id="dataFinal" width="100%" mold="rounded"
format="dd/MM/yyyy" constraint="no empty"
maxlength="10" />
</row>
</rows>
</grid>
<toolbar>
<button id="btnExecutarRelatorio" image="/gui/img/enginer.png"
label="${c:l('relatorio.lb.btnExecutarRelatorio')}" />
</toolbar>
</window>
</zk>