应收单列表明细有成本金额,但是没有成本单价,要看成本单价,要勾选成本明细,与明细不能同时勾
在应收单明细添加一个单价字段,字段名:F_UAGW_COSTPRICE , 去掉所有可见性
添加列表插件,用成本金额/计价数量 取6位小数。
import clr
clr.AddReference('System')
clr.AddReference('Kingdee.BOS')
clr.AddReference('Kingdee.BOS.Core')
from Kingdee.BOS import *
from Kingdee.BOS.Core.List.PlugIn import *
from Kingdee.BOS.Core.Metadata import *
from System import *
def CreateListHeader(e):
header = e.ListHeader.AddChild()
header.Caption = LocaleValue("成本单价")
header.Key = "F_UAGW_COSTPRICE"
header.FieldName = "F_UAGW_COSTPRICE"
header.ColType = SqlStorageType.Sqlnvarchar
header.Width = 200
header.Visible = True
#header.ColIndex = e.ListHeader.GetChilds().Max(o => o.ColIndex) + 1
maxCol = max(e.ListHeader.GetChilds(), key = lambda x: x.ColIndex)
header.ColIndex = maxCol.ColIndex + 1
def FormatCellValue(e):
if e.Header.Key.Equals("F_UAGW_COSTPRICE", StringComparison.OrdinalIgnoreCase):
e.FormateValue = '''{0}'''.format(MathUtil.Round(e.DataRow["FCOSTAMTSUM"] / e.DataRow["FPRICEQTY"], 6) if e.DataRow["FCOSTAMTSUM"] > 0 else '')
应收单添加成本单价.zip(0.73KB)
推荐阅读