@if($selectedProduct)
Product: {{ $selectedProduct->article_no }} - {{ $selectedProduct->product_name }}
Size: {{ $selectedProduct->size_name }}
@if($selectedProduct->color_name)
Color: {{ $selectedProduct->color_name }}
@endif
@if(count($ledgerData) > 0)
| Transaction Type |
Stock In |
Stock Out |
Balance |
Date |
@php
$totalStockIn = 0;
$totalStockOut = 0;
$finalBalance = 0;
@endphp
@foreach($ledgerData as $row)
@php
$totalStockIn += $row['stock_in'];
$totalStockOut += $row['stock_out'];
$finalBalance = $row['balance'];
$balanceClass = $row['balance'] >= 0 ? 'text-success' : 'text-danger';
@endphp
|
{{ $row['transaction_type'] }}
@if($row['reference'] === 'Opening')
Opening
@elseif($row['reference'] === 'PTC')
PTC
@elseif($row['reference'] === 'Order')
Order
@endif
|
@if($row['stock_in'] > 0)
{{ $row['stock_in'] }}
@else
-
@endif
|
@if($row['stock_out'] > 0)
{{ $row['stock_out'] }}
@else
-
@endif
|
{{ $row['balance'] }}
|
{{ \Carbon\Carbon::parse($row['date'])->format('d-m-Y') }}
|
@endforeach
| TOTAL |
{{ $totalStockIn }} |
{{ $totalStockOut }} |
{{ $finalBalance }}
|
|
Total Stock In
{{ $totalStockIn }}
Total Stock Out
{{ $totalStockOut }}
Final Balance
{{ $finalBalance >= 0 ? '+' : '' }}{{ $finalBalance }}
@if($finalBalance > 0)
Surplus - {{ $finalBalance }} units available
@elseif($finalBalance < 0)
Shortage - {{ abs($finalBalance) }} units needed
@else
Balanced - No surplus or shortage
@endif
@else
No transactions found for this product.
@endif
@else
Please select a product to view the ledger.
@endif