在应收款汇总表上做的插件开发,前台报表显示是1401行,但导出来只有1395行,有6行就是不能显示。不知道是我写的SQL语句的问题,还是插件取数出来需要刷新?SQL语句在数据库里直接查询,可以全部显示1401行。
这是开发环境显示结果,显示是1401行,但实际显示出没有少了6行,这6行就是我在SQL语句union all 后面加上的。
下图就是SQL语句与查询结果
请哪位大咖指点一二。
插件代码如下:
public override void BuilderReportSqlAndTempTable(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 = "Select a.* into {0} from "
+ "(select t1.*,t2.remainallamount as F_PBBE_Amount from {1} t1 left join (select kh.FNUMBER,sum(t2.FREMAINOUTQTY*t3.FTAXPRICE) as remainallamount"
+ " from T_SAL_DELIVERYNOTICE t1 join T_SAL_DELIVERYNOTICEENTRY t2 on t1.FID = t2.FID and FMATERIALID not in ('163055','163056')"
+ " join T_SAL_DELIVERYNOTICEENTRY_F t3 on t2.FENTRYID = t3.FENTRYID and t2.FSRCBILLNO not like ' ' and t2.FREMAINOUTQTY <> 0"
+ " join T_BD_CUSTOMER kh on kh.FCUSTID = t1.FCUSTOMERID group by kh.FNUMBER )t2 on t1.fcontactunitnumber = t2.FNUMBER "
+ " union all"
+ " select t2.FNUMBER as fcontactunitnumber,t2.Fname as fcontactunitname,'人民币' as fcurrencyforname,'人民币' as fcurrencyname,fsettleorgname,finitamountfor,famountfor,fhadivamountfor,frealamountfor,foffamountfor,fleftamountfor,finitamount,famount,fhadivamount,frealamount,foffamount,fleftamount,famountdigitsfor,famountdigits,fcurrencyrecname,frefundamountfor,"
+ " fnotetype,'{1}' as fdetailtablename,fidentityid,t2.remainallamount as F_PBBE_Amount from {1} t1"
+ " right join (select kh.FNUMBER,kh1.FNAME,sum(t2.FREMAINOUTQTY * t3.FTAXPRICE) as remainallamount"
+ " from T_SAL_DELIVERYNOTICE t1"
+ " join T_SAL_DELIVERYNOTICEENTRY t2 on t1.FID = t2.FID and FMATERIALID not in ('163055','163056')"
+ " join T_SAL_DELIVERYNOTICEENTRY_F t3 on t2.FENTRYID = t3.FENTRYID and t2.FSRCBILLNO not like ' ' and t2.FREMAINOUTQTY <> 0"
+ " join T_BD_CUSTOMER kh on kh.FCUSTID = t1.FCUSTOMERID"
+ " join T_BD_CUSTOMER_L kh1 on kh1.FCUSTID = t1.FCUSTOMERID"
+ " group by kh.FNUMBER,kh1.FNAME )t2 on t1.fcontactunitnumber = t2.FNUMBER"
+ " where t1.fcontactunitnumber is null) a";
sb.AppendFormat(strSql, tableName, strTable);
DBUtils.Execute(this.Context, sb.ToString());
}
SQL查询结果.png(60.08KB)
推荐阅读