账表.常见问题.数值不显示千分位

栏目:云星空知识作者:金蝶来源:金蝶云社区发布:2024-09-23浏览:1

账表.常见问题.数值不显示千分位

【场景】数值不显示千分位 【原始代码和效果】 ```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....
点击下载文档
确认删除?
回到顶部
客服QQ
  • 客服QQ点击这里给我发消息