【插件】简单账表模板
[Description("xxxx简单账表")] [HotUpdate] public class xxxxxxRpt : SysReportBaseService { private DateTime beginDate; private DateTime endDate; private DynamicObjectCollection supplies; public override void Initialize() { base.Initialize(); //设置字段精度 string deciamlControlFieldQty = "FQTYDeciaml"; List<DecimalControlField> list=new List<DecimalControlField>(); list.Add(new DecimalControlField(deciamlControlFieldQty, "purPro")); list.Add(new DecimalControlField(deciamlControlFieldQty, "inStockPro")); list.Add(new DecimalControlField(deciamlControlFieldQty, "supplyToOrder")); base.ReportProperty.DecimalControlFieldList = list; } //报表头 public override ReportTitles GetReportTitles(IRptParams filter) { ReportTitles titles = new ReportTitles(); titles.AddTitle("F_xxxx_BeginDate", beginDate.ToString("yyyy-MM-dd")); titles.AddTitle("F_xxxx_EndDate", endDate.ToString("yyyy-MM-dd")); return titles; } //自定义报表列 public override ReportHeader GetReportHeaders(IRptParams filter) { ReportHeader header = new ReportHeader(); var FNUMBER = header.AddChild("FNUMBER", new Kingdee.BOS.LocaleValue("供应商编码"), Kingdee.BOS.SqlStorageType.Sqlvarchar); FNUMBER.ColIndex = 0; var FNAME = header.AddChild("FNAME", new Kingdee.BOS.LocaleValue("供应商名称"), Kingdee.BOS.SqlStorageType.Sqlvarchar); FNAME.ColIndex = 1; var purOrder = header.AddChild("purOrder", new Kingdee.BOS.LocaleValue("订单金额"), Kingdee.BOS.SqlStorageType.SqlDecimal); purOrder.ColIndex = 2; var purPro = header.AddChild("purPro", new Kingdee.BOS.LocaleValue("占订货总额(%)"), Kingdee.BOS.SqlStorageType.SqlDecimal); purPro.ColIndex = 3; var inStock = header.AddChild("inStock", new Kingdee.BOS.LocaleValue("供货金额"), Kingdee.BOS.SqlStorageType.SqlDecimal); inStock.ColIndex = 4; var inStockPro = header.AddChild("inStockPro", new Kingdee.BOS.LocaleValue("占供货总额(%)"), Kingdee.BOS.SqlStorageType.SqlDecimal); inStockPro.ColIndex = 5; var supplyToOrder = header.AddChild("supplyToOrder", new Kingdee.BOS.LocaleValue("供货占订货(%)"), Kingdee.BOS.SqlStorageType.SqlDecimal); supplyToOrder.ColIndex = 6; var ABC = header.AddChild("ABC", new Kingdee.BOS.LocaleValue("ABC分类"), Kingdee.BOS.SqlStorageType.Sqlvarchar); ABC.ColIndex = 7; var remarks = header.AddChild("remarks", new Kingdee.BOS.LocaleValue("备注"), Kingdee.BOS.SqlStorageType.Sqlvarchar); remarks.ColIndex = 8; return header; } public override void BuilderReportSqlAndTempTable(IRptParams filter, string tableName) { base.BuilderReportSqlAndTempTable(filter, tableName); //获取自定义过滤框的条件 this.SetFilter(filter); string sql = string.Format(@"select ROW_NUMBER() over (order by FNAME) FIDENTITYID, FNAME,FNUMBER,purOrder ,purOrder/purOrderAll*100 purPro ,inStock ,inStock/inStockAll*100 inStockPro , supplyToOrder ,2 FQTYDeciaml --字段精度 。。。。。 )t"); sql = string.Format(@"/*dialect*/SELECT T.* INTO {0} FROM ({1}) T WHERE 1=1 ", tableName, sql); DBUtils.Execute(this.Context, sql); } public override List<SummaryField> GetSummaryColumnInfo(IRptParams filter) { var result = base.GetSummaryColumnInfo(filter); result.Add(new SummaryField("purOrder", Kingdee.BOS.Core.Enums.BOSEnums.Enu_SummaryType.SUM)); result.Add(new SummaryField("inStock", Kingdee.BOS.Core.Enums.BOSEnums.Enu_SummaryType.SUM)); return result; } private void SetFilter(IRptParams filter) { //获取自定义过滤对象 DynamicObject customFilter = filter.FilterParameter.CustomFilter; this.beginDate = Convert.ToDateTime(customFilter["F_xxx_BeginDate"]); this.endDate = Convert.ToDateTime(customFilter["F_xxx_EndDate"]); } }
关于控制报表字段的精度几种方法
1.BOS配置
2.插件代码干预
string deciamlControlFieldQty = "FQTYDeciaml"; List<DecimalControlField> list=new List<DecimalControlField>(); list.Add(new DecimalControlField(deciamlControlFieldQty, "purPro")); base.ReportProperty.DecimalControlFieldList = list;
select ROW_NUMBER() over (order by FNAME) FIDENTITYID, FNAME,FNUMBER,purOrder ....... ,2 FQTYDeciaml
3.SQL控制
CONVERT(DECIMAL(13,2), filed) 别名
【插件】简单账表模板
[Description("xxxx简单账表")] [HotUpdate] public class xxxxxxRpt : SysReportBaseService { private DateTime beg...
点击下载文档
上一篇:项目分享-对接一个很坑的WMS系统下一篇:运用Python调用API接口
本文2024-09-16 17:16:52发表“云星空知识”栏目。
本文链接:https://wenku.my7c.com/article/kingdee-k3cloud-14690.html
您需要登录后才可以发表评论, 登录登录 或者 注册
最新文档
热门文章