在列表使用Python插件格式化字段显示值
#原需求:在列表使用单价FPrice*汇率FDECIMAL_PLC字段去计算二开字段FDECIMAL_PLC
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 *
#获取列表是否显示FExchangeRate、FPrice、FDECIMAL_PLC字段
isShow_FExchangeRate = False;
isShow_FPrice = False;
isShow_FDECIMAL_PLC = False;
def PrepareFilterParameter(e):
global isShow_FExchangeRate
global isShow_FPrice
global isShow_FDECIMAL_PLC
for item in e.ColumnFields:
if item.Key=="FExchangeRate":
isShow_FExchangeRate=True
for item in e.ColumnFields:
if item.Key=="FPrice":
isShow_FPrice=True
for item in e.ColumnFields:
if item.Key=="FDECIMAL_PLC":
isShow_FDECIMAL_PLC=True
def FormatCellValue(e):
if (isShow_FExchangeRate and isShow_FPrice and isShow_FDECIMAL_PLC):
if (e.Header.Key == "FDECIMAL_PLC"):
e.FormateValue = str(MathUtil.Round(e.DataRow["FPrice"] * e.DataRow["FExchangeRate"], 2))
在列表使用Python插件格式化字段显示值
本文2024-09-23 02:38:45发表“云星空知识”栏目。
本文链接:https://wenku.my7c.com/article/kingdee-k3cloud-153788.html