From c3747e4b640c12a7fb1af483cc59c0c687110375 Mon Sep 17 00:00:00 2001 From: HECTOR RODRIGUEZ Date: Thu, 29 Apr 2021 20:53:58 -0700 Subject: [PATCH] Mejora en depositos --- Bancos/DepositosCaja.aspx | 76 +++++++++++++++++++++++++++++++----- Bancos/DepositosCaja.aspx.vb | 2 + 2 files changed, 69 insertions(+), 9 deletions(-) diff --git a/Bancos/DepositosCaja.aspx b/Bancos/DepositosCaja.aspx index 20e230d4d..adbf00f56 100644 --- a/Bancos/DepositosCaja.aspx +++ b/Bancos/DepositosCaja.aspx @@ -256,30 +256,89 @@ function FnSuma(chk, cantidad) { var saldoInicial = ToDouble($('#C_lblValorTotal').text()); + var ValorTotalSeleccionado2 = 0; + + $('#C_GvFacturas input[type=checkbox]').each( + function () { + if (this.checked) { + ValorTotalSeleccionado2 = ValorTotalSeleccionado2 + ToDouble(FormatoNumero($(this).val(), 2)); + } + } + ); + + ValorTotalSeleccionado = ValorTotalSeleccionado2; + if (chk.checked == false) { cantidad = cantidad * -1; } saldoInicial = saldoInicial + cantidad; $('#C_lblValorTotal').text(FormatoNumero(saldoInicial, 2)); - $('#C_lblValorTotalSeleccionado').text(FormatoNumero(saldoInicial, 2)); - ValorTotalSeleccionado = saldoInicial - + $('#C_lblValorTotalSeleccionado').text(FormatoNumero(ValorTotalSeleccionado, 2)); + debugger; + + + if ($('#C_ChkFaltante').attr('checked')) { + var txtcomision = ToDouble($('#C_TxtComision').val()); + if (txtcomision != 0) { + var comisionNegativa = 0; + if (txtcomision < 0) { + comisionNegativa = txtcomision * -1; + } + if (comisionNegativa > saldo) { + $('#C_TxtComision').val(0); + comision = 0; + descuento = 0; + txtcomision = 0; + alert("No es posible poner un importe Faltante/Sobrante superior a lo seleccionado"); + saldo = 0; + $('#C_lblValorTotal').text(FormatoNumero(ValorTotalSeleccionado, 2)); + debugger; + } else { + + //debugger; + } + } + } + if ($('#C_ChkDescuento').attr('checked')) { + var txtdescuento = ToDouble($('#C_TxtDescuento').val()); + if (txtdescuento != 0) { + var DescuentoNegativa = 0; + if (txtdescuento < 0) { + DescuentoNegativa = txtdescuento * -1; + } + if (DescuentoNegativa > saldo) { + $('#C_TxtDescuento').val(0); + comision = 0; + descuento = 0; + txtdescuento = 0; + alert("No es posible poner un descuento superior a lo seleccionado"); + saldo = 0; + $('#C_lblValorTotal').text(FormatoNumero(ValorTotalSeleccionado, 2)); + debugger; + } else { + //saldo = ValorTotalSeleccionado + txtdescuento + comision; + //$('#C_lblValorTotal').text(FormatoNumero(saldo, 2)); + //descuento = ToDouble($('#C_TxtDescuento').val()) + //debugger; + } + } + } + } function txtSuma(txt) { var comision2 = ToDouble($('#C_TxtComision').val()); var comisionNegativa = 0; if (comision2 < 0) { - comisionNegativa = comision2 * -1 + comisionNegativa = comision2 * -1; } if (comisionNegativa > ValorTotalSeleccionado) { - $('#C_TxtComision').val(comision) + $('#C_TxtComision').val(0) alert("No es posible poner una comision superior a lo seleccionado") } else { saldo = ValorTotalSeleccionado + comision2 + descuento; $('#C_lblValorTotal').text(FormatoNumero(saldo, 2)); comision = ToDouble($('#C_TxtComision').val()) - debugger; } } @@ -288,7 +347,7 @@ var comision2 = ToDouble($('#C_TxtDescuento').val()); var comisionNegativa = 0; if (comision2 < 0) { - comisionNegativa = comision2 * -1 + comisionNegativa = comision2 * -1; } if (comisionNegativa > ValorTotalSeleccionado) { $('#C_TxtDescuento').val(descuento) @@ -297,7 +356,6 @@ saldo = ValorTotalSeleccionado + comision2 + comision; $('#C_lblValorTotal').text(FormatoNumero(saldo, 2)); descuento = ToDouble($('#C_TxtDescuento').val()) - debugger; } } @@ -311,7 +369,7 @@ $('#divClasificacion').css("display", "block"); } else { $('#DivComision').css("display", "none"); - $('#divSubProyecto').css("display", "none"); + $('#LblSubproyecto').css("display", "none"); $('#divSubProyecto').css("display", "none"); $('#LblClasificacion').css("display", "none"); $('#divClasificacion').css("display", "none"); diff --git a/Bancos/DepositosCaja.aspx.vb b/Bancos/DepositosCaja.aspx.vb index 9274e79ab..260a9bc5d 100644 --- a/Bancos/DepositosCaja.aspx.vb +++ b/Bancos/DepositosCaja.aspx.vb @@ -253,6 +253,8 @@ Partial Class Bancos_DepositosCaja Protected Sub GvFacturas_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvFacturas.RowDataBound If e.Row.RowType = DataControlRowType.DataRow Then e.Row.FCCheckBox("ChkFactura").Attributes.Add("onclick", String.Format("FnSuma(this,{0});", e.Row.DBCampo("Importe"))) + e.Row.FCCheckBox("ChkFactura").InputAttributes.Add("Value", e.Row.DBCampo("Importe")) + End If End Sub