From d93ccda5ac41b82ca908090f2a47c6158c7ee9fc Mon Sep 17 00:00:00 2001 From: amazing-username Date: Wed, 31 May 2017 14:04:16 -0500 Subject: [PATCH] Fixed bug where variable is undefined --- app/Http/Controllers/PaycheckController.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/PaycheckController.php b/app/Http/Controllers/PaycheckController.php index f8921d2..bceb876 100644 --- a/app/Http/Controllers/PaycheckController.php +++ b/app/Http/Controllers/PaycheckController.php @@ -15,7 +15,7 @@ class PaycheckController extends Controller { $hours = $stuff->input('hours'); $payrate = $stuff->input('payrate'); - $grosspay; + $grosspay = $hours * $payrate; $netpay; $fedtax; $statetax; @@ -31,7 +31,6 @@ class PaycheckController extends Controller return view('paycheck', ['hours' => 'd', 'payrate' => '', 'grosspay' => '', 'netpay' => '', 'fedtax' => '', 'statetax' => '', 'sstax' => '', 'medtax' => '']); } - $grosspay = $hours * $payrate; if ($grosspay < 87) { $fedtax = 0; @@ -48,6 +47,10 @@ class PaycheckController extends Controller { $fedtax = floor(($grosspay - 744.04) * .25 * 100)/100; } + else + { + $fedtax = floor(($grosspay - 1500) * .40 * 100)/100; + } $statetax = round($grosspay * .0375 * 100)/100;