0 $P!{hiden}
union all
select max(i.departCoding) as coding,i.depart,sum(-(t.price * t.amount)) as totalprice from
ReturnGoodsRecord i,DisposableGoodsBatchStock bs,ReturnGoodsItem t left join TousseDefinition d on t.toussedefinition_id = d.id
where i.id = t.returngoodsrecord_id and t.diposableGoodBatchStock_id = bs.id $P!{returnGoodsQuery} group by i.depart
)temp group by temp.depart order by coding asc]]>