简单帐表插件开发示例分享
金蝶云社区-天冥异
天冥异
7人赞赏了该文章 4,137次浏览 未经作者许可,禁止转载编辑于2018年07月27日 11:18:11
  1. public class DemoSysReport : SysReportBaseService

  2. {

  3. public override void Initialize()

  4. {

  5. // 支持分组汇总

  6. this.ReportProperty.IsGroupSummary = true;

  7. //this.ReportProperty.BillKeyFieldName = "FID";

  8. this.ReportProperty.ReportName = new LocaleValue(Kingdee.BOS.Resource.ResManager.LoadKDString("销售分组汇总报表","002460030014686",Kingdee.BOS.Resource.SubSystemType.BOS), this.Context.UserLocale.LCID);

  9. //this.ReportProperty.GroupSummaryInfoData.DefaultGroupbyString = "fwname";

  10. this.ReportProperty.DecimalControlFieldList = new List<DecimalControlField>();

  11. // 标示famount用famount_decimal做精度格式化

  12. this.ReportProperty.DecimalControlFieldList.Add(new DecimalControlField() { ByDecimalControlFieldName = "famount", DecimalControlFieldName = "famount_decimal" });

  13. }


  14. public override void BuilderReportSqlAndTempTable(IRptParams filter, string tableName)

  15. {

  16. // 拼接sql

  17. string sSQL = @"select b.fname as fwname,c.fcustid,d.fname as fcname,a.* ,f.famount,3 as famount_decimal,f.fprice, {0} into {1} from T_SAL_ORDERENTRY a 

  18. left join T_BD_MATERIAL_L b on a.fmaterialid=b.fmaterialid and b.FLOCALEID=2052

  19. left join T_SAL_ORDER c on a.fid=c.fid

  20. left join T_BD_CUSTOMER_L d on c.fcustid=d.fcustid and d.FLOCALEID=2052 

  21. left join T_SAL_ORDERENTRY_F f on a.fentryid=f.fentryid";

  22. // 设置分页排序

  23. KSQL_SEQ = string.Format(KSQL_SEQ, "a.FID asc");

  24. sSQL = string.Format(sSQL, this.KSQL_SEQ, tableName);


  25. DBUtils.Execute(this.Context, sSQL);

  26. }


  27. public override ReportTitles GetReportTitles(IRptParams filter)

  28. {

  29. ReportTitles titles = new ReportTitles();

  30. // TODO:从filter中获取具体的固定过滤条件,设置到tilte中,用于报表条件展示

  31. //titles.AddTitle("FText", "55555");

  32. //titles.AddTitle("FLabel", "66666");

  33. return titles;

  34. }

  35. /// <summary>

  36. /// 设置汇总列信息

  37. /// </summary>

  38. /// <param name="filter"></param>

  39. /// <returns></returns>

  40. public override List<Core.Report.SummaryField> GetSummaryColumnInfo(IRptParams filter)

  41. {

  42. List<Core.Report.SummaryField> summarys = new List<Core.Report.SummaryField>();

  43. summarys.Add(new Core.Report.SummaryField("FQty", Core.Enums.BOSEnums.Enu_SummaryType.SUM));

  44. // 单价求平均

  45. summarys.Add(new Core.Report.SummaryField("fprice", Core.Enums.BOSEnums.Enu_SummaryType.AVERAGE));

  46. // 金额汇总

  47. summarys.Add(new Core.Report.SummaryField("famount", Core.Enums.BOSEnums.Enu_SummaryType.SUM));

  48. return summarys;

  49. }

  50. /// <summary>

  51. /// 构建动态列

  52. /// </summary>

  53. /// <param name="filter"></param>

  54. /// <returns></returns>

  55. public override ReportHeader GetReportHeaders(IRptParams filter)

  56. {

  57. // TODO:fentryid,fid,fbaseunitqty,fmaterialid,fbomid,fqty

  58. ReportHeader header = new ReportHeader();

  59. header.AddChild("fwname", new LocaleValue(Kingdee.BOS.Resource.ResManager.LoadKDString("物料","002460030014689",Kingdee.BOS.Resource.SubSystemType.BOS), this.Context.UserLocale.LCID));

  60. header.AddChild("fcustid", new LocaleValue(Kingdee.BOS.Resource.ResManager.LoadKDString("客户","002460030014692",Kingdee.BOS.Resource.SubSystemType.BOS), this.Context.UserLocale.LCID));

  61. header.AddChild("FQty", new LocaleValue(Kingdee.BOS.Resource.ResManager.LoadKDString("数量","002460030014695",Kingdee.BOS.Resource.SubSystemType.BOS), this.Context.UserLocale.LCID),SqlStorageType.SqlDecimal);

  62. header.AddChild("fprice", new LocaleValue(Kingdee.BOS.Resource.ResManager.LoadKDString("单价","002460030014698",Kingdee.BOS.Resource.SubSystemType.BOS), this.Context.UserLocale.LCID), SqlStorageType.SqlDecimal);

  63. header.AddChild("famount", new LocaleValue(Kingdee.BOS.Resource.ResManager.LoadKDString("金额","002460030014701",Kingdee.BOS.Resource.SubSystemType.BOS), this.Context.UserLocale.LCID), SqlStorageType.SqlDecimal);

  64. return header;

  65. }

  66. }

复制代码


注释:loadkdstring是k/3cloud的多语言函数,会根据后面的编号从资源文件中获取到相应的翻译语言。一般项目中,没有多语言的,可以参考如下代码: new LocaleValue("销售分组汇总报表", this.Context.UserLocale.LCID);

图标赞 7
7人点赞
还没有人点赞,快来当第一个点赞的人吧!
图标打赏
0人打赏
还没有人打赏,快来当第一个打赏的人吧!