From e356bf45552330d9f474a659a581e92add81ac9f Mon Sep 17 00:00:00 2001
From: amazing-username
";
- }
- //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', '');
+
+ 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');
}
public function managebill(Request $stuff)
{
@@ -55,7 +51,6 @@ class BillController extends Controller
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', '');
}
else
@@ -64,29 +59,22 @@ class BillController extends Controller
DB::table('transactions')->insert([
'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','');
}
}
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');
- //$id = DB::table('transactions')->where('username', $stuff->input('username'))->pluck('id');
$date = $stuff->input('date');
$username = $stuff->input('username');
$billname = $stuff->input('billname');
$payer = $stuff->input('payer');
$amountpaid = $stuff->input('amountpaid');
+ $amountpaids = DB::table('responsible')->where('username', $payer)->pluck('amountpaid');
$responsibleid = DB::table('responsible')->where('owner', $stuff->input('username'))->pluck('id');
$count = $amountpaids->count();
- $num = '0';
- echo ++$num;
- echo "All users" . "
";
- foreach ($users as $groov)
- {
- echo $groov . "
";
- }
if ($billname !== "Rent" | $billname !== "rent")
{
echo "Not equal" . "
";
@@ -122,7 +110,7 @@ class BillController extends Controller
}
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');
$payer = $stuff->input('payer');
$bills = DB::table('responsible')->where('username', $payer)->pluck('billname');
@@ -157,6 +145,9 @@ class BillController extends Controller
}
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 $stuff->input('tough');
echo "
";
diff --git a/maxipad.sql b/maxipad.sql
index 833f36c..5aaee09 100644
--- a/maxipad.sql
+++ b/maxipad.sql
@@ -34,7 +34,7 @@ CREATE TABLE `bills` (
LOCK TABLES `bills` WRITE;
/*!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 */;
UNLOCK TABLES;
@@ -107,7 +107,7 @@ CREATE TABLE `responsible` (
LOCK TABLES `responsible` WRITE;
/*!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 */;
UNLOCK TABLES;
@@ -134,7 +134,7 @@ CREATE TABLE `transactions` (
LOCK TABLES `transactions` WRITE;
/*!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 */;
UNLOCK TABLES;
@@ -173,4 +173,4 @@ UNLOCK TABLES;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!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
diff --git a/resources/views/manage.blade.php b/resources/views/manage.blade.php
index db853f1..23631b9 100644
--- a/resources/views/manage.blade.php
+++ b/resources/views/manage.blade.php
@@ -44,6 +44,7 @@