Commit e750f24c by hannan

reset to fezrul changes

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