diff --git a/.classpath b/.classpath
index 56fe1eb18..c86aa943a 100644
--- a/.classpath
+++ b/.classpath
@@ -92,18 +92,18 @@
-
+
+
+
+
-
+
-
-
-
diff --git a/.settings/org.eclipse.wst.common.project.facet.core.xml b/.settings/org.eclipse.wst.common.project.facet.core.xml
index 043bd75ea..42b813043 100644
--- a/.settings/org.eclipse.wst.common.project.facet.core.xml
+++ b/.settings/org.eclipse.wst.common.project.facet.core.xml
@@ -1,6 +1,6 @@
-
+
diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioTrechoVendido.java b/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioTrechoVendido.java
new file mode 100644
index 000000000..f2558ee72
--- /dev/null
+++ b/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioTrechoVendido.java
@@ -0,0 +1,17 @@
+package com.rjconsultores.ventaboletos.relatorios.impl;
+
+import java.sql.Connection;
+import java.util.Map;
+
+import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio;
+
+public class RelatorioTrechoVendido extends Relatorio {
+
+ public RelatorioTrechoVendido(Map parametros, Connection conexao) {
+ super(parametros, conexao);
+ }
+
+ @Override
+ protected void processaParametros() throws Exception {
+ }
+}
diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioTrechoVendido_pt_BR.properties b/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioTrechoVendido_pt_BR.properties
new file mode 100644
index 000000000..87ab58c2e
--- /dev/null
+++ b/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioTrechoVendido_pt_BR.properties
@@ -0,0 +1,20 @@
+#geral
+msg.noData=Não foi possivel obter dados com os parâmetros informados.
+msg.a=à
+
+#Labels header
+header.titulo.relatorio=Trecho Vendido Por Agência
+header.periodo=Período:
+header.data.hora=Data/Hora:
+header.pagina=Página:
+header.filtro.agencia=Filtros: Agência:
+
+#Labels group
+
+group.trecho=Trecho
+group.horario=Horário
+group.venda=Venda
+group.poltronas.livres=P. Livre
+group.total=Total
+group.valor.total=Vr. Total
+
diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioTrechoVendido.jasper b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioTrechoVendido.jasper
new file mode 100644
index 000000000..f05291c7b
Binary files /dev/null and b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioTrechoVendido.jasper differ
diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioTrechoVendido.jrxml b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioTrechoVendido.jrxml
new file mode 100644
index 000000000..3e2494d3d
--- /dev/null
+++ b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioTrechoVendido.jrxml
@@ -0,0 +1,310 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 0
+ THEN 1
+ ELSE NULL
+ END) AS VENDA
+FROM
+ CAJA c
+LEFT JOIN PARADA origem
+ON
+ (
+ c.ORIGEN_ID = origem.PARADA_ID
+ )
+LEFT JOIN PARADA destino
+ON
+ (
+ c.DESTINO_ID = destino.PARADA_ID
+ )
+LEFT JOIN CORRIDA cor
+ON
+ (
+ c.CORRIDA_ID = cor.CORRIDA_ID
+ AND c.FECCORRIDA = cor.FECCORRIDA
+ )
+LEFT JOIN EMPRESA e
+ON
+ (
+ e.EMPRESA_ID = c.EMPRESAPUNTOVENTA_ID
+ )
+WHERE
+ c.FECCORRIDA BETWEEN $P{DATA_INICIO} AND $P{DATA_FINAL}
+AND c.PUNTOVENTA_ID = $P{PUNTOVENTA_ID}
+AND e.NOMBEMPRESA LIKE $P{NOMBEMPRESA_SEARCH}
+GROUP BY
+ c.CORRIDA_ID,
+ c.FECCORRIDA,
+ origem.DESCPARADA,
+ destino.DESCPARADA,
+ cor.FECHORSALIDA,
+ e.NOMBEMPRESA
+ORDER BY
+ origem.DESCPARADA,
+ destino.DESCPARADA]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioTrechoVendidoController.java b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioTrechoVendidoController.java
new file mode 100644
index 000000000..68d6f3eef
--- /dev/null
+++ b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioTrechoVendidoController.java
@@ -0,0 +1,214 @@
+package com.rjconsultores.ventaboletos.web.gui.controladores.relatorios;
+
+import java.util.ArrayList;
+import java.util.Date;
+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.zhtml.Messagebox;
+import org.zkoss.zk.ui.Component;
+import org.zkoss.zk.ui.event.Event;
+import org.zkoss.zul.Bandbox;
+import org.zkoss.zul.Combobox;
+import org.zkoss.zul.Datebox;
+import org.zkoss.zul.Paging;
+import org.zkoss.zul.Textbox;
+
+import com.rjconsultores.ventaboletos.entidad.Empresa;
+import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
+import com.rjconsultores.ventaboletos.relatorios.impl.RelatorioTrechoVendido;
+import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio;
+import com.rjconsultores.ventaboletos.service.EmpresaService;
+import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
+import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
+import com.rjconsultores.ventaboletos.web.utilerias.paginacion.HibernateSearchObject;
+import com.rjconsultores.ventaboletos.web.utilerias.paginacion.PagedListWrapper;
+import com.rjconsultores.ventaboletos.web.utilerias.render.RenderPuntoVentaSimple;
+import com.trg.search.Filter;
+
+@Controller("relatorioTrechoVendidoController")
+@Scope("prototype")
+public class RelatorioTrechoVendidoController extends MyGenericForwardComposer {
+
+ private static final long serialVersionUID = 1L;
+
+ private static Logger log = Logger.getLogger(RelatorioTrechoVendidoController.class);
+
+ @Autowired
+ private DataSource dataSource;
+
+ @Autowired
+ private EmpresaService empresaService;
+
+ private ArrayList lsNumPuntoVenta = new ArrayList();
+ private ArrayList lsNumEmpresa = new ArrayList();
+
+ @Autowired
+ private transient PagedListWrapper plwPuntoVenta;
+ private MyListbox puntoVentaList;
+ private Paging pagingPuntoVenta;
+ private Bandbox bbPesquisaPuntoVenta;
+ private Textbox txtPalavraPesquisa;
+ private Datebox datInicial;
+ private Datebox datFinal;
+
+ private Combobox cmbEmpresa;
+ private List lsEmpresa;
+
+ private void executarRelatorio() throws Exception {
+
+ if (lsNumPuntoVenta.size() > 0) {
+ Map parametros = new HashMap();
+ parametros.put("DATA_INICIO", new java.sql.Date(((java.util.Date) this.datInicial.getValue()).getTime()));
+ parametros.put("DATA_FINAL", new java.sql.Date(((java.util.Date) this.datFinal.getValue()).getTime()));
+
+ if (lsNumPuntoVenta.size() > 0) {
+ Integer puntuVentaId = null;
+ try {
+ puntuVentaId = Integer.parseInt(lsNumPuntoVenta.iterator().next());
+ } catch (Exception e) {
+ log.error(e.getStackTrace());
+ }
+ parametros.put("PUNTOVENTA_ID", puntuVentaId);
+ }
+
+ String empresa = "";
+ try {
+ empresa = cmbEmpresa.getValue();
+
+ } catch (Exception e) {
+ log.error(e.getStackTrace());
+ }
+ parametros.put("NOMBEMPRESA", empresa);
+
+ String empresaSearch = "";
+ if (!empresa.equals(null)) {
+ empresaSearch = "%" + empresa + "%";
+ } else {
+ empresaSearch = "%%";
+ }
+ parametros.put("NOMBEMPRESA_SEARCH", empresaSearch);
+
+ Date now = new Date();
+ parametros.put("NOW", now);
+
+ Relatorio relatorio = new RelatorioTrechoVendido(parametros, dataSource.getConnection());
+
+ Map args = new HashMap();
+ args.put("relatorio", relatorio);
+
+ openWindow("/component/reportView.zul",
+ Labels.getLabel("relatorioTrechoVendidoController.window.title"), args, MODAL);
+ } else {
+ try {
+ Messagebox.show(Labels.getLabel("relatorioTrechoVendidoController.no.agencia"),
+ Labels.getLabel("relatorioTrechoVendidoController.window.title"),
+ Messagebox.OK, Messagebox.INFORMATION);
+ } catch (InterruptedException ex) {
+ }
+ }
+ }
+
+ public void onSelect$puntoVentaList(Event ev) {
+
+ String strListPuntoVenta = new String();
+ ArrayList