diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioBaixasVendasInternet.java b/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioBaixasVendasInternet.java new file mode 100644 index 000000000..18efa7f52 --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioBaixasVendasInternet.java @@ -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(), 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 resultBean = transformResultSet(resultSet); + setCollectionDataSource(new JRBeanCollectionDataSource(resultBean)); + + } + + private List transformResultSet(ResultSet resultSet) throws SQLException { + List resultBean = new ArrayList(); + 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; + + } + +} \ No newline at end of file diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioBaixasVendasInternet_es.properties b/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioBaixasVendasInternet_es.properties new file mode 100644 index 000000000..51bff3371 --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioBaixasVendasInternet_es.properties @@ -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 \ No newline at end of file diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioBaixasVendasInternet_pt_BR.properties b/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioBaixasVendasInternet_pt_BR.properties new file mode 100644 index 000000000..c14d9b1ea --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioBaixasVendasInternet_pt_BR.properties @@ -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 \ No newline at end of file diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioBaixasVendasInternet.jasper b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioBaixasVendasInternet.jasper new file mode 100644 index 000000000..cb5724907 Binary files /dev/null and b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioBaixasVendasInternet.jasper differ diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioBaixasVendasInternet.jrxml b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioBaixasVendasInternet.jrxml new file mode 100644 index 000000000..3c0687792 --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioBaixasVendasInternet.jrxml @@ -0,0 +1,166 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <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> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/utilitarios/RelatorioBaixasVendasInternetBean.java b/src/java/com/rjconsultores/ventaboletos/relatorios/utilitarios/RelatorioBaixasVendasInternetBean.java new file mode 100644 index 000000000..f62c9d546 --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/utilitarios/RelatorioBaixasVendasInternetBean.java @@ -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; + } + +} diff --git a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioBaixasVendasInternetController.java b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioBaixasVendasInternetController.java new file mode 100644 index 000000000..318671e4d --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioBaixasVendasInternetController.java @@ -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 args = new HashMap(); + args.put("relatorio", relatorio); + + openWindow("/component/reportView.zul", + Labels.getLabel("indexController.mniRelatorioBaixasVendasInternet.label"), args, MODAL); + + } + +} \ No newline at end of file diff --git a/src/java/com/rjconsultores/ventaboletos/web/utilerias/menu/item/relatorios/ItemMenuRelatorioBaixasVendasInternet.java b/src/java/com/rjconsultores/ventaboletos/web/utilerias/menu/item/relatorios/ItemMenuRelatorioBaixasVendasInternet.java new file mode 100644 index 000000000..cd9977006 --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/web/utilerias/menu/item/relatorios/ItemMenuRelatorioBaixasVendasInternet.java @@ -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); + + } +} diff --git a/web/gui/relatorios/filtroRelatorioBaixasVendasInternet.zul b/web/gui/relatorios/filtroRelatorioBaixasVendasInternet.zul new file mode 100644 index 000000000..9c538dfc9 --- /dev/null +++ b/web/gui/relatorios/filtroRelatorioBaixasVendasInternet.zul @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + +