Option Explicit On Option Strict On Imports System.Data Imports Extensiones Imports Microsoft.Reporting.WebForms Partial Class Compras_RepCancelacionesVentas Inherits ClsPaginas 'Private Property DTComplemntos As DataTable ' Get ' If ViewState("DTComplemntos") Is Nothing Then ' Return New DataTable ' Else ' Return DirectCast(ViewState("DTComplemntos"), DataTable) ' End If ' End Get ' Set(value As DataTable) ' ViewState("DTComplemntos") = value ' End Set 'End Property Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load If Not IsPostBack Then InicializaValores() End If End Sub #Region " INICIALIZA VALORES " Private Sub InicializaValores() TxtFiltrosFechaInicio.Text = NowADS().FirstDayOfMonth.ToShortDateString TxtFiltrosFechaFin.Text = NowADS().ToShortDateString Dim EsWS = If(UsuarioActual.Empresa.Funcionalidad(105) = "1" Or UsuarioActual.Empresa.Funcionalidad(141) = "1", True, False) If EsWS Then DdlClientes.setEsWebService(True) Else DdlClientes.setEsWebService(False) DdlClientes.DataSource = GlobalDTCliente(UsuarioActual.CveEmpresa, -1) DdlClientes.DataBind() DdlClientes.ddl.Items.Insert(0, New ListItem("Todos", "-1")) End If DdlMotivoCancelacion.DataSource = GlobalDTMotivosCancelacionEmpresa(UsuarioActual.CveEmpresa).FiltraParametros("CveSATMotivoCancelacion IN (2,3)") DdlMotivoCancelacion.DataBind() DdlMotivoCancelacion.Items.Insert(0, New ListItem("Todos", "-1")) CargarCentrosDeCosto(Nothing, DdlSubProyecto, Nothing, LblSubProyecto:=LblSubProyecto) GvDatos.Columns(4).HeaderText = LblSubProyecto.Text UpFiltros.Update() End Sub #End Region #Region " CARGA DATOS " Protected Sub BtnConsultarFiltros_Click(sender As Object, e As EventArgs) CargaDatos() End Sub Private Sub CargaDatos() LnkExcel.Visible = False Dim CveCliente As Integer = If(DdlClientes.SelectedValue = "", -1, DdlClientes.SelectedValue.ToEntero) Dim FechaInicio = If(IsDate(TxtFiltrosFechaInicio.Text), TxtFiltrosFechaInicio.Text.ToDate, MinFecha) Dim FechaFin = If(IsDate(TxtFiltrosFechaFin.Text), TxtFiltrosFechaFin.Text.ToDate, MaxFecha) Dim ObjVentas As New ClsVentas If ObjVentas.GetRepCancelacionVentas(FechaInicio, FechaFin, DdlSubProyecto.SelectedValue.ToEntero, CveCliente, DdlMotivoCancelacion.SelectedValue.ToEntero, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then GvDatos.DataSource = ObjVentas.DtResultados If ObjVentas.DtResultados.Rows.Count > 0 Then LnkExcel.Visible = True End If Else GvDatos.DataSource = Nothing End If ObjVentas.Dispose() GvDatos.DataBind() UpAcciones.Update() UpDatos.Update() End Sub Protected Sub GvDatos_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDatos.RowDataBound If e.Row.RowType = DataControlRowType.DataRow Then End If End Sub #End Region #Region "IMPRESION" Protected Sub LnkExcel_Click(sender As Object, e As EventArgs) GeneraImpresion() End Sub Private Sub GeneraImpresion() GvDatos.ExportToExcel2("RepCancelacionVentas.xlsx") End Sub #End Region End Class