Commit c4357f33 by Azhan Hannan

integration chargeable overheadform

parent 7e31ead9
...@@ -173,14 +173,13 @@ input[type=number] { ...@@ -173,14 +173,13 @@ input[type=number] {
$total += data_get($valuehour,'td_hours'); $total += data_get($valuehour,'td_hours');
} }
?> ?>
@if(data_get($value,'attendance_status') == 1) @if(data_get($value,'attendance_status') == 1)
<td style="width: 5%;"> <td style="width: 5%;">
<input type="text" onkeypress="onlynumber(event)" id="hour[{{$project['td_project']}}][{{$day}}]" name="hour[{{$project['td_project']}}][{{$day}}]" value="@if($valuehour){{$valuehour->td_hours}}@else @endif" min="0" max="24" style="padding:2px;margin:unset" onchange="limiter(this,'{{ $project['td_project'] }}');"> <input type="text" onkeypress="onlynumber(event)" id="hour[{{$project['td_project']}}][{{$day}}]" name="hour[{{$project['td_project']}}][{{$day}}]" value="@if($valuehour){{data_get($valuehour,'td_hours')}}@else @endif" min="0" max="24" style="padding:2px;margin:unset" onchange="limiter(this,'{{ $project['td_project'] }}');">
</td> </td>
@else @else
<td style="width: 5%; background-color: #DCDCDC;"> <td style="width: 5%; background-color: #DCDCDC;">
<input type="text" onkeypress="onlynumber(event)" id="hour[{{$project['td_project']}}][{{$day}}]" name="hour[{{$project['td_project']}}][{{$day}}]" value="@if($valuehour){{$valuehour->td_hours}}@else @endif" min="0" max="24" style="padding:2px;margin:unset;background-color: #DCDCDC;" onchange="limiter(this,'{{ $project['td_project'] }}');"> <input type="text" onkeypress="onlynumber(event)" id="hour[{{$project['td_project']}}][{{$day}}]" name="hour[{{$project['td_project']}}][{{$day}}]" value="@if($valuehour){{data_get($valuehour,'td_hours')}}@else @endif" min="0" max="24" style="padding:2px;margin:unset;background-color: #DCDCDC;" onchange="limiter(this,'{{ $project['td_project'] }}');">
</td> </td>
@endif @endif
@endforeach @endforeach
......
...@@ -195,7 +195,7 @@ class FormController extends Controller ...@@ -195,7 +195,7 @@ class FormController extends Controller
} }
} }
// dd($dt); // dd($dt);kb
// echo $dt->toDateTimeString(); // echo $dt->toDateTimeString();
$lat = LAttendance::where('staff_id', $userId) $lat = LAttendance::where('staff_id', $userId)
...@@ -839,7 +839,25 @@ class FormController extends Controller ...@@ -839,7 +839,25 @@ class FormController extends Controller
else else
{ {
$hour = null; $hour = null;
$fk_tm_id = null; // $fk_tm_id = null;
$check = new Ts_master;
$check->tm_staff_id = $userId;
$check->tm_year = $year;
$check->tm_month = $month;
$check->tm_phase = $phase;
$check->tm_timesheet_master_sts = 1;
$check->updated_by = $userId;
$check->save();
$checkoverhead = Ts_master::where('tm_staff_id', $userId)
->where('tm_year', $year)
->where('tm_month', $month)
->where('tm_phase', $phase)
->first();
$fk_tm_id = $checkoverhead->id;
// dd($fk_tm_id);
} }
// dd($checkoverhead->id); // dd($checkoverhead->id);
...@@ -869,6 +887,180 @@ class FormController extends Controller ...@@ -869,6 +887,180 @@ class FormController extends Controller
// $lat = []; // $lat = [];
// dd($lat); // dd($lat);
$leave = $lat->where('attendance_status', 2);
// dd($checklat);
$publichol = 6;
$mc = 8;
$el = 10;
$al = 7;
if (count($leave) > 0) {
foreach ($leave as $key => $value)
{
$leavetype = data_get($value,'jenis_cuti');
if (data_get($value,'jenis_cuti') == 'MC') {
$checktdetailmc = Ts_detail::where('td_date', data_get($value,'DATE'))
->where('tm_staff_id', data_get($value,'staff_id'))
->where('fk_o_id', $mc)
->where('fk_tm_id', $fk_tm_id)
->first();
if($checktdetailmc)
{
}
else
{
//create baru
$mcdetail = new Ts_detail;
$mcdetail->td_date = data_get($value,'DATE');
$mcdetail->fk_o_id = $mc;
$mcdetail->fk_tm_id = $fk_tm_id;
$mcdetail->tm_staff_id = $userId;
$mcdetail->tm_month = $month;
$mcdetail->tm_year = $year;
$mcdetail->tm_phase = $phase;
$mcdetail->td_project_type = 3;
$mcdetail->updated_by = $userId;
$project = Overhead::where('id', $mc)
->first();
$mcdetail->td_overhead_desc = $project->o_overhead_desc;
$mcdetail->td_overhead_note = 'Cuti Sakit';
$mcdetail->td_hours = 8;
$mcdetail->td_timesheet_sts = 1;
$mcdetail->save();
}
}
else if (data_get($value,'jenis_cuti') == 'EL')
{
$checktdetailel = Ts_detail::where('td_date', data_get($value,'DATE'))
->where('tm_staff_id', data_get($value,'staff_id'))
->where('fk_o_id', $el)
->where('fk_tm_id', $fk_tm_id)
->first();
if($checktdetailel)
{
}
else
{
//create baru
$eldetail = new Ts_detail;
$eldetail->td_date = data_get($value,'DATE');
$eldetail->fk_o_id = $el;
$eldetail->fk_tm_id = $fk_tm_id;
$eldetail->tm_staff_id = $userId;
$eldetail->tm_month = $month;
$eldetail->tm_year = $year;
$eldetail->tm_phase = $phase;
$eldetail->td_project_type = 3;
$eldetail->updated_by = $userId;
$project = Overhead::where('id', $el)
->first();
$eldetail->td_overhead_desc = $project->o_overhead_desc;
$eldetail->td_overhead_note = 'Cuti Kecemasan';
$eldetail->td_hours = 8;
$eldetail->td_timesheet_sts = 1;
$eldetail->save();
}
}
}
}
$halfday = $lat->where('attendance_status', 1)->whereIn('jenis_cuti', ['AL(m)','AL (e)']);
// dd($halfday);
if (count($halfday) > 0) {
foreach ($halfday as $key => $value) {
if (data_get($value,'jenis_cuti') == 'AL(m)')
{
$checktdetailal = Ts_detail::where('td_date', data_get($value,'DATE'))
->where('tm_staff_id', data_get($value,'staff_id'))
->where('fk_o_id', $al)
->where('fk_tm_id', $fk_tm_id)
->first();
if($checktdetailal)
{
}
else
{
//create baru
$aldetail = new Ts_detail;
$aldetail->td_date = data_get($value,'DATE');
$aldetail->fk_o_id = $al;
$aldetail->fk_tm_id = $fk_tm_id;
$aldetail->tm_staff_id = $userId;
$aldetail->tm_month = $month;
$aldetail->tm_year = $year;
$aldetail->tm_phase = $phase;
$aldetail->td_project_type = 3;
$aldetail->updated_by = $userId;
$project = Overhead::where('id', $al)
->first();
$aldetail->td_overhead_desc = $project->o_overhead_desc;
$aldetail->td_overhead_note = 'Cuti Separuh Hari (Pagi)';
$aldetail->td_hours = 4;
$aldetail->td_timesheet_sts = 1;
$aldetail->save();
}
}
else if (data_get($value,'jenis_cuti') == 'AL (e)')
{
$checktdetailal = Ts_detail::where('td_date', data_get($value,'DATE'))
->where('tm_staff_id', data_get($value,'staff_id'))
->where('fk_o_id', $al)
->where('fk_tm_id', $fk_tm_id)
->first();
if($checktdetailal)
{
}
else
{
//create baru
$aldetail = new Ts_detail;
$aldetail->td_date = data_get($value,'DATE');
$aldetail->fk_o_id = $al;
$aldetail->fk_tm_id = $fk_tm_id;
$aldetail->tm_staff_id = $userId;
$aldetail->tm_month = $month;
$aldetail->tm_year = $year;
$aldetail->tm_phase = $phase;
$aldetail->td_project_type = 3;
$aldetail->updated_by = $userId;
$project = Overhead::where('id', $al)
->first();
$aldetail->td_overhead_desc = $project->o_overhead_desc;
$aldetail->td_overhead_note = 'Cuti Separuh Hari (Petang)';
$aldetail->td_hours = 4;
$aldetail->td_timesheet_sts = 1;
$aldetail->save();
}
}
}
}
if($fk_tm_id)
{
$hour = Ts_detail::where('fk_tm_id',$checkoverhead->id)
->where('td_project_type', 3)
->get();
}
else
{
$hour = null;
$fk_tm_id = null;
}
return view('timesheet::form.overheadForm', compact('checkoverhead','projectlist','userId','month','phase','daymonth','year', 'hour', 'project', 'fk_tm_id', 'strdays', 'lat')); return view('timesheet::form.overheadForm', compact('checkoverhead','projectlist','userId','month','phase','daymonth','year', 'hour', 'project', 'fk_tm_id', 'strdays', 'lat'));
} }
......
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