Skip to content

Instantly share code, notes, and snippets.

@psykzz
Created October 22, 2012 19:36
Show Gist options
  • Select an option

  • Save psykzz/3933577 to your computer and use it in GitHub Desktop.

Select an option

Save psykzz/3933577 to your computer and use it in GitHub Desktop.
<?
error_reporting(E_ALL & ~E_NOTICE);
define("ALE_DIR","./ale/factory.php");
require_once(ALE_DIR);
$keyID = "80085";
$vCode = "GSPEEF4EI8NMSL20UPU1REALLY2THINK3I4WOULD5GIVE6YOU7MY8KEYI1LCMGZ7MUDUD";
$charID = "1365215823";
function sortByDate($a, $b) {
$d1 = new DateTime($a['date']);
$d2 = new DateTime($b['date']);#
if ($d1 > $d2)
return 0;
if ($d1 == $d2)
return 1;
if ($d1 < $d2)
return 2;
}
$ale = AleFactory::getEVEOnline();
$ale->setKey($keyID, $vCode, $charID);
$keyinfo = $ale->account->APIKeyInfo();
if ($keyinfo->result->key->type != "Corporation")
die('Requires a corp key.');
$wallet = $ale->corp->AccountBalance()->toArray();
$params = array(
'accountKey'=>1000,
'rowCount'=>500
);
$planetary_ID = 97;
$journal = $ale->corp->WalletJournal($params)->toArray();
$journal = $journal['result']['entries'];
$total = 0;
usort($journal, 'sortByDate');
foreach ($journal as $key=>$value) {
if ($value['refTypeID'] != $planetary_ID)
continue;
$total += $value['amount'];
$poco_groups[$value['argName1']][] = $value;
$poco_group_totals[$value['argName1']] += $value['amount'];
$poco[$key] = $value;
}
echo "<h2>Total POCO Monies... <br />".number_format((int)$total,2)." ISK </h2>";
foreach ($poco_groups as $group=>$__) {
echo "<strong>{$group} - ".number_format($poco_group_totals[$group],2)." ISK</strong><br />";
foreach ($__ as $_)
echo "[{$_['date']}] <strong>{$_['ownerName1']}</strong> in {$_['argName1']} ".number_format((int)$_['amount'],2)." ISK <br />\n";
echo "<hr />";
}
echo "<strong>ALL Pocos</strong><br />";
foreach ($poco as $_)
echo "[{$_['date']}] <strong>{$_['ownerName1']}</strong> in {$_['argName1']} ".number_format((int)$_['amount'],2)." ISK <br />\n";
echo "<hr />";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment