Commit inicial Ventas Productivo
This commit is contained in:
90
Compras/RepBeneficiarios.aspx.vb
Normal file
90
Compras/RepBeneficiarios.aspx.vb
Normal file
@@ -0,0 +1,90 @@
|
||||
Option Explicit On
|
||||
Option Strict On
|
||||
|
||||
Imports System.Data
|
||||
Imports Extensiones
|
||||
Partial Class Compras_RepBeneficiarios
|
||||
Inherits ClsPaginas
|
||||
|
||||
|
||||
#Region "PROPIEDADES"
|
||||
Private Property DtDatos As DataTable
|
||||
Get
|
||||
DtDatos = CType(ViewState("DtDatos"), DataTable)
|
||||
End Get
|
||||
Set(value As DataTable)
|
||||
ViewState("DtDatos") = value
|
||||
End Set
|
||||
End Property
|
||||
#End Region
|
||||
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()
|
||||
Dim ObjCompras As New ClsCompras
|
||||
|
||||
If ObjCompras.GetBeneficiarios(-1, UsuarioActual.CveEmpresa) Then
|
||||
DtDatos = ObjCompras.DtResultados
|
||||
CargaGrid("")
|
||||
Else
|
||||
Alert("Ocurrió un error al obtener el catálogo de Beneficiarios", Extensiones.TipoMensaje.MsgError)
|
||||
End If
|
||||
|
||||
ObjCompras.Dispose()
|
||||
End Sub
|
||||
|
||||
Protected Sub GvDatos_RowDataBound(sender As Object, e As GridViewRowEventArgs)
|
||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||
If e.Row.DBCampo("CveProveedor") = "" Then
|
||||
e.Row.CssClass = "SubTotales2"
|
||||
Else
|
||||
e.Row.FCHyperLink("HLRazonSocial").NavigateUrl = String.Format("/Compras/Proveedores.aspx?CveProveedor={0}", e.Row.DBCampo("CveProveedor"))
|
||||
e.Row.FCHyperLink("HLDeudor").NavigateUrl = String.Format("RepBeneficiariosDetalle.aspx?CVEP={0}&T=5", e.Row.DBCampo("CveProveedor"))
|
||||
End If
|
||||
|
||||
End If
|
||||
End Sub
|
||||
|
||||
#Region "O R D E N A M I E N T O"
|
||||
Protected Sub LbOrden_Click(ByVal sender As Object, ByVal e As EventArgs)
|
||||
Dim Orden As String = ""
|
||||
Dim Campo As String = ""
|
||||
Dim Literal As Literal = Nothing
|
||||
Const OrdenInicial As String = ""
|
||||
Dim Arg(2) As String
|
||||
|
||||
Arg = CType(sender, LinkButton).CommandArgument().ToString.Split(";"c)
|
||||
Campo = Arg(0)
|
||||
Literal = CType(CType(sender, LinkButton).NamingContainer.FindControl("Img" & Campo.Replace(",", "_")), Literal)
|
||||
|
||||
If ViewState(String.Format("O{0}", Campo)) IsNot Nothing AndAlso ViewState(String.Format("O{0}", Campo)).ToString = String.Format("{0} DESC", Campo) Then
|
||||
ViewState(String.Format("O{0}", Campo)) = String.Format("{0} ASC", Campo)
|
||||
Literal.Text = String.Format("<i class='fa fa-sort-asc' style='color:#999' ></i>")
|
||||
Else
|
||||
ViewState(String.Format("O{0}", Campo)) = String.Format("{0} DESC", Campo)
|
||||
Literal.Text = String.Format("<i class='fa fa-sort-desc' style='color:#999' ></i>")
|
||||
End If
|
||||
Orden = OrdenInicial & ViewState(String.Format("O{0}", Campo)).ToString
|
||||
ViewState("Orden") = Orden
|
||||
CargaGrid(Orden)
|
||||
End Sub
|
||||
|
||||
Protected Sub CargaGrid(Orden As String)
|
||||
Dim DV As DataView = Nothing
|
||||
DV = New DataView(DtDatos, "", Orden, DataViewRowState.CurrentRows)
|
||||
If Orden <> String.Empty Then
|
||||
GvDatos.DataSource = DV.ToTable()
|
||||
Else
|
||||
GvDatos.DataSource = DtDatos
|
||||
End If
|
||||
|
||||
GvDatos.DataBind()
|
||||
UpDatos.Update()
|
||||
DV.Dispose()
|
||||
End Sub
|
||||
#End Region
|
||||
End Class
|
||||
Reference in New Issue
Block a user