From e0bdc6863ddb4de0f5cc1e75236f2990c5bc4522 Mon Sep 17 00:00:00 2001
From: amazing-username
+ {!! Form::open(array('action' => 'HomeController@home')) !!}
+ {{ Form::hidden('username', $username) }}
+
";
- $id = $date . $billname;
- $cost = DB::table('transactions')->where('responsible', $id)->pluck('cost')->first();
- $people = DB::table('transactions')->where('responsible', $id)->pluck('people')->first();
- $full = ($cost * 100) / ($people * 100);
- echo $id . $billname . $payer . $amountpaid . $full . $username;
- DB::table('responsible')->insert(
- ['id' => $id, 'billname' => $billname, 'username' => $payer, 'amountpaid' => $amountpaid, 'total' => $full, 'owner' => $username]
- );
- }
- else
- {
- echo "It's the rent bill" . "
";
$id = $date . $billname;
$cost = DB::table('transactions')->where('responsible', $id)->pluck('cost')->first();
$roomtype = DB::table('users')->where('username', $payer)->pluck('room')->first();
@@ -104,6 +92,16 @@ class BillController extends Controller
['id' => $id, 'billname' => $billname, 'username' => $payer, 'amountpaid' => $amountpaid, 'total' => '262', 'owner' => $username]);
}
}
+ else
+ {
+ $id = $date . $billname;
+ $cost = DB::table('transactions')->where('responsible', $id)->pluck('cost')->first();
+ $people = DB::table('transactions')->where('responsible', $id)->pluck('people')->first();
+ $full = ($cost * 100) / ($people * 100);
+ DB::table('responsible')->insert(
+ ['id' => $id, 'billname' => $billname, 'username' => $payer, 'amountpaid' => $amountpaid, 'total' => $full, 'owner' => $username]
+ );
+ }
return view('manage', ['username' => $username, 'message' => $payer . " has been added to the bill"])->with('test', $test)->with('users', $users)->with('payer', '')->with('bills', '')->with('amountpaids', $amountpaids)->with('totals', '')->with('responsibleid', $responsibleid)->with('count', '');
}
@@ -119,7 +117,6 @@ class BillController extends Controller
$count = $amountpaids->count();
DB::table('responsible')->where('id', $stuff->input('responsibleid'))->update(['amountpaid' => $stuff->input('amountpaid')]);
- echo $stuff->input('amountpaid') . "
";
return view('manage', ['username' => $stuff->input('username'), 'message' => ''])->with('test', $test)->with('users', $users)->with('payer', $payer)->with('bills', $bills)->with('amountpaids', $amountpaids)->with('totals', $totals)->with('responsibleid', $responsibleid)->with('count', $count);
}
@@ -136,23 +133,21 @@ class BillController extends Controller
return view('manage', ['username' => $stuff->input('username'), 'message' => ''])->with('test', $test)->with('users', $users)->with('payer', $payer)->with('bills', $bills)->with('amountpaids', $amountpaids)->with('totals', $totals)->with('responsibleid', $responsibleid)->with('count', $count);
}
+
public function view(Request $stuff)
{
$grass = DB::table('bills')->pluck('billname');
- return view('view', ['username' => $stuff->input('username')])->with('grass', $grass)->with('billname', '')->with('owner', '')->with('amountpaid', '')->with('total', '');
+ return view('view', ['username' => $stuff->input('username')])->with('grass', $grass)->with('billname', '')->with('owner', '')->with('amountpaid', '')->with('total', '')->with('count', '');
}
public function viewbill(Request $stuff)
{
$grass = DB::table('bills')->pluck('billname');
$billchoice = $stuff->input('tough');
- $owner = DB::table('responsible')->orderBy('id', 'desc')->where('username', $stuff->input('username'))->pluck('owner')->first();
- $amountpaid = DB::table('responsible')->orderBy('id', 'desc')->where('username', $stuff->input('username'))->pluck('amountpaid')->first();
- $total = DB::table('responsible')->orderBy('id', 'desc')->where('username', $stuff->input('username'))->pluck('total')->first();
+ $owner = DB::table('responsible')->orderBy('id', 'desc')->where('username', $stuff->input('username'))->where('billname', $billchoice)->pluck('owner');
+ $amountpaid = DB::table('responsible')->orderBy('id', 'desc')->where('username', $stuff->input('username'))->where('billname', $billchoice)->pluck('amountpaid');
+ $total = DB::table('responsible')->orderBy('id', 'desc')->where('username', $stuff->input('username'))->where('billname', $billchoice)->pluck('total');
+ $count = DB::table('responsible')->where('username', $stuff->input('username'))->where('billname', $billchoice)->count();
- echo "Hey " . $stuff->input('username') . " you chose: ";
- echo $stuff->input('tough');
- echo "
";
-
- return view('view', ['username' => $stuff->input('username')])->with('grass', $grass)->with('billname', $billchoice)->with('owner', $owner)->with('amountpaid', $amountpaid)->with('total', $total);
+ return view('view', ['username' => $stuff->input('username')])->with('grass', $grass)->with('billname', $billchoice)->with('owner', $owner)->with('amountpaid', $amountpaid)->with('total', $total)->with('count', $count);
}
}
diff --git a/resources/views/createbill.blade.php b/resources/views/createbill.blade.php
index 94e24e8..34cda4a 100644
--- a/resources/views/createbill.blade.php
+++ b/resources/views/createbill.blade.php
@@ -13,18 +13,16 @@
- {!! Form::open(array('action' => 'HomeController@home')) !!}
- {{ Form::hidden('username', $username) }}
-
@@ -34,7 +32,7 @@ {{ Form::text('billname', '') }}
- {{ Form::button('Create Bill', array('class' => 'createbill', 'type' => 'submit')) }} + {{ Form::button('Create Bill', array('class' => 'createbill', 'type' => 'submit')) }}
{!! Form::close() !!}+ {!! Form::open(array('action' => 'HomeController@home')) !!} + {{ Form::hidden('username', $username) }} +
- {{ Form::label('billnamelabel', 'billname', array('style' => 'font-size:500%'))}} -
-- -
-- {{ Form::label('datelabel', "enter date in yyyymm") }} -
-- {{ Form::text('date', '') }} -
-- {{ Form::label('totallabel', 'total bill amount') }} -
-- {{ Form::text('total', '') }} -
-- {{ Form::label('eachlabel', 'how many people') }} -
-- {{ Form::text('each', '') }} -
- {{ Form::button('add bill', array('class' => 'createbillmonthamount', 'type' => 'submit')) }} -+ {{ Form::label('billnamelabel', 'billname', array('style' => 'font-size:500%'))}} +
++ +
++ {{ Form::label('datelabel', "enter date in yyyymm") }} +
++ {{ Form::text('date', '') }} +
++ {{ Form::label('totallabel', 'total bill amount') }} +
++ {{ Form::text('total', '') }} +
++ {{ Form::label('eachlabel', 'how many people') }} +
++ {{ Form::text('each', '') }} +
+ {{ Form::button('add bill', array('class' => 'createbillmonthamount', 'type' => 'submit')) }} +
@@ -84,9 +82,9 @@
@@ -117,9 +115,9 @@
@@ -127,9 +125,9 @@
@@ -137,9 +135,9 @@
@@ -164,9 +162,9 @@
diff --git a/resources/views/register.blade.php b/resources/views/register.blade.php index b363c8b..bfa30d9 100644 --- a/resources/views/register.blade.php +++ b/resources/views/register.blade.php @@ -1,4 +1,4 @@ - +
- {{ Form::label('firstnamelabel', 'first name') }}
-
- {{ Form::text('firstname', '') }}
-
- {{ Form::label('lastnamelabel', 'last name') }}
-
- {{ Form::text('lastname', '') }}
-
- {{ Form::label('usernamelabel', 'username') }}
-
- {{ Form::text('username', '') }}
-
- {{ Form::label('passwordlabel', 'password') }}
-
- {{ Form::password('password') }}
-
- {{ Form::label('confirmlabel', 'confirm') }}
-
- {{ Form::password('confirm') }}
-
- {{ Form::label('roomlabel', 'room') }}
-
-
-
-
- {{ Form::submit('register me', array('class' => 'registeraccount')) }}
-
+ {{ Form::label('firstnamelabel', 'first name') }}
+
+ {{ Form::text('firstname', '') }}
+
+ {{ Form::label('lastnamelabel', 'last name') }}
+
+ {{ Form::text('lastname', '') }}
+
+ {{ Form::label('usernamelabel', 'username') }}
+
+ {{ Form::text('username', '') }}
+
+ {{ Form::label('passwordlabel', 'password') }}
+
+ {{ Form::password('password') }}
+
+ {{ Form::label('confirmlabel', 'confirm') }}
+
+ {{ Form::password('confirm') }}
+
+ {{ Form::label('roomlabel', 'room') }}
+
+
+
+
+ {{ Form::submit('register me', array('class' => 'registeraccount')) }}
+
- {{ Form::button('create', array('class' => 'createsection', 'type' => 'submit')) }} + {{ Form::button('create', array('class' => 'createsection', 'type' => 'submit')) }}
{!! Form::close() !!} {!! Form::open(array('action' => 'BillController@manage')) !!} {{ Form::hidden('username', $username) }}- {{ Form::button('mange', array('class' => 'managesection', 'type' => 'submit')) }} + {{ Form::button('mange', array('class' => 'managesection', 'type' => 'submit')) }}
{!! Form::close() !!} {!! Form::open(array('action' => 'BillController@view')) !!} - {{ Form::hidden('username', $username) }}- {{ Form::button('view', array('class' => 'viewsection', 'type' => 'submit')) }} + {{ Form::button('view', array('class' => 'viewsection', 'type' => 'submit')) }}
{!! Form::close() !!} diff --git a/resources/views/view.blade.php b/resources/views/view.blade.php index 9773feb..f112595 100644 --- a/resources/views/view.blade.php +++ b/resources/views/view.blade.php @@ -13,14 +13,14 @@ - {!! Form::open(array('action' => 'HomeController@home')) !!} - {{ Form::hidden('username', $username) }} -+ {!! Form::open(array('action' => 'HomeController@home')) !!} + {{ Form::hidden('username', $username) }} +
@@ -45,12 +45,14 @@