This is one of the major ‘headaches’ if you want to use the financials of PHPVMS as there are so many factors in the real world that affect ticket prices . In the Virtual airline world I think we try to keep things as simple as possible unless you really want to copy a real world airline 100%. So how do you work out your fares for the flights in your schedule to be a ‘reasonable amount’. Actually it is standard in IATA to have a price built based on sets of tables which if you got the money you could subscribe to IATA and do it the professional way. However research done crunching hundreds and thousands of prices for flights came to an average calculation that (this is based on it being done in USD) that every flight had a base fare of around $50 and for every mile of the distance it costs $0.11 . So based on this I put together the following test code to see what sort of numbers came out -
//
//
// fare calculation
//
// This is calculated as follows -:
// $basefare i.e 50
// $permile i.e 0.11
// $rounding i.e 5
// $business i.e 3
// $first i.e 5
// $distance i.e 1200
//
// Economy Fare is Base Fare + (distance * per=mile) rounded to nearest rounding factor
// Business Fare is (Base Fare + (distance * per=mile)) * factor rounded to nearest rounding factor
// First Class Fare is (Base Fare + (distance * per=mile)) * factor rounded to nearest rounding factor
//
// function to round a number to nearest factor
//
function roundUpToAny($n,$x) {
return (round($n)%$x === 0) ? round($n) : round(($n+$x/2)/$x)*$x;
}
//
// dummy test results
//
$distance = 200;
$basefare = 50;
$permile = 0.11;
$business = 3;
$first = 5;
$rounding = 5;
$economy_fare = $basefare + ($distance * $permile);
$economy_fare = roundUpToAny($economy_fare,$rounding);
echo 'Economy Class fare for a '.$distance.'Nm flight is '.$economy_fare.PHP_EOL;
$business_fare = ($basefare + ($distance * $permile)) * $business;
$business_fare = roundUpToAny($business_fare,$rounding);
echo 'Business Class fare for a '.$distance.'Nm flight is '.$business_fare.PHP_EOL;
$first_fare = ($basefare + ($distance * $permile)) * $first;
$first_fare = roundUpToAny($first_fare,$rounding);
echo 'First Class fare for a '.$distance.'Nm flight is '.$first_fare.PHP_EOL;
It was no surprise to see the results as follows -:
Economy Class fare for a 200Nm flight is 75
Business Class fare for a 200Nm flight is 220
First Class fare for a 200Nm flight is 360
I know this is not going to be perfect for everyone and yes many will say that it is either too expensive or too cheap , but of course you can adjust the BASE FARE and PER MILE amount and even the factor for Business and First if you want.
I know that if you are setting up a virtual airline with 500 flights that’s a lot of fares to consider, I saw in one virtual airline albeit using PHPVMS V5 that many flights were giving a large negative revenue or very large positive revenue which suggested that the fares for some of these flights were guessed at. I understand that the Finance of PHPVMS has been built to enhance the virtual airline experience where you can see profit and loss just like the real world, however it gets to a point where the numbers do not make sense and thus the objective id defeated.
These are just my thoughts on the matter of fares and how best to get them done in a way that has the potential to work very well