@extends('admin.layout.interface') @section('content')

Customers

Account Summary

Customer: {{$customer->name}}

Total Debit: {{$customer->accountSummary['debit']}}

Total Credit: {{$customer->accountSummary['credit']}}

Total Remaining: {{$customer->accountSummary['remaining']}}

@php $balance = 0; @endphp @foreach ($customer->ledgers as $key => $ledger) @php $debit = 0; $credit = 0; if ($ledger->transaction_type == 'debit') { $debit = $ledger->amount; $balance -= $ledger->amount; }else{ $credit = $ledger->amount; $balance += $ledger->amount; } @endphp @endforeach
Sr# Date Type Reference no Debit Credit Balance
{{$key+1}} {{$ledger->created_at->format("m-d-Y")}} {{$ledger->detail}} {{$ledger->sale ? $ledger->sale->bill_no : ''}} {{$debit}} {{$credit}} {{$balance}}
{{-- Add Customer Modals --}} @endsection @section('js') @endsection