155 lines
4.2 KiB
Plaintext
155 lines
4.2 KiB
Plaintext
unit U_EmployeeBZ;
|
|
|
|
interface
|
|
|
|
uses
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|
Dialogs, StdCtrls, ExtCtrls, ComCtrls, ToolWin, cxStyles, cxCustomData,
|
|
cxGraphics, cxFilter, cxData, cxDataStorage, cxEdit, DB, cxDBData, ADODB,
|
|
cxGridLevel, cxClasses, cxControls, cxGridCustomView, cxGridCustomTableView,
|
|
cxGridTableView, cxGridDBTableView, cxGrid, DBClient, cxSplitter,
|
|
cxLookAndFeels, cxLookAndFeelPainters, cxNavigator, U_BaseList, dxSkinsCore,
|
|
dxSkinsDefaultPainters, dxScrollbarAnnotations, dxDateRanges;
|
|
|
|
type
|
|
TfrmEmployeeBZ = class(TfrmBaseList)
|
|
ToolBar1: TToolBar;
|
|
TBRafresh: TToolButton;
|
|
TBClose: TToolButton;
|
|
PanelZD: TPanel;
|
|
ToolBar2: TToolBar;
|
|
TBAddZD: TToolButton;
|
|
cxGridZD: TcxGrid;
|
|
TVZD: TcxGridDBTableView;
|
|
TVZDZdyName: TcxGridDBColumn;
|
|
cxGridZDLevel1: TcxGridLevel;
|
|
cxSplitter1: TcxSplitter;
|
|
PanelMain: TPanel;
|
|
PanelTop: TPanel;
|
|
LabelTop: TLabel;
|
|
cxGridTop: TcxGrid;
|
|
TvTop: TcxGridDBTableView;
|
|
TvTopEECode: TcxGridDBColumn;
|
|
TvTopEEName: TcxGridDBColumn;
|
|
TvTopDept: TcxGridDBColumn;
|
|
cxGridTopLevel1: TcxGridLevel;
|
|
cxSplitter2: TcxSplitter;
|
|
PanelTip: TPanel;
|
|
LabelTip: TLabel;
|
|
PanelBottom: TPanel;
|
|
LabelBottom: TLabel;
|
|
cxGridBottom: TcxGrid;
|
|
TvBottom: TcxGridDBTableView;
|
|
TvBottomEECode: TcxGridDBColumn;
|
|
TvBottomEEName: TcxGridDBColumn;
|
|
TvBottomDept: TcxGridDBColumn;
|
|
cxGridBottomLevel1: TcxGridLevel;
|
|
ADOQueryZD: TADOQuery;
|
|
ADOQueryTop: TADOQuery;
|
|
ADOQueryBottom: TADOQuery;
|
|
DataSource1: TDataSource;
|
|
DataSource2: TDataSource;
|
|
DataSource3: TDataSource;
|
|
CDS_Top: TClientDataSet;
|
|
CDS_Bottom: TClientDataSet;
|
|
CDS_ZD: TClientDataSet;
|
|
cxStyleRepository1: TcxStyleRepository;
|
|
cxStyle1: TcxStyle;
|
|
procedure FormDestroy(Sender: TObject);
|
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|
procedure FormShow(Sender: TObject);
|
|
procedure TBCloseClick(Sender: TObject);
|
|
procedure TBRafreshClick(Sender: TObject);
|
|
procedure TBAddZDClick(Sender: TObject);
|
|
procedure TVZDCellClick(Sender: TcxCustomGridTableView;
|
|
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
|
|
AShift: TShiftState; var AHandled: Boolean);
|
|
procedure TvTopCellDblClick(Sender: TcxCustomGridTableView;
|
|
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
|
|
AShift: TShiftState; var AHandled: Boolean);
|
|
procedure TvBottomCellDblClick(Sender: TcxCustomGridTableView;
|
|
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
|
|
AShift: TShiftState; var AHandled: Boolean);
|
|
private
|
|
function GetZDName(): string;
|
|
procedure InitZD();
|
|
procedure InitTop();
|
|
procedure InitBottom();
|
|
{ Private declarations }
|
|
public
|
|
{ Public declarations }
|
|
end;
|
|
|
|
var
|
|
frmEmployeeBZ: TfrmEmployeeBZ;
|
|
|
|
implementation
|
|
|
|
uses
|
|
U_DataLink, U_RTFun, U_ZDYHelp;
|
|
|
|
{$R *.dfm}
|
|
|
|
procedure TfrmEmployeeBZ.FormDestroy(Sender: TObject);
|
|
begin
|
|
inherited;
|
|
frmEmployeeBZ := nil;
|
|
end;
|
|
|
|
procedure TfrmEmployeeBZ.FormClose(Sender: TObject; var Action: TCloseAction);
|
|
begin
|
|
inherited;
|
|
Action := caFree;
|
|
end;
|
|
|
|
function TfrmEmployeeBZ.GetZDName(): string;
|
|
begin
|
|
Result := '';
|
|
if CDS_ZD.Active and (not CDS_ZD.IsEmpty) then
|
|
Result := Trim(CDS_ZD.FieldByName('ZdyName').AsString);
|
|
end;
|
|
|
|
procedure TfrmEmployeeBZ.InitZD();
|
|
begin
|
|
try
|
|
ADOQueryZD.DisableControls;
|
|
with ADOQueryZD do
|
|
begin
|
|
Close;
|
|
SQL.Clear;
|
|
SQL.Add('select ZdyNo,ZdyName from KH_ZDY where Type=''BZNAME'' order by ZdyNo');
|
|
Open;
|
|
end;
|
|
SCreateCDS(ADOQueryZD, CDS_ZD);
|
|
SInitCDSData(ADOQueryZD, CDS_ZD);
|
|
finally
|
|
ADOQueryZD.EnableControls;
|
|
end;
|
|
end;
|
|
|
|
procedure TfrmEmployeeBZ.InitTop();
|
|
begin
|
|
try
|
|
ADOQueryTop.DisableControls;
|
|
with ADOQueryTop do
|
|
begin
|
|
Close;
|
|
SQL.Clear;
|
|
SQL.Add('select * from SY_Employee where bzname is null or bzname=''''');
|
|
SQL.Add(' order by EECode');
|
|
Open;
|
|
end;
|
|
SCreateCDS(ADOQueryTop, CDS_Top);
|
|
SInitCDSData(ADOQueryTop, CDS_Top);
|
|
finally
|
|
ADOQueryTop.EnableControls;
|
|
end;
|
|
end;
|
|
|
|
procedure TfrmEmployeeBZ.InitBottom();
|
|
var
|
|
fbz: string;
|
|
begin
|
|
fbz := GetZDName();
|
|
if fbz <> '' then
|
|
LabelBottom.Caption := ' |