--Catalogo de motivos de devolucion
This commit is contained in:
93
Ventas/CatMotivosDevoluciones.aspx.vb
Normal file
93
Ventas/CatMotivosDevoluciones.aspx.vb
Normal file
@@ -0,0 +1,93 @@
|
||||
|
||||
Option Explicit On
|
||||
Option Strict On
|
||||
|
||||
Imports Extensiones
|
||||
|
||||
Partial Class Ventas_CatMotivosDevoluciones
|
||||
Inherits ClsPaginas
|
||||
|
||||
Private Property CveMotivoDevolucion As Integer
|
||||
Get
|
||||
Return (IfNull(ViewState("CveMotivoDevolucion"), "-1", ViewState("CveMotivoDevolucion"))).ToString().ToEntero()
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
ViewState("CveMotivoDevolucion") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
||||
If Not Page.IsPostBack Then
|
||||
CargaDatos()
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub CargaDatos()
|
||||
LimpiaDatos()
|
||||
|
||||
Using ObjVentas As New ClsVentas
|
||||
If ObjVentas.GetMotivoDevolucion(-1, -1, UsuarioActual.CveEmpresa) Then
|
||||
GvDatos.DataSource = ObjVentas.DtResultados.Copy()
|
||||
End If
|
||||
End Using
|
||||
GvDatos.DataBind()
|
||||
|
||||
UpDatos.Update()
|
||||
End Sub
|
||||
|
||||
Protected Sub GvDatos_RowDeleting(sender As Object, e As GridViewDeleteEventArgs)
|
||||
Dim GvRow As GridViewRow = GvDatos.Rows(e.RowIndex)
|
||||
|
||||
CveMotivoDevolucion = GvRow.DataKey("CveMotivoDevolucion").ToEntero()
|
||||
|
||||
Using ObjVentas As New ClsVentas
|
||||
If ObjVentas.RemoveMotivoDevolucion(CveMotivoDevolucion, UsuarioActual.CveEmpresa) Then
|
||||
Alert("Se eliminó correctamente")
|
||||
End If
|
||||
End Using
|
||||
|
||||
CargaDatos()
|
||||
End Sub
|
||||
Protected Sub imgE_Click(sender As Object, e As EventArgs)
|
||||
Dim GvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow)
|
||||
|
||||
CveMotivoDevolucion = GvRow.DataKey("CveMotivoDevolucion").ToEntero()
|
||||
TxtMotivo.Text = GvRow.DataKey("MotivoDevolucion")
|
||||
ChkEstatus.Checked = CBool(GvRow.DataKey("Estatus"))
|
||||
|
||||
UpModal.Update()
|
||||
|
||||
RegistraScript("$('#DivMotivo').modal('show');")
|
||||
End Sub
|
||||
|
||||
Private Sub LimpiaDatos()
|
||||
CveMotivoDevolucion = -1
|
||||
TxtMotivo.Text = ""
|
||||
ChkEstatus.Checked = True
|
||||
End Sub
|
||||
Protected Sub BtnGuardar_Click(sender As Object, e As EventArgs)
|
||||
Dim Motivo As String = TxtMotivo.Text
|
||||
|
||||
'AGREGAR
|
||||
Dim ObjVentas As New ClsVentas
|
||||
If CveMotivoDevolucion = -1 Then
|
||||
If ObjVentas.AddMotivoDevolucion(Motivo, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
|
||||
Alert("El motivo se agrego correctamente")
|
||||
End If
|
||||
Else
|
||||
If ObjVentas.UpdateMotivoDevolucion(CveMotivoDevolucion, Motivo, ChkEstatus.Checked, UsuarioActual.CveEmpresa) Then
|
||||
Alert("El motivo se actualizó correctamente")
|
||||
End If
|
||||
End If
|
||||
ObjVentas.Dispose()
|
||||
|
||||
RegistraScript("$('#DivMotivo').modal('hide');")
|
||||
|
||||
CargaDatos()
|
||||
End Sub
|
||||
Protected Sub LnkAgregar_Click(sender As Object, e As EventArgs)
|
||||
LimpiaDatos()
|
||||
|
||||
RegistraScript("$('#DivMotivo').modal('show');")
|
||||
End Sub
|
||||
End Class
|
||||
Reference in New Issue
Block a user