faraz
January 8, 2010, 10:29pm
1
HI
I want Add Total Hours This Month and Total Flight This Month in profile_main ( Pilot Center) !
I added some code in StatsData , but doesn’t work!!
I have problem with date filter …
Finlay I used this code directly in profile_main
$dateFilter = date("Y-m-d", mktime(0,0,0,date("m"),date("d")-30,date("Y")));
$toDay = date("Y-m-d");
$datecondition = "where FlightDate BETWEEN '".$dateFilter."' AND '".$toDay."'";
nabeel
January 9, 2010, 4:46pm
2
For total hours in a month, you can do:
$hours = PIREPData::getIntervalDataByMonth(array(), 1);
echo $hours->total;
For total flights:
$flights = PIREPData::findFlights(array('DATE_SUB(CURDATE(), INTERVAL 1 MONTH) <= p.submitdate'));
$total = count($flights);
1 Like
faraz
March 18, 2010, 4:23pm
3
Thank you Nabeel .
Those codes doesn’t work for me .
nabeel
March 20, 2010, 3:12pm
5
What happens? Need some more info
faraz
March 20, 2010, 4:03pm
6
$flights = PIREPData::findFlights(array('DATE_SUB(CURDATE(), INTERVAL 1 MONTH) <= p.submitdate'));
$total = count($flights);
changed to
$flights = PIREPData::findPIREPS(array('DATE_SUB(CURDATE(), INTERVAL 1 MONTH) <= p.submitdate'));
$total = count($flights);
and
<?php
$hours = PIREPData::getIntervalDataByMonth(array(), 1);
echo $hours->total;
?>
I added those code in Pilot center , but doesn’t work . and no value show in pilot center .
nabeel
March 20, 2010, 6:17pm
7
If you add a DB::debug() after them, like:
DB::debug();
What does that show?
1 Like
faraz
March 20, 2010, 9:21pm
8
HI
<?php
$flights = PIREPData::findPIREPS(array('DATE_SUB(CURDATE(), INTERVAL 1 MONTH) <= p.submitdate'));
$total = count($flights);
echo $total;
?>
that code for Flight This Month work , now show all pireps, but i want show Flight This Month for accepted pireps .
and for Hours This Month :
<?php
$hours = PIREPData::getIntervalDataByMonth(array(), 1);
echo $hours->total;
DB::debug();
?>
doesn’t work .
and how can I use those codes in Pilot center and pilot public profile ?
nabeel
March 20, 2010, 10:03pm
9
HI
<?php
$flights = PIREPData::findPIREPS(array('DATE_SUB(CURDATE(), INTERVAL 1 MONTH) <= p.submitdate'));
$total = count($flights);
echo $total;
?>
This code for Flight This Month work , But i want show Flight This Month for accepted pireps , now show all pireps .
and for Hours This Month :
<?php
$hours = PIREPData::getIntervalDataByMonth(array(), 1);
echo $hours->total;
DB::debug();
?>
doesn’t work .
It’ll show some debug output on the screen. What is that?
faraz
March 20, 2010, 10:18pm
10
for second code nothing show on screen , but first code fully work .
faraz
March 22, 2010, 8:49pm
11
can anybody help me!
Hours This Month doesn’t work .
how can i use those codes in pilot center and pilot public profile .
nabeel
March 22, 2010, 9:48pm
12
After
$flights = PIREPData::findPIREPS(array('DATE_SUB(CURDATE(), INTERVAL 1 MONTH) <= p.submitdate'));
DB::debug();
Add that DB::debug(); What does the output say?
faraz
March 22, 2010, 10:00pm
13
$hours = PIREPData::getIntervalDataByMonth(array(), 1);
echo $hours->total;
DB::debug();
?>
that code is correct ?
if correct , Not shown anything .
Flight Hours this Month:
faraz
March 25, 2010, 9:27pm
14
Hours This Month:
ezDB (v3.00) Debug..
Query [10] – [sELECT DATE_FORMAT(p.submitdate, ‘%Y-%m’) AS ym, UNIX_TIMESTAMP(p.submitdate) AS timestamp, COUNT(p.pirepid) AS total, SUM(p.revenue) as revenue, SUM(p.gross) as gross, SUM(p.fuelprice) as fuelprice, SUM(p.price) as price, SUM(p.expenses) as expenses, (SUM(p.pilotpay) * SUM(p.flighttime)) as pilotpay FROM phpvms_pireps p WHERE DATE_SUB(NOW(), INTERVAL 1 MONTH) <= p.submitdate GROUP BY ym ORDER BY timestamp ASC]
Query Result..
(row) string 0
ym int 0
timestamp int 0
total real 0
revenue real 0
gross real 0
fuelprice real 0
price real 0
expenses real 0
pilotpay
No Results
nabeel
March 26, 2010, 12:36am
15
So that says there were no PIREPs since it returns empty
faraz
March 26, 2010, 9:12am
16
Flight Hours This Month:
<?php
$hours = PIREPData::getIntervalDataByMonth(array(), 1);
echo $hours->total;
DB::debug();
?>
ezDB (v3.00) Debug..
Query [12] -- [sELECT * FROM phpvms_expenselog WHERE `dateadded`=201003]
Query Result..
(row) int 0
dateadded string 0
name string 0
type real 0
cost
No Results
I have 6 PIREPs for this Month .
Flight This Month: 6
faraz
April 2, 2010, 7:38pm
18
Hi Nabeel
Did you find any solution for Flight Hours This Month ?
faraz
April 2, 2010, 8:33pm
19
please check this code .
$pireps = PIREPData::findPIREPS(array('DATE_SUB(CURDATE(), INTERVAL 1 MONTH) <= p.submitdate'));
$thismonth = 0;
foreach($pireps as $pirep)
{
$thismonth = $pirep->flighttime;
}
echo $thismonth;