<?php
/*
页面功能：配合页面V_1.php,从会计科目表中提取过滤信息；
*/
//****************************************请求权限******************************************
require("locked.php");                                                                 //*
setlocked(8,"");                                                                       //*
//****************************************************************************************

//提取核算项目的类
class pro{
	public $proName;
	public function xmhs($id){
		include("cnn.php");
	    $sql=$mysqli->query('select slwb,xjll,kh,gr,ch,gys,bm,xm from account where id="'.$id.'"');
		$info=$sql->fetch_array(MYSQLI_BOTH);
		if($info[slwb]==-1){
			$this->proName='数量外币';
		}
		if($info[xjll]==-1){
			$this->proName=$this->proName.'/现金流量';
		}
		if($info[kh]==-1){
			$this->proName=$this->proName.'/客户';
		}
		if($info[gr]==-1){
			$this->proName=$this->proName.'/个人';
		}
		if($info[ch]==-1){
			$this->proName=$this->proName.'/存货';
		}
		if($info[gys]==-1){
			$this->proName=$this->proName.'/供应商';
		}
		if($info[bm]==-1){
			$this->proName=$this->proName.'/部门';
		}
		if($info[xm]==-1){
			$this->proName=$this->proName.'/核算项目';
		}
		if(substr($this->proName,0,1)=="/"){
			$this->proName=substr($this->proName,1,strlen($this->proName)-1);
		}
		if(strlen($this->proName)>0){
			return $this->proName;
		}else{
			return "空白";
		}
	}
}

include("cnn.php");
$sql=$mysqli->query('select id,Fname,t,dc from account where id like "'.$_GET[searchText].'%" or Fname like "%'.$_GET[searchText].'%" order by id asc');
$info=$sql->fetch_array(MYSQLI_BOTH);
echo '<table border=1 cellspacing=0 bgcolor="white" id="tbl2" style="margin-top:-20px">';
if($info){ //如果存在数据；
    DO{
	   echo '<tr onmouseover="trMouseover(this)" onmouseout="trMouseout(this)" onclick="trClick(this)">';
	   echo '<td>'.$info[id].'</td>';
	   echo '<td>'.$info[Fname].'</td>';
	   $xmName=new pro();
	   echo '<td>'.$xmName->xmhs($info[id]).'</td>';
	   echo '<td>'.$info[dc].'</td>';
	   echo '<td>'.$info[t].'</td>';
	   echo '</tr>';
	}while($info=$sql->fetch_array(MYSQLI_BOTH));
}
echo '</table>';

echo '<div><input id="addKM" value="新增会计科目" onclick="openInsertAccount()" type="button" /></div>';

$sql->free();
$mysqli->close();
?>