@foreach ($totals as $index => $item)
@php
$diff = (int)$item->actual_output - (int)$item->expected_output;
$class = $diff >= 0 ? 'text-success' : 'text-danger';
$prefix = $diff >= 0 ? '+' : '-';
$sold = (int) ($item->sold_qty ?? 0);
$current = (int) ($item->current_stock ?? ((int)$item->actual_output - $sold));
@endphp
| {{ $index + 1 }} |
{{ $item->brickType->name ?? 'Unknown' }} |
{{ number_format($item->expected_output) }} |
{{ number_format($item->actual_output) }} |
{{ $prefix }}{{ number_format(abs($diff)) }}
|
{{ number_format($sold) }} |
{{ number_format($current) }}
|
@endforeach