177 lines
3.9 KiB
JavaScript
Executable File
177 lines
3.9 KiB
JavaScript
Executable File
function UpdateSucursal(){
|
|
|
|
var sucursalId = $("sucursalId").value;
|
|
var invFisicoId = $("invFisicoId").value;
|
|
|
|
new Ajax.Request(WEB_ROOT+'/ajax/inventario-fisico.php',
|
|
{
|
|
method:'post',
|
|
parameters: {type:"updateSucursal", sucursalId:sucursalId, invFisicoId:invFisicoId},
|
|
|
|
onSuccess: function(transport){
|
|
var response = transport.responseText || "no response text";
|
|
var splitResponse = response.split("[#]");
|
|
|
|
if(splitResponse[0] == "ok"){
|
|
$("txtSucMsg").innerHTML = splitResponse[1];
|
|
|
|
Effect.Appear('txtSucMsg');
|
|
setTimeout(function(){
|
|
Effect.Fade('txtSucMsg',{duration:2});
|
|
}, 3000);
|
|
}
|
|
},
|
|
onFailure: function(){ alert('Something went wrong...') }
|
|
});
|
|
|
|
}
|
|
|
|
function AgregarProducto()
|
|
{
|
|
$("type").value = "agregarProducto";
|
|
|
|
new Ajax.Request(WEB_ROOT+'/ajax/inventario-fisico.php',
|
|
{
|
|
method:'post',
|
|
parameters: $('frmInvFisico').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"){
|
|
|
|
$('nomProd').innerHTML = "";
|
|
$("codigoBarra").value = "";
|
|
$("cantidad").value = "";
|
|
$("productoId").value = "";
|
|
|
|
$("codigoBarra").focus();
|
|
|
|
$("txtSucMsg").innerHTML = splitResponse[1];
|
|
Effect.Appear('txtSucMsg');
|
|
setTimeout(function(){
|
|
Effect.Fade('txtSucMsg',{duration:2});
|
|
}, 3000);
|
|
|
|
$("contProds").innerHTML = splitResponse[2];
|
|
|
|
}else{
|
|
|
|
$("txtErrMsg").innerHTML = splitResponse[1];
|
|
|
|
Effect.Appear('txtErrMsg');
|
|
setTimeout(function(){
|
|
Effect.Fade('txtErrMsg',{duration:2});
|
|
}, 3000);
|
|
|
|
}
|
|
|
|
},
|
|
onFailure: function(){ alert('Something went wrong...') }
|
|
});
|
|
}
|
|
|
|
function EliminarProd(id)
|
|
{
|
|
var resp = confirm("Esta seguro de eliminar este producto?");
|
|
|
|
if(!resp)
|
|
return;
|
|
|
|
new Ajax.Request(WEB_ROOT+'/ajax/inventario-fisico.php',
|
|
{
|
|
method:'post',
|
|
parameters: {type:"eliminarProducto", invFisProdId:id},
|
|
onLoading: function(){
|
|
$("loader").show();
|
|
},
|
|
onSuccess: function(transport){
|
|
var response = transport.responseText || "no response text";
|
|
var splitResponse = response.split("[#]");
|
|
|
|
$("loader").hide();
|
|
|
|
if(splitResponse[0] == "ok"){
|
|
|
|
$("txtSucMsg").innerHTML = splitResponse[1];
|
|
|
|
Effect.Appear('txtSucMsg');
|
|
setTimeout(function(){
|
|
Effect.Fade('txtSucMsg',{duration:2});
|
|
}, 3000);
|
|
|
|
$("contProds").innerHTML = splitResponse[2];
|
|
}
|
|
|
|
},
|
|
onFailure: function(){ alert('Something went wrong...') }
|
|
});
|
|
}
|
|
|
|
function BuscarProducto()
|
|
{
|
|
$("type").value = "buscarProducto";
|
|
|
|
new Ajax.Request(WEB_ROOT+'/ajax/inventario-fisico.php',
|
|
{
|
|
method:'post',
|
|
parameters: $('frmInvFisico').serialize(),
|
|
onLoading: function(){
|
|
$('nomProd').innerHTML = LOADER;
|
|
},
|
|
onSuccess: function(transport){
|
|
var response = transport.responseText || "no response text";
|
|
var splitResponse = response.split("[#]");
|
|
|
|
$('nomProd').innerHTML = "";
|
|
|
|
if(splitResponse[0] == "ok"){
|
|
$('nomProd').innerHTML = splitResponse[1];
|
|
$("productoId").value = splitResponse[2];
|
|
$("cantidad").focus();
|
|
}else{
|
|
$("txtErrMsg").innerHTML = splitResponse[1];
|
|
$("productoId").value = "";
|
|
|
|
Effect.Appear('txtErrMsg');
|
|
setTimeout(function(){
|
|
Effect.Fade('txtErrMsg',{duration:2});
|
|
}, 3000);
|
|
}
|
|
|
|
},
|
|
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){
|
|
BuscarProducto();
|
|
}
|
|
|
|
}//CheckKey
|
|
|
|
function CheckKey2(e){
|
|
|
|
if(window.event)
|
|
keyCode = window.event.keyCode;
|
|
else if(e)
|
|
keyCode=e.which;
|
|
|
|
if(keyCode == 13){
|
|
AgregarProducto();
|
|
}
|
|
|
|
}//CheckKey2
|