diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioOCDNaoResgatadaEmpresa.java b/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioOCDNaoResgatadaEmpresa.java new file mode 100644 index 000000000..5a45fbd66 --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioOCDNaoResgatadaEmpresa.java @@ -0,0 +1,110 @@ +package com.rjconsultores.ventaboletos.relatorios.impl; + +import java.sql.Connection; +import java.sql.ResultSet; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource; + +import com.rjconsultores.ventaboletos.relatorios.utilitarios.DataSource; +import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio; +import com.rjconsultores.ventaboletos.relatorios.utilitarios.RelatorioOCDBean; +import com.rjconsultores.ventaboletos.web.utilerias.NamedParameterStatement; + +public class RelatorioOCDNaoResgatadaEmpresa extends Relatorio { + + private List lsDadosRelatorio; + + public RelatorioOCDNaoResgatadaEmpresa(Map parametros, Connection conexao) throws Exception { + super(parametros, conexao); + + this.setCustomDataSource(new DataSource(this) { + @Override + public void initDados() throws Exception { + + Connection conexao = this.relatorio.getConexao(); + + Map parametros = this.relatorio.getParametros(); + + String fecInicio = parametros.get("fecInicio").toString() + " 00:00:00"; + String fecFinal = parametros.get("fecFinal").toString() + " 23:59:59"; + Integer empresaId = parametros.get("empresa") != null ? Integer.parseInt(parametros.get("empresa").toString()) : null; + + String sql = getSql(fecInicio, fecFinal, empresaId); + + NamedParameterStatement stmt = new NamedParameterStatement(conexao, sql); + ResultSet rset = null; + + SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss"); + stmt.setDate("fecInicio", new java.sql.Date(sdf.parse(fecInicio).getTime())); + stmt.setDate("fecFinal", new java.sql.Date(sdf.parse(fecFinal).getTime())); + if (empresaId != null){ + stmt.setInt("empresaId", empresaId); + } + + rset = stmt.executeQuery(); + + lsDadosRelatorio = new ArrayList(); + + while (rset.next()) { + RelatorioOCDBean ocdBean = new RelatorioOCDBean(); + ocdBean.setBoletoId(rset.getLong("boleto_Id")); + ocdBean.setFecinc(rset.getDate("fecinc")); + ocdBean.setFecpagar(rset.getDate("fecpagar")); + ocdBean.setFecpago(rset.getDate("fecpago")); + ocdBean.setIndpago(rset.getBoolean("indpago")); + ocdBean.setEmpresa(rset.getString("nombempresa")); + ocdBean.setNombpuntoventa(rset.getString("nombpuntoventa") != null ? rset.getString("nombpuntoventa") : ""); + ocdBean.setNombpuntoventapago(rset.getString("nombpuntoventapago") != null ? rset.getString("nombpuntoventapago") : ""); + ocdBean.setNombusuario(rset.getString("nombusuario") != null ? rset.getString("nombusuario") : ""); + ocdBean.setNombusuarioinc(rset.getString("nombusuarioinc") != null ? rset.getString("nombusuarioinc") : ""); + ocdBean.setNombusuariopago(rset.getString("nombusuariopago") != null ? rset.getString("nombusuariopago") : ""); + ocdBean.setNumoperacion(rset.getString("numoperacion")); + ocdBean.setPenalizacion(rset.getBigDecimal("penalizacion")); + ocdBean.setValorPagar(rset.getBigDecimal("valor_Pagar")); + + lsDadosRelatorio.add(ocdBean); + } + + if (lsDadosRelatorio.size() > 0) { + + setLsDadosRelatorio(lsDadosRelatorio); + } + } + }); + } + + public void setLsDadosRelatorio(List lsDadosRelatorio) { + this.setCollectionDataSource(new JRBeanCollectionDataSource(lsDadosRelatorio)); + this.lsDadosRelatorio = lsDadosRelatorio; + } + + @Override + protected void processaParametros() throws Exception { + } + + private String getSql(String fecInicio, String fecFinal, Integer empresaId) { + StringBuffer sql = new StringBuffer(); + + sql.append("select nombempresa, o.*, ui.nombusuario nombusuarioinc, "); + sql.append("up.nombusuario nombusuariopago, u.nombusuario nombusuario, "); + sql.append("p.nombpuntoventa nombpuntoventa, pp.nombpuntoventa nombpuntoventapago "); + sql.append("from ocd o "); + sql.append("join boleto b on b.boleto_id = o.boleto_id "); + sql.append("join empresa e on b.empresacorrida_id = e.empresa_id "); + sql.append("join usuario u on u.usuario_id = o.usuario_id "); + sql.append("join usuario ui on ui.usuario_id = o.usuarioinc_id "); + sql.append("left join usuario up on up.usuario_id = o.usuariopago_id "); + sql.append("join punto_venta p on p.puntoventa_id = o.puntoventa_id "); + sql.append("left join punto_venta pp on pp.puntoventa_id = o.puntoventapago_id "); + sql.append("where o.fecpago is null and o.fecpagar between :fecInicio and :fecFinal "); + if (empresaId != null){ + sql.append("and e.empresa_id = :empresaId "); + } + + return sql.toString(); + } +} diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioOCDNaoResgatadaEmpresa_pt_BR.properties b/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioOCDNaoResgatadaEmpresa_pt_BR.properties new file mode 100644 index 000000000..3b2bef5bf --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioOCDNaoResgatadaEmpresa_pt_BR.properties @@ -0,0 +1,32 @@ +#geral +msg.noData=Não foi possivel obter dados com os parâmetros informados. +msg.a=à + +#Labels header +header.periodo=Período: +header.data.hora=Data/Hora\: +header.pagina=Página\: +header.filtro=Filtro\: +header.filtro.servico=Serviço\: +header.filtro.linha=Linha\: +header.filtro.grupo=Grupo de Linhas\: + +#Labels detail + +detail.boletoId=Boleto +detail.nombpuntoventa=Ponto de Venda +detail.numoperacion=Num. Operação +detail.fecpagar=Data Pag. +detail.valorPagar=Vr. Pagar +detail.penalizacion=Penalização +detail.nombusuarioinc=Usuário Inc. + +detail.fecinc=Data Inc. +detail.nombempresa=Empresa +detail.nombusuario=Usuário +detail.nombusuariopago=Usuário Pag. +detail.nombpuntoventapago=Ponto Venda Pag. + +linhas=Linhas + + diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioOCDNaoResgatadaEmpresa.jasper b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioOCDNaoResgatadaEmpresa.jasper new file mode 100644 index 000000000..8f2ea2bda Binary files /dev/null and b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioOCDNaoResgatadaEmpresa.jasper differ diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioOCDNaoResgatadaEmpresa.jrxml b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioOCDNaoResgatadaEmpresa.jrxml new file mode 100644 index 000000000..1f410ad49 --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioOCDNaoResgatadaEmpresa.jrxml @@ -0,0 +1,266 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/utilitarios/RelatorioOCDBean.java b/src/java/com/rjconsultores/ventaboletos/relatorios/utilitarios/RelatorioOCDBean.java new file mode 100644 index 000000000..80bc8e841 --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/utilitarios/RelatorioOCDBean.java @@ -0,0 +1,120 @@ +package com.rjconsultores.ventaboletos.relatorios.utilitarios; + +import java.math.BigDecimal; +import java.util.Date; + +public class RelatorioOCDBean { + + private Long ocdId; + + private Long boletoId; + + private String numoperacion; + + private Date fecpagar; + private BigDecimal valorPagar; + private BigDecimal penalizacion; + + private Date fecinc; + + private Boolean indpago; + private Date fecpago; + + private String empresa; + private String nombusuario; + private String nombusuarioinc; + private String nombusuariopago; + private String nombpuntoventa; + private String nombpuntoventapago; + + public Long getOcdId() { + return ocdId; + } + public void setOcdId(Long ocdId) { + this.ocdId = ocdId; + } + public Long getBoletoId() { + return boletoId; + } + public void setBoletoId(Long boletoId) { + this.boletoId = boletoId; + } + public String getNumoperacion() { + return numoperacion; + } + public void setNumoperacion(String numoperacion) { + this.numoperacion = numoperacion; + } + public Date getFecpagar() { + return fecpagar; + } + public void setFecpagar(Date fecpagar) { + this.fecpagar = fecpagar; + } + public BigDecimal getValorPagar() { + return valorPagar; + } + public void setValorPagar(BigDecimal valorPagar) { + this.valorPagar = valorPagar; + } + public BigDecimal getPenalizacion() { + return penalizacion; + } + public void setPenalizacion(BigDecimal penalizacion) { + this.penalizacion = penalizacion; + } + public Date getFecinc() { + return fecinc; + } + public void setFecinc(Date fecinc) { + this.fecinc = fecinc; + } + public Boolean getIndpago() { + return indpago; + } + public void setIndpago(Boolean indpago) { + this.indpago = indpago; + } + public Date getFecpago() { + return fecpago; + } + public void setFecpago(Date fecpago) { + this.fecpago = fecpago; + } + public String getEmpresa() { + return empresa; + } + public void setEmpresa(String empresa) { + this.empresa = empresa; + } + public String getNombusuario() { + return nombusuario; + } + public void setNombusuario(String nombusuario) { + this.nombusuario = nombusuario; + } + public String getNombusuarioinc() { + return nombusuarioinc; + } + public void setNombusuarioinc(String nombusuarioinc) { + this.nombusuarioinc = nombusuarioinc; + } + public String getNombusuariopago() { + return nombusuariopago; + } + public void setNombusuariopago(String nombusuariopago) { + this.nombusuariopago = nombusuariopago; + } + public String getNombpuntoventa() { + return nombpuntoventa; + } + public void setNombpuntoventa(String nombpuntoventa) { + this.nombpuntoventa = nombpuntoventa; + } + public String getNombpuntoventapago() { + return nombpuntoventapago; + } + public void setNombpuntoventapago(String nombpuntoventapago) { + this.nombpuntoventapago = nombpuntoventapago; + } +} diff --git a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioOCDController.java b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioOCDController.java new file mode 100644 index 000000000..3a9552ad1 --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioOCDController.java @@ -0,0 +1,93 @@ +package com.rjconsultores.ventaboletos.web.gui.controladores.relatorios; + +import java.text.SimpleDateFormat; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.sql.DataSource; + +import org.apache.log4j.Logger; +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.Combobox; +import org.zkoss.zul.Datebox; + +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.relatorios.impl.RelatorioOCDNaoResgatadaEmpresa; +import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio; +import com.rjconsultores.ventaboletos.service.EmpresaService; +import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer; + +@Controller("relatorioOCDController") +@Scope("prototype") +public class RelatorioOCDController extends MyGenericForwardComposer { + private static final long serialVersionUID = 1L; + private static Logger log = Logger.getLogger(RelatorioOCDController.class); + + @Autowired + private DataSource dataSource; + + @Autowired + private EmpresaService empresaService; + + private Datebox datInicial; + private Datebox datFinal; + private Combobox cmbEmpresa; + + private List lsEmpresas; + + private void executarRelatorio() throws Exception { + + Map parametros = new HashMap(); + + SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); + parametros.put("fecInicio", sdf.format(this.datInicial.getValue())); + parametros.put("fecFinal", sdf.format(this.datFinal.getValue())); + if (cmbEmpresa.getSelectedIndex() != -1){ + parametros.put("empresa", ((Empresa)cmbEmpresa.getSelectedItem().getValue()).getEmpresaId()); + } + parametros.put("TITULO", Labels.getLabel("relatorioOCDController.window.title")); + + Relatorio relatorio = new RelatorioOCDNaoResgatadaEmpresa(parametros, dataSource.getConnection()); + + Map args = new HashMap(); + args.put("relatorio", relatorio); + + openWindow("/component/reportView.zul", + Labels.getLabel("relatorioOCDController.window.title"), args, MODAL); + + } + + public void onClick$btnExecutarRelatorio(Event ev) throws Exception { + executarRelatorio(); + } + + @Override + public void doAfterCompose(Component comp) throws Exception { + lsEmpresas = empresaService.obtenerTodos(); + + super.doAfterCompose(comp); + } + + public Combobox getCmbEmpresa() { + return cmbEmpresa; + } + + public void setCmbEmpresa(Combobox cmbEmpresa) { + this.cmbEmpresa = cmbEmpresa; + } + + public List getLsEmpresas() { + return lsEmpresas; + } + + public void setLsEmpresas(List lsEmpresas) { + this.lsEmpresas = lsEmpresas; + } + +} diff --git a/src/java/com/rjconsultores/ventaboletos/web/utilerias/menu/item/relatorios/ItemMenuRelatorioOCD.java b/src/java/com/rjconsultores/ventaboletos/web/utilerias/menu/item/relatorios/ItemMenuRelatorioOCD.java new file mode 100644 index 000000000..808044544 --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/web/utilerias/menu/item/relatorios/ItemMenuRelatorioOCD.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 ItemMenuRelatorioOCD extends DefaultItemMenuSistema { + + public ItemMenuRelatorioOCD() { + super("indexController.mniRelatorioOCD.label"); + } + + @Override + public String getClaveMenu() { + return "COM.RJCONSULTORES.ADMINISTRACION.GUI.RELATORIOS.MENU.RELATORIOOCDNAORESGATADAS"; + } + + @Override + public void ejecutar() { + PantallaUtileria.openWindow("/gui/relatorios/filtroRelatorioOCD.zul", + Labels.getLabel("relatorioOCDController.window.title"), null, desktop); + } + +} diff --git a/web/WEB-INF/i3-label_es_MX.label b/web/WEB-INF/i3-label_es_MX.label index eabc5e23d..d9ee0a551 100644 --- a/web/WEB-INF/i3-label_es_MX.label +++ b/web/WEB-INF/i3-label_es_MX.label @@ -225,6 +225,7 @@ indexController.mniRelatorioTaxasLinha.label = Reporte de tasas por linea indexController.mniRelatorioSisdap.label=SISDAP indexController.mniRelatorioEmpresaCorrida.label = Reporte de la Empresa Corrida indexController.mniRelatorioEmpresaOnibus.label = Reporte de la Empresa Onibus +indexController.mniRelatorioOCD.label = Reporte OCD por la Empresa #PARTE REALIZADA POR MANUEL indexController.mnCortesias.label = Cortesias para empleados @@ -304,6 +305,12 @@ relatorioEmpresaOnibusController.window.title=Reporte Empresa Onibus relatorioEmpresaOnibusController.lbDataIni.value=Fecha Inicio relatorioEmpresaOnibusController.lbDataFin.value=Fecha Final +# Relatorio OCD Empresa +relatorioOCDController.window.title=Reporte OCD por la Empresa +relatorioOCDController.lbEmpresa.value=Empresa +relatorioOCDController.lbDataIni.value=Fecha Inicio +relatorioOCDController.lbDataFin.value=Fecha Final + #Relatorio rutas Horario relatorioLinhasHorarioController.window.title = Reporte de rutas por horário relatorioLinhasHorarioController.lbDataIni.value = Fecha inicial diff --git a/web/WEB-INF/i3-label_pt_BR.label b/web/WEB-INF/i3-label_pt_BR.label index a6b7562e5..ae5f77d43 100644 --- a/web/WEB-INF/i3-label_pt_BR.label +++ b/web/WEB-INF/i3-label_pt_BR.label @@ -229,6 +229,7 @@ indexController.mniRelatorioDevolucaoBilhetes.label = Relatório de Devolução indexController.mniRelatorioSisdap.label=SISDAP indexController.mniRelatorioEmpresaCorrida.label = Relatório por Empresa Corrida indexController.mniRelatorioEmpresaOnibus.label = Relatório por Empresa Ônibus +indexController.mniRelatorioOCD.label = Relatório OCD por Empresa #PARTE REALIZADA POR MANUEL indexController.mnCortesias.label = Cortesias Para Funcionários @@ -310,6 +311,12 @@ relatorioEmpresaOnibusController.window.title=Relatório Empresa Ônibus relatorioEmpresaOnibusController.lbDataIni.value=Data Inicial relatorioEmpresaOnibusController.lbDataFin.value=Data Final +# Relatorio OCD Empresa +relatorioOCDController.window.title=Relatório OCD por Empresa +relatorioOCDController.lbEmpresa.value=Empresa +relatorioOCDController.lbDataIni.value=Data Inicial +relatorioOCDController.lbDataFin.value=Data Final + #Relatorio Linhas Horario relatorioLinhasHorarioController.window.title = Relatório de Linhas por Horário relatorioLinhasHorarioController.lbDataIni.value = Data Inicial diff --git a/web/gui/relatorios/filtroRelatorioOCD.zul b/web/gui/relatorios/filtroRelatorioOCD.zul new file mode 100644 index 000000000..46e553e44 --- /dev/null +++ b/web/gui/relatorios/filtroRelatorioOCD.zul @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + +