unit U_UserList;

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, cxFilter, cxData, cxDataStorage, cxEdit, cxDBData, DBClient,
  cxGridCustomTableView, cxGridTableView, cxGridDBTableView, ExtCtrls,
  cxSplitter, cxGridLevel, cxClasses, cxGridCustomView, cxGrid,
  cxGridCustomPopupMenu, cxGridPopupMenu, RM_Dataset, RM_System, RM_Common,
  RM_Class, RM_GridReport, IdBaseComponent, IdComponent, IdTCPConnection,
  IdTCPClient, IdFTP,ShellAPI,IniFiles, cxCheckBox, cxCalendar,
  cxButtonEdit, cxTextEdit, cxPC, cxCheckComboBox, cxDropDownEdit, Menus,
  RM_e_Xls, TeEngine, Series, TeeProcs, Chart, DbChart;

type
  TfrmUserList = class(TForm)
    ToolBar1: TToolBar;
    TBRafresh: TToolButton;
    TBClose: TToolButton;
    ADOQueryTemp: TADOQuery;
    ADOQueryCmd: TADOQuery;
    ToolButton2: TToolButton;
    ADOQueryMain: TADOQuery;
    RM1: TRMGridReport;
    RMDB_Main: TRMDBDataSet;
    cxGrid2: TcxGrid;
    Tv2: TcxGridDBTableView;
    cxGridLevel1: TcxGridLevel;
    cxGridPopupMenu2: TcxGridPopupMenu;
    DS_HZ: TDataSource;
    CDS_User: TClientDataSet;
    PopupMenu1: TPopupMenu;
    N1: TMenuItem;
    N2: TMenuItem;
    Panel1: TPanel;
    Udept: TEdit;
    RMXLSExport2: TRMXLSExport;
    v2Column8: TcxGridDBColumn;
    Label1: TLabel;
    v2Column1: TcxGridDBColumn;
    ADOQueryPrt: TADOQuery;
    Label2: TLabel;
    username: TEdit;
    v2Column2: TcxGridDBColumn;
    procedure FormDestroy(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure TBCloseClick(Sender: TObject);
    procedure FormShow(Sender: TObject);
    procedure TBRafreshClick(Sender: TObject);
    procedure ToolButton2Click(Sender: TObject);
    procedure cxTabControl1Change(Sender: TObject);
    procedure CustomerChange(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure Tv2DblClick(Sender: TObject);
  private
    { Private declarations }
  
    procedure InitGrid();
  public
    fFlag:integer;
    { Public declarations }
    RKFlag,FCYID,fmanage:String;

  end;

var
  frmUserList: TfrmUserList;

implementation
uses
  U_DataLink,U_Fun,U_ZDYHelp;

{$R *.dfm}

 

procedure TfrmUserList.InitGrid();
begin
  try
    ADOQueryMain.DisableControls;
    with ADOQueryMain do
    begin
      Close;
      SQL.Clear;
      sql.Add(' select * from  SY_User  ');
      Open;
    end;
    SCreateCDS20(ADOQueryMain,CDS_User);
    SInitCDSData20(ADOQueryMain,CDS_User);
  finally
    ADOQueryMain.EnableControls;
    ToolButton2.Click;
  end;
end;

procedure TfrmUserList.FormDestroy(Sender: TObject);
begin
  frmUserList:=nil;
end;

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

procedure TfrmUserList.TBCloseClick(Sender: TObject);
begin
  WriteCxGrid(Trim(Self.Caption),Tv2,'权限管理');
  Close;
end;
procedure TfrmUserList.FormShow(Sender: TObject);
begin
  ReadCxGrid(Trim(Self.Caption),Tv2,'权限管理');
//  Enddate.DateTime:=SGetServerDate(ADOQueryTemp);
//  begdate.DateTime:=Enddate.DateTime-30;
  InitGrid();
end;

procedure TfrmUserList.TBRafreshClick(Sender: TObject);
begin
  InitGrid();
end;

procedure TfrmUserList.ToolButton2Click(Sender: TObject);
var
  sql:string;
begin
  if ADOQueryMain.Active then
  begin
    sql:=SGetFilters(Panel1,1,2);
    SDofilter(ADOQueryMain,sql);
    SCreateCDS20(ADOQueryMain,CDS_User);
    SInitCDSData20(ADOQueryMain,CDS_User);
  end;
end;


procedure TfrmUserList.cxTabControl1Change(Sender: TObject);
begin
  InitGrid;
end;

procedure TfrmUserList.CustomerChange(Sender: TObject);
begin
  ToolButton2.Click;
end;

procedure TfrmUserList.FormCreate(Sender: TObject);
begin
  fmanage:=Trim(DParameters1);
end;

procedure TfrmUserList.Tv2DblClick(Sender: TObject);
begin
  if CDS_User.IsEmpty then exit;
  ModalResult:=1;
end;

end.
