price last edited 2

This commit is contained in:
2026-06-08 01:11:49 +03:30
parent c82331b39b
commit 2ddd462636
@@ -512,13 +512,11 @@ class ReportController extends Controller
| main_product / zaarbox: سفارش از Price::latest() — نمایش buy/sell همان منبع.
*/
if (in_array($priceProvider, ['main_product', 'zaarbox'], true) && !$closed) {
$storedPrice = $lastPrice ?? Price::latest()->first();
if ($storedPrice && (float) $storedPrice->price > 0) {
$base = (float) $storedPrice->price;
$sell = $open_sell ? (int) ceil($base - $diff_sell) : 0;
$buy = $open_buy ? (int) ceil($base + $diff_buy) : 0;
$priceLast = (int) ceil($base + $diff_buy);
}
$base = (float) $priceValue;
$sell = $open_sell ? (int) ceil($base - $diff_sell) : 0;
$buy = $open_buy ? (int) ceil($base + $diff_buy) : 0;
$priceLast = (int) ceil($base + $diff_buy);
}
if (!$closed && $priceValue > 0) {