192 lines
8.0 KiB
VB.net
192 lines
8.0 KiB
VB.net
Imports Extensiones
|
|
Imports System.Data
|
|
Imports Microsoft.Reporting.WebForms
|
|
|
|
Partial Class AC_RepPresupuestoEgresosMensual
|
|
Inherits ClsPaginas
|
|
|
|
Private Property DtPresupuestoEgresos As DataTable
|
|
Get
|
|
Return CType(ViewState("DtPresupuestoEgresos"), DataTable)
|
|
End Get
|
|
Set(value As DataTable)
|
|
ViewState("DtPresupuestoEgresos") = value
|
|
End Set
|
|
End Property
|
|
|
|
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
|
|
If Not Page.IsPostBack Then
|
|
CargaEjercicios()
|
|
CargaCombos()
|
|
|
|
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub CargaEjercicios()
|
|
Dim ClsConta As New ClsContPAQi(UsuarioActual.Empresa)
|
|
If ClsConta.GetEjercicios() Then
|
|
DdlEjercicio.DataSource = ClsConta.DtResultados
|
|
Else
|
|
DdlEjercicio.DataSource = Nothing
|
|
End If
|
|
ClsConta.Dispose()
|
|
DdlEjercicio.DataBind()
|
|
|
|
DdlEjercicio.SelectedValueExist(UsuarioActual.Empresa.EjercicioActual.ToString)
|
|
|
|
|
|
End Sub
|
|
|
|
Private Sub CargaCombos()
|
|
DdlCapituloClasificaciones.DataSource = GlobalDTACClasificadorObjetoGasto(UsuarioActual.CveEmpresa).FiltraParametros("NivelClasificacion = 1", "Codigo")
|
|
DdlCapituloClasificaciones.DataBind()
|
|
|
|
DdlClasificaciones.DataSource = GlobalDTACClasificadorObjetoGasto(UsuarioActual.CveEmpresa).FiltraParametros("NivelClasificacion = 4", "Clasificacion")
|
|
DdlClasificaciones.DataBind()
|
|
|
|
DdlFuenteFinanciamiento.DataSource = GlobalDTAC_FuentesFinanciamiento.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa)
|
|
DdlFuenteFinanciamiento.DataBind()
|
|
|
|
DdlProgramaOperativo.DataSource = GlobalDTAC_ProgramaOperativo(UsuarioActual.CveEmpresa)
|
|
DdlProgramaOperativo.DataBind()
|
|
|
|
DdlUnidadAdministrativa.DataSource = GlobalDTAC_UnidadesAdministrativas(UsuarioActual.CveEmpresa)
|
|
DdlUnidadAdministrativa.DataBind()
|
|
End Sub
|
|
Protected Sub DdlCapituloClasificaciones_SelectedIndexChanged(sender As Object, e As EventArgs)
|
|
DdlClasificaciones.Items.Clear()
|
|
|
|
If DdlCapituloClasificaciones.SelectedValue.ToEntero > 1 Then
|
|
DdlClasificaciones.DataSource = GlobalDTACClasificadorObjetoGasto(UsuarioActual.CveEmpresa).FiltraParametros(String.Format("NivelClasificacion = 4 AND CodigoClasificacion LIKE '{0}%'", DdlCapituloClasificaciones.SelectedItem.Text.Substring(0, 1)), "Codigo")
|
|
Else
|
|
DdlClasificaciones.DataSource = GlobalDTACClasificadorObjetoGasto(UsuarioActual.CveEmpresa).FiltraParametros("NivelClasificacion = 4", "Codigo")
|
|
End If
|
|
|
|
DdlClasificaciones.Items.Insert(0, New ListItem("Todas", "-1"))
|
|
DdlClasificaciones.DataBind()
|
|
UPFiltros.Update()
|
|
End Sub
|
|
|
|
|
|
Private Sub CargaDatos()
|
|
|
|
ImgExcel.Visible = False
|
|
BtnImprimir.Visible = False
|
|
|
|
Dim objAC As New ClsContPAQi(UsuarioActual.Empresa)
|
|
Dim Capitulo As String = If(DdlCapituloClasificaciones.SelectedValue.ToEntero = -1, "-1", GlobalDTACClasificadorObjetoGasto.FiltraParametros(String.Format("CveClasificacion = {0}", DdlCapituloClasificaciones.SelectedValue.ToEntero)).Rows(0)("Codigo").ToString.Substring(0, 1))
|
|
UPPDatos.Update()
|
|
Gv.DataBind()
|
|
|
|
If objAC.GetRepPresupuestosEgresosSaldosMensual(DdlTipoCuenta.SelectedValue.ToString, DdlEjercicio.SelectedValue.ToEntero, Capitulo, DdlClasificaciones.SelectedValue.ToEntero, DdlFuenteFinanciamiento.SelectedValue.ToEntero, DdlProgramaOperativo.SelectedValue.ToEntero, DdlUnidadAdministrativa.SelectedValue.ToEntero, DdlOrden.SelectedValue.ToEntero) Then
|
|
DtPresupuestoEgresos = objAC.DtResultados
|
|
|
|
If Not (DdlOrden.SelectedValue.ToEntero = 1 Or DdlOrden.SelectedValue.ToEntero = 6) Then
|
|
DtPresupuestoEgresos.Rows.RemoveAt(0)
|
|
DtPresupuestoEgresos.Rows.RemoveAt(0)
|
|
DtPresupuestoEgresos.Rows.RemoveAt(0)
|
|
End If
|
|
|
|
Gv.DataSource = DtPresupuestoEgresos
|
|
If DtPresupuestoEgresos IsNot Nothing AndAlso DtPresupuestoEgresos.Rows.Count > 0 Then
|
|
ImgExcel.Visible = True
|
|
BtnImprimir.Visible = True
|
|
End If
|
|
|
|
Else
|
|
Gv.DataSource = Nothing
|
|
DtPresupuestoEgresos = Nothing
|
|
End If
|
|
|
|
objAC.Dispose()
|
|
|
|
'Carga Grid
|
|
Gv.DataBind()
|
|
UPPDatos.Update()
|
|
End Sub
|
|
|
|
Private Sub CargaDatosANT()
|
|
Dim AC As New ClsContPAQi(UsuarioActual.Empresa)
|
|
Dim Ejercicio As Integer = DdlEjercicio.SelectedValue.ToEntero
|
|
UPPDatos.Update()
|
|
Gv.DataBind()
|
|
|
|
If AC.RepPresupuestoEgresosGet(Ejercicio) Then
|
|
Gv.DataSource = AC.DtResultados
|
|
Gv.DataBind()
|
|
End If
|
|
|
|
AC.Dispose()
|
|
End Sub
|
|
|
|
Protected Sub Gv_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles Gv.RowDataBound
|
|
If e.Row.RowType = DataControlRowType.DataRow Then
|
|
|
|
'If DdlOrden.SelectedValue.ToEntero = 1 Then
|
|
' If (IsDBNull(e.Row.DBCampo("Codigo1")) OrElse e.Row.DBCampo("Codigo1").Trim = "") Then
|
|
' e.Row.CssClass = "Totales"
|
|
' ElseIf (IsDBNull(e.Row.DBCampo("Codigo2")) OrElse e.Row.DBCampo("Codigo2").Trim = "") Then
|
|
' e.Row.FCLiteral("LtlGrupo").Text = String.Format("{0} - {1}", e.Row.DBCampo("Codigo1"), e.Row.DBCampo("Clasificacion1"))
|
|
' e.Row.CssClass = "SubTotales2"
|
|
' ElseIf (IsDBNull(e.Row.DBCampo("Codigo3")) OrElse e.Row.DBCampo("Codigo3").Trim = "") Then
|
|
' e.Row.FCLiteral("LtlGrupo").Text = String.Format("{0} - {1}", e.Row.DBCampo("Codigo2"), e.Row.DBCampo("Clasificacion2"))
|
|
' e.Row.CssClass = "SubTotales3"
|
|
' ElseIf (IsDBNull(e.Row.DBCampo("CodigoClasificacion")) OrElse e.Row.DBCampo("CodigoClasificacion").Trim = "") Then
|
|
' e.Row.FCLiteral("LtlGrupo").Text = String.Format("{0} - {1}", e.Row.DBCampo("Codigo3"), e.Row.DBCampo("Clasificacion3"))
|
|
' e.Row.Font.Bold = True
|
|
' End If
|
|
'Else
|
|
' If e.Row.DBCampo("Gpo") = "Total" Then
|
|
' e.Row.CssClass = "Totales"
|
|
' e.Row.Visible = If(e.Row.RowIndex = 0, True, False)
|
|
' End If
|
|
'End If
|
|
|
|
|
|
|
|
If e.Row.DBCampo("Nivel") = "5" Then
|
|
e.Row.CssClass = "Totales"
|
|
ElseIf e.Row.DBCampo("Nivel") = "4" Then
|
|
e.Row.FCLiteral("LtlGrupo").Text = e.Row.DBCampo("Clasificacion1")
|
|
e.Row.CssClass = "SubTotales2"
|
|
ElseIf e.Row.DBCampo("Nivel") = "3" Then
|
|
e.Row.FCLiteral("LtlGrupo").Text = e.Row.DBCampo("Clasificacion2")
|
|
e.Row.CssClass = "SubTotales3"
|
|
ElseIf e.Row.DBCampo("Nivel") = "2" Then
|
|
e.Row.FCLiteral("LtlGrupo").Text = e.Row.DBCampo("Clasificacion3")
|
|
e.Row.Font.Bold = True
|
|
End If
|
|
|
|
End If
|
|
End Sub
|
|
|
|
Protected Sub consultar_Click(sender As Object, e As EventArgs)
|
|
CargaDatos()
|
|
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.ToString))
|
|
params.Add(New ReportParameter("pMomentoContable", DdlTipoCuenta.SelectedItem.ToString))
|
|
|
|
ImprimirPDF("AC/Reportes/RepPresupuestoEgresosMensual.rdlc", DtPresupuestoEgresos, params, "RepPresupuestoEgresosMensual", Formato)
|
|
End Sub
|
|
#End Region
|
|
|
|
End Class
|