<?php
!defined('IN_TOA') && exit('Access Denied!');
function get_menu_home($fatherid=0){
    global $db;
	$sql="SELECT * FROM ".DB_TABLEPRE.DB_JT."menu where fatherid='$fatherid' and menutype!=1 ORDER BY menunum Asc";
	$query = $db->query($sql);
	if(count($query)>0){
		while ($row = $db->fetch_array($query)) {
			$rsfno = $db->fetch_one_array("SELECT * FROM ".DB_TABLEPRE.DB_JT."menu where fatherid='".$row[menuid]."' and menutype!=1 ORDER BY menunum asc limit 0,1");
				if($row[keytable]!=''){
					if(is_superadmin() || check_purview($row[keytable])){
						if ( file_exists('template/default/ico/'.$row['menuid'].'.png') ) {
							$row['icoid']=$row['menuid'];
						}else{
							$row['icoid']='0';
						}
						$htmlviews.='{'.chr(13).chr(10);
						$htmlviews.='windowsId: "menu'.$row['menuid'].'",';
						$htmlviews.='iconSrc: "template/default/ico/'.$row['icoid'].'.png",';
						$htmlviews.='windowTitle: "'.$row['menuname'].'",';
						if($rsfno[menuid]!=''){
							$htmlviews.='childItem:['.chr(13).chr(10);
							$htmlviews.='['.chr(13).chr(10);
								$htmlviews.=get_menu_home($row['menuid']);
							$htmlviews.=']'.chr(13).chr(10);
						    $htmlviews.=']'.chr(13).chr(10);
						}else{
							
							$htmlviews.='iframSrc: "'.$row['menuurl'].'",';
							$htmlviews.='windowWidth: 1024,';
							$htmlviews.='windowHeight: 600';
						}
						$htmlviews.='},'.chr(13).chr(10);
					}
				}else{
						if ( file_exists('template/default/ico/'.$row['menuid'].'.png') ) {
							$row['icoid']=$row['menuid'];
						}else{
							$row['icoid']='0';
						}
						$htmlviews.='{'.chr(13).chr(10);
						$htmlviews.='windowsId: "menu'.$row['menuid'].'",';
						$htmlviews.='iconSrc: "template/default/ico/'.$row['icoid'].'.png",';
						$htmlviews.='windowTitle: "'.$row['menuname'].'",';
						if($rsfno[menuid]!=''){
							$htmlviews.='childItem:['.chr(13).chr(10);
							$htmlviews.='['.chr(13).chr(10);
								$htmlviews.=get_menu_home($row['menuid']);
							$htmlviews.=']'.chr(13).chr(10);
						    $htmlviews.=']'.chr(13).chr(10);
						}else{
							
							$htmlviews.='iframSrc: "'.$row['menuurl'].'",';
							$htmlviews.='windowWidth: 1024,';
							$htmlviews.='windowHeight: 600';
						}
						$htmlviews.='},'.chr(13).chr(10);
				}
						
			
		}
	}
   return substr($htmlviews, 0, -3);

}
/************************************************************/
/*内容统计小控件模块
************************/
//公文
function _App_Ico(){
    global $db;
	$num1 = $db->result("SELECT COUNT(*) AS num1 FROM ".DB_TABLEPRE.DB_JT."apps a,".DB_TABLEPRE.DB_JT."app_personnel b WHERE 1 $wheresql and  a.id=b.appid and (b.pertype=0 or b.pertype=4) and b.usernum like '%".get_realname($_USER->id)."%' and a.type!=1 order by b.perid desc");
	//$num2 = $db->result("SELECT COUNT(*) AS num2 FROM ".DB_TABLEPRE.DB_JT."apps a,".DB_TABLEPRE.DB_JT."app_personnel b WHERE 1 $wheresql and a.id=b.appid and b.pertype!=0 and b.userend like '%".get_realname($_USER->id)."%' order by b.perid desc");
	$html='';
	$html.='<div class="col-lg-3 col-md-3 col-sm-6 col-xs-12">';
    $html.='<div class="databox bg-white radius-bordered">';
    $html.='<div class="databox-left bg-themesecondary">';
    $html.='<div class="databox-piechart">';
    $html.='<div data-toggle="easypiechart" class="easyPieChart" data-barcolor="#fff" data-linecap="butt" data-percent="'.$num1.'" data-linewidth="3" data-size="47" data-trackcolor="rgba(255,255,255,0.1)">';
	$html.='<span class="white font-90">'.$num1.'%</span></div>';
    $html.='</div>';
    $html.='</div>';
    $html.='<div class="databox-right">';
    $html.='<span class="databox-number themesecondary">'.$num1.'</span>';
    $html.='<div class="databox-text themesecondary">公文办理</div>';
    $html.='<div class="databox-stat themesecondary radius-bordered">';
    $html.='<i class="stat-icon icon-lg fa fa-folder-open-o"></i>';
    $html.='</div>';
    $html.='</div>';
    $html.='</div>';
    $html.='</div>';
	echo   $html;
}
//工作流
function _WorkClass_Ico(){
    global $db;
	global $_USER;
	$num = $db->result("SELECT COUNT(*) AS num FROM ".DB_TABLEPRE.DB_JT."workclass a,".DB_TABLEPRE.DB_JT."workclass_personnel b WHERE 1 $wheresql and  a.id=b.workid and (b.pertype=0 or b.pertype=4) and b.usernum like '%".get_realname($_USER->id)."%' and a.type!=1 order by b.perid desc");
	$html='';
	$html.='<div class="col-lg-3 col-md-3 col-sm-6 col-xs-12">';
    $html.='<div class="databox bg-white radius-bordered">';
    $html.='<div class="databox-left bg-themeprimary">';
    $html.='<div class="databox-piechart">';
    $html.='<div data-toggle="easypiechart" class="easyPieChart" data-barcolor="#fff" data-linecap="butt" data-percent="'.$num.'" data-linewidth="3" data-size="47" data-trackcolor="rgba(255,255,255,0.1)">';
	$html.='<span class="white font-90">'.$num.'%</span></div>';
    $html.='</div>';
    $html.='</div>';
    $html.='<div class="databox-right">';
    $html.='<span class="databox-number themeprimary">'.$num.'</span>';
    $html.='<div class="databox-text themeprimary">流程办理</div>';
    $html.='<div class="databox-stat themeprimary radius-bordered">';
    $html.='<i class="stat-icon icon-lg fa fa-retweet"></i>';
    $html.='</div>';
    $html.='</div>';
    $html.='</div>';
    $html.='</div>';
	echo $html;
}
//消息
function _Sms_Ico(){
    global $db;
	global $_USER;
	$num = $db->result("SELECT COUNT(*) AS num FROM ".DB_TABLEPRE."sms_receive WHERE receiveuser='".$_USER->id."' and smskey=1");
	$html='';
	$html.='<div class="col-lg-3 col-md-3 col-sm-6 col-xs-12">';
    $html.='<div class="databox bg-white radius-bordered">';
    $html.='<div class="databox-left bg-slate-gray">';
    $html.='<div class="databox-piechart">';
    $html.='<div data-toggle="easypiechart" class="easyPieChart" data-barcolor="#fff" data-linecap="butt" data-percent="'.$num.'" data-linewidth="3" data-size="47" data-trackcolor="rgba(255,255,255,0.1)">';
	$html.='<span class="white font-90">'.$num.'%</span></div>';
    $html.='</div>';
    $html.='</div>';
    $html.='<div class="databox-right">';
    $html.='<span class="databox-number slate-gray">'.$num.'</span>';
    $html.='<div class="databox-text slate-gray">短消息</div>';
    $html.='<div class="databox-stat slate-gray radius-bordered">';
    $html.='<i class="stat-icon icon-lg fa fa-comment-o"></i>';
    $html.='</div>';
    $html.='</div>';
    $html.='</div>';
    $html.='</div>';
	echo $html;
}
//邮件
function _Email_Ico(){
    global $db;
	global $_USER;
	$num = $db->result("SELECT COUNT(*) AS num FROM ".DB_TABLEPRE.DB_JT."recemail WHERE receuser='".$_USER->id."' AND type='0' order by date desc");
	$html='';
	$html.='<div class="col-lg-3 col-md-3 col-sm-6 col-xs-12">';
    $html.='<div class="databox bg-white radius-bordered">';
    $html.='<div class="databox-left bg-themethirdcolor">';
    $html.='<div class="databox-piechart">';
    $html.='<div data-toggle="easypiechart" class="easyPieChart" data-barcolor="#fff" data-linecap="butt" data-percent="'.$num.'" data-linewidth="3" data-size="47" data-trackcolor="rgba(255,255,255,0.1)">';
	$html.='<span class="white font-90">'.$num.'%</span></div>';
    $html.='</div>';
    $html.='</div>';
    $html.='<div class="databox-right">';
    $html.='<span class="databox-number themethirdcolor">'.$num.'</span>';
    $html.='<div class="databox-text themethirdcolor">邮件</div>';
    $html.='<div class="databox-stat themethirdcolor radius-bordered">';
    $html.='<i class="stat-icon icon-lg fa fa-envelope-o"></i>';
    $html.='</div>';
    $html.='</div>';
    $html.='</div>';
    $html.='</div>';
	echo $html;
}
//集团审批
function _JiTuan_Ico(){
    global $db;
	global $_USER;
	$num = $db->result("SELECT COUNT(*) AS num FROM ".DB_TABLEPRE."jituan a,".DB_TABLEPRE."jituan_personnel b WHERE 1 $wheresql and  a.id=b.workid and (b.pertype=0 or b.pertype=4) and b.usernum like '%".get_realname($_USER->id)."%' and a.type!=1 order by b.perid desc");
	$html='';
	$html.='<div class="col-lg-3 col-md-3 col-sm-6 col-xs-12">';
    $html.='<div class="databox bg-white radius-bordered">';
    $html.='<div class="databox-left bg-info">';
    $html.='<div class="databox-piechart">';
    $html.='<div data-toggle="easypiechart" class="easyPieChart" data-barcolor="#fff" data-linecap="butt" data-percent="'.$num.'" data-linewidth="3" data-size="47" data-trackcolor="rgba(255,255,255,0.1)">';
	$html.='<span class="white font-90">'.$num.'%</span></div>';
    $html.='</div>';
    $html.='</div>';
    $html.='<div class="databox-right">';
    $html.='<span class="databox-number info">'.$num.'</span>';
    $html.='<div class="databox-text info">集团审批</div>';
    $html.='<div class="databox-stat info radius-bordered">';
    $html.='<i class="stat-icon icon-lg fa fa-qrcode"></i>';
    $html.='</div>';
    $html.='</div>';
    $html.='</div>';
    $html.='</div>';
	echo  $html;
}
//会议服务
function _Conference_Ico(){
    global $db;
	global $_USER;
	$num = $db->result("SELECT COUNT(*) AS num FROM ".DB_TABLEPRE.DB_JT."conference WHERE attendance LIKE '%".get_realname($_USER->id)."%' ORDER BY id desc");
	$html='';
	$html.='<div class="col-lg-3 col-md-3 col-sm-6 col-xs-12">';
    $html.='<div class="databox bg-white radius-bordered">';
    $html.='<div class="databox-left bg-pink">';
    $html.='<div class="databox-piechart">';
    $html.='<div data-toggle="easypiechart" class="easyPieChart" data-barcolor="#fff" data-linecap="butt" data-percent="'.$num.'" data-linewidth="3" data-size="47" data-trackcolor="rgba(255,255,255,0.1)">';
	$html.='<span class="white font-90">'.$num.'%</span></div>';
    $html.='</div>';
    $html.='</div>';
    $html.='<div class="databox-right">';
    $html.='<span class="databox-number pink">'.$num.'</span>';
    $html.='<div class="databox-text pink">待参加会议</div>';
    $html.='<div class="databox-stat pink radius-bordered">';
    $html.='<i class="stat-icon icon-lg fa fa-volume-up"></i>';
    $html.='</div>';
    $html.='</div>';
    $html.='</div>';
    $html.='</div>';
	echo  $html;
}
//任务管理
//工作计划
//通知公告
function _News_Ico(){
    global $db;
	global $_USER;
	$num = $db->result("SELECT COUNT(*) AS num FROM ".DB_TABLEPRE.DB_JT."news WHERE (receive like'%".get_realname($_USER->id)."%' or receive='0') and (type=3 or type=4) ORDER BY id desc");
	$html='';
	$html.='<div class="col-lg-3 col-md-3 col-sm-6 col-xs-12">';
    $html.='<div class="databox bg-white radius-bordered">';
    $html.='<div class="databox-left bg-maroon">';
    $html.='<div class="databox-piechart">';
    $html.='<div data-toggle="easypiechart" class="easyPieChart" data-barcolor="#fff" data-linecap="butt" data-percent="'.$num.'" data-linewidth="3" data-size="47" data-trackcolor="rgba(255,255,255,0.1)">';
	$html.='<span class="white font-90">'.$num.'%</span></div>';
    $html.='</div>';
    $html.='</div>';
    $html.='<div class="databox-right">';
    $html.='<span class="databox-number maroon">'.$num.'</span>';
    $html.='<div class="databox-text maroon">通知公告</div>';
    $html.='<div class="databox-stat maroon radius-bordered">';
    $html.='<i class="stat-icon icon-lg fa fa-bullhorn"></i>';
    $html.='</div>';
    $html.='</div>';
    $html.='</div>';
    $html.='</div>';
	echo  $html;
}




/************************************************************/
/*内容显示模块
************************/
//工作流
function _WorkClass_Info(){
	global $db;
	global $_USER;
	$html='';
	$html.='<div class="col-lg-6 col-sm-6 col-xs-12">';
	$html.='<div class="widget">';
	$html.='<div class="widget-header bordered-top bordered-sky">';
	$html.='<i class="widget-icon fa fa-retweet sky"></i><span class="widget-caption sky">流程审批</span>';
	$html.='</div>';
	$html.='<div class="widget-body">';
	$html.='<div id="WorkClass_Info">';
	$query = $db->query("SELECT a.* FROM ".DB_TABLEPRE.DB_JT."workclass a,".DB_TABLEPRE.DB_JT."workclass_personnel b WHERE 1 $wheresql and  a.id=b.workid and (b.pertype=0 or b.pertype=4) and b.usernum like '%".get_realname($_USER->id)."%' and a.type!=1 order by b.perid desc");
	while ($row = $db->fetch_array($query)) {	
		$html.='<div class="pclass"><i class="stat-icon icon-lg fa fa-angle-right"></i>【'.public_value('typename',DB_JT.'workclass_type','tid='.$row['typeid']).'】<a href="admin.php?ac=workadd&fileurl=workclass&workid='.$row['id'].'&typeid='.$row['typeid'].'&tplid='.$row['tplid'].'" target="_blank">'.$row['title'].'</a></div>';
	}
	$html.='</div></div>';
	$html.='</div>';
	$html.='</div>';
	$html.='<script type="text/javascript">_Home_Scroll("#11a9cc","WorkClass_Info")';
	$html.=';</script>';
	echo  $html;
}
//公文
function _Apps_Info(){
	global $db;
	global $_USER;
	$html='';
	$html.='<div class="col-lg-6 col-sm-6 col-xs-12">';
	$html.='<div class="widget">';
	$html.='<div class="widget-header bordered-top bordered-themesecondary">';
	$html.='<i class="widget-icon fa fa-folder-open themesecondary"></i><span class="widget-caption themesecondary">公文办理</span>';
	$html.='</div>';
	$html.='<div class="widget-body">';
	$html.='<div id="Apps_Info">';
	$query = $db->query("SELECT a.* FROM ".DB_TABLEPRE.DB_JT."apps a,".DB_TABLEPRE.DB_JT."app_personnel b WHERE 1 $wheresql and  a.id=b.appid and (b.pertype=0 or b.pertype=4) and b.usernum like '%".get_realname($_USER->id)."%' and a.type!=1 order by b.perid desc");
	while ($row = $db->fetch_array($query)) {	
		$html.='<div class="pclass"><i class="stat-icon icon-lg fa fa-angle-right"></i>【'.public_value('title',DB_JT.'app_type','tplid='.$row['tplid']).'】<a href="admin.php?ac=add&fileurl=apps&appid='.$row['id'].'&tplid='.$row['tplid'].'&tpltype='.$row['tpltype'].'" target="_blank">'.$row['title'].'</a></div>';
	}
	$html.='</div></div>';
	$html.='</div>';
	$html.='</div>';
	$html.='<script type="text/javascript">_Home_Scroll("#fb6e52","Apps_Info")';
	$html.=';</script>';
	echo  $html;
}
//集团审批
function _JiTuan_Info(){
	global $db;
	global $_USER;
	$html='';
	$html.='<div class="col-lg-6 col-sm-6 col-xs-12">';
	$html.='<div class="widget">';
	$html.='<div class="widget-header bordered-top bordered-info">';
	$html.='<i class="widget-icon fa fa-qrcode info"></i><span class="widget-caption info">集团审批</span>';
	$html.='</div>';
	$html.='<div class="widget-body">';
	$html.='<div id="JiTuan_Info">';
	$query = $db->query("SELECT a.* FROM ".DB_TABLEPRE."jituan a,".DB_TABLEPRE."jituan_personnel b WHERE 1 $wheresql and  a.id=b.workid and (b.pertype=0 or b.pertype=4) and b.usernum like '%".get_realname($_USER->id)."%' and a.type!=1 order by b.perid desc");
	while ($row = $db->fetch_array($query)) {	
		$html.='<div class="pclass"><i class="stat-icon icon-lg fa fa-angle-right"></i>【'.public_value('typename','jituan_type','tid='.$row['typeid']).'】<a href="admin.php?ac=workadd&fileurl=jituan&workid='.$row['id'].'&typeid='.$row['typeid'].'&tplid='.$row['tplid'].'" target="_blank">'.$row['title'].'</a></div>';
	}
	$html.='</div></div>';
	$html.='</div>';
	$html.='</div>';
	$html.='<script type="text/javascript">_Home_Scroll("#57b5e3","JiTuan_Info")';
	$html.=';</script>';
	echo  $html;
}
//公告
function _News_Info($type,$name,$ico){
	global $db;
	global $_USER;
	$q1 = $db->fetch_one_array("SELECT title FROM ".DB_TABLEPRE.DB_JT."homekey  WHERE modname like '%tscx".$name."tscx%'");
	$html='';
	$html.='<div class="col-lg-6 col-sm-6 col-xs-12">';
	$html.='<div class="widget">';
	$html.='<div class="widget-header bordered-top bordered-darkgray">';
	$html.='<i class="widget-icon fa '.$ico.' darkgray"></i><span class="widget-caption darkgray">'.$q1['title'].'</span>';
	$html.='</div>';
	$html.='<div class="widget-body">';
	$html.='<div id="News_Info'.$type.'">';
	$query = $db->query("SELECT * FROM ".DB_TABLEPRE.DB_JT."news WHERE (receive like'%".get_realname($_USER->id)."%' or receive='0' or uid='".$_USER->id."') and type ='".$type."' ORDER BY id desc LIMIT 0,20");
	while ($row = $db->fetch_array($query)) {	
		$html.='<div class="pclass"><i class="stat-icon icon-lg fa fa-angle-right"></i> <a href="admin.php?ac=news&fileurl=workbench&do=views&id='.$row['id'].'&type='.$row['type'].'" target="_blank">'.$row['subject'].'</a></div>';
	}
	$html.='</div></div>';
	$html.='</div>';
	$html.='</div>';
	$html.='<script type="text/javascript">_Home_Scroll("#999","News_Info'.$type.'")';
	$html.=';</script>';
	echo  $html;
}

//日程安排
function _WorkDate_Info(){
	global $db;
	global $_USER;
	$html='';
	$html.='<div class="col-lg-6 col-sm-6 col-xs-12">';
	$html.='<div class="widget">';
	$html.='<div class="widget-header bordered-top bordered-primary">';
	$html.='<i class="widget-icon fa fa-calendar primary"></i><span class="widget-caption primary">日程安排</span>';
	$html.='</div>';
	$html.='<div class="widget-body">';
	$html.='<div id="WorkDate_Info">';
	$query = $db->query("SELECT * FROM ".DB_TABLEPRE.DB_JT."workdate WHERE uid =".$_USER->id." ORDER BY id desc LIMIT 0,20");
	while ($row = $db->fetch_array($query)) {	
		$html.='<div class="pclass"><i class="stat-icon icon-lg fa fa-angle-right"></i> <a href="admin.php?ac=workdate&fileurl=workbench&do=views&id='.$row['id'].'" target="_blank">'.cut_str(strip_tags($row['content']),74).'</a></div>';
	}
	$html.='</div></div>';
	$html.='</div>';
	$html.='</div>';
	$html.='<script type="text/javascript">_Home_Scroll("#4374e0","WorkDate_Info")';
	$html.=';</script>';
	echo  $html;
}
//工作计划
function _Plan_Info(){
	global $db;
	global $_USER;
	$html='';
	$html.='<div class="col-lg-6 col-sm-6 col-xs-12">';
	$html.='<div class="widget">';
	$html.='<div class="widget-header bordered-top bordered-azure">';
	$html.='<i class="widget-icon fa fa-calendar-o azure"></i><span class="widget-caption azure">工作计划</span>';
	$html.='</div>';
	$html.='<div class="widget-body">';
	$html.='<div id="Plan_Info">';
	$query = $db->query("SELECT * FROM ".DB_TABLEPRE.DB_JT."plan WHERE uid = $_USER->id or participation LIKE '%".get_realname($_USER->id)."%' or person LIKE '%".get_realname($_USER->id)."%' ORDER BY id desc LIMIT 0,20");
	while ($row = $db->fetch_array($query)) {	
		$html.='<div class="pclass"><i class="stat-icon icon-lg fa fa-angle-right"></i>【';
		if($row['completiondate']!=''){
			$html.="<span style='color:#006600;'>已结束</span>";
		}else{
			$html.="未结束";
		}
		$html.='】<a href="admin.php?ac=plan&fileurl=workbench&do=views&id='.$row['id'].'" target="_blank">'.$row['title'].'</a> 结束时间:'.$row['enddate'].'</div>';
	}
	$html.='</div></div>';
	$html.='</div>';
	$html.='</div>';
	$html.='<script type="text/javascript">_Home_Scroll("#2dc3e8","Plan_Info")';
	$html.=';</script>';
	echo  $html;
}
//我的任务
function _Duty_Info(){
	global $db;
	global $_USER;
	$html='';
	$html.='<div class="col-lg-6 col-sm-6 col-xs-12">';
	$html.='<div class="widget">';
	$html.='<div class="widget-header bordered-top bordered-blueberry">';
	$html.='<i class="widget-icon fa  fa-sign-out blueberry"></i><span class="widget-caption blueberry">我的任务</span>';
	$html.='</div>';
	$html.='<div class="widget-body">';
	$html.='<div id="Duty_Info">';
	$query = $db->query("SELECT * FROM ".DB_TABLEPRE.DB_JT."duty WHERE uid='".$_USER->id."' or user like '%".get_realname($_USER->id)."%' ORDER BY id desc LIMIT 0,20");
	while ($row = $db->fetch_array($query)) {	
		$html.='<div class="pclass"><i class="stat-icon icon-lg fa fa-angle-right"></i>【';
		if($row['dkey']=='1'){
			$html.= "进行中";
		}elseif($row['dkey']=='2'){
			$html.= "<font color=red>未完成</font>";
		}else{
			$html.= "<font color=#006600>己完成</font>";
		}
		$html.='】<a href="admin.php?ac=duty&do=view&fileurl=duty&id='.$row['id'].'" target="_blank">'.$row['title'].'</a></div>';
	}
	$html.='</div></div>';
	$html.='</div>';
	$html.='</div>';
	$html.='<script type="text/javascript">_Home_Scroll("#6f85bf","Duty_Info")';
	$html.=';</script>';
	echo  $html;
}
//工作日志
function _Blog_Info(){
	global $db;
	global $_USER;
	$html='';
	$html.='<div class="col-lg-6 col-sm-6 col-xs-12">';
	$html.='<div class="widget">';
	$html.='<div class="widget-header bordered-top bordered-palegreen">';
	$html.='<i class="widget-icon fa   fa-pencil-square-o palegreen"></i><span class="widget-caption palegreen">工作日志</span>';
	$html.='</div>';
	$html.='<div class="widget-body">';
	$html.='<div id="Blog_Info">';
	$query = $db->query("SELECT * FROM ".DB_TABLEPRE.DB_JT."blog WHERE user='全部人员' or user like'%".get_realname($_USER->id)."%' or uid = ".$_USER->id." ORDER BY id desc LIMIT 0,20");
	while ($row = $db->fetch_array($query)) {	
		$html.='<div class="pclass"><i class="stat-icon icon-lg fa fa-angle-right"></i>【'.$row['date'].'】<a href="admin.php?ac=blog&fileurl=workbench&do=views&id='.$row['id'].'" target="_blank">'.$row['title'].'</a></div>';
	}
	$html.='</div></div>';
	$html.='</div>';
	$html.='</div>';
	$html.='<script type="text/javascript">_Home_Scroll("#a0d468","Blog_Info")';
	$html.=';</script>';
	echo  $html;
}

//个人文件柜
function _DocuMent_Info($type,$name,$ico){
	global $db;
	global $_USER;
	$html='';
	$html.='<div class="col-lg-6 col-sm-6 col-xs-12">';
	$html.='<div class="widget">';
	$html.='<div class="widget-header bordered-top bordered-success">';
	$html.='<i class="widget-icon fa '.$ico.' success"></i><span class="widget-caption success">'.$name.'</span>';
	$html.='</div>';
	$html.='<div class="widget-body">';
	$html.='<div id="DocuMent_Info'.$type.'">';
	$query = $db->query("SELECT * FROM ".DB_TABLEPRE.DB_JT."document WHERE (readuser LIKE'%".get_realname($_USER->id)."%' or uid='".$_USER->id."' or readuser='全体人员') and type=".$type." ORDER BY id desc LIMIT 0,20");
	while ($row = $db->fetch_array($query)) {	
		$html.='<div class="pclass"><i class="stat-icon icon-lg fa fa-angle-right"></i> <a onClick="javascript:window.location=';
		$html.="'downurl.php?urls=".str_replace('../','',$row['annex'])."&filename=".urlencode($row['title'])."'";
		$html.='" href="javascript:;">'.$row['title'].'</a></div>';
	}
	$html.='</div></div>';
	$html.='</div>';
	$html.='</div>';
	$html.='<script type="text/javascript">_Home_Scroll("#53a93f","DocuMent_Info'.$type.'")';
	$html.=';</script>';
	echo  $html;
}

//公共文件柜
//网络硬盘
//下载管理
//规章制度
//报表管理


//知识阅读
function _Knowledge_Info(){
	global $db;
	global $_USER;
	$html='';
	$html.='<div class="col-lg-6 col-sm-6 col-xs-12">';
	$html.='<div class="widget">';
	$html.='<div class="widget-header bordered-top bordered-lightyellow">';
	$html.='<i class="widget-icon fa  fa-ellipsis-h lightyellow"></i><span class="widget-caption lightyellow">知识阅读</span>';
	$html.='</div>';
	$html.='<div class="widget-body">';
	$html.='<div id="Knowledge_Info">';
	$query = $db->query("SELECT * FROM ".DB_TABLEPRE.DB_JT."knowledge WHERE type ='2' or uid = ".$_USER->id." ORDER BY id desc LIMIT 0,20");
	while ($row = $db->fetch_array($query)) {	
		$html.='<div class="pclass"><i class="stat-icon icon-lg fa fa-angle-right"></i> <a href="admin.php?ac=know&fileurl=knowledge&do=views&id='.$row['id'].'" target="_blank">'.$row['title'].'</a></div>';
	}
	$html.='</div></div>';
	$html.='</div>';
	$html.='</div>';
	$html.='<script type="text/javascript">_Home_Scroll("#f6d52e","Knowledge_Info")';
	$html.=';</script>';
	echo  $html;
}
//投票
function _App_Info(){
	global $db;
	global $_USER;
	$html='';
	$html.='<div class="col-lg-6 col-sm-6 col-xs-12">';
	$html.='<div class="widget">';
	$html.='<div class="widget-header bordered-top bordered-orange">';
	$html.='<i class="widget-icon fa fa-gavel orange"></i><span class="widget-caption orange">投票</span>';
	$html.='</div>';
	$html.='<div class="widget-body">';
	$html.='<div id="App_Info">';
	$query = $db->query("SELECT * FROM ".DB_TABLEPRE.DB_JT."app WHERE uid = ".$_USER->id." and (user like '%".get_realname($_USER->id)."%' or user='') ORDER BY id desc LIMIT 0,20");
	while ($row = $db->fetch_array($query)) {	
		$html.='<div class="pclass"><i class="stat-icon icon-lg fa fa-angle-right"></i> <a href="admin.php?ac=app&fileurl=knowledge&do=views&id='.$row['id'].'" target="_blank">'.$row['title'].'</a></div>';
	}
	$html.='</div></div>';
	$html.='</div>';
	$html.='</div>';
	$html.='<script type="text/javascript">_Home_Scroll("#fb6e52","App_Info")';
	$html.=';</script>';
	echo  $html;
}
//论坛
function _Bbs_Info(){
	global $db;
	global $_USER;
	$html='';
	$html.='<div class="col-lg-6 col-sm-6 col-xs-12">';
	$html.='<div class="widget">';
	$html.='<div class="widget-header bordered-top bordered-lightred">';
	$html.='<i class="widget-icon fa fa-comments lightred"></i><span class="widget-caption lightred">论坛</span>';
	$html.='</div>';
	$html.='<div class="widget-body">';
	$html.='<div id="Bbs_Info">';
	$query = $db->query("SELECT * FROM ".DB_TABLEPRE.DB_JT."bbs  ORDER BY id desc LIMIT 0,20");
	while ($row = $db->fetch_array($query)) {	
		$html.='<div class="pclass"><i class="stat-icon icon-lg fa fa-angle-right"></i> <a href="admin.php?ac=bbs&fileurl=knowledge&do=views&id='.$row['id'].'" target="_blank">'.$row['title'].'</a></div>';
	}
	$html.='</div></div>';
	$html.='</div>';
	$html.='</div>';
	$html.='<script type="text/javascript">_Home_Scroll("#e46f61","Bbs_Info")';
	$html.=';</script>';
	echo  $html;
}
//档案管理
function _File_Info(){
	global $db;
	global $_USER;
	$html='';
	$html.='<div class="col-lg-6 col-sm-6 col-xs-12">';
	$html.='<div class="widget">';
	$html.='<div class="widget-header bordered-top bordered-darkorange">';
	$html.='<i class="widget-icon fa fa-suitcase darkorange"></i><span class="widget-caption darkorange">档案借阅</span>';
	$html.='</div>';
	$html.='<div class="widget-body">';
	$html.='<div id="File_Info">';
	$query = $db->query("SELECT * FROM ".DB_TABLEPRE.DB_JT."file_read where appperson=".$_USER->id."  ORDER BY id desc LIMIT 0,20");
	while ($row = $db->fetch_array($query)) {	
		$html.='<div class="pclass"><i class="stat-icon icon-lg fa fa-angle-right"></i>【'.$row['filenumber'].'】<a href="admin.php?ac=views&do=edit&fileurl=file&id='.$row['fileid'].'" target="_blank">'.$row['filename'].'</a></div>';
	}
	$html.='</div></div>';
	$html.='</div>';
	$html.='</div>';
	$html.='<script type="text/javascript">_Home_Scroll("#e46f61","File_Info")';
	$html.=';</script>';
	echo  $html;
}
//项目审批
function _Project_Info(){
	global $db;
	global $_USER;
	$html='';
	$html.='<div class="col-lg-6 col-sm-6 col-xs-12">';
	$html.='<div class="widget">';
	$html.='<div class="widget-header bordered-top bordered-red">';
	$html.='<i class="widget-icon fa fa-building-o red"></i><span class="widget-caption red">项目审批</span>';
	$html.='</div>';
	$html.='<div class="widget-body">';
	$html.='<div id="Project_Info">';
	$query = $db->query("SELECT a.* FROM ".DB_TABLEPRE.DB_JT."project a,".DB_TABLEPRE.DB_JT."project_personnel b WHERE  a.id=b.projectid and (b.pertype=0 or b.pertype=4) and b.name like '%".get_realname($_USER->id)."%' and a.type!=1 and b.appkey2=1 order by b.perid asc");
	while ($row = $db->fetch_array($query)) {	
		$html.='<div class="pclass"><i class="stat-icon icon-lg fa fa-angle-right"></i>【'.get_realname($row['uid']).'】<a href="admin.php?ac=list&fileurl=project&do=personnel&projectid='.$row['id'].'" target="_blank">'.$row['title'].'</a></div>';
	}
	$html.='</div></div>';
	$html.='</div>';
	$html.='</div>';
	$html.='<script type="text/javascript">_Home_Scroll("#df5138","Project_Info")';
	$html.=';</script>';
	echo  $html;
}
//培训管理
function _TraiNing_Info(){
	global $db;
	global $_USER;
	$html='';
	$html.='<div class="col-lg-6 col-sm-6 col-xs-12">';
	$html.='<div class="widget">';
	$html.='<div class="widget-header bordered-top bordered-danger">';
	$html.='<i class="widget-icon fa fa-check-square-o danger"></i><span class="widget-caption danger">培训管理</span>';
	$html.='</div>';
	$html.='<div class="widget-body">';
	$html.='<div id="TraiNing_Info">';
	$query = $db->query("SELECT * FROM ".DB_TABLEPRE.DB_JT."training where responsible LIKE '%".get_realname($_USER->id)."%' or user LIKE '%".get_realname($_USER->id)."%' or uid=".$_USER->id."  ORDER BY id desc LIMIT 0,20");
	while ($row = $db->fetch_array($query)) {	
		$html.='<div class="pclass"><i class="stat-icon icon-lg fa fa-angle-right"></i> <a href="admin.php?ac=training&fileurl=human&do=views&id='.$row['id'].'" target="_blank">'.$row['name'].'</a></div>';
	}
	$html.='</div></div>';
	$html.='</div>';
	$html.='</div>';
	$html.='<script type="text/javascript">_Home_Scroll("#d73d32","TraiNing_Info")';
	$html.=';</script>';
	echo  $html;
}
//图书管理
function _Book_Info(){
	global $db;
	global $_USER;
	$html='';
	$html.='<div class="col-lg-6 col-sm-6 col-xs-12">';
	$html.='<div class="widget">';
	$html.='<div class="widget-header bordered-top bordered-pink">';
	$html.='<i class="widget-icon fa fa-book pink"></i><span class="widget-caption pink">图书借阅</span>';
	$html.='</div>';
	$html.='<div class="widget-body">';
	$html.='<div id="Book_Info">';
	$query = $db->query("SELECT * FROM ".DB_TABLEPRE.DB_JT."book_read where appperson=".$_USER->id."  ORDER BY id desc LIMIT 0,20");
	while ($row = $db->fetch_array($query)) {	
		$html.='<div class="pclass"><i class="stat-icon icon-lg fa fa-angle-right"></i>【'.$row['booknumber'].'】<a href="admin.php?ac=views&do=edit&fileurl=book&id='.$row['bookid'].'" target="_blank">'.$row['bookname'].'</a></div>';
	}
	$html.='</div></div>';
	$html.='</div>';
	$html.='</div>';
	$html.='<script type="text/javascript">_Home_Scroll("#e75b8d","Book_Info")';
	$html.=';</script>';
	echo  $html;
}
//办公用品
function _Goods_Info(){
	global $db;
	global $_USER;
	$html='';
	$html.='<div class="col-lg-6 col-sm-6 col-xs-12">';
	$html.='<div class="widget">';
	$html.='<div class="widget-header bordered-top bordered-darkpink">';
	$html.='<i class="widget-icon fa fa-eraser darkpink"></i><span class="widget-caption darkpink">用品领用</span>';
	$html.='</div>';
	$html.='<div class="widget-body">';
	$html.='<div id="Goods_Info">';
	$query = $db->query("SELECT * FROM ".DB_TABLEPRE.DB_JT."office_goods_record where uid =".$_USER->id."  ORDER BY id desc LIMIT 0,20");
	while ($row = $db->fetch_array($query)) {	
		$html.='<div class="pclass"><i class="stat-icon icon-lg fa fa-angle-right"></i> <a href="admin.php?ac=goods_record_view&fileurl=goods" target="_blank">'.$row['title'].'</a></div>';
	}
	$html.='</div></div>';
	$html.='</div>';
	$html.='</div>';
	$html.='<script type="text/javascript">_Home_Scroll("#cc324b","Goods_Info")';
	$html.=';</script>';
	echo  $html;
}
//会议管理
function _Conferencet_Info(){
	global $db;
	global $_USER;
	$html='';
	$html.='<div class="col-lg-6 col-sm-6 col-xs-12">';
	$html.='<div class="widget">';
	$html.='<div class="widget-header bordered-top bordered-magenta">';
	$html.='<i class="widget-icon fa fa-volume-up magenta"></i><span class="widget-caption magenta">会议管理</span>';
	$html.='</div>';
	$html.='<div class="widget-body">';
	$html.='<div id="Conferencet_Info">';
	$query = $db->query("SELECT * FROM ".DB_TABLEPRE.DB_JT."conference where uid =".$_USER->id." or attendance LIKE '%".get_realname($_USER->id)."%'  ORDER BY id desc LIMIT 0,20");
	while ($row = $db->fetch_array($query)) {	
		$html.='<div class="pclass"><i class="stat-icon icon-lg fa fa-angle-right"></i> <a href="admin.php?ac=conference&fileurl=administrative&do=views&id='.$row['id'].'" target="_blank">'.$row['title'].'</a></div>';
	}
	$html.='</div></div>';
	$html.='</div>';
	$html.='</div>';
	$html.='<script type="text/javascript">_Home_Scroll("#bc5679","Conferencet_Info")';
	$html.=';</script>';
	echo  $html;
}
//客户信息
function _Company_Info(){
	global $db;
	global $_USER;
	$html='';
	$html.='<div class="col-lg-6 col-sm-6 col-xs-12">';
	$html.='<div class="widget">';
	$html.='<div class="widget-header bordered-top bordered-purple">';
	$html.='<i class="widget-icon fa fa-users purple"></i><span class="widget-caption purple">客户信息</span>';
	$html.='</div>';
	$html.='<div class="widget-body">';
	$html.='<div id="Company_Info">';
	$query = $db->query("SELECT * FROM ".DB_TABLEPRE.DB_JT."crm_company where uid='".$_USER->id."' or user='".get_realname($_USER->id)."'  ORDER BY id desc LIMIT 0,20");
	while ($row = $db->fetch_array($query)) {	
		$html.='<div class="pclass"><i class="stat-icon icon-lg fa fa-angle-right"></i> <a href="admin.php?ac=company&fileurl=crm&do=view&id='.$row['id'].'" target="_blank">'.$row['title'].'</a></div>';
	}
	$html.='</div></div>';
	$html.='</div>';
	$html.='</div>';
	$html.='<script type="text/javascript">_Home_Scroll("#7e3794","Company_Info")';
	$html.=';</script>';
	echo  $html;
}
//客户关怀
function _Care_Info(){
	global $db;
	global $_USER;
	$html='';
	$html.='<div class="col-lg-6 col-sm-6 col-xs-12">';
	$html.='<div class="widget">';
	$html.='<div class="widget-header bordered-top bordered-purple">';
	$html.='<i class="widget-icon fa  fa-trophy purple"></i><span class="widget-caption purple">客户关怀</span>';
	$html.='</div>';
	$html.='<div class="widget-body">';
	$html.='<div id="Care_Info">';
	$query = $db->query("SELECT * FROM ".DB_TABLEPRE.DB_JT."crm_care where (uid='".$_USER->id."' or user='".get_realname($_USER->id)."') and type=1  ORDER BY id desc LIMIT 0,20");
	while ($row = $db->fetch_array($query)) {	
		$html.='<div class="pclass"><i class="stat-icon icon-lg fa fa-angle-right"></i> <a href="admin.php?ac=care&fileurl=crm&do=view&id='.$row['id'].'&type=1&cid='.$row['cid'].'" target="_blank">'.$row['title'].'</a></div>';
	}
	$html.='</div></div>';
	$html.='</div>';
	$html.='</div>';
	$html.='<script type="text/javascript">_Home_Scroll("#7e3794","Care_Info")';
	$html.=';</script>';
	echo  $html;
}
//客户回访
function _Service_Info(){
	global $db;
	global $_USER;
	$html='';
	$html.='<div class="col-lg-6 col-sm-6 col-xs-12">';
	$html.='<div class="widget">';
	$html.='<div class="widget-header bordered-top bordered-purple">';
	$html.='<i class="widget-icon fa fa-phone-square purple"></i><span class="widget-caption purple">客户回访</span>';
	$html.='</div>';
	$html.='<div class="widget-body">';
	$html.='<div id="Service_Info">';
	$query = $db->query("SELECT * FROM ".DB_TABLEPRE.DB_JT."crm_service where (uid='".$_USER->id."' or user='".get_realname($_USER->id)."')  ORDER BY id desc LIMIT 0,20");
	while ($row = $db->fetch_array($query)) {	
		$html.='<div class="pclass"><i class="stat-icon icon-lg fa fa-angle-right"></i> <a href="admin.php?ac=service&fileurl=crm&do=view&id='.$row['id'].'&type=1&cid='.$row['cid'].'" target="_blank">'.$row['title'].'</a></div>';
	}
	$html.='</div></div>';
	$html.='</div>';
	$html.='</div>';
	$html.='<script type="text/javascript">_Home_Scroll("#7e3794","Service_Info")';
	$html.=';</script>';
	echo  $html;
}
//客户投诉
function _Complaints_Info(){
	global $db;
	global $_USER;
	$html='';
	$html.='<div class="col-lg-6 col-sm-6 col-xs-12">';
	$html.='<div class="widget">';
	$html.='<div class="widget-header bordered-top bordered-purple">';
	$html.='<i class="widget-icon fa fa-meh-o purple"></i><span class="widget-caption purple">客户投诉</span>';
	$html.='</div>';
	$html.='<div class="widget-body">';
	$html.='<div id="Complaints_Info">';
	$query = $db->query("SELECT * FROM ".DB_TABLEPRE.DB_JT."crm_complaints where (uid='".$_USER->id."' or user='".get_realname($_USER->id)."') and type=1  ORDER BY id desc LIMIT 0,20");
	while ($row = $db->fetch_array($query)) {	
		$html.='<div class="pclass"><i class="stat-icon icon-lg fa fa-angle-right"></i> <a href="admin.php?ac=complaints&fileurl=crm&do=view&id='.$row['id'].'&type=1&cid='.$row['cid'].'" target="_blank">'.$row['title'].'</a></div>';
	}
	$html.='</div></div>';
	$html.='</div>';
	$html.='</div>';
	$html.='<script type="text/javascript">_Home_Scroll("#7e3794","Complaints_Info")';
	$html.=';</script>';
	echo  $html;
}
//报价单
function _Offer_Info(){
	global $db;
	global $_USER;
	$html='';
	$html.='<div class="col-lg-6 col-sm-6 col-xs-12">';
	$html.='<div class="widget">';
	$html.='<div class="widget-header bordered-top bordered-purple">';
	$html.='<i class="widget-icon fa fa-pencil-square purple"></i><span class="widget-caption purple">报价单</span>';
	$html.='</div>';
	$html.='<div class="widget-body">';
	$html.='<div id="Offer_Info">';
	$query = $db->query("SELECT * FROM ".DB_TABLEPRE.DB_JT."crm_offer where uid='".$_USER->id."'  ORDER BY id desc LIMIT 0,20");
	while ($row = $db->fetch_array($query)) {	
		$html.='<div class="pclass"><i class="stat-icon icon-lg fa fa-angle-right"></i> <a href="admin.php?ac=offer&fileurl=crm&do=view&id='.$row['id'].'&cid='.$row['cid'].'" target="_blank">'.$row['title'].'</a></div>';
	}
	$html.='</div></div>';
	$html.='</div>';
	$html.='</div>';
	$html.='<script type="text/javascript">_Home_Scroll("#7e3794","Offer_Info")';
	$html.=';</script>';
	echo  $html;
}
//解决方案
function _Program_Info(){
	global $db;
	global $_USER;
	$html='';
	$html.='<div class="col-lg-6 col-sm-6 col-xs-12">';
	$html.='<div class="widget">';
	$html.='<div class="widget-header bordered-top bordered-purple">';
	$html.='<i class="widget-icon fa  fa-pencil-square-o purple"></i><span class="widget-caption purple">解决方案</span>';
	$html.='</div>';
	$html.='<div class="widget-body">';
	$html.='<div id="Program_Info">';
	$query = $db->query("SELECT * FROM ".DB_TABLEPRE.DB_JT."crm_program where uid='".$_USER->id."'  ORDER BY id desc LIMIT 0,20");
	while ($row = $db->fetch_array($query)) {	
		$html.='<div class="pclass"><i class="stat-icon icon-lg fa fa-angle-right"></i> <a href="admin.php?ac=program&fileurl=crm&do=view&id='.$row['id'].'&cid='.$row['cid'].'" target="_blank">'.$row['title'].'</a></div>';
	}
	$html.='</div></div>';
	$html.='</div>';
	$html.='</div>';
	$html.='<script type="text/javascript">_Home_Scroll("#7e3794","Program_Info")';
	$html.=';</script>';
	echo  $html;
}
//合同
function _ContRact_Info(){
	global $db;
	global $_USER;
	$html='';
	$html.='<div class="col-lg-6 col-sm-6 col-xs-12">';
	$html.='<div class="widget">';
	$html.='<div class="widget-header bordered-top bordered-purple">';
	$html.='<i class="widget-icon fa fa-print purple"></i><span class="widget-caption purple">合同</span>';
	$html.='</div>';
	$html.='<div class="widget-body">';
	$html.='<div id="ContRact_Info">';
	$query = $db->query("SELECT * FROM ".DB_TABLEPRE.DB_JT."crm_contract where uid='".$_USER->id."'  ORDER BY id desc LIMIT 0,20");
	while ($row = $db->fetch_array($query)) {	
		$html.='<div class="pclass"><i class="stat-icon icon-lg fa fa-angle-right"></i> <a href="admin.php?ac=contract&fileurl=crm&do=view&id='.$row['id'].'&cid='.$row['cid'].'" target="_blank">'.$row['title'].'</a></div>';
	}
	$html.='</div></div>';
	$html.='</div>';
	$html.='</div>';
	$html.='<script type="text/javascript">_Home_Scroll("#7e3794","ContRact_Info")';
	$html.=';</script>';
	echo  $html;
}
//订单
function _Order_Info(){
	global $db;
	global $_USER;
	$html='';
	$html.='<div class="col-lg-6 col-sm-6 col-xs-12">';
	$html.='<div class="widget">';
	$html.='<div class="widget-header bordered-top bordered-purple">';
	$html.='<i class="widget-icon fa fa-shopping-cart purple"></i><span class="widget-caption purple">订单</span>';
	$html.='</div>';
	$html.='<div class="widget-body">';
	$html.='<div id="Order_Info">';
	$query = $db->query("SELECT * FROM ".DB_TABLEPRE.DB_JT."crm_order where uid='".$_USER->id."'  ORDER BY id desc LIMIT 0,20");
	while ($row = $db->fetch_array($query)) {	
		$html.='<div class="pclass"><i class="stat-icon icon-lg fa fa-angle-right"></i> <a href="admin.php?ac=order&fileurl=crm&do=view&id='.$row['id'].'&cid='.$row['cid'].'" target="_blank">'.$row['title'].'</a></div>';
	}
	$html.='</div></div>';
	$html.='</div>';
	$html.='</div>';
	$html.='<script type="text/javascript">_Home_Scroll("#7e3794","Order_Info")';
	$html.=';</script>';
	echo  $html;
}
//收款单
function _Price_Info(){
	global $db;
	global $_USER;
	$html='';
	$html.='<div class="col-lg-6 col-sm-6 col-xs-12">';
	$html.='<div class="widget">';
	$html.='<div class="widget-header bordered-top bordered-purple">';
	$html.='<i class="widget-icon fa fa-tags purple"></i><span class="widget-caption purple">收款单</span>';
	$html.='</div>';
	$html.='<div class="widget-body">';
	$html.='<div id="Price_Info">';
	$query = $db->query("SELECT * FROM ".DB_TABLEPRE.DB_JT."crm_price where uid='".$_USER->id."' or user='".get_realname($_USER->id)."'  ORDER BY id desc LIMIT 0,20");
	while ($row = $db->fetch_array($query)) {	
		$html.='<div class="pclass"><i class="stat-icon icon-lg fa fa-angle-right"></i> <a href="admin.php?ac=price&fileurl=crm&do=view&id='.$row['id'].'" target="_blank">'.$row['title'].'</a></div>';
	}
	$html.='</div></div>';
	$html.='</div>';
	$html.='</div>';
	$html.='<script type="text/javascript">_Home_Scroll("#7e3794","Price_Info")';
	$html.=';</script>';
	echo  $html;
}
//付款单
function _Payment_Info(){
	global $db;
	global $_USER;
	$html='';
	$html.='<div class="col-lg-6 col-sm-6 col-xs-12">';
	$html.='<div class="widget">';
	$html.='<div class="widget-header bordered-top bordered-purple">';
	$html.='<i class="widget-icon fa fa-tag purple"></i><span class="widget-caption purple">付款单</span>';
	$html.='</div>';
	$html.='<div class="widget-body">';
	$html.='<div id="Payment_Info">';
	$query = $db->query("SELECT * FROM ".DB_TABLEPRE.DB_JT."crm_payment where uid='".$_USER->id."' or user='".get_realname($_USER->id)."'  ORDER BY id desc LIMIT 0,20");
	while ($row = $db->fetch_array($query)) {	
		$html.='<div class="pclass"><i class="stat-icon icon-lg fa fa-angle-right"></i> <a href="admin.php?ac=payment&fileurl=crm&do=view&id='.$row['id'].'" target="_blank">'.$row['title'].'</a></div>';
	}
	$html.='</div></div>';
	$html.='</div>';
	$html.='</div>';
	$html.='<script type="text/javascript">_Home_Scroll("#7e3794","Payment_Info")';
	$html.=';</script>';
	echo  $html;
}
//供应商信息
function _Supplier_Info(){
	global $db;
	global $_USER;
	$html='';
	$html.='<div class="col-lg-6 col-sm-6 col-xs-12">';
	$html.='<div class="widget">';
	$html.='<div class="widget-header bordered-top bordered-purple">';
	$html.='<i class="widget-icon fa fa-truck purple"></i><span class="widget-caption purple">供应商信息</span>';
	$html.='</div>';
	$html.='<div class="widget-body">';
	$html.='<div id="Supplier_Info">';
	$query = $db->query("SELECT * FROM ".DB_TABLEPRE.DB_JT."crm_supplier where uid='".$_USER->id."' or user='".get_realname($_USER->id)."'  ORDER BY id desc LIMIT 0,20");
	while ($row = $db->fetch_array($query)) {	
		$html.='<div class="pclass"><i class="stat-icon icon-lg fa fa-angle-right"></i> <a href="admin.php?ac=supplier&fileurl=crm&do=view&id='.$row['id'].'" target="_blank">'.$row['title'].'</a></div>';
	}
	$html.='</div></div>';
	$html.='</div>';
	$html.='</div>';
	$html.='<script type="text/javascript">_Home_Scroll("#7e3794","Supplier_Info")';
	$html.=';</script>';
	echo  $html;
}
//采购信息
function _Purchase_Info(){
	global $db;
	global $_USER;
	$html='';
	$html.='<div class="col-lg-6 col-sm-6 col-xs-12">';
	$html.='<div class="widget">';
	$html.='<div class="widget-header bordered-top bordered-purple">';
	$html.='<i class="widget-icon fa fa-spinner purple"></i><span class="widget-caption purple">采购信息</span>';
	$html.='</div>';
	$html.='<div class="widget-body">';
	$html.='<div id="Purchase_Info">';
	$query = $db->query("SELECT * FROM ".DB_TABLEPRE.DB_JT."crm_purchase where uid='".$_USER->id."' or user='".get_realname($_USER->id)."'  ORDER BY id desc LIMIT 0,20");
	while ($row = $db->fetch_array($query)) {	
		$html.='<div class="pclass"><i class="stat-icon icon-lg fa fa-angle-right"></i> <a href="admin.php?ac=purchase&fileurl=crm&do=view&id='.$row['id'].'" target="_blank">'.$row['title'].'</a></div>';
	}
	$html.='</div></div>';
	$html.='</div>';
	$html.='</div>';
	$html.='<script type="text/javascript">_Home_Scroll("#7e3794","Purchase_Info")';
	$html.=';</script>';
	echo  $html;
}
//代理商信息
function _Business_Info(){
	global $db;
	global $_USER;
	$html='';
	$html.='<div class="col-lg-6 col-sm-6 col-xs-12">';
	$html.='<div class="widget">';
	$html.='<div class="widget-header bordered-top bordered-purple">';
	$html.='<i class="widget-icon fa fa-sort-amount-asc purple"></i><span class="widget-caption purple">代理商信息</span>';
	$html.='</div>';
	$html.='<div class="widget-body">';
	$html.='<div id="Business_Info">';
	$query = $db->query("SELECT * FROM ".DB_TABLEPRE.DB_JT."crm_business where uid='".$_USER->id."' or user='".get_realname($_USER->id)."'  ORDER BY id desc LIMIT 0,20");
	while ($row = $db->fetch_array($query)) {	
		$html.='<div class="pclass"><i class="stat-icon icon-lg fa fa-angle-right"></i> <a href="admin.php?ac=business&fileurl=crm&do=view&id='.$row['id'].'" target="_blank">'.$row['title'].'</a></div>';
	}
	$html.='</div></div>';
	$html.='</div>';
	$html.='</div>';
	$html.='<script type="text/javascript">_Home_Scroll("#7e3794","Business_Info")';
	$html.=';</script>';
	echo  $html;
}









/************************************************************/
/*统计控件模块
************************/
?>