📄 historylist.php
字号:
<?
include_once("inc/auth.php");
include_once("inc/utility_all.php");
$PAGE_SIZE=2;
?>
<script>
function set_page()
{
PAGE_START=PAGE_NUM.value;
location="historylist.php?CUSTOMER_ID=<?=$CUSTOMER_ID?>&CUR_PAGE="+PAGE_START;
}
</script>
<html>
<head>
<title>销售记录快速搜索 </title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<?
//-----------先组织SQL语句-----------
$CUSTOMER_COUNT=0;
$query="SELECT count(*) from SALE_HISTORY a
LEFT OUTER JOIN CUSTOMER b ON a.CUSTOMER_ID=b.CUSTOMER_ID
LEFT OUTER JOIN PRODUCT c ON a.PRODUCT_ID=c.PRODUCT_ID and a.TYPE='PRO'
LEFT OUTER JOIN SERVICE d ON a.SERVICE_ID=d.SERVICE_ID and a.TYPE='SER'
LEFT OUTER JOIN USER e ON a.SALESMAN=e.USER_ID where a.CUSTOMER_ID='$CUSTOMER_ID'";
$cursor= exequery($connection,$query);
if($ROW=mysql_fetch_array($cursor))
$CUSTOMER_COUNT=$ROW[0];
$PER_PAGE=5;
$PAGE_COUNT=ceil($CUSTOMER_COUNT/$PER_PAGE);
if($CUR_PAGE<=0 || $CUR_PAGE=="")
$CUR_PAGE=1;
if($CUR_PAGE>$PAGE_COUNT)
$CUR_PAGE=$PAGE_COUNT;
$query1="SELECT c.PRODUCT_NAME as PRODUCT_NAME,d.SERVICE_NAME as SERVICE_NAME,a.PRICE as PRICE,a.AMT as AMT,a.TOTAL_PRICE as TOTAL_PRICE,a.DATE as DATE,e.USER_NAME as SELLER,a.HISTORY_ID as HISTORY_ID,a.TYPE as TYPE
from SALE_HISTORY a
LEFT OUTER JOIN PRODUCT c ON a.PRODUCT_ID=c.PRODUCT_ID and a.TYPE='PRO'
LEFT OUTER JOIN SERVICE d ON a.SERVICE_ID=d.SERVICE_ID and a.TYPE='SER'
LEFT OUTER JOIN USER e ON a.SALESMAN=e.USER_ID
where a.CUSTOMER_ID='$CUSTOMER_ID'";
$offest=($CUR_PAGE-1)*5;
$query1=$query1." LIMIT ". $offest." ,".$PER_PAGE;
$cursor1 = exequery($connection, $query1);
if($CUSTOMER_COUNT==0)
{
Message("<br>提示","没有销售记录");
exit;
}
else
{
?>
<table border="0" cellspacing="1" width="95%" class="small" cellpadding="3">
<tr>
<td align="left">
<a href="historylist.php?CUR_PAGE=1&CUSTOMER_ID=<?=$CUSTOMER_ID?>"><img src='/images/first02.gif' width='24' border='0' height='15' alt='首页'></a>
<a href="historylist.php?CUR_PAGE=<?=$CUR_PAGE-1?>&CUSTOMER_ID=<?=$CUSTOMER_ID?>"><img src='/images/first01.gif' width='24' border='0' height='15' alt='上一页'></a>
<a href="historylist.php?CUR_PAGE=<?=$CUR_PAGE+1?>&CUSTOMER_ID=<?=$CUSTOMER_ID?>"><img src='/images/last01.gif' width='24' border='0' height='15' alt='下一页' style="cursor:hand"></a>
<a href="historylist.php?CUR_PAGE=<?=$PAGE_COUNT?>&CUSTOMER_ID=<?=$CUSTOMER_ID?>"><img src='/images/last02.gif' width='24' border='0' height='15' alt='末页' style="cursor:hand"></a>
到
<input type="text" name="PAGE_NUM" size="3" maxlength="4" class="SmallInput">
页
<img id="btnGotoPage" src="/images/menu/book.gif" onclick="set_page()" border="0" WIDTH="19" HEIGHT="17" style="cursor:hand" alt="转到相应页面">
</td>
<td align="right">
<?=$CUR_PAGE?>/<?=$PAGE_COUNT?>页 共 <?=$CUSTOMER_COUNT?> 条
</td>
</tr>
</table>
<table border="0" cellspacing="1" width="95%" class="small" bgcolor="#000000" cellpadding="3">
<tr class="TableHeader">
<td nowrap align="center">产品名称</td>
<td nowrap align="center">服务名称</td>
<td nowrap align="center">销售单价</td>
<td nowrap align="center">数量</td>
<td nowrap align="center">总价</td>
<td nowrap align="center">日期</td>
<td nowrap align="center">销售员</td>
</tr>
<?
$CUSTOMER_COUNT=0;
while($ROW=mysql_fetch_array($cursor1))
{
$CUSTOMER_COUNT++;
$PRODUCT_NAME1=$ROW["PRODUCT_NAME"];
$SERVICE_NAME1=$ROW["SERVICE_NAME"];
$PRICE1=$ROW["PRICE"];
$AMT1=$ROW["AMT"];
$TOTAL_PRICE1=$ROW["TOTAL_PRICE"];
$CREAT_DATE=$ROW["DATE"];
$SELLER1=$ROW["SELLER"];
$TYPE1=$ROW["TYPE"];
$HISTORY_ID1=$ROW["HISTORY_ID"];
if($CUSTOMER_COUNT%2==1)
$TableLine="TableLine1";
else
$TableLine="TableLine2";
?>
<tr class="<?=$TableLine?>">
<td nowrap align="center"><?=$PRODUCT_NAME1?></td>
<td nowrap align="center"><?=$SERVICE_NAME1?></td>
<td nowrap align="center"><?=$PRICE1?></td>
<td nowrap align="center"><?=$AMT1?></td>
<td nowrap align="center"><?=$TOTAL_PRICE1?></td>
<td nowrap align="center"><?=$CREAT_DATE?></td>
<td nowrap align="center"><?=$SELLER1?></td>
</tr>
<?
}
}
?>
</table>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -