Файл: RootPanel 1.7.0 FreeCode/RootPanel 1.7.0 FreeCode/_rootbill/_shop.inc.php
Строк: 133
<?
_head('utf-8',$_lang[ShopTitle]);
// print "<H1 class=pagetitle>".$_lang[ShopTitle]."</H1><hr class=hr>";
$r=@mysql_query("select * from bills where status = '0' and uid='".$_SESSION["userId"]."'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
if (mysql_num_rows($r) > 0) {
print "<font color=red>".$_lang[BillsNeOplachenoSchetov].": ".mysql_num_rows($r).". ".$_lang[BillsGoto]." <A class=rootlink href=?do=bills>".$_lang[BillsTitle]."</a> ".$_lang[BillGotoFor].".</font><BR><BR>";
}
if ($sub == 'delete' and $id) {
$order = GetOrderShopById($id);
if ($order->startdate == "0000-00-00" and $order->uid == $_SESSION["userId"]) {
@mysql_query("delete from orders_shop where id='$id' and uid='".$_SESSION["userId"]."'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
@mysql_query("delete from bills where shop_id='$id' and uid='".$_SESSION["userId"]."'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
print $_lang[OrdersDeleteSuccess]."<BR><BR>";
} else {
print "<font color=red>".$_lang[OrdersErrorCantDelete]."</font><BR><BR>";
}
}
getfont();
$r=@mysql_query("select * from orders_shop WHERE uid='".$_SESSION["userId"]."' 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);
?>
<table class='rpTable' cellpadding=3 width=95% align=center border=1>
<tr align=center>
<th><?=$_lang[OrdersDate]?></th>
<th><?=$_lang[OrderItem]?></th>
<th><?=$_lang[OrdersEnd]?></th>
<th><?=$_lang[OrdersLeftDays]?></th>
<th><?=$_lang[Option]?></th>
</tr>
<?
$r=@mysql_query("select *,TO_DAYS(todate)-TO_DAYS(NOW()) as leftdays from orders_shop where uid='".$_SESSION["userId"]."' 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)) {
getfont();
$t=mysql_query("select * from shop_items where id = '$rr->item'");
$t=mysql_fetch_object($t);
$b=mysql_query("select * from bills where shop_id = '$rr->id' and uid='".$_SESSION["userId"]."'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
$bills=mysql_num_rows($b);
$b=mysql_fetch_object($b);
$bp=mysql_query("select * from bills where shop_id = '$rr->id' and uid='".$_SESSION["userId"]."' and !(status='0')") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
$billspayed=mysql_num_rows($bp);
$billsNonPayed = $bills-$billspayed;
if ($t->costtype != "one" and $rr->leftdays != "") {
if ($rr->leftdays <= 10 and $rr->startdate != "0000-00-00") {
$leftDays = "<font color=red>".$rr->leftdays."</font>";
} else {
$leftDays = $rr->leftdays;
}
$leftDays="<img src=./_rootimages/shop.gif border=0 alt='".$_lang[OrderItem]."'> ".$leftDays;
}
else { $leftDays = "-"; }
if ($t->costtype != "one" and $rr->startdate != "0000-00-00") { $todate="<img src=./_rootimages/shop.gif border=0 alt='".$_lang[OrderItem]."'> ".mydate($rr->todate); }
else { $todate = "-"; }
if ($billspayed > 0 or $rr->startdate != "0000-00-00") {
$delete='';
} else {
$delete="<A class=rootlink href=?do=$do&sub=delete&id=$rr->id onclick="javascript: return confirm('".$_lang[OrdersDeleteAlert]."');"><img src=./_rootimages/del.gif style='padding-right: 5px' border=0 alt='".$_lang[OrdersDeleteOrder]."'>$_lang[OrdersDeleteOrder]</a><BR>";
}
if ($t->costtype != "one" and $billsNonPayed == 0 and $rr->todate != "0000-00-00") {
$renew="<a class=rootlink href=?do=renewshop&shop_id=$rr->id><img src=./_rootimages/renew.gif style='padding-right: 5px' border=0 alt='".$_lang[OrdersRenewOrder]."'>$_lang[OrdersRenewOrder]</a><BR>";
} else {
$renew='';
}
if ($rr->remarkUser) {
$rr->remarkUser = preg_replace("/n/ui","<BR>",$rr->remarkUser);
$remark="<span title='<B>".$_lang[OrderRemark].":</b><BR>$rr->remarkUser'><img src=./_rootimages/question2.gif style='padding-right: 5px' border=0>$_lang[OrderRemark]</span><BR>";
} else {
$remark="";
}
if ($rr->status and $rr->field3) {
$download="<a class=rootlink href=$rr->field3><img src=./_rootimages/download.gif style='padding-right: 5px' border=0 alt='".$_lang[ShopDownloadDist]."'>$_lang[ShopDownloadDist]</a><BR>";
} else {
$download="";
}
print "
<tr bgcolor=$font_row height=30>
<td align=center>".mydate($rr->orderdate)."</td>
<td align=center><b>$t->name</b></td>
<td align=center>$todate</td>
<td align=center nowrap>$leftDays</td>
<td align=left valign=middle>$download$remark<A class=rootlink href=?do=bills¶m=shop_id&search=$rr->id><img src=./_rootimages/bills.gif style='padding-right: 5px' border=0 alt='".$_lang[BillsTitle].": $bills'>$_lang[BillsTitle]: $bills</a><BR>$renew$delete</td>
</tr>
";
$cnt++;
}
?>
<tr><th colspan=5><?=$_lang[ShopTotalOrders]?>: <?=$rows?>, <?=$_lang[ShopOrdersOnPage]?>: <?=$cnt?></th></tr>
<tr><th colspan=5 align=right><?=$txt?></th></tr>
</table>
<?
_foot('utf-8');
?>