cxgrid设置某列为其他列的乘积

简介:

procedure TfrmMedBack.cxSumColumn7GetDataText(Sender: TcxCustomGridTableItem;
  ARecordIndex: Integer; var AText: string);
begin
  if cxsum.DataController.RecordCount > 0 then
  begin
    if cxSum.DataController.GetValue(ARecordIndex,5) <> null then
    AText:=FloatToStrF( strtofloat(vartostr(cxSum.DataController.GetValue(ARecordIndex,2)))*
                       strtofloat(vartostr(cxSum.DataController.GetValue(ARecordIndex,5))),ffGeneral,10,2);
  end;
end;


------

procedure TfrmMedBack.cxSumEditing(Sender: TcxCustomGridTableView;
  AItem: TcxCustomGridTableItem; var AAllow: Boolean);
begin
  if aitem.index <> 5 then
    AAllow := false;
  if (AItem.GridView.ViewData.GetRecordByIndex(curindex).Values[5]
    > AItem.GridView.ViewData.GetRecordByIndex(curindex).Values[3]) then
  begin
    Messagebox(handle,'退药数量不能大于总数量?','提示信息',MB_OK +MB_ICONQUESTION);
    cxsum.Controller.FocusedRowIndex := curindex;
    cxSum.Controller.FocusedColumnIndex := 5;
    cxSum.Controller.FocusedColumn.FocusWithSelection;
  end;
end;


----获取单元格的值

cxsum.DataController.GetDisplayText(i,7)














本文转自鹅倌51CTO博客,原文链接: http://blog.51cto.com/kaixinbuliao/1582522,如需转载请自行联系原作者




相关文章
|
1月前
|
数据挖掘 数据处理 索引
使用Python实现DataFrame中奇数列与偶数列的位置调换
使用Python实现DataFrame中奇数列与偶数列的位置调换
20 1
|
1月前
|
Python
dataframe循环更新某列的值
使用Python的for循环和Pandas DataFrame的iterrows()方法可更新DataFrame列值。示例中创建新列&#39;D&#39;,其值为旧列&#39;C&#39;的一半。
44 2
|
1月前
|
索引
根据索引值计算item所在行列(row,col)索引序号(index)
根据索引值计算item所在行列(row,col)索引序号(index)
|
12月前
|
C++ 计算机视觉 索引
【C++】删除矩阵中的指定列(非常实用)
【C++】删除矩阵中的指定列(非常实用)
|
SQL 关系型数据库 MySQL
列的完整性约束——设置表字段的非空约束(NOT NULL, NK)
列的完整性约束——设置表字段的非空约束(NOT NULL, NK)
|
前端开发
Bootstrap - 列排序,列偏移,列嵌套
Bootstrap - 列排序,列偏移,列嵌套
72 0
|
C# 索引
C#编程-71:dataGridView获取行列坐标索引和值
C#编程-71:dataGridView获取行列坐标索引和值
356 0
|
Python
按照A列进行分组并计算出B列每个分组的平均值,然后对B列内的每个元素减去分组平均值
按照A列进行分组并计算出B列每个分组的平均值,然后对B列内的每个元素减去分组平均值
185 0
按照A列进行分组并计算出B列每个分组的平均值,然后对B列内的每个元素减去分组平均值