<?php
	$acl=$_SESSION["acl"];
	if (strlen($acl)<1 || !strpos($acl,"<0009>")) {	//没有权限
		ob_clean();
		header("Location: accesserror.html");
		exit;
	}
?>

<html>

<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>结帐类型</title>
</head>

<body background="bkg.bmp">

<p align="center"><font size="5"><b>管理结帐类型</b></font></p>
<hr color="#999966">
<p align="center">　</p>
<div align="center">
  <center>
  <table border="1" width="423" height="91" bordercolor="#008080" cellspacing="0" cellpadding="0">
    <tr>
      <td width="140" align="center" height="39">类型名称</td>
      <td width="237" align="center" height="39">
          结帐单价
        </td>
    </tr>

<?php
	$timestr=strftime("%Y-%m-%d %H:%M:%S");
	$db=mysql_pconnect(get_cfg_var("SIPSERVER"),get_cfg_var("SIPUSER"),get_cfg_var("SIPPWD"));
	mysql_select_db(get_cfg_var("SIPDB"),$db);
	$price=trim($_REQUEST["price"]);
	$usertype=trim($_REQUEST["usertype"]);
	if ($usertype!="") {
		if ($price=="") {
			$price="0";
		}
		mysql_query( "update types set price=".$price." where name='".$usertype."'",$db );
		mysql_query( "insert into operation values('".$_SESSION["operator"]."','".$timestr."','修改结算单价：".$usertype."类型')",$db );
	}
	$n=1;
	$rs = mysql_query("select name,price,orderid from types order by orderid",$db);
	while ($row = mysql_fetch_array($rs)) {
		echo("<tr>");
    	echo("<td align=center valign=middle>".$row["name"]."</td>");
		echo("<td align=center valign=middle>");
		echo("<br>");
		echo("<form name=form".strval($n)." method=POST action=type.php>");
    	echo("<input type=hidden name=usertype size=8 value=".$row["name"].">");
		echo("<input type=text name=price size=8 value=".strval($row["price"]).">元");
    	echo(" <input type=submit value=修改 name=B1>");
		echo("</form>");
    	echo("</td>");
		echo("</tr>");
   		$n=$n+1;
    }
    mysql_free_result($rs);
    mysql_close($db);
?>

  </table>
  </center>
</div>

<p>　</p>
<hr>
<p align="center">SIP酒店上网计费管理系统</p>
<p align="center">作者：<b>深圳市飞沃软件有限公司</b></p>

</body>

</html>
