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

📄 uform_fw_list.pas

📁 这是在SQL数据库下编写的一个源代码
💻 PAS
字号:
unit Uform_fw_list;

interface

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

type
  Tform_fw_list = class(TForm)
    Panel1: TPanel;
    Image1: TImage;
    Label2: TLabel;
    Label1: TLabel;
    Bevel1: TBevel;
    Image2: TImage;
    Label5: TLabel;
    Label6: TLabel;
    Panel2: TPanel;
    apart_list: TListView;
    Panel3: TPanel;
    Panel4: TPanel;
    BitBtn3: TBitBtn;
    BitBtn2: TBitBtn;
    ImageList1: TImageList;
    recordset_temp: TADOQuery;
    recordset_temp2: TADOQuery;
    Label3: TLabel;
    Label4: TLabel;
    Label7: TLabel;
    Label8: TLabel;
    Label9: TLabel;
    Label10: TLabel;
    BitBtn1: TBitBtn;
    procedure FormShow(Sender: TObject);
    procedure BitBtn3Click(Sender: TObject);
    procedure BitBtn2Click(Sender: TObject);
    procedure BitBtn1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
    intCount:integer;
    sdate:tdate;
    edate:tdate;
  end;

var
  form_fw_list: Tform_fw_list;

implementation

uses Uform_fw_limit, Uform_fw_one;

{$R *.dfm}

procedure Tform_fw_list.FormShow(Sender: TObject);
var
   i:integer;
   ListItem: TListItem;
   p:^integer;
begin
   //add the fw into the list 2002-2-1

   //CLEAR ALL INFORMATION
   apart_list.Items.Clear ;
   label8.Caption :='未限定';
   label4.Caption :='未限定';
   label10.Caption :=format('%8.2f¥',[0.0]);
   sdate:=now;
   edate:=now;

   //add the fw into imagelist
   recordset_temp.SQL.Clear ;
   recordset_temp.SQL.Add ('select * from [FW]');
   recordset_temp.Open ;
   intCount:=recordset_temp.RecordCount ;
   Label5.Caption :=inttostr(intCount) + '个';
   for i:=1 to recordset_temp.RecordCount do
   begin
      listitem:=apart_LIST.Items.Add ;
      listitem.Caption :=recordset_temp.Fields[1].AsString ;
      listitem.SubItems.Add(format( '%8.2f¥',[recordset_temp.fields[2].asfloat]));
      listitem.SubItems.Add('0');
      listitem.SubItems.Add (format('%8.2f¥',[0.0]));
      listitem.ImageIndex :=0;
      new(p);
      p^ := recordset_temp.Fields[0].AsInteger ;
      listitem.Data :=p;
      recordset_temp.Next;
   end;
end;

procedure Tform_fw_list.BitBtn3Click(Sender: TObject);
begin
   close;
end;

procedure Tform_fw_list.BitBtn2Click(Sender: TObject);
var
   i:integer;
   ListItem: TListItem;
   p:^integer;
   money:real;
begin
   //limit the fw 2002-2-1
   form_fw_limit.ShowModal ;
   if form_fw_limit.yesno =false then exit;
   sdate:=form_fw_limit.sdate ;
   edate:=form_fw_limit.edate ;
   //CLEAR ALL INFORMATION
   apart_list.Items.Clear ;
   label8.Caption :=datetostr(sdate);
   label4.Caption :=datetostr(edate);
   money:=0;


   //add the fw into imagelist
   recordset_temp.SQL.Clear ;
   recordset_temp.SQL.Add ('select * from [FW]');
   recordset_temp.Open ;
   intCount:=recordset_temp.RecordCount ;
   Label5.Caption :=inttostr(intCount) + '个';
   for i:=1 to recordset_temp.RecordCount do
   begin
      listitem:=apart_LIST.Items.Add ;
      listitem.Caption :=recordset_temp.Fields[1].AsString ;
      listitem.SubItems.Add(format( '%8.2f¥',[recordset_temp.fields[2].asfloat]));
      listitem.ImageIndex :=0;

      recordset_temp2.SQL.Clear;
      recordset_temp2.SQL.Add('select sum([JY_FWCOUNT]),sum([JY_ALLDOLLOR]) from [JY] where [JY_FWID]='
        + inttostr(recordset_temp.Fields[0].AsInteger) + ' and [JY_DATE]>=#' + datetostr(sdate) + '# and [JY_DATE]<=#' + datetostr(edate+1) + '#');
      recordset_temp2.Open ;
      if recordset_temp.RecordCount <>0 then
      begin
         listitem.SubItems.Add(inttostr(recordset_temp2.Fields[0].asinteger));
         listitem.SubItems.Add (format('%8.2f¥',[recordset_temp2.Fields[1].asfloat]));
         money:=money+recordset_temp2.Fields[1].asfloat;
      end
      else
      begin
         listitem.SubItems.Add('0');
         listitem.SubItems.Add (format('%8.2f¥',[0.0]));
      end;
      recordset_temp2.Close;

      new(p);
      p^ := recordset_temp.Fields[0].AsInteger ;
      listitem.Data :=p;
      recordset_temp.Next;
   end;

   label10.Caption :=format('%8.2f¥',[money]);
end;

procedure Tform_fw_list.BitBtn1Click(Sender: TObject);
var
   p:^integer;
begin
   if apart_list.Selected =nil then exit ;
   p:=Apart_list.Selected.Data;
   form_fw_one.id :=p^;
   form_fw_one.stime:=datetostr(sdate) + '-' + datetostr(edate);
   form_fw_one.fw_name :=apart_list.Selected.Caption ;

   recordset_temp2.SQL.Clear;
   recordset_temp2.SQL.Add('select sum([JY_FWCOUNT]),sum([JY_ALLDOLLOR]) from [JY] where [JY_FWID]='
        + inttostr(p^) + ' and [JY_DATE]>=#' + datetostr(sdate) + '# and [JY_DATE]<=#' + datetostr(edate+1) + '#');
   recordset_temp2.Open ;
   if recordset_temp.RecordCount <>0 then
   begin
         form_fw_one.cc:=inttostr(recordset_temp2.Fields[0].asinteger) + '套/' +
         format('%8.2f¥',[recordset_temp2.Fields[1].asfloat]);
   end
   else
   begin
         form_fw_one.cc:='0套/'+ format('%8.2f¥',[0.0]);
   end;
   recordset_temp2.Close;

   form_fw_one.sdate:=sdate;
   form_fw_one.edate:=edate;

   form_fw_one.ShowModal ;


end;

end.

⌨️ 快捷键说明

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