Fixed bug when adding people to the bill throws an exception
This commit is contained in:
@@ -27,15 +27,11 @@ class BillController extends Controller
|
|||||||
}
|
}
|
||||||
public function manage(Request $stuff)
|
public function manage(Request $stuff)
|
||||||
{
|
{
|
||||||
$test = DB::table('bills')->where('username', 'juice')->pluck('billname');
|
$test = DB::table('bills')->where('username', $stuff->input('username'))->pluck('billname');
|
||||||
$users = DB::table('users')->pluck('username');
|
$users = DB::table('users')->pluck('username');
|
||||||
$responsibleid = DB::table('responsible')->where('owner', $stuff->input('username'))->pluck('id');
|
$responsibleid = DB::table('responsible')->where('owner', $stuff->input('username'))->pluck('id');
|
||||||
foreach ($test as $gus) {
|
|
||||||
echo $gus . " " . $responsibleid[0];
|
return view('manage', ['username' => $stuff->input('username'), 'message' => ""])->with('test', $test)->with('users', $users)->with('payer', '')->with('bills', '')->with('amountpaids', '')->with('totals', '')->with('responsibleid', $responsibleid)->with('count', '0');
|
||||||
echo "<br>";
|
|
||||||
}
|
|
||||||
//return view('manage', ['username' => $stuff->input('username'), 'message' => ''])->with('test', $test);
|
|
||||||
return view('manage', ['username' => $stuff->input('username'), 'message' => ""])->with('test', $test)->with('users', $users)->with('payer', '')->with('bills', '')->with('amountpaids', '')->with('totals', '')->with('responsibleid', $responsibleid)->with('count', '');
|
|
||||||
}
|
}
|
||||||
public function managebill(Request $stuff)
|
public function managebill(Request $stuff)
|
||||||
{
|
{
|
||||||
@@ -55,7 +51,6 @@ class BillController extends Controller
|
|||||||
|
|
||||||
if (!$emptdate | !$empttotal | !$empteach)
|
if (!$emptdate | !$empttotal | !$empteach)
|
||||||
{
|
{
|
||||||
//return view('manage', ['username' => $username, 'message' => "Remeber to fill in all of the fields"])->with('test', $test);
|
|
||||||
return view('manage', ['username' => $username, 'message' => "Remeber to fill in all of the fields"])->with('test', $test)->with('users', $users)->with('payer', '')->with('bills', '')->with('amountpaids', '')->with('totals', '')->with('responsibleid', $responsibleid)->with('count', '');
|
return view('manage', ['username' => $username, 'message' => "Remeber to fill in all of the fields"])->with('test', $test)->with('users', $users)->with('payer', '')->with('bills', '')->with('amountpaids', '')->with('totals', '')->with('responsibleid', $responsibleid)->with('count', '');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -64,29 +59,22 @@ class BillController extends Controller
|
|||||||
DB::table('transactions')->insert([
|
DB::table('transactions')->insert([
|
||||||
'billname' => $billname, 'date' => $date, 'cost' => $total, 'responsible' => $responsibleid, 'username' => $username, 'people' => $each
|
'billname' => $billname, 'date' => $date, 'cost' => $total, 'responsible' => $responsibleid, 'username' => $username, 'people' => $each
|
||||||
]);
|
]);
|
||||||
//return view('manage', ['username' => $username, 'message' => "The bill has been posted for others to see"])->with('test', $test);
|
$responsibleid = DB::table('responsible')->where('owner', $stuff->input('username'))->pluck('id');
|
||||||
return view('manage', ['username' => $username, 'message' => "The bill has been posted for others to see"])->with('test', $test)->with('users', $users)->with('payer', '')->with('bills', '')->with('amountpaids', '')->with('totals', '')->with('responsibleid', $responsibleid)->with('count','');
|
return view('manage', ['username' => $username, 'message' => "The bill has been posted for others to see"])->with('test', $test)->with('users', $users)->with('payer', '')->with('bills', '')->with('amountpaids', '')->with('totals', '')->with('responsibleid', $responsibleid)->with('count','');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public function addpeople(Request $stuff)
|
public function addpeople(Request $stuff)
|
||||||
{
|
{
|
||||||
$test = DB::table('bills')->where('username', 'juice')->pluck('billname');
|
$test = DB::table('bills')->where('username', $stuff->input('username'))->pluck('billname');
|
||||||
$users = DB::table('users')->pluck('username');
|
$users = DB::table('users')->pluck('username');
|
||||||
//$id = DB::table('transactions')->where('username', $stuff->input('username'))->pluck('id');
|
|
||||||
$date = $stuff->input('date');
|
$date = $stuff->input('date');
|
||||||
$username = $stuff->input('username');
|
$username = $stuff->input('username');
|
||||||
$billname = $stuff->input('billname');
|
$billname = $stuff->input('billname');
|
||||||
$payer = $stuff->input('payer');
|
$payer = $stuff->input('payer');
|
||||||
$amountpaid = $stuff->input('amountpaid');
|
$amountpaid = $stuff->input('amountpaid');
|
||||||
|
$amountpaids = DB::table('responsible')->where('username', $payer)->pluck('amountpaid');
|
||||||
$responsibleid = DB::table('responsible')->where('owner', $stuff->input('username'))->pluck('id');
|
$responsibleid = DB::table('responsible')->where('owner', $stuff->input('username'))->pluck('id');
|
||||||
$count = $amountpaids->count();
|
$count = $amountpaids->count();
|
||||||
$num = '0';
|
|
||||||
echo ++$num;
|
|
||||||
echo "All users" . "<br>";
|
|
||||||
foreach ($users as $groov)
|
|
||||||
{
|
|
||||||
echo $groov . "<br>";
|
|
||||||
}
|
|
||||||
if ($billname !== "Rent" | $billname !== "rent")
|
if ($billname !== "Rent" | $billname !== "rent")
|
||||||
{
|
{
|
||||||
echo "Not equal" . "<br>";
|
echo "Not equal" . "<br>";
|
||||||
@@ -122,7 +110,7 @@ class BillController extends Controller
|
|||||||
}
|
}
|
||||||
public function calcbill(Request $stuff)
|
public function calcbill(Request $stuff)
|
||||||
{
|
{
|
||||||
$test = DB::table('bills')->where('username', 'juice')->pluck('billname');
|
$test = DB::table('bills')->where('username', $stuff->input('username'))->pluck('billname');
|
||||||
$users = DB::table('users')->pluck('username');
|
$users = DB::table('users')->pluck('username');
|
||||||
$payer = $stuff->input('payer');
|
$payer = $stuff->input('payer');
|
||||||
$bills = DB::table('responsible')->where('username', $payer)->pluck('billname');
|
$bills = DB::table('responsible')->where('username', $payer)->pluck('billname');
|
||||||
@@ -157,6 +145,9 @@ class BillController extends Controller
|
|||||||
}
|
}
|
||||||
public function viewbill(Request $stuff)
|
public function viewbill(Request $stuff)
|
||||||
{
|
{
|
||||||
|
$grass = DB::table('bills')->pluck('billname');
|
||||||
|
$billchoice = $stuff->input('tough');
|
||||||
|
$bills = DB::table('responsible')->where('billname', $billchoice)->orderBy('id', 'desc');
|
||||||
echo "Hey " . $stuff->input('username') . " you chose: ";
|
echo "Hey " . $stuff->input('username') . " you chose: ";
|
||||||
echo $stuff->input('tough');
|
echo $stuff->input('tough');
|
||||||
echo "<br>";
|
echo "<br>";
|
||||||
|
|||||||
+4
-4
@@ -34,7 +34,7 @@ CREATE TABLE `bills` (
|
|||||||
|
|
||||||
LOCK TABLES `bills` WRITE;
|
LOCK TABLES `bills` WRITE;
|
||||||
/*!40000 ALTER TABLE `bills` DISABLE KEYS */;
|
/*!40000 ALTER TABLE `bills` DISABLE KEYS */;
|
||||||
INSERT INTO `bills` VALUES ('Fish','juice'),('Buthole','juice'),('car','juice');
|
INSERT INTO `bills` VALUES ('Fish','juice'),('Buthole','juice'),('car','juice'),('Beef','weezybaby'),('Ink','weezybaby'),('Pepsi','weezybaby');
|
||||||
/*!40000 ALTER TABLE `bills` ENABLE KEYS */;
|
/*!40000 ALTER TABLE `bills` ENABLE KEYS */;
|
||||||
UNLOCK TABLES;
|
UNLOCK TABLES;
|
||||||
|
|
||||||
@@ -107,7 +107,7 @@ CREATE TABLE `responsible` (
|
|||||||
|
|
||||||
LOCK TABLES `responsible` WRITE;
|
LOCK TABLES `responsible` WRITE;
|
||||||
/*!40000 ALTER TABLE `responsible` DISABLE KEYS */;
|
/*!40000 ALTER TABLE `responsible` DISABLE KEYS */;
|
||||||
INSERT INTO `responsible` VALUES (NULL,NULL,'ice',NULL,NULL,NULL),('201705Fish','Fish','weezybaby','6','10','juice'),('201705Fish','Fish','weezybaby','6','10','juice'),('201705Fish','Fish','weezybaby','6','10','juice'),('201705Fish','Fish','weezybaby','6','10','juice'),('201705Fish','Fish','bbc_champ','6','10','juice');
|
INSERT INTO `responsible` VALUES (NULL,NULL,'ice',NULL,NULL,NULL),('201705Fish','Fish','weezybaby','6','10','juice'),('201705Fish','Fish','weezybaby','6','10','juice'),('201705Fish','Fish','weezybaby','6','10','juice'),('201705Fish','Fish','weezybaby','6','10','juice'),('201705Fish','Fish','bbc_champ','6','10','juice'),('201705Pepsi','Pepsi','juice','16','20','weezybaby');
|
||||||
/*!40000 ALTER TABLE `responsible` ENABLE KEYS */;
|
/*!40000 ALTER TABLE `responsible` ENABLE KEYS */;
|
||||||
UNLOCK TABLES;
|
UNLOCK TABLES;
|
||||||
|
|
||||||
@@ -134,7 +134,7 @@ CREATE TABLE `transactions` (
|
|||||||
|
|
||||||
LOCK TABLES `transactions` WRITE;
|
LOCK TABLES `transactions` WRITE;
|
||||||
/*!40000 ALTER TABLE `transactions` DISABLE KEYS */;
|
/*!40000 ALTER TABLE `transactions` DISABLE KEYS */;
|
||||||
INSERT INTO `transactions` VALUES ('Fish','201705','30','201705Fish','juice','3'),('car','201705','400','201705car','juice','2'),('car','201705','400','201705car','juice','2');
|
INSERT INTO `transactions` VALUES ('Fish','201705','30','201705Fish','juice','3'),('car','201705','400','201705car','juice','2'),('car','201705','400','201705car','juice','2'),('Beef','201705','30','201705Beef','weezybaby','5'),('Ink','201705','87','201705Ink','weezybaby','3'),('Pepsi','201705','100','201705Pepsi','weezybaby','5');
|
||||||
/*!40000 ALTER TABLE `transactions` ENABLE KEYS */;
|
/*!40000 ALTER TABLE `transactions` ENABLE KEYS */;
|
||||||
UNLOCK TABLES;
|
UNLOCK TABLES;
|
||||||
|
|
||||||
@@ -173,4 +173,4 @@ UNLOCK TABLES;
|
|||||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||||
|
|
||||||
-- Dump completed on 2017-05-29 19:19:42
|
-- Dump completed on 2017-05-29 22:30:58
|
||||||
|
|||||||
@@ -44,6 +44,7 @@
|
|||||||
</p>
|
</p>
|
||||||
{!! Form::close() !!}
|
{!! Form::close() !!}
|
||||||
<h1>{{ $message }}</h1>
|
<h1>{{ $message }}</h1>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<br><br>
|
<br><br>
|
||||||
<h1>Add people to the bill</h1>
|
<h1>Add people to the bill</h1>
|
||||||
@@ -128,7 +129,7 @@
|
|||||||
{{ Form::button('check', array('style' => '', 'type' => 'submit')) }}
|
{{ Form::button('check', array('style' => '', 'type' => 'submit')) }}
|
||||||
</p>
|
</p>
|
||||||
{!! Form::close() !!}
|
{!! Form::close() !!}
|
||||||
{{ $empt = isset($payer[0]) }}
|
{{ $empt = isset($payer) }}
|
||||||
@if (!$empt)
|
@if (!$empt)
|
||||||
nothing
|
nothing
|
||||||
@endif
|
@endif
|
||||||
|
|||||||
Reference in New Issue
Block a user