unit U_SYUserView;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, cxGraphics, cxCustomData, cxStyles, cxTL, cxMaskEdit, DB, ADODB,
  cxInplaceContainer, cxDBTL, cxControls, cxTLData, ComCtrls, ToolWin,
  StdCtrls, ExtCtrls, DBClient, cxFilter, cxData, cxDataStorage, cxEdit,
  cxDBData, cxGridLevel, cxGridCustomTableView, cxGridTableView,
  cxGridDBTableView, cxClasses, cxGridCustomView, cxGrid;

type
  TfrmSYUserView = class(TForm)
    ToolBar1: TToolBar;
    TBRafresh: TToolButton;
    TBClose: TToolButton;
    ADOQueryTemp: TADOQuery;
    ADOQueryCmd: TADOQuery;
    cxGrid4: TcxGrid;
    Tv4: TcxGridDBTableView;
    cxGridDBColumn1: TcxGridDBColumn;
    cxGridDBColumn7: TcxGridDBColumn;
    cxGridLevel2: TcxGridLevel;
    CDS_User: TClientDataSet;
    DSUser: TDataSource;
    procedure FormDestroy(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure TBRafreshClick(Sender: TObject);
    procedure TBCloseClick(Sender: TObject);
    procedure Tv4DblClick(Sender: TObject);
    procedure FormShow(Sender: TObject);
  private
    { Private declarations }
    PState:Integer;
    FCPID,FTopID:String;
    procedure InitUser();

  public
    { Public declarations }
  end;

var
  frmSYUserView: TfrmSYUserView;

implementation
uses
  U_DataLink,U_RTFun;

{$R *.dfm}



procedure TfrmSYUserView.FormDestroy(Sender: TObject);
begin
  frmSYUserView:=nil;
end;

procedure TfrmSYUserView.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  Action:=caFree;
end;

procedure TfrmSYUserView.TBRafreshClick(Sender: TObject);
begin
  InitUser();
end;

procedure TfrmSYUserView.TBCloseClick(Sender: TObject);
begin
  Close;
end;

procedure TfrmSYUserView.Tv4DblClick(Sender: TObject);
begin
  ModalResult:=1;
end;
procedure TfrmSYUserView.InitUser();
begin
  with ADOQueryTemp do
  begin
    Close;
    SQL.Clear;
    SQL.Add('select A.* ');
    SQL.Add(' from SY_User A where UserId not in(''Admin'',''Test'') ');
    SQL.Add(' and Valid=''Y'' ');
    sql.Add(' and UDept=''¸úµ¥'' ');
    Open;
  end;
  SCreateCDS20(ADOQueryTemp,CDS_User);
  SInitCDSData20(ADOQueryTemp,CDS_User);
end;

procedure TfrmSYUserView.FormShow(Sender: TObject);
begin
  InitUser();
end;

end.
