<?php 
//****************************************请求权限****************************************
require("locked.php");                                                                 //*
setlocked(0);//会计科目                                                                 //*
//****************************************************************************************
?>
<html>
<head>
<meta charset="utf-8">
<title>修改会计科目</title>
<script language="javascript" type="text/javascript" src="myJs.js"></script>
<link rel="stylesheet" href="myCss.css" type="text/css" />
<script language="javascript" type="text/javascript">
<!--
function checkForm(){
	if (form1.id.value==""){
	    alert("ID不能为空！");
		form1.id.focus();
		return false;
	}
	
	if (isNaN(form1.id.value)){
	    alert("ID必须为数字！");
		form1.id.focus();
		return false;
	}else{
		switch(form1.id.value.length){
			//限定会计科目长度，五级，42222类型；
			case 4:
				break;
			case 6:
				break;
			case 8:
				break;
			case 10:
				break;
			case 12:
				break;
			default:
				alert("ID位数不正确！");
				form1.id.focus();
				return false;
		}
	}
	
	if((form1.id.value).substring(0,1)==0){
		alert("ID起始不能为零！");
		form1.id.focus();
		return false;
	}
	
	if (form1.name.value==""){
	    alert("名称不能为空！");
		form1.name.focus();
		return false;
	}
	
	//会计科目，基础资料名称文字禁止出现的数据 arrban 列举的字符；
	for(var i=0;i<arrban.length;i++){
		if((form1.name.value).indexOf(arrban[i])!=-1){
			alert("名称字符不能出现："+arrban[i]);
			form1.name.focus();
			return false;
		}
	}
	
	form1.submit();
}
//-->
</script>
</head>

<body>
<?php
include("cnn.php");
$keyword=$mysqli->real_escape_string($_GET[keyword]);
$strsql='select * from account where id="'.$keyword.'"';
$sql=$mysqli->query($strsql);
$info=$sql->fetch_array(MYSQLI_BOTH);
if($info){ //如果存在数据；
?>
<form action="account_EditSubmit.php" method="post" name="form1">
<table>
<td colspan="2" align="center"><font size="+3">会计科目</font></td>
<tr>
<td>ID</td><td><input name="id" type="text" style="width:450px" readonly value="<?php echo $info[id]; ?>" /></td>
</tr>
<tr>
<td>名称</td><td><input name="name" type="text" style="width:450px" value="<?php echo $info[name]; ?>" /></td>
</tr>
<tr>
<td>分类</td>
<td>
<select name="t" style="width:456px">
<option value="资产" <?php if($info[t]=='资产'){echo 'selected="selected"';} ?>>资产</option>
<option value="负债" <?php if($info[t]=='负债'){echo 'selected="selected"';} ?>>负债</option>
<option value="权益" <?php if($info[t]=='权益'){echo 'selected="selected"';} ?>>权益</option>
<option value="成本" <?php if($info[t]=='成本'){echo 'selected="selected"';} ?>>成本</option>
<option value="利润" <?php if($info[t]=='利润'){echo 'selected="selected"';} ?>>利润</option>
</select>
</td>
</tr>
<tr>
<td>方向</td>
<td>
<select name="dc" style="width:456px">
<option value="借方" <?php if($info[dc]=='借方'){echo 'selected="selected"';} ?>>借方</option>
<option value="贷方" <?php if($info[dc]=='贷方'){echo 'selected="selected"';} ?>>贷方</option>
</select>
</td>
</tr>
<tr>
<td>基<br /><br />础<br /><br />资<br /><br />料</td>
<td align="center">

<table>
<tr>
<td>
数量外币
</td>
<td>
<select name="slwb">
<option value="0" <?php if($info[slwb]==0){echo 'selected="selected"';} ?>>否</option>
<option value="-1" <?php if($info[slwb]==-1){echo 'selected="selected"';} ?>>是</option>
</select>
</td>
<td width="100px"></td>
<td>
现金流量
</td>
<td>
<select name="xjll">
<option value="0" <?php if($info[xjll]==0){echo 'selected="selected"';} ?>>否</option>
<option value="-1" <?php if($info[xjll]==-1){echo 'selected="selected"';} ?>>是</option>
</select>
</td>
<tr>
<td>
客户
</td>
<td>
<select name="kh">
<option value="0" <?php if($info[kh]==0){echo 'selected="selected"';} ?>>否</option>
<option value="-1" <?php if($info[kh]==-1){echo 'selected="selected"';} ?>>是</option>
</select>
</td>
<td width="100px"></td>
<td>
个人
</td>
<td>
<select name="gr">
<option value="0" <?php if($info[gr]==0){echo 'selected="selected"';} ?>>否</option>
<option value="-1" <?php if($info[gr]==-1){echo 'selected="selected"';} ?>>是</option>
</select>
</td>
</tr>
<tr>
<td>
存货
</td>
<td>
<select name="ch">
<option value="0" <?php if($info[ch]==0){echo 'selected="selected"';} ?>>否</option>
<option value="-1" <?php if($info[ch]==-1){echo 'selected="selected"';} ?>>是</option>
</select>
</td>
<td width="100px"></td>
<td>
供应商
</td>
<td>
<select name="gys">
<option value="0" <?php if($info[gys]==0){echo 'selected="selected"';} ?>>否</option>
<option value="-1" <?php if($info[gys]==-1){echo 'selected="selected"';} ?>>是</option>
</select>
</td>
</tr>
<tr>
<td>
部门
</td>
<td>
<select name="bm">
<option value="0" <?php if($info[bm]==0){echo 'selected="selected"';} ?>>否</option>
<option value="-1" <?php if($info[bm]==-1){echo 'selected="selected"';} ?>>是</option>
</select>
</td>
<td width="100px"></td>
<td>
核算项目
</td>
<td>
<select name="xm">
<option value="0" <?php if($info[xm]==0){echo 'selected="selected"';} ?>>否</option>
<option value="-1" <?php if($info[xm]==-1){echo 'selected="selected"';} ?>>是</option>
</select>
</td>
</tr>
</table>

</td>
</tr>
<tr>
<td colspan="2" align="center"><br /><br />
<?php
//已经审核的数据不允许修改；
if(is_null($info[chk])){
    echo '<input name="edit" type="button" onclick="checkForm()" value="保存" />';
}else{
	echo '<input name="edit" type="button" onclick="checkForm()" disabled="disabled" value="保存" />';
}
$sql->free();
$mysqli->close();
?>
</td>
</tr>
</table>
</form>
<?php
}else{
	echo '未检测到相关数据，该数据可能被删除；';
}
?>

</body>
</html>