本文介绍了在DevExpress中计算ASPxGridview列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 ASPxGridview (通常21列,但我只想要进程4列)。

I have a ASPxGridview (Normally 21 column but i just want process 4 column).

每列都有一个十进制值。
MV_EDDIE 列为空。

Every column has a decimal value.MV_EDDIE column is empty.

我想要的是,按程序计算, MV_EDDIE 列是 RISK_EUR - (IPOTEK + MV_BERND)只在 GroupSummary TotalSummary

What i want is, calculating programmaticly ,MV_EDDIE columns is RISK_EUR - (IPOTEK + MV_BERND) only in GroupSummary and TotalSummary.

例如;
如果

For example;If

RISK_EUR = 100
IPOTEK = 40
MV_BERND = 50

然后 MV_EDDIE 列应为100 - (40 + 50) = 10

Then MV_EDDIE column should be 100 - (40 + 50) = 10

我该怎么做?

注意:我有 Sql 像这样

SELECT A.HESAP_NO, A.TEKLIF_NO1 || '/' || A.TEKLIF_NO2 AS TEKLIF,
            A.MUS_K_ISIM, A.RISK,
            (CASE WHEN A.DOVIZ_KOD = 21 THEN 'EUR' WHEN A.DOVIZ_KOD = 2 THEN 'USD' WHEN A.DOVIZ_KOD = 1 THEN 'TL' END) AS DOVIZ,
            ROUND(KRISK_CV(A.TEKLIF_NO1, A.TEKLIF_NO2,A.DOVIZ_KOD,:TAR),2) AS RISK_EUR,
            NVL(IPOTEK(A.HESAP_NO, :TAR),0) AS IPOTEK,
            ROUND(SUM(M_V(A.TEKLIF_NO1, A.TEKLIF_NO2,:TAR)),2) AS MV_BERND,
            ROUND(SUM(MV_EX(A.TEKLIF_NO1, A.TEKLIF_NO2,:TAR)),2) AS MV_EDDIE,
            (CASE WHEN ROUND(SUM(MV_K(A.TEKLIF_NO1, A.TEKLIF_NO2,:TAR)),2) < 0 THEN
            ROUND(SUM(MV_EX(A.TEKLIF_NO1, A.TEKLIF_NO2,:TAR)),2) ELSE
            ROUND(SUM(MV_K(A.TEKLIF_NO1, A.TEKLIF_NO2,:TAR)),2) END) AS MV_KASKO,
           B.TARIH, GGUNK(A.TEKLIF_NO1,A.TEKLIF_NO2,:TAR) AS GUN
            FROM S_TEKLIF A, TMP_TAKIP B
            WHERE A.HESAP_NO = B.HESAP
            --AND A.HESAP_NO = 316
            AND A.RISK > 0
            GROUP BY B.TARIH, A.HESAP_NO, A.TEKLIF_NO1 || '/' || A.TEKLIF_NO2 ,
            A.MUS_K_ISIM, GGUNK(A.TEKLIF_NO1,A.TEKLIF_NO2,:TAR),
            A.RISK, A.DOVIZ_KOD,KRISK_CV(A.TEKLIF_NO1, A.TEKLIF_NO2,A.DOVIZ_KOD,:TAR)
            ORDER BY 3

注2 :我可以解决这个问题改变我的sql查询,但我不想要它。我的查询已经复杂了我不想改变它。因此,我想以编程方式解决..

NOTE 2: I can solve this problem changing my sql query, but i don't want it. My query is complicated already. I don't want change it. Because of that, i want to solve it programmaticly ..

编辑:我只想计算它 GroupSummary TotalSummary

推荐答案

如果有人考虑我找到的答案。

If anyone consider the answer i found it.

protected void ASPxGridView1_Init(object sender, EventArgs e)
  {
      GridViewDataTextColumn colTotal = new GridViewDataTextColumn();
      colTotal.Caption = "Total";
      colTotal.FieldName = "Total";
      colTotal.UnboundType = DevExpress.Data.UnboundColumnType.Decimal;
      colTotal.VisibleIndex = ASPxGridView1.VisibleColumns.Count;
      colTotal.PropertiesTextEdit.DisplayFormatString = "n0";
      ASPxGridView1.Columns.Add(colTotal);

  }

protected void ASPxGridView1_CustomUnboundColumnData(object sender, ASPxGridViewColumnDataEventArgs e)
  {
      if (e.Column.FieldName == "Total")
      {
          decimal risk = Convert.ToDecimal(e.GetListSourceFieldValue("RISK"));
          decimal mv = Convert.ToDecimal(e.GetListSourceFieldValue("MV_BERND"));
          decimal ipotek = Convert.ToDecimal(e.GetListSourceFieldValue("IPOTEK"));


          e.Value = risk - mv - ipotek;
      }

  }

这篇关于在DevExpress中计算ASPxGridview列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-13 17:46