diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioReceitaDiariaAgencia_pt_BR.properties b/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioReceitaDiariaAgencia_pt_BR.properties
new file mode 100644
index 000000000..735c7ea62
--- /dev/null
+++ b/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioReceitaDiariaAgencia_pt_BR.properties
@@ -0,0 +1,10 @@
+#geral
+msg.noData=Não foi possivel obter dados com os parâmetros informados.
+
+#Labels cabeçalho
+cabecalho.relatorio=Relatório:
+cabecalho.periodo=Período:
+cabecalho.periodoA=à
+
+rodape.pagina=Página
+rodape.de=de
\ No newline at end of file
diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/parametros/RendimentoParamsImpl.java b/src/java/com/rjconsultores/ventaboletos/relatorios/parametros/RendimentoParamsImpl.java
index 64dc0b6ff..ce9b3f682 100644
--- a/src/java/com/rjconsultores/ventaboletos/relatorios/parametros/RendimentoParamsImpl.java
+++ b/src/java/com/rjconsultores/ventaboletos/relatorios/parametros/RendimentoParamsImpl.java
@@ -57,7 +57,7 @@ public class RendimentoParamsImpl implements IParametros {
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_ARRECADADO / TAB.KM_NOMINAL,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(" (TAB.TOTAL_OCUPADOS/TAB.TOTAL_ACENTOS) OCUPACAO, ");
@@ -73,7 +73,7 @@ public class RendimentoParamsImpl implements IParametros {
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(" (SELECT SUM(TR.CANTKMREAL) ");
sql.append(" FROM CORRIDA_TRAMO CT, ");
sql.append(" TRAMO TR, ");
sql.append(" ROL_OPERATIVO RO, ");
diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/render/RenderRelatorioAbstract.java b/src/java/com/rjconsultores/ventaboletos/relatorios/render/RenderRelatorioAbstract.java
index 5fd231e11..12b59c2c0 100644
--- a/src/java/com/rjconsultores/ventaboletos/relatorios/render/RenderRelatorioAbstract.java
+++ b/src/java/com/rjconsultores/ventaboletos/relatorios/render/RenderRelatorioAbstract.java
@@ -1,5 +1,6 @@
package com.rjconsultores.ventaboletos.relatorios.render;
+import java.io.InputStream;
import java.sql.Connection;
import java.util.HashMap;
import java.util.Map;
@@ -43,6 +44,14 @@ public abstract class RenderRelatorioAbstract implements IRenderRelatorio {
* Excessão durante a renderização do relatório
*/
protected abstract byte[] render(SaidaRelatorio saida) throws Exception;
+
+
+ protected abstract InputStream getTemplateInputStream() throws Exception;
+
+ protected abstract byte[] renderPdf() throws Exception;
+
+ protected abstract byte[] renderXls() throws Exception;
+
/**
* @param relatorio
@@ -66,8 +75,7 @@ public abstract class RenderRelatorioAbstract implements IRenderRelatorio {
public void initParametros(){
this.parametros.put("NOME_RELATORIO", this.relatorio.getDescricao());
- this.parametros.put("MSG_NO_DATA", this.relatorio.getNome());
-
+
}
/*
@@ -81,5 +89,7 @@ public abstract class RenderRelatorioAbstract implements IRenderRelatorio {
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
index f1f7a3d46..26c4b7411 100644
--- a/src/java/com/rjconsultores/ventaboletos/relatorios/render/RenderRelatorioJasper.java
+++ b/src/java/com/rjconsultores/ventaboletos/relatorios/render/RenderRelatorioJasper.java
@@ -7,6 +7,7 @@ import java.util.Locale;
import java.util.ResourceBundle;
import net.sf.jasperreports.engine.JRDataSource;
+import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JRParameter;
import net.sf.jasperreports.engine.JasperExportManager;
import net.sf.jasperreports.engine.JasperFillManager;
@@ -56,20 +57,43 @@ public class RenderRelatorioJasper extends RenderRelatorioAbstract {
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.");
}
-
+
@Override
- public void preRender(){
+ public void preRender() {
super.preRender();
this.initBundler();
-
+ this.initLocale();
+
}
-
- private void initBundler(){
+
+ private void initBundler() {
// TODO Alterar para injeção de acordo com usuário logado ou outro meio para obter o Locale correto
Locale locale = new Locale("pt", "BR");
- ResourceBundle resource = ResourceBundle.getBundle("com.rjconsultores.ventaboletos.relatorios.internacionalizacao."+this.relatorio.getNome(), locale);
-
- this.parametros.put(JRParameter.REPORT_RESOURCE_BUNDLE, resource);
+ try {
+
+ ResourceBundle resource = ResourceBundle.getBundle("com.rjconsultores.ventaboletos.relatorios.internacionalizacao." + this.relatorio.getNome(), locale);
+ this.parametros.put(JRParameter.REPORT_RESOURCE_BUNDLE, resource);
+ } catch (Exception e) {
+ }
+ }
+
+ private void initLocale() {
+ // TODO Alterar para injeção de acordo com usuário logado ou outro meio para obter o Locale correto
+ Locale locale = new Locale("pt", "BR");
+ this.parametros.put(JRParameter.REPORT_LOCALE, locale);
+ }
+
+ protected InputStream getTemplateInputStream() throws Exception {
+ String diretorio = "/com/rjconsultores/ventaboletos/relatorios/templates/" + this.relatorio.getNome() + ".jasper";
+ InputStream iStemplate = this.getClass().getResourceAsStream(diretorio);
+
+ if (iStemplate == null)
+ {
+ throw new Exception("Não foi possivel localizar o template do relátorio no diretorio a seguir: " + diretorio);
+ }
+
+ return iStemplate;
+
}
/*
@@ -86,36 +110,47 @@ public class RenderRelatorioJasper extends RenderRelatorioAbstract {
if (this.relatorio.getParametros() != null)
this.relatorio.getParametros().processaParametros(this.parametros, this.connection);
- InputStream iStemplate = this.getClass().getResourceAsStream("/com/rjconsultores/ventaboletos/relatorios/templates/" + this.relatorio.getNome()+".jasper");
-
if (this.relatorio.getDatasource() != null)
- this.jasperPrint = JasperFillManager.fillReport(iStemplate, this.getParametros(), (JRDataSource) this.datasource);
+ this.jasperPrint = JasperFillManager.fillReport(this.getTemplateInputStream(), this.getParametros(), (JRDataSource) this.datasource);
else
- this.jasperPrint = JasperFillManager.fillReport(iStemplate, this.getParametros(), this.connection);
+ this.jasperPrint = JasperFillManager.fillReport(this.getTemplateInputStream(), this.getParametros(), this.connection);
}
+
switch (saida) {
case PDF:
- conteudo = JasperExportManager.exportReportToPdf(this.jasperPrint);
+ conteudo = this.renderPdf();
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();
+ conteudo = this.renderXls();
break;
}
return conteudo;
}
+
+ protected byte[] renderXls() throws Exception {
+
+ 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();
+ return output.toByteArray();
+
+ }
+
+ protected byte[] renderPdf() throws Exception {
+
+ return JasperExportManager.exportReportToPdf(this.jasperPrint);
+
+ }
}
diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioReceitaDiariaAgencia.jasper b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioReceitaDiariaAgencia.jasper
new file mode 100644
index 000000000..4c13e2f88
Binary files /dev/null and b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioReceitaDiariaAgencia.jasper differ
diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioReceitaDiariaAgencia.jrxml b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioReceitaDiariaAgencia.jrxml
new file mode 100644
index 000000000..c2d3c0214
--- /dev/null
+++ b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioReceitaDiariaAgencia.jrxml
@@ -0,0 +1,799 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 18 THEN
+ 1
+ ELSE
+ 0
+ END) total_bilhetes,
+
+ sum(CASE
+ WHEN cj.motivocancelacion_id is not null THEN
+ 1
+ ELSE
+ 0
+ END) total_bilhetes_canc,
+ sum(CASE
+ WHEN cj.motivocancelacion_id is null and
+ cj.tipoventa_id = 18 THEN
+ 1
+ ELSE
+ 0
+ END) total_bilhetes_gap,
+ sum(CASE
+ WHEN cj.motivocancelacion_id is null and
+ cj.tipoventa_id <> 18 THEN
+ cj.preciopagado
+ ELSE
+ 0
+ END) receita_tarifa,
+ sum(CASE
+ WHEN cj.motivocancelacion_id is null and
+ cj.tipoventa_id = 18 THEN
+ cj.preciopagado
+ ELSE
+ 0
+ END) receita_tarifa_gap,
+ sum(CASE
+ WHEN cj.motivocancelacion_id is null and
+ cj.tipoventa_id <> 18 THEN
+ cj.importeseguro
+ ELSE
+ 0
+ END) receita_seguro,
+ sum(CASE
+ WHEN cj.motivocancelacion_id is null and
+ cj.tipoventa_id = 18 THEN
+ cj.importeseguro
+ ELSE
+ 0
+ END) receita_seguro_gap,
+ sum(CASE
+ WHEN cj.motivocancelacion_id is null and
+ cj.tipoventa_id <> 18 THEN
+ cj.importetaxaembarque
+ ELSE
+ 0
+ END) receita_embarque,
+ sum(CASE
+ WHEN cj.motivocancelacion_id is null and
+ cj.tipoventa_id = 18 THEN
+ cj.importetaxaembarque
+ ELSE
+ 0
+ END) receita_embarque_gap,
+ sum(CASE
+ WHEN cj.motivocancelacion_id is null and
+ cj.tipoventa_id <> 18 THEN
+ cj.importeoutros
+ ELSE
+ 0
+ END) receita_outros,
+ sum(CASE
+ WHEN cj.motivocancelacion_id is null and
+ cj.tipoventa_id = 18 THEN
+ cj.importeoutros
+ ELSE
+ 0
+ END) receita_outros_gap,
+ sum(CASE
+ WHEN cj.motivocancelacion_id is null and
+ cj.tipoventa_id <> 18 THEN
+ cj.importepedagio
+ ELSE
+ 0
+ END) receita_pedagio,
+ sum(CASE
+ WHEN cj.motivocancelacion_id is null and
+ cj.tipoventa_id = 18 THEN
+ cj.importepedagio
+ ELSE
+ 0
+ END) receita_pedagio_gap,
+
+ sum(CASE
+ WHEN cj.motivocancelacion_id in (31, 32) and
+ cj.tipoventa_id <> 18 THEN
+ cj.preciopagado
+ ELSE
+ 0
+ END) total_devol,
+ sum(CASE
+ WHEN cj.motivocancelacion_id in (31, 32) and
+ cj.tipoventa_id = 18 THEN
+ cj.preciopagado
+ ELSE
+ 0
+ END) total_devol_gap
+ from vtabol.caja cj,
+ vtabol.punto_venta pv,
+ vtabol.parada pr,
+ vtabol.ciudad cd,
+ vtabol.estado es
+ where cj.puntoventa_id = pv.puntoventa_id
+ and trunc(cj.fechorventa) between $P{DATA_INICIO} and $P{DATA_FINAL}
+ and pr.parada_id = pv.parada_id
+ and cd.ciudad_id = pr.ciudad_id
+ and cd.estado_id = es.estado_id
+ and es.estado_id = nvl($P{ESTADO_ID}, es.estado_id)
+ and (($X{IN, numpuntoventa, NUMPUNTOVENTA} and $P{ISNUMPUNTOVENTATODOS} = 'N')or($P{ISNUMPUNTOVENTATODOS} = 'S'))
+ group by es.cveestado, pv.puntoventa_id, pv.numpuntoventa, pv.nombpuntoventa) tab,
+ vtabol.evento_extra ee
+ where trunc(ee.fechoringreso(+)) between $P{DATA_INICIO} and $P{DATA_FINAL}
+ and ee.puntoventa_id(+) = tab.puntoventa_id
+
+ group by tab.cveestado,
+ tab.puntoventa_id,
+ tab.numpuntoventa,
+ tab.nombpuntoventa,
+ tab.total_bilhetes,
+ tab.total_bilhetes_gap,
+ tab.receita_tarifa,
+ tab.receita_seguro,
+ tab.total_devol,
+ tab.receita_tarifa_gap,
+ tab.receita_seguro_gap,
+ tab.total_devol_gap,
+ tab.total_bilhetes_canc) tab1]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/utilitarios/Relatorio.java b/src/java/com/rjconsultores/ventaboletos/relatorios/utilitarios/Relatorio.java
index f56f26e5c..af7c909ab 100644
--- a/src/java/com/rjconsultores/ventaboletos/relatorios/utilitarios/Relatorio.java
+++ b/src/java/com/rjconsultores/ventaboletos/relatorios/utilitarios/Relatorio.java
@@ -20,8 +20,8 @@ import com.rjconsultores.ventaboletos.relatorios.parametros.*;
public enum Relatorio {
RELATORIO_APROVEITAMENTO(1, "RelatorioAproveitamento", "Relatório de Aproveitamento",new RendimentoParamsImpl(), null),
- RELATORIO_SERVICOS(2, "Servicosr", "Relatório de Serviços", null, new Vendas2CustomDS()),
- RELATORIO_EXEMPLO(3, "ExemploFoo", "Relatório Foo", null, null);
+ RELATORIO_RECEITA_DIARIA_AGENCIA(2, "RelatorioReceitaDiariaAgencia", "Relatório de Receita Diária por Agência", null, null),
+ RELATORIO_EXEMPLO(99, "ExemploFoo", "Relatório Foo", null, null);
private int codigo;
private String nome;
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
index 5b6f59e5c..15ac0289e 100644
--- a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioAproveitamentoController.java
+++ b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioAproveitamentoController.java
@@ -4,6 +4,7 @@
*/
package com.rjconsultores.ventaboletos.web.gui.controladores.relatorios;
+import java.util.Date;
import java.util.HashMap;
import java.util.Map;
@@ -12,17 +13,30 @@ 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.zhtml.Messagebox;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.event.Event;
+import org.zkoss.zul.Button;
+import org.zkoss.zul.Comboitem;
+import org.zkoss.zul.ComboitemRenderer;
import org.zkoss.zul.Datebox;
-import org.zkoss.zul.Div;
-import org.zkoss.zul.Iframe;
+import org.zkoss.zul.Paging;
+import com.rjconsultores.ventaboletos.entidad.Corrida;
+import com.rjconsultores.ventaboletos.entidad.Parada;
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.MyComboboxParada;
+import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxParadaCve;
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
+import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
import com.rjconsultores.ventaboletos.web.utilerias.MyTextbox;
+import com.rjconsultores.ventaboletos.web.utilerias.paginacion.HibernateSearchObject;
+import com.rjconsultores.ventaboletos.web.utilerias.paginacion.PagedListWrapper;
+import com.rjconsultores.ventaboletos.web.utilerias.render.RenderCorrida;
+import com.rjconsultores.ventaboletos.web.utilerias.render.RenderCorridaAproveitamento;
/**
*
@@ -33,28 +47,22 @@ import com.rjconsultores.ventaboletos.web.utilerias.MyTextbox;
public class RelatorioAproveitamentoController extends MyGenericForwardComposer {
private Datebox fecCorrida;
- private Div divResultadoRelatorio;
- private Iframe iframeRelatorio;
private MyTextbox txtCorridaId;
+ private MyComboboxParada cmbParadaOrigem;
+ private MyComboboxParadaCve cmbParadaOrigemCve;
+ private MyComboboxParada cmbParadaDestino;
+ private MyComboboxParadaCve cmbParadaDestinoCve;
+ private Button btnExecutarRelatorio;
+
+ private MyListbox corridaList;
+ private Paging pagingCorrida;
+
@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;
- }
+ @Autowired
+ private transient PagedListWrapper plwCorrida;
public Datebox getFecCorrida() {
return fecCorrida;
@@ -68,10 +76,132 @@ public class RelatorioAproveitamentoController extends MyGenericForwardComposer
public void doAfterCompose(Component comp) throws Exception {
super.doAfterCompose(comp);
+ corridaList.setItemRenderer(new RenderCorridaAproveitamento());
+
+ btnExecutarRelatorio.setDisabled(true);
+
+ cmbParadaOrigemCve.setItemRenderer(new ComboitemRenderer() {
+
+ @Override
+ public void render(Comboitem cmbtm, Object o) throws Exception {
+ Parada parada = (Parada) o;
+
+ cmbtm.setLabel(parada.getCveparada());
+ cmbtm.setValue(parada);
+
+ }
+ });
+
+ cmbParadaDestinoCve.setItemRenderer(new ComboitemRenderer() {
+
+ @Override
+ public void render(Comboitem cmbtm, Object o) throws Exception {
+ Parada parada = (Parada) o;
+
+ cmbtm.setLabel(parada.getCveparada());
+ cmbtm.setValue(parada);
+
+ }
+ });
+
}
+ public void onClick$btnBuscarServico(Event ev) throws Exception {
+ refreshLista();
+ }
+
+
public void onClick$btnExecutarRelatorio(Event ev) throws Exception {
- executarRelatorio();
+ executarRelatorio();
+ }
+
+ public void onSelect$cmbParadaOrigemCve(Event ev) {
+ if (cmbParadaOrigemCve.getSelectedItem() != null) {
+ cmbParadaOrigem.setComboItemByParada((Parada) cmbParadaOrigemCve.getSelectedItem().getValue());
+ }
+
+ }
+
+ public void onSelect$cmbParadaOrigem(Event ev) {
+
+ if (cmbParadaOrigem.getSelectedItem() != null)
+ cmbParadaOrigemCve.setComboItemByParada((Parada) cmbParadaOrigem.getSelectedItem().getValue());
+
+ }
+
+ public void onSelect$cmbParadaDestinoCve(Event ev) {
+
+ if (cmbParadaDestinoCve.getSelectedItem() != null)
+ cmbParadaDestino.setComboItemByParada((Parada) cmbParadaDestinoCve.getSelectedItem().getValue());
+
+ }
+
+ public void onSelect$cmbParadaDestino(Event ev) {
+
+ if (cmbParadaDestino.getSelectedItem() != null)
+ cmbParadaDestinoCve.setComboItemByParada((Parada) cmbParadaDestino.getSelectedItem().getValue());
+
+ }
+ public void onSelect$corridaList(Event ev) {
+ txtCorridaId.setValue(((Corrida)corridaList.getSelected()).getId().getCorridaId().toString());
+ btnExecutarRelatorio.setDisabled(false);
+
+ }
+
+
+
+ private void refreshLista() {
+ btnExecutarRelatorio.setDisabled(true);
+ HibernateSearchObject corridaBusqueda =
+ new HibernateSearchObject(Corrida.class,
+ pagingCorrida.getPageSize());
+
+
+ Comboitem cbiOrigem = cmbParadaOrigem.getSelectedItem();
+ if (cbiOrigem != null) {
+ Parada origem = (Parada) cbiOrigem.getValue();
+ corridaBusqueda.addFilterEqual("origem", origem);
+ }
+
+ Comboitem cbiDestino = cmbParadaDestino.getSelectedItem();
+ if (cbiDestino != null) {
+ Parada destino = (Parada) cbiDestino.getValue();
+ corridaBusqueda.addFilterEqual("destino", destino);
+ }
+
+ if (fecCorrida.getValue() != null) {
+ Date data = fecCorrida.getValue();
+ data.setHours(00);
+ data.setMinutes(00);
+ data.setSeconds(00);
+ corridaBusqueda.addFilterEqual("id.feccorrida", data);
+ }
+
+
+ if(txtCorridaId.getValue() != null && !txtCorridaId.getValue().isEmpty()){
+ corridaBusqueda.addFilterEqual("id.corridaId", new Integer(txtCorridaId.getValue()));
+ }
+
+
+ corridaBusqueda.addFilterEqual("activo", Boolean.TRUE);
+
+ plwCorrida.init(corridaBusqueda, corridaList,
+ pagingCorrida);
+
+ if (corridaList.getData().length == 0) {
+ try {
+ Messagebox.show(Labels.getLabel("MSG.ningunRegistro"),
+ Labels.getLabel("relatorioAproveitamentoController.window.title"),
+ Messagebox.OK, Messagebox.INFORMATION);
+ } catch (InterruptedException ex) {
+ }
+ }
+
+ if (corridaList.getData().length == 1) {
+ corridaList.setSelectedIndex(0);
+ btnExecutarRelatorio.setDisabled(false);
+ }
+
}
/**
@@ -94,7 +224,7 @@ public class RelatorioAproveitamentoController extends MyGenericForwardComposer
args.put("renderRelatorio", render);
openWindow("/component/reportView.zul",
- Relatorio.RELATORIO_APROVEITAMENTO.getNome(), args, MODAL);
+ Relatorio.RELATORIO_APROVEITAMENTO.getDescricao(), args, MODAL);
}
diff --git a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioReceitaDiariaAgenciaController.java b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioReceitaDiariaAgenciaController.java
new file mode 100644
index 000000000..55fdd5696
--- /dev/null
+++ b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioReceitaDiariaAgenciaController.java
@@ -0,0 +1,276 @@
+/*
+ * 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.ArrayList;
+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.zhtml.Messagebox;
+import org.zkoss.zk.ui.Component;
+import org.zkoss.zk.ui.event.Event;
+import org.zkoss.zk.ui.event.EventListener;
+import org.zkoss.zk.ui.event.ForwardEvent;
+import org.zkoss.zul.Bandbox;
+import org.zkoss.zul.Checkbox;
+import org.zkoss.zul.Combobox;
+import org.zkoss.zul.Comboitem;
+import org.zkoss.zul.Datebox;
+import org.zkoss.zul.Div;
+import org.zkoss.zul.Iframe;
+import org.zkoss.zul.Listitem;
+import org.zkoss.zul.Paging;
+import org.zkoss.zul.Textbox;
+import org.zkoss.zul.event.PagingEvent;
+
+import com.rjconsultores.ventaboletos.entidad.Articulo;
+import com.rjconsultores.ventaboletos.entidad.Estado;
+import com.rjconsultores.ventaboletos.entidad.Pais;
+import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
+import com.rjconsultores.ventaboletos.relatorios.render.RenderRelatorioJasper;
+import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio;
+import com.rjconsultores.ventaboletos.service.EstadoService;
+import com.rjconsultores.ventaboletos.service.PaisService;
+import com.rjconsultores.ventaboletos.service.PuntoVentaService;
+import com.rjconsultores.ventaboletos.utilerias.DateUtil;
+import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
+import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
+import com.rjconsultores.ventaboletos.web.utilerias.MyTextbox;
+import com.rjconsultores.ventaboletos.web.utilerias.paginacion.HibernateSearchObject;
+import com.rjconsultores.ventaboletos.web.utilerias.paginacion.PagedListWrapper;
+import com.rjconsultores.ventaboletos.web.utilerias.render.RenderArticulo;
+import com.rjconsultores.ventaboletos.web.utilerias.render.RenderPuntoVenta;
+import com.rjconsultores.ventaboletos.web.utilerias.render.RenderPuntoVentaSimple;
+import com.trg.search.Filter;
+
+/**
+ *
+ * @author Administrador
+ */
+@Controller("relatorioReceitaDiariaAgenciaController")
+@Scope("prototype")
+public class RelatorioReceitaDiariaAgenciaController extends MyGenericForwardComposer {
+
+ @Autowired
+ private EstadoService estadoService;
+ @Autowired
+ private PuntoVentaService puntoVentaService;
+ @Autowired
+ private DataSource dataSource;
+ private List lsEstado;
+
+ private ArrayList lsNumPuntoVenta = new ArrayList();
+
+ @Autowired
+ private transient PagedListWrapper plwPuntoVenta;
+ private MyListbox puntoVentaList;
+ private Paging pagingPuntoVenta;
+
+ private Bandbox bbPesquisaPuntoVenta;
+
+ private Textbox txtPalavraPesquisa;
+ private Combobox cmbEstado;
+ private Combobox cmbPuntoVenta;
+ private Datebox datInicial;
+ private Datebox datFinal;
+ private Checkbox chkExcessoBagagem;
+
+ public Datebox getDatInicial() {
+ return datInicial;
+ }
+
+ public void setDatInicial(Datebox datInicial) {
+ this.datInicial = datInicial;
+ }
+
+ public Datebox getDatFinal() {
+ return datFinal;
+ }
+
+ public void setDatFinal(Datebox datFinal) {
+ this.datFinal = datFinal;
+ }
+
+ public List getLsEstado() {
+ return lsEstado;
+ }
+
+ public void setLsEstado(List lsEstado) {
+ this.lsEstado = lsEstado;
+ }
+
+ public Combobox getCmbEstado() {
+ return cmbEstado;
+ }
+
+ public void setCmbEstado(Combobox cmbEstado) {
+ this.cmbEstado = cmbEstado;
+ }
+
+ public Combobox getCmbPuntoVenta() {
+ return cmbPuntoVenta;
+ }
+
+ public void setCmbPuntoVenta(Combobox cmbPuntoVenta) {
+ this.cmbPuntoVenta = cmbPuntoVenta;
+ }
+
+ public MyListbox getPuntoVentaList() {
+ return puntoVentaList;
+ }
+
+ public void setPuntoVentaList(MyListbox puntoVentaList) {
+ this.puntoVentaList = puntoVentaList;
+ }
+
+ public Paging getPagingPuntoVenta() {
+ return pagingPuntoVenta;
+ }
+
+ public void setPagingPuntoVenta(Paging pagingPuntoVenta) {
+ this.pagingPuntoVenta = pagingPuntoVenta;
+ }
+
+ public Textbox getTxtPalavraPesquisa() {
+ return txtPalavraPesquisa;
+ }
+
+ public void setTxtPalavraPesquisa(Textbox txtPalavraPesquisa) {
+ this.txtPalavraPesquisa = txtPalavraPesquisa;
+ }
+
+ public Bandbox getBbPesquisaPuntoVenta() {
+ return bbPesquisaPuntoVenta;
+ }
+
+ public void setBbPesquisaPuntoVenta(Bandbox bbPesquisaPuntoVenta) {
+ this.bbPesquisaPuntoVenta = bbPesquisaPuntoVenta;
+ }
+
+ public Checkbox getChkExcessoBagagem() {
+ return chkExcessoBagagem;
+ }
+
+ public void setChkExcessoBagagem(Checkbox chkExcessoBagagem) {
+ this.chkExcessoBagagem = chkExcessoBagagem;
+ }
+
+ public void onClick$btnExecutarRelatorio(Event ev) throws Exception {
+ executarRelatorio();
+ }
+
+ public void onSelect$puntoVentaList(Event ev) {
+
+ String strListPuntoVenta = new String();
+ ArrayList