unit U_KHHelp; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData, cxDataStorage, cxEdit, DB, cxDBData, ToolWin, ComCtrls, cxGridCustomTableView, cxGridTableView, cxGridDBTableView, cxGridLevel, cxClasses, cxControls, cxGridCustomView, cxGrid, DBClient, ADODB, ImgList, StdCtrls, ExtCtrls, cxTextEdit, cxGridCustomPopupMenu, cxGridPopupMenu, cxLookAndFeels, cxLookAndFeelPainters, cxNavigator, dxDateRanges, dxBarBuiltInMenu, System.ImageList; type TfrmKHHelp = class(TForm) TV1: TcxGridDBTableView; cxGrid1Level1: TcxGridLevel; cxGrid1: TcxGrid; V1Name: TcxGridDBColumn; ToolBar1: TToolBar; ADOQueryMain: TADOQuery; ADOQueryTemp: TADOQuery; ADOQueryCmd: TADOQuery; DataSource1: TDataSource; ClientDataSet1: TClientDataSet; TBClose: TToolButton; ToolButton1: TToolButton; ADOConnection1: TADOConnection; Panel1: TPanel; Label1: TLabel; ZDYName: TEdit; ThreeImgList: TImageList; cxGridPopupMenu1: TcxGridPopupMenu; V1Column1: TcxGridDBColumn; procedure FormCreate(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure TBCloseClick(Sender: TObject); procedure FormShow(Sender: TObject); procedure ToolButton1Click(Sender: TObject); procedure TV1CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean); procedure ZDYNameChange(Sender: TObject); procedure FormDestroy(Sender: TObject); private procedure InitGrid(); { Private declarations } public flag,flagname,snote,MainType:string; fnote,forderno,fZdyFlag:Boolean; PPSTE:integer; { Public declarations } end; var frmKHHelp: TfrmKHHelp; implementation uses U_DataLink,U_Fun; {$R *.dfm} procedure TfrmKHHelp.FormCreate(Sender: TObject); begin try cxGrid1.Align:=alClient; with ADOConnection1 do begin Connected:=false; ConnectionString:=DConString; //ConnectionString:=''; Connected:=true; end; except frmKHHelp.Free; end; end; procedure TfrmKHHelp.FormClose(Sender: TObject; var Action: TCloseAction); begin ZDYName.SetFocus; Action:=caFree; end; procedure TfrmKHHelp.InitGrid(); var CYType:String; begin with ADOQueryTemp do begin Close; sql.Clear; sql.Add('select * from SY_User where UserId='''+Trim(DCode)+''''); Open; end; CYType:=Trim(ADOQueryTemp.fieldbyname('DPID').AsString); try ADOQueryMain.DisableControls; with ADOQueryMain do begin Close; sql.Clear; sql.Add('exec P_Select_User_KHName :CYType'); Parameters.ParamByName('CYType').Value:=Trim(CYType); Open; end; SCreateCDS20(ADOQueryMain,ClientDataSet1); SInitCDSData20(ADOQueryMain,ClientDataSet1); finally ADOQueryMain.EnableControls; end; end; procedure TfrmKHHelp.TBCloseClick(Sender: TObject); begin ModalResult:=2; ZDYName.SetFocus; WriteCxGrid('客户名称',TV1,'基础数据'); Close; end; procedure TfrmKHHelp.FormShow(Sender: TObject); begin InitGrid(); ReadCxGrid('客户名称',TV1,'基础数据'); end; procedure TfrmKHHelp.ToolButton1Click(Sender: TObject); begin ZDYName.SetFocus; ModalResult:=1; end; procedure TfrmKHHelp.TV1CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean); begin if TV1.OptionsData.Editing=False then begin ModalResult:=1; end; end; procedure TfrmKHHelp.ZDYNameChange(Sender: TObject); var fsj:String; begin if Trim(ZDYName.Text)<>'' then begin fsj:=' zdyname like '''+'%'+Trim(ZDYName.Text)+'%'+'''' +' or ZJM like '''+'%'+Trim(ZDYName.Text)+'%'+''''; end; if ADOQueryMain.Active then begin SDofilter(ADOQueryMain,fsj); SCreateCDS20(ADOQueryMain,ClientDataSet1); SInitCDSData20(ADOQueryMain,ClientDataSet1); end; end; procedure TfrmKHHelp.FormDestroy(Sender: TObject); begin frmKHHelp:=nil; end; end.