日期:2014-05-17 浏览次数:20433 次
select acc.yto_sapcode,yas.yto_accountName,yas.yto_account,
0 as qichu,0 as yingshou,0 as threeMonth,0 as sixMonth,0 as twelveMonth,0 as twoYear,0 as threeYear,0 as beforeThreeYear
into #table
from yto_accountsreceivable yas
left join Account acc on yas.yto_account=acc.AccountId
where yas.statecode=0 and acc.StateCode=0 and acc.yto_accounttype=1
group by yas.yto_accountName,yas.yto_account,acc.yto_sapcode
update #table set #table.qichu=fn.qichu,#table.yingshou=fn.yingshou,#table.threeMonth=fn.threeMonth
from dbo.Frensworkz_getCYJzhujichangXY_Report(#table.yto_account,@endDateUTC) as fn
update #table
set #table.qichu=fn.qichu,#table.yingshou=fn.yingshou,#table.threeMonth=fn.threeMonth
from #table cross apply
dbo.Frensworkz_getCYJzhujichangXY_Report(#table.yto_account,@endDateUTC) as fn