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

📄 uform_ljxf.pas

📁 Delphi应用婚纱系统 Delphi应用婚纱系统
💻 PAS
字号:
unit Uform_ljxf;
//按客户查询消费情况
interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Buttons, ComCtrls, DB, ADODB, ImgList, ExtCtrls;

type
  Tform_ljxf = 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;
    ImageList1: TImageList;
    recordset_temp: TADOQuery;
    Panel2: TPanel;
    ListView1: TListView;
    Panel3: TPanel;
    Panel4: TPanel;
    BitBtn3: TBitBtn;
    BitBtn2: TBitBtn;
    Bevel2: TBevel;
    Label21: TLabel;
    Label22: TLabel;
    Label23: TLabel;
    Label24: TLabel;
    BitBtn1: TBitBtn;
    recordset_temp2: TADOQuery;
    procedure FormShow(Sender: TObject);
    procedure BitBtn3Click(Sender: TObject);
    procedure BitBtn2Click(Sender: TObject);
    procedure ListView1Click(Sender: TObject);
    procedure BitBtn1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
    sdate:tdate;
    edate:tdate;
    smoney:integer;
    emoney:integer;
  end;

var
  form_ljxf: Tform_ljxf;

implementation

uses Uform_xf_limit, Uform_ljxf_one;

{$R *.dfm}

procedure Tform_ljxf.FormShow(Sender: TObject);
//初始化窗口显示
begin
     label22.Caption :='';
     label24.Caption :='';
     label4.Caption :='' ;
     label5.Caption :='';
     label7.Caption :='';
     label10.Caption :='';
     label12.Caption :='';
     label14.Caption :='';
     label15.Caption :='';
     label17.Caption :='';
     label19.Caption :='';
     listview1.Clear ;
end;

procedure Tform_ljxf.BitBtn3Click(Sender: TObject);
//关闭窗口
begin
   close;
end;

procedure Tform_ljxf.BitBtn2Click(Sender: TObject);
//选定消费查询的限定条件
var
   i:integer;
   ListItem: TListItem;
   p:^integer;
   mm:real;
begin
   //显示消费查询限定窗口
   form_xf_limit.ShowModal ;
   //是否选择了限定条件
   if form_xf_limit.yesno =false then exit;
   //按限定条件在数据库中查询
   sdate:=form_xf_limit.sdate ;
   edate:=form_xf_limit.edate ;
   smoney:=form_xf_limit.smoney ;
   emoney:=form_xf_limit.emoney ;
   label22.Caption :=datetostr(sdate) + ' - ' + datetostr(edate);
   label24.Caption :=inttostr(smoney) + '¥ - ' + inttostr(emoney) + '¥';
   listview1.Clear ;
   recordset_temp.SQL.Clear ;
   recordset_temp.SQL.Add('select * from [CUSTOM]');
   recordset_temp.open;
   //将查询结果显示在窗口中
   for i:=1 to recordset_temp.RecordCount do
   begin
      recordset_temp2.SQL.Clear ;
      recordset_temp2.SQL.Add('select sum([JY_ALLDOLLOR]) from [JY] where [JY_DATE]>#'
                        + datetostr(sdate) + '# and [JY_DATE]<#' + datetostr(edate)
                        + '# and [JY_CUSTOMID]='
                        + inttostr(recordset_temp.Fields[0].asinteger));
      recordset_temp2.Open ;
      if recordset_temp2.RecordCount <>0 then
      begin
         mm:=recordset_temp2.Fields[0].AsFloat ;
      end;
      if ((mm>smoney) and (mm<emoney)) then
      begin
         listitem:=listview1.Items.Add ;
         listitem.Caption :=recordset_temp.Fields[1].AsString ;
         listitem.ImageIndex :=0;
         listitem.SubItems.Add(recordset_temp.Fields[2].asstring);
         listitem.SubItems.Add(recordset_temp.Fields[3].asstring);
         listitem.SubItems.Add(format( '%8.2f¥',[mm]));
         new(p);
         p^ := recordset_temp.Fields[0].AsInteger ;
         listitem.Data :=p;
      end;
      recordset_temp2.Close ;
      recordset_temp.Next;
   end;
   recordset_temp.Close ;
end;

procedure Tform_ljxf.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 [CUSTOM],[AREA],[FROM] where [FROM_ID]=[CUSTOM_FROM] and [AREA_ID]=[CUSTOM_AREA] and [CUSTOM_ID]=' + inttostr(p^)
   );
   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_ljxf.BitBtn1Click(Sender: TObject);
//查看某个用户的消费信息
var
   p:^integer;
begin
   //是否选中某个用户
   if listview1.selected=nil then exit;
   p:=listview1.Selected.Data ;
   form_ljxf_one.userid :=p^;
   form_ljxf_one.sdate:=sdate ;
   form_ljxf_one.edate:=edate ;
   form_ljxf_one.ShowModal ;
end;

end.

⌨️ 快捷键说明

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