<?PHP include('header.php');

echo "<span class='top-bl-s-verh'>Статистика заказов рекламы</span>
<div class='menucenter-top1'>
<table class='profile' width='100%' border='0' cellpadding='0' cellspacing='0' style='margin-bottom: 0;'>
<tr><td class='value1'>
Здесь ВЫ можете посмотреть всю статистику по заказам рекламы.
</td></tr>
</table>";

echo <<<html
<table class="history" cellspacing="0" cellpadding="0" width="100%" style='border:1px solid #ccc;'>
<thead>
<th width='80px'></th>
<th><img src='/css/img/icon_stats/dyn.png' title='Оплачиваемые клики' style='cursor:help;'></th>
<th><img src='/css/img/icon_stats/mail.png' title='Оплачиваемые письма'style='cursor:help;'></th>
<th><img src='/css/img/icon_stats/task.png' title='Оплачиваемые задания'style='cursor:help;'></th>
<th><img src='/css/img/icon_stats/test.png' title='Оплачиваемые тесты'style='cursor:help;'></th>
<th><img src='/css/img/icon_stats/kont.png' title='Контекстная реклама'style='cursor:help;'></th>
<th><img src='/css/img/icon_stats/ban.png' title='Баннеры'style='cursor:help;'></th>
<th>Всего</th>
</thead>
<tbody>
html;
$weekday = date("w");

function view_day($weekday){
switch($weekday){
case 1: return "Понедельник";break;
case 2: return "Вторник";break;
case 3: return "Среда";break;
case 4: return "Четверг";break;
case 5: return "Пятница";break;
case 6: return "Суббота";break;
case 0: return "Воскресенье";break;
}
}
$style = $style2 = NULL;
$sql = mysql_query("SELECT * FROM `b_all_stats` ORDER BY `id` ASC") or die(mysql_error());
while($row = mysql_fetch_assoc($sql)){
if($row["date"] == $weekday) { $style = "style='background:#C7F9D2;text-align:center;color:#AD3535;'";$style2 = "style='background:#C7F9D2;text-align:left;color:#AD3535;'"; }else{ $style = "style='text-align:center;'"; $style2 = "style='text-align:left;color:#3E46BC;'"; }
$all_summ = round($row["dyn"]+$row["mail"]+$row["task"]+$row["test"]+$row["kont"]+$row["ban"]);
$valute_c = "<span style='color:#069925;'> р.</span>";
echo "<tr>";
echo "<td $style2>".view_day($row["date"])."</td>";
echo "<td $style>".round($row["dyn"])."$valute_c</td>";
echo "<td $style>".round($row["mail"])."$valute_c</td>";
echo "<td $style>".round($row["task"])."$valute_c</td>";
echo "<td $style>".round($row["test"])."$valute_c</td>";
echo "<td $style>".round($row["kont"])."$valute_c</td>";
echo "<td $style>".round($row["ban"])."$valute_c</td>";
echo "<td $style>".$all_summ."$valute_c</td>";
echo "</tr>";
}
echo "</tbody></table></div>";
include('footer.php');?>