📄 uform_xf_one.~pas
字号:
unit Uform_xf_one;
//对每次消费的情况进行查询
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, ADODB, ImgList, StdCtrls, Buttons, ComCtrls, ExtCtrls;
type
Tform_xf_one = class(TForm)
Panel1: TPanel;
Image1: TImage;
Label2: TLabel;
Label1: TLabel;
Bevel1: TBevel;
Image2: TImage;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
Label9: TLabel;
Label10: TLabel;
Label11: TLabel;
Label12: TLabel;
Label13: TLabel;
Label14: TLabel;
Label15: TLabel;
Label16: TLabel;
Label17: TLabel;
Label18: TLabel;
Label19: TLabel;
Label20: TLabel;
Panel2: TPanel;
ListView1: TListView;
Panel3: TPanel;
Panel4: TPanel;
BitBtn3: TBitBtn;
BitBtn2: TBitBtn;
ImageList1: TImageList;
recordset_temp: TADOQuery;
procedure BitBtn3Click(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
procedure ListView1Click(Sender: TObject);
procedure FormShow(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
form_xf_one: Tform_xf_one;
implementation
uses Uform_xf_limit;
{$R *.dfm}
procedure Tform_xf_one.BitBtn3Click(Sender: TObject);
//关闭窗口
begin
close;
end;
procedure Tform_xf_one.BitBtn2Click(Sender: TObject);
//选定消费查询的限定条件
var
i:integer;
ListItem: TListItem;
p:^integer;
sdate:tdate;
edate:tdate;
smoney:integer;
emoney:integer;
begin
//显示消费查询限定窗口
form_xf_limit.ShowModal ;
//是否选择了限定条件
if form_xf_limit.yesno=false then exit;
//按限定条件在数据库中查询
listview1.Clear ;
sdate:=form_xf_limit.sdate ;
edate:=form_xf_limit.edate ;
smoney:=form_xf_limit.smoney ;
emoney:=form_xf_limit.emoney ;
recordset_temp.SQL.Clear;
recordset_temp.SQL.Add('select [JY_ID],[FW_NAME],[FW_DOLLOR],[JY_FWCOUNT],[JY_ALLDOLLOR],[JY_DATE] from [JY],[FW] where [JY_FWID]=[FW_ID] '
+ 'and [JY_DATE]>=#' + datetostr(sdate) + '# and [JY_DATE]<=#' + datetostr(edate+1) + '#'
+ ' and [JY_ALLDOLLOR]>' + inttostr(smoney) + ' and [JY_ALLDOLLOR]<' + inttostr(emoney));
recordset_temp.Open ;
//将查询结果显示在窗口中
for i:=1 to recordset_temp.RecordCount do
begin
listitem:=listview1.Items.Add ;
listitem.Caption :=recordset_temp.Fields[1].AsString ;
listitem.ImageIndex :=0;
listitem.SubItems.Add(format( '%8.2f¥',[recordset_temp.fields[2].AsFloat]));
listitem.SubItems.Add(inttostr(recordset_temp.Fields[3].asinteger));
listitem.SubItems.Add(format( '%8.2f¥',[recordset_temp.fields[4].AsFloat]));
listitem.SubItems.Add(datetostr(recordset_temp.Fields[5].asdatetime));
new(p);
p^ := recordset_temp.Fields[0].AsInteger ;
listitem.Data :=p;
recordset_temp.Next;
end;
recordset_temp.Close;
end;
procedure Tform_xf_one.ListView1Click(Sender: TObject);
//根据用户在消费列表中的选择显示该次消费客户的详细信息
var
p:^integer;
begin
//是否选中某个条目
if listview1.selected=nil then
begin
label4.Caption :='';
label5.Caption :='';
label7.Caption :='';
label10.Caption :='';
label12.Caption :='';
label14.Caption :='';
label15.Caption :='';
label17.Caption :='';
label19.Caption :='';
exit;
end;
//显示客户详细信息
p:=listview1.Selected.Data;
recordset_temp.SQL.Clear;
recordset_temp.SQL.Add('select [CUSTOM_CODE],[CUSTOM_MNAME],[CUSTOM_FNAME],[CUSTOM_TEL]'
+ ',[AREA_NAME],[CUSTOM_ADD],[FROM_NAME],[CUSTOM_POST],[CUSTOM_DATE] from [JY],[CUSTOM],[AREA],[FROM] where [FROM_ID]=[CUSTOM_FROM] and [AREA_ID]=[CUSTOM_AREA] and [JY_ID]=' + inttostr(p^)
+ ' and [JY_CUSTOMID]=[CUSTOM_ID]');
recordset_temp.Open ;
if recordset_temp.recordcount<>0 then
begin
label4.Caption :=recordset_temp.Fields[0].AsString ;
label5.Caption :=recordset_temp.Fields[1].AsString;
label7.Caption :=recordset_temp.Fields[2].AsString;
label10.Caption :=recordset_temp.Fields[3].AsString;
label12.Caption :=recordset_temp.Fields[4].AsString;
label14.Caption :=recordset_temp.Fields [5].AsString ;
label15.Caption :=recordset_temp.Fields [6].AsString;
label17.Caption :=recordset_temp.Fields [7].AsString;
label19.Caption :=datetostr(recordset_temp.Fields [8].AsDateTime );
end;
end;
procedure Tform_xf_one.FormShow(Sender: TObject);
//初始化窗口显示
begin
listview1.Clear ;
label4.Caption :='';
label5.Caption :='';
label7.Caption :='';
label10.Caption :='';
label12.Caption :='';
label14.Caption :='';
label15.Caption :='';
label17.Caption :='';
label19.Caption :='';
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -