|
|
unit u_sys_close;
|
|
|
|
|
|
interface
|
|
|
|
|
|
uses
|
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|
|
Dialogs, bsSkinCtrls, BusinessSkinForm,shellapi,bsSkinTabs,ADODB,
|
|
|
StdCtrls;
|
|
|
|
|
|
type
|
|
|
Tfrm_sys_close = class(TForm)
|
|
|
RadioGroup1: TbsSkinRadioGroup;
|
|
|
bsBusinessSkinForm1: TbsBusinessSkinForm;
|
|
|
bsSkinButton1: TbsSkinButton;
|
|
|
bsSkinButton2: TbsSkinButton;
|
|
|
Memo1: TMemo;
|
|
|
procedure bsSkinButton1Click(Sender: TObject);
|
|
|
procedure bsSkinButton2Click(Sender: TObject);
|
|
|
procedure FormShow(Sender: TObject);
|
|
|
private
|
|
|
function GetSysTypes: Boolean;
|
|
|
function SetPrivilege(sPrivilegeName: AnsiString; bEnable: Boolean): Boolean;
|
|
|
procedure ExitWin32Sys(iFlags: Integer);
|
|
|
{ Private declarations }
|
|
|
public
|
|
|
{ Public declarations }
|
|
|
end;
|
|
|
|
|
|
var
|
|
|
frm_sys_close: Tfrm_sys_close;
|
|
|
|
|
|
implementation
|
|
|
|
|
|
uses u_main, u_sys_relogin, u_tree_main, u_dxbar_main,
|
|
|
u_open_operation, u_open_code, u_open_info, u_open_report,
|
|
|
my_sys_function, u_sys_progress, u_data_share;
|
|
|
|
|
|
{$R *.dfm}
|
|
|
|
|
|
procedure Tfrm_sys_close.ExitWin32Sys(iFlags: Integer);
|
|
|
begin
|
|
|
if GetSysTypes then
|
|
|
ExitWindowsEx(iFlags,0)
|
|
|
else
|
|
|
if SetPrivilege('SeShutdownPrivilege',True) then
|
|
|
if not ExitWindowsEx(iFlags,0) then
|
|
|
SetPrivilege('SeShutdownPrivilege',False);
|
|
|
end;
|
|
|
|
|
|
function Tfrm_sys_close.GetSysTypes: Boolean;
|
|
|
var
|
|
|
ver: TOSVersionInfo;
|
|
|
begin
|
|
|
Result := False;
|
|
|
ver.dwOSVersionInfoSize := Sizeof(TOSVersionInfo);
|
|
|
if GetVersionEx(Ver) then
|
|
|
if Ver.dwPlatformId = VER_PLATFORM_WIN32_WINDOWS then
|
|
|
Result := True
|
|
|
else
|
|
|
Result := False;
|
|
|
end;
|
|
|
|
|
|
function Tfrm_sys_close.SetPrivilege(sPrivilegeName: AnsiString;
|
|
|
bEnable: Boolean): Boolean;
|
|
|
var
|
|
|
TPPrev, TP: TTokenPrivileges;
|
|
|
Token : THandle;
|
|
|
dwRetLen : DWord;
|
|
|
begin
|
|
|
Result := False;
|
|
|
OpenProcessToken(GetCurrentProcess, TOKEN_ADJUST_PRIVILEGES or
|
|
|
TOKEN_QUERY, Token);
|
|
|
TP.PrivilegeCount := 1;
|
|
|
if LookupPrivilegeValue(nil,PAnsiChar(sPrivilegeName),TP.Privileges[0].LUID) then
|
|
|
begin
|
|
|
if bEnable then
|
|
|
TP.Privileges[0].Attributes := SE_PRIVILEGE_ENABLED
|
|
|
else
|
|
|
TP.Privileges[0].Attributes := 0;
|
|
|
dwRetLen := 0;
|
|
|
Result := AdjustTokenPrivileges(Token, False, TP, SizeOf(TPPrev), TPPrev, dwRetLen);
|
|
|
end;
|
|
|
CloseHandle(Token);
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_sys_close.bsSkinButton1Click(Sender: TObject);
|
|
|
var MyPagecontrol:TbsSkinPageControl;
|
|
|
begin
|
|
|
|
|
|
case RadioGroup1.ItemIndex of
|
|
|
0:
|
|
|
begin
|
|
|
// SendLogoutMsg;
|
|
|
if (isclosewoke='<27><>') and (trim(isopenwoke)='<27><>') then
|
|
|
KillTask('DsrClient.exe');
|
|
|
Application.Terminate;
|
|
|
end;
|
|
|
1:
|
|
|
begin
|
|
|
{ if t_project then MyPagecontrol:=frm_tree_main.bsSkinPageControl1
|
|
|
else MyPagecontrol:=frm_dxbar_main.bsSkinPageControl1 ;
|
|
|
if MyPagecontrol.PageCount>2 then
|
|
|
begin
|
|
|
showmessage('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ر<EFBFBD><D8B1><EFBFBD><EFBFBD>е<EFBFBD>ҵ<EFBFBD><D2B5>ģ<EFBFBD>飡');
|
|
|
exit ;
|
|
|
end ;
|
|
|
}
|
|
|
if t_project then
|
|
|
if not frm_tree_main.freesheeet then exit ;
|
|
|
if not t_project then
|
|
|
if not frm_dxbar_main.freesheeet then exit ;
|
|
|
|
|
|
|
|
|
if assigned(frm_open_operation) then
|
|
|
freeAndNil(frm_open_operation);
|
|
|
|
|
|
if assigned(frm_open_code) then
|
|
|
FreeAndNIL(frm_open_code);
|
|
|
if assigned(frm_open_info) then
|
|
|
freeAndNil(frm_open_info);
|
|
|
|
|
|
if assigned(frm_open_report) then
|
|
|
freeAndNil(frm_open_report);
|
|
|
|
|
|
|
|
|
if Assigned(frm_tree_main) then
|
|
|
FreeAndNil(frm_tree_main);
|
|
|
if Assigned(frm_dxbar_main) then
|
|
|
FreeAndNil(frm_dxbar_main);
|
|
|
Hide;
|
|
|
try
|
|
|
if not assigned(frm_sys_relogin) then
|
|
|
frm_sys_relogin:=Tfrm_sys_relogin.Create(Application);
|
|
|
|
|
|
frm_sys_relogin.ShowModal;
|
|
|
close;
|
|
|
finally
|
|
|
frm_sys_relogin.Free;
|
|
|
frm_sys_relogin:=nil;
|
|
|
// frm_main.show;
|
|
|
end;
|
|
|
end;
|
|
|
{
|
|
|
2:
|
|
|
begin
|
|
|
SendLogoutMsg;
|
|
|
if (isclosewoke='<27><>') and (trim(isopenwoke)='<27><>') then
|
|
|
KillTask('DsrClient.exe');
|
|
|
Application.Terminate;
|
|
|
ExitWin32Sys(EWX_FORCE or EWX_REBOOT);//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
end;
|
|
|
3:
|
|
|
begin
|
|
|
SendLogoutMsg;
|
|
|
if (isclosewoke='<27><>') and (trim(isopenwoke)='<27><>') then
|
|
|
KillTask('DsrClient.exe');
|
|
|
Application.Terminate;
|
|
|
ExitWin32Sys(EWX_FORCE or EWX_POWEROFF);//<2F>رռ<D8B1><D5BC><EFBFBD><EFBFBD><EFBFBD>
|
|
|
end;
|
|
|
}
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_sys_close.bsSkinButton2Click(Sender: TObject);
|
|
|
begin
|
|
|
close;
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_sys_close.FormShow(Sender: TObject);
|
|
|
var aAdoQuery:TAdoQuery;
|
|
|
begin
|
|
|
{
|
|
|
|
|
|
if (pos('<27><><EFBFBD><EFBFBD>',department)>0)
|
|
|
or (pos('ϵͳ',employee)>0)
|
|
|
or (pos('<27><><EFBFBD><EFBFBD>',employee)>0)
|
|
|
or (pos('<27><><EFBFBD><EFBFBD>',department)>0)
|
|
|
then
|
|
|
try
|
|
|
if not ASSIGNED(frm_sys_progress) then
|
|
|
frm_sys_progress:=tfrm_sys_progress.Create(application);
|
|
|
frm_sys_progress.bsSkinGauge1.ProgressText:='<27><><EFBFBD><EFBFBD>У<EFBFBD>鵱<EFBFBD>մ<EFBFBD><D5B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݡ<EFBFBD><DDA1><EFBFBD><EFBFBD><EFBFBD>';
|
|
|
frm_sys_progress.Show;
|
|
|
frm_sys_progress.bsSkinGauge1.MaxValue:=10;
|
|
|
frm_sys_progress.bsSkinGauge1.MinValue:=0;
|
|
|
frm_sys_progress.bsSkinGauge1.Value:=0;
|
|
|
aAdoQuery:=CreateAdoQuery;
|
|
|
with aAdoQuery do
|
|
|
begin
|
|
|
frm_sys_progress.bsSkinGauge1.Value:=1;
|
|
|
frm_sys_progress.bsSkinGauge1.Value:=2;
|
|
|
frm_sys_progress.bsSkinGauge1.Value:=3;
|
|
|
frm_sys_progress.bsSkinGauge1.Value:=4;
|
|
|
frm_sys_progress.bsSkinGauge1.Value:=5;
|
|
|
Close;sql.Clear;
|
|
|
sql.Add('select v.<2E><><EFBFBD>ᵥ<EFBFBD><E1B5A5>,v.ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,fee.<2E><><EFBFBD><EFBFBD>,fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,do.ԭʼ<D4AD><CABC><EFBFBD><EFBFBD>,do.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD> from t_ch_fee fee');
|
|
|
sql.Add('inner JOIN t_ch_fee_do do on fee.<2E><><EFBFBD><EFBFBD>=do.ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD> and fee.ch_id=do.ch_id');
|
|
|
sql.Add('left join V_op_bscard_All v on fee.<2E><><EFBFBD><EFBFBD>=v.<2E><><EFBFBD><EFBFBD>');
|
|
|
sql.Add('where ((fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=0 and fee.<2E><><EFBFBD><EFBFBD><>0) or (fee.<2E><><EFBFBD><EFBFBD>>0 and fee.<2E><><EFBFBD><EFBFBD><fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) or (fee.<2E><><EFBFBD><EFBFBD><0 and fee.<2E><><EFBFBD><EFBFBD>>fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>))');
|
|
|
sql.Add('and do.<2E><><EFBFBD><EFBFBD> in (3,4)');
|
|
|
sql.Add('union ');
|
|
|
sql.Add('select v.<2E><><EFBFBD>ᵥ<EFBFBD><E1B5A5>,v.ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,fee.<2E><><EFBFBD><EFBFBD>,fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,0 ԭʼ<D4AD><CABC><EFBFBD><EFBFBD>,'''' <20>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD> from t_ch_fee fee');
|
|
|
sql.Add('left join V_op_bscard_All v on fee.<2E><><EFBFBD><EFBFBD>=v.<2E><><EFBFBD><EFBFBD>');
|
|
|
sql.Add('where (fee.<2E><><EFBFBD><EFBFBD>>0 and fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><0) or (fee.<2E><><EFBFBD><EFBFBD>>0 and fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>fee.<2E><><EFBFBD><EFBFBD>)');
|
|
|
sql.Add('or (fee.<2E><><EFBFBD><EFBFBD><0 and fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>0)');
|
|
|
sql.Add('union ');
|
|
|
sql.Add('select v.<2E><><EFBFBD>ᵥ<EFBFBD><E1B5A5>,v.ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,'''' <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,'''' <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,0 <20><><EFBFBD><EFBFBD>,v_valid_dofee_bs.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,v_valid_dofee.ԭʼ<D4AD><CABC><EFBFBD><EFBFBD>,'''' <20>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>');
|
|
|
sql.Add('from v_valid_dofee_bs');
|
|
|
sql.Add('left join v_valid_dofee on v_valid_dofee_bs.<2E><><EFBFBD><EFBFBD>=v_valid_dofee.ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|
|
sql.Add('left join V_op_bscard_All v on v_valid_dofee_bs.<2E><><EFBFBD><EFBFBD>=v.<2E><><EFBFBD><EFBFBD>');
|
|
|
sql.Add('where v_valid_dofee_bs.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><>v_valid_dofee.ԭʼ<D4AD><CABC><EFBFBD><EFBFBD>');
|
|
|
sql.Add('order by v.<2E><><EFBFBD>ᵥ<EFBFBD><E1B5A5>');
|
|
|
|
|
|
Open;
|
|
|
frm_sys_progress.bsSkinGauge1.Value:=6;
|
|
|
if not IsEmpty then
|
|
|
begin
|
|
|
aAdoQuery.SaveToFile('c:\ds.xml',pfXML);
|
|
|
Memo1.font.Color:=clred;
|
|
|
Memo1.Lines.Add('У<><D0A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>쳣:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ŵ<EFBFBD>c:\ds.xml');
|
|
|
Memo1.Lines.Add('<27><><EFBFBD>붫ʤ<EBB6AB><CAA4>ϵ:0532-83863830');
|
|
|
end
|
|
|
else
|
|
|
Memo1.Lines.Add('û<><C3BB><EFBFBD>쳣');
|
|
|
Memo1.Lines.Add(department+' '+employee);
|
|
|
|
|
|
frm_sys_progress.bsSkinGauge1.Value:=7;
|
|
|
frm_sys_progress.bsSkinGauge1.Value:=8;
|
|
|
frm_sys_progress.bsSkinGauge1.Value:=9;
|
|
|
end;
|
|
|
finally
|
|
|
aAdoQuery.FREE;
|
|
|
frm_sys_progress.bsSkinGauge1.Value:=10;
|
|
|
frm_sys_progress.Close;
|
|
|
frm_sys_progress.Free;
|
|
|
frm_sys_progress:=nil;
|
|
|
end;
|
|
|
}
|
|
|
|
|
|
end;
|
|
|
|
|
|
end.
|