/*
* Modificado
* Autor: Rodrigo Sobrero
* Fecha: 04/08/2016
*/
var oPolizaBusq = oPolizaBusq || {};
var oPolizaDatosGral = oPolizaDatosGral || {};
var oConsultaSiniestro = oConsultaSiniestro || {};
var oCartasReclamos = oCartasReclamos || {};
oCartasReclamos.nYaSeleccionado = '';
oCartasReclamos.polizaSeleccionada = '';
// LISTADO GO - OR - PR
oCartasReclamos.listadoCartasReclamos = function() {
"use strict";
oGen.fnBloqueaShow();
$("#divDatosConsultaCartaReclamo").show();
console.log('1.Global.productor.NIVEL', oGlobal.productor);
oConsulta.show({
consulta : "OV_CONSULTA_CARRECTOTALES",
dataSource : "ovQbe",
titulo : "Cartas de Reclamos",
// estilo : "grillaSmall",
idComponente : "divDatosTotalesCartaReclamo",
paramsDefault : {
prm_usuarcod : oGlobal.cUsuario,
prm_nivelclas : oGlobal.productor.NIVEL,
prm_cliensecas : oGlobal.productor.CLIENSEC
},
groupFields : [ "CL1", "CL2" ],
groupNull : "0",
fnCallback : function(row, nCol) {
if (nCol === 6) {
oCartasReclamos.detallesCartasReclamos(row);
}
},
rowStyle : function(reg, idx) {
if (reg.VIGENTE != '0') {
return {
classes : 'error'
};
}
return {};
}
});
};
// DETALLE DE CARTAS
oCartasReclamos.detallesCartasReclamos = function(row) {
oGen.fnBloqueaShow();
oGen.goHistory('divDatosConsultaDetContCartaReclamo');
var CL1 = "", CL2 = "", CL3 = "", NI1 = "", NI2 = "", NI3 = "";
console.log('2.oGlobal.productor.NIVEL', oGlobal.productor);
// oGlobal.productor.NIVEL !== "" &&
if (row === undefined) {
CL1 = "0";
CL2 = "0";
CL3 = '0';
NI1 = "";
NI2 = "";
NI3 = "";
} else {
if (oGlobal.productor.NIVEL !== "PR") {
if (row.CL1 !== "0") {
CL1 = row.CL1;
}
if (row.CL2 !== "0") {
CL2 = row.CL2;
}
if (row.CL3 !== "0") {
CL3 = row.CL3;
}
NI1 = row.NI1 === undefined ? "" : row.NI1;
NI2 = row.NI2 === undefined ? "" : row.NI2;
NI3 = row.NI3 === undefined ? "" : row.NI3;
oGen.goHistory("divDatosConsultaDetContCartaReclamo");
} else {
CL1 = "0";
CL2 = "0";
CL3 = oGlobal.productor.CLIENSEC;
NI1 = "";
NI2 = "";
NI3 = "PR";
$("#btnVolver").hide();
}
}
/*
* var CL1 = '', CL2 = '', CL3 = '', NI1 = '0', NI2 = '0', NI3 = '0'; if
* (oGlobal.productor.NIVEL != 'PR') { if (row.CL1 != 0) { CL1 = row.CL1; }
* if (row.CL2 != 0) { CL2 = row.CL2; } if (row.CL3 != 0) { CL3 = row.CL3; }
* oGen.goHistory('divDatosConsultaDetContCartaReclamo'); } else { CL1 =
* '0'; CL2 = '0'; CL3 = oGlobal.productor.CLIENSEC; NI1 = '0'; NI2 = '0';
* NI3 = 'PR'; $("#btnVolver").hide(); }
*/
console.log('3.oGlobal.productor.NIVEL', oGlobal.productor);
oCartasReclamos.paramsDefault = {
prm_funcion : "pamqsolo.cartasrecladetalle",
prm_usuarcod : oGlobal.cUsuario,
prm_nivelas : oGlobal.productor.NIVEL,
prm_cliensecas : oGlobal.productor.CLIENSEC,
prm_NIVEL1 : NI1,
prm_CLIENSEC1 : CL1,
prm_NIVEL2 : NI2,
prm_CLIENSEC2 : CL2,
prm_NIVEL3 : NI3,
prm_CLIENSEC3 : CL3,
prm_CONTINUAR : ''
};
oGen
.fnGetStore({
titulo : "Estructura Administrativa",
params : {
prm_dataSource : "ovQbe",
prm_funcion : "pamqsolo.cartasrecladetalle",
prm_usuarcod : oGlobal.cUsuario,
prm_nivelas : oGlobal.productor.NIVEL,
prm_cliensecas : oGlobal.productor.CLIENSEC,
prm_NIVEL1 : NI1,
prm_CLIENSEC1 : CL1,
prm_NIVEL2 : NI2,
prm_CLIENSEC2 : CL2,
prm_NIVEL3 : NI3,
prm_CLIENSEC3 : CL3,
prm_CONTINUAR : ''
},
fnCallback : function(oResp) {
if (oResp.records.length > 1 || typeof oResp.records[0].IMP != 'undefined') {
var ConsultaStyle = (oSalesForce.ORIGEN !== 'SALESFORCE'? 'oConsulta.fnCursorPointer': 'color:black');
oConsulta.show({
consulta : "OV_CONSULTA_DETALLECARREC",
dataSource : "ovQbe",
titulo : "Detalle de Carta de Reclamo",
idComponente : "divDatosConsultaDetCartaReclamo",
exportar : true,
estilo : "grillaSmall",
paramsDefault : oCartasReclamos.paramsDefault,
fnCallback : function(row, nCol) {
// if (nCol === 0 || nCol == 1 || nCol == 5) {
if (nCol === 0 || nCol === 1) {
oCartasReclamos.resumenPoliza(row);
}
if (nCol === 5 && row.SINI === "S") {
oPolizaBusq.sCliDes = row.CLIDES;
oPolizaBusq.sRamopCod = row.PROD;
oPolizaBusq.sPol = row.POL;
oPolizaBusq.sPolizAnn = row.POL.slice(0, 2);
oPolizaBusq.sPolizSec = row.POL.slice(2, 8);
oPolizaBusq.sCertiPol = row.CERPOL;
oPolizaBusq.sCertiAnn = row.CERANN;
oPolizaBusq.sCertiSec = row.CERSEC;
oPolizaBusq.sSupleNums = "";
oPolizaBusq.sRamo = row.RAMO;
oPolizaBusq.sEstado = "";
if (oSalesForce.ORIGEN !== 'SALESFORCE') {
oGen.fnCargaFormulario({
formulario : "ovQbe_polizaDatosGral",
idComponente : "polizaContainer",
fnCallback : function() {
oPolizaDatosGral.initialize("siniestros");
}
}, "quoteContainer");
}
}
if (nCol === 6) {
oCartasReclamos.fnRecibosCartaReclamo(row);
}
},
columnStyle : [ {
CNOMBRECAMPO : 'CLIDES',
style : ConsultaStyle
}, {
CNOMBRECAMPO : 'POLIZA',
style : ConsultaStyle
} ],
rowStyle : function(reg, idx) {
if (reg.VIGENTE != '0' && typeof reg.VIGENTE != 'undefined') {
return {
classes : 'error'
};
}
return {};
}
});
} else {
var htmlError = "
Nombre y Apellido / Razón Social | Número de Poliza | Fecha de Envio | Total Reclamado | Cod. Prod. |
---|
No se encontraron registros |
";
$('#divDatosConsultaDetCartaReclamo').html(htmlError);
oGen.fnBloqueaHide();
}
if (oGlobal.productor.NIVEL == 'PR') {
$('#btnVolverDetCont').show();
$('#btnVolverDetCont').on('click', function() {
window.history.back();
});
}
}
});
};
// RECIBOS DE CARTAS DE RECLAMOS
oCartasReclamos.fnRecibosCartaReclamo = function(row) {
$('#SectionResultado .title h4').html('Detalle según carta emitida el ' + row.FECENV);
$('#SectionResultado .title h4').show();
oCartasReclamos.nYaSeleccionado = row.CLIDES;
oCartasReclamos.polizaSeleccionada = oCartasReclamos.armaNumeroPoliza('', row);
$('#nyaRecibos').html(oCartasReclamos.nYaSeleccionado);
$('#polNumRecibos').html(oCartasReclamos.polizaSeleccionada);
$("#datosRecibo").show();
oGen.goHistory('datosRecibo');
$('#btnVolver').show();
oConsulta.show({
consulta : "OV_CONSULTA_CARRECRECIBOS",
dataSource : "ovQbe",
titulo : "Detalle de Carta de Reclamo",
idComponente : "consultaDetCartaReclamo",
exportar : true,
estilo : "grillaSmall",
paramsDefault : {
prm_USUARIO : oGlobal.cUsuario,
prm_PRODUCTO : row.PROD,
prm_POLIZA : row.POL + row.CERPOL + row.CERANN + row.CERSEC,
prm_FECENVIO : row.FECENV
},
fnCallback : function(row, nCol) {
},
rowStyle : function(reg, idx) {
if (typeof reg.VIGENTE != 'undefined' && reg.VIGENTE != '0') {
return {
classes : 'error'
};
}
return {};
}
});
};
// FUNCIONES PARA UNIR CAMPOS
oCartasReclamos.concero = 0;
oCartasReclamos.sincero = 0;
oCartasReclamos.juntaSignoValor1 = function(a, b) {
if (b.TOTALPOL != '0' || b.TOTALS1 != '0,00' || b.TOTALS2 != '0,00') {
oCartasReclamos.sincero++;
} else {
oCartasReclamos.concero++;
}
if (typeof b.SIGNO1 != 'undefined' && b.SIGNO1 == '-') {
return b.SIGNO1 + b.TOTALS1;
} else {
return b.TOTALS1;
}
};
oCartasReclamos.juntaSignoValor2 = function(a, b) {
if (typeof b.SIGNO2 != 'undefined' && b.SIGNO2 == '-') {
return b.SIGNO2 + b.TOTALS2;
} else {
return b.TOTALS2;
}
};
oCartasReclamos.juntaSignoValor3 = function(a, b) {
if (typeof b.SIG != 'undefined' && b.SIG == '-') {
return b.MON + ' ' + b.SIG + b.IMP;
} else {
return b.MON + ' ' + b.IMP;
}
};
oCartasReclamos.juntaTotalReclamado = function(a, b) {
// MON + IMP
return b.MON + ' ' + b.IMP;
};
// BOTONES DE LISTADOS
oCartasReclamos.btnDetalles = function(a, b) {
var sBoton = "";
// if(b.TOTALPOL != "0" || b.TOTALS1 != "0,00" || b.TOTALS2 != "0,00"){
sBoton = "";
// }
return sBoton;
};
oCartasReclamos.btnAlertaSiniestro = function(a, row) {
var boton = "";
if (row.SINI == 'S') {
boton = "";
boton += "";
boton += '';
}
return boton;
};
oConsultaSiniestro.fnBtnSiniDet = function() {
return '';
};
// FORMATO DE POLIZA
oCartasReclamos.armaNumeroPoliza = function(a, row) {
var numPoliza = '';
if (typeof row.PROD != 'undefined' && typeof row.POL != 'undefined') {
var n1 = row.PROD;
var n2 = row.POL.substring(0, 2);
var n3 = row.POL.substring(2, 8);
numPoliza += n1 + '-' + n2 + '-' + n3;
}
if (typeof row.CERANN != 'undefined' && typeof row.CERSEC != 'undefined') {
var n4 = row.CERANN;
var n5 = row.CERSEC;
if (n4 != '0000' || n5 != '000000') {
numPoliza += ' / ' + n4 + n5;
}
;
}
return numPoliza.toString();
};
oPolizaDatosGral.fnSiniPoli = function(val, reg, idx) {
"use strict";
var sNroPoliza = "", sRamopCod = String(reg.RAMO), sProd = String(reg.PROD), sPoliz = String(reg.POL),
// sCertiPol = String(reg.CERPOL),
sCertiAnn = String(reg.CERANN), sCertiSec = String(reg.CERSEC);
if (sRamopCod === "1") {
sNroPoliza = sProd + "-" + sPoliz.slice(0, 2) + "-" + sPoliz.slice(2, 8) + " / " + sCertiAnn + sCertiSec;
} else if (sRamopCod === "2") {
sNroPoliza = sProd + "-" + sPoliz.slice(0, 2) + "-" + sPoliz.slice(2, 8);
}
return sNroPoliza;
};
// FUNCIONES POPUP
oCartasReclamos.datosResumenPoliza = function(reg) {
/** YA NO SE USA! * */
var HTML = '', nroPoliza = '';
if (reg.CERSEC === "000000") {
nroPoliza = reg.PROD + "-" + reg.POL.substr(0, 2) + "-" + reg.POL.substr(2);
} else {
nroPoliza = reg.PROD + "-" + reg.POL.substr(0, 2) + "-" + reg.POL.substr(2) + " / " + reg.CERPOL + "-" + reg.CERANN + "-" + reg.CERSEC;
}
oGen.fnGetStore({
titulo : "Detalle de Póliza",
params : {
prm_dataSource : "ovQbe",
prm_funcion : "paconsultamq.datosgralpoliza",
prm_ramopcod : reg.PROD,
prm_polizann : reg.POL.substr(0, 2),
prm_polizsec : reg.POL.substr(2),
prm_certipol : reg.CERPOL,
prm_certiann : reg.CERANN,
prm_certisec : reg.CERSEC,
prm_suplenum : ""
},
fnCallback : function(oResp) {
$.each(oResp.records, function(item, reg) {
HTML += "";
HTML += " Nombre y Apellido/Razón Social | " + reg.CLIENDES + " |
";
HTML += " Número de Póliza | " + nroPoliza + " |
";
HTML += " Fecha Inicio | " + reg.FECINI + " |
";
HTML += " Canal de Cobro | " + reg.COBRODAB + " |
";
HTML += " Tipo de Cuenta | " + reg.COBRODES + " |
";
if (typeof reg.CAMPADES != 'undefined') {
HTML += " Campaña | " + reg.CAMPADES + " |
";
}
HTML += " Estado | " + reg.SITUCPOL + " |
";
HTML += " Acreedor Prendario Hipotecario | " + reg.ACREEDOR + " |
";
HTML += " Fecha Última Renovación | " + reg.FECULTRE + " |
";
if (typeof reg.CUENTNUM != 'undefined') {
HTML += " Número de Cuenta | " + reg.CUENTNUM + " |
";
}
HTML += " Grupo Afinidad | " + reg.GRUPOASE + " |
";
HTML += "
";
});
MessageAlert.messagePopup("Detalle de poliza", HTML);
}
});
};
oCartasReclamos.datosCliente = function(reg) {
/** YA NO SE USA! * */
oGen.fnGetStore({
titulo : "Detalle de Cliente",
params : {
prm_dataSource : "ovQbe",
prm_funcion : "pamqsolo.datosgralcliente",
prm_usuario : oGlobal.cUsuario,
prm_producto : reg.PROD,
prm_poliza : reg.POL,
prm_certi : reg.CERPOL + reg.CERANN + reg.CERSEC
},
fnCallback : function(oResp) {
var HTML = '', HTML_CTO = 'Medios de Contacto
', flag = 0;
HTML_CTO += '';
HTML_CTO += 'Descripcion | Medio |
';
$.each(oResp.records, function(item, reg) {
while (flag === 0) {
HTML += "";
if (typeof reg.NACIONALI != 'undefined') {
HTML += " Nacionalidad | " + reg.NACIONALI + " |
";
}
if (reg.FECNAC !== "00/00/0000" || reg.FECNAC !== undefined) {
HTML += " Fecha de Nacimiento | " + reg.FECNAC + " |
";
}
if (typeof reg.FUMADOR != 'undefined') {
HTML += " Fumador | " + reg.FUMADOR + " |
";
}
HTML += " Domicilio | " + reg.CALLEPART + " |
";
HTML += " Localidad | " + reg.LOCALPART + " |
";
HTML += " Tipo de Documento | " + reg.TIPODOCU + " |
";
HTML += " Número de Documento | " + reg.NUMEDOCU + " |
";
if (typeof reg.SEXO != 'undefined') {
HTML += " Sexo | " + reg.SEXO + " |
";
}
if (typeof reg.ESTCIVIL != 'undefined') {
HTML += " Estado Civil | " + reg.ESTCIVIL + " |
";
}
HTML += " Código Postal | " + reg.CPOPART + " |
";
HTML += " Provincia | " + reg.PROVPART + " |
";
HTML += "
";
flag = 1;
}
HTML_CTO += '' + reg.CON_DESCRIPCION + ' | ' + reg.CON_DATOCONT + ' |
';
});
MessageAlert.messagePopup("Datos del cliente", HTML + HTML_CTO);
}
});
};
oCartasReclamos.resumenPoliza = function(row) {
oPolizaBusq.sRamopCod = row.PROD;
oPolizaBusq.sPol = row.POL;
oPolizaBusq.sPolizAnn = row.POL.slice(0, 2);
oPolizaBusq.sPolizSec = row.POL.slice(2);
oPolizaBusq.sCertiPol = row.CERPOL;
oPolizaBusq.sCertiAnn = row.CERANN;
oPolizaBusq.sCertiSec = row.CERSEC;
oPolizaBusq.sSupleNums = "";
if (oSalesForce.ORIGEN !== 'SALESFORCE') {
oGen.fnCargaFormulario({
formulario : "ovQbe_polizaDatosGral",
idComponente : "detailContainer",
fnCallback : function() {
oPolizaDatosGral.initialize();
}
}, "quoteContainer");
}
};
oCartasReclamos.fnPrticualirdadesSF = function () {
if (oSalesForce.ORIGEN === 'SALESFORCE') {
$('#botonCR_volver01').hide();
$('#btnVolverDetCont').hide();
}
}
// Carga al finalizar el header
oGlobal.initialize = function() {
oGen.fnBtnPermisoUsuario({
funcionProd : 'oCartasReclamos.detallesCartasReclamos();',
funcionNoProd : 'oCartasReclamos.listadoCartasReclamos();'
});
};
// READY
$(document).ready(function() {
oSalesForce.fnObtenerParametrosOrigen("Carta de Reclamos", oCartasReclamos.fnPrticualirdadesSF);
$("#divDatosConsultaCartaReclamo").hide();
$("#divDatosConsultaDetContCartaReclamo").hide();
$("#datosRecibo").hide();
//MTRIPODI 16/2/2022 Nuevo Volver desde SalesForce.
if (oSalesForce.ORIGEN === 'SALESFORCE')
$("#btnVolverDetCont").attr("onclick", "window.history.back()");
else
$("#btnVolverDetCont").attr("onclick", "oGen.goBack()");
});