Jump to content

Pilot Financial Report V1.0


Parkho

Recommended Posts

  • Moderators

Here is another small add-on for those who want to show pilot's financial reports. It's based on pilot id, so the results are for each of you pilots.Cheers ;)

Install

1. Download the zip from repo.

2. Unzip and upload in the order of folders.

3. Access financial report for a pilot by

<?php echo url('/pfinance') ;?>

-----------------OR----------------------

Access financial report for all pilots by

<?php echo url('/pfinance/pilots') ;?>

4. Enjoy.

Download:PilotFinancialReport_V1.0

Screenshot for a pilot report:

PF1.png

Screenshot for all pilots report:

PF2.png

Change Log:

1. PilotFinance.class.php & pilots_finance.tpl have been added. Those of you who have downloaded this before should re-download.

  • Like 2
Link to comment
Share on other sites

hi parkho

i have this error:

Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /var/www/virtual/italianivolanti.it/htdocs/iv/core/templates/pilot_finance.tpl on line 12

€ 0.00


  • Your total flight fuel expenses in Italiani Volanti is:
    Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /var/www/virtual/italianivolanti.it/htdocs/iv/core/templates/pilot_finance.tpl on line 18
    € 0.00
  • Your total in flight expenses in Italiani Volanti is:
    Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /var/www/virtual/italianivolanti.it/htdocs/iv/core/templates/pilot_finance.tpl on line 24
    € 0.00
  • Your total flight revenue in Italiani Volanti is:
    Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /var/www/virtual/italianivolanti.it/htdocs/iv/core/templates/pilot_finance.tpl on line 31

Link to comment
Share on other sites

  • Moderators

hi parkho

i have this error:

Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /var/www/virtual/italianivolanti.it/htdocs/iv/core/templates/pilot_finance.tpl on line 12

€ 0.00


  • Your total flight fuel expenses in Italiani Volanti is:
    Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /var/www/virtual/italianivolanti.it/htdocs/iv/core/templates/pilot_finance.tpl on line 18
    € 0.00
  • Your total in flight expenses in Italiani Volanti is:
    Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /var/www/virtual/italianivolanti.it/htdocs/iv/core/templates/pilot_finance.tpl on line 24
    € 0.00
  • Your total flight revenue in Italiani Volanti is:
    Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /var/www/virtual/italianivolanti.it/htdocs/iv/core/templates/pilot_finance.tpl on line 31

Are you using any shared server for your site? Cause I think that's where the problem lies not sure though. It's working just fine on this side. ;)

Link to comment
Share on other sites

Guest lorathon

Just glancing through this.

The queries should be using the TABLE_PREFIX variable that is part of phpVMS. Then all of the MySQL DB errors regarding not finding tables would disappear. Also the queries should be using the API of phpVMS not mysql_fetch_assoc()

IMHO

Data should be returned not echoed - allows you to use it in different ways not just displaying it.

Plus the Auth::$pilotid should be in the module not the class. This allows you to use the same function to get data on another pilot. They way it is written it will ONLY return data on the pilot displaying the page.

I personally would format the data on the template not inside of the class. (FinanceData::FormatMoney)

One other item to note. The query will sum the totals of all pireps. Including rejected ones. I would include a filter in the where for only the accepted pireps.

Example

public function fuelsum($pilotid) {
$qry = 'SELECT SUM(fuelprice) AS total FROM '.TABLE_PREFIX.'pireps WHERE pilotid='.$pilotid.' AND accepted=1';
$row = DB::get_row($sql);
return $row->total;
}

Link to comment
Share on other sites

  • 1 month later...

How would I show ALL reports for ALL pilots with this code edited for that??

<?php
$pilotid = Auth::$userinfo->pilotid;
$reps = PIREPData::getLastReports($pilotid, 5);
?>

<table class="balancesheet" width="50%">
<tr class="balancesheet_header">
<td colspan="5">Last 5 Flights</td>
</tr>
<tr>
<td align="center"><strong>Flight #</strong></td>
<td align="center"><strong>Duration</strong></td>
<td align="center"><strong>Pilot Pay</strong></td>
<td align="center"><strong>Revenue</strong></td>
<td align="center"><strong>Status</strong></td>
</tr>
<?php
if(!$reps)
{
?>
<tr><td align="center" colspan="4">No Flights</td></tr>
<?php
}
else
{
$i = 1;
foreach($reps as $rep)
{

?>

Link to comment
Share on other sites

I would love to see CPC900's suggestion also.

Is there a way to show every pilots stats along with their earnings? When you click "Pilots" it only shows how many flights and how many hours...it would be great to beable to categorize the list by people with the most hours. I would also like that page to show pilot finances. Look at my page for an example: http://www.msflights.net/pilots/phpvms/index.php/pilots

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...