Cambio en catalogo de peridos
This commit is contained in:
@@ -7,25 +7,33 @@ Imports Extensiones
|
||||
|
||||
Partial Class Nomina_CatPeriodos
|
||||
Inherits ClsPaginas
|
||||
|
||||
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
||||
Private Property Comando As String
|
||||
Get
|
||||
Return ViewState("Comando").ToString
|
||||
End Get
|
||||
Set(value As String)
|
||||
ViewState("Comando") = value
|
||||
End Set
|
||||
End Property
|
||||
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
||||
If Not Page.IsPostBack Then
|
||||
ViewState("Orden") = ""
|
||||
CargaDatos()
|
||||
CargaTipoPeriodo()
|
||||
CargaTipoPeriodo()
|
||||
cargaEjercicios()
|
||||
CargaDatos()
|
||||
|
||||
''Permiso Registro
|
||||
'If PermisoRegistro Then
|
||||
' LbAgregar.Enabled = True
|
||||
'Else
|
||||
' LbAgregar.Enabled = False
|
||||
'End If
|
||||
End If
|
||||
''Permiso Registro
|
||||
'If PermisoRegistro Then
|
||||
' LbAgregar.Enabled = True
|
||||
'Else
|
||||
' LbAgregar.Enabled = False
|
||||
'End If
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Public Sub CargaDatos()
|
||||
Dim ObjNom_Periodos As New ClsNominas
|
||||
If ObjNom_Periodos.GetPeriodos(-1, UsuarioActual.CveEmpresa, Now.Year, -1, -1) Then
|
||||
If ObjNom_Periodos.GetPeriodos(DdlTipoPeriodo.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, DdlEjercicio.SelectedValue.ToEntero, -1, -1, DdlEstatus.SelectedValue.ToEntero) Then
|
||||
ViewState("DTNom_Periodos") = ObjNom_Periodos.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa)
|
||||
GlobalDTNom_Periodos = ObjNom_Periodos.DtResultados
|
||||
|
||||
@@ -42,44 +50,27 @@ Partial Class Nomina_CatPeriodos
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Protected Sub LbAgregar_Click(sender As Object, e As System.EventArgs) Handles LbAgregar.Click
|
||||
Dim ObjNom_Periodos As New ClsNominas
|
||||
Dim Numero As Integer = TxtNumero.Text.Trim.ToEntero
|
||||
Dim EsInicioMes As Boolean = ChkEsInicioMes.Checked
|
||||
Dim EsFinMes As Boolean = ChkEsFinMes.Checked
|
||||
Dim EsInicioSS As Boolean = CBool(ChkEsInicioSS.Checked)
|
||||
Dim EsFinSS As Boolean = ChkEsFinSS.Checked
|
||||
Dim EsInicioAño As Boolean = ChkEsInicioAño.Checked
|
||||
Dim EsFinAño As Boolean = ChkEsFinAño.Checked
|
||||
Dim FueCalculado As Boolean = ChkFueCalculado.Checked
|
||||
Dim FechaInicio As Date = TxtFechaInicio.Text.Trim.ToDate
|
||||
Dim FechaFin As Date = TxtFechaFin.Text.Trim.ToDate
|
||||
Dim Mes As Integer = FechaFin.Month
|
||||
Dim Ejercicio As Integer = FechaFin.Year
|
||||
Dim CveTipoPeriodo As Integer = DdlTipoPeriodo.SelectedValue.ToEntero
|
||||
Dim Estatus As Integer = DdlEstatus.SelectedValue.ToEntero
|
||||
|
||||
If ObjNom_Periodos.AddPeriodo(CveTipoPeriodo, Ejercicio, Mes, Numero, FechaInicio, FechaFin, EsInicioMes, EsFinMes, ChkEsInicioSS.Checked, ChkEsFinAño.Checked, ChkEsInicioAño.Checked, ChkEsFinAño.Checked, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
|
||||
|
||||
Alert("El nuevo Periodo se guardó correctamente.", TipoMensaje.MsgInformacion)
|
||||
UpDatos.Update()
|
||||
ViewState("DTNom_Periodos") = ObjNom_Periodos.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa)
|
||||
GlobalDTNom_Periodos = ObjNom_Periodos.DtResultados
|
||||
CargaDatos()
|
||||
If String.IsNullOrEmpty(ViewState("Orden").ToString()) Then
|
||||
CargaGrid(ViewState("Orden").ToString())
|
||||
Else
|
||||
CargaGrid("")
|
||||
End If
|
||||
|
||||
End If
|
||||
'ObjNom_Periodos.Dispose()
|
||||
End Sub
|
||||
|
||||
#Region " C O M B O S"
|
||||
Private Sub CargaTipoPeriodo()
|
||||
DdlTipoPeriodo.DataSource = GlobalDTTipoPeriodo
|
||||
DdlTipoPeriodoAdd.DataSource = GlobalDTTipoPeriodo
|
||||
|
||||
DdlTipoPeriodo.DataBind()
|
||||
DdlTipoPeriodoAdd.DataBind()
|
||||
End Sub
|
||||
|
||||
Private Sub cargaEjercicios()
|
||||
Dim objconta As New ClsContabilidad
|
||||
If objconta.GetEjercicios(UsuarioActual.CveEmpresa) Then
|
||||
DdlEjercicio.DataSource = objconta.DtResultados
|
||||
Else
|
||||
DdlEjercicio.DataSource = Nothing
|
||||
End If
|
||||
objconta.Dispose()
|
||||
DdlEjercicio.DataBind()
|
||||
DdlEjercicio.Items.Insert(0, New ListItem("Todos", "-1"))
|
||||
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
@@ -120,12 +111,23 @@ Partial Class Nomina_CatPeriodos
|
||||
e.Row.Cells(12).HorizontalAlign = HorizontalAlign.Center
|
||||
e.Row.Cells(13).HorizontalAlign = HorizontalAlign.Center
|
||||
e.Row.Cells(14).HorizontalAlign = HorizontalAlign.Center
|
||||
If e.Row.RowState = DataControlRowState.Edit OrElse e.Row.RowState = 5 Then
|
||||
e.Row.FCDropDownList("DdlTipoPeriodo").DataSource = GlobalDTTipoPeriodo
|
||||
e.Row.FCDropDownList("DdlTipoPeriodo").DataBind()
|
||||
e.Row.FCDropDownList("DdlTipoPeriodo").SelectedValue = e.Row.DBCampo("CveTipoPeriodo")
|
||||
e.Row.FCDropDownList("DdlEstatus").SelectedItem.Text = e.Row.DBCampo("Estatus")
|
||||
|
||||
e.Row.FCCheckBox("ChkEsInicioMes").Checked = Convert.ToBoolean(e.Row.DataKey("EsInicioMes").ToString)
|
||||
e.Row.FCCheckBox("ChkEsFinMes").Checked = Convert.ToBoolean(e.Row.DataKey("EsFinMes").ToString)
|
||||
e.Row.FCCheckBox("ChkEsInicioSS").Checked = Convert.ToBoolean(e.Row.DataKey("EsInicioSS").ToString)
|
||||
e.Row.FCCheckBox("ChkEsFinSS").Checked = Convert.ToBoolean(e.Row.DataKey("EsFinSS").ToString)
|
||||
e.Row.FCCheckBox("ChkEsInicioAño").Checked = Convert.ToBoolean(e.Row.DataKey("EsInicioAño").ToString)
|
||||
e.Row.FCCheckBox("ChkEsFinAño").Checked = Convert.ToBoolean(e.Row.DataKey("EsFinAño").ToString)
|
||||
e.Row.FCCheckBox("ChkFueCalculado").Checked = Convert.ToBoolean(e.Row.DataKey("FueCalculado").ToString)
|
||||
|
||||
If e.Row.DataKey("Estatus").ToString.ToEntero = 1 Then
|
||||
e.Row.FCLiteral("LtlEstatus").Text = "Actual"
|
||||
ElseIf e.Row.DataKey("Estatus").ToString.ToEntero = 2 Or e.Row.DataKey("Estatus").ToString.ToEntero = 3 Then
|
||||
e.Row.FCLiteral("LtlEstatus").Text = "Cerrado"
|
||||
Else
|
||||
e.Row.FCLiteral("LtlEstatus").Text = ""
|
||||
End If
|
||||
|
||||
End If
|
||||
End Sub
|
||||
|
||||
@@ -156,51 +158,7 @@ Partial Class Nomina_CatPeriodos
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Protected Sub GvDatos_RowUpdating(sender As Object, e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles GvDatos.RowUpdating
|
||||
Dim ObjNom_Periodos As New ClsNominas
|
||||
Dim Numero As Integer = DirectCast(GvDatos.Rows(e.RowIndex).FindControl("TxtNumero"), TextBox).Text.Trim.ToEntero
|
||||
Dim EsInicioMes As Boolean = GvDatos.Rows(e.RowIndex).FCCheckBox("ChkEsInicioMes").Checked
|
||||
Dim EsFinMes As Boolean = GvDatos.Rows(e.RowIndex).FCCheckBox("ChkEsFinMes").Checked
|
||||
Dim EsInicioSS As Boolean = GvDatos.Rows(e.RowIndex).FCCheckBox("ChkEsInicioSS").Checked
|
||||
Dim EsFinSS As Boolean = GvDatos.Rows(e.RowIndex).FCCheckBox("ChkEsFinSS").Checked
|
||||
Dim EsInicioAño As Boolean = GvDatos.Rows(e.RowIndex).FCCheckBox("ChkEsInicioAño").Checked
|
||||
Dim EsFinAño As Boolean = GvDatos.Rows(e.RowIndex).FCCheckBox("ChkEsFinAño").Checked
|
||||
Dim FueCalculado As Boolean = GvDatos.Rows(e.RowIndex).FCCheckBox("ChkFueCalculado").Checked
|
||||
Dim FechaInicio As Date = DirectCast(GvDatos.Rows(e.RowIndex).FindControl("TxtFechaInicio"), TextBox).Text.Trim.ToDateTime
|
||||
Dim FechaFin As Date = DirectCast(GvDatos.Rows(e.RowIndex).FindControl("TxtFechaFin"), TextBox).Text.Trim.ToDateTime
|
||||
Dim Mes As Integer = FechaFin.Month
|
||||
Dim Ejercicio As Integer = FechaFin.Year
|
||||
Dim CveTipoPeriodo As Integer = DirectCast(GvDatos.Rows(e.RowIndex).FindControl("DdlTipoPeriodo"), DropDownList).SelectedValue.ToEntero
|
||||
Dim Estatus As Integer = DirectCast(GvDatos.Rows(e.RowIndex).FindControl("DdlEstatus"), DropDownList).SelectedValue.ToEntero
|
||||
|
||||
Dim CvePeriodo As Integer = GvDatos.DataKeys(e.RowIndex).Value.ToString.ToEntero
|
||||
|
||||
If ObjNom_Periodos.UpdatePeriodo(FechaInicio, FechaFin, EsInicioMes, EsFinMes, EsInicioSS, EsFinSS, EsInicioAño, EsFinAño, FueCalculado,
|
||||
CveTipoPeriodo, Ejercicio, Mes, Numero, Estatus, CvePeriodo, UsuarioActual.CveEmpresa) Then
|
||||
GvDatos.EditIndex = -1
|
||||
ViewState("DTNom_Periodos") = ObjNom_Periodos.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa)
|
||||
GlobalDTNom_Periodos = ObjNom_Periodos.DtResultados
|
||||
Alert("Los cambios se guardaron correctamente.", TipoMensaje.MsgInformacion)
|
||||
End If
|
||||
|
||||
ObjNom_Periodos.Dispose()
|
||||
|
||||
If ViewState("Orden").ToString() <> String.Empty Then
|
||||
CargaGrid(ViewState("Orden").ToString())
|
||||
Else
|
||||
CargaGrid("")
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
Protected Sub GvDatos_RowEditing(sender As Object, e As System.Web.UI.WebControls.GridViewEditEventArgs) Handles GvDatos.RowEditing
|
||||
GvDatos.EditIndex = e.NewEditIndex
|
||||
If ViewState("Orden").ToString() <> String.Empty Then
|
||||
CargaGrid(ViewState("Orden").ToString())
|
||||
Else
|
||||
CargaGrid("")
|
||||
End If
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
#Region "O R D E N A M I E N T O"
|
||||
@@ -239,4 +197,151 @@ Partial Class Nomina_CatPeriodos
|
||||
UpDatos.Update()
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
Private Sub LnkAddPeriodo_Click(sender As Object, e As EventArgs) Handles LnkAddPeriodo.Click
|
||||
LimpiarModal()
|
||||
Comando = "Agregar"
|
||||
lblTiulomodal.Text = "Agregar Periodo"
|
||||
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 EsInicioMes As Boolean
|
||||
Dim EsFinMes As Boolean
|
||||
Dim EsInicioSS As Boolean
|
||||
Dim EsFinSS As Boolean
|
||||
Dim EsInicioAño As Boolean
|
||||
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 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
|
||||
|
||||
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) Then
|
||||
|
||||
Alert("El nuevo Periodo se guardó correctamente.", TipoMensaje.MsgInformacion)
|
||||
UpDatos.Update()
|
||||
ViewState("DTNom_Periodos") = ObjNom_Periodos.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa)
|
||||
GlobalDTNom_Periodos = ObjNom_Periodos.DtResultados
|
||||
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) Then
|
||||
|
||||
Alert("Los cambios se guardaron correctamente.", TipoMensaje.MsgInformacion)
|
||||
UpDatos.Update()
|
||||
ViewState("DTNom_Periodos") = ObjNom_Periodos.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa)
|
||||
GlobalDTNom_Periodos = ObjNom_Periodos.DtResultados
|
||||
CargaDatos()
|
||||
If String.IsNullOrEmpty(ViewState("Orden").ToString()) Then
|
||||
CargaGrid(ViewState("Orden").ToString())
|
||||
Else
|
||||
CargaGrid("")
|
||||
End If
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
|
||||
RegistraScript("$('#divAddPeriodo').modal('hide');")
|
||||
|
||||
'ObjNom_Periodos.Dispose()
|
||||
End Sub
|
||||
|
||||
Protected Sub BtnConsultar_Click(sender As Object, e As System.EventArgs) Handles BtnConsultar.Click
|
||||
CargaDatos()
|
||||
End Sub
|
||||
Protected Sub LnkEditar_Click(sender As Object, e As EventArgs)
|
||||
LimpiarModal()
|
||||
Comando = "Actualizar"
|
||||
lblTiulomodal.Text = "Actualizar Periodo"
|
||||
Dim GvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow)
|
||||
DdlTipoPeriodoAdd.SelectedValueExist(GvRow.DataKey("CveTipoPeriodo").ToString.ToEntero)
|
||||
TxtNumeroAdd.Text = GvRow.DataKey("Numero").ToString
|
||||
TxtFechaInicioAdd.Text = GvRow.DataKey("FechaInicio").ToString
|
||||
TxtFechaFinAdd.Text = GvRow.DataKey("FechaFin").ToString
|
||||
DdlEstatusAdd.SelectedValueExist(GvRow.DataKey("Estatus").ToString.ToEntero)
|
||||
hdnCvePerido.Value = GvRow.DataKey("CvePeriodo").ToString
|
||||
For Each item As ListItem In CBLchk.Items
|
||||
Select Case item.Value.ToEntero()
|
||||
Case 1
|
||||
item.Selected = Convert.ToBoolean(GvRow.DataKey("EsInicioMes").ToString)
|
||||
Case 2
|
||||
item.Selected = Convert.ToBoolean(GvRow.DataKey("EsFinMes").ToString)
|
||||
Case 3
|
||||
item.Selected = Convert.ToBoolean(GvRow.DataKey("EsInicioSS").ToString)
|
||||
Case 4
|
||||
item.Selected = Convert.ToBoolean(GvRow.DataKey("EsFinSS").ToString)
|
||||
Case 5
|
||||
item.Selected = Convert.ToBoolean(GvRow.DataKey("EsInicioAño").ToString)
|
||||
Case 6
|
||||
item.Selected = Convert.ToBoolean(GvRow.DataKey("EsFinAño").ToString)
|
||||
Case 7
|
||||
item.Selected = Convert.ToBoolean(GvRow.DataKey("FueCalculado").ToString)
|
||||
End Select
|
||||
Next
|
||||
UpModalPerido.Update()
|
||||
|
||||
RegistraScript("$('#divAddPeriodo').modal('show')")
|
||||
End Sub
|
||||
|
||||
Private Sub LimpiarModal()
|
||||
DdlTipoPeriodoAdd.SelectedValueExist(-1)
|
||||
TxtNumeroAdd.Text = ""
|
||||
TxtFechaInicioAdd.Text = ""
|
||||
TxtFechaFinAdd.Text = ""
|
||||
DdlEstatusAdd.SelectedValueExist(-1)
|
||||
For Each item As ListItem In CBLchk.Items
|
||||
Select Case item.Value.ToEntero()
|
||||
Case 1
|
||||
item.Selected = False
|
||||
Case 2
|
||||
item.Selected = False
|
||||
Case 3
|
||||
item.Selected = False
|
||||
Case 4
|
||||
item.Selected = False
|
||||
Case 5
|
||||
item.Selected = False
|
||||
Case 6
|
||||
item.Selected = False
|
||||
Case 7
|
||||
item.Selected = False
|
||||
End Select
|
||||
Next
|
||||
UpModalPerido.Update()
|
||||
End Sub
|
||||
End Class
|
||||
|
||||
Reference in New Issue
Block a user