diff --git a/htdocs/langs/en_US/loan.lang b/htdocs/langs/en_US/loan.lang index 4922c0fc0a1..056ce1d0b48 100644 --- a/htdocs/langs/en_US/loan.lang +++ b/htdocs/langs/en_US/loan.lang @@ -18,6 +18,18 @@ ErrorLoanCapital=Loan amount has to be numeric and greate ErrorLoanLength=Loan length has to be numeric and greater than zero. ErrorLoanInterest=Annual interest has to be numeric and greater than zero. # Calc +LoanCalc=Bank Loans Calculator +PurchaseFinanceInfo=Purchase & Financing Information +SalePriceOfAsset=Sale Price of Asset +PercentageDown=Percentage Down +LengthOfMortgage=Length of Mortgage +AnnualInterestRate=Annual Interest Rate +ExplainCalculations=Explain Calculations +ShowMeCalculationsAndAmortization=Show me the calculations and amortization +MortgagePaymentInformation=Mortgage Payment Information +DownPayment=Down Payment +AmountFinanced=Amount Financed +AmortizationMonthlyPaymentOverYears=Amortization For Monthly Payment: %s over %s years Totalsforyear=Totals for year MonthlyPayment=Monthly Payment LoanCalcDesc=This mortgage calculator can be used to figure out monthly payments of a home mortgage loan, based on the home's sale price, the term of the loan desired, buyer's down payment percentage, and the loan's interest rate.
This calculator factors in PMI (Private Mortgage Insurance) for loans where less than 20% is put as a down payment. Also taken into consideration are the town property taxes, and their effect on the total monthly mortgage payment.
diff --git a/htdocs/loan/calc.php b/htdocs/loan/calc.php index 0a5ee21923a..06b62231a67 100644 --- a/htdocs/loan/calc.php +++ b/htdocs/loan/calc.php @@ -56,13 +56,13 @@ if (isset($_REQUEST['form_complete'])) { $show_progress = (isset($_REQUEST['show_progress'])) ? $_REQUEST['show_progress'] : false; $form_complete = $_REQUEST['form_complete']; } - + // This function does the actual mortgage calculations // by plotting a PVIFA (Present Value Interest Factor of Annuity) // table... function get_interest_factor($year_term, $monthly_interest_rate) { global $base_rate; - + $factor = 0; $base_rate = 1 + $monthly_interest_rate; $denominator = $base_rate; @@ -71,7 +71,7 @@ function get_interest_factor($year_term, $monthly_interest_rate) { $denominator *= $base_rate; } return $factor; -} +} // If the form is complete, we'll start the math if ($form_complete) { @@ -109,18 +109,19 @@ if ($form_complete) { if (!$down_percent) { $down_percent = $default_down_percent; } if (!$show_progress) { $show_progress = $default_show_progress; } } - + if (! empty($errors)) { setEventMessages('', $errors, 'errors'); $form_complete = false; } - + /* * View */ llxHeader(); +print_fiche_titre($langs->trans("LoanCalc")); print $langs->trans('LoanCalcDesc'); print '
'; @@ -131,33 +132,33 @@ print ''; //print ''; //print ''; print ''; -print ''; +print ''; print ''; print ''; -print ''; +print ''; print '';print ''; print ''; -print ''; +print ''; print ''; print ''; print ''; -print ''; +print ''; print ''; print ''; print ''; -print ''; +print ''; print ''; print ''; print ''; -print ''; +print ''; if (! empty($show_progress)) { - print ''; + print ''; } else { - print ''; + print ''; } print ''; @@ -173,18 +174,18 @@ if ($form_complete && $monthly_payment) print '
'; print '
Purchase & Financing Information'.$langs->trans('PurchaseFinanceInfo').'
Sale Price of Home:'.$langs->trans('SalePriceOfAsset').': '.$langs->trans("Currency".$conf->currency).'
Percentage Down:'.$langs->trans('PercentageDown').':%
Length of Mortgage:'.$langs->trans('LengthOfMortgage').':years
Annual Interest Rate:'.$langs->trans('AnnualInterestRate').':%
Explain Calculations:'.$langs->trans('ExplainCalculations').':Show me the calculations and amortization'.$langs->trans('ShowMeCalculationsAndAmortization').'Show me the calculations and amortization'.$langs->trans('ShowMeCalculationsAndAmortization').'
'; print ''; - print ''; + print ''; print ''; print ''; - print ''; + print ''; print ''; print ''; print ''; - print ''; + print ''; print ''; print ''; print ''; - print ''; + print ''; print ''; print ''; @@ -203,7 +204,7 @@ if ($form_complete && $monthly_payment) print ''; print ''; print ''; - print ''; + print ''; print ''; print ''; @@ -243,7 +244,7 @@ if ($form_complete && $monthly_payment) print '
Mortgage Payment Information'.$langs->trans('MortgagePaymentInformation').'
Down Payment:'.$langs->trans('DownPayment').':' . number_format($down_payment, "2", ".", ",") . ' ' . $langs->trans("Currency".$conf->currency) . '
Amount Financed:'.$langs->trans('AmountFinanced').':' . number_format($financing_price, "2", ".", ",") . ' ' . $langs->trans("Currency".$conf->currency) . '
Monthly Payment:'.$langs->trans('MonthlyPayment').':' . number_format($monthly_payment, "2", ".", ",") . ' ' . $langs->trans("Currency".$conf->currency) . '
(Principal & Interest ONLY)
Monthly Payment:'.$langs->trans('MonthlyPayment').':' . number_format(($monthly_payment + $pmi_per_month), "2", ".", ",") . $langs->trans("Currency".$conf->currency) . '
'; print '(Principal & Interest, and PMI)
'; print '
'; -// This prints the calculation progress and +// This prints the calculation progress and // the instructions of HOW everything is figured // out if ($form_complete && $show_progress) { @@ -256,7 +257,7 @@ if ($form_complete && $show_progress) { print ''; echo 'The down payment = The price of the home multiplied by the percentage down divided by 100 (for 5% down becomes 5/100 or 0.05)

- ' . number_format($down_payment,"2",".",",") . ' ' . $langs->trans("Currency".$conf->currency) . ' = '.number_format($sale_price,"2",".",",") . ' ' . $langs->trans("Currency".$conf->currency) . ' X + ' . number_format($down_payment,"2",".",",") . ' ' . $langs->trans("Currency".$conf->currency) . ' = '.number_format($sale_price,"2",".",",") . ' ' . $langs->trans("Currency".$conf->currency) . ' X ('.$down_percent.' / 100)'; print ''; print ''; @@ -290,7 +291,6 @@ if ($form_complete && $show_progress) { print '' . $step++ . ''; print ''; print 'The montly payment is figured out using the following formula:
'; - print 'Monthly Payment = ' . number_format($financing_price, "2", "", "") . ' * '; print $langs->trans('MonthlyPayment').' = ' . number_format($financing_price, "2", "", "") . ' * '; print '(1 - ((1 + ' . number_format($monthly_interest_rate, "4", "", "") . ')'; print '-(' . $month_term . '))))'; @@ -313,7 +313,7 @@ if ($form_complete && $show_progress) { $denom = pow((1 + $monthly_interest_rate), $power); $monthly_payment = $principal * ($monthly_interest_rate / (1 - $denom)); - print "

Amortization For Monthly Payment: " . number_format($monthly_payment, "2", ".", ",") . " over " . $year_term . " years
\n"; + print '

'.$langs->trans('AmortizationMonthlyPaymentOverYears', number_format($monthly_payment, "2", ".", ","), $year_term)."
\n"; print ''; @@ -327,17 +327,17 @@ if ($form_complete && $show_progress) { print $legend; - // Loop through and get the current month's payments for - // the length of the loan + // Loop through and get the current month's payments for + // the length of the loan while ($current_month <= $month_term) - { + { $interest_paid = $principal * $monthly_interest_rate; $principal_paid = $monthly_payment - $interest_paid; $remaining_balance = $principal - $principal_paid; - + $this_year_interest_paid = $this_year_interest_paid + $interest_paid; $this_year_principal_paid = $this_year_principal_paid + $principal_paid; - + $var = !$var; print ""; print '';
' . $current_month . '