合同的采购清单修改后应该自动更新合同总价
— 以下是代码部分
–[[
Code: SD-0404
Author:han Create Date: 2021-8-11
Version:V1.0
功能:
更新订单中的价格 F_TOTAL
–]]
json = require (“json”)
mobox = require (“OILua_JavelinExt”)
function AfterDataObjModify ( strLuaDEID )
local nRet,strRetInfo, strPOCode
— 获取 订单编号
nRet, strRetInfo = mobox.getCurEditDataObjAttr( strLuaDEID, “S_PO_CODE” )
if ( nRet ~= 0 or strRetInfo == ” ) then
mobox.error( strLuaDEID, “获取价格信息失败!” )
return
end
local retAttrs = json.decode( strRetInfo )
strPOCode = retAttrs[1].value
— 获取这个订单下面的 总价
local strCondition = “S_PO_CODE = ‘”..strPOCode..”‘”
nRet, strRetInfo = mobox.getDataObjAttrSum( strLuaDEID, “采购清单”, strCondition, “F_SUBTOTAL” )
if ( nRet ~= 0 ) then
mobox.error( strLuaDEID, strRetInfo)
return
end
local fSumTotal = 0
local retValue = json.decode( strRetInfo )
if ( retValue[1] ~= ” ) then
fSumTotal = tonumber( retValue[1] )
end
strCondition = “S_PO_CODE = ‘”..strPOCode..”‘”
strSetAttr = “F_TOTAL = “..fSumTotal
nRet, strRetInfo = mobox.updateDataAttrByCondition( strLuaDEID, “订单”, strCondition, strSetAttr )
if ( nRet ~= 0 ) then
mobox.error( strLuaDEID, strRetInfo )
return
end
end
上一篇: 共好合同管理系统-部署环境要求
下一篇: 数据对象的编号生成