复制单据重取汇率
@[TOC](目录)
### pytho案例(以采购退料单为例)
```python
import clr
clr.AddReference('System')
clr.AddReference('mscorlib')
clr.AddReference('Kingdee.BOS.Core')
clr.AddReference('Kingdee.K3.SCM.ServiceHelper')
from System import *
from Kingdee.BOS.Core.Metadata import CreateFrom
from Kingdee.K3.SCM.ServiceHelper import *
def AfterCreateNewData(e):
if this.View.OpenParameter.CreateFrom == CreateFrom.Copy:
SetExchangeRate()
def SetExchangeRate():
locCurr = this.View.Model.GetValue("FLocalCurrId")
exchangeType = this.View.Model.GetValue("FExchangeTypeId")
setCurr = this.View.Model.GetValue("FSettleCurrId")
if locCurr == None or exchangeType == None or setCurr == None:
return
locCurrId = Convert.ToInt64(locCurr["Id"])
exchangeTypeId = Convert.ToInt64(exchangeType["Id"])
setCurrId = Convert.ToInt64(setCurr["Id"])
billdate = Convert.ToDateTime(this.View.Model.GetValue("FDate"))
if locCurrId == setCurrId or billdate == DateTime.MinValue:
this.View.Model.SetValue("FExchangeRate", 1)
else:
rateNDec = CommonServiceHelper.GetExchangeRateAndDecimal(this.Context, setCurrId, locCurrId, exchangeTypeId, billdate, billdate)
this.View.Model.SetValue("FExchangeRate", rateNDec.Key)
this.View.GetFieldEditor("FExchangeRate", 0).Scale = Convert.ToInt16(rateNDec.Value)
this.View.InvokeFieldUpdateService("FExchangeRate", 0)
def AfterCopyData(e):
exchangeRate = Convert.ToDecimal(this.View.Model.GetValue("FExchangeRate"))
currencyObj = this.View.Model.GetValue("FSettleCurrId")
iAmountDigits = 2
if currencyObj != None:
iAmountDigits = Convert.ToInt16(currencyObj["AmountDigits"])
dycFinanceEntryData = e.DataObject["PUR_MRBFIN"]
if dycFinanceEntryData != None and dycFinanceEntryData.Count > 0:
financeEntryData = dycFinanceEntryData[0]
financeEntryData["BILLTAXAMOUNT_LC"] = Math.Round(Convert.ToDecimal(financeEntryData["BILLTAXAMOUNT"]) * exchangeRate, int(iAmountDigits))
financeEntryData["BillAmount_LC"] = Math.Round(Convert.ToDecimal(financeEntryData["BillAmount"]) * exchangeRate, int(iAmountDigits))
financeEntryData["FBILLALLAMOUNT_LC"] = Convert.ToDecimal(financeEntryData["BILLTAXAMOUNT_LC"]) + Convert.ToDecimal(financeEntryData["BillAmount_LC"])
for entry in e.DataObject["PUR_MRBENTRY"]:
entry["TAXAMOUNT_LC"] = Math.Round(Convert.ToDecimal(entry["TaxAmount"]) * exchangeRate, int(iAmountDigits))
entry["Amount_LC"] = Math.Round(Convert.ToDecimal(entry["Amount"]) * exchangeRate, int(iAmountDigits))
entry["ALLAMOUNT_LC"] = Convert.ToDecimal(entry["TAXAMOUNT_LC"]) + Convert.ToDecimal(entry["Amount_LC"])
```
**其他更多文章入口:**[https://vip.kingdee.com/link/s/lbRPP](https://vip.kingdee.com/link/s/lbRPP)
复制单据重取汇率
@[TOC](目录)### pytho案例(以采购退料单为例)```pythonimport clrclr.AddReference('System')clr.AddReference('mscorlib')clr.AddRef...
点击下载文档
本文2024-09-23 02:34:24发表“云星空知识”栏目。
本文链接:https://wenku.my7c.com/article/kingdee-k3cloud-153313.html
您需要登录后才可以发表评论, 登录登录 或者 注册
最新文档
热门文章