LesJar Posted September 6, 2021 Report Share Posted September 6, 2021 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 Quote Link to comment Share on other sites More sharing options...
LesJar Posted September 6, 2021 Author Report Share Posted September 6, 2021 AS a sub-note to this topic and since I am no longer going to run PHPVMSGEN for money but make it a free service to the PHPVMS community I will add these variables for fare calculation into the system so when you input your requirements you are asked if you want fares to be generated. If you select yes then you will input your base fare amount , permile and business , first class factors. That way when I create your csv files I can have fares build for you as a starting point or not. The idea behind PHPVMSGEN is to build a set of csv files that you can import into PHPVMS V7 and have as far as possible a fully working virtual airline. Yes of course you may need to make adjustments here and there but the bulk of your data will have been done for you by PHPVMSGEN Quote Link to comment Share on other sites More sharing options...
LesJar Posted September 6, 2021 Author Report Share Posted September 6, 2021 Thinking about this , it could be developed as an option when setting up a new flight in PHPVMS like the distance is calculated to auto-calculate. The suggestion being is to add two new fields to the fares table and also to the input screens obviously Auto Calculate Base Fare. This is the $50 mentioned above so for economy it would be 50 business 150 first 250. I.e 3 times and 5 times Per Mile Unit This is the .11 mentioned above for economy and thus .33 for business and .55 for First Class Then on input of a flight you just need an extra field on fares to say. Auto-Calculate Y/N I think this would help many new Virtual Airlines especially those not based on a real world airline. Quote Link to comment Share on other sites More sharing options...
LesJar Posted September 27, 2021 Author Report Share Posted September 27, 2021 Phpvmsgen will have the option to build fares and attach them to flights in different formats Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.