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

📄 mrsjbf.pas

📁 这是用Delphi编写的汽车配件管理系统。主要功能有基础信息管理
💻 PAS
📖 第 1 页 / 共 3 页
字号:
        time1.Locate('bian','rk3',[lopartialkey]);
        time1.edit;
        time1.fieldbyname('time').asdatetime:=date;
        time1.Post;
        end;
     3:begin
        time1.Locate('bian','rk4',[lopartialkey]);
        time1.edit;
        time1.fieldbyname('time').asdatetime:=date;
        time1.Post;
        end;
     4:begin
        time1.Locate('bian','rk5',[lopartialkey]);
        time1.edit;
        time1.fieldbyname('time').asdatetime:=date;
        time1.Post;
        end;
     end;
    label3.caption:=inttostr(shu);
    label4.caption:=datetostr(time1.fieldbyname('time').asdatetime);
   chu:=true;
   showmessage('数据备份成功。');
except on exception do showmessage('数据有误,不能备份。');
end;
end;

end;
procedure TSJBF.FormShow(Sender: TObject);
var shu:integer;
begin

chu:=false;
ru:=false;
tui:=false;
shu:=0;
pagecontrol1.ActivePage:=tabsheet1;
combobox1.itemindex:=0;
    time1.Locate('bian','rk1',[Lopartialkey]);
    table4.filter:=format('bei'+'='+'''%s''',[combobox1.text]);
    table4.First;
    while not table4.eof do begin
       table4.next;
       shu:=shu+1;
       end;
    label3.caption:=inttostr(shu);
    label4.caption:=datetostr(time1.fieldbyname('time').asdatetime);
   end;

procedure TSJBF.BitBtn3Click(Sender: TObject);
begin
if table4.Locate('bei',combobox1.text,[lopartialkey]) then begin
if application.MessageBox('恢复记录将覆盖现有的所有的记录,'+#13+'  您确定吗?',
   '提醒',mb_yesno)=idyes then begin
      try
      table1.First;
      while not table1.eof do begin
           table1.delete;
       end;
      table4.first;
      while not table4.eof do begin
         table1.insert;
   table1.fieldbyname('cpbh').asstring:=
      table4.fieldbyname('cpbh').asstring;
   table1.fieldbyname('cpmc').asstring:=
      table4.fieldbyname('cpmc').asstring;
   table1.fieldbyname('cpxh').asstring:=
      table4.fieldbyname('cpxh').asstring;
   table1.fieldbyname('cpbs').asstring:=
      table4.fieldbyname('cpbs').asstring;
   table1.fieldbyname('jsr').asstring:=
      table4.fieldbyname('jsr').asstring;
   table1.fieldbyname('rdate').asdatetime:=
      table4.fieldbyname('rdate').asdatetime;
   table1.fieldbyname('danjia').asinteger:=
      table4.fieldbyname('danjia').asinteger;
   table1.fieldbyname('dan').asstring:=
      table4.fieldbyname('dan').asstring;
   table1.fieldbyname('shuliang').asstring:=
      table4.fieldbyname('shuliang').asstring;
   table1.fieldbyname('cx').asstring:=
      table4.fieldbyname('cx').asstring;
   table1.fieldbyname('cd').asstring:=
      table4.fieldbyname('cd').asstring;
   table1.fieldbyname('khbh').asstring:=
      table4.fieldbyname('khbh').asstring;
   table1.fieldbyname('khqc').asstring:=
      table4.fieldbyname('khqc').asstring;
   table1.fieldbyname('di').asstring:=
      table4.fieldbyname('di').asstring;
   table1.fieldbyname('lxdh').asstring:=
      table4.fieldbyname('lxdh').asstring;
   table1.fieldbyname('jy').asstring:=
      table4.fieldbyname('jy').asstring;
   table1.fieldbyname('je').asinteger:=
      table4.fieldbyname('je').asinteger;
   table1.fieldbyname('ying').asinteger:=
      table4.fieldbyname('ying').asinteger;
   table1.fieldbyname('shi').asinteger:=
      table4.fieldbyname('shi').asinteger;
   table1.fieldbyname('lxr').asstring:=
      table4.fieldbyname('lxr').asstring;
   table1.fieldbyname('sj').asstring:=
      table4.fieldbyname('sj').asstring;
   table1.fieldbyname('yb').asstring:=
      table4.fieldbyname('yb').asstring;
     table1.post;
     table4.next;
  end;
  showmessage('数据恢复完毕。');
  except on exception do showmessage('数据错误无法恢复。');
  end;

end; end
else begin
   showmessage('备份库中无纪录。');
   end;

end;

procedure TSJBF.BitBtn4Click(Sender: TObject);
begin
if  chu then begin
  table1.first;
  while not table1.eof do begin
    table1.delete;
  end;
   showmessage('数据以从新纪录。');
  end
else begin
  showmessage('请将记录备份后在从新记忆。')
end;
end;
procedure TSJBF.TabSheet1Show(Sender: TObject);
var shu:integer;
begin
shu:=0;
  combobox1.ItemIndex:=0;
    time1.Locate('bian','rk1',[Lopartialkey]);
    table4.filter:=format('bei'+'='+'''%s''',[combobox1.text]);
    table4.First;
    while not table4.eof do begin
       table4.next;
       shu:=shu+1;
       end;
    label3.caption:=inttostr(shu);
    label4.caption:=datetostr(time1.fieldbyname('time').asdatetime);


end;

procedure TSJBF.TabSheet2Show(Sender: TObject);
var shu:integer;

begin
shu:=0;
  combobox2.ItemIndex:=0;
    time1.Locate('bian','ck1',[Lopartialkey]);
    table5.filter:=format('bei'+'='+'''%s''',[combobox1.text]);
    table5.First;
    while not table5.eof do begin
       table5.next;
       shu:=shu+1;
       end;
    label7.caption:=inttostr(shu);
    label8.caption:=datetostr(time1.fieldbyname('time').asdatetime);



end;

procedure TSJBF.TabSheet3Show(Sender: TObject);
var shu:integer;
begin
shu:=0;
  combobox3.ItemIndex:=0;
    time1.Locate('bian','th1',[Lopartialkey]);
    table6.filter:=format('bei'+'='+'''%s''',[combobox1.text]);
    table6.First;
    while not table6.eof do begin
       table6.next;
       shu:=shu+1;
       end;
    label11.caption:=inttostr(shu);
    label12.caption:=datetostr(time1.fieldbyname('time').asdatetime);

end;

procedure TSJBF.BitBtn7Click(Sender: TObject);
begin
if ru then begin
  table2.First;
  while not table2.eof do begin
    table2.delete;
  end;
  showmessage('数据以从新纪录。');
end
else begin
 showmessage('请将记录备份后在从新记忆。')
end;

end;

procedure TSJBF.BitBtn10Click(Sender: TObject);
begin
if tui then begin
  table3.first;
  while not table3.eof do begin
     table3.delete;
  end;
end
else begin
  showmessage('请将记录备份后在从新记忆。')
end;
end;

procedure TSJBF.ComboBox2Click(Sender: TObject);
var shu:integer;

begin
shu:=0;
case combobox2.itemindex of
   0:begin
    time1.Locate('bian','ck1',[Lopartialkey]);
    table5.filter:=format('bei'+'='+'''%s''',[combobox2.text]);
    table5.First;
    while not table5.eof do begin
       table5.next;
       shu:=shu+1;
       end;
    label7.caption:=inttostr(shu);
    label8.caption:=datetostr(time1.fieldbyname('time').asdatetime);
    end;
   1:begin
    time1.locate('bian','ck2',[lopartialkey]);
    table5.filter:=format('bei'+'='+'''%s''',[combobox2.text]);
    table5.first;
    while not table5.Eof do begin
       table5.next;
       shu:=shu+1;
       end;
    label7.caption:=inttostr(shu);
    label8.caption:=datetostr(time1.fieldbyname('time').asdatetime);
    end;
   2:begin
    time1.locate('bian','ck3',[lopartialkey]);
    table5.filter:=format('bei'+'='+'''%s''',[combobox2.text]);
    table5.first;
    while not table5.Eof do begin
       table5.next;
       shu:=shu+1;
       end;
    label7.caption:=inttostr(shu);
    label8.caption:=datetostr(time1.fieldbyname('time').asdatetime);
    end;
   3:begin
    time1.locate('bian','ck4',[lopartialkey]);
    table5.filter:=format('bei'+'='+'''%s''',[combobox2.text]);
    table5.first;
    while not table5.Eof do begin
       table5.next;
       shu:=shu+1;
       end;
    label7.caption:=inttostr(shu);
    label8.caption:=datetostr(time1.fieldbyname('time').asdatetime);
    end;
   4:begin
    time1.locate('bian','ck5',[lopartialkey]);
    table5.filter:=format('bei'+'='+'''%s''',[combobox2.text]);
    table5.first;
    while not table5.Eof do begin
       table5.next;
       shu:=shu+1;
       end;
    label7.caption:=inttostr(shu);
    label8.caption:=datetostr(time1.fieldbyname('time').asdatetime);
     end;
   end;
end;
procedure TSJBF.ComboBox3Click(Sender: TObject);
var shu:integer;
begin
shu:=0;
case combobox3.itemindex of
   0:begin
    time1.Locate('bian','th1',[Lopartialkey]);
    table6.filter:=format('bei'+'='+'''%s''',[combobox3.text]);
    table6.First;
    while not table6.eof do begin
       table6.next;
       shu:=shu+1;
       end;
    label11.caption:=inttostr(shu);
    label12.caption:=datetostr(time1.fieldbyname('time').asdatetime);
    end;
   1:begin
    time1.Locate('bian','th2',[Lopartialkey]);
    table6.filter:=format('bei'+'='+'''%s''',[combobox3.text]);
    table6.First;
    while not table6.eof do begin
       table6.next;
       shu:=shu+1;
       end;
    label11.caption:=inttostr(shu);
    label12.caption:=datetostr(time1.fieldbyname('time').asdatetime);
    end;
   2:begin
    time1.Locate('bian','th3',[Lopartialkey]);
    table6.filter:=format('bei'+'='+'''%s''',[combobox3.text]);
    table6.First;
    while not table6.eof do begin
       table6.next;
       shu:=shu+1;
       end;
    label11.caption:=inttostr(shu);
    label12.caption:=datetostr(time1.fieldbyname('time').asdatetime);
    end;
  3:begin
    time1.Locate('bian','th4',[Lopartialkey]);
    table6.filter:=format('bei'+'='+'''%s''',[combobox3.text]);
    table6.First;
    while not table6.eof do begin
       table6.next;
       shu:=shu+1;
       end;
    label11.caption:=inttostr(shu);
    label12.caption:=datetostr(time1.fieldbyname('time').asdatetime);
    end;
   4:begin
    time1.Locate('bian','th5',[Lopartialkey]);
    table6.filter:=format('bei'+'='+'''%s''',[combobox3.text]);
    table6.First;
    while not table6.eof do begin
       table6.next;
       shu:=shu+1;
       end;
    label11.caption:=inttostr(shu);
    label12.caption:=datetostr(time1.fieldbyname('time').asdatetime);
    end;
  end;
end;

procedure TSJBF.BitBtn5Click(Sender: TObject);
var shu:integer;
begin
shu:=0;
if table5.Locate('bei',combobox2.text,[lopartialkey]) then begin
if application.messagebox('此库中已有备份记录,是否覆盖?','提醒',mb_yesno)
   =idyes then begin

try
table5.First;
while not table5.eof do begin
   table5.delete;
end;
table2.first;
while not table2.Eof do begin
   table5.Insert;
   table5.fieldbyname('cpbh').asstring:=
      table2.fieldbyname('cpbh').asstring;
   table5.fieldbyname('cpmc').asstring:=
      table2.fieldbyname('cpmc').asstring;
   table5.fieldbyname('cpxh').asstring:=
      table2.fieldbyname('cpxh').asstring;
   table5.fieldbyname('cpbs').asstring:=
      table2.fieldbyname('cpbs').asstring;
   table5.fieldbyname('rdate').asdatetime:=
      table2.fieldbyname('rdate').asdatetime;
   table5.fieldbyname('dan').asstring:=
      table2.fieldbyname('dan').asstring;
   table5.fieldbyname('shuliang').asstring:=
      table2.fieldbyname('shuliang').asstring;
   table5.fieldbyname('cx').asstring:=
      table2.fieldbyname('cx').asstring;
   table5.fieldbyname('cd').asstring:=
      table2.fieldbyname('cd').asstring;
   table5.fieldbyname('khbh').asstring:=
      table2.fieldbyname('khbh').asstring;
   table5.fieldbyname('khqc').asstring:=
      table2.fieldbyname('khqc').asstring;
   table5.fieldbyname('lxdh').asstring:=
      table2.fieldbyname('lxdh').asstring;
   table5.fieldbyname('je').asinteger:=
      table2.fieldbyname('je').asinteger;
   table5.fieldbyname('ying').asinteger:=
      table2.fieldbyname('ying').asinteger;
   table5.fieldbyname('jsr').asstring:=
      table2.fieldbyname('jsr').asstring;
   table5.FieldByName('bei').asstring:=combobox2.text;
     table5.post;
     table2.next;
       shu:=shu+1;
   end;
   case combobox2.ItemIndex of
     0:begin
        time1.Locate('bian','ck1',[lopartialkey]);
        time1.edit;
        time1.fieldbyname('time').asdatetime:=date;
        time1.Post;
        end;
     1:begin
        time1.locate('bian','ck2',[lopartialkey]);
        time1.edit;
        time1.fieldbyname('time').asdatetime:=date;
        time1.post;
        end;
     2:begin
        time1.Locate('bian','ck3',[lopartialkey]);
        time1.edit;
        time1.fieldbyname('time').asdatetime:=date;
        time1.Post;
        end;
     3:begin
        time1.Locate('bian','ck4',[lopartialkey]);
        time1.edit;
        time1.fieldbyname('time').asdatetime:=date;
        time1.Post;

⌨️ 快捷键说明

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