<?PHP

require("../../inc/header.inc");
echo "<br>operator the point of x,y";
//update sysLedConf set point_x=20 WHERE key_src_page_type = '0' AND key_src_page_num = '20480' AND point_x != '999' and remark like '$likeStr' 
$pubDb = "OMC_PUB";

if(0)//map
for($i=0; $i<=11; $i++)
{
	if(strlen($i)==1) $ii = '0'.$i;
	else $ii = $i;
	$likeStr = 'BTS_'.$ii.'%';
	$point_x = 20+$i*60;
	
	$updSql = "update sysLedConf set point_x=$point_x WHERE key_src_page_type = '0' AND key_src_page_num = '20480' AND point_x != '999' and remark like '$likeStr'";
	echo "<br>updSql x = $updSql";
	mysqli_query($pubConn,$updSql);
	
	//exit;
	
	$selSql = "select * from sysLedConf where point_x=$point_x AND key_src_page_num = '20480' AND point_x != '999' and remark like '$likeStr' order by key_led_num";
	//echo "<br>selSql=$selSql";
	$result = mysqli_query($pubConn,$selSql);
	$tmp=0;
	while($row = mysqli_fetch_array($result)) {
		$keyLedNum = $row[key_led_num];
		if($tmp==0)$num = $keyLedNum;
		$poin_y = ($keyLedNum-$num+1)*40+20;
		$updSql = "update sysLedConf set point_y=$poin_y where key_led_num=$keyLedNum AND key_src_page_num = '20480' AND point_x != '999' and remark like '$likeStr'";
		//echo "<br>$updSql";
		mysqli_query($pubConn,$updSql);
		$tmp++;
	}
}

if(0)//BSS-x
{
	$pointArr = array(
		array('x' => 263,	'y' => 268),
		array('x' => 346,	'y' => 268),
		array('x' => 430,	'y' => 268),
		array('x' => 514,	'y' => 268),
		array('x' => 598,	'y' => 268),
		array('x' => 679,	'y' => 268),

		array('x' => 263,	'y' => 455),
		array('x' => 346,	'y' => 455),
		array('x' => 430,	'y' => 455),
		array('x' => 514,	'y' => 455),
		array('x' => 598,	'y' => 455),
		array('x' => 679,	'y' => 455)
		);
	for($i=20577; $i<=20588; $i++){
		$selSql = "SELECT * FROM sysLedConf WHERE key_src_page_type = '2' AND key_src_page_num = '$i' AND point_x != '999' and remark like 'BTS%' ORDER BY key_src_page_type,key_led_num ASC";
		$Result = mysqli_query($pubConn,$selSql);
		while($Rows = mysqli_fetch_array($Result)){
			$remark = $Rows[remark];
			$subNo = explode('_',$remark);
			$subNo = $subNo[2];
			$subNo -= 0;
			//echo "<br>$subNo";
			$key_led_num = $Rows[key_led_num];
			$pointX = $pointArr[$subNo][x];
			$pointY = $pointArr[$subNo][y];
			$updSql = "update sysLedConf set point_x=$pointX,point_y=$pointY WHERE key_src_page_type = '2' AND key_src_page_num = '$i' AND point_x != '999' and remark like 'BTS%' and key_led_num=$key_led_num";
			echo "<br>$updSql";
			mysqli_query($pubConn,$updSql);
		}
	}
	
	for($i=20577; $i<=20588; $i++){
		$selSql = "SELECT * FROM sysLedConf WHERE key_src_page_type = '2' AND key_src_page_num = '$i' AND point_x != '999' and remark like 'BSC%' ORDER BY key_src_page_type,key_led_num ASC";
		$Result = mysqli_query($pubConn,$selSql);
		$Rows = mysqli_fetch_array($Result);
			
			$key_led_num = $Rows[key_led_num];
			$pointX = 37;
			$pointY = 454;
			$updSql = "update sysLedConf set point_x=$pointX,point_y=$pointY WHERE key_src_page_type = '2' AND key_src_page_num = '$i' AND point_x != '999' and remark like 'BSC%' and key_led_num=$key_led_num";
			echo "<br>$updSql";
			mysqli_query($pubConn,$updSql);
	}
}

?>