mejora, cuando hay muchos subproyectos activos, E154,
proceso de limpiar subproyectos en cero, y limite la cantidad de columnas visibles
This commit is contained in:
@@ -1712,6 +1712,26 @@ Partial Class Contabilidad_RepEstadoResultadosHorizontal
|
||||
If ObjConta.GetEstadosSubProyectoHorizontal(FechaIMes.ToDate, FechaFMes.ToDate, CveSubProyecto, DdlDivisor.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario) Then
|
||||
DTSubProyectosCabecerasH = ObjConta.DSResultados.Tables(0)
|
||||
DtDatosSubProyectoH = ObjConta.DSResultados.Tables(1).FiltraParametros("(ImporteActual <> 0 OR ImporteAcumulado <> 0)")
|
||||
'se limpian los subproyectos con importe cero
|
||||
Dim IndexData As Integer = 1
|
||||
Dim ColumnasEliminar As New ArrayList
|
||||
For Each dColumn As DataColumn In DtDatosSubProyectoH.Columns
|
||||
'si el nombre es numerico, s la clave del subproyecto
|
||||
If dColumn.ColumnName.ToEntero > 0 Then
|
||||
If DtDatosSubProyectoH.MAX(String.Format("[{0}]", dColumn.ColumnName)).ToDecimal = 0 Then
|
||||
ColumnasEliminar.Add(dColumn.ColumnName)
|
||||
'DtDatosSubProyectoH.Columns.Remove(dColumn.ColumnName)
|
||||
End If
|
||||
End If
|
||||
|
||||
Next
|
||||
|
||||
If ColumnasEliminar.Count > 0 Then
|
||||
For Each columna As String In ColumnasEliminar
|
||||
DtDatosSubProyectoH.Columns.Remove(columna)
|
||||
Next
|
||||
End If
|
||||
|
||||
Else
|
||||
DtDatosSubProyectoH = Nothing
|
||||
Alert("Ocurrio un error al cargar los datos del Estado de Actividades", TipoMensaje.MsgError)
|
||||
@@ -1739,43 +1759,59 @@ Partial Class Contabilidad_RepEstadoResultadosHorizontal
|
||||
Dim IndexGv As Integer = 1
|
||||
Dim IndexMax As Integer = 1
|
||||
Dim IndexSubProyecto = 0
|
||||
Dim IndexSubProyectoMAx As Integer = DTSubProyectosCabecerasH.Rows.Count - 1
|
||||
Dim IndexTotatles As Integer = 13 + IndexSubProyectoMAx
|
||||
Dim IndexSubProyectoMax As Integer = DTSubProyectosCabecerasH.Rows.Count - 1
|
||||
|
||||
|
||||
If IndexSubProyectoMAx > GvIngresosSubProyectoH.Columns.Count - 2 Then
|
||||
IndexSubProyectoMAx = GvIngresosSubProyectoH.Columns.Count - 2
|
||||
End If
|
||||
Dim IndexTotales As Integer = 13 + IndexSubProyectoMax
|
||||
If IndexTotales > DtIngresosSubProyectoH.Columns.Count - 2 Then
|
||||
IndexTotales = DtIngresosSubProyectoH.Columns.Count - 2
|
||||
End If
|
||||
|
||||
'34
|
||||
Dim IDX_LIMPIAR As Integer = 1
|
||||
|
||||
For IDX_LIMPIAR = 1 To 35
|
||||
For IDX_LIMPIAR = 1 To GvIngresosSubProyectoH.Columns.Count - 2
|
||||
CType(GvIngresosSubProyectoH.Columns(IDX_LIMPIAR), BoundField).DataField = Nothing
|
||||
CType(GvIngresosSubProyectoH.Columns(IDX_LIMPIAR), BoundField).HeaderText = ""
|
||||
GvIngresosSubProyectoH.Columns(IDX_LIMPIAR).Visible = False
|
||||
Next
|
||||
listaCampos.Clear()
|
||||
|
||||
|
||||
If DtIngresosSubProyectoH.Rows.Count > 0 Then
|
||||
|
||||
For Each dCoumn As DataColumn In DtIngresosSubProyectoH.Columns
|
||||
For Each dColumn As DataColumn In DtIngresosSubProyectoH.Columns
|
||||
|
||||
If IndexData >= 13 Then
|
||||
|
||||
If IndexSubProyecto <= IndexSubProyectoMAx Then
|
||||
If IndexSubProyecto <= IndexSubProyectoMax Then
|
||||
|
||||
CType(GvIngresosSubProyectoH.Columns(IndexGv), BoundField).DataField = dCoumn.ColumnName
|
||||
GvIngresosSubProyectoH.Columns(IndexGv).Visible = True
|
||||
If GvIngresosSubProyectoH.Columns(IndexGv).GetType.Name = "BoundField" Then
|
||||
CType(GvIngresosSubProyectoH.Columns(IndexGv), BoundField).DataField = dColumn.ColumnName
|
||||
GvIngresosSubProyectoH.Columns(IndexGv).Visible = True
|
||||
|
||||
CType(GvTotalesSubProyectoH.Columns(IndexGv), BoundField).DataField = dCoumn.ColumnName
|
||||
GvTotalesSubProyectoH.Columns(IndexGv).Visible = True
|
||||
CType(GvTotalesSubProyectoH.Columns(IndexGv), BoundField).DataField = dColumn.ColumnName
|
||||
GvTotalesSubProyectoH.Columns(IndexGv).Visible = True
|
||||
|
||||
If IndexSubProyecto <= IndexSubProyectoMAx Then
|
||||
CType(GvIngresosSubProyectoH.Columns(IndexGv), BoundField).HeaderText = DTSubProyectosCabecerasH.Rows(IndexSubProyecto)(0).ToString
|
||||
CType(GvTotalesSubProyectoH.Columns(IndexGv), BoundField).HeaderText = DTSubProyectosCabecerasH.Rows(IndexSubProyecto)(0).ToString
|
||||
CType(GvGastosSubProyectoH.Columns(IndexGv), BoundField).HeaderText = DTSubProyectosCabecerasH.Rows(IndexSubProyecto)(0).ToString
|
||||
If IndexSubProyecto <= IndexSubProyectoMax Then
|
||||
Dim TxtSub As String = GlobalDTSubProyectos(-1, CveSubProyecto:=dColumn.ColumnName.ToEntero, CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimeroValor("SubProyecto")
|
||||
CType(GvIngresosSubProyectoH.Columns(IndexGv), BoundField).HeaderText = TxtSub
|
||||
CType(GvTotalesSubProyectoH.Columns(IndexGv), BoundField).HeaderText = TxtSub
|
||||
CType(GvGastosSubProyectoH.Columns(IndexGv), BoundField).HeaderText = TxtSub
|
||||
End If
|
||||
listaCampos.Add(New String() {dColumn.ColumnName.ToString(), DTSubProyectosCabecerasH.Rows(IndexSubProyecto)(0).ToString()})
|
||||
End If
|
||||
listaCampos.Add(New String() {dCoumn.ColumnName.ToString(), DTSubProyectosCabecerasH.Rows(IndexSubProyecto)(0).ToString()})
|
||||
|
||||
Else
|
||||
GvIngresosSubProyectoH.Columns(IndexGv).Visible = False
|
||||
GvTotalesSubProyectoH.Columns(IndexGv).Visible = False
|
||||
If IndexGv < GvIngresosSubProyectoH.Columns.Count Then
|
||||
GvIngresosSubProyectoH.Columns(IndexGv).Visible = False
|
||||
GvTotalesSubProyectoH.Columns(IndexGv).Visible = False
|
||||
Else
|
||||
Exit For
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
IndexGv = IndexGv + 1
|
||||
@@ -1793,8 +1829,10 @@ Partial Class Contabilidad_RepEstadoResultadosHorizontal
|
||||
Next
|
||||
|
||||
IndexData = 13
|
||||
For IndexData = 13 To IndexTotatles
|
||||
Row.Item(IndexData) = DtIngresosSubProyectoH.SUM($"[{DtIngresosSubProyectoH.Columns(IndexData).ColumnName}]", "NOT CtaMayor in (3,4)")
|
||||
For IndexData = 13 To IndexTotales
|
||||
If DtIngresosSubProyectoH.Columns(IndexData).ColumnName.ToEntero > 0 Then 'filtro solo los que tienen número
|
||||
Row.Item(IndexData) = DtIngresosSubProyectoH.SUM($"[{DtIngresosSubProyectoH.Columns(IndexData).ColumnName}]", "NOT CtaMayor in (3,4)")
|
||||
End If
|
||||
Next
|
||||
|
||||
Row.Item("Nombre") = "TOTAL INGRESOS "
|
||||
@@ -1823,7 +1861,6 @@ Partial Class Contabilidad_RepEstadoResultadosHorizontal
|
||||
|
||||
If DtGastosSubProyectoH.Rows.Count > 1 Then
|
||||
|
||||
|
||||
IndexData = 0
|
||||
IndexGv = 1
|
||||
IndexMax = 0
|
||||
@@ -1832,13 +1869,20 @@ Partial Class Contabilidad_RepEstadoResultadosHorizontal
|
||||
For Each dCoumn As DataColumn In DtIngresosSubProyectoH.Columns
|
||||
If IndexData >= 13 Then
|
||||
If IndexSubProyecto <= IndexSubProyectoMAx Then
|
||||
CType(GvGastosSubProyectoH.Columns(IndexGv), BoundField).DataField = dCoumn.ColumnName
|
||||
GvGastosSubProyectoH.Columns(IndexGv).Visible = True
|
||||
CType(GvTotalesSubProyectoH.Columns(IndexGv), BoundField).DataField = dCoumn.ColumnName
|
||||
GvTotalesSubProyectoH.Columns(IndexGv).Visible = True
|
||||
If GvIngresosSubProyectoH.Columns(IndexGv).GetType.Name = "BoundField" Then
|
||||
CType(GvGastosSubProyectoH.Columns(IndexGv), BoundField).DataField = dCoumn.ColumnName
|
||||
GvGastosSubProyectoH.Columns(IndexGv).Visible = True
|
||||
CType(GvTotalesSubProyectoH.Columns(IndexGv), BoundField).DataField = dCoumn.ColumnName
|
||||
GvTotalesSubProyectoH.Columns(IndexGv).Visible = True
|
||||
End If
|
||||
|
||||
Else
|
||||
GvIngresosSubProyectoH.Columns(IndexGv).Visible = False
|
||||
GvTotalesSubProyectoH.Columns(IndexGv).Visible = False
|
||||
If IndexGv < DtIngresosSubProyectoH.Columns.Count AndAlso IndexGv < GvIngresosSubProyectoH.Columns.Count Then
|
||||
GvIngresosSubProyectoH.Columns(IndexGv).Visible = False
|
||||
GvTotalesSubProyectoH.Columns(IndexGv).Visible = False
|
||||
Else
|
||||
Exit For
|
||||
End If
|
||||
End If
|
||||
|
||||
IndexGv = IndexGv + 1
|
||||
@@ -1847,16 +1891,16 @@ Partial Class Contabilidad_RepEstadoResultadosHorizontal
|
||||
IndexData = IndexData + 1
|
||||
Next
|
||||
|
||||
|
||||
|
||||
For Each dr As DataRow In DtGastosSubProyectoH.FiltraParametros("NOT CtaMayor in (3,4)").Rows
|
||||
TotalActual += dr("ImporteActual").ToString.ToDouble
|
||||
TotalAnterior += dr("ImporteAcumulado").ToString.ToDouble
|
||||
Next
|
||||
|
||||
IndexData = 13
|
||||
For IndexData = 13 To IndexTotatles
|
||||
Row.Item(IndexData) = DtGastosSubProyectoH.SUM($"[{DtIngresosSubProyectoH.Columns(IndexData).ColumnName}]", "NOT CtaMayor in (3,4)")
|
||||
For IndexData = 13 To IndexTotales
|
||||
If DtIngresosSubProyectoH.Columns(IndexData).ColumnName.ToEntero > 0 Then 'filtro solo los que tienen número
|
||||
Row.Item(IndexData) = DtGastosSubProyectoH.SUM($"[{DtIngresosSubProyectoH.Columns(IndexData).ColumnName}]", "NOT CtaMayor in (3,4)")
|
||||
End If
|
||||
Next
|
||||
|
||||
Row.Item("Nombre") = "TOTAL GASTOS"
|
||||
@@ -1881,8 +1925,10 @@ Partial Class Contabilidad_RepEstadoResultadosHorizontal
|
||||
Row = DTTotalesSubProyectoH.NewRow
|
||||
|
||||
IndexData = 13
|
||||
For IndexData = 13 To IndexTotatles
|
||||
Row.Item(IndexData) = DtIngresosSubProyectoH.SUM($"[{DtIngresosSubProyectoH.Columns(IndexData).ColumnName}]", "NOT CtaMayor in (-1,3,4)") - DtGastosSubProyectoH.SUM($"[{DtGastosSubProyectoH.Columns(IndexData).ColumnName}]", "NOT CtaMayor in (-1,3,4)")
|
||||
For IndexData = 13 To IndexTotales
|
||||
If DtIngresosSubProyectoH.Columns(IndexData).ColumnName.ToEntero > 0 Then 'filtro solo los que tienen número
|
||||
Row.Item(IndexData) = DtIngresosSubProyectoH.SUM($"[{DtIngresosSubProyectoH.Columns(IndexData).ColumnName}]", "NOT CtaMayor in (-1,3,4)") - DtGastosSubProyectoH.SUM($"[{DtGastosSubProyectoH.Columns(IndexData).ColumnName}]", "NOT CtaMayor in (-1,3,4)")
|
||||
End If
|
||||
Next
|
||||
|
||||
Row.Item("Nombre") = "Resultado del ejercicio"
|
||||
@@ -1949,19 +1995,22 @@ Partial Class Contabilidad_RepEstadoResultadosHorizontal
|
||||
Dim IndiceMax As Integer = 1 + CountDinamico
|
||||
|
||||
Dim FEchaMesFinal As Date = New Date(DdlEjercicio.SelectedValue.ToEntero, DdlPeriodo.SelectedValue.ToEntero, 1).LastDayOfMonth
|
||||
If IndiceMax > GvIngresosSubProyectoH.Columns.Count - 2 Then
|
||||
IndiceMax = GvIngresosSubProyectoH.Columns.Count - 2
|
||||
End If
|
||||
|
||||
For IndiceInicio = 1 To IndiceMax
|
||||
|
||||
Dim CveSubProyectoIntermo As String = CType(GvGastosSubProyectoH.Columns(IndiceInicio), BoundField).DataField
|
||||
Dim Importe As Decimal = e.Row.Cells(IndiceInicio).Text.ToDecimal
|
||||
If GvGastosSubProyectoH.Columns(IndiceInicio).GetType.Name = "BoundField" Then
|
||||
Dim CveSubProyectoInterno As String = CType(GvGastosSubProyectoH.Columns(IndiceInicio), BoundField).DataField
|
||||
Dim Importe As Decimal = e.Row.Cells(IndiceInicio).Text.ToDecimal
|
||||
|
||||
If CveSubProyectoInterno.ToEntero > 0 Then
|
||||
e.Row.Cells(IndiceInicio).Text = $"<a { If(Importe < 0, "style='color:Red;'", "style='color:#337ab7;'") } target='_blank' href='./RepAnexoCatalogo.aspx?CveCuenta={CveCuenta}&FF={FEchaMesFinal.ToString("dd/MM/yyyy")}&FI=01/01/{DdlEjercicio.SelectedValue}&ER=1&CveSubProyecto={CveSubProyectoInterno}' >{ If(DdlDivisor.SelectedValue.ToEntero > 1, Importe.ToString("###,###,##0"), Importe.ToString("###,###,###.00")) }</a>"
|
||||
End If
|
||||
|
||||
If CveSubProyectoIntermo.ToEntero > 0 Then
|
||||
e.Row.Cells(IndiceInicio).Text = $"<a { If(Importe < 0, "style='color:Red;'", "style='color:#337ab7;'") } target='_blank' href='./RepAnexoCatalogo.aspx?CveCuenta={CveCuenta}&FF={FEchaMesFinal.ToString("dd/MM/yyyy")}&FI=01/01/{DdlEjercicio.SelectedValue}&ER=1&CveSubProyecto={CveSubProyectoIntermo}' >{ If(DdlDivisor.SelectedValue.ToEntero > 1, Importe.ToString("###,###,##0"), Importe.ToString("###,###,###.00")) }</a>"
|
||||
End If
|
||||
|
||||
|
||||
|
||||
Next IndiceInicio
|
||||
|
||||
e.Row.FCHyperLink("HLAnterior").NavigateUrl = $"./RepAnexoCatalogoCC.aspx?CveCuenta={e.Row.DBCampo("CveCuenta").ToString}&Ejercicio={DdlEjercicio.SelectedValue}&Divisor={DdlDivisor.SelectedValue}&CveSubProyecto={DdlSubproyecto.SelectedValue}&Periodo={DdlPeriodo.SelectedValue}"
|
||||
@@ -1971,20 +2020,23 @@ Partial Class Contabilidad_RepEstadoResultadosHorizontal
|
||||
Dim CountDinamico As Integer = e.Row.DataKey("CountDinamico").ToEntero
|
||||
Dim IndiceInicio As Integer = 1
|
||||
Dim IndiceMax As Integer = 1 + CountDinamico
|
||||
If IndiceMax > GvIngresosSubProyectoH.Columns.Count - 2 Then
|
||||
IndiceMax = GvIngresosSubProyectoH.Columns.Count - 2
|
||||
End If
|
||||
|
||||
For IndiceInicio = 1 To IndiceMax
|
||||
|
||||
Dim Importe As Decimal = e.Row.Cells(IndiceInicio).Text.ToDecimal
|
||||
e.Row.Cells(IndiceInicio).Text = $"<div { If(Importe < 0, "style='color:Red;'", "style='color:#000000;'") } ><strong>{ If(DdlDivisor.SelectedValue.ToEntero > 1, Importe.ToString("###,###,##0"), Importe.ToString("###,###,###.00")) }</strong></div>"
|
||||
Next IndiceInicio
|
||||
|
||||
|
||||
|
||||
ElseIf e.Row.DBCampo("CtaMayor").ToString.ToEntero = -2 Then
|
||||
|
||||
Dim CountDinamico As Integer = e.Row.DataKey("CountDinamico").ToEntero
|
||||
Dim IndiceInicio As Integer = 1
|
||||
Dim IndiceMax As Integer = 1 + CountDinamico
|
||||
If IndiceMax > GvIngresosSubProyectoH.Columns.Count - 2 Then
|
||||
IndiceMax = GvIngresosSubProyectoH.Columns.Count - 2
|
||||
End If
|
||||
|
||||
For IndiceInicio = 1 To IndiceMax
|
||||
|
||||
|
||||
Reference in New Issue
Block a user