账表.常见问题.数值不显示千分位
【场景】数值不显示千分位
【原始代码和效果】
```csharp
using Kingdee.BOS.App.Data;
using Kingdee.BOS.Contracts.Report;
using Kingdee.BOS.Core.Report;
using System.Collections.Generic;
using System.Text;
namespace DynamicFormPlugIn.Report
{
[Kingdee.BOS.Util.HotUpdate]
[System.ComponentModel.Description("简单报表案例")]
public class ReportServicePlugIn_Decimal : SysReportBaseService
{
public override void Initialize()
{
}
public override ReportHeader GetReportHeaders(IRptParams filter)
{
ReportHeader rptHeader = new ReportHeader();
rptHeader.AddChild("FQty", new Kingdee.BOS.LocaleValue("数量"), Kingdee.BOS.SqlStorageType.SqlDecimal);
return rptHeader;
}
public override void BuilderReportSqlAndTempTable(IRptParams filter, string tableName)
{
StringBuilder stringBuilder = new StringBuilder();
KSQL_SEQ = string.Format(KSQL_SEQ, "FID");
stringBuilder.AppendFormat("select top 10 FID, FQty, {0} into {1} from t_pur_poorderentry", KSQL_SEQ, tableName);
DBUtils.Execute(this.Context, stringBuilder.ToString());
}
}
}
```
![image.webp](/download/0100ded11137747a45918c69c70a67e2cc76.webp)
【原理】
当没有定义精度控制时,或精度为0时,不会显示千分位
【修改方案】
![image.webp](/download/01000259de313bd848e2a29a89dc86630f6a.webp)
```csharp
using Kingdee.BOS.App.Data;
using Kingdee.BOS.Contracts.Report;
using Kingdee.BOS.Core.Report;
using System.Collections.Generic;
using System.Text;
namespace DynamicFormPlugIn.Report
{
[Kingdee.BOS.Util.HotUpdate]
[System.ComponentModel.Description("简单报表案例")]
public class ReportServicePlugIn_Decimal : SysReportBaseService
{
public override void Initialize()
{
var decimalFieldList = new List<DecimalControlField>();
var decimalField = new DecimalControlField()
{
ByDecimalControlFieldName = "FQty",
DecimalControlFieldName = "FPrecision"
};
decimalFieldList.Add(decimalField);
this.ReportProperty.DecimalControlFieldList = decimalFieldList;
}
public override ReportHeader GetReportHeaders(IRptParams filter)
{
ReportHeader rptHeader = new ReportHeader();
rptHeader.AddChild("FQty", new Kingdee.BOS.LocaleValue("数量"), Kingdee.BOS.SqlStorageType.SqlDecimal);
return rptHeader;
}
public override void BuilderReportSqlAndTempTable(IRptParams filter, string tableName)
{
StringBuilder stringBuilder = new StringBuilder();
KSQL_SEQ = string.Format(KSQL_SEQ, "FID");
//stringBuilder.AppendFormat("select top 10 FID, FQty, {0} into {1} from t_pur_poorderentry", KSQL_SEQ, tableName);
//增加精度
stringBuilder.AppendFormat("select top 10 FID, FQty, 1 as FPrecision, {0} into {1} from t_pur_poorderentry", KSQL_SEQ, tableName);
DBUtils.Execute(this.Context, stringBuilder.ToString());
}
}
}
```
![image.webp](/download/0100cf3cafe2299f4ca99b1fc3662e15dd3d.webp)
账表.常见问题.数值不显示千分位
【场景】数值不显示千分位【原始代码和效果】```csharpusing Kingdee.BOS.App.Data;using Kingdee.BOS.Contracts.Report;using Kingdee....
点击下载文档
本文2024-09-23 04:17:21发表“云星空知识”栏目。
本文链接:https://wenku.my7c.com/article/kingdee-k3cloud-164344.html
您需要登录后才可以发表评论, 登录登录 或者 注册
最新文档
热门文章