Trans in Loan Calculator

This commit is contained in:
frederic34 2015-03-28 10:02:33 +01:00
parent a0c7cedaf1
commit 680317f250
2 changed files with 39 additions and 27 deletions

View File

@ -18,6 +18,18 @@ ErrorLoanCapital=<font color=red>Loan amount</font> has to be numeric and greate
ErrorLoanLength=<font color=red>Loan length</font> has to be numeric and greater than zero. ErrorLoanLength=<font color=red>Loan length</font> has to be numeric and greater than zero.
ErrorLoanInterest=<font color=red>Annual interest</font> has to be numeric and greater than zero. ErrorLoanInterest=<font color=red>Annual interest</font> has to be numeric and greater than zero.
# Calc # 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: <b>%s</b> over %s years
Totalsforyear=Totals for year Totalsforyear=Totals for year
MonthlyPayment=Monthly Payment MonthlyPayment=Monthly Payment
LoanCalcDesc=This <b>mortgage calculator</b> 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.<br> 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.<br> LoanCalcDesc=This <b>mortgage calculator</b> 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.<br> 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.<br>

View File

@ -121,6 +121,7 @@ if (! empty($errors)) {
llxHeader(); llxHeader();
print_fiche_titre($langs->trans("LoanCalc"));
print $langs->trans('LoanCalcDesc'); print $langs->trans('LoanCalcDesc');
print '<form method="GET" name="information" action="'.$_SERVER['PHP_SELF'].'">'; print '<form method="GET" name="information" action="'.$_SERVER['PHP_SELF'].'">';
@ -131,33 +132,33 @@ print '<table cellpadding="2" cellspacing="0" border="0" width="100%">';
//print '<td align="smalltext" width="100%"><img src="/images/clear.gif" width="250" height="1" border="0" alt=""></td>'; //print '<td align="smalltext" width="100%"><img src="/images/clear.gif" width="250" height="1" border="0" alt=""></td>';
//print '</tr>'; //print '</tr>';
print '<tr bgcolor="#cccccc">'; print '<tr bgcolor="#cccccc">';
print '<td align="center" colspan="2"><b>Purchase &amp; Financing Information</b></td>'; print '<td align="center" colspan="2"><b>'.$langs->trans('PurchaseFinanceInfo').'</b></td>';
print '</tr>'; print '</tr>';
print '<tr bgcolor="#eeeeee">'; print '<tr bgcolor="#eeeeee">';
print '<td align="right">Sale Price of Home:</td>'; print '<td align="right">'.$langs->trans('SalePriceOfAsset').':</td>';
print '<td><input type="text" size="10" name="sale_price" value="'.$sale_price.'"> '.$langs->trans("Currency".$conf->currency).'</td>';print '</tr>'; print '<td><input type="text" size="10" name="sale_price" value="'.$sale_price.'"> '.$langs->trans("Currency".$conf->currency).'</td>';print '</tr>';
print '<tr bgcolor="#eeeeee">'; print '<tr bgcolor="#eeeeee">';
print '<td align="right">Percentage Down:</td>'; print '<td align="right">'.$langs->trans('PercentageDown').':</td>';
print '<td><input type="text" size="5" name="down_percent" value="'.$down_percent.'">%</td>'; print '<td><input type="text" size="5" name="down_percent" value="'.$down_percent.'">%</td>';
print '</tr>'; print '</tr>';
print '<tr bgcolor="#eeeeee">'; print '<tr bgcolor="#eeeeee">';
print '<td align="right">Length of Mortgage:</td>'; print '<td align="right">'.$langs->trans('LengthOfMortgage').':</td>';
print '<td><input type="text" size="3" name="year_term" value="'.$year_term.'">years</td>'; print '<td><input type="text" size="3" name="year_term" value="'.$year_term.'">years</td>';
print '</tr>'; print '</tr>';
print '<tr bgcolor="#eeeeee">'; print '<tr bgcolor="#eeeeee">';
print '<td align="right">Annual Interest Rate:</td>'; print '<td align="right">'.$langs->trans('AnnualInterestRate').':</td>';
print '<td><input type="text" size="5" name="annual_interest_percent" value="'.$annual_interest_percent.'">%</td>'; print '<td><input type="text" size="5" name="annual_interest_percent" value="'.$annual_interest_percent.'">%</td>';
print '</tr>'; print '</tr>';
print '<tr bgcolor="#eeeeee">'; print '<tr bgcolor="#eeeeee">';
print '<td align="right">Explain Calculations:</td>'; print '<td align="right">'.$langs->trans('ExplainCalculations').':</td>';
if (! empty($show_progress)) if (! empty($show_progress))
{ {
print '<td><input type="checkbox" name="show_progress" value="1" checked>Show me the calculations and amortization</td>'; print '<td><input type="checkbox" name="show_progress" value="1" checked>'.$langs->trans('ShowMeCalculationsAndAmortization').'</td>';
} }
else else
{ {
print '<td><input type="checkbox" name="show_progress" value="1">Show me the calculations and amortization</td>'; print '<td><input type="checkbox" name="show_progress" value="1">'.$langs->trans('ShowMeCalculationsAndAmortization').'</td>';
} }
print '</tr>'; print '</tr>';
@ -173,18 +174,18 @@ if ($form_complete && $monthly_payment)
print '<br>'; print '<br>';
print '<table cellpadding="2" cellspacing="0" border="0" width="100%">'; print '<table cellpadding="2" cellspacing="0" border="0" width="100%">';
print '<tr valign="top">'; print '<tr valign="top">';
print '<td align="center" colspan="2" bgcolor="#000000"><font color="#ffffff"><b>Mortgage Payment Information</b></font></td>'; print '<td align="center" colspan="2" bgcolor="#000000"><font color="#ffffff"><b>'.$langs->trans('MortgagePaymentInformation').'</b></font></td>';
print '</tr>'; print '</tr>';
print '<tr valign="top" bgcolor="#eeeeee">'; print '<tr valign="top" bgcolor="#eeeeee">';
print '<td align="right">Down Payment:</td>'; print '<td align="right">'.$langs->trans('DownPayment').':</td>';
print '<td><b>' . number_format($down_payment, "2", ".", ",") . ' ' . $langs->trans("Currency".$conf->currency) . '</b></td>'; print '<td><b>' . number_format($down_payment, "2", ".", ",") . ' ' . $langs->trans("Currency".$conf->currency) . '</b></td>';
print '</tr>'; print '</tr>';
print '<tr valign="top" bgcolor="#eeeeee">'; print '<tr valign="top" bgcolor="#eeeeee">';
print '<td align="right">Amount Financed:</td>'; print '<td align="right">'.$langs->trans('AmountFinanced').':</td>';
print '<td><b>' . number_format($financing_price, "2", ".", ",") . ' ' . $langs->trans("Currency".$conf->currency) . '</b></td>'; print '<td><b>' . number_format($financing_price, "2", ".", ",") . ' ' . $langs->trans("Currency".$conf->currency) . '</b></td>';
print '</tr>'; print '</tr>';
print '<tr valign="top" bgcolor="#cccccc">'; print '<tr valign="top" bgcolor="#cccccc">';
print '<td align="right">Monthly Payment:</td>'; print '<td align="right">'.$langs->trans('MonthlyPayment').':</td>';
print '<td><b>' . number_format($monthly_payment, "2", ".", ",") . ' ' . $langs->trans("Currency".$conf->currency) . '</b><br><font>(Principal &amp; Interest ONLY)</font></td>'; print '<td><b>' . number_format($monthly_payment, "2", ".", ",") . ' ' . $langs->trans("Currency".$conf->currency) . '</b><br><font>(Principal &amp; Interest ONLY)</font></td>';
print '</tr>'; print '</tr>';
@ -203,7 +204,7 @@ if ($form_complete && $monthly_payment)
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
print '<tr valign="top" bgcolor="#FFFF99">'; print '<tr valign="top" bgcolor="#FFFF99">';
print '<td align="right">Monthly Payment:</td>'; print '<td align="right">'.$langs->trans('MonthlyPayment').':</td>';
print '<td><b>' . number_format(($monthly_payment + $pmi_per_month), "2", ".", ",") . $langs->trans("Currency".$conf->currency) . '</b><br><font>'; print '<td><b>' . number_format(($monthly_payment + $pmi_per_month), "2", ".", ",") . $langs->trans("Currency".$conf->currency) . '</b><br><font>';
print '(Principal &amp; Interest, and PMI)</td>'; print '(Principal &amp; Interest, and PMI)</td>';
print '</tr>'; print '</tr>';
@ -290,7 +291,6 @@ if ($form_complete && $show_progress) {
print '<td><b>' . $step++ . '</b></td>'; print '<td><b>' . $step++ . '</b></td>';
print '<td>'; print '<td>';
print 'The montly payment is figured out using the following formula:<br>'; print 'The montly payment is figured out using the following formula:<br>';
print 'Monthly Payment = ' . number_format($financing_price, "2", "", "") . ' * ';
print $langs->trans('MonthlyPayment').' = ' . number_format($financing_price, "2", "", "") . ' * '; print $langs->trans('MonthlyPayment').' = ' . number_format($financing_price, "2", "", "") . ' * ';
print '(1 - ((1 + ' . number_format($monthly_interest_rate, "4", "", "") . ')'; print '(1 - ((1 + ' . number_format($monthly_interest_rate, "4", "", "") . ')';
print '<sup>-(' . $month_term . ')</sup>)))'; print '<sup>-(' . $month_term . ')</sup>)))';
@ -313,7 +313,7 @@ if ($form_complete && $show_progress) {
$denom = pow((1 + $monthly_interest_rate), $power); $denom = pow((1 + $monthly_interest_rate), $power);
$monthly_payment = $principal * ($monthly_interest_rate / (1 - $denom)); $monthly_payment = $principal * ($monthly_interest_rate / (1 - $denom));
print "<br><br><a name=\"amortization\"></a>Amortization For Monthly Payment: <b>" . number_format($monthly_payment, "2", ".", ",") . "</b> over " . $year_term . " years<br>\n"; print '<br><br><a name="amortization"></a>'.$langs->trans('AmortizationMonthlyPaymentOverYears', number_format($monthly_payment, "2", ".", ","), $year_term)."<br>\n";
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';