fixes bug #7178
git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@53552 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
3aa1179b5e
commit
1ad6c7b406
|
@ -7,15 +7,20 @@ import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Constante;
|
||||||
import com.rjconsultores.ventaboletos.relatorios.utilitarios.ArrayDataSource;
|
import com.rjconsultores.ventaboletos.relatorios.utilitarios.ArrayDataSource;
|
||||||
import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio;
|
import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio;
|
||||||
|
import com.rjconsultores.ventaboletos.service.ConstanteService;
|
||||||
import com.rjconsultores.ventaboletos.utilerias.DateUtil;
|
import com.rjconsultores.ventaboletos.utilerias.DateUtil;
|
||||||
import com.rjconsultores.ventaboletos.web.utilerias.NamedParameterStatement;
|
import com.rjconsultores.ventaboletos.web.utilerias.NamedParameterStatement;
|
||||||
|
|
||||||
public class RelatorioCancelamentoVendaCartao extends Relatorio {
|
public class RelatorioCancelamentoVendaCartao extends Relatorio {
|
||||||
|
|
||||||
|
private ConstanteService constanteService;
|
||||||
|
|
||||||
public RelatorioCancelamentoVendaCartao(Map<String, Object> parametros, Connection conexao) throws Exception {
|
public RelatorioCancelamentoVendaCartao(Map<String, Object> parametros, Connection conexao, ConstanteService constanteService) throws Exception {
|
||||||
super(parametros, conexao);
|
super(parametros, conexao);
|
||||||
|
this.constanteService = constanteService;
|
||||||
|
|
||||||
this.setCustomDataSource(new ArrayDataSource(this) {
|
this.setCustomDataSource(new ArrayDataSource(this) {
|
||||||
|
|
||||||
|
@ -30,7 +35,7 @@ public class RelatorioCancelamentoVendaCartao extends Relatorio {
|
||||||
stmt.setTimestamp("data_inicial", new Timestamp(DateUtil.inicioFecha((Date) parametros.get("DATA_INICIAL")).getTime()));
|
stmt.setTimestamp("data_inicial", new Timestamp(DateUtil.inicioFecha((Date) parametros.get("DATA_INICIAL")).getTime()));
|
||||||
stmt.setTimestamp("data_final", new Timestamp(DateUtil.fimFecha((Date) parametros.get("DATA_FINAL")).getTime()));
|
stmt.setTimestamp("data_final", new Timestamp(DateUtil.fimFecha((Date) parametros.get("DATA_FINAL")).getTime()));
|
||||||
stmt.setInt("formaPago1", CARTAO_CREDITO);
|
stmt.setInt("formaPago1", CARTAO_CREDITO);
|
||||||
|
|
||||||
ResultSet rset = stmt.executeQuery();
|
ResultSet rset = stmt.executeQuery();
|
||||||
|
|
||||||
while (rset.next()) {
|
while (rset.next()) {
|
||||||
|
@ -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(" 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(" 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(" 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(" FROM OCD o INNER JOIN boleto b ON o.BOLETO_ID = b.BOLETO_ID ");
|
||||||
sql.append(" AND b.numfoliosistema = c.numfoliosistema ");
|
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 ");
|
sql.append(" AND o.fecinc between :data_inicial and :data_final ");
|
||||||
if (parametros.get("EMPRESA_ID") != null) {
|
if (parametros.get("EMPRESA_ID") != null) {
|
||||||
sql.append(" INNER JOIN marca ma on ma.marca_id = b.marca_id");
|
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.feccorrida = c.feccorrida ");
|
||||||
sql.append(" AND b.corrida_id = c.corrida_id ");
|
sql.append(" AND b.corrida_id = c.corrida_id ");
|
||||||
sql.append(" AND b.numasiento = c.numasiento ");
|
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
|
//Busca os boletos novos após a transferência e geração de OCD
|
||||||
sql.append(" boletos_novos AS( ");
|
sql.append(" boletos_novos AS( ");
|
||||||
|
@ -159,6 +176,7 @@ public class RelatorioCancelamentoVendaCartao extends Relatorio {
|
||||||
sql.append(" from OCD o");
|
sql.append(" from OCD o");
|
||||||
sql.append(" inner join boleto b on o.BOLETO_ID = b.BOLETO_ID");
|
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(" 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_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 caja_tarjeta ctj on cdt.cajadetpago_id = ctj.cajadetpago_id");
|
||||||
sql.append(" inner join punto_venta p on p.puntoventa_id = b.puntoventa_id");
|
sql.append(" inner join punto_venta p on p.puntoventa_id = b.puntoventa_id");
|
||||||
|
|
|
@ -24,6 +24,7 @@ import com.rjconsultores.ventaboletos.entidad.Empresa;
|
||||||
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
|
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
|
||||||
import com.rjconsultores.ventaboletos.relatorios.impl.RelatorioCancelamentoVendaCartao;
|
import com.rjconsultores.ventaboletos.relatorios.impl.RelatorioCancelamentoVendaCartao;
|
||||||
import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio;
|
import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio;
|
||||||
|
import com.rjconsultores.ventaboletos.service.ConstanteService;
|
||||||
import com.rjconsultores.ventaboletos.service.EmpresaService;
|
import com.rjconsultores.ventaboletos.service.EmpresaService;
|
||||||
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||||
import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEstandar;
|
import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEstandar;
|
||||||
|
@ -53,6 +54,8 @@ public class RelatorioCancelamentoVendaCartaoController extends MyGenericForward
|
||||||
@Autowired
|
@Autowired
|
||||||
private EmpresaService empresaService;
|
private EmpresaService empresaService;
|
||||||
@Autowired
|
@Autowired
|
||||||
|
private ConstanteService constanteService;
|
||||||
|
@Autowired
|
||||||
private DataSource dataSourceRead;
|
private DataSource dataSourceRead;
|
||||||
@Autowired
|
@Autowired
|
||||||
private transient PagedListWrapper<PuntoVenta> plwPuntoVenta;
|
private transient PagedListWrapper<PuntoVenta> plwPuntoVenta;
|
||||||
|
@ -138,7 +141,7 @@ public class RelatorioCancelamentoVendaCartaoController extends MyGenericForward
|
||||||
}
|
}
|
||||||
filtro.append(puntoVentas).append(";");
|
filtro.append(puntoVentas).append(";");
|
||||||
parametros.put("FILTROS", filtro.toString());
|
parametros.put("FILTROS", filtro.toString());
|
||||||
relatorio = new RelatorioCancelamentoVendaCartao(parametros, dataSourceRead.getConnection());
|
relatorio = new RelatorioCancelamentoVendaCartao(parametros, dataSourceRead.getConnection(), constanteService);
|
||||||
|
|
||||||
Map args = new HashMap();
|
Map args = new HashMap();
|
||||||
args.put("relatorio", relatorio);
|
args.put("relatorio", relatorio);
|
||||||
|
|
Loading…
Reference in New Issue