Primer commit del sistema avantika sin cambios
This commit is contained in:
136
javascript/facturas-nueva.js
Executable file
136
javascript/facturas-nueva.js
Executable file
@@ -0,0 +1,136 @@
|
||||
Event.observe(window, 'load', function(){
|
||||
|
||||
if($('vistaPrevia'))
|
||||
Event.observe($('vistaPrevia'), "click", VistaPreviaComprobante);
|
||||
|
||||
if($('generarFactura'))
|
||||
Event.observe($('generarFactura'), "click", GenerarComprobante);
|
||||
|
||||
});
|
||||
|
||||
|
||||
function GenerarComprobante()
|
||||
{
|
||||
var message = "Realmente deseas generar un comprobante. Asegurate de que lo estes generando para tu RFC Correcto.";
|
||||
if(!confirm(message)){
|
||||
return;
|
||||
}
|
||||
|
||||
$('contTemp').innerHTML = '';
|
||||
|
||||
$('nuevaFactura').enable();
|
||||
var nuevaFactura = $('nuevaFactura').serialize();
|
||||
$('nuevaFactura').disable();
|
||||
$('rfc').enable();
|
||||
$('userId').enable();
|
||||
$('formaDePago').enable();
|
||||
$('condicionesDePago').enable();
|
||||
$('metodoDePago').enable();
|
||||
$('tasaIva').enable();
|
||||
$('tiposDeMoneda').enable();
|
||||
$('porcentajeRetIva').enable();
|
||||
$('porcentajeDescuento').enable();
|
||||
$('tipoDeCambio').enable();
|
||||
$('porcentajeRetIsr').enable();
|
||||
$('tiposComprobanteId').enable();
|
||||
$('sucursalId').enable();
|
||||
$('porcentajeIEPS').enable();
|
||||
$('nuevaFactura').enable();
|
||||
|
||||
new Ajax.Request(WEB_ROOT+'/ajax/facturacion-nueva.php',
|
||||
{
|
||||
parameters: {nuevaFactura: nuevaFactura, type: "generarComprobante"},
|
||||
method:'post',
|
||||
onLoading: function(){
|
||||
$("loader").show();
|
||||
},
|
||||
onSuccess: function(transport){
|
||||
var response = transport.responseText || "no response text";
|
||||
var splitResponse = response.split("[#]");
|
||||
|
||||
$("loader").hide();
|
||||
|
||||
if(splitResponse[0] == "ok"){
|
||||
$("titH1").innerHTML = "Paso 3 de 3: Guarde los archivos generados.";
|
||||
$("frmNvaFact").hide();
|
||||
$("dwnPdf").show();
|
||||
$('dwnPdf').innerHTML = splitResponse[1];
|
||||
}else{
|
||||
$('divStatus').innerHTML = splitResponse[1];
|
||||
$('centeredDiv').show();
|
||||
grayOut(true);
|
||||
}
|
||||
|
||||
},
|
||||
onFailure: function(){ alert('Something went wrong...') }
|
||||
});
|
||||
}
|
||||
|
||||
function VistaPreviaComprobante()
|
||||
{
|
||||
var message = "Esto solo generara una vista previa. Para generar un comprobante da click en Generar Comprobante.";
|
||||
if(!confirm(message)){
|
||||
return;
|
||||
}
|
||||
|
||||
$('contTemp').innerHTML = '';
|
||||
$('loaderPrev').show();
|
||||
|
||||
$('nuevaFactura').enable();
|
||||
var nuevaFactura = $('nuevaFactura').serialize();
|
||||
$('nuevaFactura').disable();
|
||||
$('rfc').enable();
|
||||
$('userId').enable();
|
||||
$('formaDePago').enable();
|
||||
$('condicionesDePago').enable();
|
||||
$('metodoDePago').enable();
|
||||
$('tasaIva').enable();
|
||||
$('tiposDeMoneda').enable();
|
||||
$('porcentajeRetIva').enable();
|
||||
$('porcentajeDescuento').enable();
|
||||
$('tipoDeCambio').enable();
|
||||
$('porcentajeRetIsr').enable();
|
||||
$('tiposComprobanteId').enable();
|
||||
$('sucursalId').enable();
|
||||
$('porcentajeIEPS').enable();
|
||||
$('nuevaFactura').enable();
|
||||
|
||||
if($('reviso')) var reviso = $('reviso').value;
|
||||
else var reviso = "";
|
||||
|
||||
if($('autorizo')) var autorizo = $('autorizo').value;
|
||||
else var autorizo = "";
|
||||
|
||||
if($('recibio')) var recibio = $('recibio').value;
|
||||
else var recibio = "";
|
||||
|
||||
if($('vobo')) var vobo = $('vobo').value;
|
||||
else var vobo = "";
|
||||
|
||||
if($('pago')) var pago = $('pago').value;
|
||||
else var pago = "";
|
||||
|
||||
new Ajax.Request(WEB_ROOT+'/ajax/facturacion-nueva.php',
|
||||
{
|
||||
parameters: {nuevaFactura: nuevaFactura, type: "vistaPreviaComprobante", reviso: reviso, autorizo: autorizo, recibio: recibio, vobo: vobo, pago: pago},
|
||||
method:'post',
|
||||
onSuccess: function(transport){
|
||||
var response = transport.responseText || "no response text";
|
||||
var splitResponse = response.split("[#]");
|
||||
|
||||
$('loaderPrev').hide();
|
||||
|
||||
if(splitResponse[0] == "fail")
|
||||
{
|
||||
$('divStatus').innerHTML = splitResponse[1];
|
||||
$('centeredDiv').show();
|
||||
grayOut(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
$('contTemp').innerHTML = splitResponse[1];
|
||||
}
|
||||
},
|
||||
onFailure: function(){ alert('Something went wrong...') }
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user