Imports DevExpress.XtraPivotGrid

Public Class ucAuditoria
    Inherits System.Web.UI.UserControl
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub
    Protected Sub ASPxPivotGrid1_HtmlFieldValuePrepared(sender As Object, e As DevExpress.Web.ASPxPivotGrid.PivotHtmlFieldValuePreparedEventArgs) Handles ASPxPivotGrid1.HtmlFieldValuePrepared

        If e.IsColumn Then
            Select Case e.FieldIndex
                Case 0
                    e.Cell.BackColor = ColorEstadoInscripcion()
                    e.Cell.ForeColor = Drawing.Color.Black
                Case 1
                    e.Cell.BackColor = ColorEstadoEvaluacion()
                    e.Cell.ForeColor = Drawing.Color.White
                Case 2
                    e.Cell.BackColor = ColorEstadoAdjudicada()
                    e.Cell.ForeColor = Drawing.Color.White
            End Select

        Else
            If e.FieldIndex Mod 2 = 0 Then
                e.Cell.BackColor = Drawing.Color.AliceBlue
            End If
        End If
        'End If
    End Sub

    Protected Sub ASPxPivotGrid1_CustomCellStyle(sender As Object, e As DevExpress.Web.ASPxPivotGrid.PivotCustomCellStyleEventArgs) Handles ASPxPivotGrid1.CustomCellStyle
        ' if (e.ColumnValueType != DevExpress.XtraPivotGrid.PivotGridValueType.Value ||
        'e.RowValueType != DevExpress.XtraPivotGrid.PivotGridValueType.Value) return;
        'If (Convert.ToInt32(e.Value) < 50000) Then
        'e.CellStyle.BackColor = System.Drawing.Color.LemonChiffon;
        'If e.ColumnValueType = 
        'If e.ColumnField.FieldName = "Disponible" Then
        '    e.CellStyle.BackColor = Drawing.Color.AliceBlue
        'End If
        If e.RowFieldIndex Mod 2 = 0 Then
            e.CellStyle.BackColor = Drawing.Color.AliceBlue
        End If

        If e.ColumnValueType = DevExpress.XtraPivotGrid.PivotGridValueType.GrandTotal Then
            If e.DataField.ExpressionFieldName = "idPlaza" Then
                e.CellStyle.Font.Bold = True
            End If
        End If

        If e.RowValueType = DevExpress.XtraPivotGrid.PivotGridValueType.GrandTotal Then
            If e.DataField.ExpressionFieldName = "idPlaza" Or e.DataField.ExpressionFieldName = "salario" Then
                Select Case e.ColumnFieldIndex
                    Case 0
                        e.CellStyle.BackColor = ColorEstadoInscripcion()
                        e.CellStyle.ForeColor = Drawing.Color.Black
                    Case 1
                        e.CellStyle.BackColor = ColorEstadoEvaluacion()
                        e.CellStyle.ForeColor = Drawing.Color.White
                    Case 2
                        e.CellStyle.BackColor = ColorEstadoAdjudicada()
                        e.CellStyle.ForeColor = Drawing.Color.White
                End Select
            End If

        End If
    End Sub

    Protected Sub ASPxPivotGrid1_FieldValueDisplayText(sender As Object, e As DevExpress.Web.ASPxPivotGrid.PivotFieldDisplayTextEventArgs) Handles ASPxPivotGrid1.FieldValueDisplayText

        If (e.ValueType = PivotGridValueType.GrandTotal And Not (e.DataField Is Nothing) And Not e.IsColumn) Then
            e.DisplayText = "Instituciones: " & InstitucionBusinessObject.GetTotalquePublican
        End If

    End Sub
End Class