var oPymesBusquedaCot = oPymesBusquedaCot || []; var oSalesForce = oSalesForce || {}; //MTRIPODI 06/01/2021 Cargo Ramo que viene de Salesforce oSalesForce.fnObtenerParametros = function () { // oSalesForce.RAMOPCOD = ""; oSalesForce.ORIGEN = ""; try { var _rParam = Base64.decode(oGen.getParameterByName("rParam")); if (oGen.nvl(_rParam, "") != "") { var rParams = _rParam.split("@@"); oSalesForce.ORIGEN = oGen.nvl(rParams[0].split("=")[1], ""); // SALESFORCE oSalesForce.RAMOPCOD = oGen.nvl(rParams[1].split("=")[1], ""); // AUT1 / ICQ1 / ICQ2 } if (oSalesForce.ORIGEN == "SALESFORCE") { $('#btnBusCotiAtras').hide(); } else { $('#btnBusCotiAtras').show(); } } catch (e) { console.log("Cotizaciones Individuos", e); } }; oPymesBusquedaCot.fnCbProductoCarga = function () { oGen.fnBloqueoUnico(); oGen.fnComboCarga({ titulo: 'Producto', idComponente: 'cbProducto', params: { prm_dataSource: 'ovQbe', prm_funcion: 'ov.paMenuQuote.obtenerProducto', prm_ciaascod: 1, prm_usuarcod: oGlobal.cUsuario, prm_canalHsbc: oGlobal.canales.CANALHSBC, prm_pymes: 'S' }, valor: 'RAMOPCOD', descripcion: 'RAMOPDAB', valorSeleccionado: oSalesForce.RAMOPCOD, fnCallback: function (msg) { // } }); oGen.fnBloqueoUnicoHide(); }; oPymesBusquedaCot.fnValidarPantalla = function () { var error = false; if ($('#txNroCotizacion').is(':visible')) { if (oPymesBusquedaCot.showError('txNroCotizacion', 'Ingrese el Número de Cotización.')) error = true; } if ($('#txApellidoCliente').is(':visible')) { if (oPymesBusquedaCot.showError('txApellidoCliente', 'Ingrese el Apellido / Razón Social.')) error = true; } if ($('#cbTipoDocumentoCliente').is(':visible')) { if (oPymesBusquedaCot.showError('cbTipoDocumentoCliente', 'Seleccione el tipo de documento.')) error = true; } if ($('#txDocumentoCliente').is(':visible')) { if (oPymesBusquedaCot.showError('txDocumentoCliente', 'Ingrese el número de documento.')) error = true; } return !error; } oPymesBusquedaCot.showError = function (id, cMensaje) { if ($("#" + id).val() === null || $("#" + id).val().trim() == '') { oGen.fnShowError({ idComponente: $("#" + id), mensaje: cMensaje }); oGen.fnPanelErrorAdd(cMensaje, id); return true; } else { oGen.fnHideError(id); } return false; }; oPymesBusquedaCot.fnDisplayQuote = function (quote, efectiveDate) { // oGen.fnBloqueoUnico(); // oGen.fnGetStore({ params: { prm_dataSource: 'ovQbe', prm_funcion: 'ov.PAPOLICYSERVICES.QuoteHeaderRetrieve', prm_userid: oGlobal.cUsuario, prm_userrole: oGen.lPad(oGlobal.productor.CLIENSEC, 9, '0'), prm_userlevel: oGlobal.productor.NIVEL, prm_Company: '1', prm_Branch: '01', prm_QuoteNumber: quote, prm_EffectiveDate: efectiveDate, }, fnCallback: function (oResp) { oGen.fnCargaFormulario({ formulario: 'ovQbe_pymesResumenCot', idComponente: 'quoteContainerPymesResumen', fnCallback: function () { oPymesResumenCot.fnCargarDatosResumenBusqueda(oResp, quote); } }, 'quoteContainer'); } }); oGen.fnBloqueoUnicoHide(); }; oPymesBusquedaCot.fnGrilla = function (prm_param) { // oConsulta.show({ consulta: 'OV_COTIZACIONES_PYMES_LISTA', dataSource: 'ovQbe', idComponente: 'divDatosConsulta', exportar: true, estilo: 'grillaSmall', paramsDefault: prm_param, columnStyle: [{ CNOMBRECAMPO: "NROCOTIZACION", style: "oConsulta.fnCursorPointer" }], fnCallback: function (row, col) { //Ingresa al hacer click en el registro oGen.logDesarrollo(col, row); switch (col) { case 0: oPymesBusquedaCot.fnDisplayQuote(row.QUOTENUMBER, row.INCEPTIONDATE); break; default: break; } }, fnCallbackBeforeLoad: function (prm, recs) { if (recs.length === 1 && oGen.nvl(recs[0].QUOTENUMBER) !== "") { oPymesBusquedaCot.fnDisplayQuote(recs[0].QUOTENUMBER, recs[0].INCEPTIONDATE); } } }); }; $(document).ready(function () { oGen.fnInicioForms(false); oSalesForce.fnObtenerParametros(); $("#salesforeceProducto").hide(); oGen.fnDisable('cbProducto'); if (oSalesForce.ORIGEN == 'SALESFORCE') { $("#salesforeceProducto").show(); oPymesBusquedaCot.fnCbProductoCarga(); } $('#divNroCotizacion').show(); $('#divApellido').hide(); $('#divDocumento').hide(); $('#divProducto').hide(); $('#cbBuscarPor').on('change', function () { // var valor = $('#cbBuscarPor').val(); // switch (valor) { case "QT": $('#divNroCotizacion').show(); $('#divApellido').hide(); $('#divDocumento').hide(); if (oSalesForce.ORIGEN != 'SALESFORCE') { $('#divProducto').hide(); } break; case "CUS": $('#divNroCotizacion').hide(); $('#divApellido').show(); $('#divDocumento').hide(); if (oSalesForce.ORIGEN != 'SALESFORCE') { $('#divProducto').show(); } break; case "CUD": $('#divNroCotizacion').hide(); $('#divApellido').hide(); $('#divDocumento').show(); if (oSalesForce.ORIGEN != 'SALESFORCE') { $('#divProducto').show(); } break; case "MYQT": $('#divNroCotizacion').hide(); $('#divApellido').hide(); $('#divDocumento').hide(); if (oSalesForce.ORIGEN != 'SALESFORCE') { $('#divProducto').show(); } break; }; }); $('#btnBuscarCot').on('click', function () { // if (oPymesBusquedaCot.fnValidarPantalla()) { var _quoteNumber = ""; var _clientid = ""; var _clientidtype = ""; var _clientname = ""; var _product = ""; // var valor = $('#cbBuscarPor').val(); // switch (valor) { case "QT": _quoteNumber = oGen.nvl($('#txNroCotizacion').val()); break; case "CUS": _clientname = oGen.nvl($('#txApellidoCliente').val()); _product = oGen.nvl($('#cbProductoBusqueda').val()); break; case "CUD": _clientid = oGen.nvl($('#txDocumentoCliente').val()); _clientidtype = oGen.nvl($('#cbTipoDocumentoCliente').val()); _product = oGen.nvl($('#cbProductoBusqueda').val()); break; case "MYQT": _product = oGen.nvl($('#cbProductoBusqueda').val()); break; }; // if (oSalesForce.ORIGEN == 'SALESFORCE') { _product = oSalesForce.RAMOPCOD; } // oGen.fnBloqueoUnico(); var _param = { prm_dataSource: 'ovQbe', prm_funcion: 'ov.PaPolicyServices.QuoteSearch', prm_userid: oGlobal.cUsuario, prm_userrole: oGen.lPad(oGlobal.productor.CLIENSEC, 9, '0'), prm_userlevel: oGlobal.productor.NIVEL, prm_QuoteNumber: _quoteNumber, prm_clientid: _clientid, prm_clientidtype: _clientidtype, prm_clientname: _clientname, prm_product: _product }; var _param = { prm_userid: oGlobal.cUsuario, prm_userrole: oGen.lPad(oGlobal.productor.CLIENSEC, 9, '0'), prm_userlevel: oGlobal.productor.NIVEL, prm_QuoteNumber: _quoteNumber, prm_clientid: _clientid, prm_clientidtype: _clientidtype, prm_clientname: _clientname, prm_product: _product }; // oPymesBusquedaCot.fnGrilla(_param); oGen.fnBloqueoUnicoHide(); // /* oGen.fnGetStore({ titulo: ' ', params: { prm_dataSource: 'ovQbe', prm_funcion: 'ov.PaPolicyServices.QuoteSearch', prm_userid: oGlobal.cUsuario, prm_userrole: oGen.lPad(oGlobal.productor.CLIENSEC, 9, '0'), prm_userlevel: oGlobal.productor.NIVEL, prm_QuoteNumber: _quoteNumber, prm_clientid: _clientid, prm_clientidtype: _clientidtype, prm_clientname: _clientname, prm_product: _product }, fnCallback: function (oResp) { // oPymesBusquedaCot.tablaCotizaciones = []; if (oResp.PRM_CURSOR != undefined) { // oPymesBusquedaCot.tablaCotizaciones = oResp.PRM_CURSOR; // if (oPymesBusquedaCot.tablaCotizaciones.length === 1) { // if (oGen.nvl(oPymesBusquedaCot.tablaCotizaciones[0].QUOTENUMBER) !== "") { // oPymesBusquedaCot.fnGrilla(); oPymesBusquedaCot.fnDisplayQuote(oPymesBusquedaCot.tablaCotizaciones[0].QUOTENUMBER, oPymesBusquedaCot.tablaCotizaciones[0].INCEPTIONDATE ); } } else { oPymesBusquedaCot.fnGrilla(); } } } }); */ } }); });