fixes bug#18705

qua:wallyson
dev:


As vendas com os numeros autorizações  zeradas, são as vendas feitas pela internet ou por um canal de venda terceirizada que não envia o numeo de autorização.
O relatorio agrupa os bilhetes por autorização, logo como existia varios bilhetes com autorização 00000, o relatorio somava todo o valor com essa mesma autorização, acarretando em um valor alto.

Com isso foi criado um filtro no relatorio, para o cliente selecionar quais os canal de vendas que ele deseja retirar para o relatorio nao exibir informações com autorizaçoes zeradas

git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@101202 d1611594-4594-4d17-8e1d-87c2c4800839
master
walace 2020-04-14 22:30:02 +00:00
parent 2ac2f44ea1
commit a97f4960d0
5 changed files with 188 additions and 6 deletions

View File

@ -46,8 +46,9 @@ public class RelatorioVendasCartoes extends Relatorio {
PuntoVenta puntoVenta = (PuntoVenta) parametros.get("PUNTOVENTA");
Usuario usuario = (Usuario) parametros.get("USUARIO");
Estacion estacao = (Estacion) parametros.get("ESTACION");
String tipoAgencias = (String) parametros.get("TIPOPUNTOVENTA");
String sql = getSql(dataInicial, dataFinal, empresa, puntoVenta, usuario, estacao, buscarPorDataDaVenda);
String sql = getSql(dataInicial, dataFinal, empresa, puntoVenta, tipoAgencias, usuario, estacao, buscarPorDataDaVenda);
try {
stmt = new NamedParameterStatement(conexao, sql);
@ -117,14 +118,14 @@ public class RelatorioVendasCartoes extends Relatorio {
protected void processaParametros() throws Exception {
}
private String getSql(String dataInicial, String dataFinal, Empresa empresa, PuntoVenta puntoVenta, Usuario usuario, Estacion estacion, Boolean buscarPorDataDaVenda) {
private String getSql(String dataInicial, String dataFinal, Empresa empresa, PuntoVenta puntoVenta, String tipoAgencias, Usuario usuario, Estacion estacion, Boolean buscarPorDataDaVenda) {
StringBuilder sb = new StringBuilder();
sb.append("SELECT caja.descpago as descPagamento,");
sb.append(" to_char(caja.dataoperacao, 'ddMMyy') as dataOperacao,");
sb.append(" caja.autorizacao as autorizacao,");
sb.append(" caja.qtdparcelas as qtdParcelas,");
sb.append(" coalesce(caja.qtdparcelas, 1) as qtdParcelas ,");
sb.append(" to_char(caja.datavenda, 'ddMMyy') as dataVenda, ");
sb.append(" sum(caja.preco) as valor ");
sb.append("FROM");
@ -140,6 +141,7 @@ public class RelatorioVendasCartoes extends Relatorio {
sb.append(" INNER JOIN forma_pago fp ON cfp.formapago_id=fp.formapago_id");
sb.append(" INNER JOIN caja_det_pago cdp ON (c.caja_id = cdp.caja_id and cdp.cajaformapago_id = cfp.cajaformapago_id)");
sb.append(" INNER JOIN caja_tarjeta ct ON (ct.cajadetpago_id = cdp.cajadetpago_id)");
sb.append(" INNER JOIN punto_venta pt ON (pt.puntoventa_id = c.puntoventa_id) ");
sb.append(" WHERE c.indreimpresion = 0 ");
if(empresa!= null){
@ -170,6 +172,10 @@ public class RelatorioVendasCartoes extends Relatorio {
sb.append("AND c.feccorte <= TO_DATE(:dataFinal, 'DD/MM/YYYY HH24:MI:SS') ");
}
sb.append(tipoAgencias.equals("-1") || tipoAgencias.equals("TODAS") ? "" : " and pt.tipoptovta_id not in (" + tipoAgencias + ") ");
sb.append(" AND fp.formapago_id IN(2,3)");
sb.append(" AND c.activo = 1) caja ");
sb.append("GROUP BY caja.descpago,");

View File

@ -1,5 +1,7 @@
package com.rjconsultores.ventaboletos.web.gui.controladores.relatorios;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -10,18 +12,24 @@ 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.Comboitem;
import org.zkoss.zul.Datebox;
import org.zkoss.zul.Paging;
import org.zkoss.zul.Radio;
import org.zkoss.zul.Textbox;
import com.rjconsultores.ventaboletos.entidad.Empresa;
import com.rjconsultores.ventaboletos.entidad.Estacion;
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
import com.rjconsultores.ventaboletos.entidad.TipoPuntoVenta;
import com.rjconsultores.ventaboletos.entidad.Usuario;
import com.rjconsultores.ventaboletos.relatorios.impl.RelatorioVendasCartoes;
import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio;
import com.rjconsultores.ventaboletos.service.TipoPuntoVentaService;
import com.rjconsultores.ventaboletos.utilerias.DateUtil;
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEstacion;
@ -29,6 +37,12 @@ import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEstandar;
import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxPuntoVenta;
import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxUsuario;
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.rjconsultores.ventaboletos.web.utilerias.render.RenderTipoPuntoVenta;
import com.trg.search.Filter;
@Controller("relatorioVendasCartoesController")
@Scope("prototype")
@ -43,6 +57,18 @@ public class RelatorioVendasCartoesController extends MyGenericForwardComposer {
private MyComboboxEstacion cmbEstacion;
private MyComboboxUsuario cmbUsuario;
private List<Empresa> lsEmpresa;
@Autowired
private TipoPuntoVentaService tipoPuntoVentaService;
private List<TipoPuntoVenta> lsTipoPuntoVenta;
private MyListbox tipoPuntoVentaList;
private MyListbox tipoPuntoVentaSelList;
private Paging pagingtipoPuntoVenta;
private Textbox txtPalavraPesquisa;
@Autowired
private transient PagedListWrapper<TipoPuntoVenta> plwtipoPuntoVenta;
private static final String TODOS_VALUE = new Integer(-1).toString();
private static final String TODOS = "TODAS";
private Bandbox bbPesquisaPuntoVenta;
private Radio radioDataVenda;
@ -51,8 +77,11 @@ public class RelatorioVendasCartoesController extends MyGenericForwardComposer {
@Override
public void doAfterCompose(Component comp) throws Exception {
lsEmpresa = UsuarioLogado.getUsuarioLogado().getEmpresa();
super.doAfterCompose(comp);
lsEmpresa = UsuarioLogado.getUsuarioLogado().getEmpresa();
lsTipoPuntoVenta = tipoPuntoVentaService.obtenerTodos();
tipoPuntoVentaSelList.setItemRenderer(new RenderTipoPuntoVenta());
}
/**
@ -63,6 +92,7 @@ public class RelatorioVendasCartoesController extends MyGenericForwardComposer {
private void executarRelatorio() throws Exception {
Map<String, Object> parametros = new HashMap<String, Object>();
if(dataInicial.getValue() == null){
return;
}
@ -71,6 +101,24 @@ public class RelatorioVendasCartoesController extends MyGenericForwardComposer {
}
parametros.put("NOME_RELATORIO", Labels.getLabel("relatorioVendasCartoesController.window.title"));
lsTipoPuntoVenta = new ArrayList(Arrays.asList(tipoPuntoVentaSelList.getData()));
if (lsTipoPuntoVenta.size() > 0) {
String puntoVentaExpression = null;
for (TipoPuntoVenta p : lsTipoPuntoVenta) {
if (lsTipoPuntoVenta.indexOf(p) == 0) {
puntoVentaExpression = p.getTipoptovtaId().toString();
} else {
puntoVentaExpression += ", " + p.getTipoptovtaId().toString();
}
}
parametros.put("TIPOPUNTOVENTA_ID", puntoVentaExpression);
parametros.put("TIPOPUNTOVENTA", puntoVentaExpression);
} else {
parametros.put("TIPOPUNTOVENTA_ID", TODOS_VALUE);
parametros.put("TIPOPUNTOVENTA", TODOS);
}
StringBuilder filtro = new StringBuilder("Filtros\n");
Comboitem itemEmpresa = cmbEmpresa.getSelectedItem();
@ -136,14 +184,68 @@ public class RelatorioVendasCartoesController extends MyGenericForwardComposer {
Labels.getLabel("relatorioVendasCartoesController.window.title"), args, MODAL);
}
public void onClick$btnPesquisa(Event ev) {
executarPesquisa();
}
private void executarPesquisa() {
HibernateSearchObject<TipoPuntoVenta> tipoPuntoVentaBusqueda = new HibernateSearchObject<TipoPuntoVenta>(TipoPuntoVenta.class,
pagingtipoPuntoVenta.getPageSize());
tipoPuntoVentaBusqueda.addFilterOr(Filter.like("desctipo", "%" + txtPalavraPesquisa.getText().trim().toUpperCase().concat("%")), Filter.like("desctipo", "%" + txtPalavraPesquisa.getText().trim().toUpperCase().concat("%")));
tipoPuntoVentaBusqueda.addSortAsc("desctipo");
tipoPuntoVentaBusqueda.addFilterEqual("activo", Boolean.TRUE);
plwtipoPuntoVenta.init(tipoPuntoVentaBusqueda, tipoPuntoVentaList, pagingtipoPuntoVenta);
if (tipoPuntoVentaList.getData().length == 0) {
try {
Messagebox.show(Labels.getLabel("MSG.ningunRegistro"),
Labels.getLabel("relatorioReceitaDiariaAgenciaController.window.title"),
Messagebox.OK, Messagebox.INFORMATION);
} catch (InterruptedException ex) {
}
}
}
public void onClick$btnExecutarRelatorio(Event ev) throws Exception{
executarRelatorio();
}
public void onDoubleClick$tipoPuntoVentaList(Event ev) {
TipoPuntoVenta puntoVentaSel = (TipoPuntoVenta) tipoPuntoVentaList.getSelected();
tipoPuntoVentaSelList.addItemNovo(puntoVentaSel);
}
public void onDoubleClick$tipoPuntoVentaSelList(Event ev) {
TipoPuntoVenta puntoVentaSel = (TipoPuntoVenta) tipoPuntoVentaSelList.getSelected();
tipoPuntoVentaSelList.removeItem(puntoVentaSel);
}
private void limparPesquisaTipoAgencia() {
tipoPuntoVentaList.clearSelection();
lsTipoPuntoVenta.clear();
this.bbPesquisaPuntoVenta.setValue("");
}
public Datebox getDatInicial() {
return dataInicial;
}
public void onClick$btnLimpar(Event ev) {
limparPesquisaTipoAgencia();
}
public void setDatInicial(Datebox datInicial) {
this.dataInicial = datInicial;
}

View File

@ -8523,8 +8523,21 @@ busquedaConfTotemController.pagamentoMultiempresaBPe.ajuda=Habilita o pagamento
busquedaConfTotemController.pagamentoMultiempresaBPe=Pagamento Multiempresa BPe
busquedaConfTotemController.imprimeComprovanteCartaoEmpresaCorrida.value=Imprimir Comprovante Cartão como Empresa da Corrida.
relatorioVendasCartoesController.lb.bucarDataCorte.value = Buscar por data do fechamento
relatorioVendasCartoesController.window.title = Relatório Vendas Cartões
relatorioVendasCartoesController.lbEmpresa.value = Empresa
relatorioVendasCartoesController.lb.puntoVenta.value = Agência
relatorioVendasCartoesController.lb.estacao.value = Estação
relatorioVendasCartoesController.lbDatInicial.value = Data Inicial
relatorioVendasCartoesController.lbDatFinal.value = Data Final
relatorioVendasCartoesController.lb.usuario.value = Bilheteiro
relatorioVendasCartoesController.lb.bucarDataCorte.value = Buscar por data do fechamento do caixa
relatorioVendasCartoesController.lb.buscarDataVenda.value = Buscar por data da Venda
relatorioVendasCartoesController.lbTipo.value = Tipo
relatorioVendasCartoesController.lbInternetPTA.value = Internet x PTA
relatorioVendasCartoesController.lbPTA.value = PTA
relatorioVendasCartoesControllerlbTipoAgencia.value = Ignorar Canal de Venda
relatorioVendasCartoesController.tipoPuntoVentaSelList.nome = Descrição
relatorioVendasCartoesController.tipoPuntoVentaSelList.codigo = Codigo
# Pesquisa de Tarifa Embarcada
busquedaTarifaEmbarcadaController.window.title = Alteração de Preço - Embarcada

View File

@ -940,6 +940,12 @@ relatorioVendasCartoesController.lbDatFinal.value = Data Final
relatorioVendasCartoesController.lb.usuario.value = Bilheteiro
relatorioVendasCartoesController.lb.bucarDataCorte.value = Buscar por data do fechamento do caixa
relatorioVendasCartoesController.lb.buscarDataVenda.value = Buscar por data da Venda
relatorioVendasCartoesController.lbTipo.value = Tipo
relatorioVendasCartoesController.lbInternetPTA.value = Internet x PTA
relatorioVendasCartoesController.lbPTA.value = PTA
relatorioVendasCartoesControllerlbTipoAgencia.value = Ignorar Canal de Venda
relatorioVendasCartoesController.tipoPuntoVentaSelList.nome = Descrição
relatorioVendasCartoesController.tipoPuntoVentaSelList.codigo = Codigo
#Relatório de Vendas PTA
relatorioVendasPTAController.window.title = Relatório de Vendas PTA

View File

@ -7,7 +7,7 @@
<zk xmlns="http://www.zkoss.org/2005/zul">
<window id="winFiltroRelatorioVendasCartoes"
apply="${relatorioVendasCartoesController}"
contentStyle="overflow:auto" height="250px" width="600px"
contentStyle="overflow:auto" height="380px" width="600px"
border="normal">
<grid fixedLayout="true">
<columns>
@ -64,6 +64,61 @@
label="${c:l('relatorioVendasCartoesController.lb.bucarDataCorte.value')}" />
</radiogroup>
</row>
<row spans="1,2">
<label
value="${c:l('relatorioVendasCartoesControllerlbTipoAgencia.value')}" />
<bandbox id="bbPesquisaPuntoVenta" width="90%"
mold="rounded" readonly="true">
<bandpopup height="150px">
<vbox>
<hbox>
<textbox id="txtPalavraPesquisa" />
<button id="btnPesquisa"
image="/gui/img/find.png"
label="${c:l('relatorioVendasCartoesController.btnPesquisa.label')}" />
<button id="btnLimpar"
image="/gui/img/eraser.png"
label="${c:l('relatorioVendasCartoesController.btnLimpar.label')}" />
</hbox>
<listbox id="tipoPuntoVentaList"
mold="paging"
use="com.rjconsultores.ventaboletos.web.utilerias.MyListbox"
vflex="true" multiple="false" height="100%" width="360px">
<listhead>
<listheader
label="${c:l('relatorioVendasCartoesController.tipoPuntoVentaSelList.codigo')}" />
<listheader
label="${c:l('relatorioVendasCartoesController.tipoPuntoVentaSelList.nome')}" />
</listhead>
</listbox>
<paging id="pagingtipoPuntoVenta"
pageSize="10" />
</vbox>
</bandpopup>
</bandbox>
</row>
<row>
<cell colspan="2" rowspan="2">
<borderlayout height="100px">
<center border="0">
<listbox id="tipoPuntoVentaSelList"
mold="paging"
use="com.rjconsultores.ventaboletos.web.utilerias.MyListbox"
vflex="true" multiple="true" height="60%" width="100%">
<listhead>
<listheader
label="${c:l('relatorioVendasCartoesController.tipoPuntoVentaSelList.codigo')}" />
<listheader
label="${c:l('relatorioVendasCartoesController.tipoPuntoVentaSelList.nome')}" />
<listheader width="35px" />
</listhead>
</listbox>
</center>
</borderlayout>
</cell>
</row>
</rows>
</grid>
<toolbar>