<?php
include("CheckSession.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="description" content="馬戲團" />
<title>馬戲團</title>
<Script Language="javascript" src="control/calendar.js"></Script>
<link href="css/style.css" rel="stylesheet" type="text/css" />
</head>
<?php


require_once("class/DBConfig.php");
require_once("class/DBOperation.php");
require_once("class/MacOperation.php");

$tempCustomerId = $_GET["tempCustomerId"];
$QueryTel = $_POST["QueryTel"];
$AId = $_POST["AId"];

$db = new DBOperation();
$db->connect_db($_DB['host'], $_DB['username'], $_DB['password'], $_DB['dbname']);
$querySql = "select * from AdminUser where AId = ".$AId." and AFlag = '1'";
$db->query($querySql);
$myrow = $db->fetch_array();
$db->close_db();

$AName = $myrow['AName'];
$CTel = $QueryTel;

$CNickname = "";
$CArea = "";
$CSource = "";
$CGreenTel = "";
$CBlackTel = "";
$CRedTel = "";
$CMemo = "";
$id = "";
$TelClass = "";
$CCreator = "";
$CClass = "";

//消費內容判斷使用
date_default_timezone_set('Asia/Taipei');
$t=time();
$db = new DBOperation();

//判斷actionOp
$db->connect_db($_DB['host'], $_DB['username'], $_DB['password'], $_DB['dbname']);
$actionOp = "Insert";	

if($actionOp == "Insert" && ($tempCustomerId == null || $tempCustomerId == ""))
{
	$dateStr = date("YmdHis");
	$tempCustomerId = "Temp_0_".$_SESSION['userId']."_".$dateStr;
}

$rowAdminUser = null;
$x = 0;
if($QueryTel != null && $QueryTel != "")
{
	$CTel = $QueryTel;
}

?>
<SCRIPT language="JavaScript">
function validateForm(objThisUi) 
{
	return true;  
}

function DelMiss(objThisUi)
{
	document.CustomerForm.action = "CustomerMissContentDel.php";
	CustomerForm.submit();	
}
</SCRIPT>
<body>
<form name="CustomerForm" method="post" action="CustomerQueryUpdateDeal1.php" id="CustomerForm"
 onSubmit="return validateForm(this);">
<input type="hidden" name="actionOp" id="actionOp" value="<?php echo $actionOp ?>"/>
<input type="hidden" name="id" id="id" value="<?php echo $id ?>"/>
<input type="hidden" name="tempCustomerId" id="tempCustomerId" value="<?php echo $tempCustomerId ?>"/>
<input type="hidden" value="<?php echo $AId; ?>" name="AId" id="AId" />
<input type="hidden" value="<?php echo $AName; ?>" name="AName" id="AName" />
<input type="hidden" value="<?php echo $CTel; ?>" name="CTel" id="CTel" />
<table border="0" cellspacing="0" cellspadding="0" width="100%">
<!--
<tr>
<td align="center" colspan="2">
<span class="title"><b>客戶資料管理</b></span>
</td>
</tr>
-->
<tr>
<td align="left" colspan="2">
&nbsp;
</td>
</tr>
<tr>
<td align="left" colspan="2">
<span class="t14b"><b>新增/修改客戶資料</b></span>
</td>
</tr>
<tr>
<td align="left" colspan="2">

<table border="3" cellspacing="2" cellspadding="2" width="100%">
<tr>
<td align="left" width="20%">
<span class="t12">誰的客戶</span>
</td>
<td align="left" width="20%">
<span class="t12"><?php echo $AName; ?><span>
</td>
</tr>
<tr>
<td align="left" width="20%">
<span class="t12">電話</span>
</td>
<td align="left" width="85%">
<?php echo $CTel ?>
</td>
</tr>
<tr>
<td align="left" width="15%">
<span class="t12">地區</span>
</td>
<td align="left" width="85%">
<table border="0" cellspacing="5" cellspading="5">
<tr>
<td>
<span class="t12">
<input type="checkbox" name="chkTaipei" id="chkTaipei" value="N:Taipei" <?php if(str_indexof($CArea,"N:Taipei") >= 0) echo "checked"; ?>>台北
</span>
<br>
<span class="t12">
<input type="checkbox" name="chkTainan" id="chkTainan" value="S:Tainan" <?php if(str_indexof($CArea,"S:Tainan") >= 0) echo "checked"; ?>>台南
</span>
</td>
<td>
<span class="t12">
<input type="checkbox" name="chkTaoyuan" id="chkTaoyuan" value="N:Taoyuan" <?php if(str_indexof($CArea,"N:Taoyuan") >= 0) echo "checked"; ?>>桃園
</span>
<br>
<span class="t12">
<input type="checkbox" name="chkKaohsiung" id="chkKaohsiung" value="S:Kaohsiung" <?php if(str_indexof($CArea,"S:Kaohsiung") >= 0) echo "checked"; ?>>高雄
</span>
</td>
<td>
<span class="t12">
<input type="checkbox" name="chkZhongli" id="chkZhongli" value="N:Zhongli" <?php if(str_indexof($CArea,"N:Zhongli") >= 0) echo "checked"; ?>>中壢
</span>
<br>
<span class="t12">
<input type="checkbox" name="chkHualien" id="chkHualien" value="E:Hualien" <?php if(str_indexof($CArea,"E:Hualien") >= 0) echo "checked"; ?>>花蓮
</span>
</td>
<td>
<span class="t12">
<input type="checkbox" name="chkHsinchu" id="chkHsinchu" value="M:Hsinchu" <?php if(str_indexof($CArea,"M:Hsinchu") >= 0) echo "checked"; ?>>新竹
</span>
<br>
<span class="t12">
<input type="checkbox" name="chkToufen" id="chkToufen" value="M:Toufen" <?php if(str_indexof($CArea,"M:Toufen") >= 0) echo "checked"; ?>>頭份
</span>
</td>
<td>
<span class="t12">
<input type="checkbox" name="chkTaichung" id="chkTaichung" value="M:Taichung" <?php if(str_indexof($CArea,"M:Taichung") >= 0) echo "checked"; ?>>台中
</span>
<br>
&nbsp;
</td>
<td>
<span class="t12">
<input type="checkbox" name="chkZhanghua" id="chkZhanghua" value="M:Zhanghua" <?php if(str_indexof($CArea,"M:Zhanghua") >= 0) echo "checked"; ?>>彰投
</span>
<br>
&nbsp;
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td align="left">
<span class="t12">來源</span>
</td>
<td align="left">
<input type="checkbox" name="chkSourceL" id="chkSourceL" value="L" <?php if(str_indexof($CSource,"L") >= 0) echo "checked";?>>
<span class="t12">Line</span>
<input type="checkbox" name="chkSourceW" id="chkSourceW" value="W" <?php if(str_indexof($CSource,"W") >= 0) echo "checked";?>>
<span class="t12">微信</span>
<input type="checkbox" name="chkSourceT" id="chkSourceT" value="T" <?php if(str_indexof($CSource,"T") >= 0) echo "checked";?>>
<span class="t12">電話</span>
<input type="checkbox" name="chkSourceG" id="chkSourceG" value="G" <?php if(str_indexof($CSource,"G") >= 0) echo "checked";?>>
<span class="t12">即時通</span>
<input type="checkbox" name="chkSourceS" id="chkSourceS" value="S" <?php if(str_indexof($CSource,"S") >= 0) echo "checked";?>>
<span class="t12">SKYPE</span>
<input type="checkbox" name="chkSourceO" id="chkSourceO" value="O" <?php if(str_indexof($CSource,"O") >= 0) echo "checked";?>>
<span class="t12">其他</span>
</td>
</tr>
<tr>
<td align="left">
<span class="t12">類別</span>
</td>
<td align="left">
<input  type="radio" name="radClass" id="radClass" value="A" <?php if($CClass == "A") echo "checked";?>>
<span class="t12">A</span>
<input  type="radio" name="radClass" id="radClass" value="B" <?php if($CClass == "B") echo "checked";?>>
<span class="t12">B</span>
<input  type="radio" name="radClass" id="radClass" value="C" <?php if($CClass == "C") echo "checked";?>>
<span class="t12">C</span>
<input  type="radio" name="radClass" id="radClass" value="D" <?php if($CClass == "D") echo "checked";?>>
<span class="t12">D</span>
</td>
</tr>
<tr>
<td align="left" width="15%">
<span class="t12">暱稱/其他</span>
</td>
<td align="left" width="85%">
<input type="text" value="<?php echo $CNickname ?>" name="CNickname" id="CNickname" size="70" maxlength="70" style="font-size: 12.0pt;font-family: 微軟正黑體;"/>
</td>
</tr>
<tr>
<td align="left" width="15%">
<span class="t12">喜好/備註</span>
</td>
<td align="left" width="85%">
<table border="0" cellspacing="2" cellspading="2">
<tr>
<td>
<input type="checkbox" name="chk01" id="chk01" value="01" <?php if(str_indexof($CMemo,"01") >= 0) echo "checked"; ?>><span class="t12r">高價</span>
</td>
<td>
<input type="checkbox" name="chk07" id="chk07" value="07" <?php if(str_indexof($CMemo,"07") >= 0) echo "checked"; ?>><span class="t12">年輕</span>
</td>
<td>
<input type="checkbox" name="chk13" id="chk13" value="13" <?php if(str_indexof($CMemo,"13") >= 0) echo "checked"; ?>><span class="t12">氣質</span>
</td>
<td>
<input type="checkbox" name="chk19" id="chk19" value="19" <?php if(str_indexof($CMemo,"19") >= 0) echo "checked"; ?>><span class="t12">無套BJ</span>
</td>
<td>
<input type="checkbox" name="chk25" id="chk25" value="25" <?php if(str_indexof($CMemo,"25") >= 0) echo "checked"; ?>><span class="t12">不抽菸</span>
</td>
<td>
<input type="checkbox" name="chk31" id="chk31" value="31" <?php if(str_indexof($CMemo,"31") >= 0) echo "checked"; ?>><span class="t12">漂亮</span>
</td>
<td>
<input type="checkbox" name="chk37" id="chk37" value="37" <?php if(str_indexof($CMemo,"37") >= 0) echo "checked"; ?>><span class="t12">大眼</span>
</td>
<td>
<input type="checkbox" name="chk43" id="chk43" value="43" <?php if(str_indexof($CMemo,"43") >= 0) echo "checked"; ?>><span class="t12g">奧客</span>
</td>
</tr>
<tr>
<td>
<input type="checkbox" name="chk02" id="chk02" value="02" <?php if(str_indexof($CMemo,"02") >= 0) echo "checked"; ?>><span class="t12r">好客</span>
</td>
<td>
<input type="checkbox" name="chk08" id="chk08" value="08" <?php if(str_indexof($CMemo,"08") >= 0) echo "checked"; ?>><span class="t12">臉蛋</span>
</td>
<td>
<input type="checkbox" name="chk14" id="chk14" value="14" <?php if(str_indexof($CMemo,"14") >= 0) echo "checked"; ?>><span class="t12">清純</span>
</td>
<td>
<input type="checkbox" name="chk20" id="chk20" value="20" <?php if(str_indexof($CMemo,"20") >= 0) echo "checked"; ?>><span class="t12">主動</span>
</td>
<td>
<input type="checkbox" name="chk26" id="chk26" value="26" <?php if(str_indexof($CMemo,"26") >= 0) echo "checked"; ?>><span class="t12">熟女</span>
</td>
<td>
<input type="checkbox" name="chk32" id="chk32" value="32" <?php if(str_indexof($CMemo,"32") >= 0) echo "checked"; ?>><span class="t12">要求高</span>
</td>
<td>
<input type="checkbox" name="chk38" id="chk38" value="38" <?php if(str_indexof($CMemo,"38") >= 0) echo "checked"; ?>><span class="t12">活潑</span>
</td>
<td>
<input type="checkbox" name="chk44" id="chk44" value="44" <?php if(str_indexof($CMemo,"44") >= 0) echo "checked"; ?>><span class="t12g">注意</span>
</td>
</tr>
<tr>
<td>
<input type="checkbox" name="chk03" id="chk03" value="03" <?php if(str_indexof($CMemo,"03") >= 0) echo "checked"; ?>><span class="t12r">常客</span>
</td>
<td>
<input type="checkbox" name="chk09" id="chk09" value="09" <?php if(str_indexof($CMemo,"09") >= 0) echo "checked"; ?>><span class="t12">學生</span>
</td>
<td>
<input type="checkbox" name="chk15" id="chk15" value="15" <?php if(str_indexof($CMemo,"15") >= 0) echo "checked"; ?>><span class="t12">可愛</span>
</td>
<td>
<input type="checkbox" name="chk21" id="chk21" value="21" <?php if(str_indexof($CMemo,"21") >= 0) echo "checked"; ?>><span class="t12g">不傳</span>
</td>
<td>
<input type="checkbox" name="chk27" id="chk27" value="27" <?php if(str_indexof($CMemo,"27") >= 0) echo "checked"; ?>><span class="t12">服務好</span>
</td>
<td>
<input type="checkbox" name="chk33" id="chk33" value="33" <?php if(str_indexof($CMemo,"33") >= 0) echo "checked"; ?>><span class="t12">注重身材</span>
</td>
<td>
<input type="checkbox" name="chk39" id="chk39" value="39" <?php if(str_indexof($CMemo,"39") >= 0) echo "checked"; ?>><span class="t12">兼職型</span>
</td>
<td>
<input type="checkbox" name="chk45" id="chk45" value="45" <?php if(str_indexof($CMemo,"45") >= 0) echo "checked"; ?>><span class="t12">帶朋友</span>
</td>
</tr>
<tr>
<td>
<input type="checkbox" name="chk04" id="chk04" value="04" <?php if(str_indexof($CMemo,"04") >= 0) echo "checked"; ?>><span class="t12r">固定</span>
</td>
<td>
<input type="checkbox" name="chk10" id="chk10" value="10" <?php if(str_indexof($CMemo,"10") >= 0) echo "checked"; ?>><span class="t12">高挑</span>
</td>
<td>
<input type="checkbox" name="chk16" id="chk16" value="16" <?php if(str_indexof($CMemo,"16") >= 0) echo "checked"; ?>><span class="t12">OL</span>
</td>
<td>
<input type="checkbox" name="chk22" id="chk22" value="22" <?php if(str_indexof($CMemo,"22") >= 0) echo "checked"; ?>><span class="t12">很挑</span>
</td>
<td>
<input type="checkbox" name="chk28" id="chk28" value="28" <?php if(str_indexof($CMemo,"28") >= 0) echo "checked"; ?>><span class="t12">膚白</span>
</td>
<td>
<input type="checkbox" name="chk34" id="chk34" value="34" <?php if(str_indexof($CMemo,"34") >= 0) echo "checked"; ?>><span class="t12">女友FU</span>
</td>
<td>
<input type="checkbox" name="chk40" id="chk40" value="40" <?php if(str_indexof($CMemo,"40") >= 0) echo "checked"; ?>><span class="t12">不要大陸</span>
</td>
<td>
<input type="checkbox" name="chk46" id="chk46" value="46" <?php if(str_indexof($CMemo,"46") >= 0) echo "checked"; ?>><span class="t12g">危險</span>
</td>
</tr>
<tr>
<td>
<input type="checkbox" name="chk05" id="chk05" value="05" <?php if(str_indexof($CMemo,"05") >= 0) echo "checked"; ?>><span class="t12r">新人</span>
</td>
<td>
<input type="checkbox" name="chk11" id="chk11" value="11" <?php if(str_indexof($CMemo,"11") >= 0) echo "checked"; ?>><span class="t12">骨感</span>
</td>
<td>
<input type="checkbox" name="chk17" id="chk17" value="17" <?php if(str_indexof($CMemo,"17") >= 0) echo "checked"; ?>><span class="t12">大奶</span>
</td>
<td>
<input type="checkbox" name="chk23" id="chk23" value="23" <?php if(str_indexof($CMemo,"23") >= 0) echo "checked"; ?>><span class="t12">無套做</span>
</td>
<td>
<input type="checkbox" name="chk29" id="chk29" value="29" <?php if(str_indexof($CMemo,"29") >= 0) echo "checked"; ?>><span class="t12">加節</span>
</td>
<td>
<input type="checkbox" name="chk35" id="chk35" value="35" <?php if(str_indexof($CMemo,"35") >= 0) echo "checked"; ?>><span class="t12">無刺青</span>
</td>
<td>
<input type="checkbox" name="chk41" id="chk41" value="41" <?php if(str_indexof($CMemo,"41") >= 0) echo "checked"; ?>><span class="t12">要大陸</span>
</td>
<td>
<input type="checkbox" name="chk47" id="chk47" value="47" <?php if(str_indexof($CMemo,"47") >= 0) echo "checked"; ?>><span class="t12g">問題</span>
</td>
</tr>
<tr>
<td>
<input type="checkbox" name="chk06" id="chk06" value="06" <?php if(str_indexof($CMemo,"06") >= 0) echo "checked"; ?>><span class="t12r">不挑</span>
</td>
<td>
<input type="checkbox" name="chk12" id="chk12" value="12" <?php if(str_indexof($CMemo,"12") >= 0) echo "checked"; ?>><span class="t12">美腿</span>
</td>
<td>
<input type="checkbox" name="chk18" id="chk18" value="18" <?php if(str_indexof($CMemo,"18") >= 0) echo "checked"; ?>><span class="t12">要</span>LG
</td>
<td>
<input type="checkbox" name="chk24" id="chk24" value="24" <?php if(str_indexof($CMemo,"24") >= 0) echo "checked"; ?>><span class="t12">絲襪</span>
</td>
<td>
<input type="checkbox" name="chk30" id="chk30" value="30" <?php if(str_indexof($CMemo,"30") >= 0) echo "checked"; ?>><span class="t12">嬌小</span>
</td>
<td>
<input type="checkbox" name="chk36" id="chk36" value="36" <?php if(str_indexof($CMemo,"36") >= 0) echo "checked"; ?>><span class="t12">長髮</span>
</td>
<td>
<input type="checkbox" name="chk42" id="chk42" value="42" <?php if(str_indexof($CMemo,"42") >= 0) echo "checked"; ?>><span class="t12">要外國人</span>
</td>
<td>
<input type="checkbox" name="chk48" id="chk48" value="48" <?php if(str_indexof($CMemo,"48") >= 0) echo "checked"; ?>><span class="t12">俄羅斯</span>
</td>
</tr>
<tr>
<td>
<input type="checkbox" name="chk49" id="chk49" value="49" <?php if(str_indexof($CMemo,"49") >= 0) echo "checked"; ?>><span class="t12">按摩</span>
</td>
<td>
<input type="checkbox" name="chk50" id="chk50" value="50" <?php if(str_indexof($CMemo,"50") >= 0) echo "checked"; ?>><span class="t12">半套</span>
</td>
<td>
<input type="checkbox" name="chk51" id="chk51" value="51" <?php if(str_indexof($CMemo,"51") >= 0) echo "checked"; ?>><span class="t12">全套</span>
</td>
<td>
<input type="checkbox" name="chk52" id="chk52" value="52" <?php if(str_indexof($CMemo,"52") >= 0) echo "checked"; ?>><span class="t12">工作室</span>
</td>
<td>
&nbsp;
</td>
<td>
&nbsp;
</td>
<td>
&nbsp;
</td>
<td>
&nbsp;
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td align="left" width="15%">
<span class="t12">消費內容</span>
</td>
<td align="left">
<iframe src="MissContentOperation.php?tempCustomerId=<?php echo $tempCustomerId;?>" width="650" height="400" scrolling="yes" frameborder="0" marginwidth="0" marginheight="0"> 
</iframe> 
</td>
</tr>
<tr>
<td  align="center" colspan="2">
<input type="submit" name="btnSub" id="btnSub" value="<?php if($actionOp == "Insert") echo "確認新增"; else echo "確認修改" ?>" class="t12" />
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
</body>
</html>
