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 همان منبع. | main_product / zaarbox: سفارش از Price::latest() — نمایش buy/sell همان منبع.
*/ */
if (in_array($priceProvider, ['main_product', 'zaarbox'], true) && !$closed) { if (in_array($priceProvider, ['main_product', 'zaarbox'], true) && !$closed) {
$storedPrice = $lastPrice ?? Price::latest()->first(); $base = (float) $priceValue;
if ($storedPrice && (float) $storedPrice->price > 0) {
$base = (float) $storedPrice->price; $sell = $open_sell ? (int) ceil($base - $diff_sell) : 0;
$sell = $open_sell ? (int) ceil($base - $diff_sell) : 0; $buy = $open_buy ? (int) ceil($base + $diff_buy) : 0;
$buy = $open_buy ? (int) ceil($base + $diff_buy) : 0; $priceLast = (int) ceil($base + $diff_buy);
$priceLast = (int) ceil($base + $diff_buy);
}
} }
if (!$closed && $priceValue > 0) { if (!$closed && $priceValue > 0) {