zoukankan      html  css  js  c++  java
  • K/3Cloud 分页报表示例参考

    分页报表首先需要实现的方法就是GetList,这个方法用来获得分页的条件。

    其他的就和其他报表类似了。

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using Kingdee.BOS.Core.Report.PlugIn;
    using Kingdee.BOS.Core.Report;
    using System.Data;
    using Kingdee.BOS.App.Data;
    using Kingdee.BOS.Contracts.Report;
    using Kingdee.BOS.Core.CommonFilter;
    using Kingdee.BOS.Util;
    
    namespace Kingdee.BOS.Demo.Report
    {
        public class DemoMoveReport : SysReportBaseService
        {
            public override void Initialize()
            {
                // 标记报表类型
                this.ReportProperty.ReportType = Core.Report.ReportType.REPORTTYPE_MOVE;
                this.ReportProperty.IsGroupSummary = true;
            }
            
            /// <summary>
            /// 构建分页报表每个报表的临时表
            /// 首先从分页依据中拿到本次分页的条件,就是当前页报表的条件:this.CacheDataList[filter.CurrentPosition]
            /// 然后把条件拼装到SQL中,例如b.FLocaleId= dr["FLocaleId"] 语言id=当前报表的语言id
            /// </summary>
            /// <param name="filter"></param>
            /// <param name="tableName"></param>
            public override void BuilderReportSqlAndTempTable(IRptParams filter, string 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);
            }
    
            public override List<Core.Report.SummaryField> GetSummaryColumnInfo(IRptParams filter)
            {
                List<Core.Report.SummaryField> fls = new List<Core.Report.SummaryField>();
                Core.Report.SummaryField fs = new Core.Report.SummaryField("FLocaleId", Core.Enums.BOSEnums.Enu_SummaryType.SUM);
                fls.Add(fs);
                return fls;
            }
    
    
            /// <summary>
            /// 分页报表必须实现的方法,此方法用于为报表提供分页依据。
            /// 比如以下示例:分别按语言来对部门分类,也就是说每种语言一个报表,中文的是一个报表、英文的一个报表,繁体的一个
            /// </summary>
            /// <param name="filter"></param>
            /// <returns></returns>
            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;
            }
    
            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;
            }
    
            public override ReportHeader GetReportHeaders(IRptParams filter)
            {
                // TODO:
                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;
            }
        }
    }


  • 相关阅读:
    vue项目中实现定时刷新页面(重新渲染数据实时更新)
    如何撤销 Git commit ?
    error: You have not concluded your merge (MERGE_HEAD exists)
    ajax的前世今生
    DevTools failed to load SourceMap: Could not load content for webpack:///node_modules/sockjs-client/
    Vue 项目如何配置代理解决跨域
    Nginx 到底是什么东西?
    JSON.parse()与JSON.stringify()的区别
    uni-app 中如何管理用户登录状态
    Oracle分析函数简析
  • 原文地址:https://www.cnblogs.com/fyq891014/p/4188794.html
Copyright © 2011-2022 走看看