@extends('index') @section('content')

Employee Detail

@csrf
Good job!
Good job!
@if(!empty($dfrom) && !empty($dto)) @endif {{-- --}} {{-- --}} {{-- --}}
Employee: {{$employee['employee_no']}} - {{$employee['name']}}Date From: {{date("d-m-Y", strtotime($dfrom))}} Date To: {{date("d-m-Y", strtotime($dto))}}Department: {{$employee['dname']}} Contact: {{$employee['phone']}}{{($balance > 0)? 'Payable':'Receivable'}} Amount: {{number_format(abs($balance))}}Receivable Amount: {{number_format($balance)}}
@php $index = 1; $balance = $oBalance; @endphp @if($oBalance != 0) @endif @if($detail->count()) @foreach($detail as $item) @php // For employee ledger (liability account): // DB debit (displayed as Credit) = work done, increases liability = ADD to balance // DB credit (displayed as Debit) = payments made, decreases liability = SUBTRACT from balance // Include ALL transaction types - no filtering $debit = $item->debit ?? 0; $credit = $item->credit ?? 0; if($item->transaction_type != 'salary'){ $balance += $debit - $credit; } // For employee ledger, reverse the display (DB debit shown in credit column, DB credit shown in debit column) $displayDebit = $credit; $displayCredit = $debit; @endphp @endforeach @endif @if($cBalance != 0) @endif
Sr. Date Transaction Type Debit Credit Balance Action
{{$index++}} {{\Carbon\Carbon::parse($dfrom)->format('d-m-Y')}} Opening Balance {{ $oBalance > 0 ? number_format(abs($oBalance)) : '' }} {{ $oBalance < 0 ? number_format(abs($oBalance)) : '' }} {{ number_format($oBalance) }}
{{ $loop->index + 1 }} {{ isset($item->purchase_date) ? \Carbon\Carbon::parse($item->purchase_date)->format('d-m-Y') : (isset($item->transaction_date) ? \Carbon\Carbon::parse($item->transaction_date)->format('d-m-Y') : '') }} @if(isset($item->transaction_type)) @switch($item->transaction_type) @case('advance') Give Loan @break @case('receiveAdvance') Receive Loan Repayment @break @case('salaryAdvance') Salary Advance @break @case('salary') Monthly Salary @if(isset($item->description))
{{ $item->description }} @endif @break @default {{ ucfirst($item->transaction_type) }} @endswitch @else Purchase Order @endif
{{ $displayDebit > 0 ? number_format($displayDebit) : '' }} {{ $displayCredit > 0 ? number_format($displayCredit) : '' }} {{number_format($balance)}} @if($item->transaction_type == 'openingBalance') View @elseif($item->transaction_type == 'wages')
@if(isset($item->stock_id)) View @endif @if(isset($item->wage_details) && !empty($item->wage_details) && isset($item->stock_id)) @endif
@elseif($item->transaction_type == 'salary') View @else View @endif
{{$index++}} {{\Carbon\Carbon::parse($dto)->format('d-m-Y')}} Closing Balance {{ $cBalance < 0 ? number_format(abs($cBalance)) : '' }} {{ $cBalance > 0 ? number_format(abs($cBalance)) : '' }} {{ $balance ? number_format($balance += $cBalance) : number_format($oBalance + $cBalance) }}
Sr. Date Transaction Type Debit Credit Balance Action
{{-- Wages Detail Modals --}} @if($detail->count()) @foreach($detail as $item) @if(isset($item->transaction_type) && $item->transaction_type == 'wages' && isset($item->wage_details)) @endif @endforeach @endif @endsection