1030 lines
43 KiB
JavaScript
1030 lines
43 KiB
JavaScript
|
|
$("#formDatosGenerales").EnableValidationToolTip();
|
|||
|
|
$("#formDatosResidenciales").EnableValidationToolTip();
|
|||
|
|
$("#formDatosPersonaJuridica").EnableValidationToolTip();
|
|||
|
|
var JsonParticipante = {};
|
|||
|
|
var CICDeudasRefinanciar = null;
|
|||
|
|
var CICFeActualizacion = null;
|
|||
|
|
var IsReadOnlyForm = false;
|
|||
|
|
|
|||
|
|
jQuery(document).ready(function () {
|
|||
|
|
//$('#btnSolicitarInfoCobis').attr("disabled", true);
|
|||
|
|
$('#btnSolicitarInfoBDInterna').attr("disabled", true);
|
|||
|
|
$('#divTipoPersona').hide();
|
|||
|
|
$("#divDatosPersonaJuridica").hide();
|
|||
|
|
$("#divDatosPersonaFisica").hide();
|
|||
|
|
GetControlsSettings("DatosGeneralesParticipantes", "DatosGeneralesParticipantes", "formDatosGenerales", false);
|
|||
|
|
GetControlsSettings("DatosGeneralesParticipantes", "DatosGeneralesParticipantes", "formDatosResidenciales", true);
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
$("#TabsClienteCentrico li a").click(function (event) {
|
|||
|
|
try {
|
|||
|
|
//Si etapa está activa
|
|||
|
|
if ($("#hiddenTaskStatus").val() == 1 && IsReadOnlyForm == false) {
|
|||
|
|
|
|||
|
|
event.preventDefault();
|
|||
|
|
var thisHREF = this.attributes["href"].nodeValue;
|
|||
|
|
|
|||
|
|
//Si es la primera vez que quiere salir o no ha guardado antes de quere salir.
|
|||
|
|
if ($("#hiddenFlagSalir").val() != "true" || $("#hiddenFlagGuardarDatos").val() != "true") {
|
|||
|
|
|
|||
|
|
//Activa el flag de salir
|
|||
|
|
$("#hiddenFlagSalir").val("true");
|
|||
|
|
|
|||
|
|
//Indica al usuario que debe guardar
|
|||
|
|
toastr.warning("Estimado usuario, debe guardar los datos antes de salir del formulario.", Message_Warning);
|
|||
|
|
ENDREQUEST();
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
document.location.href = thisHREF;
|
|||
|
|
}
|
|||
|
|
} catch (e) {
|
|||
|
|
ENDREQUEST();
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
$("#bulletedListOpciones li a").click(function (event) {
|
|||
|
|
try {
|
|||
|
|
//Si etapa está activa
|
|||
|
|
if ($("#hiddenTaskStatus").val() == 1 && IsReadOnlyForm == false) {
|
|||
|
|
|
|||
|
|
event.preventDefault();
|
|||
|
|
var thisHREF = this.attributes["href"].nodeValue;
|
|||
|
|
|
|||
|
|
//Si es la primera vez que quiere salir o no ha guardado antes de quere salir.
|
|||
|
|
if ($("#hiddenFlagSalir").val() != "true" || $("#hiddenFlagGuardarDatos").val() != "true") {
|
|||
|
|
|
|||
|
|
//Activa el flag de salir
|
|||
|
|
$("#hiddenFlagSalir").val("true");
|
|||
|
|
|
|||
|
|
//Indica al usuario que debe guardar
|
|||
|
|
toastr.warning("Estimado usuario, debe guardar los datos antes de salir del formulario.", Message_Warning);
|
|||
|
|
ENDREQUEST();
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
document.location.href = thisHREF;
|
|||
|
|
}
|
|||
|
|
} catch (e) {
|
|||
|
|
ENDREQUEST();
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
this.getDataModel = function () {
|
|||
|
|
|
|||
|
|
try {
|
|||
|
|
CargarParticipante();
|
|||
|
|
$("#radioTipoParticipanteCodeudor").attr("name", "TipoParticipante");
|
|||
|
|
$("#radioTipoParticipanteFiador").attr("name", "TipoParticipante");
|
|||
|
|
|
|||
|
|
$("#radioTipoPersonaFisica").attr("name", "TipoPersona");
|
|||
|
|
$("#radioTipoPersonaJuridica").attr("name", "TipoPersona");
|
|||
|
|
|
|||
|
|
$("#radioAutoSi").attr("name", "TieneAuto");
|
|||
|
|
$("#radioAutoNo").attr("name", "TieneAuto");
|
|||
|
|
|
|||
|
|
$("#radioResidenteSi").attr("name", "Residente");
|
|||
|
|
$("#radioResidenteNo").attr("name", "Residente");
|
|||
|
|
|
|||
|
|
$("#radioTipoParticipanteCodeudor").change(function () {
|
|||
|
|
SeleccionTipoParticipante();
|
|||
|
|
SeleccionTipoPersona();
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
$("#radioTipoParticipanteFiador").change(function () {
|
|||
|
|
SeleccionTipoParticipante();
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
$("#radioTipoPersonaFisica").change(function () {
|
|||
|
|
SeleccionTipoPersona();
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
$("#radioTipoPersonaJuridica").change(function () {
|
|||
|
|
SeleccionTipoPersona();
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
$('#btnCanton').unbind('click');
|
|||
|
|
$('#btnCanton').click(function () {
|
|||
|
|
CantonClick();
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
$('#btnDistrito').unbind('click');
|
|||
|
|
$('#btnDistrito').click(function () {
|
|||
|
|
DistritoClick();
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
$('#btnGuardarDatosGenerales').click(function () {
|
|||
|
|
GuardarParticipante();
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
$('#btnCargarDeudasCIC').click(function () {
|
|||
|
|
CargarDeudasCICParticipante();
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
$('#btnEvaluarCIC').click(function () {
|
|||
|
|
EvaluarDeudasCICParticipante();
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
$('#btnSolicitarInfoCobis').mousedown(function () {
|
|||
|
|
this.disabled = true;
|
|||
|
|
ObtenerInformacionCobisParticipante();
|
|||
|
|
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
$('#btnSolicitarInfoCobis').click(function () {
|
|||
|
|
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
$('#btnSolicitarInfoBDInterna').click(function () {
|
|||
|
|
ObtenerInformacionCliente();
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
$('#ddtipo_Identificacion').unbind('change');
|
|||
|
|
$('#ddtipo_Identificacion').change(function () {
|
|||
|
|
ShowDiv('Identificacion');
|
|||
|
|
|
|||
|
|
var tipoId = obtener_tipo_identificacion('Identificacion');
|
|||
|
|
if (tipoId == "0") {
|
|||
|
|
$('#btnSolicitarInfoCobis').attr("disabled", true);
|
|||
|
|
}
|
|||
|
|
else {
|
|||
|
|
$('#btnSolicitarInfoCobis').attr("disabled", false);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
var _crtlIdentificacion = $('#divIdentificacion');
|
|||
|
|
$("input[type='text']", _crtlIdentificacion.contents()).change(function () {
|
|||
|
|
$('#btnSolicitarInfoCobis').attr("disabled", false);
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
} catch (e) {
|
|||
|
|
toastr.error("Ha ocurrido un error inesperado al intentar cargar la información en el formulario. Por favor contacte al Administrador del Sistema");
|
|||
|
|
}
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
this.CargarDataCatalogoAdicional = function()
|
|||
|
|
{
|
|||
|
|
if(SelectedCatalog==="Provincia")
|
|||
|
|
{
|
|||
|
|
$("#txtCanton").val("");
|
|||
|
|
$("#hiddenCanton").val("");
|
|||
|
|
$("#txtDistrito").val("");
|
|||
|
|
$("#hiddenDistrito").val("");
|
|||
|
|
}
|
|||
|
|
if (SelectedCatalog === "Canton")
|
|||
|
|
{
|
|||
|
|
$("#txtDistrito").val("");
|
|||
|
|
$("#hiddenDistrito").val("");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
this.CargarParticipante = function () {
|
|||
|
|
try {
|
|||
|
|
|
|||
|
|
|
|||
|
|
var idSolicitud = $("#hiddensol_co_solicitud").val();
|
|||
|
|
var idCliente = $("#hiddencl_co_cliente").val();
|
|||
|
|
var codeudor = $("#radioTipoParticipanteCodeudor").prop('checked');
|
|||
|
|
var fiador = $("#radioTipoParticipanteFiador").prop('checked');
|
|||
|
|
|
|||
|
|
if (idCliente == "0") {
|
|||
|
|
|
|||
|
|
if (codeudor === undefined && fiador === undefined) {
|
|||
|
|
var uri = format("api/SolicitanteAPI/ObtenerInfoClienteCotizacion?idSolicitud={0}", idSolicitud);
|
|||
|
|
|
|||
|
|
|
|||
|
|
$.getJSON(server + uri).done(function (data) {
|
|||
|
|
|
|||
|
|
JsonParticipante = data;
|
|||
|
|
|
|||
|
|
$("#txtNombre").val(data.PrimerNombre);
|
|||
|
|
$("#txtSegundoNombre").val(data.SegundoNombre);
|
|||
|
|
$("#txtPrimerApellido").val(data.PrimerApellido);
|
|||
|
|
$("#txtSegundoApellido").val(data.SegundoApellido);
|
|||
|
|
|
|||
|
|
impostar_tipo_identificacion('Identificacion', data.TipoIdentificacion);
|
|||
|
|
impostar_identificacion('Identificacion', data.Identificacion);
|
|||
|
|
|
|||
|
|
$("#txtEmail").val(data.Email);
|
|||
|
|
|
|||
|
|
$("#formDatosGenerales").valid();
|
|||
|
|
$("#formDatosResidenciales").valid();
|
|||
|
|
|
|||
|
|
|
|||
|
|
}).fail(function (jqxhr, textStatus, error) {
|
|||
|
|
toastr.error("Ha ocurrido un error inesperado. Vuelva a intentarlo mas tarde");
|
|||
|
|
}).then(function (value) {
|
|||
|
|
ENDREQUEST();
|
|||
|
|
SoloLectura();
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
else {
|
|||
|
|
$.getJSON(server + 'api/SolicitanteAPI/ObtenerParticipante?idSolicitud=' + idSolicitud + "&idCliente=" + idCliente, function (data) {
|
|||
|
|
|
|||
|
|
ENDREQUEST();
|
|||
|
|
if (data == null || data.length == 0)
|
|||
|
|
return;
|
|||
|
|
|
|||
|
|
data = data[0];
|
|||
|
|
JsonParticipante = data;
|
|||
|
|
|
|||
|
|
$("#radioTipoParticipanteCodeudor").prop("checked", data.TipoParticipante == 1);
|
|||
|
|
$("#radioTipoParticipanteFiador").prop("checked", data.TipoParticipante == 2);
|
|||
|
|
|
|||
|
|
$("#radioTipoPersonaFisica").prop("checked", data.TipoPersona == 1);
|
|||
|
|
$("#radioTipoPersonaJuridica").prop("checked", data.TipoPersona == 2);
|
|||
|
|
|
|||
|
|
CargarRadioParticipante();
|
|||
|
|
$("#txtNombre").val(data.primerNombre);
|
|||
|
|
$("#txtSegundoNombre").val(data.segundoNombre);
|
|||
|
|
$("#txtPrimerApellido").val(data.primerApellido);
|
|||
|
|
$("#txtSegundoApellido").val(data.segundoApellido);
|
|||
|
|
$("#txtFechaNacimiento").val(data.fechaNacimiento == null ? "" : moment(data.fechaNacimiento).format("DD/MM/YYYY"));
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
if (data.TipoParticipante == 2 && data.TipoPersona == 2) {
|
|||
|
|
impostar_tipo_identificacion('CedulaJuridica', data.idTipoIdentificacion);
|
|||
|
|
impostar_identificacion('CedulaJuridica', data.identificacion);
|
|||
|
|
} else {
|
|||
|
|
impostar_tipo_identificacion('Identificacion', data.idTipoIdentificacion);
|
|||
|
|
impostar_identificacion('Identificacion', data.identificacion);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
$("#hiddenEsValidado").val(data.EsValidado);
|
|||
|
|
$("#txtPaisNacimiento").val(data.paisNacimiento);
|
|||
|
|
$("#hiddenPaisNacimiento").val(data.idPaisNacimiento);
|
|||
|
|
$("#hiddenNacionalidad").val(data.idNacionalidad);
|
|||
|
|
$("#txtNacionalidad").val(data.nacionalidad);
|
|||
|
|
$("#txtSexo").val(data.sexo);
|
|||
|
|
$("#hiddenSexo").val(data.idSexo);
|
|||
|
|
$("#txtEstadoCivil").val(data.estadoCivil);
|
|||
|
|
$("#hiddenEstadoCivil").val(data.idEstadoCivil);
|
|||
|
|
OnchangeEstadoCivil(data.idEstadoCivil);
|
|||
|
|
$("#txtCantidadVecesEstadoCivil").val(data.NumerosVecesEstadoCivil);
|
|||
|
|
$("#txtProfesion").val(data.profesion);
|
|||
|
|
$("#hiddenProfesion").val(data.idProfesion);
|
|||
|
|
$("#txtDependientes").val(data.dependientes);
|
|||
|
|
$("#radioResidenteSi").prop("checked", data.residente == true);
|
|||
|
|
$("#radioResidenteNo").prop("checked", data.residente == false);
|
|||
|
|
$("#txtEducacion").val(data.nivelEducacion);
|
|||
|
|
$("#hiddenEducacion").val(data.idNivelEducacion);
|
|||
|
|
$("#txtFechaVencimientoCedula").val(data.fechaVencimientoCedula == null ? "" : moment(data.fechaVencimientoCedula).format("DD/MM/YYYY"));
|
|||
|
|
$("#radioAutoSi").prop("checked", data.tieneAuto == true);
|
|||
|
|
$("#radioAutoNo").prop("checked", data.tieneAuto == false);
|
|||
|
|
$("#txtPlaca").val(data.numeroPlaca);
|
|||
|
|
$("#txtCodGrupoEconomico").val(data.CodGrupoEconomico); //IFRS
|
|||
|
|
$("#txtProvincia").val(data.provincia);
|
|||
|
|
$("#hiddenProvincia").val(data.idProvincia);
|
|||
|
|
$("#txtCanton").val(data.canton);
|
|||
|
|
$("#hiddenCanton").val(data.idCanton);
|
|||
|
|
$("#txtDistrito").val(data.distrito);
|
|||
|
|
$("#hiddenDistrito").val(data.idDistrito);
|
|||
|
|
|
|||
|
|
$("#txtApartadoPostal").val(data.apartadoPostal);
|
|||
|
|
$("#txtCodigoPostal").val(data.codigoPostal);
|
|||
|
|
$("#txtTelefonoCelular").val(data.telefonoCelular);
|
|||
|
|
$("#txtEmail").val(data.correoElectronico);
|
|||
|
|
$("#txtOtrasSeñas").val(data.direccionExacta);
|
|||
|
|
$("#txtNCasa").val(data.numeroCasaApto);
|
|||
|
|
$("#txtZonaPostal").val(data.zonaPostal);
|
|||
|
|
$("#txtTelefonoResidencia").val(data.telefonoResidencial);
|
|||
|
|
$("#txtFax").val(data.telefonoFax);
|
|||
|
|
$("#txtCondicionVivienda").val(data.CondicionVivienda);
|
|||
|
|
$("#hiddenCondicionVivienda").val(data.idCondicionVivienda);
|
|||
|
|
|
|||
|
|
if (data.TipoParticipante == 2 && data.TipoPersona == 2) {
|
|||
|
|
|
|||
|
|
$("#txtNombreEmpresa").val(data.NombreEmpresa);
|
|||
|
|
$('#txtCapitalSocial').autoNumeric('set', data.CapitalSocial);
|
|||
|
|
$("#txtActividadEmpresa").val(data.ActividadEmpresa);
|
|||
|
|
$('#txtFechaVencimiento').val(data.FechaVencimiento == null ? "" : moment(data.FechaVencimiento).format("DD/MM/YYYY"));
|
|||
|
|
$("#txtNombreRepresentanteLegal").val(data.NombreRepresentanteLegal);
|
|||
|
|
$("#formDatosPersonaJuridica").valid();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
switch (data.ResultadoEvaluacionCIC) {
|
|||
|
|
case 0:
|
|||
|
|
$("#hiddenResultadoEvaluacionCIC").val("0");
|
|||
|
|
$("#txtResultadoEvaluacionCIC").val("CLIENTE NO ES EXCELENTE CIC");
|
|||
|
|
|
|||
|
|
break;
|
|||
|
|
case 1:
|
|||
|
|
$("#hiddenResultadoEvaluacionCIC").val("1")
|
|||
|
|
$("#txtResultadoEvaluacionCIC").val("CLIENTE CON EXCELENTE CIC");
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if ($("#hiddenStep").val() != "AU_Cotiza") {
|
|||
|
|
$('#btnSolicitarInfoCobis').attr("disabled", true);
|
|||
|
|
$('#btnCargarDeudasCIC').attr("disabled", true);
|
|||
|
|
$("#divIdentificacion").find(":input").prop("disabled", true);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
$("#formDatosGenerales").valid();
|
|||
|
|
$("#formDatosResidenciales").valid();
|
|||
|
|
|
|||
|
|
}).fail(function (jqxhr, textStatus, error) {
|
|||
|
|
toastr.error("Ha ocurrido un error inesperado. Vuelva a intentarlo mas tarde");
|
|||
|
|
}).then(function (value) {
|
|||
|
|
ENDREQUEST();
|
|||
|
|
SoloLectura();
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch (e) {
|
|||
|
|
toastr.error("Ha ocurrido un error inesperado al intentar cargar la información en el formulario. Por favor contacte al Administrador del Sistema");
|
|||
|
|
}
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
this.CantonClick = function () {
|
|||
|
|
var provincia = $("#hiddenProvincia").val();
|
|||
|
|
if (provincia == null || provincia == "") {
|
|||
|
|
toastr.warning("Debe escoger una provincia", Message_Warning);
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
var DireccionAPI = $('#btnCanton').attr("Direccion_API");
|
|||
|
|
DireccionAPICatalogo = DireccionAPI
|
|||
|
|
SelectedCatalog = "Canton";
|
|||
|
|
CargarDataCatalogo(DireccionAPI, null, provincia);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
this.DistritoClick = function () {
|
|||
|
|
var canton = $("#hiddenCanton").val();
|
|||
|
|
if (canton == null || canton == "") {
|
|||
|
|
toastr.warning("Debe escoger un cantón", Message_Warning);
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
var DireccionAPI = $('#btnDistrito').attr("Direccion_API");
|
|||
|
|
DireccionAPICatalogo = DireccionAPI
|
|||
|
|
SelectedCatalog = "Distrito";
|
|||
|
|
CargarDataCatalogo(DireccionAPI, null, canton);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
function CargarRadioParticipante() {
|
|||
|
|
|
|||
|
|
if ($("#radioTipoParticipanteCodeudor").is(":checked")) {
|
|||
|
|
$("#divDatosPersonaFisica").show();
|
|||
|
|
$("#radioTipoParticipanteFiador").attr("disabled", true);
|
|||
|
|
$("#divDatosPersonaJuridica").hide();
|
|||
|
|
$('#divTipoPersona').hide();
|
|||
|
|
$("#listInfoLaboral").show();
|
|||
|
|
$("#listRefenciaDeuda").show();
|
|||
|
|
}
|
|||
|
|
else if ($("#radioTipoParticipanteFiador").is(":checked")) {
|
|||
|
|
$("#radioTipoParticipanteCodeudor").attr("disabled", true);
|
|||
|
|
$("#listInfoLaboral").hide();
|
|||
|
|
$("#listRefenciaDeuda").hide();
|
|||
|
|
if ($("#radioTipoPersonaFisica").is(":checked")) {
|
|||
|
|
$("#divDatosPersonaFisica").show();
|
|||
|
|
$('#divTipoPersona').show();
|
|||
|
|
$("#radioTipoPersonaJuridica").attr("disabled", true);
|
|||
|
|
}
|
|||
|
|
if ($("#radioTipoPersonaJuridica").is(":checked")) {
|
|||
|
|
|
|||
|
|
$('#divTipoPersona').show();
|
|||
|
|
$("#divDatosPersonaFisica").hide();
|
|||
|
|
$("#divDatosPersonaJuridica").show();
|
|||
|
|
$("#radioTipoPersonaFisica").attr("disabled", true);
|
|||
|
|
GetControlsSettings("PersonaJuridica", "PersonaJuridica", "formDatosPersonaJuridica", false, false);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
function SeleccionTipoParticipante() {
|
|||
|
|
|
|||
|
|
$("#radioTipoPersonaFisica").prop("checked", false);
|
|||
|
|
$("#radioTipoPersonaJuridica").prop("checked", false);
|
|||
|
|
|
|||
|
|
|
|||
|
|
if ($("#radioTipoParticipanteCodeudor").is(":checked")) {
|
|||
|
|
$("#divDatosPersonaFisica").show();
|
|||
|
|
$("#radioTipoPersonaFisica").attr("disabled", true);
|
|||
|
|
$("#radioTipoPersonaJuridica").attr("disabled", true);
|
|||
|
|
$("#radioTipoPersonaFisica").prop("checked", true);
|
|||
|
|
$("#divDatosPersonaJuridica").hide();
|
|||
|
|
|
|||
|
|
$('#divTipoPersona').hide();
|
|||
|
|
$("#radioTipoPersonaFisica").prop("checked", false);
|
|||
|
|
$("#radioTipoPersonaJuridica").prop("checked", false);
|
|||
|
|
|
|||
|
|
$("#listInfoLaboral").show();
|
|||
|
|
$("#listRefenciaDeuda").show();
|
|||
|
|
LimpiarPersonaJuridica();
|
|||
|
|
GetControlsSettings("PersonaNatural", "DatosGeneralesParticipantes", "formDatosGenerales", false);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
else if ($("#radioTipoParticipanteFiador").is(":checked")) {
|
|||
|
|
$("#divDatosPersonaFisica").hide();
|
|||
|
|
$("#radioTipoPersonaFisica").removeAttr("disabled");
|
|||
|
|
$("#radioTipoPersonaJuridica").removeAttr("disabled");
|
|||
|
|
|
|||
|
|
$('#divTipoPersona').show();
|
|||
|
|
//$("#radioTipoPersonaFisica").prop("checked", true);
|
|||
|
|
|
|||
|
|
$("#listInfoLaboral").hide();
|
|||
|
|
$("#listRefenciaDeuda").hide();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
function SeleccionTipoPersona() {
|
|||
|
|
|
|||
|
|
if ($("#radioTipoPersonaFisica").is(":checked") || $("#radioTipoParticipanteCodeudor").is(":checked")) {
|
|||
|
|
$("#divDatosPersonaFisica").show();
|
|||
|
|
LimpiarPersonaJuridica();
|
|||
|
|
GetControlsSettings("PersonaNatural", "DatosGeneralesParticipantes", "formDatosGenerales", false);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
else
|
|||
|
|
$("#divDatosPersonaFisica").hide();
|
|||
|
|
|
|||
|
|
if ($("#radioTipoPersonaJuridica").is(":checked")) {
|
|||
|
|
$("#divDatosPersonaJuridica").show();
|
|||
|
|
LimpiarPersonaNatural();
|
|||
|
|
GetControlsSettings("PersonaJuridica", "PersonaJuridica", "formDatosPersonaJuridica", false, false);
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
$("#divDatosPersonaJuridica").hide();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
function GuardarParticipante() {
|
|||
|
|
|
|||
|
|
if ($("#hiddenEsValidado").val() == "false" || !$("#hiddenEsValidado").val()) {
|
|||
|
|
toastr.warning("Debe Realizar la consulta Cobis.");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (!$("#formDatosGenerales").valid()) {
|
|||
|
|
toastr.warning("Ingresar todos los campos que son requeridos.");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (!$("#formDatosResidenciales").valid()) {
|
|||
|
|
toastr.warning("Ingresar todos los campos que son requeridos.");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
var datos = GetDatos();
|
|||
|
|
|
|||
|
|
if (datos.idTipoIdentificacion == 0) {
|
|||
|
|
toastr.warning("Ingresar la identificación.");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
$.ajax({
|
|||
|
|
type: 'POST',
|
|||
|
|
url: server + "api/SolicitanteAPI/GuardarParticipante",
|
|||
|
|
cache: false,
|
|||
|
|
data: JSON.stringify(datos),
|
|||
|
|
contentType: 'application/json; charset=utf-8',
|
|||
|
|
dataType: 'json',
|
|||
|
|
success: function (data) {
|
|||
|
|
|
|||
|
|
if (data != null && data.CodigoRespuesta == "EXITOSO") {
|
|||
|
|
|
|||
|
|
toastr.success("Información guardada", Message_Success);
|
|||
|
|
|
|||
|
|
if ($("#hiddencl_co_cliente").val() == "0") {
|
|||
|
|
location.href = location.href.replace("&cl_co_cliente=0", "&cl_co_cliente=" + data.IdCliente);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if ($("#hiddenFlagSalir").val() == "true") { $("#hiddenFlagGuardarDatos").val("true"); }
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
else if (data.CodigoRespuesta == "ADVERTENCIA") {
|
|||
|
|
toastr.warning(data.DescripcionRespuesta, Message_Warning);
|
|||
|
|
}
|
|||
|
|
else {
|
|||
|
|
toastr.error("Ha ocurrido un error inesperado. Vuela a intentarlo mas tarde", Message_Error);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}).fail(function (jqxhr, textStatus, error) {
|
|||
|
|
toastr.error("Ha ocurrido un error inesperado. Vuela a intentarlo mas tarde", Message_Error);
|
|||
|
|
}).then(function (value) {
|
|||
|
|
ENDREQUEST();
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
function GetDatos() {
|
|||
|
|
|
|||
|
|
var idjuridica = obtener_identificacion('CedulaJuridica');
|
|||
|
|
var idnatural = obtener_identificacion('Identificacion');
|
|||
|
|
var tipoidjuridica = obtener_tipo_identificacion('CedulaJuridica')
|
|||
|
|
var tipoidnatural = obtener_tipo_identificacion('Identificacion')
|
|||
|
|
var id = "";
|
|||
|
|
var tipoid = "";
|
|||
|
|
var participante = ($("#radioTipoParticipanteCodeudor").is(":checked") ? 1 : ($("#radioTipoParticipanteFiador").is(":checked") ? 2 : 0));
|
|||
|
|
var tipopersona = ($("#radioTipoPersonaFisica").is(":checked") ? 1 : ($("#radioTipoPersonaJuridica").is(":checked") ? 2 : 0));
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
if (participante == 2 && tipopersona == 2) {
|
|||
|
|
id = idjuridica
|
|||
|
|
tipoid = tipoidjuridica
|
|||
|
|
}
|
|||
|
|
else {
|
|||
|
|
id = idnatural
|
|||
|
|
tipoid = tipoidnatural
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
var d = {
|
|||
|
|
idSolicitud: $("#hiddensol_co_solicitud").val(),
|
|||
|
|
idCliente: $("#hiddencl_co_cliente").val(),
|
|||
|
|
TipoParticipante: ($("#radioTipoParticipanteCodeudor").is(":checked") ? 1 : ($("#radioTipoParticipanteFiador").is(":checked") ? 2 : 0)),
|
|||
|
|
TipoPersona: ($("#radioTipoPersonaFisica").is(":checked") ? 1 : ($("#radioTipoPersonaJuridica").is(":checked") ? 2 : 0)),
|
|||
|
|
primerNombre: $("#txtNombre").val(),
|
|||
|
|
segundoNombre: $("#txtSegundoNombre").val(),
|
|||
|
|
primerApellido: $("#txtPrimerApellido").val(),
|
|||
|
|
segundoApellido: $("#txtSegundoApellido").val(),
|
|||
|
|
identificacion: id,
|
|||
|
|
idTipoIdentificacion: tipoid,
|
|||
|
|
fechaNacimiento: $('#txtFechaNacimiento').val() == "" ? null : moment($('#txtFechaNacimiento').val(), "DD/MM/YYYY").toJSON(),
|
|||
|
|
idPaisNacimiento: $("#hiddenPaisNacimiento").val(),
|
|||
|
|
paisNacimiento: $("#txtPaisNacimiento").val(),
|
|||
|
|
idNacionalidad: $("#hiddenNacionalidad").val(),
|
|||
|
|
nacionalidad: $("#txtNacionalidad").val(),
|
|||
|
|
idSexo: $("#hiddenSexo").val(),
|
|||
|
|
sexo: $("#txtSexo").val(),
|
|||
|
|
idEstadoCivil: $("#hiddenEstadoCivil").val(),
|
|||
|
|
estadoCivil: $("#txtEstadoCivil").val(),
|
|||
|
|
NumerosVecesEstadoCivil: $("#txtCantidadVecesEstadoCivil").val(),
|
|||
|
|
idProfesion: $("#hiddenProfesion").val(),
|
|||
|
|
profesion: $("#txtProfesion").val(),
|
|||
|
|
dependientes: $("#txtDependientes").val(),
|
|||
|
|
residente: ($("#radioResidenteSi").is(":checked") ? true : ($("#radioResidenteNo").is(":checked") ? false : null)),
|
|||
|
|
idNivelEducacion: $("#hiddenEducacion").val(),
|
|||
|
|
nivelEducacion: $("#txtEducacion").val(),
|
|||
|
|
fechaVencimientoCedula: $('#txtFechaVencimientoCedula').val() == "" ? null : moment($('#txtFechaVencimientoCedula').val(), "DD/MM/YYYY").toJSON(),
|
|||
|
|
tieneAuto: ($("#radioAutoSi").is(":checked") ? true : ($("#radioAutoNo").is(":checked") ? false : null)),
|
|||
|
|
numeroPlaca: $("#txtPlaca").val(),
|
|||
|
|
CodGrupoEconomico: $("#txtCodGrupoEconomico").val(),
|
|||
|
|
idProvincia: $("#hiddenProvincia").val(),
|
|||
|
|
provincia: $("#txtProvincia").val(),
|
|||
|
|
idCanton: $("#hiddenCanton").val(),
|
|||
|
|
canton: $("#txtCanton").val(),
|
|||
|
|
idDistrito: $("#hiddenDistrito").val(),
|
|||
|
|
distrito: $("#txtDistrito").val(),
|
|||
|
|
apartadoPostal: $("#txtApartadoPostal").val(),
|
|||
|
|
codigoPostal: $("#txtCodigoPostal").val(),
|
|||
|
|
telefonoCelular: $("#txtTelefonoCelular").val(),
|
|||
|
|
correoElectronico: $("#txtEmail").val(),
|
|||
|
|
direccionExacta: $("#txtOtrasSeñas").val(),
|
|||
|
|
numeroCasaApto: $("#txtNCasa").val(),
|
|||
|
|
zonaPostal: $("#txtZonaPostal").val(),
|
|||
|
|
telefonoResidencial: $("#txtTelefonoResidencia").val(),
|
|||
|
|
telefonoFax: $("#txtFax").val(),
|
|||
|
|
idCondicionVivienda: $("#hiddenCondicionVivienda").val(),
|
|||
|
|
CondicionVivienda: $("#txtCondicionVivienda").val(),
|
|||
|
|
NombreEmpresa: $("#txtNombreEmpresa").val(),
|
|||
|
|
CapitalSocial: $("#txtCapitalSocial").val() == "" || $("#txtCapitalSocial").val() == undefined ? null : $("#txtCapitalSocial").autoNumeric('get'),
|
|||
|
|
ActividadEmpresa: $("#txtActividadEmpresa").val(),
|
|||
|
|
FechaVencimiento: $('#txtFechaVencimiento').val() == "" ? null : moment($('#txtFechaVencimiento').val(), "DD/MM/YYYY").toJSON(),
|
|||
|
|
NombreRepresentanteLegal: $("#txtNombreRepresentanteLegal").val(),
|
|||
|
|
ResultadoEvaluacionCIC: $("#hiddenResultadoEvaluacionCIC").val(),
|
|||
|
|
EsValidado: $("#hiddenEsValidado").val()
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
return d;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
this.SoloLectura = function () {
|
|||
|
|
|
|||
|
|
try {
|
|||
|
|
$("#btnOpcionesSolicitante").removeAttr("disabled");
|
|||
|
|
if ($("#hiddenTaskStatus").val() == 1 && $("#hiddenStep").val() == "AU_Cotiza") {
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
FormReadOnly();
|
|||
|
|
$("button[direccion_api]").remove();
|
|||
|
|
$("#btnGuardarDatosGenerales").remove();
|
|||
|
|
$("#formBitacoraComentario").remove();
|
|||
|
|
$("#btnOpcionesSolicitante").removeAttr("disabled");
|
|||
|
|
if ($('#btnCargarDeudasCIC') != null) $('#btnCargarDeudasCIC').attr("disabled", true)
|
|||
|
|
if ($('#btnEvaluarCIC') != null) $('#btnEvaluarCIC').attr("disabled", true)
|
|||
|
|
|
|||
|
|
IsReadOnlyForm = true;
|
|||
|
|
|
|||
|
|
} catch (e) {
|
|||
|
|
toastr.error("Ha ocurrido un problema al cargar el formulario. Vuela a intentarlo mas tarde", Message_Error);
|
|||
|
|
}
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
this.ObtenerInformacionCobisParticipante = function () {
|
|||
|
|
try {
|
|||
|
|
var _IdCliente = $("#hiddencl_co_cliente").val();
|
|||
|
|
var _IdSolicitud = $("#hiddensol_co_solicitud").val();
|
|||
|
|
var _Identificacion = obtener_identificacion('Identificacion');
|
|||
|
|
var _TipoIdentificacion = obtener_tipo_identificacion('Identificacion');
|
|||
|
|
var _Proceso = $("#hiddenProcess").val();
|
|||
|
|
var _Usuario = $("#hiddenUserID").val().split('/')[1];
|
|||
|
|
var _TipoCambio = $("#hiddenTasaTipoCambio").val();
|
|||
|
|
|
|||
|
|
|
|||
|
|
var _TipoParticipante = ($("#radioTipoParticipanteCodeudor").is(":checked") ? 1 : ($("#radioTipoParticipanteFiador").is(":checked") ? 2 : 0));
|
|||
|
|
var _TipoPersona = ($("#radioTipoPersonaFisica").is(":checked") ? 1 : ($("#radioTipoPersonaJuridica").is(":checked") ? 2 : 0));
|
|||
|
|
|
|||
|
|
var _TipoIdentificacionHomologo = "C";
|
|||
|
|
|
|||
|
|
switch (_TipoIdentificacion) {
|
|||
|
|
case "1":
|
|||
|
|
case "2":
|
|||
|
|
case "3":
|
|||
|
|
case "4":
|
|||
|
|
case "5":
|
|||
|
|
case "6":
|
|||
|
|
case "11":
|
|||
|
|
_TipoIdentificacionHomologo = "C";
|
|||
|
|
break;
|
|||
|
|
case "7":
|
|||
|
|
case "8":
|
|||
|
|
_TipoIdentificacionHomologo = "P";
|
|||
|
|
break;
|
|||
|
|
default:
|
|||
|
|
_TipoIdentificacionHomologo = "C";
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
var uri = format("api/SolicitanteAPI/ObtenerInfoParticipanteCobis?IdCliente={0}&IdSolicitud={1}&Identificacion={2}&TipoIdentificacion={3}&Proceso={4}&Usuario={5}&TipoCambio={6}&TipoParticipante={7}&TipoPersona={8}", _IdCliente, _IdSolicitud, _Identificacion, _TipoIdentificacionHomologo, _Proceso, _Usuario, _TipoCambio, _TipoParticipante, _TipoPersona);
|
|||
|
|
|
|||
|
|
|
|||
|
|
$.ajax({
|
|||
|
|
type: 'GET',
|
|||
|
|
url: server + uri,
|
|||
|
|
cache: false,
|
|||
|
|
contentType: 'application/json; charset=utf-8',
|
|||
|
|
dataType: 'json',
|
|||
|
|
async: true,
|
|||
|
|
success: function (data) {
|
|||
|
|
|
|||
|
|
$("#hiddenEsValidado").val('true');
|
|||
|
|
if (data != null && (data.CodigoRespuesta == "EXITOSO" || data.CodigoRespuesta == "ADVERTENCIA")) {
|
|||
|
|
//******************************************
|
|||
|
|
//Muestra los mensajes de advertencia
|
|||
|
|
//******************************************
|
|||
|
|
if (data.CodigoRespuesta == "ADVERTENCIA") {
|
|||
|
|
$.each(data.Alertas, function (key, item) {
|
|||
|
|
toastr.warning(item, Message_Warning);
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
//******************************************
|
|||
|
|
//Si el cliente es nuevo no intenta cargar
|
|||
|
|
//******************************************
|
|||
|
|
if (data.tipoCliente == "Nuevo") {
|
|||
|
|
toastr.success("Integración con el Cobis completada satisfactoriamente", Message_Success);
|
|||
|
|
|
|||
|
|
//Habilita el boton de consulta a la Base de Datos Interna
|
|||
|
|
$('#btnSolicitarInfoBDInterna').attr("disabled", false)
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//******************************************
|
|||
|
|
//Carga la informacion en pantalla
|
|||
|
|
//******************************************
|
|||
|
|
JsonParticipante = data;
|
|||
|
|
|
|||
|
|
if ($("#hiddencl_co_cliente").val() == "0") {
|
|||
|
|
location.href = location.href.replace("&cl_co_cliente=0", "&cl_co_cliente=" + data.idCliente);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
$("#radioTipoParticipanteCodeudor").prop("checked", data.TipoParticipante == 1);
|
|||
|
|
|
|||
|
|
$("#radioTipoParticipanteFiador").prop("checked", data.TipoParticipante == 2);
|
|||
|
|
//SeleccionTipoParticipante();
|
|||
|
|
$("#radioTipoPersonaFisica").prop("checked", data.TipoPersona == 1);
|
|||
|
|
$("#radioTipoPersonaJuridica").prop("checked", data.TipoPersona == 2);
|
|||
|
|
//SeleccionTipoPersona();
|
|||
|
|
CargarRadioParticipante();
|
|||
|
|
$("#txtNombre").val(data.primerNombre);
|
|||
|
|
$("#txtSegundoNombre").val(data.segundoNombre);
|
|||
|
|
$("#txtPrimerApellido").val(data.primerApellido);
|
|||
|
|
$("#txtSegundoApellido").val(data.segundoApellido);
|
|||
|
|
$("#txtFechaNacimiento").val(data.fechaNacimiento == null ? "" : moment(data.fechaNacimiento).format("DD/MM/YYYY"));
|
|||
|
|
impostar_tipo_identificacion('Identificacion', data.idTipoIdentificacion);
|
|||
|
|
impostar_identificacion('Identificacion', data.identificacion);
|
|||
|
|
$("#txtPaisNacimiento").val(data.paisNacimiento);
|
|||
|
|
$("#hiddenPaisNacimiento").val(data.idPaisNacimiento);
|
|||
|
|
$("#hiddenNacionalidad").val(data.idNacionalidad);
|
|||
|
|
$("#txtNacionalidad").val(data.nacionalidad);
|
|||
|
|
$("#txtSexo").val(data.sexo);
|
|||
|
|
$("#hiddenSexo").val(data.idSexo);
|
|||
|
|
$("#txtEstadoCivil").val(data.estadoCivil);
|
|||
|
|
$("#hiddenEstadoCivil").val(data.idEstadoCivil);
|
|||
|
|
$("#txtProfesion").val(data.profesion);
|
|||
|
|
$("#hiddenProfesion").val(data.idProfesion);
|
|||
|
|
$("#txtDependientes").val(data.dependientes);
|
|||
|
|
$("#radioResidenteSi").prop("checked", data.residente == true);
|
|||
|
|
$("#radioResidenteNo").prop("checked", data.residente == false);
|
|||
|
|
$("#txtEducacion").val(data.nivelEducacion);
|
|||
|
|
$("#hiddenEducacion").val(data.idNivelEducacion);
|
|||
|
|
$("#txtFechaVencimientoCedula").val(data.fechaVencimientoCedula == null ? "" : moment(data.fechaVencimientoCedula).format("DD/MM/YYYY"));
|
|||
|
|
$("#radioAutoSi").prop("checked", data.tieneAuto == true);
|
|||
|
|
$("#radioAutoNo").prop("checked", data.tieneAuto == false);
|
|||
|
|
$("#txtPlaca").val(data.numeroPlaca);
|
|||
|
|
$("#txtCodGrupoEconomico").val(data.CodGrupoEconomico);
|
|||
|
|
$("#txtProvincia").val(data.provincia);
|
|||
|
|
$("#hiddenProvincia").val(data.idProvincia);
|
|||
|
|
$("#txtCanton").val(data.canton);
|
|||
|
|
$("#hiddenCanton").val(data.idCanton);
|
|||
|
|
$("#txtDistrito").val(data.distrito);
|
|||
|
|
$("#hiddenDistrito").val(data.idDistrito);
|
|||
|
|
|
|||
|
|
$("#txtApartadoPostal").val(data.apartadoPostal);
|
|||
|
|
$("#txtCodigoPostal").val(data.codigoPostal);
|
|||
|
|
$("#txtTelefonoCelular").val(data.telefonoCelular);
|
|||
|
|
$("#txtEmail").val(data.correoElectronico);
|
|||
|
|
$("#txtOtrasSeñas").val(data.direccionExacta);
|
|||
|
|
$("#txtNCasa").val(data.numeroCasaApto);
|
|||
|
|
$("#txtZonaPostal").val(data.zonaPostal);
|
|||
|
|
$("#txtTelefonoResidencia").val(data.telefonoResidencial);
|
|||
|
|
$("#txtFax").val(data.telefonoFax);
|
|||
|
|
$("#txtCondicionVivienda").val(data.CondicionVivienda);
|
|||
|
|
$("#hiddenCondicionVivienda").val(data.idCondicionVivienda);
|
|||
|
|
|
|||
|
|
$("#formDatosGenerales").valid();
|
|||
|
|
$("#formDatosResidenciales").valid();
|
|||
|
|
|
|||
|
|
toastr.success("Integración con Cobis completada satisfactoriamente", Message_Success);
|
|||
|
|
}
|
|||
|
|
else {
|
|||
|
|
toastr.error("Ha ocurrido un error inesperado al realizar la consulta del cliente en cobis. Vuelva a intentarlo mas tarde", Message_Warning);
|
|||
|
|
toastr.error(data.DescripcionRespuesta, Message_Error);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}).fail(function (jqxhr, textStatus, error) {
|
|||
|
|
ENDREQUEST();
|
|||
|
|
toastr.error("Ha ocurrido un error inesperado. Vuelva a intentarlo mas tarde", Message_Error);
|
|||
|
|
}).then(function (value) {
|
|||
|
|
ENDREQUEST();
|
|||
|
|
$("#btnSolicitarInfoCobis").attr('disabled', false);
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
} catch (e) {
|
|||
|
|
toastr.error("Ha ocurrido un error inesperado. Vuelva a intentarlo mas tarde", Message_Error);
|
|||
|
|
$("#btnSolicitarInfoCobis").attr('disabled', false);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
this.CargarDeudasCICParticipante = function () {
|
|||
|
|
|
|||
|
|
try {
|
|||
|
|
var _IdCliente = $("#hiddencl_co_cliente").val();
|
|||
|
|
var _Identificacion = obtener_identificacion('Identificacion');
|
|||
|
|
var _Incidente = $("#hiddenIncident").val();
|
|||
|
|
var _Proceso = $("#hiddenProcess").val();
|
|||
|
|
var _Solicitud = $("#hiddensol_co_solicitud").val();
|
|||
|
|
var _TipoCambio = $("#hiddenTasaTipoCambio").val();
|
|||
|
|
|
|||
|
|
if (_IdCliente == "" || _IdCliente == "0") {
|
|||
|
|
toastr.warning("Estimado usuario debe guardar la información del cliente antes de realizar la integración con el CIC", Message_Warning);
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
var uri = format("api/ReferenciaDeudaAPI/ObtenerDeudasCIC?IdCliente={0}&Identificacion={1}&Incidente={2}&Proceso={3}&IdSolicitud={4}&TipoCambio={5}", _IdCliente, _Identificacion, _Incidente, _Proceso, _Solicitud, _TipoCambio);
|
|||
|
|
|
|||
|
|
$.getJSON(server + uri).done(function (data) {
|
|||
|
|
if (data != null && data.CodigoRespuesta == "EXITOSO") {
|
|||
|
|
|
|||
|
|
//Carga los datos en memoria para enviarlos a almacenar en el boton de guardar
|
|||
|
|
CICDeudasRefinanciar = data.DeudasRefinanciarXmlCIC;
|
|||
|
|
CICFeActualizacion = data.FechaActualizacionCIC;
|
|||
|
|
|
|||
|
|
toastr.success("Integración con el CIC completada satisfactoriamente", Message_Success);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
else if (data.CodigoRespuesta == "ADVERTENCIA") {
|
|||
|
|
toastr.warning(data.DescripcionRespuesta, Message_Warning);
|
|||
|
|
}
|
|||
|
|
else {
|
|||
|
|
toastr.warning(data.DescripcionRespuesta, Message_Warning);
|
|||
|
|
toastr.error("Ha ocurrido un error inesperado. Vuelva a intentarlo mas tarde", Message_Error);
|
|||
|
|
}
|
|||
|
|
}).fail(function (jqxhr, textStatus, error) {
|
|||
|
|
ENDREQUEST();
|
|||
|
|
toastr.error("Ha ocurrido un error inesperado. Vuelva a intentarlo mas tarde", Message_Error);
|
|||
|
|
}).then(function (value) {
|
|||
|
|
ENDREQUEST();
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
} catch (e) {
|
|||
|
|
toastr.error("Ha ocurrido un error inesperado. Vuelva a intentarlo mas tarde", Message_Error);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
this.EvaluarDeudasCICParticipante = function () {
|
|||
|
|
|
|||
|
|
try {
|
|||
|
|
var _IdCliente = $("#hiddencl_co_cliente").val();
|
|||
|
|
var _Identificacion = JsonParticipante.identificacion;
|
|||
|
|
var _Incidente = $("#hiddenIncident").val();
|
|||
|
|
var _Proceso = $("#hiddenProcess").val();
|
|||
|
|
var _Solicitud = $("#hiddensol_co_solicitud").val();
|
|||
|
|
var _Modo = "1";
|
|||
|
|
var _Juicios = "";
|
|||
|
|
var _MalasReferencias = "";
|
|||
|
|
|
|||
|
|
var uri = format("api/ReferenciaDeudaAPI/EvaluarDeudasCIC?IdCliente={0}&Identificacion={1}&Incidente={2}&Proceso={3}&IdSolicitud={4}&Modo={5}&Juicios={6}&MalasReferencias={7}", _IdCliente, _Identificacion, _Incidente, _Proceso, _Solicitud, _Modo, _Juicios, _MalasReferencias);
|
|||
|
|
|
|||
|
|
$.getJSON(server + uri).done(function (data) {
|
|||
|
|
if (data != null && data.CodigoRespuesta == "EXITOSO") {
|
|||
|
|
|
|||
|
|
|
|||
|
|
switch (data.ResultadoEvaluacionCIC.trim()) {
|
|||
|
|
case "0":
|
|||
|
|
$("#hiddenResultadoEvaluacionCIC").val("0");
|
|||
|
|
$("#txtResultadoEvaluacionCIC").val("CLIENTE NO ES EXCELENTE CIC");
|
|||
|
|
break;
|
|||
|
|
case "1":
|
|||
|
|
$("#hiddenResultadoEvaluacionCIC").val("1")
|
|||
|
|
$("#txtResultadoEvaluacionCIC").val("CLIENTE CON EXCELENTE CIC");
|
|||
|
|
break;
|
|||
|
|
default:
|
|||
|
|
$("#txtResultadoEvaluacionCIC").val("RESULTADO EVALUACION CIC INCORRECTO:[" + data.ResultadoEvaluacionCIC.trim() + "]");
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
toastr.success("Evaluación de las deudas del CIC completada satisfactoriamente", Message_Success);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
else if (data.CodigoRespuesta == "ADVERTENCIA") {
|
|||
|
|
toastr.warning(data.DescripcionRespuesta, Message_Warning);
|
|||
|
|
}
|
|||
|
|
else {
|
|||
|
|
toastr.error("Ha ocurrido un error inesperado. Vuelva a intentarlo mas tarde", Message_Error);
|
|||
|
|
}
|
|||
|
|
}).fail(function (jqxhr, textStatus, error) {
|
|||
|
|
ENDREQUEST();
|
|||
|
|
toastr.error("Ha ocurrido un error inesperado. Vuelva a intentarlo mas tarde", Message_Error);
|
|||
|
|
}).then(function (value) {
|
|||
|
|
ENDREQUEST();
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
} catch (e) {
|
|||
|
|
toastr.error("Ha ocurrido un error inesperado. Vuelva a intentarlo mas tarde", Message_Error);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
this.ObtenerInformacionCliente = function () {
|
|||
|
|
|
|||
|
|
try {
|
|||
|
|
var tipoBusqueda = $("#radioTipoPersonaJuridica").is(":checked") ? "Juridica" : "Fisica";
|
|||
|
|
var cedula = $("#radioTipoPersonaJuridica").is(":checked") ? $("#txtCedulaJuridica").val() : obtener_identificacion('Identificacion');
|
|||
|
|
var idTipoIdentificacion = obtener_tipo_identificacion('Identificacion');
|
|||
|
|
|
|||
|
|
var uri = format("api/SolicitanteAPI/ObtenerInformacionCliente?tipoBusqueda={0}&cedula={1}&idTipoIdentificacion={2}", tipoBusqueda, cedula, idTipoIdentificacion);
|
|||
|
|
|
|||
|
|
$.getJSON(server + uri).done(function (data) {
|
|||
|
|
if (data != null && data.CodigoRespuesta == "EXITOSO") {
|
|||
|
|
|
|||
|
|
if ($("#radioTipoPersonaJuridica").is(":checked")) {
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
else {
|
|||
|
|
$("#txtNombre").val(data.PrimerNombre);
|
|||
|
|
$("#txtSegundoNombre").val(data.SegundoNombre);
|
|||
|
|
$("#txtPrimerApellido").val(data.PrimerApellido);
|
|||
|
|
$("#txtSegundoApellido").val(data.SegundoApellido);
|
|||
|
|
$("#txtPaisNacimiento").val(data.lugarNacimiento == null ? "" : data.lugarNacimiento.Pais);
|
|||
|
|
$("#hiddenPaisNacimiento").val(data.lugarNacimiento == null ? "" : data.lugarNacimiento.IdNacionalidad);
|
|||
|
|
$("#txtFechaNacimiento").val(data.FechaNacimiento);
|
|||
|
|
$("#txtFechaVencimientoCedula").val(data.FechaExpiracionCedula);
|
|||
|
|
$("#txtSexo").val(data.genero == null ? "" : data.genero.Descripcion);
|
|||
|
|
$("#hiddenSexo").val(data.genero == null ? "" : data.genero.IdGenero);
|
|||
|
|
$("#hiddenNacionalidad").val(data.nacionalidad == null ? "" : data.nacionalidad.IdNacionalidad);
|
|||
|
|
$("#txtNacionalidad").val(data.nacionalidad == null ? "" : data.nacionalidad.Descripcion);
|
|||
|
|
$("#txtDependientes").val(data.Dependientes);
|
|||
|
|
$("#txtEstadoCivil").val(data.estadoCivil == null ? "" : data.estadoCivil.Descripcion);
|
|||
|
|
$("#hiddenEstadoCivil").val(data.estadoCivil == null ? "" : data.estadoCivil.IdEstadoCivil);
|
|||
|
|
|
|||
|
|
|
|||
|
|
$("#txtTelefonoCelular").val(data.telefonoCelular);
|
|||
|
|
$("#txtTelefonoResidencia").val(data.telefonoResidencial);
|
|||
|
|
|
|||
|
|
$("#txtProvincia").val(data.provincia == null ? "" : data.provincia.Descripcion);
|
|||
|
|
$("#hiddenProvincia").val(data.provincia == null ? "" : data.provincia.IdProvincia);
|
|||
|
|
$("#txtCanton").val(data.canton == null ? "" : data.canton.Descripcion);
|
|||
|
|
$("#hiddenCanton").val(data.canton == null ? "" : data.canton.IdCanton);
|
|||
|
|
$("#txtDistrito").val(data.distrito == null ? "" : data.distrito.Descripcion);
|
|||
|
|
$("#hiddenDistrito").val(data.distrito == null ? "" : data.distrito.IdDistrito);
|
|||
|
|
$("#txtOtrasSeñas").val(data.direccion);
|
|||
|
|
|
|||
|
|
$("#formDatosGenerales").valid();
|
|||
|
|
$("#formDatosResidenciales").valid();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
toastr.success("Integración con Base de Datos Interna completada satisfactoriamente", Message_Success);
|
|||
|
|
}
|
|||
|
|
else if (data.CodigoRespuesta == "ADVERTENCIA") {
|
|||
|
|
toastr.warning(data.DescripcionRespuesta, Message_Warning);
|
|||
|
|
}
|
|||
|
|
else {
|
|||
|
|
toastr.error("Ha ocurrido un error inesperado. Vuelva a intentarlo mas tarde", Message_Error);
|
|||
|
|
}
|
|||
|
|
}).fail(function (jqxhr, textStatus, error) {
|
|||
|
|
ENDREQUEST();
|
|||
|
|
toastr.error("Ha ocurrido un error inesperado. Vuelva a intentarlo mas tarde", Message_Error);
|
|||
|
|
}).then(function (value) {
|
|||
|
|
ENDREQUEST();
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
} catch (e) {
|
|||
|
|
toastr.error("Ha ocurrido un error inesperado al intentar invocar el método de consulta de información del cliente. Vuelva a intentarlo mas tarde", Message_Error);
|
|||
|
|
}
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
this.LimpiarPersonaJuridica = function () {
|
|||
|
|
|
|||
|
|
$("#txtNombreEmpresa").val("");
|
|||
|
|
$("#txtCapitalSocial").val("0");
|
|||
|
|
$("#txtActividadEmpresa").val("");
|
|||
|
|
$("#txtFechaVencimiento").val("");
|
|||
|
|
$("#txtNombreRepresentanteLegal").val("");
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
this.LimpiarPersonaNatural = function () {
|
|||
|
|
$("#txtNombre").val("");
|
|||
|
|
$("#txtSegundoNombre").val("");
|
|||
|
|
$("#txtPrimerApellido").val("");
|
|||
|
|
$("#txtSegundoApellido").val("");
|
|||
|
|
$("#txtFechaNacimiento").val("");
|
|||
|
|
impostar_tipo_identificacion('Identificacion', "");
|
|||
|
|
impostar_identificacion('Identificacion', "");
|
|||
|
|
$("#txtPaisNacimiento").val("");
|
|||
|
|
$("#hiddenPaisNacimiento").val("");
|
|||
|
|
$("#hiddenNacionalidad").val("");
|
|||
|
|
$("#txtNacionalidad").val("");
|
|||
|
|
$("#txtSexo").val("");
|
|||
|
|
$("#hiddenSexo").val("");
|
|||
|
|
$("#txtEstadoCivil").val("");
|
|||
|
|
$("#hiddenEstadoCivil").val("");
|
|||
|
|
$("#txtProfesion").val("");
|
|||
|
|
$("#hiddenProfesion").val("");
|
|||
|
|
$("#txtDependientes").val("");
|
|||
|
|
$("#radioResidenteSi").prop("checked", true);
|
|||
|
|
$("#radioResidenteNo").prop("checked", false);
|
|||
|
|
$("#txtEducacion").val("");
|
|||
|
|
$("#hiddenEducacion").val("");
|
|||
|
|
$("#txtFechaVencimientoCedula").val("");
|
|||
|
|
$("#radioAutoSi").prop("checked", true);
|
|||
|
|
$("#radioAutoNo").prop("checked", false);
|
|||
|
|
$("#txtPlaca").val("");
|
|||
|
|
$("#txtCodGrupoEconomico").val("");
|
|||
|
|
$("#txtProvincia").val("");
|
|||
|
|
$("#hiddenProvincia").val("");
|
|||
|
|
$("#txtCanton").val("");
|
|||
|
|
$("#hiddenCanton").val("");
|
|||
|
|
$("#txtDistrito").val("");
|
|||
|
|
$("#hiddenDistrito").val("");
|
|||
|
|
|
|||
|
|
$("#txtApartadoPostal").val("");
|
|||
|
|
$("#txtCodigoPostal").val("");
|
|||
|
|
$("#txtTelefonoCelular").val("");
|
|||
|
|
$("#txtEmail").val("");
|
|||
|
|
$("#txtOtrasSeñas").val("");
|
|||
|
|
$("#txtNCasa").val("");
|
|||
|
|
$("#txtZonaPostal").val("");
|
|||
|
|
$("#txtTelefonoResidencia").val("");
|
|||
|
|
$("#txtFax").val("");
|
|||
|
|
$("#txtCondicionVivienda").val("");
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
this.DataCatalogo = function (SelectedCatalog, data) {
|
|||
|
|
try {
|
|||
|
|
if (data != null) {
|
|||
|
|
switch (SelectedCatalog) {
|
|||
|
|
case "EstadoCivil":
|
|||
|
|
OnchangeEstadoCivil(data.codigo);
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
} catch (e) {
|
|||
|
|
toastr.warning("Ha ocurrido un error inesperado al establecer el valor seleccionado.");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
this.OnchangeEstadoCivil = function (data) {
|
|||
|
|
switch (data) {
|
|||
|
|
case "C":
|
|||
|
|
case "D":
|
|||
|
|
case "V":
|
|||
|
|
$("#divCantidadVecesEstadoCivil").show();
|
|||
|
|
$("#txtCantidadVecesEstadoCivil").show();
|
|||
|
|
$("#txtCantidadVecesEstadoCivil").required();
|
|||
|
|
break;
|
|||
|
|
default:
|
|||
|
|
$("#divCantidadVecesEstadoCivil").hide();
|
|||
|
|
$("#txtCantidadVecesEstadoCivil").hide();
|
|||
|
|
$("#txtCantidadVecesEstadoCivil").noRequired();
|
|||
|
|
$("#txtCantidadVecesEstadoCivil").val("");
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
}
|