private void pivotGridControl1_CustomSummary(object sender, DevExpress.XtraPivotGrid.PivotGridCustomSummaryEventArgs e) { if (e.ColumnField == null) { e.CustomValue = e.SummaryValue.Summary; } }
private void pivotGridControl1_CustomSummary(object sender, DevExpress.XtraPivotGrid.PivotGridCustomSummaryEventArgs e) { if (e.DataField != fieldPercentualeCopertura1) { return; } if (ReferenceEquals(e.ColumnField, null) || ReferenceEquals(e.RowField, null)) { //this is Grand Total cell e.CustomValue = (decimal)e.SummaryValue.Summary / ressourceCount; return; } DevExpress.XtraPivotGrid.PivotGridControl pivot = sender as DevExpress.XtraPivotGrid.PivotGridControl; int lastRowFieldIndex = pivot.Fields.GetVisibleFieldCount(DevExpress.XtraPivotGrid.PivotArea.RowArea) - 1; int lastColumnFieldIndex = pivot.Fields.GetVisibleFieldCount(DevExpress.XtraPivotGrid.PivotArea.ColumnArea) - 1; if (e.RowField.AreaIndex == lastRowFieldIndex && e.ColumnField.AreaIndex == lastColumnFieldIndex) { //this is Ordinary cell e.CustomValue = e.SummaryValue.Summary; } else { //this is Total cell e.CustomValue = (decimal)e.SummaryValue.Summary / ressourceCount; } }
private void pivotGridControl1_CustomSummary(object sender, DevExpress.XtraPivotGrid.PivotGridCustomSummaryEventArgs e) { decimal firstn = 0; decimal sumn = 0; PivotDrillDownDataSource ds = e.CreateDrillDownDataSource(); if (e.DataField == filedQcPer) { for (int i = 0; i < ds.RowCount; i++) { PivotDrillDownDataRow row = ds[i]; firstn += Convert.ToDecimal(row[fieldPNGQtyInK1]);; sumn += Convert.ToDecimal(row[fieldinqtyink1]); if (sumn != 0) { e.CustomValue = firstn / sumn; } } } }
private void pivotGridControlBreakHours_CustomSummary(object sender, DevExpress.XtraPivotGrid.PivotGridCustomSummaryEventArgs e) { string field = e.DataField.FieldName; IList list = e.CreateDrillDownDataSource(); if (field == "break_hours") { List <TimeSpan> listHours = new List <TimeSpan>(); foreach (PivotDrillDownDataRow row in list) { listHours.Add(TimeSpan.Parse(row[field].ToString())); } var ts = new TimeSpan(listHours.Sum(t => t.Duration().Ticks)); string total = string.Format("{0:D2}H:{1:D2}M:{2:D2}S", (int)ts.TotalHours, ts.Minutes, ts.Seconds ); e.CustomValue = total; } }
private void pivotGridControl1_CustomSummary(object sender, DevExpress.XtraPivotGrid.PivotGridCustomSummaryEventArgs e) { if (e.DataField.Name == "fieldValue") { PivotDrillDownDataSource ds = e.CreateDrillDownDataSource(); decimal customValue = 0; for (int i = 0; i < ds.RowCount; i++) { object currentType = ds.GetValue(i, "Type"); if (currentType != null && currentType.ToString() == "Outlay") { customValue -= Convert.ToDecimal(ds.GetValue(i, e.DataField)); } else { customValue += Convert.ToDecimal(ds.GetValue(i, e.DataField)); } } e.CustomValue = customValue; } }
private void pivotGridControl1_CustomSummary(object sender, DevExpress.XtraPivotGrid.PivotGridCustomSummaryEventArgs e) { decimal firstn = 0; decimal sumn = 0; PivotDrillDownDataSource ds = e.CreateDrillDownDataSource(); if (e.DataField == colNgQtyPercent) { //报废率 for (int i = 0; i < ds.RowCount; i++) { PivotDrillDownDataRow row = ds[i]; firstn += Convert.ToDecimal(row[fieldInQty1]); //冲压投入 sumn += Convert.ToDecimal(row[fieldNgQty1]); //冲压报废 if (firstn != 0) { e.CustomValue = sumn / firstn; } } } if (e.DataField == colPNGQtyPercent) { //冲压报废率 for (int i = 0; i < ds.RowCount; i++) { PivotDrillDownDataRow row = ds[i]; firstn += Convert.ToDecimal(row[fieldPinqtyink1]) + Convert.ToDecimal(row[fieldPIQCNGQtyInk1]); //冲压投入 sumn += Convert.ToDecimal(row[fieldPNGQtyInK1]) + Convert.ToDecimal(row[fieldPIQCNGQtyInk1]); //冲压报废 if (firstn != 0) { e.CustomValue = sumn / firstn; } } } if (e.DataField == colENGQtyPercent) { //电镀报废率 for (int i = 0; i < ds.RowCount; i++) { PivotDrillDownDataRow row = ds[i]; firstn += Convert.ToDecimal(row[fieldEinqtyink1]) + Convert.ToDecimal(row[fieldEIQCNGQtyInk1]); //投入 sumn += Convert.ToDecimal(row[fieldENGQtyInK1]) + Convert.ToDecimal(row[fieldEIQCNGQtyInk1]); //报废 if (firstn != 0) { e.CustomValue = sumn / firstn; } } } if (e.DataField == colCNGQtyPercent) { //切断报废率pivotGridField19 for (int i = 0; i < ds.RowCount; i++) { PivotDrillDownDataRow row = ds[i]; firstn += Convert.ToDecimal(row[fieldCinqtyink1]) + Convert.ToDecimal(row[fieldCIQCNGQtyInk1]); //投入 sumn += Convert.ToDecimal(row[fieldCNGQtyInK1]) + Convert.ToDecimal(row[fieldCIQCNGQtyInk1]); //报废 if (firstn != 0) { e.CustomValue = sumn / firstn; } } } if (e.DataField == colFNGQtyPercent) {//其他报废率 for (int i = 0; i < ds.RowCount; i++) { PivotDrillDownDataRow row = ds[i]; firstn += Convert.ToDecimal(row[fieldFinqtyink1]) + Convert.ToDecimal(row[fieldFIQCNGQtyInk1]); //投入 sumn += Convert.ToDecimal(row[fieldFNGQtyInK1]) + Convert.ToDecimal(row[fieldFIQCNGQtyInk1]); //报废 if (firstn != 0) { e.CustomValue = sumn / firstn; } } } }
private void pivotGridControl1_CustomSummary(object sender, DevExpress.XtraPivotGrid.PivotGridCustomSummaryEventArgs e) { e.CustomValue = e.CreateDrillDownDataSource().RowCount; }