12 changed files with 522 additions and 84 deletions
@ -0,0 +1,207 @@ |
|||||
|
<?php |
||||
|
include_once("../header.php"); |
||||
|
// require_once('./connT8.php'); |
||||
|
require("../contract-repair/conn.php"); |
||||
|
|
||||
|
|
||||
|
$contract_type = [ |
||||
|
'1' => '新梯', |
||||
|
'2' => '汰改', |
||||
|
'3' => '保養' |
||||
|
]; |
||||
|
|
||||
|
$bonus_type = [ |
||||
|
'1' => '契約人獎金', |
||||
|
'2' => '區經理獎金', |
||||
|
'3' => '專任契約經理獎金' |
||||
|
]; |
||||
|
$clause = ''; |
||||
|
if (!empty($_GET['check'])) { |
||||
|
if ($_GET['check'] == 1) { |
||||
|
$clause .= "AND pay_day > DATE_SUB(NOW(), INTERVAL 1 MONTH)"; |
||||
|
} else if ($_GET['check'] == 2) { |
||||
|
$clause .= "AND status = 1"; |
||||
|
} else if ($_GET['check'] == 3) { |
||||
|
$clause .= "AND status = 2"; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
$sql = "SELECT * FROM bonus WHERE 1=1 $clause"; |
||||
|
$stmt = $conn->prepare($sql); |
||||
|
$stmt->execute(); |
||||
|
$datas = $stmt->fetchAll(PDO::FETCH_ASSOC); |
||||
|
|
||||
|
$now = new DateTime(); |
||||
|
$oneMonthAgo = $now->modify('+1 month'); |
||||
|
|
||||
|
|
||||
|
// 查看 T8 是否有收款明細 |
||||
|
// require("./api/get.php"); |
||||
|
function isPay($contract_no) |
||||
|
{ |
||||
|
$api_url = './api/get.php?contract_no=' . $contract_no; |
||||
|
$ch = curl_init(); |
||||
|
curl_setopt($ch, CURLOPT_URL, $api_url); |
||||
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); |
||||
|
curl_setopt($ch, CURLOPT_HTTPHEADER, array($contract_no)); |
||||
|
|
||||
|
$response = curl_exec($ch); |
||||
|
echo $response; |
||||
|
if ($response === false) { |
||||
|
echo '123Curl error: ' . curl_error($ch); |
||||
|
} else { |
||||
|
$result = json_decode($response, true); |
||||
|
if ($result['Status'] == 'Success') |
||||
|
return $result; |
||||
|
if ($result['Status'] == 'Error') |
||||
|
return $result; |
||||
|
} |
||||
|
|
||||
|
curl_close($ch); |
||||
|
} |
||||
|
?> |
||||
|
<link rel="stylesheet" href="../contract-repair/styles/style.css"> |
||||
|
<link rel="stylesheet" href="../contract-repair/semantic/dist/semantic.min.css"> |
||||
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css" integrity="sha512-z3gLpd7yknf1YoNbCzqRKc4qyor8gaKU1qmn+CShxbuBusANI9QpRohGBreCFkKxLhei6S9CQXFEbbKuqLg0DA==" crossorigin="anonymous" referrerpolicy="no-referrer" /> |
||||
|
<script src="../contract-repair/js/alpine.js"></script> |
||||
|
<script src="../contract-repair/js/axios/axios.min.js"></script> |
||||
|
<!-- <script src="../contract-repair/js/jquery/jquery-3.1.1.min.js"></script> --> |
||||
|
<script src="../contract-repair/semantic/dist/semantic.min.js"></script> |
||||
|
<script defer src="../contract-repair/js/alpinejs/cdn.min.js"></script> |
||||
|
|
||||
|
<div class="bonus_index" x-data="bonusIndex"> |
||||
|
<div style="overflow-x:auto;margin-top:12px"> |
||||
|
<a href="contract-newelevator-input.php?function_name=repair&<?php echo $token_link; ?>" class="btn btn-info btn-sm"> |
||||
|
<span class="glyphicon glyphicon-plus"></span> |
||||
|
</a> |
||||
|
<a href="/wms/bonus/bonus.php?function_name=bonus&token=<?php echo $token; ?>" class=" btn <?php echo (!isset($_GET['check'])) ? "btn btn-primary" : "btn-secondary"; ?> btn-sm categoryBtn"> 所有獎金</a> |
||||
|
<a href="/wms/bonus/bonus.php?check=1&function_name=bonus&token=<?php echo $token; ?>" class=" btn <?php echo (isset($_GET['check']) && $_GET['check'] == 1) ? "btn-primary" : "btn-secondary"; ?> btn-sm categoryBtn"> 應發獎金</a> |
||||
|
<a href="/wms/bonus/bonus.php?check=2&function_name=bonus&token=<?php echo $token; ?>" class=" btn <?php echo (isset($_GET['check']) && $_GET['check'] == 2) ? "btn-primary" : "btn-secondary"; ?> btn-sm categoryBtn"> 未發獎金</a> |
||||
|
<a href="/wms/bonus/bonus.php?check=3&function_name=bonus&token=<?php echo $token; ?>" class=" btn <?php echo (isset($_GET['check']) && $_GET['check'] == 3) ? "btn-primary" : "btn-secondary"; ?> btn-sm categoryBtn"> 已發獎金</a> |
||||
|
|
||||
|
<table id="table_index" class="table table-striped table-bordered" style="width:100%"> |
||||
|
<thead> |
||||
|
<tr> |
||||
|
<th>項次</th> |
||||
|
<th>合約類別</th> |
||||
|
<th>合約號</th> |
||||
|
<th>做番號</th> |
||||
|
<th>獎金類別</th> |
||||
|
<th>獎金試用版本</th> |
||||
|
<th>應發人員</th> |
||||
|
<th>發放時間</th> |
||||
|
<th>是否發放</th> |
||||
|
<th>是否收款</th> |
||||
|
<th>檢視</th> |
||||
|
</tr> |
||||
|
</thead> |
||||
|
<tbody> |
||||
|
<?php if (!empty($datas)) { |
||||
|
foreach ($datas as $key => $data) : |
||||
|
$isPay = isPay($data['contract_no']); |
||||
|
?> |
||||
|
<tr> |
||||
|
<td><?= $data['id'] ?></td> |
||||
|
<td><?= $contract_type[$data['contract_type']] ?></td> |
||||
|
<td><?= $data['contract_no'] ?></td> |
||||
|
<td><?= $data['facility_no'] ?></td> |
||||
|
<td><?= $bonus_type[$data['bonus_type']] ?></td> |
||||
|
<td><?= $data['bonus_verson'] ?></td> |
||||
|
<td><?= $data['receiver'] ?></td> |
||||
|
<td><?= $data['pay_day'] ?></td> |
||||
|
<td><?= ($data['status'] == 1) ? '未發放' : '已發放' ?></td> |
||||
|
<td> |
||||
|
<span x-text="data"></span> |
||||
|
</td> |
||||
|
<td> |
||||
|
<span></span> |
||||
|
<?php |
||||
|
// 判斷時間是否為一個月內 |
||||
|
$payday = new DateTime($data['pay_day']); |
||||
|
if ($payday < $oneMonthAgo) { |
||||
|
?> |
||||
|
<a href="bonus_detail.php?id=<?= $data['id'] ?>&token=<?php echo $token; ?>" class="applybtn">查看詳情</a> |
||||
|
<?php |
||||
|
} else { |
||||
|
echo '--'; |
||||
|
} |
||||
|
?> |
||||
|
</td> |
||||
|
|
||||
|
</tr> |
||||
|
<?php |
||||
|
endforeach; |
||||
|
} ?> |
||||
|
</tbody> |
||||
|
</table> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<style> |
||||
|
table { |
||||
|
table-layout: fixed; |
||||
|
width: 100%; |
||||
|
} |
||||
|
|
||||
|
td { |
||||
|
word-wrap: break-word; |
||||
|
} |
||||
|
|
||||
|
.width_style_1 { |
||||
|
width: 125px; |
||||
|
} |
||||
|
|
||||
|
table { |
||||
|
width: 100%; |
||||
|
} |
||||
|
|
||||
|
#table_index_filter { |
||||
|
float: right; |
||||
|
} |
||||
|
|
||||
|
#table_index_paginate { |
||||
|
table-layout: fixed; |
||||
|
width: 100%; |
||||
|
} |
||||
|
|
||||
|
label { |
||||
|
display: inline-flex; |
||||
|
margin-bottom: .5rem; |
||||
|
margin-top: .5rem; |
||||
|
|
||||
|
} |
||||
|
|
||||
|
.applybtn { |
||||
|
color: #fff; |
||||
|
background-color: #1484c4; |
||||
|
display: block; |
||||
|
border-radius: 4px; |
||||
|
padding: 4px 2px; |
||||
|
font-size: 13px; |
||||
|
|
||||
|
} |
||||
|
|
||||
|
.applybtn:hover { |
||||
|
background-color: #1494f9; |
||||
|
color: #fff; |
||||
|
} |
||||
|
</style> |
||||
|
|
||||
|
<script> |
||||
|
const datas = <?php echo json_encode($datas); ?>; |
||||
|
|
||||
|
// $(function() { |
||||
|
// $('#table_index2').DataTable({ |
||||
|
// "scrollX": true, |
||||
|
// "pageLength": 50 |
||||
|
// }); |
||||
|
// /* |
||||
|
// var api = $('#table_index').dataTable().api(); |
||||
|
// //var order = api.order(); |
||||
|
// //console.log(order); |
||||
|
// api |
||||
|
// .order([0, "desc"]) |
||||
|
// .draw(); |
||||
|
// */ |
||||
|
// }); |
||||
|
</script> |
@ -0,0 +1,198 @@ |
|||||
|
<?php |
||||
|
include('../header.php'); |
||||
|
require_once('../contract-repair/conn.php'); |
||||
|
|
||||
|
$sql = "SELECT * FROM bonus WHERE id = :id"; |
||||
|
$stmt = $conn->prepare($sql); |
||||
|
$stmt->bindParam(':id', $_GET['id']); |
||||
|
$stmt->execute(); |
||||
|
$result = $stmt->fetch(PDO::FETCH_ASSOC); |
||||
|
echo '<pre>'; |
||||
|
print_r($result); |
||||
|
echo '</pre>'; |
||||
|
?> |
||||
|
|
||||
|
<link rel="stylesheet" href="../contract-repair/styles/style.css"> |
||||
|
<link rel="stylesheet" href="../contract-repair/semantic/dist/semantic.min.css"> |
||||
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css" integrity="sha512-z3gLpd7yknf1YoNbCzqRKc4qyor8gaKU1qmn+CShxbuBusANI9QpRohGBreCFkKxLhei6S9CQXFEbbKuqLg0DA==" crossorigin="anonymous" referrerpolicy="no-referrer" /> |
||||
|
<script src="../contract-repair/js/alpine.js"></script> |
||||
|
<script defer src="../contract-repair/js/alpinejs/cdn.min.js"></script> |
||||
|
<script src="../contract-repair/js/axios/axios.min.js"></script> |
||||
|
<script src="../contract-repair/js/jquery/jquery-3.1.1.min.js"></script> |
||||
|
<script src="../contract-repair/semantic/dist/semantic.min.js"></script> |
||||
|
|
||||
|
<div class="bonuns_index" x-data="bonunsIndexTest"> |
||||
|
<div class="form" method="post" id="form" enctype="multipart/form-data"> |
||||
|
<input type="hidden" name="form_name" value="main_form"> |
||||
|
<div> |
||||
|
<table class="table table-bordered query-table table-striped table-bordered display compact" style="width:99%;margin-left:.5%"> |
||||
|
<thead> |
||||
|
<tr> |
||||
|
<td colspan="8"> |
||||
|
<h3 style='text-align:center'>獎金計算</h3> |
||||
|
</td> |
||||
|
</tr> |
||||
|
</thead> |
||||
|
<!-- <template x-if="step==1"> |
||||
|
<tbody style="font-weight: bolder;margin: botton 20px;"> |
||||
|
<tr> |
||||
|
<td style="vertical-align: middle;">合約號</td> |
||||
|
<td colspan="5"> |
||||
|
<input class="form-control" @keyup="nextStepKeyupFn($event)" type="text" name="contract_no" x-model="data.contract_no"> |
||||
|
</td> |
||||
|
<td colspan="2" style="vertical-align:middle"></td> |
||||
|
</tr> |
||||
|
</tbody> |
||||
|
</template> --> |
||||
|
|
||||
|
<template x-if="step==1"> |
||||
|
<tbody style="font-weight: bolder;margin-bottom:20px"> |
||||
|
<tr> |
||||
|
<td colspan="7" style="vertical-align:middle;border-right:0px"> |
||||
|
<h4>獎金確認項</h4> |
||||
|
</td> |
||||
|
<td class="text-right" style="border: left 0px;"> |
||||
|
<button type="button" id="btn_back" class="btn btn-default" onclick="window.history.back();">返回</button> |
||||
|
<button type="button" id="btn_close" class="btn btn-default" onclick="window.close()">關閉</button> |
||||
|
</td> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
<td style="vertical-align:middle">合約號</td> |
||||
|
<td> |
||||
|
<input type="text" x-model="data.contract_no" disabled="disabled"> |
||||
|
</td> |
||||
|
<td style="vertical-align:middle">合約類別</td> |
||||
|
<td> |
||||
|
<select id="contract_type" x-model="data.contract_type" disabled="disabled"> |
||||
|
<option value="">--請選擇--</option> |
||||
|
<option value="1">新梯</option> |
||||
|
<option value="2">汰改</option> |
||||
|
<option value="3">保養</option> |
||||
|
</select> |
||||
|
<p class="alerttext" x-show="data.contract_type==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p> |
||||
|
</td> |
||||
|
<td style="vertical-align:middle">作番號</td> |
||||
|
<td> |
||||
|
<input type="text" x-model="data.facility_no" disabled="disabled"> |
||||
|
</td> |
||||
|
|
||||
|
<td style="vertical-align:middle">獎金適用版本</td> |
||||
|
<td> |
||||
|
<input type="text" x-model="data.bonus_verson" disabled="disabled"> |
||||
|
</td> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
<td style="vertical-align:middle">發放人員</td> |
||||
|
<td> |
||||
|
<input type="text" x-model="data.receiver" disabled="disabled"> |
||||
|
</td> |
||||
|
<td style="vertical-align:middle">發放日期</td> |
||||
|
<td> |
||||
|
<input type="text" x-model="data.payDay" disabled="disabled"> |
||||
|
</td> |
||||
|
<td style="vertical-align:middle">發放金額</td> |
||||
|
<td> |
||||
|
<input type="text" x-model="data.maintain_price_total" disabled="disabled"> |
||||
|
</td> |
||||
|
<td></td> |
||||
|
<td></td> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
<td style="vertical-align:middle">地區經理經理員</td> |
||||
|
<td> |
||||
|
<input type="text" x-model="data.manager"> |
||||
|
</td> |
||||
|
<td style="vertical-align:middle">專任契約經理員</td> |
||||
|
<td> |
||||
|
<input type="text" x-model="data.contract_manger"> |
||||
|
</td> |
||||
|
<td></td> |
||||
|
<td></td> |
||||
|
<td></td> |
||||
|
<td></td> |
||||
|
</tr> |
||||
|
</tbody> |
||||
|
</template> |
||||
|
<!-- 獎金計算頁面 --> |
||||
|
<!-- <template x-if="step == 3"> |
||||
|
<template x-for="(bonusArr,index) in data.bonusArr" :key=""> |
||||
|
<tbody style="font-weight: bolder;margin-bottom:20px" x-show="step==3"> |
||||
|
<tr> |
||||
|
<td style="vertical-align:middle">獎金類型</td> |
||||
|
<td> |
||||
|
<input type="text" x-model="data.bonusArr[index].bonus_type"> |
||||
|
</td> |
||||
|
<td style="vertical-align:middle">發放人員</td> |
||||
|
<td> |
||||
|
<input type="text" x-model="data.bonusArr[index].bonus_receiver"> |
||||
|
</td> |
||||
|
<td style="vertical-align:middle;">發放金額</td> |
||||
|
<td> |
||||
|
<input type="text" x-model="data.bonusArr[index].bonus_amount"> |
||||
|
</td> |
||||
|
<td style="vertical-align:middle">預計發放時間</td> |
||||
|
<td> |
||||
|
<input type="text" x-model="data.bonusArr[index].pay_day_due"> |
||||
|
</td> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
<td style="vertical-align:middle">發放規定</td> |
||||
|
<td colspan="5"> |
||||
|
<input type="text" x-model="data.bonusArr[index].bonus_regulation"> |
||||
|
</td> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
<td></td> |
||||
|
<td></td> |
||||
|
<td></td> |
||||
|
<td></td> |
||||
|
<td></td> |
||||
|
<td></td> |
||||
|
<td></td> |
||||
|
<td></td> |
||||
|
</tr> |
||||
|
</tbody> |
||||
|
</template> |
||||
|
</template> --> |
||||
|
</table> |
||||
|
|
||||
|
<button x-show="step==1" @click="save()" :disabled="isLoading" type="button" class="btn btn-primary btn-lg pull-right savebtn"> |
||||
|
<template x-if="!isLoading"> |
||||
|
<span>確認</span> |
||||
|
</template> |
||||
|
<template x-if="isLoading"> |
||||
|
<div class="loader"></div> |
||||
|
</template> |
||||
|
</button> |
||||
|
<!-- <button x-show="step<=2" @click="nextStepFn()" type="button" class="btn btn-primary btn-lg pull-right savebtn" :disabled="isLoading"> |
||||
|
<template x-if="!isLoading"> |
||||
|
<span>下一步</span> |
||||
|
</template> |
||||
|
<template x-if="isLoading"> |
||||
|
<div class="loader"></div> |
||||
|
</template> |
||||
|
</button> |
||||
|
<button x-show="step>1" @click="preStepFn()" :disabled="isLoading" type="button" class="btn btn-primary btn-lg pull-right savebtn"> |
||||
|
<template x-if="!isLoading"> |
||||
|
<span>上一步</span> |
||||
|
</template> |
||||
|
<template x-if="isLoading"> |
||||
|
<div class="loader"></div> |
||||
|
</template> |
||||
|
</button> --> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<script> |
||||
|
const user_id = '<?= $user_id ?>'; |
||||
|
const id = '<?= $_GET['id'] ?>'; |
||||
|
const contract_no = '<?= $result['contract_no'] ?>'; |
||||
|
const facility_no = '<?= $result['facility_no'] ?>'; |
||||
|
const bonus_verson = '<?= $result['bonus_verson'] ?>'; |
||||
|
const receiver = '<?= $result['receiver'] ?>'; |
||||
|
const payDay = '<?= $result['pay_day'] ?>'; |
||||
|
const maintain_price_total = '<?= $result['amount'] ?>'; |
||||
|
const contract_type = '<?= $result['contract_type'] ?>'; |
||||
|
// const bonus_verson = '<?= $result['bonus_verson'] ?>'; |
||||
|
</script> |
@ -0,0 +1,15 @@ |
|||||
|
<?php |
||||
|
require_once dirname(__FILE__) . "/../../mkt/database.php"; |
||||
|
include_once '../fun_global.php'; |
||||
|
// phpinfo(); |
||||
|
// exit(); |
||||
|
try { |
||||
|
$connT8 = new PDO("sqlsrv:Server=220.130.203.251;Database=T8masada", "M0225", "IFFBU1E="); |
||||
|
if ($connT8) { |
||||
|
$connT8->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
||||
|
} |
||||
|
} catch (PDOException $e) { |
||||
|
// echo "fail"; |
||||
|
// echo $e->getMessage(); |
||||
|
die("ERROR!!!: " . $e->getMessage()); |
||||
|
} |
Loading…
Reference in new issue