Está en la página 1de 5

FORMULARIO DE VENTAS

Jeraldine Valeria Espinoza Espinoza


NOMBRE COMPLETO:_________________________________________________________

NOMBRE COMPLETO: JERALDINE VALERIA ESPINOZA ESPINOZA

1. Captura de su pantalla de su editor de código (pantalla completa)


FORMULARIO DE VENTAS
NOMBRE COMPLETO:_________________________________________________________

2. fragmento del código (sin formato ni colores)


<script type="text/javascript">

$(document).ready(function(){

$("#menu").load("menu.html");

var i =0;

var newRow = function(){


$("#tabla tbody").append(
'<tr>'+
'<td>' + (++i) + '</td>'+
'<td><input class="form-control cant key" type="text" id="focus'+i+'"></td>'+
'<td>'+
'<select style="color: rgb(75, 73, 73);" class="form-control" id="opt" value="Sel">'+
' <option>Selecione un Producto</option>'+
'<option>Producto 1: color rojo</option>'+
'<option>Producto 2: cuenta con 100 piesas</option>'+
FORMULARIO DE VENTAS
NOMBRE COMPLETO:_________________________________________________________

'<option>Producto 3: Color negro</option>'+


'</select>' +
'</td>'+
'<td><input class="form-control pu key" type="text"></td>'+
'<td><input class="form-control subt" type="text" disabled></td>'+
'<td class="noPrint"><button class="btn btn-danger borrar"><i class="fa fa-trash fa-
sm"></i></button></td>'+
'</tr>');
$('#focus' + i).focus();
}
newRow();
var sumRow = function(){
var total=0;
i=0;
$("#tabla tbody tr").each(function(){
var cant = $(this).find('.cant').val();
var pu=$(this).find('.pu').val();
var subt = cant *pu;
total+=subt;
i++;
$(this).find('.subt').val(subt);

});

$('#total').text(total);

var desc = $('#descuento').val();

$('#totalF').text(total-desc);
}

$(document).on('keyup','.cant,.pu',function(){ sumRow();});
$(document).on('blur','.pu',function(){ newRow(); });

$(document).on('keyup','#descuento',function(){ sumRow();});

$(document).on('click','.borrar',function(){
FORMULARIO DE VENTAS
NOMBRE COMPLETO:_________________________________________________________

$(this).parents("tr").remove();
sumRow();
});
});
</script>

3. imagen de su formulario con su template


FORMULARIO DE VENTAS
NOMBRE COMPLETO:_________________________________________________________

También podría gustarte