56 lines
2.6 KiB
PHP
56 lines
2.6 KiB
PHP
|
|
<div class="responsive-table m-0">
|
||
|
|
<table class="table" id="datatable">
|
||
|
|
<thead>
|
||
|
|
<tr>
|
||
|
|
<th>{{ __('SL') }}.</th>
|
||
|
|
<th class="text-start">{{ __('Product') }}</th>
|
||
|
|
<th class="text-start">{{ __('Cost') }}</th>
|
||
|
|
<th class="text-start">{{ __('Qty') }}</th>
|
||
|
|
<th class="text-start">{{ __('Sale') }}</th>
|
||
|
|
<th class="text-end">{{ __('Stock Value') }}</th>
|
||
|
|
</tr>
|
||
|
|
</thead>
|
||
|
|
<tbody>
|
||
|
|
@foreach ($stock_reports as $stock_report)
|
||
|
|
@php
|
||
|
|
$total_stock = $stock_report->stocks->sum('productStock');
|
||
|
|
$firstStock = $stock_report->stocks->first();
|
||
|
|
$total_value = $stock_report->stocks->sum(function ($stock) {
|
||
|
|
return $stock->productPurchasePrice * $stock->productStock;
|
||
|
|
});
|
||
|
|
@endphp
|
||
|
|
<tr>
|
||
|
|
<td>{{ ($stock_reports->currentPage() - 1) * $stock_reports->perPage() + $loop->iteration }}</td>
|
||
|
|
<td class="text-start">{{ $stock_report->productName }}</td>
|
||
|
|
<td class="text-start">{{ currency_format(optional($firstStock)->productPurchasePrice, currency: business_currency()) }}</td>
|
||
|
|
<td class="{{ $total_stock <= $stock_report->alert_qty ? 'text-danger' : 'text-success' }} text-start">{{ $total_stock }}</td>
|
||
|
|
<td class="text-start">{{ currency_format(optional($firstStock)->productSalePrice, currency: business_currency()) }}</td>
|
||
|
|
<td class="text-end">{{ currency_format($total_value, currency: business_currency()) }}</td>
|
||
|
|
</tr>
|
||
|
|
@endforeach
|
||
|
|
</tbody>
|
||
|
|
@if ($stock_reports->count() > 0)
|
||
|
|
<tr class="table-footer">
|
||
|
|
<td class="text-start">{{ __('Total') }}</td>
|
||
|
|
<td></td>
|
||
|
|
<td></td>
|
||
|
|
<td></td>
|
||
|
|
<td></td>
|
||
|
|
<td class="text-end">
|
||
|
|
{{ currency_format(
|
||
|
|
$stock_reports->sum(function ($stock_report) {
|
||
|
|
return $stock_report->stocks->sum(function ($stock) {
|
||
|
|
return $stock->productPurchasePrice * $stock->productStock;
|
||
|
|
});
|
||
|
|
}),
|
||
|
|
currency: business_currency()
|
||
|
|
) }}
|
||
|
|
</td>
|
||
|
|
</tr>
|
||
|
|
@endif
|
||
|
|
</table>
|
||
|
|
</div>
|
||
|
|
<div class="mt-3">
|
||
|
|
{{ $stock_reports->links('vendor.pagination.bootstrap-5') }}
|
||
|
|
</div>
|