⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 index.php

📁 泛微协同办公系统标准版E-office V5.5的源代码内含泛微办公系统V5.5自动注册文件。
💻 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.*, u.USER_NAME FROM customer as c, USER as u WHERE 1 group by c.CUSTOMER_NAME";
switch ( $_REQUEST['order'] )
{
case "customer_name" :
	$query .= " order by c.CUSTOMER_NAME";
	break;
case "tel_no" :
	$query .= " order by c.TEL_NO";
	break;
default :
	$query .= " order by c.CUSTOMER_ID";
	break;
}
$query .= $_REQUEST['sens'] ? " ASC" : " DESC";
$cursor = exequery( $connection, $query );
while ( $row = mysql_fetch_array( $cursor ) )
{
	$customer_id = $row['CUSTOMER_ID'];
	$old_customer_name = $row['CUSTOMER_NAME'];
	$tel_no = $row['TEL_NO'];
	$fax_no = $row['FAX_NO'];
	$customer_www = $row['CUSTOMER_WWW'];
	$email = $row['EMAIL'];
	$customer_add = $row['CUSTOMER_ADD'];
	$postalcode = $row['POSTALCODE'];
	$memo = $row['MEMO'];
	$manage_user = $row['MANAGE_USER'];
	$customer_type = $row['CUSTOMER_TYPE'];
	$purview = $row['PURVIEW'];
	$purview_dept = $row['PURVIEW_DEPT'];
	$purview_role = $row['PURVIEW_ROLE'];
	$purview_user = $row['PURVIEW_USER'];
	$user_name = $row['USER_NAME'];
	$query2 = "select LINKMAN_ID, LINKMAN_NAME from linkman where CUSTOMER_ID=".$customer_id;
	$cursor2 = exequery( $connection, $query2 );
	if ( $row2 = mysql_fetch_row( $cursor2 ) )
	{
		$linkman_id = $row2[0];
		$linkman_name = $row2[1];
	}
	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'] || $manage_user == "" )
	{
		$purview_ses = "<a href=\"#\" onclick=\"customer_detail('".$customer_id."');\">".$customer_name."</a>";
	}
	if ( $purview_ses == false )
	{
	}
	else
	{
		$str_customer_id .= $customer_id.",";
	}
}
$str_customer_id = substr( $str_customer_id, 0, -1 );
$str_customer_id = $str_customer_id == "" ? 0 : $str_customer_id;
$query = "SELECT c.*, u.USER_NAME FROM customer as c, USER as u WHERE 1 and c.CUSTOMER_ID IN(".$str_customer_id.") group by c.CUSTOMER_NAME";
switch ( $_REQUEST['order'] )
{
case "customer_name" :
	$query .= " order by c.CUSTOMER_NAME";
	break;
case "tel_no" :
	$query .= " order by c.TEL_NO";
	break;
default :
	$query .= " order by c.CUSTOMER_ID";
	break;
}
$query .= $_REQUEST['sens'] ? " ASC" : " DESC";
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 search_click(){\r\n\turl\t= \"search.php\";\r\n\tlocation = url;\r\n}\r\n\r\nfunction linkman(CUSTOMER_ID)\r\n{\r\n\tURL=\"../../../crm/linkman/query/list.php?BE_CALLED=YES&CUSTOMER_ID2=\"+CUSTOMER_ID;\r\n\tmyleft=(screen.availWidth-800)/2;\r\n\twindow.open(URL,\"read_notify\",\"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 contact";
echo "(CUSTOMER_ID)\r\n{\r\n\tURL=\"../../../crm/contact/query/list.php?BE_CALLED=YES&CUSTOMER_ID2=\"+CUSTOMER_ID;\r\n\tmyleft=(screen.availWidth-800)/2;\r\n\twindow.open(URL,\"read_notify\",\"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 product(CUSTOMER_ID)\r\n{\r\n\tURL=\"../../../sale/sale_history/query/list.php?BE_CALLED=YES&CUSTOMER_ID2=\"+";
echo "CUSTOMER_ID;\r\n\tmyleft=(screen.availWidth-800)/2;\r\n\twindow.open(URL,\"read_notify\",\"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= \"../detail.php?CUSTOMER_ID=\"+customer_id;\r\n\twindow.open(url,\"\",\"height=650,width=900,status=1,toolbar=no,menubar=no,location=no,scrollbars=yes,top=";
echo "30,left=30,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\r\nfunction exports(str){\r\n\tlocation\t= \"export.php?query=\"+str+\"&export_type=index\";\r\n}\r\n</script>\r\n</head>\r\n\r\n<body class=\"bodycolor\" t";
echo "opmargin=\"5\">\r\n<table border=\"0\" width=\"100%\" cellspacing=\"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=\"search_click();\" 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> <BUTTON class=btn onClick=\"javascript:exports('";
echo $query;
echo "');\" 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<table border=\"0\" cellspacing=\"1\" width=\"100%\" cellpadding=\"5\" class=\"small\">\r\n";
$query = page( $query, 15 );
$cursor = exequery( $connection, $query );
$count = 0;
while ( $row = mysql_fetch_array( $cursor ) )
{
	++$count;
	$customer_id = $row['CUSTOMER_ID'];
	$old_customer_name = $row['CUSTOMER_NAME'];
	$tel_no = $row['TEL_NO'];
	$fax_no = $row['FAX_NO'];
	$customer_www = $row['CUSTOMER_WWW'];
	$email = $row['EMAIL'];
	$customer_add = $row['CUSTOMER_ADD'];
	$postalcode = $row['POSTALCODE'];
	$memo = $row['MEMO'];
	$manage_user = $row['MANAGE_USER'];
	$customer_type = $row['CUSTOMER_TYPE'];
	$purview = $row['PURVIEW'];
	$purview_dept = $row['PURVIEW_DEPT'];
	$purview_role = $row['PURVIEW_ROLE'];
	$purview_user = $row['PURVIEW_USER'];
	$user_name = $row['USER_NAME'];
	$query2 = "select LINKMAN_ID, LINKMAN_NAME from linkman where CUSTOMER_ID=".$customer_id." ORDER BY MOSTLY_LINKMAN DESC LIMIT 0,1";
	$cursor2 = exequery( $connection, $query2 );
	if ( $row2 = mysql_fetch_row( $cursor2 ) )
	{
		$linkman_id = $row2[0];
		$linkman_name = $row2[1];
	}
	$customer_name = strlen( $old_customer_name ) <= 35 ? $old_customer_name : substr( $old_customer_name, 0, 35 ).chr( 0 )."...";
	if ( $count % 2 == 1 )
	{
		$TableLine = "TableLine1";
	}
	else
	{
		$TableLine = "TableLine2";
	}
	switch ( $customer_type )
	{
	case "1" :
		$c_title = "正式客户";
		$c_img = "<img src='../../../../images/littlegif/1-formal.gif' border='0'>";
		break;
	case "2" :
		$c_title = "重要客户";
		$c_img = "<img src='../../../../images/littlegif/2-emphasis.gif' border='0'>";
		break;
	case "3" :
		$c_title = "潜在客户";
		$c_img = "<img src='../../../../images/littlegif/3-latent.gif' border='0'>";
		break;
	case "4" :
		$c_title = "无效客户";
		$c_img = "<img src='../../../../images/littlegif/4-useless.gif' border='0'>";
		break;
	default :
		$c_title = "无状态";
		$c_img = "";
		break;
	}
	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'] || $manage_user == "" )
	{
		$purview_ses = "<a href=\"#\" onclick=\"customer_detail('".$customer_id."');\">".$customer_name."</a>";
	}
	if ( $manage_user != "" )
	{
		$sqlus = "SELECT USER_NAME FROM user WHERE USER_ID='".$manage_user."'";
		$rsus = exequery( $connection, $sqlus );
		$rowus = mysql_fetch_array( $rsus );
		$user_name = $rowus['USER_NAME'];
	}
	else
	{
		$user_name = "";
	}
	if ( $purview_ses == false )
	{
	}
	else
	{
		echo "<tr class=\"";
		echo $TableLine;
		echo "\">\r\n\t\t<td title=\"";
		echo $c_title;
		echo "\">";
		echo $c_img;
		echo "</td>\r\n\t\t<td width='30%' title='";
		echo $old_customer_name;
		echo "'>";
		echo $purview_ses;
		echo "</td>\r\n\t\t<td title='";
		echo $linkman_name;
		echo "'><a href=\"#\" onclick=\"linkman_detail('";
		echo $linkman_id;
		echo "')\">";
		echo $linkman_name;
		echo "</a></td>\r\n\t\t<td title='";
		echo $tel_no;
		echo "'>";
		echo strlen( $tel_no ) <= 20 ? $tel_no : substr( $tel_no, 0, 20 ).chr( 0 )."...";
		echo "</td>\r\n\t\t<td>";
		echo $user_name;
		echo "</td>\r\n\t\t<td>\r\n\t\t<a href=\"javascript:linkman('";
		echo $customer_id;
		echo "');\">联系人 </a>\r\n        <a href=\"javascript:contact('";
		echo $customer_id;
		echo "');\">交往记录 </a>\r\n        <a href=\"javascript:product('";
		echo $customer_id;
		echo "');\">销售记录 </a></td>\r\n\t</tr>\r\n";
		unset( $linkman_id );
		unset( $linkman_name );
	}
}
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 width=\"3%\" align=\"center\" style=\"color:#FF0000;\" title=\"客户类型\">!</td>\r\n\t\t<td><a href=\"";
echo $sufurl;
echo "&order=customer_name&cur_page=";
echo $cur_page;
echo "\">客户名称";
if ( $_REQUEST['order'] == "customer_name" )
{
	echo "<img src='".$sensimg."' border='0'>";
}
echo "</a></td>\r\n\t\t<td>联系人</td>\r\n\t\t<td><a href=\"";
echo $sufurl;
echo "&order=tel_no&cur_page=";
echo $cur_page;
echo "\">电话";
if ( $_REQUEST['order'] == "tel_no" )
{
	echo "<img src='".$sensimg."' border='0'>";
}
echo "</a></td>\r\n\t\t<td>客户经理</td>\r\n\t\t<td width='20%'>操作</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 + -