• 嵌套子表(dx),如何根据从表合计数显示主表记录的颜色


    假设用dx已经构建好m/d了,主表不需要更新。
    1、在master中有一字段mysum,增加一个对照字段如ctrl_Field,其初始是detail的合计数
    2、master根据mysum和ctrl_Field的值对照改变该记录颜色。
    procedure TFormBase_PayPlan.cxgrdbtblvwGrid1DBTableView_TargetCustomDrawCell(
      Sender: TcxCustomGridTableView; ACanvas: TcxCanvas;
      AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
    var
      a_sum,b_sum : Currency;
    begin
      if VarIsNull(AViewInfo.GridRecord.Values[cxgrdbclmnGrid1DBTableView1is_sum.Index]) then
       a_sum := 0
     else
       a_sum := StrToFloat(AViewInfo.GridRecord.Values[cxgrdbclmnGrid1DBTableView1is_sum.Index]);
    
        if VarIsNull(AViewInfo.GridRecord.Values[cxgrdbclmnGrid1DBTableView1isd_sum_total.Index]) then
       b_sum := 0
     else
       b_sum := StrToFloat(AViewInfo.GridRecord.Values[cxgrdbclmnGrid1DBTableView1isd_sum_total.Index]);
    
      if   a_sum  < b_sum  then
      ACanvas.Canvas.Font.Color:= clRed;//clActiveCaption ?????????????????
    
    end;

    3、在修改数据事件中做修改ctrl_Field的处理如下,目的是修改ctrl_Field在grid中的值:

                        // 显示控制
                        i := cxgrdbtblvwGrid1DBTableView_Target.DataController.FocusedRowIndex;
                        j := cxgrdbclmnGrid1DBTableView1isd_sum_total.Index;
                        if VarIsNull(cxgrdbtblvwGrid1DBTableView_Target.DataController.Values[i,j]) then
                           cxgrdbtblvwGrid1DBTableView_Target.DataController.Values[i,j] := cxcrncydt_Sum.Value
                        else
                           cxgrdbtblvwGrid1DBTableView_Target.DataController.Values[i,j] := cxcrncydt_Sum.Value +
                              cxgrdbtblvwGrid1DBTableView_Target.DataController.Values[i,j];//增加处理
    
    { cxgrdbtblvwGrid1DBTableView_Target.DataController.Values[i,j] := cxcrncydt_Sum.Value +
                              cxgrdbtblvwGrid1DBTableView_Target.DataController.Values[i,j] - ctrl_PaySTDSun;//修改的处理}
                        //end of 显示控制
  • 相关阅读:
    VS中编码格式的问题(待总结)
    第一次搭建Eureka服务器的虐心之路
    Eureka相关
    【移动开发】SparseArray替代HashMap
    【移动开发】plurals
    皮尔森相似度计算举例(R语言)
    据说,年薪百万的程序员,都是这么开悟的
    RDD:基于内存的集群计算容错抽象
    使用IDEA运行Spark程序
    scala for spark
  • 原文地址:https://www.cnblogs.com/usegear/p/2612356.html
Copyright © 2020-2023  润新知