unit u_op_chkpart; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, bsSkinCtrls, ExtCtrls, Grids, DBGridEh, StdCtrls, DBCtrls, Mask, DB, ADODB; type Tfrm_op_chkpart = class(TForm) Panel1: TPanel; bsSkinButton1: TbsSkinButton; bsSkinButton2: TbsSkinButton; bsSkinButton4: TbsSkinButton; bsSkinButton3: TbsSkinButton; bsSkinButton5: TbsSkinButton; bsSkinPanel1: TbsSkinPanel; DBGridEh1: TDBGridEh; bsSkinButton6: TbsSkinButton; bsSkinButton7: TbsSkinButton; Label1: TLabel; Label2: TLabel; Label3: TLabel; DBEdit1: TDBEdit; DBEdit2: TDBEdit; DBMemo1: TDBMemo; qry_op_chkpart: TADOQuery; dsr_op_chkpart: TDataSource; Label4: TLabel; Label5: TLabel; DBMemo2: TDBMemo; DBComboBox1: TDBComboBox; bsSkinButton8: TbsSkinButton; procedure bsSkinButton1Click(Sender: TObject); procedure DBEdit2KeyPress(Sender: TObject; var Key: Char); procedure bsSkinButton2Click(Sender: TObject); procedure bsSkinButton4Click(Sender: TObject); procedure bsSkinButton3Click(Sender: TObject); procedure bsSkinButton6Click(Sender: TObject); procedure bsSkinButton7Click(Sender: TObject); procedure bsSkinButton5Click(Sender: TObject); procedure bsSkinButton8Click(Sender: TObject); private { Private declarations } ywlb:string ; public { Public declarations } procedure showywlb(yw:string); end; var frm_op_chkpart: Tfrm_op_chkpart; implementation {$R *.dfm} uses u_main,my_sys_function ; { Tfrm_op_chkpart } procedure Tfrm_op_chkpart.showywlb(yw: string); begin ywlb:=yw ; with qry_op_chkpart,sql do begin close ; clear ; add('select * from t_op_chkpart where 业务类别=:ywlb order by 顺序号'); parameters.ParamByName('ywlb').value:=ywlb ; open ; end ; showmodal ; end; procedure Tfrm_op_chkpart.bsSkinButton1Click(Sender: TObject); begin qry_op_chkpart.Append ; qry_op_chkpart.FieldByName('业务类别').AsString:=ywlb ; dbedit2.SetFocus ; end; procedure Tfrm_op_chkpart.DBEdit2KeyPress(Sender: TObject; var Key: Char); begin if key=#13 then dbmemo1.SetFocus ; end; procedure Tfrm_op_chkpart.bsSkinButton2Click(Sender: TObject); begin qry_op_chkpart.Post ; end; procedure Tfrm_op_chkpart.bsSkinButton4Click(Sender: TObject); begin qry_op_chkpart.Delete ; end; procedure Tfrm_op_chkpart.bsSkinButton3Click(Sender: TObject); begin qry_op_chkpart.Cancel ; end; procedure Tfrm_op_chkpart.bsSkinButton6Click(Sender: TObject); begin qry_op_chkpart.Next ; end; procedure Tfrm_op_chkpart.bsSkinButton7Click(Sender: TObject); begin qry_op_chkpart.Prior ; end; procedure Tfrm_op_chkpart.bsSkinButton5Click(Sender: TObject); begin close ; end; procedure Tfrm_op_chkpart.bsSkinButton8Click(Sender: TObject); var aQuery:TADOQuery ; begin try aQuery:=CreateAdoQuery; with aQuery,sql do begin close; clear ; if DBComboBox1.Text='主表' then begin add('select count(*) as cnt from t_op_seae where (1=1) ') ; add(' and '); add(qry_op_chkpart.fieldbyname('条件').asstring); end else if DBComboBox1.Text='费用表' then begin add('select count(*) as cnt from t_ch_fee where (1=1) '); add(' and '); add(qry_op_chkpart.fieldbyname('条件').asstring); end else if DBComboBox1.Text='利润表' then begin add('select count(*)as cnt from t_op_gain where (1=1) '); add('and '); add(qry_op_chkpart.fieldbyname('条件').asstring); end ; open ; close ; FreeAndNil(aQuery); showmessage('检查正确!'); end ; except showmessage('输入条件不合规范,请修改!'); end; end ; end.