Files
SIG/AC/RepPresupuestoIngresos.aspx.vb
2023-10-09 11:55:07 -07:00

191 lines
9.7 KiB
VB.net

Imports Extensiones
Imports Microsoft.Reporting.WebForms
Imports System.Data
Partial Class AC_RepPresupuestoIngresos
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
Private Property FechaCorte As Date
Get
Return ViewState("FechaCorte").ToString.ToDate
End Get
Set(value As Date)
ViewState("FechaCorte") = 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
If UsuarioActual.Empresa.UsaAC Then
Dim ClsConta As New ClsContPAQi(UsuarioActual.Empresa)
If ClsConta.GetEjercicios() Then
DdlEjercicio.DataSource = ClsConta.DtResultados
Else
DdlEjercicio.DataSource = Nothing
End If
ClsConta.Dispose()
Else
Dim ClsConta As New ClsContabilidad
If ClsConta.GetEjercicios(UsuarioActual.CveEmpresa) Then
DdlEjercicio.DataSource = ClsConta.DtResultados
Else
DdlEjercicio.DataSource = Nothing
End If
ClsConta.Dispose()
End If
DdlEjercicio.DataBind()
DdlEjercicio.SelectedValue = UsuarioActual.Empresa.EjercicioActual.ToString
txtFechaF.Text = NowADS().ToShortDateString
CargaDatos()
End If
End Sub
Protected Sub consultar_Click(sender As Object, e As EventArgs)
CargaDatos()
End Sub
Private Sub CargaDatos()
If UsuarioActual.Empresa.UsaAC Then
Dim ObjAC As New ClsContPAQi(UsuarioActual.Empresa)
Dim Ejercicio As Integer = DdlEjercicio.SelectedValue.ToEntero
UPPDatos.Update()
FechaCorte = txtFechaF.Text.ToDate
If ObjAC.GetPresupuestoIngresosRep(Ejercicio, FechaCorte, DdlAgrupador.SelectedValue.ToEntero) Then
DtIngresos = ObjAC.DtResultados
Else
DtIngresos = Nothing
Alert("Ocurrió un error al cargar los datos del reporte.", TipoMensaje.MsgError)
End If
ObjAC.Dispose()
Else
Dim ObjAC As New ClsContabilidad
Dim Ejercicio As Integer = DdlEjercicio.SelectedValue.ToEntero
UPPDatos.Update()
FechaCorte = txtFechaF.Text.ToDate
If ObjAC.GetPresupuestoIngresosRep(Ejercicio, FechaCorte, DdlAgrupador.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) Then
DtIngresos = ObjAC.DtResultados
Else
DtIngresos = Nothing
Alert("Ocurrió un error al cargar los datos del reporte.", TipoMensaje.MsgError)
End If
ObjAC.Dispose()
End If
Gv.DataSource = DtIngresos
Gv.DataBind()
UPPDatos.Update()
End Sub
Protected Sub Gv_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles Gv.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
If e.Row.DBCampo("Agrupador") = "" Then
e.Row.CssClass = "SubTotales"
End If
If e.Row.RowIndex = 0 Then
e.Row.FCLiteral("LtEstimado").Visible = True
e.Row.FCLiteral("LtModificado").Visible = True
e.Row.FCLiteral("LtDevengado").Visible = True
e.Row.FCLiteral("LtRecaudado").Visible = True
e.Row.FCHyperLink("HLEstimado").Visible = False
e.Row.FCHyperLink("HLModificado").Visible = False
e.Row.FCHyperLink("HLDevengado").Visible = False
e.Row.FCHyperLink("HLRecaudado").Visible = False
'e.Row.FCHyperLink("HLEstimado").Visible = False
'e.Row.FCHyperLink("HLModificado").Visible = False
'e.Row.FCHyperLink("HLDevengado").Visible = False
'e.Row.FCHyperLink("HLRecaudado").Visible = False
Else
e.Row.FCHyperLink("HLEstimado").NavigateUrl = String.Format("/AC/RepPresupuestoIngresosDetalle.aspx?MM=1&FR={0}&RI={1}&FeI={2}&FeF={3}&Ej={4}", e.Row.DBCampo("CveFuenteRecaudacion").ToEntero, e.Row.DBCampo("CveRubroIngreso").ToEntero, String.Format("01/01/{0}", DdlEjercicio.SelectedItem.Text), If(txtFechaF.Text <> "", txtFechaF.Text, NowADS().ToString("dd/MM/yyyy")), DdlEjercicio.SelectedValue)
e.Row.FCHyperLink("HLEstimado").CssClass = "Texto"
e.Row.FCHyperLink("HLModificado").NavigateUrl = String.Format("/AC/RepPresupuestoIngresosDetalle.aspx?MM=2&FR={0}&RI={1}&FeI={2}&FeF={3}&Ej={4}", e.Row.DBCampo("CveFuenteRecaudacion").ToEntero, e.Row.DBCampo("CveRubroIngreso").ToEntero, String.Format("01/01/{0}", DdlEjercicio.SelectedItem.Text), If(txtFechaF.Text <> "", txtFechaF.Text, NowADS().ToString("dd/MM/yyyy")), DdlEjercicio.SelectedValue)
e.Row.FCHyperLink("HLModificado").CssClass = "Texto"
e.Row.FCHyperLink("HLDevengado").NavigateUrl = String.Format("/AC/RepPresupuestoIngresosDetalle.aspx?MM=3&FR={0}&RI={1}&FeI={2}&FeF={3}&Ej={4}", e.Row.DBCampo("CveFuenteRecaudacion").ToEntero, e.Row.DBCampo("CveRubroIngreso").ToEntero, String.Format("01/01/{0}", DdlEjercicio.SelectedItem.Text), If(txtFechaF.Text <> "", txtFechaF.Text, NowADS().ToString("dd/MM/yyyy")), DdlEjercicio.SelectedValue)
e.Row.FCHyperLink("HLDevengado").CssClass = "Texto"
e.Row.FCHyperLink("HLRecaudado").NavigateUrl = String.Format("/AC/RepPresupuestoIngresosDetalle.aspx?MM=4&FR={0}&RI={1}&FeI={2}&FeF={3}&Ej={4}", e.Row.DBCampo("CveFuenteRecaudacion").ToEntero, e.Row.DBCampo("CveRubroIngreso").ToEntero, String.Format("01/01/{0}", DdlEjercicio.SelectedItem.Text), If(txtFechaF.Text <> "", txtFechaF.Text, NowADS().ToString("dd/MM/yyyy")), DdlEjercicio.SelectedValue)
e.Row.FCHyperLink("HLRecaudado").CssClass = "Texto"
'e.Row.FCHyperLink("HLEstimado").NavigateUrl = String.Format("/AC/RepPresupuestoIngresosDetalle.aspx?MM=1&FR={0}&RI={1}&FeI={2}&FeF={3}&Ej={4}", e.Row.DBCampo("CveFuenteRecaudacion").ToEntero, e.Row.DBCampo("CveRubroIngreso").ToEntero, String.Format("01/01/{0}", DdlEjercicio.SelectedItem.Text), If(txtFechaF.Text <> "", txtFechaF.Text, NowADS().ToString("dd/MM/yyyy")), DdlEjercicio.SelectedValue)
'e.Row.FCHyperLink("HLEstimado").CssClass = "Texto"
'e.Row.FCHyperLink("HLModificado").NavigateUrl = String.Format("/AC/RepPresupuestoIngresosDetalle.aspx?MM=2&FR={0}&RI={1}&FeI={2}&FeF={3}&Ej={4}", e.Row.DBCampo("CveFuenteRecaudacion").ToEntero, e.Row.DBCampo("CveRubroIngreso").ToEntero, String.Format("01/01/{0}", DdlEjercicio.SelectedItem.Text), If(txtFechaF.Text <> "", txtFechaF.Text, NowADS().ToString("dd/MM/yyyy")), DdlEjercicio.SelectedValue)
'e.Row.FCHyperLink("HLModificado").CssClass = "Texto"
'e.Row.FCHyperLink("HLDevengado").NavigateUrl = String.Format("/AC/RepPresupuestoIngresosDetalle.aspx?MM=3&FR={0}&RI={1}&FeI={2}&FeF={3}&Ej={4}", e.Row.DBCampo("CveFuenteRecaudacion").ToEntero, e.Row.DBCampo("CveRubroIngreso").ToEntero, String.Format("01/01/{0}", DdlEjercicio.SelectedItem.Text), If(txtFechaF.Text <> "", txtFechaF.Text, NowADS().ToString("dd/MM/yyyy")), DdlEjercicio.SelectedValue)
'e.Row.FCHyperLink("HLDevengado").CssClass = "Texto"
'e.Row.FCHyperLink("HLRecaudado").NavigateUrl = String.Format("/AC/RepPresupuestoIngresosDetalle.aspx?MM=4&FR={0}&RI={1}&FeI={2}&FeF={3}&Ej={4}", e.Row.DBCampo("CveFuenteRecaudacion").ToEntero, e.Row.DBCampo("CveRubroIngreso").ToEntero, String.Format("01/01/{0}", DdlEjercicio.SelectedItem.Text), If(txtFechaF.Text <> "", txtFechaF.Text, NowADS().ToString("dd/MM/yyyy")), DdlEjercicio.SelectedValue)
'e.Row.FCHyperLink("HLRecaudado").CssClass = "Texto"
End If
e.Row.Cells(1).HorizontalAlign = HorizontalAlign.Right
e.Row.Cells(2).HorizontalAlign = HorizontalAlign.Right
e.Row.Cells(3).HorizontalAlign = HorizontalAlign.Right
e.Row.Cells(4).HorizontalAlign = HorizontalAlign.Right
End If
End Sub
#Region "I M P R I M I R "
Protected 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("pFechaCorte", FechaCorte.ToShortDateString))
params.Add(New ReportParameter("pImg", If(Imagen.Exists, $"file://{Imagen.FullName}", "")))
params.Add(New ReportParameter("pEjercicio", DdlEjercicio.SelectedValue.ToString))
ImprimirPDF("AC/Reportes/RepPresupuestoIngresos.rdlc", DtIngresos, params, "ReportePresupuestoIngresos", Formato)
End Sub
#End Region
#Region " EXPORTAR - PDF - EXCEL "
Protected Sub ImgExcel_Click(sender As Object, e As EventArgs)
'Tbl.ExportToExcel("Estado del Ejercicio del Presupuesto de Egresos ")
ImprimirReporte("Excel")
End Sub
Protected Sub BtnImprimir_Click(sender As Object, e As EventArgs)
'Tbl.ExportToPDF("Estado del Ejercicio del Presupuesto de Egresos ")
ImprimirReporte()
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
Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs)
End Sub
End Class