[Description("应收明细:增加项目字段")]
[Kingdee.BOS.Util.HotUpdate]
public class ReceivablesDetail : ARDetailReportService
{
private string[] TempTableName;
//重写创建临时表方法
public override void BuilderReportSqlAndTempTable(IRptParams filter, string tableName)
{
//创建临时表用于保存自己的数据
IDBService dbservice = Kingdee.BOS.App.ServiceHelper.GetService<IDBService>();
TempTableName = dbservice.CreateTemporaryTableName(this.Context, 1);
string strTable = TempTableName[0];
//调用基类方法,获取初步的查询结果
base.BuilderReportSqlAndTempTable(filter, strTable);
//对初步的查询结果处理,然后回填到默认的存放查询结果到临时表
StringBuilder sb = new StringBuilder();
string strSql = @"/*dialect*/select t1.*,TSKPL.FNAME as F_ULRD_Project1
into {0} from {1} t1 left join t_AR_receivable TAR
ON t1.FID=TAR.FID
LEFT JOIN t_AR_receivableEntry TARE
ON TAR.FID=TARE.FID
LEFT JOIN T_AR_RECEIVEBILL SK_TAR
ON t1.FID=SK_TAR.FID
LEFT JOIN T_SAL_KF_PROJECTARCHIVES TSKP
ON TARE.F_ULRD_XM=TSKP.FID or SK_TAR.F_ULRD_BASE=TSKP.FID
LEFT JOIN T_SAL_KF_PROJECTARCHIVES_L TSKPL
ON TSKP.FID=TSKPL.FID";
sb.AppendFormat(strSql, tableName, strTable);
DBUtils.Execute(this.Context, sb.ToString());
}
public override void CloseReport()
{
//删除临时表
if (TempTableName == null || TempTableName.Length == 0)
{
return;
}
IDBService dbservice = Kingdee.BOS.App.ServiceHelper.GetService<IDBService>();
dbservice.DeleteTemporaryTableName(this.Context, TempTableName);
base.CloseReport();
}