using Kingdee.BOS.App; using Kingdee.BOS.App.Data; using Kingdee.BOS.Contracts; using Kingdee.BOS.Orm.DataEntity; using System; using Kingdee.BOS.Contracts.Report; using System.ComponentModel; using Kingdee.BOS.Core.Report; using Kingdee.BOS; using System.Collections; using Kingdee.BOS.Core.Util; using System.Collections.Generic; using System.Linq; using System.Text; using Kingdee.BOS.Core.List; using VTR.ZHX.Plugin.Common; using Kingdee.BOS.ServiceHelper; using Kingdee.BOS.Core.ReportFilter; using Kingdee.BOS.Model.ReportFilter; using Kingdee.BOS.Util; namespace JN.K3.YDL.App.Report { [Description("擴充套件-科目餘額表"), HotUpdate] public class AccountBalanceService : Kingdee.K3.FIN.GL.App.Report.AccountBalanceService { public override void BuilderReportSqlAndTempTable(IRptParams filter, string tableName) { base.BuilderReportSqlAndTempTable(filter, tableName); DynamicObject customFilter = filter.FilterParameter.CustomFilter; //修改引數 int FSTARTPERIOD = Convert.ToInt32(customFilter["STARTPERIOD"]); int FENDPERIOD = Convert.ToInt32(customFilter["ENDPERIOD"]); if (FENDPERIOD != FSTARTPERIOD) { ISysReportService sysReportService = ServiceFactory.GetSysReportService(this.Context); IPermissionService permissionService = ServiceFactory.GetPermissionService(this.Context); var filterMetadata = FormMetaDataCache.GetCachedFilterMetaData(this.Context); var reportMetadata = FormMetaDataCache.GetCachedFormMetaData(this.Context, "GL_RPT_AccountBalance"); var reportfilterMetadata = FormMetaDataCache.GetCachedFormMetaData(this.Context, "GL_RPT_AccountBalanceFilter");//獲取報表過濾方案的構建基礎,便於後續模型構建 var reportfilterServiceProvider = reportfilterMetadata.BusinessInfo.GetForm().GetFormServiceProvider(); var model = new SysReportFilterModel(); model.SetContext(this.Context, reportfilterMetadata.BusinessInfo, reportfilterServiceProvider); model.FormId = reportfilterMetadata.BusinessInfo.GetForm().Id; model.FilterObject.FilterMetaData = filterMetadata; model.InitFieldList(reportMetadata, reportfilterMetadata); model.GetSchemeList(); //獲取過濾方案,可以透過LoadScheme("Id"), 查詢報表預設存在的一些過濾方案 //var entity = model.Load(" 62455ed272f00d");//.LoadDefaultScheme(); //var dyn = Deseria1i zeCustomF il ter (reportFi1 terMetadata. BusinessInfo,enti ty. //mode1. DataObject = dyn; var filterParameter = model.GetFilterParameter(); //var det = reportFilterlletadata. BusinessInfo. GetDynami cObjectType() ; //這裡填寫普透過濾方案,填充實體資訊 DynamicObject fi1terObj = filterParameter.CustomFilter; //fi1terObj["ACCTGSYSTEMID"] = getDynamicObject("0rg_ AccountSystem" ,ACCTGSYSTEMID, ctx);//預設會計核算體系 ////fi1ter0bj["STARTDATE"] = null; ////fi1terObj["EndDate"] = nul1; //fi1terObj["ACCTGSYSTEMID_ Id"] = ACCTGSYSTEMID; //fi1terObj["ACCTGORGID_ Id"] = ACCTGORGID; //核算組織 //fi1terObj[" ACCTGORGID"] = getDynami cObject("0RG_ _Organizations' ,ACCTGORGID, ctx); //fi1terObj["ACCTPOLICYID_ Id"] = ACCTP0LICYID; //會計政策 //fi1terObj["ACCTPOLICYID"] = getDynami cObject("BD_ ACCTPOLICY", ACCTPOLICYID, ctx); ////fi1ter0bj ["FCURRENCYID_ Id"] = currency; ////fi1ter0bj["FCURRENCYID"] = getDynami cObject(' 'BD_ Currency",currency, ctx) ; //fi1terObj["Year"] = year; //fi1terObj["Period"] = period; //fi1terObj["ENDYEAR"] = endYear; //fi1terObj["EndPeriod"] = endPeriod; //fi1terObj["FDimType"] =“0”; //顯示維度 //fi1terObj["CHXEXPENSE"] = "true";//顯示費用專案明細 //DynamicObject dyllatria1ID = getDynami cObject("BD_ JMATERIAL", FromMateria1ID, ctx); //fi1terObj["MATERIALID_ Id"] = FromMateria1ID; //物料編碼從 //fi1terObj["MATERIALID"] = dyllatria1ID; //物料編碼從 //fi1terObj["ENDIATERIALID_ Id"] = Fromlateria1ID;//物料編碼至 //fi1terObj["ENDMATERIALID"] = dyllatria1ID;//物料編碼 至 //RptParams rptParams = new RptParams(); //rptParams.FormId = ""; //rptParams.EndRow = -1; //rptParams.StartRow = 0; //rptParams.FilterParameter = filterParameter; ////報表服務引數,用於查詢。分頁報表 //MoveReportServiceParameter reportServiceParam = new MoveReportServiceParameter(this.Context, reportMetadata.BusinessInfo, Guid.NewGuid().ToString(), rptParams); //var presult = sysReportService.GetListAndReportData(reportServiceParam); for (int i = FSTARTPERIOD; i <= FENDPERIOD; i++) { customFilter["STARTPERIOD"] = i; customFilter["ENDPERIOD"] = i; ReportServiceParameter reportServiceParam2 = new ReportServiceParameter(); reportServiceParam2.RptFilterParams = filter; reportServiceParam2.Context = this.Context; reportServiceParam2.PageId = Guid.NewGuid().ToString(); reportServiceParam2.BusinessInfo = reportMetadata.BusinessInfo; //呼叫服務、查詢報表,簡單賬表 resut1.DataSource就是我們需要的DatTable了 var result3 = sysReportService.GetReportData(reportServiceParam2); var dt = result3.DataSource; //var result2 = sysReporSservice.GetData(ctx,reporletadata. BusinessInfo, p, true) ; //var result3 = sysReporSservice.GetReportData(reportServiceParam2) ; //var resu1t4 = sysReporSservice.GetExportData(reportServiceParam2) ; . } customFilter["STARTPERIOD"] = FSTARTPERIOD; customFilter["ENDPERIOD"] = FENDPERIOD; } } } }