Option Explicit On Option Strict On Imports Extensiones Imports System.Data Partial Class Ventas_RepABT Inherits ClsPaginas 'Private ReadOnly Property Ejercicio As Integer ' Get ' Return ViewState("Ejercicio") ' End Get 'End Property 'Private ReadOnly Property Periodo As Integer ' Get ' Return ViewState("Periodo") ' End Get 'End Property Private Property DtDatos As datatable Get Return CType(ViewState("DtDatos"), DataTable) End Get Set(value As datatable) ViewState("DtDatos") = value End Set End Property Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load If Not IsPostBack Then 'If Request("Ejercicio") IsNot Nothing AndAlso IsNumeric(Request("Ejercicio")) Then ' ViewState("Ejercicio") = Request("Ejercicio") 'End If 'If Request("Periodo") IsNot Nothing AndAlso IsNumeric(Request("Periodo")) Then ' ViewState("Periodo") = Request("Periodo") 'End If DdlEjercicio.SelectedValue = Now.Year.ToString DdlPeriodo.SelectedValue = Now.Month.ToString CargaDatos() End If End Sub Private Sub CargaDatos() Dim ObjVentas As New ClsVentas If ObjVentas.GetRepABT(DdlEjercicio.SelectedValue.ToEntero, DdlPeriodo.SelectedValue.ToEntero) Then GvRepABT.DataSource = ObjVentas.DtResultados.FiltraParametros("", DistinctColumns:={"CveVenta", "TipoDocto", "SerieFolio", "Cliente", "SubProyecto", "FechaVenta", "Mesa", "NumeroPersonas", "TotalRemision", "FechaCorte"}) Else GvRepABT.DataSource = Nothing End If DtDatos = ObjVentas.DtResultados ObjVentas.Dispose() GvRepABT.DataBind() End Sub Protected Sub ImgExcel_Click(sender As Object, e As EventArgs) Handles ImgExcel.Click GvRepABT.ExportToExcel("Reporte ABT") End Sub Protected Sub GvRepABT_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvRepABT.RowDataBound If e.Row.RowType = DataControlRowType.DataRow Then e.Row.FCGridView("GvD").DataSource = DtDatos.FiltraParametros(String.Format("CveVenta = {0}", e.Row.DBCampo("CveVenta"))) e.Row.FCGridView("GvD").DataBind() End If End Sub Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs) Handles BtnConsultar.Click CargaDatos() UpDatos.Update() End Sub End Class