114 lines
3.7 KiB
VB.net
114 lines
3.7 KiB
VB.net
Option Explicit On
|
|
Option Strict On
|
|
|
|
Imports System.Data
|
|
Imports Microsoft.Reporting.WebForms
|
|
Imports Extensiones
|
|
Partial Class RepComprasPrecios
|
|
Inherits ClsPaginas
|
|
Private Shared missing As Object = System.Reflection.Missing.Value
|
|
|
|
#Region "PROPIEDADES"
|
|
Private Property DtCompras As DataTable
|
|
Get
|
|
Return DirectCast(ViewState("DtCompras"), DataTable)
|
|
End Get
|
|
Set(value As DataTable)
|
|
ViewState("DtCompras") = 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
|
|
CargaProveedor()
|
|
'CargaDatos()
|
|
End If
|
|
End Sub
|
|
|
|
#Region " C A R G A - D A T O S "
|
|
Public Sub CargaDatos()
|
|
Dim ObjCompras As New ClsCompras
|
|
|
|
If ObjCompras.GetRepComprasPrecios(DdlProveedor.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) Then
|
|
GvDatos.DataSource = ObjCompras.DtResultados
|
|
DtCompras = ObjCompras.DtResultados
|
|
|
|
End If
|
|
|
|
ObjCompras.Dispose()
|
|
GvDatos.DataBind()
|
|
UPDatos.Update()
|
|
End Sub
|
|
#End Region
|
|
|
|
#Region "G V - D A T O S "
|
|
Protected Sub GvDatos_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvDatos.RowDataBound
|
|
If e.Row.RowType = DataControlRowType.DataRow Then
|
|
|
|
'GvDatos.Columns(1).ItemStyle.Width = New Unit("500px")
|
|
|
|
GvDatos.HeaderRow.Cells(0).Visible = False
|
|
e.Row.Cells(0).Visible = False
|
|
|
|
e.Row.HorizontalAlign = HorizontalAlign.Right
|
|
e.Row.Cells(1).HorizontalAlign = HorizontalAlign.Left
|
|
e.Row.Cells(1).Width = Unit.Pixel(125)
|
|
|
|
If e.Row.DBCampo("CvePS") = "" Then
|
|
e.Row.CssClass = "Totales"
|
|
End If
|
|
|
|
For Each Cells As TableCell In e.Row.Cells
|
|
Dim Celda As String = Cells.Text
|
|
If IsNumeric(Celda) Then
|
|
'If Celda.ToDouble = 0 Then
|
|
' Cells.Text = ""
|
|
'Else
|
|
Dim ce = DirectCast(Cells, System.Web.UI.WebControls.DataControlFieldCell)
|
|
|
|
If Not ce.ContainingField.HeaderText = "PS" Then
|
|
Cells.Text = Cells.Text.FormatoNumero(2)
|
|
End If
|
|
'End If
|
|
End If
|
|
Next
|
|
|
|
End If
|
|
End Sub
|
|
#End Region
|
|
|
|
#Region "CARGA COMBOS FILTRO"
|
|
Private Sub CargaProveedor()
|
|
DdlProveedor.setEsWebService(True)
|
|
DdlProveedor.Attributes.Add("data-metodo", "getproveedores")
|
|
DdlProveedor.SelectedText = "Todos"
|
|
DdlProveedor.SelectedValue = "-1"
|
|
End Sub
|
|
#End Region
|
|
|
|
#Region "IMPRESION"
|
|
'Private Sub LnkPdf_Click(sender As Object, e As EventArgs) Handles LnkPdf.Click
|
|
' Imprime("PDF")
|
|
'End Sub
|
|
Private Sub Imprime(Formato As String)
|
|
If DtCompras IsNot Nothing Then
|
|
Dim StrFiltro As New StringBuilder
|
|
StrFiltro.AppendFormat("Proveedor: {0},", DdlProveedor.SelectedText)
|
|
GvDatos.ExportToExcelG("RepComprasPrecios.xlsx", "Reporte de Precios de Compras", UsuarioActual, StrFiltro.ToString, 100, 200)
|
|
Else
|
|
Alert("No hay datos consultados", TipoMensaje.MsgAdvertencia)
|
|
End If
|
|
End Sub
|
|
#End Region
|
|
Private Sub BtnConsultar_Click(sender As Object, e As EventArgs) Handles BtnConsultar.Click
|
|
CargaDatos()
|
|
End Sub
|
|
|
|
Private Sub ImgExcel_Click(sender As Object, e As EventArgs) Handles ImgExcel.Click
|
|
Imprime("Excel")
|
|
End Sub
|
|
Public Overrides Sub VerifyRenderingInServerForm(ByVal control As Control)
|
|
End Sub
|
|
End Class
|