Jump to content

Recommended Posts

Posted

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."'";

  • Administrators
Posted

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);

  • Like 1
  • 2 months later...
Posted

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

Posted

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 ?

  • Administrators
Posted

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?

  • Administrators
Posted

After

$flights = PIREPData::findPIREPS(array('DATE_SUB(CURDATE(), INTERVAL 1 MONTH) <= p.submitdate'));
DB::debug();

Add that DB::debug(); What does the output say?

Posted

$hours = PIREPData::getIntervalDataByMonth(array(), 1);
echo $hours->total;
DB::debug();
?>

that code is correct ?

if correct , Not shown anything .

Flight Hours this Month:

Posted

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

Posted

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

Posted

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;

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