Файл: _rootadmin/_specialcosts.inc.php
Строк: 363
<?
if ($uid) {
$user = GetUserById($uid);
$noentry = "<Table width=100%><tr bgcolor=#FFFFFF><TD align=center>Специальные цены не установлены</td></tr></table>";
if ($sub == "delete" and $id) {
checkAdminAccess('clientSpecialCostDelete',1);
@mysql_query("delete from specialcosts where id='$id' and uid='$uid'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
writeAdminLog("Удалена спец. цена для клиента ID # $uid, $user->login");
}
if ($sub == "add" and ($tarif_id or $zone_id or $addon_id or $item_id)) {
checkAdminAccess('clientSpecialCostCreate',1);
if ($tarif_id) {$row = "tarif_id"; $value = $tarif_id; }
else if ($zone_id) {$row = "zone_id"; $value = $zone_id; }
else if ($addon_id) {$row = "addon_id"; $value = $addon_id; }
else if ($item_id) {$row = "item_id"; $value = $item_id; }
$r = @mysql_query("select id from specialcosts where $row='$value' and uid='$uid'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
if (mysql_num_rows($r) == 0) {
@mysql_query("insert into specialcosts (uid,$row,cost1,cost2) values($uid,$value,$cost1,$cost2)") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
}
writeAdminLog("Добавлена спец. цена для клиента ID # $uid, $user->login");
}
print menu_admin_client($uid);
checkAdminAccess('clientSpecialCostRead',1);
print "<table cellpadding=3 width=98%>";
print "<tr><td align=center colspan=3 bgcolor=$font_head><B>Текущие специальные цены</b></td></tr>";
print "<tr bgcolor=$font_head><td align=center>Тарифные планы</td><td align=center>Доменные зоны</td><td align=center>Дополнительные услуги</td></tr>";
print "<tr bgcolor=$font_row><td align=center valign=top width=33%>";
$r = @mysql_query("select * from specialcosts where NOT(tarif_id = 0) and uid='$uid'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
if (mysql_num_rows($r) > 0) {
print "<table width=100%><tr bgcolor=#FFFFFF><td align=center valign=top><B>Название</b></td><td align=center width=130><B>Цена, ".CURAS."</b><p style="$styleHelp">Установка / Ежемесячно</td><td></td></tr>";
while ($rr = mysql_fetch_object($r)) {
$tarif = GetTarifById($rr->tarif_id);
print "<tr bgcolor=#FFFFFF><td align=center>$tarif->name</td><Td align=center>$rr->cost1 / $rr->cost2</td><td width=20><A href=?do=$do&uid=$uid&sub=delete&id=$rr->id onclick="javascript: return confirm('Вы уверены, что хотите удалить спец. цену для тарифного плана?');"><img src=./_rootimages/del.gif alt=Удалить border=0></a></td></tr>";
}
print "</table>";
} else { print $noentry; }
print "</td><Td align=center valign=top width=33%>";
$r = @mysql_query("select * from specialcosts where NOT(zone_id = 0) and uid='$uid'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
if (mysql_num_rows($r) > 0) {
print "<table width=100%><tr bgcolor=#FFFFFF><td align=center valign=top><B>Зона</b></td><td align=center width=170><B>Цена, ".CURAS."</b><p style="$styleHelp">Регистрация / Продление</td><td></td></tr>";
while ($rr = mysql_fetch_object($r)) {
$zone = GetZoneById($rr->zone_id);
if ($zone->autoreg) {$regaddon=" [".GetRegistratorNameById($zone->autoreg)."]";} else {$regaddon = "";}
print "<tr bgcolor=#FFFFFF><td align=center>.$zone->zone$regaddon</td><Td align=center>$rr->cost1 / $rr->cost2</td><td width=20><A href=?do=$do&uid=$uid&sub=delete&id=$rr->id onclick="javascript: return confirm('Вы уверены, что хотите удалить спец. цену для доменной зоны?');"><img src=./_rootimages/del.gif alt=Удалить border=0></a></td></tr>";
}
print "</table>";
} else { print $noentry; }
print "</td><td align=center valign=top width=33%>";
$r = @mysql_query("select * from specialcosts where NOT(addon_id = 0) and uid='$uid'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
if (mysql_num_rows($r) > 0) {
print "<table width=100%><tr bgcolor=#FFFFFF><td align=center valign=top><B>Идентификатор</b></td><td align=center width=130><B>Цена, ".CURAS."</b><p style="$styleHelp">Установка / Ежемесячно</td><td></td></tr>";
while ($rr = mysql_fetch_object($r)) {
$addon = GetAddonById($rr->addon_id);
print "<tr bgcolor=#FFFFFF><td align=center>$addon->textid</td><Td align=center>$rr->cost1 / $rr->cost2</td><td width=20><A href=?do=$do&uid=$uid&sub=delete&id=$rr->id onclick="javascript: return confirm('Вы уверены, что хотите удалить спец. цену для дополнительной услуги?');"><img src=./_rootimages/del.gif alt=Удалить border=0></a></td></tr>";
}
print "</table>";
} else { print $noentry; }
print "</td></tr>";
print "<tr bgcolor=$font_head><td align=center>Товары</td><td align=center></td><td align=center></td></tr>";
print "<tr bgcolor=$font_row><td align=center valign=top width=33%>";
$r = @mysql_query("select * from specialcosts where NOT(item_id = 0) and uid='$uid'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
if (mysql_num_rows($r) > 0) {
print "<table width=100%><tr bgcolor=#FFFFFF><td align=center valign=top><B>Название</b></td><td align=center width=130><B>Цена, ".CURAS."</b></td><td></td></tr>";
while ($rr = mysql_fetch_object($r)) {
$item = GetShopItemById($rr->item_id);
print "<tr bgcolor=#FFFFFF><td align=center>$item->name</td><Td align=center>$rr->cost1</td><td width=20><A href=?do=$do&uid=$uid&sub=delete&id=$rr->id onclick="javascript: return confirm('Вы уверены, что хотите удалить спец. цену для товара?');"><img src=./_rootimages/del.gif alt=Удалить border=0></a></td></tr>";
}
print "</table>";
} else { print $noentry; }
print "</td><Td align=center valign=top width=33%>";
print "</td><td align=center valign=top width=33%>";
print "</td></tr>";
print "</table><BR>";
print "<table cellpadding=3 width=98%>";
print "<tr><td align=center colspan=3 bgcolor=$font_head><B>Установка специальных цен</b></td></tr>";
print "<tr bgcolor=$font_head><td align=center>Тарифные планы</td><td align=center>Доменные зоны</td><td align=center>Дополнительные услуги</td></tr>";
print "<tr bgcolor=$font_row><td align=center valign=top width=33%>";
print "<form method=post><input type=hidden name=do value=$do><input type=hidden name=uid value=$uid><input type=hidden name=sub value=add><table>";
print "<tr><td>Тариф:</td><Td>"; printTarifsSelect(); print "</td></tr>";
print "<tr><Td>Цена установки, ".CURAS."</td><Td><input type=text name=cost1 size=11 value=0.00></td></tr>";
print "<tr><Td>Цена ежемесячно, ".CURAS."</td><Td><input type=text name=cost2 size=11 value=0.00></td></tr>";
print "<tr><td colspan=2 align=center><input type=submit value=Добавить></td></tr>";
print "</table></form>";
print "</td><Td align=center valign=top width=33%>";
print "<form method=post><input type=hidden name=do value=$do><input type=hidden name=uid value=$uid><input type=hidden name=sub value=add><table>";
print "<tr><td>Зона:</td><Td>";
# printZonesSelect();
$q=GetZonesAll();
print "<select name=zone_id><option></option>";
while ($qq=mysql_fetch_object($q)) {
if ($qq->autoreg) {$regaddon=" [".GetRegistratorNameById($qq->autoreg)."]";} else {$regaddon = "";}
print "<option value=$qq->id>.$qq->zone$regaddon</option>";
}
print "</select>";
print "</td></tr>";
print "<tr><Td>Цена регистрации, ".CURAS."</td><Td><input type=text name=cost1 size=11 value=0.00></td></tr>";
print "<tr><Td>Цена продления, ".CURAS."</td><Td><input type=text name=cost2 size=11 value=0.00></td></tr>";
print "<tr><td colspan=2 align=center><input type=submit value=Добавить></td></tr>";
print "</table></form>";
print "</td><td align=center valign=top width=33%>";
print "<form method=post><input type=hidden name=do value=$do><input type=hidden name=uid value=$uid><input type=hidden name=sub value=add><table>";
print "<tr><td>Услуга:</td><Td>"; printAddonsSelect(); print "</td></tr>";
print "<tr><Td>Цена установки, ".CURAS."</td><Td><input type=text name=cost1 size=11 value=0.00></td></tr>";
print "<tr><Td>Цена ежемесячно, ".CURAS."</td><Td><input type=text name=cost2 size=11 value=0.00></td></tr>";
print "<tr><td colspan=2 align=center><input type=submit value=Добавить></td></tr>";
print "</table></form>";
print "</td></tr>";
print "<tr bgcolor=$font_head><td align=center>Товары</td><td align=center></td><td align=center></td></tr>";
print "<tr bgcolor=$font_row><td align=center valign=top width=33%>";
print "<form method=post><input type=hidden name=do value=$do><input type=hidden name=uid value=$uid><input type=hidden name=sub value=add><table>";
print "<tr><td>Товар:</td><Td><select name=item_id>";
$items = GetShopItems();
while ($item = @mysql_fetch_object($items)) {
print "<option value=$item->id>$item->name</option>";
}
print "</select></td></tr>";
print "<tr><Td>Цена, ".CURAS."</td><Td><input type=text name=cost1 size=11 value=0.00><input type=hidden name=cost2 value=0></td></tr>";
print "<tr><td colspan=2 align=center><input type=submit value=Добавить></td></tr>";
print "</table></form>";
print "</td><Td align=center valign=top width=33%>";
print "</td><td align=center valign=top width=33%>";
print "</td></tr>";
print "</table>";
}
?>