Commit inicial Ventas Productivo
This commit is contained in:
153
AF/CatTipos.aspx.vb
Normal file
153
AF/CatTipos.aspx.vb
Normal file
@@ -0,0 +1,153 @@
|
||||
Option Explicit On
|
||||
Option Strict On
|
||||
|
||||
Imports System.Data
|
||||
Imports System.Linq
|
||||
Imports Extensiones
|
||||
|
||||
Partial Class AF_CatTipos
|
||||
Inherits ClsPaginas
|
||||
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
||||
If Not Page.IsPostBack Then
|
||||
|
||||
If UsuarioActual.Empresa.UsaAC Then
|
||||
TdCuentaInicial.Visible = True
|
||||
GvDatos.Columns(3).Visible = True
|
||||
GvDatos.Columns(1).Visible = True
|
||||
End If
|
||||
|
||||
CargaDatos()
|
||||
End If
|
||||
End Sub
|
||||
|
||||
#Region "AGREGAR / ACTUALIZAR"
|
||||
Private Sub LnkTipoAF_Click(sender As Object, e As EventArgs) Handles LnkTipoAF.Click
|
||||
HdnModalidad.Value = "A"
|
||||
UpDatos.Update()
|
||||
BtnAgregarTipoAF.Text = "Agregar"
|
||||
myModalLabel.InnerText = "Agregar Tipo Activo Fijo"
|
||||
TxtTipo.Text = ""
|
||||
TxtDepreciacionAF.Text = ""
|
||||
DdlCuentaInicial.SelectedIndex = 0
|
||||
DdlMedidaVehicular.SelectedIndex = 0
|
||||
ChkFolio.Checked = False
|
||||
ChkContable.Checked = False
|
||||
divEstatus.Visible = False
|
||||
UpAddTipoAF.Update()
|
||||
RegistraScript(String.Format("$('#{0}').modal('show');", "DivAddTipoAF"))
|
||||
End Sub
|
||||
Public Sub Edit_Click(sender As Object, e As EventArgs)
|
||||
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
||||
HdnModalidad.Value = "U"
|
||||
HdnID.Value = GvRow.DataKey("CveTipoActivoFijo")
|
||||
UpDatos.Update()
|
||||
BtnAgregarTipoAF.Text = "Actualizar"
|
||||
myModalLabel.InnerText = "Actualizar Tipo Activo Fijo"
|
||||
TxtTipo.Text = GvRow.DataKey("TipoActivoFijo")
|
||||
TxtDepreciacionAF.Text = GvRow.DataKey("PorDepreciacion")
|
||||
|
||||
DdlCuentaInicial.SelectedValueExist(GvRow.DataKey("Conta_CuentaInicial"))
|
||||
|
||||
If GvRow.DataKey("MedidaVehicularClave").ToEntero > 0 Then
|
||||
DdlMedidaVehicular.SelectedValueExist(GvRow.DataKey("MedidaVehicularClave"))
|
||||
Else
|
||||
DdlMedidaVehicular.SelectedIndex = 0
|
||||
End If
|
||||
|
||||
ChkFolio.Checked = CBool(If(GvRow.DataKey("AutoFolio") = "Activo", True, False))
|
||||
ChkContable.Checked = CBool(If(GvRow.DataKey("Contable") = "Activo", True, False))
|
||||
divEstatus.Visible = True
|
||||
ChkEstatus.Checked = CBool(If(GvRow.DataKey("Estado") = "Activo", True, False))
|
||||
UpAddTipoAF.Update()
|
||||
RegistraScript(String.Format("$('#{0}').modal('show');", "DivAddTipoAF"))
|
||||
End Sub
|
||||
Private Sub BtnAgregarTipoAF_Click(sender As Object, e As EventArgs) Handles BtnAgregarTipoAF.Click
|
||||
Dim ObjAF As New ClsAF
|
||||
Dim TieneError = False
|
||||
Dim Estatus = False
|
||||
If ChkEstatus.Checked Then Estatus = True Else Estatus = False
|
||||
|
||||
If HdnModalidad.Value = "A" Then
|
||||
If Not ObjAF.AddTiposActivosFijos(TxtTipo.Text.Trim, DdlCuentaInicial.SelectedValue.ToEntero, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, PorDepreciacion:=TxtDepreciacionAF.Text.ToDecimal, MedidaVehicular:=DdlMedidaVehicular.SelectedValue.ToEntero, AutoFolio:=ChkFolio.Checked, Contable:=ChkContable.Checked) Then
|
||||
TieneError = True
|
||||
End If
|
||||
ElseIf HdnModalidad.Value = "U" Then
|
||||
If Not ObjAF.UpdateTiposActivosFijos(HdnID.Value.ToEntero, TxtTipo.Text.Trim, DdlCuentaInicial.SelectedValue.ToEntero, Estatus, PorDepreciacion:=TxtDepreciacionAF.Text.ToDecimal, MedidaVehicular:=DdlMedidaVehicular.SelectedValue.ToEntero, AutoFolio:=ChkFolio.Checked, Contable:=ChkContable.Checked) Then
|
||||
TieneError = True
|
||||
End If
|
||||
End If
|
||||
|
||||
If Not TieneError Then
|
||||
Alert("Agregado / Actualizado Correctamente.", TipoMensaje.MsgInformacion)
|
||||
RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAddTipoAF"))
|
||||
ObjAF.Dispose()
|
||||
UpDatos.Update()
|
||||
CargaDatos()
|
||||
CargaGlobal()
|
||||
Else
|
||||
Alert("Ha Ocurrido un error al Agregar o Actualizar", TipoMensaje.MsgInformacion)
|
||||
RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAddTipoAF"))
|
||||
End If
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
Public Sub CargaDatos()
|
||||
Dim ObjTipo As New ClsAF
|
||||
If ObjTipo.GetTiposActivosFijos(UsuarioActual.CveEmpresa) Then
|
||||
GvDatos.DataSource = ObjTipo.DtResultados
|
||||
Else
|
||||
GvDatos.DataSource = Nothing
|
||||
End If
|
||||
GvDatos.DataBind()
|
||||
|
||||
ObjTipo.Dispose()
|
||||
UpDatos.Update()
|
||||
End Sub
|
||||
Private Sub CargaGlobal()
|
||||
Dim ObjTipo As New ClsAF
|
||||
If ObjTipo.GetTiposActivosFijos(-1) Then
|
||||
GlobalDTTipoActivoFijo(-1) = ObjTipo.DtResultados
|
||||
End If
|
||||
ObjTipo.Dispose()
|
||||
End Sub
|
||||
|
||||
#Region " G V - D A T O S"
|
||||
Protected Sub GvDatos_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvDatos.RowDataBound
|
||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||
If e.Row.DBCampo("Estado") = "Activo" Then
|
||||
e.Row.FCLabel("LblEstatus").Text = "Activo"
|
||||
e.Row.FCLabel("LblEstatus").ForeColor = Drawing.Color.Green
|
||||
|
||||
Else
|
||||
e.Row.FCLabel("LblEstatus").Text = "Inactivo"
|
||||
e.Row.FCLabel("LblEstatus").ForeColor = Drawing.Color.Red
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
Public Sub Delete_Click(sender As Object, e As EventArgs)
|
||||
Dim ObjAF As New ClsAF()
|
||||
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
||||
Dim TieneError = False
|
||||
|
||||
HdnID.Value = GvRow.DataKey("CveTipoActivoFijo")
|
||||
UpDatos.Update()
|
||||
If Not ObjAF.RemoveTiposActivosFijos(HdnID.Value.ToEntero) Then
|
||||
TieneError = True
|
||||
|
||||
End If
|
||||
|
||||
If Not TieneError Then
|
||||
CargaDatos()
|
||||
Alert("Eliminado Correctamente.", TipoMensaje.MsgInformacion)
|
||||
ObjAF.Dispose()
|
||||
UpDatos.Update()
|
||||
CargaGlobal()
|
||||
Else
|
||||
Alert("Ha ocurrido un error al eliminar", TipoMensaje.MsgInformacion)
|
||||
End If
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
|
||||
|
||||
End Class
|
||||
Reference in New Issue
Block a user