Fixed bug where variable is undefined

This commit is contained in:
amazing-username
2017-05-31 14:04:16 -05:00
parent 9dcb335a03
commit d93ccda5ac
+5 -2
View File
@@ -15,7 +15,7 @@ class PaycheckController extends Controller
{ {
$hours = $stuff->input('hours'); $hours = $stuff->input('hours');
$payrate = $stuff->input('payrate'); $payrate = $stuff->input('payrate');
$grosspay; $grosspay = $hours * $payrate;
$netpay; $netpay;
$fedtax; $fedtax;
$statetax; $statetax;
@@ -31,7 +31,6 @@ class PaycheckController extends Controller
return view('paycheck', ['hours' => 'd', 'payrate' => '', 'grosspay' => '', 'netpay' => '', 'fedtax' => '', 'statetax' => '', 'sstax' => '', 'medtax' => '']); return view('paycheck', ['hours' => 'd', 'payrate' => '', 'grosspay' => '', 'netpay' => '', 'fedtax' => '', 'statetax' => '', 'sstax' => '', 'medtax' => '']);
} }
$grosspay = $hours * $payrate;
if ($grosspay < 87) if ($grosspay < 87)
{ {
$fedtax = 0; $fedtax = 0;
@@ -48,6 +47,10 @@ class PaycheckController extends Controller
{ {
$fedtax = floor(($grosspay - 744.04) * .25 * 100)/100; $fedtax = floor(($grosspay - 744.04) * .25 * 100)/100;
} }
else
{
$fedtax = floor(($grosspay - 1500) * .40 * 100)/100;
}
$statetax = round($grosspay * .0375 * 100)/100; $statetax = round($grosspay * .0375 * 100)/100;