Added bi-weekly paycheck calculator for singles
This commit is contained in:
@@ -0,0 +1,79 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class PaycheckController extends Controller
|
||||
{
|
||||
//
|
||||
public function display()
|
||||
{
|
||||
return view('paycheck', ['hours' => '', 'payrate' => '', 'grosspay' => '', 'netpay' => '', 'fedtax' => '', 'statetax' => '', 'sstax' => '', 'medtax' => '']);
|
||||
}
|
||||
public function results(Request $stuff)
|
||||
{
|
||||
$hours = $stuff->input('hours');
|
||||
$payrate = $stuff->input('payrate');
|
||||
$grosspay;
|
||||
$netpay;
|
||||
$fedtax;
|
||||
$statetax;
|
||||
$sstax;
|
||||
$medtax;
|
||||
$totaltax;
|
||||
|
||||
$empthours = isset($hours);
|
||||
$emptpayrate = isset($payrate);
|
||||
|
||||
if (!$empthours | !$emptpayrate)
|
||||
{
|
||||
return view('paycheck', ['hours' => 'd', 'payrate' => '', 'grosspay' => '', 'netpay' => '', 'fedtax' => '', 'statetax' => '', 'sstax' => '', 'medtax' => '']);
|
||||
}
|
||||
|
||||
$grosspay = $hours * $payrate;
|
||||
if ($grosspay < 87)
|
||||
{
|
||||
$fedtax = 0;
|
||||
}
|
||||
else if ($grosspay >= 87 && $grosspay < 443)
|
||||
{
|
||||
$fedtax = floor(($grosspay - 88.50) * .10 * 100)/100;
|
||||
}
|
||||
else if ($grosspay >= 443 && $grosspay < 1529)
|
||||
{
|
||||
$fedtax = floor(($grosspay - 208.00) * .15 * 100)/100;
|
||||
}
|
||||
else if ($grosspay <= 1529 && $grosspay < 3925)
|
||||
{
|
||||
$fedtax = floor(($grosspay - 744.04) * .25 * 100)/100;
|
||||
}
|
||||
|
||||
$statetax = round($grosspay * .0375 * 100)/100;
|
||||
|
||||
if ($hours >=26)
|
||||
{
|
||||
$sstax = round(($grosspay * .062) * 100)/100;
|
||||
}
|
||||
else
|
||||
{
|
||||
$sstax = 0;
|
||||
}
|
||||
|
||||
if ($hours >= 26)
|
||||
{
|
||||
$medtax = round(($grosspay * .0145) * 100)/100;
|
||||
}
|
||||
else
|
||||
{
|
||||
$medtax = 0;
|
||||
}
|
||||
|
||||
|
||||
$totaltax = $fedtax + $statetax + $sstax + $medtax;
|
||||
$netpay = $grosspay - $totaltax;
|
||||
|
||||
|
||||
return view('paycheck', ['hours' => $hours, 'payrate' => $payrate, 'grosspay' => $grosspay, 'netpay' => $netpay, 'fedtax' => $fedtax, 'statetax' => $statetax, 'sstax' => $sstax, 'medtax' => $medtax]);
|
||||
}
|
||||
}
|
||||
@@ -9,14 +9,24 @@
|
||||
|
||||
<!-- Latest compiled and minified JavaScript -->
|
||||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
|
||||
|
||||
<style>
|
||||
button {
|
||||
height:40%;
|
||||
width:90%;
|
||||
}
|
||||
h1 {
|
||||
font-size:1000%;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body style="background-color:#eee">
|
||||
<div class="jumbotron text-center">
|
||||
<h1>HomeIsWhereTheMoneyIs</h1>
|
||||
<a href="login"><button style="height:40%;width:90%"><h1 style="font-size:1000%">Login</h1></button><br></a>
|
||||
<a href="login"><button><h1 style="font-size:1000%">Login</h1></button><br></a>
|
||||
<br><br>
|
||||
<a href="register"><button style="height:30%;width:90%"><h1 style="font-size:500%">Register</h1></button></a>
|
||||
<a href="register"><button><h1 style="font-size:500%">Register</h1></button></a>
|
||||
<br><br>
|
||||
<a href='paycheck'><button><h1>Paycheck Calculator</h1></button></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Paycheck Calculator</title>
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
|
||||
|
||||
<!-- Optional theme -->
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
|
||||
|
||||
<!-- Latest compiled and minified JavaScript -->
|
||||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
|
||||
<style type="text/css">
|
||||
.test
|
||||
{
|
||||
height: 30%;
|
||||
}
|
||||
.test2 {
|
||||
height:50%;
|
||||
}
|
||||
input {
|
||||
width:70%;
|
||||
height:20%;
|
||||
font-size:500%;
|
||||
}
|
||||
select {
|
||||
width:70%;
|
||||
height:20%;
|
||||
font-size:500%;
|
||||
}
|
||||
label {
|
||||
font-size:500%;
|
||||
}
|
||||
button {
|
||||
width:70%;
|
||||
height:20%;
|
||||
font-size:500%;
|
||||
}
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body style="background-color:#eee">
|
||||
<div style="background-color:#000000;text-align:center">
|
||||
<a href="/"><h1 style="height:10%;font-size:800%">Home</h1></a>
|
||||
</div>
|
||||
<div class="jumbotron text-center">
|
||||
<h1>Bi-weekly paycheck calculator</h1>
|
||||
<br><br>
|
||||
{!! Form::open(array('action' => 'PaycheckController@results')) !!}
|
||||
<p>
|
||||
{{ Form::label('hourslbl', 'hours') }}
|
||||
</p>
|
||||
<p>
|
||||
{{ Form::text('hours') }}
|
||||
</p>
|
||||
<p>
|
||||
{{ Form::label('payratelbl', 'payrate') }}
|
||||
</p>
|
||||
<p>
|
||||
{{ Form::text('payrate') }}
|
||||
</p>
|
||||
<p>
|
||||
{{ Form::button('do it', array('type' => 'submit')) }}
|
||||
</p>
|
||||
{!! Form::close() !!}
|
||||
@if ($hours!=='d')
|
||||
<label style="font-size:500%">Hours: {{ $hours }}</label>
|
||||
<br>
|
||||
<label>Pay rate: {{ $payrate }}</label>
|
||||
<br>
|
||||
<label>Gross pay: {{ $grosspay }}</label>
|
||||
<br>
|
||||
<label>Net pay: {{ $netpay }}</label>
|
||||
<br>
|
||||
<label>Federal tax: {{ $fedtax }}</label>
|
||||
<br>
|
||||
<label>State tax: {{ $statetax }}</label>
|
||||
<br>
|
||||
<label>Social Security tax: {{ $sstax }}</label>
|
||||
<br>
|
||||
<label>Medicare tax: {{ $medtax }}</label>
|
||||
<br>
|
||||
@endif
|
||||
@if ($hours==='d')
|
||||
<h1>Remember to fill in all the fields</h1>
|
||||
@endif
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -34,3 +34,5 @@ Route::get('hotboy', function () {
|
||||
Route::get('stunt', function () {
|
||||
return "Check the database, I think someone was created";
|
||||
});
|
||||
Route::get('paycheck', 'PaycheckController@display');
|
||||
Route::post('paycheck/biweekly', 'PaycheckController@results');
|
||||
|
||||
Reference in New Issue
Block a user