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

📄 c_shortproduct.pas

📁 《delphi数据库设计与实例开发》随书光盘
💻 PAS
字号:
unit c_shortproduct;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, Grids, DBGrids, DB, StdCtrls;

type
  Tcfrm_shortproduct = class(TForm)
    GroupBox1: TGroupBox;
    Label1: TLabel;
    ListBox1: TListBox;
    ListBox2: TListBox;
    Label2: TLabel;
    Label3: TLabel;
    ListBox3: TListBox;
    Label4: TLabel;
    ListBox4: TListBox;
    Label5: TLabel;
    ListBox5: TListBox;
    Label6: TLabel;
    ListBox6: TListBox;
    procedure FormShow(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  cfrm_shortproduct: Tcfrm_shortproduct;

implementation

uses datam;

{$R *.dfm}

procedure Tcfrm_shortproduct.FormShow(Sender: TObject);
var
 ProductID:string;
 Quantity:Double;
begin
  with dm.ADOQ_cx do
   begin
   close;
   SQL.Clear;
   SQL.Add('select sum(Quantity) as SumQuantity,ProductID from Storage group by ProductID');
   open;
   first;
   while not dm.ADOQ_cx.Eof do
    begin
    ProductID:=fieldbyname('ProductID').AsString;
    Quantity:=fieldbyname('SumQuantity').AsFloat;
    with dm.ADO_product do
     begin
      close;
      open;
      First;
      locate('ProductID',ProductID,[]);
      if fieldbyname('Min_s').AsFloat>Quantity then
      begin
      Listbox1.Items.Add(fieldbyname('ProductName').AsString);
      Listbox2.Items.Add(fieldbyname('Spec').AsString);
      Listbox3.Items.Add(fieldbyname('Unit').AsString);
      Listbox4.Items.Add(fieldbyname('Min_s').AsString);
      Listbox5.Items.Add(FloattoStr(Quantity));
      Listbox6.Items.Add(fieldbyname('ProductID').AsString);
      end;
     end;
     next;
    end;
   end;
end;

procedure Tcfrm_shortproduct.FormClose(Sender: TObject;
  var Action: TCloseAction);
begin
dm.ADO_product.Close;
end;

end.

⌨️ 快捷键说明

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