Commit e750f24c by hannan

reset to fezrul changes

parent 8c12b1b9
...@@ -79,6 +79,7 @@ class DashboardController extends Controller ...@@ -79,6 +79,7 @@ class DashboardController extends Controller
public function borangBolehCaj(Request $request) public function borangBolehCaj(Request $request)
{ {
$userId = Auth::id(); $userId = Auth::id();
$user = users::where('id', Auth::id())->first();
$projectcode = 'Project Code'; $projectcode = 'Project Code';
$projectname = 'Project Name'; $projectname = 'Project Name';
...@@ -179,18 +180,19 @@ class DashboardController extends Controller ...@@ -179,18 +180,19 @@ class DashboardController extends Controller
->where('tm_year', $year) ->where('tm_year', $year)
->where('tm_month', $month) ->where('tm_month', $month)
->where('tm_phase', $phase) ->where('tm_phase', $phase)
->whereNotNull('tm_chargeable_hrs')
->first(); ->first();
// dd($check);
//kalau ada, dia gi ke edit //kalau ada, dia gi ke edit
if($check) if($check)
{ {
$data = Ts_master::where('id',$request->id)->first(); $hour = Ts_detail::where('fk_tm_id',$check->id)->get();
} }
//klu xde g create.php //klu xde g create.php
else else
{ {
$data = []; $hour = null;
} }
//kalau ada juga = bawak data details //kalau ada juga = bawak data details
...@@ -216,8 +218,8 @@ class DashboardController extends Controller ...@@ -216,8 +218,8 @@ class DashboardController extends Controller
// } // }
// dd($checkTimesheetDetail); // dd($checkTimesheetDetail);
// dd($hour);
return view('timesheet::dashboard.borangBolehCaj', compact('userId','projectcode', 'projectname','month','phase','samplequery','daymonth','year','sampleTimesheet_dtl','day','data')); return view('timesheet::dashboard.borangBolehCaj', compact('userId','projectcode', 'projectname','month','phase','samplequery','daymonth','year','sampleTimesheet_dtl','day','hour'));
} }
public function kalendarCharge() public function kalendarCharge()
...@@ -292,15 +294,17 @@ class DashboardController extends Controller ...@@ -292,15 +294,17 @@ class DashboardController extends Controller
->where('tm_phase', $request->phase) ->where('tm_phase', $request->phase)
->first(); ->first();
if($checkTimesheetDetail)
{
//update hours to null
$valuehour = $day; $valuehour = $day;
if($valuehour == null) if($valuehour == null)
{ {
$valuehour = 0; $valuehour = 0;
} }
if($checkTimesheetDetail)
{
//update hours to null
$checkTimesheetDetail->td_hours = $valuehour; $checkTimesheetDetail->td_hours = $valuehour;
$checkTimesheetDetail->update(); $checkTimesheetDetail->update();
...@@ -321,7 +325,7 @@ class DashboardController extends Controller ...@@ -321,7 +325,7 @@ class DashboardController extends Controller
$project = Project::where('id', $projectid)->first(); $project = Project::where('id', $projectid)->first();
$tmdetail->td_project_name = $project->p_project_description; $tmdetail->td_project_name = $project->p_project_description;
$tmdetail->td_hours = $day; $tmdetail->td_hours = $valuehour;
$tmdetail->save(); $tmdetail->save();
//$tmdetail -> kjhdiwhdf; //$tmdetail -> kjhdiwhdf;
...@@ -343,9 +347,10 @@ class DashboardController extends Controller ...@@ -343,9 +347,10 @@ class DashboardController extends Controller
->where('tm_phase', $request->phase) ->where('tm_phase', $request->phase)
->sum('td_hours'); ->sum('td_hours');
// dd($sumdetailhour); // dd($sumdetailhour);
// checktotalhours
$checktotalhours = Ts_master::where('id', $tmasterid)->first(); $checktotalhours = Ts_master::where('id', $tmasterid)->first();
$checktotalhours->where('tm_chargeable_hrs', $sumdetailhour); $checktotalhours->tm_chargeable_hrs = $sumdetailhour;
$checktotalhours->update(); $checktotalhours->update();
// return redirect::to('mobile/profile'); // return redirect::to('mobile/profile');
......
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