fixes bug #9485
git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@72494 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
35b67795a8
commit
360bbf05ad
|
@ -280,7 +280,7 @@ public class SQLBuilderOracle implements SQLBuilder {
|
||||||
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.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 ) ,");
|
||||||
|
@ -289,7 +289,7 @@ public class SQLBuilderOracle implements SQLBuilder {
|
||||||
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.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 ) ,");
|
||||||
|
@ -802,10 +802,10 @@ public class SQLBuilderOracle implements SQLBuilder {
|
||||||
sb.append(" and tao.ACTIVO=1 ");
|
sb.append(" and tao.ACTIVO=1 ");
|
||||||
sb.append(" and v.VIGENCIATARIFA_ID=").append(vigenciaTarifaId).append(" ");
|
sb.append(" and v.VIGENCIATARIFA_ID=").append(vigenciaTarifaId).append(" ");
|
||||||
|
|
||||||
if(orgao != null){
|
if (orgao != null) {
|
||||||
sb.append(" and tao.ORGAOCONCEDENTE_ID=").append(orgao.getOrgaoConcedenteId()).append(" ");
|
sb.append(" and tao.ORGAOCONCEDENTE_ID=").append(orgao.getOrgaoConcedenteId()).append(" ");
|
||||||
}
|
}
|
||||||
if(empresa != null){
|
if (empresa != null) {
|
||||||
sb.append(" and m.EMPRESA_ID=").append(empresa.getEmpresaId()).append(" ");
|
sb.append(" and m.EMPRESA_ID=").append(empresa.getEmpresaId()).append(" ");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -924,13 +924,13 @@ public class SQLBuilderOracle implements SQLBuilder {
|
||||||
|
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getSQLBuscarDatosCaja(Date fechaDesde, Date fechaHasta, Boolean sembilhetesPacote) {
|
public String getSQLBuscarDatosCaja(Date fechaDesde, Date fechaHasta, Boolean sembilhetesPacote) {
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
|
|
||||||
StringBuilder sb = new StringBuilder("");
|
StringBuilder sb = new StringBuilder("");
|
||||||
|
|
||||||
|
|
||||||
sb.append(" select ");
|
sb.append(" select ");
|
||||||
sb.append(" ");
|
sb.append(" ");
|
||||||
sb.append(" c.CAJA_ID as \"cajaId\", ");
|
sb.append(" c.CAJA_ID as \"cajaId\", ");
|
||||||
|
@ -1007,7 +1007,7 @@ public class SQLBuilderOracle implements SQLBuilder {
|
||||||
sb.append(" where ");
|
sb.append(" where ");
|
||||||
sb.append(" trunc(fechorventa) between to_date('").append(sdf.format(fechaDesde)).append("','yyyy-MM-dd') and ").append(" to_date('").append(sdf.format(fechaHasta)).append("','yyyy-MM-dd')");
|
sb.append(" trunc(fechorventa) between to_date('").append(sdf.format(fechaDesde)).append("','yyyy-MM-dd') and ").append(" to_date('").append(sdf.format(fechaHasta)).append("','yyyy-MM-dd')");
|
||||||
|
|
||||||
if(sembilhetesPacote != null && sembilhetesPacote) {
|
if (sembilhetesPacote != null && sembilhetesPacote) {
|
||||||
sb.append("and fp.tipo_pago != ")
|
sb.append("and fp.tipo_pago != ")
|
||||||
.append(TipoFormapago.PACOTE.getValor())
|
.append(TipoFormapago.PACOTE.getValor())
|
||||||
.append("and (c.motivocancelacion_id is null or c.motivocancelacion_id != ")
|
.append("and (c.motivocancelacion_id is null or c.motivocancelacion_id != ")
|
||||||
|
|
|
@ -80,17 +80,20 @@ public class TarifaOficialServiceImpl implements TarifaOficialService {
|
||||||
rutaId = r.getRutaId();
|
rutaId = r.getRutaId();
|
||||||
}
|
}
|
||||||
|
|
||||||
log.info("gerarAtualizarTarifa= rudaId:" + rutaId + ";orgaoConcedenteId:" + orgaoConcedente.getOrgaoConcedenteId() + ";empresaId:" + idsEmpresas);
|
log.info("gerarAtualizarTarifa= rudaId:" + rutaId + ";orgaoConcedenteId:" + (orgaoConcedente != null ? orgaoConcedente.getOrgaoConcedenteId() : "null") + ";empresaId:" + idsEmpresas);
|
||||||
|
|
||||||
// Gerando as tarifas pelo coeficiente
|
// Gerando as tarifas pelo coeficiente
|
||||||
if (orgaoConcedente.getOrgaoConcedenteId() == null || orgaoConcedente.getOrgaoConcedenteId() != OrgaoConcedente.CODIGO_ARTESP) {
|
if (orgaoConcedente == null ||
|
||||||
|
(orgaoConcedente.getOrgaoConcedenteId() == null || orgaoConcedente.getOrgaoConcedenteId() != OrgaoConcedente.CODIGO_ARTESP)) {
|
||||||
Integer qtdTarifaCoeficiente = gerarTarifaPorCoeficiente(rutaId, orgaoConcedente, idsEmpresas);
|
Integer qtdTarifaCoeficiente = gerarTarifaPorCoeficiente(rutaId, orgaoConcedente, idsEmpresas);
|
||||||
log.info("qtdTarifaCoeficiente=" + qtdTarifaCoeficiente);
|
log.info("qtdTarifaCoeficiente=" + qtdTarifaCoeficiente);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Gerando as tarifas para ARTESP
|
// Gerando as tarifas para ARTESP
|
||||||
if (orgaoConcedente.getOrgaoConcedenteId() == null || orgaoConcedente.getOrgaoConcedenteId() == OrgaoConcedente.CODIGO_ARTESP) {
|
if (orgaoConcedente == null ||
|
||||||
Integer qtdTarifaArtesp = tarifaOficialDAO.gerarTarifaArtesp(rutaId, UsuarioLogado.getUsuarioLogado().getUsuarioId(), orgaoConcedente.getOrgaoConcedenteId(), idsEmpresas);
|
(orgaoConcedente.getOrgaoConcedenteId() == null || orgaoConcedente.getOrgaoConcedenteId() == OrgaoConcedente.CODIGO_ARTESP)) {
|
||||||
|
Integer qtdTarifaArtesp = tarifaOficialDAO.gerarTarifaArtesp(rutaId, UsuarioLogado.getUsuarioLogado().getUsuarioId(),
|
||||||
|
orgaoConcedente != null ? orgaoConcedente.getOrgaoConcedenteId() : null, idsEmpresas);
|
||||||
log.info("qtdTarifaArtesp=" + qtdTarifaArtesp);
|
log.info("qtdTarifaArtesp=" + qtdTarifaArtesp);
|
||||||
}
|
}
|
||||||
x--;
|
x--;
|
||||||
|
@ -182,7 +185,7 @@ public class TarifaOficialServiceImpl implements TarifaOficialService {
|
||||||
if(lsRuta != null && !lsRuta.isEmpty()){
|
if(lsRuta != null && !lsRuta.isEmpty()){
|
||||||
rutaId = lsRuta.get(x-1).getRutaId();
|
rutaId = lsRuta.get(x-1).getRutaId();
|
||||||
}
|
}
|
||||||
//O seguro por km é preferencial em relação ao por tarifa.
|
// O seguro por km é preferencial em relação ao por tarifa.
|
||||||
for (Integer orgaoConcedenteId : lsOrgaoId) {
|
for (Integer orgaoConcedenteId : lsOrgaoId) {
|
||||||
if (seguroKmDAO.existe(orgaoConcedenteId)) {
|
if (seguroKmDAO.existe(orgaoConcedenteId)) {
|
||||||
atualizarSeguroPorKm(rutaId, orgaoConcedenteId, tipoSeguro);
|
atualizarSeguroPorKm(rutaId, orgaoConcedenteId, tipoSeguro);
|
||||||
|
@ -223,7 +226,7 @@ public class TarifaOficialServiceImpl implements TarifaOficialService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
x--;
|
x--;
|
||||||
}while(x > 0);
|
} while (x > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue