This commit is contained in:
Hamza Aleghwairyeen
2024-04-12 16:32:18 +03:00
parent c68ec9b533
commit 9412ed0e06

View File

@@ -2319,26 +2319,38 @@ class MapPassengerController extends GetxController {
DateTime currentTime = DateTime.now(); DateTime currentTime = DateTime.now();
newTime = currentTime.add(durationToAdd); newTime = currentTime.add(durationToAdd);
averageDuration = (durationToRide / 60) / distance; averageDuration = (durationToRide / 60) / distance;
costDuration = (durationToRide / 60) * averageDuration * 0.016; // costDuration = (durationToRide / 60) * averageDuration * 0.016;
costDuration = (durationToRide / 60).floorToDouble();
print('costDuration----- $costDuration'); print('costDuration----- $costDuration');
print('costDistance----- $costDistance'); print('costDistance----- $costDistance');
print( print(
'passengerWalletTotal----- ${box.read(BoxName.passengerWalletTotal)}'); 'passengerWalletTotal----- ${box.read(BoxName.passengerWalletTotal)}');
double costComfort, costSpeed, costDelivery, costMashwari = 0;
update(); update();
if (currentTime.hour >= 22 && currentTime.hour < 5) { if (currentTime.hour >= 22 && currentTime.hour < 5) {
costDistance = distance * latePrice; // costDistance = distance * latePrice;
costComfort = (distance * comfortPrice) + costDuration * latePrice;
costMashwari = (distance * mashwariPrice) + costDuration * latePrice;
costSpeed = (distance * speedPrice) + costDuration * latePrice;
costDelivery = (distance * deliveryPrice) + costDuration * latePrice;
update(); update();
} else if (currentTime.hour >= 13 && currentTime.hour <= 16) { } else if (currentTime.hour >= 13 && currentTime.hour <= 16) {
if (averageDuration > 2.5) { // if (averageDuration > 2.5) {
costDistance = distance * heavyPrice; // costDistance = distance * heavyPrice;
update(); costComfort = (distance * comfortPrice) + costDuration * heavyPrice;
} else { costMashwari = (distance * mashwariPrice) + costDuration * heavyPrice;
costDistance = distance * naturePrice; costSpeed = (distance * speedPrice) + costDuration * heavyPrice;
update(); costDelivery = (distance * deliveryPrice) + costDuration * heavyPrice;
}
update();
// } /
} else { } else {
costDistance = distance * (naturePrice - .1); // costDistance = distance * (naturePrice - .1);
costComfort = (distance * comfortPrice) + costDuration;
costMashwari = (distance * mashwariPrice) + costDuration;
costSpeed = (distance * speedPrice) + costDuration;
costDelivery = (distance * deliveryPrice) + costDuration;
update(); update();
} }
//print('cost $cost'); //print('cost $cost');
@@ -2353,16 +2365,16 @@ class MapPassengerController extends GetxController {
// } // }
var totalDriver1 = costDistance + costDuration; var totalDriver1 = costDistance + costDuration;
totalCostPassenger = totalDriver1 + (totalDriver1 * kazan / 100); totalCostPassenger = totalDriver1 + (totalDriver1 * kazan / 100);
totalPassenger = totalCostPassenger; totalPassenger = costSpeed + (costSpeed * kazan / 100);
totalPassengerComfort = totalCostPassenger + (totalCostPassenger * .2); totalPassengerComfort = costComfort + (costComfort * kazan / 100);
// totalPassengerComfort = totalCostPassenger + (totalCostPassenger * .2);
totalPassengerComfortDiscount = totalPassengerComfortDiscount =
totalPassengerComfort + totalPassengerComfort * (kazan - 4) / 100; totalPassengerComfort + totalPassengerComfort * (kazan - 4) / 100;
totalPassengerMotoDelivery = totalPassengerMotoDelivery = costDelivery + (costDelivery * kazan / 100);
totalCostPassenger - (totalCostPassenger * .35);
totalDriver = totalDriver1 + (totalDriver1 * kazan / 100); totalDriver = totalDriver1 + (totalDriver1 * kazan / 100);
tax = totalCostPassenger * kazan / 100; tax = totalCostPassenger * kazan / 100;
totalME = totalCostPassenger - tax; totalME = totalCostPassenger - tax;
costForDriver = fuelPrice * 12; costForDriver = fuelPrice * (20 / 210) * distance;
if (totalCostPassenger < 20) { if (totalCostPassenger < 20) {
// for eygpt 20 le open ride // for eygpt 20 le open ride
@@ -2477,6 +2489,10 @@ class MapPassengerController extends GetxController {
} }
double passengerRate = 5; double passengerRate = 5;
double comfortPrice = 8;
double speedPrice = 4;
double mashwariPrice = 4;
double deliveryPrice = 1.2;
getKazanPercent() async { getKazanPercent() async {
var res = await CRUD().get( var res = await CRUD().get(
link: AppLink.getKazanPercent, link: AppLink.getKazanPercent,
@@ -2489,6 +2505,12 @@ class MapPassengerController extends GetxController {
heavyPrice = double.parse(jsonDecode(res)['message'][0]['heavyPrice']); heavyPrice = double.parse(jsonDecode(res)['message'][0]['heavyPrice']);
latePrice = double.parse(jsonDecode(res)['message'][0]['latePrice']); latePrice = double.parse(jsonDecode(res)['message'][0]['latePrice']);
fuelPrice = double.parse(jsonDecode(res)['message'][0]['fuelPrice']); fuelPrice = double.parse(jsonDecode(res)['message'][0]['fuelPrice']);
comfortPrice =
double.parse(jsonDecode(res)['message'][0]['comfortPrice']);
speedPrice = double.parse(jsonDecode(res)['message'][0]['speedPrice']);
mashwariPrice = double.parse(jsonDecode(res)['message'][0]['freePrice']);
deliveryPrice =
double.parse(jsonDecode(res)['message'][0]['deliveryPrice']);
} }
} }