Esta de resultados y anexos, Links en deatalles
This commit is contained in:
@@ -33,6 +33,39 @@ Partial Class Contabilidad2_RepAnexoCatalogoCC
|
||||
End Set
|
||||
End Property
|
||||
|
||||
|
||||
Private Property DTHeaders As DataTable
|
||||
Get
|
||||
|
||||
If ViewState("DTHeaders") Is Nothing Then
|
||||
Return New DataTable
|
||||
Else
|
||||
Return DirectCast(ViewState("DTHeaders"), DataTable)
|
||||
End If
|
||||
|
||||
End Get
|
||||
Set(value As DataTable)
|
||||
ViewState("DTHeaders") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
|
||||
Private Property DTDatos As DataTable
|
||||
Get
|
||||
|
||||
If ViewState("DTDatos") Is Nothing Then
|
||||
Return New DataTable
|
||||
Else
|
||||
Return DirectCast(ViewState("DTDatos"), DataTable)
|
||||
End If
|
||||
|
||||
End Get
|
||||
Set(value As DataTable)
|
||||
ViewState("DTDatos") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
|
||||
#End Region
|
||||
|
||||
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
||||
@@ -112,12 +145,16 @@ Partial Class Contabilidad2_RepAnexoCatalogoCC
|
||||
CargaDatos()
|
||||
End Sub
|
||||
|
||||
Private Sub CargaDatos()
|
||||
Private Sub CargaDatos()
|
||||
|
||||
DTHeaders = New DataTable
|
||||
DTDatos = New DataTable
|
||||
Dim Conta As New ClsContabilidad
|
||||
|
||||
If Conta.GetAnexoCatalagoCC(CveCuenta, DdlEjercicio.SelectedValue.ToEntero, DdlSubProyecto.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, DdlDivisor.SelectedValue.ToEntero, DdlPeriodo.SelectedValue.ToEntero, UsuarioActual.CveUsuario) Then
|
||||
|
||||
Dim DtHeaders As DataTable = Conta.DSResultados.Tables(0)
|
||||
DTHeaders = Conta.DSResultados.Tables(0)
|
||||
DTDatos = Conta.DSResultados.Tables(1)
|
||||
GvCC.DataSource = Conta.DSResultados.Tables(1)
|
||||
|
||||
Dim Index = 4
|
||||
@@ -127,18 +164,19 @@ Partial Class Contabilidad2_RepAnexoCatalogoCC
|
||||
listaCampos.Clear()
|
||||
|
||||
Index = 4
|
||||
For Each Dr As DataRow In DtHeaders.Rows
|
||||
For Each Dr As DataRow In DTHeaders.Rows
|
||||
GvCC.Columns(Index).Visible = True
|
||||
CType(GvCC.Columns(Index), BoundField).DataField = String.Format("SubProyecto{0}", Dr("SubProyecto"))
|
||||
GvCC.Columns(Index).HeaderText = Dr("SubProyecto").ToString()
|
||||
listaCampos.Add(New String() {String.Format("SubProyecto{0}", Dr("SubProyecto")), Dr("SubProyecto").ToString()})
|
||||
|
||||
|
||||
GvCC.Columns(Index + 1).Visible = True
|
||||
CType(GvCC.Columns(Index + 1), BoundField).DataField = String.Format("SubProyecto{0}Porcentaje", Dr("SubProyecto"))
|
||||
GvCC.Columns(Index + 1).HeaderText = "%"
|
||||
|
||||
Index += 2
|
||||
listaCampos.Add(New String() {String.Format("SubProyecto{0}", Dr("SubProyecto")), Dr("SubProyecto").ToString()})
|
||||
|
||||
|
||||
'GvCC.Columns(Index + 1).Visible = True
|
||||
'CType(GvCC.Columns(Index + 1), BoundField).DataField = String.Format("SubProyecto{0}Porcentaje", Dr("SubProyecto"))
|
||||
'GvCC.Columns(Index + 1).HeaderText = "%"
|
||||
'Index += 2
|
||||
|
||||
Index += 1
|
||||
Next
|
||||
|
||||
GvCC.DataBind()
|
||||
@@ -156,7 +194,7 @@ Partial Class Contabilidad2_RepAnexoCatalogoCC
|
||||
|
||||
End If
|
||||
|
||||
RegistraScript($"LimpiaCeros({DdlDivisor.SelectedValue});")
|
||||
'RegistraScript($"LimpiaCeros({DdlDivisor.SelectedValue});")
|
||||
Conta.Dispose()
|
||||
End Sub
|
||||
|
||||
@@ -164,16 +202,119 @@ Partial Class Contabilidad2_RepAnexoCatalogoCC
|
||||
|
||||
|
||||
#Region " GV ROW DATABOUND "
|
||||
Protected Sub GvCC_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvCC.RowDataBound
|
||||
Protected Sub GvCC_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvCC.RowDataBound
|
||||
|
||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||
|
||||
If e.Row.RowIndex = 0 Then
|
||||
e.Row.Style.Add("font-weight", "bold")
|
||||
End If
|
||||
setgraficaCC(e)
|
||||
e.Row.Cells(1).Style.Add("text-indent", $"{e.Row.DBCampo("Level").ToString.ToEntero * 2}em")
|
||||
|
||||
setgraficaCC(e)
|
||||
|
||||
If e.Row.DataKey("Level").ToEntero = 0 Then
|
||||
e.Row.CssClass = "Totales"
|
||||
End If
|
||||
|
||||
If e.Row.DataKey("Level").ToEntero = 1 Then
|
||||
e.Row.CssClass = "SubTotales"
|
||||
End If
|
||||
|
||||
|
||||
Dim Index As Integer = 2
|
||||
|
||||
For Each DRow As DataRow In DTHeaders.Rows
|
||||
Dim Importe As Decimal = e.Row.DBCampo($"SubProyecto{DRow("SubProyecto")}").ToDecimal
|
||||
'Dim Anio As Integer = DRow("SubProyecto").ToString.ToEntero
|
||||
|
||||
If e.Row.CssClass = "Totales" And Index = 2 Then
|
||||
e.Row.Cells(Index).ForeColor = Drawing.ColorTranslator.FromHtml("#337ab7")
|
||||
End If
|
||||
|
||||
|
||||
If e.Row.Cells(Index).Text.Replace("%", "").ToDecimal = 0 Then
|
||||
e.Row.Cells(Index).Text = "-"
|
||||
ElseIf e.Row.Cells(Index).Text.Replace("%", "").ToDecimal < 0 Then
|
||||
e.Row.Cells(Index).ForeColor = Drawing.Color.Red
|
||||
End If
|
||||
|
||||
|
||||
|
||||
Index += 1
|
||||
Next
|
||||
|
||||
Dim CveCunetaRow As Integer = e.Row.DataKey("CveCuenta").ToEntero
|
||||
Dim inicial As Boolean = True
|
||||
Index = 4
|
||||
|
||||
For Each DRow As DataRow In DTHeaders.Rows
|
||||
|
||||
Dim Importe As Decimal = e.Row.DBCampo($"SubProyecto{DRow("SubProyecto")}").ToDecimal
|
||||
'Dim Anio As Integer = DRow("SubProyecto").ToString.ToEntero
|
||||
|
||||
|
||||
If e.Row.Cells(Index).Text.Replace("%", "").ToDecimal = 0 Then
|
||||
e.Row.Cells(Index).Text = "-"
|
||||
ElseIf e.Row.Cells(Index).Text.Replace("%", "").ToDecimal < 0 Then
|
||||
e.Row.Cells(Index).ForeColor = Drawing.Color.Red
|
||||
End If
|
||||
|
||||
|
||||
If Importe <> 0 Then
|
||||
e.Row.Cells(Index).Text = $"<a { If(Importe < 0, "style='color:Red;'", "style='color:#337ab7;'") } target='_blank' href='./RepAnexoCatalogo.aspx?CveCuenta={CveCunetaRow}&FF=31/12/{DdlEjercicio.SelectedValue}&FI=01/01/{DdlEjercicio.SelectedValue}&ER=1&CveSubProyecto={DdlSubProyecto.SelectedValue.ToEntero}' >{ If(DdlDivisor.SelectedValue.ToEntero > 1, Importe.ToString("###,###,##0"), Importe.ToString("###,###,###.00")) }</a>"
|
||||
End If
|
||||
|
||||
'If e.Row.Cells(Index + 1).Text.ToDecimal = 0 Then
|
||||
' e.Row.Cells(Index + 1).Text = "-"
|
||||
'ElseIf e.Row.Cells(Index + 1).Text.ToDecimal < 0 Then
|
||||
' e.Row.Cells(Index + 1).ForeColor = Drawing.Color.Red
|
||||
|
||||
'End If
|
||||
|
||||
|
||||
|
||||
Index += 1
|
||||
|
||||
Next
|
||||
|
||||
|
||||
'Index = 4
|
||||
|
||||
'For Each DRow As DataRow In DTHeaders.Rows
|
||||
|
||||
' Dim Importe As Decimal = e.Row.DBCampo($"SubProyecto{DRow("SubProyecto")}").ToDecimal
|
||||
' 'Dim Anio As Integer = DRow("SubProyecto").ToString.ToEntero
|
||||
|
||||
' If Importe > 0 Then
|
||||
' e.Row.Cells(Index).Text = $"<a { If(Importe < 0, "style='color:Red;'", "style='color:#337ab7;'") } target='_blank' href='./RepAnexoCatalogo.aspx?CveCuenta={CveCunetaRow}&FF=31/12/{DdlEjercicio.SelectedValue}&FI=01/01/{DdlEjercicio.SelectedValue}&ER=1&CveSubProyecto={DdlSubProyecto.SelectedValue.ToEntero}' >{ If(DdlDivisor.SelectedValue.ToEntero > 1, Importe.ToString("###,###,##0"), Importe.ToString("###,###,###.00")) }</a>"
|
||||
' Else
|
||||
' e.Row.Cells(Index).Text = "-"
|
||||
' End If
|
||||
|
||||
' If e.Row.Cells(Index + 1).Text.ToDecimal = 0 Then
|
||||
|
||||
' e.Row.Cells(Index + 1).Text = "-"
|
||||
|
||||
' ElseIf e.Row.Cells(Index + 1).Text.ToDecimal < 0 Then
|
||||
' e.Row.Cells(Index + 1).ForeColor = Drawing.Color.Red
|
||||
|
||||
' End If
|
||||
|
||||
' If e.Row.Cells(Index + 2).Text.Replace("%", "").ToDecimal = 0 Then
|
||||
' e.Row.Cells(Index + 2).Text = "-"
|
||||
' ElseIf e.Row.Cells(Index + 2).Text.Replace("%", "").ToDecimal < 0 Then
|
||||
' e.Row.Cells(Index + 2).ForeColor = Drawing.Color.Red
|
||||
' End If
|
||||
|
||||
' Index += 1
|
||||
|
||||
'Next
|
||||
|
||||
|
||||
|
||||
' e.Row.Cells(1).Style.Add("text-indent", $"{e.Row.DBCampo("Level").ToString.ToEntero * 2}em")
|
||||
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
Public Sub setgraficaCC(e As GridViewRowEventArgs)
|
||||
@@ -198,7 +339,7 @@ Partial Class Contabilidad2_RepAnexoCatalogoCC
|
||||
SubProyecto = DdlSubProyecto.SelectedItem.Text
|
||||
End If
|
||||
|
||||
GvCC.ExportToExcelGembox("AnexoCatálogoMensual", UsuarioActual, $"01/01/{DdlEjercicio.SelectedValue}", $"31/12/{DdlEjercicio.SelectedValue}", "Anexo del Catálogo - Mensual", SubProyecto, DdlDivisor.SelectedValue.ToEntero, DatoTituloExtra:=$"Periodo {DdlPeriodo.SelectedItem.Text}")
|
||||
GvCC.ExportToExcelGembox("AnexoCatálogoMensual", UsuarioActual, $"01/01/{DdlEjercicio.SelectedValue}", $"31/12/{DdlEjercicio.SelectedValue}", $"Estado de Resultados Horizontal por {LblSubProyecto.Text}", SubProyecto, DdlDivisor.SelectedValue.ToEntero, DatoTituloExtra:=$"Periodo {DdlPeriodo.SelectedItem.Text}")
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
Reference in New Issue
Block a user