Commit 73f57338 by Azhan Hannan

Integration → tproject tak added dalam table. tapi ada ts_detail

parent 90c767b3
...@@ -110,7 +110,6 @@ ...@@ -110,7 +110,6 @@
@if(data_get($chargeable, 'tp_timesheet_sts') == 3) @if(data_get($chargeable, 'tp_timesheet_sts') == 3)
<button class="center aligned ui green icon button" onclick="window.location.href='{{ route('timesheet::dashboard.approvalaction', ['tpid'=>data_get($chargeable, 'id'), 'phase'=>data_get($chargeable, 'tp_phase'), 'month'=>data_get($chargeable, 'tp_month'), 'year'=>data_get($chargeable, 'tp_year'), 'page'=>$page ]) }}';">Approval</button> <button class="center aligned ui green icon button" onclick="window.location.href='{{ route('timesheet::dashboard.approvalaction', ['tpid'=>data_get($chargeable, 'id'), 'phase'=>data_get($chargeable, 'tp_phase'), 'month'=>data_get($chargeable, 'tp_month'), 'year'=>data_get($chargeable, 'tp_year'), 'page'=>$page ]) }}';">Approval</button>
@else @else
<!-- <button class="center aligned ui green icon button disabled">Approval</button> -->
<a class="center aligned ui blue icon button" href="{{ route('timesheet::dashboard.timesheetViewer', [ 'user'=>data_get($staff,'staffid') ,'phase' => data_get($staff,'phase'), 'month' => data_get($staff,'month'), 'year' => data_get($staff,'year')]) }}" target='_blank'>View</a> <a class="center aligned ui blue icon button" href="{{ route('timesheet::dashboard.timesheetViewer', [ 'user'=>data_get($staff,'staffid') ,'phase' => data_get($staff,'phase'), 'month' => data_get($staff,'month'), 'year' => data_get($staff,'year')]) }}" target='_blank'>View</a>
@endif @endif
</td> </td>
...@@ -139,7 +138,6 @@ ...@@ -139,7 +138,6 @@
@if(data_get($staff,'tmid') == data_get($overhead,'fk_tm_id')) @if(data_get($staff,'tmid') == data_get($overhead,'fk_tm_id'))
<tr> <tr>
<td style="width: 25%;" class="single line"> <td style="width: 25%;" class="single line">
<!-- {{data_get($overhead,'id')}} -->
@if(data_get($overhead,'tp_timesheet_sts') == 3) @if(data_get($overhead,'tp_timesheet_sts') == 3)
<div class="ui toggle checkbox"> <div class="ui toggle checkbox">
<input type="checkbox" name="pid[{{data_get($overhead,'id')}}]" value="{{data_get($overhead,'id')}}"> <input type="checkbox" name="pid[{{data_get($overhead,'id')}}]" value="{{data_get($overhead,'id')}}">
...@@ -169,7 +167,6 @@ ...@@ -169,7 +167,6 @@
@if(data_get($overhead, 'tp_timesheet_sts') == 3) @if(data_get($overhead, 'tp_timesheet_sts') == 3)
<button type="button" class="center aligned ui green icon button" onclick="window.location.href='{{ route('timesheet::dashboard.approvalaction', ['tpid'=>data_get($overhead, 'id'), 'phase'=>data_get($overhead, 'tp_phase'), 'month'=>data_get($overhead, 'tp_month'), 'year'=>data_get($overhead, 'tp_year'), 'page'=>$page ]) }}';">Approval</button> <button type="button" class="center aligned ui green icon button" onclick="window.location.href='{{ route('timesheet::dashboard.approvalaction', ['tpid'=>data_get($overhead, 'id'), 'phase'=>data_get($overhead, 'tp_phase'), 'month'=>data_get($overhead, 'tp_month'), 'year'=>data_get($overhead, 'tp_year'), 'page'=>$page ]) }}';">Approval</button>
@else @else
<!-- <button type="button" class="center aligned ui green icon button disabled">Approval</button> -->
<a href="{{ route('timesheet::dashboard.timesheetViewer', [ 'user'=>data_get($staff,'staffid') ,'phase' => data_get($staff,'phase'), 'month' => data_get($staff,'month'), 'year' => data_get($staff,'year')]) }}" type="button" class="center aligned ui blue icon button" target='_blank'>View</a> <a href="{{ route('timesheet::dashboard.timesheetViewer', [ 'user'=>data_get($staff,'staffid') ,'phase' => data_get($staff,'phase'), 'month' => data_get($staff,'month'), 'year' => data_get($staff,'year')]) }}" type="button" class="center aligned ui blue icon button" target='_blank'>View</a>
@endif @endif
</td> </td>
......
...@@ -10,12 +10,9 @@ ...@@ -10,12 +10,9 @@
<div class="ui styled fluid accordion"> <div class="ui styled fluid accordion">
<?php $page = 1; ?> <?php $page = 1; ?>
@foreach($profile as $key => $staff) @foreach($profile as $key => $staff)
@if(data_get($staff,'status') == 2 || data_get($staff,'status') == 3) @if(data_get($staff,'status') == 2 || data_get($staff,'status') == 3 || data_get($staff,'status') == 6 )
<?php <?php
// dd($details);
// $detail = $details->where('staffid', $staff->staff_id)->where('fk_tm_id', $staff->tmid)->where('tp_timesheet_sts', 2);
$detail = $details->where('staffid', $staff->staff_id)->where('fk_tm_id', $staff->tmid)->where('tp_project_type', 3)->whereIn('tp_timesheet_sts', [2,3,6]); $detail = $details->where('staffid', $staff->staff_id)->where('fk_tm_id', $staff->tmid)->where('tp_project_type', 3)->whereIn('tp_timesheet_sts', [2,3,6]);
// dump($detail);
$ts = $checkts->where('tm_staff_id', $staff->staff_id); $ts = $checkts->where('tm_staff_id', $staff->staff_id);
?> ?>
...@@ -31,14 +28,12 @@ ...@@ -31,14 +28,12 @@
<th style="width: 15%;" class="center aligned"> <th style="width: 15%;" class="center aligned">
<?php <?php
$overheadverified = 0; $overheadverified = 0;
// dd($details); foreach ($details as $key => $value)
foreach ($details as $key => $value) { {
if(data_get($value,'staffid') == data_get($staff,'staff_id') && data_get($value,'tp_timesheet_sts') == 3) if(data_get($value,'staffid') == data_get($staff,'staff_id') && data_get($value,'tp_timesheet_sts') == 3)
$overheadverified += 1; $overheadverified += 1;
} }
// dump($overheadverified);
// dump(data_get($staff,'status'));
?> ?>
@if($staff->status == 7) <i class="red attention icon"></i>Rejected by HR @if($staff->status == 7) <i class="red attention icon"></i>Rejected by HR
...@@ -74,6 +69,7 @@ ...@@ -74,6 +69,7 @@
</thead> </thead>
@foreach($detail as $key => $tp) @foreach($detail as $key => $tp)
@if(data_get($staff, 'tmid') == data_get($tp, 'fk_tm_id')) @if(data_get($staff, 'tmid') == data_get($tp, 'fk_tm_id'))
<tr> <tr>
<td style="width: 25;">{{data_get($tp, 'tp_project_name')}}</td> <td style="width: 25;">{{data_get($tp, 'tp_project_name')}}</td>
...@@ -96,7 +92,6 @@ ...@@ -96,7 +92,6 @@
@if(data_get($tp, 'tp_timesheet_sts') == 2) @if(data_get($tp, 'tp_timesheet_sts') == 2)
<button class="center aligned ui green icon button" onclick="window.location.href='{{route('timesheet::dashboard.revaction', ['tpid'=>data_get($tp, 'id'), 'phase'=>data_get($tp,'tp_phase'), 'month'=>data_get($tp,'tp_month'), 'year'=>data_get($tp,'tp_year'), 'page'=>$page ]) }}';">Verify | Reject</button> <button class="center aligned ui green icon button" onclick="window.location.href='{{route('timesheet::dashboard.revaction', ['tpid'=>data_get($tp, 'id'), 'phase'=>data_get($tp,'tp_phase'), 'month'=>data_get($tp,'tp_month'), 'year'=>data_get($tp,'tp_year'), 'page'=>$page ]) }}';">Verify | Reject</button>
@else @else
<!-- <button class="center aligned ui green icon button disabled">Verify | Reject</button> -->
<a href="{{ route('timesheet::dashboard.timesheetViewer', [ 'user'=>data_get($staff,'staff_id') ,'phase' => data_get($staff,'tm_phase'), 'month' => data_get($staff,'tm_month'), 'year' => data_get($staff,'tm_year') ]) }}" class="center aligned ui blue icon button" target='_blank'>View</a> <a href="{{ route('timesheet::dashboard.timesheetViewer', [ 'user'=>data_get($staff,'staff_id') ,'phase' => data_get($staff,'tm_phase'), 'month' => data_get($staff,'tm_month'), 'year' => data_get($staff,'tm_year') ]) }}" class="center aligned ui blue icon button" target='_blank'>View</a>
@endif @endif
</td> </td>
......
...@@ -772,9 +772,15 @@ class FormController extends Controller ...@@ -772,9 +772,15 @@ class FormController extends Controller
public function overheadForm(Request $request) public function overheadForm(Request $request)
{ {
$userId = users::find(Auth::id()) $userId = Users::find(Auth::id())
->u_staffID; ->u_staffID;
$user = Staff_info::where('id', Auth::id())
->with('penyokongpm')
->first();
// dd(data_get($user,'penyokong'));
$project = Overhead::where('o_overhead_sts',1) $project = Overhead::where('o_overhead_sts',1)
->get(); ->get();
...@@ -900,7 +906,8 @@ class FormController extends Controller ...@@ -900,7 +906,8 @@ class FormController extends Controller
{ {
$leavetype = data_get($value,'jenis_cuti'); $leavetype = data_get($value,'jenis_cuti');
if (data_get($value,'jenis_cuti') == 'MC') { if (data_get($value,'jenis_cuti') == 'MC')
{
$checktdetailmc = Ts_detail::where('td_date', data_get($value,'DATE')) $checktdetailmc = 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', $mc) ->where('fk_o_id', $mc)
...@@ -909,10 +916,37 @@ class FormController extends Controller ...@@ -909,10 +916,37 @@ class FormController extends Controller
if($checktdetailmc) if($checktdetailmc)
{ {
$checktpmc = Tproject::where('fk_tm_id', $fk_tm_id)
->where('fk_o_id', $mc)
->first();
if ($checktpmc)
{
}
else
{
$tpmc = new Tproject;
$tpmc->staffid = $userId;
$tpmc->fk_o_id = $mc;
$tpmc->fk_tm_id = $fk_tm_id;
$tpmc->tp_project_type = 3;
$tpmc->tp_year = $year;
$tpmc->tp_month = $month;
$tpmc->tp_phase = $phase;
$project = Overhead::where('id', $mc)
->first();
$tpmc->tp_project_name = $project->o_overhead_desc;
$tpmc->tp_hours = 8;
$tpmc->tp_timesheet_sts = 1;
$tpmc->tp_pm = data_get($user,'penyokong');
$tpmc->tp_pd = data_get($user,'pelulus');
$tpmc->save();
}
} }
else else
{ {
//create baru
$mcdetail = new Ts_detail; $mcdetail = new Ts_detail;
$mcdetail->td_date = data_get($value,'DATE'); $mcdetail->td_date = data_get($value,'DATE');
$mcdetail->fk_o_id = $mc; $mcdetail->fk_o_id = $mc;
...@@ -932,6 +966,35 @@ class FormController extends Controller ...@@ -932,6 +966,35 @@ class FormController extends Controller
$mcdetail->td_hours = 8; $mcdetail->td_hours = 8;
$mcdetail->td_timesheet_sts = 1; $mcdetail->td_timesheet_sts = 1;
$mcdetail->save(); $mcdetail->save();
$checktpmc = Tproject::where('fk_tm_id', $fk_tm_id)
->where('fk_o_id', $mc)
->first();
if ($checktpmc)
{
}
else
{
$tpmc = new Tproject;
$tpmc->staffid = $userId;
$tpmc->fk_o_id = $mc;
$tpmc->fk_tm_id = $fk_tm_id;
$tpmc->tp_project_type = 3;
$tpmc->tp_year = $year;
$tpmc->tp_month = $month;
$tpmc->tp_phase = $phase;
$project = Overhead::where('id', $mc)
->first();
$tpmc->tp_project_name = $project->o_overhead_desc;
$tpmc->tp_hours = 8;
$tpmc->tp_timesheet_sts = 1;
$tpmc->tp_pm = data_get($user,'penyokong');
$tpmc->tp_pd = data_get($user,'pelulus');
$tpmc->save();
}
} }
} }
else if (data_get($value,'jenis_cuti') == 'EL') else if (data_get($value,'jenis_cuti') == 'EL')
...@@ -944,6 +1007,34 @@ class FormController extends Controller ...@@ -944,6 +1007,34 @@ class FormController extends Controller
if($checktdetailel) if($checktdetailel)
{ {
$checktpel = Tproject::where('fk_tm_id', $fk_tm_id)
->where('fk_o_id', $el)
->first();
if ($checktpel)
{
}
else
{
$tpel = new Tproject;
$tpel->staffid = $userId;
$tpel->fk_o_id = $el;
$tpel->fk_tm_id = $fk_tm_id;
$tpel->tp_project_type = 3;
$tpel->tp_year = $year;
$tpel->tp_month = $month;
$tpel->tp_phase = $phase;
$project = Overhead::where('id', $el)
->first();
$tpel->tp_project_name = $project->o_overhead_desc;
$tpel->tp_hours = 8;
$tpel->tp_timesheet_sts = 1;
$tpel->tp_pm = data_get($user,'penyokong');
$tpel->tp_pd = data_get($user,'pelulus');
$tpel->save();
}
} }
else else
{ {
...@@ -967,6 +1058,35 @@ class FormController extends Controller ...@@ -967,6 +1058,35 @@ class FormController extends Controller
$eldetail->td_hours = 8; $eldetail->td_hours = 8;
$eldetail->td_timesheet_sts = 1; $eldetail->td_timesheet_sts = 1;
$eldetail->save(); $eldetail->save();
$checktpel = Tproject::where('fk_tm_id', $fk_tm_id)
->where('fk_o_id', $el)
->first();
if ($checktpel)
{
}
else
{
$tpel = new Tproject;
$tpel->staffid = $userId;
$tpel->fk_o_id = $el;
$tpel->fk_tm_id = $fk_tm_id;
$tpel->tp_project_type = 3;
$tpel->tp_year = $year;
$tpel->tp_month = $month;
$tpel->tp_phase = $phase;
$project = Overhead::where('id', $el)
->first();
$tpel->tp_project_name = $project->o_overhead_desc;
$tpel->tp_hours = 8;
$tpel->tp_timesheet_sts = 1;
$tpel->tp_pm = data_get($user,'penyokong');
$tpel->tp_pd = data_get($user,'pelulus');
$tpel->save();
}
} }
} }
else if (data_get($value,'jenis_cuti') == 'AL') else if (data_get($value,'jenis_cuti') == 'AL')
...@@ -979,6 +1099,34 @@ class FormController extends Controller ...@@ -979,6 +1099,34 @@ class FormController extends Controller
if($checktdetailal) if($checktdetailal)
{ {
$checktpal = Tproject::where('fk_tm_id', $fk_tm_id)
->where('fk_o_id', $al)
->first();
if ($checktpal)
{
}
else
{
$tpal = new Tproject;
$tpal->staffid = $userId;
$tpal->fk_o_id = $al;
$tpal->fk_tm_id = $fk_tm_id;
$tpal->tp_project_type = 3;
$tpal->tp_year = $year;
$tpal->tp_month = $month;
$tpal->tp_phase = $phase;
$project = Overhead::where('id', $al)
->first();
$tpal->tp_project_name = $project->o_overhead_desc;
$tpal->tp_hours = 8;
$tpal->tp_timesheet_sts = 1;
$tpal->tp_pm = data_get($user,'penyokong');
$tpal->tp_pd = data_get($user,'pelulus');
$tpal->save();
}
} }
else else
{ {
...@@ -1002,6 +1150,35 @@ class FormController extends Controller ...@@ -1002,6 +1150,35 @@ class FormController extends Controller
$aldetail->td_hours = 8; $aldetail->td_hours = 8;
$aldetail->td_timesheet_sts = 1; $aldetail->td_timesheet_sts = 1;
$aldetail->save(); $aldetail->save();
$checktpal = Tproject::where('fk_tm_id', $fk_tm_id)
->where('fk_o_id', $al)
->first();
if ($checktpal)
{
}
else
{
$tpal = new Tproject;
$tpal->staffid = $userId;
$tpal->fk_o_id = $al;
$tpal->fk_tm_id = $fk_tm_id;
$tpal->tp_project_type = 3;
$tpal->tp_year = $year;
$tpal->tp_month = $month;
$tpal->tp_phase = $phase;
$project = Overhead::where('id', $al)
->first();
$tpal->tp_project_name = $project->o_overhead_desc;
$tpal->tp_hours = 8;
$tpal->tp_timesheet_sts = 1;
$tpal->tp_pm = data_get($user,'penyokong');
$tpal->tp_pd = data_get($user,'pelulus');
$tpal->save();
}
} }
} }
} }
...@@ -1021,10 +1198,37 @@ class FormController extends Controller ...@@ -1021,10 +1198,37 @@ class FormController extends Controller
if($checktdetailhd) if($checktdetailhd)
{ {
$checktpal = Tproject::where('fk_tm_id', $fk_tm_id)
->where('fk_o_id', $al)
->first();
if ($checktpal)
{
}
else
{
$tpal = new Tproject;
$tpal->staffid = $userId;
$tpal->fk_o_id = $al;
$tpal->fk_tm_id = $fk_tm_id;
$tpal->tp_project_type = 3;
$tpal->tp_year = $year;
$tpal->tp_month = $month;
$tpal->tp_phase = $phase;
$project = Overhead::where('id', $al)
->first();
$tpal->tp_project_name = $project->o_overhead_desc;
$tpal->tp_hours = 4;
$tpal->tp_timesheet_sts = 1;
$tpal->tp_pm = data_get($user,'penyokong');
$tpal->tp_pd = data_get($user,'pelulus');
$tpal->save();
}
} }
else else
{ {
//create baru
$aldetail = new Ts_detail; $aldetail = new Ts_detail;
$aldetail->td_date = data_get($value,'DATE'); $aldetail->td_date = data_get($value,'DATE');
$aldetail->fk_o_id = $al; $aldetail->fk_o_id = $al;
...@@ -1044,6 +1248,35 @@ class FormController extends Controller ...@@ -1044,6 +1248,35 @@ class FormController extends Controller
$aldetail->td_hours = 4; $aldetail->td_hours = 4;
$aldetail->td_timesheet_sts = 1; $aldetail->td_timesheet_sts = 1;
$aldetail->save(); $aldetail->save();
$checktpal = Tproject::where('fk_tm_id', $fk_tm_id)
->where('fk_o_id', $al)
->first();
if ($checktpal)
{
}
else
{
$tpal = new Tproject;
$tpal->staffid = $userId;
$tpal->fk_o_id = $al;
$tpal->fk_tm_id = $fk_tm_id;
$tpal->tp_project_type = 3;
$tpal->tp_year = $year;
$tpal->tp_month = $month;
$tpal->tp_phase = $phase;
$project = Overhead::where('id', $al)
->first();
$tpal->tp_project_name = $project->o_overhead_desc;
$tpal->tp_hours = 4;
$tpal->tp_timesheet_sts = 1;
$tpal->tp_pm = data_get($user,'penyokong');
$tpal->tp_pd = data_get($user,'pelulus');
$tpal->save();
}
} }
} }
else if (data_get($value,'jenis_cuti') == 'AL (e)') else if (data_get($value,'jenis_cuti') == 'AL (e)')
...@@ -1056,6 +1289,34 @@ class FormController extends Controller ...@@ -1056,6 +1289,34 @@ class FormController extends Controller
if($checktdetailhd) if($checktdetailhd)
{ {
$checktpal = Tproject::where('fk_tm_id', $fk_tm_id)
->where('fk_o_id', $al)
->first();
if ($checktpal)
{
}
else
{
$tpal = new Tproject;
$tpal->staffid = $userId;
$tpal->fk_o_id = $al;
$tpal->fk_tm_id = $fk_tm_id;
$tpal->tp_project_type = 3;
$tpal->tp_year = $year;
$tpal->tp_month = $month;
$tpal->tp_phase = $phase;
$project = Overhead::where('id', $al)
->first();
$tpal->tp_project_name = $project->o_overhead_desc;
$tpal->tp_hours = 4;
$tpal->tp_timesheet_sts = 1;
$tpal->tp_pm = data_get($user,'penyokong');
$tpal->tp_pd = data_get($user,'pelulus');
$tpal->save();
}
} }
else else
{ {
...@@ -1079,6 +1340,35 @@ class FormController extends Controller ...@@ -1079,6 +1340,35 @@ class FormController extends Controller
$aldetail->td_hours = 4; $aldetail->td_hours = 4;
$aldetail->td_timesheet_sts = 1; $aldetail->td_timesheet_sts = 1;
$aldetail->save(); $aldetail->save();
$checktpal = Tproject::where('fk_tm_id', $fk_tm_id)
->where('fk_o_id', $al)
->first();
if ($checktpal)
{
}
else
{
$tpal = new Tproject;
$tpal->staffid = $userId;
$tpal->fk_o_id = $al;
$tpal->fk_tm_id = $fk_tm_id;
$tpal->tp_project_type = 3;
$tpal->tp_year = $year;
$tpal->tp_month = $month;
$tpal->tp_phase = $phase;
$project = Overhead::where('id', $al)
->first();
$tpal->tp_project_name = $project->o_overhead_desc;
$tpal->tp_hours = 4;
$tpal->tp_timesheet_sts = 1;
$tpal->tp_pm = data_get($user,'penyokong');
$tpal->tp_pd = data_get($user,'pelulus');
$tpal->save();
}
} }
} }
} }
...@@ -1087,7 +1377,8 @@ class FormController extends Controller ...@@ -1087,7 +1377,8 @@ class FormController extends Controller
$training = $lat->where('attendance_status', 3); $training = $lat->where('attendance_status', 3);
// dd($pubhol); // dd($pubhol);
if (count($training) > 0) { if (count($training) > 0) {
foreach ($training as $key => $value) { foreach ($training as $key => $value)
{
$checktdetailtr = Ts_detail::where('td_date', data_get($value,'DATE')) $checktdetailtr = 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'))
...@@ -1097,10 +1388,37 @@ class FormController extends Controller ...@@ -1097,10 +1388,37 @@ class FormController extends Controller
if($checktdetailtr) if($checktdetailtr)
{ {
$checktptr = Tproject::where('fk_tm_id', $fk_tm_id)
->where('fk_o_id', $tr)
->first();
if ($checktptr)
{
}
else
{
$tptr = new Tproject;
$tptr->staffid = $userId;
$tptr->fk_o_id = $tr;
$tptr->fk_tm_id = $fk_tm_id;
$tptr->tp_project_type = 3;
$tptr->tp_year = $year;
$tptr->tp_month = $month;
$tptr->tp_phase = $phase;
$project = Overhead::where('id', $tr)
->first();
$tptr->tp_project_name = $project->o_overhead_desc;
$tptr->tp_hours = 8;
$tptr->tp_timesheet_sts = 1;
$tptr->tp_pm = data_get($user,'penyokong');
$tptr->tp_pd = data_get($user,'pelulus');
$tptr->save();
}
} }
else else
{ {
//create baru
$trdetail = new Ts_detail; $trdetail = new Ts_detail;
$trdetail->td_date = data_get($value,'DATE'); $trdetail->td_date = data_get($value,'DATE');
$trdetail->fk_o_id = $tr; $trdetail->fk_o_id = $tr;
...@@ -1120,6 +1438,35 @@ class FormController extends Controller ...@@ -1120,6 +1438,35 @@ class FormController extends Controller
$trdetail->td_hours = 8; $trdetail->td_hours = 8;
$trdetail->td_timesheet_sts = 1; $trdetail->td_timesheet_sts = 1;
$trdetail->save(); $trdetail->save();
$checktptr = Tproject::where('fk_tm_id', $fk_tm_id)
->where('fk_o_id', $tr)
->first();
if ($checktptr)
{
}
else
{
$tptr = new Tproject;
$tptr->staffid = $userId;
$tptr->fk_o_id = $tr;
$tptr->fk_tm_id = $fk_tm_id;
$tptr->tp_project_type = 3;
$tptr->tp_year = $year;
$tptr->tp_month = $month;
$tptr->tp_phase = $phase;
$project = Overhead::where('id', $tr)
->first();
$tptr->tp_project_name = $project->o_overhead_desc;
$tptr->tp_hours = 8;
$tptr->tp_timesheet_sts = 1;
$tptr->tp_pm = data_get($user,'penyokong');
$tptr->tp_pd = data_get($user,'pelulus');
$tptr->save();
}
} }
} }
} }
...@@ -1137,6 +1484,34 @@ class FormController extends Controller ...@@ -1137,6 +1484,34 @@ class FormController extends Controller
if($checktdetailph) if($checktdetailph)
{ {
$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();
}
} }
else else
{ {
...@@ -1160,6 +1535,35 @@ class FormController extends Controller ...@@ -1160,6 +1535,35 @@ class FormController extends Controller
$pbdetail->td_hours = 8; $pbdetail->td_hours = 8;
$pbdetail->td_timesheet_sts = 1; $pbdetail->td_timesheet_sts = 1;
$pbdetail->save(); $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();
}
} }
} }
} }
......
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