Skip to content

Instantly share code, notes, and snippets.

@esmeromichael
Created March 9, 2020 07:46
Show Gist options
  • Save esmeromichael/2357a38a154ee47cbb331ccc4cb4bc88 to your computer and use it in GitHub Desktop.
Save esmeromichael/2357a38a154ee47cbb331ccc4cb4bc88 to your computer and use it in GitHub Desktop.
<td>
<table class="circle101" style="width: 85%;">
<tr>
<td style="width: 55%">
<label style="text-align: center;font-weight: bold;">
{{ $details->employee->first_name }} {{ $details->employee->middle_name }} {{ $details->employee->last_name }}
</label>
</td>
<td style="width: 45%;">
<?php
$date_from = date('F j',strtotime($header->date_from));
$date_to = date('d',strtotime($header->date_to));
$year = date('Y',strtotime($header->date_to));
?>
<label style="text-align: right;">Payroll Period : {{ $date_from }}-{{ $date_to }}, {{ $year }}</label>
</td>
</tr>
</table>
<table><tr><td></td></tr></table>
<table class="circle101" style="width: 80%;border: .5px solid black;">
<thead>
<tr>
<th class="circle1" style="width:9%;">Day</th>
<th class="circle1" style="width:11%;">Date</th>
<th class="circle" style="width:11%;">IN</th>
<th class="circle" style="width:11.7%;">OUT</th>
<th class="circle1" style="width:15%;">Late(mins)</th>
<th class="circle1" style="width:13%;">Late(hrs)</th>
<th class="circle1" style="width:13%;">OT(in hrs)</th>
<th class="circle1" style="width:13%;">Basic Pay</th>
<th class="circle1" style="width:18%;">Premium</th>
</tr>
</thead>
<tbody>
<?php
$total_hrs = 0;
$total_ot = 0;
$total_prem = 0;
$basic_pay = 0;
?>
@foreach($data as $result)
@if($details->id == $result['detail_id'])
<tr>
<?php
$day = date('D', strtotime($result['date']));
$day_int = date('w', strtotime($result['date']));
$dts = date('Y-m-d', strtotime($result['date']));
$emp_dtr = App\EmpDtr::where('emp_id',$details->emp_id)->where('date',$dts)->first();
?>
<td class="circle2">{{ $day }}</td>
<td class="circle2">{{ date('m/j/y', strtotime($result['date'])) }}</td>
<td class="circle2">
@if($details->position($details->emp_id)->no_dtr == 'No')
@if($result['timein1'] > 0)
@if($result['type'] == "OB")
OB
@else
{{ $result['timein1'] }}
@endif
@else
@if($result['type'] == "DTR")
-
@else
{{$result['type']}}
@endif
@endif
@endif
</td>
<td class="circle2">
@if($details->position($details->emp_id)->no_dtr == 'No')
@if($result['timeout1'] > 0)
@if($result['type'] == "OB")
@else
@if($emp_dtr)
{{App\EmpDtr::timeOut($emp_dtr,$day_int)}}
@else
{{ $result['timeout1'] }}
@endif
@endif
@else
-
@endif
@endif
</td>
<td class="circle2">
@if($details->position($details->emp_id)->no_dtr == 'No')
@if($result['late_mins'] > 0)
{{ $result['late_mins'] }}
@else
@if(($details->position($details->emp_id)->rate_type == "Monthly") && ($result['type'] == "RH" || $result['type'] == "SH"))
<?php
$basicpay = ($details->position($details->emp_id)->basic_rate / 26);
$basic_pay = number_format($basicpay,2,'.','');
$regHoliday = App\HolidayList::beforeAfterLate($details->emp_id,$dts,$basic_pay);
if($regHoliday['undertimePay'] > 0){
echo number_format($regHoliday['undertimePay'],2,'.','');
}
?>
@else
-
@endif
@endif
@endif
</td>
<td class="circle2">
@if($details->position($details->emp_id)->no_dtr == 'No')
@if($result['late_hrs'] > 0)
{{ $result['late_hrs'] }}
@else
-
@endif
@endif
</td>
<td class="circle2">
@if($result['ot_hours'] > 0)
{{ $result['ot_hours'] }}
@else
-
@endif
</td>
<td class="circle2">
<?php
$worksched = DB::select("SELECT cast(time_to_sec(TIMEDIFF(timeout,timein)) / (60 * 60) as decimal(10, 1)) as time1,
cast(time_to_sec(TIMEDIFF(timeout2,timein2)) / (60 * 60) as decimal(10, 1)) as time2,
cast(time_to_sec(TIMEDIFF(timeout3,timein3)) / (60 * 60) as decimal(10, 1)) as time3,
day from emp_work_schedules where emp_id = $details->emp_id and day = $day_int and status = 'Active' ORDER BY date_start desc LIMIT 1");
if($worksched){
$schedTotal = number_format($worksched[0]->time1 + $worksched[0]->time2 + $worksched[0]->time3, 2, '.','');
}
else{
$schedTotal = 0.00;
}
?>
@if($details->position1($details->emp_id, $dts))
@if($details->position1($details->emp_id, $dts)->rate_type == "Monthly")
-
@else
@if($details->position($details->emp_id)->no_dtr == 'No')
{{ $result['basic_pay'] }}
@else
{{ $result['reg_hours'] }} {{ $schedTotal }}
@if($result['type'] == 'UT')
@if(number_format($result['reg_hours'], 2, '.', '') >= number_format($schedTotal, 2, '.', ''))
@else
{{ $result['basic_pay'] }}
@endif
@else
{{ $result['basic_pay'] }}
@endif
@endif
@endif
@endif
</td>
<td class="circle2">
@if($result['premium'] > 0)
{{ $result['premium'] }}
@else
-
@endif
</td>
</tr>
<?php
$total_hrs += $result['late_hrs'];
$total_ot += $result['ot_hours'];
$total_prem += $result['premium'];
$basic_pay += $result['basic_pay'];
?>
@endif
@endforeach
</tbody>
</table>
<table style="width: 80%;" cellspacing="1">
<tr>
<td style="width: 57%;"></td>
<td class="circle101" style="width: 14.2%;text-align: center;">
@if($details->position($details->emp_id)->no_dtr == 'No')
{{ ($total_hrs > 0) ? number_format($total_hrs,2,'.',',') : '0.00' }}
@endif
</td>
<td class="circle101" style="width: 12%;text-align:center;">{{ ($total_ot > 0) ? number_format($total_ot,2,'.',',') : '-' }}</td>
<td class="circle101" style="width: 16%;text-align:center;">
@if($details->position($details->emp_id)->rate_type == 'Monthly')
@else
{{ ($basic_pay > 0) ? number_format($basic_pay,2,'.',',') : '0.00' }}
@endif
</td>
<td class="circle101" style="width: 13%;text-align:center;">{{ ($total_prem > 0) ? number_format($total_prem,2,'.',',') : '-' }}</td>
</tr>
</table>
<table style="width: 79.5%;">
<tbody>
<tr>
<td style="width: 50%;">
<table>
@if($details->position($details->emp_id)->rate_type == 'Monthly')
<tr>
<td class="footer" style="width: 60%;">Basic Pay</td>
<td class="footer" style="width: 40%;text-align: right;">{{ ($details->basic_pay > 0) ? number_format($details->basic_pay,2,'.',',') : '0.00' }}</td>
</tr>
<tr>
<td class="footer" style="width: 60%;">Premium</td>
<td class="footer" style="width: 40%;text-align: right;">{{ ($details->premium > 0) ? number_format($details->premium,2,'.',',') : '0.00' }}</td>
</tr>
<tr>
<td class="footer" style="width: 60%;">Absences</td>
<td class="footer" style="width: 40%;text-align: right;">( {{ ($details->absences_pay > 0) ? number_format($details->absences_pay,2,'.',',') : '0.00' }} )</td>
</tr>
<tr>
<td class="footer" style="width: 60%;">Late/Undertime</td>
<td class="footer" style="width: 40%;text-align: right;">( {{ ($details->undertime_pay > 0) ? number_format($details->undertime_pay,2,'.',',') : '0.00' }} )</td>
</tr>
@else
<tr>
<td class="footer" style="width: 60%;">Basic Pay</td>
<td class="footer" style="width: 40%;text-align: right;">{{ ($details->basic_pay > 0) ? number_format($details->basic_pay,2,'.',',') : '0.00' }}</td>
</tr>
<tr>
<td class="footer" style="width: 60%;">Premium</td>
<td class="footer" style="width: 40%;text-align: right;">{{ ($details->premium > 0) ? number_format($details->premium,2,'.',',') : '0.00' }}</td>
</tr>
@endif
@if(App\PayrollSubDetail::income1($details->id))
@foreach(App\PayrollSubDetail::income1($details->id) as $dtl)
<tr>
<td class="footer" style="width: 70%;">{{ $dtl->name }}</td>
<?php $i = $dtl->amount; ?>
<td class="footer" style="width: 30%;text-align: right;">{{ number_format($i,2,'.',',') }}</td>
</tr>
@endforeach
@endif
</table>
</td>
<td style="width: 50%;">
<table>
<tr>
<td class="footer" style="width: 43%;">&nbsp;&nbsp;&nbsp;&nbsp;Deductions</td>
@if(count($ploan) > 0)
<td class="footer" style="width: 30%;text-align: center;">Loan Amount</td>
<td class="footer" style="width: 30%;text-align: center;">Balance</td>
<td class="footer" style="width: 20%;text-align: right;">This Pay</td>
@endif
</tr>
<?php $ca_total = 0; ?>
@foreach($ploan as $loan)
@if($loan->header_id == $details->id)
<tr>
<td class="footer" style="width: 43%;">&nbsp;&nbsp;&nbsp;&nbsp;{{App\PayrollDetail::loan_type($loan->loan_id)->loan}}</td>
<td class="footer" style="width: 30%;text-align: center;">{{ number_format(App\PayrollDetail::loan_type($loan->loan_id)->principal,2,'.',',') }}</td>
<td class="footer" style="width: 30%;text-align: center;">{{ number_format(App\PayrollDetail::loan_balance($loan->loan_deduction_id)->balance,2,'.',',') }}</td>
<td class="footer" style="width: 22%;text-align: right;">{{ number_format($loan->amount,2,'.',',') }}&nbsp;&nbsp;&nbsp;</td>
</tr>
@endif
<?php
$ca_total += $loan->amount;
?>
@endforeach
@if(App\PayrollSubDetail::deduction1($details->id))
@foreach(App\PayrollSubDetail::deduction1($details->id) as $ded_dtl)
<tr>
<?php $xxx = $ded_dtl->amount; ?>
<td class="footer" style="width: 95%;">&nbsp;&nbsp;&nbsp;&nbsp;{{ $ded_dtl->name }}</td>
<td class="footer" style="width: 30%;text-align: right;">{{ number_format($xxx,2,'.',',') }}
&nbsp;&nbsp;</td>
</tr>
@endforeach
@endif
@if($details->position($details->emp_id)->sss == 'Yes')
<tr>
<td class="footer" style="width: 95%;">&nbsp;&nbsp;&nbsp;&nbsp;SSS Contributions</td>
<td class="footer" style="width: 30%;text-align: right;">{{ number_format($details->sss,2,'.',',') }}&nbsp;&nbsp;&nbsp;</td>
</tr>
@endif
@if($details->position($details->emp_id)->philhealth == 'Yes')
<tr>
<td class="footer" style="width: 95%;">&nbsp;&nbsp;&nbsp;&nbsp;Philhealth Contributions</td>
<td class="footer" style="width: 30%;text-align: right;">{{ number_format($details->philhealth,2,'.',',') }}&nbsp;&nbsp;&nbsp;</td>
</tr>
@endif
@if($details->position($details->emp_id)->pagibig == 'Yes')
<tr>
<td class="footer" style="width: 95%;">&nbsp;&nbsp;&nbsp;&nbsp;Pag-ibig Contributions</td>
<td class="footer" style="width: 30%;text-align: right;">{{ number_format($details->pagibig,2,'.',',') }}&nbsp;&nbsp;&nbsp;</td>
</tr>
@endif
@if($details->position($details->emp_id)->tax == 'Yes')
<tr>
<td class="footer" style="width: 95%;">&nbsp;&nbsp;&nbsp;&nbsp;Tax</td>
<td class="footer" style="width: 30%;text-align: right;">{{ number_format($details->tax,2,'.',',') }}&nbsp;&nbsp;&nbsp;</td>
</tr>
@endif
</table>
</td>
</tr>
</tbody>
</table>
<table><tr><td></td></tr></table>
<table style="width: 80%;">
<tbody>
<tr>
<td style="width: 50%;">
<table>
<tr>
<td class="footer" style="width: 60%;">TOTAL INCOME</td>
<td class="footer" style="width: 40%;text-align: right;">
{{ number_format($details->income,2,'.',',') }}
</td>
</tr>
</table>
</td>
<td style="width: 49%;">
<table>
<tr>
<td class="footer" style="width: 92%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;TOTAL DEDUCTION</td>
<td class="footer" style="width: 30%;text-align: right;">{{ number_format($details->total_deductions,2,'.',',') }}</td>
</tr>
</table>
</td>
</tr>
</tbody>
</table>
<table><tr><td></td></tr></table>
<table style="width: 80%;">
<tr>
<td style="width: 35%;"></td>
<td style="width: 65%;">
<table>
<tr>
<td class="footer" style="width: 92%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TAKE HOME PAY</td>
<?php
$total_net = $details->income - $details->total_deductions;
?>
<td class="footer" style="width: 30%;text-align: right;">{{ number_format($total_net,2,'.',',') }}</td>
</tr>
</table>
</td>
</tr>
</table>
<table><tr><td></td></tr></table>
@if($xx == 2)
<table style="width: 85%;">
<tr>
<td class="footer" style="width: 25%;"></td>
<td class="footer" style="width: 40%;">Approved by:</td>
<td class="footer" style="width: 35%;">Received Payment</td>
</tr>
</table>
<table><tr><td></td></tr></table>
<table style="width: 85%;">
<tr>
<td class="footer" style="width: 25%;"></td>
<td class="footer" style="width: 40%;">{{ $user->name }}</td>
<td class="footer" style="width: 35%;">_______________________________</td>
</tr>
<tr>
<td class="footer" style="width: 25%;"></td>
<td class="footer" style="width: 46%;">{{date('F d, Y', strtotime($details->updated_at))}}</td>
<td class="footer" style="width: 29%;">&nbsp;&nbsp;Date and Signature</td>
</tr>
<tr>
<td class="footer" style="width: 25%;"></td>
<td class="footer" style="width: 43%;"></td>
<td class="footer" style="width: 32%;">&nbsp;&nbsp;(over Printed Full Name)</td>
</tr>
</table>
@endif
</td>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment