public function lastNullPrice($typeID)
 {
     //Get the last Null buy price
     $criteria = new CDbCriteria();
     $criteria->condition = 'typeID=:typeID AND (characterID = 2) AND stationID = 60014899 AND transactionType = "buy"';
     $criteria->params = array(':typeID' => $typeID);
     $criteria->order = 'transactionDateTime DESC';
     //Run the query
     $lastNull = Wallet::Model()->find($criteria);
     return $lastNull->price;
 }
Esempio n. 2
0
 public function lastJitaPrice($typeID, $days, $walletID)
 {
     //Grab the characters from the db
     $members = $this->getMembersAsArray($this->getUsersGroup($walletID));
     $sqlarray = '(' . implode(',', $members) . ')';
     //Get the last Jita buy price
     $criteria = new CDbCriteria();
     $criteria->condition = 'typeID=:typeID AND characterID IN ' . $sqlarray . ' AND stationID = 60003760 AND transactionType = "buy" AND personal = 0';
     $criteria->params = array(':typeID' => $typeID);
     $criteria->order = 'transactionDateTime DESC';
     //Run the query
     $lastJita = Wallet::Model()->find($criteria);
     if (!empty($lastJita)) {
         return $lastJita->price;
     } else {
         return 0;
     }
 }
Esempio n. 3
0
 public function lastSalePrice($typeID)
 {
     //Get the last sale price
     $criteria = new CDbCriteria();
     $criteria->condition = 'typeID=:typeID AND transactionType = "sell"';
     $criteria->params = array(':typeID' => $typeID);
     $criteria->order = 'transactionDateTime DESC';
     //Run query
     $lastSale = Wallet::Model()->find($criteria);
     return $lastSale->price;
 }
Esempio n. 4
0
//Get station information - not working yet as db stastations table is too old
// $stationInfo = Stastations::Model()->findByPk($data->stationID);
?>

	<?php 
if ($index % 2) {
    echo "<tr class='odd'>";
} else {
    echo "<tr>";
}
//Load the station information
$statCriteria = new CDbCriteria();
$statCriteria->condition = 'stationID=:stationID';
$statCriteria->params = array(':stationID' => $data->stationID);
$statCriteria->order = 'transactionDateTime DESC';
$station = Wallet::Model()->find($statCriteria);
//Get our time stuff
$timeLeft = $this->getHumanTime(strtotime("+ {$data->duration} day", strtotime($data->issued)) - strtotime("+ 5 hour"));
?>
	
	<?php 
$result = number_format($data->volRemaining / $data->volEntered * 100);
if ($result > 50.0) {
    $left = "<img src='./images/accept.png'>";
} elseif ($result > 25.0) {
    $left = $left = "<img src='./images/error.png'>";
} else {
    $left = $left = "<img src='./images/exclamation.png'>";
}
?>
Esempio n. 5
0
 public function getItemHistoricalData($typeID, $sell = 'sell')
 {
     //Grab the characters from the db
     $members = $this->getMembersAsArray(Yii::app()->user->trackingGroupID);
     $sqlarray = '(' . implode(',', $members) . ')';
     $criteria = new CdbCriteria();
     $criteria->condition = 'typeID=:typeID AND transactionType = :sell AND personal = 0 AND characterID IN ' . $sqlarray . '';
     $criteria->params = array(':typeID' => $typeID, ':sell' => $sell);
     $criteria->order = 'transactionDateTime';
     $history = Wallet::Model()->findAll($criteria);
     $graphArray = '[';
     foreach ($history as $transaction) {
         $date = (strtotime($transaction->transactionDateTime) - 5 * 60 * 60) * 1000;
         $graphArray = $graphArray . '[' . $date . ',' . $transaction->price . '],';
     }
     $graphArray = $graphArray . ']';
     return $graphArray;
 }