/** * Calculates Contribution from Adjusted Available Income (AAI) * @param EfcCalculationRole $role Role of the subject within the calculation * @param float $adjustedAvailableIncome Adjusted Available Income * @return float */ public function CalculateContributionFromAai($role, $adjustedAvailableIncome) { if ($role == EfcCalculationRole::DependentStudent || $role == EfcCalculationRole::IndependentStudentWithoutDependents) { return EfcMathHelper::roundPositive($adjustedAvailableIncome); } $aaiContributionRanges = $this->_constants->aaiContributionRanges; $aaiContributionPercents = $this->_constants->aaiContributionPercents; $aaiContributionBases = $this->_constants->aaiContributionBases; if ($adjustedAvailableIncome < $aaiContributionRanges[0]) { return 0; } $baseRange = 0; $maxIndex = count($aaiContributionRanges) - 1; // Loop through AAIContributionRanges until adjustedAvailableIncome param is within range foreach ($aaiContributionRanges as $index => $range) { // If at end of ranges, set baseAmount to maximum range if ($index == $maxIndex) { $baseRange = $aaiContributionRanges[$index]; break; } // If adjustedAvailableIncome is within range if ($adjustedAvailableIncome < $aaiContributionRanges[$index + 1]) { // If adjustedAvailableIncome is within first range, there is no baseAmount; // otherwise, assign standard baseAmount $baseRange = $index == 0 ? 0 : $range; break; } } // Contribution From AAI = // (Base Amount for Range) // + (((Adjusted Available Income) - (Lowest Value of Range)) * (Percent for Range)) $contributionFromAai = $aaiContributionBases[$index] + ($adjustedAvailableIncome - $baseRange) * ($aaiContributionPercents[$index] * 0.01); return EfcMathHelper::roundPositive($contributionFromAai); }
/** * Calculates Employmement Expense Allowance * @param EfcCalculationRole $role Subject's role within the calculation * @param MaritalStatus $maritalStatus Marital status * @param HouseholdMember[] $employablePersons People capable of employment. Exact definition varies depending on role. If the role is "Parent" * for example, this refers to the parents. If the role is "IndependentStudent", this refers to the student and spouse * @return float */ public function calculateEmploymentExpenseAllowance($role, $maritalStatus, $employablePersons) { if ($employablePersons == null || count($employablePersons) == 0 || $role == EfcCalculationRole::DependentStudent || $role == EfcCalculationRole::IndependentStudentWithoutDependents && $maritalStatus == MaritalStatus::SingleSeparatedDivorced) { return 0; } // Determine if all employable persons are earning money foreach ($employablePersons as $person) { if (!$person->isWorking) { // Not all of the employable persons are working return 0; } } // Determine the lowest income $lowestIncomePerson = $employablePersons[0]; $lowestIncome = $lowestIncomePerson->workIncome; foreach ($employablePersons as $person) { if ($person->workIncome < $lowestIncome) { $lowestIncome = $person->workIncome; } } $employmentExpensePercent = $this->_constants->employmentExpensePercent; $employmentExpenseMaximum = $this->_constants->employmentExpenseMaximum; // Use the lowest of the incomes for the calculation $adjustedLowestIncome = $lowestIncome * $employmentExpensePercent; $employmentExpenseAllowance = $adjustedLowestIncome > $employmentExpenseMaximum ? $employmentExpenseMaximum : $adjustedLowestIncome; return EfcMathHelper::roundPositive($employmentExpenseAllowance); }
/** * Calculates Contributions from Additional Financial Information * @param float $additionalFinancialInfo Total additional financial infomation * @return float */ public function calculateAdditionalFinancialInformation($additionalFinancialInfo) { return EfcMathHelper::roundPositive($additionalFinancialInfo); }
/** * Calculates the Adjusted Net Worth of Business/Farm contribution * @param EfcCalculationRole $role Subject's role within the calculation * @param float $businessFarmNetWorth Net worth of business and/or investment farm * @return float */ public function calculateAdjustedBusinessFarmNetWorthContribution($role, $businessFarmNetWorth) { if ($role == EfcCalculationRole::DependentStudent) { return EfcMathHelper::roundPositive($businessFarmNetWorth); } $businessFarmNetWorthAdjustmentRanges = $this->_constants->businessFarmNetWorthAdjustmentRanges; $businessFarmNetWorthAdjustmentBases = $this->_constants->businessFarmNetWorthAdjustmentBases; $businessFarmNetWorthAdjustmentPercents = $this->_constants->businessFarmNetWorthAdjustmentPercents; $baseRange = 0; $maxIndex = count($businessFarmNetWorthAdjustmentRanges) - 1; // Loop through $businessFarmNetWorthAdjustmentContributionRanges until $businessFarmNetWorth // param is within range foreach ($businessFarmNetWorthAdjustmentRanges as $index => $range) { // If at end of ranges, set baseAmount to maximum range if ($index == $maxIndex) { $baseRange = $businessFarmNetWorthAdjustmentRanges[$index]; break; } // If businessFarmNetWorth is within range if ($businessFarmNetWorth < $businessFarmNetWorthAdjustmentRanges[$index + 1]) { // If $businessFarmNetWorth is within first range, there is no baseAmount // Otherwise, assign standard baseAmount $baseRange = $index == 0 ? 0 : $range; break; } } // Contribution From AAI = // (Base Amount for Range) // + (((Business Farm Net Worth) - (Lowest Value of Range)) * (Percent for Range)) $adjustedBusinessFarmNetWorth = $businessFarmNetWorthAdjustmentBases[$index] + ($businessFarmNetWorth - $baseRange) * ($businessFarmNetWorthAdjustmentPercents[$index] * 0.01); return EfcMathHelper::roundPositive($adjustedBusinessFarmNetWorth); }