Commit 6f0f74b8 by Azhan Hannan

HOD PM verify Project chargeable PM

parent cd819ede
......@@ -1005,8 +1005,10 @@ class DashboardController extends Controller
public function tsubmit(Request $request)
{
$roleid = auth()->user()->roles['0']->id;
$user = Staff_info::where('fk_users', Auth::id())->first();
// dd($user);
$user = Staff_info::where('fk_users', Auth::id())
->with('penyokongpm')
->first();
// dd(data_get($user,'penyokongpm.staff_id'));
$checknotes = Ts_detail::where('fk_tm_id', $request->tid)
->whereNotNull('td_hours')
......@@ -1040,6 +1042,7 @@ class DashboardController extends Controller
Tproject::where('fk_tm_id', $request->tid)
->update(['tp_timesheet_sts' => 2]);
if( $roleid == '8' )
{
$checkpm = Tproject::where('tp_project_type', 3)
......@@ -1050,24 +1053,27 @@ class DashboardController extends Controller
{
Ts_detail::where('fk_tm_id', $request->tid)
->where('td_project_type', 3)
->update([ 'td_timesheet_sts' => 3 ]);
->update(['td_timesheet_sts' => 2 ]);
Tproject::where('fk_tm_id', $request->tid)
->where('tp_project_type', 3)
->update([ 'tp_timesheet_sts' => 3] );
->update(['tp_timesheet_sts' => 2] );
}
else
{
Ts_master::where('id', $request->tid)
->update([ 'tm_timesheet_master_sts' => 3 ]);
->update([ 'tm_timesheet_master_sts' => 2 ]);
Ts_detail::where('fk_tm_id', $request->tid)
->where('td_project_type', 3)
->update([ 'td_timesheet_sts' => 3 ]);
->update([ 'td_timesheet_sts' => 2 ]);
Tproject::where('fk_tm_id', $request->tid)
->where('tp_project_type', 3)
->update([ 'tp_timesheet_sts' => 3] );
->update([
'tp_timesheet_sts' => 2,
'tp_pm' => data_get($user,'penyokongpm.staff_id')
] );
}
......
......@@ -187,6 +187,9 @@ class FormController extends Controller
$userId = users::find(Auth::id())
->u_staffID;
$user = Staff_info::where('fk_users', Auth::id())
->with('penyokongpm')
->first();
$check = Ts_master::where('tm_staff_id', $userId)
->where('tm_year', $request->year)
......@@ -279,6 +282,7 @@ class FormController extends Controller
if ($checktproject) {
$checktproject->tp_hours = $checkhours->sum('td_hours');
$checktproject->tp_pm = data_get($user, 'penyokongpm.staff_id');
$checktproject->save();
}
else
......@@ -297,7 +301,7 @@ class FormController extends Controller
$tpdetail->tp_project_name = $project->p_project_description;
$tpdetail->tp_hours = $checkhours->sum('td_hours');
$tpdetail->tp_pm = $project->p_project_task_team;
$tpdetail->tp_pm = data_get($user, 'penyokongpm.staff_id');
$tpdetail->tp_pd = $project->p_project_director;
$tpdetail->tp_timesheet_sts = 1;
$tpdetail->updated_by = $userId;
......
......@@ -28,6 +28,11 @@ class Staff_info extends Model
return $this->hasOne('Portal\Timesheet\Model\Department','id','fk_lkp_department');
}
public function penyokongpm()
{
return $this->hasOne('Portal\Timesheet\Model\Staff_info','id','penyokong');
}
// public function project_code()
// {
// return $this->hasMany('Portal\Timesheet\Model\Ts_detail','td_project','id');
......
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