#! /usr/bin/perl require "cgi-lib.pl"; require "cl-lib.pl"; sub calcdeposit { #LTV, Financing return (@_[1]/((@_[0] / 100)) - @_[1]); } sub IRF { local($ir,$ty,$a); $ir=@_[0]; $ty=@_[1]; $ir = $ir + (0.5 - (($ir * 10) % 5)/10) if ((($ir*10) % 5) != 0); if ($ty = 30){$ty = 4.77; $a=0.3;} if ($ty = 20){$ty = 6.06; $a=0.27;} if ($ty = 15){$ty = 7.40; $a=0.25;} return (1) if ($ty > 10); $ty += $a + (($ir - 4) / 0.5)*0.004999999 if (($ir - 4) > 0); return $ty; } sub HousingRatio { return (@_[0]*0.28)*0.92; } sub DebtRatio { return ((@_[0]-@_[1])*0.36)*0.92; } sub MaxMort { local($gmi,$debt,$irate,$termy,$a,$b,$c); $gmi= @_[0]; $debt= @_[1]; $irate=@_[2]; $termy=@_[3]; $a= &HousingRatio($gmi)/ &IRF($irate,$termy) * 1000; $b= &DebtRatio($gmi,$debt)/ &IRF($irate,$termy) * 1000; #return ($a < $b)?($a / &IRF($irate,$termy) * 1000):($b / &IRF($irate,$termy) * 1000); return ($a<$b)?(($a),($b)):(($b),($a)); #$c = ($a < $b)?($b - $a)/2+$a:($a - $b)/2+$b; #return ($c / &IRF($irate,$termy) * 1000); } sub doreport { open(INPUTFORM,"prequal/pqoutpre.html") || die "Can't open your output form-pre. $!\n"; while() { print $_; } close INPUTFORM; # The next statement is Vernon's idea, that dood is the bomb! printf( < ConservativeAggressive Maximum Purchase Price\$%9.2fMaximum Purchase Price\$%9.2f Down Payment\$%9.2fDown Payment\$%9.2f Cash Available\$%9.2fCash Available\$%9.2f Interest Rate\$%9.2fInterest Rate\$%9.2f Closing Costs\$%9.2fClosing Costs\$%9.2f Monthly Payment\$%9.2fMonthly Payment\$%9.2f Loan Amount\$%9.2fLoan Amount\$%9.2f closeTable print " "; print "You may not have enough available cash to qualify for a conservative loan." if ($input{casha} < $C{downp}); print " "; print "You may not have enough available cash to qualify for an aggressive loan." if ($input{casha} < $A{downp}); print ""; print ""; print qq!
!; print qq!!; print qq!!; print qq!!; print qq!!; print qq!!; print qq!!; print qq!!; print qq!!; print qq!!; print qq!!; print "Try another down payment"; print qq!20% "; print qq!10% "; print qq!5%"; print qq! !; print "Please Note: Monthly Payment is the sum of Principal, Interest, Taxes and Insurance

"; print ""; open(INPUTFORM,"prequal/pqoutpost.html") || die "Can't open your output form-pre. $!\n"; while() { print $_; } close INPUTFORM; } sub doform { open(INPUTFORM,"prequal/pqinpre.html") || die "Can't open your input form-pre. $!\n"; while() { print $_; } close INPUTFORM; # # Insert Form here # print<
NOTE: Please check with Tucker Mortgage LLC; you may qualify for a special program.
Gross Monthly Income \$
Monthly Debt \$
Term in Years
Interest Rate
Cash Available

myForm open(INPUTFORM,"prequal/pqinpost.html") || die "Can't open your input form-post. $!\n"; while() { print $_; } close INPUTFORM; print qq!

Return to Home Page

! if ($input{c}); } MAIN: { #Read in all the variables set by the form. Else, send out the input form. print &PrintHeader; if (&MethGet) { &ReadParse (*input); &doform; } else { if (! &ReadParse (*input)) { $in = ""; $in = $in . "&banana=spiders"; $in = $in . "&c=abcmortgage"; $in = $in . "&gmi=2500"; $in = $in . "&debt=500"; $in = $in . "&termy=30"; $in = $in . "&irate=8"; $in = $in . "&casha=50000"; $in = $in . "&tax=0.0125"; $in = $in . "&hins=0.0035"; $in = $in . "&ccost=0.03"; $in = $in . "<v=80"; @input = split(/&/,$in); foreach $i (1 .. $#input) { ($key, $val) = split(/=/,$input[$i],2); $input{$key} .= $val; } } $hr = &HousingRatio($input{gmi}); $dr = &DebtRatio($input{gmi},$input{debt}); #$C_maxpp,$C_downp,$C_irate,$C_hi,$C_pt,$C_cc,$C_monthly ($C{maxmort},$A{maxmort}) = &MaxMort($input{gmi},$input{debt},$input{irate},$input{termy}); $C{downp} = &calcdeposit($input{ltv},$C{maxmort}); $C{maxpp} = $C{maxmort} + $C{downp}; $C{irate} = $input{irate}; $C{hi} = $C{maxmort} * $input{hins}; $C{pt} = $C{maxpp} * $input{tax}; $C{cc} = $C{maxmort} * $input{ccost}; $C{monthly} = ($hr < $dr)?($hr+($C{pt}+$C{hi})/12):($dr+($C{pt}+$C{hi})/12); $A{downp} = &calcdeposit($input{ltv},$A{maxmort}); $A{maxpp} = $A{maxmort} + $A{downp}; $A{irate} = $input{irate}; $A{hi} = $A{maxmort} * $input{hins}; $A{pt} = $A{maxpp} * $input{tax}; $A{cc} = $A{maxmort} * $input{ccost}; $A{monthly} = ($hr > $dr)?($hr+($A{pt}+$A{hi})/12):($dr+($A{pt}+$A{hi})/12); &doreport; } }