获取核算组织的本位币示例

栏目:云星空知识作者:金蝶来源:金蝶云社区发布:2024-09-16浏览:1

获取核算组织的本位币示例

一、【业务需求】

单据扩展本位币的字段,新增单据时,如何让这个字段自动赋值为账套的本位币种?


二、【分析实现】

1、根据组织取到默认会计政策下面默认的本位币和汇率类型

两种方式:

  • 调用财务领域的服务

Kingdee.K3.BD.Contracts.FIN.IFINServiceForCommon service = Kingdee.K3.BD.Contracts.ServiceFactory.GetService<Kingdee.K3.BD.Contracts.FIN.IFINServiceForCommon>(ctx);
return service.GetDefCurrencyAndExchangeTypeByBizOrgID(ctx, subOrgId);


  • 调用供应链领域CommonServiceHelper,引用组件(Kingdee.K3.SCM.ServiceHelper.dll)

CommonServiceHelper.GetDefCurrencyAndExchangeTypeByBizOrgID(this.View.Context, orgId)


image.webp


返回JSONObject类型,其中

  • FRateType:汇率类型   

  • FCyForID:本位币内码

  • FCyForCode: 本位币编码


2、调拨申请单扩展本位币字段,二开表单插件

public override void AfterCreateModelData(EventArgs e)
{
            if (this.View.OpenParameter.Status == OperationStatus.ADDNEW)
            {
                if (this.View.OpenParameter.CreateFrom != CreateFrom.Push)
                { 

                    DynamicObject apporg = this.Model.GetValue("FAPPORGID") as DynamicObject;
                    long orgId = apporg == null ? 0 : Convert.ToInt64(apporg["Id"]);
                    JSONObject objk = CommonServiceHelper.GetDefCurrencyAndExchangeTypeByBizOrgID(this.View.Context, orgId);
                    this.View.Model.SetValue("FBaseCurrId", objk["FCyForID"]);
                }
            }
}


Python: 

import clr
clr.AddReference("System")
clr.AddReference("System.Core")
clr.AddReference("Kingdee.BOS")
clr.AddReference("Kingdee.BOS.Core")
clr.AddReference('Kingdee.K3.SCM.ServiceHelper')

from System import *
from Kingdee.BOS.Core import *
from Kingdee.K3.SCM.ServiceHelper import *

def AfterCreateModelData(e):
    if this.View.OpenParameter.Status == OperationStatus.ADDNEW and this.View.OpenParameter.CreateFrom != CreateFrom.Push:
        apporg = this.Model.GetValue("FAPPORGID")
        if apporg != None:
            orgId = Convert.ToInt64(apporg["Id"])
            objk = CommonServiceHelper.GetDefCurrencyAndExchangeTypeByBizOrgID(this.View.Context, orgId)
            this.View.Model.SetValue("FBaseCurrId", objk["FCyForID"])


image.webp

获取核算组织的本位币示例

一、【业务需求】单据扩展本位币的字段,新增单据时,如何让这个字段自动赋值为账套的本位币种?二、【分析实现】1、根据组织取到默认会计...
点击下载文档
确认删除?
回到顶部
客服QQ
  • 客服QQ点击这里给我发消息