@extends('backend.layouts.master') @section('section-title', 'Customer') @section('page-title', 'Customer List') @if (check_permission('customer.store')) @section('action-button') Add Customer @endsection @endif @push('css') @endpush @section('content')
@php $custommer = App\Models\Customer::get(); @endphp
Reset Print
@php $total_amount = 0; $total_paid = 0; $total_due = 0; $personal_balance = 0; $total_count = 0; @endphp @forelse($customers as $data) @php $count_cus = App\Models\Invoice::where('customer_id', $data->id)->count(); $count_tra = App\Models\Transaction::where('customer_id', $data->id)->count(); $open_balance = open_balance_customer( $data->id, $data->due_amount, ); $inv_total = App\Models\Invoice::where('customer_id', $data->id)->sum( 'total_amount', ); $inv_paid = App\Models\Invoice::where('customer_id', $data->id)->sum( 'total_paid', ); // $inv_due = App\Models\Invoice::where('customer_id', $data->id)->sum('total_due'); $inv_due = App\Models\Invoice::where('customer_id', $data->id) ->where('status', 0) ->sum('total_due'); $total_amount += $inv_total; $total_paid += $inv_paid; $total_due += $inv_due; $personal_balance += $open_balance; @endphp {{-- edit modal --}} @csrf @method('PUT') @if($data->id != 1) @if (auth()->user()->branch_id == 1) @foreach ($allBranch as $branch) @endforeach @endif @endif {{-- delete modal --}} @csrf @method('DELETE') @empty @endforelse @php @endphp
#SL Name & Email & Phone Branch Total Invoice Paid Invoice Due Invoice Personal Balance Action
{{ $loop->index + 1 }} {{ $data->name }}
{{ $data->phone }}
{{ $data->email == null ? 'NULL' : $data->email }}
{{ $data->branch?->name }} {{ $inv_total }} {{ empty(get_setting('com_currency')) ?: get_setting('com_currency') }} {{ $inv_paid }} {{ empty(get_setting('com_currency')) ?: get_setting('com_currency') }} {{ $inv_due }} {{ empty(get_setting('com_currency')) ?: get_setting('com_currency') }} {{ $open_balance }} {{ empty(get_setting('com_currency')) ?: get_setting('com_currency') }}
No Data Available
Total({{ count($customers) }}): {{ number_format($total_amount, 2) }}{{ empty(get_setting('com_currency')) ?: get_setting('com_currency') }} {{ number_format($total_paid, 2) }}{{ empty(get_setting('com_currency')) ?: get_setting('com_currency') }} {{ number_format($total_due, 2) }}{{ empty(get_setting('com_currency')) ?: get_setting('com_currency') }} {{ number_format($personal_balance, 2) }}{{ empty(get_setting('com_currency')) ?: get_setting('com_currency') }}
{{ $customers->onEachSide(1)->links() }}
{{-- Add Modal --}}
@csrf @if (auth()->user()->branch_id == 1) @foreach ($allBranch as $data) @endforeach @endif
@endsection