Commit inicial Ventas Productivo
This commit is contained in:
655
AC/RepSituacionFinanciera.aspx.vb
Normal file
655
AC/RepSituacionFinanciera.aspx.vb
Normal file
@@ -0,0 +1,655 @@
|
||||
Option Explicit On
|
||||
Option Strict On
|
||||
|
||||
Imports System.Data
|
||||
Imports Extensiones
|
||||
Imports Microsoft.Reporting.WebForms
|
||||
Partial Class AC_SituacionFinanciera
|
||||
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
|
||||
Private Property DtCuentasOrden As DataTable
|
||||
Get
|
||||
DtCuentasOrden = DirectCast(ViewState("DtCuentasOrden"), DataTable)
|
||||
End Get
|
||||
|
||||
Set(ByVal value As DataTable)
|
||||
ViewState("DtCuentasOrden") = value
|
||||
End Set
|
||||
End Property
|
||||
Private Property TotalActivoActual As Double
|
||||
Get
|
||||
TotalActivoActual = ViewState("TotalActivoActual").ToString.ToDouble
|
||||
End Get
|
||||
Set(value As Double)
|
||||
ViewState("TotalActivoActual") = value
|
||||
End Set
|
||||
End Property
|
||||
Private Property TotalActivoAnterior As Double
|
||||
Get
|
||||
TotalActivoAnterior = ViewState("TotalActivoAnterior").ToString.ToDouble
|
||||
End Get
|
||||
Set(value As Double)
|
||||
ViewState("TotalActivoAnterior") = value
|
||||
End Set
|
||||
End Property
|
||||
Private Property TotalPasivoActual As Double
|
||||
Get
|
||||
TotalPasivoActual = ViewState("TotalPasivoActual").ToString.ToDouble
|
||||
End Get
|
||||
Set(value As Double)
|
||||
ViewState("TotalPasivoActual") = value
|
||||
End Set
|
||||
End Property
|
||||
Private Property TotalPasivoAnterior As Double
|
||||
Get
|
||||
TotalPasivoAnterior = ViewState("TotalPasivoAnterior").ToString.ToDouble
|
||||
End Get
|
||||
Set(value As Double)
|
||||
ViewState("TotalPasivoAnterior") = value
|
||||
End Set
|
||||
End Property
|
||||
Private Property TotalPatrimonioActual As Double
|
||||
Get
|
||||
TotalPatrimonioActual = ViewState("TotalPatrimonioActual").ToString.ToDouble
|
||||
End Get
|
||||
Set(value As Double)
|
||||
ViewState("TotalPatrimonioActual") = value
|
||||
End Set
|
||||
End Property
|
||||
Private Property TotalPatrimonioAnterior As Double
|
||||
Get
|
||||
TotalPatrimonioAnterior = ViewState("TotalPatrimonioAnterior").ToString.ToDouble
|
||||
End Get
|
||||
Set(value As Double)
|
||||
ViewState("TotalPatrimonioAnterior") = value
|
||||
End Set
|
||||
End Property
|
||||
Private Property TotalPasivoPatrimonioActual As Double
|
||||
Get
|
||||
TotalPasivoPatrimonioActual = ViewState("TotalPasivoPatrimonioActual").ToString.ToDouble
|
||||
End Get
|
||||
Set(value As Double)
|
||||
ViewState("TotalPasivoPatrimonioActual") = value
|
||||
End Set
|
||||
End Property
|
||||
Private Property TotalPasivoPatrimonioAnterior As Double
|
||||
Get
|
||||
TotalPasivoPatrimonioAnterior = ViewState("TotalPasivoPatrimonioAnterior").ToString.ToDouble
|
||||
End Get
|
||||
Set(value As Double)
|
||||
ViewState("TotalPasivoPatrimonioAnterior") = value
|
||||
End Set
|
||||
End Property
|
||||
Private Property FechaInicioActual As Date
|
||||
Get
|
||||
FechaInicioActual = ViewState("FechaInicioActual").ToString.ToDate
|
||||
End Get
|
||||
Set(value As Date)
|
||||
ViewState("FechaInicioActual") = value
|
||||
End Set
|
||||
End Property
|
||||
Private Property FechaFinActual As Date
|
||||
Get
|
||||
FechaFinActual = ViewState("FechaFinActual").ToString.ToDate
|
||||
End Get
|
||||
Set(value As Date)
|
||||
ViewState("FechaFinActual") = value
|
||||
End Set
|
||||
End Property
|
||||
Private Property FechaInicioAnterior As Date
|
||||
Get
|
||||
FechaInicioAnterior = ViewState("FechaInicioAnterior").ToString.ToDate
|
||||
End Get
|
||||
Set(value As Date)
|
||||
ViewState("FechaInicioAnterior") = value
|
||||
End Set
|
||||
End Property
|
||||
Private Property FechaFinAnterior As Date
|
||||
Get
|
||||
FechaFinAnterior = ViewState("FechaFinAnterior").ToString.ToDate
|
||||
End Get
|
||||
Set(value As Date)
|
||||
ViewState("FechaFinAnterior") = value
|
||||
End Set
|
||||
End Property
|
||||
Private Property TipoReporte As Integer
|
||||
Get
|
||||
TipoReporte = ViewState("TipoReporte").ToString.ToEntero
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
ViewState("TipoReporte") = 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
|
||||
TipoReporte = -1
|
||||
Else
|
||||
TipoReporte = 1
|
||||
tdTipoReporte.Visible = True
|
||||
LtTitulo.Text = "Balance General"
|
||||
End If
|
||||
|
||||
|
||||
TotalActivoActual = 0
|
||||
TotalActivoAnterior = 0
|
||||
TotalPasivoActual = 0
|
||||
TotalPasivoAnterior = 0
|
||||
TotalPatrimonioActual = 0
|
||||
TotalPatrimonioAnterior = 0
|
||||
TotalPasivoPatrimonioActual = 0
|
||||
TotalPasivoPatrimonioAnterior = 0
|
||||
|
||||
'TxtFechaInicio.Text = DateSerial(Year(Date.Now), 1, 1).ToShortDateString
|
||||
'TxtFechaFin.Text = Date.Now.ToShortDateString
|
||||
|
||||
CargaEjercicios()
|
||||
|
||||
CargaDatos()
|
||||
|
||||
|
||||
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)
|
||||
DdlPeriodo.SelectedValue = Now.Month.ToString
|
||||
End Sub
|
||||
|
||||
Private Sub CargaDatos()
|
||||
Dim ObjConta As New ClsContPAQi(UsuarioActual.Empresa)
|
||||
|
||||
Dim FechaI = String.Format("01/{0}/{1}", DdlPeriodo.SelectedValue.PadLeft(2, CChar("0")), DdlEjercicio.SelectedValue)
|
||||
Dim FechaF = FechaI.ToDate.LastDayOfMonth.ToShortDateString
|
||||
TipoReporte = If(TipoReporte = -1, -1, DdlTipoReporte.SelectedValue.ToEntero)
|
||||
|
||||
GvActivo.Columns(1).HeaderText = DdlEjercicio.SelectedValue
|
||||
GvActivo.Columns(2).HeaderText = (DdlEjercicio.SelectedValue.ToEntero - 1).ToString
|
||||
|
||||
GvPasivo.Columns(1).HeaderText = DdlEjercicio.SelectedValue
|
||||
GvPasivo.Columns(2).HeaderText = (DdlEjercicio.SelectedValue.ToEntero - 1).ToString
|
||||
|
||||
Dim IdCuentaAhorroDesahorro = 9999
|
||||
|
||||
If UsuarioActual.CveEmpresa = 48 Then
|
||||
IdCuentaAhorroDesahorro = 87
|
||||
End If
|
||||
If UsuarioActual.CveEmpresa = 120 Then
|
||||
IdCuentaAhorroDesahorro = 646
|
||||
End If
|
||||
|
||||
If ObjConta.GetBalanceGeneral("01/01/1000".ToDate, FechaF.ToDate, UsuarioActual.CveEmpresa, TipoReporte, UsuarioActual.Empresa.UsaAC, IdCuentaAhorroDesahorro) Then
|
||||
DtDatos = ObjConta.DtResultados
|
||||
|
||||
CargaGrids()
|
||||
SumaTotales()
|
||||
Else
|
||||
DtDatos = Nothing
|
||||
Alert("Ocurrio un error al cargar los datos del estado de situación financiera", TipoMensaje.MsgError)
|
||||
End If
|
||||
|
||||
ObjConta.Dispose()
|
||||
End Sub
|
||||
Private Sub CargaGrids()
|
||||
|
||||
If Not ChkNivel.Checked Then
|
||||
DtDatos = DtDatos.FiltraParametros("Level < 2")
|
||||
End If
|
||||
Dim CuentaAhorroDesahorro As Integer = 87
|
||||
|
||||
Select Case UsuarioActual.CveEmpresa
|
||||
Case 120
|
||||
CuentaAhorroDesahorro = 646
|
||||
Case Else
|
||||
CuentaAhorroDesahorro = 87
|
||||
End Select
|
||||
|
||||
'Defino Variables para el Orden
|
||||
Dim Orden1, Orden2, Orden3, Orden4, Orden5, Orden6, Orden7 As String
|
||||
If UsuarioActual.CveEmpresa = 48 Then Orden1 = "00011%" Else Orden1 = "011%"
|
||||
If UsuarioActual.CveEmpresa = 48 Then Orden2 = "00012%" Else Orden2 = "012%"
|
||||
If UsuarioActual.CveEmpresa = 48 Then Orden3 = "00021%" Else Orden3 = "021%"
|
||||
If UsuarioActual.CveEmpresa = 48 Then Orden4 = "00022%" Else Orden4 = "022%"
|
||||
If UsuarioActual.CveEmpresa = 48 Then Orden5 = "00031%" Else If UsuarioActual.CveEmpresa = 120 Then Orden5 = "0321%" Else Orden5 = "031%"
|
||||
If UsuarioActual.CveEmpresa = 48 Then Orden6 = "00032%" Else Orden6 = "032%"
|
||||
If UsuarioActual.CveEmpresa = 48 Then Orden7 = "00033%" Else Orden7 = "033%"
|
||||
|
||||
'ACTIVO
|
||||
Dim DtActivoCirculante = DtDatos.FiltraParametros($"Tipo in ('A','B','C') AND Orden LIKE '{Orden1}' ")
|
||||
|
||||
Dim DtActivoNoCirculante As DataTable
|
||||
|
||||
If UsuarioActual.CveEmpresa = 48 Then
|
||||
DtActivoNoCirculante = DtDatos.FiltraParametros($"Tipo in ('A','B','C') AND Orden LIKE '{Orden2}' ")
|
||||
Else
|
||||
DtActivoNoCirculante = DtDatos.FiltraParametros($"Tipo in ('A','B','C') AND Orden LIKE '{Orden2}' ")
|
||||
End If
|
||||
|
||||
Dim Row As DataRow = DtActivoCirculante.NewRow
|
||||
|
||||
If DtActivoCirculante.Rows.Count > 0 Then
|
||||
Row.Item("Nombre") = " TOTAL ACTIVO CIRCULANTE"
|
||||
Row.Item("ImporteActual") = DtActivoCirculante.Rows(0)("ImporteActual").ToString
|
||||
Row.Item("ImporteAnterior") = DtActivoCirculante.Rows(0)("ImporteAnterior").ToString
|
||||
Row.Item("CtaMayor") = -1
|
||||
DtActivoCirculante.Rows.RemoveAt(0)
|
||||
Else
|
||||
Row.Item("Nombre") = " TOTAL ACTIVO CIRCULANTE"
|
||||
Row.Item("ImporteActual") = "0.00"
|
||||
Row.Item("ImporteAnterior") = "0.00"
|
||||
Row.Item("CtaMayor") = -1
|
||||
End If
|
||||
DtActivoCirculante.Rows.Add(Row)
|
||||
|
||||
|
||||
Row = DtActivoNoCirculante.NewRow
|
||||
If DtActivoNoCirculante.Rows.Count > 0 Then
|
||||
Row.Item("Nombre") = " TOTAL ACTIVO NO CIRCULANTE"
|
||||
|
||||
If UsuarioActual.CveEmpresa = 48 Then
|
||||
Row.Item("ImporteActual") = DtActivoNoCirculante.Rows(0)("ImporteActual").ToString
|
||||
Row.Item("ImporteAnterior") = DtActivoNoCirculante.Rows(0)("ImporteAnterior").ToString
|
||||
ElseIf UsuarioActual.CveEmpresa = 120 Then
|
||||
Row.Item("ImporteActual") = DtActivoNoCirculante.SUM("ImporteActual", " Sup ='ACTIVO NO CIRCULANTE' ")
|
||||
Row.Item("ImporteAnterior") = DtActivoNoCirculante.SUM("ImporteAnterior", " Sup ='ACTIVO NO CIRCULANTE' ")
|
||||
Else
|
||||
Row.Item("ImporteActual") = DtActivoNoCirculante.Rows(0)("ImporteActual").ToString
|
||||
Row.Item("ImporteAnterior") = DtActivoNoCirculante.Rows(0)("ImporteAnterior").ToString
|
||||
End If
|
||||
|
||||
|
||||
Row.Item("CtaMayor") = -1
|
||||
DtActivoNoCirculante.Rows.RemoveAt(0)
|
||||
Else
|
||||
Row.Item("Nombre") = " TOTAL ACTIVO NO CIRCULANTE"
|
||||
Row.Item("ImporteActual") = "0.00"
|
||||
Row.Item("ImporteAnterior") = "0.00"
|
||||
Row.Item("CtaMayor") = -1
|
||||
End If
|
||||
DtActivoNoCirculante.Rows.Add(Row)
|
||||
|
||||
GvActivo.DataSource = DtActivoCirculante
|
||||
GvActivo.DataBind()
|
||||
GvActivoNoCirculante.DataSource = DtActivoNoCirculante
|
||||
GvActivoNoCirculante.DataBind()
|
||||
UpActivo.Update()
|
||||
|
||||
|
||||
'PASIVO
|
||||
Dim DtPasivoCirculante = DtDatos.FiltraParametros($"Tipo in ('D') AND Orden LIKE '{Orden3}' ")
|
||||
Dim DtPasivoNoCirculante = DtDatos.FiltraParametros($"Tipo in ('D') AND Orden LIKE '{Orden4}' ")
|
||||
|
||||
Row = DtPasivoCirculante.NewRow
|
||||
If DtPasivoCirculante.Rows.Count > 0 Then
|
||||
Row.Item("Nombre") = " TOTAL PASIVO CIRCULANTE"
|
||||
Row.Item("ImporteActual") = DtPasivoCirculante.Rows(0)("ImporteActual").ToString
|
||||
Row.Item("ImporteAnterior") = DtPasivoCirculante.Rows(0)("ImporteAnterior").ToString
|
||||
Row.Item("CtaMayor") = -1
|
||||
DtPasivoCirculante.Rows.RemoveAt(0)
|
||||
Else
|
||||
Row.Item("Nombre") = " TOTAL PASIVO CIRCULANTE"
|
||||
Row.Item("ImporteActual") = "0.00"
|
||||
Row.Item("ImporteAnterior") = "0.00"
|
||||
Row.Item("CtaMayor") = -1
|
||||
End If
|
||||
DtPasivoCirculante.Rows.Add(Row)
|
||||
|
||||
Row = DtPasivoNoCirculante.NewRow
|
||||
If DtPasivoNoCirculante.Rows.Count > 0 Then
|
||||
Row.Item("Nombre") = " TOTAL PASIVO NO CIRCULANTE"
|
||||
Row.Item("ImporteActual") = DtPasivoNoCirculante.Rows(0)("ImporteActual").ToString
|
||||
Row.Item("ImporteAnterior") = DtPasivoNoCirculante.Rows(0)("ImporteAnterior").ToString
|
||||
Row.Item("CtaMayor") = -1
|
||||
DtPasivoNoCirculante.Rows.RemoveAt(0)
|
||||
Else
|
||||
Row.Item("Nombre") = " TOTAL PASIVO NO CIRCULANTE"
|
||||
Row.Item("ImporteActual") = "0.00"
|
||||
Row.Item("ImporteAnterior") = "0.00"
|
||||
Row.Item("CtaMayor") = -1
|
||||
End If
|
||||
DtPasivoNoCirculante.Rows.Add(Row)
|
||||
|
||||
|
||||
GvPasivo.DataSource = DtPasivoCirculante
|
||||
GvPasivo.DataBind()
|
||||
GvPasivoNoCirculante.DataSource = DtPasivoNoCirculante
|
||||
GvPasivoNoCirculante.DataBind()
|
||||
UpPasivo.Update()
|
||||
|
||||
|
||||
'PATRIMONIO
|
||||
Dim DtPatrimonioContribuido = DtDatos.FiltraParametros($"Tipo in ('F') AND Orden LIKE '{Orden5}' ")
|
||||
Dim DtPatrimonioGenerado = DtDatos.FiltraParametros($"Tipo in ('F') AND Orden LIKE '{Orden6}' ")
|
||||
Dim DtPatrimonioActualizacion = DtDatos.FiltraParametros($"Tipo in ('F') AND Orden LIKE '{Orden7}' ")
|
||||
|
||||
Row = DtPatrimonioContribuido.NewRow
|
||||
If DtPatrimonioContribuido.Rows.Count > 0 Then
|
||||
Row.Item("Nombre") = " TOTAL PATRIMONIO CONTRIBUIDO"
|
||||
Row.Item("ImporteActual") = DtPatrimonioContribuido.Rows(0)("ImporteActual").ToString
|
||||
Row.Item("ImporteAnterior") = DtPatrimonioContribuido.Rows(0)("ImporteAnterior").ToString
|
||||
Row.Item("CtaMayor") = -1
|
||||
DtPatrimonioContribuido.Rows.RemoveAt(0)
|
||||
Else
|
||||
Row.Item("Nombre") = " TOTAL PATRIMONIO CONTRIBUIDO"
|
||||
Row.Item("ImporteActual") = "0.00"
|
||||
Row.Item("ImporteAnterior") = "0.00"
|
||||
Row.Item("CtaMayor") = -1
|
||||
End If
|
||||
DtPatrimonioContribuido.Rows.Add(Row)
|
||||
|
||||
Row = DtPatrimonioGenerado.NewRow
|
||||
If DtPatrimonioGenerado.Rows.Count > 0 Then
|
||||
Row.Item("Nombre") = " TOTAL PATRIMONIO GENERADO"
|
||||
'El id = 87 es el id de la cuenta "RESULTADOS DEL EJERCICIO:(AHORRO/DESAHORRO)"
|
||||
If DtPatrimonioGenerado.FiltraParametros($"Id = {CuentaAhorroDesahorro}").Rows.Count > 0 Then
|
||||
Row.Item("ImporteActual") = (DtPatrimonioGenerado.Rows(0)("ImporteActual").ToString.ToDouble + DtPatrimonioGenerado.FiltroPrimero($"Id = {CuentaAhorroDesahorro}")("ImporteActual").ToString.ToDouble).ToString
|
||||
Row.Item("ImporteAnterior") = (DtPatrimonioGenerado.Rows(0)("ImporteAnterior").ToString.ToDouble + DtPatrimonioGenerado.FiltroPrimero($"Id = {CuentaAhorroDesahorro}")("ImporteAnterior").ToString.ToDouble).ToString
|
||||
Else
|
||||
Row.Item("ImporteActual") = DtPatrimonioGenerado.Rows(0)("ImporteActual").ToString
|
||||
Row.Item("ImporteAnterior") = DtPatrimonioGenerado.Rows(0)("ImporteAnterior").ToString
|
||||
End If
|
||||
Row.Item("CtaMayor") = -1
|
||||
DtPatrimonioGenerado.Rows.RemoveAt(0)
|
||||
Else
|
||||
Row.Item("Nombre") = " TOTAL PATRIMONIO GENERADO"
|
||||
Row.Item("ImporteActual") = "0.00"
|
||||
Row.Item("ImporteAnterior") = "0.00"
|
||||
Row.Item("CtaMayor") = -1
|
||||
End If
|
||||
DtPatrimonioGenerado.Rows.Add(Row)
|
||||
|
||||
Row = DtPatrimonioActualizacion.NewRow
|
||||
If DtPatrimonioActualizacion.Rows.Count > 0 Then
|
||||
Row.Item("Nombre") = " TOTAL EXCESO O INSUFICIENCIA EN LA ACTUALIZACION"
|
||||
Row.Item("ImporteActual") = DtPatrimonioActualizacion.Rows(0)("ImporteActual").ToString
|
||||
Row.Item("ImporteAnterior") = DtPatrimonioActualizacion.Rows(0)("ImporteAnterior").ToString
|
||||
Row.Item("CtaMayor") = -1
|
||||
DtPatrimonioActualizacion.Rows.RemoveAt(0)
|
||||
Else
|
||||
Row.Item("Nombre") = " TOTAL EXCESO O INSUFICIENCIA EN LA ACTUALIZACION"
|
||||
Row.Item("ImporteActual") = "0.00"
|
||||
Row.Item("ImporteAnterior") = "0.00"
|
||||
Row.Item("CtaMayor") = -1
|
||||
End If
|
||||
DtPatrimonioActualizacion.Rows.Add(Row)
|
||||
|
||||
|
||||
GvPatrimonio.DataSource = DtPatrimonioContribuido
|
||||
GvPatrimonio.DataBind()
|
||||
GvPatrimonioGenerado.DataSource = DtPatrimonioGenerado
|
||||
GvPatrimonioGenerado.DataBind()
|
||||
GvPatrimonioActualizacion.DataSource = DtPatrimonioActualizacion
|
||||
GvPatrimonioActualizacion.DataBind()
|
||||
UpPatrimonio.Update()
|
||||
End Sub
|
||||
Private Sub SumaTotales()
|
||||
TotalPasivoPatrimonioActual = TotalPasivoActual + TotalPatrimonioActual
|
||||
TotalPasivoPatrimonioAnterior = TotalPasivoAnterior + TotalPatrimonioAnterior
|
||||
|
||||
'Llena Lb´s Totales
|
||||
LbTotalActivoActual.Text = TotalActivoActual.ToString.FormatoNumero
|
||||
LbTotalActivoAnterior.Text = TotalActivoAnterior.ToString.FormatoNumero
|
||||
|
||||
LbTotalPasivoActual.Text = TotalPasivoActual.ToString.FormatoNumero
|
||||
LbTotalPasivoAnterior.Text = TotalPasivoAnterior.ToString.FormatoNumero
|
||||
|
||||
LbTotalPatrimonioActual.Text = TotalPatrimonioActual.ToString.FormatoNumero
|
||||
LbTotalPatrimonioAnterior.Text = TotalPatrimonioAnterior.ToString.FormatoNumero
|
||||
|
||||
LbTotalPasivoPatrimonioActual.Text = TotalPasivoPatrimonioActual.ToString.FormatoNumero
|
||||
LbTotalPasivoPatrimonioAnterior.Text = TotalPasivoPatrimonioAnterior.ToString.FormatoNumero
|
||||
|
||||
|
||||
Dim Descuadre = False
|
||||
'COLOREA ROJO SI NO CUADRAN TOTALES
|
||||
If TotalActivoActual <> TotalPasivoPatrimonioActual Then
|
||||
LbTotalActivoActual.ForeColor = Drawing.Color.Red
|
||||
LbTotalPasivoPatrimonioActual.ForeColor = Drawing.Color.Red
|
||||
Descuadre = True
|
||||
Else
|
||||
LbTotalActivoActual.ForeColor = Drawing.Color.Black
|
||||
LbTotalPasivoPatrimonioActual.ForeColor = Drawing.Color.Black
|
||||
End If
|
||||
|
||||
If TotalActivoAnterior <> TotalPasivoPatrimonioAnterior Then
|
||||
LbTotalActivoAnterior.ForeColor = Drawing.Color.Red
|
||||
LbTotalPasivoPatrimonioAnterior.ForeColor = Drawing.Color.Red
|
||||
Descuadre = True
|
||||
Else
|
||||
LbTotalActivoAnterior.ForeColor = Drawing.Color.Black
|
||||
LbTotalPasivoPatrimonioAnterior.ForeColor = Drawing.Color.Black
|
||||
End If
|
||||
|
||||
If Descuadre Then
|
||||
LbDescuadre.Text = "Las sumas de los totales están descuadradas."
|
||||
Else
|
||||
LbDescuadre.Text = ""
|
||||
End If
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
Protected Sub Imprimir_click(sender As Object, e As EventArgs) Handles Imprimir.Click
|
||||
'Dim ObjConta As New ClsContPAQi(UsuarioActual.Empresa)
|
||||
'Dim FechaI = String.Format("01/{0}/{1}", DdlPeriodo.SelectedValue.PadLeft(2, CChar("0")), DdlEjercicio.SelectedValue)
|
||||
'Dim FechaF = DateAdd(DateInterval.Day, -1, DateAdd(DateInterval.Month, 1, CDate(FechaI))).ToString("dd/MM/yyyy")
|
||||
|
||||
'If ObjConta.GetSituacionFinanciera("01/01/2000".ToDate, FechaF.ToDate, DdlTipoReporte.SelectedValue.ToEntero) Then
|
||||
' DtDatos = ObjConta.DtResultados
|
||||
' 'If ChkFirma.Checked = True Then
|
||||
|
||||
' ' Dim Row As DataRow = DtDatos.NewRow
|
||||
' ' Row.Item("Nombre") = String.Format("C.P. Izelda Angulo Peraza{0} Subdirector de contabilidad", "")
|
||||
' ' Row.Item("Sup") = String.Format("Lic. Juan Fortino Leon Robinson{0} Director General", "")
|
||||
' ' Row.Item("ImporteActual") = "0"
|
||||
' ' Row.Item("ImporteAnterior") = "0"
|
||||
' ' Row.Item("Tipo") = "Firma"
|
||||
' ' DtDatos.Rows.Add(Row)
|
||||
' 'End If
|
||||
'End If
|
||||
'ObjConta.Dispose()
|
||||
|
||||
If Not IsNothing(DtDatos) Then
|
||||
ImprimirReporte()
|
||||
Else
|
||||
Alert("No se econtró información para el reporte.", TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs)
|
||||
TotalActivoActual = 0
|
||||
TotalActivoAnterior = 0
|
||||
TotalPasivoActual = 0
|
||||
TotalPasivoAnterior = 0
|
||||
TotalPatrimonioActual = 0
|
||||
TotalPatrimonioAnterior = 0
|
||||
TotalPasivoPatrimonioActual = 0
|
||||
TotalPasivoPatrimonioAnterior = 0
|
||||
|
||||
CargaDatos()
|
||||
End Sub
|
||||
|
||||
|
||||
#Region "GV´S ROW DATA BOUND"
|
||||
|
||||
Protected Sub GvActivo_RowDataBound(sender As Object, e As GridViewRowEventArgs)
|
||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||
If e.Row.DBCampo("CtaMayor").ToString.ToEntero < 0 Then
|
||||
TotalActivoActual += e.Row.DBCampo("ImporteActual").ToString.ToDouble
|
||||
TotalActivoAnterior += e.Row.DBCampo("ImporteAnterior").ToString.ToDouble
|
||||
e.Row.FCLabel("LbNombre").Font.Italic = True
|
||||
e.Row.FCLabel("LbNombre").Font.Bold = True
|
||||
e.Row.Attributes.Add("style", "border-top: thick solid; border-top-width: thin;")
|
||||
Else
|
||||
e.Row.FCHyperLink("HLActual").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?ID={0}&FF={1}&TP={2}", e.Row.DBCampo("Id"), e.Row.DBCampo("FechaFActual").ToDate.ToShortDateString, TipoReporte)
|
||||
e.Row.FCHyperLink("HLAnterior").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?ID={0}&FF={1}&TP={2}", e.Row.DBCampo("Id"), e.Row.DBCampo("FechaFAnterior").ToDate.ToShortDateString, TipoReporte)
|
||||
End If
|
||||
|
||||
If e.Row.DBCampo("ImporteActual").ToString.ToDouble < 0 Then
|
||||
e.Row.FCHyperLink("HLActual").ForeColor = Drawing.Color.Red
|
||||
End If
|
||||
If e.Row.DBCampo("ImporteAnterior").ToString.ToDouble < 0 Then
|
||||
e.Row.FCHyperLink("HLAnterior").ForeColor = Drawing.Color.Red
|
||||
End If
|
||||
|
||||
If e.Row.DBCampo("Level").ToString = "2" Then
|
||||
e.Row.FCLabel("LbNombre").Text = String.Format(" {0}", e.Row.DBCampo("Nombre").ToString)
|
||||
ElseIf e.Row.DBCampo("Level").ToString = "1" Then
|
||||
e.Row.FCLabel("LbNombre").Font.Bold = True
|
||||
End If
|
||||
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Protected Sub GvPasivo_RowDataBound(sender As Object, e As GridViewRowEventArgs)
|
||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||
|
||||
'Totales
|
||||
If e.Row.DBCampo("CtaMayor").ToString.ToEntero < 0 Then
|
||||
TotalPasivoActual += e.Row.DBCampo("ImporteActual").ToString.ToDouble
|
||||
TotalPasivoAnterior += e.Row.DBCampo("ImporteAnterior").ToString.ToDouble
|
||||
e.Row.FCLabel("LbNombre").Font.Italic = True
|
||||
e.Row.FCLabel("LbNombre").Font.Bold = True
|
||||
e.Row.Attributes.Add("style", "border-top: thick solid; border-top-width: thin;")
|
||||
'Cuentas
|
||||
Else
|
||||
e.Row.FCHyperLink("HLActual").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?ID={0}&FF={1}", e.Row.DBCampo("Id"), e.Row.DBCampo("FechaFActual").ToDate.ToShortDateString)
|
||||
e.Row.FCHyperLink("HLAnterior").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?ID={0}&FF={1}", e.Row.DBCampo("Id"), e.Row.DBCampo("FechaFAnterior").ToDate.ToShortDateString)
|
||||
End If
|
||||
|
||||
|
||||
'Colorea NEGATIVOS
|
||||
If e.Row.DBCampo("ImporteActual").ToString.ToDouble < 0 Then
|
||||
e.Row.FCHyperLink("HLActual").ForeColor = Drawing.Color.Red
|
||||
End If
|
||||
If e.Row.DBCampo("ImporteAnterior").ToString.ToDouble < 0 Then
|
||||
e.Row.FCHyperLink("HLAnterior").ForeColor = Drawing.Color.Red
|
||||
End If
|
||||
|
||||
If e.Row.DBCampo("Level").ToString = "2" Then
|
||||
e.Row.FCLabel("LbNombre").Text = String.Format(" {0}", e.Row.DBCampo("Nombre").ToString)
|
||||
ElseIf e.Row.DBCampo("Level").ToString = "1" Then
|
||||
e.Row.FCLabel("LbNombre").Font.Bold = True
|
||||
End If
|
||||
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Protected Sub GvPatrimonio_RowDataBound(sender As Object, e As GridViewRowEventArgs)
|
||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||
If e.Row.DBCampo("CtaMayor").ToString.ToEntero < 0 Then
|
||||
TotalPatrimonioActual += e.Row.DBCampo("ImporteActual").ToString.ToDouble
|
||||
TotalPatrimonioAnterior += e.Row.DBCampo("ImporteAnterior").ToString.ToDouble
|
||||
e.Row.FCLabel("LbNombre").Font.Italic = True
|
||||
e.Row.FCLabel("LbNombre").Font.Bold = True
|
||||
e.Row.Attributes.Add("style", "border-top: thick solid; border-top-width: thin;")
|
||||
'e.Row.ControlStyle.BackColor = Drawing.Color.LightGray
|
||||
'e.Row.ControlStyle.ForeColor = Drawing.Color.White
|
||||
'e.Row.ControlStyle.Font.Bold = True
|
||||
Else
|
||||
e.Row.FCHyperLink("HLActual").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?ID={0}&FF={1}", e.Row.DBCampo("Id"), e.Row.DBCampo("FechaFActual").ToDate.ToShortDateString)
|
||||
e.Row.FCHyperLink("HLAnterior").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?ID={0}&FF={1}", e.Row.DBCampo("Id"), e.Row.DBCampo("FechaFAnterior").ToDate.ToShortDateString)
|
||||
End If
|
||||
|
||||
If e.Row.DBCampo("ImporteActual").ToString.ToDouble < 0 Then
|
||||
e.Row.FCHyperLink("HLActual").ForeColor = Drawing.Color.Red
|
||||
End If
|
||||
If e.Row.DBCampo("ImporteAnterior").ToString.ToDouble < 0 Then
|
||||
e.Row.FCHyperLink("HLAnterior").ForeColor = Drawing.Color.Red
|
||||
End If
|
||||
|
||||
If e.Row.DBCampo("Level").ToString = "2" Then
|
||||
e.Row.FCLabel("LbNombre").Text = String.Format(" {0}", e.Row.DBCampo("Nombre").ToString)
|
||||
ElseIf e.Row.DBCampo("Level").ToString = "1" Then
|
||||
e.Row.FCLabel("LbNombre").Font.Bold = True
|
||||
End If
|
||||
|
||||
End If
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
|
||||
Protected Sub ImgExcel_Click(sender As Object, e As EventArgs) Handles ImgExcel.Click
|
||||
If Not IsNothing(DtDatos) Then
|
||||
ImprimirReporte("Excel")
|
||||
Else
|
||||
Alert("No se econtró información para el reporte.", TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
|
||||
Private Sub ImprimirReporte(Optional Formato As String = "PDF")
|
||||
Dim FechaI = String.Format("01/{0}/{1}", DdlPeriodo.SelectedValue.PadLeft(2, CChar("0")), DdlEjercicio.SelectedValue)
|
||||
Dim FechaF = DateAdd(DateInterval.Day, -1, DateAdd(DateInterval.Month, 1, CDate(FechaI))).ToString("dd/MM/yyyy")
|
||||
'nombre del archivo a generar
|
||||
Dim fileName As String = "EdoSituacionFinanciera"
|
||||
'ubicacion del rdlc
|
||||
Dim reportpath As String = "AC/Reportes/RepSituacionFinanciera.rdlc"
|
||||
|
||||
DtCuentasOrden = New DataTable
|
||||
If Not DtCuentasOrden.Columns.Contains("Concepto") Then DtCuentasOrden.Columns.Add("Concepto", GetType(String))
|
||||
If Not DtCuentasOrden.Columns.Contains("Importe") Then DtCuentasOrden.Columns.Add("Importe", GetType(String))
|
||||
If Not DtCuentasOrden.Columns.Contains("Nivel") Then DtCuentasOrden.Columns.Add("Nivel", GetType(String))
|
||||
|
||||
Dim Dr = DtCuentasOrden.NewRow
|
||||
Dr("Concepto") = "PRUEBA"
|
||||
Dr("Importe") = "15236.85"
|
||||
Dr("Nivel") = "1"
|
||||
DtCuentasOrden.Rows.Add(Dr)
|
||||
|
||||
Dim DDdr = DtCuentasOrden.NewRow
|
||||
DDdr("Concepto") = "PRUEBA 2"
|
||||
DDdr("Importe") = "15236.85"
|
||||
DDdr("Nivel") = "2"
|
||||
DtCuentasOrden.Rows.Add(DDdr)
|
||||
|
||||
'parametros a enviar al reporte
|
||||
Dim lrds As New List(Of ReportDataSource)
|
||||
Dim rds As New ReportDataSource With {.Name = "DataSet1", .Value = If(ChkNivel.Checked, DtDatos, DtDatos.FiltraParametros("Level < 2"))}
|
||||
lrds.Add(rds)
|
||||
|
||||
Dim rds1 As New ReportDataSource With {.Name = "DataSet2", .Value = If(DtCuentasOrden IsNot Nothing, DtCuentasOrden, New DataTable)} ' sino esta creado el objeto, lo creamos, para que no truene el reporte
|
||||
lrds.Add(rds1)
|
||||
|
||||
Dim params As New List(Of ReportParameter)
|
||||
params.Add(New ReportParameter("pEmp", UsuarioActual.Empresa.Empresa))
|
||||
params.Add(New ReportParameter("CveEmpresa", UsuarioActual.CveEmpresa.ToString))
|
||||
params.Add(New ReportParameter("pImg", New Uri(Server.MapPath(String.Format("~/Empresas/{0}/Logo.png", UsuarioActual.CveEmpresa))).AbsoluteUri))
|
||||
If (UsuarioActual.CveEmpresa = 48 And ChkFirma.Checked) Then
|
||||
params.Add(New ReportParameter("pFirma1", String.Format("Lic. Damian A. Benitez Alcantar{0}Director Administrativo", vbCrLf)))
|
||||
params.Add(New ReportParameter("pFirma2", String.Format("Ing. Soraida Mesinas Reyes{0}Director General", vbCrLf)))
|
||||
ElseIf (ChkFirma.Checked) Then
|
||||
params.Add(New ReportParameter("pFirma1", String.Format("C.P. Izelda Angulo Peraza{0} Subdirector de Contabilidad", vbCrLf)))
|
||||
params.Add(New ReportParameter("pFirma2", String.Format("ING. Soraida Mesinas Reyes{0} Director General", vbCrLf)))
|
||||
Else
|
||||
params.Add(New ReportParameter("pFirma1", ""))
|
||||
params.Add(New ReportParameter("pFirma2", ""))
|
||||
End If
|
||||
params.Add(New ReportParameter("pFechaFin", FechaF))
|
||||
ImprimirPDF(reportpath, lrds, params, fileName, Formato)
|
||||
End Sub
|
||||
End Class
|
||||
Reference in New Issue
Block a user