Primer commit del sistema avantika sin cambios
This commit is contained in:
247
javascript/ventas-cobrar.js
Executable file
247
javascript/ventas-cobrar.js
Executable file
@@ -0,0 +1,247 @@
|
||||
function CobrarVentaPagos(id){
|
||||
|
||||
new Ajax.Request(WEB_ROOT+'/ajax/ventas.php',{
|
||||
method:'post',
|
||||
parameters: {type: "cobrarVtaDesc", ventaId:id},
|
||||
onSuccess: function(transport){
|
||||
var response = transport.responseText || "no response text";
|
||||
var splitResponse = response.split("[#]");
|
||||
|
||||
if(splitResponse[0] == "ok"){
|
||||
FViewOffSetCobro(splitResponse[1]);
|
||||
$('fviewCobro').show();
|
||||
|
||||
Event.observe($('frmPagos'), 'submit', function (e) {
|
||||
Event.stop(e);
|
||||
});
|
||||
|
||||
}else if(splitResponse[0] == "fail"){
|
||||
alert(splitResponse[1]);
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
onFailure: function(){ alert('Something went wrong...') }
|
||||
|
||||
});
|
||||
|
||||
|
||||
}//CobrarVentaPagos
|
||||
|
||||
function SaveVenta(){
|
||||
|
||||
$("action").value = "saveVentaDesc";
|
||||
$("idVta").value = $("vtaId").value;
|
||||
|
||||
new Ajax.Request(WEB_ROOT+'/ajax/ventas.php',{
|
||||
method:'post',
|
||||
parameters: $("frmPagos").serialize(),
|
||||
onSuccess: function(transport){
|
||||
var response = transport.responseText || "no response text";
|
||||
var splitResponse = response.split("[#]");
|
||||
|
||||
if(splitResponse[0] == "ok"){
|
||||
|
||||
PrintTicket(splitResponse[1]);
|
||||
HideFviewCobro();
|
||||
CerrarVta();
|
||||
|
||||
}else if(splitResponse[0] == "addPago"){
|
||||
AddPago();
|
||||
}else if(splitResponse[0] == "fail"){
|
||||
alert(splitResponse[1]);
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
onFailure: function(){ alert('Something went wrong...') }
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
//Pagos
|
||||
|
||||
function SavePagos(){
|
||||
|
||||
new Ajax.Request(WEB_ROOT+'/ajax/ventas.php',{
|
||||
method:'post',
|
||||
parameters: $("frmPagos").serialize(),
|
||||
onSuccess: function(transport){
|
||||
var response = transport.responseText || "no response text";
|
||||
var splitResponse = response.split("[#]");
|
||||
|
||||
},
|
||||
|
||||
onFailure: function(){ alert('Something went wrong...') }
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function AddPago(){
|
||||
|
||||
$("action").value = "addPago";
|
||||
|
||||
new Ajax.Request(WEB_ROOT+'/ajax/ventas.php',{
|
||||
method:'post',
|
||||
parameters: $("frmPagos").serialize(),
|
||||
onSuccess: function(transport){
|
||||
var response = transport.responseText || "no response text";
|
||||
var splitResponse = response.split("[#]");
|
||||
|
||||
$("listPagos").innerHTML = response;
|
||||
|
||||
},
|
||||
|
||||
onFailure: function(){ alert('Something went wrong...') }
|
||||
|
||||
});
|
||||
|
||||
}//AddPago
|
||||
|
||||
function DeletePago(k){
|
||||
|
||||
$("action").value = "deletePago";
|
||||
$("k").value = k;
|
||||
|
||||
new Ajax.Request(WEB_ROOT+'/ajax/ventas.php',{
|
||||
method:'post',
|
||||
parameters: $("frmPagos").serialize(),
|
||||
onSuccess: function(transport){
|
||||
var response = transport.responseText || "no response text";
|
||||
var splitResponse = response.split("[#]");
|
||||
|
||||
$("listPagos").innerHTML = response;
|
||||
UpdateCambio();
|
||||
|
||||
},
|
||||
|
||||
onFailure: function(){ alert('Something went wrong...') }
|
||||
|
||||
});
|
||||
|
||||
}//DeletePago
|
||||
|
||||
function UpdateCambio(){
|
||||
|
||||
$("action").value = "updateCambioDesc";
|
||||
$("idVta").value = $("vtaId").value;
|
||||
|
||||
new Ajax.Request(WEB_ROOT+'/ajax/ventas.php',{
|
||||
method:'post',
|
||||
parameters: $("frmPagos").serialize(),
|
||||
onSuccess: function(transport){
|
||||
var response = transport.responseText || "no response text";
|
||||
var splitResponse = response.split("[#]");
|
||||
|
||||
if(splitResponse[0] == "ok"){
|
||||
$("txtTotalPagado").innerHTML = splitResponse[1];
|
||||
$("txtPorPagar").innerHTML = splitResponse[2];
|
||||
$("txtCambio").innerHTML = splitResponse[3];
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
onFailure: function(){ alert('Something went wrong...') }
|
||||
|
||||
});
|
||||
|
||||
}//UpdateCambio
|
||||
|
||||
function CheckMetodoPago(k){
|
||||
|
||||
var metodoPagoId = $("idMetodoPago_"+k).value;
|
||||
|
||||
/*
|
||||
if(metodoPagoId == 5){
|
||||
$("codigoMon_"+k).show();
|
||||
$("saldoMon_"+k).show();
|
||||
}
|
||||
*/
|
||||
if(metodoPagoId == 6){
|
||||
$("vtaId_"+k).show();
|
||||
$("saldoFav_"+k).show();
|
||||
}else{
|
||||
$("vtaId_"+k).hide();
|
||||
$("saldoFav_"+k).hide();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
function GetSaldoMonedero(k){
|
||||
|
||||
var codigo = $("monCodigo_"+k).value;
|
||||
|
||||
new Ajax.Request(WEB_ROOT+'/ajax/ventas.php',{
|
||||
method:'post',
|
||||
parameters: {type:"checkMonedero", codigo:codigo},
|
||||
onSuccess: function(transport){
|
||||
var response = transport.responseText || "no response text";
|
||||
var splitResponse = response.split("[#]");
|
||||
|
||||
if(splitResponse[0] == "ok"){
|
||||
$("txtSaldo_"+k).innerHTML = splitResponse[1];
|
||||
}else{
|
||||
alert(splitResponse[1]);
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
onFailure: function(){ alert('Something went wrong...') }
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
function GetSaldoFavor(k){
|
||||
|
||||
var idVenta = $("idVta_"+k).value;
|
||||
|
||||
new Ajax.Request(WEB_ROOT+'/ajax/ventas.php',{
|
||||
method:'post',
|
||||
parameters: {type:"checkSaldo", ventaId:idVenta},
|
||||
onSuccess: function(transport){
|
||||
var response = transport.responseText || "no response text";
|
||||
var splitResponse = response.split("[#]");
|
||||
|
||||
if(splitResponse[0] == "ok"){
|
||||
$("txtSaldoFav_"+k).innerHTML = splitResponse[1];
|
||||
}else{
|
||||
alert(splitResponse[1]);
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
onFailure: function(){ alert('Something went wrong...') }
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function CheckKeyPago(e){
|
||||
|
||||
if(window.event)
|
||||
keyCode = window.event.keyCode;
|
||||
else if(e)
|
||||
keyCode=e.which;
|
||||
|
||||
if(keyCode == 13)
|
||||
SaveVenta();
|
||||
else
|
||||
UpdateCambio();
|
||||
|
||||
}//CheckKeyPago
|
||||
|
||||
function PrintTicket(id){
|
||||
|
||||
window.open(WEB_ROOT + "/ventas-ticket/id/" + id , "Ticket" , "width=350,height=300,scrollbars=YES")
|
||||
|
||||
}//PrintTicket
|
||||
|
||||
function CerrarVta(){
|
||||
window.parent.HideFviewVta();
|
||||
window.parent.location.reload();
|
||||
}
|
||||
Reference in New Issue
Block a user