Commit 0ef4746b by Azhan Hannan

detect hari bekerja

parent c9613c8d
...@@ -66,12 +66,17 @@ input[type=number] { ...@@ -66,12 +66,17 @@ input[type=number] {
</th> </th>
</tr> </tr>
<tr> <tr>
<?php @if(count($lat) > 0)
$cday = []; @foreach($lat as $key => $date)
for ($i=0; $i < $daymonth; $i++) { @if(data_get($date,'day_type') == 1 )
$cday[] = 0; <th>{{date_parse_from_format('Y-m-d', data_get($date,'DATE'))['day']}}</th>
} @else
?> <th style="background-color: #DCDCDC;">
{{date_parse_from_format('Y-m-d', data_get($date,'DATE'))['day']}}
</th>
@endif
@endforeach
@else
@if($phase == 1) @if($phase == 1)
@for($i = 0; $i < 15 ; $i++) @for($i = 0; $i < 15 ; $i++)
...@@ -83,10 +88,24 @@ input[type=number] { ...@@ -83,10 +88,24 @@ input[type=number] {
@endfor @endfor
@endif @endif
@endif
</tr> </tr>
<tr> <tr>
<th class="single line">Project Code</th> <th class="single line">Project Code</th>
<th class="single line">Project Name</th> <th class="single line">Project Name</th>
@if(count($lat) > 0)
@foreach($lat as $key => $date)
@if(data_get($date,'day_type') == 1)
<th>
{{ date('D', strtotime(data_get($date,'DATE')) ) }}
</th>
@else
<th style="background-color: #DCDCDC;">
{{ date('D', strtotime(data_get($date,'DATE')) ) }}
</th>
@endif
@endforeach
@else
@if($phase == 1) @if($phase == 1)
@for($i = 0; $i < 15 ; $i++) @for($i = 0; $i < 15 ; $i++)
...@@ -98,6 +117,7 @@ input[type=number] { ...@@ -98,6 +117,7 @@ input[type=number] {
@endfor @endfor
@endif @endif
@endif
<th>Hours</th> <th>Hours</th>
</tr> </tr>
</thead> </thead>
...@@ -111,11 +131,44 @@ input[type=number] { ...@@ -111,11 +131,44 @@ input[type=number] {
<?php $total = 0;?> <?php $total = 0;?>
<tr> <tr>
<td class="single line"> <td class="single line">
{{ $project['td_project_code']}} {{$project['td_project_code']}}
</td> </td>
<td class="single line"> <td class="single line">
{{$project['td_project_name']}} {{$project['td_project_name']}}
</td> </td>
@if(count($lat) > 0)
@foreach($lat as $key => $value)
<?php
// dd($value);
$day = date_parse_from_format('Y-m-d', data_get($value,'DATE'))['day'];
// dd($day);
$valuehour = '';
$date = $year.'-'.sprintf('%02d', $month).'-'.sprintf('%02d', $day);
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');
}
?>
@if(data_get($value,'day_type') == 1)
<td>
<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>
@else
<td style="background-color: #DCDCDC;">
<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>
@endif
@endforeach
@else
@if($phase == 1) @if($phase == 1)
@for($i = 0; $i < 15 ; $i++) @for($i = 0; $i < 15 ; $i++)
...@@ -133,10 +186,9 @@ input[type=number] { ...@@ -133,10 +186,9 @@ input[type=number] {
$total += data_get($valuehour,'td_hours'); $total += data_get($valuehour,'td_hours');
} }
?> ?>
<td > <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'] }}');"> <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> </td>
@endfor @endfor
...@@ -157,13 +209,15 @@ input[type=number] { ...@@ -157,13 +209,15 @@ input[type=number] {
$total += data_get($valuehour,'td_hours'); $total += data_get($valuehour,'td_hours');
} }
?> ?>
<td> <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']}}');"> <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> </td>
@endfor @endfor
@endif @endif
@endif
<td> <td>
<input class="center aligned" type="text" name="total-{{$project['td_project']}}" id="total-{{$project['td_project']}}" style="padding-right: 4px;padding-left: 4px;" onchange="limiter(this,'{{$project['td_project']}}');" readonly="readonly" value={{$total}}> <input class="center aligned" type="text" name="total-{{$project['td_project']}}" id="total-{{$project['td_project']}}" style="padding-right: 4px;padding-left: 4px;" onchange="limiter(this,'{{$project['td_project']}}');" readonly="readonly" value="{{number_format($total,'1','.','')}}">
</td> </td>
</tr> </tr>
<?php $all += $total; ?> <?php $all += $total; ?>
......
...@@ -70,8 +70,18 @@ input[type=number] { ...@@ -70,8 +70,18 @@ input[type=number] {
</th> </th>
</tr> </tr>
<tr> <tr>
@if(count($lat) > 0)
@foreach($lat as $key => $date)
@if(data_get($date,'day_type') == 1 )
<th>{{date_parse_from_format('Y-m-d', data_get($date,'DATE'))['day']}}</th>
@else
<th style="background-color: #DCDCDC;">
{{date_parse_from_format('Y-m-d', data_get($date,'DATE'))['day']}}
</th>
@endif
@endforeach
@else
@if($phase == 1) @if($phase == 1)
@for($i = 0; $i < 15 ; $i++) @for($i = 0; $i < 15 ; $i++)
<th>{{$i+1}}</th> <th>{{$i+1}}</th>
@endfor @endfor
...@@ -80,11 +90,24 @@ input[type=number] { ...@@ -80,11 +90,24 @@ input[type=number] {
<th>{{$i+1}}</th> <th>{{$i+1}}</th>
@endfor @endfor
@endif @endif
@endif
</tr> </tr>
<tr> <tr>
@if(count($lat) > 0)
@foreach($lat as $key => $date)
@if(data_get($date,'day_type') == 1)
<th>
{{ date('D', strtotime(data_get($date,'DATE')) ) }}
</th>
@else
<th style="background-color: #DCDCDC;">
{{ date('D', strtotime(data_get($date,'DATE')) ) }}
</th>
@endif
@endforeach
@else
<!-- <th>Task</th> --> <!-- <th>Task</th> -->
@if($phase == 1) @if($phase == 1)
@for($i = 0; $i < 15 ; $i++) @for($i = 0; $i < 15 ; $i++)
<th>{{ $strdays[$i] }}</th> <th>{{ $strdays[$i] }}</th>
@endfor @endfor
...@@ -93,6 +116,7 @@ input[type=number] { ...@@ -93,6 +116,7 @@ input[type=number] {
<th>{{ $strdays[$i] }}</th> <th>{{ $strdays[$i] }}</th>
@endfor @endfor
@endif @endif
@endif
<th>Hours</th> <th>Hours</th>
</tr> </tr>
</thead> </thead>
...@@ -104,9 +128,41 @@ input[type=number] { ...@@ -104,9 +128,41 @@ input[type=number] {
<td> <td>
{{$project['td_project_name']}} {{$project['td_project_name']}}
</td> </td>
@if(count($lat) > 0)
@foreach($lat as $key => $value)
<?php
// dd($value);
$day = date_parse_from_format('Y-m-d', data_get($value,'DATE'))['day'];
// dd($day);
$valuehour = '';
$date = $year.'-'.sprintf('%02d', $month).'-'.sprintf('%02d', $day);
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');
}
?>
@if(data_get($value,'day_type') == 1)
<td>
<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'] }}');">
</td>
@else
<td style="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'] }}');">
</td>
@endif
@endforeach
@else
@if($phase == 1) @if($phase == 1)
@for($i = 0; $i < 15 ; $i++) @for($i = 0; $i < 15 ; $i++)
<?php <?php
$valuehour = ''; $valuehour = '';
...@@ -128,12 +184,9 @@ input[type=number] { ...@@ -128,12 +184,9 @@ input[type=number] {
<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']}}');"> <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> </td>
@endfor @endfor
@else @else
@for($i = 15; $i < $daymonth; $i++) @for($i = 15; $i < $daymonth; $i++)
<?php <?php
$valuehour = ''; $valuehour = '';
$date = $year.'-'.sprintf('%02d', $month).'-'.sprintf('%02d', $i+1); $date = $year.'-'.sprintf('%02d', $month).'-'.sprintf('%02d', $i+1);
...@@ -151,7 +204,7 @@ input[type=number] { ...@@ -151,7 +204,7 @@ input[type=number] {
<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']}}');"> <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> </td>
@endfor @endfor
@endif
@endif @endif
<td> <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}}> <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}}>
......
...@@ -11,6 +11,7 @@ use Portal\Timesheet\Model\Ts_detail; ...@@ -11,6 +11,7 @@ use Portal\Timesheet\Model\Ts_detail;
use Portal\Timesheet\Model\Project; use Portal\Timesheet\Model\Project;
use Portal\Timesheet\Model\Tproject; use Portal\Timesheet\Model\Tproject;
use Portal\Timesheet\Model\Department; use Portal\Timesheet\Model\Department;
use Portal\Timesheet\Model\LAttendance;
use Portal\Timesheet\Model\Pteam; use Portal\Timesheet\Model\Pteam;
use Portal\Timesheet\Model\Staff_info; use Portal\Timesheet\Model\Staff_info;
use Portal\Timesheet\Model\Overhead; use Portal\Timesheet\Model\Overhead;
...@@ -112,6 +113,7 @@ class FormController extends Controller ...@@ -112,6 +113,7 @@ class FormController extends Controller
$userId = users::find(Auth::id()) $userId = users::find(Auth::id())
->u_staffID; ->u_staffID;
$project = Pteam::where('pt_staff_id',$userId) $project = Pteam::where('pt_staff_id',$userId)
->where('pt_project_type', $chargeable) ->where('pt_project_type', $chargeable)
->where('pt_project_task_sts', 1) ->where('pt_project_task_sts', 1)
...@@ -150,13 +152,14 @@ class FormController extends Controller ...@@ -150,13 +152,14 @@ class FormController extends Controller
} }
$daymonth=cal_days_in_month(CAL_GREGORIAN,$month,$year); $daymonth=cal_days_in_month(CAL_GREGORIAN,$month,$year);
// dd($daymonth);
$strdays = []; $strdays = [];
for ($i=0; $i < $daymonth; $i++) { for ($i=0; $i < $daymonth; $i++) {
$tempdate = $year.'-'.sprintf('%02d', $month).'-'.sprintf('%02d', $i+1); $tempdate = $year.'-'.sprintf('%02d', $month).'-'.sprintf('%02d', $i+1);
$strday = Carbon::createFromFormat('Y-m-d', $tempdate)->format('l'); $strday = Carbon::createFromFormat('Y-m-d', $tempdate)->format('l');
// dd($strday);
$strdays[$i] = substr($strday, 0, 3); $strdays[$i] = substr($strday, 0, 3);
} }
...@@ -177,9 +180,33 @@ class FormController extends Controller ...@@ -177,9 +180,33 @@ class FormController extends Controller
$hour = null; $hour = null;
} }
// dd($projectlist); $dt = [];
if($phase == 1){
for ($i=0; $i < 15; $i++) {
$temp = Carbon::create($year, $month, $i+1, );
$dt[] = $temp->toDateString();
}
}
else
{
for ($j=15; $j < $daymonth; $j++) {
$temp = Carbon::create($year, $month, $j+1, );
$dt[] = $temp->toDateString();
}
}
// dd($dt);
// echo $dt->toDateTimeString();
$lat = LAttendance::where('staff_id', $userId)
->whereIn('DATE', $dt)
->get();
// dd($lat);
// dd(date('w', strtotime(data_get($lat1,'DATE'))));
// dd(date_parse_from_format('Y-m-d', data_get($lat1,'DATE'))['day']);
// dd(date('d'));
return view('timesheet::form.chargeableForm', compact('projectlist','userId','month','phase','daymonth','year', 'hour', 'strdays')); return view('timesheet::form.chargeableForm', compact('projectlist','userId','month','phase','daymonth','year', 'hour', 'strdays', 'lat'));
} }
public function savechargeablehours(Request $request) public function savechargeablehours(Request $request)
...@@ -814,7 +841,30 @@ class FormController extends Controller ...@@ -814,7 +841,30 @@ class FormController extends Controller
// dd($checkoverhead->id); // dd($checkoverhead->id);
return view('timesheet::form.overheadForm', compact('checkoverhead','projectlist','userId','month','phase','daymonth','year', 'hour', 'project', 'fk_tm_id', 'strdays')); $dt = [];
if($phase == 1){
for ($i=0; $i < 15; $i++) {
$temp = Carbon::create($year, $month, $i+1, );
$dt[] = $temp->toDateString();
}
}
else
{
for ($j=15; $j < $daymonth; $j++) {
$temp = Carbon::create($year, $month, $j+1, );
$dt[] = $temp->toDateString();
}
}
// dd($dt);
// echo $dt->toDateTimeString();
$lat = LAttendance::where('staff_id', $userId)
->whereIn('DATE', $dt)
->get();
// dd($lat);
return view('timesheet::form.overheadForm', compact('checkoverhead','projectlist','userId','month','phase','daymonth','year', 'hour', 'project', 'fk_tm_id', 'strdays', 'lat'));
} }
public function saveoverheadhours(Request $request) public function saveoverheadhours(Request $request)
......
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