Personal Envio de correos altas, bajas y reingresos
This commit is contained in:
342
Finanzas/RepRazonesFinancieras2.aspx.vb
Normal file
342
Finanzas/RepRazonesFinancieras2.aspx.vb
Normal file
@@ -0,0 +1,342 @@
|
||||
Option Explicit On
|
||||
Option Strict On
|
||||
|
||||
Imports System.Data
|
||||
Imports System.Drawing
|
||||
Imports System.IO
|
||||
Imports Extensiones
|
||||
Imports GemBox.Spreadsheet
|
||||
Imports Microsoft.Reporting.WebForms
|
||||
|
||||
Partial Class Finanzas_RepRazonesFinancieras2
|
||||
Inherits ClsPaginas
|
||||
|
||||
|
||||
|
||||
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
|
||||
If Not Page.IsPostBack Then
|
||||
|
||||
|
||||
CargaEjercicios()
|
||||
|
||||
CargarCentrosDeCosto(Nothing, DdlSubproyecto, Nothing, LblSubProyecto)
|
||||
|
||||
|
||||
|
||||
DdlEjercicio.SelectedValueExist(UsuarioActual.Empresa.EjercicioActual)
|
||||
ValidaEjercicios()
|
||||
|
||||
End If
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
Protected Sub Tab_ActiveTabChanged(sender As Object, e As EventArgs)
|
||||
|
||||
If Tab.TabIndex = 0 Then 'Balance General
|
||||
|
||||
End If
|
||||
|
||||
If Tab.ActiveTabIndex = 1 Then 'Estado de Resultados
|
||||
|
||||
End If
|
||||
|
||||
If Tab.ActiveTabIndex = 2 Then 'Ratios
|
||||
|
||||
|
||||
End If
|
||||
|
||||
|
||||
|
||||
UpFiltros.Update()
|
||||
End Sub
|
||||
|
||||
|
||||
Protected Sub DdlEjercicio_SelectedIndexChanged(sender As Object, e As EventArgs)
|
||||
ValidaEjercicios()
|
||||
End Sub
|
||||
|
||||
Protected Sub DdlEjercicio2_SelectedIndexChanged(sender As Object, e As EventArgs)
|
||||
ValidaEjercicios()
|
||||
End Sub
|
||||
|
||||
Private Sub ValidaEjercicios()
|
||||
|
||||
|
||||
Dim EInicio As Integer = DdlEjercicio.SelectedValue.ToEntero
|
||||
|
||||
|
||||
If EInicio > DdlEjercicio2.SelectedValue.ToEntero Then
|
||||
|
||||
If DdlEjercicio2.Items.Count > 0 Then
|
||||
DdlEjercicio2.SelectedIndex = DdlEjercicio2.Items.Count - 1
|
||||
End If
|
||||
|
||||
Dim Fejerciosio As Integer = DdlEjercicio2.SelectedValue.ToEntero
|
||||
|
||||
If Not EInicio + 1 > Fejerciosio Then
|
||||
DdlEjercicio2.SelectedValueExist(EInicio + 1)
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
|
||||
UpFiltros.Update()
|
||||
End Sub
|
||||
|
||||
Private Sub CargaEjercicios()
|
||||
'Dim ClsConta As New ClsContPAQi(UsuarioActual.Empresa)
|
||||
Dim ClsConta As New ClsContabilidad
|
||||
If ClsConta.GetEjercicios(UsuarioActual.CveEmpresa) Then
|
||||
DdlEjercicio.DataSource = ClsConta.DtResultados
|
||||
DdlEjercicio2.DataSource = ClsConta.DtResultados
|
||||
Else
|
||||
DdlEjercicio.DataSource = Nothing
|
||||
DdlEjercicio2.DataSource = Nothing
|
||||
End If
|
||||
ClsConta.Dispose()
|
||||
DdlEjercicio.DataBind()
|
||||
DdlEjercicio2.DataBind()
|
||||
|
||||
DdlEjercicio.SelectedValueExist(UsuarioActual.Empresa.EjercicioActual.ToString)
|
||||
If DdlEjercicio.Items.Count = 0 Then
|
||||
DdlEjercicio.Items.Add(New ListItem(Now.Year.ToString, Now.Year.ToString))
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs)
|
||||
|
||||
|
||||
|
||||
If TAB.ActiveTabIndex = 0 Then
|
||||
CargaDatosBalanceGeneral()
|
||||
End If
|
||||
|
||||
|
||||
If TAB.ActiveTabIndex = 1 Then
|
||||
CargaDatosEstadoResultados()
|
||||
End If
|
||||
|
||||
|
||||
If Tab.ActiveTabIndex = 2 Then
|
||||
CargaDatosRatios()
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
#Region "ESTADO RESULTADOS"
|
||||
|
||||
Private Sub CargaDatosBalanceGeneral()
|
||||
UpBalanceGeneral.Update()
|
||||
End Sub
|
||||
|
||||
Private Sub CargaDatosEstadoResultados()
|
||||
|
||||
|
||||
|
||||
LnkExportar.Visible = False
|
||||
GVEstadoRsultadosOcultarColumnas(GVEstadoRsultados, 1)
|
||||
|
||||
|
||||
Dim FechaI = New Date(DdlEjercicio.SelectedValue.ToEntero, 1, 1)
|
||||
Dim FechaF = New Date(DdlEjercicio2.SelectedValue.ToEntero, 1, 1)
|
||||
|
||||
|
||||
Dim CveSubProyecto = DdlSubproyecto.SelectedValue.ToEntero
|
||||
|
||||
|
||||
Dim objFinanzas As New ClsFinanzas
|
||||
Dim dtTemp As New DataTable
|
||||
|
||||
If objFinanzas.GetRazonesFinancierasEstadoResultadosRep(FechaI, FechaF, -1, CveSubProyecto, UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario, 1, 12) Then
|
||||
dtTemp = objFinanzas.DtResultados
|
||||
|
||||
GVEstadoRsultadosMostrarColumnas(dtTemp, GVEstadoRsultados)
|
||||
GVEstadoRsultados.DataSource = dtTemp
|
||||
|
||||
If dtTemp.Rows.Count > 0 Then
|
||||
LnkExportar.Visible = True
|
||||
End If
|
||||
|
||||
Else
|
||||
GVEstadoRsultados.DataSource = Nothing
|
||||
End If
|
||||
|
||||
objFinanzas.Dispose()
|
||||
GVEstadoRsultados.DataBind()
|
||||
|
||||
UpEstadoResultados.Update()
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub GVEstadoRsultadosOcultarColumnas(ByRef Gv As GridView, Optional index As Integer = 2)
|
||||
|
||||
For index = 2 To Gv.Columns.Count - 1
|
||||
CType(Gv.Columns(index), BoundField).DataField = Nothing
|
||||
Gv.Columns(index).Visible = False
|
||||
Next
|
||||
UpEstadoResultados.Update()
|
||||
End Sub
|
||||
|
||||
Private Sub GVEstadoRsultadosMostrarColumnas(dt As DataTable, ByRef Gv As GridView)
|
||||
Dim index = 1
|
||||
|
||||
|
||||
For index = 1 To dt.Columns.Count - 5
|
||||
CType(Gv.Columns(index + 4), BoundField).DataField = dt.Columns(index + 4).ColumnName
|
||||
Gv.Columns(index + 4).Visible = True
|
||||
Dim tmpDate As Date
|
||||
If (Date.TryParse(dt.Columns(index + 4).ColumnName, tmpDate)) Then
|
||||
CType(Gv.Columns(index + 4), BoundField).HeaderText = tmpDate.ToString("dd-MMM").Replace(".", "")
|
||||
Else
|
||||
CType(Gv.Columns(index + 4), BoundField).HeaderText = dt.Columns(index + 4).ColumnName
|
||||
End If
|
||||
Next
|
||||
End Sub
|
||||
|
||||
Protected Sub GVEstadoRsultados_RowDataBound(sender As Object, e As GridViewRowEventArgs)
|
||||
|
||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||
|
||||
If e.Row.DataKey("Tipo").ToEntero = 1 Then
|
||||
e.Row.Font.Bold = True
|
||||
End If
|
||||
|
||||
If e.Row.DataKey("Tipo").ToEntero = 3 Then
|
||||
e.Row.FCLabel("LblNombre").Text = $" {e.Row.FCLabel("LblNombre").Text}"
|
||||
End If
|
||||
|
||||
If e.Row.DataKey("Tipo").ToEntero = 4 Then
|
||||
e.Row.Attributes.Add("style", "border-top: solid;border-bottom: solid")
|
||||
End If
|
||||
|
||||
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
|
||||
|
||||
#Region "RATIOS"
|
||||
|
||||
|
||||
|
||||
Private Sub CargaDatosRatios()
|
||||
|
||||
|
||||
|
||||
LnkExportar.Visible = False
|
||||
GVRatiosOcultarColumnas(GVRatios, 1)
|
||||
|
||||
|
||||
Dim FechaI = New Date(DdlEjercicio.SelectedValue.ToEntero, 1, 1)
|
||||
Dim FechaF = New Date(DdlEjercicio2.SelectedValue.ToEntero, 1, 1)
|
||||
|
||||
|
||||
Dim CveSubProyecto = DdlSubproyecto.SelectedValue.ToEntero
|
||||
|
||||
|
||||
Dim objFinanzas As New ClsFinanzas
|
||||
Dim dtTemp As New DataTable
|
||||
|
||||
If objFinanzas.GetRazonesFinancierasRatiosRep(FechaI, FechaF, -1, CveSubProyecto, UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario, 1, 12) Then
|
||||
dtTemp = objFinanzas.DtResultados
|
||||
|
||||
GVRatiosMostrarColumnas(dtTemp, GVRatios)
|
||||
GVRatios.DataSource = dtTemp
|
||||
|
||||
If dtTemp.Rows.Count > 0 Then
|
||||
LnkExportar.Visible = True
|
||||
End If
|
||||
|
||||
Else
|
||||
GVRatios.DataSource = Nothing
|
||||
End If
|
||||
|
||||
objFinanzas.Dispose()
|
||||
GVRatios.DataBind()
|
||||
|
||||
UpBalanceGeneral.Update()
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub GVRatiosOcultarColumnas(ByRef Gv As GridView, Optional index As Integer = 2)
|
||||
|
||||
For index = 1 To Gv.Columns.Count - 1
|
||||
CType(Gv.Columns(index), BoundField).DataField = Nothing
|
||||
Gv.Columns(index).Visible = False
|
||||
Next
|
||||
UpEstadoResultados.Update()
|
||||
End Sub
|
||||
|
||||
Private Sub GVRatiosMostrarColumnas(dt As DataTable, ByRef Gv As GridView)
|
||||
Dim index = 1
|
||||
|
||||
|
||||
For index = 1 To dt.Columns.Count - 2
|
||||
CType(Gv.Columns(index + 1), BoundField).DataField = dt.Columns(index + 1).ColumnName
|
||||
|
||||
CType(Gv.Columns(index + 1), BoundField).DataFormatString = "{0:P2}"
|
||||
|
||||
|
||||
Gv.Columns(index + 1).Visible = True
|
||||
CType(Gv.Columns(index + 1), BoundField).HeaderText = dt.Columns(index + 1).ColumnName
|
||||
|
||||
Next
|
||||
End Sub
|
||||
|
||||
Protected Sub GVRatios_RowDataBound(sender As Object, e As GridViewRowEventArgs)
|
||||
|
||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||
|
||||
If e.Row.DataKey("Tipo").ToEntero = 1 Then
|
||||
e.Row.Font.Bold = True
|
||||
End If
|
||||
|
||||
If e.Row.DataKey("Tipo").ToEntero = 3 Then
|
||||
e.Row.FCLabel("LblNombre").Text = $" {e.Row.FCLabel("LblNombre").Text}"
|
||||
End If
|
||||
|
||||
If e.Row.DataKey("Tipo").ToEntero = 4 Then
|
||||
e.Row.Attributes.Add("style", "border-top: solid;border-bottom: solid")
|
||||
End If
|
||||
|
||||
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#Region "DESCARGA EXCEL"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Public Overrides Sub VerifyRenderingInServerForm(ByVal control As Control)
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
End Class
|
||||
|
||||
Reference in New Issue
Block a user