⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 unit1.pas

📁 有关密码为: 服务端:为 “1”。 客户端:为机器的月份+日期。 如“2005/08/05”
💻 PAS
📖 第 1 页 / 共 3 页
字号:
 aboutf:tjaqang;
 n8c1:string;
begin
if lv1.SelCount<>0 then
  begin
  n8c1:=lv1.Selected.SubItems[2];
  delete(n8c1,3,12);
  if n8c1<>'L-' then
  begin
  showmessage('    会 员'+#10#13+#10#13+'请在会员管理中加钱');
  exit;
  end;
  aboutf:=tjaqang.Create(self);
  aboutf.ShowModal;
  table1.Refresh;  //
  end;
end;

procedure TForm1.N14Click(Sender: TObject);
begin     //刷新
   jlsx(1);
end;

procedure TForm1.Timer1Timer(Sender: TObject);
begin
if sizong>18 then   //每3分钟刷新一次 时钟器是10秒一次
   begin
   jlsx(0); //计录刷新过程
    sizong:=0;

    end
else
   inc(sizong);
end;

procedure TForm1.N11Click(Sender: TObject);
   //结帐
var
 n11c1:array[0..250] of char;
 str,str1,str3:string;
begin
if lv1.SelCount=0 then exit; //如果没有选中记录就退出
if lv1.Selected.SubItems[2]='' then  //如果是空位则添加临时卡
  begin
  Form1.N7Click(Sender);
  exit;
  end;
  str:=lv1.Selected.SubItems[3];
  str1:=lv1.Selected.SubItems[6];
  str3:=lv1.Selected.SubItems[7];
  str3:='要结帐吗?'+#10#13+#10#13+#10#13+'押金:'+str+' 元'+#10#13+#10#13+'费用:'+str1+' 元'+#10#13+#10#13+'应退:'+str3+' 元'+#10#13;
  strpcopy(n11c1,str3);
if application.messagebox(n11c1,'注意',
   mb_yesno+mb_defbutton2+mb_iconquestion+mb_systemmodal)<>6 then
   exit;

 lkjz(lv1.Selected.SubItems[11]);

end;



procedure TForm1.N6Click(Sender: TObject);
var
 aboutf:tlsjl;      //添加会员
begin
aboutf:=tlsjl.Create(self);
aboutf.ShowModal;
end;

procedure TForm1.N18Click(Sender: TObject);
//远程重启电脑
begin
if lv1.SelCount=0 then exit; //没有焦点退出
fxx('rest',lv1.Selected.SubItems[11]);
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[8];
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)<=5) and (item.SubItems[3]<>'')  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[0]='?' 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;
sb1.Panels[3].Text:='  '+datetostr(date)+'   '+timetostr(now);
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[2]=''  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[4]='托管上机' 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[11]); //远程托管
    tg1:='update temp set 标志="×"  where IP="'+lv1.Selected.SubItems[11]+'"';
        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[11]); //远程托管
    tg1:='update temp set 标志="T"  where IP="'+lv1.Selected.SubItems[11]+'"';
        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[11]);
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -