added price_offset_percent

This commit is contained in:
2026-06-02 16:00:33 +03:30
parent 6cbbde9834
commit c40ac0a3fe
6 changed files with 215 additions and 36 deletions
+10 -8
View File
@@ -2,6 +2,7 @@
use App\Models\Customer;
use App\Models\Product;
use App\Services\ProductPriceService;
use Carbon\Carbon;
use Illuminate\Support\Facades\Route;
use Illuminate\Support\Facades\Http;
@@ -33,19 +34,20 @@ Route::get('/refPricer', function () {
if ($RPrice['name'] == 'گلد دات ای از آبشده - رسمی - نقد فردا') {
$RPrice['price'] = $RPrice['price'] / 4.3318;
}
$p = Product::where('id', $product->id)->update([
'price' => $RPrice['price'],
'price_profit' => $RPrice['profit'],
]);
ProductPriceService::syncFromReference(
$product,
(int) $RPrice['price'],
(int) ($RPrice['profit'] ?? 0)
);
// }
}
}
if (isset($copper) && isset($dollar)) {
$cp = ($copper / 1000000) * $dollar;
$p = Product::where('id', 33)->update([
'price' => $cp,
'price_profit' => 0,
]);
$copperProduct = Product::find(33);
if ($copperProduct) {
ProductPriceService::syncFromReference($copperProduct, (int) round($cp), 0);
}
}
return response()->json(true);