Commit d6c3e86c by Azhan Hannan

tkde detail project untuk PM nak refer

Expectation:
-Tepek detail timesheet  ni ke dalam SCREEN VERIFY/PROJECT
parent 7334001a
...@@ -488,9 +488,141 @@ class DashboardController extends Controller ...@@ -488,9 +488,141 @@ class DashboardController extends Controller
->first(); ->first();
// dd($profile); // dd($profile);
// $year = date('Y');
$phase = $profile->tp_phase;
$month = $profile->tp_month;
$year = $profile->tp_year;
$daymonth=cal_days_in_month(CAL_GREGORIAN,$month,$year);
$myDate = $month.'/'.'1'.'/'.$year;
$date = Carbon::createFromFormat('m/d/Y', $myDate);
$staff = VwViewer::where('STAFF_ID', $profile->staffid)
->first();
$strMonth = $date->format('F');
$strdays = [];
for ($i=0; $i < $daymonth; $i++) {
$tempdate = $year.'-'.sprintf('%02d', $month).'-'.sprintf('%02d', $i+1);
$strday = Carbon::createFromFormat('Y-m-d', $tempdate)->format('l');
$strdays[$i] = substr($strday, 0, 3);
}
// dd($staff);
$chargeable = 1;
$overhead = 3;
$check = Ts_master::where('tm_staff_id', $profile->staffid)
->where('tm_year', $year)
->where('tm_month', $month)
->where('tm_phase', $phase)
->with('attachement')
->first();
$chargeableproject = Tproject::where('fk_tm_id', data_get($check,'id'))
->where('tp_project_type', 1)
->with('project')
->get();
$chargeablelist = [];
$overheadlist = [];
foreach($chargeableproject as $key => $value) {
$chargeablelist[] = [
'pid' => $value->td_project,
'pcode' => $value->project->p_project_code,
'pname' => $value->project->p_project_description,
];
}
if($check)
{
$chargehour = Ts_detail::where('fk_tm_id',$check->id)
->where('td_project_type', $chargeable)
// ->where('td_hours', '!=', 0)
->get();
$overheadhour = Ts_detail::where('fk_tm_id',$check->id)
->where('td_project_type', $overhead)
->where('td_hours', '!=', 0)
->get();
$tempOverhead[0] = "";
$tempOverheadid[0] = 0;
if(isset($overheadhour[0]))
{
// dd('sini ke?');
$tempOverhead[0] = $overheadhour[0]->td_overhead_desc;
$tempOverheadid[0] = $overheadhour[0]->fk_o_id;
$j = 0;
for($i = 0; $i < count($overheadhour); $i++)
{
if ($tempOverhead[$j] == $overheadhour[$i]->td_overhead_desc) {
}
else
{
$j++;
$tempOverhead[$j] = $overheadhour[$i]->td_overhead_desc;
$tempOverheadid[$j] = $overheadhour[$i]->fk_o_id;
}
}
foreach ($tempOverhead as $key => $value) {
$overheadlist[] = [
'pid' => $tempOverheadid[$key],
'pname' => $tempOverhead[$key],
];
}
}
else
{
// dd('ke sini?');
}
$totalchargehrs = $check->tm_chargeable_hrs;
$totaloverheadhrs = $check->tm_overhead_hrs;
$notes = Ts_detail::where('tm_year', $year)
->where('tm_month', $month)
->where('tm_phase', $phase)
->where('fk_tm_id', $check->id)
->where('tm_staff_id', $profile->staffid)
->where('td_project_type', $overhead)
->whereNotNull('td_hours')
->orderby('td_date')
->get();
}
else
{
$chargehour = null;
$overheadhour = null;
$totalchargehrs = null;
$totaloverheadhrs = null;
$notes = null;
$check = null;
}
$pm = Users::find(Auth::id()); $pm = Users::find(Auth::id());
return view('timesheet::dashboard.projectaction', compact('profile', 'pm', 'page')); return view('timesheet::dashboard.projectaction', compact('profile', 'pm', 'page', 'staff', 'strMonth', 'year', 'month', 'phase', 'strdays', 'chargeablelist', 'chargehour', 'totalchargehrs'));
} }
public function verify(Request $request) public function verify(Request $request)
...@@ -900,7 +1032,6 @@ class DashboardController extends Controller ...@@ -900,7 +1032,6 @@ class DashboardController extends Controller
$strMonth = $date->format('F'); $strMonth = $date->format('F');
$chargeable = 1; $chargeable = 1;
$nonchargeable = 2;
$overhead = 3; $overhead = 3;
$check = Ts_master::where('tm_staff_id', $user->staff_id) $check = Ts_master::where('tm_staff_id', $user->staff_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