电脑桌面
添加蚂蚁七词文库到电脑桌面
安装后可以在桌面快捷访问

二开方案示例:根据凭证生成过滤方案调用凭证生成服务(仅供参考)

来源:金蝶云社区作者:金蝶2024-09-233

二开方案示例:根据凭证生成过滤方案调用凭证生成服务(仅供参考)

**调用方式:** VoucherBuild.BuildVoucher(context,filterSchemeId); **查询本次生成凭证报告:** ShowGenerateResult(view); ```c# using Kingdee.BOS; using Kingdee.BOS.Core.Bill; using Kingdee.BOS.Core.DynamicForm; using Kingdee.BOS.Core.List; using Kingdee.BOS.Core.Metadata; using Kingdee.BOS.Core.SqlBuilder; using Kingdee.BOS.Orm.DataEntity; using Kingdee.BOS.ServiceHelper; using Kingdee.BOS.Util; using Kingdee.K3.FIN.Core; using Kingdee.K3.FIN.GL.ServiceHelper; using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Kingdee.K3.FIN.GL.Business.PlugIn.BizVoucher { /// /// 二开方案示例:根据凭证生成过滤方案调用凭证生成服务 /// public static class VoucherBuild { private static string text = Kingdee.BOS.Resource.ResManager.LoadKDString("全部", "003032000001777", Kingdee.BOS.Resource.SubSystemType.FIN); /// /// 会计日历 /// private static DynamicObjectCollection calendarObject = null; /// /// 事务id:联查凭证报告 /// private static string TransactionID = SequentialGuid.NewGuid().ToString(); /// /// 调用凭证生成服务 /// /// <param name="ctx">上下文</param> /// <param name="filterSchemeId">过滤方案Id:可查询T_BAS_VCHGENESCHEME、T_BAS_VCHGENESCHEME_L表获取方案id</param> public static void BuildVoucher(Context ctx, int filterSchemeId) { List<VchSelectBookInfor> lstVchSelectBookInfor = GetBookPara(ctx, filterSchemeId); if (lstVchSelectBookInfor!=null && lstVchSelectBookInfor.Count > 0) { //调用凭证生成服务 BizVchMakeSchemeInfor bizVchMakeSchemeInfor = new BizVchMakeSchemeInfor(); bizVchMakeSchemeInfor.SelectBooks = lstVchSelectBookInfor; bizVchMakeSchemeInfor.JumpFromWhere = JumpFromWhere.No; BuildVoucherServiceHelper.BuildVoucher(ctx, bizVchMakeSchemeInfor); } } /// /// 联查本次凭证生成报告 /// /// <param name="view"></param> public static void ShowGenerateResult(IBillView view) { ListShowParameter listpara = new ListShowParameter(); listpara.FormId = "BAS_VchBuildReport"; listpara.ParentPageId = view.PageId; listpara.PageId = Guid.NewGuid().ToString(); listpara.OpenStyle.ShowType = ShowType.MainNewTabPage; listpara.IsShowFilter = false; listpara.CustomParams.Add("SubSystemId", SystemKeyConst.SYSTEM_FINBI); listpara.ListFilterParameter.Filter = string.Format(" FMakeGroupID = '{0}' ", TransactionID); view.ShowForm(listpara); } /// /// 根据过滤方案填充凭证生成账簿等信息 /// /// <param name="ctx"></param> /// <param name="filterSchemeId"></param> /// <returns></returns> private static List<VchSelectBookInfor> GetBookPara(Context ctx, int filterSchemeId) { // 获取过滤方案 FormMetadata metaData = MetaDataServiceHelper.GetFormMetaData(ctx, BusinessObjectConst.Bas_MakeBizVchWizard); DynamicObject scheme = BusinessDataServiceHelper.LoadSingle(ctx, filterSchemeId, metaData.BusinessInfo.GetDynamicObjectType()); DynamicObjectCollection doBookColc = scheme["VchGeneScmEntry"] as DynamicObjectCollection; if (doBookColc == null || doBookColc.Count == 0) { return new List<VchSelectBookInfor> (); } // 构造凭证生成所需账簿和单据信息(类似凭证生成界面选账簿和单据) List<VchSelectBookInfor> lstVchSelectBookInfor = new List<VchSelectBookInfor>(); for (int i = 0; i < doBookColc.Count; i++) { DynamicObject bookInfoDyc = doBookColc[i]["ACCTBOOKID"] as DynamicObject; if (bookInfoDyc == null || !(bookInfoDyc is DynamicObject)) { continue; } DynamicObjectCollection doBillColc = doBookColc[i]["VchGeneScmDetail"] as DynamicObjectCollection; if (doBillColc == null) { continue; } // 账簿及凭证生成方式相关信息 VchSelectBookInfor vchSelectBookInfor = new VchSelectBookInfor(); vchSelectBookInfor.AccountTableID = Convert.ToInt64(bookInfoDyc["AccountTable_Id"]);// 科目表内码 vchSelectBookInfor.AcctSystemID = Convert.ToInt64(bookInfoDyc["AcctSystemID_Id"]);//核算体系内码 vchSelectBookInfor.BookID = Convert.ToInt64(bookInfoDyc["Id"]);//账簿内码 vchSelectBookInfor.GenerateType = Convert.ToString(doBookColc[i]["ACTIONTYPE"]);//凭证生成方式:0代表仅生成业务凭证,1代表业务凭证生成总账凭证,2代表单据生成业务凭证和总账凭证 vchSelectBookInfor.Period = Convert.ToString(doBookColc[i]["Period"]); //凭证生成的年度期间 vchSelectBookInfor.TransactionID = TransactionID;//事务ID vchSelectBookInfor.AcctOrgID = Convert.ToInt64(bookInfoDyc["AccountOrgID_Id"]);//核算组织内码 vchSelectBookInfor.AcctBookCalID = Convert.ToInt64(bookInfoDyc["AccountCalendar_Id"]);//会计日历内码 vchSelectBookInfor.AcctPolicyID = Convert.ToInt64(bookInfoDyc["AcctPolicyID_Id"]);//会计政策内码 int currentYear = bookInfoDyc["CURRENTYEAR"] == null ? 0 : Convert.ToInt32(bookInfoDyc["CURRENTYEAR"]); int currentPeriod = bookInfoDyc["CURRENTPERIOD"] == null ? 0 : Convert.ToInt32(bookInfoDyc["CURRENTPERIOD"]); string strPeriod = string.Empty; if (string.IsNullOrWhiteSpace(doBookColc[i].GetValue<string>("PERIOD"))) { //设置账簿的期间默认为当前期间 strPeriod = string.Format("{0}.{1}", currentYear, currentPeriod); } else { string[] yearAndPeriod = doBookColc[i].GetValue<string>("PERIOD", "").Split('.'); if (yearAndPeriod.Count() != 2 || (Convert.ToInt32(yearAndPeriod[0]) * 100 + Convert.ToInt32(yearAndPeriod[1])) < (currentYear * 100 + currentPeriod)) { //设置账簿的期间默认为当前期间 strPeriod = string.Format("{0}.{1}", currentYear, currentPeriod); } else { strPeriod = doBookColc[i].GetValue<string>("PERIOD"); } } vchSelectBookInfor.Period = strPeriod; SetBookStartEndDate(vchSelectBookInfor, ctx); SetBillScope(doBillColc, vchSelectBookInfor); if (vchSelectBookInfor.SelectSourceBills == null || vchSelectBookInfor.SelectSourceBills.Count <= 0) { continue; } lstVchSelectBookInfor.Add(vchSel

二开方案示例:根据凭证生成过滤方案调用凭证生成服务(仅供参考)

**调用方式:**VoucherBuild.BuildVoucher(context,filterSchemeId);**查询本次生成凭证报告:**ShowGenerateResult(view);```c#using Kin...
点击下载文档文档为doc格式

声明:除非特别标注,否则均为本站原创文章,转载时请以链接形式注明文章出处。如若本站内容侵犯了原著者的合法权益,可联系本站删除。

已经是第一篇
确认删除?
回到顶部
客服QQ
  • 客服QQ点击这里给我发消息
QQ群
  • 答案:my7c点击这里加入QQ群
支持邮箱
微信
  • 微信