<?php
/*********************************************************      
 程序说明：         
    功能说明：pps用户数据维护专用页面
		1、将用户数据表的数据导入到临时参数表。
		2、修改的用户数据保存到临时参数表中，
		3、设置用户参数时,返回值将修改用户表和临时表。

    调用关系：调用: header.inc
 
    变量说明：
		输入变量：
			$keyValue	:由用户列表传来
			$sysId		:由用户列表传来或本页面指定
			$dataTypeNo	:数据类型，0=用户数据，1=冲值卡数据
			$language	:语言种类
			$canSetNum	:每次最多可以修改的字段个数

 作者：
      
修改注释：      
NO.1      
姓名： 
修改说明：将过期时间（expiration_date）的改成只读模式。 
No.2
Name: Lilong
Date: Wednesday, March 24, 2004
Description: Modify supporting R7.0
No.3
Name: CuiTicun    Date:2004-04-09
Description: Modify supporting R7.0
No.4
Name: Lilong    Date:2004-7-2
Description: delete voice prompt 1
No.5
Name: CUiTicun    Date:2004-7-20
Description: Mofify "recharge failed times、overdraft、
			 access day、SM inquiry counter、favorite 
			 number counter"readonly
No.6
Name: CUiTicun    Date:2004-8-29
Description: 

*********************************************************/  
require("../../inc/header.inc");
$DEBUG = 0;
global $pubConn;
if($DEBUG) echo "<br>正在调试中，给您的工作带来不便，请原谅！！：）";

//==========================================================
//变量定义
//==========================================================
$canwrite_flag=checkWritePrivilege();
$pubDb				= 'OMC_PUB';
$sysSubsConfTable	= 'OMC_PUB.sysSubsConf';
$systemConfTable	= 'OMC_PUB.sysConf';

$nReadComm		= 1;
$nChangeComm	= 2;
$nCreateComm	= 3;
$nDeleteComm	= 4;
$nLoadIndexComm	= 5;

$maxLevelNum = 10;

$nInteger	= 2;
$nAscStr	= 3;
$nHexStr	= 4;

$rentTypeDef=array(
		//array('Name',		'offset','remark'),
		array('rent01',		'00.0'	,'VMS rent'),
		array('rent02',		'00.1'	,'Rent01'),
		array('rent03',		'00.2'	,'Rent02'),
		array('rent04',		'00.3'	,'Rent03'),
		array('rent05',		'00.4'	,'Rent04'),
		array('rent06',		'00.5'	,'Rent05'),
		array('rent07',		'00.6'	,'Rent06'),
		array('rent08',		'00.7'	,'Rent07'),
);

//select sum(balance) from user_info
//==========================================================
//输入变量
//==========================================================
$canSetNum=$_REQUEST['canSetNum'];
$keyValue=$_REQUEST['keyValue'];
$subSysNo=$_REQUEST['subSysNo'];
$dataTypeNo=$_REQUEST['dataTypeNo'];

if ($_REQUEST['sysId'])
{
	$sysId =   $_REQUEST['sysId'];
	if($DEBUG) echo "<br>sysId=$sysId";
	$sysIdArr=explode('_',$sysId);
	$sysTypeNo=$sysIdArr[0];
	$sysNo=$sysIdArr[1];
	//	echo "sysTypeNo=$sysTypeNo,sysNo=$sysNo";
}
$canSetNum = isset($canSetNum)?$canSetNum:'all';
//显示用户数据编辑页面，需要的变量
if($DEBUG) echo "<br>sysId=$sysId";
if($DEBUG) echo "<br>canSetNum=$canSetNum";
if($DEBUG) echo "<br>keyValue=$keyValue";
if($DEBUG) echo "<br>sysTypeNo=$sysTypeNo";
if($DEBUG) echo "<br>sysNo=$sysNo";
if($DEBUG) echo "<br>subSysNo=$subSysNo";
if($DEBUG) echo "<br>dataTypeNo=$dataTypeNo";
//例如：
//$canSetNum =1; // 或= 'all'
//$sysId='330_0_0';
//$keyValue= '0460022157127016';

//操作类型变量
$isLoadIndex=$_REQUEST['isLoadIndex'];
$isTryCreate=$_REQUEST['isTryCreate'];
$isBatchCreate=$_REQUEST['isBatchCreate'];
$isCreate=$_REQUEST['isCreate'];
$isDelete=$_REQUEST['isDelete'];
$isChange=$_REQUEST['isChange'];
$isRead=$_REQUEST['isRead'];
$batchNum=$_REQUEST['batchNum'];
if($DEBUG) echo "<br>isRead=$isRead";
if($DEBUG) echo "<br>isChange=$isChange";
if($DEBUG) echo "<br>isCreate=$isCreate";
if($DEBUG) echo "<br>isDelete=$isDelete";
if($DEBUG) echo "<br>isLoadIndex=$isLoadIndex";

$bgnNo=$_POST['bgnNo'];
$endNo=$_POST['endNo'];
//保存用户数据修改的数据
if($DEBUG) echo "<br>bgnNo=$bgnNo";	
if($DEBUG) echo "<br>endNo=$endNo";	

//---------定义需要编辑保存的字段-------
//$showAttrDef=array(array('fieldName'=>'','inputName'=>'');
$showAttrDef=array(
	array('fieldName'=>'msisdn',					'inputName'=>'iMsisdn'),
	array('fieldName'=>'PIN',				'inputName'=>'iPIN'),
	array('fieldName'=>'status',					'inputName'=>'iStatus'),
	array('fieldName'=>'rent_type',				'inputName'=>'iUserType'),
	array('fieldName'=>'home_location0',	'inputName'=>'iHomeLocation0'),
	array('fieldName'=>'home_location1',	'inputName'=>'iHomeLocation1'),
	array('fieldName'=>'home_location2',	'inputName'=>'iHomeLocation2'),
	array('fieldName'=>'home_location3',	'inputName'=>'iHomeLocation3'),
	array('fieldName'=>'cug_id',					'inputName'=>'iCugID'),
	array('fieldName'=>'language_type',		'inputName'=>'iLanguageSet'),
	array('fieldName'=>'fav_change_counter',	'inputName'=>'iFavChangeCounter'),
	array('fieldName'=>'favorite_number0',	'inputName'=>'iFavoriteNumber0'),
	array('fieldName'=>'favorite_number1',	'inputName'=>'iFavoriteNumber1'),
	array('fieldName'=>'favorite_number2',	'inputName'=>'iFavoriteNumber2'),
	array('fieldName'=>'favorite_number3',	'inputName'=>'iFavoriteNumber3'),
	array('fieldName'=>'favorite_number4',	'inputName'=>'iFavoriteNumber4'),
	//array('fieldName'=>'free_sms_remaining_days', 'inputName'=>'ifree_sms_remaining_days'),
	array('fieldName'=>'pool_account_type', 'inputName'=>'ipool_account_type'),
	array('fieldName'=>'child_account_number', 'inputName'=>'ichild_account_number'),
	//array('fieldName'=>'child_number_edit_count', 'inputName'=>'ichild_number_edit_count'),
	array('fieldName'=>'child_number1', 'inputName'=>'ichild_number1'),
	array('fieldName'=>'child_number2', 'inputName'=>'ichild_number2'),
	array('fieldName'=>'child_number3', 'inputName'=>'ichild_number3'),
	array('fieldName'=>'child_number4', 'inputName'=>'ichild_number4'),
	array('fieldName'=>'child_number5', 'inputName'=>'ichild_number5'),
	array('fieldName'=>'parent_number', 'inputName'=>'iparent_number'),
	//array('fieldName'=>'intraday_calls', 'inputName'=>'iintraday_calls'),
	//array('fieldName'=>'intraday_sms', 'inputName'=>'iintraday_sms'),
	//array('fieldName'=>'intraday_charged_balance', 'inputName'=>'iintraday_charged_balance'),
	//array('fieldName'=>'cap_gprs_volume', 'inputName'=>'icap_gprs_volume'),
	//array('fieldName'=>'cap_gprs_balance', 'inputName'=>'icap_gprs_balance'),
	//array('fieldName'=>'gprs_volume_this_month', 'inputName'=>'igprs_volume_this_month'),
	//array('fieldName'=>'gprs_notification_times_today', 'inputName'=>'igprs_notification_times_today')
	array('fieldName'=>'callme_back_request_times', 'inputName'=>'icallme_back_request_times'),
	array('fieldName'=>'favorite_plan_id', 'inputName'=>'ifavorite_plan_id'),
	array('fieldName'=>'favorite_free_call_duration', 'inputName'=>'ifavorite_free_call_duration'),
	array('fieldName'=>'favorite_free_sms', 'inputName'=>'ifavorite_free_sms'),
	array('fieldName'=>'favorite_plan_state', 'inputName'=>'ifavorite_plan_state')
);

//For operation log use
{
	$iStatus_def=array(
		"00"=>"Fresh","0"=>"Fresh",
		"01"=>"Used","1"=>"Used",
		"02"=>"Suspended","2"=>"Suspended",
		"03"=>"Blacklist","3"=>"Blacklist",
		"04"=>"Released","4"=>"Released",
		"05"=>"OPR Trial","5"=>"OPR Trial"
	);
	
	$pool_account_type_def=array(
		0=>"Normal",
		1=>"Parent",
		2=>"Child"
	);
}

$logFieldDef=array(
	'iPIN',
	'iStatus',
	'iUserType',
	'iHomeLocation0',
	'iHomeLocation1',
	'iHomeLocation2',
	'iHomeLocation3',
	'iCugID',
	'iLanguageSet',
	'iFavoriteNumber0',
	'iFavoriteNumber1',
	'iFavoriteNumber2',
	'iFavoriteNumber3',
	'iFavoriteNumber4',
	//'ifree_sms_remaining_days',
	'ipool_account_type',
	//'ichild_account_number',
	//'ichild_number_edit_count',
	'ichild_number1',
	'ichild_number2',
	'ichild_number3',
	'ichild_number4',
	'ichild_number5',
	'iparent_number',
	//'iintraday_calls',
	//'iintraday_sms',
	//'iintraday_charged_balance',
	//'icap_gprs_volume',
	//'icap_gprs_balance',
	//'igprs_volume_this_month',
	//'igprs_notification_times_today'
	'icallme_back_request_times',
	'ifavorite_plan_id',
	'ifavorite_free_call_duration',
	'ifavorite_free_sms',
	'ifavorite_plan_state',
);


if($_SERVER['REQUEST_METHOD'] == "POST"){
	//system("echo '-------------------------------------'>>/tmp/test.txt");
	$pre_keyvalue = $_POST['pre_keyvalue'];
	$log_sysTypeName = $_POST['log_sysTypeName'];
	$log_sysNo = $_POST['log_sysNo'];
	$log_subSysNo = $_POST['log_subSysNo'];
	$preValueInfo="Change $pre_keyvalue ";
	$isChangeFlag=0;
	for($i=0;$i<sizeof($logFieldDef);$i++){
		$inputName	=$logFieldDef[$i];
		$inputValue	=${$inputName};
		$ppName=$inputName."_ppvalue";
		$ddName=$inputName."_ddef";
		$cdName=$inputName."_cdef";
		$nnName=$inputName."_name";
		$tmpv=$_POST[$ppName];
		$tmpd=$_POST[$ddName];
		$tmpc=$_POST[$cdName];
		$tmpn=$_POST[$nnName];
		if(strlen($inputValue)){
			//echo "<br>$inputName	= $inputValue";
			if(isset($$ddName))
			{
				$tmpv=$$ppName;
				$val1=${$$ddName}[$tmpv];
				$val2=${$$ddName}[$inputValue];
				if(strlen($$ppName) == 0)
					$val1="NoValue";
				
				if(strcasecmp($val1,$val2) != 0)
				{
					$isChangeFlag=1;
					$preValueInfo.="[{$$nnName},{$val1}->{$val2}]";
					//system("echo '[{$$nnName},{$val1}->{$val2}]' >>/tmp/test.txt");
				}
			}
			else if(isset($$cdName))
			{
				$newValue="";
				for($iii=0;$iii<sizeof(${$$cdName});$iii++)
				{
					$chkname=${$$cdName}[$iii][0];
					if($$chkname == '1')
						$newValue.=${$$cdName}[$iii][2].",";
				}
				$newValue=substr($newValue,0,strlen($newValue)-1);
				if(strcasecmp($$ppName,$newValue) != 0)
				{
					$isChangeFlag=1;
					$preValueInfo.="[{$$nnName},({$$ppName})->({$newValue})]";
					//system("echo '[{$$nnName},({$$ppName})->({$newValue})]' >>/tmp/test.txt");
				}
			}
			else
			{
				if(strlen($$ppName) == 0)
					$$ppName="NoValue";
				if(strcasecmp($$ppName,$inputValue) != 0)
				{
					$isChangeFlag=1;
					$preValueInfo.="[{$$nnName},{$$ppName}->$inputValue]";
					//system("echo '[{$$nnName},{$$ppName}->$inputValue]'>>/tmp/test.txt");
				}
			}
		}else{
			//echo "<br>Can not find $inputName's value";
		}
	}
	if($isChangeFlag==1)
	{
		$preValueInfo.=" in {$log_sysTypeName}_{$log_sysNo}_{$log_subSysNo}";
		insertLog($preValueInfo);
	}
}

//处理各个的输入单元的值，组成各个需要编辑的字段值
if($_SERVER['REQUEST_METHOD'] == "POST"){
	$msisdn=$_POST['iMsisdn'];
	//iUserType
	$orgValue=$iUserType;
	$orgValue = sprintf("%02x",$orgValue);  //需要理解
	//echo "<1>orgValue=$orgValue<br>";
	for($i=0;$i<sizeof($rentTypeDef);$i++){
		$inputName	=$rentTypeDef[$i][0];
		$inputValue	=${$inputName};
		if(strlen($inputValue) == 0){
			$inputValue=0;
		}
		$inputOffset=$rentTypeDef[$i][1];
		$orgValue=setBitValue($orgValue,$inputOffset,$inputValue);
	}
	//echo "<2>orgValue=$orgValue<br>";
	//$user_type=hexdec($orgValue);
	$rent_type=$orgValue;
	//echo "user_type=$user_type<br>";
	$PIN				 =$_POST['iPIN'];
	$status				 =$_POST['iStatus'];
	$home_location0		 =DecHex($_POST['iHomeLocation0']);
	$home_location1		 =DecHex($_POST['iHomeLocation1']);
	$home_location2		 =DecHex($_POST['iHomeLocation2']);
	$home_location3		 =DecHex($_POST['iHomeLocation3']);
	$language_type       = $_POST['iLanguageSet'];
	$cug_id              = $_POST['iCugID'];
	$fav_change_counter	 = $_POST['iFavChangeCounter'];
	$favorite_number0	     = $_POST['iFavoriteNumber0'];
	$favorite_number1	     = $_POST['iFavoriteNumber1'];
	$favorite_number2	     = $_POST['iFavoriteNumber2'];
	$favorite_number3	     = $_POST['iFavoriteNumber3'];
	$favorite_number4	     = $_POST['iFavoriteNumber4'];
	$free_sms_remaining_days=$_POST['ifree_sms_remaining_days'];
	$pool_account_type = $_POST['ipool_account_type'];
	$child_account_number = $_POST['ichild_account_number'];
	$child_number_edit_count =$_POST['ichild_number_edit_count'];
	$child_number1 = $_POST['ichild_number1'];
	$child_number2 = $_POST['ichild_number2'];
	$child_number3 = $_POST['ichild_number3'];
	$child_number4 = $_POST['ichild_number4'];
	$child_number5 = $_POST['ichild_number5'];
	$parent_number = $_POST['iparent_number'];
	$intraday_calls =$_POST['iintraday_calls'];
	$intraday_sms = $_POST['iintraday_sms'];
	$intraday_charged_balance = $_POST['iintraday_charged_balance'];
	$cap_gprs_volume = $_POST['icap_gprs_volume'];
	$cap_gprs_balance = $_POST['icap_gprs_balance'];
	$gprs_volume_this_month = $_POST['igprs_volume_this_month'];
	$gprs_notification_times_today=$_POST['igprs_notification_times_today'];	
	$callme_back_request_times=$_POST['icallme_back_request_times'];	
	$favorite_plan_id=$_POST['ifavorite_plan_id'];
	$favorite_free_call_duration=$_POST['ifavorite_free_call_duration'];
	$favorite_free_sms=$_POST['ifavorite_free_sms'];
	$favorite_plan_state=$_POST['ifavorite_plan_state'];

	//格式化每个需要保存的字段，以便数据处理模块处理
	$bgnNo=0;
	$endNo=0;
	// echo "<pre>";
	// print_r($showAttrDef);
	// echo "</pre>";
	for($i=$bgnNo;$i<sizeof($showAttrDef);$i++){
			if($oldFieldName == $showAttrDef[$i][fieldName]){
			continue;
		}
		$oldFieldName = $showAttrDef[$i][fieldName];


		${'checkBox_'.$endNo} =1;
		${'fieldName_'.$endNo}=$oldFieldName;
		${'editValue_'.$endNo}=${$oldFieldName};
		if($DEBUG) echo "<br>checkBox_$endNo	= ${'checkBox_'.$endNo}";
		if($DEBUG) echo "<br>fieldName_$endNo	= ${'fieldName_'.$endNo}";
		if($DEBUG) echo "<br>editValue_$endNo	= ${'editValue_'.$endNo}";
		$endNo++;
	}
}
//==========================================================
//数据处理
//==========================================================
if (1 == $isLoadIndex) {
	$fieldNameList		= "msisdn,status,balance,mo_expiration_date,mt_expiration_date,cug_id,access_date";
} else {
	$fieldNameList		= "ALL";
}
if ($DEBUG) echo "fieldNameList=$fieldNameList<br>";

?>
<base target="_self">
<body leftmargin="15" rightmargin="10" onload="javascript:adjust_frame('down');" onresize="javascript:adjust_frame('down');" style="overflow:hidden;overflow-x:hidden;overflow-y:hidden;">

<?php
require("../pubSubsMng/sendComm.inc");
//exit();
require("../pubSubsMng/dataProc.inc");

//==========================================================
//输出并显示数据
//==========================================================
$seqNo=0;
?>

<?php
adjust_head_frame("down");
adjust_title_head_frame("down");
adjust_title_tail_frame("down");

adjust_content_head_frame("down");	
echo "<br>";
//**********************************编辑参数时所用javascript*****************************************
?>
<script LANGUAGE="JavaScript">
function selCheckBox(thisCheckBox)
{
	if(thisCheckBox.checked == true){
		thisCheckBox.value=1;
	}else{
		thisCheckBox.value=0;
	}
}

function askSureToDel(keyName,keyId)
{
	var answer = confirm("Are you sure to delete this subscriber( "+keyName+"="
                          + keyId + ") from <?php echo"$sysTypeName";?> server?");
    if (answer == true){
		window.location.href = "<?php echo "$PHP_SELF?sysId=$sysId&dataTypeNo=$dataTypeNo&bufferNo=$bufferNo&keyValue=$keyValue&isDelete=1";?>";
		//alert('Try to send delete command');
	}else{
		return(false);
	}
}
</script>

<FORM method="POST" name="update" action="<?php echo"$PHP_SELF";?>" >
<!--***************** TABLE  START:: DISPLAY SELECT HEADER    **************-->
<TABLE border="0" cellpadding="0" cellspacing="0" width="100%">
    <TR VALIGN="BOTTOM">
		<TD><NOBR>Server ID:
		<SELECT name="sysId" size="1">
			<?php
			$selSysIdSql="SELECT sysNo,subSysNo,sysTypeName 
						FROM sysInfo,sysConf 
						WHERE sysInfo.sysTypeNo='$sysTypeNo' AND sysConf.sysTypeNo='$sysTypeNo'
						ORDER BY baseStat DESC,updateTime DESC
						";
			if($DEBUG) echo "<br>$selSysIdSql";
			$sysIdResult=mysqli_query($pubConn,$selSysIdSql);
			echo mysqli_error($pubConn);
			while($sysIdRows=mysqli_fetch_array($sysIdResult)){
				echo "<option value=\"$sysTypeNo"."_$sysIdRows[sysNo]"."_$sysIdRows[subSysNo]\"";
				if(($sysNo == $sysIdRows[sysNo]) && ($subSysNo == $sysIdRows[subSysNo]))
					echo " selected";
				echo " >$sysIdRows[sysTypeName]"."_$sysIdRows[sysNo]"."_$sysIdRows[subSysNo]";
				echo "</option>";
			}
			?>
		</SELECT>
		</NOBR></TD>

		<?php 
		if(!isset($isTryCreate)||$isTryCreate <= 0){
		?>
		<TD><NOBR>
			<?php
			$showkeyValue= $keyValue;
			$keyValueName='MSISDN';
			echo "&nbsp;&nbsp;$keyValueName:$showkeyValue";
			?>
			&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
		</NOBR></TD>
		<?php 
		}
		?>
		<?php 
		if($isTryCreate > 0){
			if($isBatchCreate> 0){
		?>
			<TD><NOBR>
				&nbsp;&nbsp;&nbsp;
				Batch amount(<=100):<input type="text" name="batchNum" class="text"  maxlength="3" size="3">
			</TD>
		<?php 
			}
		?>

		<TD>
			<input type="submit" value="Create in <?php echo "$sysTypeName"?>" name="create" title="" class="button" onClick="javascript:document.update.isCreate.value=1;">
			<input type="hidden" value="0" name="isCreate">
			<input type="hidden" value="0" name="isChange">
			<input type="hidden" value="<?php echo "$isBatchCreate"; ?>" name="isBatchCreate">
		</TD>
		<?php
			$myPrivilege = $userInfo[privilege];
			if($myPrivilege >=4){
		?>
		<TD>
			&nbsp;&nbsp;&nbsp;
			<input type="submit" value="Create in OMC" name="create" title=""  class="button" onClick="javascript:document.update.isCreate.value=2;">
		</TD>
		<?php
			}
		?>

		<?php
		}else{
		?>
		<TD>
			<?php
			echo "<input type=\"submit\" value=\"Get\" name=\"read\" title=\"\"  class=\"button\" onClick=\"javascript:document.update.isRead.value=1;\">";
			?>
			<input type="hidden" value="0" name="isRead">
		</TD>

		<TD>
			<?php
			if($canwrite_flag)
				echo "<input type=\"submit\" value=\"Set\" name=\"change\" title=\"\"  class=\"button\" onClick=\"javascript:document.update.isChange.value=1;\">";
			else
				echo "<input type=\"submit\" disabled value=\"Set\" name=\"change\" title=\"\"  class=\"button\" onClick=\"javascript:document.update.isChange.value=1;\">";
			?>
			<input type="hidden" value="0" name="isChange">
			<input type="hidden" value="0" name="isCreate">
		</TD>
		
		<TD>
			<?php
			if($canwrite_flag)
				echo "<input type=\"button\" value=\"Delete\" name=\"delete\" title=\"Delete this subscriber\"  class=\"button\" onClick=\"askSureToDel('$keyValueName','$keyValue');\">";
			else
				echo "<input type=\"button\" disabled value=\"Delete\" name=\"delete\" title=\"Delete this subscriber\"  class=\"button\" onClick=\"askSureToDel('$keyValueName','$keyValue');\">";
			?>
			<input type="hidden" value="0" name="isDelete">
		</TD>
	<?php
	}
	?>
  <TD width="100%">&nbsp;</TD>
  </TR>  
</TABLE>
<!--*****************  TABLE END:: DISPLAY SELECT HEADER    **************  -->

<BR>

<!--***************** TABLE  START:: DISPLAY USER DETAILS    ************** -->
<TABLE border="1" width="100%" cellpadding="2" cellspacing="0"  bordercolor="#666666" bordercolordark="#FFFFFF" bgcolor="#FFFFFF">    
<TR bgcolor="#E6E6E6"> 
<TD width="5%"> No.</TD>   
<TD width="25%">Name</TD>   
<TD width="20%">Value</TD>     
<TD width="50%">Description</TD>    
</TR>
<?php
//msisdn
if($isTryCreate > 0){
	// echo "<pre>";
	// print_r($tmpRow);
	// echo "</pre>";

//	echo "$tmpRow[msisdn],$tmpRow[msisdn],$tmpRow[msisdn]<br>";
	$msisdn=$tmpRow[msisdn];
	echo "\n <TR>";
	echo "<TD> $seqNo </TD>";
	$seqNo++;
	if($isBatchCreate > 0)
		echo "<TD>Start MSISDN</TD>";
	else
		echo "<TD>MSISDN</TD>";
	echo "<TD>";
	echo "<input type=\"text\" name=\"iMsisdn\" maxlength=\"16\" size=\"20\" value=\"\" class=\"text\">";
	echo "</TD>";
	echo "<TD>MSISDN = phone number of the subscriber. Includes the country code and area code,len should be 9-16</TD>";
	echo "</TR>";
}else{
	echo "<input type=\"hidden\" name=\"iMsisdn\" value=\"$keyValue\">";
}

echo "<input type=\"hidden\" name=\"log_sysTypeName\" value=\"$sysTypeName\">";
echo "<input type=\"hidden\" name=\"log_sysNo\" value=\"$sysNo\">";
echo "<input type=\"hidden\" name=\"log_subSysNo\" value=\"$subSysNo\">";
echo "<input type=\"hidden\" name=\"pre_keyvalue\" value=\"$keyValue's\">";

//PIN
$iPIN=substr($tmpRow[PIN],0,6);
echo "\n <TR>";
echo "<TD> $seqNo </TD>";
$seqNo++;
echo "<TD>Password</TD>";
echo "<TD>";
echo "<input type=\"text\" name=\"iPIN\" maxlength=\"6\" value=\"$iPIN\" class=\"text\">";
echo "</TD>";
echo "<input type=\"hidden\" name=\"iPIN_name\" value=\"Password\">";
echo "<input type=\"hidden\" name=\"iPIN_ppvalue\" value=\"$iPIN\">";
echo "<TD>Pin of the account,only support digits of 0-9</TD>";
echo "</TR>";

//Subscriber status
$statusDef=array(
		array('00','Fresh'),
		array('01','Used'),
		array('02','Suspended'),
		array('03','Blacklist'),
		array('04','Released'),
		array('05','OPR Trial')
				);
$status =$tmpRow[status];
echo "\n <TR>";
echo "<TD> $seqNo </TD>";
$seqNo++;
echo "<TD>Status</TD>";
echo "<TD>";
echo "<select  name=\"iStatus\" size=\"1\">";
for($i=0;$i<sizeof($statusDef);$i++){
	if($statusDef[$i][0] == $status){
		echo "<option value=\"{$statusDef[$i][0]}\" selected>{$statusDef[$i][1]}</option>";
	}else{
		echo "<option value=\"{$statusDef[$i][0]}\">{$statusDef[$i][1]}</option>";
	}
}
echo "</select>";
echo "</TD>";
echo "<input type=\"hidden\" name=\"iStatus_name\" value=\"Status\">";
echo "<input type=\"hidden\" name=\"iStatus_ppvalue\" value=\"$status\">";
echo "<input type=\"hidden\" name=\"iStatus_ddef\" value=\"iStatus_def\">";
echo "<TD>Fresh=not activated, Used=activated, Suspended=suspended from prepaid service, Blacklist=blacklisted, Released=released from service suspension</TD>";
echo "</TR>";

//Balance
$pssCardMinCount = getPubVar('pssCardMinCount') - 0;
$dotLen = strLen($pssCardMinCount) - 1;
$fmtBit = "%01.".$dotLen."f";
$balance=$tmpRow[balance] ;// $pssCardMinCount;
//$balance=sprintf ("$fmtBit", $balance);
$balance=showComma($balance);
echo "\n <TR>";
echo "<TD> $seqNo </TD>";
$seqNo++;
echo "<TD>Balance</TD>";
echo "<TD>";
echo "$balance";
echo "</TD>";
echo "<TD>Balance amount of PPS account in the smallest currency unit.</TD>";
echo "</TR>";

//Promotion Balance
$pssCardMinCount = getPubVar('pssCardMinCount') - 0;
$dotLen = strLen($pssCardMinCount) - 1;
$fmtBit = "%01.".$dotLen."f";
$promotionBalance=$tmpRow[promo_balance];// $pssCardMinCount;
//$promotionBalance=sprintf ("$fmtBit", $promotionBalance);
$promotionBalance=showComma($promotionBalance);
echo "\n <TR>";
echo "<TD> $seqNo </TD>";
$seqNo++;
echo "<TD>Promotion bonus</TD>";
echo "<TD>";
echo "$promotionBalance";
echo "</TD>";
echo "<TD>Promotion balance after recharge specific recharge card in specific period, this value can not be used as periodic charge.</TD>";
echo "</TR>";


//Overdraft
$pssCardMinCount = getPubVar('pssCardMinCount') - 0;
$dotLen = strLen($pssCardMinCount) - 1;
$fmtBit = "%01.".$dotLen."f";
$iOverdraft=$tmpRow[overdraft] ;// $pssCardMinCount;
//$iOverdraft=sprintf ("$fmtBit", $iOverdraft);
$iOverdraft=showComma($iOverdraft);
echo "\n <TR>";
echo "<TD> $seqNo </TD>";
$seqNo++;
echo "<TD>Overdraft</TD>";
echo "<TD>";
echo "$iOverdraft";
echo "</TD>";
echo "<TD>Set credit amount of an account, can be positive or negative.<br>If this value is set to positive then subscriber can use the PPS service until his account balance turn to the negative overdraft value.<br>If this value is set to negative then subscriber can use PPS service until his account balance turn to the absolute overdraft value. Default=0</TD>";
echo "</TR>";

//Access day
$iFirstUsedDate  =substr($tmpRow[access_date],0,8);
echo "\n <TR>";
echo "<TD> $seqNo </TD>";
$seqNo++;
echo "<TD>Access date</TD>";
echo "<TD>";
//echo "<input type=\"text\" name=\"iFirstUsedDate\"  maxlength=\"8\" value=\"$iFirstUsedDate\" class=\"text\">";
echo "$iFirstUsedDate";
echo "</TD>";
echo "<TD>For fresh account, this is the creation date of the blank account; For activated accounts, then this is the date of the first recharge</TD>";
echo "</TR>";

//MO Expiration
$iMoExpirationDate=substr($tmpRow[mo_expiration_date],0,8);
echo "\n <TR>";
echo "<TD> $seqNo </TD>";
$seqNo++;
echo "<TD>MO Expiry date</TD>";
echo "<TD>";
echo "<input type=\"hidden\" name=\"iMoExpirationDate\" maxlength=\"8\" value=\"$iMoExpirationDate\" class=\"text\">";
echo "$iMoExpirationDate";
echo "</TD>";
echo "<TD>Format: yyyymmdd<br>Expiry date of an account to make MO call. The expiration date will be extended by every successful recharge</TD>";
echo "</TR>";

//MT Expiration
$iMtExpirationDate=substr($tmpRow[mt_expiration_date],0,8);
echo "\n <TR>";
echo "<TD> $seqNo </TD>";
$seqNo++;
echo "<TD>MT Expiry date</TD>";
echo "<TD>";
echo "<input type=\"hidden\" name=\"iMtExpirationDate\" maxlength=\"8\" value=\"$iMtExpirationDate\" class=\"text\">";
echo "$iMtExpirationDate";
echo "</TD>";
echo "<TD>Format: yyyymmdd<br>Expiry date of an account to make MT call. The expiration date will be extended by every successful recharge</TD>";
echo "</TR>";

//Promotion date
$iPromotionDate=substr($tmpRow[promo_exp_date],0,8);
echo "\n <TR>";
echo "<TD> $seqNo </TD>";
$seqNo++;
echo "<TD>Promotion bonus validity</TD>";
echo "<TD>";
//echo "<input type=\"hidden\" name=\"iMtExpirationDate\" maxlength=\"8\" value=\"$iMtExpirationDate\" class=\"text\">";
echo "$iPromotionDate";
echo "</TD>";
echo "<TD>Promotion balance expiry day,  if no promotion day set then this value should be the same as MT Expiration date</TD>";
echo "</TR>";

//COS ID
$iCosId=HexDec($tmpRow[cos_id]);
echo "\n <TR>";
echo "<TD> $seqNo </TD>";
$seqNo++;
echo "<TD>COS ID</TD>";
echo "<TD>";
//echo "<input type=\"hidden\" name=\"iMtExpirationDate\" maxlength=\"8\" value=\"$iMtExpirationDate\" class=\"text\">";
echo "$iCosId";
echo "</TD>";
echo "<TD>Class of Service (COS) defines prepaid service packages, includes service parameter, tariff plan</TD>";
echo "</TR>";

//Charge type
//$iUserType =dechex($tmpRow[rent_type]);
$iUserType =$tmpRow[rent_type];
//$iUserType = sprintf("%02x",hexdec($iUserType));    
//echo "$tmpRow[user_type],$tmpRow[user_type],$tmpRow[user_type],$iUserType<br>";
echo "\n <TR>";
echo "<TD> $seqNo </TD>";
$seqNo++;
echo "<TD>Rent type</TD>";
echo "<TD>";
$preValue="";
echo "<input type=\"hidden\" name=\"iUserType\" value=\"$iUserType\">";
for($i=0;$i<sizeof($rentTypeDef);$i++){
	$value=getBitValue($iUserType,$rentTypeDef[$i][1]);
	if($value == '1'){
		echo "<input type=\"checkbox\" name=\"{$rentTypeDef[$i][0]}\"	 onClick=selCheckBox(this) value=\"1\" checked  >{$rentTypeDef[$i][2]}<br>";
		$preValue.="{$rentTypeDef[$i][2]},";
	}else{
		echo "<input type=\"checkbox\" name=\"{$rentTypeDef[$i][0]}\"	 onClick=selCheckBox(this) value=\"0\" >{$rentTypeDef[$i][2]}<br>";
	}
}
$preValue=substr($preValue,0,strlen($preValue)-1);
echo "</TD>";
echo "<input type=\"hidden\" name=\"iUserType_name\" value=\"Rent type\">";
echo "<input type=\"hidden\" name=\"iUserType_ppvalue\" value=\"$preValue\">";
echo "<input type=\"hidden\" name=\"iUserType_cdef\" value=\"rentTypeDef\">";
echo "<TD>There are 8 rental types can be set in the Rent tariff<br>Please refer to the Rent tariff to set this rent type<br>Default=no rent</TD>";
echo "</TR>";

//Home location
$iHomeLocation0=HexDec($tmpRow[home_location0]);
echo "\n <TR>";
echo "<TD> $seqNo </TD>";
$seqNo++;
echo "<TD>Home location0</TD>";
echo "<TD>";
echo "<input type=\"text\" name=\"iHomeLocation0\" maxlength=\"2\" value=\"$iHomeLocation0\" class=\"text\">";
echo "</TD>";
echo "<input type=\"hidden\" name=\"iHomeLocation0_name\" value=\"Home location0\">";
echo "<input type=\"hidden\" name=\"iHomeLocation0_ppvalue\" value=\"$iHomeLocation0\">";
echo "<TD>Home area of the account, besides these areas, the account is treated as roaming user.255 means not set yet.</TD>";
echo "</TR>";

//Home location
$iHomeLocation1=HexDec($tmpRow[home_location1]);
echo "\n <TR>";
echo "<TD> $seqNo </TD>";
$seqNo++;
echo "<TD>Home location1</TD>";
echo "<TD>";
echo "<input type=\"text\" name=\"iHomeLocation1\" maxlength=\"2\" value=\"$iHomeLocation1\" class=\"text\">";
echo "</TD>";
echo "<input type=\"hidden\" name=\"iHomeLocation1_name\" value=\"Home location1\">";
echo "<input type=\"hidden\" name=\"iHomeLocation1_ppvalue\" value=\"$iHomeLocation1\">";
echo "<TD>Home area of the account, besides these areas, the account is treated as roaming user.255 means not set yet.</TD>";
echo "</TR>";

//Home location
$iHomeLocation2=HexDec($tmpRow[home_location2]);
echo "\n <TR>";
echo "<TD> $seqNo </TD>";
$seqNo++;
echo "<TD>Home location2</TD>";
echo "<TD>";
echo "<input type=\"text\" name=\"iHomeLocation2\" maxlength=\"2\" value=\"$iHomeLocation2\" class=\"text\">";
echo "</TD>";
echo "<input type=\"hidden\" name=\"iHomeLocation2_name\" value=\"Home location2\">";
echo "<input type=\"hidden\" name=\"iHomeLocation2_ppvalue\" value=\"$iHomeLocation2\">";
echo "<TD>Home area of the account, besides these areas, the account is treated as roaming user.255 means not set yet.</TD>";
echo "</TR>";

//Home location
$iHomeLocation3=HexDec($tmpRow[home_location3]);
echo "\n <TR>";
echo "<TD> $seqNo </TD>";
$seqNo++;
echo "<TD>Home location3</TD>";
echo "<TD>";
echo "<input type=\"text\" name=\"iHomeLocation3\" maxlength=\"2\" value=\"$iHomeLocation3\" class=\"text\">";
echo "</TD>";
echo "<input type=\"hidden\" name=\"iHomeLocation3_name\" value=\"Home location3\">";
echo "<input type=\"hidden\" name=\"iHomeLocation3_ppvalue\" value=\"$iHomeLocation3\">";
echo "<TD>Home area of the account, besides these areas, the account is treated as roaming user.255 means not set yet.</TD>";
echo "</TR>";

//CloseUserGroup ID
$iCugID=$tmpRow[cug_id];
echo "\n <TR>";
echo "<TD> $seqNo </TD>";
$seqNo++;
echo "<TD>CUG ID</TD>";
echo "<TD>";
echo "<input type=\"text\" name=\"iCugID\" maxlength=\"5\" value=\"$iCugID\" class=\"text\">";
echo "</TD>";
echo "<input type=\"hidden\" name=\"iCugID_name\" value=\"CUG ID\">";
echo "<input type=\"hidden\" name=\"iCugID_ppvalue\" value=\"$iCugID\">";
echo "<TD>Define the close user group to which this subscriber belongs<br>Any call within a single user group will be charged by the user group billing rate. PPS supports maximum 10,000 user groups<br>0=the subscriber is not a CUG user. Default=0
</TD>";
echo "</TR>";

//Language set
$iLanguageSet=$tmpRow[language_type];
echo "\n <TR>";
echo "<TD> $seqNo </TD>";
$seqNo++;
echo "<TD>Language type</TD>";
echo "<TD>";
echo "<input type=\"text\" name=\"iLanguageSet\" maxlength=\"5\" value=\"$iLanguageSet\" class=\"text\">";
echo "</TD>";
echo "<input type=\"hidden\" name=\"iLanguageSet_name\" value=\"Language type\">";
echo "<input type=\"hidden\" name=\"iLanguageSet_ppvalue\" value=\"$iLanguageSet\">";
echo "<TD>";
echo "Code of  default voice type, and announcement will be played by the code defined lanague for the account, this code is defined in SRF paramete";
echo "</TD>";
echo "</TR>";

//Recharge failed times
$iRechargeFail  =HexDec($tmpRow[recharge_fail_counter]);
echo "\n <TR>";
echo "<TD> $seqNo </TD>";
$seqNo++;
echo "<TD>Recharge failure</TD>";
echo "<TD>";
//echo "<input type=\"text\" name=\"iRechargeFail\"  maxlength=\"8\" value=\"$iRechargeFail\" class=\"text\">";
echo "$iRechargeFail";
echo "</TD>";
echo "<TD>Legal recharge failure, subscriber who breaks the threshold will be marked in blacklist and suspended from service provisioning</TD>";
echo "</TR>";

//Free SM counter
$iFreeSmCounter=HexDec($tmpRow[sm_inquiry_counter]);
echo "\n <TR>";
echo "<TD> $seqNo </TD>";
$seqNo++;
echo "<TD>SM inquiry counter</TD>";
echo "<TD>";
//echo "<input type=\"text\" name=\"iFreeSmCounter\" maxlength=\"5\" value=\"$iFreeSmCounter\" class=\"text\">";
echo "$iFreeSmCounter";
echo "</TD>";
echo "<TD>";
echo "Quantity of balance inquiry by short message in a day. System provides certain quantity of free inquiry for one day";
echo "</TD>";
echo "</TR>";
/*
//Familiy number flag
$iFavFlag=$tmpRow[fav_numbers];
echo "\n <TR>";
echo "<TD> $seqNo </TD>";
$seqNo++;
echo "<TD>Friends and family number counter</TD>";
echo "<TD>";
echo "<input type=\"hidden\" name=\"iFavFlag\" maxlength=\"5\" value=\"$iFavFlag\" class=\"text\">";
echo "$iFavFlag";
echo "</TD>";
echo "<TD>";
echo "Enable or disable favorite number service";
echo "</TD>";
echo "</TR>";
*/
//Familiy number counter
$iFavChangeCounter=HexDec($tmpRow[fav_change_counter]);
echo "\n <TR>";
echo "<TD> $seqNo </TD>";
$seqNo++;
echo "<TD>Friends and family number edit counter</TD>";
echo "<TD>";
//echo "<input type=\"text\" name=\"iFavChangeCounter\" maxlength=\"5\" value=\"$iFavChangeCounter\" class=\"text\">";
echo "$iFavChangeCounter";
echo "</TD>";
echo "<TD>";
echo "Total quantity of favorite number set. System provides certain quantity of free favorite number change";
echo "</TD>";
echo "</TR>";

//Familiy number 0
$iFavoriteNumber0=$tmpRow[favorite_number0];
echo "\n <TR>";
echo "<TD> $seqNo </TD>";
$seqNo++;
echo "<TD>Friends and family number 0</TD>";
echo "<TD>";
echo "<input type=\"text\" name=\"iFavoriteNumber0\" maxlength=\"12\" value=\"$iFavoriteNumber0\" class=\"text\">";
echo "</TD>";
echo "<input type=\"hidden\" name=\"iFavoriteNumber0_name\" value=\"Friends and family number 0\">";
echo "<input type=\"hidden\" name=\"iFavoriteNumber0_ppvalue\" value=\"$iFavoriteNumber0\">";
echo "<TD>";
echo "System provides five favorite numbers. Call to these number is charged according to favorite call tariff";
echo "</TD>";
echo "</TR>";

//Familiy number 1
$iFavoriteNumber1=$tmpRow[favorite_number1];
echo "\n <TR>";
echo "<TD> $seqNo </TD>";
$seqNo++;
echo "<TD>Friends and family number 1</TD>";
echo "<TD>";
echo "<input type=\"text\" name=\"iFavoriteNumber1\" maxlength=\"12\" value=\"$iFavoriteNumber1\" class=\"text\">";
echo "</TD>";
echo "<input type=\"hidden\" name=\"iFavoriteNumber1_name\" value=\"Friends and family number 1\">";
echo "<input type=\"hidden\" name=\"iFavoriteNumber1_ppvalue\" value=\"$iFavoriteNumber1\">";
echo "<TD>";
echo "System provides five favorite numbers. Call to these number is charged according to favorite call tariff";
echo "</TD>";
echo "</TR>";

//Familiy number 2
$iFavoriteNumber2=$tmpRow[favorite_number2];
echo "\n <TR>";
echo "<TD> $seqNo </TD>";
$seqNo++;
echo "<TD>Friends and family number 2</TD>";
echo "<TD>";
echo "<input type=\"text\" name=\"iFavoriteNumber2\" maxlength=\"12\" value=\"$iFavoriteNumber2\" class=\"text\">";
echo "</TD>";
echo "<input type=\"hidden\" name=\"iFavoriteNumber2_name\" value=\"Friends and family number 2\">";
echo "<input type=\"hidden\" name=\"iFavoriteNumber2_ppvalue\" value=\"$iFavoriteNumber2\">";
echo "<TD>";
echo "System provides five favorite numbers. Call to these number is charged according to favorite call tariff";
echo "</TD>";
echo "</TR>";

//Familiy number 3
$iFavoriteNumber3=$tmpRow[favorite_number3];
echo "\n <TR>";
echo "<TD> $seqNo </TD>";
$seqNo++;
echo "<TD>Friends and family number 3</TD>";
echo "<TD>";
echo "<input type=\"text\" name=\"iFavoriteNumber3\" maxlength=\"12\" value=\"$iFavoriteNumber3\" class=\"text\">";
echo "</TD>";
echo "<input type=\"hidden\" name=\"iFavoriteNumber3_name\" value=\"Friends and family number 3\">";
echo "<input type=\"hidden\" name=\"iFavoriteNumber3_ppvalue\" value=\"$iFavoriteNumber3\">";
echo "<TD>";
echo "System provides five favorite numbers. Call to these number is charged according to favorite call tariff";
echo "</TD>";
echo "</TR>";

//Familiy number 4
$iFavoriteNumber4=$tmpRow[favorite_number4];
echo "\n <TR>";
echo "<TD> $seqNo </TD>";
$seqNo++;
echo "<TD>Friends and family number 4</TD>";
echo "<TD>";
echo "<input type=\"text\" name=\"iFavoriteNumber4\" maxlength=\"12\" value=\"$iFavoriteNumber4\" class=\"text\">";
echo "</TD>";
echo "<input type=\"hidden\" name=\"iFavoriteNumber4_name\" value=\"Friends and family number 4\">";
echo "<input type=\"hidden\" name=\"iFavoriteNumber4_ppvalue\" value=\"$iFavoriteNumber4\">";
echo "<TD>";
echo "System provides five favorite numbers. Call to these number is charged according to favorite call tariff";
echo "</TD>";
echo "</TR>";

//Last call type
$lastCallDef=array(
		array('0','mo call'),
		array('1','mt call'),
		array('2','mf call'),
		array('3','mo sms')
				);
$lastCall =$tmpRow[last_call_type];
echo "\n <TR>";
echo "<TD> $seqNo </TD>";
$seqNo++;
echo "<TD>Last call type</TD>";
echo "<TD>";
for($i=0;$i<sizeof($lastCallDef);$i++){
	if($lastCallDef[$i][0] == $lastCall){
		$tmp=$lastCallDef[$i][1];
		echo "$tmp";
		break;
	}
}
echo "</select>";
echo "</TD>";
echo "<TD>-</TD>";
echo "</TR>";


//Last Call time
$iLastCallDate=substr($tmpRow[last_call_time],0,12);
echo "\n <TR>";
echo "<TD> $seqNo </TD>";
$seqNo++;
echo "<TD>Last call time</TD>";
echo "<TD>";
echo "<input type=\"hidden\" name=\"iMtExpirationDate\" maxlength=\"8\" value=\"$iMtExpirationDate\" class=\"text\">";
if(strlen($iLastCallDate)>0)
	echo "$iLastCallDate";
else
	echo "-";
echo "</TD>";
echo "<TD>Last call taken place time</TD>";
echo "</TR>";

//Last Call msisdn
$iLastCallMsisdn=$tmpRow[last_call_number];
echo "\n <TR>";
echo "<TD> $seqNo </TD>";
$seqNo++;
echo "<TD>Last call number</TD>";
echo "<TD>";
if(strlen($iLastCallMsisdn)>0)
	echo "$iLastCallMsisdn";
else 
	echo "-";
echo "</TD>";
echo "<TD>Last call msisdn</TD>";
echo "</TR>";


//ifree_sms_remaining_days
$free_sms_remaining_days=$tmpRow[free_sms_remaining_days];
echo "\n <TR>";
echo "<TD> $seqNo </TD>";
$seqNo++;
echo "<TD>Free SMS Remaining Days</TD>";
echo "<TD>";
if(trim($free_sms_remaining_days) == "")
	echo "-";
else
	echo "$free_sms_remaining_days";

//echo "<input type=\"text\" name=\"ifree_sms_remaining_days\" maxlength=\"18\" value=\"$free_sms_remaining_days\" class=\"text\">";
echo "</TD>";
//echo "<input type=\"hidden\" name=\"ifree_sms_remaining_days_name\" value=\"Free SMS Remaining Days\">";
//echo "<input type=\"hidden\" name=\"ifree_sms_remaining_days_ppvalue\" value=\"$free_sms_remaining_days\">";
echo "<TD>--</TD>";
echo "</TR>";


//pool_account_type
$poolAccountTypeDef=array(
		array('0','Normal'),
		array('1','Parent'),
		array('2','Child')
);
$pool_account_type =$tmpRow[pool_account_type];
echo "\n <TR>";
echo "<TD> $seqNo </TD>";
$seqNo++;
echo "<TD>Pool Account Type</TD>";
echo "<TD>";
echo "<select  name=\"ipool_account_type\" size=\"1\">";
for($i=0;$i<sizeof($poolAccountTypeDef);$i++){
	if($poolAccountTypeDef[$i][0] == $pool_account_type){
		echo "<option value=\"{$poolAccountTypeDef[$i][0]}\" selected>{$poolAccountTypeDef[$i][1]}</option>";
	}else{
		echo "<option value=\"{$poolAccountTypeDef[$i][0]}\">{$poolAccountTypeDef[$i][1]}</option>";
	}
}
echo "</select>";
echo "</TD>";
echo "<input type=\"hidden\" name=\"ipool_account_type_name\" value=\"Pool Account Type\">";
echo "<input type=\"hidden\" name=\"ipool_account_type_ppvalue\" value=\"$pool_account_type\">";
echo "<input type=\"hidden\" name=\"ipool_account_type_ddef\" value=\"pool_account_type_def\">";
echo "<TD>--</TD>";
echo "</TR>";


//child_account_number
$child_account_number=$tmpRow[child_account_number];
echo "\n <TR>";
echo "<TD> $seqNo </TD>";
$seqNo++;
echo "<TD>Child Account Number</TD>";
echo "<TD>";
if(trim($child_account_number) == "")
	echo "-";
else
	echo "$child_account_number";
//echo "<input type=\"text\" name=\"ichild_account_number\" maxlength=\"18\" value=\"$child_account_number\" class=\"text\">";
echo "</TD>";
//echo "<input type=\"hidden\" name=\"ichild_account_number_name\" value=\"Child Account Number\">";
//echo "<input type=\"hidden\" name=\"ichild_account_number_ppvalue\" value=\"$child_account_number\">";
echo "<TD>--</TD>";
echo "</TR>";

//child_number_edit_count
$child_number_edit_count=$tmpRow[child_number_edit_count];
echo "\n <TR>";
echo "<TD> $seqNo </TD>";
$seqNo++;
echo "<TD>Child Number Edit Count</TD>";
echo "<TD>";
if(trim($child_number_edit_count) == "")
	echo "-";
else
	echo "$child_number_edit_count";
//echo "<input type=\"text\" name=\"ichild_number_edit_count\" maxlength=\"18\" value=\"$child_number_edit_count\" class=\"text\">";
echo "</TD>";
//echo "<input type=\"hidden\" name=\"ichild_number_edit_count_name\" value=\"Child Number Edit Count\">";
//echo "<input type=\"hidden\" name=\"ichild_number_edit_count_ppvalue\" value=\"$child_number_edit_count\">";
echo "<TD>--</TD>";
echo "</TR>";


//child_number1
$child_number1=$tmpRow[child_number1];
echo "\n <TR>";
echo "<TD> $seqNo </TD>";
$seqNo++;
echo "<TD>Child Number 1</TD>";
echo "<TD>";
echo "<input type=\"text\" name=\"ichild_number1\" maxlength=\"18\" value=\"$child_number1\" class=\"text\">";
echo "</TD>";
echo "<input type=\"hidden\" name=\"ichild_number1_name\" value=\"Child Number 1\">";
echo "<input type=\"hidden\" name=\"ichild_number1_ppvalue\" value=\"$child_number1\">";
echo "<TD>--</TD>";
echo "</TR>";

//child_number2
$child_number2=$tmpRow[child_number2];
echo "\n <TR>";
echo "<TD> $seqNo </TD>";
$seqNo++;
echo "<TD>Child Number 2</TD>";
echo "<TD>";
echo "<input type=\"text\" name=\"ichild_number2\" maxlength=\"18\" value=\"$child_number2\" class=\"text\">";
echo "</TD>";
echo "<input type=\"hidden\" name=\"ichild_number2_name\" value=\"Child Number 2\">";
echo "<input type=\"hidden\" name=\"ichild_number2_ppvalue\" value=\"$child_number2\">";
echo "<TD>--</TD>";
echo "</TR>";

//child_number3
$child_number3=$tmpRow[child_number3];
echo "\n <TR>";
echo "<TD> $seqNo </TD>";
$seqNo++;
echo "<TD>Child Number 3</TD>";
echo "<TD>";
echo "<input type=\"text\" name=\"ichild_number3\" maxlength=\"18\" value=\"$child_number3\" class=\"text\">";
echo "</TD>";
echo "<input type=\"hidden\" name=\"ichild_number3_name\" value=\"Child Number 3\">";
echo "<input type=\"hidden\" name=\"ichild_number3_ppvalue\" value=\"$child_number3\">";
echo "<TD>--</TD>";
echo "</TR>";

//child_number4
$child_number4=$tmpRow[child_number4];
echo "\n <TR>";
echo "<TD> $seqNo </TD>";
$seqNo++;
echo "<TD>Child Number 4</TD>";
echo "<TD>";
echo "<input type=\"text\" name=\"ichild_number4\" maxlength=\"18\" value=\"$child_number4\" class=\"text\">";
echo "</TD>";
echo "<input type=\"hidden\" name=\"ichild_number4_name\" value=\"Child Number 4\">";
echo "<input type=\"hidden\" name=\"ichild_number4_ppvalue\" value=\"$child_number4\">";
echo "<TD>--</TD>";
echo "</TR>";

//child_number5
$child_number5=$tmpRow[child_number5];
echo "\n <TR>";
echo "<TD> $seqNo </TD>";
$seqNo++;
echo "<TD>Child Number 5</TD>";
echo "<TD>";
echo "<input type=\"text\" name=\"ichild_number5\" maxlength=\"18\" value=\"$child_number5\" class=\"text\">";
echo "</TD>";
echo "<input type=\"hidden\" name=\"ichild_number5_name\" value=\"Child Number 5\">";
echo "<input type=\"hidden\" name=\"ichild_number5_ppvalue\" value=\"$child_number5\">";
echo "<TD>--</TD>";
echo "</TR>";


//parent_number
$parent_number=$tmpRow[parent_number];
echo "\n <TR>";
echo "<TD> $seqNo </TD>";
$seqNo++;
echo "<TD>Parent Number</TD>";
echo "<TD>";
echo "<input type=\"text\" name=\"iparent_number\" maxlength=\"18\" value=\"$parent_number\" class=\"text\">";
echo "</TD>";
echo "<input type=\"hidden\" name=\"iparent_number_name\" value=\"Parent Number\">";
echo "<input type=\"hidden\" name=\"iparent_number_ppvalue\" value=\"$parent_number\">";
echo "<TD>--</TD>";
echo "</TR>";

//intraday_calls
$intraday_calls=$tmpRow[intraday_calls];
echo "\n <TR>";
echo "<TD> $seqNo </TD>";
$seqNo++;
echo "<TD>Intraday Calls</TD>";
echo "<TD>";
if(trim($intraday_calls) == "")
	echo "-";
else
	echo "$intraday_calls";
//echo "<input type=\"text\" name=\"iintraday_calls\" maxlength=\"18\" value=\"$intraday_calls\" class=\"text\">";
echo "</TD>";
//echo "<input type=\"hidden\" name=\"iintraday_calls_name\" value=\"Intraday Calls\">";
//echo "<input type=\"hidden\" name=\"iintraday_calls_ppvalue\" value=\"$intraday_calls\">";
echo "<TD>--</TD>";
echo "</TR>";

//intraday_sms
$intraday_sms=$tmpRow[intraday_sms];
echo "\n <TR>";
echo "<TD> $seqNo </TD>";
$seqNo++;
echo "<TD>Intraday SMS</TD>";
echo "<TD>";
//echo "<input type=\"text\" name=\"iintraday_sms\" maxlength=\"18\" value=\"$intraday_sms\" class=\"text\">";
if(trim($intraday_sms) == "")
	echo "-";
else
	echo "$intraday_sms";
echo "</TD>";
//echo "<input type=\"hidden\" name=\"iintraday_sms_name\" value=\"Intraday SMS\">";
//echo "<input type=\"hidden\" name=\"iintraday_sms_ppvalue\" value=\"$intraday_sms\">";
echo "<TD>--</TD>";
echo "</TR>";

//intraday_charged_balance
$intraday_charged_balance=$tmpRow[intraday_charged_balance];
echo "\n <TR>";
echo "<TD> $seqNo </TD>";
$seqNo++;
echo "<TD>Intraday Charged Balance</TD>";
echo "<TD>";
//echo "<input type=\"text\" name=\"iintraday_charged_balance\" maxlength=\"18\" value=\"$intraday_charged_balance\" class=\"text\">";
if(trim($intraday_charged_balance) == "")
	echo "-";
else
	echo "$intraday_charged_balance";
echo "</TD>";
//echo "<input type=\"hidden\" name=\"iintraday_charged_balance_name\" value=\"Intraday Charged Balance\">";
//echo "<input type=\"hidden\" name=\"iintraday_charged_balance_ppvalue\" value=\"$intraday_charged_balance\">";
echo "<TD>--</TD>";
echo "</TR>";


//cap_gprs_volume
$cap_gprs_volume=$tmpRow[cap_gprs_volume];
echo "\n <TR>";
echo "<TD> $seqNo </TD>";
$seqNo++;
echo "<TD>Cap GPRS Volume</TD>";
echo "<TD>";
//echo "<input type=\"text\" name=\"icap_gprs_volume\" maxlength=\"18\" value=\"$cap_gprs_volume\" class=\"text\">";
if(trim($cap_gprs_volume) == "")
	echo "-";
else
	echo "$cap_gprs_volume";
echo "</TD>";
//echo "<input type=\"hidden\" name=\"icap_gprs_volume_name\" value=\"Cap GPRS Volume\">";
//echo "<input type=\"hidden\" name=\"icap_gprs_volume_ppvalue\" value=\"$cap_gprs_volume\">";
echo "<TD>Unit: KB</TD>";
echo "</TR>";


//cap_gprs_balance
$cap_gprs_balance=$tmpRow[cap_gprs_balance];
echo "\n <TR>";
echo "<TD> $seqNo </TD>";
$seqNo++;
echo "<TD>Cap GPRS Balance</TD>";
echo "<TD>";
//echo "<input type=\"text\" name=\"icap_gprs_balance\" maxlength=\"18\" value=\"$cap_gprs_balance\" class=\"text\">";
if(trim($cap_gprs_balance) == "")
	echo "-";
else
	echo "$cap_gprs_balance";
echo "</TD>";
//echo "<input type=\"hidden\" name=\"icap_gprs_balance_name\" value=\"Cap GPRS Balance\">";
//echo "<input type=\"hidden\" name=\"icap_gprs_balance_ppvalue\" value=\"$cap_gprs_balance\">";
echo "<TD>--</TD>";
echo "</TR>";


//gprs_volume_this_month
$gprs_volume_this_month=$tmpRow[gprs_volume_this_month];
echo "\n <TR>";
echo "<TD> $seqNo </TD>";
$seqNo++;
echo "<TD>GPRS Volume of This Month</TD>";
echo "<TD>";
//echo "<input type=\"text\" name=\"igprs_volume_this_month\" maxlength=\"18\" value=\"$gprs_volume_this_month\" class=\"text\">";
if(trim($gprs_volume_this_month) == "")
	echo "-";
else
	echo "$gprs_volume_this_month";
echo "</TD>";
//echo "<input type=\"hidden\" name=\"igprs_volume_this_month_name\" value=\"GPRS Volume of This Month\">";
//echo "<input type=\"hidden\" name=\"igprs_volume_this_month_ppvalue\" value=\"$gprs_volume_this_month\">";
echo "<TD>Unit: KB</TD>";
echo "</TR>";

//gprs_notification_times_today
$gprs_notification_times_today=$tmpRow[gprs_notification_times_today];
echo "\n <TR>";
echo "<TD> $seqNo </TD>";
$seqNo++;
echo "<TD>GPRS Notification Times Today</TD>";
echo "<TD>";
//echo "<input type=\"text\" name=\"igprs_notification_times_today\" maxlength=\"18\" value=\"$gprs_notification_times_today\" class=\"text\">";
if(trim($gprs_notification_times_today) == "")
	echo "-";
else
	echo "$gprs_notification_times_today";
echo "</TD>";
//echo "<input type=\"hidden\" name=\"igprs_notification_times_today_name\" value=\"GPRS Notification Times Today\">";
//echo "<input type=\"hidden\" name=\"igprs_notification_times_today_ppvalue\" value=\"$gprs_notification_times_today\">";
echo "<TD>--</TD>";
echo "</TR>";


//callme_back_request_times
$callme_back_request_times=$tmpRow[callme_back_request_times];
echo "\n <TR>";
echo "<TD> $seqNo </TD>";
$seqNo++;
echo "<TD>Call me back request times</TD>";
echo "<TD>";
echo "<input type=\"text\" name=\"icallme_back_request_times\" maxlength=\"18\" value=\"$callme_back_request_times\" class=\"text\">";
echo "</TD>";
echo "<input type=\"hidden\" name=\"icallme_back_request_times_name\" value=\"Call me back request times\">";
echo "<input type=\"hidden\" name=\"icallme_back_request_times_ppvalue\" value=\"$callme_back_request_times\">";
echo "<TD>--</TD>";
echo "</TR>";


//favorite_plan_id
$favorite_plan_id=$tmpRow[favorite_plan_id];
echo "\n <TR>";
echo "<TD> $seqNo </TD>";
$seqNo++;
echo "<TD>Friends and Family Plan ID</TD>";
echo "<TD>";
echo "<input type=\"text\" name=\"ifavorite_plan_id\" maxlength=\"18\" value=\"$favorite_plan_id\" class=\"text\">";
echo "</TD>";
echo "<input type=\"hidden\" name=\"ifavorite_plan_id_name\" value=\"Favorite Plan ID\">";
echo "<input type=\"hidden\" name=\"ifavorite_plan_id_ppvalue\" value=\"$favorite_plan_id\">";
echo "<TD>--</TD>";
echo "</TR>";


//favorite_free_call_duration
$favorite_free_call_duration=$tmpRow[favorite_free_call_duration];
echo "\n <TR>";
echo "<TD> $seqNo </TD>";
$seqNo++;
echo "<TD>Friends and Family Free Call Duration</TD>";
echo "<TD>";
echo "<input type=\"text\" name=\"ifavorite_free_call_duration\"  maxlength=\"18\" value=\"$favorite_free_call_duration\" class=\"text\">";
echo "</TD>";
echo "<input type=\"hidden\" name=\"ifavorite_free_call_duration_name\" maxlength=\"18\" value=\"Favorite Free Call Duration\">";
echo "<input type=\"hidden\" name=\"ifavorite_free_call_duration_ppvalue\" value=\"$favorite_free_call_duration\">";
echo "<TD>--</TD>";
echo "</TR>";

//favorite_free_sms
$favorite_free_sms=$tmpRow[favorite_free_sms];
echo "\n <TR>";
echo "<TD> $seqNo </TD>";
$seqNo++;
echo "<TD>Friends and Family Free SMS</TD>";
echo "<TD>";
echo "<input type=\"text\" name=\"ifavorite_free_sms\" maxlength=\"18\" value=\"$favorite_free_sms\" class=\"text\">";
echo "</TD>";
echo "<input type=\"hidden\" name=\"ifavorite_free_sms_name\" maxlength=\"18\" value=\"Favorite Free SMS\">";
echo "<input type=\"hidden\" name=\"ifavorite_free_sms_ppvalue\" value=\"$favorite_free_sms\">";
echo "<TD>--</TD>";
echo "</TR>";


//Friends and Family Plan State
$ffPlanStateDef=array(
	array('0','Normal'),
	array('1','Suspend')
);
$favorite_plan_state =$tmpRow[favorite_plan_state];
echo "\n <TR>";
echo "<TD> $seqNo </TD>";
$seqNo++;
echo "<TD>Friends and Family Plan State</TD>";
echo "<TD>";
echo "<select  name=\"ifavorite_plan_state\" size=\"1\">";
for($i=0;$i<sizeof($ffPlanStateDef);$i++){
	if($ffPlanStateDef[$i][0] == $favorite_plan_state){
		echo "<option value=\"{$ffPlanStateDef[$i][0]}\" selected>{$ffPlanStateDef[$i][1]}</option>";
	}else{
		echo "<option value=\"{$ffPlanStateDef[$i][0]}\">{$ffPlanStateDef[$i][1]}</option>";
	}
}
echo "</select>";
echo "</TD>";
echo "<input type=\"hidden\" name=\"ifavorite_plan_state_name\" value=\"Friends and Family Plan State\">";
echo "<input type=\"hidden\" name=\"ifavorite_plan_state_ppvalue\" value=\"$favorite_plan_state\">";
echo "<input type=\"hidden\" name=\"ifavorite_plan_state_ddef\" value=\"ffPlanStateDef\">";
echo "<TD></TD>";
echo "</TR>";




?>
</TABLE> 
<?php
//*****************************************隐藏输入框,用于传递值****************************************
echo "\n<input type=\"hidden\" name=\"dataTypeNo\"		value=\"$dataTypeNo\">";
echo "\n<input type=\"hidden\" name=\"keyFieldName\"	value=\"$indexFieldName\">";
echo "\n<input type=\"hidden\" name=\"keyValue\"		value=\"$keyValue\">";
?>

</form>
&nbsp;
<?php
adjust_content_tail("down");
?>
</body>
</html>
<?php
flush();
?>
