Option Explicit On Option Strict On Imports Extensiones Partial Class PopUpBuscarFolio Inherits ClsPaginas #Region "PROPIEDADES" Private ReadOnly Property Ruta As String Get Return UsuarioActual.Empresa.Ruta End Get End Property #End Region Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load If Not IsPostBack Then CType(Me.Master, BaseMasterPage).EsPopup = True CType(Me.Master, BaseMasterPage).PopupWidth = 850 RegistraScript("if($get('tdContenido')){$get('tdContenido').style.height='600px'}") InicializaValores() End If End Sub #Region " Inicializa Valores " Private Sub InicializaValores() TxtFechaF.Text = NowADS().ToShortDateString TxtFechaI.Text = NowADS().FirstDayOfMonth.ToShortDateString TxtFechaIngFin.Text = NowADS().ToShortDateString TxtFechaIngInicio.Text = NowADS().FirstDayOfMonth.ToShortDateString DdlTipoMovimiento.DataSource = GlobalDTInvConceptos() DdlTipoMovimiento.DataBind() DdlTipoMovimiento.Items.Insert(0, New ListItem("Todos", "-1")) DdlAlmacen.DataSource = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1).FiltraParametros("") 'GlobalDTAlmacen(UsuarioActual.CveEmpresa) DdlAlmacen.DataBind() DdlAlmacen.Items.Insert(0, New ListItem("Todos", "-1")) End Sub #End Region #Region " CARGA DATOS " Private Sub BtnBuscar_Click(sender As Object, e As EventArgs) Handles BtnBuscar.Click CargaDatos() End Sub Private Sub CargaDatos() If ValidarFiltrosSeleccionados() Then Dim Reporte As New ClsInventarios Dim FechaInicial = If(TxtFechaI.Text.Trim <> "" AndAlso TxtFechaI.Text <> "__/__/____", TxtFechaI.Text.ToDate, MinFecha) Dim FechaFinal = If(TxtFechaF.Text.Trim <> "" AndAlso TxtFechaF.Text <> "__/__/____", TxtFechaF.Text.ToDate, MaxFecha) Dim FechaIngI = If(TxtFechaIngInicio.Text.Trim <> "" AndAlso TxtFechaIngInicio.Text <> "__/__/____", TxtFechaIngInicio.Text.ToDate, MinFecha) Dim FechaIngF = If(TxtFechaIngFin.Text.Trim <> "" AndAlso TxtFechaIngFin.Text <> "__/__/____", TxtFechaIngFin.Text.ToDate, MaxFecha) If Reporte.GetMovimientosRep(DdlAlmacen.SelectedValue.ToEntero, DdlTipoMovimiento.SelectedValue.ToEntero, If(TxtFolio.Text = "", "-1", TxtFolio.Text.Trim).ToEntero, FechaIngI, FechaIngF, FechaInicial, FechaFinal, -1, UsuarioActual.CveEmpresa, TopSelect:=100) Then GvM.DataSource = Reporte.DtResultados LtlTotalRegistros.Text = Reporte.DtResultados.Rows.Count.ToString.FormatoNumero(0) Else GvM.DataSource = Nothing End If GvM.DataBind() UPDatos.Update() TblBusqueda.Visible = True Reporte.Dispose() Else Alert("Seleccione un criterio de busqueda", TipoMensaje.MsgAdvertencia) End If End Sub Private Function ValidarFiltrosSeleccionados() As Boolean 'If DdlAlmacen.SelectedValue.ToEntero > 0 Then Return True 'If DdlTipoMovimiento.SelectedValue.ToEntero > 0 Then Return True 'If TxtFolio.Text.Length > 0 Then Return True Return True End Function #End Region End Class