李狗蛋 470016f428 1
2025-06-03 13:44:45 +08:00

131 lines
6.6 KiB
C#
Raw Permalink 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.Core.Report;
using Kingdee.BOS;
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.Contracts.Report;
using Kingdee.BOS.Orm.DataEntity;
using Kingdee.BOS.App.Data;
using Kingdee.BOS.Core.Enums;
namespace GZ_LTHReportForms.ReporyDDWFH
{
[Description("【报表服务插件】订单为未发货明细表_TH"), HotUpdate]
public class DDWFHMX : SysReportBaseService
{
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;
}
//设置报表表单单据头
public override ReportHeader GetReportHeaders(IRptParams filter)
{
DynamicObject customFilter = filter.FilterParameter.CustomFilter;
base.GetReportHeaders(filter);
ReportHeader header = new ReportHeader();
header.AddChild("日期", new LocaleValue("日期"), SqlStorageType.SqlDatetime);
header.AddChild("制单人", new LocaleValue("制单人"), SqlStorageType.Sqlnvarchar);
header.AddChild("区域", new LocaleValue("区域"), SqlStorageType.Sqlnvarchar);
header.AddChild("业务员", new LocaleValue("业务员"), SqlStorageType.Sqlnvarchar);
header.AddChild("合同号", new LocaleValue("合同号"), SqlStorageType.Sqlnvarchar);
header.AddChild("客户", new LocaleValue("客户"), SqlStorageType.Sqlnvarchar);
header.AddChild("项目名", new LocaleValue("项目名"), SqlStorageType.Sqlnvarchar);
header.AddChild("物料编码", new LocaleValue("物料编码"), SqlStorageType.Sqlnvarchar);
header.AddChild("物料名称", new LocaleValue("物料名称"), SqlStorageType.Sqlnvarchar);
header.AddChild("规格型号", new LocaleValue("规格型号"), SqlStorageType.Sqlnvarchar);
header.AddChild("数量", new LocaleValue("数量"), SqlStorageType.SqlDecimal);
header.AddChild("含税单价", new LocaleValue("含税单价"), SqlStorageType.SqlDecimal);
header.AddChild("价税合计", new LocaleValue("价税合计"), SqlStorageType.SqlDecimal);
header.AddChild("已发货数量", new LocaleValue("已发货数量"), SqlStorageType.SqlDecimal);
header.AddChild("已发货金额", new LocaleValue("已发货金额"), SqlStorageType.SqlDecimal);
header.AddChild("未发货数量", new LocaleValue("未发货数量"), SqlStorageType.SqlDecimal);
header.AddChild("未发货金额", new LocaleValue("未发货金额"), SqlStorageType.SqlDecimal);
header.AddChild("合同类型", new LocaleValue("合同类型"), SqlStorageType.Sqlnvarchar);
header.AddChild("发货条件", new LocaleValue("发货条件"), SqlStorageType.Sqlnvarchar);
foreach (var item in header.GetChilds())
{
item.Width = 160;
}
return header;
}
//查询报表数据
public override void BuilderReportSqlAndTempTable(IRptParams filter, string tableName)
{
base.BuilderReportSqlAndTempTable(filter, tableName);
DynamicObject customFilter = filter.FilterParameter.CustomFilter;
//获取开始日期
string FstartDate = (customFilter["F_SDate"] == null) ? string.Empty : Convert.ToDateTime(
customFilter["F_SDate"]).ToString("yyyy-MM-dd");
//获取结束日期
string FEndDate = (customFilter["F_EDate"] == null) ? string.Empty : Convert.ToDateTime(
customFilter["F_EDate"]).ToString("yyyy-MM-dd");
var FZZ = customFilter["F_YWZZ"] as DynamicObject;
string FSaleOrgId = "";
if (FZZ != null)
{
FSaleOrgId = FZZ["Id"].ToString();
}
string sql = String.Format(@"/*dialect*/
EXEC GZTH_DDWFHMXB '{0}','{1}','{2}'
SELECT
ROW_NUMBER() OVER (ORDER BY [日期]) AS FIDENTITYID,
*
INTO {3}
FROM GZ_DDWFHMX_TH
WHERE [未发货数量] <> 0 AND [未发货数量] > 0
ORDER BY [日期]
", FstartDate, FEndDate, FSaleOrgId, tableName);
DBUtils.Execute(this.Context, sql);
}
//设置报表合计列
public override List<SummaryField> GetSummaryColumnInfo(IRptParams filter)
{
var result = base.GetSummaryColumnInfo(filter);
//result.Add(new SummaryField("数量", BOSEnums.Enu_SummaryType.SUM));
//result.Add(new SummaryField("含税单价", BOSEnums.Enu_SummaryType.SUM));
result.Add(new SummaryField("价税合计", BOSEnums.Enu_SummaryType.SUM));
result.Add(new SummaryField("已发货数量", BOSEnums.Enu_SummaryType.SUM));
result.Add(new SummaryField("已发货金额", BOSEnums.Enu_SummaryType.SUM));
result.Add(new SummaryField("未发货数量", BOSEnums.Enu_SummaryType.SUM));
result.Add(new SummaryField("未发货金额", BOSEnums.Enu_SummaryType.SUM));
return result;
}
}
}