127 lines
4.7 KiB
VB.net
127 lines
4.7 KiB
VB.net
Option Explicit On
|
|
Option Strict On
|
|
|
|
Imports System.Data
|
|
Imports Extensiones
|
|
Imports Microsoft.Reporting.WebForms
|
|
|
|
Partial Class AC_RepEstadoAnaliticoActivo
|
|
Inherits ClsPaginas
|
|
|
|
|
|
#Region "PROPIEDADES"
|
|
Private Property DtDatos As DataTable
|
|
Get
|
|
DtDatos = DirectCast(ViewState("DtDatos"), DataTable)
|
|
End Get
|
|
|
|
Set(ByVal value As DataTable)
|
|
ViewState("DtDatos") = 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
|
|
|
|
Dim FechaI = DateSerial(DdlEjercicio.SelectedValue.ToEntero, DdlPeriodo.SelectedValue.ToEntero, 1)
|
|
Dim FechaF = LastDayOfMonth(FechaI)
|
|
CargaDatos(FechaI, FechaF)
|
|
CargaDatosEjercicio()
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub CargaDatos(FechaI As Date, FechaF As Date)
|
|
Dim ObjConta As New ClsContPAQi(UsuarioActual.Empresa)
|
|
|
|
If ObjConta.GetEstadoAnaliticoActivo(FechaI, FechaF) Then
|
|
DtDatos = ObjConta.DtResultados
|
|
Else
|
|
DtDatos = Nothing
|
|
Alert("Ocurrio un error al cargar los datos del Estado Analítico del Activo", TipoMensaje.MsgError)
|
|
End If
|
|
|
|
|
|
ObjConta.Dispose()
|
|
|
|
CargaGrid()
|
|
End Sub
|
|
|
|
Private Sub CargaDatosEjercicio()
|
|
Dim ObjConta As New ClsContPAQi(UsuarioActual.Empresa)
|
|
If ObjConta.GetEjercicios() Then
|
|
DdlEjercicio.DataSource = ObjConta.DtResultados
|
|
Else
|
|
DdlEjercicio.DataSource = Nothing
|
|
End If
|
|
|
|
ObjConta.Dispose()
|
|
DdlEjercicio.DataBind()
|
|
End Sub
|
|
|
|
Private Sub CargaGrid()
|
|
GvDatos.DataSource = DtDatos
|
|
GvDatos.DataBind()
|
|
UpDatos.Update()
|
|
End Sub
|
|
|
|
Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs)
|
|
Dim FechaI = DateSerial(DdlEjercicio.SelectedValue.ToEntero, DdlPeriodo.SelectedValue.ToEntero, 1)
|
|
Dim FechaF = LastDayOfMonth(FechaI)
|
|
CargaDatos(FechaI, FechaF)
|
|
End Sub
|
|
|
|
Protected Sub GvDatos_RowDataBound(sender As Object, e As GridViewRowEventArgs)
|
|
If e.Row.RowType = DataControlRowType.DataRow Then
|
|
If e.Row.DBCampo("CtaMayor").ToString.ToEntero = 3 Then
|
|
e.Row.ControlStyle.Font.Bold = True
|
|
End If
|
|
|
|
If e.Row.DBCampo("SaldoInicial").ToString.ToDouble < 0 Then
|
|
e.Row.FCLabel("LbSaldoInicial").ForeColor = Drawing.Color.Red
|
|
End If
|
|
If e.Row.DBCampo("Cargos").ToString.ToDouble < 0 Then
|
|
e.Row.FCLabel("LbCargos").ForeColor = Drawing.Color.Red
|
|
End If
|
|
If e.Row.DBCampo("Abonos").ToString.ToDouble < 0 Then
|
|
e.Row.FCLabel("LbAbonos").ForeColor = Drawing.Color.Red
|
|
End If
|
|
If e.Row.DBCampo("SaldoFinal").ToString.ToDouble < 0 Then
|
|
e.Row.FCLabel("LbSaldoFinal").ForeColor = Drawing.Color.Red
|
|
End If
|
|
If e.Row.DBCampo("Variacion").ToString.ToDouble < 0 Then
|
|
e.Row.FCLabel("LbVariacion").ForeColor = Drawing.Color.Red
|
|
End If
|
|
End If
|
|
End Sub
|
|
|
|
Protected Sub BtnImprimir_Click(sender As Object, e As EventArgs) Handles BtnImprimir.Click
|
|
ImprimirReporte() 'Descarga reporte en PDF
|
|
End Sub
|
|
|
|
Protected Sub ImgExcel_Click(sender As Object, e As EventArgs) Handles ImgExcel.Click
|
|
'GvDatos.ExportToExcel("Estado analitico" & NowADS().ToShortDateString)
|
|
ImprimirReporte("Excel") 'Descarga reporte en Excel
|
|
End Sub
|
|
|
|
Private Sub ImprimirReporte(Optional Formato As String = "PDF")
|
|
'ubicacion del rdlc
|
|
Dim reportpath As String = "AC/Reportes/RepEstadoAnaliticoActivo.rdlc"
|
|
|
|
Dim fileName As String = "EdoAnaliticoActivo"
|
|
'parametros a enviar al reporte
|
|
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}", "")))
|
|
params.Add(New ReportParameter("pFechaIni", DdlEjercicio.SelectedItem.ToString))
|
|
params.Add(New ReportParameter("pFechaFin", DdlPeriodo.SelectedItem.ToString))
|
|
params.Add(New ReportParameter("pFirma1", String.Format("ING. Soraida Mesinas Reyes{0} Subdirector de Contabilidad", vbCrLf)))
|
|
params.Add(New ReportParameter("pFirma2", String.Format("ING. Soraida Mesinas Reyes{0} Director General", vbCrLf)))
|
|
ImprimirPDF(reportpath, DtDatos, params, fileName, Formato)
|
|
'MasterReporteador.Visible = True
|
|
End Sub
|
|
|
|
End Class
|