销售订单执行明细表,添加自定义字段“项目”,报表不显示!
代码如下:
[Description("销售订单执行明细表--自定义")]
public class CustomReport_XSDDZXMX3 : Kingdee.K3.SCM.App.Sal.Report.SalDetailRpt
{
private string[] customRptTempTableNames;
public override void BuilderReportSqlAndTempTable(Kingdee.BOS.Core.Report.IRptParams filter, string tableName)
{
//创建临时表,用于存放自己的数据
IDBService dbservice = Kingdee.BOS.App.ServiceHelper.GetService
customRptTempTableNames = dbservice.CreateTemporaryTableName(this.Context, 1);
string strTable = customRptTempTableNames[0];
//调用基类的方法,获取初步的查询结果到临时表
base.BuilderReportSqlAndTempTable(filter, strTable);
//对初步的查询结果进行处理,然后写回基类默认的存放查询结果的临时表
StringBuilder sb = new StringBuilder();
string strSql = "/*dialect*/select t1.*,t2.f_dnk_project into {0} from {1} t1 inner join T_SAL_ORDER t2 on t1.FOrderID=t2.FID";
sb.AppendFormat(strSql, tableName, strTable);
DBUtils.Execute(this.Context, sb.ToString());
}
public override void CloseReport()
{
//删除临时表
if (customRptTempTableNames.IsNullOrEmptyOrWhiteSpace())
{
return;
}
IDBService dbService = Kingdee.BOS.App.ServiceHelper.GetService
dbService.DeleteTemporaryTableName(this.Context, customRptTempTableNames);
base.CloseReport();
}
public override ReportHeader GetReportHeaders(IRptParams filter)
{
// TODO:
ReportHeader header = base.GetReportHeaders(filter);
header.AddChild("F_dnk_Project", new LocaleValue("项目名称", this.Context.UserLocale.LCID));
return header;
}
}
推荐阅读