Files
SIG/Compras/PopUpBuscarFolioC.aspx.vb
JORGE LUIS CAUDILLO ESPARZA c35cf91883 Commit inicial Ventas Productivo
2019-08-14 16:40:54 -07:00

105 lines
4.8 KiB
VB.net

Option Explicit On
Option Strict On
Imports Extensiones
Partial Class Compras_PopUpBuscarFolioC
Inherits ClsPaginas
Private ReadOnly Property OpcionBusqueda As String
Get
Return ViewState("Opt").ToString
End Get
End Property
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 = 900
'RegistraScript("$get('tdContenido').style.height='470px'")
CargaProveedor()
txtFechaI.Text = Now.AddDays(-30).ToShortDateString
txtFechaI.Text = Now.AddYears(-1).ToShortDateString
If Request("Opt") = "Fact" Then
ViewState("Opt") = "MandaCveCompra"
Else
ViewState("Opt") = "RecargaCompra"
End If
End If
End Sub
Protected Sub CargaProveedor()
DdlProveedor.DataSource = GlobalDTCompProveedores(UsuarioActual.CveEmpresa)
DdlProveedor.DataBind()
DdlProveedor.Items.Insert(0, New ListItem("Todos", "-1"))
End Sub
Protected Sub BtnBuscar_Click(sender As Object, e As System.EventArgs) Handles BtnBuscar.Click
Dim ObjCompras As New ClsCompras()
Dim Folio As String = "-1"
Dim FolioFiscal As String = "-1"
Dim Codigo As String = "-1"
Dim Proveedor As String = "-1"
Dim FechaI As String = "-1"
Dim FechaF As String = "-1"
Dim Descripcion, Obs As String
Folio = If(TxtFolio.Text.Trim.Length = 0, "-1", TxtFolio.Text.Trim)
FolioFiscal = If(TxtFolioFiscal.Text.Trim.Length = 0, "-1", TxtFolioFiscal.Text.Trim)
FechaI = If(IsDate(txtFechaI.Text.Trim()), txtFechaI.Text.Trim(), "-1")
FechaF = If(IsDate(txtFechaF.Text.Trim()), txtFechaF.Text.Trim(), "-1")
Descripcion = If(TxtDescripcion.Text.Trim = "", "-1", TxtDescripcion.Text.Trim)
Obs = If(TxtObservaciones.Text.Trim = "", "-1", TxtObservaciones.Text.Trim)
If ObjCompras.GetCompras(UsuarioActual.CveEmpresa, DdlTipoDocto.SelectedValue, Folio, FolioFiscal, Codigo, Proveedor, FechaI, FechaF, Descripcion, Obs, CveProveedor:=DdlProveedor.SelectedValue.ToEntero) Then
If ObjCompras.DtResultados.Rows.Count > 0 Then
LtlTotalRegistros.Text = ObjCompras.DtResultados.Rows.Count.ToString.FormatoNumero(0)
GV.DataSource = ObjCompras.DtResultados
Else
LtlTotalRegistros.Text = "0"
GV.DataSource = Nothing
Alert("No se encontraron registros con los parámetros solicitados.", Extensiones.TipoMensaje.MsgAdvertencia)
End If
End If
ObjCompras.Dispose()
GV.DataBind()
UPDatos.Update()
TblBusqueda.Visible = True
End Sub
Protected Sub GV_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GV.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
e.Row.Cells(3).HorizontalAlign = HorizontalAlign.Left
Dim Liga As String = String.Empty
Select Case Request("Opt")
Case "Fact"
Liga = String.Format("<a class='Texto' href='javascript:Ir2(""{0}"");'>", e.Row.DBCampo("CveCompra"))
Case "FactImp"
Liga = String.Format("<a class='Texto' href='javascript:Ir3(""{0}"");'>", e.Row.DBCampo("CveCompra"))
Case "FactFlete"
Liga = String.Format("<a class='Texto' href='javascript:Ir4(""{0}"");'>", e.Row.DBCampo("CveCompra"))
Case Else
Liga = String.Format("<a class='Texto' href='javascript:Ir(""{0}"");'>", e.Row.DBCampo("CveCompra"))
End Select
e.Row.FCLiteral("LtlTipo").Text = String.Format("<div class='truncate' style='width:34px;'>{0}{1}</a></div>", Liga, e.Row.DBCampo("TipoDocto"))
e.Row.FCLiteral("LtlFolio").Text = String.Format("<div class='truncate' style='width:80px;'>{0}{1}</a></div>", Liga, e.Row.DBCampo("SerieFolio"))
e.Row.FCLiteral("LtlFecha").Text = String.Format("<div class='truncate' style='width:64px;'>{0}{1}</a></div>", Liga, e.Row.DBCampo("Fecha").ToDate.ToShortDateString)
e.Row.FCLiteral("LtlNombre").Text = String.Format("<div class='truncate' style='width:325px;'>{0}{1}</a></div>", Liga, e.Row.DBCampo("RazonSocial"))
e.Row.FCLiteral("LtlTotal").Text = String.Format("<div class='truncate' style='width:72px;'>{0}{1}</a></div>", Liga, e.Row.DBCampo("Total").FormatoNumero)
e.Row.FCLiteral("LtlMoneda").Text = String.Format("<div class='truncate' style='width:65px;'>{0}{1}</a></div>", Liga, e.Row.DBCampo("Abreviatura"))
End If
End Sub
End Class