Taran Posted January 4, 2014 Report Share Posted January 4, 2014 IT WORKS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Thank you all! Quote Link to comment Share on other sites More sharing options...
Taran Posted January 8, 2014 Report Share 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 Link to comment Share on other sites More sharing options...
Taran Posted January 9, 2014 Report Share Posted January 9, 2014 anyone? Quote Link to comment Share on other sites More sharing options...
Taran Posted January 10, 2014 Report Share 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 Link to comment Share on other sites More sharing options...
Tom Posted January 10, 2014 Author Report Share 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 Link to comment Share on other sites More sharing options...
Taran Posted January 10, 2014 Report Share Posted January 10, 2014 Ok, so what would the official code be for that? Quote Link to comment Share on other sites More sharing options...
freshJet Posted January 11, 2014 Report Share 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 Link to comment Share on other sites More sharing options...
Taran Posted January 11, 2014 Report Share Posted January 11, 2014 Thanks! Quote Link to comment Share on other sites More sharing options...
Taran Posted January 19, 2014 Report Share 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 Link to comment Share on other sites More sharing options...
Strider Posted January 19, 2014 Report Share Posted January 19, 2014 In the where clause put in accepted = 1 Quote Link to comment Share on other sites More sharing options...
freshJet Posted January 19, 2014 Report Share 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 Link to comment Share on other sites More sharing options...
Taran Posted January 19, 2014 Report Share Posted January 19, 2014 thanks itrobb, Quote Link to comment Share on other sites More sharing options...
Taran Posted January 19, 2014 Report Share Posted January 19, 2014 how about an example that's not by month? Quote Link to comment Share on other sites More sharing options...
Taran Posted February 1, 2014 Report Share 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 Link to comment Share on other sites More sharing options...
Tom Posted February 1, 2014 Author Report Share 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 Link to comment Share on other sites More sharing options...
freshJet Posted February 1, 2014 Report Share 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 Link to comment Share on other sites More sharing options...
Taran Posted February 1, 2014 Report Share 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 Link to comment Share on other sites More sharing options...
Taran Posted February 7, 2014 Report Share Posted February 7, 2014 anyone? Quote Link to comment Share on other sites More sharing options...
freshJet Posted February 7, 2014 Report Share Posted February 7, 2014 What start and end dates are you passing in? Quote Link to comment Share on other sites More sharing options...
Taran Posted February 8, 2014 Report Share Posted February 8, 2014 <?php echo HubStats::TotalHoursBetweenDates('KSEA', date("Y-m-01"), date("Y-m-t"));?> Quote Link to comment Share on other sites More sharing options...
Taran Posted February 22, 2014 Report Share Posted February 22, 2014 still nothing on this issue? Quote Link to comment Share on other sites More sharing options...
flyalaska Posted March 2, 2014 Report Share 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 Link to comment Share on other sites More sharing options...
freshJet Posted March 2, 2014 Report Share 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 Link to comment Share on other sites More sharing options...
flyalaska Posted March 18, 2014 Report Share Posted March 18, 2014 I use phpvms_ as my prefix. I am using phpVMS Extended from SImpilot. Would that make a difference? Quote Link to comment Share on other sites More sharing options...
freshJet Posted March 18, 2014 Report Share Posted March 18, 2014 I don't know, I have no experience in using it. It may well do. Quote Link to comment Share on other sites More sharing options...
Strider Posted March 19, 2014 Report Share 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 Link to comment Share on other sites More sharing options...
Tato123 Posted March 28, 2014 Report Share 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 Link to comment Share on other sites More sharing options...
Moderators servetas Posted March 28, 2014 Moderators Report Share Posted March 28, 2014 Is the CountFlightsTo function included on the online version of HubStats module? Quote Link to comment Share on other sites More sharing options...
Tato123 Posted March 28, 2014 Report Share Posted March 28, 2014 Yes i have update also that file Quote Link to comment Share on other sites More sharing options...
Moderators servetas Posted March 28, 2014 Moderators Report Share Posted March 28, 2014 Can you attach this here in order to check its functions? Quote Link to comment Share on other sites More sharing options...
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.