diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/datasource/Vendas2CustomDS.java b/src/java/com/rjconsultores/ventaboletos/relatorios/datasource/Vendas2CustomDS.java new file mode 100644 index 000000000..1632dc7d1 --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/datasource/Vendas2CustomDS.java @@ -0,0 +1,43 @@ +package com.rjconsultores.ventaboletos.relatorios.datasource; + +import com.rjconsultores.ventaboletos.relatorios.utilitarios.IDataSource; + +import net.sf.jasperreports.engine.JRException; +import net.sf.jasperreports.engine.JRField; + +/** + */ +public class Vendas2CustomDS implements IDataSource { + + private Object[][] data = { + {"João", "123123"}, + {"Maria", "12312321"}, + {"Bruno", "3243"}, + {"Teste", "1234365612321"}, + + + }; + + private int index = -1; + + public Vendas2CustomDS() { + } + + public boolean next() throws JRException { + index++; + return (index < data.length); + } + + public Object getFieldValue(JRField field) throws JRException { + Object value = null; + String fieldName = field.getName(); + + if ("field1".equals(fieldName)) { + value = data[index][0]; + } else if ("field2".equals(fieldName)) { + value = data[index][1]; + }; + + return value; + } +} diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/datasource/VendasCustomDS.java b/src/java/com/rjconsultores/ventaboletos/relatorios/datasource/VendasCustomDS.java new file mode 100644 index 000000000..f108fdd53 --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/datasource/VendasCustomDS.java @@ -0,0 +1,42 @@ +package com.rjconsultores.ventaboletos.relatorios.datasource; + +import com.rjconsultores.ventaboletos.relatorios.utilitarios.IDataSource; +import net.sf.jasperreports.engine.JRException; +import net.sf.jasperreports.engine.JRField; + +/** + */ +public class VendasCustomDS implements IDataSource { + + private Object[][] data = { + {"João", "123123"}, + {"Maria", "12312321"}, + {"Bruno", "3243"}, + {"Teste", "1234365612321"}, + + + }; + + private int index = -1; + + public VendasCustomDS() { + } + + public boolean next() throws JRException { + index++; + return (index < data.length); + } + + public Object getFieldValue(JRField field) throws JRException { + Object value = null; + String fieldName = field.getName(); + + if ("field1".equals(fieldName)) { + value = data[index][0]; + } else if ("field2".equals(fieldName)) { + value = data[index][1]; + }; + + return value; + } +} diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/parametros/RendimentoParamsImpl.java b/src/java/com/rjconsultores/ventaboletos/relatorios/parametros/RendimentoParamsImpl.java new file mode 100644 index 000000000..ade2fb06b --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/parametros/RendimentoParamsImpl.java @@ -0,0 +1,216 @@ +/** + * + */ +package com.rjconsultores.ventaboletos.relatorios.parametros; + + +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.util.Map; +import com.rjconsultores.ventaboletos.relatorios.utilitarios.IParametros; +import com.rjconsultores.ventaboletos.web.utilerias.CurrencyUtil; + +/** + * @author Bruno H. G. Gouvêa + * + */ +public class RendimentoParamsImpl implements IParametros { + + /* + * (non-Javadoc) + * + * @see com.rjconsultores.ventaboletos.relatorios.utilitarios.IParametros#initParametros() + */ + @Override + public void initParametros(Map parametros, Connection connection) throws Exception { + String sql = this.getSql(); + + PreparedStatement stmt = null; + ResultSet rset = null; + stmt = connection.prepareStatement(sql); + + stmt.setInt(1, Integer.valueOf((String) parametros.get("CORRIDA_ID"))); + stmt.setDate(2, (java.sql.Date) parametros.get("FECCORRIDA")); + rset = stmt.executeQuery(); + + if (rset.next()) { + parametros.put("P_NOMINAL_KM", CurrencyUtil.getCurrencyStrFromStr(rset.getString("NOMINAL_KM"))); + parametros.put("P_TOTAL_ARRECADADO", CurrencyUtil.getCurrencyStrFromStr(rset.getString("TOTAL_ARRECADADO"))); + parametros.put("P_ARRECADO_KM", CurrencyUtil.getCurrencyStrFromStr(rset.getString("ARRECADADO_KM"))); + parametros.put("P_OCUPACAO", rset.getString("OCUPACAO")+" %"); + parametros.put("P_OCUPACAO_ARRECADACAO", rset.getString("OCUPACAO_ARRECADACAO") +" %"); + parametros.put("P_TOTAL_NOMINAL", CurrencyUtil.getCurrencyStrFromStr(rset.getString("TOTAL_NOMINAL"))); + parametros.put("P_OCUPACAO_S_ARRECADACAO", rset.getString("OCUPACAO_S_ARRECADACAO") +" %"); + } + + } + + private String getSql() { + + StringBuilder sql = new StringBuilder(); + + sql.append("SELECT round(NVL(TAB.TOTAL_ARRECADADO,0),2) TOTAL_ARRECADADO, "); + sql.append(" round(NVL(TAB.TOTAL_ARRECADADO / TAB.KM_OCUPADA,0),2) ARRECADADO_KM, "); + sql.append(" round(NVL(TAB.TOTAL_NOMINAL,0),2) TOTAL_NOMINAL, "); + sql.append(" round(TAB.TOTAL_NOMINAL / TAB.KM_NOMINAL,2) NOMINAL_KM,"); + sql.append(" round((TAB.TOTAL_OCUPADOS/TAB.TOTAL_ACENTOS)*100,1) OCUPACAO, "); + sql.append(" round(((TAB.TOTAL_OCUPADOS-TAB.TOTAL_OCUPADOS_GRATUIDADE)/TAB.TOTAL_ACENTOS)*100,1) OCUPACAO_ARRECADACAO, "); + sql.append(" round((TAB.TOTAL_OCUPADOS_GRATUIDADE/TAB.TOTAL_ACENTOS)*100,1) OCUPACAO_S_ARRECADACAO "); + sql.append(" "); + sql.append(" FROM ( "); + sql.append("SELECT (SELECT SUM(BO.PRECIOBASE) "); + sql.append(" FROM BOLETO BO "); + sql.append(" WHERE BO.CORRIDA_ID = CR.CORRIDA_ID "); + sql.append(" AND BO.FECCORRIDA = CR.FECCORRIDA "); + sql.append(" AND BO.ACTIVO = 1 "); + sql.append(" AND (BO.MOTIVOCANCELACION_ID IS NULL OR "); + sql.append(" BO.MOTIVOCANCELACION_ID = 0)) TOTAL_ARRECADADO, "); + sql.append(" "); + sql.append(" (SELECT SUM(TR.CANTKMREAL * DA.CANTASIENTOS) "); + sql.append(" FROM CORRIDA_TRAMO CT, "); + sql.append(" TRAMO TR, "); + sql.append(" ROL_OPERATIVO RO, "); + sql.append(" DIAGRAMA_AUTOBUS DA "); + sql.append(" WHERE CT.CORRIDA_ID = CR.CORRIDA_ID "); + sql.append(" AND CT.FECCORRIDA = CR.FECCORRIDA "); + sql.append(" AND RO.ROLOPERATIVO_ID = CR.ROLOPERATIVO_ID "); + sql.append(" AND DA.DIAGRAMAAUTOBUS_ID = RO.DIAGRAMAAUTOBUS_ID "); + sql.append(" AND TR.TRAMO_ID = CT.TRAMO_ID "); + sql.append(" AND CT.ACTIVO = 1) KM_NOMINAL, "); + sql.append(" "); + sql.append(" (SELECT SUM((SELECT TR.CANTKMREAL "); + sql.append(" FROM BOLETO BO, CORRIDA_TRAMO CTD, CORRIDA_TRAMO CTO "); + sql.append(" WHERE BO.CORRIDA_ID = CR.CORRIDA_ID "); + sql.append(" AND BO.FECCORRIDA = CR.FECCORRIDA "); + sql.append(" AND BO.NUMASIENTO = DD.ASIENTO "); + sql.append(" AND BO.ORIGEN_ID = CTO.ORIGEN_ID "); + sql.append(" AND BO.DESTINO_ID = CTD.DESTINO_ID "); + sql.append(" AND CTD.CORRIDA_ID = CR.CORRIDA_ID "); + sql.append(" AND CTD.FECCORRIDA = CR.FECCORRIDA "); + sql.append(" AND CTO.CORRIDA_ID = CR.CORRIDA_ID "); + sql.append(" AND CTO.FECCORRIDA = CR.FECCORRIDA "); + sql.append(" AND CTO.ACTIVO = 1 "); + sql.append(" AND CTD.ACTIVO = 1 "); + sql.append(" AND CT.NUMSECUENCIA BETWEEN CTO.NUMSECUENCIA AND "); + sql.append(" CTD.NUMSECUENCIA "); + sql.append(" AND BO.ACTIVO = 1 "); + sql.append(" AND (BO.MOTIVOCANCELACION_ID IS NULL OR "); + sql.append(" BO.MOTIVOCANCELACION_ID = 0))) "); + sql.append(" FROM CORRIDA_TRAMO CT, "); + sql.append(" TRAMO TR, "); + sql.append(" ROL_OPERATIVO RO, "); + sql.append(" DET_DIAGRAMA_AUTOBUS DD "); + sql.append(" WHERE "); + sql.append(" CR.FECCORRIDA = CT.FECCORRIDA "); + sql.append(" AND CR.CORRIDA_ID = CT.CORRIDA_ID "); + sql.append(" AND CT.TRAMO_ID = TR.TRAMO_ID "); + sql.append(" AND CR.ROLOPERATIVO_ID = RO.ROLOPERATIVO_ID "); + sql.append(" AND RO.DIAGRAMAAUTOBUS_ID = DD.DIAGRAMAAUTOBUS_ID "); + sql.append(" AND DD.VENDIBLE = 1 "); + sql.append(" AND CT.ACTIVO = 1) KM_OCUPADA, "); + sql.append(" (SELECT SUM(TF.PRECIO) "); + sql.append(" FROM CORRIDA_TRAMO CT, "); + sql.append(" TRAMO TR, "); + sql.append(" ROL_OPERATIVO RO, "); + sql.append(" DET_DIAGRAMA_AUTOBUS DD, "); + sql.append(" TARIFA TF "); + sql.append(" WHERE "); + sql.append(" CR.FECCORRIDA = CT.FECCORRIDA "); + sql.append(" AND CR.CORRIDA_ID = CT.CORRIDA_ID "); + sql.append(" AND CT.TRAMO_ID = TR.TRAMO_ID "); + sql.append(" AND CR.ROLOPERATIVO_ID = RO.ROLOPERATIVO_ID "); + sql.append(" AND RO.DIAGRAMAAUTOBUS_ID = DD.DIAGRAMAAUTOBUS_ID "); + sql.append(" AND TF.TRAMO_ID = CT.TRAMO_ID "); + sql.append(" AND TF.ORIGEN_ID = CT.ORIGEN_ID "); + sql.append(" AND TF.DESTINO_ID = CT.DESTINO_ID "); + sql.append(" AND DD.VENDIBLE = 1 "); + sql.append(" AND CT.ACTIVO = 1) TOTAL_NOMINAL, "); + sql.append(" "); + sql.append(" (SELECT COUNT(1) "); + sql.append(" FROM CORRIDA_TRAMO CT, "); + sql.append(" TRAMO TR, "); + sql.append(" ROL_OPERATIVO RO, "); + sql.append(" DET_DIAGRAMA_AUTOBUS DD "); + sql.append(" WHERE "); + sql.append(" "); + sql.append(" CR.FECCORRIDA = CT.FECCORRIDA "); + sql.append(" AND CR.CORRIDA_ID = CT.CORRIDA_ID "); + sql.append(" AND CT.TRAMO_ID = TR.TRAMO_ID "); + sql.append(" AND CR.ROLOPERATIVO_ID = RO.ROLOPERATIVO_ID "); + sql.append(" AND RO.DIAGRAMAAUTOBUS_ID = DD.DIAGRAMAAUTOBUS_ID "); + sql.append(" AND DD.VENDIBLE = 1 "); + sql.append(" AND CT.ACTIVO = 1) TOTAL_ACENTOS, "); + sql.append(" "); + sql.append(" (SELECT COUNT( "); + sql.append(" (SELECT 1 "); + sql.append(" FROM BOLETO BO, CORRIDA_TRAMO CTD, CORRIDA_TRAMO CTO "); + sql.append(" WHERE BO.CORRIDA_ID = CR.CORRIDA_ID "); + sql.append(" AND BO.FECCORRIDA = CR.FECCORRIDA "); + sql.append(" AND BO.NUMASIENTO = DD.ASIENTO "); + sql.append(" AND BO.ORIGEN_ID = CTO.ORIGEN_ID "); + sql.append(" AND BO.DESTINO_ID = CTD.DESTINO_ID "); + sql.append(" AND CTD.CORRIDA_ID = CR.CORRIDA_ID "); + sql.append(" AND CTD.FECCORRIDA = CR.FECCORRIDA "); + sql.append(" AND CTO.CORRIDA_ID = CR.CORRIDA_ID "); + sql.append(" AND CTO.FECCORRIDA = CR.FECCORRIDA "); + sql.append(" AND CTO.ACTIVO = 1 "); + sql.append(" AND CTD.ACTIVO = 1 "); + sql.append(" AND CT.NUMSECUENCIA BETWEEN CTO.NUMSECUENCIA AND CTD.NUMSECUENCIA "); + sql.append(" AND BO.ACTIVO = 1 "); + sql.append(" AND (BO.MOTIVOCANCELACION_ID IS NULL OR "); + sql.append(" BO.MOTIVOCANCELACION_ID = 0))) "); + sql.append(" FROM "); + sql.append(" CORRIDA_TRAMO CT, "); + sql.append(" TRAMO TR, "); + sql.append(" ROL_OPERATIVO RO, "); + sql.append(" DET_DIAGRAMA_AUTOBUS DD "); + sql.append(" WHERE "); + sql.append(" CR.FECCORRIDA = CT.FECCORRIDA "); + sql.append(" AND CR.CORRIDA_ID = CT.CORRIDA_ID "); + sql.append(" AND CT.TRAMO_ID = TR.TRAMO_ID "); + sql.append(" AND CR.ROLOPERATIVO_ID = RO.ROLOPERATIVO_ID "); + sql.append(" AND RO.DIAGRAMAAUTOBUS_ID = DD.DIAGRAMAAUTOBUS_ID "); + sql.append(" AND DD.VENDIBLE = 1 "); + sql.append(" AND CT.ACTIVO = 1) TOTAL_OCUPADOS, "); + sql.append(" (SELECT COUNT( "); + sql.append(" (SELECT 1 "); + sql.append(" FROM BOLETO BO, CORRIDA_TRAMO CTD, CORRIDA_TRAMO CTO "); + sql.append(" WHERE BO.CORRIDA_ID = CR.CORRIDA_ID "); + sql.append(" AND BO.FECCORRIDA = CR.FECCORRIDA "); + sql.append(" AND BO.NUMASIENTO = DD.ASIENTO "); + sql.append(" AND BO.ORIGEN_ID = CTO.ORIGEN_ID "); + sql.append(" AND BO.DESTINO_ID = CTD.DESTINO_ID "); + sql.append(" AND CTD.CORRIDA_ID = CR.CORRIDA_ID "); + sql.append(" AND CTD.FECCORRIDA = CR.FECCORRIDA "); + sql.append(" AND CTO.CORRIDA_ID = CR.CORRIDA_ID "); + sql.append(" AND CTO.FECCORRIDA = CR.FECCORRIDA "); + sql.append(" AND BO.PRECIOBASE = 0 "); + sql.append(" AND CTO.ACTIVO = 1 "); + sql.append(" AND CTD.ACTIVO = 1 "); + sql.append(" AND CT.NUMSECUENCIA BETWEEN CTO.NUMSECUENCIA AND CTD.NUMSECUENCIA "); + sql.append(" AND BO.ACTIVO = 1 "); + sql.append(" AND (BO.MOTIVOCANCELACION_ID IS NULL OR "); + sql.append(" BO.MOTIVOCANCELACION_ID = 0))) "); + sql.append(" FROM "); + sql.append(" CORRIDA_TRAMO CT, "); + sql.append(" TRAMO TR, "); + sql.append(" ROL_OPERATIVO RO, "); + sql.append(" DET_DIAGRAMA_AUTOBUS DD "); + sql.append(" WHERE "); + sql.append(" CR.FECCORRIDA = CT.FECCORRIDA "); + sql.append(" AND CR.CORRIDA_ID = CT.CORRIDA_ID "); + sql.append(" AND CT.TRAMO_ID = TR.TRAMO_ID "); + sql.append(" AND CR.ROLOPERATIVO_ID = RO.ROLOPERATIVO_ID "); + sql.append(" AND RO.DIAGRAMAAUTOBUS_ID = DD.DIAGRAMAAUTOBUS_ID "); + sql.append(" AND DD.VENDIBLE = 1 "); + sql.append(" AND CT.ACTIVO = 1) TOTAL_OCUPADOS_GRATUIDADE "); + sql.append(" FROM CORRIDA CR "); + sql.append(" WHERE CR.CORRIDA_ID = ? "); + sql.append(" AND CR.FECCORRIDA = ? "); + sql.append(" ) TAB"); + + return sql.toString(); + } + +} diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/render/RenderRelatorioAbstract.java b/src/java/com/rjconsultores/ventaboletos/relatorios/render/RenderRelatorioAbstract.java new file mode 100644 index 000000000..8e1267d76 --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/render/RenderRelatorioAbstract.java @@ -0,0 +1,106 @@ +package com.rjconsultores.ventaboletos.relatorios.render; + +import java.io.InputStream; +import java.sql.Connection; +import java.util.HashMap; +import java.util.Map; + +import net.sf.jasperreports.engine.JRDataSource; +import net.sf.jasperreports.engine.JasperFillManager; +import net.sf.jasperreports.engine.JasperPrint; + +import com.rjconsultores.ventaboletos.relatorios.utilitarios.IDataSource; +import com.rjconsultores.ventaboletos.relatorios.utilitarios.IRenderRelatorio; +import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio; +import com.rjconsultores.ventaboletos.relatorios.utilitarios.SaidaRelatorio; + +/** + * Classe utilizada para padronizar alguns comportamentos genéricos do renderizador de relatórios + * + * @author Bruno H. G. Gouvêa + * + */ +public abstract class RenderRelatorioAbstract implements IRenderRelatorio { + + protected Relatorio relatorio; + protected IDataSource datasource; + protected Connection connection; + private Map parametros = new HashMap(); + protected JasperPrint jasperPrint; + + + /** + * @param relatorio + * Enum do tipo Relatorio contendo as configurações de geração de todos os relatórios + * @param connection + * Objeto de conexão do banco que será utilizado para geração do relatório, só deve ser passado se não for utilizado nenhum tipo de Custom Data Source + */ + public RenderRelatorioAbstract(Relatorio relatorio, Connection connection) { + this.connection = connection; + this.relatorio = relatorio; + } + + /** + * Renderiza o relatório solicitado + * + * @param saida + * Enum contendo o tipo da saida do relatório + * @return Retorna um array de bytes contendo o conteúdo do relatório renderizado. + * @throws Exception + * Excessão durante a renderização do relatório + */ + protected abstract byte[] render(SaidaRelatorio saida) throws Exception; + + + /** + * @param relatorio + * Enum do tipo Relatorio contendo as configurações de geração de todos os relatórios + */ + public RenderRelatorioAbstract(Relatorio relatorio) { + this.relatorio = relatorio; + } + + public Map getParametros() { + return parametros; + } + + public void setParametros(Map parametros) { + this.parametros = parametros; + this.parametros.put("NOME_RELATORIO", this.relatorio.getNome()); + } + + /* + * (non-Javadoc) + * + * @see com.rjconsultores.ventaboletos.relatorios.utilitarios.IRenderRelatorio#getConteudo() + */ + @Override + public byte[] getConteudo(SaidaRelatorio saida) throws Exception { + + + if(this.jasperPrint == null){ + + if(this.relatorio.getParametros()!=null) + this.relatorio.getParametros().initParametros(this.parametros, this.connection); + + InputStream iStemplate = this.getClass().getResourceAsStream("/com/rjconsultores/ventaboletos/relatorios/templates/"+this.relatorio.getTemplate()); + + + if (this.relatorio.getDatasource() != null) + this.jasperPrint = JasperFillManager.fillReport(iStemplate, this.getParametros(), (JRDataSource) this.datasource); + else + this.jasperPrint = JasperFillManager.fillReport(iStemplate, this.getParametros(), this.connection); + + } + + + + + + return this.render(saida); + + } + + + +} diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/render/RenderRelatorioJasper.java b/src/java/com/rjconsultores/ventaboletos/relatorios/render/RenderRelatorioJasper.java new file mode 100644 index 000000000..a66510941 --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/render/RenderRelatorioJasper.java @@ -0,0 +1,89 @@ +package com.rjconsultores.ventaboletos.relatorios.render; + +import java.io.ByteArrayOutputStream; +import java.io.InputStream; +import java.sql.Connection; + +import net.sf.jasperreports.engine.JRDataSource; +import net.sf.jasperreports.engine.JRException; +import net.sf.jasperreports.engine.JasperExportManager; +import net.sf.jasperreports.engine.JasperFillManager; +import net.sf.jasperreports.engine.JasperPrint; +import net.sf.jasperreports.engine.export.JRXlsExporter; +import net.sf.jasperreports.engine.export.JRXlsExporterParameter; + +import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio; +import com.rjconsultores.ventaboletos.relatorios.utilitarios.SaidaRelatorio; + +/** + * Implementação da classe abstrata de renderização acoplada a uma tecnologia de renderização especifica + * + * @author Bruno H. G. Gouvêa + * + */ +public class RenderRelatorioJasper extends RenderRelatorioAbstract { + + /** + * @param relatorio + * Enum do tipo Relatorio contendo as configurações de geração de todos os relatórios + * @param connection + * Objeto de conexão do banco que será utilizado para geração do relatório, só deve ser passado se não for utilizado nenhum tipo de Custom Data Source + * + * @throws Exception + * Excessão contendo regra de utilização da classe + */ + public RenderRelatorioJasper(Relatorio relatorio, Connection connection) throws Exception { + super(relatorio, connection); + + if (relatorio.getDatasource() != null) + throw new Exception("Este relatório esta configurado para utilizar um datasource customizado, não é necessário passar uma conexão de dados."); + } + + /** + * @param relatorio + * Enum do tipo Relatorio contendo as configurações de geração de todos os relatórios + * @throws Exception + * Excessão contendo regra de utilização da classe + */ + public RenderRelatorioJasper(Relatorio relatorio) throws Exception { + super(relatorio); + + if (relatorio.getDatasource() == null) + throw new Exception("Este relatório esta configurado para utilizar uma conexão direta com banco de dados, utilize o construtor com a passagem de parametros correta."); + + } + + /* + * (non-Javadoc) + * + * @see com.rjconsultores.ventaboletos.relatorios.utilitarios.IRenderRelatorio#render() + */ + @Override + protected byte[] render(SaidaRelatorio saida) throws JRException { + byte[] conteudo = null; + + + switch (saida) { + + case PDF: + conteudo = JasperExportManager.exportReportToPdf(this.jasperPrint); + break; + + case XLS: + JRXlsExporter exporterXLS = new JRXlsExporter(); + ByteArrayOutputStream output = new ByteArrayOutputStream(); + exporterXLS.setParameter(JRXlsExporterParameter.JASPER_PRINT, this.jasperPrint); + exporterXLS.setParameter(JRXlsExporterParameter.OUTPUT_STREAM, output); + exporterXLS.setParameter(JRXlsExporterParameter.IS_ONE_PAGE_PER_SHEET, Boolean.TRUE); + exporterXLS.setParameter(JRXlsExporterParameter.IS_DETECT_CELL_TYPE, Boolean.TRUE); + exporterXLS.setParameter(JRXlsExporterParameter.IS_WHITE_PAGE_BACKGROUND, Boolean.FALSE); + exporterXLS.setParameter(JRXlsExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS, Boolean.TRUE); + exporterXLS.exportReport(); + conteudo = output.toByteArray(); + break; + + } + + return conteudo; + } +} diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioAproveitamento.jasper b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioAproveitamento.jasper new file mode 100644 index 000000000..2a899db91 Binary files /dev/null and b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioAproveitamento.jasper differ diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioAproveitamento.jrxml b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioAproveitamento.jrxml new file mode 100644 index 000000000..22e6b961f --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioAproveitamento.jrxml @@ -0,0 +1,388 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <band height="85" splitType="Stretch"> + <rectangle> + <reportElement uuid="8f226d21-ccdb-41b4-a01d-fb0712f0b4d3" x="0" y="0" width="555" height="30"/> + </rectangle> + <rectangle> + <reportElement uuid="b6aa9717-79c4-4f13-91df-9b0255003a16" x="0" y="40" width="555" height="39"/> + </rectangle> + <staticText> + <reportElement uuid="2e854857-9e82-43ae-bc7b-232319c1f259" x="12" y="0" width="65" height="15"/> + <textElement> + <font size="11" isBold="true"/> + </textElement> + <text><![CDATA[Relatório: ]]></text> + </staticText> + <textField> + <reportElement uuid="eb300dc6-1610-409d-8589-72b1539f86d3" x="77" y="0" width="478" height="15"/> + <textElement> + <font size="11"/> + </textElement> + <textFieldExpression><![CDATA[$P{NOME_RELATORIO}]]></textFieldExpression> + </textField> + <staticText> + <reportElement uuid="b76b0e17-99b2-4681-8f60-b5bd5512e897" x="12" y="15" width="65" height="15"/> + <textElement> + <font size="11" isBold="true"/> + </textElement> + <text><![CDATA[Serviço: ]]></text> + </staticText> + <staticText> + <reportElement uuid="bd889fb9-30d9-4023-b811-7f55e3213705" x="244" y="15" width="65" height="15"/> + <textElement> + <font size="11" isBold="true"/> + </textElement> + <text><![CDATA[Data:]]></text> + </staticText> + <textField> + <reportElement uuid="a3d3c093-a9f4-4b32-823f-b4f548e46c2f" x="77" y="15" width="167" height="15"/> + <textElement> + <font size="11"/> + </textElement> + <textFieldExpression><![CDATA[$P{CORRIDA_ID}]]></textFieldExpression> + </textField> + <staticText> + <reportElement uuid="021e9662-43c5-4054-a0d2-3fc8f6003111" x="12" y="40" width="78" height="11"/> + <textElement> + <font size="8"/> + </textElement> + <text><![CDATA[Total Arrecadado:]]></text> + </staticText> + <staticText> + <reportElement uuid="062b6b12-00e3-4389-8359-bf59b8879b4d" x="12" y="51" width="78" height="11"/> + <textElement> + <font size="8"/> + </textElement> + <text><![CDATA[Arrecadado/KM:]]></text> + </staticText> + <staticText> + <reportElement uuid="f2b94d48-f3b5-4781-ac11-ff28a41e0d90" x="197" y="40" width="105" height="11"/> + <textElement> + <font size="8"/> + </textElement> + <text><![CDATA[Ocupação:]]></text> + </staticText> + <staticText> + <reportElement uuid="58deb635-5e71-4614-b71e-d81d5dad85f0" x="197" y="51" width="105" height="11"/> + <textElement> + <font size="8"/> + </textElement> + <text><![CDATA[Ocupação com Arrecação:]]></text> + </staticText> + <staticText> + <reportElement uuid="eec1daa6-74c5-49bf-855f-602d5230dfa1" x="12" y="63" width="78" height="11"/> + <textElement> + <font size="8"/> + </textElement> + <text><![CDATA[Nominal/KM:]]></text> + </staticText> + <staticText> + <reportElement uuid="ccaffa74-0602-4168-b191-ba02c523221f" x="197" y="63" width="105" height="11"/> + <textElement> + <font size="8"/> + </textElement> + <text><![CDATA[Ocupação sem Arrecação:]]></text> + </staticText> + <staticText> + <reportElement uuid="12cf983e-3909-4cf6-94d8-dfc008edc47d" x="382" y="40" width="78" height="11"/> + <textElement> + <font size="8"/> + </textElement> + <text><![CDATA[Total Nominal:]]></text> + </staticText> + <line> + <reportElement uuid="5b56b7a4-1abd-43cc-8071-e949d5575a45" x="185" y="40" width="1" height="39" forecolor="#CCCCCC"/> + </line> + <line> + <reportElement uuid="98b93926-7900-4445-bbe6-024e456fd45e" x="370" y="40" width="1" height="39" forecolor="#CCCCCC"/> + </line> + <textField> + <reportElement uuid="bdfd7f9e-e50e-4a8b-bba4-2fc8a909f38b" x="90" y="63" width="78" height="11"/> + <textElement> + <font size="8"/> + </textElement> + <textFieldExpression><![CDATA[$P{P_NOMINAL_KM}]]></textFieldExpression> + </textField> + <textField> + <reportElement uuid="7eb2d8d3-4a3f-40cd-8117-8e53ab128f34" x="90" y="40" width="96" height="11"/> + <textElement> + <font size="8"/> + </textElement> + <textFieldExpression><![CDATA[$P{P_TOTAL_ARRECADADO}]]></textFieldExpression> + </textField> + <textField> + <reportElement uuid="64600377-6028-4c56-b0f1-3acf6ceeb708" x="90" y="51" width="95" height="11"/> + <textElement> + <font size="8"/> + </textElement> + <textFieldExpression><![CDATA[$P{P_ARRECADO_KM}]]></textFieldExpression> + </textField> + <textField> + <reportElement uuid="6b68d2b4-0fa0-41a4-bdf5-0eaccb7d1f59" x="302" y="40" width="100" height="11"/> + <textElement> + <font size="8"/> + </textElement> + <textFieldExpression><![CDATA[$P{P_OCUPACAO}]]></textFieldExpression> + </textField> + <textField> + <reportElement uuid="66317ebd-e503-420c-8886-8385b782770d" x="302" y="51" width="69" height="11"/> + <textElement> + <font size="8"/> + </textElement> + <textFieldExpression><![CDATA[$P{P_OCUPACAO_ARRECADACAO}]]></textFieldExpression> + </textField> + <textField> + <reportElement uuid="a6ff7221-60b5-4d08-b7e8-7b10db0b97a6" x="302" y="63" width="68" height="11"/> + <textElement> + <font size="8"/> + </textElement> + <textFieldExpression><![CDATA[$P{P_OCUPACAO_S_ARRECADACAO}]]></textFieldExpression> + </textField> + <textField> + <reportElement uuid="9eebfdd7-504b-4e98-8893-63bdb8c02b54" x="468" y="40" width="87" height="11"/> + <textElement> + <font size="8"/> + </textElement> + <textFieldExpression><![CDATA[$P{P_TOTAL_NOMINAL}]]></textFieldExpression> + </textField> + <textField> + <reportElement uuid="0eccc14c-3288-43e8-8731-7c876e4d659e" x="309" y="15" width="100" height="15"/> + <textElement/> + <textFieldExpression><![CDATA[$P{DATA}]]></textFieldExpression> + </textField> + </band> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/utilitarios/IDataSource.java b/src/java/com/rjconsultores/ventaboletos/relatorios/utilitarios/IDataSource.java new file mode 100644 index 000000000..eed0e9194 --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/utilitarios/IDataSource.java @@ -0,0 +1,13 @@ +package com.rjconsultores.ventaboletos.relatorios.utilitarios; + +import net.sf.jasperreports.engine.JRDataSource; + +/** + * Interface para desacoplamento do datasource + * + * @author Bruno H. G. Gouvêa + * + */ +public interface IDataSource extends JRDataSource { + +} \ No newline at end of file diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/utilitarios/IParametros.java b/src/java/com/rjconsultores/ventaboletos/relatorios/utilitarios/IParametros.java new file mode 100644 index 000000000..fced7e5f7 --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/utilitarios/IParametros.java @@ -0,0 +1,25 @@ +/** + * + */ +package com.rjconsultores.ventaboletos.relatorios.utilitarios; + +import java.sql.Connection; +import java.util.Map; + +/** + * @author Bruno H. G. Gouvêa + * + */ +public interface IParametros { + + + + + /** + * @param parametros + * @param connection + * @throws Exception + */ + void initParametros(Map parametros, Connection connection) throws Exception; + +} diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/utilitarios/IRenderRelatorio.java b/src/java/com/rjconsultores/ventaboletos/relatorios/utilitarios/IRenderRelatorio.java new file mode 100644 index 000000000..1f5b18db1 --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/utilitarios/IRenderRelatorio.java @@ -0,0 +1,23 @@ +package com.rjconsultores.ventaboletos.relatorios.utilitarios; + +/** + * Interface de renderização de relatórios + * + * @author Bruno H. G. Gouvêa + * + */ +public interface IRenderRelatorio { + + /** + * Retorna o relatório renderizado, ou chama a rederização caso seja necessário. + * + * @param saida + * Enum contendo o tipo da saida do relatório + * @return Retorna um array de bytes contendo o conteúdo do relatório renderizado. + * @throws Exception + * Excessão durante a renderização do relatório + */ + public byte[] getConteudo(SaidaRelatorio saida) throws Exception; + + +} \ No newline at end of file diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/utilitarios/Relatorio.java b/src/java/com/rjconsultores/ventaboletos/relatorios/utilitarios/Relatorio.java new file mode 100644 index 000000000..298b9c892 --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/utilitarios/Relatorio.java @@ -0,0 +1,97 @@ +package com.rjconsultores.ventaboletos.relatorios.utilitarios; + +import java.util.HashMap; +import java.util.Map; + +import com.rjconsultores.ventaboletos.relatorios.datasource.*; +import com.rjconsultores.ventaboletos.relatorios.parametros.*; + +/** + * + * Enum complexo contendo as configurações dos relatórios disponíveis no sistema. + * + * @author Bruno H. G. Gouvêa + * + */ +/** + * @author Bruno H. G. Gouvêa + * + */ +public enum Relatorio { + + RELATORIO_APROVEITAMENTO(1, "RelatorioAproveitamento.jasper", "Relatório de Aproveitamento",new RendimentoParamsImpl(), null), + RELATORIO_SERVICOS(2, "Servicos.jasper", "Relatório de Serviços", null, new Vendas2CustomDS()), + RELATORIO_EXEMPLO(3, "ExemploFoo.jrxml", "Relatório Foo", null, null); + + private int codigo; + private String template; + private String nome; + protected IDataSource datasource; + private IParametros parametros; + + private static Map mapCodigoToRelatorio; + + /** + * @param codigo + * Identificador do relatório + * @param template + * Arquivo de template do relatório + * @param nome + * Nome/Descrição do relátorio + * @param datasource + * Custom Data Source do relátorio, só deve ser informado caso o relátorio não possua acesso direto ao banco + */ + private Relatorio(int codigo, String template, String nome, IParametros parametros, IDataSource datasource) { + this.codigo = codigo; + this.setTemplate(template); + this.setNome(nome); + this.datasource = datasource; + this.parametros = parametros; + } + + public static Relatorio getRelatorio(int i) { + if (mapCodigoToRelatorio == null) { + initMapeamento(); + } + return mapCodigoToRelatorio.get(i); + } + + private static void initMapeamento() { + mapCodigoToRelatorio = new HashMap(); + for (Relatorio s : values()) { + mapCodigoToRelatorio.put(s.codigo, s); + } + } + + public String getTemplate() { + return template; + } + + public void setTemplate(String template) { + this.template = template; + } + + public String getNome() { + return nome; + } + + public void setNome(String nome) { + this.nome = nome; + } + + public IDataSource getDatasource() { + return datasource; + } + + public void setDatasource(IDataSource datasource) { + this.datasource = datasource; + } + + public IParametros getParametros() { + return parametros; + } + + public void setParametros(IParametros parametros) { + this.parametros = parametros; + } +} \ No newline at end of file diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/utilitarios/SaidaRelatorio.java b/src/java/com/rjconsultores/ventaboletos/relatorios/utilitarios/SaidaRelatorio.java new file mode 100644 index 000000000..acb164ea5 --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/utilitarios/SaidaRelatorio.java @@ -0,0 +1,11 @@ +package com.rjconsultores.ventaboletos.relatorios.utilitarios; + +/** + * + * + * @author Bruno H. G. Gouvêa + * + */ +public enum SaidaRelatorio { + PDF,XLS +} diff --git a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioAproveitamentoController.java b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioAproveitamentoController.java new file mode 100644 index 000000000..5b6f59e5c --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioAproveitamentoController.java @@ -0,0 +1,101 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +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.zk.ui.Component; +import org.zkoss.zk.ui.event.Event; +import org.zkoss.zul.Datebox; +import org.zkoss.zul.Div; +import org.zkoss.zul.Iframe; + +import com.rjconsultores.ventaboletos.relatorios.render.RenderRelatorioJasper; +import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio; +import com.rjconsultores.ventaboletos.utilerias.DateUtil; +import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer; +import com.rjconsultores.ventaboletos.web.utilerias.MyTextbox; + +/** + * + * @author Administrador + */ +@Controller("relatorioAproveitamentoController") +@Scope("prototype") +public class RelatorioAproveitamentoController extends MyGenericForwardComposer { + + private Datebox fecCorrida; + private Div divResultadoRelatorio; + private Iframe iframeRelatorio; + private MyTextbox txtCorridaId; + + @Autowired + private DataSource dataSource; + + public Iframe getIframeRelatorio() { + return iframeRelatorio; + } + + public void setIframeRelatorio(Iframe iframeRelatorio) { + this.iframeRelatorio = iframeRelatorio; + } + + public Div getDivResultadoRelatorio() { + return divResultadoRelatorio; + } + + public void setDivResultadoRelatorio(Div divResultadoRelatorio) { + this.divResultadoRelatorio = divResultadoRelatorio; + } + + public Datebox getFecCorrida() { + return fecCorrida; + } + + public void setFecCorrida(Datebox fecCorrida) { + this.fecCorrida = fecCorrida; + } + + @Override + public void doAfterCompose(Component comp) throws Exception { + super.doAfterCompose(comp); + + } + + public void onClick$btnExecutarRelatorio(Event ev) throws Exception { + executarRelatorio(); + } + + /** + * @throws Exception + * + */ + private void executarRelatorio() throws Exception { + + Map parametros = new HashMap(); + + RenderRelatorioJasper render = new RenderRelatorioJasper(Relatorio.RELATORIO_APROVEITAMENTO, dataSource.getConnection()); + + parametros.put("CORRIDA_ID", this.txtCorridaId.getValue()); + parametros.put("FECCORRIDA", new java.sql.Date(((java.util.Date) this.fecCorrida.getValue()).getTime())); + parametros.put("DATA", DateUtil.getStringDate((java.util.Date) this.fecCorrida.getValue())); // Utilizada para exibição no cabeçalho + + render.setParametros(parametros); + + Map args = new HashMap(); + args.put("renderRelatorio", render); + + openWindow("/component/reportView.zul", + Relatorio.RELATORIO_APROVEITAMENTO.getNome(), args, MODAL); + + } + +} diff --git a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioController.java b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioController.java new file mode 100644 index 000000000..9cf65d4f4 --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioController.java @@ -0,0 +1,133 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.web.gui.controladores.relatorios; + + +import java.io.ByteArrayInputStream; +import java.io.InputStream; + +import org.springframework.context.annotation.Scope; +import org.springframework.stereotype.Controller; +import org.zkoss.util.media.AMedia; +import org.zkoss.zk.ui.Component; +import org.zkoss.zk.ui.Executions; +import org.zkoss.zk.ui.event.Event; +import org.zkoss.zul.Div; +import org.zkoss.zul.Filedownload; +import org.zkoss.zul.Iframe; +import org.zkoss.zul.Toolbarbutton; + +import com.rjconsultores.ventaboletos.relatorios.render.RenderRelatorioJasper; +import com.rjconsultores.ventaboletos.relatorios.utilitarios.SaidaRelatorio; +import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer; + +/** + * + * @author Administrador + */ +@Controller("relatorioController") +@Scope("prototype") +public class RelatorioController extends MyGenericForwardComposer { + + + private Div divResultadoRelatorio; + private Iframe iframeRelatorio; + private Toolbarbutton btnSalvarPDF; + private Toolbarbutton btnSalvarXLS; + private AMedia conteudoRelatorioPDF; + private AMedia conteudoRelatorioXLS; + private RenderRelatorioJasper renderRelatorio; + + + /** + * @return the btnSalvarPDF + */ + public Toolbarbutton getBtnSalvarPDF() { + return btnSalvarPDF; + } + + + /** + * @param btnSalvarPDF the btnSalvarPDF to set + */ + public void setBtnSalvarPDF(Toolbarbutton btnSalvarPDF) { + this.btnSalvarPDF = btnSalvarPDF; + } + + + /** + * @return the btnSalvarXLS + */ + public Toolbarbutton getBtnSalvarXLS() { + return btnSalvarXLS; + } + + + /** + * @param btnSalvarXLS the btnSalvarXLS to set + */ + public void setBtnSalvarXLS(Toolbarbutton btnSalvarXLS) { + this.btnSalvarXLS = btnSalvarXLS; + } + + + + public Iframe getIframeRelatorio() { + return iframeRelatorio; + } + + + public void setIframeRelatorio(Iframe iframeRelatorio) { + this.iframeRelatorio = iframeRelatorio; + } + + + public Div getDivResultadoRelatorio() { + return divResultadoRelatorio; + } + + + public void setDivResultadoRelatorio(Div divResultadoRelatorio) { + this.divResultadoRelatorio = divResultadoRelatorio; + } + + + + @Override + public void doAfterCompose(Component comp) throws Exception { + super.doAfterCompose(comp); + + this.renderRelatorio = (RenderRelatorioJasper) Executions.getCurrent().getArg().get("renderRelatorio"); + + final InputStream mediais = new ByteArrayInputStream(this.renderRelatorio.getConteudo(SaidaRelatorio.PDF)); + + conteudoRelatorioPDF = new AMedia("relatorio.pdf", "pdf", null, mediais); + + + + iframeRelatorio.setContent(conteudoRelatorioPDF); + + + } + + + public void onClick$btnSalvarPDF(Event ev) { + Filedownload.save(conteudoRelatorioPDF.getStreamData(), "application/pdf", "relatorio.pdf"); + } + + public void onClick$btnSalvarXLS(Event ev) throws Exception { + final InputStream mediais = new ByteArrayInputStream(this.renderRelatorio.getConteudo(SaidaRelatorio.XLS)); + + conteudoRelatorioXLS = new AMedia("relatorio.xls", "xls", null, mediais); + Filedownload.save(conteudoRelatorioXLS.getStreamData(), "application/xls", "relatorio.xls"); + } + + + + + + + +} diff --git a/src/java/com/rjconsultores/ventaboletos/web/utilerias/CurrencyUtil.java b/src/java/com/rjconsultores/ventaboletos/web/utilerias/CurrencyUtil.java new file mode 100644 index 000000000..8cce24545 --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/web/utilerias/CurrencyUtil.java @@ -0,0 +1,30 @@ +/** + * + */ +package com.rjconsultores.ventaboletos.web.utilerias; + +import java.text.DecimalFormat; +import java.util.Currency; + +/** + * @author Bruno H. G. Gouvêa + * + */ +public final class CurrencyUtil { + + + public static String getCurrencyStrFromStr(String value){ + + + double doubleValue = Double.parseDouble(value); + Currency currency = Currency.getInstance("BRL"); + DecimalFormat formato = new DecimalFormat(currency.getSymbol() + "#,##0.00"); + + + + + return formato.format(doubleValue); + + } + +} diff --git a/src/java/com/rjconsultores/ventaboletos/web/utilerias/menu/item/relatorios/ItemMenuRelatorioAproveitamento.java b/src/java/com/rjconsultores/ventaboletos/web/utilerias/menu/item/relatorios/ItemMenuRelatorioAproveitamento.java new file mode 100644 index 000000000..d2c80d3f4 --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/web/utilerias/menu/item/relatorios/ItemMenuRelatorioAproveitamento.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 ItemMenuRelatorioAproveitamento extends DefaultItemMenuSistema { + + public ItemMenuRelatorioAproveitamento() { + super("indexController.mniRelatorioAproveitamento.label"); + } + + @Override + public String getClaveMenu() { + return "COM.RJCONSULTORES.ADMINISTRACION.GUI.RELATORIOS.MENU.RELATORIOAPROVEITAMENTO"; + } + + @Override + public void ejecutar() { + PantallaUtileria.openWindow("/gui/relatorios/filtroRelatorioAproveitamento.zul", + Labels.getLabel("relatorioAproveitamentoController.window.title"), null,desktop); + + } +} diff --git a/src/java/com/rjconsultores/ventaboletos/web/utilerias/menu/item/relatorios/MenuRelatorios.java b/src/java/com/rjconsultores/ventaboletos/web/utilerias/menu/item/relatorios/MenuRelatorios.java new file mode 100644 index 000000000..cf5c858af --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/web/utilerias/menu/item/relatorios/MenuRelatorios.java @@ -0,0 +1,16 @@ +package com.rjconsultores.ventaboletos.web.utilerias.menu.item.relatorios; + +import com.rjconsultores.ventaboletos.web.utilerias.menu.DefaultItemMenuSistema; + +public class MenuRelatorios extends DefaultItemMenuSistema { + + public MenuRelatorios() { + super("indexController.mniRelatorios.label"); + } + + @Override + public String getClaveMenu() { + return "COM.RJCONSULTORES.ADMINISTRACION.GUI.RELATORIOS"; + } + +} diff --git a/src/java/com/rjconsultores/ventaboletos/web/utilerias/menu/menu_original.properties b/src/java/com/rjconsultores/ventaboletos/web/utilerias/menu/menu_original.properties index af749aa9b..4539dace0 100644 --- a/src/java/com/rjconsultores/ventaboletos/web/utilerias/menu/menu_original.properties +++ b/src/java/com/rjconsultores/ventaboletos/web/utilerias/menu/menu_original.properties @@ -110,3 +110,5 @@ informes.categoriaVenta=com.rjconsultores.ventaboletos.web.utilerias.menu.item.i informes.ventasPuntoVenta=com.rjconsultores.ventaboletos.web.utilerias.menu.item.informes.ItemMenuVentasPuntoVenta ayuda=com.rjconsultores.ventaboletos.web.utilerias.menu.item.ayuda.MenuAyuda ayuda.version=com.rjconsultores.ventaboletos.web.utilerias.menu.item.ayuda.ItemMenuVersion +relatorios=com.rjconsultores.ventaboletos.web.utilerias.menu.item.relatorios.MenuRelatorios +relatorios.relatorioAproveitamento=com.rjconsultores.ventaboletos.web.utilerias.menu.item.relatorios.ItemMenuRelatorioAproveitamento diff --git a/web/WEB-INF/i3-label_pt_BR.label b/web/WEB-INF/i3-label_pt_BR.label index 06bb4025d..657ee2ffa 100644 --- a/web/WEB-INF/i3-label_pt_BR.label +++ b/web/WEB-INF/i3-label_pt_BR.label @@ -56,6 +56,10 @@ MSG.necesita.formaPago = Forma de Pagamento Obrigatória lb.id = ID lb.dec = Descrição lb.Equivalencia = Equivalencia +lb.btnExecutarRelatorio = Executar Relatório +lb.btnSalvarRelatorio = Salvar Relatório +lb.btnSalvarRelatorioPdf = Salvar Relatório em PDF +lb.btnSalvarRelatorioXls = Salvar Relatório em XLS # tooltip botões @@ -66,6 +70,7 @@ tooltiptext.btnAgregar = Incluir tooltiptext.btnGuardar = Salvar tooltiptext.btnPesquisa = Pesquisa + # Pantalla de início de sesión: winLogin.title = Conectar winLogin.lblUsuario = Usuário: @@ -201,6 +206,8 @@ indexController.mniConfigLayoutImpressaoBoleto.label = Config Layout Impressão indexController.mniAliasServico.label = Alias Localidade indexController.mniCliente.label = Cliente indexController.mniTarjetaCredito.label = Cartão de Crédito +indexController.mniRelatorios.label = Relatórios +indexController.mniRelatorioAproveitamento.label = Relatório de Aproveitamento #PARTE REALIZADA POR MANUEL indexController.mnCortesias.label = Cortesias Para Funcionários @@ -224,6 +231,11 @@ busquedaClaseServicioController.btnPesquisa.label = Pesquisa busquedaClaseServicioController.lhDesc.label = Descrição busquedaClaseServicioController.lhId.label = ID +#Relatórios +relatorioAproveitamentoController.window.title = Relatório de Aproveitamento +relatorioAproveitamentoController.lbFecCorrida.value = Data Serviço +relatorioAproveitamentoController.lbServico.value = N. Serviço + # Pantalla Editar Classe editarClaseServicioController.window.title = Tipo de Classe editarClaseServicioController.btnApagar.tooltiptext = Eliminar diff --git a/web/component/reportView.zul b/web/component/reportView.zul new file mode 100644 index 000000000..f790eeea6 --- /dev/null +++ b/web/component/reportView.zul @@ -0,0 +1,30 @@ + + + + + + + + + +
+ + + + + + + + + +