You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
267 lines
12 KiB
267 lines
12 KiB
|
|
<?php
|
|
include "header.php";
|
|
|
|
if($_POST['type']=='rank'){
|
|
$sign_date=$_POST["sign_date"];
|
|
$sign_type=$_POST["sign_type"];
|
|
$name= $_POST["name"];
|
|
$picture= empty($_POST["picture"])?0:$_POST["picture"];
|
|
$contractno= $_POST["contractno"];
|
|
$facilityno= $_POST["facilityno"];
|
|
$receivable= $_POST["receivable"];
|
|
$receivable_date=date("Y-m-d",strtotime( $_POST["receivable_date"]));
|
|
$tai_count= $_POST["tai_count"];
|
|
$repairername= $_POST["repairername"];
|
|
$area= $_POST["area"];
|
|
$address= $_POST["address"];
|
|
$repair_type= $_POST["repair_type"];
|
|
$fee_type= $_POST["fee_type"];
|
|
$invoice_date=date("Y-m-d",strtotime( $_POST["invoice_date"]));
|
|
$invoice_amount= empty($_POST["invoice_amount"])?0:$_POST["invoice_amount"];
|
|
$startrepair_date= date("Y-m-d",strtotime( $_POST["startrepair_date"]));
|
|
$securitycheckend_date= date("Y-m-d",strtotime( $_POST["securitycheckend_date"]));
|
|
$changeallow_status=empty($_POST["changeallow_status"])?1:$_POST["changeallow_status"];
|
|
$isrepair_status= empty($_POST["isrepair_status"])?1:$_POST["isrepair_status"];
|
|
$reinsurancer= $_POST["reinsurancer"];
|
|
$numberoffloor= empty($_POST["numberoffloor"])?0:$_POST["numberoffloor"];
|
|
$personno= empty($_POST["personno"])?0:$_POST["personno"];
|
|
$speed= empty($_POST["speed"])?0:$_POST["speed"];
|
|
$facilitok_date= date("Y-m-d",strtotime( $_POST["facilitok_date"]));
|
|
$creater = $_POST["creater"];
|
|
$create_at = date('Y/m/d H:i:s');
|
|
//查詢是否重複錄入
|
|
$sql = "SELECT * FROM ranking where contractno='$contractno'";
|
|
$data = mysqli_query($link,$sql);
|
|
$nums_rows=mysqli_num_rows($data);
|
|
|
|
if($nums_rows==0){
|
|
//添加
|
|
$db_query = "INSERT INTO `ranking` (`sign_date`,`sign_type`,`name`, `picture`, `contractno`, `facilityno`, `receivable`, `receivable_date`, `tai_count`, `repairername`, `area`,
|
|
`address`, `repair_type`, `fee_type`, `invoice_date`, `invoice_amount`, `startrepair_date`, `changeallow_status`, `reinsurancer`, `numberoffloor`, `personno`, `speed`, `facilitok_date`, `creater`, `create_at`)
|
|
VALUES( '$sign_date','$sign_type','$name', '$picture', '$contractno', '$facilityno', '$receivable','$receivable_date', '$tai_count', '$repairername', '$area', '$address',
|
|
'$repair_type', '$fee_type', '$invoice_date', '$invoice_amount','$startrepair_date', '$changeallow_status', '$reinsurancer',
|
|
'$numberoffloor', '$personno', '$speed', '$facilitok_date', '$creater', '$create_at')";
|
|
// print_r ($db_query);
|
|
// exit();
|
|
mysqli_query($link,$db_query);
|
|
if (mysqli_affected_rows($link)>0) {
|
|
echo "insert";
|
|
#$sToken = "4XcWd2eMfN6C0ACNRALwKzJNYCSNzHr6aAQeED7hJrk"; #Owen個人單個帳號測試
|
|
$sToken = "QAO0u9cb9sqWD27vRrwkSR32LkT34Fl0JbJkOmtuP7Y"; #永佳捷經理會議群組
|
|
#$sToken = "lI2Cya7tSRjg8Rpolgd1UwuLhsXjwfWNtwLEEwUGlBw"; #工作小助手
|
|
// $sMessage = "賀成交!!!最新業績排行榜如下。" . "\n";
|
|
|
|
if($sign_type=='保養'){
|
|
$sMessage = "賀成交!!!最新保養業績排行榜如下。" . "\n";
|
|
$sMessage .= "https://www.masada.com.tw/phb/phb.html" . "\n";
|
|
}elseif ($sign_type=='新梯'){
|
|
$sMessage = "賀成交!!!最新新梯業績排行榜如下。" . "\n";
|
|
$sMessage .= "https://www.masada.com.tw/phb/xphb.html" . "\n";
|
|
}elseif ($sign_type=='改造'){
|
|
$sMessage = "賀成交!!!最新改造業績排行榜如下。" . "\n";
|
|
$sMessage .= "https://www.masada.com.tw/phb/gphb.html" . "\n";
|
|
}else{
|
|
$sMessage .= "";
|
|
}
|
|
|
|
#$sMessage .= "Second " . "\n";
|
|
|
|
$chOne = curl_init();
|
|
curl_setopt( $chOne, CURLOPT_URL, "https://notify-api.line.me/api/notify");
|
|
curl_setopt( $chOne, CURLOPT_SSL_VERIFYHOST, 0);
|
|
curl_setopt( $chOne, CURLOPT_SSL_VERIFYPEER, 0);
|
|
curl_setopt( $chOne, CURLOPT_POST, 1);
|
|
curl_setopt( $chOne, CURLOPT_POSTFIELDS, "message=".$sMessage);
|
|
$headers = array( 'Content-type: application/x-www-form-urlencoded', 'Authorization: Bearer '.$sToken.'', );
|
|
curl_setopt($chOne, CURLOPT_HTTPHEADER, $headers);
|
|
curl_setopt( $chOne, CURLOPT_RETURNTRANSFER, 1);
|
|
$result = curl_exec( $chOne );
|
|
|
|
if($result){
|
|
echo "Success!";
|
|
}else{
|
|
echo "Failure!";
|
|
}
|
|
|
|
|
|
exit();
|
|
}
|
|
elseif(mysqli_affected_rows($link)==0) {
|
|
echo "新增失敗";
|
|
echo $db_query;
|
|
exit();
|
|
}
|
|
}
|
|
else{
|
|
echo "<h1 class='text-center'>資料已經存在</h1>";
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
?>
|
|
<div class="container" id="accountadd">
|
|
<div class="text-center"> <h3>排行榜資料添加</h3> </div>
|
|
<form class="form-horizontal" name="account" method="POST" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>" enctype="multipart/form-data">
|
|
<div class="form-group">
|
|
<div class="col-md-3">
|
|
|
|
</div>
|
|
<div class="col-md-9 ">
|
|
<button type="submit" class="btn btn-primary btn-lg pull-right" >點擊後提交排行榜資料</button>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<div class="col-md-3">
|
|
<label for="name">契約人員</label>
|
|
<input class="form-control" type="text" name="name" id="name" placeholder="請輸入契約人員姓名" required>
|
|
|
|
</div>
|
|
|
|
<div class="col-md-3">
|
|
<label for="pwd">簽約類型</label>
|
|
|
|
<Select name="sign_type" id="sign_type" >
|
|
<Option selected="selected" Value="保養">保養</Option>
|
|
<Option Value="新梯">新梯</Option>
|
|
<Option Value="改造">改造</Option>
|
|
</Select>
|
|
</div>
|
|
|
|
<div class="col-md-3">
|
|
<label for="name">合約號</label>
|
|
<input class="form-control" type="text" name="contractno" id="contractno" required>
|
|
</div>
|
|
|
|
<div class="col-md-3">
|
|
<label for="tel">作番號</label>
|
|
<input class="form-control" type="text" name="facilityno" id="facilityno" maxlength="16" required>
|
|
|
|
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
|
|
<div class="col-md-3">
|
|
<label for="email">簽約日期</label>
|
|
<input class="form-control" type="text" name="sign_date" id="sign_date" value="<?php date('Y/m/d H:i:s'); ?>" required>
|
|
|
|
</div>
|
|
<div class="col-md-3">
|
|
<label for="lineid">台數</label>
|
|
<input class="form-control" type="text" name="tai_count" id="tai_count" required>
|
|
</div>
|
|
|
|
<div class="col-md-3">
|
|
<label for="address">合約價格</label>
|
|
<input class="form-control" type="text" name="receivable" id="receivable" required>
|
|
</div>
|
|
|
|
<div class="col-md-3">
|
|
<label for="email">合約期間</label>
|
|
<input class="form-control" type="text" name="receivable_date" id="receivable_date" value="<?php date('Y/m/d H:i:s'); ?>" required>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<div class="col-md-3">
|
|
<label for="wechatid">保養員</label>
|
|
<input class="form-control" type="text" name="repairername" id="repairername">
|
|
</div>
|
|
<div class="col-md-3">
|
|
<label for="phone_call_help">區域</label>
|
|
<input class="form-control" type="text" name="area" id="area" maxlength="16" >
|
|
</div>
|
|
|
|
<div class="col-md-3">
|
|
<label for="chat_for_help">大樓地址</label>
|
|
<input class="form-control" type="text" name="address" id="address">
|
|
</div>
|
|
|
|
<div class="col-md-3">
|
|
<label for="remote_help">保養類別</label>
|
|
<input class="form-control" type="text" name="repair_type" id="repair_type">
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<div class="col-md-3">
|
|
<label for="repairerid">繳費類型</label>
|
|
<input class="form-control" type="text" name="fee_type" id="fee_type">
|
|
</div>
|
|
<div class="col-md-3">
|
|
<label for="manager">發票開立日期</label>
|
|
<input class="form-control" type="text" name="invoice_date" id="invoice_date">
|
|
</div>
|
|
|
|
<div class="col-md-3">
|
|
<label for="manager">發票開立金額</label>
|
|
<input class="form-control" type="text" name="invoice_amount" id="invoice_amount">
|
|
</div>
|
|
|
|
<div class="col-md-3">
|
|
<label for="creater">入保日</label>
|
|
<input class="form-control" type="text" name="startrepair_date" id="startrepair_date">
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
|
|
<div class="col-md-3">
|
|
<label for="creater">安檢到期日</label>
|
|
<input class="form-control" type="text" name="securitycheckend_date" id="securitycheckend_date">
|
|
</div>
|
|
|
|
<div class="col-md-3">
|
|
<label for="manager">變更許可證</label>
|
|
<input class="form-control" type="text" name="changeallow_status" id="changeallow_status">
|
|
</div>
|
|
|
|
<div class="col-md-3">
|
|
<label for="manager">是否改造</label>
|
|
<input class="form-control" type="text" name="isrepair_status" id="isrepair_status">
|
|
</div>
|
|
|
|
<div class="col-md-3">
|
|
<label for="creater">前保險商</label>
|
|
<input class="form-control" type="text" name="reinsurancer" id="reinsurancer">
|
|
</div>
|
|
<div class="col-md-3">
|
|
<label for="creater">樓層</label>
|
|
<input class="form-control" type="text" name="numberoffloor" id="numberoffloor">
|
|
</div>
|
|
<div class="col-md-3">
|
|
<label for="creater">人乘</label>
|
|
<input class="form-control" type="text" name="personno" id="personno">
|
|
</div>
|
|
<div class="col-md-3">
|
|
<label for="creater">速度</label>
|
|
<input class="form-control" type="text" name="speed" id="speed">
|
|
</div>
|
|
<div class="col-md-3">
|
|
<label for="creater">交車日期</label>
|
|
<input class="form-control" type="text" name="facilitok_date" id="facilitok_date">
|
|
</div>
|
|
<div class="col-md-3">
|
|
<label for="creater">建檔人</label>
|
|
<input class="form-control" type="text" name="creater" id="creater" value="<?php echo $user_id; ?>" readonly>
|
|
</div>
|
|
<div class="col-md-3">
|
|
<input class="form-control" type="hidden" name="create_at" id="create_at" value="<?php date('Y/m/d H:i:s'); ?>">
|
|
<input class="form-control" type="hidden" name="type" id="create_at" value="rank">
|
|
</div>
|
|
</div>
|
|
|
|
<input type="hidden" name="token" value="<?php echo $token; ?>">
|
|
</form>
|
|
</div>
|
|
|