Skip to content

Instantly share code, notes, and snippets.

@wacko
Forked from ceneon/gist:8222574
Last active January 19, 2017 13:09
Show Gist options
  • Star 11 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wacko/8abcd1b4173ee683bb44 to your computer and use it in GitHub Desktop.
Save wacko/8abcd1b4173ee683bb44 to your computer and use it in GitHub Desktop.
Recategorización de Monotributo

Para recategorizarte en el Monotributo, la aplicación de AFIP da error de Javascript por todos lados. A menos que entres con Internet Explorer...

Para hacer el trámite en Chrome, Firefox o cualquier browser decente:

  1. Ingresar a la AFIP (Acceso con Clave Fiscal)

  2. Ir a Sistema Registral

  3. Hacer click en la lupa

  4. Registro tributario > Monotributo

  5. Este es el 1er formulario que se rompe. Hay dos soluciones:

  6. Pasar al próximo paso cargando esta URL, reemplazando __CUIT__ por tu CUIT completo y sin guiones https://servicios1.afip.gov.ar/tramites_con_clave_fiscal/monotributo/valida_cuit.asp?tramite=3&cuit=__CUIT__&intesoc=N&eventual=N&coop=N&cuitcoop=0

  7. Pegar en la consola de javascript el archivo monotributo.js y completar el formulario normalmente

  8. En el siguiente formulario no andan los popups. Para solucionarlo, pegar el archivo showModalDialog.js en la consola de javascript.

  9. Completá el formulario de ingresos, kw/h (?) y demás

  10. Continuar, confirmar...

  11. Listo!

function obtenerParam() {
//*********************
// Obtengo el motivo del Tramite
var tramite_tempo, parametro;
var motivo, cuit, inteSoc, eventual, asocCoop, cuitCoop;
var carSacar1 = /\./gi;
var carSacar2 = /,/gi;
var carSacar3 = /-/gi;
var carNum = /.[a-z]/gi;
motivo = "---";
for (tramite_tempo = 0; tramite_tempo <= (form1.motivo_tramite.length - 1); tramite_tempo++) {
// ESTAS ERAN LAS LINEAS QUE GENERABAN ERROR:
// form1.motivo_tramite(tramite_tempo) => form1.motivo_tramite[tramite_tempo]
if (form1.motivo_tramite[tramite_tempo].checked) {
motivo = form1.motivo_tramite[tramite_tempo].value;
break;
}
}
if (motivo == "---") {
window.alert("Debe seleccionar el Tipo de Trámite que desea realizar.");
return "ERROR";
}
if (form1.cuit.value == "-1") {
window.alert("Debe seleccionar la CUIT sobre la que realizará el Empadronamiento.");
return "ERROR";
}
else {
cuit = form1.cuit.value;
}
if (form1.inte_sociedad.checked) {
inteSoc = "S";
} else {
inteSoc = "N";
}
eventual = form1.eventual_al_final.value;
if (form1.cooperativa.checked) {
if (form1.cuit_coperativa.value == "") {
window.alert("Debe ingresar la CUIT de la Cooperativa de Trabajo a la que está asociado.");
return "ERROR";
} else {
// Verifico la cuit de la cooperativa
stringIntermedio = form1.cuit_coperativa.value;
// Le saco los puntos
stringIntermedio = stringIntermedio.replace(carSacar1, "");
// Le saco las comas.
stringIntermedio = stringIntermedio.replace(carSacar2, "");
// Le saco los guiones.
stringIntermedio = stringIntermedio.replace(carSacar3, "");
form1.cuit_coperativa.value = stringIntermedio
if (carNum.test(form1.cuit_coperativa.value) == true) {
window.alert("Debe ingresar una CUIT para la Cooperativa de Trabajo válida. (Solo se permiten valores numéricos)");
return "ERROR";
}
if (form1.cuit_coperativa.value.length != 11) {
window.alert("La CUIT de la Cooperativa de Trabajo debe tener un largo de 11 números.");
return "ERROR";
}
}
asocCoop = "S";
cuitCoop = form1.cuit_coperativa.value;
} else {
asocCoop = "N";
cuitCoop = 0;
}
parametro = "?tramite=" + motivo + "&cuit=" + cuit + "&intesoc=" + inteSoc + "&eventual=" + eventual + "&coop=" + asocCoop + "&cuitcoop=" + cuitCoop
return parametro
}
// Source: https://github.com/niutech/showModalDialog/blob/gh-pages/showModalDialog.js
(function() {
window.spawn = window.spawn || function(gen) {
function continuer(verb, arg) {
var result;
try {
result = generator[verb](arg);
} catch (err) {
return Promise.reject(err);
}
if (result.done) {
return result.value;
} else {
return Promise.resolve(result.value).then(onFulfilled, onRejected);
}
}
var generator = gen();
var onFulfilled = continuer.bind(continuer, 'next');
var onRejected = continuer.bind(continuer, 'throw');
return onFulfilled();
};
window.showModalDialog = window.showModalDialog || function(url, arg, opt) {
url = url || ''; //URL of a dialog
arg = arg || null; //arguments to a dialog
opt = opt || 'dialogWidth:300px;dialogHeight:200px'; //options: dialogTop;dialogLeft;dialogWidth;dialogHeight or CSS styles
var caller = showModalDialog.caller.toString();
var dialog = document.body.appendChild(document.createElement('dialog'));
dialog.setAttribute('style', opt.replace(/dialog/gi, ''));
dialog.innerHTML = '<a href="#" id="dialog-close" style="position: absolute; top: 0; right: 4px; font-size: 20px; color: #000; text-decoration: none; outline: none;">&times;</a><iframe id="dialog-body" src="' + url + '" style="border: 0; width: 100%; height: 100%;"></iframe>';
document.getElementById('dialog-body').contentWindow.dialogArguments = arg;
document.getElementById('dialog-close').addEventListener('click', function(e) {
e.preventDefault();
dialog.close();
});
dialog.showModal();
//if using yield
if(caller.indexOf('yield') >= 0) {
return new Promise(function(resolve, reject) {
dialog.addEventListener('close', function() {
var returnValue = document.getElementById('dialog-body').contentWindow.returnValue;
document.body.removeChild(dialog);
resolve(returnValue);
});
});
}
//if using eval
var isNext = false;
var nextStmts = caller.split('\n').filter(function(stmt) {
if(isNext || stmt.indexOf('showModalDialog(') >= 0)
return isNext = true;
return false;
});
dialog.addEventListener('close', function() {
var returnValue = document.getElementById('dialog-body').contentWindow.returnValue;
document.body.removeChild(dialog);
nextStmts[0] = nextStmts[0].replace(/(window\.)?showModalDialog\(.*\)/g, JSON.stringify(returnValue));
eval('{\n' + nextStmts.join('\n'));
});
throw 'Execution stopped until showModalDialog is closed';
};
})();
@facundoolano
Copy link

No me anduvieron las soluciones de arriba, pero si están en linux pueden instalar el ie8 usando playonlinux y funca

@agustinm20
Copy link

Muy bueno! Yo uso IE11 con modo de compatibilidad, es la única manera que no da error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment