python套打_PYTHON 根据单据体字段自定义套打

#引入clr运行库

import clr

#添加对cloud插件开发的常用组件的引用

clr.AddReference('System')

clr.AddReference('Kingdee.BOS')

clr.AddReference('Kingdee.BOS.Core')

clr.AddReference('Kingdee.BOS.DataEntity')

clr.AddReference('Kingdee.BOS.Contracts')

clr.AddReference("Kingdee.BOS.ServiceHelper")

from System import *

from System.ComponentModel import *

from Kingdee.BOS.Core.BusinessFlow.PlugIn import *

from Kingdee.BOS.Core.Bill.PlugIn import *

from Kingdee.BOS.Core.Metadata.EntityElement import *

from Kingdee.BOS.Orm.DataEntity import *

from Kingdee.BOS.Orm.Metadata.DataEntity import *

from Kingdee.BOS.Core.DynamicForm.PlugIn.Args import *

from Kingdee.BOS.ServiceHelper import *

#def OnLoad(e):

#this.View.ShowMessage("helloworld!" + str(DateTime.Today));#注意缩进,用tab键即可

#def EntityRowClick(e):

#entity = this.Model.BillBusinessInfo.GetEntity("FEntity")

#row = this.Model.GetEntityDataObject(entity, e.Row)

#val = row["F_CSG_PRODNAME"]

#this.View.ShowMessage(str(val["FNumber"]))

#def DataChanged(e):

#if(e.Field.Key.upper()=="F_CSG_REDAMOUNT" or e.Field.Key.upper()=="F_CSG_BASEAMOUNT" or e.Field.Key.upper()=="F_CSG_CK"):

#this.Model.SetValue("F_CSG_AMOUNTSUM",999)

#printtype=int(this.Model.GetValue("F_CSG_CK", e.Row))

def BeforeSave(e):

this.Model.SetValue("F_CSG_Decimal",0)

rows=this.Model.GetEntryRowCount("FEntity")

amountsum=0

for irow in range(0,rows):

if(int(this.Model.GetValue("F_CSG_CK", irow))==0):

amountsum=amountsum+float(this.Model.GetValue("F_CSG_BASEAMOUNT", irow))

if(int(this.Model.GetValue("F_CSG_CK", irow))==1):

amountsum=amountsum+float(this.Model.GetValue("F_CSG_REDAMOUNT", irow))

this.Model.SetValue("F_CSG_AMOUNTSUM",amountsum)

def OnPrepareNotePrintData(e):

if (e.DataSourceId.Equals("FEntity", StringComparison.OrdinalIgnoreCase)):

_count =  e.DataObjects.Count

entity = this.Model.BillBusinessInfo.GetEntity("FEntity")

dot = e.DataObjects[0].DynamicObjectType

dot.RegisterSimpleProperty("CSGPRICE", float,None,False,[])

dot.RegisterSimpleProperty("CSGAMOUNT", float,None,False,[])

for i in range(0,_count):

obj = DynamicObject(dot)

for p in  e.DataObjects[i].DynamicObjectType.Properties:

obj[p] = e.DataObjects[i][p]

printtype=int(this.Model.GetEntityDataObject(entity, i)["F_CSG_CK"])

redprice=float(this.Model.GetEntityDataObject(entity, i)["F_CSG_REDPRICE"])

redamount=float(this.Model.GetEntityDataObject(entity, i)["F_CSG_REDAMOUNT"])

baseprice=float(this.Model.GetEntityDataObject(entity, i)["F_CSG_BASEPRICE"])

baseamount=float(this.Model.GetEntityDataObject(entity, i)["F_CSG_BASEAMOUNT"])

#this.View.ShowMessage(str(printtype))

if(printtype==0):

obj["CSGPRICE"]=baseprice

obj["CSGAMOUNT"]=baseamount

if(printtype==1):

obj["CSGPRICE"]=redprice

obj["CSGAMOUNT"]=redamount

e.DataObjects[i] = obj

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值