Compare commits

2 Commits
Author SHA1 Message Date
Hamza-Ayed ac50598ee0 Update: 2026-07-06 02:07:30 2026-07-06 02:07:30 +03:00
Hamza-Ayed 8d9126bb45 Update: 2026-07-06 02:04:01 2026-07-06 02:04:01 +03:00
5 changed files with 47 additions and 18 deletions
+16
View File
@@ -0,0 +1,16 @@
<?php
require_once __DIR__ . '/../core/bootstrap.php';
try {
$con = Database::get('main');
} catch (Exception $e) {
die("Database connection failed\n");
}
$sql = "ALTER TABLE kazan ADD COLUMN startPrice varchar(10) NOT NULL DEFAULT '0' AFTER currency";
try {
$con->exec($sql);
echo "Successfully added startPrice to kazan table.\n";
} catch (PDOException $e) {
echo "Error adding column: " . $e->getMessage() . "\n";
}
+16 -8
View File
@@ -74,9 +74,9 @@ try {
// أسعار الدقائق
if ($country === 'JO') {
$newNormalMin = 0.06;
$newPeakMin = 0.07;
$newLateMin = 0.08;
$newNormalMin = 0.05;
$newPeakMin = 0.06;
$newLateMin = 0.05;
} else {
$newNormalMin = round($newSpeedPrice / 4, 3);
$newPeakMin = round($newNormalMin * 1.15, 3);
@@ -86,20 +86,28 @@ try {
$updateSql = "UPDATE kazan
SET speedPrice = :speedPrice,
comfortPrice = :comfortPrice,
familyPrice = :ladyPrice,
ladyPrice = :ladyPrice,
electricPrice = :electricPrice,
vanPrice = :vanPrice,
deliveryPrice = :deliveryPrice,
freePrice = :mishwarVipPrice,
naturePrice = :normalMin,
heavyPrice = :peakMin,
latePrice = :lateMin
mishwarVipPrice = :mishwarVipPrice,
fixedPrice = :fixedPrice,
awfarPrice = :awfarPrice,
normalMinPrice = :normalMin,
peakMinPrice = :peakMin,
lateMinPrice = :lateMin
WHERE country = :countryName";
$upStmt = $con->prepare($updateSql);
$upStmt->execute([
':speedPrice' => $newSpeedPrice,
':comfortPrice' => $newComfortPrice,
':ladyPrice' => $newLadyPrice,
':electricPrice' => $newElectricPrice,
':vanPrice' => $newVanPrice,
':deliveryPrice' => $newDeliveryPrice,
':mishwarVipPrice' => $newMishwarVipPrice,
':fixedPrice' => $newFixedPrice,
':awfarPrice' => $newAwfarPrice,
':normalMin' => $newNormalMin,
':peakMin' => $newPeakMin,
':lateMin' => $newLateMin,
+7 -4
View File
@@ -17,10 +17,13 @@ echo "Updating Kazan pricing for Jordan...\n";
// Update the kazan table where country is Jordan
$sql = "UPDATE kazan
SET speedPrice = '0.25',
naturePrice = '0.05',
heavyPrice = '0.06',
latePrice = '0.05'
SET startPrice = '0.35',
speedPrice = '0.22',
fixedPrice = '0.22',
awfarPrice = '0.19',
normalMinPrice = '0.05',
peakMinPrice = '0.06',
lateMinPrice = '0.05'
WHERE country = 'Jordan' OR country = 'JO'";
$stmt = $con->prepare($sql);
+7 -6
View File
@@ -161,10 +161,11 @@ function calculateDynamicPrice($country, $minFare, $distance, $duration, $kazanR
} catch (Exception $e) {}
}
$naturePrice = (float) ($kazanRow['naturePrice'] ?? 0);
$heavyPrice = (float) ($kazanRow['heavyPrice'] ?? 0);
$latePrice = (float) ($kazanRow['latePrice'] ?? 0);
$kazanPercent = (float) ($kazanRow['kazan'] ?? 10);
$naturePrice = (float) ($kazanRow['normalMinPrice'] ?? 0);
$heavyPrice = (float) ($kazanRow['peakMinPrice'] ?? 0);
$latePrice = (float) ($kazanRow['lateMinPrice'] ?? 0);
$kazanPercent = (float) ($kazanRow['kazanPercent'] ?? 10);
$startPrice = (float) ($kazanRow['startPrice'] ?? 0);
// === General Settings ===
$minBillableKm = 0.2;
@@ -268,11 +269,11 @@ function calculateDynamicPrice($country, $minFare, $distance, $duration, $kazanR
$baseFareForDistance = $billableDistance * $perKmSpeed;
// 1. حساب التسعيرة مع الذروة (للسائق)
$fareWithSurge = $baseFareForDistance + ($billableMinutes * $effectivePerMin);
$fareWithSurge = $startPrice + $baseFareForDistance + ($billableMinutes * $effectivePerMin);
$fareWithSurge *= $surgeMultiplier;
// 2. حساب التسعيرة الطبيعية بدون ذروة (لراكب Prime)
$fareNoSurge = $baseFareForDistance + ($billableMinutes * $naturePrice);
$fareNoSurge = $startPrice + $baseFareForDistance + ($billableMinutes * $naturePrice);
// نحدد التسعيرة الأساسية حسب حالة الراكب
$fare = $isPrime ? $fareNoSurge : $fareWithSurge;
+1
View File
@@ -830,6 +830,7 @@ CREATE TABLE `kazan` (
`kazanPercent` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '10' COMMENT 'نسبة الكازان (عمولة المنصة) %',
`fuelPrice` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'سعر الوقود المرجعي',
`currency` varchar(5) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'SYP' COMMENT 'رمز العملة: SYP, EGP, JOD, IQD, ...',
`startPrice` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '0' COMMENT 'فتحة العداد',
-- ========== 🚗 أسعار الكيلومتر لكل نوع سيارة ==========
`speedPrice` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'سعر الكيلومتر - Speed',