54 lines
2.9 KiB
PHP
54 lines
2.9 KiB
PHP
|
|
<div class="responsive-table m-0">
|
||
|
|
<table class="table" id="datatable">
|
||
|
|
<thead>
|
||
|
|
<tr>
|
||
|
|
<th class="d-print-none">{{ __('SL') }}.</th>
|
||
|
|
<th class="text-start">{{ __('Customer Name') }}</th>
|
||
|
|
<th class="text-start d-print-none">{{ __('Phone') }}</th>
|
||
|
|
<th class="text-start d-print-none">{{ __('Type') }}</th>
|
||
|
|
<th class="text-center">{{ __('Total Sales') }}</th>
|
||
|
|
<th class="text-end">{{ __('Amount') }}</th>
|
||
|
|
<th class="text-end">{{ __('Paid') }}</th>
|
||
|
|
<th class="text-end">{{ __('Total Sale Due') }}</th>
|
||
|
|
</tr>
|
||
|
|
</thead>
|
||
|
|
<tbody>
|
||
|
|
@foreach ($customers as $customer)
|
||
|
|
<tr>
|
||
|
|
<td class="d-print-none">{{ $customers->firstItem() + $loop->index }}</td>
|
||
|
|
<td class="d-print-none text-start">
|
||
|
|
<a href="{{ route('business.customer-ledger.show', $customer->id) }}" class="stock-view-data text-primary">
|
||
|
|
{{ $customer->name }}
|
||
|
|
</a>
|
||
|
|
</td>
|
||
|
|
<td class="text-start">{{ $customer->phone }}</td>
|
||
|
|
@if ($customer->type == 'Retailer')
|
||
|
|
<td class="text-start d-print-none">{{ __('Customer') }}</td>
|
||
|
|
@else
|
||
|
|
<td class="text-start d-print-none">{{ $customer->type }}</td>
|
||
|
|
@endif
|
||
|
|
<td class="text-center">{{ $customer->sales?->count() }}</td>
|
||
|
|
<td class="text-end">{{ currency_format($customer->sales?->sum('totalAmount'), currency: business_currency()) }}</td>
|
||
|
|
<td class="text-end">{{ currency_format($customer->sales?->sum('paidAmount'), currency: business_currency()) }}</td>
|
||
|
|
<td class="text-end">{{ currency_format($customer->sales?->sum('dueAmount'), currency: business_currency()) }}</td>
|
||
|
|
</tr>
|
||
|
|
@endforeach
|
||
|
|
</tbody>
|
||
|
|
@if ($customers->count() > 0)
|
||
|
|
<tr>
|
||
|
|
<td class="text-start fw-bold">{{__('Total')}}</td>
|
||
|
|
<td class="d-print-none"></td>
|
||
|
|
<td class="d-print-none"></td>
|
||
|
|
<td class="d-print-none"></td>
|
||
|
|
<td class="text-center fw-bold ">{{ $customers->sum(fn($customer) => $customer->sales?->count()) }}</td>
|
||
|
|
<td class="text-end fw-bold ">{{ currency_format($totalAmount, currency: business_currency()) }}</td>
|
||
|
|
<td class="text-end fw-bold ">{{ currency_format($totalPaid, currency: business_currency()) }}</td>
|
||
|
|
<td class="text-end fw-bold ">{{ currency_format($totalDue, currency: business_currency()) }}</td>
|
||
|
|
</tr>
|
||
|
|
@endif
|
||
|
|
</table>
|
||
|
|
</div>
|
||
|
|
<div class="mt-3">
|
||
|
|
{{ $customers->links('vendor.pagination.bootstrap-5') }}
|
||
|
|
</div>
|