📄 c_overproduct.pas
字号:
unit c_overproduct;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, Grids, DBGrids, StdCtrls;
type
Tcfrm_overproduct = class(TForm)
GroupBox1: TGroupBox;
Label6: TLabel;
ListBox6: TListBox;
ListBox1: TListBox;
Label1: TLabel;
Label2: TLabel;
ListBox2: TListBox;
ListBox3: TListBox;
Label3: TLabel;
ListBox4: TListBox;
Label4: TLabel;
Label5: TLabel;
ListBox5: TListBox;
procedure FormShow(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
{ Private declarations }
public
{ Public declarations }
end;
var
cfrm_overproduct: Tcfrm_overproduct;
implementation
uses datam;
{$R *.dfm}
procedure Tcfrm_overproduct.FormShow(Sender: TObject);
var
ProductID:string;
Quantity:Double;
i:integer;
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('Max_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('Max_s').AsString);
Listbox5.Items.Add(FloattoStr(Quantity));
Listbox6.Items.Add(fieldbyname('ProductID').AsString);
end;
end;
next;
end;
end;
end;
procedure Tcfrm_overproduct.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
dm.ADO_product.Close;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -