1、更改某个单元格的值后,其他单元格的值也相应改变

直接点击单元格进行更改值,然后在改单元格增加相应的事件:

procedure Tfrm_BarCode_makecl5.gdtv_1select_ticketPropertiesEditValueChanged(
  Sender: TObject);
 var
    i_SalesCount:Integer;
begin
  try
      ReFreshMsgInTime();
      if (bDoOldBill) then
          Exit;
     if cds_Plan.State = dsEdit    then  //cxgrid关联的数据集clientdataset为cds_Plan
        cds_Plan.Post; //必须先POST后再去Edit,否则更改的值会丢失
      cds_Plan.Edit;
     i_SalesCount := cds_Plan.FieldByName('select_ticket').AsInteger;
       cds_Plan.FieldByName('tfare').Value :=  cds_Plan.FieldByName('price').AsCurrency * i_SalesCount;
       cds_Plan.FieldByName('JSAllmoney').Value :=  cds_Plan.FieldByName('price2').AsCurrency * i_SalesCount;
   finally
     if cds_Plan.State = dsEdit    then
        cds_Plan.Post;
     CountMoney();
   end;
end;

 

相关文章:

  • 2022-02-03
  • 2021-12-08
  • 2021-05-20
  • 2022-03-03
  • 2021-12-22
  • 2022-03-04
  • 2021-11-21
  • 2022-12-23
猜你喜欢
  • 2021-05-18
  • 2022-02-07
  • 2022-12-23
  • 2021-12-11
  • 2021-09-11
  • 2021-08-22
  • 2021-10-19
相关资源
相似解决方案