Files
ventas_php/javascript/envios-recibir.js

69 lines
1.7 KiB
JavaScript
Executable File

function RecibirMercancia(id){
var message = "Realmente deseas confirmar la recepción del envío No. " + id +" ?";
if(!confirm(message)){
return;
}
$("type").value = "recibirMercancia";
new Ajax.Request(WEB_ROOT+'/ajax/envios.php',
{
method:'post',
parameters: $('frmRecibir').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"){
location.href = WEB_ROOT + "/envios";
}else{
ShowStatus(splitResponse[1]);
HideFview();
}
},
onFailure: function(){ alert('Something went wrong...') }
});
}//RecibirMercancia
function ToogleFields(pedidoId, id){
var completo = $("completo_"+pedidoId+"_"+id).checked;
var noPrendasEnv = $("noPrendasEnv_"+pedidoId+"_"+id).value;
if(completo){
$("cantPrendas_"+pedidoId+"_"+id).value = noPrendasEnv;
$("faltantes_"+pedidoId+"_"+id).value = "";
$("cantPrendas_"+pedidoId+"_"+id).style.display = "none";
$("faltantes_"+pedidoId+"_"+id).style.display = "none";
}else{
$("cantPrendas_"+pedidoId+"_"+id).value = "";
$("faltantes_"+pedidoId+"_"+id).value = "";
$("cantPrendas_"+pedidoId+"_"+id).style.display = "";
$("faltantes_"+pedidoId+"_"+id).style.display = "";
}
}
function UpdateFaltantes(pedidoId, id){
var cantPrendas = $("cantPrendas_"+pedidoId+"_"+id).value;
var noPrendasEnv = $("noPrendasEnv_"+pedidoId+"_"+id).value;
var faltantes = noPrendasEnv - cantPrendas;
if(faltantes < 0)
faltantes = 0;
$("faltantes_"+pedidoId+"_"+id).value = faltantes;
}