Personal código siguiente

This commit is contained in:
rakcsle
2025-03-10 11:34:50 -07:00
parent 5c55d3d968
commit d3d5a95908

View File

@@ -8,6 +8,7 @@ Imports Microsoft.Reporting.WebForms
Imports System.Globalization
Imports System.Data.SqlTypes
Imports DocumentFormat.OpenXml.Drawing.Diagrams
Imports Microsoft.AspNet.SignalR.Infrastructure
Partial Class RH_Personal
Inherits ClsPaginas
@@ -1058,11 +1059,42 @@ Partial Class RH_Personal
DVDdlTipoSangre.Visible = True
End If
If Not CvePersonal > 0 Then
AsignaSiguienteCodigo()
End If
End If
AgregarEventosAsincronosGvVacaciones()
End Sub
Private Sub AsignaSiguienteCodigo()
Dim ObjPersonal As New ClsRH()
If ObjPersonal.GetPersonal(-1, "-1", "-1", "-1", "-1", -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "-1", -1, -1, -1, -1, -1, -1, "-1", "-1", "-1", "-1", UsuarioActual.CveEmpresa) Then
Dim MaxCodigo As Integer = 1
If ObjPersonal.DtResultados.Rows.Count > 0 Then
MaxCodigo = ObjPersonal.DtResultados.AsEnumerable() _
.Select(Function(row)
Dim codigoStr As String = row.Field(Of String)("Codigo")
If Not String.IsNullOrWhiteSpace(codigoStr) Then
Dim codigo As Integer
If Integer.TryParse(codigoStr, codigo) Then
Return codigo
End If
End If
Return 0
End Function) _
.DefaultIfEmpty(0) _
.Max()
End If
TxtCodigo.Text = (MaxCodigo + 1).ToString("000")
End If
ObjPersonal.Dispose()
End Sub
Private Sub LoadDefaultValues()
DdlDepartamento.SelectedIndex = 1