?? unit1.pas
字號:
begin
if lv1.SelCount=0 then exit; //沒有焦點退出
fxx('sfnw1'+NMDayTime1.LocalIP,table1ip.Value);
fxx('rest',lv1.Selected.SubItems[12]);
end;
procedure TForm1.lv1ColumnClick(Sender: TObject; Column: TListColumn);
var
//排序
str1,str2:string;
begin
str1:=column.Caption;
str2:='select * from temp order by '+str1;
tb1.Close;
tb1.SQL.Clear;
tb1.SQL.Add(str2);
tb1.Prepared;
tb1.Open;
lv1_create_date;
end;
//拖曳換機部分 來自實務經典
procedure TForm1.lv1StartDrag(Sender: TObject;
var DragObject: TDragObject);
//開始拖
begin
lv1.HotTrack:=true;
td1:=lv1.ItemFocused.Caption;
end;
procedure TForm1.lv1DragDrop(Sender, Source: TObject; X, Y: Integer);
//放的對上
var
item1:tlistitem;
td3:string;
td4:integer;
hca1,hca2,hca3,hca4,hca5:string;
hcb1,hcb2,hcb3,hcb4,hcb5:string;
hia1,hia2,hib1,hib2:double;
hta1,htb1:tdatetime;
hda1,hdb1:tdatetime;
begin
td4:=9999; //初始化
hia1:=0; hia2:=0; hib1:=0; hib2:=0;
hta1:=0; htb1:=0; hda1:=0; hdb1:=0;
td2:=lv1.DropTarget.Caption;
td3:='選擇[ '+td1+' ]機與[ '+td2+' ]機互換嗎?';
if not (td1=td2) then
td4:=Application.MessageBox(pchar(td3),pchar('我要換機'),1,);
if td4=1 then
begin
Table1.First;
while not (Table1.Eof) do
begin
if Table1a1.Value=td1 then
begin
hda1:=table1a3.Value; // 日期
hta1:=table1a4.Value; // 上機時間
hca1:=table1a5.Value; // 卡號
hia1:=table1a6.Value; // 標準
hia2:=table1a7.Value; // 押金
hca2:=table1a12.Value; // 姓名
hca3:=table1a13.Value; // 證件
hca4:=table1a16.Value; // 備注
hca5:=table1a15.Value; // 上機標志
end;
Table1.Next;
end;
Table1.First;
while not (Table1.Eof) do
begin
if Table1a1.Value=td2 then
begin
hdb1:=table1a3.Value; // 日期
htb1:=table1a4.Value; // 上機時間
hcb1:=table1a5.Value; // 卡號
hib1:=table1a6.Value; // 標準
hib2:=table1a7.Value; // 押金
hcb2:=table1a12.Value; // 姓名
hcb3:=table1a13.Value; // 證件
hcb4:=table1a16.Value; // 備注
hcb5:=table1a15.Value;
table1.Edit;
table1a3.Value:=hda1;
table1a4.Value:=hta1;
table1a5.Value:=hca1;
table1a6.Value:=hia1;
table1a7.Value:=hia2;
table1a12.Value:=hca2;
table1a13.Value:=hca3;
table1a16.Value:=hca4;
table1a15.Value:=hca5;
table1a8.Value:=0;
table1a9.Value:=0;
table1a10.Value:=0;
table1a11.Value:=0;
table1.Post;
end;
Table1.Next;
end;
Table1.First;
while not (Table1.Eof) do
begin
if Table1a1.Value=td1 then
begin
table1.Edit;
table1a3.Value:=hdb1;
table1a4.Value:=htb1;
table1a5.Value:=hcb1;
table1a6.Value:=hib1;
table1a7.Value:=hib2;
table1a12.Value:=hcb2;
table1a13.Value:=hcb3;
table1a16.Value:=hcb4;
table1a15.Value:=hcb5;
table1a8.Value:=0;
table1a9.Value:=0;
table1a10.Value:=0;
table1a11.Value:=0;
table1.Post;
end;
Table1.Next;
end;
item1:=lv3.Items.Add;
item1.Caption:=timetostr(now);
item1.SubItems.Add(td1);
item1.SubItems.Add('→');
item1.SubItems.add(td2);
jlsx(0);
tb1.Close;
tb1.Prepared;
tb1.Open;
lv1_create_date;
end; //if td4=1
end; //TForm1.lv1DragDrop
procedure TForm1.lv1EndDrag(Sender, Target: TObject; X, Y: Integer);
// 停止拖
begin
lv1.HotTrack:=false;
end;
procedure TForm1.lv1StartDock(Sender: TObject;
var DragObject: TDragDockObject);
begin
end;
//拖曳換機 完
procedure TForm1.lv1CustomDrawSubItem(Sender: TCustomListView;
Item: TListItem; SubItem: Integer; State: TCustomDrawState;
var DefaultDraw: Boolean);
// 改變顏色
var
xq_color1:string;
begin
//---qqq 對第 item.SubItems[8] 進行處理文本為數字
xq_color1:=item.SubItems[9];
if xq_color1<>'' then
begin
if pos('-',xq_color1)>0 then xq_color1[pos('-',xq_color1)]:='0';
if pos(':',xq_color1)>0 then xq_color1[pos(':',xq_color1)]:='0';
end
else
xq_color1:='1000'; //當為空時隨便給個值以便下行strtofloat(xq_color1)轉出錯
//---qqq 完
if (strtofloat(xq_color1)<=6) and (item.SubItems[4]<>'') then //如果第8列小于為紅色
begin
sender.Canvas.Font.Color:=clRed; //改變字色
if item.Index mod 2 = 1 then
sender.Canvas.Brush.Color:=clwhite //單行背景色為clwhite
else
sender.Canvas.Brush.Color:=clInfoBk; //雙行背景色為 clInfoBk
end;
// 脫網標志"?" 則為黑色
if item.SubItems[1]='?' then
begin
sender.Canvas.Brush.Color:=clblack;
sender.Canvas.Font.Color:=clwhite
end;
end;
procedure TForm1.Panel8DblClick(Sender: TObject);
begin
if application.messagebox('要清空所有記錄嗎','注意',
mb_yesno+mb_defbutton2+mb_iconquestion+mb_systemmodal)=6 then
lv3.Clear;
end;
procedure TForm1.Panel5DblClick(Sender: TObject);
begin
if application.messagebox('要清空所有記錄嗎','注意',
mb_yesno+mb_defbutton2+mb_iconquestion+mb_systemmodal)=6 then
lv2.Clear;
end;
procedure TForm1.Timer2Timer(Sender: TObject);
var
sba1:integer;
begin
sba1:=0;
tb1.First;
while not tb1.Eof do
begin
if tb1a6.Value<>'' then
sba1:=sba1+1;
tb1.Next;
end;
sb1.Panels[1].Width:=form1.Width-480;
sb1.Panels[1].Text:='共有電腦 '+inttostr(lv1.Items.Count)+' 臺, 正在使用 '+inttostr(sba1)+' 臺, 有'+inttostr(lv1.Items.Count-sba1)+' 臺空閑。';
sb1.Panels[2].Text:=NMDayTime1.LocalIP;
end;
procedure TForm1.Panel5Click(Sender: TObject);
begin
IF LV1.Height=round(form1.Height/2) THEN
LV1.Height:=FORM1.Height-135
ELSE
lv1.Height:=round(form1.Height/2); //控制lv1高度
end;
procedure TForm1.FormResize(Sender: TObject);
begin
LV1.Height:=FORM1.Height-135; //當主窗口改變時間也改變lv1
end;
procedure TForm1.N26Click(Sender: TObject);
var
aboutf:thyzl; //添加會員
begin
aboutf:=thyzl.Create(self);
aboutf.ShowModal;
end;
procedure TForm1.lv2DblClick(Sender: TObject);
begin
if application.messagebox('要清空所有記錄嗎','注意',
mb_yesno+mb_defbutton2+mb_iconquestion+mb_systemmodal)=6 then
lv2.Clear;
end;
procedure TForm1.lv4DblClick(Sender: TObject);
begin
if application.messagebox('要清空所有記錄嗎','注意',
mb_yesno+mb_defbutton2+mb_iconquestion+mb_systemmodal)=6 then
lv4.Clear;
end;
procedure TForm1.lv3DblClick(Sender: TObject);
begin
if application.messagebox('要清空所有記錄嗎','注意',
mb_yesno+mb_defbutton2+mb_iconquestion+mb_systemmodal)=6 then
lv3.Clear;
end;
procedure TForm1.lv1DblClick(Sender: TObject);
begin
if lv1.SelCount=0 then exit; //沒有焦點退出
//雙擊沒有卡號則上機 否 則結帳
if lv1.Selected.SubItems[3]='' then Form1.N7Click(Sender)
else Form1.N11Click(Sender);
end;
procedure TForm1.N23Click(Sender: TObject);
var
aboutf7:txckh; //巡查客戶
begin
if lv1.SelCount=0 then exit; //沒有焦點退出
aboutf7:=txckh.Create(self);
aboutf7.ShowModal;
end;
procedure TForm1.lv1CustomDrawItem(Sender: TCustomListView;
Item: TListItem; State: TCustomDrawState; var DefaultDraw: Boolean);
begin
if item.Index mod 2 = 1 then
sender.Canvas.Brush.Color:=clwhite
else
sender.Canvas.Brush.Color:=clInfoBk;
end;
procedure TForm1.N28Click(Sender: TObject);
begin
close; //關閉主窗口
end;
procedure TForm1.N27Click(Sender: TObject);
var
puGUAN:string;
begin
puGUAN:=xq_mima();
if puGUAN<>'' then
begin //--if1
if puGUAN =table4a0.Value then
begin
form1.Show; //恢復主窗口
end;
end; //--if1if
end;
procedure TForm1.N2Click(Sender: TObject);
var
aboutf:tfwsz; //添加會員
begin
aboutf:=tfwsz.Create(self);
aboutf.ShowModal;
end;
procedure TForm1.N3Click(Sender: TObject);
var
ZUGUAN:string;
begin
ZUGUAN:=xq_mima();
if ZUGUAN<>'' then
begin //--if1
if ZUGUAN =table4a3.Value then
begin
zgtq:='system'; //設主管特權有效
end;
end; //--if1
end;
procedure TForm1.N25Click(Sender: TObject);
var
tg1,tg2:string;
begin
if lv1.SelCount=0 then exit; //沒有焦點退出
if lv1.Selected.SubItems[5]='托管上機' then
begin //是 正在托管 則解除
//添加到歷史記錄中
table2.Active:=true; //打開歷史庫
table2.Insert;
table2a1.Value:=tb1a2.Value; //電腦
table2a2.Value:=date;
table2a4.Value:=now; //下機時間
table2a5.Value:='托管下機'; //卡號
table2.Post;
table2.Active:=false; //操作完關庫
//添加歷史庫完
fxx('wqtj_qwerty',lv1.Selected.SubItems[12]); //遠程托管
tg1:='update temp set 標志="×" where IP="'+lv1.Selected.SubItems[12]+'"';
tg2:=tb1.SQL.Text;
tb1.Close;
tb1.SQL.Clear;
tb1.SQL.Add(tg1);
tb1.Prepared;
tb1.ExecSQL;
tb1.Close;
tb1.SQL.Clear;
tb1.SQL.Add(tg2);
tb1.Prepared;
tb1.Open;
lv1_create_date;
end
else
begin
//添加到歷史記錄中
table2.Active:=true; //打開歷史庫
table2.Insert;
table2a1.Value:=tb1a2.Value; //電腦
table2a2.Value:=date;
table2a3.Value:=now; //上機時間
table2a5.Value:='托管上機'; //卡號
table2.Post;
table2.Active:=false; //操作完關庫
//添加歷史庫完
fxx('wqtj_szxzxq_yfjf',lv1.Selected.SubItems[12]); //遠程托管
tg1:='update temp set 標志="T" where IP="'+lv1.Selected.SubItems[12]+'"';
tg2:=tb1.SQL.Text;
tb1.Close;
tb1.SQL.Clear;
tb1.SQL.Add(tg1);
tb1.Prepared;
tb1.ExecSQL;
tb1.Close;
tb1.SQL.Clear;
tb1.SQL.Add(tg2);
tb1.Prepared;
tb1.Open;
lv1_create_date;
end;
end;
procedure TForm1.lv1DragOver(Sender, Source: TObject; X, Y: Integer;
State: TDragState; var Accept: Boolean);
begin
// 本事件不能沒有 否則不能拖
end;
procedure TForm1.N29Click(Sender: TObject);
//發出查遠程機進程
begin
if lv1.SelCount=0 then exit; //沒有焦點退出
tproc.Create(self);
proc.Show;
proc.Caption:= lv1.Selected.Caption +' 進程';
fxx('proc',lv1.Selected.SubItems[12]);
end;
procedure TForm1.Timer3Timer(Sender: TObject);
begin
sb1.Panels[3].Text:=' '+datetostr(date)+' '+timetostr(now);
end;
procedure TForm1.N30Click(Sender: TObject);
var
devmode:tDevicemode;
Reg_id: TDateTime;
RegisterTemp: TRegistry;
InputStr, Get_id: string;
Reg_tag, ClickDok: Boolean;
Allow: Integer;
begin
Reg_tag := False; //軟件是否到注冊期
registerTemp := TRegistry.Create; //準備使用注冊表
with registerTemp do
begin
RootKey := HKEY_LOCAL_MACHINE; //存放
if OpenKey('Software\Microsoft\Windows\CurrentSowft\tag', True) then // 建一目錄,存放標志值
begin
if ValueExists('DateTag') then begin //用DateTag的值作為標志
Reg_id := ReadDate('DateTag'); //讀出標志值
if Reg_id <> 0 then //允許使用的時間到
Reg_tag := True;
end else
WriteDateTime('DateTag', Now);
end;
if Reg_tag then begin //要求用戶輸入注冊碼
ClickDok := InputQuery('請根據下面機器碼輸入注冊碼:',form1.Label3.Caption, inputstr);
if ClickDok then begin
Get_id :=floatToStr((strtofloat(form1.Label1.Caption)*3715379)-(strtofloat(form1.Label1.Caption)*313753)); //注冊碼2
if Get_id = InputStr then begin
WriteDateTime('DateTag', 0); //將標志值置為0,即已注冊。
CloseKey;
Free;
end
else begin //若輸入的注冊碼錯誤
Application.MessageBox('注冊碼錯誤!請與作者聯系!', '警告框', mb_ok);
CloseKey;
Free;
end;
end
else begin //若用戶不輸入注冊碼
Application.MessageBox('請與作者聯系,使用注冊軟件!', '警告框', mb_ok);
CloseKey;
Free;
end;
end;
end;
end;
end.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -