102 lines
3.6 KiB
VB.net
102 lines
3.6 KiB
VB.net
Option Strict On
|
|
Option Explicit On
|
|
|
|
Imports System.Data
|
|
Imports System.Linq
|
|
Imports Extensiones
|
|
Imports Microsoft.Reporting.WebForms
|
|
|
|
Partial Class AC_RepMatrizIngresos
|
|
Inherits ClsPaginas
|
|
|
|
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
|
|
If Not Page.IsPostBack Then
|
|
ViewState("Orden") = ""
|
|
CargaDatos()
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub CargaDatos()
|
|
Dim AC As New ClsAC
|
|
UPDatos.Update()
|
|
Gv.DataBind()
|
|
|
|
If AC.GetMatrizID() Then
|
|
ViewState("DTMatrizIngresos") = AC.DtResultados
|
|
GlobalDTAC_MatrizIngresos = AC.DtResultados
|
|
End If
|
|
|
|
AC.Dispose()
|
|
|
|
If ViewState("Orden").ToString() <> String.Empty Then
|
|
CargaGrid(ViewState("Orden").ToString())
|
|
Else
|
|
CargaGrid("")
|
|
End If
|
|
End Sub
|
|
|
|
#Region "O R D E N A M I E N T O"
|
|
Protected Sub LbOrden_Click(ByVal sender As Object, ByVal e As EventArgs)
|
|
Dim Orden As String = ""
|
|
Dim Campo As String = ""
|
|
Dim Literal As Literal = Nothing
|
|
Const OrdenInicial As String = ""
|
|
Dim Arg(2) As String
|
|
|
|
Arg = CType(sender, LinkButton).CommandArgument().ToString.Split(";"c)
|
|
Campo = Arg(0)
|
|
Literal = CType(CType(sender, LinkButton).NamingContainer.FindControl("Img" & Campo.Replace(",", "_")), Literal)
|
|
|
|
If ViewState(String.Format("O{0}", Campo)) IsNot Nothing AndAlso ViewState(String.Format("O{0}", Campo)).ToString = String.Format("{0} DESC", Campo) Then
|
|
ViewState(String.Format("O{0}", Campo)) = String.Format("{0} ASC", Campo)
|
|
Literal.Text = String.Format("<i class='fa fa-sort-asc' style='color:#999' ></i>")
|
|
Else
|
|
ViewState(String.Format("O{0}", Campo)) = String.Format("{0} DESC", Campo)
|
|
Literal.Text = String.Format("<i class='fa fa-sort-desc' style='color:#999' ></i>")
|
|
End If
|
|
Orden = OrdenInicial & ViewState(String.Format("O{0}", Campo)).ToString
|
|
ViewState("Orden") = Orden
|
|
CargaGrid(Orden)
|
|
End Sub
|
|
|
|
Private Sub CargaGrid(Orden As String)
|
|
If Orden <> String.Empty Then
|
|
Dim DV As New DataView(CType(ViewState("DTMatrizIngresos"), DataTable), "", Orden, DataViewRowState.CurrentRows)
|
|
Gv.DataSource = DV.ToTable()
|
|
GvDatos.DataSource = DV.ToTable()
|
|
DV.Dispose()
|
|
Else
|
|
Gv.DataSource = CType(ViewState("DTMatrizIngresos"), DataTable)
|
|
GvDatos.DataSource = CType(ViewState("DTMatrizIngresos"), DataTable)
|
|
End If
|
|
Gv.DataBind()
|
|
GvDatos.DataBind()
|
|
UPDatos.Update()
|
|
End Sub
|
|
#End Region
|
|
|
|
#Region " EXPORTAR - PDF - EXCEL "
|
|
Protected Sub ImgExcel_Click(sender As Object, e As ImageClickEventArgs)
|
|
Tbl.ExportToExcel("Reporte Matriz de Egresos")
|
|
End Sub
|
|
|
|
Protected Sub BtnImprimir_Click(sender As Object, e As ImageClickEventArgs)
|
|
ImprimiReporte()
|
|
End Sub
|
|
'No quitar porque no funciona el exporta PDF
|
|
Public Overrides Sub VerifyRenderingInServerForm(control As Control)
|
|
' Verifies that the control is rendered
|
|
End Sub
|
|
#End Region
|
|
|
|
#Region "I M P R I M I R "
|
|
Protected Sub ImprimiReporte()
|
|
Dim params As New List(Of ReportParameter)
|
|
params.Add(New ReportParameter("pEmp", UsuarioActual.Empresa.Empresa))
|
|
Dim Imagen As New System.IO.FileInfo($"{UsuarioActual.Empresa.Ruta}/Logo.png")
|
|
params.Add(New ReportParameter("pImg", If(Imagen.Exists, $"file://{Imagen.FullName}", "")))
|
|
|
|
ImprimirPDF("AC/Reportes/RepMatrizIngresos.rdlc", GlobalDTAC_MatrizIngresos, params, "ReporteMatrizEgresos")
|
|
End Sub
|
|
#End Region
|
|
End Class |