Commit ec18097c by hannan

calculate hours and print timesheet review

parent 89c1ae9a
......@@ -8,402 +8,752 @@
</div>
<br><br>
<table class="ui unstackable collapsing table">
<tbody>
<tr>
<td rowspan="3">
<img src="https://www.3fresources.com/app/themes/3f/images/3f-logo.svg" height="126" width="126" alt="3f-logo">
</td>
<td>Name</td>
<td>:</td>
<td>{{ $user->fullname }}</td>
<td rowspan="3"></td>
<td>Department</td>
<td>:</td>
<td>{{ $dept->description }}</td>
<td rowspan="3"></td>
</tr>
<tr>
<td>Staff No</td>
<td>:</td>
<td>{{ $user->staff_id }}</td>
<td>Reporting Manager</td>
<td>:</td>
<td>{{ $hod }}</td>
</tr>
<tr>
<td>Month</td>
<td>:</td>
<td>
<div class="ui form">
<div class="field">
<select class="ui search dropdown">
<option value="" selected="">{{$strMonth}}</option>
<option value="1">January</option>
<option value="2">February</option>
<option value="3">March</option>
<option value="4">April</option>
<option value="5">May</option>
<option value="6">June</option>
<option value="7">July</option>
<option value="8">August</option>
<option value="9">September</option>
<option value="10">October</option>
<option value="11">November</option>
<option value="12">December</option>
</select>
</div>
</div>
</td>
<td>Phase</td>
<td>:</td>
<td>
<div class="ui form">
<div class="field">
<select class="ui search dropdown">
@if($phase == 1)
<option value="{{ $phase }}">{{ $phase }}</option>
<option value="2">2</option>
@else
<option value="{{ $phase }}">{{ $phase }}</option>
<option value="1">1</option>
@endif
</select>
</div>
</div>
</td>
</td>
</tr>
</tbody>
</table>
<div class="ui segment">
<table class="ui celled structured table unstackable">
<thead>
<tr>
<th colspan="3">Chargeable</th>
<th colspan="@if($phase == 1) 15 @else {{$daymonth-15}} @endif" class="center aligned">Date</th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td style="width: 3%;"></td>
<td style="width: 10%;">Project Code</td>
<td style="width: 13%;">Project Name</td>
@if($phase == 1)
<div id="print_div">
<table id="printtable1" class="ui unstackable collapsing table">
<tbody>
<tr>
<td rowspan="3">
<img src="https://www.3fresources.com/app/themes/3f/images/3f-logo.svg" height="126" width="126" alt="3f-logo">
</td>
<td>Name</td>
<td>:</td>
<td>{{ $user->fullname }}</td>
<td rowspan="3"></td>
<td>Department</td>
<td>:</td>
<td>{{ $dept->description }}</td>
<td rowspan="3"></td>
</tr>
<tr>
<td>Staff No</td>
<td>:</td>
<td>{{ $user->staff_id }}</td>
<td>Reporting Manager</td>
<td>:</td>
<td>{{ $hod }}</td>
</tr>
<tr>
<td>Month</td>
<td>:</td>
<td>
<div class="ui form">
<div class="field">
<select class="ui search dropdown">
<option value="" selected="">{{$strMonth}}</option>
<option value="1">January</option>
<option value="2">February</option>
<option value="3">March</option>
<option value="4">April</option>
<option value="5">May</option>
<option value="6">June</option>
<option value="7">July</option>
<option value="8">August</option>
<option value="9">September</option>
<option value="10">October</option>
<option value="11">November</option>
<option value="12">December</option>
</select>
</div>
</div>
</td>
<td>Phase</td>
<td>:</td>
<td>
<div class="ui form">
<div class="field">
<select class="ui search dropdown">
@if($phase == 1)
<option value="{{ $phase }}">{{ $phase }}</option>
<option value="2">2</option>
@else
<option value="{{ $phase }}">{{ $phase }}</option>
<option value="1">1</option>
@endif
</select>
</div>
</div>
</td>
</td>
</tr>
</tbody>
</table>
<div class="ui segment">
<table id="printtable2" class="ui celled structured table unstackable">
<thead>
<tr>
<th colspan="3">Chargeable</th>
<th colspan="@if($phase == 1) 15 @else {{$daymonth-15}} @endif" class="center aligned">Date</th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td style="width: 4%;"></td>
<td style="width: 10%;">Project Code</td>
<td style="width: 13%;">Project Name</td>
@if($phase == 1)
@for($i = 0; $i < 15 ; $i++)
<td>{{$i+1}}</td>
@endfor
@else
@for($i = 15; $i < $daymonth; $i++)
<td>{{$i+1}}</td>
@endfor
@endif
<td>Total Hours</td>
</tr>
@foreach($chargeablelist as $key => $projectchargeable)
<?php $totalcharge = 0; ?>
<tr>
<td style="width: 4%;"></td>
<td style="width: 10%;">{{ $projectchargeable['pcode']}}</td>
<td style="width: 13%;">{{ $projectchargeable['pname']}}</td>
@if($phase == 1)
@for($i = 0; $i < 15 ; $i++)
<?php
$valchargehour = '';
$date = $year.'-'.sprintf('%02d', $month).'-'.sprintf('%02d', $i+1);
if($chargehour)
{
$valchargehour = $chargehour->where('td_date','=',$date)
->where('td_project',$projectchargeable['pid'])
->where('tm_phase',$phase)
->first();
@for($i = 0; $i < 15 ; $i++)
<td>{{$i+1}}</td>
@endfor
@else
@for($i = 15; $i < $daymonth; $i++)
<td>{{$i+1}}</td>
@endfor
@endif
<td>Total Hours</td>
</tr>
@foreach($chargeablelist as $key => $projectchargeable)
<?php $total = 0; ?>
<tr>
<td style="width: 3%;"></td>
<td style="width: 10%;">{{ $projectchargeable['pcode']}}</td>
<td style="width: 13%;">{{ $projectchargeable['pname']}}</td>
@if($phase == 1)
$totalcharge += data_get($valchargehour,'td_hours');
}
@for($i = 0; $i < 15 ; $i++)
<?php
$valchargehour = '';
$date = $year.'-'.sprintf('%02d', $month).'-'.sprintf('%02d', $i+1);
if($chargehour)
{
$valchargehour = $chargehour->where('td_date','=',$date)
->where('td_project',$projectchargeable['pid'])
->where('tm_phase',$phase)
->first();
$total += data_get($valchargehour,'td_hours');
}
?>
@if($valchargehour)
<td>{{ $valchargehour->td_hours }}</td>
@else
<td></td>
@endif
@endfor
@else
@for($i = 15; $i < $daymonth; $i++)
<?php
$valchargehour = '';
$date = $year.'-'.sprintf('%02d', $month).'-'.sprintf('%02d', $i+1);
if($chargehour)
{
$valchargehour = $chargehour->where('td_date','=',$date)
->where('td_project',$projectchargeable['pid'])
->where('tm_phase',$phase)
->first();
$total += data_get($valchargehour,'td_hours');
}
?>
@if($valchargehour)
<td>{{ $valchargehour->td_hours }}</td>
@else
<td></td>
@endif
@endfor
@endif
@if($valchargehour)
<td>{{ $total }}</td>
@else
<td>0</td>
@endif
</tr>
@endforeach
</tbody>
<tfoot>
<th colspan="@if($phase == 1) 18 @else {{$daymonth-12}} @endif">Total</th>
<th>@if($totalchargehrs){{ $totalchargehrs }}@else 0 @endif</th>
</tfoot>
</table>
</div>
?>
@if($valchargehour)
<td style="width: 4%;">{{ $valchargehour->td_hours }}</td>
@else
<td style="width: 4%;"></td>
@endif
<div class="ui segment">
<table class="ui celled structured table unstackable">
<thead>
<tr>
<th colspan="2">Non-Chargeable</th>
<th colspan="@if($phase == 1) 15 @else {{$daymonth-15}} @endif" class="center aligned">Date</th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td style="width: 3%;"></td>
<td style="width: 23%;">Task</td>
@if($phase == 1)
@endfor
@else
@for($i = 15; $i < $daymonth; $i++)
<?php
$valchargehour = '';
$date = $year.'-'.sprintf('%02d', $month).'-'.sprintf('%02d', $i+1);
if($chargehour)
{
$valchargehour = $chargehour->where('td_date','=',$date)
->where('td_project',$projectchargeable['pid'])
->where('tm_phase',$phase)
->first();
@for($i = 0; $i < 15 ; $i++)
<td>{{$i+1}}</td>
@endfor
@else
@for($i = 15; $i < $daymonth; $i++)
<td>{{$i+1}}</td>
@endfor
$totalcharge += data_get($valchargehour,'td_hours');
}
?>
@if($valchargehour)
<td style="width: 4%;">{{ $valchargehour->td_hours }}</td>
@else
<td style="width: 4%;"></td>
@endif
@endfor
@endif
@if($valchargehour)
<td>{{ $totalcharge }}</td>
@else
<td>0</td>
@endif
</tr>
@endforeach
</tbody>
<tfoot>
<th colspan="3">Total (A)</th>
@if($phase == 1)
@for($i = 0; $i < 15 ; $i++)
<?php
$totalcbyday = 0;
$date = $year.'-'.sprintf('%02d', $month).'-'.sprintf('%02d', $i+1);
$valcbyday = $chargehour->where('td_date','=', $date)
->where('tm_phase',$phase);
foreach($valcbyday as $key => $value) {
$totalcbyday += $value->td_hours;
}
?>
<th>{{ $totalcbyday }}</th>
@endfor
@else
@for($i = 15; $i < $daymonth; $i++)
<?php
$totalcbyday = 0;
$date = $year.'-'.sprintf('%02d', $month).'-'.sprintf('%02d', $i+1);
$valcbyday = $chargehour->where('td_date','=', $date)
->where('tm_phase',$phase);
foreach($valcbyday as $key => $value) {
$totalcbyday += $value->td_hours;
}
?>
<th>{{ $totalcbyday }}</th>
@endfor
@endif
<th>@if($totalchargehrs){{ $totalchargehrs }}@else 0 @endif</th>
</tfoot>
</table>
</div>
<div class="ui segment">
<table id="printtable3" class="ui celled structured table unstackable">
<thead>
<tr>
<th colspan="2">Non-Chargeable</th>
<th colspan="@if($phase == 1) 15 @else {{$daymonth-15}} @endif" class="center aligned">Date</th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td style="width: 4%;"></td>
<td style="width: 23%;">Task</td>
@if($phase == 1)
@for($i = 0; $i < 15 ; $i++)
<td>{{$i+1}}</td>
@endfor
@else
@for($i = 15; $i < $daymonth; $i++)
<td>{{$i+1}}</td>
@endfor
@endif
<td>Total Hours</td>
</tr>
@foreach($nonchargeablelist as $key => $projectnonchargeable)
<?php $totalnoncharge = 0; ?>
<tr>
<td style="width: 4%;"></td>
<td style="width: 23%;">{{ $projectnonchargeable['pname']}}</td>
@if($phase == 1)
@for($i = 0; $i < 15 ; $i++)
<?php
$valnonchargehour = '';
$date = $year.'-'.sprintf('%02d', $month).'-'.sprintf('%02d', $i+1);
if($nonchargehour)
{
$valnonchargehour = $nonchargehour->where('td_date','=',$date)
->where('td_project',$projectnonchargeable['pid'])
->where('tm_phase',$phase)
->first();
$totalnoncharge += data_get($valnonchargehour,'td_hours');
}
?>
@if($valnonchargehour)
<td style="width: 4%;">{{ $valnonchargehour->td_hours }}</td>
@else
<td style="width: 4%;"></td>
@endif
@endfor
@endif
<td>Total Hours</td>
</tr>
@else
@for($i = 15; $i < $daymonth; $i++)
<?php
@foreach($nonchargeablelist as $key => $projectnonchargeable)
<?php $total = 0; ?>
<tr>
<td style="width: 3%;"></td>
<td style="width: 23%;">{{ $projectnonchargeable['pname']}}</td>
$valnonchargehour = '';
$date = $year.'-'.sprintf('%02d', $month).'-'.sprintf('%02d', $i+1);
if($nonchargehour)
{
$valnonchargehour = $nonchargehour->where('td_date','=',$date)
->where('td_project',$projectnonchargeable['pid'])
->where('tm_phase',$phase)
->first();
$totalnoncharge += data_get($valnonchargehour,'td_hours');
}
?>
@if($valnonchargehour)
<td style="width: 4%;">{{ $valnonchargehour->td_hours }}</td>
@else
<td style="width: 4%;"></td>
@endif
@endfor
@endif
@if($valnonchargehour)
<td>{{ $totalnoncharge }}</td>
@else
<td>0</td>
@endif
</tr>
@endforeach
</tbody>
<tfoot>
<th colspan="2">Total (B)</th>
@if($phase == 1)
@for($i = 0; $i < 15 ; $i++)
<?php
$totalncbyday = 0;
$date = $year.'-'.sprintf('%02d', $month).'-'.sprintf('%02d', $i+1);
$valncbyday = $nonchargehour->where('td_date','=', $date)
->where('tm_phase',$phase);
foreach($valncbyday as $key => $value) {
$totalncbyday += $value->td_hours;
}
?>
<th>{{ $totalncbyday }}</th>
@endfor
@else
@for($i = 15; $i < $daymonth; $i++)
<?php
$totalncbyday = 0;
$date = $year.'-'.sprintf('%02d', $month).'-'.sprintf('%02d', $i+1);
$valncbyday = $nonchargehour->where('td_date','=', $date)
->where('tm_phase',$phase);
foreach($valncbyday as $key => $value) {
$totalncbyday += $value->td_hours;
}
?>
<th>{{ $totalncbyday }}</th>
@endfor
@endif
<th>@if($totalnonchargehrs){{ $totalnonchargehrs }}@else 0 @endif</th>
</tfoot>
</table>
</div>
<div class="ui segment">
<table id="printtable4" class="ui celled structured table unstackable">
<thead>
<tr>
<th colspan="2">Overhead</th>
<th colspan="@if($phase == 1) 15 @else {{$daymonth-15}} @endif" class="center aligned">Date</th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td style="width: 4%;"></td>
<td style="width: 23%;">Overhead</td>
@if($phase == 1)
@for($i = 0; $i < 15 ; $i++)
<td>{{$i+1}}</td>
@endfor
@else
@for($i = 15; $i < $daymonth; $i++)
<td>{{$i+1}}</td>
@endfor
@endif
<td>Total Hours</td>
</tr>
@foreach($overheadlist as $key => $projectoverhead)
<?php $totaloverhead = 0; ?>
<tr>
<td style="width: 4%;"></td>
<td style="width: 23%;">{{ $projectoverhead['pname']}}</td>
@if($phase == 1)
@for($i = 0; $i < 15 ; $i++)
<?php
$valoverheadhour = '';
$date = $year.'-'.sprintf('%02d', $month).'-'.sprintf('%02d', $i+1);
if($overheadhour)
{
$valoverheadhour = $overheadhour->where('td_date','=',$date)
->where('fk_o_id',$projectoverhead['pid'])
->where('tm_phase',$phase)
->first();
$totaloverhead += data_get($valoverheadhour,'td_hours');
}
?>
@if($valoverheadhour)
<td style="width: 4%;">{{ $valoverheadhour->td_hours }}</td>
@else
<td style="width: 4%;">0</td>
@endif
@endfor
@else
@for($i = 15; $i < $daymonth ; $i++)
<?php
$valoverheadhour = '';
$date = $year.'-'.sprintf('%02d', $month).'-'.sprintf('%02d', $i+1);
if($overheadhour)
{
$valoverheadhour = $overheadhour->where('td_date','=',$date)
->where('fk_o_id',$projectoverhead['pid'])
->where('tm_phase',$phase)
->first();
$totaloverhead += data_get($valoverheadhour,'td_hours');
}
?>
@if($valoverheadhour)
<td style="width: 4%;">{{ $valoverheadhour->td_hours }}</td>
@else
<td style="width: 4%;">0</td>
@endif
@endfor
@endif
@if($valchargehour)
<td>{{ $totaloverhead }}</td>
@else
<td>0</td>
@endif
</tr>
@endforeach
</tbody>
<tfoot>
<th colspan="2">Total (C)</th>
@if($phase == 1)
@for($i = 0; $i < 15 ; $i++)
<?php
$totaloverheadbyday = 0;
$date = $year.'-'.sprintf('%02d', $month).'-'.sprintf('%02d', $i+1);
$valoverheadbyday = $overheadhour->where('td_date','=', $date)
->where('tm_phase',$phase);
foreach($valoverheadbyday as $key => $value) {
$totaloverheadbyday += $value->td_hours;
}
?>
<th>{{ $totaloverheadbyday }}</th>
@endfor
@else
@for($i = 15; $i < $daymonth; $i++)
<?php
$totaloverheadbyday = 0;
$date = $year.'-'.sprintf('%02d', $month).'-'.sprintf('%02d', $i+1);
$valoverheadbyday = $overheadhour->where('td_date','=', $date)
->where('tm_phase',$phase);
foreach($valoverheadbyday as $key => $value) {
$totaloverheadbyday += $value->td_hours;
}
?>
<th>{{ $totaloverheadbyday }}</th>
@endfor
@endif
<th>@if($totaloverheadhrs) {{ $totaloverheadhrs }} @else 0 @endif</th>
</tfoot>
</table>
</div>
<div class="ui segment">
<table id="printtable5" class="ui celled structured table unstackable">
<thead>
<tr>
<th colspan="2">Note:</th>
</tr>
</thead>
<tbody>
<tr>
<td style="width: 13.5%;">Date</td>
<td>Description</td>
</tr>
@foreach($notes as $key => $value)
<tr>
<td>{{ $value->td_date }}</td>
<td>{{ $value->td_overhead_note }}</td>
</tr>
@endforeach
</tbody>
</table>
</div>
<div class="ui segment">
<table id="printtabl6" class="ui celled structured table unstackable">
<thead>
<th colspan="@if($phase == 1) 17 @else {{$daymonth-13}} @endif"></th>
<th>Total hours</th>
<th>Total days</th>
</thead>
<tbody>
<tr>
<td style="width: 4%;"></td>
<td style="width: 23%;">Total (B) + (C) Non Chargeable</td>
@if( $phase == 1 )
@for($i = 0; $i < 15 ; $i++)
<?php
$bc = 0;
$totalncbyday = 0;
$totaloverheadbyday = 0;
$date = $year.'-'.sprintf('%02d', $month).'-'.sprintf('%02d', $i+1);
$valncbyday = $nonchargehour->where('td_date','=', $date)
->where('tm_phase',$phase);
$valoverheadbyday = $overheadhour->where('td_date','=', $date)
->where('tm_phase',$phase);
foreach($valncbyday as $key => $value) {
$totalncbyday += $value->td_hours;
}
foreach($valoverheadbyday as $key => $value) {
$totaloverheadbyday += $value->td_hours;
}
$bc = $totalncbyday + $totaloverheadbyday;
?>
<td style="width: 4%;">{{ $bc }}</td>
@endfor
@else
@for($i = 15; $i < $daymonth; $i++)
<?php
$bc = 0;
$totalncbyday = 0;
$totaloverheadbyday = 0;
$date = $year.'-'.sprintf('%02d', $month).'-'.sprintf('%02d', $i+1);
$valncbyday = $nonchargehour->where('td_date','=', $date)
->where('tm_phase',$phase);
$valoverheadbyday = $overheadhour->where('td_date','=', $date)
->where('tm_phase',$phase);
foreach($valncbyday as $key => $value) {
$totalncbyday += $value->td_hours;
}
foreach($valoverheadbyday as $key => $value) {
$totaloverheadbyday += $value->td_hours;
}
$bc = $totalncbyday + $totaloverheadbyday;
?>
<td style="width: 4%;">{{ $bc }}</td>
@endfor
@endif
<td> @if($check) {{ ($totalnonchargehrs + $totaloverheadhrs) }} @else 0 @endif </td>
<td> {{ ($totalnonchargehrs + $totaloverheadhrs)/8 }} </td>
</tr>
<tr>
<td style="width: 4%;"></td>
<td style="width: 23%;">Total (A+B+C) - 8 Overtime</td>
<?php $totalot = 0; ?>
@if( $phase == 1 )
@for($i = 0; $i < 15 ; $i++)
<?php
$ot = 0;
$bc = 0;
$totalcbyday = 0;
$totalncbyday = 0;
$totaloverheadbyday = 0;
$date = $year.'-'.sprintf('%02d', $month).'-'.sprintf('%02d', $i+1);
$valcbyday = $chargehour->where('td_date','=', $date)
->where('tm_phase',$phase);
$valncbyday = $nonchargehour->where('td_date','=', $date)
->where('tm_phase',$phase);
$valoverheadbyday = $overheadhour->where('td_date','=', $date)
->where('tm_phase',$phase);
foreach($valcbyday as $key => $value) {
$totalcbyday += $value->td_hours;
}
foreach($valncbyday as $key => $value) {
$totalncbyday += $value->td_hours;
}
foreach($valoverheadbyday as $key => $value) {
$totaloverheadbyday += $value->td_hours;
}
$ot = ($totalcbyday + $totalncbyday + $totaloverheadbyday)-8;
if($ot >= 0)
$totalot += $ot;
?>
<td style="width: 4%;">
@if($ot > 0)
{{ $ot }}
@else
0
@endif
</td>
@endfor
@else
@for($i = 15; $i < $daymonth; $i++)
<?php
$ot = 0;
$bc = 0;
$totalcbyday = 0;
$totalncbyday = 0;
$totaloverheadbyday = 0;
$date = $year.'-'.sprintf('%02d', $month).'-'.sprintf('%02d', $i+1);
$valcbyday = $chargehour->where('td_date','=', $date)
->where('tm_phase',$phase);
$valncbyday = $nonchargehour->where('td_date','=', $date)
->where('tm_phase',$phase);
$valoverheadbyday = $overheadhour->where('td_date','=', $date)
->where('tm_phase',$phase);
foreach($valcbyday as $key => $value) {
$totalcbyday += $value->td_hours;
}
foreach($valncbyday as $key => $value) {
$totalncbyday += $value->td_hours;
}
foreach($valoverheadbyday as $key => $value) {
$totaloverheadbyday += $value->td_hours;
}
$ot = ($totalcbyday + $totalncbyday + $totaloverheadbyday)-8;
if($ot >= 0)
$totalot += $ot;
?>
<td style="width: 4%;">
@if($ot > 0)
{{ $ot }}
@else
0
@endif
</td>
@endfor
@endif
<td>
@if($check)
{{ $totalot }}
@else
0
@endif
</td>
<td>{{ $totalot/8 }}</td>
</tr>
</tbody>
</table>
</div>
@for($i = 0; $i < 15 ; $i++)
<?php
$valnonchargehour = '';
$date = $year.'-'.sprintf('%02d', $month).'-'.sprintf('%02d', $i+1);
if($nonchargehour)
{
$valnonchargehour = $nonchargehour->where('td_date','=',$date)
->where('td_project',$projectnonchargeable['pid'])
->where('tm_phase',$phase)
->first();
$total += data_get($valnonchargehour,'td_hours');
}
?>
@if($valnonchargehour)
<td>{{ $valnonchargehour->td_hours }}</td>
@else
<td></td>
@endif
@endfor
@else
@for($i = 15; $i < $daymonth; $i++)
<?php
$valnonchargehour = '';
$date = $year.'-'.sprintf('%02d', $month).'-'.sprintf('%02d', $i+1);
if($nonchargehour)
{
$valnonchargehour = $nonchargehour->where('td_date','=',$date)
->where('td_project',$projectnonchargeable['pid'])
->where('tm_phase',$phase)
->first();
$total += data_get($valnonchargehour,'td_hours');
}
?>
@if($valnonchargehour)
<td>{{ $valnonchargehour->td_hours }}</td>
@else
<td></td>
@endif
@endfor
@endif
@if($valnonchargehour)
<td>{{ $total }}</td>
@else
<td>0</td>
@endif
</tr>
@endforeach
</tbody>
<tfoot>
<th colspan="@if($phase == 1) 17 @else {{$daymonth-13}} @endif">Total</th>
<th>@if($totalnonchargehrs){{ $totalnonchargehrs }}@else 0 @endif</th>
</tfoot>
</table>
</div>
<br>
<button type="button" onclick="printdiv('print_div')"> print</button>
<div class="ui segment">
<table class="ui celled structured table unstackable">
<thead>
<tr>
<th colspan="2">Overhead</th>
<th colspan="@if($phase == 1) 15 @else {{$daymonth-15}} @endif" class="center aligned">Date</th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td style="width: 3%;"></td>
<td style="width: 23%;">Overhead</td>
@if($phase == 1)
</div>
@for($i = 0; $i < 15 ; $i++)
<td>{{$i+1}}</td>
@endfor
@else
@for($i = 15; $i < $daymonth; $i++)
<td>{{$i+1}}</td>
@endfor
@endif
<td>Total Hours</td>
</tr>
@foreach($overheadlist as $key => $projectoverhead)
<?php $total = 0; ?>
<tr>
<td style="width: 3%;"></td>
<td style="width: 10%;">{{ $projectoverhead['pname']}}</td>
@endsection
@if($phase == 1)
@for($i = 0; $i < 15 ; $i++)
<?php
@push('script')
$valoverheadhour = '';
$date = $year.'-'.sprintf('%02d', $month).'-'.sprintf('%02d', $i+1);
<!-- <script type="text/javascript">
function printdiv(printpage)
{
if($overheadhour)
{
$valoverheadhour = $overheadhour->where('td_date','=',$date)
->where('fk_o_id',$projectoverhead['pid'])
->where('tm_phase',$phase)
->first();
$total += data_get($valoverheadhour,'td_hours');
}
// var oldstr = document.body.innerHTML;
// var el = document.getElementById("body1");
// el.classList.remove("on-the-fly-behavior");
// el.classList.add("print-fly");
// el.style.fontSize = "10px !important;background-color:white !important";
?>
@if($valoverheadhour)
<td>{{ $valoverheadhour->td_hours }}</td>
@else
<td></td>
@endif
document.getElementById(printpage).style.width = "100%";
@endfor
@else
@for($i = 15; $i < $daymonth ; $i++)
<?php
document.getElementById("printtable1").style.width = "100%";
document.getElementById("printtable1").style.fontSize = "10px";
$valoverheadhour = '';
$date = $year.'-'.sprintf('%02d', $month).'-'.sprintf('%02d', $i+1);
document.getElementById("printtable2").style.width = "100%";
document.getElementById("printtable2").style.fontSize = "10px";
if($overheadhour)
{
$valoverheadhour = $overheadhour->where('td_date','=',$date)
->where('fk_o_id',$projectoverhead['pid'])
->where('tm_phase',$phase)
->first();
document.getElementById("printtable3").style.width = "100%";
document.getElementById("printtable3").style.fontSize = "10px";
$total += data_get($valoverheadhour,'td_hours');
}
?>
@if($valoverheadhour)
<td>{{ $valoverheadhour->td_hours }}</td>
@else
<td></td>
@endif
@endfor
@endif
@if($valchargehour)
<td>{{ $total }}</td>
@else
<td>0</td>
@endif
</tr>
@endforeach
</tbody>
<tfoot>
<th colspan="@if($phase == 1) 17 @else {{$daymonth-13}} @endif">Total</th>
<th>@if($totaloverheadhrs) {{ $totaloverheadhrs }} @else 0 @endif</th>
</tfoot>
</table>
</div>
document.getElementById("printtable4").style.width = "100%";
document.getElementById("printtable4").style.fontSize = "10px";
<div class="ui segment">
<table class="ui celled structured table unstackable">
<thead>
<tr>
<th colspan="2">Note:</th>
</tr>
</thead>
<tbody>
<tr>
<td style="width: 13.5%;">Date</td>
<td>Description</td>
</tr>
@foreach($notes as $key => $value)
<tr>
<td>{{ $value->td_date }}</td>
<td>{{ $value->td_overhead_note }}</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
@endsection
\ No newline at end of file
document.getElementById("printtable5").style.width = "100%";
document.getElementById("printtable5").style.fontSize = "10px";
document.getElementById("printtable6").style.width = "100%";
document.getElementById("printtable6").style.fontSize = "10px";
var headstr = "<html><head><title></title></head><body style='background-color: white;font-size:10px;margin-left:50px;margin-right:50px'>";
var footstr = "</body>";
var newstr = document.all.item(printpage).innerHTML;
var winPrint = window.open('', '', 'left=0,top=0,width=800,height=600,toolbar=0,scrollbars=0,status=0');
winPrint.document.write(headstr+newstr+footstr);
winPrint.document.close();
winPrint.focus();
setTimeout(function()
{
winPrint.print();
winPrint.close();
}, 1000);
}
</script> -->
<script type="text/javascript">
function printdiv(printpage)
{
var oldstr = document.body.innerHTML;
var el = document.getElementById("body1");
el.classList.remove("on-the-fly-behavior");
el.classList.add("print-flys");
var headstr = "<html><head><title></title></head><body>";
var footstr = "</body>";
var newstr = document.all.item(printpage).innerHTML;
document.body.innerHTML = headstr+newstr+footstr;
window.print();
el.classList.remove("print-flys");
el.classList.add("on-the-fly-behavior");
document.body.innerHTML = oldstr;
$('#cpsurat').html();
return false;
}
</script>
@endpush
\ No newline at end of file
......@@ -96,9 +96,13 @@ class DashboardController extends Controller
$hod = Staff_info::find($user->penyokong)
->fullname;
$month = date('n');
$year = date('Y');
$day = date('j');
// $month = date('n');
// $year = date('Y');
// $day = date('j');
$month = 7;
$year = 2022;
$day = 2;
if ($day < 16) {
$phase = 1;
......@@ -116,7 +120,6 @@ class DashboardController extends Controller
{
$phase = $request->phase;
}
if(isset($request->month))
{
$month = $request->month;
......@@ -139,9 +142,8 @@ class DashboardController extends Controller
->where('pt_project_type', $nonchargeable)
->get();
$overheadproject = Overhead::where('o_overhead_sts',1)
->get();
// $overheadproject = Overhead::where('o_overhead_sts',1)
// ->get();
$chargeablelist = [];
......@@ -171,17 +173,6 @@ class DashboardController extends Controller
}
foreach ($overheadproject as $key => $value) {
$overheadlist[] = [
'pid' => $value->id,
'pname' => $value->o_overhead_desc,
];
}
$check = Ts_master::where('tm_staff_id', $user->staff_id)
->where('tm_year', $year)
->where('tm_month', $month)
......@@ -201,27 +192,36 @@ class DashboardController extends Controller
// ->where('td_hours', '!=', 0)
->get();
// $filledoverhead = Ts_detail::where('fk_tm_id',$check->id)
// ->where('td_project_type', $overhead)
// // ->where('td_hours', '!=', 0)
// ->get();
// foreach ($filledoverhead as $key => $value) {
// $temp[$key] =
// if($overheadlist[$key] != $overheadlist[$key+1]) {
// $overheadlist[] = [
// 'pid' => $value->fk_o_id,
// 'pname' => $value->td_overhead_desc,
// ];
// }
// }
// dd($overheadlist);
$overheadhour = Ts_detail::where('fk_tm_id',$check->id)
->where('td_project_type', $overhead)
// ->where('td_hours', '!=', 0)
->get();
->where('td_hours', '!=', 0)
->get();
$tempOverhead = [];
$tempOverheadid = [];
$tempOverhead[0] = $overheadhour[0]->td_overhead_desc;
$tempOverheadid[0] = $overheadhour[0]->fk_o_id;
$j = 0;
for($i = 0; $i < count($overheadhour); $i++){
if ($tempOverhead[$j] == $overheadhour[$i]->td_overhead_desc) {
} else {
$j++;
$tempOverhead[$j] = $overheadhour[$i]->td_overhead_desc;
$tempOverheadid[$j] = $overheadhour[$i]->fk_o_id;
}
}
foreach ($tempOverhead as $key => $value) {
$overheadlist[] = [
'pid' => $tempOverheadid[$key],
'pname' => $tempOverhead[$key],
];
}
}
else
......@@ -246,7 +246,7 @@ class DashboardController extends Controller
->orderby('td_date')
->get();
return view('timesheet::dashboard.timesheetViewer', compact('user', 'dept', 'hod', 'phase', 'month', 'year', 'day', 'strMonth', 'daymonth', 'chargeablelist', 'nonchargeablelist', 'overheadlist', 'chargehour', 'nonchargehour', 'totalchargehrs', 'totalnonchargehrs', 'totaloverheadhrs', 'overheadhour', 'notes'));
return view('timesheet::dashboard.timesheetViewer', compact('user', 'dept', 'hod', 'phase', 'month', 'year', 'day', 'strMonth', 'daymonth', 'chargeablelist', 'nonchargeablelist', 'overheadlist', 'chargehour', 'nonchargehour', 'totalchargehrs', 'totalnonchargehrs', 'totaloverheadhrs', 'overheadhour', 'notes', 'check'));
}
......
......@@ -19,7 +19,59 @@
</head>
<body data-theme="{{ config('laravolt.ui.sidebar_theme') }}" class="{{ $bodyClass ?? '' }}">
<body data-theme="{{ config('laravolt.ui.sidebar_theme') }}" class="on-the-fly-behavior {{ $bodyClass ?? '' }}" id="body1">
<style scoped>
.print-fly {
background-color: white;
font-size:10px;
}
.print-flys {
background-color: white;
width:auto;
}
.on-the-fly-behavior {
background-image: url('{{ asset('assets/images/bg.png') }}');
background-repeat:no-repeat;
background-size: contain;
}
.langdisp
{
background-color: darkmagenta;
border-radius: 20px;
margin-right: 10px;
margin-top: 20px !important;
padding-top: 10px;
padding-bottom: 14px;
padding-right: 20px;
padding-left: 20px;"
}
@media (max-width: 1200px)
{
.on-the-fly-behavior {
background-image: url('{{ asset('assets/images/bg.png') }}');
background-repeat:no-repeat;
background-size: unset;
}
.langdisp
{
background-color: unset !important;
border-radius: unset !important;
margin: unset !important;
padding: unset !important;
}
}
</style>
@yield('body')
......
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