Файл: _rootadmin/_stats.inc.php
Строк: 1195
<?
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.archived=0 and (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" or $k == "vds") {
$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.archived=0 and (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" or $k == "vds") {
$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);
$weSalesTypes = GetSetting("weSalesTypes");
$weSalesTypes = @mb_split("::",$weSalesTypes);
if (@in_array("hosting",$weSalesTypes) or @in_array("reseller",$weSalesTypes) or @in_array("vds",$weSalesTypes) or @in_array("dedicated",$weSalesTypes) or @in_array("vpn",$weSalesTypes) or @in_array("ssh",$weSalesTypes)) {
$showHost = 1;
}
if (@in_array("domains",$weSalesTypes) or @in_array("domainsopt",$weSalesTypes)) {
$showDomain = 1;
}
if (@in_array("shop",$weSalesTypes)) {
$showShop = 1;
}
?>
<table border=0>
<tr>
<td width=270 valign=top>
<?
$mhost = 0; $mdomain = 0; $maddons = 0; $mother = 0; $mshop = 0;
$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);
}
$mhosting = 0; $mreseller = 0; $mvds = 0; $mdedicated = 0;
$q = @mysql_query("select id,host_id,money_host from bills where NOT(payed='0000-00-00') and status='1' and NOT(addfunds='1') and NOT(host_id='0')") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
while ($qq = @mysql_fetch_object($q)) {
$vid = GetTarifVidByOrderId($qq->host_id);
if ($vid == "hosting") { $mhosting += $qq->money_host; }
else if ($vid == "reseller") { $mreseller += $qq->money_host; }
else if ($vid == "vds") { $mvds += $qq->money_host; }
else if ($vid == "dedicated") { $mdedicated += $qq->money_host; }
}
$mhosting = round($mhosting,2); $mreseller = round($mreseller,2); $mvds = round($mvds,2); $mdedicated = round($mdedicated,2);
?>
<table width=100%>
<tr><td colspan=3 bgcolor=<? print $font_head?> align=center><B>Финансы (общая статистика)</b></td></tr>
<tr bgcolor=<? print $font_row?>>
<td>
<? if ($showHost) { ?>
Оплачено за тарифы, <? print CURAS?>:<BR>
<? if ($mhosting) { print " за хостинг, ".CURAS.":<BR>"; } ?>
<? if ($mreseller) { print " за реселлинг, ".CURAS.":<BR>"; } ?>
<? if ($mvds) { print " за vds, ".CURAS.":<BR>"; } ?>
<? if ($mdedicated) { print " за сервера, ".CURAS.":<BR>"; } ?>
<? } ?>
<? if ($showDomain) { ?>
Оплачено за домены, <? print CURAS?>:<BR>
<? } ?>
<? if ($showHost) { ?>
Оплачено за доп. услуги, <? print CURAS?>:<BR>
<? } ?>
<? if ($showShop) { ?>
Оплачено за товары, <? print CURAS?>:<BR>
<? } ?>
Оплачено за другое, <? print CURAS?>:<BR>
Оплачено всего, <? print CURAS?>:
</td>
<td width=5></td>
<td>
<? if ($showHost) {
print $mhost."<BR>" ;
if ($mhosting) { print $mhosting."<BR>"; }
if ($mreseller) { print $mreseller."<BR>"; }
if ($mvds) { print $mvds."<BR>"; }
if ($mdedicated) { print $mdedicated."<BR>"; }
} ?>
<? if ($showDomain) {?><? print $mdomain?><BR><? } ?>
<? if ($showHost) {?><? print $maddons?><BR><? } ?>
<? if ($showShop) {?><? print $mshop?><BR><? } ?>
<? print $mother?><BR>
<B><? print ($mhost+$mdomain+$maddons+$mother+$mshop)?></b>
</td>
</tr>
</table>
</td>
<td width=20></td>
<td width=270 valign=top>
<?
$mhost = 0; $mdomain = 0; $maddons = 0; $mother = 0; $mshop = 0;
$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);
}
$mhosting = 0; $mreseller = 0; $mvds = 0; $mdedicated = 0;
$q = @mysql_query("select id,host_id,money_host 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') and NOT(host_id='0')") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
while ($qq = @mysql_fetch_object($q)) {
$vid = GetTarifVidByOrderId($qq->host_id);
if ($vid == "hosting") { $mhosting += $qq->money_host; }
else if ($vid == "reseller") { $mreseller += $qq->money_host; }
else if ($vid == "vds") { $mvds += $qq->money_host; }
else if ($vid == "dedicated") { $mdedicated += $qq->money_host; }
}
$mhosting = round($mhosting,2); $mreseller = round($mreseller,2); $mvds = round($mvds,2); $mdedicated = round($mdedicated,2);
?>
<table width=100%>
<tr><td colspan=3 bgcolor=<? print $font_head?> align=center><B>Финансы (предыдущий месяц)</b></td></tr>
<tr bgcolor=<? print $font_row?>>
<td>
<? if ($showHost) { ?>
Оплачено за тарифы, <? print CURAS?>:<BR>
<? if ($mhosting) { print " за хостинг, ".CURAS.":<BR>"; } ?>
<? if ($mreseller) { print " за реселлинг, ".CURAS.":<BR>"; } ?>
<? if ($mvds) { print " за vds, ".CURAS.":<BR>"; } ?>
<? if ($mdedicated) { print " за сервера, ".CURAS.":<BR>"; } ?>
<? } ?>
<? if ($showDomain) { ?>
Оплачено за домены, <? print CURAS?>:<BR>
<? } ?>
<? if ($showHost) { ?>
Оплачено за доп. услуги, <? print CURAS?>:<BR>
<? } ?>
<? if ($showShop) { ?>
Оплачено за товары, <? print CURAS?>:<BR>
<? } ?>
Оплачено за другое, <? print CURAS?>:<BR>
Оплачено всего, <? print CURAS?>:
</td>
<td width=5></td>
<td>
<? if ($showHost) {
print $mhost."<BR>" ;
if ($mhosting) { print $mhosting."<BR>"; }
if ($mreseller) { print $mreseller."<BR>"; }
if ($mvds) { print $mvds."<BR>"; }
if ($mdedicated) { print $mdedicated."<BR>"; }
} ?>
<? if ($showDomain) {?><? print $mdomain?><BR><? } ?>
<? if ($showHost) {?><? print $maddons?><BR><? } ?>
<? if ($showShop) {?><? print $mshop?><BR><? } ?>
<? print $mother?><BR>
<B><? print ($mhost+$mdomain+$maddons+$mother+$mshop)?></b>
</td>
</tr>
</table>
</td>
<td width=20></td>
<td width=270 valign=top>
<?
$mhost = 0; $mdomain = 0; $maddons = 0; $mother = 0; $mshop = 0;
$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);
}
$mhosting = 0; $mreseller = 0; $mvds = 0; $mdedicated = 0;
$q = @mysql_query("select id,host_id,money_host from bills where NOT(payed='0000-00-00') and status='1' and payed >= '$thisMonthFirstDayDate' and NOT(addfunds='1') and NOT(host_id='0')") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
while ($qq = @mysql_fetch_object($q)) {
$vid = GetTarifVidByOrderId($qq->host_id);
if ($vid == "hosting") { $mhosting += $qq->money_host; }
else if ($vid == "reseller") { $mreseller += $qq->money_host; }
else if ($vid == "vds") { $mvds += $qq->money_host; }
else if ($vid == "dedicated") { $mdedicated += $qq->money_host; }
}
$mhosting = round($mhosting,2); $mreseller = round($mreseller,2); $mvds = round($mvds,2); $mdedicated = round($mdedicated,2);
?>
<table width=100%>
<tr><td colspan=3 bgcolor=<? print $font_head?> align=center><B>Финансы (текущий месяц)</b></td></tr>
<tr bgcolor=<? print $font_row?>>
<td>
<? if ($showHost) { ?>
Оплачено за тарифы, <? print CURAS?>:<BR>
<? if ($mhosting) { print " за хостинг, ".CURAS.":<BR>"; } ?>
<? if ($mreseller) { print " за реселлинг, ".CURAS.":<BR>"; } ?>
<? if ($mvds) { print " за vds, ".CURAS.":<BR>"; } ?>
<? if ($mdedicated) { print " за сервера, ".CURAS.":<BR>"; } ?>
<? } ?>
<? if ($showDomain) { ?>
Оплачено за домены, <? print CURAS?>:<BR>
<? } ?>
<? if ($showHost) { ?>
Оплачено за доп. услуги, <? print CURAS?>:<BR>
<? } ?>
<? if ($showShop) { ?>
Оплачено за товары, <? print CURAS?>:<BR>
<? } ?>
Оплачено за другое, <? print CURAS?>:<BR>
Оплачено всего, <? print CURAS?>:
</td>
<td width=5></td>
<td>
<? if ($showHost) {
print $mhost."<BR>" ;
if ($mhosting) { print $mhosting."<BR>"; }
if ($mreseller) { print $mreseller."<BR>"; }
if ($mvds) { print $mvds."<BR>"; }
if ($mdedicated) { print $mdedicated."<BR>"; }
} ?>
<? if ($showDomain) {?><? print $mdomain?><BR><? } ?>
<? if ($showHost) {?><? print $maddons?><BR><? } ?>
<? if ($showShop) {?><? print $mshop?><BR><? } ?>
<? print $mother?><BR>
<B><? print ($mhost+$mdomain+$maddons+$mother+$mshop)?></b>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td valign=top>
<?
$r = @mysql_query("select SUM(money) as moneyTotal, SUM(partnerMoney) as partnerMoneyTotal from users") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
$r = mysql_fetch_object($r);
$moneyTotal = round($r->moneyTotal,2);
$partnerMoneyTotal = round($r->partnerMoneyTotal,2);
?>
<BR>
<table width=100%>
<tr><td colspan=5 bgcolor=<? print $font_head?> align=center><B>Сумма балансов клиентов</b></td></tr>
<tr bgcolor=<? print $font_row?>>
<td>
Внутренний баланс, <? print CURAS?>:<BR>
Партнерские счета, <? print CURAS?>:
</td>
<td width=5></td>
<td>
<? print $moneyTotal?><BR>
<? print $partnerMoneyTotal ?>
</td>
<td width=5></td>
<td>
[ <A href=?do=stats&sub=balances&sub2=money>подробно</a> ]<BR>
[ <a href=?do=stats&sub=balances&sub2=partnerMoney>подробно</a> ]
</td>
</tr>
</table>
</td>
<td width=20></td>
<td>
</td>
<td width=20></td>
<td>
</td>
</tr>
</table><BR><BR>
<?
}
if ($sub == "balances") {
checkAdminAccess('statsFinanceRead',1);
if ($sub2 == "money") {
$tableTitle = "Внутренние балансы клиентов";
}
else if ($sub2 == "partnerMoney") {
$tableTitle = "Партнерские счета клиентов";
}
?>
<table>
<tr><td colspan=2 align=center bgcolor=<? print $font_head?>><B><? print $tableTitle?></b></td></tr>
<tr><td width=100 align=center bgcolor=<? print $font_head?>><B>Клиент</b></td><td align=center width=100 bgcolor=<? print $font_head?>><B>Сумма, <? print CURAS?></b></td></tr>
<?
$moneyTotal = 0;
$r = @mysql_query("SELECT * FROM users where $sub2<>0 order by $sub2 desc") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
while ($rr = @mysql_fetch_array($r)) {
getfont();
$money = round($rr[$sub2],2);
$moneyTotal += $money;
print "<tr bgcolor=$font_row><td valign=top> <a target=_blank href=?do=fullinfo&id=$rr[id]>$rr[login]</a></td><Td valign=top align=center>$money</td>";
}
?>
<tr><td colspan=2 bgcolor=<? print $font_head?>>Итого: <? print $moneyTotal?> <? print CURAS?></td></tr>
</table>
<?
}
if ($sub == "aboutusfrom") {
checkAdminAccess('statsAboutUsRead',1);
?>
<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=<? print $do?>>
<input type=hidden name=sub value=<? print $sub?>>
<table>
<tr><td colspan=2 align=center bgcolor=<? print $font_head?>><B>Статистика по источникам</b></td></tr>
<tr><Td>Начало периода:</td><td>
<input name=datestart id=datestart size=9 readonly value="<? print $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="<? print $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><BR>
<?
if ($datestart or $dateend) {
if (!$datestart) { print "Не указано начало периода."; }
else if (!$dateend) { print "Не указан конец периода."; }
else {
$a = @mysql_query("SELECT * FROM aboutusfrom") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
if (mysql_num_rows($a) > 0) {
?>
<table>
<tr><td colspan=2 align=center bgcolor=<? print $font_head?>><B>Статистика по источникам</b><BR>(с <? print $datestart?> по <? print $dateend?>)</td></tr>
<tr align=center bgcolor=<? print $font_head?>><td><B>Источник</b></td><td><B>Регистраций</b></td></tr>
<?
while ($aa = @mysql_fetch_object($a)) {
getfont();
$u = @mysql_query("SELECT COUNT(id) as usersCount FROM users WHERE aboutusfromid='$aa->id' AND datareg >= '$datestart' AND datareg <= '$dateend'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
$u = @mysql_fetch_object($u);
print "<tr bgcolor=$font_row><Td>$aa->name</td><td align=center>$u->usersCount</td></tr>";
}
?>
</table>
<?
} else {
print "Источники не найдены.";
}
print "<BR><BR>";
}
}
}
if ($sub == "referals") {
checkAdminAccess('statsReferalsRead',1);
?>
<table>
<tr><td colspan=3 align=center bgcolor=<? print $font_head?>><B>Статистика по рефералам</b></td></tr>
<tr><td width=100 align=center bgcolor=<? print $font_head?>><B>Клиент</b></td><td align=center width=300 bgcolor=<? print $font_head?>><B>Рефералы 1-го уровня</b></td><td width=300 align=center bgcolor=<? print $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>
<?
}
if ($sub == "taulinkkz") {
checkAdminAccess('statsSverkaTaulinkKZ',1);
if ($datestart and $dateend) {
$r = @mysql_query("SELECT * FROM bills where created >= '$datestart' and created <= '$dateend' and merchantType='taulinkkz' order by created,id") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
?>
<table>
<tr><td colspan=5 align=center bgcolor=<? print $font_head?>><B>Сверка (Таулинк Казахстан) за период c <? print myDate($datestart)?> по <? print myDate($dateend)?></b></td></tr>
<tr align=center bgcolor=<? print $font_head?>><td> Счет № </td><td> ID транзакции </td><td> Дата </td><td> Клиент </td><td> Сумма </td></tr>
<?
while ($rr = @mysql_fetch_object($r)) {
$user = GetUserById($rr->uid);
print "<tr align=center><td> <a href=?do=bills¶m=id&search=$rr->id target=_blank>".sprintf("%04d", $rr->id)."</a> </td><td> $rr->merchantId </td><td> ".myDate($rr->created)." </td><td> # $user->id [ <a href=?do=fullinfo&id=$user->id target=_blank>$user->login</a> ] </td><td> ".sprintf("%01.2f", $rr->merchantmoney)." </td></tr>";
$allSum += $rr->merchantmoney;
$allCnt += 1;
}
?>
<tr><Td colspan=5 align=center bgcolor=<? print $font_head?>>Всего платежей: <? print $allCnt?>, на сумму <? print sprintf("%01.2f", $allSum)?> в валюте терминала</td></tr>
</table><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=<? print $do?>>
<input type=hidden name=sub value=<? print $sub?>>
<table>
<tr><td colspan=2 align=center bgcolor=<? print $font_head?>><B>Сверка (Таулинк Казахстан)</b></td></tr>
<tr><Td>Начало периода:</td><td>
<input name=datestart id=datestart size=9 readonly value="<? print $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="<? print $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 == "qiwikz") {
checkAdminAccess('statsSverkaQiwiKZ',1);
if ($datestart and $dateend) {
$r = @mysql_query("SELECT * FROM bills where created >= '$datestart' and created <= '$dateend' and merchantType='qiwikz' order by created,id") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
?>
<table>
<tr><td colspan=5 align=center bgcolor=<? print $font_head?>><B>Сверка (QIWI.kz) за период c <? print myDate($datestart)?> по <? print myDate($dateend)?></b></td></tr>
<tr align=center bgcolor=<? print $font_head?>><td> Счет № </td><td> ID транзакции </td><td> Дата </td><td> Клиент </td><td> Сумма </td></tr>
<?
while ($rr = @mysql_fetch_object($r)) {
$user = GetUserById($rr->uid);
print "<tr align=center><td> <a href=?do=bills¶m=id&search=$rr->id target=_blank>".sprintf("%04d", $rr->id)."</a> </td><td> $rr->merchantId </td><td> ".myDate($rr->created)." </td><td> # $user->id [ <a href=?do=fullinfo&id=$user->id target=_blank>$user->login</a> ] </td><td> ".sprintf("%01.2f", $rr->merchantmoney)." </td></tr>";
$allSum += $rr->merchantmoney;
$allCnt += 1;
}
?>
<tr><Td colspan=5 align=center bgcolor=<? print $font_head?>>Всего платежей: <? print $allCnt?>, на сумму <? print sprintf("%01.2f", $allSum)?> в валюте терминала</td></tr>
</table><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=<? print $do?>>
<input type=hidden name=sub value=<? print $sub?>>
<table>
<tr><td colspan=2 align=center bgcolor=<? print $font_head?>><B>Сверка (QIWI.kz)</b></td></tr>
<tr><Td>Начало периода:</td><td>
<input name=datestart id=datestart size=9 readonly value="<? print $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="<? print $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 == "supportrating") {
checkAdminAccess('statsSupportRatingRead',1);
?>
<table border=0>
<tr>
<td width=270>
<?
$r = @mysql_query("SELECT au.login, COUNT(t.id) as ratingCount, SUM(t.rating)/COUNT(t.id) as ratingAverage FROM `admin_users` as au, `tickets` as t WHERE t.adminId=au.id and t.rating > 0 GROUP by au.login ORDER BY ratingAverage") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
$adminsRatingAverage = array(); $adminsRatingCount = array();
while ($rr = mysql_fetch_object($r)) {
$adminsRatingAverage[$rr->login] = $rr->ratingAverage;
$adminsRatingCount[$rr->login] = $rr->ratingCount;
}
arsort($adminsRatingAverage);
$r = @mysql_query("SELECT * FROM admin_users ORDER BY login") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
while ($rr = mysql_fetch_object($r)) {
if (!$adminsRatingAverage[$rr->login]) { $adminsRatingAverage[$rr->login] = 0; $adminsRatingCount[$rr->login] = "0";}
}
?>
<table width=100%>
<tr><td colspan=3 bgcolor=<? print $font_head?> align=center><B>Рейтинг (общая статистика)</b></td></tr>
<tr bgcolor=<? print $font_head?> align=center><td>логин</td><td>рейтинг</td><td>оценок</td></tr>
<?
while (list($k,$v) = @each($adminsRatingAverage)) {
print "<tr bgcolor=$font_row><td>$k</td><td align=center><B>".round($v,2)."</b></td><td align=center>".$adminsRatingCount[$k]."</td>";
}
?>
</table>
</td>
<td width=20></td>
<td width=270>
<?
$thisMonthFirstDayDate = date("Y-m")."-01";
$r = @mysql_query("SELECT au.login, COUNT(t.id) as ratingCount, SUM(t.rating)/COUNT(t.id) as ratingAverage FROM `admin_users` as au, `tickets` as t WHERE t.adminId=au.id and t.rating > 0 and t.dt >= DATE_SUB('$thisMonthFirstDayDate', INTERVAL 1 MONTH) and t.dt < '$thisMonthFirstDayDate' GROUP by au.login ORDER BY ratingAverage") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
$adminsRatingAverage = array(); $adminsRatingCount = array();
while ($rr = mysql_fetch_object($r)) {
$adminsRatingAverage[$rr->login] = $rr->ratingAverage;
$adminsRatingCount[$rr->login] = $rr->ratingCount;
}
arsort($adminsRatingAverage);
$r = @mysql_query("SELECT * FROM admin_users ORDER BY login") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
while ($rr = mysql_fetch_object($r)) {
if (!$adminsRatingAverage[$rr->login]) { $adminsRatingAverage[$rr->login] = 0; $adminsRatingCount[$rr->login] = "0";}
}
?>
<table width=100%>
<tr><td colspan=3 bgcolor=<? print $font_head?> align=center><B>Рейтинг (предыдущий месяц)</b></td></tr>
<tr bgcolor=<? print $font_head?> align=center><td>логин</td><td>рейтинг</td><td>оценок</td></tr>
<?
while (list($k,$v) = @each($adminsRatingAverage)) {
print "<tr bgcolor=$font_row><td>$k</td><td align=center><B>".round($v,2)."</b></td><td align=center>".$adminsRatingCount[$k]."</td>";
}
?>
</table>
</td>
<td width=20></td>
<td width=270>
<?
$thisMonthFirstDayDate = date("Y-m")."-01";
$r = @mysql_query("SELECT au.login, COUNT(t.id) as ratingCount, SUM(t.rating)/COUNT(t.id) as ratingAverage FROM `admin_users` as au, `tickets` as t WHERE t.adminId=au.id and t.rating > 0 and t.dt >= '$thisMonthFirstDayDate' GROUP by au.login ORDER BY ratingAverage") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
$adminsRatingAverage = array(); $adminsRatingCount = array();
while ($rr = mysql_fetch_object($r)) {
$adminsRatingAverage[$rr->login] = $rr->ratingAverage;
$adminsRatingCount[$rr->login] = $rr->ratingCount;
}
arsort($adminsRatingAverage);
$r = @mysql_query("SELECT * FROM admin_users ORDER BY login") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
while ($rr = mysql_fetch_object($r)) {
if (!$adminsRatingAverage[$rr->login]) { $adminsRatingAverage[$rr->login] = 0; $adminsRatingCount[$rr->login] = "0";}
}
?>
<table width=100%>
<tr><td colspan=3 bgcolor=<? print $font_head?> align=center><B>Рейтинг (текущий месяц)</b></td></tr>
<tr bgcolor=<? print $font_head?> align=center><td>логин</td><td>рейтинг</td><td>оценок</td></tr>
<?
while (list($k,$v) = @each($adminsRatingAverage)) {
print "<tr bgcolor=$font_row><td>$k</td><td align=center><B>".round($v,2)."</b></td><td align=center>".$adminsRatingCount[$k]."</td>";
}
?>
</table>
</td>
</tr>
</table><BR><BR>
<?
}
?>