diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioServicoBloqueadoVendaInternet.java b/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioServicoBloqueadoVendaInternet.java new file mode 100644 index 000000000..68285e707 --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioServicoBloqueadoVendaInternet.java @@ -0,0 +1,105 @@ + +package com.rjconsultores.ventaboletos.relatorios.impl; + +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Map; + +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.relatorios.utilitarios.DataSource; +import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio; +import com.rjconsultores.ventaboletos.relatorios.utilitarios.RelatorioServicoBloqueadoVendaInternetBean; +import com.rjconsultores.ventaboletos.web.utilerias.NamedParameterStatement; + +import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource; + +public class RelatorioServicoBloqueadoVendaInternet extends Relatorio { + + public RelatorioServicoBloqueadoVendaInternet(Map parametros, Connection conexao) { + super(parametros, conexao); + + } + + private List lsDadosRelatorio; + + @Override + protected void processaParametros() throws Exception { + + this.setCustomDataSource(new DataSource(this) { + @Override + public void initDados() throws Exception { + + Connection conexao = this.relatorio.getConexao(); + + Map parametros = this.relatorio.getParametros(); + Empresa empresa = (Empresa) parametros.get("EMPRESA"); + + String sql = getSql(empresa); + + NamedParameterStatement stmt = new NamedParameterStatement(conexao, sql); + + stmt.setTimestamp("DATA_INICIAL", (Timestamp) parametros.get("DATA_INICIAL")); + stmt.setTimestamp("DATA_FINAL", (Timestamp) parametros.get("DATA_FINAL")); + + ResultSet rset = null; + rset = stmt.executeQuery(); + + lsDadosRelatorio = new ArrayList(); + + while (rset.next()) { + + RelatorioServicoBloqueadoVendaInternetBean bean = new RelatorioServicoBloqueadoVendaInternetBean(); + + bean.setCodOrigem((Integer) Integer.parseInt(rset.getObject("codOrigem").toString())); + bean.setCodDestino((Integer) Integer.parseInt(rset.getObject("codDestino").toString())); + bean.setDescOrigem((String) rset.getObject("descOrigem")); + bean.setDescDestino((String) rset.getObject("descDestino")); + bean.setServico((String) rset.getObject("servico").toString()); + bean.setHoraViagem((String) rset.getObject("horaViagem")); + bean.setDataServico((Date) rset.getObject("dataServico")); + + lsDadosRelatorio.add(bean); + } + + if (lsDadosRelatorio.size() > 0) { + + setLsDadosRelatorio(lsDadosRelatorio); + } + } + }); + } + + public void setLsDadosRelatorio(List lsDadosRelatorio) { + this.setCollectionDataSource(new JRBeanCollectionDataSource(lsDadosRelatorio)); + this.lsDadosRelatorio = lsDadosRelatorio; + } + + private String getSql(Empresa empresa) { + + StringBuilder sql = new StringBuilder(); + + sql.append("SELECT C.CORRIDA_ID AS servico, "); + sql.append(" CRC.ORIGEN_ID AS codOrigem, "); + sql.append(" CRC.DESTINO_ID AS codDestino, "); + sql.append(" PO.DESCPARADA AS descOrigem, "); + sql.append(" PD.DESCPARADA AS descDestino, "); + sql.append(" TO_DATE(C.FECCORRIDA,'dd/MM/yy') AS dataServico, "); + sql.append(" TO_CHAR(C.FECHORSALIDA, 'HH24:MI:SS') AS horaViagem "); + sql.append("FROM CONF_RESTRICAO_CANALVENTA CRC "); + sql.append("INNER JOIN PARADA PO ON PO.PARADA_ID = CRC.ORIGEN_ID "); + sql.append("INNER JOIN PARADA PD ON PD.PARADA_ID = CRC.DESTINO_ID "); + sql.append("INNER JOIN CORRIDA C ON CRC.CORRIDA_ID = C.CORRIDA_ID "); + sql.append("WHERE CRC.CORRIDA_ID = 2520283 "); + sql.append(" AND CRC.TIPOPTOVTA_ID = 2 "); + sql.append("AND C.FECCORRIDA BETWEEN :DATA_INICIAL AND :DATA_FINAL "); + sql.append("AND CRC.EMPRESA_ID =" + empresa.getEmpresaId() + " "); + sql.append("AND C.ACTIVO = 1 "); + + return sql.toString(); + } + +} diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioServicoBloqueadoVendaInternet_es.properties b/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioServicoBloqueadoVendaInternet_es.properties new file mode 100644 index 000000000..9f195c817 --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioServicoBloqueadoVendaInternet_es.properties @@ -0,0 +1,23 @@ +#geral +msg.noData=Não foi possivel obter dados com os parâmetros informados. +#Labels cabeçalho +cabecalho.nome=Relatório Servicos Bloqueados na Venda 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.puntoventa=Agência: +cabecalho.usuario=Usuário: +label.servico=Serviço +label.horaViagem=Hora da Viagem +label.dataServico=Data Serviço +label.dataEmbarque=Data Embarque +label.bilhete=Bilhete +label.dataEmissao=Data Emissão +label.origem= Origem +label.destino=Destino +label.empresa=Empresa: diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioServicoBloqueadoVendaInternet_pt_BR.properties b/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioServicoBloqueadoVendaInternet_pt_BR.properties new file mode 100644 index 000000000..05969998a --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioServicoBloqueadoVendaInternet_pt_BR.properties @@ -0,0 +1,26 @@ +#geral +msg.noData=Não foi possivel obter dados com os parâmetros informados. + +#Labels cabeçalho +cabecalho.nome=Relatório Servicos Bloqueados na Venda 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.puntoventa=Agência: +cabecalho.usuario=Usuário: +label.servico=Serviço +label.horaViagem=Hora da Viagem +label.dataServico=Data Serviço +label.dataEmbarque=Data Embarque +label.bilhete=Bilhete +label.dataEmissao=Data Emissão +label.origem= Origem +label.destino=Destino +label.empresa=Empresa: +label.dataInicial=Data Final: +label.dataFinal=Data Final: diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioServicoBloqueadoVendaInternet.jasper b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioServicoBloqueadoVendaInternet.jasper new file mode 100644 index 000000000..967195a5e Binary files /dev/null and b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioServicoBloqueadoVendaInternet.jasper differ diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioServicoBloqueadoVendaInternet.jrxml b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioServicoBloqueadoVendaInternet.jrxml new file mode 100644 index 000000000..3498aa1d1 --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioServicoBloqueadoVendaInternet.jrxml @@ -0,0 +1,209 @@ + + + + + + + + + + + + + + + + + + + + + + <band height="37"> + <textField> + <reportElement x="168" y="0" width="491" height="27" uuid="766b74e4-28c9-4045-8538-343a8bc8e665"/> + <textElement textAlignment="Center" verticalAlignment="Middle"> + <font size="18" isBold="true"/> + </textElement> + <textFieldExpression><![CDATA[$R{cabecalho.nome}]]></textFieldExpression> + </textField> + </band> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/utilitarios/RelatorioServicoBloqueadoVendaInternetBean.java b/src/java/com/rjconsultores/ventaboletos/relatorios/utilitarios/RelatorioServicoBloqueadoVendaInternetBean.java new file mode 100644 index 000000000..538d9ff49 --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/utilitarios/RelatorioServicoBloqueadoVendaInternetBean.java @@ -0,0 +1,72 @@ +package com.rjconsultores.ventaboletos.relatorios.utilitarios; + +import java.math.BigDecimal; +import java.util.Date; + +public class RelatorioServicoBloqueadoVendaInternetBean { + + private String servico; + private Integer codOrigem; + private Integer codDestino; + private String descOrigem; + private String descDestino; + private String horaViagem; + private Date dataServico; + + public String getServico() { + return servico; + } + + public void setServico(String servico) { + this.servico = servico; + } + + public Integer getCodOrigem() { + return codOrigem; + } + + public void setCodOrigem(Integer codOrigem) { + this.codOrigem = codOrigem; + } + + public Integer getCodDestino() { + return codDestino; + } + + public void setCodDestino(Integer codDestino) { + this.codDestino = codDestino; + } + + public String getDescOrigem() { + return descOrigem; + } + + public void setDescOrigem(String descOrigem) { + this.descOrigem = descOrigem; + } + + public String getDescDestino() { + return descDestino; + } + + public void setDescDestino(String descDestino) { + this.descDestino = descDestino; + } + + public String getHoraViagem() { + return horaViagem; + } + + public void setHoraViagem(String horaViagem) { + this.horaViagem = horaViagem; + } + + public Date getDataServico() { + return dataServico; + } + + public void setDataServico(Date dataServico) { + this.dataServico = dataServico; + } + +} diff --git a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioServicoBloqueadoVendaInternetController.java b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioServicoBloqueadoVendaInternetController.java new file mode 100644 index 000000000..4f86da4f6 --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioServicoBloqueadoVendaInternetController.java @@ -0,0 +1,90 @@ +package com.rjconsultores.ventaboletos.web.gui.controladores.relatorios; + +import java.sql.Timestamp; +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.Datebox; + +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.relatorios.impl.RelatorioServicoBloqueadoVendaInternet; +import com.rjconsultores.ventaboletos.relatorios.impl.RelatorioVendasPTA; +import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio; +import com.rjconsultores.ventaboletos.service.EmpresaService; +import com.rjconsultores.ventaboletos.utilerias.DateUtil; +import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEstandar; +import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer; + +@Controller("relatorioServicoBloqueadoVendaInternetController") +@Scope("prototype") +public class RelatorioServicoBloqueadoVendaInternetController extends MyGenericForwardComposer { + + /** + * + */ + private static final long serialVersionUID = 1L; + @Autowired + private EmpresaService empresaService; + private List lsEmpresa; + private MyComboboxEstandar cmbEmpresa; + + private Datebox datInicial; + private Datebox datFinal; + @Autowired + private DataSource dataSourceRead; + + @Override + public void doAfterCompose(Component comp) throws Exception { + + super.doAfterCompose(comp); + lsEmpresa = empresaService.obtenerTodos(); + } + + @SuppressWarnings({ "rawtypes", "unchecked" }) + private void executarRelatorio() throws Exception { + Relatorio relatorio; + + Map parametros = new HashMap(); + + Timestamp dataInicio = new Timestamp((DateUtil.inicioFecha((java.util.Date) this.datInicial.getValue()).getTime())); + Timestamp dataFinal = new Timestamp((DateUtil.fimFecha((java.util.Date) this.datFinal.getValue()).getTime())); + + parametros.put("DATA_INICIAL", dataInicio); + parametros.put("DATA_FINAL", dataFinal); + + Empresa empresa = (Empresa) cmbEmpresa.getSelectedItem().getValue(); + parametros.put("EMPRESA", empresa); + parametros.put("NOME_EMPRESA", empresa.getNombempresa()); + parametros.put("TITULO", Labels.getLabel("relatorioServicoBloqueadoVendaInternetController.window.title")); + + relatorio = new RelatorioServicoBloqueadoVendaInternet(parametros, dataSourceRead.getConnection()); + + Map args = new HashMap(); + args.put("relatorio", relatorio); + + openWindow("/component/reportView.zul", + Labels.getLabel("relatorioServicoBloqueadoVendaInternetController.window.title"), args, MODAL); + } + + public void onClick$btnExecutarRelatorio(Event ev) throws Exception { + executarRelatorio(); + } + + public List getLsEmpresa() { + return lsEmpresa; + } + + public void setLsEmpresa(List lsEmpresa) { + this.lsEmpresa = lsEmpresa; + } + +} diff --git a/src/java/com/rjconsultores/ventaboletos/web/utilerias/menu/item/relatorios/ItemMenuRelatorioServicoBloqueadoVendaInternet.java b/src/java/com/rjconsultores/ventaboletos/web/utilerias/menu/item/relatorios/ItemMenuRelatorioServicoBloqueadoVendaInternet.java new file mode 100644 index 000000000..98cd90143 --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/web/utilerias/menu/item/relatorios/ItemMenuRelatorioServicoBloqueadoVendaInternet.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 ItemMenuRelatorioServicoBloqueadoVendaInternet extends DefaultItemMenuSistema { + + public ItemMenuRelatorioServicoBloqueadoVendaInternet() { + super("indexController.mniRelatorioServicoBloqueadoVendaInternet.label"); + } + + @Override + public String getClaveMenu() { + return "COM.RJCONSULTORES.ADMINISTRACION.GUI.RELATORIOS.MENU.RELATORIOSERVICOBLOQUEADOVENDAINTERNET"; + } + + @Override + public void ejecutar() { + PantallaUtileria.openWindow("/gui/relatorios/filtroRelatorioServicoBloqueadoVendaInternet.zul", + Labels.getLabel("relatorioServicoBloqueadoVendaInternetController.window.title"), getArgs(), desktop); + } + +} diff --git a/web/gui/relatorios/filtroRelatorioServicoBloqueadoVendaInternet.zul b/web/gui/relatorios/filtroRelatorioServicoBloqueadoVendaInternet.zul new file mode 100644 index 000000000..f6135f999 --- /dev/null +++ b/web/gui/relatorios/filtroRelatorioServicoBloqueadoVendaInternet.zul @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + +