163 lines
6.7 KiB
VB.net
163 lines
6.7 KiB
VB.net
Imports System.Data
|
|
Imports Extensiones
|
|
|
|
Partial Class Vta_CatCobranzaEstatus
|
|
Inherits ClsPaginas
|
|
|
|
Private Property CveCobranzaEstatus As Integer
|
|
Get
|
|
Return ViewState("CveCobranzaEstatus").ToString.ToEntero
|
|
End Get
|
|
Set(value As Integer)
|
|
ViewState("CveCobranzaEstatus") = value
|
|
End Set
|
|
End Property
|
|
|
|
Private Property CveCobranzaEstatusTurno As Integer
|
|
Get
|
|
Return ViewState("CveCobranzaEstatusTurno").ToString.ToEntero
|
|
End Get
|
|
Set(value As Integer)
|
|
ViewState("CveCobranzaEstatusTurno") = value
|
|
End Set
|
|
End Property
|
|
|
|
Public Sub page_load(sender As Object, e As EventArgs) Handles Me.Load
|
|
If Not Page.IsPostBack Then
|
|
CargaDatos()
|
|
CargaDatosTurno()
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub CargaDatos()
|
|
Dim ObjVentas As New ClsVentas
|
|
If ObjVentas.GetCobranzaEstatus(UsuarioActual.CveEmpresa) Then
|
|
GvDatos.DataSource = ObjVentas.DtResultados
|
|
End If
|
|
ObjVentas.Dispose()
|
|
GvDatos.DataBind()
|
|
End Sub
|
|
|
|
Public Sub BtnAgregarEstatus_Click(sender As Object, e As EventArgs) Handles BtnAgregarEstatus.Click
|
|
TxtEstatusCobranza.Text = ""
|
|
ChkEstatus.Checked = True
|
|
BtnAgregarEstatusCobranza.Text = "Agregar"
|
|
UpAddEstatus.Update()
|
|
RegistraScript(String.Format("$('#{0}').modal();", "divAddEstatusCobranza"))
|
|
End Sub
|
|
|
|
Public Sub Edit_Click(sender As Object, e As EventArgs)
|
|
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
|
CveCobranzaEstatus = GvRow.DataKey("CveCobranzaEstatus").ToEntero
|
|
TxtEstatusCobranza.Text = GvRow.DataKey("CobranzaEstatus").ToString
|
|
ChkEstatus.Checked = GvRow.DataKey("Estatus") = "True"
|
|
BtnAgregarEstatusCobranza.Text = "Actualizar"
|
|
UpAddEstatus.Update()
|
|
RegistraScript(String.Format("$('#{0}').modal();", "divAddEstatusCobranza"))
|
|
End Sub
|
|
|
|
Public Sub BtnAgregarEstatusCobranza_Click(sender As Object, e As EventArgs) Handles BtnAgregarEstatusCobranza.Click
|
|
|
|
Dim ObjVentas As New ClsVentas
|
|
|
|
If BtnAgregarEstatusCobranza.Text = "Agregar" Then
|
|
If ObjVentas.AddCobranzaEstatus(TxtEstatusCobranza.Text, UsuarioActual.CveEmpresa, ChkEstatus.Checked, UsuarioActual.CveUsuario) Then
|
|
RegistraScript(String.Format("$('#{0}').modal('hide');", "divAddEstatusCobranza"))
|
|
Alert("Estatus agregado con exito")
|
|
CargaDatos()
|
|
UpDatos.Update()
|
|
Else
|
|
Alert("Error al agregar")
|
|
End If
|
|
Else
|
|
If ObjVentas.UpdateCobranzaEstatus(CveCobranzaEstatus, TxtEstatusCobranza.Text, ChkEstatus.Checked) Then
|
|
RegistraScript(String.Format("$('#{0}').modal('hide');", "divAddEstatusCobranza"))
|
|
Alert("Estatus agregado con exito")
|
|
CargaDatos()
|
|
UpDatos.Update()
|
|
Else
|
|
Alert("Error al actualizar")
|
|
End If
|
|
End If
|
|
End Sub
|
|
|
|
Protected Sub GvDatos_RowDeleting(sender As Object, e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GvDatos.RowDeleting
|
|
Dim ObjVentas As New ClsVentas
|
|
Dim CveEstatusOrdenServicio As Integer = GvDatos.Rows(e.RowIndex).DataKey("CveCobranzaEstatus").ToEntero
|
|
|
|
If ObjVentas.RemoveCobranzaEstatus(CveEstatusOrdenServicio) Then
|
|
GvDatos.EditIndex = -1
|
|
CargaDatos()
|
|
UpDatos.Update()
|
|
Alert("Estatus de cobranza eliminado")
|
|
End If
|
|
ObjVentas.Dispose()
|
|
End Sub
|
|
|
|
Private Sub CargaDatosTurno()
|
|
Dim ObjVentas As New ClsVentas
|
|
If ObjVentas.GetCobranzaTurnoEstatus(-1, UsuarioActual.CveEmpresa) Then
|
|
GvDatosTurno.DataSource = ObjVentas.DtResultados
|
|
End If
|
|
ObjVentas.Dispose()
|
|
GvDatosTurno.DataBind()
|
|
End Sub
|
|
|
|
Public Sub BtnAgregarEstatusTurno_Click(sender As Object, e As EventArgs) Handles BtnAgregarEstatusTurno.Click
|
|
TxtEstatusCobranzaTurno.Text = ""
|
|
ChkEstatusTurno.Checked = True
|
|
BtnAgregarEstatusCobranzaTurno.Text = "Agregar"
|
|
UpAddEstatusTurno.Update()
|
|
RegistraScript(String.Format("$('#{0}').modal();", "divAddEstatusCobranzaTurno"))
|
|
End Sub
|
|
|
|
Public Sub EditTurno_Click(sender As Object, e As EventArgs)
|
|
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
|
CveCobranzaEstatusTurno = GvRow.DataKey("CveCobranzaEstatusTurno").ToEntero
|
|
TxtEstatusCobranzaTurno.Text = GvRow.DataKey("CobranzaEstatusTurno").ToString
|
|
ChkEstatusTurno.Checked = GvRow.DataKey("Estatus") = "True"
|
|
BtnAgregarEstatusCobranzaTurno.Text = "Actualizar"
|
|
UpAddEstatusTurno.Update()
|
|
RegistraScript(String.Format("$('#{0}').modal();", "divAddEstatusCobranzaTurno"))
|
|
End Sub
|
|
|
|
Public Sub BtnAgregarEstatusCobranzaTurno_Click(sender As Object, e As EventArgs) Handles BtnAgregarEstatusCobranzaTurno.Click
|
|
|
|
Dim ObjVentas As New ClsVentas
|
|
|
|
If BtnAgregarEstatusCobranzaTurno.Text = "Agregar" Then
|
|
If ObjVentas.AddCobranzaEstatusTurno(TxtEstatusCobranzaTurno.Text, UsuarioActual.CveEmpresa, ChkEstatusTurno.Checked, UsuarioActual.CveUsuario) Then
|
|
RegistraScript(String.Format("$('#{0}').modal('hide');", "divAddEstatusCobranzaTurno"))
|
|
Alert("Estatus agregado con exito")
|
|
CargaDatosTurno()
|
|
UpDatosTurno.Update()
|
|
Else
|
|
Alert("Error al agregar")
|
|
End If
|
|
Else
|
|
If ObjVentas.UpdateCobranzaEstatusTurno(CveCobranzaEstatusTurno, TxtEstatusCobranzaTurno.Text, ChkEstatusTurno.Checked) Then
|
|
RegistraScript(String.Format("$('#{0}').modal('hide');", "divAddEstatusCobranzaTurno"))
|
|
Alert("Estatus agregado con exito")
|
|
CargaDatosTurno()
|
|
UpDatosTurno.Update()
|
|
Else
|
|
Alert("Error al actualizar")
|
|
End If
|
|
End If
|
|
End Sub
|
|
|
|
Protected Sub GvDatosTurno_RowDeleting(sender As Object, e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GvDatosTurno.RowDeleting
|
|
Dim ObjVentas As New ClsVentas
|
|
Dim CveEstatusOrdenServicio As Integer = GvDatosTurno.Rows(e.RowIndex).DataKey("CveCobranzaEstatusTurno").ToEntero
|
|
|
|
If ObjVentas.RemoveCobranzaEstatusTurno(CveEstatusOrdenServicio) Then
|
|
GvDatosTurno.EditIndex = -1
|
|
CargaDatosTurno()
|
|
UpDatosTurno.Update()
|
|
Alert("Turno de estatus de cobranza eliminado")
|
|
End If
|
|
ObjVentas.Dispose()
|
|
End Sub
|
|
|
|
End Class
|