package com.changhong.epc.parsing.service.asset.formula; import com.changhong.epc.bean.form.Asset; import com.changhong.epc.bean.tenant.asset.FixedAsset; /** * 平均年限法 */ public class AvgYear implements Depreciation { @Override public FixedAsset count(Asset money) { FixedAsset acc = new FixedAsset(); //月折旧率 Double depreciationRate = (1-Double.parseDouble(money.getEstimateRate()) / 100) / Double.parseDouble(money.getEstimateTime()); acc.setDepreciationRate(toNoun(depreciationRate * 100)); //本期折旧额 Double money1 = money.getOriginalMoney() * (acc.getDepreciationRate()/100); acc.setCurrentDepreciation(toNoun(money1)); if(money1 < 0){ acc.setCurrentDepreciation(toNoun(money.getOriginalMoney() - money.getCumulativeDepreciation())); } //累计折旧 Double cumulativeDepreciation = money.getCumulativeDepreciation() + acc.getCurrentDepreciation(); acc.setCumulativeDepreciation(toNoun(cumulativeDepreciation)); //净值 Double moneya = money.getNetMoney() - acc.getCurrentDepreciation(); acc.setNetMoney(toNoun(moneya)); return acc; } }