【转】【金蝶K3Cloud】 分页账表

  1 using System;
  2 using System.Collections.Generic;
  3 using System.Linq;
  4 using System.Text;
  5 using System.Threading.Tasks;
  6 using System.ComponentModel;
  7 using Kingdee.BOS.Contracts;
  8 using Kingdee.BOS.Contracts.Report;
  9 using Kingdee.BOS.Core.Metadata;
 10 using Kingdee.BOS.Core.Report;
 11 using Kingdee.BOS.App.Data;
 12 using Kingdee.BOS.Core.Permission.Objects;
 13 using Kingdee.K3.SCM.App.Sal.Report;
 14 using Kingdee.BOS.Resource;
 15 using Kingdee.BOS.BusinessEntity.BusinessFlow;
 16 using Kingdee.BOS.Util;
 17 using Kingdee.BOS.Orm.DataEntity;
 18 using Kingdee.BOS.Core.Report.PlugIn;
 19 using System.Data;
 20 using Kingdee.BOS;
 21 
 22 
 23 namespace MySysReportServicePluginThreeMxz
 24 {
 25     [Description("分表mxz练习-服务插件")]
 26     public class MyPageReportTabserPluginmxz : SysReportBaseService
 27     {
 28         public override void Initialize()
 29         {
 30             this.ReportProperty.ReportType = ReportType.REPORTTYPE_MOVE;//设置为分页账表
 31             this.ReportProperty.IsGroupSummary = true;//支持分组汇总
 32         }
 33 
 34         /// <summary>
 35         /// 动态构造列
 36         /// </summary>
 37         /// <param name="filter"></param>
 38         /// <returns></returns>
 39         public override ReportHeader GetReportHeaders(IRptParams filter)
 40         {
 41             ReportHeader header = new ReportHeader();
 42             header.AddChild("FID", new LocaleValue(Kingdee.BOS.Resource.ResManager.LoadKDString("编码", "002460030014674", Kingdee.BOS.Resource.SubSystemType.BOS), this.Context.UserLocale.LCID));
 43             header.AddChild("fname", new LocaleValue(Kingdee.BOS.Resource.ResManager.LoadKDString("全名", "002460030014677", Kingdee.BOS.Resource.SubSystemType.BOS), this.Context.UserLocale.LCID));
 44             header.AddChild("fdesc", new LocaleValue(Kingdee.BOS.Resource.ResManager.LoadKDString("别名", "002460030014680", Kingdee.BOS.Resource.SubSystemType.BOS), this.Context.UserLocale.LCID));
 45             header.AddChild("FLocaleId", new LocaleValue(Kingdee.BOS.Resource.ResManager.LoadKDString("类别", "002460030014683", Kingdee.BOS.Resource.SubSystemType.BOS), this.Context.UserLocale.LCID), SqlStorageType.SqlInt);
 46             return header;
 47         }
 48 
 49         /// <summary>
 50         /// 设置报表头
 51         /// </summary>
 52         /// <param name="filter"></param>
 53         /// <returns></returns>
 54         public override ReportTitles GetReportTitles(IRptParams filter)
 55         {
 56             ReportTitles titles = new ReportTitles();
 57             if(CacheDataList != null)
 58             {
 59                 DataTable dt = GetList(filter);
 60                 if (dt != null && dt.Rows.Count > 0)
 61                 {
 62                     //titles.AddTitle("FCondition", dt.Rows[0]["flocaleid"].ToString());
 63                     return titles;
 64                 }
 65                 return null;
 66             }
 67             DataRow dr = this.CacheDataList[filter.CurrentPosition];
 68             //titles.AddTitle("FCondition", dr["flocaleid"].ToString());
 69             return titles;
 70         }
 71 
 72         /// <summary>
 73         /// 构造取数Sql,取数据填充到临时表:tableName
 74         /// </summary>
 75         /// <param name="filter"></param>
 76         /// <param name="tableName"></param>
 77         public override void BuilderReportSqlAndTempTable(IRptParams filter, string tableName)
 78         {
 79             base.BuilderReportSqlAndTempTable(filter, tableName);
 80             DataRow dr = this.CacheDataList[filter.CurrentPosition];
 81             string sSQL = @"select a.fdeptid as FID, fname,ffullname as fdesc,FLocaleId,'BD_DEPARTMENT' as fformid, {0} into {1} from T_BD_DEPARTMENT a inner join T_BD_DEPARTMENT_l b on a.fdeptid=b.fdeptid where b.FLocaleId=" + dr["FLocaleId"].ToString();
 82             KSQL_SEQ = string.Format(KSQL_SEQ, "b.FLocaleId");
 83             sSQL = string.Format(sSQL, this.KSQL_SEQ, tableName);
 84             DBUtils.Execute(this.Context, sSQL);
 85             //DynamicObject dynamicObject = filter.FilterParameter.CustomFilter;//获取快捷页签的过滤字段数据
 86         }
 87 
 88         /// <summary>
 89         /// 设置汇总行,只有显示财务信息时才需要汇总
 90         /// </summary>
 91         /// <param name="filter"></param>
 92         /// <returns></returns>
 93         public override List<SummaryField> GetSummaryColumnInfo(IRptParams filter)
 94         {
 95             List<SummaryField> fls = new List<SummaryField>();
 96             SummaryField fs = new SummaryField("FLocaleId", Kingdee.BOS.Core.Enums.BOSEnums.Enu_SummaryType.SUM);
 97             fls.Add(fs);
 98             return fls;
 99         }
100         /// <summary>
101         /// 分页账表获取分页条件的方法
102         /// </summary>
103         /// <param name="filter"></param>
104         /// <returns></returns>
105         public override DataTable GetList(IRptParams filter)
106         {
107             DataTable dt;
108             string sSQL = @"select FLocaleId from T_BD_DEPARTMENT_L group by FLocaleId";
109             dt = DBUtils.ExecuteDataSet(this.Context, sSQL).Tables[0];
110             return dt;
111         }
112     }
113 }
View Code

 

posted @ 2018-10-22 14:50  嘿嘿嘿~  阅读(868)  评论(0编辑  收藏  举报