# BUG: Daily Performance — S (Scrap) column shows 0 / Q shows 100%

## Status
Open — deferred

## Symptom
In Info Board → Daily Performance table, the **S** (Scrap qty) column shows `—`
and **Q** (Quality %) shows `100%` even when scrap pieces were logged that day.

## Root Cause
The S column queries `llx_scrap` (confirmed/booked scrap records):

```php
"SELECT fk_ws, DATE(scrap_date) AS d, ROUND(SUM(qty), 1) AS qty"
." FROM ".MAIN_DB_PREFIX."scrap"
```

Scrap logged via ScanStation first lands in `scanstation_log` with `scan_type='scrap'`
and `booked_scrap_id IS NULL` (pending confirmation).

It only reaches `llx_scrap` **after** an operator confirms it in `scrap/scrap_confirmation.php`.

Until confirmation, `llx_scrap` has no record → S = `—` → Q = `(A - 0) / A = 100%`.

## Impact
Quality % is **overstated** for any day with unconfirmed scrap.
The error self-corrects once scrap is confirmed, but the day may already be in history.

## Proposed Fix Options

### Option 1 — Use pending scrap only
Change S source to `scanstation_log` WHERE `scan_type='scrap'` AND not reversed.
- Pro: real-time
- Con: includes items that may later be reversed (not real scrap)

### Option 2 — Show booked + pending separately (recommended)
- `S` = confirmed qty from `llx_scrap` (current)
- `Sp` = pending qty from `scanstation_log` (not reversed, not yet booked)
- Display as `3+2p` in the cell, or sum them with a tooltip

### Option 3 — Use union of both sources for Q calculation only
Keep S display as confirmed, but compute Q using `confirmed + pending` so at
least the quality % is pessimistic rather than optimistic.

## Files to touch
- `custom/planning/info_board.php` — `$perfScrapQty` query (~line 310) + render (~line 560)

## Related
- `custom/scrap/scrap_confirmation.php` — confirmation flow
- `custom/scrap/class/scrap.class.php` — INSERT into `llx_scrap`
- `custom/scanstation/ajax/scan_action.php` — writes `scanstation_log` on scrap scan
