Option Explicit On
Option Strict On
Imports System.Data
Imports Extensiones
Partial Class Compras_RepFletes
Inherits ClsPaginas
#Region "PROPIEDADES"
Private Property DtFletes As DataTable
Get
Return CType(ViewState("DtFletes"), DataTable)
End Get
Set(value As DataTable)
ViewState("DtFletes") = 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
InicializaValores()
End If
End Sub
Private Sub InicializaValores()
TxtFechaI.Text = Date.Now.AddDays(-Now.DayOfYear + 1).ToShortDateString
TxtFechaF.Text = Date.Now.ToShortDateString
DdlProveedor.DataSource = GlobalDTCompProveedores(UsuarioActual.CveEmpresa)
DdlProveedor.DataBind()
DdlProveedor.Items.Insert(0, New ListItem("Todos", "-1"))
End Sub
#Region " CARGA DAATOS "
Protected Sub BtnConsultarFiltros_Click(sender As Object, e As EventArgs)
CargaDatos()
End Sub
Private Sub CargaDatos()
Dim ObjInv As New ClsInventarios
If TxtFolio.Text <> "" Then TxtFechaI.Text = MinFecha.ToShortDateString : TxtFechaF.Text = MaxFecha.ToShortDateString
If ObjInv.GetFletes(UsuarioActual.CveEmpresa, -1, If(TxtFolio.Text = "", "-1", TxtFolio.Text), DdlProveedor.SelectedValue.ToString.ToEntero, -1, -1, TxtFechaI.Text.ToDate, TxtFechaF.Text.ToDate) Then
DtFletes = ObjInv.DtResultados
End If
ObjInv.Dispose()
CargaGrid()
End Sub
Private Sub CargaGrid()
GvDatos.DataSource = DtFletes
GvDatos.DataBind()
UpDatos.Update()
End Sub
Protected Sub GvDatos_RowDataBound(sender As Object, e As GridViewRowEventArgs)
If e.Row.RowType = DataControlRowType.DataRow Then
Dim Modalidad = e.Row.DBCampo("Modalidad").ToString.ToEntero
Dim Liga = If(Modalidad = 1, "/OC/OC.aspx?OC", "/Compras/Compras.aspx?CveCompra")
e.Row.Cells(4).Text = $"{If(Modalidad = 1, "OC: ", "Compra: ")}{e.Row.DBCampo("FolioDocumento")}"
e.Row.Cells(5).Text = $"{e.Row.DBCampo("FechaDocumento").ToDate.ToShortDateString}"
e.Row.Cells(6).Text = $"{e.Row.DBCampo("DescripcionDocumento")}"
e.Row.Cells(7).Text = $"{e.Row.DBCampo("TotalDocumento")}"
End If
End Sub
#End Region
End Class