李狗蛋 d3b0aea916 11
2025-03-19 18:36:07 +08:00

149 lines
7.3 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using Kingdee.BOS.App.Data;
using Kingdee.BOS;
using Kingdee.BOS.Contracts.Report;
using Kingdee.BOS.Core.Report;
using Kingdee.BOS.Util;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Kingdee.BOS.Orm.DataEntity;
using System.Data;
using Pilot.Report.Exploitation.PublicClass;
using Pilot.Report.Exploitation.Common;
namespace Pilot.Report.Exploitation.ResultsKanbanSummary
{
[Description("【列表插件】绩效看板汇总报表【报表】"), HotUpdate]
public class ResultsKanbanSumReport: SysReportBaseService
{
private string tableNameView = EnvironmentTEST.tableNameView_TEST;
/// <summary>
/// 初始化
/// </summary>
public override void Initialize()
{
base.Initialize();
this.ReportProperty.ReportName = new LocaleValue("绩效看板汇总", base.Context.UserLocale.LCID);
this.ReportProperty.IsUIDesignerColumns = false;
// 简单账表类型:普通、树形、分页
this.ReportProperty.ReportType = ReportType.REPORTTYPE_NORMAL;
this.IsCreateTempTableByPlugin = true;
//
this.IsCreateTempTableByPlugin = true;
//
this.ReportProperty.IsGroupSummary = true;
//
this.ReportProperty.SimpleAllCols = false;
// 单据主键两行FID相同则为同一单的两条分录单据编号可以不重复显示
this.ReportProperty.PrimaryKeyFieldName = "FID";
//
this.ReportProperty.IsDefaultOnlyDspSumAndDetailData = true;
// 设置精度控制
var list = new List<DecimalControlField>
{
new DecimalControlField("FDECIMALS", "OrigInvoiceAmount"),
new DecimalControlField("FDECIMALS", "ExchangeRate"),
new DecimalControlField("FDECIMALS", "InvoiceAmountTHB"),
new DecimalControlField("FDECIMALS", "MonthEndExRate"),
new DecimalControlField("FDECIMALS", "RevaluationAountInTHB"),
new DecimalControlField("FDECIMALS", "UnrealizedGainLoss"),
};
this.ReportProperty.DecimalControlFieldList = list;
}
/// <summary>
/// 报表列表头
/// </summary>
/// <param name="filter"></param>
/// <returns></returns>
public override ReportHeader GetReportHeaders(IRptParams filter)
{
DynamicObject customFilter = filter.FilterParameter.CustomFilter;
base.GetReportHeaders(filter);
ReportHeader header = new ReportHeader();
// 下单时间
string fDate = customFilter["F_Date"]?.ToString();
int year = Convert.ToInt32(fDate.Split('-')[0]);
//int year = 2011;
//header.AddChild("ID", new LocaleValue("序号"), SqlStorageType.Sqlvarchar);
header.AddChild("SBU", new LocaleValue("SBU"), SqlStorageType.Sqlvarchar);
header.AddChild("明细区域", new LocaleValue("明细区域"), SqlStorageType.Sqlvarchar);
header.AddChild("销售员", new LocaleValue("销售员"), SqlStorageType.Sqlvarchar);
header.AddChild("本年业绩目标_万元", new LocaleValue(""+year+"年业绩目标(万元)"), SqlStorageType.SqlDecimal);
header.AddChild("本年派诺业绩_万元", new LocaleValue(""+year+ "派诺业绩(万元)"), SqlStorageType.SqlDecimal);
header.AddChild("本年兴诺业绩_万元", new LocaleValue(""+year+ "兴诺业绩(万元)"), SqlStorageType.SqlDecimal);
header.AddChild("本年武汉派诺_万元", new LocaleValue(""+year+ "武汉派诺(万元)"), SqlStorageType.SqlDecimal);
header.AddChild("本年碳索业绩_万元", new LocaleValue(""+year+ "碳索业绩(万元)"), SqlStorageType.SqlDecimal);
header.AddChild("本年香港派诺业绩_万元", new LocaleValue(""+year+ "香港派诺业绩(万元)"), SqlStorageType.SqlDecimal);
header.AddChild("本年华夏云联业绩_万元", new LocaleValue(""+year+ "华夏云联业绩(万元)"), SqlStorageType.SqlDecimal);
header.AddChild("往年订单变更金额_万元", new LocaleValue("往年订单变更金额(万元)"), SqlStorageType.SqlDecimal);
header.AddChild("本年业绩合计_万元", new LocaleValue(""+year+ "合计业绩额(万元)"), SqlStorageType.SqlDecimal);
header.AddChild("达标率", new LocaleValue("达标率"), SqlStorageType.Sqlvarchar);
header.AddChild("去年合计业绩额_万元", new LocaleValue(""+(year-1)+ "合计业绩额(万元)"), SqlStorageType.SqlDecimal);
header.AddChild("同比增长率", new LocaleValue("同比增长率"), SqlStorageType.Sqlvarchar);
header.AddChild("本年回款目标_万元", new LocaleValue(""+year+"回款目标(万元)"), SqlStorageType.SqlDecimal);
header.AddChild("回款额_万元", new LocaleValue("回款额(万元)"), SqlStorageType.SqlDecimal);
header.AddChild("回款率", new LocaleValue("回款率"), SqlStorageType.Sqlvarchar);
header.AddChild("已发货应收款_万元", new LocaleValue("已发货应收款(万元)"), SqlStorageType.SqlDecimal);
header.AddChild("已到期应收款_万元", new LocaleValue("已到期应收款(万元)"), SqlStorageType.SqlDecimal);
foreach (var item in header.GetChilds())
{
item.Width = 160;
}
return header;
}
/// <summary>
/// 显示报表数据
/// </summary>
/// <param name="filter"></param>
/// <param name="tableName"></param>
public override void BuilderReportSqlAndTempTable(IRptParams filter, string tableName)
{
DynamicObject customFilter = filter.FilterParameter.CustomFilter;
// 销售员列表
var salesperson = (customFilter["F_Salesperson"] as DynamicObjectCollection)?.Select(n => (n["F_Salesperson"] as DynamicObject)["msterID"].ToString()).ToList();
// 销售员
var salespersonString = salesperson == null ? "" : string.Join(",", salesperson);
// 组织列表
var organizationList = (customFilter["FZuZhi"] as DynamicObjectCollection)?.Select(n => (n["FZuZhi"] as DynamicObject)["ID"].ToString()).ToList();
// 组织
var organization = organizationList == null ? "" : (string.Join(",", organizationList));
// 开始日期
string fStrartDate = customFilter["FSDate"]?.ToString();
// 结束日期
string fEndDate = customFilter["FEDate"]?.ToString();
base.BuilderReportSqlAndTempTable(filter, tableName);
string sql = string.Format("EXEC GZ_JXKBHZB_LTH '{0}','{1}' " +
"SELECT" +
"ROW_NUMBER() OVER (ORDER BY SBU DESC) AS FID," +
"ROW_NUMBER() OVER (ORDER BY SBU DESC) AS FIDENTITYID," +
" * INTO {2} FROM JXKBHZB", fStrartDate,fEndDate,tableName);
Loghelp.Log("BuilderReportSqlAndTempTable");
Loghelp.Log(sql);
DBUtils.Execute(this.Context, sql);
}
}
}