from Kingdee.BOS.Core.DynamicForm.PlugIn.ControlModel import *
def ButtonClick(e):
if(e.Key=="FBUTTON"):
para = DynamicFormShowParameter();
para.FormId ="BOS_MainSystemMenu_Often";
this.View.ShowForm(para);
分享一个单据插件里挂的python案例,汇总金额
from System import StringComparison
def DataChanged(e):
if e.Field.Key.Equals("FAmount", StringComparison.OrdinalIgnoreCase):
oldValue=e.OldValue
newValue=e.NewValue
spread=newValue-oldValue
transferDirect=this.View.Model.GetValue("FTransferDirect",e.Row).ToString()
bizType=this.View.Model.GetValue("FTransferBizType",e.Row)["Id"].ToString()
sumEntity=this.View.Model.DataObject["SumEntity"]
for sentity in sumEntity:
#this.View.ShowMessage(str(spread))
if sentity["SumType"]["Id"].ToString().Equals(bizType,StringComparison.OrdinalIgnoreCase):
if transferDirect.Equals("GENERAL", StringComparison.OrdinalIgnoreCase):
sentity["SumAcount"]=int(sentity["SumAcount"])+spread
break
else :
sentity["SumAcount"]=int(sentity["SumAcount"])-spread
break
this.View.UpdateView("FSumEntity")
再分享一个:根据过滤参数控制显示隐藏列
from System import StringComparison
def PrepareFilterParameter(e):
for item in e.ColumnFields:
item.Visible = False
#this.View.ShowMessage(item.Key+"##"+item.FieldName)
relatedBaseDataId = this.View.OpenParameter.GetCustomParameter("RelatedBaseDataId")
if relatedBaseDataId>0:
e.FilterString = " EXISTS(SELECT 1 FROM T_BD_FLEXVALUESCOM WHERE FSTOCKLOCID = FID AND FISDISABLE=0 AND FSYSDISABLE=0 AND FSTOCKID="+relatedBaseDataId+") "
relatedBaseDataObj = this.View.OpenParameter.GetCustomParameter("RelatedBaseDataObj")
stockFlexItem= relatedBaseDataObj["StockFlexItem"]
i=0
for item in stockFlexItem:
i=i+1
flexObj= item["FlexId"]
flexNumber="FF"+str(flexObj["Id"])+".FName"
for cfield in e.ColumnFields:
#this.View.ShowMessage(cfield.Key+"##"+flexNumber)
if cfield.Key.Equals(flexNumber, StringComparison.OrdinalIgnoreCase):
cfield.Visible = True
cfield.ColIndex=i
break