Validar Venta
Publicado por Jesus (1 intervención) el 19/10/2017 05:24:06
Buenas noches nececito una manito no se como validar para que no me acepte agregar el mismo producto a mi detalle de venta este es mi codigo en javascrip, estare muy agradecido con por su ayuda.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
function agregarDetalle(idarticulo,articulo,precio_venta)
{
var cantidad=1;
var descuento=0;
if (idarticulo!="")
{
var subtotal=cantidad*precio_venta;
var fila='<tr class="filas" id="fila'+cont+'">'+
'<td><button type="button" class="btn btn-danger" onclick="eliminarDetalle('+cont+')">X</button></td>'+
'<td><input type="text" name="idarticulo[]" value="'+idarticulo+'">'+articulo+'</td>'+
'<td><input type="number" name="cantidad[]" id="cantidad[]" value="'+cantidad+'" onchange="modificarSubototales();"></td>'+
'<td><input type="number" name="precio_venta[]" id="precio_venta[]" value="'+precio_venta+'" onchange="modificarSubototales();"></td>'+
'<td><input type="number" name="descuento[]" value="'+descuento+'" onchange="modificarSubototales();"></td>'+
'<td><span name="subtotal" id="subtotal'+cont+'">'+subtotal+'</span></td>'+
'<td><button type="button" onclick="modificarSubototales()" class="btn btn-info"><i class="fa fa-refresh"></i></button></td>'+
'</tr>';
cont++;
detalles=detalles+1;
$('#detalles').append(fila);
modificarSubototales();
}
else
{
alert("Error al ingresar el detalle, revisar los datos del artículo");
}
}
Valora esta pregunta


0