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

<?php
	$timestr=strftime("%Y-%m-%d %H:%M:%S");
	$userid=trim($_REQUEST["userid"]);
	$loginname=trim($_REQUEST["loginname"]);
	$usertype=trim($_REQUEST["usertype"]);
	$usertypename=trim($_REQUEST["usertypename"]);
	$username=trim($_REQUEST["username"]);
	$price=trim($_REQUEST["price"]);
	$length=trim($_REQUEST["length"]);
	$money1=trim($_REQUEST["money1"]);
	$money2=trim($_REQUEST["money2"]);
	$discount=trim($_REQUEST["discount"]);
	if ($userid!="") {
		$db=mysql_pconnect(get_cfg_var("SIPSERVER"),get_cfg_var("SIPUSER"),get_cfg_var("SIPPWD"));
		mysql_select_db(get_cfg_var("SIPDB"),$db);
		mysql_query( "update users set checked='y' where userid='".$userid."'",$db );
		mysql_query( "update usertime set overed='y' where userid='".$userid."'",$db );
		mysql_query( "insert into returnlist values('".$userid."','".$loginname."','".$timestr."','".$usertype."',".$length.",".$price.",".$money1.",".$discount.",".$money2.")",$db );
		mysql_query( "insert into operation values('".$_SESSION["operator"]."','".$timestr."','用户退费，用户ID：".$userid."')",$db );
		if ($money2!="0" && $money2!="") {	//有退购买款资金流
			mysql_query( "insert into cash values('".$userid."','".$timestr."',".$money2.",0,'5','".$_SESSION["operator"]."')" ,$db);
		}
		mysql_close($db);
	}
?>

<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">
<div id='info' align="center">
<center>
<table border="1" width="524" height="183" bordercolor="#008080" cellspacing="0" cellpadding="0">
    <tr>
      <td width="124" align="center" height="50">用户ID</td>
      <td width="386" align="left" height="50">&nbsp;&nbsp;<?php echo $loginname; ?>
      </td>
    </tr>
    <tr>
      <td width="124" align="center" height="50">用户名称</td>
      <td width="386" align="left" height="50">&nbsp;&nbsp;<?php echo $username; ?>
      </td>
    </tr>
    <tr>
      <td width="124" align="center" height="50">用户类型</td>
      <td width="386" align="left" height="50">&nbsp;&nbsp;<?php echo $usertypename; ?>
      </td>
    </tr>
    <tr>
      <td width="124" align="center" height="50">购买时单价</td>
      <td width="386" align="left" height="50">&nbsp;&nbsp;<?php echo $price; ?>元
      </td>
    </tr>
    <tr>
      <td width="124" align="center" height="50">退费数量</td>
      <td width="386" align="left" height="50">&nbsp;&nbsp;<?php echo $length; ?>
      </td>
    </tr>
    <tr>
      <td width="124" align="center" height="50">退费合计</td>
      <td width="386" align="left" height="50">&nbsp;&nbsp;<?php echo $money1; ?>元
      </td>
    </tr>
    <tr>
      <td width="124" align="center" height="50">购买时折扣率</td>
      <td width="386" align="left" height="50">&nbsp;&nbsp;<?php echo $discount; ?>
      </td>
    </tr>
    <tr>
      <td width="124" align="center" height="50">实际退费</td>
      <td width="386" align="left" height="50">&nbsp;&nbsp;<?php echo $money2; ?>元
      </td>
    </tr>
</table>
</center>
</div>
<hr>
<p align="center">SIP宽带上网计费管理系统</p>
<p align="center">作者：<b>深圳市飞沃软件有限公司</b></p>

</body>

</html>
