?? 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 + -