114 lines
3.8 KiB
VB.net
114 lines
3.8 KiB
VB.net
Option Explicit On
|
|
Option Strict On
|
|
|
|
Imports System.Data
|
|
Imports Extensiones
|
|
Partial Class Bancos_PopUpBuscarCuentasProveedor
|
|
Inherits ClsPaginas
|
|
|
|
#Region "Propiedades"
|
|
Private ReadOnly Property CveProveedor As Integer
|
|
Get
|
|
Return ViewState("CveProveedor").ToString.ToEntero
|
|
End Get
|
|
End Property
|
|
Private Property DTCuentasBancos As DataTable
|
|
Get
|
|
Return CType(ViewState("DTCuentasBancos"), DataTable)
|
|
End Get
|
|
Set(value As DataTable)
|
|
ViewState("DTCuentasBancos") = 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
|
|
CType(Me.Master, BaseMasterPage).EsPopup = True
|
|
CType(Me.Master, BaseMasterPage).PopupWidth = 780
|
|
RegistraScript("if($get('tdContenido')){$get('tdContenido').style.height='465px'}")
|
|
|
|
If Request("CveProveedor") IsNot Nothing AndAlso IsNumeric(Request("CveProveedor")) AndAlso Request("CveProveedor").ToEntero > 0 Then
|
|
ViewState("CveProveedor") = Request("CveProveedor")
|
|
CargaDatos(CveProveedor)
|
|
DdlProveedores.SelectedValue = CveProveedor.ToString
|
|
Else
|
|
ViewState("CveProveedor") = -1
|
|
End If
|
|
|
|
InicializaValores()
|
|
|
|
Me.Form.DefaultButton = BtnBuscar.UniqueID
|
|
End If
|
|
End Sub
|
|
Private Sub InicializaValores()
|
|
Dim Txt As String = IfNull(Request("Txt"), "").ToString
|
|
If Txt <> "" Then LblTitulo.Text = String.Format("Búsqueda de {0}", Txt)
|
|
|
|
DdlProveedores.setEsWebService(True)
|
|
DdlProveedores.Attributes.Add("data-metodo", "getproveedores")
|
|
DdlProveedores.SelectedText = "Seleccione"
|
|
DdlProveedores.SelectedValue = "-1"
|
|
DdlProveedores.DataBind()
|
|
End Sub
|
|
Private Sub CargaDatos(CveProveedor As Integer)
|
|
|
|
If ValidarFiltrosSeleccionados() OrElse CveProveedor > 0 Then
|
|
CargaCuentasBancarias()
|
|
UPDatos.Update()
|
|
Else
|
|
Alert("Seleccione un proveedor", TipoMensaje.MsgAdvertencia)
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub CargaCuentasBancarias()
|
|
'If CveProveedor <= 0 Then Exit Sub
|
|
Dim ObjCuentasBancos As New ClsGenerales
|
|
DTCuentasBancos = New DataTable
|
|
|
|
If ObjCuentasBancos.GetCuentasDepositos(CveProveedor) Then
|
|
DTCuentasBancos.Merge(ObjCuentasBancos.DtResultados)
|
|
Else
|
|
Alert("No se pudieron cargar las cuentas bancarias. Por favor intente nuevamente.", TipoMensaje.MsgAdvertencia)
|
|
ObjCuentasBancos.Dispose()
|
|
Exit Sub
|
|
End If
|
|
|
|
If CveProveedor < 0 Then
|
|
'Alert("No hay proveedor", TipoMensaje.MsgInformacion)
|
|
'TempDTCuentasBancos = DTCuentasBancos
|
|
End If
|
|
|
|
ObjCuentasBancos.Dispose()
|
|
CargaPSGridCuentasBancos()
|
|
|
|
End Sub
|
|
|
|
Private Sub CargaPSGridCuentasBancos()
|
|
GvBancosCuentas.DataSource = DTCuentasBancos.FiltraParametros($"CveProveedor = {DdlProveedores.SelectedValue}")
|
|
GvBancosCuentas.DataBind()
|
|
TblBusqueda.Visible = True
|
|
UPDatos.Update()
|
|
End Sub
|
|
|
|
Protected Sub BtnBuscar_Click(sender As Object, e As System.EventArgs) Handles BtnBuscar.Click
|
|
CargaDatos(DdlProveedores.SelectedValue.ToEntero)
|
|
End Sub
|
|
|
|
Private Sub GV_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvBancosCuentas.RowDataBound
|
|
'If e.Row.RowType = DataControlRowType.DataRow Then
|
|
' If e.Row.DBCampo("CveAlmacen") = "" Then
|
|
' e.Row.CssClass = "Totales"
|
|
' End If
|
|
'End If
|
|
End Sub
|
|
|
|
Private Function ValidarFiltrosSeleccionados() As Boolean
|
|
If DdlProveedores.SelectedValue.ToEntero > 0 Then Return True
|
|
Return False
|
|
End Function
|
|
|
|
End Class
|