实现简单的分页账表,从代码到客户端展示,您可以直接拿来用。先上代码,最后面再上实现的图
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.ComponentModel;
using Kingdee.BOS.Contracts;
using Kingdee.BOS.Contracts.Report;
using Kingdee.BOS.Core.Metadata;
using Kingdee.BOS.Core.Report;
using Kingdee.BOS.App.Data;
using Kingdee.BOS.Core.Permission.Objects;
using Kingdee.K3.SCM.App.Sal.Report;
using Kingdee.BOS.Resource;
using Kingdee.BOS.BusinessEntity.BusinessFlow;
using Kingdee.BOS.Util;
using Kingdee.BOS.Orm.DataEntity;
using Kingdee.BOS.Core.Report.PlugIn;
using System.Data;
using Kingdee.BOS;
namespace MySysReportServicePluginThreeMxz
{
[Description("分表mxz练习-服务插件")]
public class MyPageReportTabserPluginmxz : SysReportBaseService
{
public override void Initialize()
{
this.ReportProperty.ReportType = ReportType.REPORTTYPE_MOVE;//设置为分页账表
this.ReportProperty.IsGroupSummary = true;//支持分组汇总
}
///
/// 动态构造列
///
///
///
public override ReportHeader GetReportHeaders(IRptParams filter)
{
ReportHeader header = new ReportHeader();
header.AddChild("FID", new LocaleValue(Kingdee.BOS.Resource.ResManager.LoadKDString("编码", "002460030014674", Kingdee.BOS.Resource.SubSystemType.BOS), this.Context.UserLocale.LCID));
header.AddChild("fname", new LocaleValue(Kingdee.BOS.Resource.ResManager.LoadKDString("全名", "002460030014677", Kingdee.BOS.Resource.SubSystemType.BOS), this.Context.UserLocale.LCID));
header.AddChild("fdesc", new LocaleValue(Kingdee.BOS.Resource.ResManager.LoadKDString("别名", "002460030014680", Kingdee.BOS.Resource.SubSystemType.BOS), this.Context.UserLocale.LCID));
header.AddChild("FLocaleId", new LocaleValue(Kingdee.BOS.Resource.ResManager.LoadKDString("类别", "002460030014683", Kingdee.BOS.Resource.SubSystemType.BOS), this.Context.UserLocale.LCID), SqlStorageType.SqlInt);
return header;
}
///
/// 设置报表头
///
///
///
public override ReportTitles GetReportTitles(IRptParams filter)
{
ReportTitles titles = new ReportTitles();
if(CacheDataList != null)
{
DataTable dt = GetList(filter);
if (dt != null && dt.Rows.Count > 0)
{
//titles.AddTitle("FCondition", dt.Rows[0]["flocaleid"].ToString());
return titles;
}
return null;
}
DataRow dr = this.CacheDataList[filter.CurrentPosition];
//titles.AddTitle("FCondition", dr["flocaleid"].ToString());
return titles;
}
///
/// 构造取数Sql,取数据填充到临时表:tableName
///
///
///
public override void BuilderReportSqlAndTempTable(IRptParams filter, string tableName)
{
base.BuilderReportSqlAndTempTable(filter, tableName);
DataRow dr = this.CacheDataList[filter.CurrentPosition];
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();
KSQL_SEQ = string.Format(KSQL_SEQ, "b.FLocaleId");
sSQL = string.Format(sSQL, this.KSQL_SEQ, tableName);
DBUtils.Execute(this.Context, sSQL);
//DynamicObject dynamicObject = filter.FilterParameter.CustomFilter;//获取快捷页签的过滤字段数据
}
///
/// 设置汇总行,只有显示财务信息时才需要汇总
///
///
///
public override List
{
List
SummaryField fs = new SummaryField("FLocaleId", Kingdee.BOS.Core.Enums.BOSEnums.Enu_SummaryType.SUM);
fls.Add(fs);
return fls;
}
///
/// 分页账表获取分页条件的方法
///
///
///
public override DataTable GetList(IRptParams filter)
{
DataTable dt;
string sSQL = @"select FLocaleId from T_BD_DEPARTMENT_L group by FLocaleId";
dt = DBUtils.ExecuteDataSet(this.Context, sSQL).Tables[0];
return dt;
}
}
}
展示结果:
如有问题请联系我: javacatalina@163.com