protected void pivotGrid_CustomCellDisplayText(object sender, DevExpress.Web.ASPxPivotGrid.PivotCellDisplayTextEventArgs e)
 {
     /*
      * object orderAmount;
      * decimal grandTotalOrderAmount;
      *
      *
      *
      * // calcular la participacion
      * if (object.ReferenceEquals(e.DataField, pivotGrid.Fields["PivotGridFieldPART_VLR_VENTA"]))
      * {
      *  DevExpress.Web.ASPxPivotGrid.PivotGridField PivotGridFieldPART_VLR_VENTA = pivotGrid.Fields["PivotGridFieldPART_VLR_VENTA"];
      *  orderAmount = (e.GetCellValue(PivotGridFieldPART_VLR_VENTA));
      *  if (orderAmount == null) return;
      *
      *  grandTotalOrderAmount = Convert.ToDecimal(e.GetRowGrandTotal(PivotGridFieldPART_VLR_VENTA));
      *  if (grandTotalOrderAmount == 0) return;
      *  decimal perc = Convert.ToDecimal(orderAmount) / grandTotalOrderAmount;
      *
      *  e.DisplayText = string.Format("{0:p2}", perc);
      *
      *  orderAmount = null;
      *  grandTotalOrderAmount = 0;
      * }
      *
      * // calcular la participacion
      * if (object.ReferenceEquals(e.DataField, pivotGrid.Fields["PivotGridFieldPART_CANTIDAD"]))
      * {
      *  DevExpress.Web.ASPxPivotGrid.PivotGridField PivotGridFieldPART_CANTIDAD = pivotGrid.Fields["PivotGridFieldPART_CANTIDAD"];
      *  orderAmount = (e.GetCellValue(PivotGridFieldPART_CANTIDAD));
      *  if (orderAmount == null) return;
      *
      *  grandTotalOrderAmount = Convert.ToDecimal(e.GetRowGrandTotal(PivotGridFieldPART_CANTIDAD));
      *  if (grandTotalOrderAmount == 0) return;
      *  decimal perc = Convert.ToDecimal(orderAmount) / grandTotalOrderAmount;
      *
      *  e.DisplayText = string.Format("{0:p2}", perc);
      *
      *  orderAmount = null;
      *  grandTotalOrderAmount = 0;
      * }
      *
      * // calcular la participacion
      * if (object.ReferenceEquals(e.DataField, pivotGrid.Fields["PivotGridFieldPART_Profit"]))
      * {
      *  DevExpress.Web.ASPxPivotGrid.PivotGridField PivotGridFieldPART_Profit = pivotGrid.Fields["PivotGridFieldPART_Profit"];
      *  orderAmount = (e.GetCellValue(PivotGridFieldPART_Profit));
      *  if (orderAmount == null) return;
      *
      *  grandTotalOrderAmount = Convert.ToDecimal(e.GetRowGrandTotal(PivotGridFieldPART_Profit));
      *  if (grandTotalOrderAmount == 0) return;
      *  decimal perc = Convert.ToDecimal(orderAmount) / grandTotalOrderAmount;
      *
      *  e.DisplayText = string.Format("{0:p2}", perc);
      *
      *  orderAmount = null;
      *  grandTotalOrderAmount = 0;
      * }
      */
 }
Exemple #2
0
        protected void ASPxPivotGrid1_CustomCellDisplayText(object sender, DevExpress.Web.ASPxPivotGrid.PivotCellDisplayTextEventArgs e)
        {
            if (e.DataField.FieldName != "Custom")
            {
                return;
            }
            bool           percentOfRow = mode == "PercentOfRow";
            ASPxPivotGrid  pivot        = sender as ASPxPivotGrid;
            PivotGridField dField       = pivot.Fields["Quantity"];
            object         n            = e.GetCellValue(dField);

            if (n == null)
            {
                return;
            }
            object v = e.GetCellValue(
                GetFieldValues(e.GetColumnFields(), e, (percentOfRow ? 1 : 0)),
                GetFieldValues(e.GetRowFields(), e, (percentOfRow ? 0 : 1)),
                dField);

            v             = (Convert.ToDecimal(v) == 0) ? 1 : (Convert.ToDecimal(n) / Convert.ToDecimal(v));
            e.DisplayText = string.Format("{0:p0}", v);
        }
Exemple #3
0
 protected void pivotM_CustomCellDisplayText(object sender, DevExpress.Web.ASPxPivotGrid.PivotCellDisplayTextEventArgs e)
 {
 }