Option Explicit On Option Strict On Imports System.Data Imports Extensiones Partial Class Sistemas_Cierre Inherits ClsPaginas Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load If Not IsPostBack Then CargaDatos() End If End Sub Private Sub CargaDatos() Dim ObjEmpresas As New ClsSisEmpresas() If ObjEmpresas.GetEmpresas(UsuarioActual.CveEmpresa, "-1", "-1", "-1", "-1") Then If ObjEmpresas.DtResultados.Rows.Count > 0 Then TxtFecha.Text = ObjEmpresas.DtResultados.Rows(0)("Conta_FechaCerrado").ToString().ToDateTime().ToString("dd/MM/yyyy") End If End If ObjEmpresas.Dispose() 'If UsuarioActual.Empresa.UsaContabilidad Or UsuarioActual.Empresa.UsaAC Then ' 'DivFechaContPAQ.Visible = True ' Dim DtParametros As DataTable = Nothing ' Dim ObjConta As New ClsContPAQi(UsuarioActual.Empresa) ' If ObjConta.GetParametros() Then ' DtParametros = ObjConta.DtResultados.Copy() ' End If ' ObjConta.Dispose() ' If DtParametros IsNot Nothing Then ' If DtParametros.Rows.Count > 0 Then ' TxtFechaContPAQ.Text = DtParametros.Rows(0)("FechaCierreSIG").ToString().ToDateTime().ToString("dd/MM/yyyy") ' End If ' DtParametros.Dispose() ' End If 'End If UpParametros.Update() End Sub Protected Sub BtnGuardar_Click(sender As Object, e As EventArgs) Dim FechaCierre As Date = TxtFecha.Text.ToDate() 'Dim FechaCierreContPAQ As Date = TxtFechaContPAQ.Text.ToDate() Dim GuardoFechaContPAQ As Boolean = False If UsuarioActual.Empresa.UsaContabilidad Or UsuarioActual.Empresa.UsaAC Then Dim ObjConta As New ClsContPAQi(UsuarioActual.Empresa) GuardoFechaContPAQ = ObjConta.UpdateFechaCierreSIG(FechaCierre) ObjConta.Dispose() Else GuardoFechaContPAQ = True End If Dim ObjEmpresas As New ClsSisEmpresas() If GuardoFechaContPAQ AndAlso ObjEmpresas.UpdateEmpresaCierre(UsuarioActual.CveEmpresa, FechaCierre) Then Alert("La fecha de cierre de período se guardó correctamente.") Else Alert("Ocurrió un error al guardar la fecha", TipoMensaje.MsgError) End If ObjEmpresas.Dispose() CargaDatos() End Sub End Class