144 lines
5.6 KiB
VB.net
144 lines
5.6 KiB
VB.net
Imports System.Data
|
|
Imports Extensiones
|
|
Imports Microsoft.Reporting.WebForms
|
|
|
|
Partial Class AC_RepIngresosMensuales
|
|
Inherits ClsPaginas
|
|
|
|
|
|
#Region "PROPIEDADES"
|
|
Private Property DtIngresos As DataTable
|
|
Get
|
|
Return CType(ViewState("DtIngresos"), DataTable)
|
|
End Get
|
|
Set(value As DataTable)
|
|
ViewState("DtIngresos") = value
|
|
End Set
|
|
End Property
|
|
#End Region
|
|
|
|
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
|
|
If Not Page.IsPostBack Then
|
|
DdlEjercicio.SelectedValue = UsuarioActual.Empresa.EjercicioActual.ToString
|
|
CargaCombos()
|
|
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub CargaCombos()
|
|
DdlFuenteRecaudacion.DataSource = GlobalDTAC_FuentesRecaudacion(UsuarioActual.CveEmpresa)
|
|
DdlFuenteRecaudacion.Items.Insert(0, New ListItem("Todas", "-1"))
|
|
DdlFuenteRecaudacion.DataBind()
|
|
|
|
DdlRubroIngreso.DataSource = GlobalDTAC_RubrosIngreso()
|
|
DdlRubroIngreso.Items.Insert(0, New ListItem("Todas", "-1"))
|
|
DdlRubroIngreso.DataBind()
|
|
|
|
UpFiltros.Update()
|
|
End Sub
|
|
|
|
Private Sub CargaDatos()
|
|
Dim ObjAC As New ClsContPAQi(UsuarioActual.Empresa)
|
|
|
|
If ObjAC.GetPresupuestoIngresosMensualesRep(DdlEjercicio.SelectedValue.ToEntero, DdlMomentoContable.SelectedValue.ToEntero, DdlFuenteRecaudacion.SelectedValue.ToEntero, DdlRubroIngreso.SelectedValue.ToEntero, DdlAgrupador.SelectedValue.ToEntero) Then
|
|
DtIngresos = ObjAC.DtResultados
|
|
Else
|
|
DtIngresos = Nothing
|
|
Alert("Ocurrio un error al cargar los datos del reporte.", TipoMensaje.MsgError)
|
|
End If
|
|
|
|
ObjAC.Dispose()
|
|
|
|
'If DdlAgrupador.SelectedValue = "1" Then
|
|
' DtIngresos = DtIngresos.FiltraParametros("Nivel IN (1,2)")
|
|
'ElseIf DdlAgrupador.SelectedValue = "2" Then
|
|
' DtIngresos = DtIngresos.FiltraParametros("Nivel IN (1,3)")
|
|
'End If
|
|
|
|
DtIngresos = DtIngresos.FiltraParametros("Nivel IN (1,2,3,4)")
|
|
|
|
GvIngresos.DataSource = DtIngresos
|
|
GvIngresos.DataBind()
|
|
UpIngresos.Update()
|
|
End Sub
|
|
|
|
Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs)
|
|
CargaDatos()
|
|
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
|
|
Protected Sub CargaGrid(Orden As String)
|
|
Dim DV As DataView = Nothing
|
|
DV = New DataView(DtIngresos, "", Orden, DataViewRowState.CurrentRows)
|
|
If Orden <> String.Empty Then
|
|
GvIngresos.DataSource = DV.ToTable()
|
|
GvIngresos.DataBind()
|
|
Else
|
|
GvIngresos.DataSource = DtIngresos
|
|
End If
|
|
DV.Dispose()
|
|
End Sub
|
|
#End Region
|
|
|
|
Protected Sub GvIngresos_RowDataBound(sender As Object, e As GridViewRowEventArgs)
|
|
If e.Row.RowType = DataControlRowType.DataRow Then
|
|
If e.Row.DBCampo("Nivel") = "1" Then
|
|
e.Row.FCLabel("LabelFuenteRecaudacion").Text = "Total"
|
|
e.Row.CssClass = "Totales"
|
|
'ElseIf e.Row.DBCampo("Nivel") = "2" Then
|
|
' e.Row.FCLabel("LabelFuenteRecaudacion").Text = e.Row.DBCampo("FuenteRecaudacion")
|
|
' e.Row.CssClass = "SubTotales"
|
|
' 'ElseIf e.Row.DBCampo("Nivel") = "1" Then
|
|
' ' e.Row.CssClass = "SubTotales"
|
|
'ElseIf e.Row.DBCampo("Nivel") = "4" Then
|
|
' e.Row.FCLabel("LabelFuenteRecaudacion").Text = e.Row.DBCampo("FuenteRecaudacion")
|
|
End If
|
|
End If
|
|
End Sub
|
|
|
|
#Region "I M P R I M I R "
|
|
|
|
Protected Sub BtnImprimir_Click(sender As Object, e As EventArgs)
|
|
ImprimirReporte()
|
|
End Sub
|
|
|
|
Protected Sub ImgExcel_Click(sender As Object, e As EventArgs) Handles ImgExcel.Click
|
|
ImprimirReporte("Excel")
|
|
End Sub
|
|
|
|
Private Sub ImprimirReporte(Optional Formato As String = "PDF")
|
|
Dim Imagen As New System.IO.FileInfo($"{UsuarioActual.Empresa.Ruta}/Logo.png")
|
|
|
|
Dim params As New List(Of ReportParameter)
|
|
params.Add(New ReportParameter("pEmp", UsuarioActual.Empresa.Empresa))
|
|
params.Add(New ReportParameter("pImg", If(Imagen.Exists, $"file://{Imagen.FullName}", "")))
|
|
params.Add(New ReportParameter("pEjercicio", DdlEjercicio.SelectedValue))
|
|
params.Add(New ReportParameter("pMomentoContable", DdlMomentoContable.SelectedItem.ToString))
|
|
|
|
ImprimirPDF("AC/Reportes/RepPresupuestoIngresosMensual.rdlc", DtIngresos, params, "ReportePresupuestoIngresosMensual", Formato)
|
|
End Sub
|
|
#End Region
|
|
End Class |