unit u_fee_list; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, DB, RxMemDS, dxExEdtr, dxCntner, dxTL, dxDBCtrl, dxDBGrid, BusinessSkinForm, bsSkinCtrls, Grids, DBGridEh; type Tfrm_fee_list = class(TForm) t_fee_list: TRxMemoryData; t_fee_list1: TDataSource; dxDBGrid1: TdxDBGrid; dxDBGrid1Column2: TdxDBGridMaskColumn; dxDBGrid1Column3: TdxDBGridMaskColumn; dxDBGrid1Column4: TdxDBGridMaskColumn; dxDBGrid1Column5: TdxDBGridMaskColumn; dxDBGrid1Column6: TdxDBGridMaskColumn; dxDBGrid1Column7: TdxDBGridMaskColumn; bsBusinessSkinForm1: TbsBusinessSkinForm; DataSource1: TDataSource; bsSkinPanel1: TbsSkinPanel; bsSkinButton1: TbsSkinButton; bsSkinButton2: TbsSkinButton; dxDBGrid1Column8: TdxDBGridColumn; DBGridEh1: TDBGridEh; procedure bsSkinButton2Click(Sender: TObject); procedure FormShow(Sender: TObject); procedure bsSkinButton1Click(Sender: TObject); procedure DBGridEh1TitleBtnClick(Sender: TObject; ACol: Integer; Column: TColumnEh); procedure t_fee_listAfterPost(DataSet: TDataSet); private { Private declarations } public { Public declarations } end; var frm_fee_list: Tfrm_fee_list; implementation uses u_main; {$R *.dfm} procedure Tfrm_fee_list.bsSkinButton2Click(Sender: TObject); begin CLOSE; end; procedure Tfrm_fee_list.FormShow(Sender: TObject); var book1:Tbookmark; begin t_fee_list.Open; book1:=DataSource1.DataSet.GetBookmark; try modify_all:=true; DataSource1.DataSet.DisableControls; DataSource1.DataSet.First; while not DataSource1.DataSet.Eof do begin t_fee_list.Append; t_fee_list['CH_ID']:=DataSource1.DataSet['CH_ID']; t_fee_list['费用名称']:=DataSource1.DataSet['费用名称']; t_fee_list['客户名称']:=DataSource1.DataSet['客户名称']; t_fee_list['金额']:=DataSource1.DataSet['金额']; t_fee_list['币别']:=DataSource1.DataSet['币别']; t_fee_list['汇率']:=DataSource1.DataSet['汇率']; t_fee_list['顺序']:=DataSource1.DataSet['顺序']; t_fee_list['是否垫付']:=DataSource1.DataSet['是否垫付']; t_fee_list.post; DataSource1.DataSet.next; end; finally modify_all:=false; DataSource1.DataSet.GotoBookmark(book1); DataSource1.DataSet.EnableControls; end; end; procedure Tfrm_fee_list.bsSkinButton1Click(Sender: TObject); var book1:Tbookmark; i:integer; begin if t_fee_list.State=dsedit then t_fee_list.post; t_fee_list.first; i:=1; try modify_all:=true; book1:=DataSource1.DataSet.GetBookmark; DataSource1.DataSet.DisableControls; while not t_fee_list.eof do begin if DataSource1.DataSet.Locate('CH_ID',t_fee_list['CH_ID'],[])then begin DataSource1.DataSet.edit; DataSource1.DataSet['顺序']:=i; DataSource1.DataSet.post; end; t_fee_list.next; i:=i+1; end; finally modify_all:=false; DataSource1.DataSet.GotoBookmark(book1); DataSource1.DataSet.EnableControls; end; close; end; procedure Tfrm_fee_list.DBGridEh1TitleBtnClick(Sender: TObject; ACol: Integer; Column: TColumnEh); begin case column.Title.SortMarker of smNoneEh : begin column.Title.SortMarker:=smDownEh; t_fee_list.SortOnFields(column.FieldName,true,true); end; smDownEh : begin column.Title.SortMarker:=smUpEh; t_fee_list.SortOnFields(column.FieldName,true,false); end; smUpEh : begin column.Title.SortMarker:=smDownEh; t_fee_list.SortOnFields(column.FieldName,true,true); end; end; end; procedure Tfrm_fee_list.t_fee_listAfterPost(DataSet: TDataSet); begin if not modify_all then t_fee_list.SortOnFields('顺序',true,false); end; end.