fixes bug #10139
git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@76450 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
bcc4cc686d
commit
111e96e37c
|
@ -72,12 +72,16 @@ public class RelatorioFinanceiroAnalitico extends Relatorio {
|
|||
fs.setUf(rset.getString("uf"));
|
||||
fs.setCodigoAgencia(rset.getString("codigo"));
|
||||
fs.setFechorVenta(rset.getDate("fechorVenta"));
|
||||
|
||||
|
||||
BigDecimal receitaBPR = getBigDecimal(rset, "receita_bpr");
|
||||
fs.setGapVenda(getBigDecimal(rset, "receita_gap"));
|
||||
fs.setGapImpressa(getBigDecimal(rset, "entrega_gap"));
|
||||
|
||||
BigDecimal receita_cancel_bpr =getBigDecimal(rset, "receita_cancel_bpr");
|
||||
|
||||
receitaBPR = receitaBPR.add(fs.getGapImpressa());
|
||||
receitaBPR = receitaBPR.subtract(receita_cancel_bpr);
|
||||
receitaBPR = receitaBPR.subtract(fs.getGapVenda());
|
||||
fs.setReceitaBPR(receitaBPR);
|
||||
|
||||
BigDecimal totalVendaPassagens = fs.getReceitaBPR().add(fs.getGapVenda());
|
||||
|
@ -164,20 +168,21 @@ public class RelatorioFinanceiroAnalitico extends Relatorio {
|
|||
sql.append(" cd.puntoventaId, ");
|
||||
sql.append(" cd.empresaId, ");
|
||||
sql.append(" cd.fechorVenta, ");
|
||||
sql.append(" sum(case when (cd.motivocancelacion_id is null and cd.indreimpresion = 0 and cd.indstatusboleto = 'V' and cd.numfoliosistema is not null) then cd.pedagio else 0 end) as pedagio, ");
|
||||
sql.append(" sum(case when (cd.motivocancelacion_id is null and cd.indreimpresion = 0 and cd.indstatusboleto = 'V' and cd.numfoliosistema is not null) then cd.valorpago else 0 end) as receita_bpr, ");
|
||||
sql.append(" sum(case when (cd.indstatusboleto in ('C', 'T') and cd.motivocancelacion_id in (31,32,10,37)) then cd.valorpago else 0 end) as receita_devol_bpr, ");
|
||||
sql.append(" sum(case when (cd.indreimpresion = 0 and cd.indstatusoperacion = 'F' and cd.motivocancelacion_id is null) then cd.pedagio else 0 end) as pedagio, ");
|
||||
sql.append(" sum(case when (cd.indreimpresion = 0 and cd.indstatusoperacion = 'F' and cd.motivocancelacion_id is null) then cd.valorpago else 0 end) as receita_bpr, ");
|
||||
sql.append(" sum(case when (cd.indstatusboleto in ('C', 'T') and cd.motivocancelacion_id in (32,10,37)) then cd.valorpago else 0 end) as receita_devol_bpr, ");
|
||||
sql.append(" sum(case when (cd.indstatusboleto in ('C', 'T') and cd.motivocancelacion_id in (31)) then cd.valorpago else 0 end) as receita_cancel_bpr, ");
|
||||
sql.append(" sum(case when (cd.indreimpresion = 0 and cd.indstatusboleto = 'V' and cd.tipoventa_id in (5,12,18,49)) then cd.valorpago else 0 end) as receita_gap, ");
|
||||
sql.append(" sum(case when (cd.indstatusboleto in ('C', 'T') and cd.motivocancelacion_id in (31,32,10,37) and cd.numfoliosistema is null and cd.tipoventa_id in (5,12,18,49)) then cd.valorpago else 0 end) as receita_devol_gap, ");
|
||||
sql.append(" sum(case when (cd.indstatusboleto in ('C', 'T') and cd.motivocancelacion_id in (32,10,37) and cd.numfoliosistema is null and cd.tipoventa_id in (5,12,18,49)) then cd.valorpago else 0 end) as receita_devol_gap, ");
|
||||
sql.append(" sum(case when (cd.indreimpresion = 1 and cd.indstatusboleto = 'E' and cd.tipoventa_id in (5,12,18,49)) then cd.valorpago else 0 end) as entrega_gap, ");
|
||||
sql.append(" sum(case when (cd.motivocancelacion_id is null and cd.indreimpresion = 0 and cd.indstatusboleto = 'V' and cd.numfoliosistema is not null and cd.formapago_id in (2,25)) then cd.valorpago else 0 end) as cartao_credito, ");
|
||||
sql.append(" sum(case when (cd.motivocancelacion_id is null and cd.indreimpresion = 0 and cd.indstatusboleto = 'V' and cd.numfoliosistema is not null and cd.formapago_id in (3,26)) then cd.valorpago else 0 end) as cartao_debito, ");
|
||||
sql.append(" sum(case when (cd.motivocancelacion_id is null and cd.indreimpresion = 0 and cd.indstatusoperacion = 'F' and cd.formapago_id in (2,25)) then cd.valorpago else 0 end) as cartao_credito, ");
|
||||
sql.append(" sum(case when (cd.motivocancelacion_id is null and cd.indreimpresion = 0 and cd.indstatusoperacion = 'F' and cd.formapago_id in (3,26)) then cd.valorpago else 0 end) as cartao_debito, ");
|
||||
sql.append(" sum(case when (cd.indstatusboleto = 'C' and cd.motivocancelacion_id in (35)) then cd.valorpago else 0 end) as receita_ocd_deb, ");
|
||||
sql.append(" sum(case when (cd.indstatusboleto = 'C' and cd.motivocancelacion_id in (99) ) then cd.valorpago else 0 end) as receita_ocd_cred ");
|
||||
sql.append(" ");
|
||||
sql.append("from ( ");
|
||||
sql.append(" select ");
|
||||
sql.append(" c.boleto_id as cajaid, ");
|
||||
sql.append(" c.caja_id as cajaid, ");
|
||||
sql.append(" trunc(c.feccreacion) as fechorVenta, ");
|
||||
sql.append(" e.empresa_id as empresaId, ");
|
||||
sql.append(" pv.puntoventa_id as puntoventaId, ");
|
||||
|
@ -198,8 +203,8 @@ public class RelatorioFinanceiroAnalitico extends Relatorio {
|
|||
sql.append(" cfp.formapago_id, ");
|
||||
sql.append(" c.motivocancelacion_id as motivocancelacion_id, ");
|
||||
sql.append(" c.tipoventa_id as tipoventa_id ");
|
||||
sql.append(" from boleto c ");
|
||||
sql.append(" inner join boleto_formapago cfp on cfp.boleto_id = c.boleto_id ");
|
||||
sql.append(" from caja c ");
|
||||
sql.append(" inner join caja_formapago cfp on cfp.caja_id = c.caja_id ");
|
||||
sql.append(" inner join punto_venta pv on pv.puntoventa_id = c.puntoventa_id ");
|
||||
sql.append(" inner join forma_pago fp on cfp.formapago_id = fp.formapago_id ");
|
||||
sql.append(" inner join marca m on c.marca_id = m.marca_id ");
|
||||
|
|
|
@ -75,8 +75,12 @@ public class RelatorioFinanceiroSintetico extends Relatorio {
|
|||
BigDecimal receitaBPR = getBigDecimal(rset, "receita_bpr");
|
||||
fs.setGapVenda(getBigDecimal(rset, "receita_gap"));
|
||||
fs.setGapImpressa(getBigDecimal(rset, "entrega_gap"));
|
||||
|
||||
BigDecimal receita_cancel_bpr =getBigDecimal(rset, "receita_cancel_bpr");
|
||||
|
||||
receitaBPR = receitaBPR.add(fs.getGapImpressa());
|
||||
receitaBPR = receitaBPR.subtract(receita_cancel_bpr);
|
||||
receitaBPR = receitaBPR.subtract(fs.getGapVenda());
|
||||
fs.setReceitaBPR(receitaBPR);
|
||||
|
||||
BigDecimal totalVendaPassagens = fs.getReceitaBPR().add(fs.getGapVenda());
|
||||
|
@ -169,19 +173,20 @@ public class RelatorioFinanceiroSintetico extends Relatorio {
|
|||
sql.append(" cd.codigo, ");
|
||||
sql.append(" cd.puntoventaId, ");
|
||||
sql.append(" cd.empresaId, ");
|
||||
sql.append(" sum(case when (cd.motivocancelacion_id is null and cd.indreimpresion = 0 and cd.indstatusboleto = 'V' and cd.numfoliosistema is not null) then cd.pedagio else 0 end) as pedagio, ");
|
||||
sql.append(" sum(case when (cd.motivocancelacion_id is null and cd.indreimpresion = 0 and cd.indstatusboleto = 'V' and cd.numfoliosistema is not null) then cd.valorpago else 0 end) as receita_bpr, ");
|
||||
sql.append(" sum(case when (cd.indstatusboleto in ('C', 'T') and cd.motivocancelacion_id in (31,32,10,37)) then cd.valorpago else 0 end) as receita_devol_bpr, ");
|
||||
sql.append(" sum(case when (cd.indreimpresion = 0 and cd.indstatusoperacion = 'F' and cd.motivocancelacion_id is null) then cd.pedagio else 0 end) as pedagio, ");
|
||||
sql.append(" sum(case when (cd.indreimpresion = 0 and cd.indstatusoperacion = 'F' and cd.motivocancelacion_id is null) then cd.valorpago else 0 end) as receita_bpr, ");
|
||||
sql.append(" sum(case when (cd.indstatusboleto in ('C', 'T') and cd.motivocancelacion_id in (32,10,37)) then cd.valorpago else 0 end) as receita_devol_bpr, ");
|
||||
sql.append(" sum(case when (cd.indstatusboleto in ('C', 'T') and cd.motivocancelacion_id in (31)) then cd.valorpago else 0 end) as receita_cancel_bpr, ");
|
||||
sql.append(" sum(case when (cd.indreimpresion = 0 and cd.indstatusboleto = 'V' and cd.tipoventa_id in (5,12,18,49)) then cd.valorpago else 0 end) as receita_gap, ");
|
||||
sql.append(" sum(case when (cd.indstatusboleto in ('C', 'T') and cd.motivocancelacion_id in (31,32,10,37) and cd.numfoliosistema is null and cd.tipoventa_id in (5,12,18,49)) then cd.valorpago else 0 end) as receita_devol_gap, ");
|
||||
sql.append(" sum(case when (cd.indreimpresion = 1 and cd.indstatusboleto = 'E' and cd.tipoventa_id in (5,12,18,49)) then cd.valorpago else 0 end) as entrega_gap, ");
|
||||
sql.append(" sum(case when (cd.motivocancelacion_id is null and cd.indreimpresion = 0 and cd.indstatusboleto = 'V' and cd.numfoliosistema is not null and cd.formapago_id in (2,25)) then cd.valorpago else 0 end) as cartao_credito, ");
|
||||
sql.append(" sum(case when (cd.motivocancelacion_id is null and cd.indreimpresion = 0 and cd.indstatusboleto = 'V' and cd.numfoliosistema is not null and cd.formapago_id in (3,26)) then cd.valorpago else 0 end) as cartao_debito, ");
|
||||
sql.append(" sum(case when (cd.indstatusboleto in ('C', 'T') and cd.motivocancelacion_id in (32,10,37) and cd.numfoliosistema is null and cd.tipoventa_id in (5,12,18,49)) then cd.valorpago else 0 end) as receita_devol_gap, ");
|
||||
sql.append(" sum(case when (cd.indstatusboleto = 'E') then cd.valorpago else 0 end) as entrega_gap, ");
|
||||
sql.append(" sum(case when (cd.motivocancelacion_id is null and cd.indreimpresion = 0 and cd.indstatusoperacion = 'F' and cd.formapago_id in (2,25)) then cd.valorpago else 0 end) as cartao_credito, ");
|
||||
sql.append(" sum(case when (cd.motivocancelacion_id is null and cd.indreimpresion = 0 and cd.indstatusoperacion = 'F' and cd.formapago_id in (3,26)) then cd.valorpago else 0 end) as cartao_debito, ");
|
||||
sql.append(" sum(case when (cd.indstatusboleto = 'C' and cd.motivocancelacion_id in (35)) then cd.valorpago else 0 end) as receita_ocd_deb, ");
|
||||
sql.append(" sum(case when (cd.indstatusboleto = 'C' and cd.motivocancelacion_id in (99) ) then cd.valorpago else 0 end) as receita_ocd_cred ");
|
||||
sql.append("from ( ");
|
||||
sql.append(" select ");
|
||||
sql.append(" c.boleto_id as cajaid, ");
|
||||
sql.append(" c.caja_id as cajaid, ");
|
||||
sql.append(" e.empresa_id as empresaId, ");
|
||||
sql.append(" pv.puntoventa_id as puntoventaId, ");
|
||||
sql.append(" pv.numpuntoventa as codigo, ");
|
||||
|
@ -199,11 +204,12 @@ public class RelatorioFinanceiroSintetico extends Relatorio {
|
|||
sql.append(" coalesce(c.importeoutros, 0) as outros, ");
|
||||
sql.append(" cfp.formapago_id, ");
|
||||
sql.append(" c.motivocancelacion_id as motivocancelacion_id, ");
|
||||
sql.append(" c.tipoventa_id as tipoventa_id ");
|
||||
sql.append(" from boleto c ");
|
||||
sql.append(" inner join boleto_formapago cfp on cfp.boleto_id = c.boleto_id and cfp.activo = 1 ");
|
||||
sql.append(" c.tipoventa_id as tipoventa_id, ");
|
||||
sql.append(" c.indstatusoperacion as indstatusoperacion ");
|
||||
sql.append(" from caja c ");
|
||||
sql.append(" inner join caja_formapago cfp on cfp.caja_id = c.caja_id ");
|
||||
sql.append(" inner join punto_venta pv on pv.puntoventa_id = c.puntoventa_id ");
|
||||
sql.append(" inner join forma_pago fp on cfp.formapago_id = fp.formapago_id and fp.activo = 1 ");
|
||||
sql.append(" inner join forma_pago fp on cfp.formapago_id = fp.formapago_id ");
|
||||
sql.append(" inner join marca m on c.marca_id = m.marca_id ");
|
||||
sql.append(" inner join empresa e on e.empresa_id = m.empresa_id ");
|
||||
sql.append(" inner join parada po on po.parada_id = pv.parada_id ");
|
||||
|
|
Loading…
Reference in New Issue