Files
ventas_php/javascript/inventario-ajustar.js

82 lines
1.8 KiB
JavaScript
Executable File

function AjustarInventario()
{
var resp = confirm("Esta seguro de ajustar el inventario de ese producto?");
if(!resp)
return;
$("type").value = "ajustarInventario";
new Ajax.Request(WEB_ROOT+'/ajax/inventario-ajustar.php',
{
method:'post',
parameters: $('frmAjustar').serialize(),
onLoading: function(){
$('loader').show();
},
onSuccess: function(transport){
var response = transport.responseText || "no response text";
var splitResponse = response.split("[#]");
$('loader').hide();
if(splitResponse[0] == "ok"){
ShowStatus(splitResponse[1]);
$("frmAjustar").reset();
$('nomProd').innerHTML = "";
$('cantProd').innerHTML = "";
}else{
ShowStatus(splitResponse[1]);
}
HideFview();
},
onFailure: function(){ alert('Something went wrong...') }
});
}
function BuscarProducto()
{
$("type").value = "buscarProducto";
new Ajax.Request(WEB_ROOT+'/ajax/inventario-ajustar.php',
{
method:'post',
parameters: $('frmAjustar').serialize(),
onLoading: function(){
$('nomProd').innerHTML = LOADER;
$('cantProd').innerHTML = LOADER;
},
onSuccess: function(transport){
var response = transport.responseText || "no response text";
var splitResponse = response.split("[#]");
$('nomProd').innerHTML = "";
$('cantProd').innerHTML = "";
if(splitResponse[0] == "ok"){
$('nomProd').innerHTML = splitResponse[1];
$('cantProd').innerHTML = splitResponse[2];
}else{
ShowStatus(splitResponse[1]);
}
HideFview();
},
onFailure: function(){ alert('Something went wrong...') }
});
}
function CheckKey(e){
if(window.event)
keyCode = window.event.keyCode;
else if(e)
keyCode=e.which;
if(keyCode == 13)
AjustarInventario();
}//CheckKey