Jump to content

Hours This Month


faraz

Recommended Posts

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

Link to comment
Share on other sites

  • Administrators

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
Link to comment
Share on other sites

  • 2 months later...

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

Link to comment
Share on other sites

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 ?

Link to comment
Share on other sites

  • Administrators

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?

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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