require_once('../Include/system.inc'); $strTitle = "Car: Buy vs Lease Calculator"; $aMeta[desc] = "Car: Buy vs Lease"; $strArticleHeading = $strTitle; ?> include( '../Include/header.inc'); ?> ob_start(); ?>
$form = ob_get_clean(); if($_POST[action]) { ob_start(); if(!is_numeric($_POST[downPayment_l]) || !is_numeric($_POST[Price]) || !is_numeric($_POST[leaseMonths]) || !is_numeric($_POST[loanMonths])|| !is_numeric($_POST[interestRate]) || !is_numeric($_POST[interestRate_l]) || !is_numeric($_POST[annualDepriciation]) || !is_numeric($_POST[residual])) $error[] = "Please fill-up the required fields with appropriate values."; elseif($_POST[downPayment_l] > $_POST[Price]) $error[] = "Please check Negotiated price and/or Down payment."; elseif($_POST[interestRate_l]>30 || $_POST[interestRate]>30 || $_POST[interestRate_l]<1 || $_POST[interestRate]<1) $error[] = "Please make sure that the Interest rate is between 0 to 30."; elseif($_POST[leaseMonths]>60 || $_POST[loanMonths]>60 || $_POST[leaseMonths]<1 || $_POST[loanMonths]<1) $error[] = "Please make sure that the Term in months is between 0 to 60."; elseif($_POST[annualDepriciation]>25) $error[] = "Please fill-up the the Annual depriciation (%) field with appropriate value."; if(count($error)) { echo 'Your monthly loan payment will be =number_format($loanMonthlyPay,2)?> if you buy, or =number_format($leasePayment,2)?> if you lease the car.
$summary = ob_get_clean(); } } if(empty($error)) { ob_start(); ?>Buy | Lease | ||
---|---|---|---|
Loan Monthly Payment | =number_format($loanMonthlyPay,2);?> | Lease Monthly Payment | =number_format($leasePayment,2);?> |
Down payment | =number_format($_POST[downPayment],2);?> | Total Up front Cost | =number_format(($_POST[downPayment_l]+$_POST[otherFees_l]),2)?> |
Total Loan Payments | =number_format(($loanMonthlyPay*$_POST[loanMonths]),2);?> | Total Lease Payments | =number_format(($leasePayment*$_POST[leaseMonths]),2);?> |
Market Value of Vehicle | =number_format($marketValue,2);?> | ||
Net Cost of Buying | =number_format(($_POST[downPayment]+ $_POST[otherFees] + ($loanMonthlyPay*$_POST[loanMonths]) - $marketValue),2);?> | Net Cost of Lease | =number_format(($_POST[downPayment_l] + $_POST[otherFees_l]+($leasePayment*$_POST[leaseMonths])),2);?> |