Файл: RootPanel 1.7.0 FreeCode/RootPanel 1.7.0 FreeCode/_rootadmin/_stats.inc.php
Строк: 339
<?
if ($sub == "total") {
checkAdminAccess('statsTotalRead',1);
$servers = GetServers();
if (@mysql_num_rows($servers) > 0) {
while ($server = mysql_fetch_object($servers)) {
print "<table width=400>";
print "<tr align=center bgcolor=$font_head><td colspan=3><B>Сервер $server->name [$server->ip]</B></td></tr>";
print "<tr align=center bgcolor=$font_head><td width=150>тип услуги</td><Td>кол-во аккаунтов *</td><td>moneyBack</td></tr>";
reset($_lang[OrderType]);
$moneyBackServer = 0;
while (list($k,$v) = each($_lang[OrderType])) {
$orders = @mysql_query("select o.id,t.vid from orders as o, tarifs as t where (o.status='1' or o.status='2') and o.serverid='$server->id' and o.tarif=t.id and t.vid='$k'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
$cnt = mysql_num_rows($orders);
if ($cnt > 0) {
$moneyBack = 0;
while ($order = mysql_fetch_object($orders)) {
if ($k == "hosting" or $k == "reseller") {
$moneyBack = $moneyBack + GetMoneyBackByOrderId($order->id);
}
}
print "<tr bgcolor=$font_row1><Td>$v:</td><td align=center>$cnt</td><td align=center>$moneyBack ".CURAS."</td></tr>";
$moneyBackServer = $moneyBackServer + $moneyBack;
}
}
print "<tr bgcolor=$font_head><td>Итого:</td><td align=center>".GetServerUserCount($server->id)."</td><td align=center>$moneyBackServer ".CURAS."</td></tr>";
print "</table><BR>";
}
}
print "<table width=400>";
print "<tr align=center bgcolor=$font_head><td colspan=3><B>Общая статистика</B></td></tr>";
print "<tr align=center bgcolor=$font_head><td width=150>тип услуги</td><Td>кол-во аккаунтов *</td><td>moneyBack</td></tr>";
reset($_lang[OrderType]);
$moneyBackAll = 0;
$cntAll = 0;
while (list($k,$v) = each($_lang[OrderType])) {
$orders = @mysql_query("select o.id,t.vid from orders as o, tarifs as t where (o.status='1' or o.status='2') and o.tarif=t.id and t.vid='$k'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
$cnt = mysql_num_rows($orders);
if ($cnt > 0) {
$moneyBack = 0;
while ($order = mysql_fetch_object($orders)) {
if ($k == "hosting" or $k == "reseller") {
$moneyBack = $moneyBack + GetMoneyBackByOrderId($order->id);
}
}
print "<tr bgcolor=$font_row1><td>$v:</td><Td align=center>$cnt</td><Td align=center>$moneyBack ".CURAS."</td></tr>";
$moneyBackAll = $moneyBackAll + $moneyBack;
$cntAll = $cntAll + $cnt;
}
}
print "<tr bgcolor=$font_head><td>Итого:</td><td align=center>$cntAll</td><Td align=center>$moneyBackAll ".CURAS."</td></tr>";
print "</table><BR>";
print "<B>*</b> - в поле кол-во аккаунтов учитываются только заказы, имеющие статус Обработан и Приостановлен. Не обработанные заказы не учитываются.";
}
if ($sub == "finance") {
checkAdminAccess('statsFinanceRead',1);
?>
<table border=0>
<tr>
<td>
<?
$r = @mysql_query("select SUM(money) as mother, SUM(money_host) as mhost, SUM(money_domain) as mdomain, SUM(money_addons) as maddons, SUM(money_shop) as mshop from bills where NOT(payed='0000-00-00') and status='1' and NOT(addfunds='1')") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
if (mysql_num_rows($r) > 0) {
$r = mysql_fetch_object($r);
$mhost = round($r->mhost,2);
$mdomain = round($r->mdomain,2);
$maddons = round($r->maddons,2);
$mother = round($r->mother,2);
$mshop = round($r->mshop,2);
}
if (!$mhost) { $mhost = 0; }
if (!$mdomain) { $mdomain = 0; }
if (!$maddons) { $maddons = 0; }
if (!$mother) { $mother = 0; }
if (!$mshop) { $mshop = 0; }
?>
<table>
<tr><td colspan=3 bgcolor=<?=$font_head?> align=center><B>Финансы (общая статистика)</b></td></tr>
<tr bgcolor=<?=$font_row?>>
<td>
Оплачено за хостинг, <?=CURAS?>:<BR>
Оплачено за домены, <?=CURAS?>:<BR>
Оплачено за доп. услуги, <?=CURAS?>:<BR>
Оплачено за другое, <?=CURAS?>:<BR>
Оплачено за товары, <?=CURAS?>:<BR>
Оплачено всего, <?=CURAS?>:
</td>
<td width=5></td>
<td>
<?=$mhost?><BR>
<?=$mdomain?><BR>
<?=$maddons?><BR>
<?=$mother?><BR>
<?=$mshop?><BR>
<B><?=($mhost+$mdomain+$maddons+$mother+$mshop)?></b>
</td>
</tr>
</table>
</td>
<td width=20></td>
<td>
<?
$mhost = ""; $mdomain = ""; $maddons = ""; $mother = ""; $mshop = "";
$thisMonthFirstDayDate = date("Y-m")."-01";
$r = @mysql_query("select SUM(money) as mother, SUM(money_host) as mhost, SUM(money_domain) as mdomain, SUM(money_addons) as maddons, SUM(money_shop) as mshop from bills where NOT(payed='0000-00-00') and status='1' and payed >= DATE_SUB('$thisMonthFirstDayDate', INTERVAL 1 MONTH) and payed < '$thisMonthFirstDayDate' and NOT(addfunds='1')") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
if (mysql_num_rows($r) > 0) {
$r = mysql_fetch_object($r);
$mhost = round($r->mhost,2);
$mdomain = round($r->mdomain,2);
$maddons = round($r->maddons,2);
$mother = round($r->mother,2);
$mshop = round($r->mshop,2);
}
if (!$mhost) { $mhost = 0; }
if (!$mdomain) { $mdomain = 0; }
if (!$maddons) { $maddons = 0; }
if (!$mother) { $mother = 0; }
if (!$mshop) { $mshop = 0; }
?>
<table>
<tr><td colspan=3 bgcolor=<?=$font_head?> align=center><B>Финансы (предыдущий месяц)</b></td></tr>
<tr bgcolor=<?=$font_row?>>
<td>
Оплачено за хостинг, <?=CURAS?>:<BR>
Оплачено за домены, <?=CURAS?>:<BR>
Оплачено за доп. услуги, <?=CURAS?>:<BR>
Оплачено за другое, <?=CURAS?>:<BR>
Оплачено за товары, <?=CURAS?>:<BR>
Оплачено всего, <?=CURAS?>:
</td>
<td width=5></td>
<td>
<?=$mhost?><BR>
<?=$mdomain?><BR>
<?=$maddons?><BR>
<?=$mother?><BR>
<?=$mshop?><BR>
<B><?=($mhost+$mdomain+$maddons+$mother+$mshop)?></b>
</td>
</tr>
</table>
</td>
<td width=20></td>
<td>
<?
$mhost = ""; $mdomain = ""; $maddons = ""; $mother = ""; $mshop = "";
$thisMonthFirstDayDate = date("Y-m")."-01";
$r = @mysql_query("select SUM(money) as mother, SUM(money_host) as mhost, SUM(money_domain) as mdomain, SUM(money_addons) as maddons, SUM(money_shop) as mshop from bills where NOT(payed='0000-00-00') and status='1' and payed >= '$thisMonthFirstDayDate' and NOT(addfunds='1')") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
if (mysql_num_rows($r) > 0) {
$r = mysql_fetch_object($r);
$mhost = round($r->mhost,2);
$mdomain = round($r->mdomain,2);
$maddons = round($r->maddons,2);
$mother = round($r->mother,2);
$mshop = round($r->mshop,2);
}
if (!$mhost) { $mhost = 0; }
if (!$mdomain) { $mdomain = 0; }
if (!$maddons) { $maddons = 0; }
if (!$mother) { $mother = 0; }
if (!$mshop) { $mshop = 0; }
?>
<table>
<tr><td colspan=3 bgcolor=<?=$font_head?> align=center><B>Финансы (текущий месяц)</b></td></tr>
<tr bgcolor=<?=$font_row?>>
<td>
Оплачено за хостинг, <?=CURAS?>:<BR>
Оплачено за домены, <?=CURAS?>:<BR>
Оплачено за доп. услуги, <?=CURAS?>:<BR>
Оплачено за другое, <?=CURAS?>:<BR>
Оплачено за товары, <?=CURAS?>:<BR>
Оплачено всего, <?=CURAS?>:
</td>
<td width=5></td>
<td>
<?=$mhost?><BR>
<?=$mdomain?><BR>
<?=$maddons?><BR>
<?=$mother?><BR>
<?=$mshop?><BR>
<B><?=($mhost+$mdomain+$maddons+$mother+$mshop)?></b>
</td>
</tr>
</table>
</td>
</tr>
</table><BR><BR>
<?
}
if ($sub == "aboutusfrom") {
checkAdminAccess('statsAboutUsRead',1);
if ($aboutusfromid or $datestart or $dateend) {
if (!$aboutusfromid) { print "Не указан источник."; }
else if (!$datestart) { print "Не указано начало периода."; }
else if (!$dateend) { print "Не указан конец периода."; }
else {
$r = @mysql_query("SELECT id FROM users WHERE aboutusfromid='$aboutusfromid' AND datareg >= '$datestart' AND datareg <= '$dateend'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
$cnt = mysql_num_rows($r);
$aboutus = GetAboutUsFromById($aboutusfromid);
print "По источнику <B>".$aboutus->name."</B> в период с $datestart по $dateend зарегистрировано клиентов: <B>$cnt</b>";
}
print "<BR><BR>";
}
?>
<script src="./_rootmenu/prototype.js" type="text/javascript"></script>
<script src="./_rootmenu/builder.js" type="text/javascript"></script>
<script src="./_rootmenu/calendar.js" type="text/javascript"></script>
<link rel="stylesheet" href="./_rootmenu/calendar.css" type="text/css" />
<form name=stat method=post>
<input type=hidden name=do value=<?=$do?>>
<input type=hidden name=sub value=<?=$sub?>>
<table>
<tr><td colspan=2 align=center bgcolor=<?=$font_head?>><B>Статистика по источникам</b></td></tr>
<tr><td>Источник:</td><td><? printAboutUsFromSelect($aboutusfromid) ;?></td></tr>
<tr><Td>Начало периода:</td><td>
<input name=datestart id=datestart size=9 readonly value="<?=$datestart?>"><a href="javascript:void(null);" id="datestart_icon"><IMG height=18 hspace=3 src="./_rootimages/date_selector.gif" width=16 border=0></a>
<script type="text/javascript">new Component.Calendar('datestart', {format: 'y-m-d'});</script>
<script type="text/javascript">new Component.Calendar('datestart', {click: 'datestart_icon', format: 'y-m-d'});</script>
</td></tr>
<tr><Td>Конец периода:</td><td>
<input name=dateend id=dateend size=9 readonly value="<?=$dateend?>"><a href="javascript:void(null);" id="dateend_icon"><IMG onclick="popUpCalendar(this, stat.dateend, 'yyyy-mm-dd');" height=18 hspace=3 src="./_rootimages/date_selector.gif" width=16 border=0></a>
<script type="text/javascript">new Component.Calendar('dateend', {format: 'y-m-d'});</script>
<script type="text/javascript">new Component.Calendar('dateend', {click: 'dateend_icon', format: 'y-m-d'});</script>
</td></tr>
<tr><Td colspan=2 align=center><input type=submit value=Показать></td></tr>
</table>
</form>
<?
}
if ($sub == "referals") {
checkAdminAccess('statsReferalsRead',1);
?>
<table>
<tr><td colspan=3 align=center bgcolor=<?=$font_head?>><B>Статистика по рефералам</b></td></tr>
<tr><td width=100 align=center bgcolor=<?=$font_head?>><B>Клиент</b></td><td align=center width=300 bgcolor=<?=$font_head?>><B>Рефералы 1-го уровня</b></td><td width=300 align=center bgcolor=<?=$font_head?>><B>Рефералы 2-го уровня</b></td></tr>
<?
$r = @mysql_query("SELECT * FROM users order by login") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
while ($rr = @mysql_fetch_object($r)) {
$refs1array = array();
$refs2array = array();
$referals = GetUserReferalsArray($rr->id);
while (list($id,$refArray) = @each($referals)) {
$refs1array[$id] = "<a target=_blank href=?do=fullinfo&id=$id>".$refArray[login]."</a> [ <A href=?do=mailsend&userid=$id style='color: gray' target=_blank>".$refArray[email]."</a> ]";
$referals2 = GetUserReferalsArray($id);
while (list($id2,$refArray2) = @each($referals2)) {
$refs2array[$id2] = "<a target=_blank href=?do=fullinfo&id=$id2>".$refArray2[login]."</a> [ <A href=?do=mailsend&userid=$id2 style='color: gray' target=_blank>".$refArray2[email]."</a> ]";
}
}
if (count($refs1array) > 0) {
getfont();
print "<tr bgcolor=$font_row><td valign=top><a target=_blank href=?do=fullinfo&id=$rr->id>$rr->login</a><BR><BR></td><Td valign=top>".@join("<BR>",$refs1array)."<BR><BR></td><td valign=top>".@join("<BR>",$refs2array)."<BR><BR></td>";
}
}
?>
</table>
<?
}
?>