解决方案: |
CREATE TABLE #YXKP(sCardID varchar(20))
EXEC fa_Q_INSERT_YXKP '2004-10-31'
update fa_DeprTransactions set
fa_DeprTransactions.ldeprMonths9=(year('2004-10-31')- year(fa_Cards.dStartdate))*12 + (month('2004-10-31')- month(fa_Cards.dStartdate))-1,
fa_DeprTransactions.lusedMonths9=(year('2004-10-31')- year(fa_Cards.dStartdate))*12 + (month('2004-10-31')- month(fa_Cards.dStartdate))-1,
fa_DeprTransactions.ldeprMonths10=(year('2004-10-31')- year(fa_Cards.dStartdate))*12 + (month('2004-10-31')- month(fa_Cards.dStartdate))-1,
fa_DeprTransactions.lusedMonths10=(year('2004-10-31')- year(fa_Cards.dStartdate))*12 + (month('2004-10-31')- month(fa_Cards.dStartdate))-1
FROM (#YXKP INNER JOIN fa_Cards ON fa_Cards.sCardID = #YXKP.sCardID) INNER JOIN fa_DeprTransactions ON fa_Cards.sCardNum = fa_DeprTransactions.sCardNum
WHERE (fa_Cards.dDisposeDate) Is Null
drop table #yxkp
因为提前记提完折旧的卡片每月都有发生,累计折旧不能通过脚本修改,只能手工作变动单。
|