unit u_code_fee; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, dxExEdtr, dxDBTLCl, dxGrClms, dxTL, dxDBCtrl, dxDBGrid, dxCntner, BusinessSkinForm, bsSkinCtrls, Grids, Wwdbigrd, Wwdbgrid, StdCtrls, wwdblook, ExtCtrls, Mask, wwdbedit, Wwdotdot, Wwdbcomb, DB, ADODB, RxLookup; type Tfrm_code_fee = class(TForm) bsBusinessSkinForm1: TbsBusinessSkinForm; wwDBGrid1: TwwDBGrid; wwDBLookupCombo1: TwwDBLookupCombo; Panel1: TPanel; bsSkinButton1: TbsSkinButton; bsSkinButton2: TbsSkinButton; bsSkinButton4: TbsSkinButton; bsSkinButton3: TbsSkinButton; bsSkinButton5: TbsSkinButton; wwDBLookupCombo2: TwwDBLookupCombo; wwDBComboBox1: TwwDBComboBox; wwDBComboBox2: TwwDBComboBox; wwDBComboBox3: TwwDBComboBox; bsSkinPanel1: TbsSkinPanel; Label1: TLabel; Edit1: TEdit; Label2: TLabel; Edit2: TEdit; Label3: TLabel; bsSkinButton44: TbsSkinButton; t_code_fee1: TDataSource; t_code_fee: TADOQuery; RxDBLookupCombo15: TRxDBLookupCombo; strngfld_code_feeDSDesigner: TStringField; strngfld_code_feeDSDesigner2: TStringField; strngfld_code_feeDSDesigner3: TStringField; strngfld_code_feeDSDesigner4: TStringField; blnfld_code_feeDSDesigner5: TBooleanField; blnfld_code_feeDSDesigner6: TBooleanField; strngfld_code_feeDSDesigner7: TStringField; strngfld_code_feeDSDesigner8: TStringField; strngfld_code_feeDSDesigner9: TStringField; strngfld_code_feeDSDesigner10: TStringField; procedure FormShow(Sender: TObject); procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean); procedure bsSkinButton5Click(Sender: TObject); procedure bsSkinButton3Click(Sender: TObject); procedure bsSkinButton2Click(Sender: TObject); procedure bsSkinButton1Click(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure bsSkinButton44Click(Sender: TObject); procedure t_code_feeBeforePost(DataSet: TDataSet); procedure Edit1KeyPress(Sender: TObject; var Key: Char); procedure t_code_feeBeforeDelete(DataSet: TDataSet); procedure bsSkinButton4Click(Sender: TObject); procedure strngfld_code_feeDSDesigner2Change(Sender: TField); procedure t_code_feeBeforeEdit(DataSet: TDataSet); private { Private declarations } public { Public declarations } end; var frm_code_fee: Tfrm_code_fee; implementation uses u_data_share, my_sys_function, u_main; {$R *.dfm} procedure Tfrm_code_fee.FormShow(Sender: TObject); begin frm_data_share.t_code_currency.requery; frm_data_share.t_code_fee_type.requery; t_code_fee.open; end; procedure Tfrm_code_fee.FormCloseQuery(Sender: TObject; var CanClose: Boolean); begin frm_data_share.t_code_fee.Requery; CanClose:=frm_close_query(t_code_fee); end; procedure Tfrm_code_fee.bsSkinButton5Click(Sender: TObject); begin close; end; procedure Tfrm_code_fee.bsSkinButton3Click(Sender: TObject); begin table_cancel(t_code_fee); end; procedure Tfrm_code_fee.bsSkinButton2Click(Sender: TObject); begin table_post(t_code_fee); end; procedure Tfrm_code_fee.bsSkinButton1Click(Sender: TObject); begin t_code_fee.Insert; end; procedure Tfrm_code_fee.FormClose(Sender: TObject; var Action: TCloseAction); begin //SendMsg_gonggao('56',''); end; procedure Tfrm_code_fee.bsSkinButton44Click(Sender: TObject); begin with t_code_fee do begin close;sql.Clear; sql.Add('select * from t_code_fee where 1=1 '); if edit1.text<>'' then sql.Add(' and 代码 like ''%'+edit1.Text+'%'''); if edit2.text<>'' then sql.Add(' and 中文名 like ''%'+edit2.Text+'%'''); if RxDBLookupCombo15.DisplayValues[0]<>'' then sql.Add(' and 中文名 ='''+RxDBLookupCombo15.DisplayValues[0]+''''); open; end; end; procedure Tfrm_code_fee.t_code_feeBeforePost(DataSet: TDataSet); begin table_before_post(t_code_fee,'代码'); table_before_post(t_code_fee,'中文名'); table_before_post(t_code_fee,'费用类别'); if DataSet.State=dsEdit then if t_code_fee.FieldByName('中文名').OldValue<>t_code_fee.FieldByName('中文名').Value then begin if table_before_Edit_Delete(TAdoquery(DataSet),'t_ch_project_fee','费用名称',t_code_fee.FieldByName('中文名').OldValue,'费用方案') or table_before_Edit_Delete(TAdoquery(DataSet),'t_ch_fee','费用名称',t_code_fee.FieldByName('中文名').OldValue,'操作费用') then t_code_fee.FieldByName('中文名').Value:=t_code_fee.FieldByName('中文名').OldValue; end; end; procedure Tfrm_code_fee.Edit1KeyPress(Sender: TObject; var Key: Char); begin if key=#13 then bsSkinButton44.OnClick(sender); end; procedure Tfrm_code_fee.t_code_feeBeforeDelete(DataSet: TDataSet); begin if table_before_Edit_Delete(TAdoquery(DataSet),'t_ch_project_fee','费用名称',t_code_fee.FieldByName('中文名').AsString,'费用方案') or table_before_Edit_Delete(TAdoquery(DataSet),'t_ch_fee','费用名称',t_code_fee.FieldByName('中文名').AsString,'操作费用') then abort; end; procedure Tfrm_code_fee.bsSkinButton4Click(Sender: TObject); begin table_delete(t_code_fee); end; procedure Tfrm_code_fee.strngfld_code_feeDSDesigner2Change(Sender: TField); begin { if t_code_fee.State=dsEdit then if (t_code_fee.FieldByName('中文名').OldValue<>t_code_fee.FieldByName('中文名').Value) and t_code_fee.FieldByName('中文名').OldValue<>'' then if table_before_Edit_Delete(TAdoquery(Sender.DataSet),'t_ch_project_fee','费用名称',t_code_fee.FieldByName('中文名').OldValue,'费用方案') or table_before_Edit_Delete(TAdoquery(Sender.DataSet),'t_ch_fee','费用名称',t_code_fee.FieldByName('中文名').OldValue,'操作费用') then Sender.DataSet.Cancel; } end; procedure Tfrm_code_fee.t_code_feeBeforeEdit(DataSet: TDataSet); begin { if table_before_Edit_Delete(TAdoquery(DataSet),'t_ch_project_fee','费用名称',t_code_fee.FieldByName('中文名').OldValue,'费用方案') or table_before_Edit_Delete(TAdoquery(DataSet),'t_ch_fee','费用名称',t_code_fee.FieldByName('中文名').AsString,'操作费用') then abort; } end; end.