Correciones Presupuestos, comisiones modal de comisiones

This commit is contained in:
rakcsle
2024-03-14 19:29:41 -07:00
parent e196a0776c
commit 17cda912eb
9 changed files with 628 additions and 74 deletions

View File

@@ -20281,13 +20281,13 @@ Partial Class Compras_Compras
Dim Autorizado As Double = 0
Dim Ejercido As Double = 0
If ObjCon.GetPresupuestosResumen(UsuarioActual.CveEmpresa, -1) Then
If ObjCon.GetPresupuestosResumen(UsuarioActual.CveEmpresa, -1, 1) Then
Dim FechaCompra As Date = TxtFecha.Text.ToDate
Dim resultadosFiltrados = From row In ObjCon.DtResultados.AsEnumerable()
Where FechaCompra >= row.Field(Of Date)("FechaInicio") AndAlso
FechaCompra <= row.Field(Of Date)("FechaFin")
FechaCompra <= row.Field(Of Date)("FechaFin")
Select row
@@ -20315,54 +20315,68 @@ Partial Class Compras_Compras
If Opcion = 1 Then
Dim saldoTotal As Decimal = (From row In resultadosFiltrados
Where row.Field(Of Integer)("CveSubProyecto") = ValCveSubProyecto AndAlso
row.Field(Of Integer)("CveClasificacion") = ValCveClasificacion AndAlso
row.Field(Of Integer)("CveTipoGasto") = ValCveTipoGasto
Select row.Field(Of Decimal)("Saldo")).Sum()
If saldoTotal > 0 Then
Dim TotalAcumuladoTabla As Decimal = (TmpDT.SUM("Total", $" CveSubProyecto = {ValCveSubProyecto} AND CveClasificacion = {ValCveClasificacion} AND CveTipoGasto = {ValCveTipoGasto} "))
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>, Tipo de gasto <b>{ValTipoGasto}</b>. Se excede por <b>{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>, Tipo de gasto <b>{ValTipoGasto}</b> ", TipoMensaje.MsgAdvertencia)
respuesta = False
End If
Else
For Each item In EnumAgrupado
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") = item.CveSubProyecto AndAlso
row.Field(Of Integer)("CveClasificacion") = item.CveClasificacion
Where row.Field(Of Integer)("CveSubProyecto") = ValCveSubProyecto AndAlso
row.Field(Of Integer)("CveClasificacion") = ValCveClasificacion AndAlso
row.Field(Of Integer)("CveTipoGasto") = ValCveTipoGasto
Select row.Field(Of Decimal)("Saldo")).Sum()
If saldoTotal > 0 Then
Dim Diferencia As Decimal = saldoTotal - item.TotalSum
Dim TotalAcumuladoTabla As Decimal = (TmpDT.SUM("Total", $" CveSubProyecto = {ValCveSubProyecto} AND CveClasificacion = {ValCveClasificacion} AND CveTipoGasto = {ValCveTipoGasto} "))
Dim Diferencia As Decimal = saldoTotal - TotalAcumuladoTabla - ValImporte
If (Diferencia) < 0 Then
Alert($"No hay presupuesto disponible en el subproyecto <b>{item.SubProyecto}</b> con la clasificación <b>{item.Clasificacion}</b>, Tipo de gasto <b>{item.TipoGasto}</b>. Se excede por <b>{Diferencia.FormatoNumero}</b>", TipoMensaje.MsgAdvertencia)
Alert($"No hay presupuesto disponible en el subproyecto <b>{ValSubProyecto}</b> con la clasificación <b>{ValClasificacion}</b>, Tipo de gasto <b>{ValTipoGasto}</b>. Se excede por <b>{Math.Abs(Diferencia).FormatoNumero}</b>", TipoMensaje.MsgAdvertencia)
respuesta = False
Exit For
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>, Tipo de gasto <b>{item.TipoGasto}</b>", TipoMensaje.MsgAdvertencia)
Alert($"No hay presupuesto disponible en el subproyecto <b>{ValSubProyecto}</b> con la clasificación <b>{ValClasificacion}</b>, Tipo de gasto <b>{ValTipoGasto}</b> ", TipoMensaje.MsgAdvertencia)
respuesta = False
Exit For
End If
Else
respuesta = True
End If
Else
For Each item In EnumAgrupado
Dim tieneRegistrosConCveSubProyecto As Boolean = resultadosFiltrados.Any(Function(row) CType(row("CveSubProyecto"), Integer) = item.CveSubProyecto)
If tieneRegistrosConCveSubProyecto Then
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()
If saldoTotal > 0 Then
Dim Diferencia As Decimal = saldoTotal - item.TotalSum
If (Diferencia) < 0 Then
Alert($"No hay presupuesto disponible en el subproyecto <b>{item.SubProyecto}</b> con la clasificación <b>{item.Clasificacion}</b>, Tipo de gasto <b>{item.TipoGasto}</b>. Se excede por <b>{Math.Abs(Diferencia).FormatoNumero}</b>", TipoMensaje.MsgAdvertencia)
respuesta = False
Exit For
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>, Tipo de gasto <b>{item.TipoGasto}</b>", TipoMensaje.MsgAdvertencia)
respuesta = False
Exit For
End If
Else
respuesta = True
End If
Next
End If
@@ -20370,10 +20384,14 @@ Partial Class Compras_Compras
Else
Alert("No hay presupuestos.", TipoMensaje.MsgAdvertencia)
'Alert("No hay presupuestos.", TipoMensaje.MsgAdvertencia)
respuesta = True
End If
Else
Alert("No hay presupuestos.", TipoMensaje.MsgAdvertencia)
'Alert("No hay presupuestos.", TipoMensaje.MsgAdvertencia)
respuesta = False
End If
ObjCon.Dispose()

View File

@@ -1473,6 +1473,13 @@
<asp:CompareValidator ID="cvFechaIAdd" runat="server" ControlToValidate="txtFechaIAdd" Display="None" ErrorMessage="El campo <b>''Fecha Inicial''</b> no tienes el formato correcto, por favor intente de nuevo con el siguiente formato: (dd/mm/yyyy)." Operator="DataTypeCheck" Type="Date" ValidationGroup="GrpAddSolicitud"></asp:CompareValidator>
<ajax:ValidatorCalloutExtender ID="ValidatorCalloutExtender3" runat="server" HighlightCssClass="vco" TargetControlID="rfvFechaIAdd" Width="350px"></ajax:ValidatorCalloutExtender>
<ajax:ValidatorCalloutExtender ID="ValidatorCalloutExtender4" runat="server" HighlightCssClass="vco" TargetControlID="cvFechaIAdd" Width="350px"></ajax:ValidatorCalloutExtender>
<%-- <asp:CompareValidator ID="CvtxtFechaIAdd" ControlToCompare="txtFechaIAdd" ControlToValidate="txtFechaFAdd" Type="Date" Operator="GreaterThan" ValidationGroup="GrpAddSolicitud" Display="None"
ErrorMessage="La Fecha Inicio no puede ser inferior que la Fecha Fin" runat="server"></asp:CompareValidator>
<ajax:ValidatorCalloutExtender ID="VceCvtxtFechaIAdd" runat="server" HighlightCssClass="vco" TargetControlID="CvtxtFechaIAdd" Width="350px"></ajax:ValidatorCalloutExtender>--%>
<label for="<%= txtFechaIAdd.ClientID.ToString() %>" style="margin-top: -6px">Fecha Inicio:</label>
</div>
</div>
@@ -1487,6 +1494,12 @@
<ajax:CalendarExtender runat="server" ID="CalendarExtender2" TargetControlID="txtFechaFAdd" PopupButtonID="LnkFechaFAdd" PopupPosition="BottomRight" Enabled="True"></ajax:CalendarExtender>
<asp:RequiredFieldValidator ID="rfvFechaFAdd" runat="server" ControlToValidate="txtFechaFAdd" Display="None" ErrorMessage="El campo <b>''Fecha Final''</b> es requerido por la aplicación, por favor ingrese una fecha." ValidationGroup="GrpAddSolicitud"></asp:RequiredFieldValidator>
<asp:CompareValidator ID="cvFechaFAdd" runat="server" ControlToValidate="txtFechaFAdd" Display="None" ErrorMessage="El campo <b>''Fecha Final''</b> no tienes el formato correcto, por favor intente de nuevo con el siguiente formato: (dd/mm/yyyy)." Operator="DataTypeCheck" Type="Date" ValidationGroup="GrpAddSolicitud"></asp:CompareValidator>
<asp:CompareValidator ID="CvetxtFechaFAdd" ControlToCompare="txtFechaFAdd" ControlToValidate="txtFechaIAdd" Type="Date" Operator="LessThan" ValidationGroup="GrpAddSolicitud" Display="None"
ErrorMessage="Fecha Fin no puede ser inferior que la Fecha Inicio" runat="server"></asp:CompareValidator>
<ajax:ValidatorCalloutExtender ID="VceCvFechas" runat="server" HighlightCssClass="vco" TargetControlID="CvetxtFechaFAdd" Width="350px"></ajax:ValidatorCalloutExtender>
<ajax:ValidatorCalloutExtender ID="ValidatorCalloutExtender5" runat="server" HighlightCssClass="vco" TargetControlID="rfvFechaFAdd" Width="350px"></ajax:ValidatorCalloutExtender>
<ajax:ValidatorCalloutExtender ID="ValidatorCalloutExtender6" runat="server" HighlightCssClass="vco" TargetControlID="cvFechaFAdd" Width="350px"></ajax:ValidatorCalloutExtender>
<label for="<%= txtFechaFAdd.ClientID.ToString() %>" style="margin-top: -6px">Fecha Fin:</label>

View File

@@ -2652,6 +2652,9 @@ Partial Class Compras_eFacturas
'End Sub
Protected Sub LnkSolicitarSat_Click(ByVal sender As Object, ByVal e As EventArgs)
Exit Sub
Dim sbResultado As StringBuilder = New StringBuilder()
Dim idSolicitudCFDI As Integer = 0
Dim idSolicitudMetadata As Integer = 0