150 lines
3.8 KiB
ObjectPascal
150 lines
3.8 KiB
ObjectPascal
unit U_YWYSel;
|
||
|
||
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, dxSkinsCore, dxSkinsDefaultPainters, cxNavigator,
|
||
dxDateRanges, dxBarBuiltInMenu, System.ImageList;
|
||
|
||
type
|
||
TfrmYWYSel = class(Tform)
|
||
TV1: TcxGridDBTableView;
|
||
cxGrid1Level1: TcxGridLevel;
|
||
cxGrid1: TcxGrid;
|
||
V1Code: TcxGridDBColumn;
|
||
V1Name: TcxGridDBColumn;
|
||
ToolBar1: TToolBar;
|
||
ADOQueryMain: TADOQuery;
|
||
ADOQueryTemp: TADOQuery;
|
||
ADOQueryCmd: TADOQuery;
|
||
DataSource1: TDataSource;
|
||
ClientDataSet1: TClientDataSet;
|
||
TBClose: TToolButton;
|
||
ADOConnection1: TADOConnection;
|
||
Panel1: TPanel;
|
||
Label1: TLabel;
|
||
ZDYName: TEdit;
|
||
ThreeImgList: TImageList;
|
||
cxGridPopupMenu1: TcxGridPopupMenu;
|
||
procedure FormCreate(Sender: TObject);
|
||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||
procedure TBCloseClick(Sender: TObject);
|
||
procedure FormShow(Sender: TObject);
|
||
procedure ZDYNameChange(Sender: TObject);
|
||
procedure FormDestroy(Sender: TObject);
|
||
procedure TV1CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
||
private
|
||
procedure InitGrid();
|
||
{ Private declarations }
|
||
public
|
||
sql_str: string;
|
||
flag, flagname, snote, MainType: string;
|
||
fnote, forderno, fZdyFlag, ViewFlag, fnote1: Boolean;
|
||
PPSTE: integer;
|
||
{ Public declarations }
|
||
end;
|
||
|
||
var
|
||
frmYWYSel: TfrmYWYSel;
|
||
|
||
implementation
|
||
|
||
uses
|
||
U_DataLink, U_RTFun, U_ZDYHelp;
|
||
|
||
{$R *.dfm}
|
||
|
||
procedure TfrmYWYSel.FormCreate(Sender: TObject);
|
||
begin
|
||
try
|
||
cxGrid1.Align := alClient;
|
||
with ADOConnection1 do
|
||
begin
|
||
Connected := false;
|
||
ConnectionString := DConString;
|
||
//ConnectionString:='';
|
||
Connected := true;
|
||
end;
|
||
except
|
||
{if Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>,<2C>Ƿ<EFBFBD>Ҫ<EFBFBD>ٴ<EFBFBD><D9B4><EFBFBD><EFBFBD><EFBFBD>?','<27><>ʾ',32+4)=IDYES then
|
||
begin
|
||
try
|
||
with ADOConnection1 do
|
||
begin
|
||
Connected:=false;
|
||
ConnectionString:=DConString;
|
||
//ConnectionString:='23242';
|
||
Connected:=true;
|
||
end;
|
||
except
|
||
end;
|
||
end; }
|
||
|
||
frmZDYHelp.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmYWYSel.FormClose(Sender: TObject; var Action: TCloseAction);
|
||
begin
|
||
ZDYName.SetFocus;
|
||
Action := caFree;
|
||
end;
|
||
|
||
procedure TfrmYWYSel.InitGrid();
|
||
begin
|
||
try
|
||
ADOQueryMain.DisableControls;
|
||
with ADOQueryMain do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select UserID,UserName ,UType from SY_User');
|
||
Open;
|
||
end;
|
||
SCreateCDS(ADOQueryMain, ClientDataSet1);
|
||
SInitCDSData(ADOQueryMain, ClientDataSet1);
|
||
finally
|
||
ADOQueryMain.EnableControls;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmYWYSel.TBCloseClick(Sender: TObject);
|
||
begin
|
||
Close;
|
||
end;
|
||
|
||
procedure TfrmYWYSel.TV1CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
||
begin
|
||
ModalResult := 1;
|
||
end;
|
||
|
||
procedure TfrmYWYSel.FormShow(Sender: TObject);
|
||
begin
|
||
frmZDYHelp.Caption := Trim(flagname);
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmYWYSel.ZDYNameChange(Sender: TObject);
|
||
begin
|
||
if ADOQueryMain.Active then
|
||
begin
|
||
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
||
SCreateCDS(ADOQueryMain, ClientDataSet1);
|
||
SInitCDSData(ADOQueryMain, ClientDataSet1);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmYWYSel.FormDestroy(Sender: TObject);
|
||
begin
|
||
frmYWYSel := nil;
|
||
end;
|
||
|
||
end.
|
||
|