Jump to content

Recommended Posts

Posted

Hey, one more thing that other VA's might find handy as well. We'll be inputting cargo operations soon, is there a code available to pull total cargo carried out of and into that HUB?

Posted

Would this be it? I highly doubt it, but it's worth a shot?

public static function TotalCargoBetweenDates($icao, $startdate, $enddate) { //Count total cargo
$query = "SELECT SUM(cargo) as hours FROM phpvms_pireps WHERE depicao = '$icao' OR arricao = '$icao' AND DATE(submitdate) >= '$startdate' AND DATE(submitdate) <= '$enddate'";
$result = DB::get_row($query);
return $result->cargo;
}

Posted

Would this be it? I highly doubt it, but it's worth a shot?

public static function TotalCargoBetweenDates($icao, $startdate, $enddate) { //Count total cargo
$query = "SELECT SUM(cargo) as hours FROM phpvms_pireps WHERE depicao = '$icao' OR arricao = '$icao' AND DATE(submitdate) >= '$startdate' AND DATE(submitdate) <= '$enddate'";
$result = DB::get_row($query);
return $result->cargo;
}

I believe the 'load' column is used for both pax and cargo, so you'll need to use the 'flightType' to differentiate between them.

Posted
public static function TotalCargoBetweenDates($icao, $startdate, $enddate) { //Count total cargo
$query = "SELECT SUM(cargo) as cargo FROM phpvms_pireps WHERE depicao = '$icao' OR arricao = '$icao' AND flighttype = 'C' AND DATE(submitdate) >= '$startdate' AND DATE(submitdate) <= '$enddate'";
$result = DB::get_row($query);
return $result->cargo;
}

Posted

I hate to ask for more, but is there a way to get the data from only ACCEPTED PIREPs and have it ignore the data from rejected PIREPs? right now we have completely delete the rejected pireps for the data to stay correct.

Posted

I hate to ask for more, but is there a way to get the data from only ACCEPTED PIREPs and have it ignore the data from rejected PIREPs? right now we have completely delete the rejected pireps for the data to stay correct.

public static function TotalCargoBetweenDates($icao, $startdate, $enddate) { //Count total cargo
$query = "SELECT SUM(cargo) as cargo FROM phpvms_pireps WHERE depicao = '$icao' OR arricao = '$icao' AND flighttype = 'C' AND DATE(submitdate) >= '$startdate' AND DATE(submitdate) <= '$enddate' AND accepted = '1'";
$result = DB::get_row($query);
return $result->cargo;
}

  • 2 weeks later...
Posted

Ok, it appears that it's not calculating correctly at all by month. It just reduced the numbers but I can't tell exactly what it's calculating. At the start of February UTC time it should have reset to 0 for all, but did not. Any ideas?

Posted

Ok, it appears that it's not calculating correctly at all by month. It just reduced the numbers but I can't tell exactly what it's calculating. At the start of February UTC time it should have reset to 0 for all, but did not. Any ideas?

What's your code?

Posted

Ok, it appears that it's not calculating correctly at all by month. It just reduced the numbers but I can't tell exactly what it's calculating. At the start of February UTC time it should have reset to 0 for all, but did not. Any ideas?

Try clearing your cache.

  • 2 weeks later...
  • 2 weeks later...
Posted

AM I missing something? I have

public static function TotalHoursBetweenDates($icao, $startdate, $enddate) { //Count total hours
$query = "SELECT SUM(flighttime) as hours FROM phpvms_pireps WHERE depicao = '$icao' OR arricao = '$icao' AND DATE(submitdate) >= '$startdate' AND DATE(submitdate) <= '$enddate'";
$result = DB::get_row($query);
return $result->hours;
}

in my HubStats.class

and this on my frontpage_main.php

<?php echo HubStats::TotalHoursBetweenDates('PANC', date("Y-m-01"), date("Y-m-t"));?>

Still getting a blank return.

crew.png

Any help would be appreciated!

Posted

Only thing I can suggest is that you don't have phpvms_ as your table prefix. Other than that, you could always do

$startdate = date("Y-m-01");
$enddate = date("Y-m-t");
HubStats::TotalHoursBetweenDates('PANC', date("Y-m-01"), date("Y-m-t"));

Shouldn't make a difference but give it shot.

EDIT: You might have to set your timezone:

date_default_timezone_set('Europe/London');

Change as necessary of course.

  • 3 weeks later...
  • 2 weeks later...
Posted

Hello,

i have a problem ...

if i try in local (127.0.0.1) <?php echo HubStats::CountFlightsTo('LIRA'); ?> work great

On line don't work

All the others stats works, only CountFlightsTo not work online

Do yuo have a solution please?

Thanks

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...