Validacion de fecha de ajuste

This commit is contained in:
2022-09-30 18:44:48 -07:00
parent 58c42f1429
commit a08c401d09
2 changed files with 14 additions and 3 deletions

View File

@@ -7130,12 +7130,22 @@ Partial Class PV
'End Sub
Private Function CalculaMesesUso() As Boolean
Dim FechaI As Date = TxtFechaAjuste.Text.ToDate.AddDays(1)
Dim FechaI As Date = Now
If IsDate(TxtFechaAjuste.Text) Then
FechaI = TxtFechaAjuste.Text.ToDate.AddDays(1)
Else
TxtMesesUso.Text = ""
Alert("La fecha de ajuste no tiene el formato correcto", TipoMensaje.MsgAdvertencia)
Return False
End If
Dim FechaF As Date = Now
If FechaI.AddDays(-1) > FechaF Then
TxtMesesUso.Text = ""
TxtFechaAjuste.Text = FechaF.ToString("dd/MM/yyyy")
Alert("La fecha de ajuste debe ser menor a la fecha actual", TipoMensaje.ToastAdventencia)
Alert("La fecha de ajuste debe ser menor a la fecha actual", TipoMensaje.MsgAdvertencia)
Return False
End If