-- prespuestos resumen

This commit is contained in:
2024-05-20 19:39:17 -07:00
parent 4d6d7b3e0c
commit 55d070df28
2 changed files with 14 additions and 28 deletions

View File

@@ -3201,7 +3201,7 @@ Public Class ClsContratos
End Function
Public Function GetPresupuestosResumen(CveEmpresa As Integer, CveSubProyecto As Integer, Opcion As Integer) As Boolean
Public Function GetPresupuestosResumen(CveEmpresa As Integer, CveSubProyecto As Integer, FechaInicio As Date, FechaFin As Date, Opcion As Integer) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Con_PresupuestosResumenGet")
@@ -3209,6 +3209,8 @@ Public Class ClsContratos
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
.Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto
.Add("@Opcion", SqlDbType.Int).Value = Opcion
.Add("@FechaInicio", SqlDbType.Date).Value = FechaInicio
.Add("@FechaFin", SqlDbType.Date).Value = FechaFin
End With
Try

View File

@@ -9056,54 +9056,46 @@ Partial Class OC_OC
Dim ObjCon As New ClsContratos
Dim CvePresupuesto As Integer = 0
Dim Autorizado As Double = 0
Dim Ejercido As Double = 0
If ObjCon.GetPresupuestosResumen(UsuarioActual.CveEmpresa, -1, 2) Then
Dim FechaCompra As Date = TxtFecha.Text.ToDate
Dim Autorizado As Decimal = 0
Dim Ejercido As Decimal = 0
Dim FechaCompra As Date = TxtFecha.Text.ToDate
If ObjCon.GetPresupuestosResumen(UsuarioActual.CveEmpresa, -1, FechaCompra.FirstDayOfMonth, FechaCompra.LastDayOfMonth, 2) Then
Dim ColumnaSaldo As String = "Saldo"
If UsuarioActual.CveEmpresa.Contiene(13, 83) Then ColumnaSaldo = "SalodComprometido"
Dim resultadosFiltrados = From row In ObjCon.DtResultados.AsEnumerable()
Where FechaCompra >= row.Field(Of Date)("FechaInicio") AndAlso
FechaCompra <= row.Field(Of Date)("FechaFin")
Select row
If resultadosFiltrados.Count > 0 Then
If ObjCon.DtResultados.Rows.Count > 0 Then
If Opcion = 1 Then
Dim tieneRegistrosConCveSubProyecto As Boolean = resultadosFiltrados.Any(Function(row) CType(row("CveSubProyecto"), Integer) = ValCveSubProyecto)
If tieneRegistrosConCveSubProyecto Then
Dim saldoTotal As Decimal = (From row In resultadosFiltrados
Where row.Field(Of Integer)("CveSubProyecto") = ValCveSubProyecto AndAlso
row.Field(Of Integer)("CveClasificacion") = ValCveClasificacion
Select row.Field(Of Decimal)("Saldo")).Sum()
Select row.Field(Of Decimal)(ColumnaSaldo)).Sum()
If saldoTotal > 0 Then
Dim TotalAcumuladoTabla As Decimal = (DtDetalle.SUM("Total", $" CveSubProyecto = {ValCveSubProyecto} AND CveClasificacion = {ValCveClasificacion} "))
Dim Diferencia As Decimal = saldoTotal - TotalAcumuladoTabla - ValImporte
If (Diferencia) < 0 Then
Alert($"No hay presupuesto disponible en el subproyecto <b>{ValSubProyecto}</b> con la clasificación <b>{ValClasificacion}</b>. Se excede por <b>{ Math.Abs(Diferencia).FormatoNumero}</b>", TipoMensaje.MsgAdvertencia)
Alert($"No hay presupuesto disponible en: <br/> Subproyecto:<b> {ValSubProyecto}</b> Clasificación:<b> {ValClasificacion}</b>. Se excede por <b>{ Math.Abs(Diferencia).FormatoNumero}</b>", TipoMensaje.MsgAdvertencia)
respuesta = False
Else
respuesta = True
End If
Else
Alert($"No hay presupuesto disponible en el subproyecto <b>{ValSubProyecto}</b> con la clasificación <b>{ValClasificacion}</b>.", TipoMensaje.MsgAdvertencia)
Alert($"No hay presupuesto disponible en: <br/> Subproyecto:<b> {ValSubProyecto}</b> Clasificación:<b> {ValClasificacion}</b>.", TipoMensaje.MsgAdvertencia)
respuesta = False
End If
Else
respuesta = True
End If
Else
Dim EnumAgrupado = (From row In DtDetalle.AsEnumerable()
Group row By
SubProyecto = row.Field(Of String)("SubProyecto"),
@@ -9127,7 +9119,7 @@ Partial Class OC_OC
Dim saldoTotal As Decimal = (From row In resultadosFiltrados
Where row.Field(Of Integer)("CveSubProyecto") = item.CveSubProyecto AndAlso
row.Field(Of Integer)("CveClasificacion") = item.CveClasificacion
Select row.Field(Of Decimal)("Saldo")).Sum()
Select row.Field(Of Decimal)(ColumnaSaldo)).Sum()
If saldoTotal > 0 Then
Dim Diferencia As Decimal = saldoTotal - item.TotalSum
@@ -9139,7 +9131,6 @@ Partial Class OC_OC
Else
respuesta = True
End If
Else
Alert($"No hay presupuesto disponible en el subproyecto <b>{item.SubProyecto}</b> con la clasificación <b>{item.Clasificacion}</b>.", TipoMensaje.MsgAdvertencia)
respuesta = False
@@ -9149,7 +9140,6 @@ Partial Class OC_OC
respuesta = True
End If
Next
End If
Else
@@ -9160,16 +9150,10 @@ Partial Class OC_OC
'Alert("No hay presupuestos.", TipoMensaje.MsgAdvertencia)
respuesta = False
End If
ObjCon.Dispose()
Else
respuesta = True
End If
Return respuesta
End Function