152 lines
7.9 KiB
PHP
152 lines
7.9 KiB
PHP
<table class="table">
|
|
<thead>
|
|
<tr>
|
|
<th>{{ __('SL') }}.</th>
|
|
<th class="text-start">{{ __('Name') }}</th>
|
|
<th class="text-start">{{ __('Date') }}</th>
|
|
<th class="text-start">{{ __('Reference') }}</th>
|
|
<th class="text-start">{{ __('Type') }}</th>
|
|
<th class="text-start">{{ __('Total') }}</th>
|
|
<th class="text-start">{{ __('Money In') }}</th>
|
|
<th class="text-start">{{ __('Money Out') }}</th>
|
|
<th class="text-start">{{ __('Payment') }}</th>
|
|
<th class="text-start">{{ __('Transaction By') }}</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@foreach ($day_books as $day_book)
|
|
<tr>
|
|
<td>{{ $loop->index + 1 }}</td>
|
|
|
|
@if ($day_book->platform == 'sale')
|
|
<td class="text-start">{{ $day_book->sale?->party?->name ?? 'Guest' }}</td>
|
|
@elseif ($day_book->platform == 'sale_return')
|
|
<td class="text-start">{{ $day_book->saleReturn?->sale?->party?->name ?? 'Guest' }}</td>
|
|
@elseif ($day_book->platform == 'purchase')
|
|
<td class="text-start">{{ $day_book->purchase?->party?->name ?? 'Guest' }}</td>
|
|
@elseif ($day_book->platform == 'purchase_return')
|
|
<td class="text-start">{{ $day_book->purchaseReturn?->purchase?->party?->name ?? 'Guest' }}</td>
|
|
@elseif ($day_book->platform == 'due_collect' || $day_book->platform == 'due_pay')
|
|
<td class="text-start">{{ $day_book->dueCollect?->party?->name ?? 'Guest' }}</td>
|
|
@else
|
|
<td class="text-start">N/A</td>
|
|
@endif
|
|
|
|
<td class="text-start">{{ formatted_date($day_book->date) }}</td>
|
|
<td class="text-start">{{ $day_book->invoice_no }}</td>
|
|
<td class="text-start">{{ ucwords(str_replace('_', ' ', $day_book->platform)) }}</td>
|
|
|
|
@if ($day_book->platform == 'sale')
|
|
<td class="text-start">
|
|
{{ currency_format($day_book->sale?->totalAmount ?? 0, currency: business_currency()) }}
|
|
</td>
|
|
@elseif ($day_book->platform == 'sale_return')
|
|
<td class="text-start">
|
|
{{ currency_format($day_book->saleReturn?->sale?->totalAmount ?? 0, currency: business_currency()) }}
|
|
</td>
|
|
@elseif ($day_book->platform == 'purchase')
|
|
<td class="text-start">
|
|
{{ currency_format($day_book->purchase?->totalAmount ?? 0, currency: business_currency()) }}
|
|
</td>
|
|
@elseif ($day_book->platform == 'purchase_return')
|
|
<td class="text-start">
|
|
{{ currency_format($day_book->purchaseReturn?->purchase?->totalAmount ?? 0, currency: business_currency()) }}
|
|
</td>
|
|
@elseif ($day_book->platform == 'due_collect' || $day_book->platform == 'due_pay')
|
|
<td class="text-start">
|
|
{{ currency_format($day_book->dueCollect?->totalDue ?? 0, currency: business_currency()) }}
|
|
</td>
|
|
@else
|
|
<td class="text-start">{{ currency_format(0, currency: business_currency()) }}</td>
|
|
@endif
|
|
|
|
@php
|
|
$total_amount = match ($day_book->platform) {
|
|
'sale' => $day_book->sale?->totalAmount ?? 0,
|
|
'sale_return' => $day_book->saleReturn?->sale?->totalAmount ?? 0,
|
|
'purchase' => $day_book->purchase?->totalAmount ?? 0,
|
|
'purchase_return' => $day_book->purchaseReturn?->purchase?->totalAmount ?? 0,
|
|
'due_collect', 'due_pay' => $day_book->dueCollect?->totalDue ?? 0,
|
|
default => 0
|
|
};
|
|
@endphp
|
|
|
|
@if ($day_book->type === 'credit')
|
|
<td class="text-start text-success">{{ currency_format($total_amount, currency: business_currency()) }}
|
|
</td>
|
|
@else
|
|
<td class="text-start">{{ currency_format(0, currency: business_currency()) }}</td>
|
|
@endif
|
|
|
|
@if ($day_book->type === 'debit')
|
|
<td class="text-start text-danger">{{ currency_format($day_book->amount, currency: business_currency()) }}
|
|
</td>
|
|
@else
|
|
<td class="text-start">{{ currency_format(0, currency: business_currency()) }}</td>
|
|
@endif
|
|
|
|
@if ($day_book->payment_type_id)
|
|
<td class="text-start">{{ $day_book->paymentType?->name }}</td>
|
|
@else
|
|
<td class="text-start">{{ ucfirst(explode('_', $day_book->transaction_type)[0]) }}</td>
|
|
@endif
|
|
|
|
@if ($day_book->platform == 'sale')
|
|
<td class="text-start">{{ $day_book->sale?->user?->name ?? 'N/A' }}</td>
|
|
@elseif ($day_book->platform == 'sale_return')
|
|
<td class="text-start">{{ $day_book->saleReturn?->sale?->user?->name ?? 'N/A' }}</td>
|
|
@elseif ($day_book->platform == 'purchase')
|
|
<td class="text-start">{{ $day_book->purchase?->user?->name ?? 'N/A' }}</td>
|
|
@elseif ($day_book->platform == 'purchase_return')
|
|
<td class="text-start">{{ $day_book->purchaseReturn?->purchase?->user?->name ?? 'N/A' }}</td>
|
|
@elseif ($day_book->platform == 'due_collect' || $day_book->platform == 'due_pay')
|
|
<td class="text-start">{{ $day_book->dueCollect?->user?->name ?? 'N/A' }}</td>
|
|
@else
|
|
<td class="text-start">{{__('N/A') }}</td>
|
|
@endif
|
|
</tr>
|
|
@endforeach
|
|
</tbody>
|
|
|
|
@php
|
|
$page_total_amount = $day_books->sum(function ($day_book) {
|
|
return match ($day_book->platform) {
|
|
'sale' => $day_book->sale?->totalAmount ?? 0,
|
|
'sale_return' => $day_book->saleReturn?->sale?->totalAmount ?? 0,
|
|
'purchase' => $day_book->purchase?->totalAmount ?? 0,
|
|
'purchase_return' => $day_book->purchaseReturn?->purchase?->totalAmount ?? 0,
|
|
'due_collect', 'due_pay' => $day_book->dueCollect?->totalDue ?? 0,
|
|
default => 0
|
|
};
|
|
});
|
|
|
|
$page_money_in_new = $day_books->where('type', 'credit')->sum(function ($day_book) {
|
|
return match ($day_book->platform) {
|
|
'sale' => $day_book->sale?->totalAmount ?? 0,
|
|
'sale_return' => $day_book->saleReturn?->sale?->totalAmount ?? 0,
|
|
'purchase' => $day_book->purchase?->totalAmount ?? 0,
|
|
'purchase_return' => $day_book->purchaseReturn?->purchase?->totalAmount ?? 0,
|
|
'due_collect', 'due_pay' => $day_book->dueCollect?->totalDue ?? 0,
|
|
default => 0
|
|
};
|
|
});
|
|
|
|
$page_money_in = $day_books->where('type', 'credit')->sum('amount');
|
|
$page_money_out = $day_books->where('type', 'debit')->sum('amount');
|
|
@endphp
|
|
|
|
@if ($day_books->count() > 0)
|
|
<tr class="table-footer">
|
|
<td>{{__('Total')}}</td>
|
|
<td></td>
|
|
<td></td>
|
|
<td class="d-print-none"></td>
|
|
<td class="d-print-none text-end"></td>
|
|
<td class="text-start">{{ currency_format($page_total_amount, currency: business_currency()) }}</td>
|
|
<td class="text-start">{{ currency_format($page_money_in, currency: business_currency()) }}</td>
|
|
<td class="text-start">{{ currency_format($page_money_out, currency: business_currency()) }}</td>
|
|
<td></td>
|
|
<td class="d-print-none"></td>
|
|
</tr>
|
|
@endif
|
|
</table> |