private void gridView1_CustomSummaryCalculate(object sender, CustomSummaryEventArgs e) { GridColumnSummaryItem item = e.Item as GridColumnSummaryItem; int summaryID = Convert.ToInt32((e.Item as GridSummaryItem).Tag); GridView view = sender as GridView;//if (Equals("Sum", item.Tag)) //{ if (e.SummaryProcess == CustomSummaryProcess.Start) validRowCount = 0; if (e.SummaryProcess == CustomSummaryProcess.Calculate) { // returnamt = decimal.Parse(view.GetRowCellValue(e.RowHandle, "RETURNAMT").ToString()); validRowCount = decimal.Parse(view.GetRowCellValue(e.RowHandle, "SDISC").ToString()); totalamt = decimal.Parse(view.GetRowCellValue(e.RowHandle, "NETAMT").ToString()); //if (!Convert.ToBoolean(view.GetRowCellValue(e.RowHandle, "NETAMT"))) validRowCount = ++; } if (e.SummaryProcess == CustomSummaryProcess.Finalize) { switch (summaryID) { case 1: e.TotalValue = totalamt; break; case 2: if (totalamt - validRowCount > 0) e.TotalValue = "Discount Amount " + (validRowCount).ToString("n2"); break; } } //} }
protected void ASPxGridView1_CustomSummaryCalculate(object sender, CustomSummaryEventArgs e) { string summaryTAG = (e.Item as ASPxSummaryItem).Tag; if (e.SummaryProcess == CustomSummaryProcess.Start) { totalSumUnitPrice = 0; totalSumUnitsInStock = 0; } else if (e.SummaryProcess == CustomSummaryProcess.Calculate) { totalSumUnitPrice += Convert.ToDecimal(e.GetValue("UnitPrice")); totalSumUnitsInStock += Convert.ToDecimal(e.GetValue("UnitsInStock")); } else if (e.SummaryProcess == CustomSummaryProcess.Finalize) { switch (summaryTAG) { case "Item_A": e.TotalValue = totalSumUnitPrice; break; case "Item_B": e.TotalValue = totalSumUnitPrice * totalSumUnitsInStock; break; } } }
protected override void Tablo_CustomSummaryCalculate(object sender, CustomSummaryEventArgs e) { if (e.SummaryProcess != CustomSummaryProcess.Finalize) { return; } var item = (GridSummaryItem)e.Item; if (item.FieldName != "colTahsilatOrani") { return; } { if (e.IsGroupSummary) { var odemelerToplami = Convert.ToDecimal(Tablo.GetGroupSummaryValue(e.GroupRowHandle, (GridGroupSummaryItem)Tablo.GroupSummary["NetOdeme"])); var tahsilatlarToplami = Convert.ToDecimal(Tablo.GetGroupSummaryValue(e.GroupRowHandle, (GridGroupSummaryItem)Tablo.GroupSummary["Tahsil"])); e.TotalValue = odemelerToplami == 0 ? 0 : tahsilatlarToplami / odemelerToplami * 100; } else if (e.IsTotalSummary) { var odemelerToplami = Convert.ToDecimal(colNetOdeme.SummaryItem.SummaryValue); var tahsilatlarToplami = Convert.ToDecimal(colTahsilEdilen.SummaryItem.SummaryValue); e.TotalValue = odemelerToplami == 0 ? 0 : tahsilatlarToplami / odemelerToplami * 100; } } }
// ... void OnCalculateCustomSummary(object sender, CustomSummaryEventArgs e) { if (e.FieldName.ToString() == "Shipped") { if (e.IsTotalSummary) { if (e.SummaryProcess == CustomSummaryProcess.Start) { count = 0; } if (e.SummaryProcess == CustomSummaryProcess.Calculate) { if (!(bool)e.FieldValue) { count++; } e.TotalValue = count; } } } /*grid.SortMode = GridSortMode.Multiple; * * grid.Columns["Product.Name"].SortOrder = DevExpress.Data.ColumnSortOrder.Descending; * grid.Columns["Product.Name"].SortIndex = 0; * * grid.Columns["Quantity"].SortOrder = DevExpress.Data.ColumnSortOrder.Ascending; * grid.Columns["Quantity"].SortIndex = 1; * * grid.Columns["Shipped"].AllowSort = DevExpress.Utils.DefaultBoolean.False;*/ }
private void Orders_OnCustomSummary(object sender, CustomSummaryEventArgs e) { if (((GridSummaryItem)e.Item).FieldName == "IsSellOrder") { if (e.SummaryProcess == CustomSummaryProcess.Start) { _sellOrders = 0; } else if (e.SummaryProcess == CustomSummaryProcess.Calculate && (bool)e.FieldValue) { ++_sellOrders; e.TotalValue = _sellOrders; } } if (((GridSummaryItem)e.Item).FieldName == "IsBuyOrder") { if (e.SummaryProcess == CustomSummaryProcess.Start) { _buyOrders = 0; } else if (e.SummaryProcess == CustomSummaryProcess.Calculate && (bool)e.FieldValue) { ++_buyOrders; e.TotalValue = _buyOrders; } } }
void OnCalculateCustomSummary(object sender, CustomSummaryEventArgs e) { IRowData x = grid.GetRow(grid.SelectedRowHandle);; Page2Class selectedOrder = x.DataObject as Page2Class; string JP = selectedOrder.JP; if (e.FieldName == "JP") { if (e.IsTotalSummary) { if (e.SummaryProcess == CustomSummaryProcess.Start) { count = 0; } if (e.SummaryProcess == CustomSummaryProcess.Calculate) { if (JP == "TD") { count++; } e.TotalValue = count; } } } }
private void gbList_CustomSummaryCalculate(object sender, CustomSummaryEventArgs e) { int num = Convert.ToInt32((e.Item as GridSummaryItem).Tag); if (e.SummaryProcess == CustomSummaryProcess.Start) { this.x_OEmployeeCode = ""; this.x_TotalHour = 0; } if (e.SummaryProcess == CustomSummaryProcess.Calculate) { string str = this.gbList.GetRowCellValue(e.RowHandle, "EmployeeCode").ToString(); if (str != this.x_OEmployeeCode) { if (num == 0) { this.x_TotalHour += Convert.ToDouble(e.FieldValue); } } this.x_OEmployeeCode = str; } if (e.SummaryProcess == CustomSummaryProcess.Finalize) { if (num == 0) { e.TotalValue = this.x_TotalHour; } } }
protected override void Tablo_CustomSummaryCalculate(object sender, CustomSummaryEventArgs e) { if (e.SummaryProcess != CustomSummaryProcess.Finalize) { return; } var item = (GridSummaryItem)e.Item; if (item.FieldName != "IndirimOrani") { return; } //Grup toplami için hesaplama if (e.IsGroupSummary) { var hizmetlerToplami = Convert.ToDecimal(Tablo.GetGroupSummaryValue(e.GroupRowHandle, (GridGroupSummaryItem)Tablo.GroupSummary["NetHizmet"])); var indirimlerToplami = Convert.ToDecimal(Tablo.GetGroupSummaryValue(e.GroupRowHandle, (GridGroupSummaryItem)Tablo.GroupSummary["NetIndirim"])); e.TotalValue = hizmetlerToplami == 0 ? 0 : indirimlerToplami / hizmetlerToplami * 100; } else if (e.IsTotalSummary) { var hizmetlerToplami = Convert.ToDecimal(colNetHizmet.SummaryItem.SummaryValue); var indirimlerToplami = Convert.ToDecimal(colNetIndirim.SummaryItem.SummaryValue); e.TotalValue = hizmetlerToplami == 0 ? 0 : indirimlerToplami / hizmetlerToplami * 100; } }
void grid_CustomSummary(object sender, CustomSummaryEventArgs e) { if(((GridSummaryItem)e.Item).FieldName != "Number") return; if(e.IsTotalSummary) { if(e.SummaryProcess == CustomSummaryProcess.Start) { emptyCellsTotalCount = 0; } if(e.SummaryProcess == CustomSummaryProcess.Calculate) { int? val = (int?)e.FieldValue; if(!val.HasValue) emptyCellsTotalCount++; e.TotalValue = emptyCellsTotalCount; } } if(e.IsGroupSummary) { if(e.SummaryProcess == CustomSummaryProcess.Start) { emptyCellsGroupCount = 0; } if(e.SummaryProcess == CustomSummaryProcess.Calculate) { int? val = (int?)e.FieldValue; if(!val.HasValue) emptyCellsGroupCount++; e.TotalValue = emptyCellsGroupCount; } } }
private void gridView1_CustomSummaryCalculate(object sender, CustomSummaryEventArgs e) { try { // Initialization if (e.SummaryProcess == CustomSummaryProcess.Start) { totalCount = 0; } // Calculation if (e.SummaryProcess == CustomSummaryProcess.Calculate) { totalCount++; } // Finalization if (e.SummaryProcess == CustomSummaryProcess.Finalize) { e.TotalValue = totalCount; } } catch { Debug.Assert(false, "Error creating custom summaries"); } }
void AssociatedObject_CustomSummary(object sender, CustomSummaryEventArgs e) { if (SummaryItemAdded == null || SummaryItemRemoved == null || SummaryItemChanged == null || SummaryItemRenamed == null) { return; } if (!e.IsTotalSummary) { return; } switch (e.SummaryProcess) { case CustomSummaryProcess.Start: e.TotalValue = 0; return; case CustomSummaryProcess.Calculate: if (!(e.FieldValue is FileChangeMode)) { return; } switch ((FileChangeMode)e.FieldValue) { case FileChangeMode.New: if (e.Item == SummaryItemAdded) { IncrementSummaryValue(e); } return; case FileChangeMode.Deleted: if (e.Item == SummaryItemRemoved) { IncrementSummaryValue(e); } return; case FileChangeMode.Modified: if (e.Item == SummaryItemChanged) { IncrementSummaryValue(e); } return; case FileChangeMode.Renamed: if (e.Item == SummaryItemRenamed) { IncrementSummaryValue(e); } return; } return; case CustomSummaryProcess.Finalize: ((GridSummaryItem)e.Item).Visible = (int)e.TotalValue > 0; return; } }
private void depositsView_CustomSummaryCalculate(object sender, CustomSummaryEventArgs e) { if (depositsView.GroupedColumns[e.GroupLevel].FieldName == "Account") { if (e.SummaryProcess == CustomSummaryProcess.Finalize) { var account = (string)depositsView.GetGroupRowValue(e.GroupRowHandle); e.TotalValue = Program.Table <Payment>().Rows.Where(p => p.Account == account && p.Deposit == null && p.NeedsDeposit).Sum(p => p.Amount); } } }
private void GridControl_OnCustomSummary(object sender, CustomSummaryEventArgs e) { if (((GridSummaryItem)e.Item).FieldName != "Id") { return; } if (e.IsTotalSummary && e.SummaryProcess == CustomSummaryProcess.Finalize) { e.TotalValue = GridControl.SelectedItems.Count; } }
protected void gridCustomers_CustomSummaryCalculate(object sender, CustomSummaryEventArgs e) { ASPxSummaryItem item = e.Item as ASPxSummaryItem; if (item.FieldName == "Country") { if (e.SummaryProcess == CustomSummaryProcess.Finalize) { e.TotalValue = e.FieldValue.ToString(); } } }
protected void grid1_CustomSummaryCalculate(object sender, CustomSummaryEventArgs e) { //ASPxSummaryItem item = e.Item as ASPxSummaryItem; //if (item.FieldName == "YCBLL") //{ // //if (e.SummaryProcess == CustomSummaryProcess.Finalize) // // e.TotalValue = e.FieldValue.ToString(); //} }
public void Calculate(CustomSummaryEventArgs e) { if (e.SummaryProcess == CustomSummaryProcess.Start) { _validRowCount = 0; } if (e.SummaryProcess == CustomSummaryProcess.Calculate) { _validRowCount++; } if (e.SummaryProcess == CustomSummaryProcess.Finalize) { e.TotalValue = _validRowCount; } }
void GridViewOnCustomSummaryCalculate(object sender, CustomSummaryEventArgs e) { var item = ((GridColumnSummaryItem)e.Item); if (item.Tag is IModelGridViewRuleCustomSummaryCalculate rule) { var ruleCollector = new RuleCollector(View.Model); var customSummaryCalculateEvent = ruleCollector.CreateInstance <ICustomSummaryCalculateEvent>(Frame, rule.Controller); if (e.SummaryProcess == CustomSummaryProcess.Calculate && !CriteriaOperator.Parse(rule.Criteria).Fit(((GridView)sender).GetRow(e.RowHandle))) { return; } customSummaryCalculateEvent.Calculate(e); } }
protected override void Tablo_CustomSummaryCalculate(object sender, CustomSummaryEventArgs e) { if (e.SummaryProcess != CustomSummaryProcess.Finalize) { return; } var item = (GridSummaryItem)e.Item; if (item.FieldName == "colIndirimOrani") { if (e.IsGroupSummary) { var hizmetlerToplami = Convert.ToDecimal(tablo.GetGroupSummaryValue(e.GroupRowHandle, (GridGroupSummaryItem)tablo.GroupSummary["NetHizmet"])); var indirimlerToplami = Convert.ToDecimal(tablo.GetGroupSummaryValue(e.GroupRowHandle, (GridGroupSummaryItem)tablo.GroupSummary["NetIndirim"])); e.TotalValue = hizmetlerToplami == 0 ? 0 : indirimlerToplami / hizmetlerToplami * 100; } else if (e.IsTotalSummary) { var hizmetlerToplami = Convert.ToDecimal(colNetHizmet.SummaryItem.SummaryValue); var indirimlerToplamı = Convert.ToDecimal(colNetIndirim.SummaryItem.SummaryValue); e.TotalValue = hizmetlerToplami == 0 ? 0 : indirimlerToplamı / hizmetlerToplami * 100; } } if (item.FieldName != "colOrtalama") { return; } { if (e.IsGroupSummary) { var toplamKayit = Convert.ToDecimal(tablo.GetGroupSummaryValue(e.GroupRowHandle, (GridGroupSummaryItem)tablo.GroupSummary["ToplamKayit"])); var netUcret = Convert.ToDecimal(tablo.GetGroupSummaryValue(e.GroupRowHandle, (GridGroupSummaryItem)tablo.GroupSummary["NetUcret"])); e.TotalValue = toplamKayit == 0 ? 0 : netUcret / toplamKayit; } else if (e.IsTotalSummary) { var toplamKayit = Convert.ToDecimal(colToplamKayit.SummaryItem.SummaryValue); var netUcret = Convert.ToDecimal(colNetUcret.SummaryItem.SummaryValue); e.TotalValue = toplamKayit == 0 ? 0 : netUcret / toplamKayit; } } }
//tinh tong OrderAmount trong DridView private void grvOrder_CustomSummaryCalculate(object sender, CustomSummaryEventArgs e) { GridView view = sender as GridView; // Get the summary ID. int summaryID = Convert.ToInt32((e.Item as GridSummaryItem).Tag); // Initialization. if (e.SummaryProcess == CustomSummaryProcess.Start) { //discontinuedProductsCount = 0; if (summaryID == 1 && GlobalVariable.newOrUpdateOrderBook == true) { orderAmount = 0; } } // Calculation. if (e.SummaryProcess == CustomSummaryProcess.Calculate) { switch (summaryID) { case 1: // The total summary calculated against the 'UnitPrice' column. double unitsInStock = Convert.ToDouble(view.GetRowCellValue(e.RowHandle, "QtyKg")); orderAmount += Math.Round(Convert.ToDouble(e.FieldValue), 3); break; //case 2: // The group summary. //maxOrderSize //break; } } // Finalization. if (e.SummaryProcess == CustomSummaryProcess.Finalize) { switch (summaryID) { case 1: orderAmount = orderAmount + (1 * numOfOrderSize); e.TotalValue = orderAmount; break; //case 2: // maxOrderSize = Math.Round(((25 - (1 * numOfOrderSize)) / shotWeight) - 20, 3); // e.TotalValue = maxOrderSize; // break; } } }
void gridControl_CustomSummary(object sender, CustomSummaryEventArgs e) { if (object.Equals(e.SummaryProcess, CustomSummaryProcess.Start)) { sum = 0; } if (e.SummaryProcess == CustomSummaryProcess.Calculate) { if (gridControl.IsCellSelected(e.RowHandle, gridControl.Columns[((GridSummaryItem)e.Item).FieldName])) { sum += (int)e.FieldValue; } } if (e.SummaryProcess == CustomSummaryProcess.Finalize) { e.TotalValue = sum; } }
private void gridView_CustomSummaryCalculate(object sender, CustomSummaryEventArgs e) { switch (e.SummaryProcess) { case CustomSummaryProcess.Start: e.TotalValue = 0; break; case CustomSummaryProcess.Calculate: e.TotalValue = (int)e.TotalValue + 1; break; case CustomSummaryProcess.Finalize: e.TotalValue = RaffleTicket.CalcPrice((int)e.TotalValue); e.TotalValueReady = true; break; } }
void OnCalculateCustomSummary(object sender, CustomSummaryEventArgs e) { if (e.FieldName == "Total" && e.IsTotalSummary) { if (e.SummaryProcess == CustomSummaryProcess.Start) { e.TotalValue = 0.0; } else if (e.SummaryProcess == CustomSummaryProcess.Calculate) { double value = Convert.ToDouble(e.FieldValue); if (value > 100.0) { e.TotalValue = Convert.ToDouble(e.TotalValue) + value; } } } }
void OnCustomSummary(object sender, CustomSummaryEventArgs e) { if (((GridSummaryItem)e.Item).FieldName != "Number") { return; } if (e.SummaryProcess == CustomSummaryProcess.Start) { e.TotalValue = 0; } if (e.SummaryProcess == CustomSummaryProcess.Calculate) { if (IsEmptyCell(e.FieldValue)) { e.TotalValue = (int)e.TotalValue + 1; } } }
public void CustomSummary(CustomSummaryEventArgs e) { if (e.IsTotalSummary || e.IsGroupSummary) { if (e.SummaryProcess == CustomSummaryProcess.Start) { cumulativePrincipalUnits = 0; cumulativeCurrentUnits = 0; } if (e.SummaryProcess == CustomSummaryProcess.Calculate) { if (((GridSummaryItem)e.Item).FieldName == "TOTAL_EARNED_PERCENTAGE") { decimal budgetedUnits = ((PROGRESS_ITEMProjection)e.Row).BASELINE_ITEMJoinRATE.BASELINE_ITEM.TOTAL_HOURS; decimal previousUnits = ((PROGRESS_ITEMProjection)e.Row).PROGRESS_ITEMSBeforeReportingDate.Sum(x => x.EARNED_UNITS); decimal currentUnits = ((PROGRESS_ITEMProjection)e.Row).PROGRESS_ITEMCurrent == null ? 0 : ((PROGRESS_ITEMProjection)e.Row).PROGRESS_ITEMCurrent.EARNED_UNITS; cumulativePrincipalUnits += budgetedUnits; cumulativeCurrentUnits += (currentUnits + previousUnits); if (cumulativePrincipalUnits > 0) { e.TotalValue = (cumulativeCurrentUnits / cumulativePrincipalUnits); } } else if (((GridSummaryItem)e.Item).FieldName == "PERIOD_EARNED_PERCENTAGE") { decimal totalUnits = ((PROGRESS_ITEMProjection)e.Row).BASELINE_ITEMJoinRATE.BASELINE_ITEM.TOTAL_HOURS; decimal currentUnits = ((PROGRESS_ITEMProjection)e.Row).PROGRESS_ITEMCurrent == null ? 0 : ((PROGRESS_ITEMProjection)e.Row).PROGRESS_ITEMCurrent.EARNED_UNITS; cumulativePrincipalUnits += totalUnits; cumulativeCurrentUnits += currentUnits; if (cumulativePrincipalUnits > 0) { e.TotalValue = (cumulativeCurrentUnits / cumulativePrincipalUnits); } } else { e.TotalValue = 0; } } } }
private void WhMatGridView_CustomSummaryCalculate(object sender, CustomSummaryEventArgs e) { if (e.SummaryProcess == CustomSummaryProcess.Finalize && wh_mat_list != null) { var def_m = DBHelper.MeasuresList.FirstOrDefault(w => w.Def == 1); GridSummaryItem item = e.Item as GridSummaryItem; if (item.FieldName == "Remain") { var amount_sum = wh_mat_list.Where(w => w.MId == def_m.MId).Sum(s => s.Remain ?? 0); /* var ext_sum = _db.WaybillDet.Where(w => w.WbillId == _wbill_id && w.Materials.MId != def_m.MId) * .Select(s => new { MaterialMeasures = s.Materials.MaterialMeasures.Where(f => f.MId == def_m.MId), s.Amount }).ToList() * .SelectMany(sm => sm.MaterialMeasures, (k, n) => new { k.Amount, MeasureAmount = n.Amount }).Sum(su => su.MeasureAmount * su.Amount);*/ e.TotalValue = amount_sum.ToString() + " " + def_m.ShortName;//Math.Round(amount_sum + ext_sum, 2); } } }
private void bgvKardex_CustomSummaryCalculate(object sender, CustomSummaryEventArgs e) { var item = e.Item as GridColumnSummaryItem; if (item == null || item.FieldName != "stock") { return; } decimal inicial = (decimal)bgvKardex.Columns["inicial"].SummaryItem.SummaryValue; decimal entrada = (decimal)bgvKardex.Columns["entrada"].SummaryItem.SummaryValue; decimal salida = (decimal)bgvKardex.Columns["salida"].SummaryItem.SummaryValue; if (e.SummaryProcess == CustomSummaryProcess.Finalize) { e.TotalValue = inicial + entrada - salida; } }
private void OnCalculateCustomSummary(object sender, CustomSummaryEventArgs e) { if (e.FieldName.ToString() == "Shipped") { if (e.IsTotalSummary) { if (e.SummaryProcess == CustomSummaryProcess.Start) { count = 0; } if (e.SummaryProcess == CustomSummaryProcess.Calculate) { if (!(bool)e.FieldValue) { count++; } e.TotalValue = count; } } } }
//CustomSumaryCalculate Event GridView private void grvMaterialConsumption_CustomSummaryCalculate(object sender, CustomSummaryEventArgs e) { GridView view = sender as GridView; // Get the summary ID. int summaryID = Convert.ToInt32((e.Item as GridSummaryItem).Tag); // Initialization. if (e.SummaryProcess == CustomSummaryProcess.Start) { //discontinuedProductsCount = 0; if (summaryID == 1) { totalMaterialConsumtion = 0; } } // Calculation. if (e.SummaryProcess == CustomSummaryProcess.Calculate) { switch (summaryID) { case 1: // The total summary calculated against the 'UnitPrice' column. double unitsInStock = Convert.ToDouble(view.GetRowCellValue(e.RowHandle, "ActualUsage")); totalMaterialConsumtion += Math.Round(Convert.ToDouble(e.FieldValue), 3); break; } } // Finalization. if (e.SummaryProcess == CustomSummaryProcess.Finalize) { switch (summaryID) { case 1: e.TotalValue = totalMaterialConsumtion; break; } } }
//private void btnBrowse_Click(object sender, EventArgs e) //{ // if (openFileDialog1.ShowDialog() == DialogResult.Cancel) // return; // pictureBox1.ImageLocation = openFileDialog1.FileName; //} //string copyPictuer(string sourcefile, string key) //{ // if (sourcefile == "") // return null; // string curentPath; // string newPath; // curentPath = Application.StartupPath + @"\image\"; // if (Directory.Exists(curentPath) == false) // { // Directory.CreateDirectory(curentPath); // } // newPath = curentPath + key + sourcefile.Substring(sourcefile.LastIndexOf(".")); // if (File.Exists(newPath)) // { // File.Delete(newPath); // } // File.Copy(sourcefile, newPath); // return newPath; //} //private Region r = new Region(); //private void pictureBox1_Click(object sender, EventArgs e) //{ // if (pictureBox1.SizeMode == PictureBoxSizeMode.StretchImage) // { // r = pictureBox1.Region; // pictureBox1.SizeMode = PictureBoxSizeMode.AutoSize; // } // else // { // pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage; // pictureBox1.Region = r; // } //} //private void pictureBox1_MouseLeave(object sender, EventArgs e) //{ // pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage; // pictureBox1.Region = r; //} //private void pictureBox1_MouseMove(object sender, MouseEventArgs e) //{ // r = pictureBox1.Region; // pictureBox1.SizeMode = PictureBoxSizeMode.AutoSize; //} #endregion public static void gridView_CustomSummaryCalculate(object sender, CustomSummaryEventArgs e, GridView gridView1, string Bed = "Bed", string Bes = "Bes", string Mande = "Mande") { if (gridView1.RowCount == 0) { return; } decimal SumBed = Convert.ToDecimal(gridView1.Columns[Bed].SummaryItem.SummaryValue); decimal SumBes = Convert.ToDecimal(gridView1.Columns[Bes].SummaryItem.SummaryValue); decimal _Mande = SumBed - SumBes; var item = e.Item as GridColumnSummaryItem; if (item == null || item.FieldName != Mande) { return; } if (e.SummaryProcess == CustomSummaryProcess.Finalize) { e.TotalValue = _Mande; } }
private void grdViewPay_CustomSummaryCalculate(object sender, CustomSummaryEventArgs e) { int lCount = 0; decimal Tot = 0; if (m_sType == "F") { if (((DevExpress.XtraGrid.GridSummaryItem)e.Item).FieldName == "Amount") { if (grdViewPay.RowCount > 0) { for (lCount = 0; lCount < grdViewPay.RowCount; lCount++) { if (CommFun.IsNullCheck(grdViewPay.GetRowCellValue(lCount, "QualifierName"), CommFun.datatypes.vartypestring).ToString() == "PaidNetAmount") { Tot = (Tot + Convert.ToDecimal(grdViewPay.GetRowCellValue(lCount, "Amount"))); } } } e.TotalValue = Tot; } } }
private static void Gridview_CustomSummaryCalculate(object sender, CustomSummaryEventArgs e) { GridView _view = sender as GridView; switch (((GridSummaryItem)e.Item).FieldName) { case "Hab": switch (e.SummaryProcess) { case CustomSummaryProcess.Start: break; case CustomSummaryProcess.Calculate: e.TotalValue = Convert.ToInt32(e.TotalValue) + Convert.ToInt32(e.FieldValue); break; case CustomSummaryProcess.Finalize: break; } break; case "AreaLocal": switch (e.SummaryProcess) { case CustomSummaryProcess.Start: break; case CustomSummaryProcess.Calculate: e.TotalValue = Convert.ToDecimal(e.TotalValue) + Convert.ToDecimal(e.FieldValue); break; case CustomSummaryProcess.Finalize: break; } break; } }
private void depositsView_CustomSummaryCalculate(object sender, CustomSummaryEventArgs e) { if (depositsView.GroupedColumns[e.GroupLevel].FieldName == "Account") { if (e.SummaryProcess == CustomSummaryProcess.Finalize) { var account = (string)depositsView.GetGroupRowValue(e.GroupRowHandle); e.TotalValue = Program.Table<Payment>().Rows.Where(p => p.Account == account && p.Deposit == null && p.NeedsDeposit).Sum(p => p.Amount); } } }
void OnCalculateCustomSummary(object sender, CustomSummaryEventArgs e) { if (e.FieldName == "Total" && e.IsTotalSummary) { if (e.SummaryProcess == CustomSummaryProcess.Start) { e.TotalValue = 0.0; } else if (e.SummaryProcess == CustomSummaryProcess.Calculate) { double value = Convert.ToDouble(e.FieldValue); if (value > 100.0) e.TotalValue = Convert.ToDouble(e.TotalValue) + value; } } }
void OnCalculateCustomSummary(object sender, CustomSummaryEventArgs e){ if (e.FieldName.ToString () == "Shipped") if (e.IsTotalSummary){ if (e.SummaryProcess == CustomSummaryProcess.Start) { count = 0; } if (e.SummaryProcess == CustomSummaryProcess.Calculate) { if (!(bool)e.FieldValue) count++; e.TotalValue = count; } } }
private void bandedGridView1_CustomSummaryCalculate(object sender, CustomSummaryEventArgs e) { decimal validRowCount = 0; decimal totalamt = 0; decimal opening = 0; bool isfrist = true; GridColumnSummaryItem item = e.Item as GridColumnSummaryItem; int summaryID = Convert.ToInt32((e.Item as GridSummaryItem).Tag); GridView view = sender as GridView; ////if (Equals("Sum", item.Tag)) ////{ //if (e.SummaryProcess == DevExpress.Data.CustomSummaryProcess.Start) // validRowCount = 0; if (e.SummaryProcess == CustomSummaryProcess.Calculate) { validRowCount = decimal.Parse(view.GetRowCellValue(e.RowHandle, "Available").ToString()); if (opening == 0 && isfrist) { opening = decimal.Parse(view.GetRowCellValue(e.RowHandle, "Opening").ToString()); isfrist = false; } //if (!Convert.ToBoolean(view.GetRowCellValue(e.RowHandle, "NETAMT"))) validRowCount = ++; } if (e.SummaryProcess == CustomSummaryProcess.Finalize) { switch (summaryID) { case 1: e.TotalValue = (validRowCount).ToString("n2");; break; case 4: e.TotalValue = (opening).ToString("n2");; // if(totalamt -validRowCount > 0) // e.TotalValue = "Discount Amount " + (totalamt - validRowCount).ToString("n2"); break; } } }
private void gridView1_CustomSummaryCalculate(object sender, CustomSummaryEventArgs e) { GridColumnSummaryItem item = e.Item as GridColumnSummaryItem; int summaryID = Convert.ToInt32((e.Item as GridSummaryItem).Tag); GridView view = sender as GridView; //if (Equals("Sum", item.Tag)) //{ if (e.SummaryProcess == CustomSummaryProcess.Start) { totsprice = 0; totcprice = 0; phystock = 0; } if (e.SummaryProcess == CustomSummaryProcess.Calculate) { phystock = decimal.Parse(view.GetRowCellValue(e.RowHandle, "PHYSICALSTOCK").ToString()); totsprice += phystock * decimal.Parse(view.GetRowCellValue(e.RowHandle, "SPRICE").ToString()); totcprice += phystock * decimal.Parse(view.GetRowCellValue(e.RowHandle, "CPRICE").ToString()); //totsprice += decimal.Parse(view.GetRowCellValue(e.RowHandle, "SPRICE").ToString()); //totcprice += decimal.Parse(view.GetRowCellValue(e.RowHandle, "CPRICE").ToString()); //if (!Convert.ToBoolean(view.GetRowCellValue(e.RowHandle, "NETAMT"))) validRowCount = ++; } if (e.SummaryProcess == CustomSummaryProcess.Finalize) { switch (summaryID) { case 1: e.TotalValue = "Total Cost = " + (totcprice.ToString("#,#.00")) + " Total Sales = " + (totsprice.ToString("#,#.00")) + ""; _SummaryText = "Total Cost = " + (totcprice.ToString("#,#.00")) + " Total Sales = " + (totsprice.ToString("#,#.00")) + ""; break; } } }
void gridView1_CustomSummaryCalculate(object sender, CustomSummaryEventArgs e) { //if (e.IsGroupSummary) // { // GridGroupSummaryItem item = e.Item as GridGroupSummaryItem; // GridColumn c = gridView1.Columns[item.FieldName]; // if (c.Tag != null && c.Tag.ToString() == "SUM") return; // int level = e.GroupLevel; // } }
private void gridViewData_CustomSummaryCalculate(object sender, CustomSummaryEventArgs e) { if (!e.IsTotalSummary || e.SummaryProcess != CustomSummaryProcess.Finalize) return; if (e.Item == gridColumnGroup.SummaryItem) e.TotalValue = _quizCount; }
private void GvRateHierDrawings_CustomSummaryCalculate(object sender, CustomSummaryEventArgs e) { var draw = e.Row as HierarchyNumberDrawing; if (draw != null) { if (e.FieldValue != null) { if (e.TotalValue == null) e.TotalValue = decimal.Zero; e.TotalValue = (decimal)e.TotalValue + (decimal) e.FieldValue * draw.CountAll; } } }