Primer commit del sistema avantika sin cambios
This commit is contained in:
259
javascript/productos-editar.js
Executable file
259
javascript/productos-editar.js
Executable file
@@ -0,0 +1,259 @@
|
||||
function EditProducto(){
|
||||
|
||||
if($("delImage") != undefined){
|
||||
if($("delImage").checked == true)
|
||||
$("tmpImg").value = $("imagen").value;
|
||||
else
|
||||
$("tmpImg").value = "miImg";
|
||||
}else{
|
||||
$("tmpImg").value = $("imagen").value;
|
||||
}
|
||||
|
||||
$("type").value = "saveEditProducto";
|
||||
|
||||
new Ajax.Request(WEB_ROOT+'/ajax/productos.php',
|
||||
{
|
||||
method:'post',
|
||||
parameters: $('frmEditarProducto').serialize(),
|
||||
onLoading: function(){
|
||||
$("loader").show();
|
||||
},
|
||||
onSuccess: function(transport){
|
||||
var response = transport.responseText || "no response text";
|
||||
var splitResponse = response.split("[#]");
|
||||
|
||||
if(splitResponse[0] == "ok"){
|
||||
$('frmEditarProducto').submit();
|
||||
}else{
|
||||
ShowStatusPopUp(splitResponse[1]);
|
||||
HideFview();
|
||||
$("loader").hide();
|
||||
}
|
||||
},
|
||||
|
||||
onFailure: function(){ alert('Something went wrong...') }
|
||||
|
||||
});
|
||||
|
||||
}//EditProducto
|
||||
|
||||
function LoadSubcats(){
|
||||
|
||||
var catId = $("prodCatId").value;
|
||||
|
||||
$("enumSubcats").innerHTML = '';
|
||||
|
||||
new Ajax.Request(WEB_ROOT+'/ajax/productos.php',{
|
||||
method:'post',
|
||||
parameters: {type:"loadSubcats", prodCatId:catId},
|
||||
onLoading: function(){
|
||||
$("enumSubcats").innerHTML = LOADER;
|
||||
},
|
||||
onSuccess: function(transport){
|
||||
var response = transport.responseText || "no response text";
|
||||
var splitResponse = response.split("[#]");
|
||||
|
||||
if(splitResponse[0] == "ok")
|
||||
$("enumSubcats").innerHTML = splitResponse[1];
|
||||
|
||||
},
|
||||
onFailure: function(){ alert('Something went wrong...') }
|
||||
});
|
||||
|
||||
}//LoadSubcats
|
||||
|
||||
function LoadBarCodes(){
|
||||
|
||||
$("type").value = "loadBarCodes";
|
||||
|
||||
new Ajax.Request(WEB_ROOT+'/ajax/productos.php',{
|
||||
method:'post',
|
||||
parameters: $('frmEditarProducto').serialize(),
|
||||
onLoading: function(){
|
||||
$("codigos").innerHTML = LOADER;
|
||||
},
|
||||
onSuccess: function(transport){
|
||||
var response = transport.responseText || "no response text";
|
||||
var splitResponse = response.split("[#]");
|
||||
|
||||
if(splitResponse[0] == "ok"){
|
||||
$("codigos").innerHTML = splitResponse[1];
|
||||
}
|
||||
|
||||
},
|
||||
onFailure: function(){ alert('Something went wrong...') }
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function LoadAtributos(){
|
||||
|
||||
var id = $("prodSubcatId").value;
|
||||
|
||||
new Ajax.Request(WEB_ROOT+'/ajax/productos.php',{
|
||||
method:'post',
|
||||
parameters: {type:"loadAtributos", prodSubcatId:id},
|
||||
onLoading: function(){
|
||||
$("enumAtributos").innerHTML = LOADER;
|
||||
},
|
||||
onSuccess: function(transport){
|
||||
var response = transport.responseText || "no response text";
|
||||
var splitResponse = response.split("[#]");
|
||||
|
||||
if(splitResponse[0] == "ok"){
|
||||
$("enumAtributos").innerHTML = splitResponse[1];
|
||||
}
|
||||
|
||||
},
|
||||
onFailure: function(){ alert('Something went wrong...') }
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function LoadTallas(){
|
||||
return true;
|
||||
var idConTalla = $("conTallaId").value;
|
||||
|
||||
new Ajax.Request(WEB_ROOT+'/ajax/productos.php',{
|
||||
method:'post',
|
||||
parameters: {type:"loadTallas", conTallaId:idConTalla},
|
||||
onLoading: function(){
|
||||
$("listTallas").innerHTML = LOADER;
|
||||
},
|
||||
onSuccess: function(transport){
|
||||
var response = transport.responseText || "no response text";
|
||||
var splitResponse = response.split("[#]");
|
||||
|
||||
if(splitResponse[0] == "ok")
|
||||
$("listTallas").innerHTML = splitResponse[1];
|
||||
|
||||
LoadBarCodes();
|
||||
|
||||
},
|
||||
onFailure: function(){ alert('Something went wrong...') }
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function CheckMaterials()
|
||||
{
|
||||
$("type").value = "checkMaterials";
|
||||
|
||||
new Ajax.Request(WEB_ROOT+'/ajax/productos.php',
|
||||
{
|
||||
method:'post',
|
||||
parameters: $('frmEditarProducto').serialize(true),
|
||||
onSuccess: function(transport){
|
||||
var response = transport.responseText || "no response text";
|
||||
var splitResponse = response.split("[#]");
|
||||
|
||||
if(splitResponse[0] == "fail")
|
||||
{
|
||||
ShowStatusPopUp(splitResponse[1]);
|
||||
HideFview();
|
||||
}
|
||||
|
||||
},
|
||||
onFailure: function(){ alert('Something went wrong...') }
|
||||
});
|
||||
}
|
||||
|
||||
function CalcUtilidad(){
|
||||
|
||||
var vCosto = $("costo").value;
|
||||
var vPrecioVenta = $("precioVenta").value;
|
||||
|
||||
new Ajax.Request(WEB_ROOT+'/ajax/productos.php',
|
||||
{
|
||||
method:'post',
|
||||
parameters: {type:"calcUtilidad", costo:vCosto, precioVenta:vPrecioVenta},
|
||||
onSuccess: function(transport){
|
||||
var response = transport.responseText || "no response text";
|
||||
var splitResponse = response.split("[#]");
|
||||
|
||||
if(splitResponse[0] == "ok"){
|
||||
$("utilidad").value = splitResponse[1];
|
||||
$("porcUtilidad").innerHTML = splitResponse[2];
|
||||
}
|
||||
|
||||
},
|
||||
onFailure: function(){ alert('Something went wrong...') }
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function CalcPrecioSinIva(){
|
||||
|
||||
var vPrecioVentaIva = $("precioVentaIva").value;
|
||||
|
||||
new Ajax.Request(WEB_ROOT+'/ajax/productos.php',
|
||||
{
|
||||
method:'post',
|
||||
parameters: {type:"calcPrecioSinIva", precioVentaIva:vPrecioVentaIva},
|
||||
onLoading: function(){
|
||||
$("txtPrecioVenta").innerHTML = LOADER;
|
||||
},
|
||||
onSuccess: function(transport){
|
||||
var response = transport.responseText || "no response text";
|
||||
var splitResponse = response.split("[#]");
|
||||
|
||||
if(splitResponse[0] == "ok"){
|
||||
$("txtPrecioVenta").innerHTML = splitResponse[1];
|
||||
$("precioVenta").value = splitResponse[1];
|
||||
}
|
||||
|
||||
CalcUtilidad();
|
||||
},
|
||||
onFailure: function(){ alert('Something went wrong...') }
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
//Suggest Proveedores
|
||||
|
||||
function SuggestProveedor()
|
||||
{
|
||||
var vNombre = $("proveedor").value;
|
||||
|
||||
new Ajax.Request(WEB_ROOT+'/ajax/suggest_gral.php',
|
||||
{
|
||||
parameters: {nombre: vNombre, type: "proveedor"},
|
||||
method:'post',
|
||||
onSuccess: function(transport){
|
||||
var response = transport.responseText || "no response text";
|
||||
|
||||
$('sugProvDiv').show();
|
||||
$('sugProvDiv').innerHTML = response;
|
||||
|
||||
},
|
||||
onFailure: function(){ alert('Something went wrong...') }
|
||||
});
|
||||
}
|
||||
|
||||
function FillInfoProv(id){
|
||||
|
||||
new Ajax.Request(WEB_ROOT+'/ajax/proveedores.php',
|
||||
{
|
||||
parameters: {type: "fillInfoProv", proveedorId:id},
|
||||
method:'post',
|
||||
onSuccess: function(transport){
|
||||
var response = transport.responseText || "no response text";
|
||||
var splitResponse = response.split("[#]");
|
||||
|
||||
if(splitResponse[0] == "ok"){
|
||||
$("proveedorId").value = splitResponse[1];
|
||||
$("proveedor").value = splitResponse[2];
|
||||
}
|
||||
|
||||
CloseSugProv(k);
|
||||
},
|
||||
onFailure: function(){ alert('Something went wrong...') }
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function CloseSugProv(k){
|
||||
|
||||
$('sugProvDiv').hide();
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user