Commit 6d565adf by Azhan Hannan

integration overhead form, public holiday

parent c4357f33
...@@ -928,7 +928,7 @@ class FormController extends Controller ...@@ -928,7 +928,7 @@ class FormController extends Controller
->first(); ->first();
$mcdetail->td_overhead_desc = $project->o_overhead_desc; $mcdetail->td_overhead_desc = $project->o_overhead_desc;
$mcdetail->td_overhead_note = 'Cuti Sakit'; $mcdetail->td_overhead_note = 'Medical Leave';
$mcdetail->td_hours = 8; $mcdetail->td_hours = 8;
$mcdetail->td_timesheet_sts = 1; $mcdetail->td_timesheet_sts = 1;
$mcdetail->save(); $mcdetail->save();
...@@ -963,7 +963,7 @@ class FormController extends Controller ...@@ -963,7 +963,7 @@ class FormController extends Controller
->first(); ->first();
$eldetail->td_overhead_desc = $project->o_overhead_desc; $eldetail->td_overhead_desc = $project->o_overhead_desc;
$eldetail->td_overhead_note = 'Cuti Kecemasan'; $eldetail->td_overhead_note = 'Emergency Leave';
$eldetail->td_hours = 8; $eldetail->td_hours = 8;
$eldetail->td_timesheet_sts = 1; $eldetail->td_timesheet_sts = 1;
$eldetail->save(); $eldetail->save();
...@@ -978,13 +978,13 @@ class FormController extends Controller ...@@ -978,13 +978,13 @@ class FormController extends Controller
foreach ($halfday as $key => $value) { foreach ($halfday as $key => $value) {
if (data_get($value,'jenis_cuti') == 'AL(m)') if (data_get($value,'jenis_cuti') == 'AL(m)')
{ {
$checktdetailal = Ts_detail::where('td_date', data_get($value,'DATE')) $checktdetailhd = Ts_detail::where('td_date', data_get($value,'DATE'))
->where('tm_staff_id', data_get($value,'staff_id')) ->where('tm_staff_id', data_get($value,'staff_id'))
->where('fk_o_id', $al) ->where('fk_o_id', $al)
->where('fk_tm_id', $fk_tm_id) ->where('fk_tm_id', $fk_tm_id)
->first(); ->first();
if($checktdetailal) if($checktdetailhd)
{ {
} }
else else
...@@ -1005,7 +1005,7 @@ class FormController extends Controller ...@@ -1005,7 +1005,7 @@ class FormController extends Controller
->first(); ->first();
$aldetail->td_overhead_desc = $project->o_overhead_desc; $aldetail->td_overhead_desc = $project->o_overhead_desc;
$aldetail->td_overhead_note = 'Cuti Separuh Hari (Pagi)'; $aldetail->td_overhead_note = 'Halfday Leave (Morning)';
$aldetail->td_hours = 4; $aldetail->td_hours = 4;
$aldetail->td_timesheet_sts = 1; $aldetail->td_timesheet_sts = 1;
$aldetail->save(); $aldetail->save();
...@@ -1013,13 +1013,13 @@ class FormController extends Controller ...@@ -1013,13 +1013,13 @@ class FormController extends Controller
} }
else if (data_get($value,'jenis_cuti') == 'AL (e)') else if (data_get($value,'jenis_cuti') == 'AL (e)')
{ {
$checktdetailal = Ts_detail::where('td_date', data_get($value,'DATE')) $checktdetailhd = Ts_detail::where('td_date', data_get($value,'DATE'))
->where('tm_staff_id', data_get($value,'staff_id')) ->where('tm_staff_id', data_get($value,'staff_id'))
->where('fk_o_id', $al) ->where('fk_o_id', $al)
->where('fk_tm_id', $fk_tm_id) ->where('fk_tm_id', $fk_tm_id)
->first(); ->first();
if($checktdetailal) if($checktdetailhd)
{ {
} }
else else
...@@ -1040,7 +1040,7 @@ class FormController extends Controller ...@@ -1040,7 +1040,7 @@ class FormController extends Controller
->first(); ->first();
$aldetail->td_overhead_desc = $project->o_overhead_desc; $aldetail->td_overhead_desc = $project->o_overhead_desc;
$aldetail->td_overhead_note = 'Cuti Separuh Hari (Petang)'; $aldetail->td_overhead_note = 'Halfday Leave (Evening)';
$aldetail->td_hours = 4; $aldetail->td_hours = 4;
$aldetail->td_timesheet_sts = 1; $aldetail->td_timesheet_sts = 1;
$aldetail->save(); $aldetail->save();
...@@ -1049,6 +1049,47 @@ class FormController extends Controller ...@@ -1049,6 +1049,47 @@ class FormController extends Controller
} }
} }
$pubhol = $lat->where('attendance_status', 4);
// dd($pubhol);
if (count($pubhol) > 0) {
foreach ($pubhol 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();
}
}
}
if($fk_tm_id) if($fk_tm_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