?? xgyjzlfrm.pas
字號:
unit xgyjzlfrm;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Buttons, ComCtrls, Mask, DBCtrlsEh, db,StdCtrls, ExtCtrls;
type
Txgyjzl = class(TForm)
Panel1: TPanel;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
DBNumberEditEh1: TDBNumberEditEh;
Edit4: TEdit;
DateTimePicker1: TDateTimePicker;
Edit5: TEdit;
Panel2: TPanel;
SpeedButton1: TSpeedButton;
SpeedButton2: TSpeedButton;
procedure SpeedButton1Click(Sender: TObject);
procedure SpeedButton2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
xgyjzl: Txgyjzl;
implementation
uses datafrm, yjzlfrm;
{$R *.dfm}
procedure Txgyjzl.SpeedButton1Click(Sender: TObject);
begin
close;
end;
procedure Txgyjzl.SpeedButton2Click(Sender: TObject);
var
id:string;
i:integer;
begin
if (xgyjzl.Edit2.Text<>'') and (xgyjzl.Edit3.Text<>'') and (xgyjzl.Edit5.Text<>'') then
begin
yfgldata.yjzl.Locate('營具代碼',xgyjzl.Edit1.Text,[loCaseInsensitive]);
if (yfgldata.yjzl.FieldByName('營具名稱').AsString<>xgyjzl.Edit2.Text) and yfgldata.yjzl.Locate('營具名稱',xgyjzl.Edit2.Text,[loCaseInsensitive]) then
messagebox(xgyjzl.handle,'該營具種類已經(jīng)存在。','營房工作管理系統(tǒng)',16)
else
begin
id:=xgyjzl.Edit1.Text;
yfgldata.yjzl.Edit;
yfgldata.yjzl.FieldByName('營具名稱').AsString:=xgyjzl.Edit2.Text;
yfgldata.yjzl.FieldByName('單位').AsString:=xgyjzl.Edit3.Text;
yfgldata.yjzl.FieldByName('單價').AsFloat:=xgyjzl.DBNumberEditEh1.Value;
yfgldata.yjzl.FieldByName('規(guī)格').AsString:=xgyjzl.Edit4.Text;
yfgldata.yjzl.FieldByName('購入時間').AsDateTime:=xgyjzl.DateTimePicker1.Date;
yfgldata.yjzl.FieldByName('獲取方式').AsString:=xgyjzl.Edit5.Text;
yfgldata.yjzl.Post;
yfgldata.yj.First;
for i:=1 to yfgldata.yj.RecordCount do
begin
if yfgldata.yj.FieldByName('營具代碼').AsString=id then
begin
yfgldata.yj.Edit;
yfgldata.yj.FieldByName('營具名稱').AsString:=xgyjzl.Edit2.Text;
yfgldata.yj.FieldByName('單位').AsString:=xgyjzl.Edit3.Text;
yfgldata.yj.FieldByName('單價').AsFloat:=xgyjzl.DBNumberEditEh1.Value;
yfgldata.yj.Post;
end;
yfgldata.yj.Next;
end;
yfgldata.yj.First;
if yfgldata.yj1.Locate('代碼',id,[loCaseInsensitive]) then
begin
yfgldata.yj1.Edit;
yfgldata.yj1.FieldByName('營具名稱').AsString:=xgyjzl.Edit2.Text;
yfgldata.yj1.FieldByName('單位').AsString:=xgyjzl.Edit3.Text;
yfgldata.yj1.FieldByName('單價').AsFloat:=xgyjzl.DBNumberEditEh1.Value;
yfgldata.yj1.FieldByName('合計金額').AsCurrency:=yfgldata.yj1.FieldByName('單價').AsFloat*yfgldata.yj1.FieldByName('數(shù)量').AsFloat;
yfgldata.yj1.Post;
end;
yfgldata.kcyj.First;
for i:=1 to yfgldata.kcyj.RecordCount do
begin
if yfgldata.kcyj.FieldByName('營具代碼').AsString=id then
begin
yfgldata.kcyj.Edit;
yfgldata.kcyj.FieldByName('營具名稱').AsString:=xgyjzl.Edit2.Text;
yfgldata.kcyj.FieldByName('單位').AsString:=xgyjzl.Edit3.Text;
yfgldata.kcyj.FieldByName('單價').AsFloat:=xgyjzl.DBNumberEditEh1.Value;
yfgldata.kcyj.Post;
end;
yfgldata.kcyj.Next;
end;
yfgldata.kcyj.First;
if yfgldata.kcyj1.Locate('代碼',id,[loCaseInsensitive]) then
begin
yfgldata.kcyj1.Edit;
yfgldata.kcyj1.FieldByName('營具名稱').AsString:=xgyjzl.Edit2.Text;
yfgldata.kcyj1.FieldByName('單位').AsString:=xgyjzl.Edit3.Text;
yfgldata.kcyj1.FieldByName('單價').AsFloat:=xgyjzl.DBNumberEditEh1.Value;
yfgldata.kcyj1.FieldByName('合計金額').AsCurrency:=yfgldata.kcyj1.FieldByName('單價').AsFloat*yfgldata.kcyj1.FieldByName('數(shù)量').AsFloat;
yfgldata.kcyj1.Post;
end;
yfgldata.dwyj.First;
for i:=1 to yfgldata.dwyj.RecordCount do
begin
if yfgldata.dwyj.FieldByName('代碼').AsString=id then
begin
yfgldata.dwyj.Edit;
yfgldata.dwyj.FieldByName('營具名稱').AsString:=xgyjzl.Edit2.Text;
yfgldata.dwyj.FieldByName('單位').AsString:=xgyjzl.Edit3.Text;
yfgldata.dwyj.FieldByName('單價').AsFloat:=xgyjzl.DBNumberEditEh1.Value;
yfgldata.dwyj.Post;
end;
yfgldata.dwyj.Next;
end;
yfgldata.dwyj.First;
yfgldata.dwyj1.First;
for i:=1 to yfgldata.dwyj1.RecordCount do
begin
if yfgldata.dwyj1.Locate('代碼',id,[loCaseInsensitive]) then
begin
yfgldata.dwyj1.Edit;
yfgldata.dwyj1.FieldByName('營具名稱').AsString:=xgyjzl.Edit2.Text;
yfgldata.dwyj1.FieldByName('單位').AsString:=xgyjzl.Edit3.Text;
yfgldata.dwyj1.FieldByName('單價').AsFloat:=xgyjzl.DBNumberEditEh1.Value;
yfgldata.dwyj1.FieldByName('合計金額').AsCurrency:=yfgldata.dwyj1.FieldByName('單價').AsFloat*yfgldata.dwyj1.FieldByName('數(shù)量').AsFloat;
yfgldata.dwyj1.Post;
end;
yfgldata.dwyj1.Next;
end;
yfgldata.dwyj1.First;
yfgldata.grjyyj.First;
for i:=1 to yfgldata.grjyyj.RecordCount do
begin
if yfgldata.grjyyj.FieldByName('代碼').AsString=id then
begin
yfgldata.grjyyj.Edit;
yfgldata.grjyyj.FieldByName('營具名稱').AsString:=xgyjzl.Edit2.Text;
yfgldata.grjyyj.FieldByName('單位').AsString:=xgyjzl.Edit3.Text;
yfgldata.grjyyj.FieldByName('單價').AsFloat:=xgyjzl.DBNumberEditEh1.Value;
yfgldata.grjyyj.Post;
end;
yfgldata.grjyyj.Next;
end;
yfgldata.grjyyj.First;
yfgldata.grjyyj1.First;
for i:=1 to yfgldata.grjyyj1.RecordCount do
begin
if yfgldata.grjyyj1.Locate('代碼',id,[loCaseInsensitive]) then
begin
yfgldata.grjyyj1.Edit;
yfgldata.grjyyj1.FieldByName('營具名稱').AsString:=xgyjzl.Edit2.Text;
yfgldata.grjyyj1.FieldByName('單位').AsString:=xgyjzl.Edit3.Text;
yfgldata.grjyyj1.FieldByName('單價').AsFloat:=xgyjzl.DBNumberEditEh1.Value;
yfgldata.grjyyj1.FieldByName('合計金額').AsCurrency:=yfgldata.grjyyj1.FieldByName('單價').AsFloat*yfgldata.grjyyj1.FieldByName('數(shù)量').AsFloat;
yfgldata.grjyyj1.Post;
end;
yfgldata.grjyyj1.Next;
end;
yfgldata.grjyyj1.First;
yjzl.showbuttons;
close;
end;
end
else
messagebox(xgyjzl.handle,'營具名稱、單位、獲取方式輸入信息不全。','營房工作管理系統(tǒng)',16);
end;
end.
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -