?? data.pas
字號:
implementation
uses main,Dialogs,yhqxwh, clbmwh, Controls; //Dialogs-messagebox; Controls-messagedlg
{$R *.dfm}
procedure Tdm.whjcmxadsBeforeInsert(DataSet: TDataSet);
begin
if whjcdads.RecordCount=0 then
abort;
IF DM.whjcdads.Modified THEN
begin
SHOWMESSAGE('請先保存主記錄!');
abort;
end;
end;
procedure Tdm.whjcmxadsNewRecord(DataSet: TDataSet);
begin
if (not whjcdads.FieldByName('進倉ID').IsNull) then
begin
//whjcmxads.FieldByName('金額').Value:= 0;
//whjcmxads.FieldByName('單價').AsFloat:= 0;
//whjcmxads.FieldByName('數量').AsFloat:= 0;
whjcmxads.FieldByName('進倉ID').Value:=whjcdads.FieldByName('進倉ID').Value;
end;
end;
procedure Tdm.whjcdadsNewRecord(DataSet: TDataSet);
begin
whjcdads.FieldByName('進倉日期').Value:=date();
whjcdads.FieldByName('用戶ID').Value:=mainfrm.yhid;
whjcdads.FieldByName('倉庫ID').Value:=mainfrm.ckid;
end;
procedure Tdm.whccdadsNewRecord(DataSet: TDataSet);
begin
whccdads.FieldByName('出倉日期').Value:=date();
whccdads.FieldByName('用戶ID').Value:=mainfrm.yhid;
whccdads.FieldByName('倉庫ID').Value:=mainfrm.ckid;
end;
procedure Tdm.whccmxadsNewRecord(DataSet: TDataSet);
begin
if (not whccdads.FieldByName('出倉ID').IsNull) then
begin
//whccmxads.FieldByName('金額').Value:= 0;
//whccmxads.FieldByName('單價').AsFloat:= 0;
//whccmxads.FieldByName('數量').AsFloat:= 0;
whccmxads.FieldByName('出倉ID').Value:=whccdads.FieldByName('出倉ID').Value;
end;
end;
procedure Tdm.whccmxadsBeforeInsert(DataSet: TDataSet);
begin
IF DM.whccdads.RecordCount=0 THEN
ABORT;
IF DM.whccdads.Modified THEN
begin
SHOWMESSAGE('請先保存主記錄!');
abort;
end;
end;
procedure Tdm.whjcdadsBeforeDelete(DataSet: TDataSet);
begin
adocn.Execute('delete from jcmxb where 進倉ID='+
whjcdads.fieldbyname('進倉ID').Value);
end;
procedure Tdm.whccdadsBeforeDelete(DataSet: TDataSet);
begin
adocn.Execute('delete from ccmxb where 出倉ID='+
whccdads.fieldbyname('出倉ID').Value);
end;
procedure Tdm.whcjtzadsNewRecord(DataSet: TDataSet);
begin
whcjtzads.FieldByName('調整日期').Value:=date();
whcjtzads.FieldByName('用戶ID').Value:=mainfrm.yhid;
whcjtzads.FieldByName('倉庫ID').Value:=mainfrm.ckid;
end;
procedure Tdm.whclbmadsBeforePost(DataSet: TDataSet);
begin
if (whclbmads.FieldByName('材料編碼').Value<>'') and
(not whclbmads.FieldByName('材料編碼').IsNull) then
whclbmads.FieldByName('材料編碼').Value:=
uppercase(whclbmads.FieldByName('材料編碼').Value);
end;
procedure Tdm.whtzmxadsBeforeInsert(DataSet: TDataSet);
begin
IF DM.whcjtzads.RecordCount=0 THEN
ABORT;
IF DM.whcjtzads.Modified THEN
begin
SHOWMESSAGE('請先保存主記錄!');
abort;
end;
end;
procedure Tdm.whtzmxadsNewRecord(DataSet: TDataSet);
begin
if (not whcjtzads.FieldByName('調整ID').IsNull) then
begin
whtzmxads.FieldByName('調整金額').Value:= 0;
whtzmxads.FieldByName('調整單價').Value:= 0;
whtzmxads.FieldByName('調整數量').Value:= 0;
whtzmxads.FieldByName('調整ID').Value:=whcjtzads.FieldByName('調整ID').Value;
end;
end;
procedure Tdm.whcjtzadsBeforeDelete(DataSet: TDataSet);
begin
adocn.Execute('delete from tzmxb where 調整ID='+
whccdads.fieldbyname('調整ID').Value);
end;
procedure Tdm.whyhqxadsBeforeEdit(DataSet: TDataSet);
begin
if yhqxwhfrm.DBEdit1.Text='00' then
abort;
yhqxwhfrm.pass.Text:=yhqxwhfrm.dbpass.Text;
end;
procedure Tdm.whyhqxadsBeforeInsert(DataSet: TDataSet);
begin
yhqxwhfrm.pass.Text:='';
end;
procedure Tdm.whyhqxadsBeforePost(DataSet: TDataSet);
begin
if yhqxwhfrm.pass.Text<>yhqxwhfrm.dbpass.Text then
begin
showmessage('對不起!兩次輸入的密碼不一致,請重新輸入!');
yhqxwhfrm.dbpass.SetFocus;
abort;
end;
end;
procedure Tdm.whjcmxadsDSDesigner3Change(Sender: TField);
begin
if whjcmxads.Modified then
if (not whjcmxads.FieldByName('單價').IsNull) and (not whjcmxads.FieldByName('數量').IsNull) then
whjcmxads.FieldByName('金額').Value:=
whjcmxads.FieldByName('單價').Value*whjcmxads.FieldByName('數量').Value
end;
procedure Tdm.whjcmxadsDSDesigner2Change(Sender: TField);
begin
if whjcmxads.Modified then
if (not whjcmxads.FieldByName('單價').IsNull) and (not whjcmxads.FieldByName('數量').IsNull) then
whjcmxads.FieldByName('金額').Value:=
whjcmxads.FieldByName('單價').Value*whjcmxads.FieldByName('數量').Value
end;
procedure Tdm.whccmxadsDSDesigner2Change(Sender: TField);
begin
if whccmxads.Modified then
if (not whccmxads.FieldByName('單價').IsNull) and (not whccmxads.FieldByName('數量').IsNull) then
whccmxads.FieldByName('金額').Value:=
whccmxads.FieldByName('單價').Value*whccmxads.FieldByName('數量').Value
end;
procedure Tdm.whccmxadsDSDesigner3Change(Sender: TField);
begin
if whccmxads.Modified then
if (not whccmxads.FieldByName('單價').IsNull) and (not whccmxads.FieldByName('數量').IsNull) then
whccmxads.FieldByName('金額').Value:=
whccmxads.FieldByName('單價').Value*whjcmxads.FieldByName('數量').Value
end;
procedure Tdm.whtzmxadsDSDesigner2Change(Sender: TField);
begin
if whtzmxads.Modified then
if (not whtzmxads.FieldByName('調整單價').IsNull) and (not whtzmxads.FieldByName('調整數量').IsNull) then
whtzmxads.FieldByName('調整金額').Value:=
whtzmxads.FieldByName('調整單價').Value*whtzmxads.FieldByName('調整數量').Value
end;
procedure Tdm.whtzmxadsDSDesigner3Change(Sender: TField);
begin
if whtzmxads.Modified then
if (not whtzmxads.FieldByName('調整單價').IsNull) and (not whtzmxads.FieldByName('調整數量').IsNull) then
whtzmxads.FieldByName('調整金額').Value:=
whtzmxads.FieldByName('調整單價').Value*whtzmxads.FieldByName('調整數量').Value
end;
procedure Tdm.whjcmxadsBeforePost(DataSet: TDataSet);
begin
dm.whclbmads.Filter:='材料編碼='+''''
+dm.whjcmxads.FieldByName('材料編碼').Value+'''';
if dm.whclbmads.RecordCount=0 then
if MessageDlg('數據庫中找不材料'+
dm.whjcmxads.FieldByName('材料編碼').Value+'你是否要增加 ?', mtConfirmation,
[mbYes, mbNo], 0) = mrno then
abort
else
begin
if not Assigned(clbmWHFRM) then
clbmWHFRM := tclbmWHFRM.Create(Self);
clbmWHFRM.ShowModal;
end;
end;
procedure Tdm.whccmxadsBeforePost(DataSet: TDataSet);
begin
dm.whclbmads.Filter:='材料編碼='+''''
+dm.whccmxads.FieldByName('材料編碼').Value+'''';
if dm.whclbmads.RecordCount=0 then
if MessageDlg('數據庫中找不材料'+
dm.whccmxads.FieldByName('材料編碼').Value+'你是否要增加 ?', mtConfirmation,
[mbYes, mbNo], 0) = mrno then
abort
else
begin
if not Assigned(clbmWHFRM) then
clbmWHFRM := tclbmWHFRM.Create(Self);
clbmWHFRM.ShowModal;
end;
end;
procedure Tdm.whtzmxadsBeforePost(DataSet: TDataSet);
begin
dm.whclbmads.Filter:='材料編碼='+''''
+dm.whtzmxads.FieldByName('材料編碼').Value+'''';
if dm.whclbmads.RecordCount=0 then
if MessageDlg('數據庫中找不材料'+
dm.whtzmxads.FieldByName('材料編碼').Value+'你是否要增加 ?', mtConfirmation,
[mbYes, mbNo], 0) = mrno then
abort
else
begin
if not Assigned(clbmWHFRM) then
clbmWHFRM := tclbmWHFRM.Create(Self);
clbmWHFRM.ShowModal;
end;
end;
procedure Tdm.whclbmadsAfterPost(DataSet: TDataSet);
begin
dm.whclbmads.Refresh;
end;
procedure Tdm.whclbmadsNewRecord(DataSet: TDataSet);
begin
whclbmads.FieldByName('倉庫ID').Value:=mainfrm.ckid;
end;
procedure Tdm.whjcmxadsAfterPost(DataSet: TDataSet);
begin
IF WHCLBMADS.RecordCount=1 THEN
BEGIN
WHCLBMADS.Edit;
WHCLBMADS.FieldByName('參考價格').Value :=
WHJCMXADS.FieldByName('單價').Value ;
WHCLBMADS.Post;
END;
end;
procedure Tdm.whccmxadsAfterPost(DataSet: TDataSet);
begin
IF WHCLBMADS.RecordCount=1 THEN
BEGIN
WHCLBMADS.Edit;
WHCLBMADS.FieldByName('參考價格').Value :=
WHJCMXADS.FieldByName('單價').Value ;
WHCLBMADS.Post;
END;
end;
procedure Tdm.bmlyhzbadsCalcFields(DataSet: TDataSet);
begin
bmlyhzbads.FieldByName('單價').Value:=
bmlyhzbads.FieldByName('金額').Value/bmlyhzbads.FieldByName('數量').Value
end;
procedure Tdm.gysghhzadsCalcFields(DataSet: TDataSet);
begin
gysghhzads.FieldByName('單價').Value:=
gysghhzads.FieldByName('金額').Value/gysghhzads.FieldByName('數量').Value
end;
end.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -