added some feature for accounting and price

This commit is contained in:
2026-06-28 15:16:39 +03:30
parent 9f92466ada
commit 3801e5ee88
11 changed files with 423 additions and 39 deletions
+14 -1
View File
@@ -126,6 +126,17 @@ class ReportController extends Controller
protected function appendUpPrices(array $payload, bool $saveFullCache = false): array
{
// status: open | closed (خارج از ساعت کاری) | no_quote (مظنه در دسترس نیست)
if (!isset($payload['status'])) {
if (!empty($payload['closed'])) {
$payload['status'] = 'closed';
} elseif ((int) ($payload['price'] ?? 0) <= 0 && (int) ($payload['buy'] ?? 0) <= 0) {
$payload['status'] = 'no_quote';
} else {
$payload['status'] = 'open';
}
}
$payload['up'] = $this->buildUpDownPrices();
$payload['last_historical'] = app(ProductDisplayPriceService::class)->resolveHistoricalBasePrice();
app(ProductDisplayPriceService::class)->cacheLivePricePayload($payload);
@@ -387,6 +398,7 @@ class ReportController extends Controller
$priceValue = $storedPrice;
$priceSource = 'database_last';
} else {
// مظنه زنده نداریم و show_last_price خاموش است → نه «بسته»، بلکه «مظنه در دسترس نیست»
return $this->appendUpPrices([
'sell' => 0,
'buy' => 0,
@@ -395,7 +407,8 @@ class ReportController extends Controller
'main_product' => $pr_price ?? 0,
'montzar' => $montzar_price ?? 0,
'zaarbox' => $zaarbox_price ?? 0,
'closed' => true,
'closed' => false,
'status' => 'no_quote',
'time' => now(),
], $forceRefresh);
}