76 lines
2.6 KiB
C#
Raw Normal View History

2025-03-14 10:00:24 +08:00
using Kingdee.BOS.Core.Metadata;
using Kingdee.BOS.Core.Report.PlugIn;
using Kingdee.BOS.Core.Report.PlugIn.Args;
using Kingdee.BOS.Util;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Pilot.Report.Exploitation.AnnualSalesPaymentSum
{
[Description("【报表表单插件】年度销售额-回款额汇总插件"), HotUpdate]
public class SumResultsReportServicePlugIn: AbstractSysReportPlugIn
{
public override void FormatCellValue(FormatCellValueArgs args)
{
// 格式化日期
base.FormatCellValue(args);
if (args.Header.ColType == Kingdee.BOS.SqlStorageType.SqlDatetime)
{
DateTime value = Convert.ToDateTime(args.FormateValue);
string afterValue = value.ToString("yyyy-MM-dd");
args.FormateValue = afterValue;
}
// 格式化金额 汇率不格式化
if (args.Header.ColType == Kingdee.BOS.SqlStorageType.SqlDecimal)
{
decimal value = decimal.Parse(args.FormateValue);
// 千分位
string afterValue = value.ToString("N");
args.FormateValue = afterValue;
}
}
public override void OnFormatRowConditions(ReportFormatConditionArgs args)
{
base.OnFormatRowConditions(args);
//行背景色
if (Convert.ToInt32(args.DataRow["Sort"]) == 1)
{
FormatCondition FRow_FC = new FormatCondition()
{
BackColor = "#CC99FF",
};
args.FormatConditions.Add(FRow_FC);
}
if (Convert.ToInt32(args.DataRow["Sort"]) == 2)
{
FormatCondition FRow_FC = new FormatCondition()
{
BackColor = "#B4C6E7",
};
args.FormatConditions.Add(FRow_FC);
}
if (Convert.ToInt32(args.DataRow["Sort"]) == 3)
{
FormatCondition FRow_FC = new FormatCondition()
{
BackColor = "#C6E0B4",
};
args.FormatConditions.Add(FRow_FC);
}
if (Convert.ToInt32(args.DataRow["Sort"]) == 4)
{
FormatCondition FRow_FC = new FormatCondition()
{
BackColor = "#33CCCC",
};
args.FormatConditions.Add(FRow_FC);
}
}
}
}