Jump to content
ProAvia

Flight Time Separator [SOLVED]

Recommended Posts

I could swear I've seen this somewhere, but can't find it now. And was unable to find ANY reference using Search.

Can the flight time separator be changed from ' . ' to ' : '? And where is this setting? My present 2.x site uses the period ( . ) and I'd like to change to the colon ( : ) on my 5.5.2 site.

With a 5.5.2 site, does it matter which separator is used? Is there an advantage to using one over the other?

TIA!

Edited by ProAvia

Share this post


Link to post
Share on other sites

It can be changed, you'd have to change some files though, it would just be easier to do a str_replace() to the .where you want it changed.

Share this post


Link to post
Share on other sites

It's not that I necessarily want it changed - but on my 5.5.2 test site, I processed a test Pirep and noticed the flight time addition was odd. The pilot had 3348.38 total hours - 3348 hours 38 minutes. His Pirep added 2.22 - 2 hours 22 minutes. The result should have been 3351.00 - 3351 hours 00 minutes. Instead the result was 3350.6 - 3350 hours 60 minutes. While I know that 3350 hours 60 minutes is actually 3351 hours 00 minutes, it might be confusing to my pilots.

I'll do some more testing to see if the times add up correctly. Maybe there's an issue with 60 minutes not converting over to 1 hour - possibly it happens at 61 minutes?

I thought there was a reference - maybe during install - to choose between a period or colon for the separator.

Share this post


Link to post
Share on other sites

Thanks!

Mine is set the exact same as that. Lines 704-705 (proper timestamp section) and 825-826 (Update a specific PIREP section) match those of that file. As a matter of fact, my PIREPData.class.php file matches the one linked above exactly.

 

Share this post


Link to post
Share on other sites

Now I'm noticing the pilot pay per hour computation for the flight time is messed up.

Pilot pay / hour - $60
Flight time - 2.17 (flighttime) 2:17:00 (flighttime_stamp)
Total pay for this flight - $130.20

So in the above example, the pilot makes $1 for every minute ($60/hour) - TIMES - 137 minutes (2 hours 17 minutes) - EQUALS - $137.00 (should be).

The $130.20 paid is based on 2.17 hours(approx. 2 hours 10 minutes - 2 and 17/100 hours), not 2:17 hours (2 hours 17 minutes - 2 and 17/60 hours). While this example doesn't show a big discrepancy in dollar value, it's still an error.

I don't know where to look to try to fix it. I believe the issue is the number after the decimal is being divided by 100 instead of 60. In my example above -  17/100 instead of 17/60.

I am not sure if this same issue (x/100 versus x/60) is affecting the flight time calculation between kACARS and phpVMS - I don't presently have enough conclusive data, as the kACARS log totals usually equal - but not always - the flight time shown in the 'pireps' table.

It's not that I mind virtually paying the pilots a little less, but I know one of them will eventually catch this. :blink: LOL - Hopefully there's an easy fix.... or at least it can be incorporated into version 3.

Any and all help is appreciated!

Share this post


Link to post
Share on other sites

Just to confirm that your Pilot Pay / Hour is $60 for the rank that you are on and that the schedule doesn't have anything in the the "payforflight" field of the database.

Also, in the above example, the algorithm is correct.

Pilot Pay / hour X num hours = payforflight
$60 X 2.17 = $130.20

If the issue was that the pilot was given the pay for their payrate (e.g. $30 for pay / hour on rank then $30 every pirep), then I posted a fix in the spoiler here but it seems it is not your issue. (just putting it out there in case you come across this later, feel free to take a look anyway).

If you are looking for the pay conversion point (there are many), the main one is here

But on a closer look at the algorithm, it is mostly correct -> Just as an example

// This would usually be dynamic
$pirep->flighttime_stamp = "02:00:00";
$pirep->pilotpay = "18"; // Sets it to the payrate as phpvms does, will have to override later

$peices = explode(':', $pirep->flighttime_stamp); // Take the flighttime_stamp and make it like this 020000
$minutes = ($peices[0] * 60) + $peices[1]; // should equal 120mins
$amount = $minutes * ($pirep->pilotpay / 60); // Do the conversion
echo $amount; // should equal $36

You can try that on your machine as a test and it should equal $36. This is a whole number though, so when you go into decimal values, it gets a bit trickier.

// This would usually be dynamic
$pirep->flighttime_stamp = "02:00:00";
$pirep->pilotpay = "18"; // Sets it to the payrate as phpvms does, will have to override later

// Do the conversion
$peices = explode(':', $pirep->flighttime_stamp); // 021700
$minutes = ($peices[0] * 60) + $peices[1]; // 137mins

/* Pretty sure this is the cause */
$amount = $minutes * ($pirep->pilotpay / 60); // 0.3
/* The above is basically 137 X (18 / 60) = 0.3 */
echo $amount; // $41.1

Not sure if this is exactly what your after or if it was any help at all, but it does shed some light on what's going on. I believe this is going to be easier in v3 (calculating pay in one place, not four perhaps). And after reading your above post, yes the conversion it's doing takes the flighttime_stamp value not the flighttime (decimal) value.

Edited by web541

Share this post


Link to post
Share on other sites
Quote

Just to confirm that your Pilot Pay / Hour is $60 for the rank that you are on and that the schedule doesn't have anything in the the "payforflight" field of the database.

Yes, $60/hour - nothing in "payforflight" field

Quote

Also, in the above example, the algorithm is correct.

The multiplication is correct - if I were looking for hours and tenths. But I am looking for hours and minutes. $60 x 2.17=$130.20 - and - $60x2:17=$137.00

Quote

If you are looking for the pay conversion point (there are many), the main one is here

Thanks, I will review that.

My issue is with the minutes conversion. I will have to compare my files with those on GitHub to be sure I didn't muck mine up in some way.

In the 'ledger' table the pay amount is correct. I wonder where the incorrect amount in my example above is being pulled from? Hmm, more research needed. :wacko:

A few questions if I may - so I can understand this a bit better..... I numbered the lines to hopefully make it easier

1 - // This would usually be dynamic
2 - $pirep->flighttime_stamp = "02:00:00";
3 - $pirep->pilotpay = "18"; // Sets it to the payrate as phpvms does, will have to override later

4 - // Do the conversion
5 - $peices = explode(':', $pirep->flighttime_stamp); // 021700
6 - $minutes = ($peices[0] * 60) + $peices[1]; // 137mins

7 - /* Pretty sure this is the cause */
8 - $amount = $minutes * ($pirep->pilotpay / 60); // 0.3
9 - /* The above is basically 137 X (18 / 60) = 0.3 */
10 - echo $amount; // $41.1

Line 5 - converts the flighttime_stamp from 02:17:00 to 021700 in the example?

Line 6 - converts to minutes - $peices[0] = 02 (hours), $peices[1] = 17 (minutes) and the seconds are disgarded?

Line 8 - takes the minutes from line 6 and multiplies by (pilotpay/60) - so minutes times pay/minute?

Line 10 - shows total pay for 2:17 flight at $18/hour?

Since the ledger table amounts are correct - at least since I converted to 5.5.2, I have to believe them. I need to find where the dollar amount I am seeing is being drawn from.

Here's to hoping version 3 only has one pay conversion point!

Thanks!

EDIT:

Added file attachment showing discrepancy.

 

Pilot Pay Discrepancy.txt

Edited by ProAvia
Add attachment

Share this post


Link to post
Share on other sites

Ah ok, so I think by the txt file your pay is being calculated by the decimal (flighttime field) value instead of the flighttime_stamp value?

Then instead of taking the tenths value / 60 it takes it / 100? If so, there's a missing link somewhere during the conversion (but it seems to be calculating for me)

And your right, I hope v3 changes the calculation points, right now it goes from PIREP Filing => Controller => PIREPData File => another function to calculate it => ledger => calculate it again => PilotData file to reset it just about. I believe this is being worked on though.

In regards to your "lines",

line 5: affirm, by getting rid (exploding) the : in the flighttime string

line 6: also correct, and it does this because when the PIREP is filed from the ACARS Client, I believe it only reports the rounded value of it's calculated flighttime thus discarding the 00:00:sec value.

line 8: Mostly correct, though it's actually minutes (from line 6) * (pilotpay / 60) where pilotpay is the payrate per hour based on the pilot (who filed the PIREP)'s rank.

line 10: Correct, 2hr 17min flight with $18 per hour which from the above algorith [137 * (18 / 60) = $41.1]

 

Just confirm the above is what you are getting so we can track down your issue.

Calculation Steps From ACARS...

  1. PIREPData.class.php FileReport
  2. PIREPData.class.php PopulatePIREPFinance
    1. PIREPData.class.php GetPIREPRevenue
      1. This could be your problem as a quick glance shows it calculating the pilotpay based on the decimal value (flighttime field in DB), not sure if it gets parsed though so have to look a bit more later. EDIT: nevermind, only used to calculate Revenue.
  3. Sets the pilotpay field in the DB to the pilot's payrate (without my potential fix in a previous post) to potentially recalculate it later

This is called when a flight report is updated or it has changed status (accepted, rejected, etc.)

  1. PIREPData.class.php CalculatePIREPPayment
    1. This calculates it using the algorithm above which seems to be correct and it is only now when the Ledger DB Values are added which you said were correct, so theoretically the pay should be fine up until now. (we can dump the values later if we have to)
    2. This function is then called PilotData.class.php resetPilotpay which also should be fine as it just adds up the values from the ledger table and resets the total pilot pay for every pirep the pilot has filed.

Seems like a round circle, might have to start dumping data (var_dump or print_r) in various places to see what values are being processed.

Edited by web541

Share this post


Link to post
Share on other sites

Thanks for the affirmation on the "lines". Yeah, I over-simplified line 8, but the end result is the same.

The text file is just to list what shows in the tables. The ledger table shows the correct pilot payment. The pirep table only shows pilotpay rate, not amount of pilotpay for that flight. However, given your 2., 1. PIREPData.class.php GetPIREPRevenue, it seems that net revenue is not calculated correctly - or maybe just not displayed correctly. And that's how I am determining the supposed 'error' - subtracting fuel cost, expenses and net revenue from gross revenue to see what the pilot pay is. Then comparing that number to what's reported in the ledger. That's where I'm seeing the difference.

In version 2.1.936, I don't recall a ledger table - but need to look closer when I get home later. If it's true there was no ledger table, where was that data located? I don't care if the finances are incorrect prior to moving to 5.5.2. But moving forward, I'd like them to be correct.

Additionally, after moving to 5.5.2, I noticed that 'Financial Reports' in admin shows 0.00 Pilot Pay for all months prior to conversion month. And a large negative number for pilot pay in the conversion to 5.5.2 month. I'm guessing the large negative number is accounting for all pilot pay prior to the conversion to 5.5.2.

I'll look at the PIREPData.class.php file in detail later today also.

Thanks!

Edited by ProAvia

Share this post


Link to post
Share on other sites

Yeah, the revenue may not be calculated correctly, but this shouldn't have anything to do with the pay as only the revenue data is returned in that function.

And yes, also correct as before phpVMS 5.5.x, there was no Ledger table, so all pilot pay was calculated internally.

The calculation points are also a bit simpler in the earlier version as most of it is done in the PilotData.class.php file and what's interesting is the algorithm is slightly different as in phpVMS 5.5.x, the flighttime_stamp is used, rather in the earlier, the flighttime value (with the decimal) is used.

In addition, the pay is being calculated the same, just using the pilotpay (payrate) and flighttime of the PIREPS table instead of reading it from a Ledger Table.

  1. https://github.com/nabeelio/phpVMS/blob/master/core/common/PilotData.class.php#L680
  2. https://github.com/nabeelio/phpVMS/blob/master/core/common/PilotData.class.php#L717
  3. https://github.com/nabeelio/phpVMS/blob/master/core/common/PilotData.class.php#L749

And that large negative number is yes, probably accounting for the pay prior to the conversion, you could fix this or ignore it for later, but if you want to dump some data in a few places, we can get an idea of which data is correct and where it is being incorrectly parsed. I'll go and get these places for you. 

Share this post


Link to post
Share on other sites

Your 3 links for PilotData.class.php are for version 2.1.x showing the pilot pay calculations?

As for PIREPData.class.php, for getPILOTRevenue, lines 841, 1009 and 1038.

841 - Update a specific PIREP, recalculate finances - references '$pirepinfo->paytype' and looks to be using '$flighttime_stamp'


1009 - Populate PIREP with financial info, Set the pilotpay here - references '$payment_type' as in pay per schedule or per hour. But right above this line references 'flighttime'


1038 - Calculate gross revenue of PIREP - references '$payment_type = PILOT_PAY_HOURLY'. But again references 'flighttime' three lines later. This section returns '$revenue', as in net revenue.

Lines 1249-1290 looks to actually calculate the pilot payment, uses 'flighttime_stamp', and enters that into the ledger table.

Lines 1009 and 1038 might be where my issue originates.

For now, I'm going to ignore the large negative number and assume the version 2.1.x calculations were correct. But am willing to look at it at a later time.

Thanks!

Share this post


Link to post
Share on other sites

Yes, those links are the conversion points in phpvms 2.x.x (the original)

But I think you might be getting a little sidetracked here. The lines you mentioned actually refer to the revenue that is being returned, and then inserts that into the revenue field in the DB which shouldn't have anything to do with the pilot pay (though it is being used to calculate it) and the values with . and : shouldn't make a difference as it is being treated the same way.

Please confirm the following

  1. The issue is with the pilot pay being calculated more than expected
  2. Does this occur with just the one rank or several (with different payrates, not just $60)
  3. With your discrepancy of $6.40, the algorithm is
    1.  Supposedly doing this
      1. payrate * flighttime = dollars
        1. $60 * 2.17 = $130.20
    2. When it should be doing this
      1. payrate * total_flight_minutes = dollars
        1. $60 / 60 * 137 = $137
          1. $1 per minute in this case.
  4. In your Ledger Table, are your amount values correct?

Once you confirm all of those, can I get you to try putting the attached file into a module (e.g. core/module/PayChecker/place this file here) and then open it up and edit the top pilotid and pirepid values

Once you confirm all of those, can I get you to do the following

  1. Put the attached file into a module (e.g. core/module/PayChecker/place this file here)
  2. File a PIREP (any will do) and take note of the PIREP ID in the database or just use one which you've already filed
  3. Open up the PayChecker.php file and edit the top two values pilotid and pirepid respectively.
  4. In your url, go to http://yourvaurl.com/index.php/PayChecker and hit go
  5. Check the outcomes and report back

That should allow us to have a look and confirm the values you are seeing.

 

 

Edited by web541

Share this post


Link to post
Share on other sites
55 minutes ago, web541 said:

Please confirm the following

  1. The issue is with the pilot pay being calculated more than expected
  2. Does this occur with just the one rank or several (with different payrates, not just $60)
  3. With your discrepancy of $6.40, the algorithm is
    1.  Supposedly doing this
      1. payrate * flighttime = dollars
        1. $60 * 2.17 = $130.20
    2. When it should be doing this
      1. payrate * total_flight_minutes = dollars
        1. $60 / 60 * 137 = $137
          1. $1 per minute in this case.
  4. In your Ledger Table, are your amount values correct?
  1. Not necessarily MORE than expected. And it may not affect actual credited pay to the pilot.
  2. All ranks with differing payrates. I used the rank @ $60/hour to make the math easier.
  3. ...
    1. Yes - but may only be using this in revenue computation
    2. Yes - this amount is shown in ledger table
  4. Yes - as per 3.2 above - $137

PayChecker.php results

PIREPData => CalculatePIREPPayment
137


PilotData => resetPilotPay
10642.50


New Algorithm Using Decimal Form
137


New Algorithm Using Flight Stamp Form
137


What you are getting now (I think)
130.2

Here's what I think is happening:

  • Net revenue is being determined using flighttime method of pilotpay. Net revenue = revenue in the pireps table.
    • Now: gross - fuelprice - expenses - pilotpay(flighttime) = revenue
    • Should be: gross - fuelprice - expenses - pilotpay(flighttime_stamp) = revenue
  • Pilot pay for given PIREP is being determined using flighttime_stamp method of pilotpay. This is what shows correctly in the ledger table.

This all started when I added the following to pilot_viewreport.php to display via 'pireps/viewreport'. And I can see now that I am calling Pilot Pay incorrectly. But, this lead to finding that Net Revenue is being computed incorrectly.

<table class="balancesheet" cellpadding="0" cellspacing="0" width="100%">

	<tr class="balancesheet_header">
		<td align="" colspan="2">Flight Details</td>
	</tr>
	<tr>
		<td align="right">Gross Revenue: <br /> 
			(<?php echo $pirep->load;?> load / <?php echo FinanceData::FormatMoney($pirep->price);?> per unit)<br />
		<td align="right" valign="top"><?php echo FinanceData::FormatMoney($pirep->load * $pirep->price);?></td>
	</tr>
	<tr>
		<td align="right">Fuel Cost: <br />
			(<?php echo $pirep->fuelused;?> lbs fuel used @ <?php echo $pirep->fuelunitcost?> / lb)<br />
		<td align="right" valign="top"><?php echo FinanceData::FormatMoney($pirep->fuelused * $pirep->fuelunitcost);?></td>
	</tr>
	<tr>
		<td align="right">Pilot Pay: <br />
			(per hour based on rank)<br />
		<td align="right" valign="top"><?php echo FinanceData::FormatMoney($pirep->pilotpay * $pirep->flighttime);?></td>
	</tr>
	<tr>
		<td align="right">Net Revenue: <br />
			(after <u>all</u> expenses)<br />
		<td align="right" valign="top"><?php echo FinanceData::FormatMoney($pirep->revenue);?></td>
	</tr>
	</table>

So, it appears that revenue is not correct as it's computed using flighttime instead of flighttime_stamp. And if that's the case, I guess pilotpay is correct.

If this is what is occurring, is there an easy fix for the revenue computation? At this point, I don't really care if it will be retroactive - but moving forward, I'd like it to be correct.

Share this post


Link to post
Share on other sites
9 minutes ago, ProAvia said:
  1. Not necessarily MORE than expected. And it may not affect actual credited pay to the pilot.
  2. All ranks with differing payrates. I used the rank @ $60/hour to make the math easier.
  3. ...
    1. Yes - but may only be using this in revenue computation
    2. Yes - this amount is shown in ledger table
  4. Yes - as per 3.2 above - $137

PayChecker.php results


PIREPData => CalculatePIREPPayment
137


PilotData => resetPilotPay
10642.50


New Algorithm Using Decimal Form
137


New Algorithm Using Flight Stamp Form
137


What you are getting now (I think)
130.2

Here's what I think is happening:

  • Net revenue is being determined using flighttime method of pilotpay. Net revenue = revenue in the pireps table.
    • Now: gross - fuelprice - expenses - pilotpay(flighttime) = revenue
    • Should be: gross - fuelprice - expenses - pilotpay(flighttime_stamp) = revenue
  • Pilot pay for given PIREP is being determined using flighttime_stamp method of pilotpay. This is what shows correctly in the ledger table.

This all started when I added the following to pilot_viewreport.php to display via 'pireps/viewreport'. And I can see now that I am calling Pilot Pay incorrectly. But, this lead to finding that Net Revenue is being computed incorrectly.


<table class="balancesheet" cellpadding="0" cellspacing="0" width="100%">

	<tr class="balancesheet_header">
		<td align="" colspan="2">Flight Details</td>
	</tr>
	<tr>
		<td align="right">Gross Revenue: <br /> 
			(<?php echo $pirep->load;?> load / <?php echo FinanceData::FormatMoney($pirep->price);?> per unit)<br />
		<td align="right" valign="top"><?php echo FinanceData::FormatMoney($pirep->load * $pirep->price);?></td>
	</tr>
	<tr>
		<td align="right">Fuel Cost: <br />
			(<?php echo $pirep->fuelused;?> lbs fuel used @ <?php echo $pirep->fuelunitcost?> / lb)<br />
		<td align="right" valign="top"><?php echo FinanceData::FormatMoney($pirep->fuelused * $pirep->fuelunitcost);?></td>
	</tr>
	<tr>
		<td align="right">Pilot Pay: <br />
			(per hour based on rank)<br />
		<td align="right" valign="top"><?php echo FinanceData::FormatMoney($pirep->pilotpay * $pirep->flighttime);?></td>
	</tr>
	<tr>
		<td align="right">Net Revenue: <br />
			(after <u>all</u> expenses)<br />
		<td align="right" valign="top"><?php echo FinanceData::FormatMoney($pirep->revenue);?></td>
	</tr>
	</table>

So, it appears that revenue is not correct as it's computed using flighttime instead of flighttime_stamp. And if that's the case, I guess pilotpay is correct.

If this is what is occurring, is there an easy fix for the revenue computation? At this point, I don't really care if it will be retroactive - but moving forward, I'd like it to be correct.

Ah ok, that clears things up, so I guess it's the revenue that's stuffed up. I'll take a look and see if there's a fix to this revenue issue and I guess the pilot pay will work itself out afterwards, providing that it is correct in the ledger. And just another question, is your revenue column mainly filled with negative number? This might also fix the 0 issue in the admin.

Share this post


Link to post
Share on other sites

I checked random ledger amounts and compared to PIREP. The pilot pay appears correct. The revenue column is all positive - except for a couple random negative entries. Not enough that it should have anything to do with the 0 issue in admin. Here's that report. I converted over in January of this year.

Month 	Flights 	Revenue 	Pilot Pay 		Expenses 	Fuel 				Total 
2016-10  	2  	$ 25, 300.00  	$ 0.00  		$ 0.00  	($ -9, 570.32)  	$ 15, 729.68  
2016-11  	8  	$ 164, 100.00 	$ 0.00  		$ 0.00  	($ -40, 284.56)  	$ 123, 815.44  
2016-12  	3  	$ 75, 300.00  	$ 0.00  		$ 0.00  	($ -20, 744.08)  	$ 54, 555.92  
2017-01  	19  	$ 346, 750.00  	($ -123, 709.70) 	$ 0.00  	($ -125, 454.56)  	$ 97, 585.74  
 
												Total: $ 291, 686.78 

My guess is that the addition of the ledger table caused this. There's probably not a method to compute the data correctly for prior to conversion. That's why the 0 entries and negative hit on conversion. It should all balance out in the end though.

Edited by ProAvia

Share this post


Link to post
Share on other sites

I just checked, for all months prior to January 2017, Pilot Pay column shows $0.00. This is from when we switched over to phpVMS in May of 2014 through December 2016.

Share this post


Link to post
Share on other sites

Ok thanks, you should be able to reset it, but I'd do it after as it may recalculate revenue as well which might screw it up further.

With this, I just took a look and it seems that it is just multiplying the pilotpay in the pirep (which is the payrate set by phpvms) by the flight time, so I should be able to fix this for you pretty easily with the scripts from the PayChecker confirming your results, just as you thought earlier.

Edited by web541

Share this post


Link to post
Share on other sites

I just had a thought, maybe the revenue is being counted like that on purpose?

Anyway, if you want to calculate the pilotpay (to affect the revenue) based on pilot's payrate and correct flighttime (number of minutes instead of the flighttime itself as a decimal form / 100), then here is the fix.

Go to PIREPData.class.php line 1042 and between the if statement (the one with if($payment_type == PILOT_PAY_HOURLY) {) on it replace it's content with this

$pilot = PilotData::getPilotData($data['pilotid']); # Get the pilot info for payrate in case pay field is changed later
$flighttime = explode('.', $data['flighttime']); # split the flighttime into two parts
$flighttime_min = ($flighttime[0] * 60) + ($flighttime[1]); # Calculate no. minutes
$pilotpay = ($pilot->payrate / 60) * $flighttime_min; # Finalise the payment

// This was the original
// Only multiplies payrate (pay field) by the flight time without taking into account the minutes / 60 but min. / 100
# $pilotpay = $data['pilotpay'] * $data['flighttime'];

And you should be able to see the calculation affect the revenue with the correct amount as per the ledger table.

Once you check this, report back with your results and if they're correct, I'll amend the PayChecker script with a reset revenue function which will allow you to reset all revenue and recalculate it using the new method, without fully resetting the pilot pay itself (unless you want it to do this).

Edited by web541

Share this post


Link to post
Share on other sites
22 minutes ago, web541 said:

I just had a thought, maybe the revenue is being counted like that on purpose?

Quite possibly - or it just slipped through the cracks over the years. Maybe it's to adjust for the big virtual bucks the management gets paid. :lol:

Quote

And you should be able to see the calculation affect the revenue with the correct amount as per the ledger table.

Will this update the revenue column in pireps for previous entries too? Hmm, I'll back up the DB before I attempt. Will have to wait until tomorrow though.

Thanks for all your time and effort with this. I really do appreciate it! Hard to believe I started this thread asking about the flight time separator (period vs colon) and morphed to pilotpay only to find that's correct and the revenue was off.

I do have two more questions, if I may -

  1. While I NOW know that the way I tried calling Pilot Pay below is incorrect, how do I call it? I tried substituting flighttime_stamp for flighttime, but that gave me pilotpay based on the hour and dropped the minutes. So 02:37 was computed as 2 hours.
  2. Is there a way for pilots and admins to see how much a pilot has been paid for a PIREP and a total pay somewhere? I'd like to provide a table with that data for pilots/admins to review.
<tr>
		<td align="right">Pilot Pay: <br />
			(per hour based on rank)<br />
		<td align="right" valign="top"><?php echo FinanceData::FormatMoney($pirep->pilotpay * $pirep->flighttime);?></td>
	</tr>

Thanks!!

Edited by ProAvia
  • Like 1

Share this post


Link to post
Share on other sites

Thinking about that again, I think it just slipped through the cracks. In the example I gave the data for the flight was:

Gross Revenue: 
 (187 load / $ 180.00 per unit)
							$ 33, 660.00 
Fuel Cost: 
 (16367 lbs fuel used @ 0.68 / lb)
							$ 11, 129.56 
Net Revenue: 
 (after all expenses)
							$ 22, 400.20 

Which leave $130.24 - of which pilotpay(flighttime) was $130.20. I'll assume the 4 cents was for rounding somewhere. But the pilotpay(flighttime_stamp) was $137.00. So the revenue as reported is a higher dollar value that the actual ending dollar value giving pilotpay @ $137.00

Jeez - I'm really glad I didn't go into accounting!

Edited by ProAvia

Share this post


Link to post
Share on other sites

Nope, it won't affect your previous entries, but I will amend my PayChecker script to change this data for you (and possibly recalculate the pilot's pay), but please back up your DB first.

Now for your questions

  1. The way it is calculated is different (I assume this info will be placed on the view pirep page), use something like this
    <tr>
    	<td align="right">Pilot Pay: <br /> (per hour based on rank)<br />
    	<td align="right" valign="top">
    		<?php echo FinanceData::FormatMoney($pirep->pilotpay * $pirep->flighttime);?>
    		<?php
    		$flighttime = explode('.', $pirep->flighttime);
    		$totalminutes = ($flighttime[0] * 60) + ($flighttime[1]);
    		$pilot = PilotData::getPilotData($pirep->pilotid); // In case the pilotpay value changes in the future
    		$totalpay = ($pilot->payrate / 60) * $totalminutes;
    		return FinanceData::formatMoney($totalpay);
    		?>
    	</td>
    </tr>

     

  2. You should be able to view this in edit pirep (admin), but I'll make a table for you to show this, do you want it per pilot or per pirep?

Share this post


Link to post
Share on other sites
13 minutes ago, ProAvia said:

Thinking about that again, I think it just slipped through the cracks. In the example I gave the data for the flight was:


Gross Revenue: 
 (187 load / $ 180.00 per unit)
							$ 33, 660.00 
Fuel Cost: 
 (16367 lbs fuel used @ 0.68 / lb)
							$ 11, 129.56 
Net Revenue: 
 (after all expenses)
							$ 22, 400.20 

Which leave $130.24 - of which pilotpay(flighttime) was $130.20. I'll assume the 4 cents was for rounding somewhere. But the pilotpay(flighttime_stamp) was $137.00. So the revenue as reported is a higher dollar value that the actual ending dollar value giving pilotpay @ $137.00

Jeez - I'm really glad I didn't go into accounting!

I found out the issue here, if you look closely at your figures here for fuel cost (11,129.56), but in your database (from the txt file provided) the fuel cost is 11129.6 so it rounded it up before entry into the database, this one is probably to do with your acars client rounding it off as it doesn't go through phpvms I don't think.

After the revenue change above, the pilot pay will be adjusted, so these figures are before the change above has been implemented (I'm guessing).

Share this post


Link to post
Share on other sites
48 minutes ago, web541 said:

Nope, it won't affect your previous entries, but I will amend my PayChecker script to change this data for you (and possibly recalculate the pilot's pay), but please back up your DB first.

Now for your questions

  1. The way it is calculated is different (I assume this info will be placed on the view pirep page), use something like this
    
    <tr>
    	<td align="right">Pilot Pay: <br /> (per hour based on rank)<br />
    	<td align="right" valign="top">
    		<?php echo FinanceData::FormatMoney($pirep->pilotpay * $pirep->flighttime);?>
    		<?php
    		$flighttime = explode('.', $pirep->flighttime);
    		$totalminutes = ($flighttime[0] * 60) + ($flighttime[1]);
    		$pilot = PilotData::getPilotData($pirep->pilotid); // In case the pilotpay value changes in the future
    		$totalpay = ($pilot->payrate / 60) * $totalminutes;
    		return FinanceData::formatMoney($totalpay);
    		?>
    	</td>
    </tr>

     

  2. You should be able to view this in edit pirep (admin), but I'll make a table for you to show this, do you want it per pilot or per pirep?

1. Yup, on the view pirep page.

2. I was thinking  per pilot - showing a a column for date, flight number and pay. I can add more or incorporate into other areas once I know what to call and how to call it. Would this be available for onky the associated pilot to view, as well as admins? 

Share this post


Link to post
Share on other sites

Alright, shouldn't be a problem then. I can make it that the pilot can see their pay for their flight on their view pireps page as well as an admin page for all pilots and their last pirep (as well as a link to view all other pireps as well)

Edited by web541

Share this post


Link to post
Share on other sites
39 minutes ago, web541 said:

I found out the issue here, if you look closely at your figures here for fuel cost (11,129.56), but in your database (from the txt file provided) the fuel cost is 11129.6 so it rounded it up before entry into the database, this one is probably to do with your acars client rounding it off as it doesn't go through phpvms I don't think.

After the revenue change above, the pilot pay will be adjusted, so these figures are before the change above has been implemented (I'm guessing).

Right you are! I hadn't gotten around to looking there. I'll have a go at making the changes you provided above - tomorrow. 

Again, thank you so much for your efforts and time!

Share this post


Link to post
Share on other sites
Just now, ProAvia said:

Right you are! I hadn't gotten around to looking there. I'll have a go at making the changes you provided above - tomorrow. 

Again, thank you so much for your efforts and time!

No problem, glad to help.

Share this post


Link to post
Share on other sites

Ok, I've gone ahead and made the module again (now with extra features) and it should allow you to recalculate all your PIREP's revenue (and Pilot pay if you wish) and allow you to monitor the pay of each PIREP from each pilot.

Before you do this, please, please backup your database as I've tested the script multiple times and it seems fine to me, but if it's wrong for you, it might screw up. If you've got a local version of your website handy, I suggest you try this there first before bringing it live. The upside is that it shouldn't delete any data, only update it.

Grab the module

More details here

Share this post


Link to post
Share on other sites

OK - finally have some uninterrupted time to do this. Between taking the dog to the vet and my grandson being here all day, I've had basically no time.

Yes - I will definitely backup the DB. And I will try this on my online test site first (with a separate DB from the live site) also.

If I understand correctly, I should:

  1. backup the DB,
  2. do the replacement in PIREPData.class.php starting at line 1042
  3. see what the results are
  4. submit a new PIREP
  5. see what the results are again
  6. then attempt your last
  7. see what happens

 

Edited by ProAvia

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×