From d3d5a9590859868dba99170b2a3c29ce0614a374 Mon Sep 17 00:00:00 2001 From: rakcsle Date: Mon, 10 Mar 2025 11:34:50 -0700 Subject: [PATCH] =?UTF-8?q?Personal=20c=C3=B3digo=20siguiente?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- RH/Personal.aspx.vb | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/RH/Personal.aspx.vb b/RH/Personal.aspx.vb index f0351a9a0..b307f28ef 100644 --- a/RH/Personal.aspx.vb +++ b/RH/Personal.aspx.vb @@ -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