📄 uform_his_show.pas
字号:
unit Uform_his_show;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ImgList, ComCtrls, StdCtrls, Buttons, ExtCtrls, DB, ADODB;
type
Tform_his_show = class(TForm)
Panel1: TPanel;
Image1: TImage;
Bevel2: TBevel;
Bevel3: TBevel;
Image2: TImage;
Label1: TLabel;
Panel2: TPanel;
Panel3: TPanel;
Panel4: TPanel;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
BitBtn3: TBitBtn;
ListView2: TListView;
ImageList1: TImageList;
recordset_temp: TADOQuery;
procedure FormShow(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
procedure BitBtn3Click(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
sqlstr:string;
end;
var
form_his_show: Tform_his_show;
implementation
uses Udate_format, Uform_main;
{$R *.dfm}
procedure Tform_his_show.FormShow(Sender: TObject);
begin
//show the form 2001-12-20a
listview2.Clear ;
end;
procedure Tform_his_show.BitBtn2Click(Sender: TObject);
var
p:^integer;
i:integer;
ListItem: TListItem;
begin
//add the listitem into the listview 2001-12-20a
date_format.ShowModal ;
if date_format.yesno =false then exit ;
listview2.Clear ;
//create the sqlstr
sqlstr:= ' select * from [HIS] where [HIS_DT]>=#'
+ datetostr(date_format.s_date )
+ '# and [HIS_DT]<=#'
+ datetostr(date_format.e_date +1) + '#';
if not((date_format.xd1_bool =false) and (date_format.xd2_bool =false)
and (date_format.xd3_bool =false) and (date_format.xd4_bool =false))
then
begin
sqlstr:=sqlstr+' and [HIS_CODE_KIND] IN (';
if date_format.xd1_bool =true then
begin
sqlstr:=sqlstr + '1,';
end;
if date_format.xd2_bool =true then
begin
sqlstr:=sqlstr + '2,';
end;
if date_format.xd3_bool =true then
begin
sqlstr:=sqlstr + '3,';
end;
if date_format.xd4_bool =true then
begin
sqlstr:=sqlstr + '4,';
end;
sqlstr:=sqlstr + ')';
end;
// open the recordset object
//showmessage(sqlstr);
recordset_temp.SQL.Clear;
recordset_temp.SQL.Add(sqlstr);
recordset_temp.Open ;
//add the listitem to the listview
for i :=1 to recordset_temp.RecordCount do
begin
listitem:=listview2.Items.Add ;
listitem.Caption :=datetimetostr(recordset_temp.Fields[3].AsDateTime );
if recordset_temp.Fields[1].AsInteger =1 then
begin
listitem.ImageIndex :=0;
listitem.SubItems.Add('无效访问的纪录');
end;
if recordset_temp.Fields[1].AsInteger =2 then
begin
listitem.ImageIndex :=1;
listitem.SubItems.Add('访问已注册的产品号[' + recordset_temp.Fields[2].AsString + ']');
end;
if recordset_temp.Fields[1].AsInteger =3 then
begin
listitem.ImageIndex :=2;
listitem.SubItems.Add('访问没有的产品号[' + recordset_temp.Fields[2].AsString + ']');
end;
if recordset_temp.Fields[1].AsInteger =4 then
begin
listitem.ImageIndex :=3;
listitem.SubItems.Add('注册产品号[' + recordset_temp.Fields[2].AsString + ']');
end;
new(p);
p^ := recordset_temp.Fields[0].AsInteger ;
listitem.Data :=p;
recordset_temp.next;
end;
//close the listitem
recordset_temp.close;
end;
procedure Tform_his_show.BitBtn3Click(Sender: TObject);
begin
//close the windows 2001-12-20p
close;
end;
procedure Tform_his_show.BitBtn1Click(Sender: TObject);
var
temp:pchar;
p:^integer;
begin
//delete the visited record 2001-12-20p
if listview2.Selected =nil then exit ;
temp:=pchar('您是否确定删除这条纪录');
if messagebox(self.Handle, temp,
'警告',MB_yesno or MB_ICONQUESTION )=IDyes then
begin
p:=listview2.Selected.Data ;
form_main.Dconnect.Execute('delete * from [HIS] where [HIS_ID]=' + inttostr(p^));
listview2.Selected.Delete ;
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -