# Sale Description Serial Search Design

## Goal

Allow users to type any partial serial value saved in a POS line's Description field and find the corresponding invoice from both All Sales and All Transactions.

## Storage Mapping

The POS Description textarea is persisted in `transaction_sell_lines.sell_line_note`.

## Query Design

Extend the existing global search implementations in `SellController` and `AllTransactionsController` with a correlated `WHERE EXISTS` subquery against `transaction_sell_lines`.

For every existing search keyword, the subquery will:

- correlate `transaction_sell_lines.transaction_id` with `transactions.id`;
- compare `LOWER(COALESCE(transaction_sell_lines.sell_line_note, ''))` with a case-insensitive partial `LIKE` pattern;
- leave existing invoice, customer, payment, location, and tracked-serial searches unchanged.

Using `WHERE EXISTS` avoids duplicate invoice rows when one invoice has several matching products and preserves the current pagination/counting structure.

## Scope

- All Sales global search.
- All Transactions global search.
- Partial and case-insensitive matching.
- No interface changes.
- No database migration.

## Error and Compatibility Behavior

Null descriptions are treated as empty strings. Existing permission and location filters continue to scope results before description matching.

## Verification

Add regression tests proving both controllers include a correlated description lookup and retain the existing search paths. Run focused tests and the complete Laravel test suite.
