Exemple #1
0
        void grid_CustomSummary(object sender, DevExpress.Data.CustomSummaryEventArgs e)
        {
            switch (e.SummaryProcess)
            {
            case CustomSummaryProcess.Start:
                this.sum = 0;
                break;

            case CustomSummaryProcess.Calculate:
                if (grid.SelectionMode != MultiSelectMode.None)
                {
                    if (Grid.IsItemSelected(e.RowHandle))
                    {
                        this.sum += (decimal)e.FieldValue;
                    }
                }
                else
                {
                    this.sum += (decimal)e.FieldValue;
                }
                break;

            case CustomSummaryProcess.Finalize:
                e.TotalValue = this.sum;
                break;

            default:
                break;
            }
        }
 private void Purchases_CustomSummary(object sender, DevExpress.Data.CustomSummaryEventArgs e)
 {
     if (((GridSummaryItem)e.Item).FieldName == "总价")
     {
         if (e.IsTotalSummary)
         {
             if (e.SummaryProcess == CustomSummaryProcess.Start)
             {
                 zongjia_sum = 0;
             }
             if (e.SummaryProcess == CustomSummaryProcess.Calculate)
             {
                 if (e.FieldValue != null)
                 {
                     zongjia_sum += double.Parse(e.FieldValue.ToString());
                 }
                 e.TotalValue = zongjia_sum;
             }
             if (e.SummaryProcess == CustomSummaryProcess.Finalize)
             {
                 ((PurchaseViewModel)this.DataContext).应收 = zongjia_sum;
             }
         }
     }
 }
Exemple #3
0
        private void gridView1_CustomSummaryCalculate(object sender, DevExpress.Data.CustomSummaryEventArgs e)
        {
            if (e.Item is GridColumnSummaryItem)
            {
                GridView currentView = sender as GridView;
                GridColumnSummaryItem summaryItem = e.Item as GridColumnSummaryItem;

                // Initialization
                if (e.SummaryProcess == CustomSummaryProcess.Start)
                {
                    summaryCache[summaryItem.FieldName] = 0;
                }
                // Calculation
                if (e.SummaryProcess == CustomSummaryProcess.Calculate)
                {
                    bool needsToCalulate = (bool)currentView.GetRowCellValue(e.RowHandle, currentView.Columns["Selected"]);
                    if (needsToCalulate)
                    {
                        summaryCache[summaryItem.FieldName] += Convert.ToInt32(e.FieldValue);
                    }
                }
                // Finalization
                if (e.SummaryProcess == CustomSummaryProcess.Finalize)
                {
                    e.TotalValue = summaryCache[summaryItem.FieldName];
                }
            }
        }
Exemple #4
0
        private void WaybillDetOutGridView_CustomSummaryCalculate(object sender, DevExpress.Data.CustomSummaryEventArgs e)
        {
            if (e.SummaryProcess == CustomSummaryProcess.Finalize)
            {
                var def_m = DBHelper.MeasuresList.FirstOrDefault(w => w.Def == 1);

                GridSummaryItem item = e.Item as GridSummaryItem;

                if (item.FieldName == "MsrName")
                {
                    e.TotalValue = def_m.ShortName;
                }

                if (item.FieldName == "Amount")
                {
                    var amount_sum = _db.WaybillDet.Where(w => w.WbillId == _wbill_id && w.Materials.MId == def_m.MId).ToList().Sum(s => s.Amount);

                    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 = Math.Round(amount_sum + ext_sum, 2);
                }
            }
        }
Exemple #5
0
        private void dgProjectBudgetLinePageGrid_CustomSummary(object sender, DevExpress.Data.CustomSummaryEventArgs e)
        {
            var fieldName = ((GridSummaryItem)e.Item).FieldName;

            switch (e.SummaryProcess)
            {
            case CustomSummaryProcess.Start:
                sumMargin = sumSales = 0d;
                break;

            case CustomSummaryProcess.Calculate:
                var row = e.Row as ProjectBudgetLineLocal;
                if (row != null)
                {
                    sumSales  += row.Sales;
                    sumMargin += row.Margin;
                }
                break;

            case CustomSummaryProcess.Finalize:
                if (fieldName == "MarginRatio" && sumSales > 0)
                {
                    sumMarginRatio = 100 * sumMargin / sumSales;
                    e.TotalValue   = sumMarginRatio;
                }
                break;
            }
        }
Exemple #6
0
        private void DgInvTransGrid_CustomSummary(object sender, DevExpress.Data.CustomSummaryEventArgs e)
        {
            var fieldName = ((GridSummaryItem)e.Item).FieldName;

            switch (e.SummaryProcess)
            {
            case CustomSummaryProcess.Start:
                sumMargin = sumSales = 0d;
                break;

            case CustomSummaryProcess.Calculate:
                var row = e.Row as InvTransClient;
                sumSales  += row.SalesPrice;
                sumMargin += row.Margin;
                break;

            case CustomSummaryProcess.Finalize:
                if (fieldName == "MarginRatio" && sumSales > 0)
                {
                    sumMarginRatio = 100 * sumMargin / sumSales;
                    e.TotalValue   = sumMarginRatio;
                }
                break;
            }
        }
        private void grvListado_CustomSummaryCalculate(object sender, DevExpress.Data.CustomSummaryEventArgs e)
        {
            try
            {
                GridView grvGeneral = sender as GridView;

                // Initialization
                if (e.SummaryProcess == CustomSummaryProcess.Start)
                {
                    varSubtotal = 0;
                    varImpuesto = 0;
                    varTotal    = 0;
                }
                // Calculation
                if (e.SummaryProcess == CustomSummaryProcess.Calculate)
                {
                    if (((DevExpress.XtraGrid.GridSummaryItem)(e.Item)).FieldName.Equals("DetTotal"))
                    {
                        switch (((DevExpress.XtraGrid.GridSummaryItem)(e.Item)).Index)
                        {
                        case 0:
                            varSubtotal = varSubtotal + decimal.Parse(e.FieldValue.ToString());
                            break;

                        case 1:
                            varImpuesto = varImpuesto + (grvGeneral.GetRowCellValue(e.RowHandle, colTaxCodeAP).ToString().Equals("IVA") ? (decimal.Parse(e.FieldValue.ToString()) * (decimal)(varIVA / 100)) : 0);
                            break;

                        case 2:
                            varTotal = varTotal + decimal.Parse(e.FieldValue.ToString()) + (grvGeneral.GetRowCellValue(e.RowHandle, colTaxCodeAP).ToString().Equals("IVA") ? (decimal.Parse(e.FieldValue.ToString()) * (decimal)(varIVA / 100)) : 0);
                            break;
                        }
                    }
                }
                // Finalization
                if (e.SummaryProcess == CustomSummaryProcess.Finalize)
                {
                    if (((DevExpress.XtraGrid.GridSummaryItem)(e.Item)).FieldName.Equals("DetTotal"))
                    {
                        switch (((DevExpress.XtraGrid.GridSummaryItem)(e.Item)).Index)
                        {
                        case 0:
                            e.TotalValue = varSubtotal;
                            break;

                        case 1:
                            e.TotalValue = varImpuesto;
                            break;

                        case 2:
                            e.TotalValue = varTotal;
                            break;
                        }
                    }
                }
            }
            catch (Exception ex) { XtraMessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); }
        }
Exemple #8
0
        private void depoQryGCgridView_CustomSummaryCalculate(object sender, DevExpress.Data.CustomSummaryEventArgs e)
        {
            // Get the summary ID.
            int    summaryID = Convert.ToInt32((e.Item as GridSummaryItem).Tag);
            string summaryFN = (e.Item as GridSummaryItem).FieldName;

            // Initialization
            if (e.SummaryProcess == CustomSummaryProcess.Start)
            {
                if (summaryFN == "GIRMIK")
                {
                    dicGirMik.Clear();
                    topGirMik = 0;
                }
                else if (summaryFN == "GIRSGRDGR")
                {
                    dicSgrDgr.Clear();
                    topSgrDgr = 0;
                }
            }
            // Calculation
            if (e.SummaryProcess == CustomSummaryProcess.Calculate)
            {
                id = (int)depoQryGCgridView.GetRowCellValue(e.RowHandle, colGIRID);

                if (summaryFN == "GIRMIK" && !dicGirMik.ContainsKey(id))
                {
                    dicGirMik.Add(id, Convert.IsDBNull(e.FieldValue) ? 0 : Convert.ToInt32(e.FieldValue));
                }
                else if (summaryFN == "GIRSGRDGR" && !dicSgrDgr.ContainsKey(id))
                {
                    dicSgrDgr.Add(id, Convert.IsDBNull(e.FieldValue) ? 0.0m : Convert.ToDecimal(e.FieldValue));
                }
            }
            // Finalization
            if (e.SummaryProcess == CustomSummaryProcess.Finalize)
            {
                switch (summaryFN)
                {
                case "GIRMIK":
                    foreach (var g in dicGirMik)
                    {
                        topGirMik += g.Value;
                    }
                    e.TotalValue = topGirMik;
                    break;

                case "GIRSGRDGR":     // sgrDgr
                    foreach (var s in dicSgrDgr)
                    {
                        topSgrDgr += s.Value;
                    }
                    e.TotalValue = topSgrDgr;
                    break;
                }
            }
        }
 private void gridView1_CustomSummaryCalculate(object sender, DevExpress.Data.CustomSummaryEventArgs e)
 {
     if (e.IsTotalSummary && e.SummaryProcess == CustomSummaryProcess.Finalize)
     {
         GridView view = sender as GridView;
         if (e.Item == view.Columns["UnitPrice"].SummaryItem)
         {
             e.TotalValue = CustomSummaryHelper.GetWeightedAverage(view, "Quantity", "UnitPrice");
         }
     }
 }
Exemple #10
0
 private void grid_CustomSummary(object sender, DevExpress.Data.CustomSummaryEventArgs e)
 {
     if (e.SummaryProcess == CustomSummaryProcess.Start)
     {
         totalPrice = 0;
     }
     if (e.SummaryProcess == CustomSummaryProcess.Calculate)
     {
         double price    = (double)e.FieldValue;
         int    quantity = (int)e.GetValue("Quantity");
         totalPrice  += price * quantity;
         e.TotalValue = totalPrice;
     }
 }
Exemple #11
0
        protected void GridView_Pagos_CustomSummaryCalculate(object sender, DevExpress.Data.CustomSummaryEventArgs e)
        {
            try
            {
                if (e.SummaryProcess == CustomSummaryProcess.Start)
                {
                    TotalCordobas = 0;
                    TotalDolares  = 0;
                }
                else

                if (e.SummaryProcess == CustomSummaryProcess.Calculate)
                {
                    if (((ASPxSummaryItem)e.Item).Tag == "Cordobas")
                    {
                        if (e.GetValue("Moneda").ToString() == "Córdobas")
                        {
                            TotalCordobas += Convert.ToDecimal(e.FieldValue);
                        }
                    }
                    if (((ASPxSummaryItem)e.Item).Tag == "Dolares")
                    {
                        if (e.GetValue("Moneda").ToString() == "Dólares")
                        {
                            TotalDolares += Convert.ToDecimal(e.FieldValue);
                        }
                    }
                }

                else if (e.SummaryProcess == CustomSummaryProcess.Finalize)
                {
                    if (((ASPxSummaryItem)e.Item).Tag == "Cordobas")
                    {
                        e.TotalValue = TotalCordobas;
                    }
                    if (((ASPxSummaryItem)e.Item).Tag == "Dolares")
                    {
                        e.TotalValue = TotalDolares;
                    }

                    e.TotalValueReady = true;
                }
            }
            catch (Exception Ex)
            {
                FG.Controlador_Error(Ex, Page.Response);
            }
        }
        private void grdVwEx2_CustomSummaryCalculate(object sender, DevExpress.Data.CustomSummaryEventArgs e)
        {
            if (e.SummaryProcess == CustomSummaryProcess.Start)
            {
                subTotalTimeSpan = new TimeSpan();
                totalTimeSpan    = new TimeSpan();
            }
            if (e.SummaryProcess == CustomSummaryProcess.Calculate)
            {
                if (e.FieldValue != null && e.FieldValue != DBNull.Value)
                {
                    TimeSpan timeSpan = ((DateTime)e.FieldValue).TimeOfDay;
                    if (e.IsGroupSummary)
                    {
                        if (timeSpan < subTotalTimeSpan)
                        {
                            subTotalTimeSpan = subTotalTimeSpan.Subtract(timeSpan);
                        }
                        else
                        {
                            subTotalTimeSpan = timeSpan.Subtract(subTotalTimeSpan);
                        }
                    }

                    if (e.IsTotalSummary)
                    {
                        if (timeSpan < totalTimeSpan)
                        {
                            totalTimeSpan = totalTimeSpan.Subtract(timeSpan);
                        }
                        else
                        {
                            totalTimeSpan = timeSpan.Subtract(totalTimeSpan);
                        }
                    }
                }

                if (e.IsGroupSummary)
                {
                    e.TotalValue = subTotalTimeSpan;
                }
                if (e.IsTotalSummary)
                {
                    e.TotalValue = totalTimeSpan;
                }
            }
        }
Exemple #13
0
        private void DgInvLines_CustomSummary(object sender, DevExpress.Data.CustomSummaryEventArgs e)
        {
            var fieldName = ((GridSummaryItem)e.Item).FieldName;

            if (e.SummaryProcess == CustomSummaryProcess.Start)
            {
                sumMargin = sumSales = 0d;
            }
            if (e.SummaryProcess == CustomSummaryProcess.Calculate)
            {
                var row = e.Row as DebtorInvoiceLines;
                sumSales  += row.SalesPrice;
                sumMargin += row.Margin;
                switch (fieldName)
                {
                case "MarginRatio": sumMarginRatio = 100 * sumMargin / sumSales; e.TotalValue = sumMarginRatio; break;
                }
            }
        }
 protected void UiVistaFacturasVencidas_CustomSummaryCalculate(object sender, DevExpress.Data.CustomSummaryEventArgs e)
 {
     if (e.SummaryProcess != CustomSummaryProcess.Finalize)
     {
         return;
     }
     if (((ASPxSummaryItem)e.Item).FieldName == "DOC_DATE")
     {
         ASPxGridView gv = (ASPxGridView)sender;
         decimal      totalInicioDeInventario = 0;
         decimal      totalEgresoInventario   = 0;
         if (e.IsTotalSummary)
         {
             totalInicioDeInventario = Convert.ToDecimal(gv.GetTotalSummaryValue(gv.TotalSummary["DOC_TOTAL"]) ?? 0);
             totalEgresoInventario   = Convert.ToDecimal(gv.GetTotalSummaryValue(gv.TotalSummary["PAID_TO_DATE"]) ?? 0);
             e.TotalValue            = totalInicioDeInventario - totalEgresoInventario;
         }
     }
 }
Exemple #15
0
        /// <summary>
        /// 自定义汇总
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dgvEntity_CustomSummaryCalculate(object sender, DevExpress.Data.CustomSummaryEventArgs e)
        {
            if (e.SummaryProcess == CustomSummaryProcess.Start)
            {
                totalQuantum = 0;
            }

            if (e.SummaryProcess == CustomSummaryProcess.Calculate)
            {
                bool included = Convert.ToBoolean(this.dgvEntity.GetRowCellValue(e.RowHandle, "Included"));
                if (included)
                {
                    var item = e.Item as GridSummaryItem;
                    if (item.FieldName == "Quantum")
                    {
                        totalQuantum += Convert.ToDecimal(e.FieldValue);
                    }
                }
            }

            if (e.SummaryProcess == CustomSummaryProcess.Finalize)
            {
                var item = e.Item as GridSummaryItem;
                if (item.FieldName == "colIncrease")
                {
                    decimal totalRefQuantum = Convert.ToDecimal(this.colRefQuantum.SummaryItem.SummaryValue);
                    decimal totalQuantum    = Convert.ToDecimal(this.colQuantum.SummaryItem.SummaryValue);

                    if (totalRefQuantum == 0)
                    {
                        e.TotalValue = 1;
                    }
                    else
                    {
                        e.TotalValue = (totalQuantum - totalRefQuantum) / totalRefQuantum;
                    }
                }
                if (item.FieldName == "Quantum")
                {
                    e.TotalValue = totalQuantum;
                }
            }
        }
        private void grdVwEx1_CustomSummaryCalculate(object sender, DevExpress.Data.CustomSummaryEventArgs e)
        {
            if (e.SummaryProcess == CustomSummaryProcess.Calculate)
            {
                List <MyClassx> lista = grdVwEx3.GridControl.DataSource as List <MyClassx>;

                if (e.IsGroupSummary)
                {
                    e.TotalValue = lista
                                   .Where(w => w.Tipo1 == (int)e.FieldValue)
                                   .Sum(s => s.Valor1);
                }

                if (e.IsTotalSummary)
                {
                    e.TotalValue = lista.Sum(s => s.Valor2 / 3);
                }
            }
        }
 private void bandedGridView1_CustomSummaryCalculate(object sender, DevExpress.Data.CustomSummaryEventArgs e)
 {
     if (e.SummaryProcess == CustomSummaryProcess.Start)
     {
         //InitStartValue();
     }
     if (e.SummaryProcess == CustomSummaryProcess.Calculate)
     {
         try
         {
             GridColumnSummaryItem _obj = e.Item as GridColumnSummaryItem;
             string _fName = _obj.FieldName;
             e.TotalValue = CurrentValues[_fName];
         }
         catch
         {
             e.TotalValue = "";
         }
     }
 }
 private void grid_CustomSummary(object sender, DevExpress.Data.CustomSummaryEventArgs e)
 {
     if (object.Equals(e.SummaryProcess, CustomSummaryProcess.Start))
     {
         sum = 0;
     }
     if (e.SummaryProcess == CustomSummaryProcess.Calculate)
     {
         if ((grid != null) && (grid.View != null))
         {
             if (grid.View.IsRowSelected(e.RowHandle))
             {
                 sum += (decimal)e.FieldValue;
             }
         }
     }
     if (e.SummaryProcess == CustomSummaryProcess.Finalize)
     {
         e.TotalValue = sum;
     }
 }
Exemple #19
0
 private void gridView1_CustomSummaryCalculate(object sender, DevExpress.Data.CustomSummaryEventArgs e)
 {
     if (e.SummaryProcess == CustomSummaryProcess.Start)
     {
         customSum = new PaymentTypeSum();
     }
     if (e.SummaryProcess == CustomSummaryProcess.Calculate)
     {
         LoanPayment payment = gridView1.GetRow(e.RowHandle) as LoanPayment;
         if (payment != null && e.IsTotalSummary)
         {
             customSum.AddToSum(payment.Interest, payment.Principal);
         }
     }
     if (e.SummaryProcess == CustomSummaryProcess.Finalize)
     {
         if (e.IsTotalSummary)
         {
             e.TotalValue = customSum;
         }
     }
 }
    protected void grid_CustomSummaryCalculate(object sender, DevExpress.Data.CustomSummaryEventArgs e)
    {
        if (!e.IsTotalSummary)
        {
            return;
        }

        ASPxGridView g = sender as ASPxGridView;

        if ((e.SummaryProcess == CustomSummaryProcess.Finalize))
        {
            decimal totalValue = 0;
            CollectGorups();
            foreach (int groupRowIndex in groupRowIndexes)
            {
                decimal uisCount = (decimal)g.GetGroupSummaryValue(groupRowIndex, grid.GroupSummary["UnitsInStock"]);
                decimal uioCount = (decimal)g.GetGroupSummaryValue(groupRowIndex, grid.GroupSummary["UnitsOnOrder"]);
                totalValue += uisCount - uioCount;
            }
            e.TotalValue = totalValue;
        }
    }
 private void grid_CustomSummary(object sender, DevExpress.Data.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;
         }
     }
 }
Exemple #22
0
 private void grid_CustomSummary(object sender, DevExpress.Data.CustomSummaryEventArgs e)
 {
     if (object.Equals(e.SummaryProcess, CustomSummaryProcess.Start))
     {
         min = decimal.MinValue;
     }
     if (e.SummaryProcess == CustomSummaryProcess.Calculate)
     {
         decimal value = (decimal)e.FieldValue;
         if (min == decimal.MinValue)
         {
             min = max = value;
         }
         else
         {
             max = Math.Max(max, value);
             min = Math.Min(min, value);
         }
     }
     if (e.SummaryProcess == CustomSummaryProcess.Finalize)
     {
         e.TotalValue = (min + max) / 2;
     }
 }
 void grid_CustomSummary(object sender, DevExpress.Data.CustomSummaryEventArgs e)
 {
     if (object.Equals(e.SummaryProcess, CustomSummaryProcess.Start))
     {
         sum = 0;
     }
     if (e.SummaryProcess == CustomSummaryProcess.Calculate)
     {
         if (grid.View != null)
         {
             if (!checkEdit.IsChecked.Value || view.IsCellSelected(e.RowHandle, grid.Columns[((GridSummaryItem)e.Item).FieldName]))
             {
                 if (e.FieldValue != DBNull.Value && e.FieldValue != null)
                 {
                     sum += (int)e.FieldValue;
                 }
             }
         }
     }
     if (e.SummaryProcess == CustomSummaryProcess.Finalize)
     {
         e.TotalValue = sum;
     }
 }
 private void gridView1_CustomSummaryCalculate(object sender, DevExpress.Data.CustomSummaryEventArgs e)
 {
     if (!e.IsGroupSummary)
     {
         return;
     }
     if (e.SummaryProcess == CustomSummaryProcess.Start)
     {
         ivalue  = 0;
         dvalue  = 0;
         counter = 0;
     }
     if (e.SummaryProcess == CustomSummaryProcess.Calculate)
     {
         if (((GridGroupSummaryItem)e.Item).FieldName == "HP")
         {
             if (e.GroupRowHandle % 2 == 0)
             {
                 ivalue += (Int16)e.FieldValue;
             }
             else
             {
                 ivalue += 1;
             }
         }
         if (((GridGroupSummaryItem)e.Item).FieldName == "Liter")
         {
             if (e.GroupRowHandle % 2 == 0)
             {
                 dvalue = Math.Max(dvalue, (double)e.FieldValue);
             }
             else
             {
                 dvalue += (double)e.FieldValue;
                 counter++;
             }
         }
     }
     if (e.SummaryProcess == CustomSummaryProcess.Finalize)
     {
         if (((GridGroupSummaryItem)e.Item).FieldName == "HP")
         {
             if (e.GroupRowHandle % 2 == 0)
             {
                 e.TotalValue = ivalue;
             }
             else
             {
                 e.TotalValue = ivalue;
             }
         }
         if (((GridGroupSummaryItem)e.Item).FieldName == "Liter")
         {
             if (e.GroupRowHandle % 2 == 0)
             {
                 e.TotalValue = dvalue;
             }
             else
             {
                 e.TotalValue = dvalue / counter;
             }
         }
     }
 }
        private void KAgentAdjustmentDetGridView_CustomSummaryCalculate(object sender, DevExpress.Data.CustomSummaryEventArgs e)
        {
            if (e.SummaryProcess == CustomSummaryProcess.Finalize)
            {
                GridSummaryItem item = e.Item as GridSummaryItem;

                if (item.FieldName == "Saldo")
                {
                    e.TotalValue = e.FieldValue;
                }
            }
        }
        private void dgProjectTransCategorySum_CustomSummary(object sender, DevExpress.Data.CustomSummaryEventArgs e)
        {
            var fieldName = ((GridSummaryItem)e.Item).FieldName;

            switch (e.SummaryProcess)
            {
            case CustomSummaryProcess.Start:
                Set0();
                OnlySum = true;
                break;

            case CustomSummaryProcess.Calculate:
                var row = e.Row as ProjectTransCategorySumClientLocal;
                if (row == null)
                {
                    break;
                }
                if (row._CatType != CategoryType.Sum)
                {
                    if (OnlySum)
                    {
                        OnlySum = false;
                        Set0();
                    }
                }
                else if (!OnlySum)
                {
                    break;
                }

                double val = (double)e.FieldValue;
                switch (fieldName)
                {
                case "Qty": sumQty += val; break;

                case "Cost": sumCost += val; break;

                case "Sales": sumSales += val; break;

                case "Margin": sumMargin += val; break;

                case "BudgetQty": sumBudgetQty += val; break;

                case "BudgetCost": sumBudgetCost += val; break;

                case "BudgetSales": sumBudgetSales += val; break;

                case "Invoiced": sumInvoiced += val; break;

                case "BudgetInvoiced": sumBudgetInvoiced += val; break;

                case "InvoicedQty": sumInvoicedQty += val; break;

                case "BudgetInvoicedQty": sumBudgetInvoicedQty += val; break;
                }

                sumSalesValue  += row.Sales;
                sumMarginValue += row.Margin;
                break;

            case CustomSummaryProcess.Finalize:
                switch (fieldName)
                {
                case "Qty": e.TotalValue = sumQty; break;

                case "Cost": e.TotalValue = sumCost; break;

                case "Sales": e.TotalValue = sumSales; break;

                case "Margin": e.TotalValue = sumMargin; break;

                case "BudgetQty": e.TotalValue = sumBudgetQty; break;

                case "BudgetCost": e.TotalValue = sumBudgetCost; break;

                case "BudgetSales": e.TotalValue = sumBudgetSales; break;

                case "Invoiced": e.TotalValue = sumInvoiced; break;

                case "BudgetInvoiced": e.TotalValue = sumBudgetInvoiced; break;

                case "InvoicedQty": e.TotalValue = sumInvoicedQty; break;

                case "BudgetInvoicedQty": e.TotalValue = sumBudgetInvoicedQty; break;
                }
                if (fieldName == "MarginRatio" && sumSalesValue > 0)
                {
                    sumMarginRatio = 100 * sumMarginValue / sumSalesValue;
                    e.TotalValue   = sumMarginRatio;
                }
                break;
            }
        }