Automatic Fuel Calculation

Thanks tebinu - works nicely.

For anyone adding new aircraft types, you can check your fuel flow and reserve entries at this website.

Having problem, did everything but keep getting this error most prob did something wrong but cant see anything

it says the file isn’t there but in the image below it is

also is this setup right?

any ideas to what i done wrong?

Hi, try to move the sentence into this lines

<td width=“50%” >

<?php include (‘fuel.tpl’); ?>

</td>

<td width=“50%” >

<?php

if($schedule->flighttype==‘P’)

Also have in mind every time when you upgrade the version (Example ver 930 to 931) the file schedule_briefing.tpl will be replaced for a new one, in my case i have the file in the skin folder located on lib folder.

That is working for me.

Regards

You should do Template::Show(‘fuel.tpl’), not include(). include() will use the wrong path

Nope neither work when i put this

<td width=“50%” >

<?php include (‘fuel.tpl’); ?>

</td>

<td width=“50%” >

<?php

if($schedule->flighttype==‘P’)

a error comes cant remember what it said but it stops you getting on the schedule briefing and the Template::Show(‘fuel.tpl’) just comes up as

Template::Show(‘fuel.tpl’) in the required fuel bit.

Nope neither work when i put this

<td width=“50%” >

<?php include (‘fuel.tpl’); ?>

</td>

<td width=“50%” >

<?php

if($schedule->flighttype==‘P’)

a error comes cant remember what it said but it stops you getting on the schedule briefing and the Template::Show(‘fuel.tpl’) just comes up as

Template::Show(‘fuel.tpl’) in the required fuel bit.

please post the error so i can try to figure out whats the problem

please post the error so i can try to figure out whats the problem

[/url]

looks like there is a > too much somewhere

Just added this mod! AWESOME! Great Job!!

Tebinu, I tried to do here, but I could not, would you post the code that shows the type of flight for us (passenger flight / charter flgiht / cargo flight)?

Thxn…

Here is what I used for the passenger flight reference:

<tr style=“background-color: #333; color: #FFF;”>

<td>Required Fuel</td>

<td>Type of Flight</td>

</tr>

<tr>

<td width=“50%” >

<?php Template::Show(‘fuel.tpl’); ?>

</td>

<td width=“50%” ><?php if($schedule->flighttype==‘P’)

{

echo ‘Passenger <b>(P)</b>’;

}

?>

</td>

I assume you could just add “elseif” statements for Charter or Cargo, or whatever.

By that I meant:

<td width=“50%” ><?php if($schedule->flighttype==‘P’)

{

echo ‘Passenger <b>(P)</b>’;

} elseif($schedule->flighttype==‘C’)

{

echo ‘Cargo <b>( C )</b>’;

}

?>

Here is what I used for the passenger flight reference:

<tr style=“background-color: #333; color: #FFF;”>

<td>Required Fuel</td>

<td>Type of Flight</td>

</tr>

<tr>

<td width=“50%” >

<?php Template::Show(‘fuel.tpl’); ?>

</td>

<td width=“50%” ><?php if($schedule->flighttype==‘P’)

{

echo ‘Passenger <b>(P)</b>’;

}

?>

</td>

I assume you could just add “elseif” statements for Charter or Cargo, or whatever.

Thank you for posting that, i finally got it too work!!!

well nice mod but i can’t make it to work ;(

Parse error: syntax error, unexpected ‘=’ in /home/greeceai/public_html/fss/core/templates/fuel.tpl on line 6

<?php
               /**
	*Fuelflow Table
	*/

       $fuelflowB737-400 = 2800 ;
       $fuelflowB737-700 = 2900 ;
       $fuelflowB737-600 = 2600 ;
       $fuelflowATR 72-500 = 0760 ;
       $fuelflowE145 = 0810 ;

       /**
	*Reserves Table
	*/

       $reservesB737-400 = 3000;
       $reservesB737-700 = 3000;
       $reservesB737-600 = 3000;
       $reservesATR 72-500 = 2500;
       $reservesE145 = 1800;

       if($schedule->aircraft == 'B737-700')
       {
           $fuelflow = $fuelflowB737;
           $reserves = $reservesB737;

       }
        elseif($schedule->aircraft == 'B737-400')
        {
        	$fuelflow = $fuelflowB734;
           $reserves = $reservesB734;

        }
        elseif($schedule->aircraft == 'B737-600')
        {
        	$fuelflow = $fuelflowB736;
           $reserves = $reservesB736;

        }
        elseif($schedule->aircraft == 'ATR 72-500')
        {
        	$fuelflow = $fuelflowATR ;
           $reserves = $reservesATR ;

        }
        elseif($schedule->aircraft == 'E145')
        {
        	$fuelflow = $fuelflowE145;
           $reserves = $reservesE145;

        }

       $fltime = explode(".", $schedule->flighttime);
	$flmin = $fltime[1] / 60;
       $flhou = $fltime[0];
       $fuelhours = $fuelflow * $flhou;
       $fuelminutes1 = $fuelflow * $flmin;
       $fuelminutes = $fuelminutes1 * 1;
       $result = $fuelhours + $fuelminutes;
       $mrreserves = 600;
       $lrreserves = 1500;
       $mr = $mrreserves + $reserves;
       $lr = $lrreserves + $reserves;
       $mlf = $fuelflow * 0.45;

           if($fuelflow == '0')
           	{
               	echo 'no fuel data available (no a/c fuelflow data)';
               }
          	elseif($schedule->flighttime == '0')
               {
                       echo '<b>'.'no aircraft performance data available <br />(missing flight duration)'.'</b>';
               }
   	    elseif($schedule->flighttime >='0.00001')
           			{
                       if($result == '0')
                       {
         	              echo '<b>'.'no aircraft performance data available'.'</b>';
                       }
                       else
               		{

                         if($schedule->distance <= '501')
                           {
                           	$result1 = $result + $reserves + $mlf;
                               echo '<b>Total: </b>';
                               echo round ($result1,-2);
                               echo ' kg';
                               echo ' - ';
                               echo '<b>'.round ($result1 * 2.2,-1).'</b>';
                               echo ' lbs';
                               echo '<br>';
                               echo '<hr>';
                               echo 'Trip: ';
                               echo round ($result,-2);
                               echo ' kg';
                               echo ' - ';
                               echo '<b>'.round ($result * 2.2,-1).'</b>';
                               echo ' lbs';
                               echo '<br>';
                               echo 'Taxi + Reserves: ';
                               echo $reserves;
                               echo ' kg';
                               echo ' - ';
                               echo '<b>'.round ($reserves * 2.2,-1).'</b>';
                               echo ' lbs';
                               echo '<br>';
                               echo 'Minimum Landing: ';
                               echo $mlf;
                               echo ' kg';
                               echo ' - ';
                               echo '<b>'.round ($mlf * 2.2,-1).'</b>';
                               echo ' lbs';
                               echo '<br>';
                               echo '<hr>';
                               echo '<font color="#FF0000">Caution</font>: Please doublecheck calculation before use !';                                  
                           }
                       		elseif($schedule->distance <= '1601')
                           {
                               $result3 = $result + $mrreserves + $reserves + $mlf;
                               echo '<b>Total: </b>';
                               echo round ($result3,-1);
                               echo ' kg';
                               echo ' - ';
                               echo '<b>'.round ($result3 * 2.2,-1).'</b>';
                               echo ' lbs';
                               echo '<br>';
                               echo '<hr>';
                               echo 'Trip: ';
                               echo round ($result,-1);
                               echo ' kg';
                               echo ' - ';
                               echo '<b>'.round ($result * 2.2,-1).'</b>';
                               echo ' lbs';
                               echo '<br>';
                               echo 'Taxi + Reserves: ';
                               echo $mr;
                               echo ' kg';
                               echo ' - ';
                               echo '<b>'.round ($mr * 2.2,-1).'</b>';
                               echo ' lbs';
                               echo '<br>';
                               echo 'Minimum Landing: ';
                               echo $mlf;
                               echo ' kg';
                               echo ' - ';
                               echo '<b>'.$mlf * 2.2.'</b>';
                               echo ' lbs';
                               echo '<br>';
                               echo '<hr>';
                               echo '<font color="#FF0000">Caution</font>: Please doublecheck calculation before use !';     

                           }
                       		elseif($schedule->distance >= '1602')
                           {
                               $result4 = $result + $lrreserves + $reserves + $mlf;
                               echo '<b>Total: </b>';
                               echo round ($result4,-1);
                               echo ' kg';
                               echo ' - ';
                               echo '<b>'.round ($result4 * 2.2,-1).'</b>';
                               echo ' lbs';
                               echo '<br>';
                               echo '<hr>';
                               echo 'Trip: ';
                               echo round ($result,-1);
                               echo ' kg';
                               echo ' - ';
                               echo '<b>'.round ($result * 2.2,-1).'</b>';
                               echo ' lbs';
                               echo '<br>';
                               echo 'Taxi + Reserves: ';
                               echo $lr;
                               echo ' kg';
                               echo ' - ';
                               echo '<b>'.round ($lr * 2.2,-1).'</b>';
                               echo ' lbs';
                               echo '<br>';
                               echo 'Minimum Landing: ';
                               echo $mlf;
                               echo ' kg';
                               echo ' - ';
                               echo '<b>'.round ($mlf * 2.2,-1).'</b>';
                               echo ' lbs';
                               echo '<br>';
                               echo '<hr>';
                               echo '<font color="#FF0000">Caution</font>: Please doublecheck calculation before use !'; 
                           }
               		}
               	}

       	        else
                   {
                       echo 'fail';
                   }

		?>

ok i make it working with out errors (it was an extra “=”) but now in the required fuel i m getting: “no aircraft performance data available”

i see at least one mistake

$reservesATR 72-500 = 2500;

you cannot write variables with spaces in it. also i would recommend you to avoid using “-” in variables if possible

“no aircraft performance data available” only comes when the script cannot recognize your aircraft or there is no aircraft in the file which has the same code

i see at least one mistake

$reservesATR 72-500 = 2500;

you cannot write variables with spaces in it. also i would recommend you to avoid using “-” in variables if possible

Copy already corrected (also in admin center to avoid conflick)

“no aircraft performance data available” only comes when the script cannot recognize your aircraft or there is no aircraft in the file which has the same code

yes but my flight have an aircraft… here my new fuel.tpl:

<?php
               /**
	*Fuelflow Table
	*/

       $fuelflowB737400 = 2800 ;
       $fuelflowB737700 = 2900 ;
       $fuelflowB737600 = 2600 ;
       $fuelflowATR72500 = 0760 ;
       $fuelflowE145 = 0810 ;

       /**
	*Reserves Table
	*/

       $reservesB737400 = 3000;
       $reservesB737700 = 3000;
       $reservesB737600 = 3000;
       $reservesATR72500 = 2500;
       $reservesE145 = 1800;

       if($schedule->aircraft == 'B737700')
       {
           $fuelflow = $fuelflowB737;
           $reserves = $reservesB737;

       }
        else if($schedule->aircraft == 'B737400')
        {
        	$fuelflow = $fuelflowB734;
           $reserves = $reservesB734;

        }
        else if($schedule->aircraft == 'B737600')
        {
        	$fuelflow = $fuelflowB736;
           $reserves = $reservesB736;

        }
        else if($schedule->aircraft == 'ATR72500')
        {
        	$fuelflow = $fuelflowATR ;
           $reserves = $reservesATR ;

        }
        else if($schedule->aircraft == 'E145')
        {
        	$fuelflow = $fuelflowE145;
           $reserves = $reservesE145;

        }

       $fltime = explode(".", $schedule->flighttime);
	$flmin = $fltime[1] / 60;
       $flhou = $fltime[0];
       $fuelhours = $fuelflow * $flhou;
       $fuelminutes1 = $fuelflow * $flmin;
       $fuelminutes = $fuelminutes1 * 1;
       $result = $fuelhours + $fuelminutes;
       $mrreserves = 600;
       $lrreserves = 1500;
       $mr = $mrreserves + $reserves;
       $lr = $lrreserves + $reserves;
       $mlf = $fuelflow * 0.45;

           if($fuelflow == '0')
           	{
               	echo 'no fuel data available (no a/c fuelflow data)';
               }
          	else if($schedule->flighttime == '0')
               {
                       echo '<b>'.'no aircraft performance data available <br />(missing flight duration)'.'</b>';
               }
   	    else if($schedule->flighttime >='0.00001')
           			{
                       if($result == '0')
                       {
         	              echo '<b>'.'no aircraft performance data available'.'</b>';
                       }
                       else
               		{

                         if($schedule->distance <= '501')
                           {
                           	$result1 = $result + $reserves + $mlf;
                               echo '<b>Total: </b>';
                               echo round ($result1,-2);
                               echo ' kg';
                               echo ' - ';
                               echo '<b>'.round ($result1 * 2.2,-1).'</b>';
                               echo ' lbs';
                               echo '<br>';
                               echo '<hr>';
                               echo 'Trip: ';
                               echo round ($result,-2);
                               echo ' kg';
                               echo ' - ';
                               echo '<b>'.round ($result * 2.2,-1).'</b>';
                               echo ' lbs';
                               echo '<br>';
                               echo 'Taxi + Reserves: ';
                               echo $reserves;
                               echo ' kg';
                               echo ' - ';
                               echo '<b>'.round ($reserves * 2.2,-1).'</b>';
                               echo ' lbs';
                               echo '<br>';
                               echo 'Minimum Landing: ';
                               echo $mlf;
                               echo ' kg';
                               echo ' - ';
                               echo '<b>'.round ($mlf * 2.2,-1).'</b>';
                               echo ' lbs';
                               echo '<br>';
                               echo '<hr>';
                               echo '<font color="#FF0000">Caution</font>: Please doublecheck calculation before use !';                                  
                           }
                       		else if($schedule->distance <= '1601')
                           {
                               $result3 = $result + $mrreserves + $reserves + $mlf;
                               echo '<b>Total: </b>';
                               echo round ($result3,-1);
                               echo ' kg';
                               echo ' - ';
                               echo '<b>'.round ($result3 * 2.2,-1).'</b>';
                               echo ' lbs';
                               echo '<br>';
                               echo '<hr>';
                               echo 'Trip: ';
                               echo round ($result,-1);
                               echo ' kg';
                               echo ' - ';
                               echo '<b>'.round ($result * 2.2,-1).'</b>';
                               echo ' lbs';
                               echo '<br>';
                               echo 'Taxi + Reserves: ';
                               echo $mr;
                               echo ' kg';
                               echo ' - ';
                               echo '<b>'.round ($mr * 2.2,-1).'</b>';
                               echo ' lbs';
                               echo '<br>';
                               echo 'Minimum Landing: ';
                               echo $mlf;
                               echo ' kg';
                               echo ' - ';
                               echo '<b>'.$mlf * 2.2.'</b>';
                               echo ' lbs';
                               echo '<br>';
                               echo '<hr>';
                               echo '<font color="#FF0000">Caution</font>: Please doublecheck calculation before use !';     

                           }
                       		else if($schedule->distance >= '1602')
                           {
                               $result4 = $result + $lrreserves + $reserves + $mlf;
                               echo '<b>Total: </b>';
                               echo round ($result4,-1);
                               echo ' kg';
                               echo ' - ';
                               echo '<b>'.round ($result4 * 2.2,-1).'</b>';
                               echo ' lbs';
                               echo '<br>';
                               echo '<hr>';
                               echo 'Trip: ';
                               echo round ($result,-1);
                               echo ' kg';
                               echo ' - ';
                               echo '<b>'.round ($result * 2.2,-1).'</b>';
                               echo ' lbs';
                               echo '<br>';
                               echo 'Taxi + Reserves: ';
                               echo $lr;
                               echo ' kg';
                               echo ' - ';
                               echo '<b>'.round ($lr * 2.2,-1).'</b>';
                               echo ' lbs';
                               echo '<br>';
                               echo 'Minimum Landing: ';
                               echo $mlf;
                               echo ' kg';
                               echo ' - ';
                               echo '<b>'.round ($mlf * 2.2,-1).'</b>';
                               echo ' lbs';
                               echo '<br>';
                               echo '<hr>';
                               echo '<font color="#FF0000">Caution</font>: Please doublecheck calculation before use !'; 
                           }
               		}
               	}

       	        else
                   {
                       echo 'fail';
                   }

		?>

if($schedule->aircraft == ‘B737700’)

{

$fuelflow = $fuelflowB737; <-

$reserves = $reservesB737; <- those both variables have to be changed as well for example this one would be $reservesB737700

}

also do not add leading zero´s like you have here:

$fuelflowATR72500 = 0760 ;

$fuelflowE145 = 0810 ;

if($schedule->aircraft == ‘B737700’)

{

$fuelflow = $fuelflowB737; <-

$reserves = $reservesB737; <- those both variables have to be changed as well for example this one would be $reservesB737700

}

also do not add leading zero´s like you have here:

$fuelflowATR72500 = 0760 ;

$fuelflowE145 = 0810 ;

Thank you so much!!! Working Fine! realy good add on!

Regards Dimitris

p.s. keep up the good work

I am getting the “no aircraft performance data available” on mine. But it works 100% for the main airline. The other 2 airlines under the same site have different codes and scedules etc., but they get the error. Everything pulls from the same sql database, so not sure why this happens, or how to fix it?!