Jump to content

FuelCalculator - Help


Fernando

Recommended Posts

Hello friends,

I have a problem on the result of fuel, the error code..

Take Off & Approach time:

Fatal error: Call to undefined method Util::formatduration() in /home/voeazulv/public_html/acars/core/templates/result.tpl on line 140

My line 140 is :

<td align="left"><font size="3" color="white"><b>      <?php echo Util::FormatDuration(.44) ;?> hrs</b></font></td>

My Script Line 140 is:

<td align="left"><font size="3" color="white"><b>      <?php echo Util::FormatDuration(.44) ;?> hrs</b></font></td>

My Result.tpl

<div id="contenttext">

<table border="0" width="700" cellpadding="0" cellspacing="0">

<tr>

<td dir="ltr" align="left" width="22">

<img border="0" src="http://www.alvandair.com/lib/skins/aqua/images/lu.jpg" width="22" height="22"></td>

<td dir="ltr" align="center" bgcolor="#1D238B"> </td>

<td dir="ltr" align="right" width="22">

<img border="0" src="http://www.alvandair.com/lib/skins/aqua/images/ru.jpg" width="22" height="22"></td>

</tr>

<tr>

<td dir="ltr" align="left" width="22" bgcolor="#1D238B"> </td>

<td dir="ltr" align="center" bgcolor="#1D238B">

<p align="center">

<?php

$getac = $_GET['aircraft'];

$getnm = $_GET['NM'];

$getft = $_GET['ft'];

$fuelflowE190 = 744;

$fuelhrE190 = 2136;

$rangeE190 = 1323;

$altE190 = 41000;

$fuelflowE195 = 744;

$fuelhrE195 = 2136;

$rangeE195 = 1323;

$altE195 = 41000;

$fuelflowATR = 450;

$fuelhrATR = 1100;

$rangeATR = 750;

$altATR = 18000;

if($getac == 'E-190-EJ')

{

$fuelflow = $fuelflowE190;

$fuelhr = $fuelhrE190;

$range = $rangeE190;

$alt = $altE190;

}

elseif($getac == 'E-195')

{

$fuelflow = $fuelflowE195;

$fuelhr = $fuelhrE195;

$range = $rangeE195;

$alt = $altE195;

}

elseif($getac == 'ATR 72-500')

{

$fuelflow = $fuelflowATR;

$fuelhr = $fuelhrATR;

$range = $rangeATR;

$alt = $altATR;

}

$fldis = $getnm / 100;

$fuelnm = $fuelflow * $fldis;

$fltaxi = 200;

$flndg = $fuelhr * 3/4;

$result = $fuelnm + $flndg + $fltaxi;

$time = Round ($getnm / 480,2);

?>

<table style="" id="results">

<tr>

<td align="center" colspan="2"><font color="white" size="4"><b>Fuel Calculation for <?php echo $getac ;?></b></td>

<tr>

<td align="center" colspan="2"><hr></td>

</tr>

<?php

if($getnm > $range)

{

?>

<tr>

<td align="center" colspan="2"><font color="red" size="4"><b>No Aircraft Fuel Data Available!</b></font></td>

</tr>

<?php

}

elseif($getft > $alt)

{

?>

<tr>

<td align="center" colspan="2"><font color="red" size="4"><b>Aircraft can not reach that altitude!</b></font></td>

</tr>

<?php

}

else

{

?>

<tr>

<td align="left" width="50%"><font color="white" size="2">Range you entered:</font></td>

<td align="left" ><font color="white" size="3"><b>      <?php echo $getnm ;?> nm - <?php echo Round($getnm * 1.852,0) ;?> km</b></font></td>

</tr>

<tr>

<td align="left" width="50%"><font color="white" size="2">Maximum range for this aircraft:</font></td>

<td align="left"><font color="white" size="3"><b>      <?php echo $range ;?> nm - <?php echo Round($range * 1.852,0) ;?> km</b></font></td>

</tr>

<tr>

<td align="left" width="50%"><font color="white" size="2">Fuel per Hour:</font></td>

<td align="left"><font color="white" size="3"><b>      <?php echo $fuelhr ;?> kg - <?php echo Round($fuelhr * 2.2,0) ;?> lbs</b></font></td>

</tr>

<tr>

<td align="left" width="50%"><font color="white" size="2">Fuel per 100 nm:</font></td>

<td align="left"><font color="white" size="3"><b>      <?php echo $fuelflow ;?> kg - <?php echo Round($fuelflow * 2.2,0) ;?> lbs</b></font></td>

</tr>

<tr>

<td align="left" width="50%"><font color="white" size="2">Altitude you entered:</font></td>

<td align="left"><font color="white" size="3"><b>      <?php echo $getft ;?> ft - <?php echo Round($getft * 0.3048,0) ;?> m</b></font></td>

</tr>

<tr>

<td align="left" width="50%"><font color="white" size="2">Maximum altitude for this aircraft:</font></td>

<td align="left"><font color="white" size="3"><b>      <?php echo $alt ;?> ft - <?php echo Round($alt * 0.3048,0) ;?> m</b></font></td>

</tr>

<tr>

<td align="left" width="50%"><font color="white" size="2">Estimated Ground Speed(GS) at <?php echo $getft ;?> ft:</font></td>

<td align="left"><font color="white" size="3"><b>      480 kt - <?php echo round(480 * 1.852,0) ;?> km/h</b></font></td>

</tr>

<tr>

<td align="center" colspan="2"><hr></td>

</tr>

<tr>

<td align="left" width="50%"><font color="white" size="2">Total crusing fuel:</font></td>

<td align="left"><font color="white" size="3"><b>      <?php echo Round ($fuelnm,0) ;?> kg - <?php echo Round($fuelnm * 2.2,0) ;?> lbs</b></font></td>

</tr>

<tr>

<td align="left" width="50%"><font color="white" size="2">Plus taxi fuel:</font></td>

<td align="left"><font color="white" size="3"><b>      <?php echo Round ($fltaxi,0) ;?> kg - <?php echo Round($fltaxi * 2.2,0) ;?> lbs</b></font></td>

</tr>

<tr>

<td align="left" width="50%"><font color="white" size="2">And 45 Min reserve at destination:</font></td>

<td align="left"><font color="white" size="3"><b>      <?php echo Round ($flndg,0) ;?> kg - <?php echo Round($flndg * 2.2,0) ;?> lbs</b></font></td>

</tr>

<tr>

<td align="center" colspan="2"><hr></td>

</tr>

<tr>

<td align="left" width="50%"><font color="white" size="2">Take Off & Approach time:</font></td>

<td align="left"><font size="3" color="white"><b>      <?php echo Util::FormatDuration(.44) ;?> hrs</b></font></td>

</tr>

<tr>

<td align="center" colspan="2"><hr></td>

</tr>

<tr>

<td align="left" ><font size="4" color="white"><b>Estimated Fuel Requiered:</b></font></td>

<td align="left"><font size="5" color="red"><b>   <?php echo Round ($result,0) ;?> kg - <?php echo Round($result * 2.2,0) ;?> lbs</b></font></td>

</tr>

<tr>

<td align="left" width="50%"><font size="4" color="white"><b>Estimated flight duration:</b></font></td>

<td align="left"><font size="5" color="red"><b>   <?php echo Util::FormatDuration($time + .44) ;?> hrs</b></font></td>

</tr>

<?php

}

?>

</table>

<script type="text/javascript">

function popup(){

var printwindow = window.open('Alvandair','name','height=600,width=600,location=0,statusbar=0,menubar=0,resizable=0,toolbar=0,scrollbars=0');

printwindow.document.write('<center><table width="90%" cellpadding="0" cellspacing="0" border="0">');

printwindow.document.write('<tr><td colspan="2" align="center"><font size="4"><b>Fuel Calculation for <?php echo $getac ;?></b></font></td></tr>');

printwindow.document.write('<tr><td align="center" colspan="2"><hr></td></tr>');

printwindow.document.write('<tr><td align="left"><font size="2">Range you entered:</font></td><td align="left"><font size="3"><b>      <?php echo $getnm ;?> nm - <?php echo Round($getnm * 1.852,0) ;?> km</b></font></td></tr>');

printwindow.document.write('<tr><td align="left"><font size="2">Maximum range for this aircraft:</font></td><td align="left"><font size="3"><b>      <?php echo $range ;?> nm - <?php echo Round($range * 1.852,0) ;?> km</b></font></td></tr>');

printwindow.document.write('<tr><td align="left"><font size="2">Fuel per Hour:</font></td><td align="left"><font size="3"><b>      <?php echo $fuelhr ;?> kg - <?php echo Round($fuelhr * 2.2,0) ;?> lbs</b></font></td></tr>');

printwindow.document.write('<tr><td align="left"><font size="2">Fuel per 100 nm:</font></td><td align="left"><font size="3"><b>      <?php echo $getnm ;?> nm - <?php echo Round($getnm * 1.852,0) ;?> km</b></font></td></tr>');

printwindow.document.write('<tr><td align="left"><font size="2">Altitude you entered:</font></td><td align="left"><font size="3"><b>      <?php echo $getnm ;?> nm - <?php echo Round($getnm * 1.852,0) ;?> km</b></font></td></tr>');

printwindow.document.write('<tr><td align="left"><font size="2">Maximum altitude for this aircraft:</font></td><td align="left"><font size="3"><b>      <?php echo $alt ;?> ft - <?php echo Round($alt * 0.3048,0) ;?> m</b></font></td></tr>');

printwindow.document.write('<tr><td align="left"><font size="2">Estimated Ground Speed(GS) at <?php echo $getft ;?> ft:</font></td><td align="left"><font size="3"><b>      480 kt - <?php echo round(480 * 1.852,0) ;?> km/h</b></font></td></tr>');

printwindow.document.write('<tr><td align="center" colspan="2"><hr></td></tr>');

printwindow.document.write('<tr><td align="left"><font size="2">Total crusing fuel:</font></td><td align="left"><font size="3"><b>      <?php echo Round ($fuelnm,0) ;?> kg - <?php echo Round($fuelnm * 2.2,0) ;?> lbs</b></font></td></tr>');

printwindow.document.write('<tr><td align="left"><font size="2">Plus taxi fuel:</font></td><td align="left"><font size="3"><b>      <?php echo Round ($fltaxi,0) ;?> kg - <?php echo Round($fltaxi * 2.2,0) ;?> lbs</b></font></td></tr>');

printwindow.document.write('<tr><td align="left"><font size="2">And 45 Min reserve at destination:</font></td><td align="left"><font size="3"><b>      <?php echo Round ($flndg,0) ;?> kg - <?php echo Round($flndg * 2.2,0) ;?> lbs</b></font></td></tr>');

printwindow.document.write('<tr><td align="center" colspan="2"><hr></td></tr>');

printwindow.document.write('<tr><td align="left"><font size="2">Estimated enroute time:</font></td><td align="left"><font size="3"><b>      <?php echo Util::FormatDuration($time) ;?> hrs</b></font></td></tr>');

printwindow.document.write('<tr><td align="left"><font size="2">Take Off & Approach time:</font></td><td align="left"><font size="3"><b>      <?php echo Util::FormatDuration(.44) ;?> hrs</b></font></td></tr>');

printwindow.document.write('<td align="center" colspan="2"><hr></td>');

printwindow.document.write('<tr><td align="left"><font size="4">Estimated Fuel Requiered:</font></td><td align="left"><font size="4"><b>    <?php echo Round ($result,0) ;?> kg - <?php echo Round($result * 2.2,0) ;?> lbs</b></font></td></tr>');

printwindow.document.write('<tr><td align="left"><font size="4">Estimated Flight Duration:</font></td><td align="left"><font size="4"><b>    <?php echo Util::FormatDuration($time + .44) ;?> hrs</b></font></td></tr>');

printwindow.document.write('</tr></table></center>');

printwindow.document.close();

printwindow.print();

}

</script>

<a href="#" onclick="popup()"><img src="http://alvandair.com/lib/skins/aqua/images/Printer.png" border="0"></a>

</td>

<td dir="ltr" align="right" width="22" bgcolor="#1D238B"> </td>

</tr>

<tr>

<td dir="ltr" align="left" width="22">

<img border="0" src="http://www.alvandair.com/lib/skins/aqua/images/lb.jpg" width="22" height="22"></td>

<td dir="ltr" align="center" bgcolor="#1D238B"> </td>

<td dir="ltr" align="right" width="22">

<img border="0" src="http://www.alvandair.com/lib/skins/aqua/images/rb.jpg" width="22" height="22"></td>

</tr>

</table>

</div>

Please help-me.

Thank you.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...