0014497: calculo de preco do Parana
fixes bug#0014497 dev:Emerson qua:Fabin git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@94234 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
6a69f7814c
commit
fb616277d8
|
@ -21,6 +21,7 @@ public class SQLBuilderOracle implements SQLBuilder {
|
||||||
private static final Integer RED_PAGO_FORMAPAGO_ID = Integer.valueOf(95);
|
private static final Integer RED_PAGO_FORMAPAGO_ID = Integer.valueOf(95);
|
||||||
private static final String RED_PAGO_EMISSOR_TARJETA = "RDP";
|
private static final String RED_PAGO_EMISSOR_TARJETA = "RDP";
|
||||||
private static final String RED_PAGO_FORMA_PAGO = "CR";
|
private static final String RED_PAGO_FORMA_PAGO = "CR";
|
||||||
|
private static final Integer DER_PR = 2;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getSQLGerarTabelaZerada(final Integer codRuta, final Integer usuarioId,final Integer orgaoConcedenteId, final List<Integer> idsEmpresas){
|
public String getSQLGerarTabelaZerada(final Integer codRuta, final Integer usuarioId,final Integer orgaoConcedenteId, final List<Integer> idsEmpresas){
|
||||||
|
@ -274,25 +275,64 @@ public class SQLBuilderOracle implements SQLBuilder {
|
||||||
sb.append(" select ");
|
sb.append(" select ");
|
||||||
sb.append(" ");
|
sb.append(" ");
|
||||||
sb.append(" TARIFA_OFICIAL_SEQ.NEXTVAL, ");
|
sb.append(" TARIFA_OFICIAL_SEQ.NEXTVAL, ");
|
||||||
|
//>> SE ORGAO FOR DER-PR E SE O COEFICIENTE DA CLASSE NAO ESTA NULL
|
||||||
|
sb.append(" CASE R.ORGAOCONCEDENTE_ID WHEN "+DER_PR+" THEN CASE WHEN cl.COEFICIENTETARIFA IS NOT NULL THEN " );
|
||||||
|
sb.append(" trunc(((coalesce(ct1.coeficiente,0) + oc.coeficientetarifa / ((POWER(COALESCE(tc.kmcoeficiente1,0) + 350,0.27)*16160 )) ) * COALESCE(tc.kmcoeficiente1,0)) * cl.COEFICIENTETARIFA " );
|
||||||
|
sb.append(" + ((coalesce(ct2.coeficiente,0) + oc.coeficientetarifa / ((POWER(COALESCE(tc.kmcoeficiente2,0) + 350,0.27)*13470 )) ) * COALESCE(tc.kmcoeficiente2,0)) * cl.COEFICIENTETARIFA,2) " );
|
||||||
|
sb.append(" ELSE " );
|
||||||
|
//< COEFICIENTE DA CLASSE ESTA NULL
|
||||||
sb.append(" ROUND( ");
|
sb.append(" ROUND( ");
|
||||||
sb.append(" (coalesce(ct1.coeficiente,0) * coalesce(tc.kmcoeficiente1,0) + ");
|
sb.append(" (coalesce(ct1.coeficiente,0) * coalesce(tc.kmcoeficiente1,0) + ");
|
||||||
sb.append(" coalesce(ct2.coeficiente,0) * coalesce(tc.kmcoeficiente2,0) + ");
|
sb.append(" coalesce(ct2.coeficiente,0) * coalesce(tc.kmcoeficiente2,0) + ");
|
||||||
sb.append(" coalesce(ct3.coeficiente,0) * coalesce(tc.kmcoeficiente3,0)) * ");
|
sb.append(" coalesce(ct3.coeficiente,0) * coalesce(tc.kmcoeficiente3,0)) * ");
|
||||||
if (orgaoConcedente != null && orgaoConcedente.getIndUtilizaICMS() != null && orgaoConcedente.getIndUtilizaICMS()) {
|
if (orgaoConcedente != null && orgaoConcedente.getIndUtilizaICMS() != null && orgaoConcedente.getIndUtilizaICMS()) {
|
||||||
sb.append(" case when e.icms is null then 1 else (1/(1-e.icms/100)) end ,2) ,");
|
sb.append(" case when e.icms is null then 1 else (1/(1-e.icms/100)) end ,2) ");
|
||||||
} else {
|
} else {
|
||||||
sb.append(" 1, 2 ) ,");
|
sb.append(" 1, 2 ) ");
|
||||||
}
|
}
|
||||||
|
//
|
||||||
|
sb.append(" end else " );
|
||||||
|
//< ORGAO NAO EH DER-PR
|
||||||
sb.append(" ROUND( ");
|
sb.append(" ROUND( ");
|
||||||
sb.append(" (coalesce(ct1.coeficiente,0) * coalesce(tc.kmcoeficiente1,0) + ");
|
sb.append(" (coalesce(ct1.coeficiente,0) * coalesce(tc.kmcoeficiente1,0) + ");
|
||||||
sb.append(" coalesce(ct2.coeficiente,0) * coalesce(tc.kmcoeficiente2,0) + ");
|
sb.append(" coalesce(ct2.coeficiente,0) * coalesce(tc.kmcoeficiente2,0) + ");
|
||||||
sb.append(" coalesce(ct3.coeficiente,0) * coalesce(tc.kmcoeficiente3,0)) * ");
|
sb.append(" coalesce(ct3.coeficiente,0) * coalesce(tc.kmcoeficiente3,0)) * ");
|
||||||
if (orgaoConcedente != null && orgaoConcedente.getIndUtilizaICMS() != null && orgaoConcedente.getIndUtilizaICMS()) {
|
if (orgaoConcedente != null && orgaoConcedente.getIndUtilizaICMS() != null && orgaoConcedente.getIndUtilizaICMS()) {
|
||||||
sb.append(" case when e.icms is null then 1 else (1/(1-e.icms/100)) end ,2) ,");
|
sb.append(" case when e.icms is null then 1 else (1/(1-e.icms/100)) end ,2) ");
|
||||||
} else {
|
} else {
|
||||||
sb.append(" 1, 2 ) ,");
|
sb.append(" 1, 2 ) ");
|
||||||
}
|
}
|
||||||
|
sb.append(" end , " );
|
||||||
|
//
|
||||||
|
//>> SE ORGAO FOR DER-PR E SE O COEFICIENTE DA CLASSE NAO ESTA NULL
|
||||||
|
sb.append(" CASE R.ORGAOCONCEDENTE_ID WHEN "+DER_PR+" THEN CASE WHEN cl.COEFICIENTETARIFA IS NOT NULL THEN " );
|
||||||
|
sb.append(" trunc(((coalesce(ct1.coeficiente,0) + oc.coeficientetarifa / ((POWER(COALESCE(tc.kmcoeficiente1,0) + 350,0.27)*16160 )) ) * COALESCE(tc.kmcoeficiente1,0)) * cl.COEFICIENTETARIFA " );
|
||||||
|
sb.append(" + ((coalesce(ct2.coeficiente,0) + oc.coeficientetarifa / ((POWER(COALESCE(tc.kmcoeficiente2,0) + 350,0.27)*13470 )) ) * COALESCE(tc.kmcoeficiente2,0)) * cl.COEFICIENTETARIFA,2) " );
|
||||||
|
sb.append(" ELSE " );
|
||||||
|
//< COEFICIENTE DA CLASSE ESTA NULL
|
||||||
|
sb.append(" ROUND( ");
|
||||||
|
sb.append(" (coalesce(ct1.coeficiente,0) * coalesce(tc.kmcoeficiente1,0) + ");
|
||||||
|
sb.append(" coalesce(ct2.coeficiente,0) * coalesce(tc.kmcoeficiente2,0) + ");
|
||||||
|
sb.append(" coalesce(ct3.coeficiente,0) * coalesce(tc.kmcoeficiente3,0)) * ");
|
||||||
|
if (orgaoConcedente != null && orgaoConcedente.getIndUtilizaICMS() != null && orgaoConcedente.getIndUtilizaICMS()) {
|
||||||
|
sb.append(" case when e.icms is null then 1 else (1/(1-e.icms/100)) end ,2) ");
|
||||||
|
} else {
|
||||||
|
sb.append(" 1, 2 ) ");
|
||||||
|
}
|
||||||
|
//
|
||||||
|
sb.append(" end else " );
|
||||||
|
//< ORGAO NAO EH DER-PR
|
||||||
|
sb.append(" ROUND( ");
|
||||||
|
sb.append(" (coalesce(ct1.coeficiente,0) * coalesce(tc.kmcoeficiente1,0) + ");
|
||||||
|
sb.append(" coalesce(ct2.coeficiente,0) * coalesce(tc.kmcoeficiente2,0) + ");
|
||||||
|
sb.append(" coalesce(ct3.coeficiente,0) * coalesce(tc.kmcoeficiente3,0)) * ");
|
||||||
|
if (orgaoConcedente != null && orgaoConcedente.getIndUtilizaICMS() != null && orgaoConcedente.getIndUtilizaICMS()) {
|
||||||
|
sb.append(" case when e.icms is null then 1 else (1/(1-e.icms/100)) end ,2) ");
|
||||||
|
} else {
|
||||||
|
sb.append(" 1, 2 ) ");
|
||||||
|
}
|
||||||
|
sb.append(" end , " );
|
||||||
|
//
|
||||||
sb.append(" t.tramo_id, ");
|
sb.append(" t.tramo_id, ");
|
||||||
sb.append(" mc.marca_id, ");
|
sb.append(" mc.marca_id, ");
|
||||||
sb.append(" r.CLASESERVICIO_ID, ");
|
sb.append(" r.CLASESERVICIO_ID, ");
|
||||||
|
@ -331,7 +371,8 @@ public class SQLBuilderOracle implements SQLBuilder {
|
||||||
sb.append(" inner join ciudad c on c.ciudad_id = po.ciudad_id ");
|
sb.append(" inner join ciudad c on c.ciudad_id = po.ciudad_id ");
|
||||||
sb.append(" inner join estado e on e.estado_id = c.estado_id ");
|
sb.append(" inner join estado e on e.estado_id = c.estado_id ");
|
||||||
sb.append(" inner join MARCA_CLASESERVICIO mc on ");
|
sb.append(" inner join MARCA_CLASESERVICIO mc on ");
|
||||||
sb.append(" mc.CLASESERVICIO_ID = r.CLASESERVICIO_ID and ma.marca_id = mc.marca_id, ");
|
sb.append(" mc.CLASESERVICIO_ID = r.CLASESERVICIO_ID and ma.marca_id = mc.marca_id ");
|
||||||
|
sb.append(" inner join CLASE_SERVICIO cl on cl.claseservicio_id = r.CLASESERVICIO_ID, ");
|
||||||
sb.append(" moneda m ");
|
sb.append(" moneda m ");
|
||||||
sb.append(" ");
|
sb.append(" ");
|
||||||
sb.append("where ");
|
sb.append("where ");
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
package com.rjconsultores.ventaboletos.entidad;
|
package com.rjconsultores.ventaboletos.entidad;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -12,17 +13,15 @@ import javax.persistence.Basic;
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.GeneratedValue;
|
import javax.persistence.GeneratedValue;
|
||||||
import javax.persistence.GenerationType;
|
|
||||||
import javax.persistence.Id;
|
import javax.persistence.Id;
|
||||||
import javax.persistence.OneToMany;
|
import javax.persistence.OneToMany;
|
||||||
|
import javax.persistence.SequenceGenerator;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
import javax.persistence.Temporal;
|
import javax.persistence.Temporal;
|
||||||
import javax.persistence.TemporalType;
|
import javax.persistence.TemporalType;
|
||||||
|
|
||||||
import org.hibernate.annotations.GenericGenerator;
|
import org.hibernate.annotations.GenericGenerator;
|
||||||
|
|
||||||
import javax.persistence.SequenceGenerator;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Administrador
|
* @author Administrador
|
||||||
|
@ -67,6 +66,8 @@ public class ClaseServicio implements Serializable {
|
||||||
private List<TarifaHist> tarifaHistList;
|
private List<TarifaHist> tarifaHistList;
|
||||||
@OneToMany(mappedBy = "claseServicio")
|
@OneToMany(mappedBy = "claseServicio")
|
||||||
private List<Corrida> corridaList;
|
private List<Corrida> corridaList;
|
||||||
|
@Column(name = "COEFICIENTETARIFA")
|
||||||
|
private BigDecimal coeficiente;
|
||||||
|
|
||||||
public ClaseServicio() {
|
public ClaseServicio() {
|
||||||
}
|
}
|
||||||
|
@ -80,8 +81,6 @@ public class ClaseServicio implements Serializable {
|
||||||
this.fecmodif = fecmodif;
|
this.fecmodif = fecmodif;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public Integer getClaseservicioId() {
|
public Integer getClaseservicioId() {
|
||||||
return claseservicioId;
|
return claseservicioId;
|
||||||
}
|
}
|
||||||
|
@ -226,4 +225,13 @@ public class ClaseServicio implements Serializable {
|
||||||
public void setTipoServicoBPe(Integer tipoServicoBPe) {
|
public void setTipoServicoBPe(Integer tipoServicoBPe) {
|
||||||
this.tipoServicoBPe = tipoServicoBPe;
|
this.tipoServicoBPe = tipoServicoBPe;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public BigDecimal getCoeficiente() {
|
||||||
|
return coeficiente;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCoeficiente(BigDecimal coeficiente) {
|
||||||
|
this.coeficiente = coeficiente;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -78,6 +78,9 @@ public class OrgaoConcedente implements Serializable {
|
||||||
@OneToMany(mappedBy = "orgaoConcedente", cascade = CascadeType.ALL)
|
@OneToMany(mappedBy = "orgaoConcedente", cascade = CascadeType.ALL)
|
||||||
@Where(clause = "activo=1")
|
@Where(clause = "activo=1")
|
||||||
private List<OrgaoEmpParam> orgaoEmpParams;
|
private List<OrgaoEmpParam> orgaoEmpParams;
|
||||||
|
|
||||||
|
@Column(name = "COEFICIENTETARIFA")
|
||||||
|
private BigDecimal coeficiente;
|
||||||
|
|
||||||
public void addParametro(OrgaoCancelacion param) {
|
public void addParametro(OrgaoCancelacion param) {
|
||||||
this.orgaoCancelacionList.add(param);
|
this.orgaoCancelacionList.add(param);
|
||||||
|
@ -250,6 +253,14 @@ public class OrgaoConcedente implements Serializable {
|
||||||
this.indValDocObligatorioMonitrip = indValDocObligatorioMonitrip;
|
this.indValDocObligatorioMonitrip = indValDocObligatorioMonitrip;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public BigDecimal getCoeficiente() {
|
||||||
|
return coeficiente;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCoeficiente(BigDecimal coeficiente) {
|
||||||
|
this.coeficiente = coeficiente;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
final int prime = 31;
|
final int prime = 31;
|
||||||
|
|
Loading…
Reference in New Issue