Файл: RootPanel 1.7.0 FreeCode/RootPanel 1.7.0 FreeCode/_rootadmin/_bills.inc.php
Строк: 238
<?
if ($param == "uid" and $search) { print menu_admin_client($search); }
if ($param and $search) {$linkAddon = "param=$param&search=$search";}
if ($sub == 'delete' and $id) {
checkAdminAccess('billsDelete',1);
@mysql_query("delete from bills where id='$id'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
writeAdminLog("Удален счет ID # $id");
print "Счет успешно удален.<BR><BR>";
}
checkAdminAccess('billsRead',1);
$myShow = $_SESSION["billsShow"]; if (!$myShow) { $myShow="all"; }
if ($show and $show != $myShow) { $myShow = $show; $_SESSION["billsShow"] = $myShow; }
if ($myShow == "all") {
$where = "where 1";
} else if ($myShow == "payed") {
$where = "where status=1";
} else if ($myShow == "nonpayed") {
$where = "where status=0";
} else if ($myShow == "nonpayed20") {
$where = "where status=0 and (TO_DAYS(NOW())-TO_DAYS(created))>20";
} else if ($myShow == "uslpayed") {
$where = "where status=2";
}
if ($search) {
if ($param == "id" or $param == "uid" or $param == "host_id" or $param == "domain_id" or $param == "shop_id") {
$where .= " and $param='$search'";
} else {
$where .= " and $param LIKE '%$search%'";
}
}
getfont();
?>
<table width=99%>
<tr>
<Td valign=top>
<table width=330>
<tr><th align=center><h4>Фильтр</h4></th></tr>
<tr><td bgcolor=<?=$font_row?> align=center>
<form method=post>
<select name=show>
<option value=all <? if ($myShow == 'all') {print "selected";} ?>>Все счета</option>
<option value=payed <? if ($myShow == 'payed') {print "selected";} ?>>Оплаченные</option>
<option value=uslpayed <? if ($myShow == 'uslpayed') {print "selected";} ?>>Условно опплаченные</option>
<option value=nonpayed <? if ($myShow == 'nonpayed') {print "selected";} ?>>Не оплаченные</option>
<option value=nonpayed20 <? if ($myShow == 'nonpayed20') {print "selected";} ?>>Не оплаченные более 20 дней</option>
</select>
<input type=submit value=Показать>
</form>
</td></tr>
</table>
</td>
<td width=50> </td>
<Td valign=top>
<table width=320>
<tr><th align=center><h4>Поиск</h4></th></tr>
<tr><td bgcolor=<?=$font_row?>><form method=post><select name=param><option value=id selected>№ счета:</option></select> <input type=text name=search size=20> <input type=submit value=Найти></form></td></tr>
</table>
</td>
<td width=100%></td>
</tr>
</table><BR>
<?
$r=@mysql_query("select * from bills $where order by id desc") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
$rows = mysql_num_rows($r);
list($start, $perPage, $txt) = MakePages($page, $rows, $linkAddon);
?>
<table cellpadding=3 width=99%>
<tr><td colspan=10 align=right><?=$txt?></td></tr>
<tr><th colspan=10 align=center><h4>Счета</h4></th></tr>
<tr align=center><th>Опции</th><th>Дата</th><th>№ счета</th><th>Логин</th><th>Тариф</th><th>Домен</th><th>Стоимость, <?=CURAS?></th><th>Сумма, <?=CURAS?></th><th>Статус</th><th>Опции</th></tr>
<?
$r=@mysql_query("select * from bills $where order by id desc LIMIT $start,$perPage") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
$cnt=0;
getfont();
while ($rr = mysql_fetch_object($r)) {
$tarifTxt = "";
$domainTxt = "";
$cost = "";
$t=@mysql_query("select t1.*, t2.name from orders as t1, tarifs as t2 where t1.id='$rr->host_id' and t1.tarif=t2.id");
if (mysql_num_rows($t) > 0) {
$t=mysql_fetch_object($t);
if (!$rr->newaddons) { $cost = "<img src=./_rootimages/hosting.gif border=0 alt='Хостинг' title='Хостинг'> $rr->money_host"; }
$newreg='';
$domain_srok='';
if ($rr->newtarif) {
$newTarif=GetTarifById($rr->newtarif);
$tarifTxt = "<B>$newTarif->name</b><BR>[смена тарифа]";
} else if ($rr->newaddons) {
$tarifTxt = "<b>$t->name</b><BR>[заказ доп.услуг]";
} else {
$tarifTxt = "<b>$t->name</b><BR>[".$rr->host_srok." мес]";
}
if ($t->domain_reg == "1") {
if ($rr->renew) {
if ($rr->domain_id) {
$newreg=$_renewmin[1];
$domain_srok=" [$rr->domain_srok мес]";
} else {
$newreg=$_renewmin[0];
}
} else {
$newreg=$_newregmin[1];
$domain_srok=" [$rr->domain_srok мес]";
}
} else if ($t->domain_reg == "2") {
$newreg='';
} else if ($t->domain_reg == "0") {
if ($rr->renew or $rr->newtarif) {
$newreg='';
} else {
$newreg=$_newregmin[0];
}
}
if ($newreg) {$newreg="[".$newreg."]";}
if ($t->domain and !$rr->newaddons) { $domainTxt = "<B>$t->domain</b><BR>".$newreg.$domain_srok; }
else if ($t->domain and $rr->newaddons) { $domainTxt = "<B>$t->domain</b><BR> "; }
else { $domainTxt = ""; }
}
$d=@mysql_query("select * from orders_domains domains where id='$rr->domain_id'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
if (mysql_num_rows($d) > 0) {
$d=mysql_fetch_object($d);
$cost=$cost." <img src=./_rootimages/domain.gif border=0 alt='Домен' title='Домен'> $rr->money_domain";
if (!$rr->host_id) {
$domainTxt = "<B>".$d->domain."</b><BR>";
if ($rr->renew) { $domainTxt .= "[продление] "; } else { $domainTxt .= "[новый] "; }
$domainTxt .= "[$rr->domain_srok мес]";
}
}
if ($rr->money_addons > 0) {
$cost=$cost." <img src=./_rootimages/addons.gif border=0 alt='Доп. услуги' title='Доп. услуги'> $rr->money_addons";
}
$s=@mysql_query("select * from orders_shop where id='$rr->shop_id'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
if (mysql_num_rows($s) > 0) {
$s = mysql_fetch_object($s);
$cost = $cost." <img src=./_rootimages/shop.gif border=0 alt='Товар'> ".$rr->money_shop;
$tshop=GetShopItemById($s->item);
$shopTxt = "<B>".$tshop->name."</b><BR>";
if ($rr->renew) { $shopTxt .= "[продление] "; } else { $shopTxt .= "[новый] "; }
if ($tshop->costtype != "one") { $shopTxt .= "[$rr->shop_srok мес]"; }
}
$u=@mysql_query("select * from users where id='$rr->uid'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
$u=mysql_fetch_object($u);
if ($rr->status != 0) {$statusAddOn=" ".mydate($rr->payed);}
else {$statusAddOn="";}
getfont();
?>
<tr bgcolor="<?=$font_row?>" height=30>
<td align=center>
<a href=?do=editbill&id=<?=$rr->id?>><img src=./_rootimages/edit.gif border=0 alt="Редактировать счет" title="Редактировать счет"></a><a href=?do=<?=$do?>&sub=delete&id=<?=$rr->id?> onclick="javascript: return confirm('Вы уверены, что хотите удалить счет?');"><img src=./_rootimages/del.gif border=0 alt="Удалить счет" title="Удалить счет"></a>
</td>
<td align=center><?=mydate($rr->created)?></td>
<td align=center><B><?=sprintf("%04d", $rr->id)?></b></td>
<td align=center><a href=?do=fullinfo&id=<?=$u->id?>><?=$u->login?></a></td>
<? if (!$rr->addfunds and !$rr->money and !$rr->shop_id) { ?>
<td align=center`><?=$tarifTxt?></td>
<td><?=$domainTxt?></td>
<td align=center><?=$cost?></td>
<? } else if (!$rr->addfunds and $rr->money) { ?>
<td colspan=3 align=center>счет выставлен администратором</td>
<? } else if ($rr->shop_id) { ?>
<td colspan=2>Товар: <?=$shopTxt?></td>
<td align=center><?=$cost?></td>
<? } else {?>
<td colspan=3 align=center>пополнение внутреннего баланса</td>
<? } ?>
<td align=center><B><?=($rr->money_host+$rr->money_domain+$rr->money_addons+$rr->money+$rr->money_shop)?></b></td>
<td align=center><img src=./_rootimages/payed_<?=$rr->status?>_small.gif border=0 alt="<?=$_statusBill[$rr->status].$statusAddOn?>" title="<?=$_statusBill[$rr->status].$statusAddOn?>"></td>
<td align=center>
<? if (!$rr->addfunds and !$rr->money) { ?>
<a href=?do=editorder&<? if ($tshop->id) { print "shop_id=$tshop->id"; } else if ($t->id) { print "host_id=$t->id"; } else { print "domain_id=$d->id"; } ?>><img src=./_rootimages/orders.gif border=0 alt='Редактировать заказ' title='Редактировать заказ'></a>
<? } ?>
</td>
</tr>
<?
$cnt++;
}
?>
<tr><th colspan=10>Всего счетов: <?=$rows?>, счетов на странице: <?=$cnt?></th></tr>
<tr><td colspan=10 align=right><?=$txt?></td></tr>
</table>
<?
?>