Files
ventas_php/javascript/bonificaciones-agregar.js

109 lines
2.7 KiB
JavaScript
Executable File

function AplicarBonifDev(productoId){
var resp = confirm("Esta seguro de aplicar la evaluacion?")
if(!resp)
return;
var pedidoId = $("pedidoId").value;
new Ajax.Request(WEB_ROOT+'/ajax/bonificaciones-agregar.php',
{
parameters: {pedidoId:pedidoId, productoId:productoId, type:"aplicarEval"},
method:'post',
onLoading: function(){
$("btnAp_" + productoId).innerHTML = LOADER;
},
onSuccess: function(transport){
var response = transport.responseText || "no response text";
var splitResponse = response.split("[#]");
$("btnAp_" + productoId).innerHTML = "Aplicado";
if(splitResponse[0] == "ok"){
ShowStatus(splitResponse[1]);
HideFview();
}else{
ShowStatus(splitResponse[1]);
HideFview();
}
},
onFailure: function(){ alert('Something went wrong...') }
});
}
function BuscarFactura()
{
var folioProv = $("folioProv").value;
new Ajax.Request(WEB_ROOT+'/ajax/bonificaciones-agregar.php',
{
parameters: {folioProv:folioProv, type:"buscarFactura"},
method:'post',
onLoading: function(){
$("pedidoId").value = "";
$("txtProveedor").innerHTML = LOADER;
$("txtNoPedido").innerHTML = LOADER;
$("txtStatus").innerHTML = LOADER;
$("txtFechaPed").innerHTML = LOADER;
$("txtFechaRec").innerHTML = LOADER;
$("txtDiasTrans").innerHTML = LOADER;
$("enumProds").innerHTML = LOADER2;
},
onSuccess: function(transport){
var response = transport.responseText || "no response text";
var splitResponse = response.split("[#]");
$("pedidoId").value = "";
$("txtProveedor").innerHTML = "";
$("txtNoPedido").innerHTML = "";
$("txtStatus").innerHTML = "";
$("txtFechaPed").innerHTML = "";
$("txtFechaRec").innerHTML = "";
$("txtDiasTrans").innerHTML = "";
$("enumProds").innerHTML = "";
if(splitResponse[0] == "ok"){
$("pedidoId").value = splitResponse[1];
$("txtProveedor").innerHTML = splitResponse[2];
$("txtNoPedido").innerHTML = splitResponse[3];
$("txtStatus").innerHTML = splitResponse[4];
$("txtFechaPed").innerHTML = splitResponse[5];
$("txtFechaRec").innerHTML = splitResponse[6];
$("txtDiasTrans").innerHTML = splitResponse[7];
$("enumProds").innerHTML = splitResponse[8];
}else
{
ShowStatus(splitResponse[1]);
HideFview();
}
},
onFailure: function(){ alert('Something went wrong...') }
});
}//BuscarProd
function CancelEval(){
var resp = confirm("Esta seguro de cancelar la evaluacion?");
if(!resp)
return;
window.location = WEB_ROOT + "/bonificaciones";
}//CancelEval
function CheckKey(e){
if(window.event)
keyCode = window.event.keyCode;
else if(e)
keyCode=e.which;
if(keyCode == 13){
BuscarProd();
}
}//CheckKey