@php
$salaryTotals = $salaryTotals ?? collect();
$salaryTotalNet = (float) $salaryTotals->sum('net_payable');
$salaryTotalPaid = (float) $salaryTotals->sum('paid_amount');
$salaryTotalDue = (float) $salaryTotals->sum('due_amount');
$salaryTotalPf = (float) $salaryTotals->sum('pf_amount');
$pfTransactions = $pfTransactions ?? collect();
$pfTransactionTotals = $pfTransactionTotals ?? collect();
$employeeContributionTotal = (float) $pfTransactionTotals->where('type', \App\Models\FundTransaction::TYPE_CONTRIBUTION)->sum('amount');
$employerContributionTotal = (float) $pfTransactionTotals->where('type', \App\Models\FundTransaction::TYPE_SCHOOL_CONTRIBUTION)->sum('amount');
$overallPfContribution = (float) $pfTransactionTotals->sum('amount');
$currentPfBalance = (float) ($pfAccount->current_balance ?? 0);
@endphp
| SL |
Salary Month |
Gross Salary |
Total Allowance |
Total Deduction |
Employee PF |
Employer PF |
Net Payable |
Paid Amount |
Due Amount |
Payment Status |
Payment Date |
Action |
@forelse($salaryPayments as $index => $salary)
@php
$latestPayment = $salary->activePayments->sortByDesc('payment_date')->first();
$totalAllowance = (float) $salary->bonus_amount + (float) $salary->extra_amount;
$paymentStatus = strtolower((string) $salary->status);
$statusLabel = match ($paymentStatus) {
'paid' => 'Paid',
'partial' => 'Partially Paid',
'unpaid' => 'Unpaid',
'processing', 'pending' => 'Processing',
'locked' => 'Locked',
default => ucfirst($paymentStatus ?: 'Pending'),
};
$statusClass = match ($paymentStatus) {
'paid' => 'success',
'partial' => 'warning',
'unpaid' => 'danger',
'processing', 'pending' => 'info',
'locked' => 'secondary',
default => 'secondary',
};
@endphp
| {{ $salaryPayments->firstItem() + $index }} |
{{ optional($salary->month)->format('F Y') }} |
{{ number_format((float) $salary->gross_payable, 2) }} BDT |
{{ number_format($totalAllowance, 2) }} BDT |
{{ number_format((float) $salary->deduction_amount, 2) }} BDT |
{{ number_format((float) $salary->pf_amount, 2) }} BDT |
- |
{{ number_format((float) $salary->net_payable, 2) }} BDT |
{{ number_format((float) $salary->paid_amount, 2) }} BDT |
{{ number_format((float) $salary->due_amount, 2) }} BDT |
{{ $statusLabel }}
|
{{ optional($latestPayment?->payment_date)->format('d M Y, h:i A') ?? optional($salary->generated_at)->format('d M Y, h:i A') ?? '-' }}
|
@if($salary->id)
Payslip
@else
Not Available
@endif
|
@empty
| No payroll records found for the selected filters. |
@endforelse
@if($salaryPayments->hasPages())
{{ $salaryPayments->withQueryString()->links() }}
@endif
Employee Total Contribution
{{ number_format($employeeContributionTotal, 2) }} BDT
Employer Total Contribution
{{ number_format($employerContributionTotal, 2) }} BDT
Overall PF Contribution
{{ number_format($overallPfContribution, 2) }} BDT
Current PF Balance
{{ number_format($currentPfBalance, 2) }} BDT
| SL |
Contribution Date |
Salary Month |
Employee Contribution |
Employer Contribution |
Total Contribution |
Reference |
Note |
Recorded By |
@forelse($pfTransactions as $index => $txn)
@php
$employeeContribution = $txn->type === \App\Models\FundTransaction::TYPE_CONTRIBUTION ? (float) $txn->amount : 0;
$employerContribution = $txn->type === \App\Models\FundTransaction::TYPE_SCHOOL_CONTRIBUTION ? (float) $txn->amount : 0;
$reference = $txn->ref_table ? strtoupper(str_replace('_', ' ', $txn->ref_table)) . ' #' . ($txn->ref_id ?? '-') : '-';
$salaryMonth = optional($txn->salary?->month)->format('F Y') ?? '-';
@endphp
| {{ $pfTransactions->firstItem() + $index }} |
{{ optional($txn->performed_at)->format('d M Y, h:i A') ?? '-' }} |
{{ $salaryMonth }} |
{{ number_format($employeeContribution, 2) }} BDT |
{{ number_format($employerContribution, 2) }} BDT |
{{ number_format((float) $txn->amount, 2) }} BDT |
{{ $reference }} |
{{ $txn->note ?? '-' }} |
{{ optional($txn->performedBy)->name ?? 'System' }} |
@empty
| No PF contributions found for this employee. |
@endforelse
@if($pfTransactions->hasPages())
{{ $pfTransactions->withQueryString()->links() }}
@endif
| SL |
Request/Transaction Date |
Withdrawal Amount |
Transaction Type |
Status |
Reference |
Payment Method |
Note |
Processed By |
@forelse($withdrawalHistory as $index => $withdrawal)
@php
$status = strtolower((string) $withdrawal->status);
$statusLabel = match ($status) {
'pending' => 'Pending',
'approved' => 'Approved',
'rejected' => 'Rejected',
'completed' => 'Paid / Disbursed',
default => ucfirst($status ?: 'Pending'),
};
$statusClass = match ($status) {
'pending' => 'warning text-dark',
'approved' => 'info text-dark',
'rejected' => 'danger',
'completed' => 'success',
default => 'secondary',
};
$requestDate = optional($withdrawal->approved_at ?? $withdrawal->rejected_at ?? $withdrawal->created_at)->format('d M Y, h:i A') ?? '-';
$withdrawalAmount = (float) ($withdrawal->approved_amount ?: $withdrawal->requested_amount);
$processedBy = optional($withdrawal->approvedBy)->name
?? optional($withdrawal->rejectedBy)->name
?? optional($withdrawal->lockTransaction?->performedBy)->name
?? optional($withdrawal->schedules->firstWhere('status', \App\Models\WithdrawalSchedule::STATUS_PAID)?->paidTransaction?->performedBy)->name
?? 'System';
$note = $withdrawal->request_note ?? $withdrawal->reject_note ?? '-';
$transactionType = match ($status) {
'pending' => 'Withdrawal Request',
'approved' => 'Approved Withdrawal',
'rejected' => 'Rejected Withdrawal',
'completed' => 'Paid / Disbursed',
default => 'Withdrawal',
};
@endphp
| {{ $withdrawalHistory->firstItem() + $index }} |
{{ $requestDate }} |
{{ number_format($withdrawalAmount, 2) }} BDT |
{{ $transactionType }} |
{{ $statusLabel }}
|
WR-{{ $withdrawal->id }} |
- |
{{ $note }} |
{{ $processedBy }} |
@empty
| No PF withdrawal history found for this employee. |
@endforelse
@if($withdrawalHistory->hasPages())
{{ $withdrawalHistory->withQueryString()->links() }}
@endif