zarbox added 2

This commit is contained in:
2026-06-04 14:42:22 +03:30
parent 92d01f96da
commit f5d53b2747
4 changed files with 86 additions and 9 deletions
+17 -3
View File
@@ -330,10 +330,24 @@ class ReportController extends Controller
}
if ($pr_product && !$closed) {
if ($priceProvider === 'main_product') {
app(EtehadiePriceService::class)->syncProductFromApi($pr_product->fresh());
$pr_product->refresh();
if (Product::hasStoredPriceColumns()) {
app(EtehadiePriceService::class)->syncProductFromApi($pr_product->fresh());
$pr_product->refresh();
$pr_price = (float) $pr_product->price + (float) ($pr_product->price_profit ?? 0);
} else {
$apiUrl = $config->getString('zaarbox_api_url', '')
?: $config->getString('etehadie_api_url', 'https://price.zaarbox.ir/api/free');
$live = app(EtehadiePriceService::class)->fetchLiveOrderPrice(
$pr_product->reading_method,
$apiUrl
);
$pr_price = (float) ($live['order_price'] ?? 0);
}
} else {
$pr_price = Product::hasStoredPriceColumns()
? (float) $pr_product->price + (float) ($pr_product->price_profit ?? 0)
: 0.0;
}
$pr_price = (float) $pr_product->price + (float) ($pr_product->price_profit ?? 0);
}
/*