620 lines
17 KiB
ObjectPascal
620 lines
17 KiB
ObjectPascal
unit U_EmployeeList;
|
||
|
||
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,
|
||
cxGridCustomPopupMenu, cxGridPopupMenu, cxGridLevel, cxClasses, cxControls,
|
||
cxGridCustomView, cxGridCustomTableView, cxGridTableView, cxGridDBTableView,
|
||
cxGrid, DBClient, cxCheckBox, cxCalendar, cxSplitter, RM_Dataset, RM_System,
|
||
RM_Common, RM_Class, RM_GridReport, RM_e_Xls, Menus, cxButtonEdit,
|
||
cxDropDownEdit, cxPC, cxTL, cxMaskEdit, cxInplaceContainer, cxDBTL, cxTLData,
|
||
cxLookAndFeels, cxLookAndFeelPainters, cxTLdxBarBuiltInMenu, dxBarBuiltInMenu,
|
||
cxNavigator, U_BaseList, dxSkinsCore, dxSkinsDefaultPainters, dxDateRanges,
|
||
cxContainer, cxTextEdit;
|
||
|
||
type
|
||
TfrmEmployeeList = class(TfrmBaseList)
|
||
ToolBar1: TToolBar;
|
||
TBRafresh: TToolButton;
|
||
TBFind: TToolButton;
|
||
TBAdd: TToolButton;
|
||
TBEdit: TToolButton;
|
||
TBDel: TToolButton;
|
||
TBClose: TToolButton;
|
||
cxGridPopupMenu1: TcxGridPopupMenu;
|
||
ADOQueryCmd: TADOQuery;
|
||
ADOQueryMain: TADOQuery;
|
||
ADOQueryTemp: TADOQuery;
|
||
DataSource1: TDataSource;
|
||
TBExport: TToolButton;
|
||
Order_Main: TClientDataSet;
|
||
TBView: TToolButton;
|
||
Panel1: TPanel;
|
||
PopupMenu1: TPopupMenu;
|
||
N2: TMenuItem;
|
||
N1: TMenuItem;
|
||
Label1: TLabel;
|
||
EEName: TEdit;
|
||
Label2: TLabel;
|
||
Sex: TComboBox;
|
||
Label5: TLabel;
|
||
Post: TEdit;
|
||
cxDBTreeList1: TcxDBTreeList;
|
||
cxDBTreeList1cxDBTreeListColumn2: TcxDBTreeListColumn;
|
||
DataSource2: TDataSource;
|
||
CDS_Tree: TClientDataSet;
|
||
ADOQueryTree: TADOQuery;
|
||
cxSplitter1: TcxSplitter;
|
||
cxTabControl1: TcxTabControl;
|
||
TLZ: TToolButton;
|
||
ADOQuery1: TADOQuery;
|
||
TCXLZ: TToolButton;
|
||
cxStyleRepository1: TcxStyleRepository;
|
||
cxStyle1: TcxStyle;
|
||
cxGrid1: TcxGrid;
|
||
Tv1: TcxGridDBTableView;
|
||
v1RuZhiDate: TcxGridDBColumn;
|
||
v1YGName: TcxGridDBColumn;
|
||
v1Column1: TcxGridDBColumn;
|
||
v1Column2: TcxGridDBColumn;
|
||
v1Column8: TcxGridDBColumn;
|
||
v1Column6: TcxGridDBColumn;
|
||
v1Column29: TcxGridDBColumn;
|
||
v1SJLiZhiDate: TcxGridDBColumn;
|
||
cxGrid1Level1: TcxGridLevel;
|
||
Label4: TLabel;
|
||
Dept: TEdit;
|
||
v1SFZNo: TcxGridDBColumn;
|
||
Panel2: TPanel;
|
||
Label6: TLabel;
|
||
SJLiZhiDate: TDateTimePicker;
|
||
v1YGNo: TcxGridDBColumn;
|
||
Label7: TLabel;
|
||
EECode: TEdit;
|
||
ToolButton2: TToolButton;
|
||
v1Column4: TcxGridDBColumn;
|
||
Tv1Column1: TcxGridDBColumn;
|
||
Tv1Column2: TcxGridDBColumn;
|
||
Tv1Column3: TcxGridDBColumn;
|
||
Tv1Column4: TcxGridDBColumn;
|
||
Tv1Column5: TcxGridDBColumn;
|
||
Tv1Column6: TcxGridDBColumn;
|
||
procedure FormDestroy(Sender: TObject);
|
||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||
procedure FormCreate(Sender: TObject);
|
||
procedure TBCloseClick(Sender: TObject);
|
||
procedure TBFindClick(Sender: TObject);
|
||
procedure TBEditClick(Sender: TObject);
|
||
procedure TBDelClick(Sender: TObject);
|
||
procedure TBExportClick(Sender: TObject);
|
||
procedure TBRafreshClick(Sender: TObject);
|
||
procedure TBAddClick(Sender: TObject);
|
||
procedure FormShow(Sender: TObject);
|
||
procedure CheckBox1Click(Sender: TObject);
|
||
procedure CheckBox2Click(Sender: TObject);
|
||
procedure TBViewClick(Sender: TObject);
|
||
procedure CustomerNoNameChange(Sender: TObject);
|
||
procedure N2Click(Sender: TObject);
|
||
procedure N1Click(Sender: TObject);
|
||
procedure cxTabControl1Change(Sender: TObject);
|
||
procedure Tv1CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
||
procedure EENameChange(Sender: TObject);
|
||
procedure cxDBTreeList1DblClick(Sender: TObject);
|
||
procedure Tv1CellClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
||
procedure TLZClick(Sender: TObject);
|
||
procedure TCXLZClick(Sender: TObject);
|
||
procedure ToolButton2Click(Sender: TObject);
|
||
private
|
||
canshu1: string;
|
||
DQdate: TDateTime;
|
||
procedure InitGrid();
|
||
procedure InitForm();
|
||
|
||
procedure InitTree();
|
||
procedure GLAge();
|
||
{ Private declarations }
|
||
public
|
||
FFInt, FCloth: Integer;
|
||
|
||
{ Public declarations }
|
||
end;
|
||
|
||
var
|
||
frmEmployeeList: TfrmEmployeeList;
|
||
|
||
implementation
|
||
|
||
uses
|
||
U_DataLink, U_RTFun, U_ZDYHelp, U_EmployeeInPut, U_DeptTypeHelp; // U_FjList_RZ,
|
||
|
||
{$R *.dfm}
|
||
|
||
procedure TfrmEmployeeList.FormDestroy(Sender: TObject);
|
||
begin
|
||
inherited;
|
||
frmEmployeeList := nil;
|
||
end;
|
||
|
||
procedure TfrmEmployeeList.FormClose(Sender: TObject; var Action: TCloseAction);
|
||
begin
|
||
inherited;
|
||
Action := caFree;
|
||
end;
|
||
|
||
procedure TfrmEmployeeList.FormCreate(Sender: TObject);
|
||
begin
|
||
inherited;
|
||
canshu1 := Trim(DParameters1);
|
||
SJLiZhiDate.Date := SGetServerDate(ADOQueryTemp);
|
||
cxgrid1.Align := alClient;
|
||
end;
|
||
|
||
procedure TfrmEmployeeList.TBCloseClick(Sender: TObject);
|
||
begin
|
||
Close;
|
||
WriteCxGrid('Ա<><D4B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>2', Tv1, 'OA<4F><41><EFBFBD><EFBFBD>');
|
||
end;
|
||
|
||
procedure TfrmEmployeeList.InitGrid();
|
||
var
|
||
SqlStr, FilterStr: string;
|
||
begin
|
||
FilterStr := SGetFilters(Panel1, 1, 2);
|
||
SqlStr := ' exec P_EE_Get_All @DPID=' + quotedstr(Trim(CDS_Tree.fieldbyname('DPID').AsString));
|
||
SqlStr := SqlStr + ' ,@LiZhiFlag=' + quotedstr(Trim(inttostr(cxTabControl1.TabIndex)));
|
||
InitCDSData(ADOQueryMain, Order_Main, Tv1, SqlStr, FilterStr, '');
|
||
end;
|
||
// try
|
||
// ADOQueryMain.DisableControls;
|
||
// with ADOQueryMain do
|
||
// begin
|
||
// Filtered := False;
|
||
// Close;
|
||
// sql.Clear;
|
||
// sql.Add(' exec P_EE_Get_All :DPID,:LiZhiFlag');
|
||
// Parameters.ParamByName('DPID').Value := ;
|
||
// Parameters.ParamByName('LiZhiFlag').Value := cxTabControl1.TabIndex;
|
||
// Open;
|
||
// end;
|
||
// SCreateCDS(ADOQueryMain, Order_Main);
|
||
// SInitCDSData(ADOQueryMain, Order_Main);
|
||
// finally
|
||
// ADOQueryMain.EnableControls;
|
||
// end;
|
||
//end;
|
||
|
||
procedure TfrmEmployeeList.GLAge();
|
||
var
|
||
FXTGLNF, FYGGLNF, FGLYF: Double;
|
||
begin
|
||
FXTGLNF := strtofloat(uppercase(formatdateTime('yyyy', SGetServerDate(ADOQueryTemp))));
|
||
with ADOQueryCmd do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('select RuZhiDate,YGYearGL from SY_Employee where YGType=''<27><>ʽ'' ');
|
||
open;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
first;
|
||
while not eof do
|
||
begin
|
||
edit;
|
||
if ADOQueryCmd.fieldbyname('RuZhiDate').asstring = '' then
|
||
begin
|
||
fieldbyname('YGYearGL').AsFloat := 0;
|
||
end
|
||
else
|
||
begin
|
||
FYGGLNF := strtofloat(uppercase(formatdateTime('yyyy', ADOQueryCmd.fieldbyname('RuZhiDate').AsDateTime)));
|
||
FGLYF := strtofloat(uppercase(formatdateTime('MM', ADOQueryCmd.fieldbyname('RuZhiDate').AsDateTime)));
|
||
if (FGLYF >= 1) and (FGLYF <= 3) then
|
||
fieldbyname('YGYearGL').AsFloat := FXTGLNF - FYGGLNF + 1;
|
||
if (FGLYF > 3) and (FGLYF <= 9) then
|
||
fieldbyname('YGYearGL').AsFloat := FXTGLNF - FYGGLNF + 0.5;
|
||
if (FGLYF > 9) and (FGLYF <= 12) then
|
||
fieldbyname('YGYearGL').AsFloat := FXTGLNF - FYGGLNF;
|
||
end;
|
||
next;
|
||
end;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmEmployeeList.InitTree();
|
||
var
|
||
i: Integer;
|
||
begin
|
||
try
|
||
ADOQueryTree.DisableControls;
|
||
with ADOQueryTree do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
SQL.Add('select * from SY_Dept order by DPlevel,DPOrder,DPName');
|
||
Open;
|
||
end;
|
||
SCreateCDS(ADOQueryTree, CDS_Tree);
|
||
SInitCDSData(ADOQueryTree, CDS_Tree);
|
||
cxDBTreeList1.Items[0].Expand(True);
|
||
finally
|
||
ADOQueryTree.EnableControls;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmEmployeeList.InitForm();
|
||
begin
|
||
ReadCxGrid('Ա<><D4B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>2', Tv1, 'OA<4F><41><EFBFBD><EFBFBD>');
|
||
InitTree();
|
||
// GLAge();
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmEmployeeList.TBFindClick(Sender: TObject);
|
||
begin
|
||
if ADOQueryMain.Active = False then
|
||
Exit;
|
||
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
||
SCreateCDS(ADOQueryMain, Order_Main);
|
||
SInitCDSData(ADOQueryMain, Order_Main);
|
||
end;
|
||
|
||
procedure TfrmEmployeeList.TBEditClick(Sender: TObject);
|
||
begin
|
||
if Order_Main.IsEmpty then
|
||
Exit;
|
||
try
|
||
frmYGInPut := TfrmYGInPut.Create(Application);
|
||
with frmYGInPut do
|
||
begin
|
||
PState := 1;
|
||
FMainId := Trim(Self.Order_Main.fieldbyname('EEID').AsString);
|
||
FDPID := Trim(CDS_Tree.fieldbyname('DPID').AsString);
|
||
FDPName := trim(CDS_Tree.fieldbyname('DPName').AsString);
|
||
frmYGInPut.canshu1 := Trim(Self.canshu1);
|
||
if ShowModal = 1 then
|
||
begin
|
||
initgrid();
|
||
end;
|
||
end;
|
||
finally
|
||
frmYGInPut.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmEmployeeList.TBDelClick(Sender: TObject);
|
||
begin
|
||
if Order_Main.IsEmpty then
|
||
Exit;
|
||
//if cxTabControl1.TabIndex<>0 then Exit;
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
||
Exit;
|
||
try
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
with Order_Main do
|
||
begin
|
||
DisableControls;
|
||
First;
|
||
while not eof do
|
||
begin
|
||
if fieldbyname('ssel').AsBoolean then
|
||
begin
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('Delete SY_Employee where EEID=''' + Trim(Order_Main.fieldbyname('EEID').AsString) + '''');
|
||
sql.Add('Delete SY_User where UserID=''' + Trim(Order_Main.fieldbyname('EECode').AsString) + '''');
|
||
sql.Add('Delete TP_File where TFType=''YG'' and WBId=''' + Trim(Order_Main.fieldbyname('EEID').AsString) + '''');
|
||
ExecSQL;
|
||
end;
|
||
end;
|
||
next;
|
||
end;
|
||
EnableControls;
|
||
end;
|
||
ADOQueryCmd.Connection.CommitTrans;
|
||
InitGrid();
|
||
except
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Order_Main.EnableControls;
|
||
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmEmployeeList.TBExportClick(Sender: TObject);
|
||
begin
|
||
if ADOQueryMain.IsEmpty then
|
||
Exit;
|
||
TcxGridToExcel('Ա<><D4B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>', cxGrid1);
|
||
end;
|
||
|
||
procedure TfrmEmployeeList.TBRafreshClick(Sender: TObject);
|
||
begin
|
||
InitTree();
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmEmployeeList.TBAddClick(Sender: TObject);
|
||
var
|
||
maxno: string;
|
||
begin
|
||
try
|
||
frmYGInPut := TfrmYGInPut.Create(Application);
|
||
with frmYGInPut do
|
||
begin
|
||
PState := 0;
|
||
FMainId := '';
|
||
FDPID := Trim(CDS_Tree.fieldbyname('DPID').AsString);
|
||
FDPName := trim(CDS_Tree.fieldbyname('DPName').AsString);
|
||
if ShowModal = 1 then
|
||
begin
|
||
initgrid();
|
||
end;
|
||
end;
|
||
finally
|
||
frmYGInPut.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmEmployeeList.FormShow(Sender: TObject);
|
||
begin
|
||
inherited;
|
||
v1SJLiZhiDate.Visible := false;
|
||
if cxTabControl1.TabIndex <> 0 then
|
||
v1SJLiZhiDate.Visible := true;
|
||
InitForm();
|
||
end;
|
||
|
||
procedure TfrmEmployeeList.CheckBox1Click(Sender: TObject);
|
||
begin
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmEmployeeList.CheckBox2Click(Sender: TObject);
|
||
begin
|
||
TBRafresh.Click;
|
||
end;
|
||
|
||
procedure TfrmEmployeeList.TBViewClick(Sender: TObject);
|
||
begin
|
||
if Order_Main.IsEmpty then
|
||
Exit;
|
||
try
|
||
frmYGInPut := TfrmYGInPut.Create(Application);
|
||
with frmYGInPut do
|
||
begin
|
||
PState := 1;
|
||
FMainId := Trim(Self.Order_Main.fieldbyname('EEID').AsString);
|
||
FDPID := Trim(CDS_Tree.fieldbyname('DPID').AsString);
|
||
TBSave.Visible := False;
|
||
ToolButton1.Visible := False;
|
||
ToolButton2.Visible := False;
|
||
if ShowModal = 1 then
|
||
begin
|
||
|
||
end;
|
||
end;
|
||
finally
|
||
frmYGInPut.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmEmployeeList.CustomerNoNameChange(Sender: TObject);
|
||
begin
|
||
if ADOQueryMain.Active = False then
|
||
Exit;
|
||
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
||
SCreateCDS(ADOQueryMain, Order_Main);
|
||
SInitCDSData(ADOQueryMain, Order_Main);
|
||
end;
|
||
|
||
procedure TfrmEmployeeList.N2Click(Sender: TObject);
|
||
begin
|
||
SelOKNo(Order_Main, True);
|
||
end;
|
||
|
||
procedure TfrmEmployeeList.N1Click(Sender: TObject);
|
||
begin
|
||
SelOKNo(Order_Main, False);
|
||
end;
|
||
|
||
procedure TfrmEmployeeList.cxTabControl1Change(Sender: TObject);
|
||
begin
|
||
v1SJLiZhiDate.Visible := false;
|
||
if cxTabControl1.TabIndex <> 0 then
|
||
v1SJLiZhiDate.Visible := true;
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmEmployeeList.Tv1CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
||
begin
|
||
TBView.Click;
|
||
end;
|
||
|
||
procedure TfrmEmployeeList.EENameChange(Sender: TObject);
|
||
begin
|
||
TBFind.Click;
|
||
end;
|
||
|
||
procedure TfrmEmployeeList.cxDBTreeList1DblClick(Sender: TObject);
|
||
begin
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmEmployeeList.Tv1CellClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
||
begin
|
||
if Order_Main.IsEmpty then
|
||
Exit;
|
||
CDS_Tree.Locate('DPID', Trim(Order_Main.fieldbyname('DPID').AsString), []);
|
||
end;
|
||
|
||
procedure TfrmEmployeeList.TLZClick(Sender: TObject);
|
||
begin
|
||
|
||
if order_Main.IsEmpty then
|
||
exit;
|
||
if CxTabConTrol1.TabIndex <> 0 then
|
||
exit;
|
||
if application.MessageBox('ȷ<><C8B7>Ҫִ<D2AA>д˲<D0B4><CBB2><EFBFBD>', '<27><>ʾ', 1) = 2 then
|
||
exit;
|
||
|
||
try
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
with Order_Main do
|
||
begin
|
||
DisableControls;
|
||
First;
|
||
while not eof do
|
||
begin
|
||
if fieldbyname('ssel').AsBoolean then
|
||
begin
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('update SY_Employee set EEType=''<27><>ְ'',DepartureDate=' + Quotedstr(trim(FormatDateTime('yyyy-MM-dd', SJLiZhiDate.Date))));
|
||
sql.Add(' where EEID=''' + trim(Order_Main.fieldbyname('EEID').AsString) + '''');
|
||
ExecSQL;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('exec P_EE_in_Account @DataID=''' + Trim(Order_Main.fieldbyname('EEID').AsString) + '''');
|
||
Open;
|
||
end;
|
||
if ADOQueryCmd.FieldByName('intReturn').AsInteger = -1 then
|
||
raise Exception.Create(PChar(ADOQueryCmd.fieldbyname('ShowMsg').AsString));
|
||
end;
|
||
next;
|
||
end;
|
||
EnableControls;
|
||
end;
|
||
ADOQueryCmd.Connection.CommitTrans;
|
||
InitGrid();
|
||
except
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Order_Main.EnableControls;
|
||
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmEmployeeList.TCXLZClick(Sender: TObject);
|
||
begin
|
||
if order_Main.IsEmpty then
|
||
exit;
|
||
if cxTabControl1.TabIndex <> 1 then
|
||
exit;
|
||
if application.MessageBox('ȷ<><C8B7>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ְ<EFBFBD><D6B0>', '<27><>ʾ', 1) = 2 then
|
||
exit;
|
||
|
||
try
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
with Order_Main do
|
||
begin
|
||
DisableControls;
|
||
First;
|
||
while not eof do
|
||
begin
|
||
if fieldbyname('ssel').AsBoolean then
|
||
begin
|
||
with ADOQueryCmd do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('update SY_Employee set EEType=''<27><>ʽ'',DepartureDate=NULL');
|
||
sql.Add(' where EEID=''' + trim(Order_Main.fieldbyname('EEID').AsString) + '''');
|
||
execsql;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('exec P_EE_in_Account @DataID=''' + Trim(Order_Main.fieldbyname('EEID').AsString) + '''');
|
||
Open;
|
||
end;
|
||
if ADOQueryCmd.FieldByName('intReturn').AsInteger = -1 then
|
||
raise Exception.Create(PChar(ADOQueryCmd.fieldbyname('ShowMsg').AsString));
|
||
end;
|
||
next;
|
||
end;
|
||
EnableControls;
|
||
end;
|
||
ADOQueryCmd.Connection.CommitTrans;
|
||
InitGrid();
|
||
except
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Order_Main.EnableControls;
|
||
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmEmployeeList.ToolButton2Click(Sender: TObject);
|
||
var
|
||
FDPID, FName: string;
|
||
begin
|
||
if Order_Main.IsEmpty then
|
||
exit;
|
||
if Order_Main.Locate('ssel', true, []) = false then
|
||
begin
|
||
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
FDPID := '';
|
||
FName := '';
|
||
frmDeptTypeHelp := TfrmDeptTypeHelp.create(self);
|
||
with frmDeptTypeHelp do
|
||
begin
|
||
if showmodal = 1 then
|
||
begin
|
||
FDPID := Trim(ADOQueryHelp.fieldbyname('DPID').AsString);
|
||
FName := Trim(ADOQueryHelp.fieldbyname('DPName').AsString);
|
||
end;
|
||
free;
|
||
end;
|
||
|
||
if trim(FDPID) = '' then
|
||
exit;
|
||
|
||
try
|
||
with Order_Main do
|
||
begin
|
||
DisableControls;
|
||
First;
|
||
while not eof do
|
||
begin
|
||
if fieldbyname('ssel').AsBoolean then
|
||
begin
|
||
with ADOQueryCmd do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('update SY_Employee SET Dept=''' + trim(FName) + ''' ');
|
||
sql.Add(',DPID=''' + trim(FDPID) + ''' ');
|
||
sql.Add('where EEID=' + quotedstr(trim(Order_Main.fieldbyname('EEID').AsString)));
|
||
execsql;
|
||
end;
|
||
end;
|
||
next;
|
||
end;
|
||
First;
|
||
EnableControls;
|
||
end;
|
||
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
|
||
initgrid();
|
||
except
|
||
Order_Main.EnableControls;
|
||
application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
end;
|
||
end;
|
||
|
||
end.
|
||
|