?? updipsti.pas
字號:
unit updIPSTI;
interface
uses sysUtils, dbtables, Bde, updBase, ComObj, CONSTDEF,LibStrs;
type
TUpdateIPSTI = class(TBaseUpdateUnit)
private
FOtherVar: variant;
function update_byIPSI05(xQrySource: TQuery): Boolean;
public
function update(xQrySource: TQuery; xAction: string;
var xMsg: variant; xOtherVar: variant; xUserData: variant): Boolean;
end;
implementation
function TUpdateIPSTI.update(xQrySource: TQuery; xAction: string;
var xMsg: variant; xOtherVar: variant; xUserData: variant): Boolean;
begin
Result := True;
self.saveVar(xAction, xOtherVar, xUserData);
FOtherVar:= xOtherVar;
try
setDBName(xQrySource.databaseName);
if compareText(self.SourceTxnCode, 'TXNIPSI05') = 0 then
Result := update_byIPSI05(xQrySource)
else
begin
end;
finally
self.Query1.close;
self.Query1.UnPrepare;
end;
xMsg := self.Msg;
end;
function TUpdateIPSTI.update_byIPSI05(xQrySource: TQuery): Boolean;
var
mExist: Boolean;
mPURAMT,mTA020,mTA019,mTA018,mTI023,mTG031,mTA034:Double;
begin
Result := True;
self.Msg[0] := 'skip';
self.Msg[1] := 'IPSTI';
with xQrySource do
begin
self.Msg[2] := FieldByName('TI001').asString+' '+FieldByName('TI002').asString+' '+
FieldByName('TI003').asString;
end;
try
with self.Query1 do
begin
{ close;
SQL.clear;
RequestLive := False;
SQL.add('select SUM(TD011) as PURAMT from $$PURTD,$$IPSTB');
SQL.add(' where TB004=TD001 AND TB005=TD002 AND TB006=TD003 AND TB001=:TB001 and TB002=:TB002 ');
ParamByName('TB001').asString := xQrySource.FieldByName('TI011').asString;
ParamByName('TB002').asString := xQrySource.FieldByName('TI012').asString;
open;
first ;
if not eof then
mPURAMT:=FieldByName('PURAMT').asFloat
else
mPURAMT:=0;
}
mPURAMT:=xQrySource.FieldByName('TA018').asFloat+xQrySource.FieldByName('TA019').asFloat; //890928 MODI
close;
SQL.clear;
RequestLive := False;
case SQLTYPE of
dtMSSQL :begin
SQL.add('select IPSTI.*,IPSTG.*,IPSTA.TA034,IPSTA.TA020,IPSTA.TA018,IPSTA.TA019 from $$IPSTG IPSTG ,$$IPSTI IPSTI');
SQL.add('LEFT JOIN $$IPSTA IPSTA ON TA001=TI011 AND TA002=TI012 ');
SQL.add(' where TI001=TG001 AND TG002=TI002 AND TI001=:TI001 and TI002=:TI002 and TI003=:TI003 ');
end;
dtORACLE:begin
SQL.add('select IPSTI.*,IPSTG.*,IPSTA.TA034,IPSTA.TA020,IPSTA.TA018,IPSTA.TA019 from $$IPSTG IPSTG ,$$IPSTI IPSTI,$$IPSTA IPSTA');
SQL.add(' where TI001=TG001 AND TG002=TI002 AND TI001=:TI001 and TI002=:TI002 and TI003=:TI003 AND TA001(+)=TI011 AND TA002(+)=TI012 ');
end;
end;
ParamByName('TI001').asString := xQrySource.FieldByName('TI001').asString;
ParamByName('TI002').asString := xQrySource.FieldByName('TI002').asString;
ParamByName('TI003').asString := xQrySource.FieldByName('TI003').asString;
open;
first ;
mExist:= not eof ;
if mExist then //
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -