Commit 28f2e7b3 by Azhan Hannan

changes

parent 4d313346
...@@ -38,185 +38,141 @@ ...@@ -38,185 +38,141 @@
<br> --> <br> -->
<a class="ui teal left ribbon label">Timesheet Status</a> <a class="ui teal left ribbon label">Timesheet Status</a>
<br> <br>
<table class="ui unstackable celled table"> <br>
<thead> @foreach($timesheet as $key => $value)
<tr> <div class="ui styled fluid accordion">
<th class="single line">Year</th> <?php $page = 1; ?>
<th class="single line">Month</th> <div class="title">
<th class="single line">Phase</th> <table class="ui unstackable celled table">
<th class="single line">Status</th> <thead>
<th class="single line">Action</th> <tr>
<th class="single line">Submission Date</th> <th style="width: 60%" class="text-center">{{data_get($value,'tm_year')}} - {{ date("F", mktime(0, 0, 0, data_get($value,'tm_month'), 10)) }} - Phase {{data_get($value,'tm_phase')}}</th>
<th class="single line">Verified Date</th> <th style="width: 15%;" class="center aligned">
<th class="single line">Approval Date</th> @if(data_get($value,'tm_timesheet_master_sts') == 1) Draft
</tr> @elseif(data_get($value,'tm_timesheet_master_sts') == 2) <i class="green check icon"></i> Submitted
</thead> @elseif(data_get($value,'tm_timesheet_master_sts') == 3) <i class="green check icon"></i> Verified by PM
<tbody> @elseif(data_get($value,'tm_timesheet_master_sts') == 4) <i class="green check icon"></i> Approved by PD
@foreach($timesheet as $key => $value) @elseif(data_get($value,'tm_timesheet_master_sts') == 5) <i class="green check icon"></i> Rejected by PD
<tr> @elseif(data_get($value,'tm_timesheet_master_sts') == 6) <i class="green check icon"></i> Rejected by PM
<td class="single line">{{ data_get($value,'tm_year') }}</td> @endif
<td class="single line">{{ data_get($value,'tm_month') }}</td> </th>
<td class="single line">{{ data_get($value,'tm_phase') }}</td> <th style="width: 13%" class="text-center">Submitted on: {{data_get($value,'tm_submission_at')}}</th>
<td class="single line"> <th style="width: 12%" class="text-center">
@if($value->tm_timesheet_master_sts == 1) Draft <button class="center aligned ui blue icon button">View Project</button>
@elseif($value->tm_timesheet_master_sts == 2) Submitted </th>
@elseif($value->tm_timesheet_master_sts == 3) Verified by HOD/HOU </tr>
@elseif($value->tm_timesheet_master_sts == 4) Approved by BOD </thead>
@elseif($value->tm_timesheet_master_sts == 5) Dissaproved by BOD </table>
@elseif($value->tm_timesheet_master_sts == 6) Rejected by HOD/HOU </div>
@elseif($value->tm_timesheet_master_sts == 7) Rejected by BOD
@endif
</td>
<td class="single line">
@if($value->tm_timesheet_master_sts == 1) Submit after timesheet completion
@elseif($value->tm_timesheet_master_sts == 2) Need to verified by HOD
@elseif($value->tm_timesheet_master_sts == 3) Need to approved by BOD
@elseif($value->tm_timesheet_master_sts == 4) Successfully received by HR
@elseif($value->tm_timesheet_master_sts == 5) Revised the timesheet
@elseif($value->tm_timesheet_master_sts == 6) Revised the timesheet
@elseif($value->tm_timesheet_master_sts == 7) Revised the timesheet
@endif
</td>
<td class="single line">{{ data_get($value,'tm_submission_at') }}</td>
<td class="single line">{{ data_get($value,'tm_verified_at') }}</td>
<td class="single line">{{ data_get($value,'tm_approved_at') }}</td>
</tr>
@endforeach
</tbody>
</table>
<!-- <br> -->
</div>
@foreach($timesheet as $key => $value)
<div class="ui styled fluid accordion">
<?php $page = 1; ?>
<div class="title">
<table class="ui unstackable celled table">
<thead>
<tr>
<th style="width: 60%" class="text-center">{{data_get($value,'tm_year')}} - {{ date("F", mktime(0, 0, 0, data_get($value,'tm_month'), 10)) }} - Phase {{data_get($value,'tm_phase')}}</th>
<th style="width: 15%;" class="center aligned">
@if(data_get($value,'tm_timesheet_master_sts') == 1) Draft
@elseif(data_get($value,'tm_timesheet_master_sts') == 2) <i class="green check icon"></i> Submitted
@elseif(data_get($value,'tm_timesheet_master_sts') == 3) <i class="green check icon"></i> Verified by PM
@elseif(data_get($value,'tm_timesheet_master_sts') == 4) <i class="green check icon"></i> Approved by PD
@elseif(data_get($value,'tm_timesheet_master_sts') == 5) <i class="green check icon"></i> Rejected by PD
@elseif(data_get($value,'tm_timesheet_master_sts') == 6) <i class="green check icon"></i> Rejected by PM
@endif
</th>
<th style="width: 13%" class="text-center">Submitted on: {{data_get($value,'tm_submission_at')}}</th>
<th style="width: 12%" class="text-center">
<button class="center aligned ui blue icon button">View Project</button>
</th>
</tr>
</thead>
</table>
</div>
<?php <?php
$chargeable = $projects->where('tp_project_type', 1)->where('fk_tm_id', data_get($value,'id')); $chargeable = $projects->where('tp_project_type', 1)->where('fk_tm_id', data_get($value,'id'));
$overhead = $projects->where('tp_project_type', 3)->where('fk_tm_id', data_get($value,'id')); $overhead = $projects->where('tp_project_type', 3)->where('fk_tm_id', data_get($value,'id'));
// dd($overhead); // dd($overhead);
?> ?>
<div class="content" style="padding-top: 0px;"> <div class="content" style="padding-top: 0px;">
<!-- chargeable --> <!-- chargeable -->
<table class="ui unstackable celled table"> <table class="ui unstackable celled table">
<thead> <thead>
<tr> <tr>
<th style="width: 7%;" class="text-center">Project Code</th> <th style="width: 7%;" class="text-center">Project Code</th>
<th style="width: 13;">Project Name</th> <th style="width: 13;">Project Name</th>
<th style="width: 15;">Project Manager</th> <th style="width: 15;">Project Manager</th>
<!-- <th style="width: 5%;" class="center aligned">Total Hours</th> <!-- <th style="width: 5%;" class="center aligned">Total Hours</th>
<th style="width: 5%;" class="center aligned">Total Days</th> --> <th style="width: 5%;" class="center aligned">Total Days</th> -->
<th style="width: 20%">PM Remarks</th> <th style="width: 20%">PM Remarks</th>
<th style="width: 20%">PD Remarks</th> <th style="width: 20%">PD Remarks</th>
<th style="width: 13%" class="text-center">Status</th> <th style="width: 13%" class="text-center">Status</th>
<th style="width: 12%;" class="text-center">Action</th> <th style="width: 12%;" class="text-center">Action</th>
</tr> </tr>
</thead> </thead>
@if(count($chargeable) == '0') @if(count($chargeable) == '0')
<tr> <tr>
<td class="text-center" colspan="5">No Project Submitted</td> <td class="text-center" colspan="5">No Project Submitted</td>
</tr> </tr>
@else @else
@foreach($chargeable as $key => $tpcharge) @foreach($chargeable as $key => $tpcharge)
<tr>
<td style="width: 7%;" class="text-center">{{data_get($tpcharge,'project.p_project_code')}}</td>
<td style="width: 13;">{{data_get($tpcharge,'project.p_project_description')}}</td>
<td style="width: 15;">{{data_get($tpcharge,'project.projectManager.fullname')}}</td>
<!-- <td style="width: 5%;" class="center aligned">{{data_get($tpcharge,'tp_hours')}}</td>
<td style="width: 5%;" class="center aligned">{{data_get($tpcharge,'tp_hours')/8}}</td> -->
<td style="width: 20%">{{data_get($tpcharge,'verifier_remark')}}</td>
<td style="width: 20%">{{data_get($tpcharge,'approver_remark')}}</td>
<td style="width: 13%" class="text-center">
@if(data_get($tpcharge,'tp_timesheet_sts') == 1) Draft
@elseif(data_get($tpcharge,'tp_timesheet_sts') == 2) Submitted
@elseif(data_get($tpcharge,'tp_timesheet_sts') == 3) Verified by PM
@elseif(data_get($tpcharge,'tp_timesheet_sts') == 4) Approved by PD
@elseif(data_get($tpcharge,'tp_timesheet_sts') == 5) Rejected by PD
@elseif(data_get($tpcharge,'tp_timesheet_sts') == 6) Rejected by PM
@endif
</td>
<td style="width: 12%;" class="text-center">
@if(data_get($tpcharge,'tp_timesheet_sts') == 5|| data_get($tpcharge,'tp_timesheet_sts') == 6)
<button class="center aligned ui green icon button" onclick="window.location.href='{{ route('timesheet::form.rejected', ['tpid' => data_get($tpcharge,'id')]) }}';">Resubmit</button>
@else
<button class="center aligned ui red icon button disabled">Resubmit</button>
@endif
</td>
</tr>
@endforeach
@endif
</table>
<!-- overhead -->
<table class="ui unstackable celled table">
<thead>
<tr>
<th style="width: 17%;">Overhead</th>
<th style="width: 15%;">Verifier</th>
<!-- <th style="width: 5%;" class="center aligned">Total Hours</th>
<th style="width: 5%;" class="center aligned">Total Days</th> -->
<th style="width: 20%;">Hod Remarks</th>
<th style="width: 20%;">Bod Remarks</th>
<th style="width: 13%;" class="text-center">Status</th>
<th style="width: 12%;" class="text-center">Action</th>
</tr>
</thead>
@if($overhead)
@foreach($overhead as $key => $tpoverhead)
<tr> <tr>
<td style="width: 7%;" class="text-center">{{data_get($tpcharge,'project.p_project_code')}}</td> <td style="width: 15;">{{data_get($tpoverhead,'tp_project_name')}}</td>
<td style="width: 13;">{{data_get($tpcharge,'project.p_project_description')}}</td> <td style="width: 15;" class="single line">{{data_get($tpoverhead,'hod.fullname')}}</td>
<td style="width: 15;">{{data_get($tpcharge,'project.projectManager.fullname')}}</td> <!-- <td style="width: 5%;" class="center aligned">{{data_get($tpoverhead,'tp_hours')}}</td>
<!-- <td style="width: 5%;" class="center aligned">{{data_get($tpcharge,'tp_hours')}}</td> <td style="width: 5%;" class="center aligned">{{data_get($tpoverhead,'tp_hours')/8}}</td> -->
<td style="width: 5%;" class="center aligned">{{data_get($tpcharge,'tp_hours')/8}}</td> --> <td style="width: 20%;">{{data_get($tpoverhead,'verifier_remark')}}</td>
<td style="width: 20%">{{data_get($tpcharge,'verifier_remark')}}</td> <td style="width: 20%;">{{data_get($tpoverhead,'approver_remark')}}</td>
<td style="width: 20%">{{data_get($tpcharge,'approver_remark')}}</td> <td style="width: 13%;" class="text-center">
<td style="width: 13%" class="text-center"> @if(data_get($tpoverhead,'tp_timesheet_sts') == 1) Draft
@if(data_get($tpcharge,'tp_timesheet_sts') == 1) Draft @elseif(data_get($tpoverhead,'tp_timesheet_sts') == 2) Submitted
@elseif(data_get($tpcharge,'tp_timesheet_sts') == 2) Submitted @elseif(data_get($tpoverhead,'tp_timesheet_sts') == 3) Verified by HOD
@elseif(data_get($tpcharge,'tp_timesheet_sts') == 3) Verified by PM @elseif(data_get($tpoverhead,'tp_timesheet_sts') == 4) Approved by BOD
@elseif(data_get($tpcharge,'tp_timesheet_sts') == 4) Approved by PD @elseif(data_get($tpoverhead,'tp_timesheet_sts') == 5) Rejected by BOD
@elseif(data_get($tpcharge,'tp_timesheet_sts') == 5) Rejected by PD @elseif(data_get($tpoverhead,'tp_timesheet_sts') == 6) Rejected by HOD
@elseif(data_get($tpcharge,'tp_timesheet_sts') == 6) Rejected by PM
@endif @endif
</td> </td>
<td style="width: 12%;" class="text-center"> <td style="width: 12%;" class="text-center">
@if(data_get($tpcharge,'tp_timesheet_sts') == 5|| data_get($tpcharge,'tp_timesheet_sts') == 6) @if(data_get($tpoverhead,'tp_timesheet_sts') == 5 || data_get($tpoverhead,'tp_timesheet_sts') == 6)
<button class="center aligned ui green icon button">Resubmit</button> <button class="center aligned ui green icon button" onclick="window.location.href='{{ route('timesheet::form.rejected', ['tpid' => data_get($tpoverhead,'id')]) }}';">Resubmit</button>
@else @else
<button class="center aligned ui green icon button disabled">Resubmit</button> <button class="center aligned ui red icon button disabled">Resubmit</button>
@endif @endif
</td> </td>
</tr> </tr>
@endforeach @endforeach
@endif @endif
</table> </table>
</div>
<!-- overhead --> </div>
<table class="ui unstackable celled table"> <br>
<thead> @endforeach
<tr> <!-- <br> -->
<th style="width: 17%;">Overhead</th> </div>
<th style="width: 15%;">Verifier</th>
<!-- <th style="width: 5%;" class="center aligned">Total Hours</th>
<th style="width: 5%;" class="center aligned">Total Days</th> -->
<th style="width: 20%;">Hod Remarks</th>
<th style="width: 20%;">Bod Remarks</th>
<th style="width: 13%;" class="text-center">Status</th>
<th style="width: 12%;" class="text-center">Action</th>
</tr>
</thead>
@if($overhead)
@foreach($overhead as $key => $tpoverhead)
<tr>
<td style="width: 15;">{{data_get($tpoverhead,'tp_project_name')}}</td>
<td style="width: 15;" class="single line">{{data_get($tpoverhead,'hod.fullname')}}</td>
<!-- <td style="width: 5%;" class="center aligned">{{data_get($tpoverhead,'tp_hours')}}</td>
<td style="width: 5%;" class="center aligned">{{data_get($tpoverhead,'tp_hours')/8}}</td> -->
<td style="width: 20%;">{{data_get($tpoverhead,'verifier_remark')}}</td>
<td style="width: 20%;">{{data_get($tpoverhead,'approver_remark')}}</td>
<td style="width: 13%;" class="text-center">
@if(data_get($tpoverhead,'tp_timesheet_sts') == 1) Draft
@elseif(data_get($tpoverhead,'tp_timesheet_sts') == 2) Submitted
@elseif(data_get($tpoverhead,'tp_timesheet_sts') == 3) Verified by HOD
@elseif(data_get($tpoverhead,'tp_timesheet_sts') == 4) Approved by BOD
@elseif(data_get($tpoverhead,'tp_timesheet_sts') == 5) Rejected by BOD
@elseif(data_get($tpoverhead,'tp_timesheet_sts') == 6) Rejected by HOD
@endif
</td>
<td style="width: 12%;" class="text-center">
@if(data_get($tpoverhead,'tp_timesheet_sts') == 5 || data_get($tpoverhead,'tp_timesheet_sts') == 6)
<button class="center aligned ui green icon button">Resubmit</button>
@else
<button class="center aligned ui green icon button disabled">Resubmit</button>
@endif
</td>
</tr>
@endforeach
@endif
</table>
</div>
</div>
@endforeach
@endsection @endsection
......
@extends('ui::layouts.app')
@section('content')
<div class="ui segment">
<a class="ui blue left ribbon label">Rejected Project</a>
<br>
<br>
<form class="ui form" action="{{ route('timesheet::form.resubmit' )}}" method="POST">
{{csrf_field()}}
<input type="hidden" name="tpid" value="{{data_get($profile,'id')}}">
<table class="ui celled structured table unstackable">
<thead>
<tr>
<th colspan="2" rowspan="2" class="center aligned">Chargeable</th>
<th colspan="@if($phase == 1) 15 @else {{$daymonth-15}} @endif" class="center aligned">Date</th>
<th rowspan="2">
<button type="submit" class="ui fluid center aligned ui blue button">
<!-- <i class="save icon"></i> -->
Resubmit
</button>
</th>
</tr>
<tr>
@if($phase == 1)
@for($i = 0; $i < 15 ; $i++)
<th>{{$i+1}}</th>
@endfor
@else
@for($i = 15; $i < $daymonth; $i++)
<th>{{$i+1}}</th>
@endfor
@endif
</tr>
<tr>
<th class="single line">Project Code</th>
<th class="single line">Project Name</th>
@if($phase == 1)
@for($i = 0; $i < 15 ; $i++)
<th>{{ $strdays[$i] }}</th>
@endfor
@else
@for($i = 15; $i < $daymonth; $i++)
<th>{{ $strdays[$i] }}</th>
@endfor
@endif
<th>Total Hours</th>
</tr>
</thead>
<tbody>
@foreach($projectlist as $key => $project)
<?php $total = 0; ?>
<tr>
<td class="single line">
{{ $project['td_project_code']}}
</td>
<td class="single line">
{{$project['td_project_name']}}
</td>
@if($phase == 1)
@for($i = 0; $i < 15 ; $i++)
<?php
$valuehour = '';
$date = $year.'-'.sprintf('%02d', $month).'-'.sprintf('%02d', $i+1);
if($hour)
{
$valuehour = $hour->where('td_date','=',$date)
->where('td_project',$project['td_project'])
->where('tm_phase',$phase)
->first();
$total += data_get($valuehour,'td_hours');
}
?>
<td >
<input type="text" onkeypress="onlynumber(event)" id="hour[{{$project['td_project']}}][{{$i+1}}]" name="hour[{{$project['td_project']}}][{{$i+1}}]" value="@if($valuehour){{$valuehour->td_hours}}@else @endif" min="0" max="24" style="padding:2px;margin:unset" onchange="limiter(this,'{{$project['td_project']}}');">
</td>
@endfor
@else
@for($i = 15; $i < $daymonth; $i++)
<?php
$valuehour = '';
$date = $year.'-'.sprintf('%02d', $month).'-'.sprintf('%02d', $i+1);
if($hour)
{
$valuehour = $hour->where('td_date','=',$date)
->where('td_project',$project['td_project'])
->where('tm_phase',$phase)
->first();
$total += data_get($valuehour,'td_hours');
}
?>
<td >
<input type="text" onkeypress="onlynumber(event)" id="hour[{{$project['td_project']}}][{{$i+1}}]" name="hour[{{$project['td_project']}}][{{$i+1}}]" value="@if($valuehour){{$valuehour->td_hours}}@else @endif" min="0" max="24" style="padding:2px;margin:unset" onchange="limiter(this,'{{$project['td_project']}}');">
</td>
@endfor
@endif
<td>
<input type="text" onkeypress="onlynumber(event)" name="total-{{$project['td_project']}}" id="total-{{$project['td_project']}}" style="padding-right: 4px;padding-left: 4px;" onchange="limiter(this,'{{$project['td_project']}}');" readonly="" value={{$total}}>
</td>
</tr>
@endforeach
</tbody>
</table>
</form>
</div>
@endsection
\ No newline at end of file
@extends('ui::layouts.app')
@section('content')
<div class="ui segment">
<a class="ui purple left ribbon label">Rejected Overhead</a>
<br>
<br>
<form class="ui form" action="" method="POST">
<table class="ui celled structured unstackable table" >
<thead>
<tr>
<th rowspan="2" class="center aligned">Overhead</th>
<th colspan="@if($phase == 1) 15 @else {{$daymonth-15}} @endif" class="center aligned">Date</th>
<th rowspan="2">
<button type="submit" class="fluid center aligned ui blue button">
<!-- <i class="save icon"></i> -->
Resubmit
</button>
</th>
</tr>
<tr>
@if($phase == 1)
@for($i = 0; $i < 15 ; $i++)
<th>{{$i+1}}</th>
@endfor
@else
@for($i = 15; $i < $daymonth; $i++)
<th>{{$i+1}}</th>
@endfor
@endif
</tr>
<tr>
<th>Task</th>
@if($phase == 1)
@for($i = 0; $i < 15 ; $i++)
<th>{{ $strdays[$i] }}</th>
@endfor
@else
@for($i = 15; $i < $daymonth; $i++)
<th>{{ $strdays[$i] }}</th>
@endfor
@endif
<th>Total Hours</th>
</tr>
</thead>
<tbody>
@foreach($projectlist as $key => $project)
<?php $total = 0; ?>
<tr>
<td>
{{$project['td_project_name']}}
</td>
@if($phase == 1)
@for($i = 0; $i < 15 ; $i++)
<?php
$valuehour = '';
$date = $year.'-'.sprintf('%02d', $month).'-'.sprintf('%02d', $i+1);
if($hour)
{
$valuehour = $hour->where('td_date','=',$date)
->where('fk_o_id',$project['td_project'])
->where('tm_phase',$phase)
->first();
$total += data_get($valuehour,'td_hours');
}
?>
<td >
<input type="text" onkeypress="onlynumber(event)" id="hour[{{$project['td_project']}}][{{$i+1}}]" name="hour[{{$project['td_project']}}][{{$i+1}}]" 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>
@endfor
@else
@for($i = 15; $i < $daymonth; $i++)
<?php
$valuehour = '';
$date = $year.'-'.sprintf('%02d', $month).'-'.sprintf('%02d', $i+1);
if($hour)
{
$valuehour = $hour->where('td_date','=',$date)
->where('fk_o_id',$project['td_project'])
->where('tm_phase',$phase)
->first();
$total += data_get($valuehour,'td_hours');
}
?>
<td >
<input type="text" onkeypress="onlynumber(event)" id="hour[{{$project['td_project']}}][{{$i+1}}]" name="hour[{{$project['td_project']}}][{{$i+1}}]" 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>
@endfor
@endif
<td>
<input type="text" onkeypress="onlynumber(event)" name="total-{{$project['td_project']}}" id="total-{{$project['td_project']}}" style="padding-right: 4px;padding-left: 4px;" onchange="limiter(this,'{{$project['td_project']}}');" readonly="" value={{$total}}>
</td>
</tr>
@endforeach
</tbody>
</table>
</form>
<br>
</div>
@endsection
@push('script')
<script>
$(document).ready(function()
{
$('.view_button').click(function()
{
$('.view').modal(
{
blurring: true
}).modal('show');
var id = $(this).data('overheadid');
var month = $(this).data('month');
var year = $(this).data('year');
var phase = $(this).data('phase');
var staffid = $(this).data('tmstaffid');
$.ajax(
{
type: "GET",
url: "{{ URL::to('ajax/overheadnote')}}"+"/"+id+"/"+month+"/"+year+"/"+staffid+"/"+phase,
beforeSend: function ()
{
document.getElementById('zone2').style.display = "block";
},
success: function(html)
{
document.getElementById('zone2').style.display = "block";
$('#zone2').html( html );
// window.location.replace("{{ URL::to('ad/typeanjuran')}}")
}
});
});
});
</script>
<script>
$(function(){
$("#view").click(function()
{
$(".view").modal('show');
});
$(".view").modal(
{
closable: true
});
$(".view").modal('attach events', '.close.button');
});
</script>
<script>
$(function(){
$("#description").click(function()
{
$(".description").modal('show');
});
$(".description").modal(
{
closable: true
});
$(".description").modal('attach events', '.close.button');
});
</script>
<script>
function onlynumber(evt)
{
var theEvent = evt || window.event;
var key = theEvent.keyCode || theEvent.which;
key = String.fromCharCode(key);
var regex = /[0-9]|\./;
if( !regex.test(key) )
{
theEvent.returnValue = false;
if(theEvent.preventDefault) theEvent.preventDefault();
}
}
</script>
<script>
$().ready(function() {
});
function limiter(input,pid) {
var currenttotal = 0;
if (input.value < 0) input.value = 0;
if (input.value > 24) input.value = 24;
input.value = parseFloat(parseFloat(input.value).toFixed(1));
for(var i = 0; i < 32; i++){
var value = 0;
var hourValue = document.getElementById('hour['+pid+']['+i+']');
if(hourValue){
hourValue = hourValue.value;
value = parseFloat(parseFloat(hourValue).toFixed(1));
console.log(isNaN(value));
if(isNaN(value)){
value = 0;
}
if(typeof value === 'number'){
// console.log(value);
currenttotal += value;
}
}
}
console.log("currenttotal --> " + currenttotal);
document.getElementById('total-'+pid).value = currenttotal;
}
</script>
@endpush
\ No newline at end of file
...@@ -92,6 +92,10 @@ Route::group( ...@@ -92,6 +92,10 @@ Route::group(
Route::post('overheadselectmonthphase', ['uses' => 'FormController@overheadselectmonthphase', 'as' => 'form.overheadselectmonthphase']); Route::post('overheadselectmonthphase', ['uses' => 'FormController@overheadselectmonthphase', 'as' => 'form.overheadselectmonthphase']);
Route::post('noteselectmonthphase', ['uses' => 'FormController@noteselectmonthphase', 'as' => 'form.noteselectmonthphase']); Route::post('noteselectmonthphase', ['uses' => 'FormController@noteselectmonthphase', 'as' => 'form.noteselectmonthphase']);
Route::post('action/upload', ['uses' => 'FormController@uploadAttachement', 'as' => 'form.upload']); Route::post('action/upload', ['uses' => 'FormController@uploadAttachement', 'as' => 'form.upload']);
Route::get('rejected',['uses' => 'FormController@rejected', 'as' => 'form.rejected']);
Route::post('resubmit',['uses' => 'FormController@resubmit', 'as' => 'form.resubmit']);
Route::post('resubmitoverhead',['uses' => 'FormController@resubmitoverhead', 'as' => 'form.resubmitoverhead']);
// nonChargeableForm // nonChargeableForm
// Route::get('nonChargeableForm',['uses' => 'FormController@nonChargeableForm', 'as' => 'form.nonChargeableForm']); // Route::get('nonChargeableForm',['uses' => 'FormController@nonChargeableForm', 'as' => 'form.nonChargeableForm']);
......
...@@ -1365,7 +1365,256 @@ class FormController extends Controller ...@@ -1365,7 +1365,256 @@ class FormController extends Controller
} }
return redirect()->back()->withSuccess('Berjaya mengemaskini attachment'); return redirect()->back()->withSuccess('Berjaya mengemaskini attachment');
}
public function rejected(Request $request)
{
$userId = users::find(Auth::id())
->u_staffID;
$profile = Tproject::where('id', $request->tpid)
->with('project')
->with('overhead')
->first();
$month = data_get($profile,'tp_month');
$year = data_get($profile,'tp_year');
$phase = data_get($profile,'tp_phase');
$daymonth=cal_days_in_month(CAL_GREGORIAN,$month,$year);
$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);
}
$projectlist = [];
if ($profile->tp_project_type == 1)
{
$projectlist[] = [
'td_project' => $profile->td_project,
'td_project_code' => $profile->project->p_project_code,
'td_project_name' => $profile->project->p_project_description,
];
}
else
{
$projectlist[] = [
'td_project' => $profile->fk_o_id,
'td_project_name' => $profile->overhead->o_overhead_desc,
];
}
$check = Ts_master::where('id', $profile->fk_tm_id)
->first();
if($check)
{
if($profile->tp_project_type == 1)
{
$hour = Ts_detail::where('fk_tm_id',$check->id)
->where('td_project', $profile->td_project)
->get();
}
else
{
$hour = Ts_detail::where('fk_tm_id',$check->id)
->where('fk_o_id', $profile->fk_o_id)
->get();
// dd($hour);
}
}
else
{
$hour = null;
}
if($profile->tp_project_type == 1)
{
return view('timesheet::form.rejected', compact('month', 'phase', 'year', 'profile', 'strdays', 'daymonth', 'projectlist', 'check' ,'hour'));
}
else
{
return view('timesheet::form.rejectedoverhead', compact('month', 'phase', 'year', 'profile', 'strdays', 'daymonth', 'projectlist', 'check' ,'hour'));
}
} }
public function resubmit(Request $request)
{
$profile = Tproject::where('id', $request->tpid)
->first();
// dd($profile);
$chargeable = 1;
$userId = users::find(Auth::id())
->u_staffID;
$check = Ts_master::where('id', $profile->fk_tm_id)
->first();
// dd($check);
if($check)
{
}
else
{
$check = new Ts_master;
$check->tm_staff_id = $userId;
$check->tm_year = $profile->tp_year;
$check->tm_month = $profile->tp_month;
$check->tm_phase = $profile->tp_phase;
$check->tm_timesheet_master_sts = 1;
$check->updated_by = $userId;
$check->save();
}
$tmasterid = $check->id;
$detail = $request->hour;
foreach ($detail as $key => $value)
{
$projectid = $key;
foreach ($value as $keyday => $day)
{
$date = $profile->tp_year.'-'.$profile->tp_month.'-'.sprintf('%02d', $keyday);
$checkTimesheetDetail = Ts_detail::where('fk_tm_id', $tmasterid)
->where('td_project', $projectid)
->where('td_project_type', $chargeable)
->where('td_date', $date)
->where('tm_phase', $profile->tp_phase)
->first();
$valuehour = $day;
if($valuehour == null)
{
$valuehour = 0;
}
// dd($checkTimesheetDetail);
if($checkTimesheetDetail)
{
$checkTimesheetDetail->td_hours = $valuehour;
$checkTimesheetDetail->updated_by = $userId;
$checkTimesheetDetail->save();
}
else
{
$tmdetail = new Ts_detail;
$tmdetail->td_date = $date;
$tmdetail->td_project = $projectid;
$tmdetail->fk_tm_id = $tmasterid;
$tmdetail->tm_staff_id = $userId;
$tmdetail->tm_month = $check->tm_month;
$tmdetail->tm_year = $check->tm_year;
$tmdetail->tm_phase = $check->tm_phase;
$tmdetail->td_project_type = $chargeable;
$project = Project::where('id', $projectid)
->first();
$tmdetail->td_project_name = $project->p_project_description;
$tmdetail->td_hours = $valuehour;
$tmdetail->td_timesheet_sts = 1;
$tmdetail->updated_by = $userId;
$tmdetail->save();
}
}
$checktproject = Tproject::where('fk_tm_id', $tmasterid)
->where('td_project', $projectid)
->first();
$checkhours = Ts_detail::where('fk_tm_id', $tmasterid)
->where('td_project', $projectid)
->where('td_hours', '!=', '0')
->get();
if ($checktproject) {
$checktproject->tp_hours = $checkhours->sum('td_hours');
$checktproject->save();
}
else
{
$tpdetail = new Tproject;
$tpdetail->td_project = $projectid;
$tpdetail->staffid = $userId;
$tpdetail->fk_tm_id = $tmasterid;
$tpdetail->tp_project_type = 1;
$tpdetail->tp_year = $profile->tp_year;
$tpdetail->tp_month = $profile->tp_month;
$tpdetail->tp_phase = $profile->tp_phase;
$project = Project::where('id', $projectid)
->first();
$tpdetail->tp_project_name = $project->p_project_description;
$tpdetail->tp_hours = $checkhours->sum('td_hours');
$tpdetail->tp_pm = $project->p_project_task_team;
$tpdetail->tp_pd = $project->p_project_director;
$tpdetail->tp_timesheet_sts = 1;
$tpdetail->updated_by = $userId;
$tpdetail->save();
}
$zeroedproject = Tproject::where('fk_tm_id', $tmasterid)
->where('td_project', $projectid)
->where('tp_hours', 0)
->first();
if ($zeroedproject)
{
Tproject::where('fk_tm_id', $tmasterid)
->where('td_project', $projectid)
->delete();
Ts_detail::where('fk_tm_id', $tmasterid)
->where('td_project', $projectid)
->delete();
}
}
$sumdetailhour = Ts_detail::where('td_project_type', $chargeable)
->where('tm_staff_id', $userId)
->where('fk_tm_id', $tmasterid)
->where('tm_phase', $request->phase)
->sum('td_hours');
$checktotalhours = Ts_master::where('id', $tmasterid)->first();
$checktotalhours->tm_chargeable_hrs = $sumdetailhour;
$checktotalhours->tm_chargeable_days = $sumdetailhour/8.0;
$checktotalhours->save();
Tproject::where('id', $profile->id)
->update(['tp_timesheet_sts' => 2]);
Ts_detail::where('fk_tm_id', $profile->fk_tm_id)
->where('td_project', $profile->td_project)
->update(['td_timesheet_sts' => 2]);
return redirect()->route('timesheet::dashboard.index');
}
} }
\ No newline at end of file
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