var oPolizaBusq = oPolizaBusq || {};
var oPolizaDatosGral = oPolizaDatosGral || {};
var oConsultaSiniestro = oConsultaSiniestro || {};
var oAnuladasXFP = oAnuladasXFP || {};
var oCartasReclamos = oCartasReclamos || {};
// LISTADO GO - OR - PR
oAnuladasXFP.listadoAnulaciones = function(){
"use strict";
oGen.fnBloqueaShow();
$("#divDatosConsulta").show();
oConsulta.show({
consulta: "OV_CONSULTA_ANULACIONESTOTALES",
dataSource: "ovQbe",
titulo: "Polizas anuladas por falta de pago",
idComponente: "divDatosConsulta",
estilo: "grillaSmall",
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 === 5) {
oAnuladasXFP.detallesAnulacionPorPago(row);
}
},
rowStyle : function(reg, idx){
if(reg.VIGENTE != '0'){
return {
classes: 'error'
}
}
return {};
}
});
oAnuladasXFP.fnBtnVolver(true);
};
// DETALLE DE ANULACION
oAnuladasXFP.detallesAnulacionPorPago = function(row){
oGen.fnBloqueaShow();
oAnuladasXFP.detalleSeleccionado = row;
var CL1 = '', CL2 = '', CL3 = '', NI1 = '', NI2 = '', NI3 = '';
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;}
if(typeof row.NI1 != 'undefined'){var NI1 = row.NI1;}
if(typeof row.NI2 != 'undefined'){var NI2 = row.NI2;}
if(typeof row.NI3 != 'undefined'){var NI3 = row.NI3;}
oGen.goHistory('divDatosConsultaDetCont');
}else{
CL1 = '0';
CL2 = '0';
CL3 = oGlobal.productor.CLIENSEC;
NI3 = 'PR';
//$("#btnVolver").hide();
$("#btnImprimir").hide();
}
}
$('#contContenido').html('');
$("#divDatosConsultaDetCont").show();
var ConsultaStyle = (oSalesForce.ORIGEN !== 'SALESFORCE'? 'oConsulta.fnCursorPointer': 'color:black');
oConsulta.show({
consulta: "OV_CONSULTA_ANULXPAGODETALLES",
dataSource: "ovQbe",
titulo: "Polizas anuladas por falta de pago",
idComponente: "divDatosConsultaDet",
exportar : true,
estilo: "grillaSmall",
paramsDefault: {
prm_USUARIO: 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
},
columnStyle : [ {
CNOMBRECAMPO : 'POLIZA',
style : ConsultaStyle
},{
CNOMBRECAMPO : 'CLIDES',
style : ConsultaStyle
} ],
fnCallback: function (row, nCol) {
if (nCol < 2) {
oAnuladasXFP.resumenPoliza(row);
}
if (nCol === 4 || nCol === 5) {
oAnuladasXFP.resumenPoliza(row);
}
},
rowStyle : function(reg, idx){
/* console.log('REG!',reg);
if(reg.VIGENTE != '0'){
return {
classes: 'error'
}
} */
return {};
}
});
$('#btnImprimir').show();
};
// FUNCIONES PARA UNIR CAMPOS
oAnuladasXFP.juntaSignoValor1 = function(a,b){
if(typeof b.SIGNO1 != 'undefined'){
return b.SIGNO1 + b.TOTALS1;
}else{
return b.TOTALS1;
}
}
oAnuladasXFP.juntaSignoValor2 = function(a,b){
if(typeof b.SIGNO2 != 'undefined'){
return b.SIGNO2 + b.TOTALS2;
}else{
return b.TOTALS2;
}
}
// BOTONES DE LISTADOS
oAnuladasXFP.btnDetalles = function(){
var sBoton = "";
return sBoton;
};
oAnuladasXFP.btnAlertaSiniestro = function(a, row){
var boton = "";
if(row.SINI == 'S'){
boton = "";
boton += "";
boton += '';
}
return boton;
};
oConsultaSiniestro.fnBtnSiniPDF = function (val, reg, idx) {
"use strict";
var sBoton = "";
return sBoton;
};
oConsultaSiniestro.fnBtnSiniDet = function(){
return '';
};
// FORMATO DE POLIZA
oAnuladasXFP.armaNumeroPoliza = function(a, row){
if(typeof row.PROD != 'undefined' && typeof row.POL != 'undefined' && typeof row.CERANN != 'undefined' && typeof row.CERSEC != 'undefined'){
var n1 = row.PROD;
var n2 = row.POL.substring(0, 2);
var n3 = row.POL.substring(2, 8);
var n4 = row.CERANN;
var n5 = row.CERSEC;
var n6 = row.CERPOL;
var numPoliza = n1+'-'+n2+'-'+n3+' / '+n6+"-"+n4+"-"+n5;
}else{
var numPoliza = '';
}
return numPoliza;
};
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") {
return sNroPoliza = sProd + "-" + sPoliz.slice(0, 2) + "-" + sPoliz.slice(2, 8) + " / " +sCertiPol + "-" + sCertiAnn + "-" + sCertiSec;
} else if (sRamopCod === "2") {
return sNroPoliza = sProd + "-" + sPoliz.slice(0, 2) + "-" + sPoliz.slice(2, 8);
}
};
// FUNCIONES POPUP
oAnuladasXFP.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");
}
};
oAnuladasXFP.datosResumenPoliza = function(row){
/** 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);
}
});
};
oAnuladasXFP.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);
}
});
}
oAnuladasXFP.muestraInfoSiniestro = function(row){
/** YA NO SE USA! **/
oConsulta.show({
consulta: "OV_CONSULTA_SINI",
dataSource: "ovQbe",
titulo: "Detalle de Siniestros",
exportar: false,
estilo: "grillaSmall",
paramsDefault: {
prm_usuario : oGlobal.cUsuario,
prm_nivelas: oGlobal.productor.NIVEL,
prm_cliensecas: oGlobal.productor.CLIENSEC,
prm_documtip: "",
prm_documnro: "",
prm_cliendes: "",
prm_producto: row.PROD,
prm_poliza: row.POL,
prm_certi: row.CERPOL + row.CERANN + row.CERSEC,
prm_patente: "",
prm_sinian: "",
prm_sininum: "",
prm_msgest: "",
prm_continuar: ""
}
});
};
// IMPRIMIR LISTADO
oAnuladasXFP.fnImprimeListado = function(){
var CL1 = '', CL2 = '', CL3 = '', NI1 = '', NI2 = '', NI3 = '';
if(oGlobal.productor.NIVEL != 'PR'){
if(oAnuladasXFP.detalleSeleccionado.CL1 != 0){CL1 = oAnuladasXFP.detalleSeleccionado.CL1;}
if(oAnuladasXFP.detalleSeleccionado.CL2 != 0){CL2 = oAnuladasXFP.detalleSeleccionado.CL2;}
if(oAnuladasXFP.detalleSeleccionado.CL3 != 0){CL3 = oAnuladasXFP.detalleSeleccionado.CL3;}
if(typeof oAnuladasXFP.detalleSeleccionado.NI1 != 'undefined'){var NI1 = oAnuladasXFP.detalleSeleccionado.NI1;}
if(typeof oAnuladasXFP.detalleSeleccionado.NI2 != 'undefined'){var NI2 = oAnuladasXFP.detalleSeleccionado.NI2;}
if(typeof oAnuladasXFP.detalleSeleccionado.NI3 != 'undefined'){var NI3 = oAnuladasXFP.detalleSeleccionado.NI3;}
oGen.goHistory('divDatosConsultaDetCont');
}else{
CL1 = '0';
CL2 = '0';
CL3 = oGlobal.productor.CLIENSEC;
NI3 = 'PR';
$("#btnVolver").hide();
//$("#btnImprimir").hide();
}
oAnuladasXFP.bodyPosta = $('body').html();
oGen.fnGetStore({
titulo: "Pólizas Anuladas por Falta de Pago",
params: {
prm_dataSource: "ovQbe",
prm_funcion: "PAMQSOLO.anulxPagoDetalles",
prm_usuarcod: oGlobal.cUsuario,
prm_nivelclas: 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) {
var html = "Pólizas Anuladas por Falta de Pago
";
html += " Imprimir";
html += "- ";
html += oGlobal.productor.CLIENSEC + ' (' + oGlobal.productor.NIVEL + ') - ' + oGlobal.productor.NOMBRE;
html += "
";
html += "";
html += "Nro Póliza | Apellido / Razón Social | Fecha de Anulación | Cod. Prod |
";
$(oResp.records).each(function(){
html += "";
html += "" + oAnuladasXFP.armaNumeroPoliza('',$(this)[0]) + " | ";
html += "" + $(this)[0].CLIDES + " | ";
html += "" + $(this)[0].FECANU + " | ";
html += "" + $(this)[0].COD + " | ";
if($(this).SINI == 'S'){
html += " | ";
}else{
html += " | ";
}
html += "
";
});
html += "
";
$('#divImpresion').html(html);
window.print();
}
});
};
// Carga al finalizar el header
oGlobal.initialize = function(){
oGen.fnBtnPermisoUsuario({
funcionProd : 'oAnuladasXFP.detallesAnulacionPorPago();',
funcionNoProd: 'oAnuladasXFP.listadoAnulaciones();'
});
if(oGlobal.productor.NIVEL == 'PR'){
$('#divDatosConsultaDetCont').show();
$('#btnVolverPR').show();
}
if (oSalesForce.ORIGEN === 'SALESFORCE') {
$('#btnBackHistory').hide();
$('#btnVolverPR').hide();
}
};
// READY
$(document).ready(function(){
oSalesForce.fnObtenerParametrosOrigen("Anulada Falta Pago");
$("#divDatosConsulta").hide();
$("#divDatosConsultaDetCont").hide();
$('#btnVolverFrm').on('click', function(){
oAnuladasXFP.listadoAnulaciones();
});
$('#btnImprimir').on('click', function(){
oAnuladasXFP.fnImprimeListado();
});
if (oSalesForce.ORIGEN === 'SALESFORCE') {
$('#btnBackHistory').hide();
$('#btnVolverPR').hide();
}
});
/* Nuevo */
oAnuladasXFP.fnBtnVolver = function (prm) {
"use strict";
//MTRIPODI 16/09/2022 Cambio el oGen.goBack() por window.history.back porque no funciona en salesforce
if (prm) {
if (oSalesForce.ORIGEN !== 'SALESFORCE') {
$("#divDatosConsulta").append(""
+ "");
}
}
};