wilian 2016-03-04 18:44:15 +00:00
parent 3aa1179b5e
commit 1ad6c7b406
2 changed files with 27 additions and 6 deletions

View File

@ -7,15 +7,20 @@ import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import com.rjconsultores.ventaboletos.entidad.Constante;
import com.rjconsultores.ventaboletos.relatorios.utilitarios.ArrayDataSource;
import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio;
import com.rjconsultores.ventaboletos.service.ConstanteService;
import com.rjconsultores.ventaboletos.utilerias.DateUtil;
import com.rjconsultores.ventaboletos.web.utilerias.NamedParameterStatement;
public class RelatorioCancelamentoVendaCartao extends Relatorio {
public RelatorioCancelamentoVendaCartao(Map<String, Object> parametros, Connection conexao) throws Exception {
private ConstanteService constanteService;
public RelatorioCancelamentoVendaCartao(Map<String, Object> parametros, Connection conexao, ConstanteService constanteService) throws Exception {
super(parametros, conexao);
this.constanteService = constanteService;
this.setCustomDataSource(new ArrayDataSource(this) {
@ -104,8 +109,11 @@ public class RelatorioCancelamentoVendaCartao extends Relatorio {
sql.append(" CASE WHEN ctj.numautorizacion IS NULL THEN '-' ELSE ctj.numautorizacion END AS numautorizacion_bo_vi, ");
sql.append(" ctj.nsu AS nsu_bo_vi, c.numoperacion AS numoperacion FROM boleto b, caja_det_pago cdt, caja c, ");
sql.append(" caja_tarjeta ctj, ptovta_empresa ptovta WHERE b.boleto_id IN(SELECT b.boletooriginal_id ");
sql.append(" FROM OCD o INNER JOIN boleto b ON o.BOLETO_ID = b.BOLETO_ID INNER JOIN caja c ON c.numoperacion = b.numoperacion ");
sql.append(" AND b.numfoliosistema = c.numfoliosistema ");
sql.append(" FROM OCD o INNER JOIN boleto b ON o.BOLETO_ID = b.BOLETO_ID ");
sql.append(" inner join caja c on c.numoperacion = b.numoperacion ");
sql.append(" and c.feccorrida = b.feccorrida ");
sql.append(" and c.corrida_id = b.corrida_id ");
sql.append(" and c.numasiento = b.numasiento ");
sql.append(" AND o.fecinc between :data_inicial and :data_final ");
if (parametros.get("EMPRESA_ID") != null) {
sql.append(" INNER JOIN marca ma on ma.marca_id = b.marca_id");
@ -124,7 +132,16 @@ public class RelatorioCancelamentoVendaCartao extends Relatorio {
sql.append(" AND b.feccorrida = c.feccorrida ");
sql.append(" AND b.corrida_id = c.corrida_id ");
sql.append(" AND b.numasiento = c.numasiento ");
sql.append(" AND b.puntoventa_id = 301 ),"); //É o código do puntoventa de compras pela internet
sql.append(" AND b.puntoventa_id = ");
//Pega o ponto de venda
Constante constante = constanteService.buscarPorNomeConstante("PUNTO_VENTA_INTERNET");
if(constante != null) {
sql.append(constante.getValorconstante());
} else {
sql.append("99999");
}
sql.append(" ),"); //É o código do puntoventa de compras pela internet
//Busca os boletos novos após a transferência e geração de OCD
sql.append(" boletos_novos AS( ");
@ -159,6 +176,7 @@ public class RelatorioCancelamentoVendaCartao extends Relatorio {
sql.append(" from OCD o");
sql.append(" inner join boleto b on o.BOLETO_ID = b.BOLETO_ID");
sql.append(" inner join caja c on c.numoperacion = b.numoperacion ");
sql.append(" and c.numfoliosistema = b.numfoliosistema ");
sql.append(" inner join caja_det_pago cdt ON cdt.caja_id = c.caja_id and cdt.formapago_id in (:formaPago1)");
sql.append(" inner join caja_tarjeta ctj on cdt.cajadetpago_id = ctj.cajadetpago_id");
sql.append(" inner join punto_venta p on p.puntoventa_id = b.puntoventa_id");

View File

@ -24,6 +24,7 @@ import com.rjconsultores.ventaboletos.entidad.Empresa;
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
import com.rjconsultores.ventaboletos.relatorios.impl.RelatorioCancelamentoVendaCartao;
import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio;
import com.rjconsultores.ventaboletos.service.ConstanteService;
import com.rjconsultores.ventaboletos.service.EmpresaService;
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEstandar;
@ -53,6 +54,8 @@ public class RelatorioCancelamentoVendaCartaoController extends MyGenericForward
@Autowired
private EmpresaService empresaService;
@Autowired
private ConstanteService constanteService;
@Autowired
private DataSource dataSourceRead;
@Autowired
private transient PagedListWrapper<PuntoVenta> plwPuntoVenta;
@ -138,7 +141,7 @@ public class RelatorioCancelamentoVendaCartaoController extends MyGenericForward
}
filtro.append(puntoVentas).append(";");
parametros.put("FILTROS", filtro.toString());
relatorio = new RelatorioCancelamentoVendaCartao(parametros, dataSourceRead.getConnection());
relatorio = new RelatorioCancelamentoVendaCartao(parametros, dataSourceRead.getConnection(), constanteService);
Map args = new HashMap();
args.put("relatorio", relatorio);