create or replace view v_SpendIncomeRatio
as
select col.collegesId,
sum(inc.tuitionCount)+sum(inc.subsidyCount)+sum(inc.sepcialFunCount)+inc.otherIncomeAmount+sum(inc.donatedValue)+sum(soc.donatedValue) as totalIncome,
----总收入
tuitionCount/totalIncome as tuitionSumPerTi,----学费收入所占比例
subsidyCount/totalIncome as subsidyCountPerTi,----财政性补助所占比例
sepcialFunCount/totalIncome as sepcialFunCountPerTi,---中央投入所占比例
donatedAmount/totalIncome as donatedAmountPerTi,---社会捐赠额所占比例
otherIncomeAmount/totalIncome as otherIncomeAmountPerTi,---其他收入所占比例
spe.landAcquisitionAmount+spe.infrastructure+spe.equipment+spe.practiseConsumable+spe.practiseSpecialAmount+spe.paymentOfPtStaff+spe.sportsFacilitiesMaitenance
+spe.otherDailyExpenses+spe.reformResearchSum+spe.TchDevelopmentCount+paymentOflibraryBook+spe.otherSpending as spendCount,
(landAcquisitionAmount+infrastructure)/spendCount as landAcquisitionAmountPerSc,
equipment/spendCount as researchEquipmentPerSc,
(practiseConsumable+practiseSpecialAmount+paymentOfPtStaff+sportsFacilitiesMaitenance+otherDailyExpenses
)/spendCount as DailyEducationFundsCountPerSc,
-----日常教学经费
reformResearchSum/spendCount as reformResearchSumPerSc,
TchDevelopmentCount/spendCount as TchDevelopmentCountPerSc,
paymentOflibraryBook/spendCount as paymentOflibraryBookPerSc,
otherSpending/spendCount as otherSpendingPerSc,
from Colleges col,SocialContribution soc,IncomeChart inc,Spend spe