Files

83 lines
3.9 KiB
PHP

@if ($filter_from_date && $filter_to_date)
<div class="mb-2 text-center fw-bold duration-display">
<strong>{{ __('Duration:') }}</strong>
@if ($duration === 'today')
{{ Carbon\Carbon::parse($filter_from_date)->format('d-m-Y') }}
@elseif ($duration === 'yesterday')
{{ Carbon\Carbon::parse($filter_from_date)->format('d-m-Y') }}
@else
{{ Carbon\Carbon::parse($filter_from_date)->format('d-m-Y') }}
{{ __('to') }}
{{ Carbon\Carbon::parse($filter_to_date)->format('d-m-Y') }}
@endif
</div>
@endif
<div class="responsive-table m-0">
<table class="table" id="datatable">
<thead>
<tr>
<th>{{ __('SL') }}.</th>
<th>{{ __('Date') }}</th>
<th>{{ __('Invoice') }}</th>
<th>{{ __('Party Name') }}</th>
<th>{{ __('Sale Amount') }}</th>
<th>{{ __('Profit') }}</th>
<th>{{ __('Loss') }}</th>
<th class="d-print-none">{{ __('Action') }}</th>
</tr>
</thead>
<tbody>
@foreach ($profits as $profit)
<tr>
<td>{{ ($profits->currentPage() - 1) * $profits->perPage() + $loop->iteration }}</td>
<td>{{ formatted_date($profit->saleDate) }}</td>
<td>{{ $profit->invoiceNumber }}</td>
<td>{{ $profit->party->name ?? '' }}</td>
<td>{{ currency_format($profit->totalAmount, currency: business_currency()) }}</td>
<td>
{{ $profit->lossProfit > 0 ? currency_format($profit->lossProfit, currency: business_currency()) : '' }}
</td>
<td class="text-danger">
{{ $profit->lossProfit < 0 ? currency_format(abs($profit->lossProfit), currency: business_currency()) : '' }}
</td>
<td class="d-print-none">
<div class="dropdown table-action">
<button type="button" data-bs-toggle="dropdown">
<i class="far fa-ellipsis-v"></i>
</button>
<ul class="dropdown-menu">
<li>
@usercan('loss-profits.read')
<a href="#loss-profit-view" class="loss-profit-view" data-id="{{ $profit->id }}"
data-bs-toggle="modal">
<i class="fal fa-eye"></i>
{{ __('View') }}
</a>
@endusercan
</li>
<input type="hidden" value="{{ route('business.bill-wise-profits.show', ['bill_wise_profit' => ':id']) }}" id="loss-profit-id">
</ul>
</div>
</td>
</tr>
@endforeach
</tbody>
@if ($profits->count() > 0)
<tr>
<td class="fw-bold">{{__('Total')}}</td>
<td></td>
<td></td>
<td></td>
<td class="fw-bold">{{ currency_format($profits->sum('totalAmount'), currency: business_currency()) }}</td>
<td class="fw-bold text-success">{{ currency_format($profits->where('lossProfit', '>', 0)->sum('lossProfit'), currency: business_currency()) }}</td>
<td class="fw-bold text-danger">{{ currency_format(abs($profits->where('lossProfit', '<', 0)->sum('lossProfit')), currency: business_currency()) }}</td>
<td></td>
</tr>
@endif
</table>
</div>
<div class="mt-3">
{{ $profits->links('vendor.pagination.bootstrap-5') }}
</div>