Commit 25bc4e7a by hannan

changes

parent 7bdba129
...@@ -246,7 +246,7 @@ class DashboardController extends Controller ...@@ -246,7 +246,7 @@ class DashboardController extends Controller
//Form Baru //Form Baru
//check dalam db table ts-detail. Kalau dah ada details dalam td_hours -> update(). //check dalam db table ts-detail. Kalau dah ada details dalam td_hours -> update().
//Kalau belum -> save() //Kalau tak ada detail hours -> save()
$user = users::where('id', Auth::id())->first(); $user = users::where('id', Auth::id())->first();
...@@ -258,18 +258,21 @@ class DashboardController extends Controller ...@@ -258,18 +258,21 @@ class DashboardController extends Controller
->whereNotNull('td_hours') ->whereNotNull('td_hours')
->first(); ->first();
//update total chargeable hrs //update total chargeable hrs
if($checkTimesheetDetail) if($checkTimesheetDetail)
{ {
$data = Ts_detail::where('id',$request->id)->first(); $data = Ts_detail::where('tm_staff_id', $user->u_staffID)
->where('tm_year', $request->year)
->where('tm_month', $request->month)
->where('tm_phase', $request->phase)
->first();
$data ->td_hours = 10; $data ->td_hours = 10;
$data ->update(); $data ->update();
} }
//kalau takda, save(). //kalau takda, save().
else else
{ {
dd($checkTimesheetDetail); // dd($checkTimesheetDetail);
$data = new Ts_detail; $data = new Ts_detail;
$data ->id = $request ->id; $data ->id = $request ->id;
$data ->tm_year = $request ->year; $data ->tm_year = $request ->year;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment