Last active
October 20, 2015 18:17
-
-
Save aazbeltran/f3d09b6165c8a73027b2 to your computer and use it in GitHub Desktop.
Introducir automáticamente Cliente Único en el Sistema General de Cobranza
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (typeof introducirClienteUnico != 'function') { | |
function introducirClienteUnico() { | |
try { | |
if (location.hostname.match(/sclpcj\.com\.mx/) == null) throw "Esta herramienta está diseñada para funcionar únicamente en SCL."; | |
var CLIENTEUNICO = prompt("Por favor ingrese el cliente único a mostrar."); | |
if (CLIENTEUNICO == null) return; | |
CLIENTEUNICO = CLIENTEUNICO.replace(/\s/g, ""); | |
var iframe = document.getElementsByTagName('iframe')[0].contentDocument; | |
CLIENTEUNICO.match(/([0-9]*)-([0-9]*)-([0-9]*)-([0-9]*)/); | |
if (RegExp.$1 == "" || RegExp.$2 == "" || RegExp.$3 == "" || RegExp.$4 == "") throw "Favor de escribir un Cliente único válido"; | |
if (iframe.getElementsByName("idPais").length > 0) | |
iframe.getElementsByName("idPais")[0].value = RegExp.$1; | |
else if (iframe.getElementsByName("pais").length > 0) | |
iframe.getElementsByName("pais")[0].value = RegExp.$1; | |
else throw "Este módulo no es compatible con la función. Favor de reportar al administrador para su adaptación."; | |
if (iframe.getElementsByName("idCanal").length > 0) | |
iframe.getElementsByName("idCanal")[0].value = RegExp.$2; | |
else if (iframe.getElementsByName("canal").length > 0) | |
iframe.getElementsByName("canal")[0].value = RegExp.$2; | |
else throw "Este módulo no es compatible con la función. Favor de reportar al administrador para su adaptación."; | |
if (iframe.getElementsByName("idSucursal").length > 0) | |
iframe.getElementsByName("idSucursal")[0].value = RegExp.$3; | |
else if (iframe.getElementsByName("sucursal").length > 0) | |
iframe.getElementsByName("sucursal")[0].value = RegExp.$3; | |
else throw "Este módulo no es compatible con la función. Favor de reportar al administrador para su adaptación."; | |
if (iframe.getElementsByName("idFolio").length > 0) | |
iframe.getElementsByName("idFolio")[0].value = RegExp.$4; | |
else if (iframe.getElementsByName("folio").length > 0) | |
iframe.getElementsByName("folio")[0].value = RegExp.$4; | |
else throw "Este módulo no es compatible con la función. Favor de reportar al administrador para su adaptación."; | |
var forms = iframe.getElementsByTagName("form"); | |
var form = null; | |
for (var i = 0; i < forms.length; i++) { | |
if (forms[i].getAttribute("name") != null) { | |
if (form == null) { | |
form = forms[i]; | |
} else { | |
throw "Este módulo no es compatible con la función. Favor de reportar al administrador para su adaptación."; | |
} | |
} | |
} | |
form.submit(); | |
} catch (err) { | |
alert(err); | |
return; | |
} | |
} | |
} | |
introducirClienteUnico(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function introducirClienteUnico(){try{if(null==location.hostname.match(/sclpcj\.com\.mx/))throw"Esta herramienta está diseñada para funcionar únicamente en SCL.";var e=prompt("Por favor ingrese el cliente único a mostrar.");if(null==e)return;e=e.replace(/\s/g,"");var a=document.getElementsByTagName("iframe")[0].contentDocument;if(e.match(/([0-9]*)-([0-9]*)-([0-9]*)-([0-9]*)/),""==RegExp.$1||""==RegExp.$2||""==RegExp.$3||""==RegExp.$4)throw"Favor de escribir un Cliente único válido";if(a.getElementsByName("idPais").length>0)a.getElementsByName("idPais")[0].value=RegExp.$1;else{if(!(a.getElementsByName("pais").length>0))throw"Este módulo no es compatible con la función. Favor de reportar al administrador para su adaptación.";a.getElementsByName("pais")[0].value=RegExp.$1}if(a.getElementsByName("idCanal").length>0)a.getElementsByName("idCanal")[0].value=RegExp.$2;else{if(!(a.getElementsByName("canal").length>0))throw"Este módulo no es compatible con la función. Favor de reportar al administrador para su adaptación.";a.getElementsByName("canal")[0].value=RegExp.$2}if(a.getElementsByName("idSucursal").length>0)a.getElementsByName("idSucursal")[0].value=RegExp.$3;else{if(!(a.getElementsByName("sucursal").length>0))throw"Este módulo no es compatible con la función. Favor de reportar al administrador para su adaptación.";a.getElementsByName("sucursal")[0].value=RegExp.$3}if(a.getElementsByName("idFolio").length>0)a.getElementsByName("idFolio")[0].value=RegExp.$4;else{if(!(a.getElementsByName("folio").length>0))throw"Este módulo no es compatible con la función. Favor de reportar al administrador para su adaptación.";a.getElementsByName("folio")[0].value=RegExp.$4}for(var t=a.getElementsByTagName("form"),n=null,l=0;l<t.length;l++)if(null!=t[l].getAttribute("name")){if(null!=n)throw"Este módulo no es compatible con la función. Favor de reportar al administrador para su adaptación.";n=t[l]}n.submit()}catch(i){return void alert(i)}}introducirClienteUnico(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment