Файл: billing/_rootbill/_bills.inc.php
Строк: 285
<?
_head('utf-8',$_lang[BillsTitle]);
if ($sub == 'delete' and $id) {
$bill = GetBillById($id);
if ($bill->id) {
if ($bill->host_id) { $t=GetOrderById($bill->host_id); }
if ($bill->domain_id) { $d=GetDomainById($bill->domain_id); }
if ($bill->shop_id) { $s=GetOrderShopById($bill->shop_id); }
if (!$bill->addfunds and $bill->money) {
} else if ($t->id and $t->startdate == "0000-00-00" and $t->todate == "0000-00-00") {
} else if ($d->id and $d->startdate == "0000-00-00" and $d->todate == "0000-00-00") {
} else if ($s->id and $s->startdate == "0000-00-00" and $s->todate == "0000-00-00") {
} else {
@mysql_query("delete from bills where id='$id' and uid='".$_SESSION["userId"]."'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
print $_lang[BillsDeleteSuccess]."<BR><BR>";
}
}
}
getfont();
?>
<table class='rpTable' width=95% cellpadding=3 align=center border=1>
<tr align=center>
<th><?=$_lang[BillsDate]?></th>
<th><?=$_lang[BillsBillNo]?></th>
<th><?=$_lang[BillsTarif]?></th>
<th><?=$_lang[BillsDomain]?></th>
<th><?=$_lang[BillsCost]?>, <?=CURS?></th>
<th><?=$_lang[BillsSumma]?>, <?=CURS?></th>
<th><?=$_lang[BillsStatus]?></th>
<th><?=$_lang[Option]?></th>
</tr>
<?
if ($search and ($param == "host_id" or $param == "domain_id" or $param == "shop_id")) {
$where = " and $param='$search'";
} else {
$where = "";
}
$r=@mysql_query("select * from bills WHERE uid='".$_SESSION["userId"]."' $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);
$r=@mysql_query("select * from bills where uid='".$_SESSION["userId"]."' $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, t2.vid from orders as t1, tarifs as t2 where t1.id='$rr->host_id' and t1.uid='".$_SESSION["userId"]."' and t1.tarif=t2.id");
if (mysql_num_rows($t) > 0) {
$t=mysql_fetch_object($t);
if (!$rr->newaddons) {$tVid=$t->vid; $cost = "<img src=./_rootimages/hosting.gif border=0 alt='".$_lang[OrderType][$tVid]."'> ".round($rr->money_host*CURK,2); }
$newreg='';
$domain_srok='';
if ($rr->newtarif) {
$newTarif=GetTarifById($rr->newtarif);
$tarifTxt = "<B>".$newTarif->name."</b><BR>[".$_lang[BillsChangeTarif]."]";
} else if ($rr->newaddons) {
$newaddons = GetAddonsIdsByTxt($rr->newaddons);
$newaddonsTxt = "";
while (list($k,$v) = each($newaddons)) {
$oneAddon = GetAddonById($v);
if ($oneAddon->id) {
$newaddonsTxt = $newaddonsTxt."- $oneAddon->name<BR>";
}
}
$tarifTxt = "<B>".$t->name."</b> <img src=./_rootimages/question.gif border=0 alt='<B>".$_lang[BillsOrderedAddons].":</b><BR>$newaddonsTxt'><BR>[".$_lang[BilldOrderAddons]."]";
} else {
$tarifTxt = "<B>".$t->name."</b><BR>[".$rr->host_srok." ".$_lang[OrderSokraschenieMonth]."]";
}
if ($t->domain_reg == "1") {
if ($rr->renew) {
if ($rr->domain_id) {
$newreg=$_renewmin[1];
$domain_srok=" [$rr->domain_srok ".$_lang[OrderSokraschenieMonth]."]";
} else {
$newreg=$_renewmin[0];
}
} else {
$newreg=$_newregmin[1];
$domain_srok=" [$rr->domain_srok ".$_lang[OrderSokraschenieMonth]."]";
}
} 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='".$_lang[Domain]."'> ".round($rr->money_domain*CURK,2);
if (!$rr->host_id) {
$domainTxt = "<B>".$d->domain."</b><BR>";
if ($rr->renew) { $domainTxt .= "[".$_lang[DomainRenewMin]."] "; } else { $domainTxt .= "[".$_lang[DomainNewMin]."] "; }
$domainTxt .= "[$rr->domain_srok ".$_lang[OrderSokraschenieMonth]."]";
}
}
$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='".$_lang[OrderItem]."'> ".round($rr->money_shop*CURK,2);
$t=GetShopItemById($s->item);
$shopTxt = "<B>".$t->name."</b><BR>";
if ($rr->renew) { $shopTxt .= "[".$_lang[DomainRenewMin]."] "; } else { $shopTxt .= "[".$_lang[DomainNewMin]."] "; }
if ($t->costtype != "one") { $shopTxt .= "[$rr->shop_srok ".$_lang[OrderSokraschenieMonth]."]"; }
}
if ($rr->money_addons) { $cost = $cost." <img src=./_rootimages/addons.gif border=0 alt='".$_lang[OrderAddons]."'> ".round($rr->money_addons*CURK,2);}
$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); $make='';}
else {
$statusAddOn="";
$make="<a class=rootlink href=?do=pay&id=$rr->id><img src=./_rootimages/pay.gif border=0 style='padding-right: 5px' alt='".$_lang[BillsPayBill]."'>$_lang[BillsPayBill]</a><BR>";
if (!$rr->addfunds and $rr->money) {
} else if ($t->id and $t->startdate == "0000-00-00" and $t->todate == "0000-00-00") {
} else if ($d->id and $d->startdate == "0000-00-00" and $d->todate == "0000-00-00") {
} else if ($s->id and $s->startdate == "0000-00-00" and $s->todate == "0000-00-00") {
} else {
$make=$make."<a class=rootlink href=?do=$do&sub=delete&id=$rr->id onclick="javascript: return confirm('".$_lang[BillsDeleteBillAlert]."');"><img src=./_rootimages/del.gif style='padding-right: 10px' border=0 alt='".$_lang[BillsDeleteBill]."'>$_lang[BillsDeleteBill]</a><BR>";
}
}
getfont();
?>
<tr bgcolor="<?=$font_row?>" height=30>
<td align=center><?=mydate($rr->created)?></td>
<td align=center><B><?=sprintf("%04d", $rr->id)?></b></td>
<? if (!$rr->addfunds and !$rr->money and !$rr->shop_id) { getfont();?>
<td><?=$tarifTxt?></td>
<td><?=$domainTxt?></td>
<td align=center><?=$cost?></td>
<? } else if (!$rr->addfunds and $rr->money) { ?>
<td align=center colspan=3><?=$_lang[BillsBillByAdmin]?> <? if ($rr->comment) { print "<img src=./_rootimages/question.gif border=0 alt='<B>".$_lang[OrderComment].":</b><BR>$rr->comment'>"; } ?></td>
<? } else if ($rr->shop_id) { ?>
<td colspan=2><?=$_lang[OrderItem]?>: <?=$shopTxt?></td>
<td align=center><?=$cost?></td>
<? } else { ?>
<td align=center colspan=3><?=$_lang[BillsAddFunds]?></td>
<? } ?>
<td align=center><B><?=round(($rr->money_host+$rr->money_domain+$rr->money_addons+$rr->money+$rr->money_shop)*CURK,2)?></b></td>
<td align=center> <img src=./_rootimages/payed_<?=$rr->status?>_small.gif border=0 alt="<?=$_statusBill[$rr->status].$statusAddOn?>"></td>
<td> <?=$make?></td>
</tr>
<?
$cnt++;
}
?>
<tr><th colspan=8><?=$_lang[BillsTotalBills]?>: <?=$rows?>, <?=$_lang[BillsBillsPerPage]?>: <?=$cnt?></th></tr>
<tr><th colspan=8 align=right><?=$txt?></th></tr>
</table>
<?
_foot('utf-8');
?>