QuickReport作合计
对于动过函数获得的数据,作合计,为什么不能正常显示呢?
下面的是sql语句.其中在QuickReport合计Sum(planqty), Sum(planamt) 都能显示,而
completeqty, completeamt, notcompleteqty, notcompleteamt 都是通过函数的到,
放在QRExpr组件上不显示正确结果,始终显示0,是不是,QRExpr组件不支持通过函数获得的数据呢?
select pp.goodsid as id, lg.code as GoodsCode,
lg.name as GoodsName, lg.specs as GoodsSpecs,
lu.unitname as UnitName,
sum(pp.quantity) as planqty, sum(pp.amount) as planamt,
sum(dbo.getreferqty_base(1,m.billid,pp.goodsid,pp.unitid)) as completeqty,
sum(round(dbo.getreferqty_base(1,m.billid,pp.goodsid,pp.unitid)*pp.price,2)) as completeamt,
sum(pp.quantity-dbo.getreferqty_base(1,m.billid,pp.goodsid,pp.unitid)) as notcompleteqty,
sum(pp.amount-round(dbo.getreferqty_base(1,m.billid,pp.goodsid,pp.unitid)*pp.price,2)) as notcompleteamt,
sum(round(dbo.getreferqty_base(1,m.billid,pp.goodsid,pp.unitid)*pp.price,2)) / sum(pp.amount) as completerate
from p_purchaseplan m
left join p_purchaseplandetail pp on m.billid = pp.billid
left join l_department dep on m.departmentid = dep.departmentid
left outer join l_goodsunit lu on pp.unitid = lu.unitid
left outer join l_goods lg on pp.goodsid = lg.goodsid
left outer join l_goodstype lt on lg.gdtypeid = lt.gdtypeid
where m.billid >= 0 and m.billstate = 1 and m.billkind = 2
and m.plantype = 1 and billdate between '2006-1-1' and '2006-12-31'
group by pp.goodsid, lg.code, lg.name, lg.specs, lu.unitname
order by lg.code