2025-03-31 19:09:19 +08:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.ComponentModel;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using Kingdee.BOS;
|
|
|
|
|
using Kingdee.BOS.App.Data;
|
|
|
|
|
using Kingdee.BOS.Contracts;
|
|
|
|
|
using Kingdee.BOS.Contracts.Report;
|
|
|
|
|
using Kingdee.BOS.Core.Metadata;
|
|
|
|
|
using Kingdee.BOS.Core.Report;
|
|
|
|
|
using Kingdee.BOS.Core.SqlBuilder;
|
|
|
|
|
using Kingdee.BOS.Orm.DataEntity;
|
|
|
|
|
using Kingdee.BOS.Util;
|
|
|
|
|
|
|
|
|
|
namespace GZ_LTHReportForms.YingShouBaoBiao
|
|
|
|
|
{
|
|
|
|
|
[Description("应收情况概况表按(SBU)区分"), HotUpdate]
|
|
|
|
|
public class YingShouSBU : SysReportBaseService
|
|
|
|
|
{
|
|
|
|
|
public override void Initialize()
|
|
|
|
|
{
|
|
|
|
|
base.Initialize();
|
|
|
|
|
//设置报表类型为普通类型
|
|
|
|
|
this.ReportProperty.ReportType = ReportType.REPORTTYPE_NORMAL;
|
|
|
|
|
//设置是否通过插件创建临时表
|
|
|
|
|
this.IsCreateTempTableByPlugin = true;
|
|
|
|
|
//设置是否分组汇总
|
|
|
|
|
this.ReportProperty.IsGroupSummary = true;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//设置单据列
|
|
|
|
|
public override ReportHeader GetReportHeaders(IRptParams filter)
|
|
|
|
|
{
|
2025-04-02 11:11:13 +08:00
|
|
|
|
DynamicObject customFilter = filter.FilterParameter.CustomFilter;
|
2025-04-15 11:11:33 +08:00
|
|
|
|
//当前时间格式化
|
|
|
|
|
string FNowDate = (customFilter["F_EDate"] == null) ? DateTime.Now.ToString("yyyy年M月") : Convert.ToDateTime(
|
|
|
|
|
customFilter["F_EDate"]).ToString("yyyy年MM月");
|
|
|
|
|
|
|
|
|
|
//过去时间格式化
|
|
|
|
|
DateTime currentDate = DateTime.Now;
|
|
|
|
|
|
|
|
|
|
DateTime lastYearDecember = new DateTime(currentDate.Year - 1, 12, 31);
|
|
|
|
|
|
|
|
|
|
string FLastDate = lastYearDecember.ToString("yyyy年MM月");
|
2025-04-02 11:11:13 +08:00
|
|
|
|
|
2025-03-31 19:09:19 +08:00
|
|
|
|
//创建表头对象
|
|
|
|
|
ReportHeader header = new ReportHeader();
|
|
|
|
|
header.AddChild("SBU", new LocaleValue("SBU", this.Context.UserLocale.LCID), SqlStorageType.Sqlvarchar);
|
2025-04-15 11:11:33 +08:00
|
|
|
|
header.AddChild("年初到期应收款额", new LocaleValue(FLastDate + "期初到期应收额", this.Context.UserLocale.LCID), SqlStorageType.SqlDecimal);
|
|
|
|
|
header.AddChild("其中_年初应收款专责小组", new LocaleValue("其中:期初应收款专责小组", this.Context.UserLocale.LCID), SqlStorageType.SqlDecimal);
|
|
|
|
|
header.AddChild("本年到期应收款额", new LocaleValue(FNowDate + "到期应收额", this.Context.UserLocale.LCID), SqlStorageType.SqlDecimal);
|
|
|
|
|
header.AddChild("其中_本年应收款专责小组", new LocaleValue("其中:应收款专责小组", this.Context.UserLocale.LCID), SqlStorageType.SqlDecimal);
|
2025-03-31 19:09:19 +08:00
|
|
|
|
header.AddChild("占比", new LocaleValue("占比", this.Context.UserLocale.LCID), SqlStorageType.Sqlvarchar);
|
2025-04-15 11:11:33 +08:00
|
|
|
|
header.AddChild("变化", new LocaleValue("变化", this.Context.UserLocale.LCID), SqlStorageType.SqlDecimal);
|
2025-03-31 19:09:19 +08:00
|
|
|
|
foreach(var item in header.GetChilds())
|
|
|
|
|
{
|
|
|
|
|
item.Width = 200;
|
|
|
|
|
}
|
|
|
|
|
return header;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//创建临时表
|
|
|
|
|
public override void BuilderReportSqlAndTempTable(IRptParams filter, string tableName)
|
|
|
|
|
{
|
2025-04-02 11:11:13 +08:00
|
|
|
|
base.BuilderReportSqlAndTempTable (filter, tableName);
|
|
|
|
|
DynamicObject customFilter = filter.FilterParameter.CustomFilter;
|
2025-03-31 19:09:19 +08:00
|
|
|
|
|
2025-04-02 11:11:13 +08:00
|
|
|
|
//开始日期
|
|
|
|
|
string FStrartDate = (customFilter["F_SDate"] == null) ? string.Empty : Convert.ToDateTime(
|
|
|
|
|
customFilter["F_SDate"]).ToString("yyyy-MM-dd");
|
2025-03-31 19:09:19 +08:00
|
|
|
|
|
2025-04-02 11:11:13 +08:00
|
|
|
|
//结束日期
|
|
|
|
|
string FEndDate = (customFilter["F_EDate"] == null) ? string.Empty : Convert.ToDateTime(
|
|
|
|
|
customFilter["F_EDate"]).ToString("yyyy-MM-dd");
|
2025-03-31 19:09:19 +08:00
|
|
|
|
|
2025-04-02 11:11:13 +08:00
|
|
|
|
string sql = String.Format(@"/*dialect*/
|
2025-04-15 11:11:33 +08:00
|
|
|
|
EXEC YSQKGKSBU_GZTH '{0}','{1}'
|
2025-04-02 11:11:13 +08:00
|
|
|
|
SELECT
|
|
|
|
|
ROW_NUMBER() OVER (ORDER BY SBU DESC) AS FID,
|
|
|
|
|
ROW_NUMBER() OVER (ORDER BY SBU DESC) AS FIDENTITYID,
|
|
|
|
|
* INTO {2} FROM YSQKGK_SBU_GZTH
|
|
|
|
|
", FStrartDate,FEndDate,tableName);
|
2025-03-31 19:09:19 +08:00
|
|
|
|
//执行SQL并动态创建报表
|
|
|
|
|
DBUtils.ExecuteDynamicObject(this.Context, sql);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//添加合计列
|
|
|
|
|
public override List<SummaryField> GetSummaryColumnInfo(IRptParams filter)
|
|
|
|
|
{
|
|
|
|
|
var result = base.GetSummaryColumnInfo(filter);
|
2025-04-02 11:11:13 +08:00
|
|
|
|
result.Add(new SummaryField("年初到期应收款额", Kingdee.BOS.Core.Enums.BOSEnums.Enu_SummaryType.SUM));
|
|
|
|
|
result.Add(new SummaryField("其中_年初应收款专责小组", Kingdee.BOS.Core.Enums.BOSEnums.Enu_SummaryType.SUM));
|
|
|
|
|
result.Add(new SummaryField("本年到期应收款额", Kingdee.BOS.Core.Enums.BOSEnums.Enu_SummaryType.SUM));
|
2025-04-15 11:11:33 +08:00
|
|
|
|
result.Add(new SummaryField("其中_本年应收款专责小组", Kingdee.BOS.Core.Enums.BOSEnums.Enu_SummaryType.SUM));
|
2025-04-02 11:11:13 +08:00
|
|
|
|
result.Add(new SummaryField("变化", Kingdee.BOS.Core.Enums.BOSEnums.Enu_SummaryType.SUM));
|
2025-03-31 19:09:19 +08:00
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|