--- task: Add print button for POS scan code and sales statistics (sold today + sold to date) on BuyViewProductMarket page cycles: 5 context: true private: false started: 2026-05-16T19:01:29Z finished: 2026-05-16T19:02:00Z --- ## files - `resources/js/Pages/BuyViewProductMarket.vue` [lines 159-167] — existing POS QR section; add print button + statistics display - `app/Http/Controllers/Market/ProductController.php` [lines 223-360] — `viewProductDetails` static method; add `sold_today` and `store_sold_today` to `$data` array ## steps 1. In `ProductController.php`, add `use App\Models\Market\ProductTransaction;` to the import block (after line 14) if not already present. 2. In `ProductController.php` inside `viewProductDetails`, after line 290 (`$storeProductSold = $storeProduct->pivot->sold;`), add: ```php $storeSoldToday = ProductTransaction::where('product_id', $product->id) ->where('store_id', $targetStore->id) ->whereDate('created_at', today()) ->sum('quantity'); ``` 3. After the `if ($targetStore)` block (before line 312 `$data = [`), add a global sold_today query: ```php $soldToday = ProductTransaction::where('product_id', $product->id) ->whereDate('created_at', today()) ->sum('quantity'); ``` 4. In `$data` array (lines 312-338), add after `'sold' => $product->sold,`: ```php 'sold_today' => (int) $soldToday, 'store_sold_today' => isset($storeSoldToday) ? (int) $storeSoldToday : null, ``` 5. In `BuyViewProductMarket.vue`, add a `printPosCode()` function in `