<?php
/*********************************************************      
 文件说明:         
    功能说明:

    调用关系:调用:header.inc  
             被调用:实现各个功能模块的页面        
    变量说明:
              

作者:
NO.1      
姓名：            
时间：  
修改说明：
*********************************************************/ 
require("../../inc/header.inc");
$db=$refresh_card_db;
$table_name='card_param';
?>
<script language="javascript">
function select_type(){
	var url,base,id,add_1,tariff_type,add_2,charge_date,add_3,charge_period,add_4,periodic_amount,add_5,foredit,add_6;
	base="<?php echo $PHP_SELF; ?>?";
	id=document.selectform.id.value;
	add_1="id="+id;
	tariff_type=document.selectform.tariff_type.value;
	add_2="&tariff_type="+tariff_type;
	charge_date=document.selectform.charge_date.value;
	add_3="&charge_date="+charge_date;
	charge_period="&charge_period="+charge_period;
	periodic_amount=document.selectform.periodic_amount.value;
	add_5="&periodic_amount="+periodic_amount;
	foredit=document.selectform.foredit.value;
	add_6="&foredit="+foredit
	url=base+add_1+add_2+add_3+add_4+add_5+add_6;
	window.location=url;
}
</script>
<?php
if($edit)
{
		$delSql = " DELETE FROM $table_name ";
		$delRes = mysqli_query($pubConn,$delSql);

		$insertSql = " Insert INTO $table_name VALUES('$faceTypes','$faceValue1','$faceValue2','$faceValue3','$faceValue4','$chageToMinConto')
					 ";
		//echo "<br>insertSql=$insertSql";
		$insertRes=mysqli_query($pubConn,$insertSql);
		if($insertRes){
			echo "<br><font color=\"#0000FF\">Edit success</font>";
			$log_name = "Edit Succss".$user_info["account"];
			insertLog("$log_name");
		}
		else{
			echo "<br><font color=\"#FF0000\">Edit Failure</font>";
			$log_name = "Edit Failure".$user_info["account"];
			insertLog("$log_name");
		}
}

  $sql = " SELECT *
		   FROM $table_name
		 ";
  //echo "<br>sql=$sql";
  $res = mysqli_query($pubConn,$sql);
  $row = mysqli_fetch_array($res);

?>
 
<body>  
<form name="selectform" action=<?php echo "$PHP_SELF?id=$id&debit_date=$debit_date&periodic_amount=$periodic_amount";?> method="POST"> 
  <table border="1" width="400"  cellpadding="2" cellspacing="0"  bordercolor="#666666" bordercolordark="#FFFFFF" bgcolor="#FFFFA4"> 
    <tr>    
    <td vAlign="middle" width="40%" bgcolor="#FFFFFF">   
    <?php echo "Face value types"; ?>   
    </td>   
    <td width="60%" valign="middle" bgcolor="#FFFFFF">
	<select name="faceTypes">
	<?php
	for($i=1;$i<5;$i++)
	{
		if($row[faceTypes] == $i)
		{
			echo "<option value=\"$i\" selected>$i</option>";
		}
		else
		{
			echo "<option value=\"$i\">$i</option>";
		}
	}
	?>
	</select>
    </td> 
    </tr> 
    <tr>    
    <td vAlign="middle" width="40%" bgcolor="#FFFFFF">   
    <?php echo "Face value 1"; ?>   
    </td>   
    <td width="60%" valign="middle" bgcolor="#FFFFFF">
	<input type="input" name="faceValue1" value="<?php echo "$row[faceValue1]"; ?>"  maxlength="5" size="5"> 
    </td> 
    </tr> 
    <tr>    
    <td vAlign="middle" width="40%" bgcolor="#FFFFFF">   
    <?php echo "Face value 2"; ?>   
    </td>   
    <td width="60%" valign="middle" bgcolor="#FFFFFF">
	<input type="input" name="faceValue2" value="<?php echo "$row[faceValue2]"; ?>"  maxlength="5" size="5"> 
    </td> 
    </tr> 
    <tr>    
    <td vAlign="middle" width="40%" bgcolor="#FFFFFF">   
    <?php echo "Face value 3"; ?>   
    </td>   
    <td width="60%" valign="middle" bgcolor="#FFFFFF">
	<input type="input" name="faceValue3" value="<?php echo "$row[faceValue3]"; ?>"  maxlength="5" size="5"> 
    </td> 
    </tr> 
    <tr>    
    <td vAlign="middle" width="40%" bgcolor="#FFFFFF">   
    <?php echo "Face value 4"; ?>   
    </td>   
    <td width="60%" valign="middle" bgcolor="#FFFFFF">
	<input type="input" name="faceValue4" value="<?php echo "$row[faceValue4]"; ?>" maxlength="5" size="5"> 
    </td> 
    </tr> 
    <tr>    
    <td vAlign="middle" width="40%" bgcolor="#FFFFFF">   
    <?php echo "Decimal places"; ?>   
    </td>   
    <td width="60%" valign="middle" bgcolor="#FFFFFF">
	<select name="chageToMinConto">
	<?php
		if($row[chageToMinConto] == 0.01)
		{
			echo "<option value=\"0.01\" selected>0.01</option>";
		}
		else
		{
			echo "<option value=\"0.01\">0.01</option>";
		}
		if($row[chageToMinConto] == 0.1)
		{
			echo "<option value=\"0.1\" selected>0.1</option>";
		}
		else
		{
			echo "<option value=\"0.1\">0.1</option>";
		}
		if($row[chageToMinConto] == 1)
		{
			echo "<option value=\"1\" selected>1</option>";
		}
		else
		{
			echo "<option value=\"1\">1</option>";
		}
	?>
	</select>
	</td> 
    </tr> 
  </table>  
  <input type="submit" name="edit" value="<?php echo "$strEdit"; ?>" tabindex="1">&nbsp;&nbsp; 
  <input type="submit" name="reset" value="reset" tabindex="1">&nbsp;&nbsp; 
  </form>        
 </body>     
</html>       
