2950 lines
150 KiB
VB.net
2950 lines
150 KiB
VB.net
Imports ULA.Davivienda.WCFServiciosGenerales.DAL
|
|
Imports ULA.Davivienda.WCFServiciosGenerales.BL.UtilitarioGenBL
|
|
Imports ULA.Davivienda.WCFServiciosGenerales.BL.UtilitarioSensibilizacionBL
|
|
Imports ULA.Davivienda.WCFServiciosGenerales.Entidades
|
|
Imports System
|
|
Imports System.Xml
|
|
Imports System.Configuration
|
|
|
|
Public Class ServiciosBL
|
|
|
|
|
|
Public Shared Function GuardarRegistrosDeudasCIC(ByVal Proceso As String,
|
|
ByVal Incidente As Integer,
|
|
ByVal Solicitud As Integer,
|
|
ByVal Identificacion As String,
|
|
ByVal CadenaXml As String) As String
|
|
|
|
|
|
Dim aNombreParametro(19), aValorParametro(19) As String
|
|
Dim aNombreParametro2(17), aValorParametro2(17) As String
|
|
Dim aNombreParametro3(2), aValorParametro3(2) As String
|
|
|
|
|
|
Dim strFuenteDatos As String = String.Empty
|
|
Dim strSPSituActual As String = String.Empty
|
|
Dim strSPSituHistorica As String = String.Empty
|
|
Dim strRespXML As String = String.Empty
|
|
Dim strError As String = String.Empty
|
|
|
|
Dim objXMLDocumento As New XmlDocument
|
|
Dim objXMLNodoHijosA As XmlNode = Nothing
|
|
Dim objXMLNodoHijosH As XmlNode = Nothing
|
|
|
|
Try
|
|
|
|
|
|
'Obtiene los procedimientos/base de datos a ejecutarse
|
|
Select Case Proceso
|
|
Case Enumerador.ProcesoUltimus.PrestamoPrendario.ToString()
|
|
strFuenteDatos = Enumerador.FuenteDatosUltimus.BPMPRENDARIO.ToString()
|
|
strSPSituActual = "usp_cp_situacion_actual"
|
|
strSPSituHistorica = "usp_cp_situacion_historica"
|
|
End Select
|
|
|
|
|
|
If CadenaXml.Trim() <> "" Then
|
|
|
|
objXMLDocumento.LoadXml(CadenaXml)
|
|
|
|
|
|
If Not objXMLDocumento.SelectSingleNode("//Registros/SituacionActual") Is Nothing Then
|
|
|
|
objXMLNodoHijosA = objXMLDocumento.SelectSingleNode("//Registros/SituacionActual")
|
|
|
|
If objXMLNodoHijosA.InnerText <> "" Then
|
|
|
|
aNombreParametro3(1) = "@i_opcion" : aValorParametro3(1) = 8
|
|
aNombreParametro3(2) = "@i_solicitud" : aValorParametro3(2) = Solicitud
|
|
|
|
Dim strRespActualDel As String = outConector.EjecutarComandoSQLArreglo(Proceso, strFuenteDatos, strSPSituActual, aNombreParametro3, aValorParametro3, 0)
|
|
|
|
|
|
If (strRespActualDel <> "<NewDataSet />") Then
|
|
Dim xmlRespH As New XmlDocument
|
|
xmlRespH.LoadXml(strRespActualDel)
|
|
Dim excH As New Exception(xmlRespH.SelectSingleNode("//NewDataSet/Table/STATUS").InnerText)
|
|
Throw excH
|
|
End If
|
|
|
|
For i As Integer = 0 To objXMLNodoHijosA.ChildNodes.Count - 1
|
|
|
|
Dim xmlElementoSelected As XmlElement
|
|
xmlElementoSelected = objXMLNodoHijosA.ChildNodes.Item(i)
|
|
|
|
Dim strEntidadA As String = xmlElementoSelected.SelectSingleNode("Entidad").InnerText.Trim()
|
|
Dim strIdOperacionA As String = xmlElementoSelected.SelectSingleNode("Id.Operacion").InnerText.Trim()
|
|
Dim strMonedaA As String = xmlElementoSelected.SelectSingleNode("Moneda").InnerText.Trim()
|
|
Dim strFechaVecimientoA As String = xmlElementoSelected.SelectSingleNode("Fecha_de_Vencimiento").InnerText.Trim()
|
|
Dim strSaldoA As String = xmlElementoSelected.SelectSingleNode("Saldo").InnerText.Trim()
|
|
Dim strMontoNoDesembolsadoA As String = xmlElementoSelected.SelectSingleNode("Monto_no_desembolsado_o_fiado_avalado").InnerText.Trim()
|
|
Dim strTipoOperacionA As String = xmlElementoSelected.SelectSingleNode("Tipo_de_Operacion").InnerText.Trim()
|
|
Dim strCondicionA As String = xmlElementoSelected.SelectSingleNode("Condicion").InnerText.Trim()
|
|
Dim strEstadoOperacionA As String = xmlElementoSelected.SelectSingleNode("Estado_de_la_Operacion").InnerText.Trim()
|
|
Dim strDiasAtrasoA As String = xmlElementoSelected.SelectSingleNode("Dias_de_Atraso").InnerText.Trim()
|
|
Dim strActualizadoA As String = xmlElementoSelected.SelectSingleNode("Actualizado").InnerText.Trim()
|
|
Dim strCuotaCalcA As String = xmlElementoSelected.SelectSingleNode("Cuota_calc").InnerText.Trim()
|
|
Dim strCancelaA As String = xmlElementoSelected.SelectSingleNode("Cancela").InnerText.Trim()
|
|
|
|
'Validacion de campos
|
|
If strMonedaA.ToUpper() = "CRC" Then
|
|
strMonedaA = "N - COLONES O UNIDADES DE DESARROLLO"
|
|
ElseIf strMonedaA.ToUpper() = "USD" Then
|
|
strMonedaA = "E - DIVISA EXTRANJERA"
|
|
End If
|
|
|
|
If strCondicionA.ToUpper() = "DEUDOR" Then
|
|
strCondicionA = "DEUDOR"
|
|
ElseIf strCondicionA.ToUpper() = "CODEUDOR" Then
|
|
strCondicionA = "CO-DEUDOR"
|
|
ElseIf strCondicionA.ToUpper() = "FIADOR" Then
|
|
strCondicionA = "FIADOR/AVALISTA"
|
|
End If
|
|
|
|
'Llena la matriz de parametros para enviar a base de datos
|
|
aNombreParametro(1) = "@i_entidad_acreedora" : aValorParametro(1) = strEntidadA
|
|
aNombreParametro(2) = "@i_id_operacion" : aValorParametro(2) = strIdOperacionA
|
|
aNombreParametro(3) = "@i_moneda" : aValorParametro(3) = strMonedaA
|
|
aNombreParametro(4) = "@i_fecha_vencimiento" : aValorParametro(4) = Valida_Fecha(strFechaVecimientoA, 1, "FECHA VENCIMIENTO", "SITUACION ACTUAL", 0)
|
|
aNombreParametro(5) = "@i_saldo" : aValorParametro(5) = Valida_Numero(strSaldoA, "SALDO", "SITUACION ACTUAL")
|
|
aNombreParametro(6) = "@i_monto_nodes" : aValorParametro(6) = Valida_Numero(strMontoNoDesembolsadoA, "MONTO NO DESEMBOLSADO", "SITUACION ACTUAL")
|
|
aNombreParametro(7) = "@i_tipo_operacion" : aValorParametro(7) = EncuentraTipoOperacion(strTipoOperacionA)
|
|
aNombreParametro(8) = "@i_condicion" : aValorParametro(8) = strCondicionA
|
|
aNombreParametro(9) = "@i_estado_operacion" : aValorParametro(9) = EncuentraEstadoOperacion(strEstadoOperacionA)
|
|
aNombreParametro(10) = "@i_dias_atrasos" : aValorParametro(10) = strDiasAtrasoA
|
|
aNombreParametro(11) = "@i_fe_inicio" : aValorParametro(11) = Valida_Fecha(strActualizadoA, 1, "ACTUALIZADO AL", "SITUACION ACTUAL", 0)
|
|
aNombreParametro(12) = "@i_opcion" : aValorParametro(12) = "2"
|
|
aNombreParametro(13) = "@i_incidente" : aValorParametro(13) = Incidente
|
|
aNombreParametro(14) = "@i_solicitud" : aValorParametro(14) = Solicitud
|
|
aNombreParametro(15) = "@i_identificacion" : aValorParametro(15) = Identificacion
|
|
aNombreParametro(16) = "@i_estado" : aValorParametro(16) = "E"
|
|
aNombreParametro(17) = "@i_esdeudor" : aValorParametro(17) = 1
|
|
aNombreParametro(18) = "@i_proceso" : aValorParametro(18) = Proceso
|
|
aNombreParametro(19) = "@i_cuotas_equivalente" : aValorParametro(19) = Valida_Numero(strCuotaCalcA, "CUOTA_CALC", "SITUACION ACTUAL")
|
|
|
|
|
|
Dim strRespActual As String = outConector.EjecutarComandoSQLArreglo(Proceso, strFuenteDatos, strSPSituActual, aNombreParametro, aValorParametro, 0)
|
|
|
|
If (strRespActual <> "<NewDataSet />") Then
|
|
Dim xmlRespH As New XmlDocument
|
|
xmlRespH.LoadXml(strRespActual)
|
|
Dim excH As New Exception(xmlRespH.SelectSingleNode("//NewDataSet/Table/STATUS").InnerText)
|
|
Throw excH
|
|
End If
|
|
|
|
Next
|
|
End If
|
|
End If
|
|
|
|
|
|
If Not objXMLDocumento.SelectSingleNode("//Registros/SituacionHistorica") Is Nothing Then
|
|
|
|
objXMLNodoHijosH = objXMLDocumento.SelectSingleNode("//Registros/SituacionHistorica")
|
|
|
|
If objXMLNodoHijosH.InnerText <> "" Then
|
|
|
|
aNombreParametro3(1) = "@i_opcion" : aValorParametro3(1) = 6
|
|
aNombreParametro3(2) = "@i_solicitud" : aValorParametro3(2) = Solicitud
|
|
|
|
|
|
Dim strRespHistoricoDel As String = outConector.EjecutarComandoSQLArreglo(Proceso, strFuenteDatos, strSPSituHistorica, aNombreParametro3, aValorParametro3, 0)
|
|
|
|
|
|
If (strRespHistoricoDel <> "<NewDataSet />") Then
|
|
Dim xmlRespH As New XmlDocument
|
|
xmlRespH.LoadXml(strRespHistoricoDel)
|
|
Dim excH As New Exception(xmlRespH.SelectSingleNode("//NewDataSet/Table/STATUS").InnerText)
|
|
Throw excH
|
|
End If
|
|
|
|
For i As Integer = 0 To objXMLNodoHijosH.ChildNodes.Count - 1
|
|
|
|
Dim xmlElementoSelected As XmlElement
|
|
Dim puntaje As String
|
|
xmlElementoSelected = objXMLNodoHijosH.ChildNodes.Item(i)
|
|
|
|
Dim strEntidadH As String = xmlElementoSelected.SelectSingleNode("entidad").InnerText.Trim()
|
|
Dim strOperacionH As String = xmlElementoSelected.SelectSingleNode("operacion").InnerText.Trim()
|
|
Dim strFechaVecimientoH As String = xmlElementoSelected.SelectSingleNode("fechavencimiento").InnerText.Trim()
|
|
Dim strSituacionOperaH As String = xmlElementoSelected.SelectSingleNode("situacionopera").InnerText.Trim()
|
|
Dim strMotivoNoReporteH As String = xmlElementoSelected.SelectSingleNode("motivonoreporte").InnerText.Trim()
|
|
Dim strMesesReportadosH As String = xmlElementoSelected.SelectSingleNode("mesesreportados").InnerText.Trim()
|
|
Dim strUltimoPeriodoH As String = xmlElementoSelected.SelectSingleNode("ultimoperiodo").InnerText.Trim()
|
|
Dim strAtrasoMaximoH As String = xmlElementoSelected.SelectSingleNode("atrasomaximo").InnerText.Trim()
|
|
Dim strAtrasoMedioH As String = xmlElementoSelected.SelectSingleNode("atrasomedio").InnerText.Trim()
|
|
Dim strPuntajeH As String = xmlElementoSelected.SelectSingleNode("puntaje").InnerText.Trim()
|
|
Dim strPonderadoH As String = xmlElementoSelected.SelectSingleNode("ponderador").InnerText.Trim()
|
|
|
|
'Validacion de campos
|
|
If strUltimoPeriodoH.Trim() <> "" Then
|
|
strUltimoPeriodoH = strUltimoPeriodoH.Replace("-", "/")
|
|
End If
|
|
|
|
If Integer.Parse(strPuntajeH.Split(",")(1)) <= 0 Then
|
|
puntaje = Integer.Parse(strPuntajeH.Split(",")(0))
|
|
Else
|
|
puntaje = strPuntajeH.Split(",")(0) & "." & strPuntajeH.Split(",")(1)
|
|
End If
|
|
|
|
'Llena la matriz de parametros para enviar a base de datos
|
|
aNombreParametro2(1) = "@i_opcion" : aValorParametro2(1) = 2
|
|
aNombreParametro2(2) = "@i_entidad_acreedora" : aValorParametro2(2) = strEntidadH
|
|
aNombreParametro2(3) = "@i_fecha_vencimiento" : aValorParametro2(3) = Valida_Fecha(strFechaVecimientoH, 1, "FECHA VENCIMIENTO", "SITUACION HISTORICA", 1)
|
|
aNombreParametro2(4) = "@i_estado_operacion" : aValorParametro2(4) = strSituacionOperaH
|
|
aNombreParametro2(5) = "@i_motivo_liquidacion" : aValorParametro2(5) = strMotivoNoReporteH
|
|
aNombreParametro2(6) = "@i_meses_reportados" : aValorParametro2(6) = strMesesReportadosH
|
|
aNombreParametro2(7) = "@i_periodo_reportado" : aValorParametro2(7) = Valida_Fecha(Formato_Fecha(strUltimoPeriodoH), 1, "ULTIMO PERIODO REPORTADO", "SITUACION HISTORICA", 0)
|
|
aNombreParametro2(8) = "@i_atraso_maximo" : aValorParametro2(8) = Valida_Numero(Quita_Formato_Numero("2", strAtrasoMaximoH), "ATRASO MAXIMO", "SITUACION HISTORICA")
|
|
aNombreParametro2(9) = "@i_atraso_medio" : aValorParametro2(9) = Valida_Numero(Quita_Formato_Numero("2", strAtrasoMedioH), "ATRASO MEDIO", "SITUACION HISTORICA")
|
|
aNombreParametro2(10) = "@i_ponderador" : aValorParametro2(10) = puntaje
|
|
aNombreParametro2(11) = "@i_incidente" : aValorParametro2(11) = Incidente
|
|
aNombreParametro2(12) = "@i_solicitud" : aValorParametro2(12) = Solicitud
|
|
aNombreParametro2(13) = "@i_identificacion" : aValorParametro2(13) = Identificacion
|
|
aNombreParametro2(14) = "@i_id_operacion" : aValorParametro2(14) = strOperacionH
|
|
aNombreParametro2(15) = "@i_estado" : aValorParametro2(15) = "E"
|
|
aNombreParametro2(16) = "@i_esdeudor" : aValorParametro2(16) = 1
|
|
aNombreParametro2(17) = "@i_proceso" : aValorParametro2(17) = Proceso
|
|
|
|
Dim strRespHistorico As String = outConector.EjecutarComandoSQLArreglo(Proceso, strFuenteDatos, strSPSituHistorica, aNombreParametro2, aValorParametro2, 0)
|
|
|
|
If (strRespHistorico <> "<NewDataSet />") Then
|
|
Dim xmlRespH As New XmlDocument
|
|
xmlRespH.LoadXml(strRespHistorico)
|
|
Dim excH As New Exception(xmlRespH.SelectSingleNode("//NewDataSet/Table/STATUS").InnerText)
|
|
Throw excH
|
|
End If
|
|
|
|
Next
|
|
End If
|
|
|
|
strRespXML = ""
|
|
strRespXML &= "<RESPUESTA>"
|
|
strRespXML &= "Operacion Exitosa"
|
|
strRespXML &= "</RESPUESTA>"
|
|
End If
|
|
Else
|
|
Dim excNoExec As New Exception("Estructura XML no valida.")
|
|
Throw excNoExec
|
|
End If
|
|
|
|
|
|
Catch ex As Exception
|
|
Try
|
|
strError = ex.Message
|
|
'objAudit.Credentials = System.Net.CredentialCache.DefaultCredentials
|
|
'objAudit.grabarLog(Proceso, "ServiciosGenerales", "GuardarRegistrosDeudasCIC", "E", strError)
|
|
strRespXML = "<Direccion><Resultado>" & strError & "</Resultado></Direccion>"
|
|
Catch ex2 As Exception
|
|
'grabarError(Proceso, "ServiciosGenerales", "GuardarRegistrosDeudasCIC", "E", strError)
|
|
End Try
|
|
Finally
|
|
|
|
If strError <> "" Then
|
|
strRespXML = "<Direccion><Resultado>" & strError & "</Resultado></Direccion>"
|
|
End If
|
|
End Try
|
|
|
|
Return strRespXML
|
|
|
|
End Function
|
|
|
|
|
|
|
|
|
|
Public Shared Function GuardarOperacionesCIC(req As GuardarOperacionesCICRequest) As GuardarOperacionesCICResponse
|
|
|
|
Dim aNombreParametro(18), aValorParametro(18) As String
|
|
Dim aNombreParametro2(6), aValorParametro2(5) As String
|
|
|
|
|
|
Dim strFuenteDatos As String = String.Empty
|
|
Dim strSP As String = String.Empty
|
|
|
|
Dim strXML As String = String.Empty
|
|
Dim strXML2 As String = String.Empty
|
|
Dim strRespXML As String = String.Empty
|
|
|
|
|
|
|
|
Dim child As XmlNode = Nothing
|
|
Dim objXMLNodoHijos As XmlNode = Nothing
|
|
Dim objXMLDocumento As XmlDocument = New XmlDocument
|
|
|
|
|
|
Dim TipoOperacion As String = String.Empty
|
|
Dim IdOperacion As String = String.Empty
|
|
Dim CuotaMensual As String = String.Empty
|
|
Dim SaldoActual As String = String.Empty
|
|
Dim FechaVencimiento As String = String.Empty
|
|
Dim MontoOriginal As String = String.Empty
|
|
Dim Estado As String = String.Empty
|
|
Dim FechaInicio As String = String.Empty
|
|
Dim Moneda As String = String.Empty
|
|
|
|
|
|
Dim strError As String = String.Empty
|
|
Dim resp As GuardarOperacionesCICResponse = Nothing
|
|
|
|
Try
|
|
|
|
resp = New GuardarOperacionesCICResponse()
|
|
|
|
strFuenteDatos = Enumerador.FuenteDatosUltimus.BPMPRENDARIO
|
|
strSP = "usp_cp_situacion_actual"
|
|
|
|
|
|
If req.TipoProducto = "Activos" Then
|
|
objXMLDocumento.LoadXml(req.CadenaXml)
|
|
objXMLNodoHijos = objXMLDocumento.SelectSingleNode("//Activos/Prestamos")
|
|
If objXMLNodoHijos.InnerText <> "" Then
|
|
aNombreParametro2(1) = "@i_opcion" : aValorParametro2(1) = 5
|
|
aNombreParametro2(2) = "@i_solicitud" : aValorParametro2(2) = req.Solicitud
|
|
aNombreParametro2(3) = "@i_esdeudor" : aValorParametro2(3) = req.TipoParticipante
|
|
aNombreParametro2(4) = "@i_identificacion" : aValorParametro2(4) = req.Identificacion
|
|
aNombreParametro2(5) = "@i_proceso" : aValorParametro2(5) = req.Proceso.ToString()
|
|
aNombreParametro2(6) = "@i_idcliente" : aValorParametro2(6) = req.IdCliente
|
|
|
|
strXML2 = outConector.EjecutarComandoSQLArreglo(req.Proceso.ToString(), strFuenteDatos, strSP, aNombreParametro2, aValorParametro2, 0)
|
|
|
|
For i As Integer = 0 To objXMLNodoHijos.ChildNodes.Count - 1
|
|
child = objXMLNodoHijos.ChildNodes.Item(i)
|
|
TipoOperacion = child.SelectSingleNode("TIPOOPERACION").InnerText
|
|
IdOperacion = child.SelectSingleNode("OPERACION").InnerText
|
|
CuotaMensual = child.SelectSingleNode("CUOTAMENSUAL").InnerText
|
|
SaldoActual = child.SelectSingleNode("SALDOACTUAL").InnerText
|
|
FechaVencimiento = child.SelectSingleNode("FECHAVENCIMIENTO").InnerText
|
|
MontoOriginal = child.SelectSingleNode("MONTOORIGINAL").InnerText
|
|
Estado = child.SelectSingleNode("ESTADO").InnerText
|
|
FechaInicio = child.SelectSingleNode("FECHAINICIO").InnerText
|
|
Moneda = child.SelectSingleNode("MONEDA").InnerText
|
|
If Moneda.ToUpper = "COLONES" Then
|
|
Moneda = "N - COLONES O UNIDADES DE DESARROLLO"
|
|
ElseIf Moneda.ToUpper = "DOLARES" Then
|
|
Moneda = "E - DIVISA EXTRANJERA"
|
|
End If
|
|
|
|
aNombreParametro(1) = "@i_opcion" : aValorParametro(1) = 2
|
|
aNombreParametro(2) = "@i_incidente" : aValorParametro(2) = req.Incidente
|
|
aNombreParametro(3) = "@i_solicitud" : aValorParametro(3) = req.Solicitud
|
|
aNombreParametro(4) = "@i_identificacion" : aValorParametro(4) = req.Identificacion
|
|
aNombreParametro(5) = "@i_esdeudor" : aValorParametro(5) = req.TipoParticipante
|
|
aNombreParametro(6) = "@i_estado" : aValorParametro(6) = "A"
|
|
aNombreParametro(7) = "@i_id_operacion" : aValorParametro(7) = IdOperacion
|
|
aNombreParametro(8) = "@i_moneda" : aValorParametro(8) = Moneda
|
|
aNombreParametro(9) = "@i_fecha_vencimiento" : aValorParametro(9) = FechaVencimiento
|
|
aNombreParametro(10) = "@i_tipo_operacion" : aValorParametro(10) = TipoOperacion
|
|
aNombreParametro(11) = "@i_estado_operacion" : aValorParametro(11) = Estado.Trim
|
|
aNombreParametro(12) = "@i_saldo" : aValorParametro(12) = SaldoActual
|
|
aNombreParametro(13) = "@i_cuotas_equivalente" : aValorParametro(13) = CuotaMensual
|
|
aNombreParametro(14) = "@i_monto_original" : aValorParametro(14) = MontoOriginal
|
|
aNombreParametro(15) = "@i_fe_inicio" : aValorParametro(15) = FechaInicio
|
|
aNombreParametro(16) = "@i_entidad_acreedora" : aValorParametro(16) = "DAVIVIENDA"
|
|
aNombreParametro(17) = "@i_proceso" : aValorParametro(17) = req.Proceso.ToString()
|
|
aNombreParametro(18) = "@i_idcliente" : aValorParametro(18) = req.IdCliente
|
|
|
|
|
|
strXML = outConector.EjecutarComandoSQLArreglo(req.Proceso.ToString(), strFuenteDatos, strSP, aNombreParametro, aValorParametro, 0)
|
|
Next
|
|
End If
|
|
|
|
|
|
strRespXML = ""
|
|
strRespXML &= "<RESPUESTA>"
|
|
strRespXML &= "Operacion Exitosa"
|
|
strRespXML &= "</RESPUESTA>"
|
|
|
|
ElseIf req.TipoProducto = "Tarjetas" Then
|
|
|
|
objXMLDocumento.LoadXml(req.CadenaXml)
|
|
objXMLNodoHijos = objXMLDocumento.SelectSingleNode("//TarjetasCredito/Tarjetas")
|
|
|
|
If objXMLNodoHijos.InnerText <> "" Then
|
|
aNombreParametro2(1) = "@i_opcion" : aValorParametro2(1) = 6
|
|
aNombreParametro2(2) = "@i_solicitud" : aValorParametro2(2) = req.Solicitud
|
|
aNombreParametro2(3) = "@i_esdeudor" : aValorParametro2(3) = req.TipoParticipante
|
|
aNombreParametro2(4) = "@i_identificacion" : aValorParametro2(4) = req.Identificacion
|
|
aNombreParametro2(5) = "@i_proceso" : aValorParametro2(5) = req.Proceso.ToString()
|
|
aNombreParametro2(6) = "@i_idcliente" : aValorParametro2(6) = req.IdCliente
|
|
|
|
strXML2 = outConector.EjecutarComandoSQLArreglo(req.Proceso.ToString(), strFuenteDatos, strSP, aNombreParametro2, aValorParametro2, 0)
|
|
|
|
For i = 0 To objXMLNodoHijos.ChildNodes.Count - 1
|
|
|
|
child = objXMLNodoHijos.ChildNodes.Item(i)
|
|
IdOperacion = child.SelectSingleNode("NUMERO").InnerText
|
|
MontoOriginal = child.SelectSingleNode("LIMITE").InnerText
|
|
FechaInicio = child.SelectSingleNode("FECHAAPERTURA").InnerText
|
|
Moneda = child.SelectSingleNode("MONEDA").InnerText
|
|
|
|
If Moneda.ToUpper = "COLONES" Then
|
|
Moneda = "N - COLONES O UNIDADES DE DESARROLLO"
|
|
ElseIf Moneda.ToUpper = "DOLARES" Then
|
|
Moneda = "E - DIVISA EXTRANJERA"
|
|
End If
|
|
|
|
If req.Proceso.ToString() = Enumerador.ProcesoUltimus.PrestamoPrendario.ToString() Then
|
|
SaldoActual = child.SelectSingleNode("SALDO").InnerText
|
|
If SaldoActual = "" Then
|
|
SaldoActual = "0"
|
|
End If
|
|
CuotaMensual = child.SelectSingleNode("PAGOMINIMO").InnerText
|
|
If CuotaMensual = "" Then
|
|
CuotaMensual = "0"
|
|
End If
|
|
End If
|
|
|
|
aNombreParametro(1) = "@i_opcion" : aValorParametro(1) = 2
|
|
aNombreParametro(2) = "@i_incidente" : aValorParametro(2) = req.Incidente
|
|
aNombreParametro(3) = "@i_solicitud" : aValorParametro(3) = req.Solicitud
|
|
aNombreParametro(4) = "@i_identificacion" : aValorParametro(4) = req.Identificacion
|
|
aNombreParametro(5) = "@i_esdeudor" : aValorParametro(5) = req.TipoParticipante
|
|
aNombreParametro(6) = "@i_estado" : aValorParametro(6) = "T"
|
|
aNombreParametro(7) = "@i_id_operacion" : aValorParametro(7) = IdOperacion
|
|
aNombreParametro(8) = "@i_moneda" : aValorParametro(8) = Moneda
|
|
aNombreParametro(9) = "@i_condicion" : aValorParametro(9) = "DEUDOR"
|
|
aNombreParametro(10) = "@i_tipo_operacion" : aValorParametro(10) = "3 - TARJETAS DE CRÉDITO"
|
|
aNombreParametro(11) = "@i_estado_operacion" : aValorParametro(11) = "VIGENTE"
|
|
aNombreParametro(12) = "@i_monto_original" : aValorParametro(12) = MontoOriginal
|
|
aNombreParametro(13) = "@i_fe_inicio" : aValorParametro(13) = FechaInicio
|
|
aNombreParametro(14) = "@i_entidad_acreedora" : aValorParametro(14) = "DAVIVIENDA"
|
|
|
|
aNombreParametro(15) = "@i_saldo" : aValorParametro(15) = SaldoActual
|
|
aNombreParametro(16) = "@i_cuotas_equivalente" : aValorParametro(16) = CuotaMensual
|
|
aNombreParametro(17) = "@i_proceso" : aValorParametro(17) = req.Proceso.ToString()
|
|
aNombreParametro(18) = "@i_idcliente" : aValorParametro(18) = req.IdCliente
|
|
|
|
|
|
strXML = outConector.EjecutarComandoSQLArreglo(req.Proceso.ToString(), strFuenteDatos, strSP, aNombreParametro, aValorParametro, 0)
|
|
|
|
Next
|
|
End If
|
|
|
|
strRespXML = ""
|
|
strRespXML &= "<RESPUESTA>"
|
|
strRespXML &= "Operacion Exitosa"
|
|
strRespXML &= "</RESPUESTA>"
|
|
End If
|
|
|
|
resp.errCode = "00"
|
|
resp.errMessage = "EXITOSO"
|
|
resp.resultado = strRespXML
|
|
|
|
Catch excError As Exception
|
|
Try
|
|
strError = excError.Message
|
|
|
|
'objAudit.grabarLog(Proceso, "ServiciosGenerales", "GuardarOperacionesCIC", "E", strError)
|
|
Catch ex As Exception
|
|
'grabarError(Proceso, "ServiciosGenerales", "GuardarOperacionesCIC", "E", strError)
|
|
End Try
|
|
resp.errCode = "99"
|
|
resp.errMessage = strError
|
|
End Try
|
|
|
|
Return resp
|
|
|
|
End Function
|
|
|
|
|
|
|
|
|
|
Public Shared Function ObtenerDatosCICBD(req As ObtenerDatosCICBDRequest) As ObtenerDatosCICBDResponse
|
|
|
|
Dim resp As ObtenerDatosCICBDResponse = Nothing
|
|
|
|
Dim aNombreParametro(26), aValorParametro(26) As String
|
|
Dim aNombreParametro2(18), aValorParametro2(18) As String
|
|
Dim aNombreParametro3(3), aValorParametro3(3) As String
|
|
|
|
|
|
Dim Element As Xml.XmlElement = Nothing
|
|
Dim nElement As Xml.XmlElement = Nothing
|
|
Dim aElement As Xml.XmlElement = Nothing
|
|
Dim rootElement As Xml.XmlElement = Nothing
|
|
Dim EsquemaEnv As Xml.XmlDocument = Nothing
|
|
Dim objPI As Xml.XmlProcessingInstruction
|
|
|
|
|
|
Dim puntaje As String = String.Empty
|
|
Dim strResultXML As String = String.Empty
|
|
Dim strFuenteDatos As String = String.Empty
|
|
Dim strSPSituActual As String = String.Empty
|
|
Dim strSPSituHistorica As String = String.Empty
|
|
Dim SumaCuotaCalcColones As Decimal
|
|
Dim SumaCuotaCalcDolares As Decimal
|
|
|
|
Dim bIsDummie As Boolean = False
|
|
|
|
|
|
|
|
Try
|
|
|
|
|
|
'Inicializa el objeto de response del metodo
|
|
resp = New ObtenerDatosCICBDResponse()
|
|
|
|
'Comienza a armar la trama de salida
|
|
EsquemaEnv = New Xml.XmlDocument
|
|
objPI = EsquemaEnv.CreateProcessingInstruction("xml", "version='1.0'")
|
|
EsquemaEnv.AppendChild(objPI)
|
|
rootElement = EsquemaEnv.CreateElement("Resultado")
|
|
EsquemaEnv.AppendChild(rootElement)
|
|
|
|
Dim strSP As String = ""
|
|
Dim strBD As String = ""
|
|
Dim aNombreParametroOut(2) As String
|
|
Dim aValorParametroOut(2) As String
|
|
|
|
aNombreParametroOut(1) = "@i_operacion" : aValorParametroOut(1) = "C"
|
|
aNombreParametroOut(2) = "@i_cedula" : aValorParametroOut(2) = req.identificacion
|
|
|
|
strSP = "sp_get_datos_ult"
|
|
strBD = "CONCIC"
|
|
|
|
bIsDummie = System.Configuration.ConfigurationManager.AppSettings("isDummie")
|
|
|
|
If (bIsDummie) Then
|
|
Dim xmlDoc As XmlDocument = New XmlDocument()
|
|
Dim sRutaDummie = System.Configuration.ConfigurationManager.AppSettings("rutaDummie").ToString()
|
|
xmlDoc.Load(sRutaDummie)
|
|
|
|
strResultXML = xmlDoc.OuterXml
|
|
|
|
Else
|
|
strResultXML = outConector.EjecutarComandoSQLArreglo(req.proceso.ToString(), strBD, strSP, aNombreParametroOut, aValorParametroOut, 0)
|
|
End If
|
|
|
|
|
|
If strResultXML.Trim() <> "" Then
|
|
Dim xmlResp As XmlDocument
|
|
Dim xmlError As XmlElement
|
|
Dim xmlSalario As XmlElement = Nothing
|
|
Dim xmlRubrosModelo As XmlElement = Nothing
|
|
Dim xmlListSActual As XmlNodeList
|
|
Dim xmlListSHistorica As XmlNodeList
|
|
Dim xmlActual As Xml.XmlDocument = Nothing
|
|
Dim xmlActualDeudas As XmlNodeList
|
|
Dim xmlHistorica As Xml.XmlDocument = Nothing
|
|
Dim xmlRefinanciar As Xml.XmlDocument = Nothing
|
|
|
|
xmlResp = New XmlDocument
|
|
xmlResp.LoadXml(strResultXML)
|
|
|
|
|
|
'Insicador de errores, si esta vacio no hubo error de lo contrario trae mensaje
|
|
If Not xmlResp.SelectSingleNode("//NewDataSet/Table") Is Nothing Then
|
|
xmlError = xmlResp.SelectSingleNode("//NewDataSet/Table")
|
|
|
|
If (xmlError.SelectSingleNode("Error").InnerText.Trim() <> "") Then
|
|
Dim ex As New Exception(xmlError.SelectSingleNode("Error").InnerText.Trim())
|
|
Throw ex
|
|
End If
|
|
End If
|
|
|
|
|
|
|
|
|
|
'Opcion 1: Procesamiento del CIC del Cliente
|
|
If (req.opcion = "1") Then
|
|
|
|
'Dataset de la Situacion Actual del CIC
|
|
If Not xmlResp.SelectSingleNode("//NewDataSet/Table3") Is Nothing Then
|
|
xmlListSActual = xmlResp.SelectNodes("//NewDataSet/Table3")
|
|
|
|
Dim xmlElementoActual As XmlElement
|
|
Dim strChildXMLActual As String = ""
|
|
Dim strChildXMLRefinanciar As String = ""
|
|
|
|
xmlActual = New Xml.XmlDocument
|
|
xmlRefinanciar = New Xml.XmlDocument
|
|
|
|
|
|
strChildXMLActual += "<SituacionActual>"
|
|
strChildXMLRefinanciar += "<DeudasRefinanciar>"
|
|
|
|
For Each xmlElementoActual In xmlListSActual
|
|
strChildXMLActual += xmlElementoActual.OuterXml()
|
|
'Agrega el registro al nodo de DeudasRefinanciar si se va a cancelar la deuda
|
|
|
|
If xmlElementoActual.SelectSingleNode("Cancela").InnerText.Trim() = "true" Then
|
|
strChildXMLRefinanciar += xmlElementoActual.OuterXml()
|
|
End If
|
|
Next
|
|
strChildXMLActual += "</SituacionActual>"
|
|
strChildXMLRefinanciar += "</DeudasRefinanciar>"
|
|
|
|
|
|
xmlActual.LoadXml(strChildXMLActual)
|
|
xmlRefinanciar.LoadXml(strChildXMLRefinanciar)
|
|
|
|
End If
|
|
|
|
'Dataset de la Situacion Historica del CIC
|
|
If Not xmlResp.SelectSingleNode("//NewDataSet/Table4") Is Nothing Then
|
|
xmlListSHistorica = xmlResp.SelectNodes("//NewDataSet/Table4")
|
|
|
|
Dim xmlElementoHistorica As XmlElement
|
|
Dim strChildXMLHistorica As String = ""
|
|
|
|
xmlHistorica = New Xml.XmlDocument
|
|
strChildXMLHistorica += "<SituacionHistorica>"
|
|
|
|
For Each xmlElementoHistorica In xmlListSHistorica
|
|
strChildXMLHistorica += xmlElementoHistorica.OuterXml()
|
|
Next
|
|
strChildXMLHistorica += "</SituacionHistorica>"
|
|
|
|
xmlHistorica.LoadXml(strChildXMLHistorica)
|
|
End If
|
|
|
|
|
|
'Obtiene los procedimientos/base de datos a ejecutarse
|
|
Select Case req.proceso.ToString()
|
|
Case Enumerador.ProcesoUltimus.PrestamoPrendario.ToString()
|
|
strFuenteDatos = Enumerador.FuenteDatosUltimus.BPMPRENDARIO.ToString()
|
|
strSPSituActual = "usp_cp_situacion_actual"
|
|
strSPSituHistorica = "usp_cp_situacion_historica"
|
|
|
|
End Select
|
|
|
|
'Se eliminan los registros de Situacion Actual para que no hayan duplicados
|
|
aNombreParametro3(1) = "@i_opcion" : aValorParametro3(1) = 7
|
|
aNombreParametro3(2) = "@i_solicitud" : aValorParametro3(2) = req.solicitud
|
|
aNombreParametro3(3) = "@i_idcliente" : aValorParametro3(3) = req.idcliente
|
|
|
|
|
|
|
|
outConector.EjecutarComandoSQLArreglo(req.proceso.ToString(), strFuenteDatos, strSPSituActual, aNombreParametro3, aValorParametro3, 0)
|
|
|
|
'Se eliminan los registros de Situacion Historica para que no hayan duplicados
|
|
aNombreParametro3(1) = "@i_opcion" : aValorParametro3(1) = 5
|
|
aNombreParametro3(2) = "@i_solicitud" : aValorParametro3(2) = req.solicitud
|
|
aNombreParametro3(3) = "@i_idcliente" : aValorParametro3(3) = req.idcliente
|
|
|
|
outConector.EjecutarComandoSQLArreglo(req.proceso.ToString(), strFuenteDatos, strSPSituHistorica, aNombreParametro3, aValorParametro3, 0)
|
|
|
|
'Arma la trama de salida de Situacion Actual
|
|
nElement = EsquemaEnv.CreateElement("Respuesta1")
|
|
rootElement.AppendChild(nElement)
|
|
|
|
'Se insertan los registros de Situacion Actual en la base de datos
|
|
Dim iControlCabeceraA As Integer = 0
|
|
For x As Integer = 0 To xmlActual.SelectSingleNode("//SituacionActual").ChildNodes.Count - 1
|
|
Dim xmlElementoSelected As XmlElement
|
|
xmlElementoSelected = xmlActual.SelectSingleNode("//SituacionActual").ChildNodes.Item(x)
|
|
|
|
Dim strEntidadA As String = xmlElementoSelected.SelectSingleNode("Entidad").InnerText.Trim()
|
|
Dim strIdOperacionA As String = xmlElementoSelected.SelectSingleNode("Id.Operacion").InnerText.Trim()
|
|
Dim strMonedaA As String = xmlElementoSelected.SelectSingleNode("Moneda").InnerText.Trim()
|
|
|
|
'ALR --Dependiendo de la moneda se suma la cuota Calculada
|
|
If strMonedaA = "CRC" Then
|
|
SumaCuotaCalcColones = SumaCuotaCalcColones + Convert.ToDecimal(xmlElementoSelected.SelectSingleNode("Cuota_calc").InnerText.Trim())
|
|
ElseIf strMonedaA = "USD" Then
|
|
SumaCuotaCalcDolares = SumaCuotaCalcDolares + Convert.ToDecimal(xmlElementoSelected.SelectSingleNode("Cuota_calc").InnerText.Trim())
|
|
Else
|
|
SumaCuotaCalcDolares = SumaCuotaCalcDolares + 0
|
|
End If
|
|
|
|
|
|
Dim strFechaVecimientoA As String = xmlElementoSelected.SelectSingleNode("Fecha_de_Vencimiento").InnerText.Trim()
|
|
Dim strSaldoA As String = xmlElementoSelected.SelectSingleNode("Saldo").InnerText.Trim()
|
|
Dim strMontoNoDesembolsadoA As String = xmlElementoSelected.SelectSingleNode("Monto_no_desembolsado_o_fiado_avalado").InnerText.Trim()
|
|
Dim strTipoOperacionA As String = xmlElementoSelected.SelectSingleNode("Tipo_de_Operacion").InnerText.Trim()
|
|
Dim strCondicionA As String = xmlElementoSelected.SelectSingleNode("Condicion").InnerText.Trim()
|
|
Dim strEstadoOperacionA As String = xmlElementoSelected.SelectSingleNode("Estado_de_la_Operacion").InnerText.Trim()
|
|
Dim strDiasAtrasoA As String = xmlElementoSelected.SelectSingleNode("Dias_de_Atraso").InnerText.Trim()
|
|
Dim strActualizadoA As String = xmlElementoSelected.SelectSingleNode("Actualizado").InnerText.Trim()
|
|
Dim strCuotaCalcA As String = xmlElementoSelected.SelectSingleNode("Cuota_calc").InnerText.Trim()
|
|
Dim strCancelaA As String = xmlElementoSelected.SelectSingleNode("Cancela").InnerText.Trim()
|
|
|
|
If strCancelaA = False Then
|
|
strCancelaA = 0
|
|
Else
|
|
strCancelaA = 1
|
|
End If
|
|
|
|
Dim strCuotaPrincipalA As String = xmlElementoSelected.SelectSingleNode("CuotaPrincipal").InnerText.Trim()
|
|
Dim strCuotaInteresesA As String = xmlElementoSelected.SelectSingleNode("CuotaIntereses").InnerText.Trim()
|
|
Dim strTasaNominalA As String = xmlElementoSelected.SelectSingleNode("TasaNominal").InnerText.Trim()
|
|
Dim strTipoTasaA As String = xmlElementoSelected.SelectSingleNode("TipoTasa").InnerText.Trim()
|
|
Dim strDTIEndeudamientoA As String = xmlElementoSelected.SelectSingleNode("DTI").InnerText.Trim() 'MiniEndeudamiento para la operación.
|
|
|
|
|
|
'Arma la trama de salida de Situacion Actual
|
|
|
|
'La primera vez ingresa a crear el nodo de la cabecera requerido siempre en la salida del XML
|
|
If (iControlCabeceraA = 0) Then
|
|
aElement = EsquemaEnv.CreateElement("Registro" & (x + 1))
|
|
nElement.AppendChild(aElement)
|
|
|
|
'Se encicla en la creacion de la cebecera
|
|
For y = 0 To xmlElementoSelected.ChildNodes.Count - 1
|
|
Element = EsquemaEnv.CreateElement("Valor" & (y + 1))
|
|
Element.InnerText = xmlElementoSelected.ChildNodes(y).Name
|
|
aElement.AppendChild(Element)
|
|
Next
|
|
iControlCabeceraA = 1
|
|
End If
|
|
|
|
'Se valida que el registro venga con datos sino se sale del ciclo
|
|
If strEntidadA = "" And strIdOperacionA = "" And strFechaVecimientoA = "" Then
|
|
Exit For
|
|
End If
|
|
|
|
'Realiza la creacion de los nodos que traen los registros con datos
|
|
aElement = EsquemaEnv.CreateElement("Registro" & (x + iControlCabeceraA + 1))
|
|
nElement.AppendChild(aElement)
|
|
For k = 0 To xmlElementoSelected.ChildNodes.Count - 1
|
|
Element = EsquemaEnv.CreateElement("Valor" & (k + 1))
|
|
|
|
'Formatea el campo 'ACTUALIZADO' para que se muestre dd/mm/yyyy
|
|
If xmlElementoSelected.ChildNodes(k).Name = "Actualizado" Then
|
|
Element.InnerText = "01/" & xmlElementoSelected.ChildNodes(k).InnerText.Replace("-", "/")
|
|
Else
|
|
Element.InnerText = xmlElementoSelected.ChildNodes(k).InnerText
|
|
End If
|
|
|
|
aElement.AppendChild(Element)
|
|
Next
|
|
|
|
|
|
'Validacion de campos
|
|
If strActualizadoA.Trim() <> "" Then
|
|
strActualizadoA = strActualizadoA.Replace("-", "/")
|
|
strActualizadoA = "01/" & strActualizadoA
|
|
End If
|
|
|
|
If strMonedaA.ToUpper() = "CRC" Then
|
|
strMonedaA = "N - COLONES O UNIDADES DE DESARROLLO"
|
|
ElseIf strMonedaA.ToUpper() = "USD" Then
|
|
strMonedaA = "E - DIVISA EXTRANJERA"
|
|
End If
|
|
|
|
If strCondicionA.ToUpper() = "DEUDOR" Then
|
|
strCondicionA = "DEUDOR"
|
|
ElseIf strCondicionA.ToUpper() = "CODEUDOR" Then
|
|
strCondicionA = "CO-DEUDOR"
|
|
ElseIf strCondicionA.ToUpper() = "FIADOR" Then
|
|
strCondicionA = "FIADOR/AVALISTA"
|
|
End If
|
|
|
|
'Llena la matriz de parametros para enviar a base de datos
|
|
aNombreParametro(1) = "@i_entidad_acreedora" : aValorParametro(1) = strEntidadA
|
|
aNombreParametro(2) = "@i_id_operacion" : aValorParametro(2) = strIdOperacionA
|
|
aNombreParametro(3) = "@i_moneda" : aValorParametro(3) = strMonedaA
|
|
aNombreParametro(4) = "@i_fecha_vencimiento" : aValorParametro(4) = Valida_Fecha(strFechaVecimientoA, 1, "FECHA VENCIMIENTO", "SITUACION ACTUAL", 0)
|
|
aNombreParametro(5) = "@i_saldo" : aValorParametro(5) = Valida_Numero(strSaldoA, "SALDO", "SITUACION ACTUAL")
|
|
aNombreParametro(6) = "@i_monto_nodes" : aValorParametro(6) = Valida_Numero(strMontoNoDesembolsadoA, "MONTO NO DESEMBOLSADO", "SITUACION ACTUAL")
|
|
aNombreParametro(7) = "@i_tipo_operacion" : aValorParametro(7) = EncuentraTipoOperacion(strTipoOperacionA)
|
|
aNombreParametro(8) = "@i_condicion" : aValorParametro(8) = strCondicionA
|
|
aNombreParametro(9) = "@i_estado_operacion" : aValorParametro(9) = EncuentraEstadoOperacion(strEstadoOperacionA)
|
|
aNombreParametro(10) = "@i_dias_atrasos" : aValorParametro(10) = strDiasAtrasoA
|
|
aNombreParametro(11) = "@i_fe_inicio" : aValorParametro(11) = Valida_Fecha(strActualizadoA, 1, "ACTUALIZADO AL", "SITUACION ACTUAL", 0)
|
|
aNombreParametro(12) = "@i_opcion" : aValorParametro(12) = "2"
|
|
aNombreParametro(13) = "@i_incidente" : aValorParametro(13) = req.incidente
|
|
aNombreParametro(14) = "@i_solicitud" : aValorParametro(14) = req.solicitud
|
|
aNombreParametro(15) = "@i_identificacion" : aValorParametro(15) = req.identificacion
|
|
aNombreParametro(16) = "@i_estado" : aValorParametro(16) = "C"
|
|
aNombreParametro(17) = "@i_esdeudor" : aValorParametro(17) = 1
|
|
aNombreParametro(18) = "@i_proceso" : aValorParametro(18) = req.proceso.ToString()
|
|
aNombreParametro(19) = "@i_cuotas_equivalente" : aValorParametro(19) = Valida_Numero(strCuotaCalcA, "CUOTA_CALC", "SITUACION ACTUAL")
|
|
aNombreParametro(20) = "@i_idcliente" : aValorParametro(20) = req.idcliente
|
|
|
|
aNombreParametro(21) = "@i_cancela" : aValorParametro(21) = Valida_Numero(strCancelaA, "CANCELA", "SITUACION ACTUAL")
|
|
aNombreParametro(22) = "@i_cuota_principal" : aValorParametro(22) = Valida_Numero(strCuotaPrincipalA, "CUOTA_PRINCIPAL", "SITUACION ACTUAL")
|
|
aNombreParametro(23) = "@i_cuota_intereses" : aValorParametro(23) = Valida_Numero(strCuotaInteresesA, "CUOTA_INTERESES", "SITUACION ACTUAL")
|
|
aNombreParametro(24) = "@i_tipo_tasa" : aValorParametro(24) = strTipoTasaA
|
|
aNombreParametro(25) = "@i_tasa_nominal" : aValorParametro(25) = Valida_Numero(strTasaNominalA, "TASA_NOMINAL", "SITUACION ACTUAL")
|
|
aNombreParametro(26) = "@i_dti_mini_endeudamiento" : aValorParametro(26) = Valida_Numero(strDTIEndeudamientoA, "DTI_MINIENDEUDAMIENTO", "SITUACION ACTUAL")
|
|
|
|
|
|
Dim strRespActual As String = outConector.EjecutarComandoSQLArreglo(req.proceso.ToString(), strFuenteDatos, strSPSituActual, aNombreParametro, aValorParametro, 0)
|
|
If (strRespActual <> "<NewDataSet />") Then
|
|
Dim xmlRespA As New XmlDocument
|
|
xmlRespA.LoadXml(strRespActual)
|
|
Dim excA As New Exception(xmlRespA.SelectSingleNode("//NewDataSet/Table/STATUS").InnerText)
|
|
Throw excA
|
|
End If
|
|
|
|
Next
|
|
|
|
'Arma la trama de salida de Situacion Historica
|
|
nElement = EsquemaEnv.CreateElement("Respuesta2")
|
|
rootElement.AppendChild(nElement)
|
|
|
|
'Se insertan los registros de Situacion Historica en la base de datos
|
|
Dim iControlCabeceraH As Integer = 0
|
|
For x As Integer = 0 To xmlHistorica.SelectSingleNode("//SituacionHistorica").ChildNodes.Count - 1
|
|
Dim xmlElementoSelected As XmlElement
|
|
xmlElementoSelected = xmlHistorica.SelectSingleNode("//SituacionHistorica").ChildNodes.Item(x)
|
|
|
|
Dim strEntidadH As String = xmlElementoSelected.SelectSingleNode("entidad").InnerText.Trim()
|
|
Dim strOperacionH As String = xmlElementoSelected.SelectSingleNode("operacion").InnerText.Trim()
|
|
Dim strFechaVecimientoH As String = xmlElementoSelected.SelectSingleNode("fechavencimiento").InnerText.Trim()
|
|
Dim strSituacionOperaH As String = xmlElementoSelected.SelectSingleNode("situacionopera").InnerText.Trim()
|
|
Dim strMotivoNoReporteH As String = xmlElementoSelected.SelectSingleNode("motivonoreporte").InnerText.Trim()
|
|
Dim strMesesReportadosH As String = xmlElementoSelected.SelectSingleNode("mesesreportados").InnerText.Trim()
|
|
Dim strUltimoPeriodoH As String = xmlElementoSelected.SelectSingleNode("ultimoperiodo").InnerText.Trim()
|
|
Dim strAtrasoMaximoH As String = xmlElementoSelected.SelectSingleNode("atrasomaximo").InnerText.Trim()
|
|
Dim strAtrasoMedioH As String = xmlElementoSelected.SelectSingleNode("atrasomedio").InnerText.Trim()
|
|
Dim strPuntajeH As String = xmlElementoSelected.SelectSingleNode("puntaje").InnerText.Trim()
|
|
Dim strPonderadoH As String = xmlElementoSelected.SelectSingleNode("ponderador").InnerText.Trim()
|
|
|
|
|
|
|
|
'Arma la trama de salida de Situacion Historica
|
|
|
|
'La primera vez ingresa a crear el nodo de la cabecera requerido siempre en la salida del XML
|
|
If (iControlCabeceraH = 0) Then
|
|
aElement = EsquemaEnv.CreateElement("Registro" & (x + 1))
|
|
nElement.AppendChild(aElement)
|
|
|
|
'Se encicla en la creacion de la cebecera
|
|
For y = 0 To xmlElementoSelected.ChildNodes.Count - 1
|
|
Element = EsquemaEnv.CreateElement("Valor" & (y + 1))
|
|
Element.InnerText = xmlElementoSelected.ChildNodes(y).Name
|
|
aElement.AppendChild(Element)
|
|
Next
|
|
iControlCabeceraH = 1
|
|
End If
|
|
|
|
'Se valida que el registro venga con datos
|
|
If strEntidadH = "" And strOperacionH = "" And strFechaVecimientoH = "" Then
|
|
Exit For
|
|
End If
|
|
|
|
'Realiza la creacion de los nodos que traen los registros con datos
|
|
aElement = EsquemaEnv.CreateElement("Registro" & (x + iControlCabeceraH + 1))
|
|
nElement.AppendChild(aElement)
|
|
For k = 0 To xmlElementoSelected.ChildNodes.Count - 1
|
|
Element = EsquemaEnv.CreateElement("Valor" & (k + 1))
|
|
Element.InnerText = xmlElementoSelected.ChildNodes(k).InnerText
|
|
aElement.AppendChild(Element)
|
|
Next
|
|
|
|
|
|
'Validacion de campos
|
|
If strUltimoPeriodoH.Trim() <> "" Then
|
|
strUltimoPeriodoH = strUltimoPeriodoH.Replace("-", "/")
|
|
strUltimoPeriodoH = "01/" & strUltimoPeriodoH
|
|
End If
|
|
|
|
If Integer.Parse(strPuntajeH.Split(",")(1)) <= 0 Then
|
|
puntaje = Integer.Parse(strPuntajeH.Split(",")(0))
|
|
Else
|
|
puntaje = strPuntajeH.Split(",")(0) & "." & strPuntajeH.Split(",")(1)
|
|
End If
|
|
|
|
'Llena la matriz de parametros para enviar a base de datos
|
|
aNombreParametro2(1) = "@i_opcion" : aValorParametro2(1) = 2
|
|
aNombreParametro2(2) = "@i_entidad_acreedora" : aValorParametro2(2) = strEntidadH
|
|
aNombreParametro2(3) = "@i_fecha_vencimiento" : aValorParametro2(3) = Valida_Fecha(strFechaVecimientoH, 1, "FECHA VENCIMIENTO", "SITUACION HISTORICA", 1)
|
|
aNombreParametro2(4) = "@i_estado_operacion" : aValorParametro2(4) = strSituacionOperaH
|
|
aNombreParametro2(5) = "@i_motivo_liquidacion" : aValorParametro2(5) = strMotivoNoReporteH
|
|
aNombreParametro2(6) = "@i_meses_reportados" : aValorParametro2(6) = strMesesReportadosH
|
|
aNombreParametro2(7) = "@i_periodo_reportado" : aValorParametro2(7) = Valida_Fecha(Formato_Fecha(strUltimoPeriodoH), 1, "ULTIMO PERIODO REPORTADO", "SITUACION HISTORICA", 0)
|
|
aNombreParametro2(8) = "@i_atraso_maximo" : aValorParametro2(8) = Valida_Numero(Quita_Formato_Numero("2", strAtrasoMaximoH), "ATRASO MAXIMO", "SITUACION HISTORICA")
|
|
aNombreParametro2(9) = "@i_atraso_medio" : aValorParametro2(9) = Valida_Numero(Quita_Formato_Numero("2", strAtrasoMedioH), "ATRASO MEDIO", "SITUACION HISTORICA")
|
|
aNombreParametro2(10) = "@i_ponderador" : aValorParametro2(10) = puntaje
|
|
aNombreParametro2(11) = "@i_incidente" : aValorParametro2(11) = req.incidente
|
|
aNombreParametro2(12) = "@i_solicitud" : aValorParametro2(12) = req.solicitud
|
|
aNombreParametro2(13) = "@i_identificacion" : aValorParametro2(13) = req.identificacion
|
|
aNombreParametro2(14) = "@i_id_operacion" : aValorParametro2(14) = strOperacionH
|
|
aNombreParametro2(15) = "@i_estado" : aValorParametro2(15) = "C"
|
|
aNombreParametro2(16) = "@i_esdeudor" : aValorParametro2(16) = 1
|
|
aNombreParametro2(17) = "@i_proceso" : aValorParametro2(17) = req.proceso.ToString()
|
|
aNombreParametro2(18) = "@i_idcliente" : aValorParametro2(18) = req.idcliente
|
|
|
|
Dim strRespHistorico As String = outConector.EjecutarComandoSQLArreglo(req.proceso.ToString(), strFuenteDatos, strSPSituHistorica, aNombreParametro2, aValorParametro2, 0)
|
|
|
|
If (strRespHistorico <> "<NewDataSet />") Then
|
|
Dim xmlRespH As New XmlDocument
|
|
xmlRespH.LoadXml(strRespHistorico)
|
|
Dim excH As New Exception(xmlRespH.SelectSingleNode("//NewDataSet/Table/STATUS").InnerText)
|
|
Throw excH
|
|
End If
|
|
Next
|
|
|
|
'Arma la trama de salida para las deudas a refinanciar
|
|
If xmlRefinanciar.SelectSingleNode("//DeudasRefinanciar").ChildNodes.Count > 0 Then
|
|
nElement = EsquemaEnv.CreateElement("Respuesta3")
|
|
rootElement.AppendChild(nElement)
|
|
nElement.InnerXml = xmlRefinanciar.SelectSingleNode("//DeudasRefinanciar").InnerXml
|
|
End If
|
|
|
|
''ALR-ProyectoAuditoria 07102017
|
|
'Dataset de los rubros de situacion Actual
|
|
|
|
|
|
'Arma la trama de salida para los rubros Sumas Principales
|
|
Dim SumaCuotaCalcTotalColones As Decimal = SumaCuotaCalcColones
|
|
Dim SumaCuotaCalcTotalDolares As Decimal = SumaCuotaCalcDolares
|
|
|
|
If SumaCuotaCalcColones = 0 And SumaCuotaCalcDolares = 0 Then
|
|
nElement = EsquemaEnv.CreateElement("Respuesta4")
|
|
rootElement.AppendChild(nElement)
|
|
aElement = EsquemaEnv.CreateElement("SumaCuotaCalcTotalColones")
|
|
aElement.InnerXml = 0
|
|
nElement.AppendChild(aElement)
|
|
aElement = EsquemaEnv.CreateElement("SumaCuotaCalcTotalDolares")
|
|
aElement.InnerXml = 0
|
|
nElement.AppendChild(aElement)
|
|
Else
|
|
nElement = EsquemaEnv.CreateElement("Respuesta4")
|
|
rootElement.AppendChild(nElement)
|
|
aElement = EsquemaEnv.CreateElement("SumaCuotaCalcTotalColones")
|
|
aElement.InnerXml = SumaCuotaCalcTotalColones
|
|
nElement.AppendChild(aElement)
|
|
aElement = EsquemaEnv.CreateElement("SumaCuotaCalcTotalDolares")
|
|
aElement.InnerXml = SumaCuotaCalcTotalDolares
|
|
nElement.AppendChild(aElement)
|
|
End If
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
End If
|
|
|
|
|
|
'Opcion 1: Procesamiento del Modelos Salarial
|
|
If (req.opcion = "2") Then
|
|
|
|
'Dataset del modelo de salario del cliente
|
|
If Not xmlResp.SelectSingleNode("//NewDataSet/Table1") Is Nothing Then
|
|
xmlSalario = xmlResp.SelectSingleNode("//NewDataSet/Table1")
|
|
End If
|
|
|
|
'Dataset de los rubros a partir de los que se obtuvo el modelo de salario del cliente
|
|
If Not xmlResp.SelectSingleNode("//NewDataSet/Table2") Is Nothing Then
|
|
xmlRubrosModelo = xmlResp.SelectSingleNode("//NewDataSet/Table2")
|
|
End If
|
|
|
|
'Arma la trama de salida para el modelo de salario
|
|
If xmlSalario.ChildNodes.Count > 0 Then
|
|
nElement = EsquemaEnv.CreateElement("Respuesta4")
|
|
rootElement.AppendChild(nElement)
|
|
|
|
nElement.InnerXml = xmlSalario.InnerXml
|
|
End If
|
|
|
|
'Arma la trama de salida para los rubros del modelo de salario
|
|
If xmlRubrosModelo.ChildNodes.Count > 0 Then
|
|
nElement = EsquemaEnv.CreateElement("Respuesta5")
|
|
rootElement.AppendChild(nElement)
|
|
nElement.InnerXml = xmlRubrosModelo.InnerXml
|
|
End If
|
|
|
|
End If
|
|
|
|
Else
|
|
Throw New Exception("No se pudo completar la integracion con el Sistema de Contingencia CIC.")
|
|
End If
|
|
|
|
resp.errCode = "00"
|
|
resp.errMessage = "OK"
|
|
resp.resultado = EsquemaEnv.InnerXml
|
|
|
|
Catch ex As Exception
|
|
Try
|
|
|
|
'objAudit.Credentials = System.Net.CredentialCache.DefaultCredentials
|
|
'objAudit.grabarLog(ProcessBD, "ServiciosGenerales", "Obtener_Datos_Excel", "E", mensaje)
|
|
|
|
resp.errCode = "99"
|
|
resp.errMessage = ex.Message
|
|
resp.resultado = "<Direccion><Resultado>" & ex.Message & "</Resultado></Direccion>"
|
|
|
|
Catch ex2 As Exception
|
|
'grabarError(ProcessBD, "ServiciosGenerales", "Obtener_Datos_Excel", "E", mensaje)
|
|
End Try
|
|
Finally
|
|
System.GC.Collect()
|
|
System.GC.Collect()
|
|
End Try
|
|
|
|
|
|
Return resp
|
|
|
|
|
|
End Function
|
|
|
|
|
|
|
|
''' <summary>
|
|
'''
|
|
''' </summary>
|
|
''' <param name="req"></param>
|
|
''' <returns></returns>
|
|
Public Shared Function ObtenerDatosSensibilizacion(req As ObtenerDatosSensibilizacionRequest) As ObtenerDatosSensibilizacionResponse
|
|
|
|
Dim valores As Hashtable = Nothing
|
|
Dim respuestaXml As String = String.Empty
|
|
Dim resp As ObtenerDatosSensibilizacionResponse = Nothing
|
|
|
|
Try
|
|
|
|
|
|
resp = New ObtenerDatosSensibilizacionResponse()
|
|
|
|
valores = UtilitarioSensibilizacionBL.ObtieneParametrosSensibilizacion(req.Proceso.ToString(), req.TipoTasaReferencia, req.Moneda)
|
|
|
|
If valores Is Nothing Then
|
|
Throw New Exception("No se encontraron parámetros de sensibilización.")
|
|
End If
|
|
|
|
If IsNothing(valores("Error")) Then
|
|
|
|
valores.Add("Proceso", req.Proceso.ToString())
|
|
valores.Add("Incidente", req.Incidente)
|
|
valores.Add("Solicitud", req.Solicitud)
|
|
valores.Add("Identificacion", req.Identificacion)
|
|
valores.Add("TipoCliente", req.TipoCliente)
|
|
valores.Add("SoloLectura", req.SoloLectura)
|
|
valores.Add("Moneda", req.Moneda)
|
|
valores.Add("IngNetoCol", Double.Parse(req.IngNetoCol).ToString())
|
|
valores.Add("IngNetoDol", Double.Parse(req.IngNetoDol).ToString())
|
|
valores.Add("TipoCambio", Double.Parse(req.TipoCambio).ToString())
|
|
valores.Add("TipoTasa", req.TipoTasaReferencia)
|
|
valores.Add("MontoPrestamo", Double.Parse(req.MontoPrestamo).ToString())
|
|
valores.Add("TasaPrestamo", req.TasaPrestamo)
|
|
valores.Add("PlazoPrestamo", req.PlazoPrestamo)
|
|
valores.Add("CuotaPrestamo", Double.Parse(req.CuotaPrestamo).ToString())
|
|
valores.Add("TotalCompromiso", Double.Parse(req.TotalCompromiso).ToString())
|
|
valores.Add("Seguro", req.Seguro)
|
|
|
|
|
|
|
|
UtilitarioSensibilizacionBL.CargarValoresSensibilizacion(valores,
|
|
req.Moneda,
|
|
req.IngNetoDol,
|
|
req.IngNetoCol,
|
|
req.TipoCambio,
|
|
req.Proceso.ToString(),
|
|
req.TasaPrestamo,
|
|
req.PlazoPrestamo,
|
|
req.MontoPrestamo,
|
|
req.Seguro,
|
|
req.TotalCompromiso,
|
|
req.CuotaPrestamo)
|
|
|
|
If (req.Mode = 1) Then
|
|
If req.SoloLectura = "0" Then
|
|
'********************************************************************
|
|
'Calcula los escenarios de sensibilizacion por operacion del cliente
|
|
'********************************************************************
|
|
UtilitarioSensibilizacionBL.CalculoSensibilizacionOperaciones(req.Incidente,
|
|
req.Solicitud,
|
|
req.Proceso.ToString(),
|
|
req.Identificacion,
|
|
req.IngNetoCol,
|
|
req.IngNetoDol,
|
|
req.TipoCambio,
|
|
req.CuotaPrestamo,
|
|
req.TasaPrestamo,
|
|
req.TipoTasa,
|
|
req.CoMoneda,
|
|
req.PlazoPrestamo,
|
|
req.MontoPrestamo,
|
|
req.Seguro,
|
|
req.IdCliente)
|
|
End If
|
|
|
|
'********************************************************************
|
|
'Consulta endeudamiento calculado por operacion del cliente y actualiza
|
|
'********************************************************************
|
|
UtilitarioSensibilizacionBL.CargaEndeudamientoDTICalculado(req.Incidente,
|
|
req.Solicitud,
|
|
req.Proceso.ToString(),
|
|
req.Identificacion,
|
|
req.IdCliente,
|
|
valores)
|
|
End If
|
|
|
|
If req.SoloLectura = "0" Then
|
|
UtilitarioSensibilizacionBL.GuardaCalculoSensibilizacion(req.Proceso.ToString(),
|
|
req.Incidente,
|
|
req.Solicitud,
|
|
req.Identificacion,
|
|
req.TipoCliente,
|
|
req.IdCliente,
|
|
valores)
|
|
End If
|
|
|
|
respuestaXml = UtilitarioSensibilizacionBL.ArmarRespuestaSensibilizacion(valores, req.Mode)
|
|
Else
|
|
Throw New Exception(valores("Error"))
|
|
End If
|
|
|
|
resp.errCode = "00"
|
|
resp.errMessage = "OK"
|
|
resp.resultado = respuestaXml
|
|
|
|
Catch ex As Exception
|
|
respuestaXml = "<Respuesta><Error>" + ex.Message + "</Error></Respuesta>"
|
|
|
|
resp.errCode = "99"
|
|
resp.errMessage = ex.Message
|
|
resp.resultado = respuestaXml
|
|
End Try
|
|
|
|
|
|
Return resp
|
|
End Function
|
|
|
|
|
|
|
|
Public Shared Function ObtenerCategoriaRiesgo(req As ObtenerCategoriaRiesgoRequest) As ObtenerCategoriaRiesgoResponse
|
|
|
|
Dim resp As ObtenerCategoriaRiesgoResponse = New ObtenerCategoriaRiesgoResponse()
|
|
|
|
Try
|
|
Dim arrParametrosNombres(3), arrParametrosValores(3) As String
|
|
arrParametrosNombres(0) = ""
|
|
arrParametrosValores(0) = ""
|
|
arrParametrosNombres(1) = "@morosidad"
|
|
arrParametrosValores(1) = req.Morosidad
|
|
arrParametrosNombres(2) = "@pagohistorico"
|
|
arrParametrosValores(2) = req.PagoHistorico
|
|
arrParametrosNombres(3) = "@capacidadpago"
|
|
arrParametrosValores(3) = req.CapacidadPago
|
|
|
|
Dim strXML As String = outConector.EjecutarComandoSQLArreglo(req.Proceso.ToString(), Enumerador.FuenteDatosUltimus.BPMPRENDARIO.ToString(), "usp_cp_obtener_categoriariezgo", arrParametrosNombres, arrParametrosValores, 0)
|
|
If (strXML <> "<NewDataSet />") Then
|
|
Dim xmlResp As New XmlDocument
|
|
xmlResp.LoadXml(strXML)
|
|
resp.resultado = xmlResp.SelectSingleNode("//NewDataSet/Table/categoria").InnerText
|
|
End If
|
|
|
|
resp.errCode = "00"
|
|
resp.errMessage = "OK"
|
|
|
|
Catch ex As Exception
|
|
resp.errCode = "99"
|
|
resp.errMessage = ex.Message
|
|
End Try
|
|
|
|
Return resp
|
|
End Function
|
|
|
|
|
|
Public Shared Function ObtenerDatosPersonaFisica(cedula As String) As DatosPersonaFisica
|
|
|
|
Dim resp As DatosPersonaFisica = New DatosPersonaFisica()
|
|
|
|
Try
|
|
Dim arrParametrosNombres(2), arrParametrosValores(2) As String
|
|
arrParametrosNombres(0) = ""
|
|
arrParametrosValores(0) = ""
|
|
arrParametrosNombres(1) = "@pcedula"
|
|
arrParametrosValores(1) = cedula
|
|
arrParametrosNombres(2) = "@ptipBusqueda"
|
|
arrParametrosValores(2) = "Fisica"
|
|
|
|
Dim strXML As String = outConector.EjecutarComandoSQLArreglo(Enumerador.ProcesoUltimus.PrestamoPrendario.ToString(), Enumerador.FuenteDatosINTNegocio.INTNEGOCIO.ToString(), "selCLI_Info_General", arrParametrosNombres, arrParametrosValores, 0)
|
|
If (strXML <> "<NewDataSet />") Then
|
|
Dim xmlResp As New XmlDocument
|
|
xmlResp.LoadXml(strXML)
|
|
Dim n As XmlNode = xmlResp.SelectSingleNode("//NewDataSet/Table")
|
|
|
|
Dim temp As String = n.SelectSingleNode("Nombre_Cliente").InnerText.Trim()
|
|
|
|
resp.Identificacion = n.SelectSingleNode("NumCedula_Cliente").InnerText
|
|
|
|
If (temp.IndexOf(" ") = -1) Then
|
|
resp.PrimerNombre = temp
|
|
resp.SegundoNombre = ""
|
|
Else
|
|
resp.PrimerNombre = temp.Substring(0, temp.IndexOf(" "))
|
|
resp.SegundoNombre = temp.Substring(temp.IndexOf(" ") + 1)
|
|
End If
|
|
|
|
If Not n.SelectSingleNode("Apellido1") Is Nothing Then
|
|
resp.PrimerApellido = n.SelectSingleNode("Apellido1").InnerText
|
|
End If
|
|
|
|
If Not n.SelectSingleNode("Apellido2") Is Nothing Then
|
|
resp.SegundoApellido = n.SelectSingleNode("Apellido2").InnerText
|
|
End If
|
|
|
|
If Not n.SelectSingleNode("LugarNacimiento_Cliente") Is Nothing Then
|
|
resp.LugarNacimiento = n.SelectSingleNode("LugarNacimiento_Cliente").InnerText
|
|
End If
|
|
|
|
If Not n.SelectSingleNode("FecNacimiento") Is Nothing Then
|
|
resp.FechaNacimiento = n.SelectSingleNode("FecNacimiento").InnerText
|
|
End If
|
|
|
|
If Not n.SelectSingleNode("FecExpCed") Is Nothing Then
|
|
resp.FechaExpiracionCedula = n.SelectSingleNode("FecExpCed").InnerText
|
|
End If
|
|
|
|
If Not n.SelectSingleNode("Edad_Cliente") Is Nothing Then
|
|
resp.Edad = n.SelectSingleNode("Edad_Cliente").InnerText
|
|
End If
|
|
|
|
If Not n.SelectSingleNode("Genero_Cliente") Is Nothing Then
|
|
resp.Genero = n.SelectSingleNode("Genero_Cliente").InnerText
|
|
End If
|
|
|
|
If Not n.SelectSingleNode("Nacionalidad_Cliente") Is Nothing Then
|
|
resp.Nacionalidad = n.SelectSingleNode("Nacionalidad_Cliente").InnerText
|
|
End If
|
|
|
|
If Not n.SelectSingleNode("EstadoVida_Cliente") Is Nothing Then
|
|
resp.EstadoVida = n.SelectSingleNode("EstadoVida_Cliente").InnerText
|
|
End If
|
|
|
|
If Not n.SelectSingleNode("Fecha_Defuncion") Is Nothing Then
|
|
resp.FechaDefuncion = n.SelectSingleNode("Fecha_Defuncion").InnerText
|
|
End If
|
|
|
|
If Not n.SelectSingleNode("Dependientes_Cliente") Is Nothing Then
|
|
resp.Dependientes = n.SelectSingleNode("Dependientes_Cliente").InnerText
|
|
End If
|
|
|
|
If Not n.SelectSingleNode("Hijos") Is Nothing Then
|
|
resp.Hijos = n.SelectSingleNode("Hijos").InnerText
|
|
End If
|
|
|
|
If Not n.SelectSingleNode("Ingresos_Estimados") Is Nothing Then
|
|
resp.IngresosEstimados = n.SelectSingleNode("Ingresos Estimados").InnerText
|
|
End If
|
|
|
|
If Not n.SelectSingleNode("Est_Civil") Is Nothing Then
|
|
resp.EstadoCivil = n.SelectSingleNode("Est_Civil").InnerText
|
|
End If
|
|
|
|
If Not n.SelectSingleNode("NumCedula_Conyugue") Is Nothing Then
|
|
resp.CedulaConyugue = n.SelectSingleNode("NumCedula_Conyugue").InnerText
|
|
End If
|
|
|
|
If Not n.SelectSingleNode("Nombre_Conyugue") Is Nothing Then
|
|
resp.NombreConyugue = n.SelectSingleNode("Nombre_Conyugue").InnerText
|
|
End If
|
|
|
|
If Not n.SelectSingleNode("Fec_Evento") Is Nothing Then
|
|
resp.FechaEvento = n.SelectSingleNode("Fec_Evento").InnerText
|
|
End If
|
|
|
|
If Not n.SelectSingleNode("Indicador_PEPS") Is Nothing Then
|
|
resp.IndicadorPEPS = n.SelectSingleNode("Indicador_PEPS").InnerText
|
|
End If
|
|
|
|
If Not n.SelectSingleNode("Descripcion_PEPS") Is Nothing Then
|
|
resp.DescripcionPEPS = n.SelectSingleNode("Descripcion_PEPS").InnerText
|
|
End If
|
|
|
|
If Not n.SelectSingleNode("Institucion_PEPS") Is Nothing Then
|
|
resp.InstitucionPEPS = n.SelectSingleNode("Institucion_PEPS").InnerText
|
|
End If
|
|
|
|
If Not n.SelectSingleNode("Periodo_PEPS") Is Nothing Then
|
|
resp.PeriodoPEPS = n.SelectSingleNode("Periodo_PEPS").InnerText
|
|
End If
|
|
|
|
If Not n.SelectSingleNode("GAM") Is Nothing Then
|
|
resp.GAM = n.SelectSingleNode("GAM").InnerText
|
|
End If
|
|
|
|
If Not n.SelectSingleNode("Provincia") Is Nothing Then
|
|
resp.Provincia = n.SelectSingleNode("Provincia").InnerText
|
|
End If
|
|
|
|
If Not n.SelectSingleNode("Ingreso_Promedio_Estimado_3M") Is Nothing Then
|
|
resp.IngresosEstimados3M = n.SelectSingleNode("Ingreso_Promedio_Estimado_3M").InnerText
|
|
End If
|
|
|
|
If Not n.SelectSingleNode("Ingreso_Promedio_Estimado_6M") Is Nothing Then
|
|
resp.IngresosEstimados6M = n.SelectSingleNode("Ingreso_Promedio_Estimado_6M").InnerText
|
|
End If
|
|
|
|
If Not n.SelectSingleNode("Ingreso_Promedio_Estimado_12M") Is Nothing Then
|
|
resp.IngresosEstimados12M = n.SelectSingleNode("Ingreso_Promedio_Estimado_12M").InnerText
|
|
End If
|
|
|
|
End If
|
|
|
|
Catch ex As Exception
|
|
Return Nothing
|
|
End Try
|
|
|
|
Return resp
|
|
End Function
|
|
|
|
Public Shared Function ObtenerDatosPersonaJuridica(cedula As String) As DatosPersonaJuridica
|
|
|
|
Dim resp As DatosPersonaJuridica = New DatosPersonaJuridica()
|
|
|
|
Try
|
|
Dim arrParametrosNombres(2), arrParametrosValores(3) As String
|
|
arrParametrosNombres(0) = ""
|
|
arrParametrosValores(0) = ""
|
|
arrParametrosNombres(1) = "@pcedula"
|
|
arrParametrosValores(1) = cedula
|
|
arrParametrosNombres(2) = "@ptipBusqueda"
|
|
arrParametrosValores(2) = "Juridica"
|
|
|
|
Dim strXML As String = outConector.EjecutarComandoSQLArreglo("", Enumerador.FuenteDatosINTNegocio.INTNEGOCIO.ToString(), "selCLI_Info_General", arrParametrosNombres, arrParametrosValores, 0)
|
|
If (strXML <> "<NewDataSet />") Then
|
|
Dim xmlResp As New XmlDocument
|
|
xmlResp.LoadXml(strXML)
|
|
|
|
Dim n As XmlNode = xmlResp.SelectSingleNode("//NewDataSet/Table")
|
|
resp.Identificacion = n.SelectSingleNode("IDENTIFICACION_EMPRESA").InnerText
|
|
resp.Nombre = n.SelectSingleNode("NOMBRE").InnerText
|
|
resp.Objeto = n.SelectSingleNode("OBJETO").InnerText
|
|
resp.PlazoSocial = n.SelectSingleNode("PLAZO_SOCIAL").InnerText
|
|
resp.Estado = n.SelectSingleNode("ESTADO").InnerText
|
|
resp.TipoSociedad = n.SelectSingleNode("TIPO_SOCIEDAD").InnerText
|
|
resp.ActividadEconomica = n.SelectSingleNode("ACTIVIDAD_ECONOMICA").InnerText
|
|
resp.ClaseAccion = n.SelectSingleNode("CLASE_ACCION").InnerText
|
|
resp.TipoCapital = n.SelectSingleNode("TIPO_CAPITAL").InnerText
|
|
resp.TipoMoneda = n.SelectSingleNode("TIPO_MONEDA").InnerText
|
|
resp.MontoAccion = n.SelectSingleNode("MONTO_ACCION").InnerText
|
|
resp.CantidadAcciones = n.SelectSingleNode("CANTIDAD_ACCIONES").InnerText
|
|
resp.Observaciones = n.SelectSingleNode("OBSERVACIONES").InnerText
|
|
resp.Direccion = n.SelectSingleNode("Direccion").InnerText
|
|
resp.PlazoSocialAnios = n.SelectSingleNode("Plazo_Social_anos").InnerText
|
|
resp.CapitalSocial = n.SelectSingleNode("Capital_Social").InnerText
|
|
resp.Acciones = n.SelectSingleNode("Acciones").InnerText
|
|
'resp.FechaNacimiento = n.SelectSingleNode("").InnerText
|
|
'resp.FechaInicioPlazoSocial = n.SelectSingleNode("").InnerText
|
|
'resp.FechaVencimiento = n.SelectSingleNode("").InnerText
|
|
'resp.FechaInscripcion = n.SelectSingleNode("").InnerText
|
|
|
|
End If
|
|
|
|
Catch ex As Exception
|
|
Return Nothing
|
|
End Try
|
|
|
|
Return resp
|
|
End Function
|
|
|
|
Public Shared Function ObtenerTelefonos(cedula As String) As List(Of Telefono)
|
|
|
|
Dim resp As List(Of Telefono) = New List(Of Telefono)()
|
|
|
|
Try
|
|
Dim arrParametrosNombres(2), arrParametrosValores(3) As String
|
|
arrParametrosNombres(0) = ""
|
|
arrParametrosValores(0) = ""
|
|
arrParametrosNombres(1) = "@pcedula"
|
|
arrParametrosValores(1) = cedula
|
|
arrParametrosNombres(2) = "@ptipBusqueda"
|
|
arrParametrosValores(2) = "Telefono"
|
|
|
|
Dim strXML As String = outConector.EjecutarComandoSQLArreglo("", Enumerador.FuenteDatosINTNegocio.INTNEGOCIO.ToString(), "selCLI_Contacto", arrParametrosNombres, arrParametrosValores, 0)
|
|
If (strXML <> "<NewDataSet />") Then
|
|
Dim xmlResp As New XmlDocument
|
|
xmlResp.LoadXml(strXML)
|
|
|
|
For Each temp As XmlNode In xmlResp.SelectSingleNode("//NewDataSet").ChildNodes
|
|
Dim t As Telefono = New Telefono()
|
|
t.numero = temp.SelectSingleNode("NumTelefono").InnerText.Replace("-", "")
|
|
t.tipo = temp.SelectSingleNode("tipo").InnerText
|
|
resp.Add(t)
|
|
Next
|
|
End If
|
|
|
|
Catch ex As Exception
|
|
Return Nothing
|
|
End Try
|
|
|
|
Return resp
|
|
End Function
|
|
|
|
Public Shared Function ObtenerDirecciones(cedula As String) As List(Of Direccion)
|
|
|
|
Dim resp As List(Of Direccion) = New List(Of Direccion)()
|
|
|
|
Try
|
|
Dim arrParametrosNombres(2), arrParametrosValores(3) As String
|
|
arrParametrosNombres(0) = ""
|
|
arrParametrosValores(0) = ""
|
|
arrParametrosNombres(1) = "@pcedula"
|
|
arrParametrosValores(1) = cedula
|
|
arrParametrosNombres(2) = "@ptipBusqueda"
|
|
arrParametrosValores(2) = "Ubicacion"
|
|
|
|
Dim strXML As String = outConector.EjecutarComandoSQLArreglo("", Enumerador.FuenteDatosINTNegocio.INTNEGOCIO.ToString(), "selCLI_Contacto", arrParametrosNombres, arrParametrosValores, 0)
|
|
If (strXML <> "<NewDataSet />") Then
|
|
Dim xmlResp As New XmlDocument
|
|
xmlResp.LoadXml(strXML)
|
|
|
|
For Each temp As XmlNode In xmlResp.SelectSingleNode("//NewDataSet").ChildNodes
|
|
Dim t As Direccion = New Direccion()
|
|
t.provincia = temp.SelectSingleNode("Provincia").InnerText
|
|
t.canton = temp.SelectSingleNode("Canton").InnerText
|
|
t.distrito = temp.SelectSingleNode("Distrito").InnerText
|
|
t.direccionSena = temp.SelectSingleNode("Direccion_Sena").InnerText
|
|
resp.Add(t)
|
|
Next
|
|
End If
|
|
|
|
Catch ex As Exception
|
|
Return Nothing
|
|
End Try
|
|
|
|
Return resp
|
|
End Function
|
|
|
|
|
|
|
|
Public Shared Function ObtenerNumeroBoleta(req As ObtenerNumeroBoletaRequest) As ObtenerNumeroBoletaResponse
|
|
|
|
Dim strFuenteDatos As String = String.Empty
|
|
Dim strProceso As String = String.Empty
|
|
Dim strSQL As String = String.Empty
|
|
Dim strRespXML As String = String.Empty
|
|
|
|
Dim xmlResp As XmlDocument
|
|
Dim xmlRoot As XmlElement
|
|
Dim numsolicitud As String
|
|
Dim arrParametrosNombres(2) As String
|
|
Dim arrParametrosValores(2) As String
|
|
|
|
Dim resp As ObtenerNumeroBoletaResponse = Nothing
|
|
|
|
|
|
Try
|
|
|
|
resp = New ObtenerNumeroBoletaResponse()
|
|
|
|
|
|
strProceso = req.Proceso.ToString()
|
|
strFuenteDatos = Enumerador.FuenteDatosUltimus.MAILNET.ToString()
|
|
strSQL = ConfigurationManager.AppSettings("BoletaMensajeria.SpConsultaNumeroBoleta")
|
|
|
|
arrParametrosNombres(1) = "@ususolicitud" : arrParametrosValores(1) = req.Usuario
|
|
arrParametrosNombres(2) = "@numobjeto" : arrParametrosValores(2) = req.NumObjeto
|
|
|
|
strRespXML = outConector.EjecutarComandoSQLArreglo(strProceso, strFuenteDatos, strSQL, arrParametrosNombres, arrParametrosValores, "0")
|
|
|
|
If (Not String.IsNullOrEmpty(strRespXML)) And strRespXML <> "<NewDataSet/>" Then
|
|
|
|
xmlResp = New XmlDocument
|
|
xmlResp.LoadXml(strRespXML)
|
|
xmlRoot = xmlResp.DocumentElement.SelectSingleNode("//NewDataSet/Table")
|
|
numsolicitud = xmlRoot.SelectSingleNode("numsolicitud").InnerText
|
|
|
|
resp.NumeroBoleta = Integer.Parse(numsolicitud)
|
|
Else
|
|
Throw New Exception("No fue posible obtener la respuesta de la consulta de base de datos")
|
|
End If
|
|
|
|
resp.errCode = "00"
|
|
resp.errMessage = "EXITOSO"
|
|
|
|
|
|
Catch ex As Exception
|
|
|
|
resp.errCode = "99"
|
|
resp.errMessage = ex.Message + "=> " + strProceso + "," + strFuenteDatos + "," + strSQL + "," + req.Usuario + "," + req.NumObjeto
|
|
|
|
Finally
|
|
xmlRoot = Nothing
|
|
xmlResp = Nothing
|
|
End Try
|
|
|
|
Return resp
|
|
|
|
End Function
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Public Shared Function ObtenerNivelCapacidadPagoDeudor(req As ObtenerNivelCapacidadPagoDeudorRequest) As ObtenerNivelCapacidadPagoDeudorResponse
|
|
|
|
Dim resp As ObtenerNivelCapacidadPagoDeudorResponse = Nothing
|
|
Dim aNombreParametro(4), aValorParametro(4) As String
|
|
Dim xmlResp As XmlDocument = Nothing
|
|
|
|
Dim strXML As String = String.Empty
|
|
Dim strError As String = String.Empty
|
|
Dim strResult As String = String.Empty
|
|
Dim strRespXML As String = String.Empty
|
|
|
|
Dim strFuenteDatos As String = String.Empty
|
|
Dim strSP As String = String.Empty
|
|
Dim _ingresoNeto As Double = 0
|
|
|
|
Try
|
|
|
|
resp = New ObtenerNivelCapacidadPagoDeudorResponse()
|
|
|
|
|
|
Select Case req.IdMoneda
|
|
Case 0 'Colones
|
|
_ingresoNeto = req.IngresoNetoColones + (req.IngresoNetoDolares * req.TasaCambio)
|
|
Case 1 'Dolares
|
|
_ingresoNeto = req.IngresoNetoDolares + (req.IngresoNetoColones / req.TasaCambio)
|
|
End Select
|
|
|
|
|
|
|
|
strFuenteDatos = Enumerador.FuenteDatosUltimus.BPMPRENDARIO.ToString()
|
|
strSP = "usp_cp_nivel_capacidad_pago"
|
|
|
|
'*************************************************************************
|
|
'Obtiene el porcentaje máximo de endeudamiento para el ingreso del deudor
|
|
'*************************************************************************
|
|
aNombreParametro(1) = "@i_opcion" : aValorParametro(1) = "1"
|
|
aNombreParametro(2) = "@i_porc_endeudamiento" : aValorParametro(2) = req.PorcEndeudamiento.ToString()
|
|
aNombreParametro(3) = "@i_ingreso_neto" : aValorParametro(3) = _ingresoNeto.ToString()
|
|
aNombreParametro(4) = "@i_proceso" : aValorParametro(4) = req.Proceso.ToString()
|
|
|
|
|
|
strXML = outConector.EjecutarComandoSQLArreglo(req.Proceso.ToString(), strFuenteDatos, strSP, aNombreParametro, aValorParametro, 0)
|
|
|
|
'*************************************************************************
|
|
'Valida que se haya recibido una respuesta correcta
|
|
'*************************************************************************
|
|
If strXML.Trim() = String.Empty Or strXML.Trim() = "<NewDataSet />" Then
|
|
Throw New Exception("No se obtuvo el nivel de capacidad de pago.")
|
|
End If
|
|
|
|
'*************************************************************************
|
|
'Obtiene los parámetros obtenidos
|
|
'*************************************************************************
|
|
xmlResp = New XmlDocument
|
|
xmlResp.LoadXml(strXML)
|
|
|
|
If Not IsNothing(xmlResp.SelectSingleNode("//NewDataSet/Table/ERROR")) Then
|
|
Throw New Exception(xmlResp.SelectSingleNode("//NewDataSet/Table/ERROR").InnerText)
|
|
End If
|
|
|
|
strResult = xmlResp.SelectSingleNode("//NewDataSet/Table").OuterXml
|
|
|
|
|
|
|
|
resp.Configuracion = strResult
|
|
If (Not IsNothing(xmlResp.SelectSingleNode("//NewDataSet/Table/IdCapacidadPago"))) Then
|
|
resp.NivelCapacidadPago = xmlResp.SelectSingleNode("//NewDataSet/Table/IdCapacidadPago").InnerText
|
|
End If
|
|
|
|
|
|
resp.errCode = "00"
|
|
resp.errMessage = "EXITOSO"
|
|
|
|
|
|
Catch excError As Exception
|
|
resp.errCode = "99"
|
|
resp.errMessage = excError.Message
|
|
|
|
End Try
|
|
|
|
Return resp
|
|
|
|
|
|
End Function
|
|
|
|
|
|
|
|
Public Shared Function ObtenerEstratoSocial(req As ObtenerEstratoSocialRequest) As ObtenerEstratoSocialResponse
|
|
|
|
Dim resp As ObtenerEstratoSocialResponse = Nothing
|
|
Dim aNombreParametro(1), aValorParametro(1) As String
|
|
Dim strFuenteDatos, strSP As String
|
|
Dim xmlResp As XmlDocument
|
|
Dim xmlRoot As XmlElement
|
|
|
|
Dim strXML As String = String.Empty
|
|
Dim strEstratoSocial As String = String.Empty
|
|
Dim dblSalarioBruto As Double = 0
|
|
|
|
Try
|
|
resp = New ObtenerEstratoSocialResponse()
|
|
strFuenteDatos = Enumerador.FuenteDatosUltimus.BPMPRENDARIO.ToString()
|
|
strSP = "usp_cp_obtener_estrato_social"
|
|
|
|
|
|
' Obtiene el salario bruto total
|
|
dblSalarioBruto = req.TotalIngresoBrutoDol + (req.TotalIngresoBrutoCol / req.TasaCambio)
|
|
|
|
aNombreParametro(1) = "@i_ingresoDolares" : aValorParametro(1) = dblSalarioBruto.ToString()
|
|
|
|
'Obtiene los valores de la BD
|
|
|
|
strXML = outConector.EjecutarComandoSQLArreglo(req.Proceso.ToString(), strFuenteDatos, strSP, aNombreParametro, aValorParametro, 0)
|
|
|
|
If strXML <> "<NewDataSet />" Then
|
|
xmlResp = New XmlDocument
|
|
xmlResp.LoadXml(strXML)
|
|
xmlRoot = xmlResp.DocumentElement.SelectSingleNode("//NewDataSet/Table")
|
|
strEstratoSocial = xmlRoot.SelectSingleNode("EstratoSocial").InnerText
|
|
End If
|
|
|
|
|
|
resp.EstratoSocial = strEstratoSocial
|
|
resp.errCode = "00"
|
|
resp.errMessage = "EXITOSO"
|
|
|
|
Catch excError As Exception
|
|
resp.errCode = "99"
|
|
resp.errMessage = excError.Message
|
|
End Try
|
|
|
|
Return resp
|
|
|
|
End Function
|
|
|
|
|
|
Public Shared Function ClasificaGeneradorMoneda(req As ClasificaGeneradorMonedaRequest) As ClasificaGeneradorMonedaResponse
|
|
|
|
|
|
Dim Tabla1 As String = String.Empty
|
|
Dim Tabla2 As String = String.Empty
|
|
Dim Tabla3 As String = String.Empty
|
|
|
|
|
|
Dim cant_oper_dolares_tar As Integer = 0
|
|
Dim subtot_pagos_dolares_tar As Decimal = 0
|
|
Dim subtot_pagos_colones_tar As Decimal = 0
|
|
|
|
Dim cant_oper_dolares_act As Integer = 0
|
|
Dim subtot_cuotas_dolares_act As Decimal = 0
|
|
Dim subtot_cuotas_colones_act As Decimal = 0
|
|
|
|
|
|
Dim Moneda As String = String.Empty
|
|
Dim PagoMinimo As String = String.Empty
|
|
Dim CuotaActual As String = String.Empty
|
|
|
|
Dim StrSQL As String = String.Empty
|
|
Dim strFuenteDatos As String = String.Empty
|
|
Dim categoriaGenerador As String = String.Empty
|
|
|
|
|
|
Dim ds As DataSet = Nothing
|
|
Dim fila As DataRow = Nothing
|
|
Dim tabla As DataTable = Nothing
|
|
Dim objXML As System.Xml.XmlDocument = Nothing
|
|
Dim resp As ClasificaGeneradorMonedaResponse = Nothing
|
|
|
|
Try
|
|
|
|
resp = New ClasificaGeneradorMonedaResponse()
|
|
objXML = New System.Xml.XmlDocument
|
|
|
|
Select Case req.Proceso
|
|
Case Enumerador.ProcesoUltimus.PrestamoPrendario
|
|
Tabla1 = "[Prendario].[PosicionActivos]"
|
|
Tabla2 = "[Prendario].[PosicionTarjetas]"
|
|
Tabla3 = "[Prendario].[SensibilizacionSolicitud]"
|
|
strFuenteDatos = Enumerador.FuenteDatosUltimus.BPMPRENDARIO.ToString()
|
|
|
|
Case Else
|
|
Throw New Exception("No se encuentra parametrizado el proceso " + req.Proceso.ToString() + " para completar la ejecución.")
|
|
End Select
|
|
|
|
|
|
|
|
|
|
If req.TotalIngresoNetoDolares.Length = 0 Or req.TotalIngresoNetoDolares = "" Then
|
|
req.TotalIngresoNetoDolares = 0
|
|
End If
|
|
|
|
If req.TotalIngresoNetoColones.Length = 0 Or req.TotalIngresoNetoColones = "" Then
|
|
req.TotalIngresoNetoColones = 0
|
|
End If
|
|
|
|
If req.TasaCambio.Length = 0 Or req.TasaCambio = "" Then
|
|
req.TasaCambio = 0
|
|
End If
|
|
|
|
|
|
If req.IdCliente = "" Then
|
|
req.IdCliente = 0
|
|
End If
|
|
|
|
If req.CuotaPrestamo Is Nothing Then
|
|
req.CuotaPrestamo = "0"
|
|
Else
|
|
If req.CuotaPrestamo.Trim().Length = 0 Then
|
|
req.CuotaPrestamo = "0"
|
|
End If
|
|
End If
|
|
|
|
|
|
|
|
|
|
|
|
'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
'Validación de información de las activos
|
|
'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
|
|
|
|
subtot_cuotas_dolares_act = 0
|
|
subtot_cuotas_colones_act = 0
|
|
cant_oper_dolares_act = 0
|
|
|
|
StrSQL = "Select Moneda, CuotaActual From " & Tabla1 & " Where IdSolicitud=" & req.IdSolicitud & " and IdCliente =" & req.IdCliente
|
|
ds = outConector.EjecutarComandoSQLXMLDataSet(req.Proceso.ToString(), strFuenteDatos, StrSQL)
|
|
|
|
'Recorriendo los activos del cliente
|
|
If (ds.Tables.Count > 0) Then
|
|
For Each tabla In ds.Tables
|
|
For Each fila In tabla.Rows
|
|
Moneda = fila.Item("Moneda")
|
|
CuotaActual = fila.Item("CuotaActual")
|
|
|
|
If CuotaActual.Length = 0 Or CuotaActual = "" Then
|
|
CuotaActual = 0
|
|
End If
|
|
|
|
Select Case Moneda.ToUpper()
|
|
Case "DOLARES"
|
|
cant_oper_dolares_act = cant_oper_dolares_act + 1
|
|
subtot_cuotas_dolares_act = subtot_cuotas_dolares_act + CDbl(CuotaActual)
|
|
Case "COLONES"
|
|
subtot_cuotas_colones_act = subtot_cuotas_colones_act + CDbl(CuotaActual)
|
|
End Select
|
|
Next
|
|
Next
|
|
End If
|
|
ds.Reset()
|
|
|
|
'*****************************************************************************************
|
|
'EO 30-11-2009 Ajuste para agregar cuota del trámite en el cálculo
|
|
'*****************************************************************************************
|
|
If (req.Proceso = Enumerador.ProcesoUltimus.PrestamoPrendario) Or
|
|
InStr(req.Proceso.ToString(), "PERSONAL") Then
|
|
|
|
If req.Moneda.ToUpper() = "COLONES" Then
|
|
subtot_cuotas_colones_act = subtot_cuotas_colones_act + CDbl(req.CuotaPrestamo)
|
|
Else
|
|
cant_oper_dolares_act = cant_oper_dolares_act + 1
|
|
subtot_cuotas_dolares_act = subtot_cuotas_dolares_act + CDbl(req.CuotaPrestamo)
|
|
End If
|
|
|
|
End If
|
|
|
|
'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
'Validación de información de las Tarjetas
|
|
'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
subtot_pagos_dolares_tar = 0
|
|
subtot_pagos_colones_tar = 0
|
|
cant_oper_dolares_tar = 0
|
|
|
|
StrSQL = "Select Moneda, PagoMinimo From " & Tabla2 & " Where IdSolicitud=" & req.IdSolicitud & " and IdCliente=" & req.IdCliente
|
|
ds = outConector.EjecutarComandoSQLXMLDataSet(req.Proceso.ToString(), strFuenteDatos, StrSQL)
|
|
|
|
'Recorriendo las Tarjetas del cliente
|
|
If (ds.Tables.Count > 0) Then
|
|
For Each tabla In ds.Tables
|
|
For Each fila In tabla.Rows
|
|
Moneda = fila.Item("Moneda")
|
|
PagoMinimo = fila.Item("PagoMinimo")
|
|
|
|
If PagoMinimo.Length = 0 Or PagoMinimo = "" Then
|
|
PagoMinimo = 0
|
|
End If
|
|
|
|
Select Case Moneda.ToUpper()
|
|
Case "DOLARES"
|
|
cant_oper_dolares_tar = cant_oper_dolares_tar + 1
|
|
subtot_pagos_dolares_tar = subtot_pagos_dolares_tar + CDbl(PagoMinimo)
|
|
Case "COLONES"
|
|
subtot_pagos_colones_tar = subtot_pagos_colones_tar + CDbl(PagoMinimo)
|
|
End Select
|
|
Next
|
|
Next
|
|
End If
|
|
ds.Reset()
|
|
|
|
'*****************************************************************************************
|
|
'EO 30-11-2009 Ajuste para agregar cuota del trámite en el cálculo
|
|
'*****************************************************************************************
|
|
If InStr(req.Proceso.ToString(), "TARJETA") Then
|
|
StrSQL = "select ss_esc1_cuota from " & Tabla3 & " where IdSolicitud =" & req.IdSolicitud & " and IdCliente =" & req.IdCliente
|
|
|
|
ds = outConector.EjecutarComandoSQLXMLDataSet(req.Proceso.ToString(), strFuenteDatos, StrSQL)
|
|
req.CuotaPrestamo = ds.Tables.Item(0).Rows(0).Item("ss_esc1_cuota")
|
|
If req.Moneda.ToUpper() = "COLONES" Then
|
|
subtot_pagos_colones_tar = subtot_pagos_colones_tar + CDbl(req.CuotaPrestamo)
|
|
Else
|
|
cant_oper_dolares_tar = cant_oper_dolares_tar + 1
|
|
subtot_pagos_dolares_tar = subtot_pagos_dolares_tar + CDbl(req.CuotaPrestamo)
|
|
End If
|
|
End If
|
|
|
|
|
|
'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
'Clasificar al cliente en:
|
|
' 1- No Aplica
|
|
' 2- Generador de Moneda Extranjera
|
|
' 3- No generador de Moneda Extranjera de Bajo Riesgo
|
|
' 4- No generador de Moneda Extranjera de Alto Riesgo
|
|
'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
|
|
Dim flagCondicionBase As Boolean = False
|
|
|
|
'Se Valida si aplica a primera clasificacion (1)
|
|
If cant_oper_dolares_act = 0 And cant_oper_dolares_tar = 0 Then
|
|
'No tiene ninguna operacion en dolares
|
|
categoriaGenerador = ConfigurationManager.AppSettings("categoria1")
|
|
Else
|
|
'Cumple con condición basica de tener al menos una operacion en dolares (activos o tarjetas)
|
|
flagCondicionBase = True
|
|
End If
|
|
|
|
'Se valida si aplica a la segunda categoría (2), sino aplico en la categoria anterior
|
|
Dim subtot_ing_tar_act As Double = 0
|
|
|
|
'Se suman los activos y tarjetas en dolares
|
|
subtot_ing_tar_act = subtot_pagos_dolares_tar + subtot_cuotas_dolares_act
|
|
|
|
If categoriaGenerador = "" And flagCondicionBase = True Then
|
|
If CDbl(req.TotalIngresoNetoDolares) >= subtot_ing_tar_act And CDbl(req.TotalIngresoNetoDolares) > 0 Then
|
|
categoriaGenerador = ConfigurationManager.AppSettings("categoria2")
|
|
End If
|
|
End If
|
|
|
|
'Se valida si aplica a la tercer categoría (3), sino aplico en la categoria anterior
|
|
Dim subtot_dol_tar_act_col As Decimal = 0
|
|
Dim tot_deudas_cat3 As Decimal = 0
|
|
|
|
If categoriaGenerador = "" And flagCondicionBase = True Then
|
|
'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
'Se consulta ingreso neto en dolares en el escenario 3 de sensibilizacion
|
|
'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
StrSQL = "Select ss_esc3_ingresosnetos, ss_esc3_tipocambio_esp From " & Tabla3 & " where IdSolicitud =" & req.IdSolicitud & " and IdCliente =" & req.IdCliente
|
|
ds = outConector.EjecutarComandoSQLXMLDataSet(req.Proceso.ToString(), strFuenteDatos, StrSQL)
|
|
|
|
If (ds.Tables.Count > 0) Then
|
|
If (ds.Tables.Item(0).Rows.Count > 0) Then
|
|
' Se calculan los equivalentes en dolares para las operaciones que son en colones
|
|
subtot_dol_tar_act_col = (subtot_cuotas_colones_act + subtot_pagos_colones_tar) * (1 / CDbl(ds.Tables.Item(0).Rows(0).Item("ss_esc3_tipocambio_esp")))
|
|
'Se suman todos los montos de todos los activos y tarjetas
|
|
tot_deudas_cat3 = subtot_dol_tar_act_col + subtot_ing_tar_act
|
|
|
|
'Recorriendo la sensibilizacion
|
|
Dim ing_neto_es3sensibiliza As String
|
|
|
|
ing_neto_es3sensibiliza = CDbl(req.TotalIngresoNetoDolares) + (CDbl(req.TotalIngresoNetoColones) / CDbl(ds.Tables.Item(0).Rows(0).Item("ss_esc3_tipocambio_esp")))
|
|
|
|
ds.Reset()
|
|
|
|
If ing_neto_es3sensibiliza >= tot_deudas_cat3 Then
|
|
categoriaGenerador = ConfigurationManager.AppSettings("categoria3")
|
|
End If
|
|
End If
|
|
End If
|
|
|
|
|
|
End If
|
|
|
|
'Se valida si aplica a la cuarta categoría (4), sino aplico en la categoria anterior
|
|
If categoriaGenerador = "" And flagCondicionBase = True Then
|
|
categoriaGenerador = ConfigurationManager.AppSettings("categoria4")
|
|
End If
|
|
|
|
|
|
resp.CategoriaGenerador = categoriaGenerador
|
|
resp.errCode = "00"
|
|
resp.errMessage = "EXITOSO"
|
|
|
|
Catch excError As Exception
|
|
resp.errCode = "99"
|
|
resp.errMessage = excError.Message
|
|
|
|
End Try
|
|
|
|
Return resp
|
|
|
|
End Function
|
|
|
|
|
|
|
|
Public Shared Function ClasificaGeneradorMonedaSugef(req As ClasificaGeneradorMonedaRequest) As ClasificaGeneradorMonedaResponse
|
|
|
|
Dim strSQL As String = String.Empty
|
|
Dim strXML As String = String.Empty
|
|
Dim NombreSP As String = String.Empty
|
|
Dim NombreFuenteDatos As String = String.Empty
|
|
|
|
Dim xmlResp As XmlDocument = Nothing
|
|
Dim xmlRoot As XmlNode = Nothing
|
|
|
|
Dim arrParametrosNombres(10),
|
|
arrParametrosValores(10) As String
|
|
|
|
Dim resp As ClasificaGeneradorMonedaResponse = Nothing
|
|
|
|
Try
|
|
|
|
resp = New ClasificaGeneradorMonedaResponse()
|
|
|
|
strSQL = "usp_wf_generador_moneda"
|
|
NombreFuenteDatos = "BPMDATA"
|
|
|
|
arrParametrosNombres(1) = "@i_opcion" : arrParametrosValores(1) = "1"
|
|
arrParametrosNombres(2) = "@i_incidente" : arrParametrosValores(2) = req.Incidente
|
|
arrParametrosNombres(3) = "@i_solicitud" : arrParametrosValores(3) = req.IdSolicitud
|
|
arrParametrosNombres(4) = "@i_proceso" : arrParametrosValores(4) = req.Proceso.ToString()
|
|
arrParametrosNombres(5) = "@i_identificacion" : arrParametrosValores(5) = req.Identificacion
|
|
arrParametrosNombres(6) = "@i_ingreso_brut_col" : arrParametrosValores(6) = req.TotalIngresoBrutoColones
|
|
arrParametrosNombres(7) = "@i_ingreso_brut_dol" : arrParametrosValores(7) = req.TotalIngresoBrutoDolares
|
|
arrParametrosNombres(8) = "@i_tipo_cambio" : arrParametrosValores(8) = req.TasaCambio
|
|
arrParametrosNombres(9) = "@i_fecha_solicitud" : arrParametrosValores(9) = req.FechaSolicitud
|
|
arrParametrosNombres(10) = "@i_idcliente" : arrParametrosValores(10) = req.IdCliente
|
|
|
|
strXML = outConector.EjecutarComandoSQLArreglo(req.Proceso.ToString(), NombreFuenteDatos, strSQL, arrParametrosNombres, arrParametrosValores, 0)
|
|
|
|
If (strXML = "<NewDataSet />") Then
|
|
Throw New Exception("No fue posible obtener el resultado del procedimiento de clasificación de generador de moneda extranjera")
|
|
End If
|
|
|
|
|
|
xmlResp = New XmlDocument()
|
|
xmlResp.LoadXml(strXML)
|
|
|
|
xmlRoot = xmlResp.SelectSingleNode("//NewDataSet/Table")
|
|
|
|
Dim RespCode = xmlRoot.SelectSingleNode("res_code").InnerText
|
|
|
|
If RespCode <> "0" Then
|
|
Dim RespMessage = xmlRoot.SelectSingleNode("res_message").InnerText
|
|
Dim RespErrProcedure = xmlRoot.SelectSingleNode("res_err_procedure").InnerText
|
|
Dim RespErrLine = xmlRoot.SelectSingleNode("res_err_line").InnerText
|
|
|
|
Throw New Exception(String.Format("Ha ocurrido un problema al intentar realizar el cálculo de clasificación de generador de moneda extranjera.\nCode:{0}\nMessage:{1}\nStored Procedure:{2}\nLine{3}", RespCode, RespMessage, RespErrProcedure, RespErrLine))
|
|
End If
|
|
|
|
Dim RespCodGenerador = xmlRoot.SelectSingleNode("res_cod_generador").InnerText
|
|
Dim RespDesGenerador = xmlRoot.SelectSingleNode("res_des_generador").InnerText
|
|
|
|
|
|
resp.CategoriaGenerador = RespDesGenerador
|
|
resp.errCode = "00"
|
|
resp.errMessage = "EXITOSO"
|
|
|
|
|
|
Catch excError As Exception
|
|
resp.errCode = "99"
|
|
resp.errMessage = excError.Message
|
|
End Try
|
|
|
|
Return resp
|
|
|
|
End Function
|
|
|
|
|
|
|
|
Public Shared Function ClasificaRiesgoCambiario(req As RiesgoCambiarioRequest) As RiesgoCambiarioResponse
|
|
|
|
|
|
Dim strSQL As String = String.Empty
|
|
Dim strXML As String = String.Empty
|
|
Dim NombreSP As String = String.Empty
|
|
Dim NombreFuenteDatos As String = String.Empty
|
|
|
|
Dim xmlResp As XmlDocument = Nothing
|
|
Dim xmlRoot As XmlNode = Nothing
|
|
|
|
Dim arrParametrosNombres(10),
|
|
arrParametrosValores(10) As String
|
|
|
|
Dim resp As RiesgoCambiarioResponse = Nothing
|
|
|
|
Try
|
|
|
|
resp = New RiesgoCambiarioResponse()
|
|
|
|
strSQL = "usp_wf_riesgocambiario_CSD"
|
|
NombreFuenteDatos = "BPMDATA"
|
|
|
|
arrParametrosNombres(1) = "@i_opcion" : arrParametrosValores(1) = "1"
|
|
arrParametrosNombres(2) = "@i_incidente" : arrParametrosValores(2) = req.Incidente
|
|
arrParametrosNombres(3) = "@i_solicitud" : arrParametrosValores(3) = req.IdSolicitud
|
|
arrParametrosNombres(4) = "@i_proceso" : arrParametrosValores(4) = req.Proceso.ToString()
|
|
arrParametrosNombres(5) = "@i_identificacion" : arrParametrosValores(5) = req.Identificacion
|
|
arrParametrosNombres(6) = "@i_ingreso_neto_col" : arrParametrosValores(6) = req.TotalIngresoNetoColones
|
|
arrParametrosNombres(7) = "@i_ingreso_neto_dol" : arrParametrosValores(7) = req.TotalIngresoNetoDolares
|
|
arrParametrosNombres(8) = "@i_tipo_cambio" : arrParametrosValores(8) = req.TasaCambio
|
|
arrParametrosNombres(9) = "@i_fecha_solicitud" : arrParametrosValores(9) = req.FechaSolicitud
|
|
arrParametrosNombres(10) = "@i_idcliente" : arrParametrosValores(10) = req.IdCliente
|
|
|
|
strXML = outConector.EjecutarComandoSQLArreglo(req.Proceso.ToString(), NombreFuenteDatos, strSQL, arrParametrosNombres, arrParametrosValores, 0)
|
|
|
|
If (strXML = "<NewDataSet />") Then
|
|
Throw New Exception("No fue posible obtener el resultado del procedimiento de clasificación de riesgo cambiario")
|
|
End If
|
|
|
|
|
|
xmlResp = New XmlDocument()
|
|
xmlResp.LoadXml(strXML)
|
|
|
|
xmlRoot = xmlResp.SelectSingleNode("//NewDataSet/Table")
|
|
|
|
Dim RespCode = xmlRoot.SelectSingleNode("res_code").InnerText
|
|
|
|
If RespCode <> "0" Then
|
|
Dim RespMessage = xmlRoot.SelectSingleNode("res_message").InnerText
|
|
Dim RespErrProcedure = xmlRoot.SelectSingleNode("res_err_procedure").InnerText
|
|
Dim RespErrLine = xmlRoot.SelectSingleNode("res_err_line").InnerText
|
|
|
|
Throw New Exception(String.Format("Ha ocurrido un problema al intentar realizar el cálculo de clasificación de riesgo cambiario.\nCode:{0}\nMessage:{1}\nStored Procedure:{2}\nLine{3}", RespCode, RespMessage, RespErrProcedure, RespErrLine))
|
|
End If
|
|
|
|
Dim RespCodRiesgoCambiario = xmlRoot.SelectSingleNode("res_cod_riesgo_cambiario").InnerText
|
|
Dim RespDesRiesgoCambiario = xmlRoot.SelectSingleNode("res_riesgo_cambiario").InnerText
|
|
|
|
|
|
resp.RiesgoCambiario = RespDesRiesgoCambiario
|
|
resp.errCode = "00"
|
|
resp.errMessage = "EXITOSO"
|
|
|
|
|
|
Catch excError As Exception
|
|
resp.errCode = "99"
|
|
resp.errMessage = excError.Message
|
|
End Try
|
|
|
|
Return resp
|
|
|
|
End Function
|
|
|
|
|
|
Public Shared Function ObtenerCSD(req As ObtenerCSDRequest) As ObtenerCSDResponse
|
|
|
|
|
|
Dim strSQL As String = String.Empty
|
|
Dim strXML As String = String.Empty
|
|
Dim NombreSP As String = String.Empty
|
|
Dim NombreFuenteDatos As String = String.Empty
|
|
|
|
Dim xmlResp As XmlDocument = Nothing
|
|
Dim xmlRoot As XmlNode = Nothing
|
|
|
|
Dim arrParametrosNombres(10),
|
|
arrParametrosValores(10) As String
|
|
|
|
Dim resp As ObtenerCSDResponse = Nothing
|
|
|
|
Try
|
|
|
|
resp = New ObtenerCSDResponse()
|
|
|
|
strSQL = "usp_wf_riesgocambiario_CSD"
|
|
NombreFuenteDatos = "BPMDATA"
|
|
|
|
arrParametrosNombres(1) = "@i_opcion" : arrParametrosValores(1) = "2"
|
|
arrParametrosNombres(2) = "@i_incidente" : arrParametrosValores(2) = req.Incidente
|
|
arrParametrosNombres(3) = "@i_solicitud" : arrParametrosValores(3) = req.IdSolicitud
|
|
arrParametrosNombres(4) = "@i_proceso" : arrParametrosValores(4) = req.Proceso.ToString()
|
|
arrParametrosNombres(5) = "@i_identificacion" : arrParametrosValores(5) = req.Identificacion
|
|
arrParametrosNombres(6) = "@i_ingreso_bruto_col" : arrParametrosValores(6) = req.TotalIngresoBrutoColones
|
|
arrParametrosNombres(7) = "@i_ingreso_bruto_dol" : arrParametrosValores(7) = req.TotalIngresoBrutoDolares
|
|
arrParametrosNombres(8) = "@i_tipo_cambio" : arrParametrosValores(8) = req.TasaCambio
|
|
arrParametrosNombres(9) = "@i_fecha_solicitud" : arrParametrosValores(9) = req.FechaSolicitud
|
|
arrParametrosNombres(10) = "@i_idcliente" : arrParametrosValores(10) = req.IdCliente
|
|
|
|
strXML = outConector.EjecutarComandoSQLArreglo(req.Proceso.ToString(), NombreFuenteDatos, strSQL, arrParametrosNombres, arrParametrosValores, 0)
|
|
|
|
If (strXML = "<NewDataSet />") Then
|
|
Throw New Exception("No fue posible obtener el resultado del procedimiento de clasificación de riesgo cambiario")
|
|
End If
|
|
|
|
|
|
xmlResp = New XmlDocument()
|
|
xmlResp.LoadXml(strXML)
|
|
|
|
xmlRoot = xmlResp.SelectSingleNode("//NewDataSet/Table")
|
|
|
|
Dim RespCode = xmlRoot.SelectSingleNode("res_code").InnerText
|
|
|
|
If RespCode <> "0" Then
|
|
Dim RespMessage = xmlRoot.SelectSingleNode("res_message").InnerText
|
|
Dim RespErrProcedure = xmlRoot.SelectSingleNode("res_err_procedure").InnerText
|
|
Dim RespErrLine = xmlRoot.SelectSingleNode("res_err_line").InnerText
|
|
|
|
Throw New Exception(String.Format("Ha ocurrido un problema al intentar realizar el cálculo de clasificación de riesgo cambiario.\nCode:{0}\nMessage:{1}\nStored Procedure:{2}\nLine{3}", RespCode, RespMessage, RespErrProcedure, RespErrLine))
|
|
End If
|
|
|
|
Dim RespCSD = xmlRoot.SelectSingleNode("CSD").InnerText
|
|
|
|
|
|
|
|
resp.CSD = RespCSD
|
|
resp.errCode = "00"
|
|
resp.errMessage = "EXITOSO"
|
|
|
|
|
|
Catch excError As Exception
|
|
resp.errCode = "99"
|
|
resp.errMessage = excError.Message
|
|
End Try
|
|
|
|
Return resp
|
|
|
|
End Function
|
|
|
|
|
|
|
|
Public Shared Function ObtenerSalarioNeto(req As ObtenerSalarioNetoRequest) As ObtenerSalarioNetoResponse
|
|
|
|
Dim aNombreParametro(0), aValorParametro(0) As String
|
|
Dim strFuenteDatos As String = String.Empty
|
|
Dim strSP As String = String.Empty
|
|
Dim xmlResp As XmlDocument = Nothing
|
|
Dim xmlRoot As XmlElement = Nothing
|
|
Dim strXML As String = String.Empty
|
|
|
|
Dim strValorIvmEfMater As Decimal = 0
|
|
Dim srtValorPopular As Decimal = 0
|
|
Dim strValorRenta As Decimal = 0
|
|
Dim strValorSalarioNetoCol As Decimal = 0
|
|
Dim strPrcSalarioNetoCol As Decimal = 0
|
|
Dim strValorSalarioNetoDol As Decimal = 0
|
|
Dim strPrcSalarioNetoDol As Decimal = 0
|
|
Dim strPrcRenta As Decimal = 0
|
|
Dim strSalarioBruto As Decimal = 0
|
|
|
|
|
|
Dim strIvmEfMater As String = String.Empty
|
|
Dim strPopular As String = String.Empty
|
|
Dim strTope1DesdeCol As String = String.Empty
|
|
Dim strTope1HastaCol As String = String.Empty
|
|
Dim strTope1Porcentaje As String = String.Empty
|
|
Dim strTope2DesdeCol As String = String.Empty
|
|
Dim strTope2HastaCol As String = String.Empty
|
|
Dim strTope2Porcentaje As String = String.Empty
|
|
Dim strTope3DesdeCol As String = String.Empty
|
|
Dim strTope3HastaCol As String = String.Empty
|
|
Dim strTope3Porcentaje As String = String.Empty
|
|
|
|
|
|
Dim strTope1DesdeDol As String = String.Empty
|
|
Dim strTope1HastaDol As String = String.Empty
|
|
Dim strTope2DesdeDol As String = String.Empty
|
|
Dim strTope2HastaDol As String = String.Empty
|
|
Dim strTope3DesdeDol As String = String.Empty
|
|
Dim strTope3HastaDol As String = String.Empty
|
|
|
|
Dim resp As ObtenerSalarioNetoResponse = Nothing
|
|
|
|
|
|
|
|
Try
|
|
|
|
resp = New ObtenerSalarioNetoResponse()
|
|
|
|
strFuenteDatos = Enumerador.FuenteDatosUltimus.BPMPRENDARIO.ToString()
|
|
strSP = "usp_cp_salario_neto"
|
|
|
|
'********************************************
|
|
'Obtiene los valores de la BD
|
|
'********************************************
|
|
strXML = outConector.EjecutarComandoSQLArreglo(req.Proceso.ToString(), strFuenteDatos, strSP, aNombreParametro, aValorParametro, 0)
|
|
|
|
xmlResp = New XmlDocument
|
|
xmlResp.LoadXml(strXML)
|
|
xmlRoot = xmlResp.DocumentElement.SelectSingleNode("//NewDataSet/Table")
|
|
|
|
strIvmEfMater = xmlRoot.SelectSingleNode("IvmEnferMaternidad").InnerText
|
|
strPopular = xmlRoot.SelectSingleNode("Popular").InnerText
|
|
strTope1DesdeCol = xmlRoot.SelectSingleNode("MontoTop1Desde").InnerText
|
|
strTope1HastaCol = xmlRoot.SelectSingleNode("MontoTop1Hasta").InnerText
|
|
strTope1Porcentaje = xmlRoot.SelectSingleNode("Top1Porcentaje").InnerText
|
|
strTope2DesdeCol = xmlRoot.SelectSingleNode("MontoTop2Desde").InnerText
|
|
strTope2HastaCol = xmlRoot.SelectSingleNode("MontoTop2Hasta").InnerText
|
|
strTope2Porcentaje = xmlRoot.SelectSingleNode("Top2Porcentaje").InnerText
|
|
strTope3DesdeCol = xmlRoot.SelectSingleNode("MontoTop3Desde").InnerText
|
|
strTope3HastaCol = xmlRoot.SelectSingleNode("MontoTop3Hasta").InnerText
|
|
strTope3Porcentaje = xmlRoot.SelectSingleNode("Top3Porcentaje").InnerText
|
|
|
|
If req.IdMoneda = 1 Then 'Dolares
|
|
strTope1DesdeDol = CDec(strTope1DesdeCol) / CDec(req.TasaCambio)
|
|
strTope1HastaDol = CDec(strTope1HastaCol) / CDec(req.TasaCambio)
|
|
strTope2DesdeDol = CDec(strTope2DesdeCol) / CDec(req.TasaCambio)
|
|
strTope2HastaDol = CDec(strTope2HastaCol) / CDec(req.TasaCambio)
|
|
strTope3DesdeDol = CDec(strTope3DesdeCol) / CDec(req.TasaCambio)
|
|
strTope3HastaDol = CDec(strTope3HastaCol) / CDec(req.TasaCambio)
|
|
End If
|
|
|
|
'Calcular el Ingreso Neto para el Ingreso Bruto en COLONES
|
|
If CDec(req.SalarioBrutoCol) > 0 Then
|
|
'Calculo del valor IVM, Maternidad, Enfermedad
|
|
strValorIvmEfMater = CDec(strIvmEfMater) / 100 * CDec(req.SalarioBrutoCol)
|
|
'Calculo del valor Popular
|
|
srtValorPopular = CDec(strPopular) / 100 * CDec(req.SalarioBrutoCol)
|
|
|
|
' Se evaluan las condiciones para la renta
|
|
If CDec(req.SalarioBrutoCol) <= strTope1HastaCol Then
|
|
strValorRenta = 0
|
|
ElseIf CDec(req.SalarioBrutoCol) >= CDec(strTope2DesdeCol) And CDec(req.SalarioBrutoCol) <= CDec(strTope2HastaCol) Then
|
|
strValorRenta = (CDec(req.SalarioBrutoCol) - CDec(strTope1HastaCol)) * (CDec(strTope2Porcentaje) / 100)
|
|
ElseIf CDec(req.SalarioBrutoCol) >= CDec(strTope3DesdeCol) Then
|
|
strValorRenta = ((CDec(strTope2HastaCol) - CDec(strTope1HastaCol)) * (CDec(strTope2Porcentaje) / 100)) + ((CDec(req.SalarioBrutoCol) - CDec(strTope2HastaCol)) * (CDec(strTope3Porcentaje) / 100))
|
|
End If
|
|
|
|
' Calcula el porcentaje de la renta
|
|
strPrcRenta = CDec(strValorRenta) / CDec(req.SalarioBrutoCol)
|
|
|
|
' Calcula el salario neto
|
|
strValorSalarioNetoCol = CDec(req.SalarioBrutoCol) - (CDec(strValorIvmEfMater) + CDec(srtValorPopular) + CDec(strValorRenta))
|
|
strPrcSalarioNetoCol = CDec(strValorSalarioNetoCol) / CDec(req.SalarioBrutoCol) * 100
|
|
Else
|
|
strValorSalarioNetoCol = "0"
|
|
strPrcSalarioNetoCol = "0"
|
|
End If
|
|
|
|
' Calcular el Ingreso Neto para el Ingreso Bruto en DOLARES
|
|
If CDec(req.SalarioBrutoDol) > 0 Then
|
|
' Calculo del valor IVM, Maternidad, Enfermedad
|
|
strValorIvmEfMater = CDec(strIvmEfMater) / 100 * CDec(req.SalarioBrutoDol)
|
|
' Calculo del valor Popular
|
|
srtValorPopular = CDec(strPopular) / 100 * CDec(req.SalarioBrutoDol)
|
|
|
|
' Se evaluan las condiciones para la renta
|
|
If CDec(req.SalarioBrutoDol) <= strTope1HastaDol Then
|
|
strValorRenta = 0
|
|
ElseIf CDec(req.SalarioBrutoDol) >= CDec(strTope2DesdeDol) And CDec(req.SalarioBrutoDol) <= CDec(strTope2HastaDol) Then
|
|
strValorRenta = (CDec(req.SalarioBrutoDol) - CDec(strTope1HastaDol)) * (CDec(strTope2Porcentaje) / 100)
|
|
ElseIf CDec(req.SalarioBrutoDol) >= CDec(strTope3DesdeDol) Then
|
|
strValorRenta = ((CDec(strTope2HastaDol) - CDec(strTope1HastaDol)) * (CDec(strTope2Porcentaje) / 100)) + ((CDec(req.SalarioBrutoDol) - CDec(strTope2HastaDol)) * (CDec(strTope3Porcentaje) / 100))
|
|
End If
|
|
|
|
' Calcula el porcentaje de la renta
|
|
strPrcRenta = CDec(strValorRenta) / CDec(req.SalarioBrutoDol)
|
|
|
|
' Calcula el salario neto
|
|
strValorSalarioNetoDol = CDec(req.SalarioBrutoDol) - (CDec(strValorIvmEfMater) + CDec(srtValorPopular) + CDec(strValorRenta))
|
|
strPrcSalarioNetoDol = CDec(strValorSalarioNetoDol) / CDec(req.SalarioBrutoDol) * 100
|
|
Else
|
|
strValorSalarioNetoDol = "0"
|
|
strPrcSalarioNetoDol = "0"
|
|
End If
|
|
|
|
|
|
resp.SalarioNetoColones = strValorSalarioNetoCol
|
|
resp.SalarioNetoDolares = strValorSalarioNetoDol
|
|
resp.PorcentajeSalarioNetoColones = strPrcSalarioNetoCol
|
|
resp.PorcentajeSalarioNetoDolares = strPrcSalarioNetoDol
|
|
|
|
resp.errCode = "00"
|
|
resp.errMessage = "EXITOSO"
|
|
|
|
Catch excError As Exception
|
|
|
|
resp.errCode = "99"
|
|
resp.errMessage = excError.Message
|
|
|
|
End Try
|
|
|
|
Return resp
|
|
|
|
End Function
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Public Shared reg_sactual As String = 0
|
|
Public Shared reg_shistorica As String = 0
|
|
Public Shared G_Valor_Meses_Rep As String = String.Empty
|
|
Public Shared G_Param_Meses_Rep As String = String.Empty
|
|
Public Shared G_Opera_Meses_Rep As String = String.Empty
|
|
Public Shared G_Valor_Dif_Fe_Rep As String = String.Empty
|
|
Public Shared G_Param_Dif_Fe_Rep As String = String.Empty
|
|
Public Shared G_Opera_Dif_Fe_Rep As String = String.Empty
|
|
|
|
|
|
Public Shared Function EvaluarCIC(req As EvaluarCICRequest) As EvaluarCICResponse
|
|
|
|
Dim resp As EvaluarCICResponse = Nothing
|
|
Dim strConexion As String = String.Empty
|
|
Dim strProceso As String = req.proceso.ToString()
|
|
Dim strXMLReturn As String
|
|
Dim objXML As New System.Xml.XmlDocument
|
|
|
|
|
|
Dim StrXml As String = String.Empty
|
|
Dim StrSQL As String = String.Empty
|
|
Dim ds As New DataSet
|
|
Dim tabla As DataTable
|
|
Dim fila As DataRow
|
|
Dim arrParametrosNombres(7) As String
|
|
Dim arrParametrosValores(7) As String
|
|
Dim i As Integer
|
|
Dim node, child As System.Xml.XmlNode
|
|
Dim campos, valores As String
|
|
Dim arr_valores() As String
|
|
Dim arr_campos() As String
|
|
Dim dias_atrasos, condicion As String
|
|
Dim estado_operacion, meses_reportados, ponderador, registro_tabla As String
|
|
Dim nu_seccion As String = String.Empty
|
|
Dim nu_regla As String = String.Empty
|
|
Dim cod_variable As String = String.Empty
|
|
Dim operador As String = String.Empty
|
|
Dim valor_eval As String = String.Empty
|
|
Dim tipo_valor As String = String.Empty
|
|
Dim CadenaNeg As String = String.Empty
|
|
Dim valor_comp As String = String.Empty
|
|
|
|
Dim dif_fe_repor_fe_sol As String
|
|
Dim flag As Boolean = True
|
|
Dim flag2 As Boolean = True
|
|
Dim flag3 As Boolean = True
|
|
Dim x As Integer
|
|
|
|
|
|
Try
|
|
|
|
resp = New EvaluarCICResponse()
|
|
|
|
Select Case req.proceso
|
|
Case Enumerador.ProcesoUltimus.PrestamoPrendario
|
|
strConexion = Enumerador.FuenteDatosUltimus.BPMPRENDARIO.ToString()
|
|
StrSQL = "usp_ep_politicas"
|
|
End Select
|
|
|
|
|
|
valida_registros(req.solicitud, req.incidente, req.identificacion, req.proceso.ToString(), req.idCliente)
|
|
arrParametrosNombres(1) = "@i_opcion" : arrParametrosValores(1) = "6"
|
|
arrParametrosNombres(2) = "@i_incidente" : arrParametrosValores(2) = req.incidente
|
|
arrParametrosNombres(3) = "@i_solicitud" : arrParametrosValores(3) = req.solicitud
|
|
arrParametrosNombres(4) = "@i_identificacion" : arrParametrosValores(4) = req.identificacion
|
|
arrParametrosNombres(5) = "@i_proceso" : arrParametrosValores(5) = strProceso
|
|
arrParametrosNombres(6) = "@i_seccion" : arrParametrosValores(6) = ""
|
|
arrParametrosNombres(7) = "@i_idcliente" : arrParametrosValores(7) = req.idCliente.ToString()
|
|
|
|
|
|
StrXml = outConector.EjecutarComandoSQLArreglo( _
|
|
strProceso, _
|
|
strConexion, _
|
|
StrSQL, _
|
|
arrParametrosNombres, _
|
|
arrParametrosValores, _
|
|
"0")
|
|
|
|
Dim notienecondificon As Boolean
|
|
If (StrXml <> "<NewDataSet />") Then
|
|
objXML.LoadXml(StrXml)
|
|
node = objXML.SelectSingleNode("//NewDataSet")
|
|
For i = 0 To node.ChildNodes.Count - 1
|
|
notienecondificon = False
|
|
child = node.ChildNodes(i)
|
|
dias_atrasos = valida_nodo(child, "sf_dias_atrasos")
|
|
condicion = IIf(valida_nodo(child, "sf_condicion") = "", "DEUDOR", valida_nodo(child, "sf_condicion"))
|
|
estado_operacion = valida_nodo(child, "sf_estado_operacion")
|
|
meses_reportados = valida_nodo(child, "sf_meses_reportados")
|
|
ponderador = valida_nodo(child, "sf_ponderador")
|
|
registro_tabla = valida_nodo(child, "sf_status_tabla")
|
|
reg_sactual = valida_nodo(child, "reg_sactual")
|
|
reg_shistorica = valida_nodo(child, "reg_shistorica")
|
|
dif_fe_repor_fe_sol = valida_nodo(child, "sf_periodo_reportado")
|
|
|
|
G_Valor_Meses_Rep = ""
|
|
G_Param_Meses_Rep = ""
|
|
G_Opera_Meses_Rep = ""
|
|
G_Valor_Dif_Fe_Rep = ""
|
|
G_Param_Dif_Fe_Rep = ""
|
|
G_Opera_Dif_Fe_Rep = ""
|
|
|
|
' Se envian los campos a evaluar
|
|
campos = "v_ci_sit_actual|v_ci_atraso_sa|v_ci_condicion|v_ci_sit_historica|v_ci_operacion_sh|"
|
|
campos += "v_ci_meses_reportados_sh|v_ci_puntaje_sh|v_ci_juicios|v_ci_malas_ref|v_ci_dif_fe_repor_fe_sol|"
|
|
campos += "v_ci_est_tabla|"
|
|
' Se envian los valores de los campos a evaluar
|
|
valores = reg_sactual & "|" & dias_atrasos & "|" & condicion & "|" & reg_shistorica & "|" & estado_operacion & "|"
|
|
valores += meses_reportados & "|" & ponderador & "|" & req.juicios & "|" & req.malas_ref & "|" & dif_fe_repor_fe_sol & "|"
|
|
valores += registro_tabla & "|"
|
|
|
|
If (req.modo = 1 And registro_tabla = "C") Then 'Evaluacion de CIC SECCION A
|
|
StrSQL = "Exec usp_ep_productos 2,'','',0,'',6,3" 'CIC A REFERENCIAS ACTUALES E HISTORICAS
|
|
ElseIf (req.modo = 1 And registro_tabla = "A") Then 'Evaluacion de CIC SECCION A
|
|
StrSQL = "Exec usp_ep_productos 2,'','',0,'',6,4" 'CIC A REFERENCIAS ACTUALES
|
|
ElseIf (req.modo = 1 And registro_tabla = "H") Then 'Evaluacion de CIC SECCION A
|
|
StrSQL = "Exec usp_ep_productos 2,'','',0,'',6,5" 'CIC A REFERENCIAS HISTORICAS
|
|
ElseIf (req.modo = 2 And registro_tabla = "C") Then 'Evaluacion de CIC COMPLETO
|
|
StrSQL = "Exec usp_ep_productos 2,'','',0,'',6,1" 'CIC COMPLETO REFERENCIAS ACTUALES E HISTORICAS"
|
|
ElseIf (req.modo = 2 And registro_tabla = "A") Then 'Evaluacion de CIC COMPLETO
|
|
StrSQL = "Exec usp_ep_productos 2,'','',0,'',6,2" 'CIC COMPLETO REFERENCIAS ACTUALES
|
|
ElseIf (req.modo = 2 And registro_tabla = "H") Then 'Evaluacion de CIC COMPLETO
|
|
StrSQL = "Exec usp_ep_productos 2,'','',0,'',6,6" 'CIC COMPLETO REFERENCIAS HISTORICAS
|
|
Else
|
|
'Exit For
|
|
notienecondificon = True
|
|
End If
|
|
If notienecondificon = False Then
|
|
arr_campos = Split(campos, "|")
|
|
arr_valores = Split(valores, "|")
|
|
ds = outConector.EjecutarComandoSQLXMLDataSet(strProceso, strConexion, StrSQL)
|
|
|
|
|
|
'Se inicia el ciclo para recorrer cada seccion
|
|
If (ds.Tables.Count > 0) Then
|
|
For Each tabla In ds.Tables
|
|
For Each fila In tabla.Rows
|
|
nu_seccion = fila.Item("re_codseccion")
|
|
nu_regla = fila.Item("re_regla")
|
|
cod_variable = fila.Item("re_codvariable")
|
|
operador = fila.Item("re_operador")
|
|
valor_eval = fila.Item("re_valor_eval")
|
|
tipo_valor = fila.Item("re_tipo_valor")
|
|
CadenaNeg = fila.Item("re_mensaje")
|
|
For x = 0 To UBound(arr_campos) - 1
|
|
If (Trim(arr_campos(x)) = cod_variable) Then
|
|
valor_comp = arr_valores(x)
|
|
Exit For
|
|
End If
|
|
Next
|
|
'******************************************************************************
|
|
'19-11-2008 EO: Ajuste para validar meses reportados y tiempo de ultimo reporte
|
|
'******************************************************************************
|
|
If cod_variable = "v_ci_meses_reportados_sh" Then
|
|
If G_Param_Dif_Fe_Rep <> "" Then
|
|
If flag3 = True Then
|
|
If Not (EvalCondiciones(valor_comp, operador, valor_eval, cod_variable, "") = True And EvalCondiciones(G_Valor_Dif_Fe_Rep, G_Opera_Dif_Fe_Rep, G_Param_Dif_Fe_Rep, cod_variable, "") = True) Then
|
|
flag2 = False
|
|
Else
|
|
flag2 = True
|
|
flag3 = False 'Flag que permite saber que ya se encontro una referencia que cumple
|
|
End If
|
|
End If
|
|
Else
|
|
G_Valor_Meses_Rep = valor_comp
|
|
G_Param_Meses_Rep = valor_eval
|
|
G_Opera_Meses_Rep = operador
|
|
End If
|
|
Else
|
|
If cod_variable = "v_ci_dif_fe_repor_fe_sol" Then
|
|
If G_Param_Meses_Rep <> "" Then
|
|
If flag3 = True Then
|
|
If Not (EvalCondiciones(valor_comp, operador, valor_eval, cod_variable, "") = True And EvalCondiciones(G_Valor_Meses_Rep, G_Opera_Meses_Rep, G_Param_Meses_Rep, cod_variable, "") = True) Then
|
|
flag2 = False
|
|
Else
|
|
flag2 = True
|
|
flag3 = False 'Flag que permite saber que ya se encontro una referencia que cumple
|
|
End If
|
|
End If
|
|
Else
|
|
G_Valor_Dif_Fe_Rep = valor_comp
|
|
G_Param_Dif_Fe_Rep = valor_eval
|
|
G_Opera_Dif_Fe_Rep = operador
|
|
End If
|
|
'******************************************************************************
|
|
Else
|
|
flag = EvalCondiciones(valor_comp, operador, valor_eval, cod_variable, "")
|
|
End If
|
|
End If
|
|
If (flag = False) Then
|
|
Exit For
|
|
End If
|
|
Next
|
|
If (flag = False) Then
|
|
Exit For
|
|
End If
|
|
Next
|
|
Else
|
|
flag = False
|
|
End If
|
|
End If
|
|
If (flag = False) Then
|
|
Exit For
|
|
End If
|
|
Next
|
|
Else
|
|
flag = False
|
|
End If
|
|
|
|
If (flag = True And flag2 = True) Then
|
|
strXMLReturn = 1 'Cliente con excelente CIC
|
|
Else
|
|
strXMLReturn = 0 'Cliente con mal CIC
|
|
End If
|
|
|
|
resp.errCode = "00"
|
|
resp.errMessage = "EXITOSO"
|
|
resp.resultadoCIC = strXMLReturn
|
|
|
|
Catch excError As Exception
|
|
resp.errCode = "99"
|
|
resp.errMessage = excError.Message
|
|
|
|
End Try
|
|
|
|
Return resp
|
|
|
|
End Function
|
|
|
|
|
|
Private Shared Function EvalCondiciones(ByVal valor_comp As String, _
|
|
ByVal operador As String, _
|
|
ByVal valor_eval As String, _
|
|
ByVal cod_variable As String, _
|
|
ByVal monto As String) As String
|
|
Dim flag As Boolean
|
|
Dim strError As String = String.Empty
|
|
Dim strRespXml As String
|
|
Dim dias_dif As Integer = 0
|
|
Try
|
|
If (cod_variable = "v_ci_condicion") _
|
|
Or (cod_variable = "v_condicion") _
|
|
Or (cod_variable = "v_ju_calidad") _
|
|
Or (cod_variable = "v_rc_calidad") Then
|
|
valor_comp = valor_comp.ToUpper
|
|
valor_eval = valor_eval.ToUpper
|
|
End If
|
|
|
|
'Evaluando la condicion segun el operador indicado
|
|
Select Case operador
|
|
Case "="
|
|
If valor_comp = valor_eval Then
|
|
flag = True
|
|
Else
|
|
flag = False
|
|
End If
|
|
Case ">"
|
|
If Decimal.Parse(valor_comp) > Decimal.Parse(valor_eval) Then
|
|
flag = True
|
|
Else
|
|
flag = False
|
|
End If
|
|
Case ">="
|
|
If Decimal.Parse(valor_comp) >= Decimal.Parse(valor_eval) Then
|
|
flag = True
|
|
Else
|
|
flag = False
|
|
End If
|
|
Case "<>"
|
|
If valor_comp <> valor_eval Then
|
|
flag = True
|
|
Else
|
|
flag = False
|
|
End If
|
|
Case "<"
|
|
If Decimal.Parse(valor_comp) < Decimal.Parse(valor_eval) Then
|
|
flag = True
|
|
Else
|
|
flag = False
|
|
End If
|
|
Case "<="
|
|
'Agregado por AES para evaluar el % en el caso de juicios
|
|
If (cod_variable = "v_ju_ing_bruto" Or cod_variable = "v_rc_ing_bruto") Then
|
|
If Decimal.Parse(monto) <= (Decimal.Parse(valor_eval) * valor_comp) Then
|
|
flag = True
|
|
Else
|
|
flag = False
|
|
End If
|
|
Else
|
|
If Decimal.Parse(valor_comp) <= Decimal.Parse(valor_eval) Then
|
|
flag = True
|
|
Else
|
|
flag = False
|
|
End If
|
|
End If
|
|
End Select
|
|
EvalCondiciones = flag
|
|
Catch excError As Exception
|
|
strError = excError.Message
|
|
Finally
|
|
If strError <> "" Then
|
|
strRespXml = "Error: " & strError
|
|
EvalCondiciones = strRespXml
|
|
Else
|
|
EvalCondiciones = flag
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
Private Shared Function valida_nodo(ByVal child As System.Xml.XmlNode, ByRef nodo As String)
|
|
Dim Resp As String = String.Empty
|
|
If Not (child.SelectSingleNode("" & nodo & "")) Is Nothing Then
|
|
Resp = child.SelectSingleNode("" & nodo & "").InnerXml
|
|
If (Resp.Length = 0) Then
|
|
Resp = "0"
|
|
End If
|
|
Else
|
|
Select Case nodo
|
|
Case "ej_fecha_anotacion_juicio"
|
|
Case "ref_fecha_registro"
|
|
Resp = ""
|
|
Case Else
|
|
Resp = 0
|
|
End Select
|
|
End If
|
|
Return Resp
|
|
End Function
|
|
|
|
Private Shared Function valida_registros(ByVal solicitud As Integer,
|
|
ByVal incidente As Integer,
|
|
ByVal identificacion As String,
|
|
ByVal Proceso As String,
|
|
ByVal idCliente As Integer) As String
|
|
|
|
Dim strConexion As String = String.Empty
|
|
Dim strProceso As String = Proceso
|
|
|
|
Dim objXML As New System.Xml.XmlDocument
|
|
|
|
|
|
Dim StrSQL As String = String.Empty
|
|
Dim ds As New DataSet
|
|
Dim fila_sa, fila_sh As DataRow
|
|
Dim status As String
|
|
|
|
|
|
Dim cont As Integer = 0
|
|
Dim registros_sactual, registros_shistorico As String
|
|
Dim excError As Exception
|
|
Dim strError As String = String.Empty
|
|
Dim strRespXml As String
|
|
'Variables Situacion Actual
|
|
Dim sa_llave, sa_identificacion, sa_esdeudor, sa_estado, sa_id_operacion, sa_moneda, sa_fecha_vencimiento, sa_tipo_operacion As String
|
|
Dim sa_condicion, sa_estado_operacion, sa_dias_atrasos, sa_entidad_acreedora, sa_saldo, sa_cuotas_equivalente As String
|
|
Dim sa_monto_original, sa_fe_inicio As String
|
|
'Variables Situacion Historica
|
|
Dim sh_llave, sh_identificacion, sh_esdeudor, sh_estado, sh_id_operacion, sh_fecha_vencimiento, sh_estado_operacion, sh_entidad_acreedora As String
|
|
Dim sh_motivo_liquidacion, sh_atraso_maximo, sh_atraso_medio, sh_categoria_operacion As String
|
|
Dim sh_periodo_reportado, sh_meses_reportados, sh_ponderador As String
|
|
Dim sh_flag_ultimo As Integer = 0
|
|
|
|
Select Case Proceso
|
|
Case Enumerador.ProcesoUltimus.PrestamoPrendario.ToString()
|
|
strConexion = Enumerador.FuenteDatosUltimus.BPMPRENDARIO.ToString()
|
|
StrSQL = "usp_ep_politicas_cic"
|
|
End Select
|
|
|
|
Try
|
|
EliminaExcepciones(solicitud, incidente, identificacion, 8, Proceso, idCliente)
|
|
StrSQL = "Exec " & StrSQL & " 1," & incidente & "," & solicitud.ToString() & ",'" & strProceso & "', '" & identificacion & "', '" & idCliente.ToString() & "'"
|
|
|
|
ds = outConector.EjecutarComandoSQLXMLDataSet(strProceso, strConexion, StrSQL)
|
|
registros_sactual = ds.Tables(0).Rows.Count
|
|
registros_shistorico = ds.Tables(1).Rows.Count
|
|
If (registros_sactual > 0 And registros_shistorico > 0) Then
|
|
For Each fila_sh In ds.Tables(1).Rows
|
|
cont = cont + 1
|
|
'Informacion de Situacion Historica
|
|
sh_llave = fila_sh.Item("sh_llave")
|
|
sh_identificacion = fila_sh.Item("sh_identificacion")
|
|
sh_esdeudor = fila_sh.Item("sh_esdeudor")
|
|
sh_estado = fila_sh.Item("sh_estado")
|
|
sh_id_operacion = fila_sh.Item("sh_id_operacion")
|
|
sh_fecha_vencimiento = fila_sh.Item("sh_fecha_vencimiento")
|
|
sh_estado_operacion = fila_sh.Item("sh_estado_operacion")
|
|
sh_entidad_acreedora = fila_sh.Item("sh_entidad_acreedora")
|
|
sh_motivo_liquidacion = fila_sh.Item("sh_motivo_liquidacion")
|
|
sh_atraso_maximo = fila_sh.Item("sh_atraso_maximo")
|
|
sh_atraso_medio = fila_sh.Item("sh_atraso_medio")
|
|
sh_categoria_operacion = fila_sh.Item("sh_categoria_operacion")
|
|
sh_periodo_reportado = fila_sh.Item("sh_periodo_reportado")
|
|
sh_meses_reportados = fila_sh.Item("sh_meses_reportados")
|
|
sh_ponderador = fila_sh.Item("sh_ponderador")
|
|
If sh_id_operacion.Trim() = "TC2733039914" Then
|
|
status = ""
|
|
End If
|
|
|
|
'Se valida si el registro solo aparece en situacion historica
|
|
If (sh_estado_operacion.Trim() = "1" Or sh_estado_operacion.Trim() = "2") Then
|
|
status = "H"
|
|
|
|
inserta_regfinal(2, sh_llave, incidente, solicitud, strProceso, sh_identificacion, sh_esdeudor, sh_estado, sh_id_operacion, "", _
|
|
sh_fecha_vencimiento, "", "", sh_estado_operacion, "", sh_entidad_acreedora, "", "", "", "", _
|
|
sh_motivo_liquidacion, sh_atraso_maximo, sh_atraso_medio, sh_categoria_operacion, sh_periodo_reportado, _
|
|
sh_meses_reportados, sh_ponderador, status, idCliente)
|
|
|
|
ElseIf (sh_estado_operacion.Trim() = "3") Then
|
|
For Each fila_sa In ds.Tables(0).Rows
|
|
'Informacion de Situacion Actual
|
|
sa_llave = fila_sa.Item("sa_llave")
|
|
sa_identificacion = fila_sa.Item("sa_identificacion")
|
|
sa_esdeudor = fila_sa.Item("sa_esdeudor")
|
|
sa_estado = fila_sa.Item("sa_estado")
|
|
sa_id_operacion = fila_sa.Item("sa_id_operacion")
|
|
sa_moneda = fila_sa.Item("sa_moneda")
|
|
sa_fecha_vencimiento = fila_sa.Item("sa_fecha_vencimiento")
|
|
sa_tipo_operacion = fila_sa.Item("sa_tipo_operacion")
|
|
sa_condicion = fila_sa.Item("sa_condicion")
|
|
sa_estado_operacion = fila_sa.Item("sa_estado_operacion")
|
|
sa_dias_atrasos = fila_sa.Item("sa_dias_atrasos")
|
|
sa_entidad_acreedora = fila_sa.Item("sa_entidad_acreedora")
|
|
sa_saldo = fila_sa.Item("sa_saldo")
|
|
sa_cuotas_equivalente = fila_sa.Item("sa_cuotas_equivalente")
|
|
sa_monto_original = fila_sa.Item("sa_monto_nodes")
|
|
sa_fe_inicio = fila_sa.Item("sa_fe_inicio")
|
|
|
|
If (sh_id_operacion.Trim() = sa_id_operacion.Trim() And sh_entidad_acreedora.Trim() = sa_entidad_acreedora.Trim() And sh_id_operacion.Trim().Length > 0 And sh_flag_ultimo = 0) Then
|
|
status = "C"
|
|
inserta_regfinal(2, sa_llave, incidente, solicitud, strProceso, sa_identificacion, sa_esdeudor, sa_estado, sa_id_operacion, _
|
|
sa_moneda, sa_fecha_vencimiento, sa_tipo_operacion, sa_condicion, sh_estado_operacion, _
|
|
sa_dias_atrasos, sa_entidad_acreedora, sa_saldo, sa_cuotas_equivalente, sa_monto_original, _
|
|
sa_fe_inicio, sh_motivo_liquidacion, sh_atraso_maximo, sh_atraso_medio, sh_categoria_operacion, _
|
|
sh_periodo_reportado, sh_meses_reportados, sh_ponderador, status, idCliente)
|
|
|
|
If cont = registros_shistorico Then
|
|
sh_flag_ultimo = 1
|
|
End If
|
|
If cont < registros_shistorico Then
|
|
Exit For
|
|
End If
|
|
|
|
'Se valida en el caso que algun id sea nulo. Se verifica con la fecha de vencimiento
|
|
ElseIf (sh_fecha_vencimiento.Trim() = sa_fecha_vencimiento.Trim() And sh_id_operacion = "" And sh_flag_ultimo = 0) Then
|
|
|
|
status = "C"
|
|
inserta_regfinal(2, sa_llave, incidente, solicitud, strProceso, sa_identificacion, sa_esdeudor, sa_estado, sa_id_operacion, _
|
|
sa_moneda, sa_fecha_vencimiento, sa_tipo_operacion, sa_condicion, sh_estado_operacion, _
|
|
sa_dias_atrasos, sa_entidad_acreedora, sa_saldo, sa_cuotas_equivalente, sa_monto_original, _
|
|
sa_fe_inicio, sh_motivo_liquidacion, sh_atraso_maximo, sh_atraso_medio, sh_categoria_operacion, _
|
|
sh_periodo_reportado, sh_meses_reportados, sh_ponderador, status, idCliente)
|
|
|
|
If cont = registros_shistorico Then
|
|
sh_flag_ultimo = 1
|
|
End If
|
|
If cont < registros_shistorico Then
|
|
Exit For
|
|
End If
|
|
End If
|
|
|
|
'Si condicion es fiador solo existe en situacion actual
|
|
If (sa_condicion.Trim() = "FIADOR/AVALISTA" And cont = registros_shistorico) Then
|
|
status = "A"
|
|
inserta_regfinal(2, sa_llave, incidente, solicitud, strProceso, sa_identificacion, sa_esdeudor, sa_estado, sa_id_operacion, sa_moneda, _
|
|
sa_fecha_vencimiento, sa_tipo_operacion, sa_condicion, "", sa_dias_atrasos, _
|
|
sa_entidad_acreedora, sa_saldo, sa_cuotas_equivalente, sa_monto_original, sa_fe_inicio, _
|
|
"", "", "", "", "", "", "", status, idCliente)
|
|
End If
|
|
|
|
Next
|
|
End If
|
|
Next
|
|
ElseIf (registros_sactual > 0 And registros_shistorico <= 0) Then
|
|
|
|
For Each fila_sa In ds.Tables(0).Rows
|
|
sa_llave = fila_sa.Item("sa_llave")
|
|
sa_identificacion = fila_sa.Item("sa_identificacion")
|
|
sa_esdeudor = fila_sa.Item("sa_esdeudor")
|
|
sa_estado = fila_sa.Item("sa_estado")
|
|
sa_id_operacion = fila_sa.Item("sa_id_operacion")
|
|
sa_moneda = fila_sa.Item("sa_moneda")
|
|
sa_fecha_vencimiento = fila_sa.Item("sa_fecha_vencimiento")
|
|
sa_tipo_operacion = fila_sa.Item("sa_tipo_operacion")
|
|
sa_condicion = fila_sa.Item("sa_condicion")
|
|
sa_estado_operacion = fila_sa.Item("sa_estado_operacion")
|
|
sa_dias_atrasos = fila_sa.Item("sa_dias_atrasos")
|
|
sa_entidad_acreedora = fila_sa.Item("sa_entidad_acreedora")
|
|
sa_saldo = fila_sa.Item("sa_saldo")
|
|
sa_cuotas_equivalente = fila_sa.Item("sa_cuotas_equivalente")
|
|
sa_monto_original = fila_sa.Item("sa_monto_nodes")
|
|
sa_fe_inicio = fila_sa.Item("sa_fe_inicio")
|
|
status = "A"
|
|
|
|
|
|
inserta_regfinal(2, sa_llave, incidente, solicitud, strProceso, sa_identificacion, sa_esdeudor, sa_estado, sa_id_operacion, sa_moneda, _
|
|
sa_fecha_vencimiento, sa_tipo_operacion, sa_condicion, "", sa_dias_atrasos, _
|
|
sa_entidad_acreedora, sa_saldo, sa_cuotas_equivalente, sa_monto_original, sa_fe_inicio, _
|
|
"", "", "", "", "", "", "", status, idCliente)
|
|
Next
|
|
Else
|
|
For Each fila_sh In ds.Tables(1).Rows
|
|
sh_llave = fila_sh.Item("sh_llave")
|
|
sh_identificacion = fila_sh.Item("sh_identificacion")
|
|
sh_esdeudor = fila_sh.Item("sh_esdeudor")
|
|
sh_estado = fila_sh.Item("sh_estado")
|
|
sh_id_operacion = fila_sh.Item("sh_id_operacion")
|
|
sh_fecha_vencimiento = fila_sh.Item("sh_fecha_vencimiento")
|
|
sh_estado_operacion = fila_sh.Item("sh_estado_operacion")
|
|
sh_entidad_acreedora = fila_sh.Item("sh_entidad_acreedora")
|
|
sh_motivo_liquidacion = fila_sh.Item("sh_motivo_liquidacion")
|
|
sh_atraso_maximo = fila_sh.Item("sh_atraso_maximo")
|
|
sh_atraso_medio = fila_sh.Item("sh_atraso_medio")
|
|
sh_categoria_operacion = fila_sh.Item("sh_categoria_operacion")
|
|
sh_periodo_reportado = fila_sh.Item("sh_periodo_reportado")
|
|
sh_meses_reportados = fila_sh.Item("sh_meses_reportados")
|
|
sh_ponderador = fila_sh.Item("sh_ponderador")
|
|
|
|
status = "H"
|
|
|
|
inserta_regfinal(2, sh_llave, incidente, solicitud, strProceso, sh_identificacion, sh_esdeudor, sh_estado, sh_id_operacion, "", _
|
|
sh_fecha_vencimiento, "", "", sh_estado_operacion, "", sh_entidad_acreedora, "", "", "", "", _
|
|
sh_motivo_liquidacion, sh_atraso_maximo, sh_atraso_medio, sh_categoria_operacion, sh_periodo_reportado, _
|
|
sh_meses_reportados, sh_ponderador, status, idCliente)
|
|
Next
|
|
End If
|
|
strError = ""
|
|
Catch excError
|
|
Try
|
|
strError = excError.Message
|
|
Catch ex As Exception
|
|
End Try
|
|
Finally
|
|
If strError <> "" Then
|
|
strRespXml = "Error: " & strError
|
|
valida_registros = strRespXml
|
|
Else
|
|
valida_registros = strError
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
Private Shared Sub EliminaExcepciones(ByVal solicitud As String, _
|
|
ByVal incidente As String, _
|
|
ByVal identificacion As String, _
|
|
ByVal modo As String, _
|
|
ByVal Proceso As String,
|
|
ByVal idCliente As Integer)
|
|
|
|
Dim strConexion As String = String.Empty
|
|
Dim strProceso As String = Proceso
|
|
Dim strSQL As String = String.Empty
|
|
Dim ds As New DataSet
|
|
Dim strXML As String = ""
|
|
Dim arrParametrosNombres(7) As String
|
|
Dim arrParametrosValores(7) As String
|
|
Dim seccion As Integer = 0
|
|
Dim RespPolitica As String = ""
|
|
|
|
|
|
Dim strError As String
|
|
Dim excError As Exception
|
|
|
|
Select Case Proceso
|
|
Case Enumerador.ProcesoUltimus.PrestamoPrendario.ToString()
|
|
strConexion = Enumerador.FuenteDatosUltimus.BPMPRENDARIO.ToString()
|
|
strSQL = "usp_ep_politicas"
|
|
End Select
|
|
|
|
Try
|
|
''MODO 7-ELIMINA REGISTROS EN LA TABLA DE EXCEPCIONES
|
|
''MODO 8-ELIMINA REGISTROS EN LA TABLA DE SITUACION FINAL
|
|
''MODO 10-ELIMINA REGISTROS EN LA TABLA REGLAS NO CUMPLIDAS
|
|
''MODO 11-ELIMINA REGISTROS EN LA TABLA RESULTADO_CIC
|
|
arrParametrosNombres(1) = "@i_opcion" : arrParametrosValores(1) = modo '"7
|
|
arrParametrosNombres(2) = "@i_incidente" : arrParametrosValores(2) = incidente
|
|
arrParametrosNombres(3) = "@i_solicitud" : arrParametrosValores(3) = solicitud
|
|
arrParametrosNombres(4) = "@i_identificacion" : arrParametrosValores(4) = identificacion
|
|
arrParametrosNombres(5) = "@i_proceso" : arrParametrosValores(5) = strProceso
|
|
arrParametrosNombres(6) = "@i_seccion" : arrParametrosValores(6) = ""
|
|
arrParametrosNombres(7) = "@i_idcliente" : arrParametrosValores(7) = idCliente.ToString()
|
|
|
|
|
|
strXML = outConector.EjecutarComandoSQLArreglo( _
|
|
strProceso, _
|
|
strConexion, _
|
|
strSQL, _
|
|
arrParametrosNombres, _
|
|
arrParametrosValores, _
|
|
"0")
|
|
|
|
Catch excError
|
|
strError = excError.Message
|
|
Finally
|
|
|
|
End Try
|
|
|
|
End Sub
|
|
|
|
Private Shared Sub inserta_regfinal(ByVal opcion As String, _
|
|
ByVal llave As String, _
|
|
ByVal incidente As String, _
|
|
ByVal solicitud As String, _
|
|
ByVal proceso As String, _
|
|
ByVal identificacion As String, _
|
|
ByVal esdeudor As String, _
|
|
ByVal estado As String, _
|
|
ByVal id_operacion As String, _
|
|
ByVal moneda As String, _
|
|
ByVal fecha_vencimiento As String, _
|
|
ByVal tipo_operacion As String, _
|
|
ByVal condicion As String, _
|
|
ByVal estado_operacion As String, _
|
|
ByVal dias_atrasos As String, _
|
|
ByVal entidad_acreedora As String, _
|
|
ByVal saldo As String, _
|
|
ByVal cuotas_equivalente As String, _
|
|
ByVal monto_original As String, _
|
|
ByVal fe_inicio As String, _
|
|
ByVal motivo_liquidacion As String, _
|
|
ByVal atraso_maximo As String, _
|
|
ByVal atraso_medio As String, _
|
|
ByVal categoria_operacion As String, _
|
|
ByVal periodo_reportado As String, _
|
|
ByVal meses_reportados As String, _
|
|
ByVal ponderador As String, _
|
|
ByVal status_tabla As String,
|
|
ByVal idCliente As Integer)
|
|
|
|
Dim strConexion As String = String.Empty
|
|
Dim strProceso As String = proceso
|
|
|
|
Dim objXML As New System.Xml.XmlDocument
|
|
|
|
Dim StrXml As String = String.Empty
|
|
Dim StrSQL As String = String.Empty
|
|
Dim arrParametrosNombres(29) As String
|
|
Dim arrParametrosValores(29) As String
|
|
|
|
Select Case proceso
|
|
Case Enumerador.ProcesoUltimus.PrestamoPrendario.ToString()
|
|
strConexion = Enumerador.FuenteDatosUltimus.BPMPRENDARIO.ToString()
|
|
StrSQL = "usp_ep_politicas_cic"
|
|
End Select
|
|
|
|
Try
|
|
If esdeudor = "" Then
|
|
esdeudor = ""
|
|
Else
|
|
esdeudor = IIf(esdeudor = True, 1, 0)
|
|
End If
|
|
|
|
'GRABA LAS SITUACIONES EN LA TABLA FINAL
|
|
arrParametrosNombres(1) = "@i_opcion" : arrParametrosValores(1) = opcion
|
|
arrParametrosNombres(2) = "@i_incidente" : arrParametrosValores(2) = incidente
|
|
arrParametrosNombres(3) = "@i_solicitud" : arrParametrosValores(3) = solicitud
|
|
arrParametrosNombres(4) = "@i_proceso" : arrParametrosValores(4) = proceso
|
|
arrParametrosNombres(5) = "@i_identificacion" : arrParametrosValores(5) = identificacion
|
|
arrParametrosNombres(6) = "@i_esdeudor" : arrParametrosValores(6) = esdeudor
|
|
arrParametrosNombres(7) = "@i_estado" : arrParametrosValores(7) = estado
|
|
arrParametrosNombres(8) = "@i_id_operacion" : arrParametrosValores(8) = id_operacion
|
|
arrParametrosNombres(9) = "@i_moneda" : arrParametrosValores(9) = moneda
|
|
arrParametrosNombres(10) = "@i_fecha_vencimiento" : arrParametrosValores(10) = fecha_vencimiento
|
|
arrParametrosNombres(11) = "@i_tipo_operacion" : arrParametrosValores(11) = tipo_operacion
|
|
arrParametrosNombres(12) = "@i_condicion" : arrParametrosValores(12) = condicion
|
|
arrParametrosNombres(13) = "@i_estado_operacion" : arrParametrosValores(13) = estado_operacion
|
|
arrParametrosNombres(14) = "@i_dias_atrasos" : arrParametrosValores(14) = dias_atrasos
|
|
arrParametrosNombres(15) = "@i_entidad_acreedora" : arrParametrosValores(15) = entidad_acreedora
|
|
arrParametrosNombres(16) = "@i_saldo" : arrParametrosValores(16) = saldo
|
|
arrParametrosNombres(17) = "@i_cuotas_equivalente" : arrParametrosValores(17) = cuotas_equivalente
|
|
arrParametrosNombres(18) = "@i_monto_original" : arrParametrosValores(18) = monto_original
|
|
arrParametrosNombres(19) = "@i_fe_inicio" : arrParametrosValores(19) = fe_inicio
|
|
arrParametrosNombres(20) = "@i_motivo_liquidacion" : arrParametrosValores(20) = motivo_liquidacion
|
|
arrParametrosNombres(21) = "@i_atraso_maximo" : arrParametrosValores(21) = atraso_maximo
|
|
arrParametrosNombres(22) = "@i_atraso_medio" : arrParametrosValores(22) = atraso_medio
|
|
arrParametrosNombres(23) = "@i_categoria_operacion" : arrParametrosValores(23) = categoria_operacion
|
|
arrParametrosNombres(24) = "@i_periodo_reportado" : arrParametrosValores(24) = periodo_reportado
|
|
arrParametrosNombres(25) = "@i_meses_reportados" : arrParametrosValores(25) = meses_reportados
|
|
arrParametrosNombres(26) = "@i_ponderador" : arrParametrosValores(26) = ponderador
|
|
arrParametrosNombres(27) = "@i_status_tabla" : arrParametrosValores(27) = status_tabla
|
|
arrParametrosNombres(28) = "@i_llave" : arrParametrosValores(28) = llave
|
|
arrParametrosNombres(29) = "@i_idcliente" : arrParametrosValores(29) = idCliente.ToString()
|
|
|
|
StrXml = outConector.EjecutarComandoSQLArreglo( _
|
|
strProceso, _
|
|
strConexion, _
|
|
StrSQL, _
|
|
arrParametrosNombres, _
|
|
arrParametrosValores, _
|
|
"0")
|
|
|
|
|
|
Catch excError As Exception
|
|
|
|
End Try
|
|
End Sub
|
|
|
|
End Class
|