From b6817236804e37ae0e35d7f1829cd133729758a7 Mon Sep 17 00:00:00 2001 From: rakcsle Date: Tue, 21 May 2024 11:31:53 -0700 Subject: [PATCH] =?UTF-8?q?EMD=20-=20Agregar=20Clasificaci=C3=B3n=20a=20un?= =?UTF-8?q?=20presupuesto?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Compras/Compras.aspx | 8 ++- Contratos/ModificarPresupuesto.aspx | 70 ++++++++++++++++++++- Contratos/ModificarPresupuesto.aspx.vb | 86 +++++++++++++++++++++++++- 3 files changed, 159 insertions(+), 5 deletions(-) diff --git a/Compras/Compras.aspx b/Compras/Compras.aspx index 2db947fe9..ea1caef0c 100644 --- a/Compras/Compras.aspx +++ b/Compras/Compras.aspx @@ -5937,7 +5937,7 @@ } } else { TCC = 1; } - var DifSaldo = (TotalSaldoCompra - FnSumaValoresAnt()).toFixed(2); // le agrego lo del valor actual para validarlo + var DifSaldo = (TotalSaldoCompra - FnSumaValoresAnt());//.toFixed(2); // le agrego lo del valor actual para validarlo @@ -5952,7 +5952,7 @@ let difFinal = (DifSaldo - importevalue) * TCC; if (difFinal > 0 && difFinal < 1) { - txtComision.value = toFixed(ToDouble(difFinal), 2); + txtComision.value = toFixed(roundToTwo(difFinal), 2); } @@ -5968,6 +5968,10 @@ } + function roundToTwo(num) { + return Math.round(num * 100) / 100; + } + function FnCambiaAnt(chk, txt, saldo, TotalSaldo, CveMonedaAnticipo, TCAnticipo, CveMonedaOriginal, txtComision) { var Total = ToDouble($get('TxtTotal').value); diff --git a/Contratos/ModificarPresupuesto.aspx b/Contratos/ModificarPresupuesto.aspx index eab520066..5c419e264 100644 --- a/Contratos/ModificarPresupuesto.aspx +++ b/Contratos/ModificarPresupuesto.aspx @@ -10,6 +10,17 @@ + + + + +
  • + +
  • + +
    +
    @@ -98,7 +109,7 @@
    -
    +
    - +
    + + + + + diff --git a/Contratos/ModificarPresupuesto.aspx.vb b/Contratos/ModificarPresupuesto.aspx.vb index a15b37859..7eba861ad 100644 --- a/Contratos/ModificarPresupuesto.aspx.vb +++ b/Contratos/ModificarPresupuesto.aspx.vb @@ -88,11 +88,13 @@ Partial Class Contratos_ModificarPresupuesto #Region "C A R G A - D A T O S" Private Sub CargaDatos() + Dim CvePresupuesto = DdlPresupuesto.SelectedValue.ToEntero Dim Nombre = "-1" Dim CveSubProyecto = -1 Dim CveUsuario = -1 Dim Agrupador = 1 'CLASIFICACION + If CvePresupuesto > 0 Then TxtFecha.Text = NowADS().ToString("dd/MM/yyyy") Dim DrPresupuesto = DtPresupuestos.FiltroPrimero($"CvePresupuesto = {CvePresupuesto}") @@ -131,10 +133,22 @@ Partial Class Contratos_ModificarPresupuesto GvPresupuestos.Columns(3).Visible = True GvPresupuestos.Columns(4).Visible = True End Select - + Else + DtClasificaciones = New DataTable + GvPresupuestos.DataSource = DtClasificaciones + GvPresupuestos.DataBind() End If + + + + ValidaAcciones() + End Sub + + + + Protected Sub GvPresupuestos_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvPresupuestos.RowDataBound If e.Row.RowType = DataControlRowType.DataRow Then Dim StrTipo = DdlTipo.SelectedValue @@ -286,4 +300,74 @@ Partial Class Contratos_ModificarPresupuesto End If End Sub + + + Private Sub ValidaAcciones() + LnkAccionesAgregarClasificacion.Visible = False + If DtClasificaciones IsNot Nothing AndAlso DtClasificaciones.Rows.Count > 0 Then + LnkAccionesAgregarClasificacion.Visible = True + End If + UpAcciones.Update() + + End Sub + + Protected Sub LnkAccionesAgregarClasificacion_Click(sender As Object, e As EventArgs) + CargaAccionesDdlclasificaciones() + RegistraScript("$('#DVModalAgregarClasificacion').modal();") + End Sub + + Private Sub CargaAccionesDdlclasificaciones() + + Dim dtClasificaciones As DataTable = Me.DtClasificaciones.Copy + Dim globalDtClasificacionesn As DataTable = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltraParametros("Tipo = 1").Copy + + + Dim filteredRecords = From globalRow In globalDtClasificacionesn.AsEnumerable() + Where Not dtClasificaciones.AsEnumerable().Any(Function(dtRow) dtRow.Field(Of Integer)("CveClasificacion") = globalRow.Field(Of Integer)("CveClasificacion")) + Select globalRow + + + Dim resultTable As DataTable = globalDtClasificacionesn.Clone() + For Each row In filteredRecords + resultTable.ImportRow(row) + Next + + + DdlModalClasificacion.DataSource = resultTable + + DdlModalClasificacion.DataBind() + DdlModalClasificacion.Items.Insert(0, New ListItem("Seleccione Una", "-1")) + UpModalAgregarClasicicacion.Update() + End Sub + + Protected Sub LnkModalAgregarClasificacion_Click(sender As Object, e As EventArgs) + + Dim CvePresupuesto = DdlPresupuesto.SelectedValue.ToEntero + Dim CveClasificacion As Integer = DdlModalClasificacion.SelectedValue.ToEntero + + If CveClasificacion > 0 Then + + Dim ObjCont As New ClsContratos + Dim TieneError As Boolean = False + + If Not ObjCont.AddPresupuestosDetalle(CvePresupuesto, CveClasificacion, -1, 0, "") Then + TieneError = True + End If + + ObjCont.Dispose() + + If Not TieneError Then + RegistraScript($"$('#DVModalAgregarClasificacion').modal('hide');") + Alert($"Clasificación {DdlModalClasificacion.SelectedItem.Text} agregada correctamente.") + CargaDatos() + UpGvClasificaciones.Update() + End If + + End If + + + + End Sub + + End Class