简单帐表插件开发示例分享

public class DemoSysReport : SysReportBaseService
{
public override void Initialize()
{
// 支持分组汇总
this.ReportProperty.IsGroupSummary = true;
//this.ReportProperty.BillKeyFieldName = "FID";
this.ReportProperty.ReportName = new LocaleValue(Kingdee.BOS.Resource.ResManager.LoadKDString("销售分组汇总报表","002460030014686",Kingdee.BOS.Resource.SubSystemType.BOS), this.Context.UserLocale.LCID);
//this.ReportProperty.GroupSummaryInfoData.DefaultGroupbyString = "fwname";
this.ReportProperty.DecimalControlFieldList = new List<DecimalControlField>();
// 标示famount用famount_decimal做精度格式化
this.ReportProperty.DecimalControlFieldList.Add(new DecimalControlField() { ByDecimalControlFieldName = "famount", DecimalControlFieldName = "famount_decimal" });
}

public override void BuilderReportSqlAndTempTable(IRptParams filter, string tableName)
{
// 拼接sql
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 
left join T_BD_MATERIAL_L b on a.fmaterialid=b.fmaterialid and b.FLOCALEID=2052
left join T_SAL_ORDER c on a.fid=c.fid
left join T_BD_CUSTOMER_L d on c.fcustid=d.fcustid and d.FLOCALEID=2052 
left join T_SAL_ORDERENTRY_F f on a.fentryid=f.fentryid";
// 设置分页排序
KSQL_SEQ = string.Format(KSQL_SEQ, "a.FID asc");
sSQL = string.Format(sSQL, this.KSQL_SEQ, tableName);

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

public override ReportTitles GetReportTitles(IRptParams filter)
{
ReportTitles titles = new ReportTitles();
// TODO:从filter中获取具体的固定过滤条件,设置到tilte中,用于报表条件展示
//titles.AddTitle("FText", "55555");
//titles.AddTitle("FLabel", "66666");
return titles;
}
/// <summary>
/// 设置汇总列信息
/// </summary>
/// <param name="filter"></param>
/// <returns></returns>
public override List<Core.Report.SummaryField> GetSummaryColumnInfo(IRptParams filter)
{
List<Core.Report.SummaryField> summarys = new List<Core.Report.SummaryField>();
summarys.Add(new Core.Report.SummaryField("FQty", Core.Enums.BOSEnums.Enu_SummaryType.SUM));
// 单价求平均
summarys.Add(new Core.Report.SummaryField("fprice", Core.Enums.BOSEnums.Enu_SummaryType.AVERAGE));
// 金额汇总
summarys.Add(new Core.Report.SummaryField("famount", Core.Enums.BOSEnums.Enu_SummaryType.SUM));
return summarys;
}
/// <summary>
/// 构建动态列
/// </summary>
/// <param name="filter"></param>
/// <returns></returns>
public override ReportHeader GetReportHeaders(IRptParams filter)
{
// TODO:fentryid,fid,fbaseunitqty,fmaterialid,fbomid,fqty
ReportHeader header = new ReportHeader();
header.AddChild("fwname", new LocaleValue(Kingdee.BOS.Resource.ResManager.LoadKDString("物料","002460030014689",Kingdee.BOS.Resource.SubSystemType.BOS), this.Context.UserLocale.LCID)); 
header.AddChild("fcustid", new LocaleValue(Kingdee.BOS.Resource.ResManager.LoadKDString("客户","002460030014692",Kingdee.BOS.Resource.SubSystemType.BOS), this.Context.UserLocale.LCID));
header.AddChild("FQty", new LocaleValue(Kingdee.BOS.Resource.ResManager.LoadKDString("数量","002460030014695",Kingdee.BOS.Resource.SubSystemType.BOS), this.Context.UserLocale.LCID),SqlStorageType.SqlDecimal);
header.AddChild("fprice", new LocaleValue(Kingdee.BOS.Resource.ResManager.LoadKDString("单价","002460030014698",Kingdee.BOS.Resource.SubSystemType.BOS), this.Context.UserLocale.LCID), SqlStorageType.SqlDecimal);
header.AddChild("famount", new LocaleValue(Kingdee.BOS.Resource.ResManager.LoadKDString("金额","002460030014701",Kingdee.BOS.Resource.SubSystemType.BOS), this.Context.UserLocale.LCID), SqlStorageType.SqlDecimal);
return header;
}
}

posted @ 2014-08-27 11:24  范永强  阅读(674)  评论(0编辑  收藏  举报