Taran Posted January 4, 2014 Report Posted January 4, 2014 IT WORKS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Thank you all! Quote
Taran Posted January 8, 2014 Report Posted January 8, 2014 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? Quote
Taran Posted January 10, 2014 Report Posted January 10, 2014 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; } Quote
Tom Posted January 10, 2014 Author Report Posted January 10, 2014 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. Quote
Taran Posted January 10, 2014 Report Posted January 10, 2014 Ok, so what would the official code be for that? Quote
freshJet Posted January 11, 2014 Report Posted January 11, 2014 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; } Quote
Taran Posted January 19, 2014 Report Posted January 19, 2014 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. Quote
Strider Posted January 19, 2014 Report Posted January 19, 2014 In the where clause put in accepted = 1 Quote
freshJet Posted January 19, 2014 Report Posted January 19, 2014 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; } Quote
Taran Posted January 19, 2014 Report Posted January 19, 2014 how about an example that's not by month? Quote
Taran Posted February 1, 2014 Report Posted February 1, 2014 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? Quote
Tom Posted February 1, 2014 Author Report Posted February 1, 2014 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? Quote
freshJet Posted February 1, 2014 Report Posted February 1, 2014 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. Quote
Taran Posted February 1, 2014 Report Posted February 1, 2014 My code is what we posted earlier in the thread exactly. and clearing my cache didn't do it either Quote
freshJet Posted February 7, 2014 Report Posted February 7, 2014 What start and end dates are you passing in? Quote
Taran Posted February 8, 2014 Report Posted February 8, 2014 <?php echo HubStats::TotalHoursBetweenDates('KSEA', date("Y-m-01"), date("Y-m-t"));?> Quote
flyalaska Posted March 2, 2014 Report Posted March 2, 2014 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. Any help would be appreciated! Quote
freshJet Posted March 2, 2014 Report Posted March 2, 2014 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. Quote
flyalaska Posted March 18, 2014 Report Posted March 18, 2014 I use phpvms_ as my prefix. I am using phpVMS Extended from SImpilot. Would that make a difference? Quote
freshJet Posted March 18, 2014 Report Posted March 18, 2014 I don't know, I have no experience in using it. It may well do. Quote
Strider Posted March 19, 2014 Report Posted March 19, 2014 have a look in the error_log and see if any error shows up there. It may tell you why you are getting a blank. Quote
Tato123 Posted March 28, 2014 Report Posted March 28, 2014 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 Quote
Moderators servetas Posted March 28, 2014 Moderators Report Posted March 28, 2014 Is the CountFlightsTo function included on the online version of HubStats module? Quote
Moderators servetas Posted March 28, 2014 Moderators Report Posted March 28, 2014 Can you attach this here in order to check its functions? Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.