From 7c38c8aeb8aa858ad6eb09f643078ff1103fc8e8 Mon Sep 17 00:00:00 2001 From: JORGE LUIS CAUDILLO ESPARZA Date: Tue, 13 Aug 2024 06:49:54 -0700 Subject: [PATCH] --- Nomina/CatPeriodos.aspx | 8 ++- Nomina/CatPeriodos.aspx.vb | 125 +++++++++++++++++++++---------------- Nomina/Nomina.aspx | 8 +-- 3 files changed, 81 insertions(+), 60 deletions(-) diff --git a/Nomina/CatPeriodos.aspx b/Nomina/CatPeriodos.aspx index cd697aca8..1787267e5 100644 --- a/Nomina/CatPeriodos.aspx +++ b/Nomina/CatPeriodos.aspx @@ -187,7 +187,7 @@ - @@ -383,6 +383,12 @@
+
+ Mes: +
+
+ +

diff --git a/Nomina/CatPeriodos.aspx.vb b/Nomina/CatPeriodos.aspx.vb index d195014ed..6a5f39df1 100644 --- a/Nomina/CatPeriodos.aspx.vb +++ b/Nomina/CatPeriodos.aspx.vb @@ -227,8 +227,8 @@ Partial Class Nomina_CatPeriodos RegistraScript("$('#divAddPeriodo').modal('show');") End Sub Protected Sub BtnAgregar_Click(sender As Object, e As System.EventArgs) Handles BtnAgregar.Click - Dim ObjNom_Periodos As New ClsNominas + Dim mensajeerror As String = "" Dim EsInicioMes As Boolean Dim EsFinMes As Boolean Dim EsInicioSS As Boolean @@ -237,72 +237,85 @@ Partial Class Nomina_CatPeriodos Dim EsFinAño As Boolean Dim FueCalculado As Boolean Dim Numero As Integer = TxtNumeroAdd.Text.Trim.ToEntero() - Dim FechaInicio As Date = TxtFechaInicioAdd.Text.Trim.ToDate - Dim FechaFin As Date = TxtFechaFinAdd.Text.Trim.ToDate - Dim Mes As Integer = FechaFin.Month + Dim FechaInicio As Date = TxtFechaInicioAdd.Text().Trim.ToDate() + Dim FechaFin As Date = TxtFechaFinAdd.Text.Trim().ToDate() + Dim Mes As Integer = TxtMes.Text.Trim().ToEntero() + If Not ((FechaFin.Month = 12 And (Mes = 1)) OrElse (FechaFin.Month = 1 And (Mes = 12)) OrElse (Math.Abs(FechaFin.Month - Mes) <= 1)) OrElse + Mes > 12 OrElse Mes < 1 Then + TxtMes.Text = FechaFin.Month.ToString() + mensajeerror = "El mes seleccionado para el periodo de nómina debe ser el mes actual, el mes anterior, o el mes siguiente a la fecha de finalización." + End If Dim Ejercicio As Integer = FechaFin.Year Dim CveTipoPeriodo As Integer = DdlTipoPeriodoAdd.SelectedValue.ToEntero() Dim Estatus As Integer = DdlEstatusAdd.SelectedValue.ToEntero() Dim CvePeriodo As Integer = hdnCvePerido.Value.ToEntero() Dim CveSubTipoPeriodo As Integer = TxtCveSubTipoPeriodoAdd.Text.ToEntero() - If CveSubTipoPeriodo <= 1 Then - CveSubTipoPeriodo = 1 - End If - For Each item As ListItem In CBLchk.Items - Select Case item.Value.ToEntero() - Case 1 - If item.Selected Then EsInicioMes = True Else EsInicioMes = False - Case 2 - If item.Selected Then EsFinMes = True Else EsFinMes = False - Case 3 - If item.Selected Then EsInicioSS = True Else EsInicioSS = False - Case 4 - If item.Selected Then EsFinSS = True Else EsFinSS = False - Case 5 - If item.Selected Then EsInicioAño = True Else EsInicioAño = False - Case 6 - If item.Selected Then EsFinAño = True Else EsFinAño = False - Case 7 - If item.Selected Then FueCalculado = True Else FueCalculado = False - End Select - Next - If Comando = "Agregar" Then + If (mensajeerror = "") Then - If ObjNom_Periodos.AddPeriodo(CveTipoPeriodo, Ejercicio, Mes, Numero, FechaInicio, FechaFin, EsInicioMes, EsFinMes, EsInicioSS, EsFinSS, EsInicioAño, EsFinAño, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, DdlTurno.SelectedValue.ToEntero(), DdlEstatus.SelectedValue.ToEntero(), CveSubTipoPeriodo) Then + Using ObjNom_Periodos As New ClsNominas + + If CveSubTipoPeriodo <= 1 Then + CveSubTipoPeriodo = 1 + End If + For Each item As ListItem In CBLchk.Items + Select Case item.Value.ToEntero() + Case 1 + If item.Selected Then EsInicioMes = True Else EsInicioMes = False + Case 2 + If item.Selected Then EsFinMes = True Else EsFinMes = False + Case 3 + If item.Selected Then EsInicioSS = True Else EsInicioSS = False + Case 4 + If item.Selected Then EsFinSS = True Else EsFinSS = False + Case 5 + If item.Selected Then EsInicioAño = True Else EsInicioAño = False + Case 6 + If item.Selected Then EsFinAño = True Else EsFinAño = False + Case 7 + If item.Selected Then FueCalculado = True Else FueCalculado = False + End Select + Next + If Comando = "Agregar" Then + + If ObjNom_Periodos.AddPeriodo(CveTipoPeriodo, Ejercicio, Mes, Numero, FechaInicio, FechaFin, EsInicioMes, EsFinMes, EsInicioSS, EsFinSS, EsInicioAño, EsFinAño, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, DdlTurno.SelectedValue.ToEntero(), DdlEstatus.SelectedValue.ToEntero(), CveSubTipoPeriodo) Then + + Alert("El nuevo Periodo se guardó correctamente.", TipoMensaje.MsgInformacion) + UpDatos.Update() + ViewState("DTNom_Periodos") = ObjNom_Periodos.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa) + GlobalDTNominasPeriodos(-1, -1, UsuarioActual.CveEmpresa) = Nothing + CargaDatos() + If String.IsNullOrEmpty(ViewState("Orden").ToString()) Then + CargaGrid(ViewState("Orden").ToString()) + Else + CargaGrid("") + End If + + End If + ElseIf Comando = "Actualizar" Then + + If ObjNom_Periodos.UpdatePeriodo(FechaInicio, FechaFin, EsInicioMes, EsFinMes, EsInicioSS, EsFinSS, EsInicioAño, EsFinAño, FueCalculado, CveTipoPeriodo, Ejercicio, Mes, Numero, Estatus, CvePeriodo, UsuarioActual.CveEmpresa, DdlTurno.SelectedValue.ToEntero(), CveSubTipoPeriodo) Then + + Alert("Los cambios se guardaron correctamente.", TipoMensaje.MsgInformacion) + UpDatos.Update() + ViewState("DTNom_Periodos") = ObjNom_Periodos.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa) + GlobalDTNominasPeriodos(-1, -1, UsuarioActual.CveEmpresa) = Nothing + CargaDatos() + If String.IsNullOrEmpty(ViewState("Orden").ToString()) Then + CargaGrid(ViewState("Orden").ToString()) + Else + CargaGrid("") + End If + End If - Alert("El nuevo Periodo se guardó correctamente.", TipoMensaje.MsgInformacion) - UpDatos.Update() - ViewState("DTNom_Periodos") = ObjNom_Periodos.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa) - GlobalDTNominasPeriodos(-1, -1, UsuarioActual.CveEmpresa) = Nothing - CargaDatos() - If String.IsNullOrEmpty(ViewState("Orden").ToString()) Then - CargaGrid(ViewState("Orden").ToString()) - Else - CargaGrid("") End If - End If - ElseIf Comando = "Actualizar" Then - - If ObjNom_Periodos.UpdatePeriodo(FechaInicio, FechaFin, EsInicioMes, EsFinMes, EsInicioSS, EsFinSS, EsInicioAño, EsFinAño, FueCalculado, CveTipoPeriodo, Ejercicio, Mes, Numero, Estatus, CvePeriodo, UsuarioActual.CveEmpresa, DdlTurno.SelectedValue.ToEntero(), CveSubTipoPeriodo) Then - - Alert("Los cambios se guardaron correctamente.", TipoMensaje.MsgInformacion) - UpDatos.Update() - ViewState("DTNom_Periodos") = ObjNom_Periodos.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa) - GlobalDTNominasPeriodos(-1, -1, UsuarioActual.CveEmpresa) = Nothing - CargaDatos() - If String.IsNullOrEmpty(ViewState("Orden").ToString()) Then - CargaGrid(ViewState("Orden").ToString()) - Else - CargaGrid("") - End If - End If - + End Using + RegistraScript("$('#divAddPeriodo').modal('hide');") + Else + Alert(mensajeerror, TipoMensaje.MsgAdvertencia) End If - RegistraScript("$('#divAddPeriodo').modal('hide');") - 'ObjNom_Periodos.Dispose() End Sub @@ -321,6 +334,7 @@ Partial Class Nomina_CatPeriodos TxtFechaFinAdd.Text = GvRow.DataKey("FechaFin").ToString() DdlEstatusAdd.SelectedValueExist(GvRow.DataKey("Estatus").ToString().ToEntero()) hdnCvePerido.Value = GvRow.DataKey("CvePeriodo").ToString() + TxtMes.Text = GvRow.DataKey("Mes").ToString() TxtCveSubTipoPeriodoAdd.Text = GvRow.DataKey("CveSubTipoPeriodo").ToString() For Each item As ListItem In CBLchk.Items @@ -351,6 +365,7 @@ Partial Class Nomina_CatPeriodos TxtNumeroAdd.Text = "" TxtFechaInicioAdd.Text = "" TxtFechaFinAdd.Text = "" + TxtMes.Text = "" DdlEstatusAdd.SelectedValueExist(-1) DdlTurno.SelectedValueExist(-1) For Each item As ListItem In CBLchk.Items diff --git a/Nomina/Nomina.aspx b/Nomina/Nomina.aspx index 39250c7b2..ca6d5a9d8 100644 --- a/Nomina/Nomina.aspx +++ b/Nomina/Nomina.aspx @@ -2533,13 +2533,13 @@ OnRowDataBound="GVNominaPendiente_RowDataBound"> - - + + - - + +