Cambio para limpiar campos

This commit is contained in:
HECTOR RODRIGUEZ
2021-06-22 01:04:32 -07:00
parent 6eea95ee9e
commit 2958ce3c60

View File

@@ -340,7 +340,6 @@
specialKeys.push(9); //Backspace specialKeys.push(9); //Backspace
function numericOnly(elementRef) { function numericOnly(elementRef) {
var keyCodeEntered = (event.which) ? event.which : (window.event.keyCode) ? window.event.keyCode : -1; var keyCodeEntered = (event.which) ? event.which : (window.event.keyCode) ? window.event.keyCode : -1;
debugger;
if ((keyCodeEntered >= 48) && (keyCodeEntered <= 57)) { if ((keyCodeEntered >= 48) && (keyCodeEntered <= 57)) {
return true; return true;
@@ -357,7 +356,6 @@
var tamaño = elementRef.value.length; var tamaño = elementRef.value.length;
if (tamaño == 0) { if (tamaño == 0) {
if ((elementRef.value) && (elementRef.value.indexOf('-') >= 0)) { if ((elementRef.value) && (elementRef.value.indexOf('-') >= 0)) {
debugger;
return false; return false;
} }
else { else {
@@ -367,7 +365,6 @@
} }
} }
debugger;
return false; return false;
} }
@@ -400,7 +397,6 @@
saldoInicial = saldoInicial + cantidad; saldoInicial = saldoInicial + cantidad;
$('#C_lblValorTotal').text(FormatoNumero(saldoInicial, 2)); $('#C_lblValorTotal').text(FormatoNumero(saldoInicial, 2));
$('#C_lblValorTotalSeleccionado').text(FormatoNumero(ValorTotalSeleccionado, 2)); $('#C_lblValorTotalSeleccionado').text(FormatoNumero(ValorTotalSeleccionado, 2));
debugger;
if ($('#C_ChkFaltante').attr('checked')) { if ($('#C_ChkFaltante').attr('checked')) {
@@ -418,7 +414,6 @@
alert("No es posible poner un importe Faltante/Sobrante superior a lo seleccionado"); alert("No es posible poner un importe Faltante/Sobrante superior a lo seleccionado");
saldo = 0; saldo = 0;
$('#C_lblValorTotal').text(FormatoNumero(ValorTotalSeleccionado, 2)); $('#C_lblValorTotal').text(FormatoNumero(ValorTotalSeleccionado, 2));
debugger;
} else { } else {
//debugger; //debugger;
@@ -441,7 +436,6 @@
alert("No es posible poner un descuento superior a lo seleccionado"); alert("No es posible poner un descuento superior a lo seleccionado");
saldo = 0; saldo = 0;
$('#C_lblValorTotal').text(FormatoNumero(ValorTotalSeleccionado, 2)); $('#C_lblValorTotal').text(FormatoNumero(ValorTotalSeleccionado, 2));
debugger;
} else { } else {
//saldo = ValorTotalSeleccionado + txtdescuento + comision; //saldo = ValorTotalSeleccionado + txtdescuento + comision;
//$('#C_lblValorTotal').text(FormatoNumero(saldo, 2)); //$('#C_lblValorTotal').text(FormatoNumero(saldo, 2));
@@ -466,7 +460,6 @@
alert("No es posible poner un descuento superior a lo seleccionado"); alert("No es posible poner un descuento superior a lo seleccionado");
saldo = 0; saldo = 0;
$('#C_lblValorTotal').text(FormatoNumero(ValorTotalSeleccionado, 2)); $('#C_lblValorTotal').text(FormatoNumero(ValorTotalSeleccionado, 2));
debugger;
} else { } else {
//saldo = ValorTotalSeleccionado + txtdescuento + comision; //saldo = ValorTotalSeleccionado + txtdescuento + comision;
//$('#C_lblValorTotal').text(FormatoNumero(saldo, 2)); //$('#C_lblValorTotal').text(FormatoNumero(saldo, 2));
@@ -491,7 +484,6 @@
alert("No es posible poner un importe IVA superior a lo seleccionado"); alert("No es posible poner un importe IVA superior a lo seleccionado");
saldo = 0; saldo = 0;
$('#C_lblValorTotal').text(FormatoNumero(ValorTotalSeleccionado, 2)); $('#C_lblValorTotal').text(FormatoNumero(ValorTotalSeleccionado, 2));
debugger;
} else { } else {
//debugger; //debugger;
@@ -536,12 +528,12 @@
function txtSumaIVA(txt) { function txtSumaIVA(txt) {
var comision2 = ToDouble($('#C_TxtIVA').val()); var comision2 = ToDouble($('#C_TxtIVA').val());
if (comision2 > ValorTotalSeleccionado) { if (comision2 > ValorTotalSeleccionado) {
$('#C_TxtIVA').val(IVA) $('#C_TxtIVA').val(IVA);
alert("No es posible poner un IVA superior a lo seleccionado") alert("No es posible poner un IVA superior a lo seleccionado");
} else { } else {
saldo = ValorTotalSeleccionado - descuento + comision - comision2 - ComisionIntermediario; saldo = ValorTotalSeleccionado - descuento + comision - comision2 - ComisionIntermediario;
$('#C_lblValorTotal').text(FormatoNumero(saldo, 2)); $('#C_lblValorTotal').text(FormatoNumero(saldo, 2));
IVA = ToDouble($('#C_TxtIVA').val()) IVA = ToDouble($('#C_TxtIVA').val());
} }
} }
@@ -549,12 +541,12 @@
function txtSumaTntermediario(txt) { function txtSumaTntermediario(txt) {
var comision2 = ToDouble($('#C_TxtComisionIntermediario').val()); var comision2 = ToDouble($('#C_TxtComisionIntermediario').val());
if (comision2 > ValorTotalSeleccionado) { if (comision2 > ValorTotalSeleccionado) {
$('#C_TxtComisionIntermediario').val(ComisionIntermediario) $('#C_TxtComisionIntermediario').val(ComisionIntermediario);
alert("No es posible poner un importe superior a lo seleccionado") alert("No es posible poner un importe superior a lo seleccionado");
} else { } else {
saldo = ValorTotalSeleccionado - descuento + comision - comision2 - IVA; saldo = ValorTotalSeleccionado - descuento + comision - comision2 - IVA;
$('#C_lblValorTotal').text(FormatoNumero(saldo, 2)); $('#C_lblValorTotal').text(FormatoNumero(saldo, 2));
ComisionIntermediario = ToDouble($('#C_TxtComisionIntermediario').val()) ComisionIntermediario = ToDouble($('#C_TxtComisionIntermediario').val());
} }
} }
@@ -562,12 +554,15 @@
function CheckFaltante(chk) { function CheckFaltante(chk) {
if (chk.checked == true) { if (chk.checked == true) {
$('#DivComision').css("display", "block"); $('#DivComision').css("display", "block");
$('#DivComisioncheck').removeClass("truncate") $('#DivComisioncheck').removeClass("truncate");
$("#DivDescuentocheck").css("margin-top", 0); $("#DivDescuentocheck").css("margin-top", 0);
} else { } else {
$('#C_TxtComision').val(0);
Recalcular();
$('#DivComision').css("display", "none"); $('#DivComision').css("display", "none");
$('#DivComisioncheck').addClass("truncate") $('#DivComisioncheck').addClass("truncate");
$("#DivDescuentocheck").css("margin-top", -25); $("#DivDescuentocheck").css("margin-top", -25);
} }
} }
@@ -575,15 +570,17 @@
function CheckDescuento(chk) { function CheckDescuento(chk) {
if (chk.checked == true) { if (chk.checked == true) {
$('#DivDescuento').css("display", "block"); $('#DivDescuento').css("display", "block");
$('#DivDescuentocheck').removeClass("truncate") $('#DivDescuentocheck').removeClass("truncate");
$("#DivIntercheck").css("margin-top", 0); $("#DivIntercheck").css("margin-top", 0);
} else { } else {
$('#C_TxtDescuento').val(0);
Recalcular();
$('#DivDescuento').css("display", "none"); $('#DivDescuento').css("display", "none");
$('#DivDescuentocheck').addClass("truncate") $('#DivDescuentocheck').addClass("truncate");
$("#DivIntercheck").css("margin-top", -25); $("#DivIntercheck").css("margin-top", -25);
} }
} }
@@ -591,14 +588,32 @@
function CheckIntermediario(chk) { function CheckIntermediario(chk) {
if (chk.checked == true) { if (chk.checked == true) {
$('#DivInter').css("display", "block"); $('#DivInter').css("display", "block");
$('#DivIntercheck').removeClass("truncate") $('#DivIntercheck').removeClass("truncate");
} else { } else {
$('#C_TxtIVA').val(0);
$('#C_TxtComisionIntermediario').val(0);
Recalcular();
$('#DivInter').css("display", "none"); $('#DivInter').css("display", "none");
$('#DivIntercheck').addClass("truncate") $('#DivIntercheck').addClass("truncate");
} }
} }
function Recalcular() {
debugger;
var Comision = ToDouble($('#C_TxtComision').val());
var Descuento = ToDouble($('#C_TxtDescuento').val());
var IVA = ToDouble($('#C_TxtIVA').val());
var ImporteInter = ToDouble($('#C_TxtComisionIntermediario').val());
var total = ValorTotalSeleccionado + Comision - Descuento - IVA - ImporteInter
$('#C_lblValorTotal').text(FormatoNumero(total, 2));
debugger;
}
</script> </script>