Beispiel #1
0
        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;
                }
            }
        }
Beispiel #2
0
        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;
            }
        }
        protected override void Tablo_CustomSummaryCalculate(object sender, CustomSummaryEventArgs e)
        {
            if (e.SummaryProcess != CustomSummaryProcess.Finalize)
            {
                return;
            }

            var item = (GridSummaryItem)e.Item;

            switch (item.FieldName)
            {
            case "colUcretliOrtalama":

                if (e.IsGroupSummary)
                {
                    var ucretliOgrenci = Convert.ToDecimal(Tablo.GetGroupSummaryValue(e.GroupRowHandle, (GridGroupSummaryItem)Tablo.GroupSummary["UcretliOgrenci"]));
                    var netUcret       = Convert.ToDecimal(Tablo.GetGroupSummaryValue(e.GroupRowHandle, (GridGroupSummaryItem)Tablo.GroupSummary["NetUcret"]));

                    e.TotalValue = ucretliOgrenci == 0 ? 0 : netUcret / ucretliOgrenci;
                }

                else if (e.IsTotalSummary)
                {
                    var ucretliOgrenci = Convert.ToDecimal(colUcretliOgrenci.SummaryItem.SummaryValue);
                    var netUcret       = Convert.ToDecimal(colNetUcret.SummaryItem.SummaryValue);


                    e.TotalValue = ucretliOgrenci == 0 ? 0 : netUcret / ucretliOgrenci;
                }
                break;

            case "colUcretsizDahilOrtalama":

                if (e.IsGroupSummary)
                {
                    var ogrenciSayisi = Convert.ToDecimal(Tablo.GetGroupSummaryValue(e.GroupRowHandle, (GridGroupSummaryItem)Tablo.GroupSummary["ToplamOgrenci"]));
                    var netUcret      = Convert.ToDecimal(Tablo.GetGroupSummaryValue(e.GroupRowHandle, (GridGroupSummaryItem)Tablo.GroupSummary["NetUcret"]));

                    e.TotalValue = ogrenciSayisi == 0 ? 0 : netUcret / ogrenciSayisi;
                }

                else if (e.IsTotalSummary)
                {
                    var ogrenciSayisi = Convert.ToDecimal(colToplamOgrenci.SummaryItem.SummaryValue);
                    var netUcret      = Convert.ToDecimal(colNetUcret.SummaryItem.SummaryValue);


                    e.TotalValue = ogrenciSayisi == 0 ? 0 : netUcret / ogrenciSayisi;
                }
                break;

            case "colSinifOrtalama":

                if (e.IsGroupSummary)
                {
                    var ogrenciSayisi = Convert.ToDecimal(Tablo.GetGroupSummaryValue(e.GroupRowHandle, (GridGroupSummaryItem)Tablo.GroupSummary["ToplamOgrenci"]));
                    var sinifSayisi   = Convert.ToDecimal(Tablo.GetGroupSummaryValue(e.GroupRowHandle, (GridGroupSummaryItem)Tablo.GroupSummary["SinifSayisi"]));

                    e.TotalValue = sinifSayisi == 0 ? 0 : ogrenciSayisi / sinifSayisi;
                }

                else if (e.IsTotalSummary)
                {
                    var ogrenciSayisi = Convert.ToDecimal(colToplamOgrenci.SummaryItem.SummaryValue);
                    var sinifSayisi   = Convert.ToDecimal(colNetUcret.SummaryItem.SummaryValue);


                    e.TotalValue = sinifSayisi == 0 ? 0 : ogrenciSayisi / sinifSayisi;
                }
                break;
            }
        }