📄 list.php
字号:
<?php
function default_validate( )
{
global $connection;
global $customer_id;
global $customer_name;
global $manage_user;
$query2 = "select up.* from user_priv as up, user as u where up.USER_PRIV=u.USER_PRIV and u.USER_ID='".$manage_user."'";
$cursor2 = exequery( $connection, $query2 );
if ( $row2 = mysql_fetch_array( $cursor2 ) )
{
$priv_no = $row2['PRIV_NO'];
}
$query3 = "select up.* from user_priv as up, user as u where up.USER_PRIV=u.USER_PRIV and u.USER_ID='".$_SESSION['LOGIN_USER_ID']."'";
$cursor3 = exequery( $connection, $query3 );
if ( $row3 = mysql_fetch_array( $cursor3 ) )
{
$login_priv_no = $row3['PRIV_NO'];
}
if ( $login_priv_no < $priv_no )
{
$purview_ses = "<a href=\"#\" onclick=\"customer_detail('".$customer_id."');\">".$customer_name."</a>";
}
else
{
$purview_ses = false;
}
return $purview_ses;
}
function dept_validate( )
{
global $connection;
global $purview_dept;
if ( $purview_dept == "ALL_DEPT" )
{
return true;
}
$query2 = "select d.* from department as d, user as u where u.DEPT_ID=d.DEPT_ID and u.USER_ID='".$_SESSION['LOGIN_USER_ID']."'";
$cursor2 = exequery( $connection, $query2 );
if ( $row2 = mysql_fetch_array( $cursor2 ) )
{
$dept_id = $row2['DEPT_ID'];
}
if ( array_search( $dept_id, explode( ",", $purview_dept ) ) !== false )
{
return true;
}
else
{
return false;
}
}
function role_validate( )
{
global $connection;
global $purview_role;
$query2 = "select up.* from user_priv as up, user as u where up.USER_PRIV=u.USER_PRIV and u.USER_ID='".$_SESSION['LOGIN_USER_ID']."'";
$cursor2 = exequery( $connection, $query2 );
if ( $row2 = mysql_fetch_array( $cursor2 ) )
{
$login_priv_no = $row2['USER_PRIV'];
}
if ( array_search( $login_priv_no, explode( ",", $purview_role ) ) !== false )
{
return true;
}
else
{
return false;
}
}
function user_validate( )
{
global $connection;
global $purview_user;
if ( array_search( $_SESSION['LOGIN_USER_ID'], explode( ",", $purview_user ) ) !== false )
{
return true;
}
else
{
return false;
}
}
include_once( "inc/auth.php" );
include_once( "inc/function_page_01.php" );
if ( $_REQUEST['cur_page'] == "" )
{
$cur_page = 1;
}
else
{
$cur_page = $_REQUEST['cur_page'];
}
$connection = openconnection( );
$query = "SELECT c.*, ct.*, l.LINKMAN_ID FROM customer as c, contact as ct, linkman as l WHERE ct.CUSTOMER_ID=c.CUSTOMER_ID and c.CUSTOMER_ID=l.CUSTOMER_ID and ct.CUSTOMER_ID=".$_REQUEST['CUSTOMER_ID2']."";
$where_str = "";
if ( $_REQUEST['CUSTOMER_NAME'] != "" )
{
$where_str .= " and c.CUSTOMER_NAME like '%".$_REQUEST['CUSTOMER_NAME']."%'";
}
if ( $_REQUEST['CONTACT_DATE'] != "" )
{
$where_str .= " and to_days(ct.CONTACT_DATE) > to_days('".$_REQUEST['CONTACT_DATE']."')";
}
if ( $_REQUEST['CONTACT_DATE2'] != "" )
{
$where_str .= " and to_days(ct.CONTACT_DATE) < to_days('".$_REQUEST['CONTACT_DATE2']."')";
}
if ( $_REQUEST['CONTACT_CONTENT'] != "" )
{
$where_str .= " and ct.CONTACT_CONTENT like '%".$_REQUEST['CONTACT_CONTENT']."%'";
}
if ( $_REQUEST['LINKMAN_NAME'] != "" )
{
$where_str .= " and ct.LINKMAN_NAME like '%".$_REQUEST['LINKMAN_NAME']."%'";
}
if ( $_REQUEST['MEMO'] != "" )
{
$where_str .= " and ct.MEMO like '%".$_REQUEST['MEMO']."%'";
}
$query .= $where_str;
switch ( $_REQUEST['order'] )
{
case "contact_content" :
$query .= " group by ct.CONTACT_ID order by ct.CONTACT_CONTENT";
break;
case "contact_date" :
$query .= " group by ct.CONTACT_ID order by ct.CONTACT_DATE";
break;
case "customer_name" :
$query .= " group by ct.CONTACT_ID order by c.CUSTOMER_NAME";
break;
case "linkman_name" :
$query .= " group by ct.CONTACT_ID order by ct.LINKMAN_NAME";
break;
default :
$query .= " group by ct.CONTACT_ID order by ct.CONTACT_ID";
break;
}
$query .= $_REQUEST['sens'] ? " DESC" : " ASC";
$cursor = exequery( $connection, $query );
while ( $row = mysql_fetch_array( $cursor ) )
{
$contact_id = $row['CONTACT_ID'];
$customer_id = $row['CUSTOMER_ID'];
$customer_name = $row['CUSTOMER_NAME'];
$linkman_name = $row['LINKMAN_NAME'];
$linkman_id = $row['LINKMAN_ID'];
$contact_content = $row['CONTACT_CONTENT'];
$contact_date = $row['CONTACT_DATE'];
$contact_date_end = $row['CONTACT_DATE_END'];
$create_user = $row['CREATE_USER'];
$manage_user = $row['MANAGE_USER'];
$purview = $row['PURVIEW'];
$purview_dept = $row['PURVIEW_DEPT'];
$purview_role = $row['PURVIEW_ROLE'];
$purview_user = $row['PURVIEW_USER'];
switch ( $purview )
{
case "1" :
$purview_ses = default_validate( );
break;
case "2" :
$purview_ses = "<a href=\"#\" onclick=\"customer_detail('".$customer_id."');\">".$customer_name."</a>";
break;
case "3" :
$dept_validate = dept_validate( );
$role_validate = role_validate( );
$user_validate = user_validate( );
if ( ( $dept_validate || $role_validate || $user_validate ) === false )
{
$purview_ses = default_validate( );
}
else
{
$purview_ses = "<a href=\"#\" onclick=\"customer_detail('".$customer_id."');\">".$customer_name."</a>";
}
}
if ( $manage_user == $_SESSION['LOGIN_USER_ID'] )
{
$purview_ses = "<a href=\"#\" onclick=\"customer_detail('".$customer_id."');\">".$customer_name."</a>";
}
if ( $purview_ses == false )
{
}
else
{
$str_contact_id .= $contact_id.",";
}
}
$str_contact_id = substr( $str_contact_id, 0, -1 );
$str_contact_id = $str_contact_id == "" ? 0 : $str_contact_id;
echo "\r\n<html>\r\n<head>\r\n<title>交往信息</title>\r\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=gb2312\">\r\n";
echo "<s";
echo "cript>\r\nfunction contact_detail(contact_id)\r\n{\r\n\tURL=\"detail.php?CONTACT_ID=\"+contact_id;\r\n\twindow.open(URL,\"\",\"height=600,width=800,status=1,toolbar=no,menubar=no,location=no,scrollbars=yes,top=50,left=100,resizable=yes\");\r\n}\r\n\r\nfunction customer_detail(customer_id)\r\n{\r\n\tvar url\t= \"../../customer/detail.php?CUSTOMER_ID=\"+customer_id;\twindow.open(url,\"\",\"height=600,width=800,status=1,toolbar=no,me";
echo "nubar=no,location=no,scrollbars=yes,top=50,left=100,resizable=yes\");\r\n}\r\n\r\nfunction linkman_detail(linkman_id)\r\n{\r\n\tURL=\"../../linkman/detail.php?linkman_id=\"+linkman_id;\r\n\twindow.open(URL,\"\",\"height=600,width=800,status=1,toolbar=no,menubar=no,location=no,scrollbars=yes,top=50,left=100,resizable=yes\");\r\n}\r\n</script>\r\n</head>\r\n\r\n<body class=\"bodycolor\" topmargin=\"5\">\r\n<table border=\"0\" width=\"100%\" ce";
echo "llspacing=\"1\" cellpadding=\"0\">\r\n\t<tr class=\"tablehead1\">\r\n\t\t<td><img src=\"/images/manage/news.gif\" align=\"absmiddle\">交往信息查询结果</td>\r\n\t</tr>\r\n\t<tr class=\"tablehead2\">\r\n\t\t<td><BUTTON class=btn onClick=\"window.close();\" title=\"关闭窗口\"><table><tr valign=top ><td><img src=\"/images/littlegif/b_u.gif\" align=\"center\"></td> <td>";
echo "<s";
echo "pan id=\"showallid\">关闭</span></td></tr></table></BUTTON></td>\r\n\t</tr>\r\n</table>\r\n<br>\r\n";
$query = "SELECT c.*, ct.*, l.LINKMAN_ID FROM customer as c, contact as ct, linkman as l WHERE ct.CUSTOMER_ID=c.CUSTOMER_ID and c.CUSTOMER_ID=l.CUSTOMER_ID and ct.CONTACT_ID IN(".$str_contact_id.")";
$where_str = "";
if ( $_REQUEST['CUSTOMER_NAME'] != "" )
{
$where_str .= " and c.CUSTOMER_NAME like '%".$_REQUEST['CUSTOMER_NAME']."%'";
}
if ( $_REQUEST['CONTACT_DATE'] != "" )
{
$where_str .= " and to_days(ct.CONTACT_DATE) > to_days('".$_REQUEST['CONTACT_DATE']."')";
}
if ( $_REQUEST['CONTACT_DATE2'] != "" )
{
$where_str .= " and to_days(ct.CONTACT_DATE) < to_days('".$_REQUEST['CONTACT_DATE2']."')";
}
if ( $_REQUEST['CONTACT_CONTENT'] != "" )
{
$where_str .= " and ct.CONTACT_CONTENT like '%".$_REQUEST['CONTACT_CONTENT']."%'";
}
if ( $_REQUEST['LINKMAN_NAME'] != "" )
{
$where_str .= " and ct.LINKMAN_NAME like '%".$_REQUEST['LINKMAN_NAME']."%'";
}
if ( $_REQUEST['MEMO'] != "" )
{
$where_str .= " and ct.MEMO like '%".$_REQUEST['MEMO']."%'";
}
$query .= $where_str;
switch ( $_REQUEST['order'] )
{
case "contact_content" :
$query .= " group by ct.CONTACT_ID order by ct.CONTACT_CONTENT";
break;
case "contact_date" :
$query .= " group by ct.CONTACT_ID order by ct.CONTACT_DATE";
break;
case "customer_name" :
$query .= " group by ct.CONTACT_ID order by c.CUSTOMER_NAME";
break;
case "linkman_name" :
$query .= " group by ct.CONTACT_ID order by ct.LINKMAN_NAME";
break;
default :
$query .= " group by ct.CONTACT_ID order by ct.CONTACT_ID";
break;
}
$query .= $_REQUEST['sens'] ? " DESC" : " ASC";
$query = page( $query, 15 );
$cursor = exequery( $connection, $query );
$count = 0;
echo "<table border=\"0\" cellspacing=\"1\" width=\"100%\" cellpadding=\"5\" class=\"small\">\r\n";
while ( $row = mysql_fetch_array( $cursor ) )
{
++$count;
$contact_id = $row['CONTACT_ID'];
$customer_id = $row['CUSTOMER_ID'];
$customer_name = $row['CUSTOMER_NAME'];
$linkman_name = $row['LINKMAN_NAME'];
$linkman_id = $row['LINKMAN_ID'];
$contact_content = $row['CONTACT_CONTENT'];
$contact_date = $row['CONTACT_DATE'];
$contact_date_end = $row['CONTACT_DATE_END'];
$create_user = $row['CREATE_USER'];
$manage_user = $row['MANAGE_USER'];
$purview = $row['PURVIEW'];
$purview_dept = $row['PURVIEW_DEPT'];
$purview_role = $row['PURVIEW_ROLE'];
$purview_user = $row['PURVIEW_USER'];
if ( $count % 2 == 1 )
{
$TableLine = "TableLine1";
}
else
{
$TableLine = "TableLine2";
}
$length = 50;
switch ( $purview )
{
case "1" :
$purview_ses = default_validate( );
break;
case "2" :
$purview_ses = "<a href=\"#\" onclick=\"customer_detail('".$customer_id."');\">".$customer_name."</a>";
break;
case "3" :
$dept_validate = dept_validate( );
$role_validate = role_validate( );
$user_validate = user_validate( );
if ( ( $dept_validate || $role_validate || $user_validate ) === false )
{
$purview_ses = default_validate( );
}
else
{
$purview_ses = "<a href=\"#\" onclick=\"customer_detail('".$customer_id."');\">".$customer_name."</a>";
}
}
if ( $manage_user == $_SESSION['LOGIN_USER_ID'] )
{
$purview_ses = "<a href=\"#\" onclick=\"customer_detail('".$customer_id."');\">".$customer_name."</a>";
}
if ( $purview_ses == false )
{
}
else
{
echo "<tr class=\"";
echo $TableLine;
echo "\">\r\n\t\t<td width=\"35%\" title=\"";
echo $contact_content;
echo "\"><a href=\"#\" onClick=\"contact_detail('";
echo $contact_id;
echo "');\">";
echo strlen( $contact_content ) <= $length ? $contact_content : substr( $contact_content, 0, $length ).chr( 0 )."...";
echo "</a></td>\r\n\t\t<td title='";
echo $customer_name;
echo "'><a href=\"#\" onClick=\"customer_detail('";
echo $customer_id;
echo "');\">";
echo strlen( $customer_name ) <= 35 ? $customer_name : substr( $customer_name, 0, 35 ).chr( 0 )."...";
echo "</a></td>\r\n\t\t<td title='";
echo $linkman_name;
echo "'><a href=\"#\" onClick=\"linkman_detail('";
echo $linkman_id;
echo "');\">";
echo strlen( $linkman_name ) <= 35 ? $linkman_name : substr( $linkman_name, 0, 35 ).chr( 0 )."...";
echo "</a></td>\r\n\t\t<td>";
echo $contact_date." 至 ".$contact_date_end;
echo "</td>\r\n\t</tr>\r\n";
}
}
echo "<center>";
if ( $count == 0 )
{
message( "提示", "暂无记录" );
exit( );
}
echo "</center>";
$sens = $_REQUEST['sens'] ? 0 : 1;
$sensimg = $_REQUEST['sens'] ? "arrow_up.gif" : "arrow_down.gif";
$sensimg = "/images/".$sensimg;
$sufurl = $_SERVER['PHP_SELF']."?sens=".$sens;
echo "\t<thead class=\"TableHeader\">\r\n\t\t<td><a href=\"";
echo $sufurl;
echo "&order=contact_content&cur_page=";
echo $cur_page;
echo "&CUSTOMER_ID2=";
echo $customer_id;
echo "\">交往内容";
if ( $_REQUEST['order'] == "contact_content" )
{
echo "<img src='".$sensimg."' border='0'>";
}
echo "</a></td>\r\n\t\t<td><a href=\"";
echo $sufurl;
echo "&order=customer_name&cur_page=";
echo $cur_page;
echo "&CUSTOMER_ID2=";
echo $customer_id;
echo "\">所属客户";
if ( $_REQUEST['order'] == "customer_name" )
{
echo "<img src='".$sensimg."' border='0'>";
}
echo "</a></td>\r\n\t\t<td><a href=\"";
echo $sufurl;
echo "&order=linkman_name&cur_page=";
echo $cur_page;
echo "&CUSTOMER_ID2=";
echo $customer_id;
echo "\">联系人";
if ( $_REQUEST['order'] == "linkman_name" )
{
echo "<img src='".$sensimg."' border='0'>";
}
echo "</a></td>\r\n\t\t<td><a href=\"";
echo $sufurl;
echo "&order=contact_date&cur_page=";
echo $cur_page;
echo "&CUSTOMER_ID2=";
echo $customer_id;
echo "\">交往日期";
if ( $_REQUEST['order'] == "contact_date" )
{
echo "<img src='".$sensimg."' border='0'>";
}
echo "</a></td>\r\n\t</thead>\r\n</table>\r\n<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"5\">\r\n\t<tr>\r\n\t\t<td class=\"TableLine1\" nowrap align=\"right\">";
disp( "sens=".$_REQUEST['sens']."&order=".$_REQUEST['order'] );
echo "</td>\r\n\t</tr>\r\n</table>\r\n";
if ( 0 < ( $n = $_REQUEST['cur_page'] - $total_page_nums ) )
{
$cur_page = $_REQUEST['cur_page'] - $n;
header( "location:".$_SERVER['PHP_SELF']."?&order=".$_REQUEST['order']."&sens=".$_REQUEST['sens']."&cur_page=".$cur_page );
}
echo "</body>\r\n</html>\r\n";
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -