天天看點

财務預付注意

給供應商預付的時候不能隻看餘額,還應當看應收應付金額,所反應的真實餘額應當為ye+ysyfje

是以供應商裡真實餘額應當為

select c.rq,c.danwbh,c.dwmch,c.ye from

(select rq,danwbh,dwmch,ye from

(select a.ye+a.ysyfje as ye,a.dwbh,a.rq,a.djbh,b.dwmch,b.danwbh,row_number() over (PARTITION BY a.dwbh order by rq desc,plh desc) row from wlzhk a,mchk b where a.dwbh=b.dwbh and a.rq<=getdate() and fx='進') t

where row=1 

) c

order by c.danwbh

本文轉自 qvodnet 51CTO部落格,原文連結:http://blog.51cto.com/bks2015/1654941