Files
SIG/Bancos/FlujoDiario.aspx.vb

106 lines
4.2 KiB
VB.net

Option Explicit On
Option Strict On
Imports System.Data
Imports Extensiones
Imports Microsoft.Reporting.WebForms
Partial Class Bancos_FlujoDiario
Inherits ClsPaginas
#Region "Propiedades"
Private Property TmpDTSaldosIniciales As DataTable
Get
Return CType(ViewState("TmpDTSaldosIniciales"), DataTable)
End Get
Set(value As DataTable)
ViewState("TmpDTSaldosIniciales") = value
End Set
End Property
Private Property TmpDTGastosDelDia As DataTable
Get
Return CType(ViewState("TmpDTGastosDelDia"), DataTable)
End Get
Set(value As DataTable)
ViewState("TmpDTGastosDelDia") = value
End Set
End Property
Private Property TmpDTIngresosDelDia As DataTable
Get
Return CType(ViewState("TmpDTIngresosDelDia"), DataTable)
End Get
Set(value As DataTable)
ViewState("TmpDTIngresosDelDia") = value
End Set
End Property
Private Property TmpDTSaldosActuales As DataTable
Get
Return CType(ViewState("TmpDTSaldosActuales"), DataTable)
End Get
Set(value As DataTable)
ViewState("TmpDTSaldosActuales") = value
End Set
End Property
#End Region
Private Sub Bancos_FlujoDiario_Load(sender As Object, e As EventArgs) Handles Me.Load
If Not IsPostBack Then
TxtFecha.Text = Now.ToString
End If
End Sub
Private Sub BtnConsultar_Click(sender As Object, e As EventArgs) Handles BtnConsultar.Click
Dim params As New List(Of ReportParameter)
Dim Imagen As New System.IO.FileInfo($"{UsuarioActual.Empresa.Ruta}/Logo.png")
params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa))
params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre))
params.Add(New ReportParameter("FechaImpresion", Now.ToDateTime.ToShortDateString))
params.Add(New ReportParameter("Fecha", TxtFecha.Text.ToDate.ToLongDateString))
params.Add(New ReportParameter("LogoPath", If(Imagen.Exists, $"file://{Imagen.FullName}", "")))
'SE LLENA TmpDTSaldosIniciales
Dim Ban As New ClsBancos
If Ban.GetBancosSaldos(-1, -1, -1, MinFecha.ToString, TxtFecha.Text.ToDate.AddDays(-1).ToShortDateString, 0, "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
TmpDTSaldosIniciales = Ban.DtResultados
End If
'Se Llena TmpDTIngresosDelDia
If Ban.GetIngresoEgresosDelDia(TxtFecha.Text.ToDate, "Ing", UsuarioActual.CveEmpresa) Then
TmpDTIngresosDelDia = Ban.DtResultados'.FiltraParametros("CveTipoTransaccion <> 8")
End If
'Se Llena TmpDTGastosDelDia
If Ban.GetIngresoEgresosDelDia(TxtFecha.Text.ToDate, "Egs", UsuarioActual.CveEmpresa) Then
TmpDTGastosDelDia = Ban.DtResultados'.FiltraParametros("CveTipoTransaccion <> 2")
End If
'Se Llena TmpDTSaldosActuales
If Ban.GetBancosSaldos(-1, -1, -1, MinFecha.ToString, TxtFecha.Text, 0, "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
TmpDTSaldosActuales = Ban.DtResultados
End If
Ban.Dispose()
Dim lrds As New List(Of ReportDataSource)
Dim rds As New ReportDataSource With {.Name = "DataSet1", .Value = TmpDTSaldosIniciales}
Dim rds2 As New ReportDataSource With {.Name = "DataSet2", .Value = If(TmpDTIngresosDelDia IsNot Nothing, TmpDTIngresosDelDia, New DataTable)}
Dim rds3 As New ReportDataSource With {.Name = "DataSet3", .Value = If(TmpDTGastosDelDia IsNot Nothing, TmpDTGastosDelDia, New DataTable)}
Dim rds5 As New ReportDataSource With {.Name = "DataSet5", .Value = If(TmpDTGastosDelDia IsNot Nothing, TmpDTGastosDelDia, New DataTable)}
Dim rds4 As New ReportDataSource With {.Name = "DataSet4", .Value = If(TmpDTSaldosActuales IsNot Nothing, TmpDTSaldosActuales, New DataTable)}
lrds.Add(rds)
lrds.Add(rds2)
lrds.Add(rds3)
lrds.Add(rds4)
'lrds.Add(rds5)-
ImprimirPDF("Empresas/Grales/Formatos/FlujoDiario.rdlc", lrds, params, NombreArchivo:=String.Format("FlujoDiario-{0}", TxtFecha.Text.ToDate.ToShortDateString))
End Sub
End Class