我的使用方式如下:
function TAccountTransferForm.Save: Boolean;
var
sInputUser, sSignUser: string;
dtInputTime, dtSignTime: TDateTime;
i, iCount, iID, iCheck: Integer;
Node: TdxTreeListNode;
begin
if not FChanged then
begin
Result := True;
Exit;
end;
Result := False;
UpdateTL;
iCount := dxTL.Count;
DMBase.adocnBiz.BeginTrans; //
for i := 0 to iCount - 1 do
begin
Node := dxTL.Items;
iCheck := Node.Values[Integer(aclCheck)];
iID := Node.Values[Integer(aclID)];
if (iCheck = 1) or (iID <> 0) then
begin
try //保存操作,后台sqlServer中也有事务处理
Result := DMAccountTransfer.SaveAccountTransfer(iID,
Node.Values[Integer(aclAID)], Node.Values[Integer(aclOutAccount)],
Node.Values[Integer(aclInAccount)], Node.Values[Integer(aclBalance)], Node.Values[Integer(aclOutUID)],
rzedtInUnit.tag, Node.Values[Integer(aclOutBankID)],
rzcbBank.ItemIndex + 1,StrToDateTime(Node.Values[Integer(aclCDate)]),
StrToDateTime(Node.Values[Integer(aclFactDate)]),StrToCurr(Node.Values[Integer(aclFactMoney)]),
StrToCurr(Node.Values[Integer(aclAccrual)]), StrToDateTime(Node.Values[Integer(aclEndMonth)]),
Node.Values[Integer(aclTag)],Node.Values[Integer(aclMemo)],
sInputUser, dtInputTime, sSignUser, dtSignTime);
if (Result = True) and (iCheck = 1) and (Node.Values[Integer(aclSignTag)] = 1) then
begin //审批操作,也有事务操作
Result := DMAccountTransfer.SignAccountTransfer(iID, sSignUser, dtSignTime);
end;
if Result = True then
begin
if iCheck = 1 then
Node.Values[Integer(aclID)] := iID
else
Node.Values[Integer(aclID)] := 0;
end;
except
DMBase.adocnBiz.RollbackTrans;
raise;
Exit;
end;
end;
end;
DMBase.adocnBiz.CommitTrans;
FChanged := False;
FModifing := (rzrgSignTag.ItemIndex = 0);
EnableControls;
end;
我的目的如下:
就是保存之前要测试一下这个用户到底有没有审批的权限,如果没有,那么他只能保存
未审批的记录,已经审批的记录,只能让具有审批权限的人修改保存。
好像没有什么问题。
请大家看看。