declare getstoragecard cursor for
select to_char(needday,'yyyy-mm-dd'),sum(a.somany - a.storage - b.mademany)
from mrp_detial a,v_new_tj_all_mrpmany b
where a.mpsid=b.mpsid and
a.indexcode=b.mpsindex and
a.lifecode=6 and
a.needday>=sysdate and
a.soncode=:productid
group by to_char(needday,'yyyy-mm-dd')
ORDER BY to_char(needday,'yyyy-mm-dd');
open getstoragecard;
do while sqlca.sqlcode=0
fetch getstoragecarD into :sday,:manyin;
if sqlca.sqlcode=0 then
i=dw_card.insertrow(0)
dw_card.object.typein[i]='计划入库'
dw_card.object.dayin[i]=sday
dw_card.object.manyin[i]=manyin
else
exit
end if
loop
close getstoragecard;