Commit 26191784 by Azhan Hannan

update cuti umum daytype 3

parent 8f726ed6
...@@ -1382,6 +1382,74 @@ class FormController extends Controller ...@@ -1382,6 +1382,74 @@ class FormController extends Controller
} }
} }
$cutiumum = $lat->where('day_type', 3);
if (count($cutiumum) > 0) {
foreach ($cutiumum as $key => $value) {
$checktdetailph = Ts_detail::where('td_date', data_get($value,'DATE'))
->where('tm_staff_id', data_get($value,'staff_id'))
->where('fk_o_id', $publichol)
->where('fk_tm_id', $fk_tm_id)
->first();
if($checktdetailph)
{
}
else
{
//create baru
$pbdetail = new Ts_detail;
$pbdetail->td_date = data_get($value,'DATE');
$pbdetail->fk_o_id = $publichol;
$pbdetail->fk_tm_id = $fk_tm_id;
$pbdetail->tm_staff_id = $userId;
$pbdetail->tm_month = $month;
$pbdetail->tm_year = $year;
$pbdetail->tm_phase = $phase;
$pbdetail->td_project_type = 3;
$pbdetail->updated_by = $userId;
$project = Overhead::where('id', $publichol)
->first();
$pbdetail->td_overhead_desc = $project->o_overhead_desc;
$pbdetail->td_overhead_note = 'Public Holiday';
$pbdetail->td_hours = 8;
$pbdetail->td_timesheet_sts = 1;
$pbdetail->save();
$checktpph = Tproject::where('fk_tm_id', $fk_tm_id)
->where('fk_o_id', $publichol)
->first();
if ($checktpph)
{
}
else
{
$tpph = new Tproject;
$tpph->staffid = $userId;
$tpph->fk_o_id = $publichol;
$tpph->fk_tm_id = $fk_tm_id;
$tpph->tp_project_type = 3;
$tpph->tp_year = $year;
$tpph->tp_month = $month;
$tpph->tp_phase = $phase;
$project = Overhead::where('id', $publichol)
->first();
$tpph->tp_project_name = $project->o_overhead_desc;
$tpph->tp_hours = 8;
$tpph->tp_timesheet_sts = 1;
$tpph->tp_pm = data_get($user,'penyokong');
$tpph->tp_pd = data_get($user,'pelulus');
$tpph->save();
}
}
}
}
if($fk_tm_id) if($fk_tm_id)
{ {
$hour = Ts_detail::where('fk_tm_id',$checkoverhead->id) $hour = Ts_detail::where('fk_tm_id',$checkoverhead->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