292 lines
8.3 KiB
PHP
Executable File
292 lines
8.3 KiB
PHP
Executable File
<?php
|
||
/*********************************************************
|
||
文件说明:
|
||
功能说明:修改Rent
|
||
|
||
调用关系:调用:header.inc
|
||
被调用:实现各个功能模块的页面
|
||
变量说明:
|
||
|
||
作者:
|
||
NO.1
|
||
姓名:崔体存
|
||
时间: 2004-4-13
|
||
修改说明:OMC 7.0 增加了可通过选择不同的tariff_id来修改不同
|
||
tariff_id得费率
|
||
*********************************************************/
|
||
require("../../inc/header.inc");
|
||
?>
|
||
<body leftmargin="15" rightmargin="10" onload="javascript:adjust();" onresize="javascript:adjust();" style="overflow:hidden;overflow-x:hidden;overflow-y:hidden;">
|
||
<form name="editform" action="<?php echo"$PHP_SELF?id=".$_REQUEST['id']."&mode=".$_REQUEST['mode']; ?>" method="POST">
|
||
|
||
<?php
|
||
$DEBUG =0;
|
||
adjust_head();
|
||
adjust_title_head();
|
||
|
||
|
||
//==========================================================
|
||
//变量定义
|
||
//==========================================================
|
||
$ppsDb ='PPS_DB';
|
||
|
||
$id=$_REQUEST['id'];
|
||
$tariffID=$_REQUEST['tariffID'];
|
||
$tariff_id=$_REQUEST['tariff_id'];
|
||
$mode=$_REQUEST['mode'];
|
||
$edit=$_REQUEST['edit'];
|
||
$number_of_records=$_REQUEST['number_of_records'];
|
||
//添加修改所需的参数
|
||
|
||
$rent_id=$_REQUEST['rent_id'];
|
||
$description=$_REQUEST['description'];
|
||
|
||
$rent_type=$_REQUEST['rent_type'];
|
||
$rent_day=$_REQUEST['rent_day'];
|
||
$Charge_amount=$_REQUEST['Charge_amount'];
|
||
|
||
|
||
global $pubConn,$OMC_server;
|
||
$srcDataConn = mysqli_connect($OMC_server[0]['host'],$OMC_server[0]['user'],$OMC_server[0]['password'], $ppsDb);
|
||
|
||
$tableName ='pre_rent';
|
||
$listPageURL = "tariffBasic.php?keep_id=1&return_tariff_id=$tariffID";
|
||
$moneyPara = getMoneyPara(); //显示的货币单位是最小货币单位的倍数
|
||
$strPageTitle=$strTitleAdvanced.$strTitleSpace."PPS".$strTitleSpace."Tariff plan".$strTitleSpace."Rent";
|
||
$arr_mode=array("edit","add");
|
||
if($mode == "add"){
|
||
$tableTitle = "Add Rent";
|
||
}
|
||
elseif($mode == "edit"){
|
||
$tableTitle = "Edit Rent";
|
||
}
|
||
|
||
echo "<table id=\"table_up\" border=\"0\" width=\"100%\">";
|
||
echo "<tr>";
|
||
echo "<td width=\"50%\">";
|
||
echo "$strPageTitle";
|
||
echo "</td>";
|
||
echo "<td width=\"50%\" align=\"right\"> ";
|
||
|
||
echo "</td>";
|
||
echo "</tr>";
|
||
echo "</table>";
|
||
|
||
adjust_title_tail();
|
||
adjust_content_head();
|
||
echo "<br>";
|
||
|
||
//==========================================================
|
||
//输入变量
|
||
//==========================================================
|
||
if($DEBUG) echo "<br>id=$id";
|
||
|
||
//==========================================================
|
||
//数据处理
|
||
//==========================================================
|
||
//保存修改的变量
|
||
if(strlen($_REQUEST['set']) > 0){
|
||
if ($mode == "edit"){
|
||
$setSql="UPDATE $tableName
|
||
SET description = '$description',
|
||
rent_type = '$rent_type',
|
||
charge_date = '$rent_day',
|
||
rent_amount = '$Charge_amount'
|
||
WHERE id = '$id' AND tariff_id='$tariffID'";
|
||
if(1) echo "<br>$setSql";
|
||
$result= @mysqli_query($srcDataConn,$setSql);
|
||
echo mysqli_error($srcDataConn);
|
||
if($DEBUG) exit();
|
||
echo " <meta http-equiv=\"refresh\" content=\"0; url=$listPageURL\"> ";
|
||
}
|
||
if ($mode == "add"){
|
||
$setSql="INSERT INTO $tableName
|
||
(id,description,rent_type,charge_date,rent_amount)
|
||
VALUES
|
||
('$rent_id','$description','$rent_type','$rent_day','$charge_amount')";
|
||
if($DEBUG) echo "<br>setSql=$setSql";
|
||
$result= @mysqli_query($srcDataConn,$setSql);
|
||
echo mysqli_error($srcDataConn);
|
||
if($DEBUG) exit();
|
||
echo " <meta http-equiv=\"refresh\" content=\"0; url=$listPageURL\"> ";
|
||
}
|
||
}
|
||
|
||
//==========================================================
|
||
//输出并显示数据
|
||
//==========================================================
|
||
$getEditSql="SELECT id,description, rent_type, charge_date,rent_amount
|
||
FROM $tableName
|
||
WHERE id = '$id' AND tariff_id='$tariffID'";
|
||
if($DEBUG) echo "<br>$getEditSql";
|
||
$resultEdit= @mysqli_query($srcDataConn,$getEditSql);
|
||
$rows= @mysqli_fetch_array($resultEdit);
|
||
echo mysqli_error($srcDataConn);
|
||
|
||
$getAddSql="SELECT id
|
||
FROM $tableName";
|
||
//if($DEBUG) echo "<br>$getEditSql";
|
||
$resultAdd= @mysqli_query($srcDataConn,$getAddSql);
|
||
$rowsAdd= @mysqli_fetch_array($resultAdd);
|
||
echo mysqli_error($srcDataConn);
|
||
?>
|
||
|
||
<script LANGUAGE="JavaScript">
|
||
function selectType(){
|
||
var base_url,url_add,url;
|
||
base_url='<?php echo "$PHP_SELF?edit=1&id=$id&tariffID=$tariffID&mode=$mode&rent_type=";?>';
|
||
//echo "a=-==".document.editform.rent_type.options;
|
||
console.log(document.getElementById('rent_type').value)
|
||
url_add=document.getElementById('rent_type').value;
|
||
url=base_url+url_add;
|
||
window.location=url;
|
||
}
|
||
</script>
|
||
|
||
|
||
<table border="1" width="400" cellpadding="2" cellspacing="0" bordercolor="#666666" bordercolordark="#FFFFFF" bgcolor="#FFFFFF" >
|
||
<tr bgcolor="#E6E6E6">
|
||
<td colspan="3">
|
||
<?php echo $tableTitle; ?>
|
||
</td>
|
||
</tr>
|
||
<?php
|
||
if ($mode == "edit"){
|
||
echo "<tr>";
|
||
echo "<td width=\"40%\">$strTariffRentID</td>";
|
||
echo "<td width=\"60%\">$id</td>";
|
||
echo "<input type=\"hidden\" name=\"tariff_id\" value=\"$rows[tariff_id]\" size=\"25\">";
|
||
$return_tariff_id = $rows[tariff_id]; //定义返回时的页面
|
||
|
||
echo "</tr>";
|
||
|
||
echo "<tr>";
|
||
echo "<td>$strDescription</td>";
|
||
if(1==$id){
|
||
echo "<td>$rows[description]</td>";
|
||
echo "<td><input type=\"hidden\" name=\"description\" size=\"10\" value=\"$rows[description]\"></td>";
|
||
}
|
||
else
|
||
echo "<td><input type=\"text\" name=\"description\" size=\"10\" value=\"$rows[description]\"></td>";
|
||
echo "</tr>";
|
||
|
||
echo "<tr>";
|
||
echo "<td>$strTariffRentChargeType</td>";
|
||
$arr_RentType = array("Every day","Every month");
|
||
$length = sizeof($arr_RentType);
|
||
echo "<td>";
|
||
echo "<select onChange=\"javascript:selectType();\" name=\"rent_type\" id=\"rent_type\">";
|
||
//检查是否处于编辑状态
|
||
if($edit != 1){
|
||
$rent_type = $rows[rent_type];
|
||
}
|
||
else {
|
||
$rent_type=$rent_type;
|
||
}
|
||
for ($i=0;$i<$length;$i++)
|
||
{
|
||
echo "<option value=\"$i\" ";
|
||
if ($i == $rent_type)
|
||
{
|
||
echo "selected";
|
||
}
|
||
echo ">$arr_RentType[$i]</option>";
|
||
}
|
||
echo "</select>";
|
||
echo "</td>";
|
||
echo "</tr>";
|
||
|
||
echo "<tr>";
|
||
echo "<td>$strTariffRentChargeDate</td>";
|
||
echo "<td>";
|
||
if ($rent_type =='1')
|
||
{
|
||
echo "<select name=\"rent_day\" >";
|
||
for ($i=1;$i<=28;$i++)
|
||
{
|
||
echo "<option value=\"$i\" ";
|
||
if ($i == $rows[charge_date])
|
||
{
|
||
echo "selected";
|
||
}
|
||
echo ">$i</option>";
|
||
}
|
||
echo "</select>";
|
||
}
|
||
elseif ($rent_type == '0'){
|
||
echo "--";
|
||
}
|
||
echo "</td>";
|
||
echo "</tr>";
|
||
|
||
echo "<tr>";
|
||
echo "<td>$strTariffRentChargeAmount</td>";
|
||
echo "<td><input type=\"text\" name=\"Charge_amount\" size=\"10\" value=\"$rows[rent_amount]\" class=\"text\"> $moneyPara </td>";
|
||
echo "</tr>";
|
||
}
|
||
elseif ($mode == "add"){
|
||
echo "<tr>";
|
||
echo "<td width=\"40%\">$strTariffRentID</td>";
|
||
echo "<td width=\"60%\">$id<input type=\"hidden\" name=\"rent_id\" value=\"$id\"></td>";
|
||
echo "</tr>";
|
||
echo "<tr>";
|
||
echo "<td>$strTariffRentChargeType</td>";
|
||
$arr_RentType = array("Every day","Every month");
|
||
$length = sizeof($arr_RentType);
|
||
echo "<td>";
|
||
echo "<select onChange=\"javascript:selectType();\" name=\"rent_type\">";
|
||
for ($i=0;$i<$length;$i++)
|
||
{
|
||
echo "<option value=\"$i\">$arr_RentType[$i]</option>";
|
||
}
|
||
echo "</select>";
|
||
echo "</td>";
|
||
echo "</tr>";
|
||
|
||
echo "<tr>";
|
||
echo "<td>$strTariffRentChargeDate</td>";
|
||
echo "<td>";
|
||
if ($rent_type=='1'){
|
||
echo "<select name=\"rent_day\">";
|
||
for ($i=1;$i<=28;$i++){
|
||
echo "<option value=\"$i\">$i</option>";
|
||
}
|
||
echo "</select>";
|
||
}
|
||
elseif ($rent_type=='0'){
|
||
echo "--";
|
||
}
|
||
else {echo "--";}
|
||
echo "</td>";
|
||
echo "</tr>";
|
||
|
||
echo "<tr>";
|
||
echo "<td>$strDescription</td>";
|
||
echo "<td><input type=\"text\" name=\"description\" size=\"16\" value=\"\" class=\"text\"></td>";
|
||
echo "</tr>";
|
||
|
||
echo "<tr>";
|
||
echo "<td>$strTariffRentChargeAmount</td>";
|
||
echo "<td><input type=\"text\" name=\"charge_amount\" size=\"10\" value=\"\" class=\"text\"> $moneyPara </td>";
|
||
echo "</tr>";
|
||
}
|
||
?>
|
||
</table>
|
||
<table width="400">
|
||
<tr>
|
||
<td>
|
||
<input type="hidden" name="tariffID" value="<?php echo $tariffID;?>">
|
||
<input type="submit" name="set" value="Set" style="width:40" class="button">
|
||
<input type="reset" name="reset" value="Reset" class="button">
|
||
<input type="button" name="return" value="Return" onclick=jacascript:location.href="./tariffBasic.php" class="button">
|
||
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
</form>
|
||
<?php
|
||
adjust_content_tail();
|
||
?>
|
||
</body>
|
||
</html>
|