📄 sjgl_bjxxform.~pas
字号:
unit SJGL_BJXXFORM;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Db, ADODB, Grids, DBGrids, ComCtrls, ExtCtrls, StdCtrls, Buttons;
type
TSJGL_BJXX = class(TForm)
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
BitBtn4: TBitBtn;
Bevel1: TBevel;
Label1: TLabel;
Label2: TLabel;
ComboBox1: TComboBox;
ADOQuery1: TADOQuery;
ADOQuery1DSDesigner: TStringField;
ADOQuery1DSDesigner2: TStringField;
ADOQuery1DSDesigner3: TStringField;
ADOQuery1DSDesigner4: TStringField;
ADOQuery1DSDesigner5: TStringField;
ADOQuery1DSDesigner6: TIntegerField;
ADOQuery1DSDesigner7: TBCDField;
ADOQuery1DSDesigner8: TBCDField;
ADOQuery1DSDesigner9: TIntegerField;
ADOQuery1DSDesigner10: TIntegerField;
ADOQuery1DSDesigner11: TStringField;
DataSource1: TDataSource;
ADOQuery3: TADOQuery;
ADOQuery2: TADOQuery;
DBGrid1: TDBGrid;
procedure FormShow(Sender: TObject);
procedure BitBtn4Click(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
procedure ComboBox1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
SJGL_BJXX: TSJGL_BJXX;
implementation
uses SJGL_BJXX_CXFORM, SJGL_BJXX_TSXGFORM, MR_WXFORM;
{$R *.DFM}
procedure TSJGL_BJXX.FormShow(Sender: TObject);
begin
animatewindow(handle,200,AW_VER_NEGATIVE-AW_HOR_POSITIVE);
dbgrid1.Refresh;
bevel1.Refresh;
label2.Refresh;
adoquery2.First;
combobox1.Items.clear;
while not adoquery2.Eof do begin
combobox1.Items.Add(adoquery2.fieldbyname('库房').asstring);
adoquery2.Next;
end;
combobox1.ItemIndex:=0;
adoquery3.Close;
adoquery3.sql.clear;
adoquery3.SQL.add('select sum(库存金额) from 备件库存 where 部门='''+combobox1.Text+'''');
adoquery3.Open;
label1.caption:='库存总金额为'+adoquery3.Fields[0].asstring+'元';
adoquery1.Close;
adoquery1.SQL.clear;
adoquery1.sql.add('select * from 备件库存 where 部门='''+combobox1.text+'''');
adoquery1.Open;
datasource1.DataSet:=adoquery1;
end;
procedure TSJGL_BJXX.BitBtn1Click(Sender: TObject); //修改备件信息
begin
if adoquery1.RecordCount=0 then begin
showmessage('库中无备件信息.');
end else begin
if application.FindComponent('SJGL_BJXX_TSXG')=nil then application.CreateForm(TSJGL_BJXX_TSXG,SJGL_BJXX_TSXG);
SJGL_BJXX_TSXG.showmodal;
if application.FindComponent('SJGL_BJXX_TSXG')<>nil then SJGL_BJXX_TSXG.Release;
end;
end;
procedure TSJGL_BJXX.BitBtn2Click(Sender: TObject); //查询备件信息
begin
if tbitbtn(sender).caption='刷 新[&S]' then begin
tbitbtn(sender).caption:='库信息查询[&S]';
adoquery1.filtered:=false;
end else begin
if application.FindComponent('SJGL_BJXX_CX')=nil then application.CreateForm(TSJGL_BJXX_CX,SJGL_BJXX_CX);
SJGL_BJXX_CX.showmodal;
if application.FindComponent('SJGL_BJXX_CX')<>nil then SJGL_BJXX_CX.Release;
end;
end;
procedure TSJGL_BJXX.ComboBox1Click(Sender: TObject); //选择备件库
begin
datasource1.DataSet:=nil;
adoquery3.Close;
adoquery3.sql.clear;
adoquery3.SQL.add('select sum(库存金额) from 备件库存 where 部门='''+combobox1.Text+'''');
adoquery3.Open;
label1.caption:='库存总金额为'+adoquery3.Fields[0].asstring+'元';
adoquery1.Close;
adoquery1.SQL.clear;
adoquery1.sql.add('select * from 备件库存 where 部门='''+combobox1.text+'''');
adoquery1.Open;
datasource1.DataSet:=adoquery1;
end;
procedure TSJGL_BJXX.BitBtn4Click(Sender: TObject); //退出
begin
close;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -