Commit 6bb4c3ba by Azhan Hannan

Calculate overtime hours based on timesheet.

parent 1bf8e272
...@@ -148,8 +148,8 @@ ...@@ -148,8 +148,8 @@
@endfor @endfor
@endif @endif
@if($valchargehour) @if($totalcharge)
<td>{{ $totalcharge }}</td> <td>{{ number_format($totalcharge, 1, '.', '') }}</td>
<td>{{ number_format($totalcharge/8, 1, '.', '') }}</td> <td>{{ number_format($totalcharge/8, 1, '.', '') }}</td>
@else @else
<td>0</td> <td>0</td>
...@@ -196,7 +196,7 @@ ...@@ -196,7 +196,7 @@
@endfor @endfor
@endif @endif
<th>@if($totalchargehrs){{ $totalchargehrs }}@else 0 @endif</th> <th>@if($totalchargehrs){{ number_format($totalchargehrs, 1, '.', '') }}@else 0 @endif</th>
<th>@if($totalchargehrs){{ number_format($totalchargehrs/8, 1, '.', '') }}@else 0 @endif</th> <th>@if($totalchargehrs){{ number_format($totalchargehrs/8, 1, '.', '') }}@else 0 @endif</th>
</tfoot> </tfoot>
</table> </table>
...@@ -301,7 +301,7 @@ ...@@ -301,7 +301,7 @@
@endif @endif
@if($totaloverhead) @if($totaloverhead)
<td>{{ $totaloverhead }}</td> <td>{{ number_format($totaloverhead, 1, '.', '') }}</td>
<td>{{ number_format($totaloverhead/8, 1, '.', '') }}</td> <td>{{ number_format($totaloverhead/8, 1, '.', '') }}</td>
@else @else
<td>0</td> <td>0</td>
...@@ -346,7 +346,7 @@ ...@@ -346,7 +346,7 @@
<th>{{ $totaloverheadbyday }}</th> <th>{{ $totaloverheadbyday }}</th>
@endfor @endfor
@endif @endif
<th>@if($totaloverheadhrs) {{ $totaloverheadhrs }} @else 0 @endif</th> <th>@if($totaloverheadhrs) {{ number_format($totaloverheadhrs, 1, '.', '') }} @else 0 @endif</th>
<th>@if($totaloverheadhrs) {{ number_format($totaloverheadhrs/8, 1, '.', '') }} @else 0 @endif</th> <th>@if($totaloverheadhrs) {{ number_format($totaloverheadhrs/8, 1, '.', '') }} @else 0 @endif</th>
</tfoot> </tfoot>
</table> </table>
...@@ -472,7 +472,7 @@ ...@@ -472,7 +472,7 @@
<td style="width: 4%;">{{ $ac }}</td> <td style="width: 4%;">{{ $ac }}</td>
@endfor @endfor
@endif @endif
<td> @if($check) {{ ($totalchargehrs + $totaloverheadhrs) }} @else 0 @endif </td> <td> @if($check) {{ number_format(($totalchargehrs + $totaloverheadhrs), 1, '.', '') }} @else 0 @endif </td>
<td> {{ number_format(($totalchargehrs + $totaloverheadhrs)/8, 1, '.', '') }} </td> <td> {{ number_format(($totalchargehrs + $totaloverheadhrs)/8, 1, '.', '') }} </td>
</tr> </tr>
...@@ -483,10 +483,9 @@ ...@@ -483,10 +483,9 @@
@if( $phase == 1 ) @if( $phase == 1 )
@for($i = 0; $i < 15 ; $i++) @for($i = 0; $i < 15 ; $i++)
<?php <?php
$ot = 0; $ot = 8;
$ac = 0; $ac = 0;
$totalcbyday = 0; $totalcbyday = 0;
// $totalncbyday = 0;
$totaloverheadbyday = 0; $totaloverheadbyday = 0;
$date = $year.'-'.sprintf('%02d', $month).'-'.sprintf('%02d', $i+1); $date = $year.'-'.sprintf('%02d', $month).'-'.sprintf('%02d', $i+1);
...@@ -508,21 +507,21 @@ ...@@ -508,21 +507,21 @@
$ot = ($totalcbyday + $totaloverheadbyday)-8; $ot = ($totalcbyday + $totaloverheadbyday)-8;
if($ot >= 0) // if($ot >= 0)
$totalot += $ot; $totalot += $ot;
?> ?>
<td style="width: 4%;"> <td style="width: 4%;">
@if($ot > 0) @if($ot > 0)
{{ $ot }} {{ $ot }}
@else @else
0 ({{ abs($ot) }})
@endif @endif
</td> </td>
@endfor @endfor
@else @else
@for($i = 15; $i < $daymonth; $i++) @for($i = 15; $i < $daymonth; $i++)
<?php <?php
$ot = 0; $ot = 8;
$totalcbyday = 0; $totalcbyday = 0;
$totaloverheadbyday = 0; $totaloverheadbyday = 0;
$date = $year.'-'.sprintf('%02d', $month).'-'.sprintf('%02d', $i+1); $date = $year.'-'.sprintf('%02d', $month).'-'.sprintf('%02d', $i+1);
...@@ -545,25 +544,32 @@ ...@@ -545,25 +544,32 @@
$ot = ($totalcbyday + $totaloverheadbyday)-8; $ot = ($totalcbyday + $totaloverheadbyday)-8;
if($ot >= 0) $totalot += $ot; $totalot += $ot;
?> ?>
<td style="width: 4%;"> <td style="width: 4%;">
@if($ot > 0) @if($ot > 0)
{{ $ot }} {{ $ot }}
@else @else
0 ({{ abs($ot) }})
@endif @endif
</td> </td>
@endfor @endfor
@endif @endif
<td> <td>
@if($check) @if($totalot >= 0)
{{ $totalot }} {{ number_format($totalot, 1, '.', '') }}
@else
({{ abs(number_format($totalot, 1, '.', '')) }})
@endif
</td>
<td>
@if($totalot/8 >= 0)
{{ number_format($totalot/8, 1, '.', '') }}
@else @else
0 ({{ abs(number_format($totalot/8, 1, '.', '')) }})
@endif @endif
<!-- {{ number_format($totalot/8, 1, '.', '') }} -->
</td> </td>
<td>{{ number_format($totalot/8, 1, '.', '') }}</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
......
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