📄 contractlist.php
字号:
<?
include_once("inc/auth.php");
include_once("inc/utility_all.php");
$PAGE_SIZE=10;
?>
<script>
function set_page()
{
PAGE_START=PAGE_NUM.value;
location="contractlist.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 CONTRACT where 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 a.CONTRACT_ID as CONTRACT_ID,a.CONTRACT_NAME as CONTRACT_NAME,a.CONTRACT_NO as CONTRACT_NO,
b.CODE_NAME as CONTRACT_TYPE,
g.USER_NAME as SELLER,sum(IFNULL(c.TOTAL_PRICE, 0)) as TOTALPRICE,a.CREATE_DATE as CREATE_DATE,
a.BEGIN_DATE as BEGIN_DATE,a.END_DATE as END_DATE,sum(IFNULL(c.PAYMENT, 0)) as PAYMENT
from CONTRACT a
LEFT OUTER JOIN SYS_CODE b ON a.CONTRACT_TYPE = b.CODE_NO AND b.PARENT_NO = 'CONTRACT_TYPE'
LEFT OUTER JOIN CONTRACT_LINE c ON a.CONTRACT_ID = c.CONTRACT_ID
LEFT OUTER JOIN USER g ON a.SELLER=g.USER_ID
where a.CUSTOMER_ID='$CUSTOMER_ID' group by a.CONTRACT_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="contractlist.php?CUR_PAGE=1&CUSTOMER_ID=<?=$CUSTOMER_ID?>"><img src='/images/first02.gif' width='24' border='0' height='15' alt='首页'></a>
<a href="contractlist.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="contractlist.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="contractlist.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>
<td nowrap align="center">创建人</td>
</tr>
<?
$CUSTOMER_COUNT=0;
while($ROW=mysql_fetch_array($cursor1))
{
$CUSTOMER_COUNT++;
$CONTRACT_ID1=$ROW["CONTRACT_ID"];
$CONTRACT_NO1=$ROW["CONTRACT_NO"];
$CONTRACT_NAME1=$ROW["CONTRACT_NAME"];
$CONTRACT_TYPE1=$ROW["CONTRACT_TYPE"];
$TOTALPRICE1=$ROW["TOTALPRICE"];
$PAYMENT=$ROW["PAYMENT"];
$BEGIN_DATE1=$ROW["BEGIN_DATE"];
$END_DATE1=$ROW["END_DATE"];
$CREATE_DATE1=$ROW["CREATE_DATE"];
$SELLER1=$ROW["SELLER"];
if($CUSTOMER_COUNT%2==1)
$TableLine="TableLine1";
else
$TableLine="TableLine2";
?>
<tr class="<?=$TableLine?>">
<td nowrap align="center"><?=$CONTRACT_NO1?></td>
<td nowrap align="center"><?=$CONTRACT_NAME1?></td>
<td nowrap align="center"><?=$TOTALPRICE1?></td>
<td nowrap align="center"><?=$PAYMENT?></td>
<td nowrap align="center"><?=$BEGIN_DATE1?></td>
<td nowrap align="center"><?=$END_DATE1?></td>
<td nowrap align="center"><?=$CREATE_DATE1?></td>
<td nowrap align="center"><?=$SELLER1?></td>
</tr>
<?
}
}
?>
</table>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -