Browse Source

新梯/汰改價審更新 0226 ,差上傳報價單

main
10994015 1 year ago
parent
commit
6617999f75
  1. 10
      wms/T8_Authorization_from_bpm.php
  2. BIN
      wms/account-receivable-contract.xlsx
  3. 48
      wms/account-receivable-excel.php
  4. BIN
      wms/account-receivable-facility.xlsx
  5. 927
      wms/account-receivable-new-index.php
  6. 9
      wms/account-receivable-renovate-index.php
  7. 2
      wms/account-receivable.txt
  8. 111
      wms/bonus/api/postStatus.php
  9. 146
      wms/bonus/bonus.php
  10. 199
      wms/bonus/bonus_check.php
  11. 34
      wms/bonus/bonus_detail.php
  12. 218
      wms/bonus/elevator_new/elevator_new_deal_bonus.php
  13. 36
      wms/bonus/other/maintenance_contract_bonus_v2_1.php
  14. 55
      wms/bonus/other/maintenance_contract_bonus_v2_1_examination.php
  15. 20
      wms/contract-repair/contract-renovate-input.php
  16. 51
      wms/contract-repair/js/alpine.js
  17. 2
      wms/contract-repair/styles/style.css
  18. 2
      wms/contract-repair/styles/style.scss
  19. 11
      wms/contract/api/T8salIncomeApply.php
  20. 15
      wms/contract/api/getComboNo.php
  21. 63
      wms/contract/api/getContractData.php
  22. 276
      wms/contract/api/postContractData.php
  23. 194
      wms/contract/api/postNewContractData.php
  24. 53
      wms/contract/api/testT8API.php
  25. 2
      wms/contract/conn.php
  26. 106
      wms/contract/contract-input.php
  27. 10
      wms/contract/contract-new-apply.php
  28. 169
      wms/contract/contract-newelevator-input.php
  29. 101
      wms/contract/js/alpine.js
  30. 309
      wms/contract_b-index.php
  31. 2
      wms/crm/crmm02-index.php
  32. 8
      wms/crm/crmm03-edit.php
  33. 8
      wms/crm/crmm04-edit.php
  34. 24
      wms/mkt/assets/js/pricereviewAlpine.js
  35. 134
      wms/mkt/css/pricereview.css
  36. 13
      wms/mkt/css/pricereview.css.map
  37. 154
      wms/mkt/css/pricereview.scss
  38. 195
      wms/mkt/pricereviewMaintainCreate.php

10
wms/T8_Authorization_from_bpm.php

@ -3,10 +3,7 @@
// $user_id = "M0000";
// $user_password = "M012290493119";
$user_id = "M0117";
$user_password = "90493119";
echo $validation = get_Auth($user_id, $user_password);
// echo $validation = get_Auth($user_id, $user_password);
function get_Auth($user_id = "M0000", $user_password = "M012290493119")
{
@ -16,8 +13,9 @@ function get_Auth($user_id = "M0000", $user_password = "M012290493119")
// $now = gmdate("YmdHis");
$now = gmdate("YmdHis", strtotime("-2 minutes"));
$data = "$user_id." . $now;
$sign = hash_hmac('SHA256', $data, 'B2D6395D2883E26C', false);
$sign = hash_hmac('SHA256', $data, 'A21181F1EE4966D3', false);
// echo $sign;
// $apiurl = 'https://erp.masada.com.tw:780/twWebAPI/GetAuth';
$apiurl = 'http://60.244.87.101:880//twWebAPI/GetAuth';
@ -53,4 +51,4 @@ function get_Auth($user_id = "M0000", $user_password = "M012290493119")
curl_close($ch);
}
// $data = [];
get_Auth();
// get_Auth();

BIN
wms/account-receivable-contract.xlsx

Binary file not shown.

48
wms/account-receivable-excel.php

@ -12,8 +12,52 @@ $array_data = array();
$Bill = json_decode(file_get_contents("php://input"), true);
$spreadsheet = new Spreadsheet();
$sheet = $spreadsheet->getActiveSheet();
// file_put_contents('account-receivable.txt', json_encode($Bill));
if ($type == 'facility') {
if ($type == 'newContract') {
$excel_array = array();
$colomnHeader = [
'合約號', '客戶名稱', '營業員', '合約金額', '台數', '作番狀態', '催收金額', '催收次數', '訂金催收金額', '訂金催收次數', '二次款催收金額', '二次款催收次數',
'貨抵工地款催收金額', '貨抵工地款催收次數',
'安裝款催收金額', '安裝款催收次數',
'試車款催收金額', '試車款催收次數',
'官檢驗收催收金額', '官檢驗收催收次數',
'交車款催收金額', '交車款催收次數',
'尾款催收金額', '尾款催收次數'
];
foreach ($Bill as $key => $value) {
$excel_array[$key] = [
$value[0], $value[3], $value[8], $value[11], $value[19], $value[20], $value[17], $value[18], $value[26], $value[27], $value[33], $value[34],
$value[40], $value[41],
$value[47], $value[48],
$value[54], $value[55],
$value[61], $value[62],
$value[68], $value[69],
$value[75], $value[76]
];
}
file_put_contents('account-receivable.txt', json_encode($excel_array, JSON_UNESCAPED_UNICODE));
$sheet->fromArray($colomnHeader, NULL, 'A1');
$rowIndex = 2;
foreach ($excel_array as $item) {
$sheet->fromArray($item, NULL, 'A' . $rowIndex);
$column = [
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X'
];
foreach ($column as $col) {
if ($col == 'F') {
$sheet->getColumnDimension('F')->setWidth(35);
$sheet->getStyle('F')->getAlignment()->setWrapText(true);
} else {
$sheet->getColumnDimension($col)->setAutoSize(true);
}
}
$rowIndex++;
}
$writer = new Xlsx($spreadsheet);
$excelFileName = 'account-receivable-contract.xlsx';
$writer->save($excelFileName);
} elseif ($type == 'facility') {
$colomnHeader = [
'T8單據日期', '作番號', '合約號', '部門', '經理', '營業員', '客戶名稱', '統一編號', '聯絡地址', '抬頭',
'訂金名稱', '訂金合約金額', '訂金應收日期', '訂金目前應收金額', '訂金已開金額', '訂金未開金額', '訂金已收金額', '訂金催收金額', '訂金催收次數',

BIN
wms/account-receivable-facility.xlsx

Binary file not shown.

927
wms/account-receivable-new-index.php

File diff suppressed because it is too large

9
wms/account-receivable-renovate-index.php

@ -9,11 +9,14 @@ $sum_A40002 = 0;
$sum_A40009 = 0;
// 安裝
$sum_A40010 = 0;
// M4
$sum_A40019 = 0;
$sum_total_budget = 0;
$average_budget = 0;
$average_A40002 = 0;
$average_A40009 = 0;
$average_A40010 = 0;
$average_A40019 = 0;
$start_date = empty($_POST['date_start']) ? null : $_POST['date_start'];
$end_date = empty($_POST['date_end']) ? null : $_POST['date_end'];
@ -258,7 +261,7 @@ foreach ($contract as $cont) {
$arrayData[$BillNo]['invoice'] = array();
$arrayData[$BillNo]['received_budget'] = 0;
$arrayData[$BillNo]['invoice_budget'] = 0;
$arrayData[$BillNo]['A40002'] = $arrayData[$BillNo]['A40009'] = $arrayData[$BillNo]['A40010'] = 0;
$arrayData[$BillNo]['A40002'] = $arrayData[$BillNo]['A40009'] = $arrayData[$BillNo]['A40010'] =$arrayData[$BillNo]['A40019'] = 0;
$arrayData[$BillNo]['total_facility_num'] = 0;
}
$arrayData[$BillNo]['PayStage'][$RowNo]['type'] = 0;
@ -312,7 +315,7 @@ foreach ($contract_budget_data as $cont) {
} else {
$arrayData[$BillNo]['total_facility_num'] += 1;
$arrayData[$BillNo]['facility'][$cont['CU_MaterialId']]['total_budget'] = $cont['OAmountWithTax'];
$arrayData[$BillNo]['facility'][$cont['CU_MaterialId']]['A40002'] = $arrayData[$BillNo]['facility'][$cont['CU_MaterialId']]['A40009'] = $arrayData[$BillNo]['facility'][$cont['CU_MaterialId']]['A40010'] = 0;
$arrayData[$BillNo]['facility'][$cont['CU_MaterialId']]['A40002'] = $arrayData[$BillNo]['facility'][$cont['CU_MaterialId']]['A40009'] = $arrayData[$BillNo]['facility'][$cont['CU_MaterialId']]['A40010'] = $arrayData[$BillNo]['facility'][$cont['CU_MaterialId']]['A40019'] = 0;
$arrayData[$BillNo]['facility'][$cont['CU_MaterialId']][$cont['MaterialId']] = $cont['OAmountWithTax'];
}
}
@ -335,6 +338,7 @@ foreach ($contract_budget_data as $cont) {
$contract_budget[$cont['BillNo']]['facility'][$cont['CU_MaterialId']]['A40002'] = 0;
$contract_budget[$cont['BillNo']]['facility'][$cont['CU_MaterialId']]['A40009'] = 0;
$contract_budget[$cont['BillNo']]['facility'][$cont['CU_MaterialId']]['A40010'] = 0;
$contract_budget[$cont['BillNo']]['facility'][$cont['CU_MaterialId']]['A40019'] = 0;
$contract_budget[$cont['BillNo']]['facility'][$cont['CU_MaterialId']][$cont['MaterialId']] = $cont['OAmountWithTax'];
};
}
@ -428,6 +432,7 @@ foreach ($wipwhole_array as $wip) {
$arrayData[$billno]['facility'][$wip['facilityno']]['A40002'] = (isset($contract_budget[$billno][$wip['facilityno']]['A40002']) && !is_null($contract_budget[$billno][$wip['facilityno']]['A40002'])) ? $contract_budget[$billno][$wip['facilityno']]['A40002'] : 0;
$arrayData[$billno]['facility'][$wip['facilityno']]['A40008'] = (isset($contract_budget[$billno][$wip['facilityno']]['A40008']) && !is_null($contract_budget[$billno][$wip['facilityno']]['A40008'])) ? $contract_budget[$billno][$wip['facilityno']]['A40008'] : 0;
$arrayData[$billno]['facility'][$wip['facilityno']]['A40010'] = (isset($contract_budget[$billno][$wip['facilityno']]['A40010']) && !is_null($contract_budget[$billno][$wip['facilityno']]['A40010'])) ? $contract_budget[$billno][$wip['facilityno']]['A40010'] : 0;
$arrayData[$billno]['facility'][$wip['facilityno']]['A40019'] = (isset($contract_budget[$billno][$wip['facilityno']]['A40019']) && !is_null($contract_budget[$billno][$wip['facilityno']]['A40019'])) ? $contract_budget[$billno][$wip['facilityno']]['A40019'] : 0;
}
$wipwhole_status[$wip['facilityno']] = $wip;
}

2
wms/account-receivable.txt

File diff suppressed because one or more lines are too long

111
wms/bonus/api/postStatus.php

@ -0,0 +1,111 @@
<?php
require_once("../../contract/conn.php");
if (!empty($_POST['id']) && !empty($_POST['postType']) && $_POST['postType'] == 'a') {
try {
$id = empty($_POST['id']) ? '' : $_POST['id'];
$user_id = empty($_POST['user_id']) ? '' : $_POST['user_id'];
$amount = empty($_POST['amount']) ? '' : $_POST['amount'];
$pay_day = empty($_POST['pay_day']) ? '' : $_POST['pay_day'];
$review_at = date("Y-m-d H:i:s");
$sql = "UPDATE bonus SET status = 2 ,bonus_actual='$amount',review_hr = '$user_id' ,review_at = '$review_at',pay_day ='$pay_day',update_id='$user_id',update_at='$review_at' WHERE id = $id";
$stmt = $conn->prepare($sql);
$stmt->execute();
header("HTTP/1.1 200 success!");
echo 'Success';
} catch (PDOException $e) {
header("HTTP/1.1 404 failed!");
echo $e->getMessage();
die('Error!:' . $e->getMessage());
}
}
// 獎金確認發放,並更新獎金 OR 實際發放時間
if (!empty($_POST['postType']) && $_POST['postType'] == 'b') {
try {
$id = empty($_POST['id']) ? '' : $_POST['id'];
$pay_day = empty($_POST['pay_day']) ? '' : $_POST['pay_day'];
$bonus_actual = empty($_POST['bonus_actual']) ? '' : $_POST['bonus_actual'];
$note = empty($_POST['note']) ? '' : $_POST['note'];
$user_id = empty($_POST['user_id']) ? '' : $_POST['user_id'];
$review_at = date("Y-m-d H:i:s");
if ($pay_day != '' && $bonus_actual != '') {
$sql = "UPDATE bonus SET status = 2,review_hr='$user_id',review_at='$review_at',bonus_actual='$bonus_actual',pay_day='$pay_day',note='$note' WHERE id = $id";
$stmt = $conn->prepare($sql);
$stmt->execute();
header("HTTP/1.1 200 success!");
} else {
header("HTTP/1.1 400");
echo '請填寫發放時間和實發獎金';
}
} catch (PDOException $e) {
header("HTTP/1.1 404 failed!");
echo $e->getMessage();
die('Error!:' . $e->getMessage());
}
}
// 獎金暫不發放
if (!empty($_POST['postType']) && $_POST['postType'] == 'c') {
// echo 'cccccc';
try {
$id = empty($_POST['id']) ? '' : $_POST['id'];
$pay_day = empty($_POST['pay_day']) ? '' : $_POST['pay_day'];
$bonus_actual = empty($_POST['bonus_issue']) ? '' : $_POST['bonus_issue'];
$user_id = empty($_POST['user_id']) ? '' : $_POST['user_id'];
$note = empty($_POST['note']) ? '' : $_POST['note'];
$review_at = date("Y-m-d H:i:s");
if ($note != '') {
$sql = "UPDATE bonus SET status = 4,review_hr='$user_id',review_at='$review_at',pay_day='$pay_day',note='$note' WHERE id = $id";
echo $sql;
$stmt = $conn->prepare($sql);
$stmt->execute();
header("HTTP/1.1 200 success!");
} else {
echo '請填寫備註!!';
header("HTTP/1.1 400!");
}
} catch (PDOException $e) {
header("HTTP/1.1 404 failed!");
echo $e->getMessage();
die('Error!:' . $e->getMessage());
}
}
if (!empty($_POST['postType']) && $_POST['postType'] == 'd') {
try {
$id = empty($_POST['id']) ? '' : $_POST['id'];
$review_at = date("Y-m-d H:i:s");
$user_id = empty($_POST['user_id']) ? '' : $_POST['user_id'];
$sql = "SELECT * FROM bonus WHERE id IN ($id)";
$stmt = $conn->prepare($sql);
$stmt->execute();
$results = $stmt->fetchAll(PDO::FETCH_ASSOC);
$conn->beginTransaction();
foreach ($results as $result) {
// echo '<pre>';
// print_r($result);
// echo '</pre>';
// exit();
$amount = $result['amount'];
$id = $result['id'];
$pay_day = $result['pay_day_due'];
$sql = "UPDATE bonus SET status = 5 ,bonus_actual='$amount',review_hr = '$user_id' ,review_at = '$review_at',pay_day ='$pay_day' WHERE id = $id";
$stmt = $conn->prepare($sql);
$stmt->execute();
}
$conn->commit();
header("HTTP/1.1 200 success!");
} catch (PDOException $e) {
$conn->rollBack();
header("HTTP/1.1 404 failed!");
echo $e->getMessage();
die('Error!:' . $e->getMessage());
}
// echo 'ddddd';
}

146
wms/bonus/bonus.php

@ -2,7 +2,7 @@
include_once("../header.php");
// require_once('./connT8.php');
require("../contract/conn.php");
$now = date("Y-m-d");
$contract_type = [
'1' => '新梯',
@ -15,18 +15,32 @@ $bonus_type = [
'2' => '區經理獎金',
'3' => '專任契約經理獎金'
];
$bonus_status = [
'1' => '未確認',
'2' => '應發已確認',
'3' => '應發未確認',
'4' => '暫不發放',
'5' => '人事審核確認'
];
$clause = '';
if ($user_id != 'M0225') {
$clause .= "AND receiver == '$user_id'";
}
if (!empty($_GET['check'])) {
if ($_GET['check'] == 1) {
$clause .= "AND pay_day > DATE_SUB(NOW(), INTERVAL 1 MONTH)";
// 人事發放作業,應為一個月內
if ($_GET['check'] == 4) {
$oneMonthAgo = date("Y-m-d", strtotime("$now +1 months"));
// $clause .= "AND pay_day_due >= '$now' AND pay_day_due <= '$oneMonthAgo' AND status IN (1,2,5)";
$clause .= "AND status IN (1,2,5)";
} else if ($_GET['check'] == 2) {
$clause .= "AND status = 1";
} else if ($_GET['check'] == 3) {
$clause .= "AND status = 2";
$clause .= "AND status IN (2,5)";
}
}
$sql = "SELECT * FROM bonus WHERE 1=1 $clause LIMIT 50";
$sql = "SELECT * FROM bonus WHERE 1=1 $clause";
$stmt = $conn->prepare($sql);
$stmt->execute();
$datas = $stmt->fetchAll(PDO::FETCH_ASSOC);
@ -35,6 +49,13 @@ $datas = $stmt->fetchAll(PDO::FETCH_ASSOC);
$now = new DateTime();
$oneMonthAgo = $now->modify('+1 month');
$id = [];
foreach ($datas as $data) {
$id[] = $data['id'];
}
$id_str = implode(',', $id);
// 查看 T8 是否有收款明細
// require("./api/get.php");
function isPay($contract_no, $connT8)
@ -98,19 +119,23 @@ function isPay($contract_no, $connT8)
<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="bonus_index">
<!-- <input type="button" hidden x-ref="initbtn" @click="isPay()" /> -->
<div class="bonus_index" x-data="bonusIndexTest">
<div class="form" method="post" id="form" enctype="multipart/form-data">
<div style="overflow-x:auto;margin-top:12px">
<a href="bonus_index1.php?function_name=bonus&token=<?php echo $token; ?>" class="btn btn-info btn-sm">
<!-- <a href="bonus_index1.php?function_name=bonus&token=<?php echo $token; ?>" class="btn btn-info btn-sm">
<span class="glyphicon glyphicon-plus"></span>
</a>
</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=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>
<a href="/wms/bonus/bonus.php?check=4&function_name=bonus&token=<?php echo $token; ?>" class=" btn <?php echo (isset($_GET['check']) && $_GET['check'] == 4) ? "btn-primary" : "btn-secondary"; ?> btn-sm categoryBtn"> 人事發放作業</a>
<table id="table_index" class="table table-striped table-bordered" style="width:100%">
<?php if (!empty($_GET['check']) && $_GET['check'] == '4') { ?>
<button class="btn btn-primary float-end" style="float: right;" onclick="All('<?= $id_str ?>')">鎖定並發放</button>
<?php } ?>
<thead>
<tr>
<th>項次</th>
@ -119,15 +144,24 @@ function isPay($contract_no, $connT8)
<th>作番號</th>
<th>獎金類別</th>
<th>獎金版本</th>
<th>作番總價</th>
<th>作番金額(月)</th>
<th>牌價</th>
<th>服務費</th>
<th>應發人員</th>
<th>預計發放時間</th>
<th>獎金水庫</th>
<!-- <th>是否發放</th> -->
<th>應發獎金水庫</th>
<th>實發金額</th>
<th>狀態</th>
<th>檢視/發放</th>
<?php
if (!empty($_GET['check']) && $_GET['check'] == '4') {
?>
<th>實際發放時間</th>
<th>發放 / 詳情</th>
<?php } else { ?>
<th>詳情</th>
<?php
} ?>
</tr>
</thead>
<tbody>
@ -136,11 +170,10 @@ function isPay($contract_no, $connT8)
$contract_no = $data['contract_no'];
$json = json_decode($data['bonus_json']);
$total = empty($json->total) ? 0 : $json->total;
$fee_per_st = empty($json->fee_per_st) ? 0 : $json->fee_per_st;
$commission_fee = empty($json->commission_fee) ? 0 : $json->commission_fee;
$isPay = isPay($data['contract_no'], $connT8);
// $isPay = isPay($data['contract_no'], $connT8);
?>
<tr>
@ -150,33 +183,45 @@ function isPay($contract_no, $connT8)
<td><?= $data['facility_no'] ?></td>
<td><?= $bonus_type[$data['bonus_type']] ?></td>
<td><?= $data['bonus_verson'] ?></td>
<td><?= $total ?></td>
<td><?= $fee_per_st ?></td>
<td><?= $total ?></td>
<td><?= $commission_fee ?></td>
<td><?= $data['receiver'] ?></td>
<td><?= $data['pay_day'] ?></td>
<td><?= $data['pay_day_due'] ?></td>
<td><?= $data['amount'] ?></td>
<!-- <td><?= ($data['status'] == 1) ? '未發放' : '已發放' ?></td> -->
<td><?= $data['bonus_actual'] ?></td>
<td>
<!-- <input type="text" x-model="isPays[<?php echo $key; ?>]" /> -->
<span><?= ($isPay == 1) ? '已收款' : '未收款' ?></span>
<?= $bonus_status[$data['status']] ?>
<!-- <span><?= ($isPay == 1) ? '已收款' : '未收款' ?></span> -->
</td>
<?php if (!empty($_GET['check']) && $_GET['check'] == '4') {
if ($data['status'] == '3' || $data['status'] == '1') { ?>
<td> -- </td>
<td>
<?php
// 判斷時間是否為一個月內
$payday = new DateTime($data['pay_day']);
if ($isPay == 1) {
// if ($isPay == 1) {
?>
<a href="bonus_detail.php?id=<?= $data['id'] ?>&token=<?php echo $token; ?>" class="applybtn" style="">發放獎金</a>
<button onclick="issue(<?= $data['id'] ?>,'<?= $user_id ?>','<?= $data['pay_day_due'] ?>','<?= $data['amount'] ?>')" type="button" class="btn applybtn" name='issuePay'>發放獎金</button>
<?php
} else if ($payday < $oneMonthAgo) {
// } else if ($payday < $oneMonthAgo) {
?>
<a href="bonus_detail.php?id=<?= $data['id'] ?>&token=<?php echo $token; ?>" class="applybtncheck">查看詳情</a>
<?php
}
// }
?>
</td>
<!-- <td><input type="date" value="<?= $data['pay_day'] ?>"></td> -->
<?php } else { ?>
<td><?= $data['pay_day'] ?></td>
<td><a href="bonus_check.php?id=<?= $data['id'] ?>&token=<?php echo $token; ?>" class="applybtncheck">查看詳情</a></td>
<?php }
} else { ?>
<td><a href="bonus_check.php?id=<?= $data['id'] ?>&token=<?php echo $token; ?>" class="applybtncheck">查看詳情</a></td>
<?php } ?>
</tr>
<?php
endforeach;
@ -185,6 +230,7 @@ function isPay($contract_no, $connT8)
</table>
</div>
</div>
<!-- </div> -->
<style>
table {
@ -237,13 +283,13 @@ function isPay($contract_no, $connT8)
background-color: #1484c4;
/* display: block; */
border-radius: 5px;
padding: 5px 2px;
/* padding: 5px 2px; */
font-size: 13px;
line-height: 1;
display: grid;
place-items: center;
/* 水平和垂直居中 */
height: 2%vh;
/* height: 2%vh; */
/* 100%视窗高度,可根据需要调整 */
}
@ -276,6 +322,46 @@ function isPay($contract_no, $connT8)
<script>
const datas = <?php echo json_encode($datas); ?>;
function issue(id, user_id, pay_day, amount) {
// console.log(id);
const form = new FormData();
form.append('id', id)
form.append('user_id', user_id);
form.append('pay_day', pay_day)
form.append('amount', amount);
form.append('postType', 'a');
axios.post('./api/postStatus.php', form).then((res) => {
if (res.data == 'Success') {
alert('更新成功');
location.reload();
}
}).catch((err) => {
})
}
function All(data) {
let arr = data.split(",");
const form = new FormData();
form.append('id', arr);
form.append('user_id', '<?= $user_id ?>')
form.append('postType', 'd');
if (confirm('是否發放全部獎金')) {
axios.post('./api/postStatus.php', form).then((res) => {
if (res.status == 200) {
alert('更新成功');
location.reload();
}
}).catch((err) => {
});
}
}
// $(function() {
// $("button[name=issuePay]").click(function() {
// console.log(123);
// })
// })
// function init() {
// this.isPay();

199
wms/bonus/bonus_check.php

@ -0,0 +1,199 @@
<?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['bonus_json']);
// echo '</pre>';
$bonus_json = json_decode($result['bonus_json']);
$paykind = [
'monthly' => '月繳',
'bimonthly' => '雙月繳',
'quarterly' => '季繳',
'semiannually' => '半年繳',
'annually' => '年繳'
];
$maintain_type = [
'new' => '新簽約',
'free_to_charge' => '免保轉有費',
'renew_priceissue' => '續簽約'
];
?>
<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="bonunsIndex">
<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-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.maintain_type" disabled>
</td>
<td style="vertical-align:middle">付款方式</td>
<td>
<input type="text" x-model="data.pay_kind" disabled>
</td>
<td style="vertical-align:middle">合約付款日</td>
<td>
<input type="text" x-model="data.receivable_date_due" disabled>
</td>
<td style="vertical-align:middle">應發獎金</td>
<td>
<input type="text" x-model="data.maintain_price_total" disabled>
</td>
</tr>
<tr>
<td style="vertical-align:middle">作番總價</td>
<td>
<input type="text" x-model="data.total" disabled>
</td>
<td style="vertical-align:middle">牌價</td>
<td>
<input type="text" x-model="data.fee_per_st" disabled>
</td>
<td style="vertical-align:middle">服務費</td>
<td>
<input type="text" x-model="data.commission_fee" disabled>
</td>
<td style="vertical-align:middle">價率</td>
<td>
<input type="text" x-model="data.discount" disabled>
</td>
</tr>
<tr>
<td style="vertical-align:middle">實發獎金</td>
<td>
<input type="text" x-model="data.bonus_actual" disabled>
</td>
<td style="vertical-align:middle">實發時間</td>
<td> <input class="form-control disabled_select" type="date" x-model="data.payDay" disabled>
</td>
<td style="vertical-align:middle">備註</td>
<td><input type="text" x-model='data.note' disabled></td>
<td></td>
<td></td>
</tr>
</tbody>
</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==1" @click="stop()" :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 payDaydue = '<?= $result['pay_day'] ?>';
const maintain_price_total = '<?= $result['amount'] ?>';
const contract_type = '<?= $result['contract_type'] ?>';
// const bonus_verson = '<?= $result['bonus_verson'] ?>';
const maintain_type = '<?= $maintain_type[$bonus_json->contract_type] ?>';
const pay_kind = '<?= $paykind[$bonus_json->paykind] ?>';
const receivable_date_due = '<?= $bonus_json->receivable_date_due ?>';
const total = '<?= $bonus_json->total ?>';
const fee_per_st = '<?= $bonus_json->fee_per_st ?>';
const commission_fee = '<?= $bonus_json->commission_fee ?>';
const discount = '<?= $bonus_json->discount ?>'
const bonus_actual = '<?= $result['bonus_actual'] ?>';
const payDay = '<?= $result['pay_day'] ?>';
const note = '<?= $result['note'] ?>'
</script>

34
wms/bonus/bonus_detail.php

@ -48,17 +48,6 @@ $maintain_type = [
</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">
@ -111,7 +100,7 @@ $maintain_type = [
</td>
<td style="vertical-align:middle">應發獎金</td>
<td>
<input type="text" x-model="data.maintain_price_total" disabled>
<input type="text" x-model="data.maintain_price_total">
</td>
</tr>
<tr>
@ -133,6 +122,17 @@ $maintain_type = [
</td>
</tr>
<tr>
<td style="vertical-align:middle">實發獎金</td>
<td>
<input type="text" x-model="data.bonus_actual">
</td>
<td style="vertical-align:middle">實發時間</td>
<td> <input class="form-control disabled_select" type="date" x-model="data.payDay">
</td>
<td style="vertical-align:middle">備註</td>
<td><input type="text" x-model='data.note'></td>
</tr>
</tbody>
</template>
</table>
@ -145,6 +145,14 @@ $maintain_type = [
<div class="loader"></div>
</template>
</button>
<button x-show=" step==1" @click="stop()" :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>
@ -176,7 +184,7 @@ $maintain_type = [
const maintain_price_total = '<?= $result['amount'] ?>';
const contract_type = '<?= $result['contract_type'] ?>';
// const bonus_verson = '<?= $result['bonus_verson'] ?>';
const maintain_type = '<?= $maintain_type[$bonus_json->maintain_type] ?>';
const maintain_type = '<?= $maintain_type[$bonus_json->contract_type] ?>';
const pay_kind = '<?= $paykind[$bonus_json->paykind] ?>';
const receivable_date_due = '<?= $bonus_json->receivable_date_due ?>';
const total = '<?= $bonus_json->total ?>';

218
wms/bonus/elevator_new/elevator_new_deal_bonus.php

@ -0,0 +1,218 @@
<?php
function elevator_new_deal_bonus_v2_0($ver, $contract_type, $elevator_type, $elevator_list_price, $elevator_knockdown_price, $sales_id, $region_manger_id)
{
$bonus_array = [];
if ($ver == "2.0") {
$discount = round($elevator_knockdown_price / $elevator_list_price, 3); #銷售點數,取到小數點第三位。
#合約總類($contract_type):戰略客戶(strategy_customer)、一般客戶(general_customer)
switch ($contract_type) {
case "strategy_customer":
#契約員獎金($sales_bonus)
$sales_bonus = $elevator_knockdown_price * 0.007;
#地區經理提成獎金($region_manager_bonus)
$region_manager_bonus = 400;
break;
case "general_customer":
switch ($elevator_type) {
#客梯(passenger)、貨梯(cargo)
case ($elevator_type == "passenger" or $elevator_type == "cargo"):
switch ($discount) {
case ($discount >= 1.0):
$sales_bonus = $elevator_knockdown_price * 0.02;
break;
case ($discount >= 0.9 and $discount < 1.0):
$sales_bonus = $elevator_knockdown_price * 0.018;
break;
case ($discount >= 0.75 and $discount < 0.9):
$sales_bonus = $elevator_knockdown_price * 0.015;
break;
case ($discount < 0.75):
$sales_bonus = $elevator_knockdown_price * 0.008;
break;
};
break;
#小電梯(dumbwaiter)、平台梯(flatbase)、強驅(positive_drive)
case ($elevator_type == "dumbwaiter" or $elevator_type == "flatbase" or $elevator_type == "positive_drive"):
switch ($discount) {
case ($discount >= 1.0):
$sales_bonus = $elevator_knockdown_price * 0.02;
break;
case ($discount >= 0.9 and $discount < 1.0):
$sales_bonus = $elevator_knockdown_price * 0.018;
break;
case ($discount >= 0.72 and $discount < 0.9):
$sales_bonus = $elevator_knockdown_price * 0.015;
break;
case ($discount < 0.72):
$sales_bonus = $elevator_knockdown_price * 0.008;
break;
};
break;
};
#區域經理提成獎金($region_manager_bonus)
$region_manager_bonus = 600;
break;
};
#營銷人員銷售獎金水庫-----訂金已收款20%,發放總獎金20%
array_push($bonus_array, [
"bonus_type" => "營銷人員銷售獎金-訂金段", #獎金名稱
"bonus_receiver" => $sales_id, #發放人員
"bonus_amount" => round($sales_bonus * 0.2), #金額
"payment_schedul_due" => "deposit", #訂金已收款20%
"payment_schedul_regulation" => "訂金已收款20%,發放總獎金20%" #發放規定
]);
#營銷人員銷售獎金水庫-----出貨前期所有款項已收齊,且出貨款已收款50%,發放總獎金50%
array_push($bonus_array, [
"bonus_type" => "營銷人員銷售獎金-出貨款段", #獎金名稱
"bonus_receiver" => $sales_id, #發放人員
"bonus_amount" => round($sales_bonus * 0.5), #金額
"payment_schedul_due" => "shipping", #訂金已收款20%
"payment_schedul_regulation" => "出貨前期所有款項已收齊,且出貨款已收款50%,發放總獎金50%" #發放規定
]);
#營銷人員銷售獎金水庫-----驗收前期所有款項已收齊,且驗收款已收款30%,發放總獎金30%
array_push($bonus_array, [
"bonus_type" => "營銷人員銷售獎金-驗收款段", #獎金名稱
"bonus_receiver" => $sales_id, #發放人員
"bonus_amount" => round($sales_bonus * 0.3), #金額
"payment_schedul_due" => "acceptance", #訂金已收款20%
"payment_schedul_regulation" => "驗收前期所有款項已收齊,且驗收款已收款30%,發放總獎金30%" #發放規定
]);
#區域經理提成獎金水庫-----訂金已收款100%,發放總獎金50%
array_push($bonus_array, [
"bonus_type" => "區域經理提成獎金-訂金段", #獎金名稱
"bonus_receiver" => $region_manger_id, #發放人員
"bonus_amount" => round($region_manager_bonus * 0.5), #金額
"payment_schedul_due" => "deposit", #訂金已收款100%
"payment_schedul_regulation" => "訂金已收款100%,發放總獎金50%" #發放規定
]);
#區域經理獎金水庫-----貨到工地款(含)之前所有款項已收款100%,發放總獎金50%
array_push($bonus_array, [
"bonus_type" => "區域經理提成獎金-貨到工地款段", #獎金名稱
"bonus_receiver" => $region_manger_id, #發放人員
"bonus_amount" => round($region_manager_bonus * 0.5), #金額
"payment_schedul_due" => "deliveried", #貨到工地款(含)之前所有款項已收款100%
"payment_schedul_regulation" => "貨到工地款(含)之前所有款項已收款100%,發放總獎金50%" #發放規定
]);
$result_array = [
"ver" => $ver, #獎金版本
"result_status" => "success", #計算結果
"bonus_array" => $bonus_array #獎金水庫
];
} else {
array_push($bonus_array, [
"bonus_type" => "error", #獎金名稱
"bonus_receiver" => "error", #發放人員
"bonus_amount" => 0, #金額
"payment_schedul_due" => "9999-1-1", #預計發放時間
"payment_schedul_regulation" => "error" #發放規定
]);
$result_array = [
"ver" => $ver, #獎金版本
"result_status" => "error", #計算結果
"bonus_array" => $bonus_array #獎金水庫
];
};
return $result_array;
};
function elevator_new_deal_bonus_v1_0($ver, $contract_type, $elevator_knockdown_price, $sales_id, $region_manger_id)
{
$bonus_array = [];
if ($ver == "1.0") {
#合約總類($contract_type):戰略客戶(strategy_customer)、一般客戶(general_customer)
switch ($contract_type) {
case "strategy_customer":
#契約員獎金($sales_bonus)
$sales_bonus = $elevator_knockdown_price * 0.007;
#地區經理經理獎金($region_manager_bonus)
$region_manager_bonus = 400;
break;
case "general_customer":
#契約員獎金($sales_bonus)
$sales_bonus = $elevator_knockdown_price * 0.015;
#區域經理獎金($region_manager_bonus)
$region_manager_bonus = 600;
break;
};
#營銷人員銷售獎金水庫-----訂金已收款20%,發放總獎金20%
array_push($bonus_array, [
"bonus_type" => "營銷人員銷售獎金-訂金段", #獎金名稱
"bonus_receiver" => $sales_id, #發放人員
"bonus_amount" => round($sales_bonus * 0.2), #金額
"payment_schedul_due" => "deposit", #訂金已收款20%
"payment_schedul_regulation" => "訂金已收款20%,發放總獎金20%" #發放規定
]);
#營銷人員銷售獎金水庫-----出貨前期所有款項已收齊,且出貨款已收款50%,發放總獎金50%
array_push($bonus_array, [
"bonus_type" => "營銷人員銷售獎金-出貨款段", #獎金名稱
"bonus_receiver" => $sales_id, #發放人員
"bonus_amount" => round($sales_bonus * 0.5), #金額
"payment_schedul_due" => "shipping", #訂金已收款20%
"payment_schedul_regulation" => "出貨前期所有款項已收齊,且出貨款已收款50%,發放總獎金50%" #發放規定
]);
#營銷人員銷售獎金水庫-----驗收前期所有款項已收齊,且驗收款已收款30%,發放總獎金30%
array_push($bonus_array, [
"bonus_type" => "營銷人員銷售獎金-驗收款段", #獎金名稱
"bonus_receiver" => $sales_id, #發放人員
"bonus_amount" => round($sales_bonus * 0.3), #金額
"payment_schedul_due" => "acceptance", #訂金已收款20%
"payment_schedul_regulation" => "驗收前期所有款項已收齊,且驗收款已收款30%,發放總獎金30%" #發放規定
]);
#區域經理獎金水庫-----訂金已收款100%,發放總獎金50%
array_push($bonus_array, [
"bonus_type" => "區域經理提成獎金-訂金段", #獎金名稱
"bonus_receiver" => $region_manger_id, #發放人員
"bonus_amount" => round($region_manager_bonus * 0.5), #金額
"payment_schedul_due" => "deposit", #訂金已收款100%
"payment_schedul_regulation" => "訂金已收款100%,發放總獎金50%" #發放規定
]);
#區域經理獎金水庫-----貨到工地款(含)之前所有款項已收款100%,發放總獎金50%
array_push($bonus_array, [
"bonus_type" => "區域經理提成獎金-貨到工地款段", #獎金名稱
"bonus_receiver" => $region_manger_id, #發放人員
"bonus_amount" => round($region_manager_bonus * 0.5), #金額
"payment_schedul_due" => "deliveried", #貨到工地款(含)之前所有款項已收款100%
"payment_schedul_regulation" => "貨到工地款(含)之前所有款項已收款100%,發放總獎金50%" #發放規定
]);
$result_array = [
"ver" => $ver, #獎金版本
"result_status" => "success", #計算結果
"bonus_array" => $bonus_array #獎金水庫
];
} else {
array_push($bonus_array, [
"bonus_type" => "error", #獎金名稱
"bonus_receiver" => "error", #發放人員
"bonus_amount" => 0, #金額
"payment_schedul_due" => "9999-1-1", #預計發放時間
"payment_schedul_regulation" => "error" #發放規定
]);
$result_array = [
"ver" => $ver, #獎金版本
"result_status" => "error", #計算結果
"bonus_array" => $bonus_array #獎金水庫
];
};
return $result_array;
};

36
wms/bonus/other/maintenance_contract_bonus_v2_1.php

@ -41,7 +41,7 @@ result_array[
function maintenance_contract_bonus_v2_1($ver, $contract_type, $payment_period, $elevator_list_price, $fee_per_st, $commission_fee, $receivable_date_due, $sales_id, $region_director_id, $regular_contract_manger_id)
function maintenance_contract_bonus_v2_1($ver, $contract_type, $payment_period, $elevator_list_price, $fee_per_st, $commission_fee, $receivable_date_due, $sales_id, $region_director_id, $regular_contract_manger_id = '')
{
$bonus_array = [];
if ($ver == "2.1") {
@ -54,13 +54,13 @@ function maintenance_contract_bonus_v2_1($ver, $contract_type, $payment_period,
switch ($discount) {
case ($discount >= 0.8):
switch ($fee_per_st) {
case ($fee_per_st < 3000):
case ($fee_per_st <= 3000):
$sales_bonus = ($fee_per_st - $commission_fee) * 0.6;
break;
case ($fee_per_st >= 3000 and $fee_per_st < 3500):
case ($fee_per_st >= 3001 and $fee_per_st <= 3499):
$sales_bonus = ($fee_per_st - $commission_fee) * 0.7;
break;
case ($fee_per_st >= 3500 and $fee_per_st < 4000):
case ($fee_per_st >= 3500 and $fee_per_st <= 3999):
$sales_bonus = ($fee_per_st - $commission_fee) * 0.8;
break;
case ($fee_per_st >= 4000):
@ -157,19 +157,19 @@ function maintenance_contract_bonus_v2_1($ver, $contract_type, $payment_period,
"bonus_receiver" => $region_director_id, #發放人員
"bonus_amount" => round($region_director_bonus), #金額
"pay_day_due" => date("Y-m-d", strtotime("$receivable_date_due +1 months")), #預計發放時間
"bonus_regulation" => "第1次款項收回後,次月發放", #發放規定
'discount' => $discount //折扣率
"bonus_regulation" => "第1次款項收回後,次月發放" #發放規定
]);
#專任契約經理獎金
if ($regular_contract_manger_id != '') {
array_push($bonus_array, [
"bonus_type" => "3", #獎金名稱
"bonus_receiver" => $regular_contract_manger_id, #發放人員
"bonus_amount" => round($regular_contract_manger_bonus), #金額
"pay_day_due" => date("Y-m-d", strtotime("$receivable_date_due +1 months")), #預計發放時間
"bonus_regulation" => "第1次款項收回後,次月發放", #發放規定
'discount' => $discount //折扣率
"bonus_regulation" => "第1次款項收回後,次月發放" #發放規定
]);
}
#契約員獎金
switch ($payment_period) {
@ -180,9 +180,7 @@ function maintenance_contract_bonus_v2_1($ver, $contract_type, $payment_period,
"bonus_receiver" => $sales_id, #發放人員
"bonus_amount" => round($sales_bonus), #金額
"pay_day_due" => date("Y-m-d", strtotime("$receivable_date_due +1 months")), #預計發放時間
"bonus_regulation" => "每月收款後,按收款比率次月發放", #發放規定
'discount' => $discount //折扣率
"bonus_regulation" => "每月收款後,按收款比率次月發放" #發放規定
]);
break;
@ -201,9 +199,7 @@ function maintenance_contract_bonus_v2_1($ver, $contract_type, $payment_period,
"bonus_receiver" => $sales_id, #發放人員
"bonus_amount" => round($current_bonus), #金額
"pay_day_due" => date("Y-m-d", strtotime("$receivable_date_due +$payday_due_array[$i] months")), #預計發放時間
"bonus_regulation" => "每月收款後,按收款比率次月發放", #發放規定
'discount' => $discount //折扣率
"bonus_regulation" => "每月收款後,按收款比率次月發放" #發放規定
]);
}
break;
@ -223,9 +219,7 @@ function maintenance_contract_bonus_v2_1($ver, $contract_type, $payment_period,
"bonus_receiver" => $sales_id, #發放人員
"bonus_amount" => round($current_bonus), #金額
"pay_day_due" => date("Y-m-d", strtotime("$receivable_date_due +$payday_due_array[$i] months")), #預計發放時間
"bonus_regulation" => "每月收款後,按收款比率次月發放", #發放規定
'discount' => $discount //折扣率
"bonus_regulation" => "每月收款後,按收款比率次月發放" #發放規定
]);
}
break;
@ -245,9 +239,7 @@ function maintenance_contract_bonus_v2_1($ver, $contract_type, $payment_period,
"bonus_receiver" => $sales_id, #發放人員
"bonus_amount" => round($current_bonus), #金額
"pay_day_due" => date("Y-m-d", strtotime("$receivable_date_due +$payday_due_array[$i] months")), #預計發放時間
"bonus_regulation" => "每月收款後,按收款比率次月發放", #發放規定
'discount' => $discount //折扣率
"bonus_regulation" => "每月收款後,按收款比率次月發放" #發放規定
]);
}
break;
@ -267,9 +259,7 @@ function maintenance_contract_bonus_v2_1($ver, $contract_type, $payment_period,
"bonus_receiver" => $sales_id, #發放人員
"bonus_amount" => round($current_bonus), #金額
"pay_day_due" => date("Y-m-d", strtotime("$receivable_date_due +$payday_due_array[$i] months")), #預計發放時間
"bonus_regulation" => "每月收款後,按收款比率次月發放", #發放規定
'discount' => $discount //折扣率
"bonus_regulation" => "每月收款後,按收款比率次月發放" #發放規定
]);
}
break;

55
wms/bonus/other/maintenance_contract_bonus_v2_1_examination.php

@ -48,10 +48,10 @@ require_once("maintenance_contract_bonus_v2_1.php");
#獎金測試
$examination_array = [
#錯誤版本
["1.0","new","one",0.8,4000,333, "2014-07-01", "M0001", "M0002", "M0003"],
// ["1.0", "new", "one", 0.8, 4000, 333, "2014-07-01", "M0001", "M0002", "M0003"],
#新簽約
#月繳(monthly)
["2.1","new","monthly",3000,3000,600,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、月繳、牌價3000、簽約價3000元、服務費600元(折扣率0.8)
["2.1", "new", "monthly", 3000, 3000, 600, "2014-07-01", "M0001", "M0002", ''], #新簽約、月繳、牌價3000、簽約價3000元、服務費600元(折扣率0.8)
["2.1", "new", "monthly", 3000, 3001, 601, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、月繳、牌價3000、簽約價3001元、服務費601元(折扣率0.8)
["2.1", "new", "monthly", 3000, 3500, 1100, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、月繳、牌價3000、簽約價3500元、服務費1100元(折扣率0.8)
["2.1", "new", "monthly", 3000, 4000, 1600, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、月繳、牌價3000、簽約價4000元、服務費1600元(折扣率0.8)
@ -258,9 +258,26 @@ $examination_array = [
["2.1", "renew_priceissue", "annually", 3000, 4000, 2230, "2014-07-01", "M0001", "M0002", "M0003"] #續簽約(原價或僅契約金額異動)、年付、牌價3000、簽約價4000元、服務費2230元(折扣率0.59)
];
// echo '1、契約總類($contract_type):新簽約(new)、免保轉有費(free_to_charge)、續簽約(原價或僅契約金額異動)(renew_priceissue)</br>';
// echo '6、付款方式$payment_period: 每月支付(monthly), 2月1次(bimonthly), 季付(quarterly), 半年付(semiannually), 年付(annually)</br>';
// echo '2、作番契約金額($fee_per_st):3000元/月以下、3001-3499元/月、3500-3999元/月、4000元/月以上</br>';
// echo '3、牌價($elevator_list_price):該電梯的合約發佈(標準)價+Option價格+與其他電梯共同分擔的費用貨價格</br>';
// echo '4、該作番所佔的服務費金額($commission_fee)</br>';
// echo '5、合約折扣率($discount):大於80%以上(含)(above_80)、60-79%(含)以上(60_to_79)、折扣率59% (含)以下(below_59) ; 契約折扣率=(簽約價格-服務費)/牌價</br>';
// echo '7、第一筆保養款項應收回日($receivable_date_due, array)</br>';
// echo '8、契約員員工號($sales_id)</br>';
// echo '9、地區處長員工號($region_director_id)</br>';
// echo '10、專任契約經理員工號($regular_contract_manger_id)</br>';
for ($i = 0; $i < count($examination_array); $i++) {
$fee_per_st = $examination_array[$i][3];
$commission_fee = $examination_array[$i][5];
$elevator_list_price = $examination_array[$i][4];
$discount = round(($fee_per_st - $commission_fee) / $elevator_list_price, 2);
// echo "$fee_per_st - $commission_fee / $elevator_list_price ";
// $discount = round(($examination_array[$i][4] - $examination_array[$i][6]) / $examination_array[$i][5], 2);
$examination_array[$i][9] = $examination_array[$i][9] == '' ? '' : $examination_array[$i][9];
$result = maintenance_contract_bonus_v2_1(
$examination_array[$i][0],
$examination_array[$i][1],
@ -273,19 +290,39 @@ for($i = 0; $i<count($examination_array); $i++){
$examination_array[$i][8],
$examination_array[$i][9]
);
#新簽約、月繳、牌價3000、簽約價3000元、服務費600元(折扣率0.8)
$contract_type = [
'new' => '新簽約',
'free_to_charge' => '免保轉有費',
'renew_priceissue' => '續簽約(原價或僅契約金額異動)'
];
// 付款方式$payment_period: 每月支付(monthly), 2月1次(bimonthly), 季付(quarterly), 半年付(semiannually), 年付(annually)
$pay_kind = [
'monthly' => '月繳',
'bimonthly' => '雙月繳',
'quarterly' => '季繳',
'semiannually' => '半年繳',
'annually' => '年繳'
];
//
$bonus_type = [
'1' => '契約員獎金',
'2' => '區經理獎金',
'3' => '契約經理獎金'
];
echo "獎金版本:" . $result["ver"] . "<br>";
echo "計算結果:" . $result["result_status"] . "<br>";
echo "傳入參數說明:" . $contract_type[$examination_array[$i][1]] . "、" . $pay_kind[$examination_array[$i][2]] . "、牌價" . $examination_array[$i][3] . "元、簽約價" . $examination_array[$i][4] . "元、服務費600元(折扣率" . $discount . ")、契約人員 : " . $examination_array[$i][7] . "、區經理 : " . $examination_array[$i][8] . " 、契約經理 : " . $examination_array[$i][9] . "<br>";
echo "輸入參數:" . $examination_array[$i][1] . " " . $examination_array[$i][2] . " " . $examination_array[$i][3] . " " . $examination_array[$i][4] . " "
. $examination_array[$i][5] . " " . $examination_array[$i][6] . " " . $examination_array[$i][7] . " " . $examination_array[$i][8] . " "
. $examination_array[$i][9] . "<br>";
for ($j = 0; $j < count($result["bonus_array"]); $j++) {
echo "輸出結果:" . $result["bonus_array"][$j]["bonus_type"] . " " . $result["bonus_array"][$j]["bonus_receiver"] . " "
. $result["bonus_array"][$j]["bonus_amount"] . " " . $result["bonus_array"][$j]["pay_day_due"] . " "
echo "輸出結果:" . $bonus_type[$result["bonus_array"][$j]["bonus_type"]] . " ,發放人員 : " . $result["bonus_array"][$j]["bonus_receiver"] . " ,發放金額 : "
. $result["bonus_array"][$j]["bonus_amount"] . " ,預計發放時間 : " . $result["bonus_array"][$j]["pay_day_due"] . " ,說明 : "
. $result["bonus_array"][$j]["bonus_regulation"] . "<br>";
};
echo "-------------------------" . "<br>";
};
?>

20
wms/contract-repair/contract-renovate-input.php

@ -92,7 +92,7 @@ $contractSalesman = $stmt->fetchAll(PDO::FETCH_ASSOC);
<tr>
<td rowspan="4">材料</td>
<td rowspan="3">材料</td>
<td>1、訂金</td>
<td>
<input type="text">
@ -143,23 +143,7 @@ $contractSalesman = $stmt->fetchAll(PDO::FETCH_ASSOC);
</select>
</td>
</tr>
<!-- <tr>
<td>4、其他</td>
<td>
<input type="text">
</td>
<td colspan="2">
<input type="text">
</td>
<td>
<select x-model=data.paykind[3] @change="totalFn()">
<template x-for="pay in data.payarr" :key="pay">
<!-- <option value=""></option> -->
<option x-text="pay"></option>
</template>
</select>
</td>
</tr> -->
<tr>
<td rowspan="3">安裝</td>

51
wms/contract-repair/js/alpine.js

@ -900,7 +900,13 @@ const bonunsIndex = () => {
total: total,
fee_per_st: fee_per_st,
commission_fee: commission_fee,
discount: discount
discount: discount,
bonus_actual: '',
note: '',
id: id,
// bonus_actual: bonus_actual,
// payDay: payDay,
// note: note
},
step: 1,
@ -929,6 +935,9 @@ const bonunsIndex = () => {
this.step = 3; s
}
},
issue() {
console.log(1233);
},
getContractData() {
axios.get('./api/get.php?contract_no=' + this.data.contract_no).then(res => {
if (!res.data) {
@ -965,7 +974,39 @@ const bonunsIndex = () => {
},
save() {
if (this.step == 1) {
window.history.back();
// window.history.back();
const form = new FormData();
form.append('id', this.data.id);
form.append('bonus_actual', this.data.bonus_actual);
form.append('pay_day', this.data.payDay);
form.append('note', this.data.note);
form.append('user_id', this.data.user_id);
form.append('postType', 'b');
axios.post('./api/postStatus.php', form).then((res) => {
alert('更新成功');
window.history.go(-1);
}).catch((err) => {
// alert('更新失敗');
alert('更新失敗' + err.response.data);
})
}
},
stop() {
if (this.step == 1) {
const form = new FormData();
form.append('id', this.data.id);
form.append('bonus_actual', this.data.bonus_actual);
form.append('pay_day', this.data.payDay);
form.append('note', this.data.note);
form.append('postType', 'c');
axios.post('./api/postStatus.php', form).then((res) => {
console.log(res);
alert('更新成功');
window.history.go(-1);
}).catch((err) => {
alert(err.response.data);
})
}
},
calBons() {
@ -1001,7 +1042,7 @@ const bonunsIndex = () => {
}
}
const bonunsIndexTest = () => {
const bonusIndexTest = () => {
return {
data: {
bonus_verson: '2.1',
@ -1028,8 +1069,8 @@ const bonunsIndexTest = () => {
step: 1,
isLoading: false,
fail_arr: [],
test() {
console.log(this.data.paykind);
issue() {
console.log('123');
},
nextStepFn() {
if (this.step == 1) {

2
wms/contract-repair/styles/style.css

@ -654,7 +654,7 @@ main table th {
align-items: center;
width: 70px;
height: 45px;
font-size: 15px;
font-size: 10px;
}
.contract-input-component .form table .fixed,
.contract-management .form table .fixed,

2
wms/contract-repair/styles/style.scss

@ -707,7 +707,7 @@ main {
align-items: center;
width: 70px;
height: 45px;
font-size: 15px;
font-size: 10px;
}
table {

11
wms/contract/api/T8salIncomeApply.php

@ -3,14 +3,15 @@ require_once("../../T8_Authorization_from_bpm.php");
function T8API($data)
{
// echo '<pre>';
// print_r(json_encode($data));
// echo '</pre>';
$api_url = 'https://erp.masada.com.tw:780/twWebAPI/V1/SALINCOMEAPPLY/PostERPData';
$validation = get_Auth();
echo '<pre>';
print_r(json_encode($data));
echo '</pre>';
$header = [
"CHI_Authorization :" . $validation
"CHI_Authorization :" . $validation,
"GroupId:TEST"
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $api_url); // 设置请求的URL
@ -20,6 +21,7 @@ function T8API($data)
curl_setopt($ch, CURLOPT_POST, 1); // 使用 POST
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
$response = curl_exec($ch);
if ($response === false) {
echo 'Curl error: ' . curl_error($ch);
} else {
@ -32,6 +34,7 @@ function T8API($data)
// print_r($result);
return $result;
}
return $result;
}
curl_close($ch);

15
wms/contract/api/getComboNo.php

@ -1,6 +1,7 @@
<?php
class CreateComboNo{
class CreateComboNo
{
private $comboarr = [
'week' => 'BW002',
'month' => 'EM002',
@ -21,12 +22,14 @@ class CreateComboNo{
private $combo;
private $startdate;
private $enddate;
public function __construct($combo, $startdate, $enddate){
public function __construct($combo, $startdate, $enddate)
{
$this->combo = $combo;
$this->startdate = $startdate;
$this->enddate = $enddate;
}
public function getComboNo(){
public function getComboNo()
{
$comboarr = (array) $this->combo === 'bw' ? $this->bwarr : $this->emarr;
$startdate = new DateTime($this->startdate);
@ -43,13 +46,13 @@ class CreateComboNo{
$first_day = date('Y-m-d', strtotime($this->startdate . ' + 3 days'));
$new_first_month = date('m', strtotime($first_day));
if ($ori_first_month != $new_first_month) {
$first_day = date('Y-m-t', strtotime($this->startdate));
$first_day = date('Y-m-d', strtotime($this->startdate));
}
$scheduleDate = new DateTime($first_day);
for ($i = 0; $i < $months; $i++){
for ($i = 0; $i <= $months; $i++) {
$newarr[] = [$this->comboarr[$comboarr[$idx]], $scheduleDate->format("Y-m-d")];
$idx++;
$scheduleDate = $startdate->modify("+1 month");
$scheduleDate = $scheduleDate->modify("+1 month");
if ($idx >= count($comboarr)) {
$idx = 0;
}

63
wms/contract/api/getContractData.php

@ -23,6 +23,10 @@ if(isset($_GET['contractno']) && $_GET['contractno']!='' && isset($_GET['contrac
$stmt->execute();
$elevators = $stmt->fetchAll(PDO::FETCH_ASSOC);
$count = COUNT($elevators);
// foreach ($elevators as $key => $elevator) {
// $elevator['discount'] = ($elevator['sold_price'] / $elevator['stand_price']) * 100;
// }
$contract['elevators'] = $elevators;
$contract['num'] = $count;
@ -42,13 +46,52 @@ if(isset($_GET['contractno']) && $_GET['contractno']!='' && isset($_GET['contrac
if (isset($_GET['contractno']) && $_GET['contractno'] != '' && isset($_GET['contracttype']) && $_GET['contracttype'] == 'm') {
try {
$contractno = $_GET['contractno'];
$sql_str = "SELECT * FROM hope_elevator_customer WHERE vol_no = :vol_no ORDER BY created_at DESC";
$sql_str = "SELECT a.*,b.lm_tel,b.uscc,b.manager,b.linkman FROM pricereview_main AS a
LEFT JOIN hope_elevator_customer AS b ON a.contractno = b.vol_no
WHERE a.contractno = :contractno AND a.status != 'YN' ";
$stmt = $conn->prepare($sql_str);
$stmt->bindParam(':vol_no', $contractno);
$stmt->bindParam(':contractno', $contractno);
$stmt->execute();
$contract = $stmt->fetch(PDO::FETCH_ASSOC);
$contractResponse = json_encode($contract);
$salesman = $contract['person'];
$sql = "SELECT * FROM account WHERE accountid = :accountid ";
$stmt = $conn->prepare($sql);
$stmt->bindParam(':accountid', $salesman);
$stmt->execute();
$account_detail = $stmt->fetch(PDO::FETCH_ASSOC);
$contract['manager'] = $account_detail['manager'];
$contract['salesman_departno'] = $account_detail['department_id'];
$mid = $contract['id'];
$sql = "SELECT * FROM pricereview_item WHERE mid = :mid AND item_group = 'A' ";
$stmt = $conn->prepare($sql);
$stmt->bindParam(':mid', $mid);
$stmt->execute();
$results = $stmt->fetchAll(PDO::FETCH_ASSOC);
$elevators_detail_arr = [];
foreach ($results as $keys => $result) {
$note = explode(',', $result['note']);
$result['spec'] = $note[0]; //型號
$result['person'] = $note[1]; // 人承
$result['floor'] = $note[2]; // 樓層
$result['speed'] = $note[3]; // 速度
for ($i = 0; $i < $result['item_qty']; $i++) {
$result['item_no'] = $i + 1;
array_push($elevators_detail_arr, $result);
}
}
$count = COUNT($elevators_detail_arr);
$contract['elevators'] = $results;
$contract['elevators_detail_arr'] = $elevators_detail_arr;
$contract['nums'] = $count;
// echo '<pre>';
// print_r($contract);
// echo '</pre>';
// exit;
$contractResponse = json_encode($contract);
// 設定回應標頭為 JSON
header('Content-Type: application/json');
@ -59,4 +102,18 @@ if(isset($_GET['contractno']) && $_GET['contractno']!='' && isset($_GET['contrac
}
}
if (!empty($_GET['contracttype']) && $_GET['contracttype'] == 'accountManger' && !empty($_GET['salesman'])) {
try {
$salesman = $_GET['salesman'];
$sql = "SELECT manager FROM account WHERE accountid = :accountid";
$stmt = $conn->prepare($sql);
$stmt->bindParam(':accountid', $salesman);
$stmt->execute();
$result = $stmt->fetch(PDO::FETCH_ASSOC);
header('Content-Type:application/json');
echo json_encode($result);
} catch (PDOException $e) {
die("ERROR!!!:" . $e->getMessage());
}
}

276
wms/contract/api/postContractData.php

@ -18,7 +18,7 @@ if (isset($_POST["contractno"]) && $_POST["contractno"] != "" && isset($_POST['c
$phone = !empty($_POST['phone']) ? $_POST['phone'] : null;
$email = !empty($_POST['email']) ? $_POST['email'] : null;
$mworker = !empty($_POST['mworker']) ? $_POST['mworker'] : null;
$mcycle = !empty($_POST['mcycle']) ? $_POST['mcycle'] : null;
// $mcycle = !empty($_POST['mcycle']) ? $_POST['mcycle'] : null;
$salesman = !empty($_POST['salesman']) ? $_POST['salesman'] : null;
$contract_begin_date = !empty($_POST['contract_begin_date']) ? $_POST['contract_begin_date'] : null;
$contract_end_date = !empty($_POST['contract_end_date']) ? $_POST['contract_end_date'] : null;
@ -35,17 +35,53 @@ if (isset($_POST["contractno"]) && $_POST["contractno"] != "" && isset($_POST['c
$files = !empty($_FILES['files']) ? $_FILES['files'] : null;
$elevators = !empty($_POST['elevators']) ? json_decode($_POST['elevators'], true) : [];
$payType = !empty($_POST['payType']) ? $_POST['payType'] : null;
$sql = "SELECT * FROM account WHERE accountid = '$salesman'";
$stmt = $conn->prepare($sql);
$stmt->execute();
$accountData = $stmt->fetch(PDO::FETCH_ASSOC);
$depId = $accountData['department_id'];
// validate
//create facility table
$createFacilityNo = new CreateFacilityNo();
$dailyNecessities = [
'MAE100' => 'X',
'MAM200' => 'W',
'MAH100' => 'H',
'MAQ100' => 'Z',
'MAF100' => 'F',
'MAZ100' => 'B',
];
$maintain_times = [
'1' => 'em', //月保
'2' => 'bw' // 雙周保
];
$facility_arr = [];
foreach ($elevators as $elevator) {
$facility_arr[] = $dailyNecessities[$elevator['spec']];
}
echo json_encode($facility_arr);
// 電梯做番號
$facilityno = $createFacilityNo->makeBFacilityNo("T", $facility_arr, (int)$num);
// if ($user_id == 'M0225') {
// echo '<pre>';
// print_r($facilityno);
// echo '</pre>';
// exit();
// }
echo json_encode($facilityno);
/// 獎金計算
$fail_arr = [];
if ($contractno === '') return $fail_arr[] = '合約號為必填';
if ($total_price == '') $fail_arr[] = '合約總價為必填';
if ($vat == '') $fail_arr[] = '統一編號為必填';
if ($mtype == '') $fail_arr[] = '維修型態為必填';
if ($phone == '') $fail_arr[] = '客戶電話為必填';
if ($email == '') $fail_arr[] = 'Email為必填';
// if ($email == '') $fail_arr[] = 'Email為必填';
if ($mworker == '') $fail_arr[] = '保養員為必填';
if ($mcycle == '') $fail_arr[] = '保養頻率為必填';
// if ($mcycle == '') $fail_arr[] = '保養頻率為必填';
if ($salesman == '') $fail_arr[] = '營業員為必填';
if ($contract_begin_date == '') $fail_arr[] = '合約開始時間為必填';
if ($contract_end_date == '') $fail_arr[] = '合約結束時間為必填';
@ -63,7 +99,8 @@ if (isset($_POST["contractno"]) && $_POST["contractno"] != "" && isset($_POST['c
echo json_encode($fail_arr);
exit();
}
T8insert($_POST, $facilityno, $depId);
bonusCreate($_POST, $facilityno, $conn);
//create account table
$accounttype = "A";
$accountid = $vat;
@ -75,6 +112,8 @@ if (isset($_POST["contractno"]) && $_POST["contractno"] != "" && isset($_POST['c
$create_at = date('Y-m-d H:i:s');
$conn->beginTransaction();
// bonusCreate($_POST, $facilityno, $conn);
// exit();
$sql_str = "INSERT INTO account (accounttype, accountid, pwd, name, tel, address, email, repairerid, creater, create_at) VALUES (:accounttype, :accountid, :pwd, :name, :tel, :address, :email, :repairerid, :creater, :create_at)";
$stmt = $conn->prepare($sql_str);
@ -127,30 +166,35 @@ if (isset($_POST["contractno"]) && $_POST["contractno"] != "" && isset($_POST['c
$stmt->execute();
//create facility table
$createFacilityNo = new CreateFacilityNo();
$dailyNecessities = [
'MAE100' => 'X',
'MAM200' => 'W',
'MAH100' => 'H',
'MAQ100' => 'Z',
'MAF100' => 'F',
'MAZ100' => 'B',
];
$facility_arr = [];
foreach ($elevators as $elevator) {
$facility_arr[] = $dailyNecessities[$elevator['spec']];
}
echo json_encode($facility_arr);
// 電梯做番號
$facilityno = $createFacilityNo->makeBFacilityNo("T", $facility_arr, (int)$num);
// if ($user_id == 'M0225') {
// echo '<pre>';
// print_r($facilityno);
// echo '</pre>';
// exit();
// $createFacilityNo = new CreateFacilityNo();
// $dailyNecessities = [
// 'MAE100' => 'X',
// 'MAM200' => 'W',
// 'MAH100' => 'H',
// 'MAQ100' => 'Z',
// 'MAF100' => 'F',
// 'MAZ100' => 'B',
// ];
// $maintain_times = [
// '1' => 'em', //月保
// '2' => 'bw' // 雙周保
// ];
// $facility_arr = [];
// foreach ($elevators as $elevator) {
// $facility_arr[] = $dailyNecessities[$elevator['spec']];
// }
echo json_encode($facilityno);
echo '-------';
// echo json_encode($facility_arr);
// // 電梯做番號
// $facilityno = $createFacilityNo->makeBFacilityNo("T", $facility_arr, (int)$num);
// // if ($user_id == 'M0225') {
// // echo '<pre>';
// // print_r($facilityno);
// // echo '</pre>';
// // exit();
// // }
// echo json_encode($facilityno);
// echo '-------';
$sql_str = "SELECT accountid, name FROM account WHERE accountid = :accountid";
$stmt = $conn->prepare($sql_str);
$stmt->bindParam(':accountid', $mworker);
@ -162,6 +206,12 @@ if (isset($_POST["contractno"]) && $_POST["contractno"] != "" && isset($_POST['c
$repairerid = $mworker;
$repairername = $worker['name'];
foreach ($elevators as $idx => $elevator) {
// 民國年轉換西元年
$ROCuseful_date = $elevator['useful_date'];
$click = explode("-", $ROCuseful_date);
$click[0] = intval($click[0]) + 1911;
$ADuseful_date = implode("-", $click);
$sql_str = "INSERT INTO facility (contractno, define, facilityno, latitude, longitude, customerid, weight, numberofpassenger, numberofstop, numberoffloor, opentype, speed, repairtype, maintainance, facility_kind, address, repairerid, repairername, creater, create_at, area, takecertificatedate, licensedate)
VALUES (:contractno, :define, :facilityno, :latitude, :longitude, :customerid, :weight, :numberofpassenger, :numberofstop, :numberoffloor, :opentype, :speed, :repairtype, :maintainance, :facility_kind, :address, :repairerid, :repairername, :creater, :create_at, :area, :takecertificatedate, :licensedate)";
$stmt = $conn->prepare($sql_str);
@ -187,15 +237,17 @@ if (isset($_POST["contractno"]) && $_POST["contractno"] != "" && isset($_POST['c
$stmt->bindParam(':create_at', $create_at);
$stmt->bindParam(':area', $area);
$stmt->bindParam(':takecertificatedate', $elevator['takecertificatedate']);
$stmt->bindParam(':licensedate', $elevator['useful_date']);
$stmt->bindParam(':licensedate', $ADuseful_date);
$result = $stmt->execute();
}
//create schedule table
$comboNo = new CreateComboNo($mcycle, $contract_begin_date, $contract_end_date);
$comboArr = json_decode($comboNo->getComboNo(), true);
// $comboNo = new CreateComboNo($mcycle, $contract_begin_date, $contract_end_date);
// $comboArr = json_decode($comboNo->getComboNo(), true);
foreach ($facilityno as $no) {
$comboNo = new CreateComboNo($maintain_times[$elevator['maintain_times']], $contract_begin_date, $contract_end_date);
$comboArr = json_decode($comboNo->getComboNo(), true);
foreach ($comboArr as $combo) {
$sql_str = 'INSERT INTO schedule (contractno, facilityno, combono, repairerid, repairername, duedate, creater, create_at) VALUES (:contractno, :facilityno, :combono, :repairerid, :repairername, :duedate, :creater, :create_at)';
$stmt = $conn->prepare($sql_str);
@ -218,7 +270,7 @@ if (isset($_POST["contractno"]) && $_POST["contractno"] != "" && isset($_POST['c
$customer_phone = $phone;
$customer_email = $email;
$repairman = $mworker;
$cycle = $mcycle;
// $cycle = $mcycle;
$contact_person = $partyA;
$contact_address = $partyAaddress;
$contact_phone = $partyAphone;
@ -285,8 +337,8 @@ if (isset($_POST["contractno"]) && $_POST["contractno"] != "" && isset($_POST['c
} else {
$files = null;
}
$sql_str = "INSERT INTO contract_b_signed_back (contract_no, contract_type, company, customer_no, salesperson, contract_start_date, contract_end_date, total_price,payType, customer_phone, customer_email, repairman, cycle, contact_person, contact_address, contact_phone, contact_email, elevators_number, area, address, files_id, bonus, max_bonus, created_at, created_by)
VALUES (:contract_no, :contract_type, :company, :customer_no, :salesperson, :contract_start_date, :contract_end_date, :total_price, :payType ,:customer_phone, :customer_email, :repairman, :cycle, :contact_person, :contact_address, :contact_phone, :contact_email, :elevators_number, :area, :address, :files_id, :bonus, :max_bonus, :created_at, :created_by)";
$sql_str = "INSERT INTO contract_b_signed_back (contract_no, contract_type, company, customer_no, salesperson, contract_start_date, contract_end_date, total_price,payType, customer_phone, customer_email, repairman, contact_person, contact_address, contact_phone, contact_email, elevators_number, area, address, files_id, bonus, max_bonus, created_at, created_by)
VALUES (:contract_no, :contract_type, :company, :customer_no, :salesperson, :contract_start_date, :contract_end_date, :total_price, :payType ,:customer_phone, :customer_email, :repairman, :contact_person, :contact_address, :contact_phone, :contact_email, :elevators_number, :area, :address, :files_id, :bonus, :max_bonus, :created_at, :created_by)";
$stmt = $conn->prepare($sql_str);
$stmt->bindParam(":contract_no", $contractno);
$stmt->bindParam(":contract_type", $contract_type);
@ -299,7 +351,7 @@ if (isset($_POST["contractno"]) && $_POST["contractno"] != "" && isset($_POST['c
$stmt->bindParam(":customer_phone", $customer_phone);
$stmt->bindParam(":customer_email", $customer_email);
$stmt->bindParam(":repairman", $repairman);
$stmt->bindParam(":cycle", $cycle);
// $stmt->bindParam(":cycle", $cycle); // 保養頻率在做番上,這邊不 insert。
$stmt->bindParam(":contact_person", $contact_person);
$stmt->bindParam(":contact_address", $contact_address);
$stmt->bindParam(":contact_phone", $contact_phone);
@ -316,20 +368,9 @@ if (isset($_POST["contractno"]) && $_POST["contractno"] != "" && isset($_POST['c
$stmt->execute();
// $date = date('Y-m-sH-s-i');
// $createTime = str_replace("-", '', $date);
// $sql = "INSERT INTO comCustomer(BizPartnerId,PersonId,CreatorId,IsInUsed,InvoiceAddress,CreateTime)VALUES(:BizPartnerId,:PersonId,:CreatorId,1,:InvoiceAddress,:CreateTime)";
// $stmt = $connT8->prepare($sql);
// $stmt->bindParam(':BizPartnerId', $contractno);
// $stmt->bindParam(':PersonId', $salesman);
// $stmt->bindParam(':CreatorId', $user_id);
// $stmt->bindParam(':InvoiceAddress', $address);
// $stmt->bindParam(':CreateTime', $createTime);
// $stmt->execute();
T8insert($_POST, $facilityno);
// T8insert($_POST, $facilityno);
header('Content-Type: application/json');
// header('Content-Type: application/json');
$jsonData = json_encode($files);
$conn->commit();
@ -341,7 +382,7 @@ if (isset($_POST["contractno"]) && $_POST["contractno"] != "" && isset($_POST['c
}
};
function T8insert($data, $facilityno)
function T8insert($data, $facilityno, $depId)
{
require_once("../connt8.php");
// 引入 T8 API 連線
@ -362,7 +403,6 @@ function T8insert($data, $facilityno)
$elevators = !empty($data['elevators']) ? json_decode($data['elevators'], true) : []; //電梯
$area = !empty($data['area']) ? $data['area'] : null; //縣市 Ex. A->台北 , B-> ..。
$payType = !empty($data['payType']) ? $data['payType'] : null;
$user_id = !empty($_POST['user_id']) ? $_POST['user_id'] : null;
@ -372,9 +412,9 @@ function T8insert($data, $facilityno)
$stmt = $conn->prepare($sql);
$stmt->bindParam(':BizPartnerId', $contractno);
$stmt->execute();
$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
$date = date('Y-m-sH-s-i');
$date_1 = date('Y-m-s');
$result = $stmt->fetch(PDO::FETCH_ASSOC);
$date = date('Y-m-dH-s-i');
$date_1 = date('Y-m-d');
$createTime = str_replace("-", '', $date);
$insertTime = str_replace('-', '', $date_1);
$beginDate = str_replace("-", '', $contract_begin_date);
@ -493,12 +533,12 @@ function T8insert($data, $facilityno)
// echo '<pre>';
// print_r($elevator);
// echo '</pre>';
$facility_no = $facilityno[$index];
$sql = "INSERT INTO comMaterial
(FOrgid,MaterialId,MaterialTypeId,MaterialCategoryId,CreatorId,CreateTime)
VALUES ('1000',:MaterialId,'10','E',:CreatorId,:CreateTime)";
$stmt = $connT8->prepare($sql);
$stmt->bindParam(':MaterialId', $facilityno[$index]);
$stmt->bindParam(':MaterialId', $facility_no);
$stmt->bindParam(':CreatorId', $user_id);
$stmt->bindParam(':CreateTime', $createTime);
$stmt->execute();
@ -507,7 +547,7 @@ function T8insert($data, $facilityno)
(MaterialTypeId,MaterialId,MaterialName,MaterialCategoryId,IsInUsed,UnitId,CreatorId,CreateTime)
VALUES ('10',:MaterialId,:MaterialName,'E',1,'SET',:CreatorId,:CreateTime)";
$stmt = $connT8->prepare($sql);
$stmt->bindParam(':MaterialId', $facilityno[$index]);
$stmt->bindParam(':MaterialId', $facility_no);
$stmt->bindParam(':MaterialName', $customer);
$stmt->bindParam(':CreatorId', $user_id);
$stmt->bindParam(':CreateTime', $createTime);
@ -517,7 +557,7 @@ function T8insert($data, $facilityno)
(Orgid,MaterialTypeId,MaterialId,CurrId,SUnitId,TaxId,CreatorId,CreateTime)
VALUES ('1000','10',:MaterialId,'TWD','SET','ST005',:CreatorId,:CreateTime)";
$stmt = $connT8->prepare($sql);
$stmt->bindParam(':MaterialId', $facilityno[$index]);
$stmt->bindParam(':MaterialId', $facility_no);
$stmt->bindParam(':CreatorId', $user_id);
$stmt->bindParam(':CreateTime', $createTime);
$stmt->execute();
@ -533,6 +573,9 @@ function T8insert($data, $facilityno)
//分幾期 => 總共保養月 / 分期月
$SQuantity = $elevator['maintain_months'] / $IncomeId[$payType];
$date_1 = getNext25thDate($contract_begin_date);
// 依每台電梯去加入各個的付款項
for ($i = 0; $i < $IncomeId[$payType]; $i++) {
$row++;
@ -547,14 +590,16 @@ function T8insert($data, $facilityno)
"RowCode" => $row,
"RowNo" => $row,
"ItemType" => 1,
"SPrice" => $elevator['sold_price'],
"SPrice" => intval($elevator['sold_price']),
"SQuantity" => $SQuantity,
"ProjectId" => "$contractno",
"FromSourceTag" => 0,
"CU_MaterialId" => "$facilityno[$index]",
"CU_EstPayDate" => "$payDay"
"CU_MaterialId" => "$facility_no",
"CU_EstPayDate" => intval($payDay)
];
$salIncomeApplyDetail_rows[] = $rows_data;
// echo '<pre>';
// print_r($salIncomeApplyDetail_rows);
// echo '</pre>';
}
}
@ -564,7 +609,7 @@ function T8insert($data, $facilityno)
// $insertime = settype($insertTime, 'integer');
$salIncomeApplyMaster_rows = [
"BillNo" => "$contractno",
"BillDate" => $insertTime,
"BillDate" => intval($insertTime),
"OrgId" => "1000",
"FOrgId" => "1000",
"TypeId" => "RAS",
@ -578,7 +623,10 @@ function T8insert($data, $facilityno)
"DueToId" => "$contractno",
"TaxId" => "ST005",
"CompId" => "1001",
"CreatorId" => "$user_id"
"CreatorId" => "$user_id",
"CreateTime" => intval($insertTime),
"DeptId" => "$depId",
"IsPriceWithTax" => 1
];
$salIncomeApplyMaster = [
@ -593,6 +641,9 @@ function T8insert($data, $facilityno)
$API_body[] = $salIncomeApplyMaster;
$API_body[] = $salIncomeApplyDetail;
// 呼叫 API
// echo '<pre>';
// print_r($API_body);
// echo '</pre>';
$result = T8API($API_body);
if ($result['Status'] == 'Error' || $result['Status'] == 'Fails') {
@ -601,3 +652,102 @@ function T8insert($data, $facilityno)
die('Error!:' . $result['ErrorMsg']);
}
}
function bonusCreate($data, $facilityno, $conn)
{
try {
require_once("../../bonus/other/maintenance_contract_bonus_v2_1.php");
$elevators = !empty($_POST['elevators']) ? json_decode($_POST['elevators'], true) : [];
$contract_begin_date = !empty($data['contract_begin_date']) ? $data['contract_begin_date'] : '';
$salesman = !empty($data['salesman']) ? $data['salesman'] : '';
$payType = !empty($data['payType']) ? $data['payType'] : '';
$status = 1;
$bonus_json = [];
$create_id = $data['user_id'];
$create_at = date('Y-m-d');
$contract_no = !empty($data['contractno']) ? $data['contractno'] : '';
$contract_kind = 3;
$payment = [
'A40006' => 'annually', //年繳
'A40007' => 'quarterly', //季繳
'A40004' => 'bimonthly', // 雙月繳
'A40005' => 'semiannually', // 半年繳
'A40003' => 'monthly' //月繳
];
$payDay = getNext25thDate($contract_begin_date);
foreach ($elevators as $key => $elevator) {
// print_r($payDay);
// echo '<pre>';
// print_r($elevator);
// echo '</pre>';
// exit;
$facility_no = $facilityno[$key];
$ver = $elevator['bonus_verson']; //獎金版本
$contract_type = $elevator['contract_type']; //合約類別
$payment_period = $payment[$payType]; //付款方式
$elevator_list_price = intval($elevator['stand_price']); //牌價
$fee_per_st = $elevator['contract_price']; //作翻契約金額
$commission_fee = $elevator['service_expense']; //服務費(月)
$receivable_date_due = $payDay; //第一筆保養款項收回日
$sales_id = $salesman; //營業人員
$discount = $elevator['discount'];
$region_director_id = $elevator['manager'];
$regular_contract_manger_id = !empty($elevator['regular_contract_manger_id']) ? $elevator['regular_contract_manger_id'] : '';
$results = maintenance_contract_bonus_v2_1($ver, $contract_type, $payment_period, $elevator_list_price, $fee_per_st, $commission_fee, $receivable_date_due, $sales_id, $region_director_id, $regular_contract_manger_id);
$bonus_json = [
'contract_type' => $contract_type,
'total' => $elevator_list_price,
'fee_per_st' => $fee_per_st,
'commission_fee' => $commission_fee,
'paykind' => $payment_period,
'receivable_date_due' => $receivable_date_due,
'discount' => $discount
];
if ($results['result_status'] != 'error') {
foreach ($results['bonus_array'] as $i => $result) {
$bonus_type = $result['bonus_type'];
$pay_day = $result['pay_day_due'];
$amount = $result['bonus_amount'];
$receiver = $result['bonus_receiver'];
$a = json_encode($bonus_json);
$sql = "INSERT INTO bonus
(bonus_type,bonus_verson,contract_no,contract_type,facility_no,amount,receiver,pay_day_due,status,bonus_json,create_id,create_at) VALUES
($bonus_type,'$ver','$contract_no',$contract_kind,'$facility_no',$amount,'$receiver','$pay_day',$status,'$a','$create_id','$create_at')";
$stmt = $conn->prepare($sql);
$stmt->execute();
}
}
}
// exit();
} catch (PDOException $e) {
http_response_code(404);
echo $e->getMessage();
die('Error!:' . $e->getMessage());
}
}
// 計算保養開始日期的當月25號
function getNext25thDate($dateString)
{
// 將傳入的日期字串轉換成 Unix 時間戳記
$timestamp = strtotime($dateString);
// 取得該日期的日期
$day = date('d', $timestamp);
// 如果日期大於 25,則回傳下個月的 25 號日期
if ($day > 25) {
// 增加一個月
$timestamp = strtotime('+1 month', $timestamp);
}
// 設定日期為 25 號
$targetDate = date('Y-m-25', $timestamp);
return $targetDate;
}

194
wms/contract/api/postNewContractData.php

@ -24,6 +24,14 @@ if(isset($_POST["contractno"]) && $_POST["contractno"] != "" && isset($_POST['co
$salesman = $_POST["salesman"];
$qc = $_POST["qc"];
$contracttype = $_POST["contracttype"];
$elevators_nums = $_POST['nums'];
$elevators = json_decode($_POST['elevators'], true);
$elevators_detail_arr = json_decode($_POST['elevators_detail_arr'], true);
BounsCount($_POST, $conn);
// echo '<pre>';
// print_r($elevators);
// echo '</pre>';
// exit;
$files = !empty($_FILES['files']) ? $_FILES['files'] : null;
$files_id = null;
@ -43,8 +51,27 @@ if(isset($_POST["contractno"]) && $_POST["contractno"] != "" && isset($_POST['co
echo json_encode($fail_arr);
exit();
}
//create facility table
$createFacilityNo = new CreateFacilityNo();
$dailyNecessities = [
'MAE100' => 'X',
'MAM200' => 'W',
'MAH100' => 'H',
'MAQ100' => 'Z',
'MAF100' => 'F',
'MAZ100' => 'B',
];
$arr = [];
// 建立作番號
foreach ($elevators_detail_arr as $elevator) {
// $spec = explode('-', $elevator['item_spec']);
$arr[] = $dailyNecessities[$elevator['spec']];
}
$facilityno = $createFacilityNo->makeMFacilityNo('M', $arr, intval($elevators_nums));
echo '<pre>';
print_r($facilityno);
echo '</pre>';
exit();
$conn->beginTransaction();
$sql_str = "SELECT accountid, name FROM account WHERE accountid = :accountid ORDER BY create_at DESC";
@ -71,7 +98,9 @@ if(isset($_POST["contractno"]) && $_POST["contractno"] != "" && isset($_POST['co
$max_size = 4096 * 4096; //設定允許上傳檔案容量的最大值(1M)
$allow_ext = array('jpeg', 'jpg', 'png', 'JPG', 'JPEG', 'PNG', 'GIF'); //設定允許上傳檔案的類型
$path = '../images/contracts/';
if (!file_exists($path)) { mkdir($path); }
if (!file_exists($path)) {
mkdir($path);
}
$msg_result = ''; //負責接收所有檔案檢測後的回傳訊息
$datetime = (string)date('YmdHis');
$files_id = 'm' . $datetime; // 保養=>b + 日期時間
@ -130,10 +159,167 @@ if(isset($_POST["contractno"]) && $_POST["contractno"] != "" && isset($_POST['co
if ($result) {
header("HTTP/1.1 201 Created");
}
} catch (PDOException $e) {
$conn->rollback();
header("HTTP/1.1 500 Internal Server Error");
die('Error!:' . $e->getMessage());
}
}
function T8Insert($data)
{
require_once("../connt8.php");
$contractno = $data['contractno'];
$partyA = $data['customer'];
$phone = $data['lm_tel'];
$vat = $data['vat'];
$partyAaddress = $data['address'];
$user_id = $data['user_id'];
$salesman = $data['salesman'];
$createAt = date("Y-m-dH-i-s");
$elevators[] = $data['elevators'];
$createTime = str_replace('-', '', $createAt);
$connT8->beginTransaction();
$sql = "SELECT * FROM comCustomer WHERE BizPartnerId = :BizPartnerId";
$stmt = $conn->prepare($sql);
$stmt->bindParam(':BizPartnerId', $contractno);
$stmt->execute();
$result = $stmt->fetch(PDO::FETCH_ASSOC);
// 新增客戶 table
if (empty($result)) {
// 若 客戶資料為空,新增一筆到 comCustomer
// 新增客戶資料
$sql = "INSERT INTO comBusinessPartner
(BizPartnerId,BizPartnerName,BusinessAttr,CountryId,WorkTelNo,BizToDate,TaxNo,EnterpriseName,ContactAddress,EMail,CreatorId,CreateTime,BizPartnerTypeId)
VALUES(:BizPartnerId,:BizPartnerName,1,'TW',:WorkTelNo,99999999,:TaxNo,:EnterpriseName,:ContactAddress,:EMail,:CreatorId,:CreateTime,'10')";
$stmt = $connT8->prepare($sql);
$stmt->bindParam(':BizPartnerId', $contractno);
$stmt->bindParam(':BizPartnerName', $partyA); //客戶名稱
$stmt->bindParam(':WorkTelNo', $phone);
$stmt->bindParam(':TaxNo', $vat);
// $stmt->bindParam(':EnterpriseName', $customer); //企業名稱
$stmt->bindParam(':ContactAddress', $partyAaddress);
$stmt->bindParam(':EMail', $email);
$stmt->bindParam(':CreatorId', $user_id);
$stmt->bindParam(':CreateTime', $createTime);
$stmt->execute();
$sql = "INSERT INTO comCustomer
(OrgId,BizPartnerTypeId,CurrId,BizPartnerId,PersonId,CreatorId,IsInUsed,InvoiceAddress,CreateTime,InvoiceId)
VALUES('1000','10','TWD',:BizPartnerId,:PersonId,:CreatorId,1,:InvoiceAddress,:CreateTime,'35')";
$stmt = $connT8->prepare($sql);
$stmt->bindParam(':BizPartnerId', $contractno);
$stmt->bindParam(':PersonId', $salesman);
$stmt->bindParam(':CreatorId', $user_id);
$stmt->bindParam(':InvoiceAddress', $address);
$stmt->bindParam(':CreateTime', $createTime);
$stmt->execute();
} else {
// // 若客戶資料不為空,更新該客戶資訊。
$sql = "UPDATE comCustomer SET
PersonId=:PersonId,
InvoiceAddress=:InvoiceAddress,
LastOperatorId=:LastOperatorId,
LastOperateTime=:LastOperateTime
WHERE BizPartnerId=:BizPartnerId
";
$stmt = $connT8->prepare($sql);
$stmt->bindParam(':PersonId', $salesman);
$stmt->bindParam(':InvoiceAddress', $address);
$stmt->bindParam(':LastOperatorId', $user_id);
$stmt->bindParam(':LastOperateTime', $createTime);
$stmt->bindParam(':BizPartnerId', $contractno);
$stmt->execute();
$sql = "UPDATE comBusinessPartner SET
BizPartnerName=:BizPartnerName,
WorkTelNo=:WorkTelNo,
TaxNo=:TaxNo,
EnterpriseName=:EnterpriseName,
ContactAddress=:ContactAddress,
EMail=:EMail,
LastOperatorId=:LastOperatorId,
LastOperateTime=:LastOperateTime
WHERE BizPartnerId = :BizPartnerId
";
$stmt = $connT8->prepare($sql);
$stmt->bindParam(':BizPartnerName', $partyA);
$stmt->bindParam(':WorkTelNo', $phone);
$stmt->bindParam(':TaxNo', $vat);
$stmt->bindParam(':EnterpriseName', $customer);
$stmt->bindParam(':ContactAddress', $partyAaddress);
$stmt->bindParam(':EMail', $email);
$stmt->bindParam(':LastOperatorId', $user_id);
$stmt->bindParam(':LastOperateTime', $createTime);
$stmt->bindParam(':BizPartnerId', $contractno);
$stmt->execute();
}
$sql = "SELECT * FROM comProject WHERE ProjectId = :ProjectId";
$stmt = $connT8->prepare($sql);
$stmt->bindParam(':ProjectId', $contractno);
$stmt->execute();
$resultProject = $stmt->fetchAll(PDO::FETCH_ASSOC);
if (empty($resultProject)) {
//新增於 comProject。合約 table
$sql = "INSERT INTO comProject(ProjectId,ProjectName,TypeId,CreateTime,CreatorId,IsInUsed)
VALUES(:ProjectId,:ProjectName,'C0',:CreateTime,:CreatorId,1)";
$stmt = $connT8->prepare($sql);
$stmt->bindParam(':ProjectId', $contractno);
$stmt->bindParam(':ProjectName', $customer);
$stmt->bindParam(':CreateTime', $createTime);
$stmt->bindParam(':CreatorId', $user_id);
$stmt->execute();
}
}
function BounsCount($data, $conn)
{
// echo '<pre>';
// print_r($data);
// echo '</pre>';
// exit;
require_once("../../bonus/elevator_new/elevator_new_deal_bonus.php");
$signing_date = $data['signing_date'];
$bonus_v1_0_date = '2024-01-02';
$bonus_v2_0_date = '2024-01-03';
$contractType = [
'1' => 'strategy_customer',
'2' => 'general_customer'
];
$contract_type = $data['contract_type'];
$type = $contractType[$contract_type]; //戰略客戶 or 一般客戶
$elevator_knockdown_price = $data['price_total']; //受價總額
$salesman = $data['salesman'];
$manager = $data['manager'];
$result_bonus = [];
if ($signing_date <= $bonus_v1_0_date) {
$ver = '1.0';
$result_bonus = elevator_new_deal_bonus_v1_0($ver, $type, $elevator_knockdown_price, $salesman, $manager);
} else if ($signing_date >= $bonus_v2_0_date) {
$ver = '2.0';
// $result_bonus = elevator_new_deal_bonus_v2_0($ver,$contract_type,);
}
echo '<pre>';
print_r($result_bonus);
echo '</pre>';
exit();
try {
} catch (PDOException $e) {
header("HTTP/1.1 500 Internal Server Error");
die('Error!:' . $e->getMessage());
}
}

53
wms/contract/api/testT8API.php

@ -1,21 +1,36 @@
<?php
$date = Date('Y-m-d');
$date1 = Date('Y-m-d', strtotime("$date +1 months"));
// $paymonth = $i * $SQuantity;
// $countDay = date('Y-m-d', strtotime("$date + $paymonth months"));
// $payDay = str_replace('-', '', $countDay);
// $countDay = date('Ymd', strtotime("$date1 + 1 months"));
// echo '<pre>';
// print_r($countDay);
// echo '</pre>';
// exit();
$SQuantity = 2;
// $b = 24 / $a;
for ($i = 0; $i < 12; $i++) {
$paymonth = $i * $SQuantity;
$countDay = date('Y-m-d', strtotime("$date + $paymonth months"));
$payDay = str_replace('-', '', $countDay);
echo '<pre>';
print_r($payDay);
echo '</pre>';
?>
<head>
<title>地址轉經緯度</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
</head>
<body>
<h1>輸入地址以獲取經緯度</h1>
<form id="addressForm" method="post">
<input type="text" id="addressInput" name="address" placeholder="輸入地址">
<button type="submit">查詢</button>
</form>
<div id="map"></div>
<script>
// 使用AJAX提交表單
$(document).ready(function() {
$("#addressForm").submit(function(event) {
event.preventDefault();
var address = $("#addressInput").val();
$.ajax({
url: "get_lat_lng.php",
type: "POST",
data: {
address: address
},
success: function(data) {
$("#map").html(data);
}
});
});
});
</script>
</body>

2
wms/contract/conn.php

@ -34,7 +34,7 @@ try {
//設定主動以警告的形式報錯
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$connT8 = new PDO("sqlsrv:Server=220.130.203.251;Database=T8masada", "M0225", "IFFBU1E=");
$connT8 = new PDO("sqlsrv:Server=220.130.203.251;Database=T8TEST", "M0225", "IFFBU1E=");
if ($connT8) {
$connT8->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}

106
wms/contract/contract-input.php

@ -136,7 +136,7 @@ $contractpersons = $stmt->fetchAll(PDO::FETCH_ASSOC);
</select>
<p class="alerttext" x-show="data.mworker==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td>
<td style="vertical-align: middle">保養頻率</td>
<!-- <td style="vertical-align: middle">保養頻率</td>
<td>
<select class="ui search dropdown" name="repairer_name" x-model="data.mcycle">
<option value="">選擇保養頻率</option>
@ -144,6 +144,18 @@ $contractpersons = $stmt->fetchAll(PDO::FETCH_ASSOC);
<option value="em">月保</option>
</select>
<p class="alerttext" x-show="data.mcycle==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td> -->
<td style="vertical-align: middle">分期方式</td>
<td>
<select class="ui search dropdown" x-model="data.payType">
<option value="">選擇付款方式</option>
<option value="A40006">年繳</option>
<option value="A40007">季繳</option>
<option value="A40003">月繳</option>
<option value="A40004">雙月繳</option>
<option value="A40005">半年繳</option>
</select>
<p class="alerttext" x-show="data.payType==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td>
</tr>
<tr>
@ -184,21 +196,13 @@ $contractpersons = $stmt->fetchAll(PDO::FETCH_ASSOC);
<input type="text" x-model="data.address" />
<p class="alerttext" x-show="data.address==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td>
<td style="vertical-align: middle">分期方式</td>
<td style="vertical-align: middle">附件</td>
<td colspan="2">
<select class="ui search dropdown" x-model="data.payType">
<option value="">選擇付款方式</option>
<option value="A40006">年繳</option>
<option value="A40007">季繳</option>
<option value="A40003">月繳</option>
<option value="A40004">雙月繳</option>
<option value="A40005">半年繳</option>
</select>
<p class="alerttext" x-show="data.payType==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
<input type="file" name="file[]" multiple draggable="true" @change="uploadFiles($event)" />
</td>
</tr>
<tr>
<!-- <tr>
<td></td>
<td></td>
<td></td>
@ -208,7 +212,7 @@ $contractpersons = $stmt->fetchAll(PDO::FETCH_ASSOC);
<td colspan="2">
<input type="file" name="file[]" multiple draggable="true" @change="uploadFiles($event)" />
</td>
</tr>
</tr> -->
</tbody>
</template>
<template x-if="step==3">
@ -307,19 +311,28 @@ $contractpersons = $stmt->fetchAll(PDO::FETCH_ASSOC);
</select>
<p class="alerttext" x-show="data.elevators[idx].maintainance=='' || !data.elevators[idx].maintainance"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td>
<td style="vertical-align: middle">竣檢日</td>
<td style="vertical-align: middle">竣檢日(民國年分)</td>
<td>
<input class="form-control disabled_select" type="date" x-model="data.elevators[idx].takecertificatedate">
<input class="form-control disabled_select" type="text" x-model="data.elevators[idx].takecertificatedate">
<p class="alerttext" x-show="data.elevators[idx].takecertificatedate=='' || !data.elevators[idx].takecertificatedate"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td>
</tr>
<tr>
<td style="vertical-align: middle">許可證有效時間</td>
<td style="vertical-align: middle">許可證有效日期<br>(民國年-月-日。Ex.113-01-01)</td>
<td>
<input class="form-control disabled_select" type="date" x-model="data.elevators[idx].useful_date">
<input class="form-control disabled_select" type="text" x-model="data.elevators[idx].useful_date">
<p class="alerttext" x-show="data.elevators[idx].useful_date=='' || !data.elevators[idx].useful_date"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td>
<td style="vertical-align: middle">保養頻率</td>
<td>
<select class="ui search dropdown" name="repairer_name" x-model="data.elevators[idx].maintain_times">
<option value="">選擇保養頻率</option>
<option value="2">雙週保</option>
<option value="1">月保</option>
</select>
<p class="alerttext" x-show="data.maintain_times==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td>
</tr>
<tr>
<td></td>
@ -334,10 +347,65 @@ $contractpersons = $stmt->fetchAll(PDO::FETCH_ASSOC);
</tbody>
</template>
</template>
<template x-if="step==4">
<template x-for="(elevator, idx) in data.elevators" :key="elevator.apply_key + elevator.register_code">
<tbody style="font-weight: bolder;margin-bottom: 20px" x-show="step==4">
<tr>
<td colspan=8>
<p x-text="'獎金計算 : 電梯' + Number(idx+1)"></p>
</td>
</tr>
<tr>
<td style="vertical-align:middle">契約人員</td>
<td><input type="text" x-model="data.salesman"></td>
<td style="vertical-align:middle">保養月份</td>
<td>
<input type="text" x-model="elevator.maintain_months">
</td>
<td style="vertical-align:middle">合約類別</td>
<td>
<select name="" id="" x-model="elevator.contract_type">
<option value="">請選擇</option>
<option value="new">新簽約</option>
<option value="free_to_charge">免保轉有費</option>
<option value="renew_priceissue">續簽約</option>
</select>
</td>
<td style="vertical-align:middle">獎金適用版本</td>
<td>
<input type="text" x-model="elevator.bonus_verson" disabled="disabled">
</td>
</tr>
<tr>
<td style="vertical-align:middle">作番契約金額(月)</td>
<td><input type="text" x-model="elevator.sold_price" disabled></td>
<td style="vertical-align:middle">牌價(標準價)</td>
<td>
<input type="text" x-model="elevator.stand_price" disabled>
<p>標準價+Option價格+與其他電梯共同分擔的費用貨價格</p>
</td>
<td style="vertical-align:middle">服務費</td>
<td>
<input type="text" x-model="elevator.service_expense" disabled>
</td>
<td style="vertical-align:middle">折扣率(%)</td>
<td><input type="text" x-model='elevator.discount' disabled></td>
</tr>
<tr>
<td style="vertical-align:middle">地區處長員工號</td>
<td><input type="text" x-model="elevator.manager" disabled></td>
<td style="vertical-align:middle">專任契約經理員工號</td>
<td><input type="text" x-model="elevator.regular_contract_manger_id"></td>
</tr>
</tbody>
</template>
</template>
</table>
<button x-show="step==3" @click="save()" :disabled="isLoading" type="button" class="btn btn-primary btn-lg pull-right savebtn">
<button x-show=" step==4" @click="save()" :disabled="isLoading" type="button" class="btn btn-primary btn-lg pull-right savebtn">
<template x-if="!isLoading">
<span>存檔</span>
</template>
@ -345,7 +413,7 @@ $contractpersons = $stmt->fetchAll(PDO::FETCH_ASSOC);
<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">
<button x-show="step<=3" @click="nextStepFn()" type="button" class="btn btn-primary btn-lg pull-right savebtn" :disabled="isLoading">
<template x-if="!isLoading">
<span>下一步</span>
</template>

10
wms/contract/contract-new-apply.php

@ -495,7 +495,7 @@ $para = "function_name=pricereview&" . $token_link;
<td>結果</td>
<td colspan=2>意見</td>
<td>時間</td>
<td colspan=2><?php if (($user_id === "M0174" || $user_id === "M0107" || $user_id === "M0060" || $user_id == "TEST02" || $user_id == "TEST03") && $status == 1) : ?>審核意見<?php endif; ?></td>
<td colspan=2><?php if (($user_id === "M0174" || $user_id === "M0175" || $user_id === "M0060" || $user_id == "TEST02" || $user_id == "TEST03") && $status == 1) : ?>審核意見<?php endif; ?></td>
</tr>
<tr>
<td>營業員</td>
@ -508,7 +508,7 @@ $para = "function_name=pricereview&" . $token_link;
<td colspan=2>---</td>
<td><?php echo ($contract['submit_date']) ?? "---"; ?> </td>
<td colspan=2 rowspan="3">
<?php if (($user_id === "M0174" || $user_id === "M0107" || $user_id === "M0060" || $user_id == "TEST02" || $user_id == "TEST03") && $status == 1) : ?>
<?php if (($user_id === "M0174" || $user_id === "M0175" || $user_id === "M0060" || $user_id == "TEST02" || $user_id == "TEST03") && $status == 1) : ?>
<textarea class="form-control opinion" x-model="data.review_comment"></textarea>
<?php endif; ?>
</td>
@ -572,14 +572,14 @@ $para = "function_name=pricereview&" . $token_link;
</template>
</button>
<?php endif; ?>
<?php if ($status == 1 && ((($user_id == "M0107" || $user_id == "TEST02") && $contract['progress'] <= 1) || (($user_id == "M0060" || $user_id == "TEST03") && $contract['progress'] == 2) || $user_id == "M0174")) : ?>
<?php if ($status == 1 && ((($user_id == "M0175" || $user_id == "TEST02") && $contract['progress'] <= 1) || (($user_id == "M0060" || $user_id == "TEST03") && $contract['progress'] == 2) || $user_id == "M0174")) : ?>
<button x-show="true" x-on:click="agree()" :disabled="isLoading" type="button" class="btn btn-primary btn-lg pull-right savebtn">
<template x-if="!isLoading">
<span>
<?php
if (($user_id === "M0107" || $user_id == "TEST02") && $contract['progress'] <= 1) {
if (($user_id === "M0175" || $user_id == "TEST02") && $contract['progress'] <= 1) {
echo "同意(上呈)";
// } elseif (($user_id === "M0060" || $user_id == "TEST03") && $contract['progress'] == 2) {
} elseif (($user_id === "M0060" || $user_id == "TEST03") && $contract['progress'] == 2) {
echo "同意(結案)";
}
?>

169
wms/contract/contract-newelevator-input.php

@ -2,14 +2,14 @@
include_once("../header.php");
require_once("./conn.php");
$accounttype = "M";
$sql_str = "SELECT accountid, name FROM account WHERE accounttype = :accounttype";
$sql_str = "SELECT accountid, name FROM account WHERE accounttype = :accounttype ORDER BY accountid";
$stmt = $conn->prepare($sql_str);
$stmt->bindParam(":accounttype", $accounttype);
$stmt->execute();
$persons = $stmt->fetchAll(PDO::FETCH_ASSOC);
$persons = array_map(function ($person) {
return [
'view'=>$person['accountid'] .'-'. $person['name'],
'view' => $person['name'] . '-' . $person['accountid'],
'value' => $person['accountid'],
'name' => $person['name']
];
@ -62,17 +62,22 @@ $persons = array_map(function($person){
<tr>
<td style="vertical-align: middle">客戶名稱</td>
<td>
<input class="form-control disabled_select" type="text" name="uscc" x-model="data.customer" >
<input class="form-control disabled_select" type="text" name="" x-model="data.customer">
<p class="alerttext" x-show="data.customer==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td>
<td style="vertical-align: middle">負責人</td>
<td>
<input class="form-control disabled_select" type="text" name="uscc" x-model="data.manager" >
<select class="manager" id="manager" x-model="data.manager">
<option value="">請選擇營業員</option>
<?php foreach ($persons as $person) : ?>
<option value="<?php echo $person['value']; ?>"><?php echo $person['view']; ?></option>
<?php endforeach ?>
</select>
<p class="alerttext" x-show="data.manager==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td>
<td style="vertical-align: middle">統一編號/身分證</td>
<td>
<input class="form-control disabled_select" type="text" name="uscc" x-model="data.vat" >
<input class="form-control disabled_select" type="text" name="" x-model="data.vat">
<p class="alerttext" x-show="data.vat==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td>
<td style="vertical-align: middle">營業員</td>
@ -88,17 +93,98 @@ $persons = array_map(function($person){
<p class="alerttext" x-show="data.salesman==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td>
</tr>
<tr>
<tr>\
<td style="vertical-align:middle">電梯數量</td>
<td>
<input type="text" class="form-control disabled_select" name="num" x-model="data.nums" disabled>
</td>
<td style="vertical-align: middle">聯繫人</td>
<td>
<input class="form-control disabled_select" type="text" name="uscc" x-model="data.linkman" >
<input class="form-control disabled_select" type="text" name="" x-model="data.linkman">
<p class="alerttext" x-show="data.linkman==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td>
<td style="vertical-align: middle">聯繫人電話</td>
<td>
<input class="form-control disabled_select" type="text" name="uscc" x-model="data.lm_tel" >
<input class="form-control disabled_select" type="text" name="" x-model="data.lm_tel">
<p class="alerttext" x-show="data.lm_tel==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td>
<td style="vertical-align: middle">案件名稱</td>
<td>
<input class="form-control disabled_select" type="text" name="" x-model="data.case_name">
<p class="alerttext" x-show="data.case_name==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td>
</tr>
<tr>
<td style="vertical-align: middle">合約簽訂日期</td>
<td>
<input class="form-control disabled_select" type="date" name="" x-model="data.signing_date">
<p class="alerttext" x-show="data.signing_date==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td>
<td style="vertical-align: middle">客戶類型</td>
<td>
<select name="contract_type" id="contract_type" x-model="data.contract_type">
<option value="">請選擇</option>
<option value="1">戰略客戶</option>
<option value="2">一般客戶</option>
</select>
</td>
<td style="vertical-align: middle">附件上傳</td>
<td colspan="3">
<input type="file" name="file[]" multiple draggable="true" @change="uploadFiles($event)" />
</td>
</tr>
<tr>
</tr>
</tbody>
</template>
<template x-if="step == 3">
<template x-for="(elevator, idx) in data.elevators_detail_arr" :key="idx">
<tbody style="font-weight: bolder;margin-bottom: 20px" x-show="step==3">
<tr>
<td colspan=8>
<p x-text="'電梯' + Number(idx+1)"></p>
</td>
</tr>
<tr>
<td style="vertical-align: middle">電梯型號</td>
<td>
<input class="form-control disabled_select" type="text" x-model="elevator.spec" disabled>
</td>
<td style="vertical-align: middle">開門方式</td>
<td>
<input class="form-control disabled_select" type="text" x-model="elevator.item_op" disabled>
</td>
<td style="vertical-align: middle">電梯載重</td>
<td>
<input class="form-control disabled_select" type="text" x-model="elevator.item_weight" disabled>
</td>
<td style="vertical-align: middle">電梯人乘</td>
<td>
<input class="form-control disabled_select" type="text" x-model="elevator.person" disabled>
</td>
</tr>
<tr>
<td style="vertical-align: middle">電梯速度</td>
<td>
<input class="form-control disabled_select" type="text" x-model="elevator.person" disabled>
</td>
<td style="vertical-align: middle">電梯樓停</td>
<td>
<input class="form-control disabled_select" type="text" x-model="elevator.floor" disabled>
</td>
<td style="vertical-align: middle">電梯樓層</td>
<td>
<input class="form-control disabled_select" type="text" x-model="elevator.floor">
</td>
<td style="vertical-align: middle">合約交期(到工地)</td>
<td>
<input class="form-control disabled_select" type="date" x-model="elevator.contract_arrival_date">
</td>
</tr>
<tr>
<td style="vertical-align: middle">QC和官檢</td>
<td>
<select class="" id="qc" x-model="data.qc">
@ -109,28 +195,69 @@ $persons = array_map(function($person){
</select>
<p class="alerttext" x-show="data.qc==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td>
<td style="vertical-align: middle">案件名稱</td>
<td style="vertical-align: middle">工地負責人</td>
<td>
<input class="form-control disabled_select" type="text" name="uscc" x-model="data.case_name" >
<p class="alerttext" x-show="data.case_name==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
<input class="form-control disabled_select" type="text" x-model="elevator.manage">
</td>
<td style="vertical-align: middle">工務部門負責人</td>
<td style="vertical-align: middle">
<select class="form-control " id="warehouseid" name="warehouseid" x-model="elevator.warehouseid">
<option value="">未選擇</option>
<optgroup label="北區">
<option value="M0041">張潘榮(桃竹以北)</option>
<option value="M0150">羅盛騰(桃竹)</option>
<option value="M0040">吳宗紘</option>
</optgroup>
<optgroup label="中區">
<option value="M0198">廖堉勝</option>
<option value="M0158">劉子睿(新梯)</option>
<option value="M0161">鄭永典(汰改)</option>
<option value="M0159">孫仲凱</option>
<option value="M0202">徐錦潤</option>
<option value="M0113">林瑋隆</option>
</optgroup>
<optgroup label="南區">
<option value="M0078">許益連</option>
<option value="M0102">鄭存邑(高屏、台東)</option>
<option value="M0187">田祖豪(台南、嘉義)</option>
<option value="M0077">鍾玉龍</option>
</optgroup>
<optgroup label="宜蘭">
<option value="M0087">高培軒</option>
</optgroup>
</select>
</td>
<td></td>
<td></td>
</tr>
<tr>
<td style="vertical-align: middle">地址</td>
<td colspan=3>
<input class="form-control disabled_select" type="text" name="uscc" x-model="data.address" >
<p class="alerttext" x-show="data.address==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td>
<td style="vertical-align: middle">附件上傳</td>
<td style="vertical-align: middle">現場地址</td>
<td colspan="3">
<input type="file" name="file[]" multiple draggable="true" @change="uploadFiles($event)" />
<input class="form-control disabled_select" type="text" x-model="data.address">
</td>
<td style="vertical-align: middle">經度</td>
<td>
<input class="form-control disabled_select" type="text" x-model="elevator.latitude">
</td>
<td style="vertical-align: middle">緯度</td>
<td>
<input class="form-control disabled_select" type="text" x-model="elevator.longitude">
</td>
</tr>
<tr>
<td></td>
</tr>
</tbody>
</template>
</template>
<template x-if="step == 4">
<template>
</template>
</template>
</table>
<button x-show="step==2" x-on:click="save()" :disabled="isLoading" type="button" class="btn btn-primary btn-lg pull-right savebtn">
<button x-show="step==3" x-on:click="save()" :disabled="isLoading" type="button" class="btn btn-primary btn-lg pull-right savebtn">
<template x-if="!isLoading">
<span>存檔</span>
</template>
@ -138,7 +265,7 @@ $persons = array_map(function($person){
<div class="loader"></div>
</template>
</button>
<button x-show="step<=1" x-on:click="nextStepFn()" type="button" class="btn btn-primary btn-lg pull-right savebtn" :disabled="isLoading">
<button x-show="step<=3" x-on:click="nextStepFn()" type="button" class="btn btn-primary btn-lg pull-right savebtn" :disabled="isLoading">
<template x-if="!isLoading">
<span>下一步</span>
</template>

101
wms/contract/js/alpine.js

@ -810,7 +810,7 @@ const contractNewInput = () => {
return {
init() { },
data: {
contractno: '',
contractno: 'M23110004',
customer: '',
manager: '',
vat: '',
@ -821,7 +821,13 @@ const contractNewInput = () => {
salesman: '',
qc: '',
qc: '',
price_total: '', //合約總價
files: [],
contract_type: '1',
signing_date: '', //合約簽訂日期
elevators: [], // 電梯種類 Array
elevators_detail_arr: [], // 電梯台數 Array
nums: '', //電梯數量
},
step: 1,
isLoading: false,
@ -831,6 +837,10 @@ const contractNewInput = () => {
this.isLoading = true
if (this.step == 1) {
this.getContractDate();
} else if (this.step == 2) {
this.getElevatorsData();
} else if (this.step == 3) {
this.getElevatorsData();
}
},
nextStepKeyupFn(e) {
@ -843,10 +853,34 @@ const contractNewInput = () => {
preStepFn() {
if (this.step == 2) {
this.step = 1
} else if (this.step == 3) {
this.step = 2
}
},
getElevatorsData() {
if (this.step == 2) {
for (let i = 0; i < this.data.nums; i++) {
// console.log(this.data.elevators_detail_arr[i]);
this.data.elevators_detail_arr[i].warehouseid = ''; // 公務部門負責人
this.data.elevators_detail_arr[i].latitude = ''; // 經度
this.data.elevators_detail_arr[i].longitude = ''; // 緯度
this.data.elevators_detail_arr[i].manage = ''; // 工地負責人
this.data.elevators_detail_arr[i].qc = ''; // QC和官檢
this.data.elevators_detail_arr[i].contract_arrival_date = ''; //合約交期(到工地)
}
this.step = 3;
this.isLoading = false;
} else if (this.step == 3) {
console.log(this.data.elevators_detail_arr);
this.step = 4;
this.isLoading = false;
}
},
getContractDate() {
axios.get('./api/getContractData.php?contracttype=m&contractno=' + this.data.contractno).then(res => {
console.log(res);
if (!res.data) {
this.step = 2
this.isLoading = false
@ -854,15 +888,19 @@ const contractNewInput = () => {
}
if (!this.customize) {
console.log(res.data);
this.data.customer = res.data.customer
this.data.customer = res.data.company
this.data.manager = res.data.manager
this.data.vat = res.data.uscc
this.data.case_name = res.data.case_name
this.data.linkman = res.data.linkman
this.data.lm_tel = res.data.lm_tel
this.data.address = res.data.address
this.data.salesman = res.data.salesman
this.data.qc = res.data.qc
this.data.salesman = res.data.person
this.data.qc = res.data.qc;
this.data.price_total = res.data.price_total;
this.data.elevators = res.data.elevators;
this.data.elevators_detail_arr = res.data.elevators_detail_arr;
this.data.nums = res.data.nums;
}
this.step = 2
this.isLoading = false
@ -884,6 +922,12 @@ const contractNewInput = () => {
form.append('address', this.data.address);
form.append('salesman', this.data.salesman);
form.append('qc', this.data.qc);
form.append('signing_date', this.data.signing_date);
form.append('nums', this.data.nums);
form.append('price_total', this.data.price_total);
form.append('contract_type', this.data.contract_type);
form.append('elevators_detail_arr', JSON.stringify(this.data.elevators_detail_arr));
form.append('elevators', JSON.stringify(this.data.elevators));
form.append('contracttype', 'm');
form.append('user_id', user_id);
for (var i = 0; i < this.data.files.length; i++) {
@ -971,7 +1015,11 @@ const contractInput = () => {
num: '', //電梯數量
disabled: false, //資料庫是否有電梯數量資料
elevators: [], //機種、載重、人乘、樓停、樓層、速度、緯度、經度、開門方式、保養別、廠牌、竣檢日、許可證日期
payType: '' //付款方式
payType: '', //付款方式
// bonus_verson: 2.1,
// manager: '',
// regular_contract_manger_id: '',
// bonus: [],
},
customize: false,
step: 1,
@ -988,6 +1036,26 @@ const contractInput = () => {
this.createElevator();
}
this.step = 3
} else if (this.step == 3) {
this.getManager();
this.step = 4;
// console.log(this.step);
}
},
getBonusVerson(data) {
// 目前獎金版本為 2.1,若之後要依辦法建立時間來判斷在這邊修改
data.bonus_verson = 2.1;
},
getManager() {
for (let i = 0; i < this.data.elevators.length; i++) {
this.getBonusVerson(this.data.elevators[i]);
axios.get('./api/getContractData.php?contracttype=accountManger&salesman=' + this.data.salesman).then(res => {
this.data.elevators[i].manager = res.data.manager;
console.log(this.data.elevators[i]);
}).catch(err => {
})
}
},
nextStepKeyupFn(e) {
@ -1017,6 +1085,12 @@ const contractInput = () => {
maintainance: '', //保養別
takecertificatedate: '', //竣檢日
useful_date: '', //許可證有效日期
maintain_times: '', //保養頻率
discount: '', //折價率
contract_type: '',
manager: '',
regular_contract_manger_id: '',
bonus_verson: ''
})
}
},
@ -1028,9 +1102,15 @@ const contractInput = () => {
return
}
if (!this.customize) {
this.data.elevators = res.data.elevators;
for (let i = 0; i < res.data.elevators.length; i++) {
// 合約總價格。
this.data.total_price = Number(res.data.elevators[i].sold_price) + Number(this.data.total_price);
console.log(this.data.total_price);
// 服務費 (以單筆合約記,但計算獎金須傳入單月服務費)
this.data.elevators[i].service_expense = Math.round(this.data.elevators[i].service_expense / 12);
// 折扣率
this.data.elevators[i].discount = Math.round(((res.data.elevators[i].sold_price / res.data.elevators[i].stand_price) + this.data.elevators[i].service_expense) * 100);
}
this.data.total_price = Number(res.data.elevators[0].maintain_months) * this.data.total_price;
this.data.salesman = res.data.salesman
@ -1040,9 +1120,10 @@ const contractInput = () => {
this.data.customer = res.data.customer
this.data.partyA = res.data.customer
this.data.partyAaddress = res.data.address
this.data.num = res.data.num
this.data.num = res.data.num;
this.data.payType = res.data.payment_kind
this.data.disabled = (res.data.num > 0) ? true : false;
this.data.elevators = res.data.elevators
let cityIndex = this.data.address.indexOf('市');
// console.log(cityIndex);
if (cityIndex == -1) {
@ -1094,6 +1175,8 @@ const contractInput = () => {
}
} else if (this.step == 3) {
this.step = 2
} else if (this.step == 4) {
this.step = 3
}
},
save() {
@ -1106,7 +1189,7 @@ const contractInput = () => {
form.append('phone', this.data.phone);
form.append('email', this.data.email);
form.append('mworker', this.data.mworker);
form.append('mcycle', this.data.mcycle);
// form.append('mcycle', this.data.mcycle);
form.append('salesman', this.data.salesman);
form.append('contract_begin_date', this.data.contract_begin_date);
form.append('contract_end_date', this.data.contract_end_date);

309
wms/contract_b-index.php

@ -0,0 +1,309 @@
<?php
include "header.php";
include "css/view/wipwhole-index.php";
// 設置一個空陣列來放資料
$data = array();
$contractno = empty($_POST['contractno']) ? null : $_POST['contractno'];
$department_id = accountidToDepartId($user_id);
if (in_array(accountidToDepartId($user_id), ['220'])) {
$sql_cmd = " WHERE 1=1 ";
} else {
$sql_cmd = sql_myself($user_id, "cgp.PersonId");
}
// 合約主檔
$sql = "
SELECT
siam.BillNo, -- 單據號
siad_tmp.ProjectId,-- 合約號
siam.BillDate, -- 合約日期
BizPartnerName, -- 客戶名稱
cp.PersonId, -- 業務人員
cgp.PersonName, -- 業務人員名稱
cd.DeptName, -- 業務人員部門
siam.UnTransAmount, -- 合約金額
siad_tmp2.Max_CU_EstPayDate -- 最後收款日期
FROM salIncomeApplyMaster AS siam
LEFT JOIN (
SELECT
cc.BizPartnerId,
cbp.BizPartnerName
FROM comCustomer AS cc
LEFT JOIN comBusinessPartner AS cbp
ON cc.BizPartnerId = cbp.BizPartnerId
)cb_tmp
ON cb_tmp.BizPartnerId = siam.BizPartnerId
LEFT JOIN comPerson AS cp -- 員工主檔
ON siam.PersonId = cp.PersonId
LEFT JOIN comGroupPerson AS cgp -- 員工明細檔
ON cp.PersonId = cgp.PersonId
LEFT JOIN comDepartment AS cd -- 部門主檔
ON cp.DeptId = cd.DeptId
LEFT JOIN
(
SELECT DISTINCT
siad.BillNo,
siad.ProjectId
FROM salIncomeApplyDetail AS siad
WHERE siad.ProjectId != ''
AND siad.ProjectId IS NOT NULL
)AS siad_tmp -- 合約明細
ON siam.BillNo = siad_tmp.BillNo
LEFT JOIN
(
SELECT
siad.BillNo,
MAX(siad.CU_EstPayDate) as Max_CU_EstPayDate
FROM salIncomeApplyDetail AS siad
GROUP BY siad.BillNo
)AS siad_tmp2 -- 合約明細2
ON siam.BillNo = siad_tmp2.BillNo
$sql_cmd
AND siam.CurrentState = '2'
";
if (!empty($contractno)) {
$sql .= " AND siad_tmp.ProjectId = '$contractno' ";
}
// echo "<pre>";
// echo $sql;
// echo "</pre>";
// exit;
$data = $conn->query($sql);
if ($data) :
?>
<style>
table {
table-layout: fixed;
width: 100%;
}
td {
word-wrap: break-word;
}
img {
width: 125px;
}
.width_style_1 {
width: 125px;
}
table {
width: 100%;
}
#table_index_filter {
float: right;
}
#table_index_paginate {
float: right;
}
label {
display: inline-flex;
margin-bottom: .5rem;
margin-top: .5rem;
}
</style>
<div id="myModal" class="modal">
<div class="back"></div>
<div class="modal-content">
<button type="button" class="close" id="myCloseBtn">X</button>
<div class='col-12' style='text-align:center'>
<div class='row'>
<div class='col-12'>
<table id="table_detail" class="table table-bordered" style="width:100%; margin:0 auto;">
<thead>
<tr>
<th>收入代碼</th>
<th>收入名稱</th>
<th>數量</th>
<th>單價</th>
<th>金額(未稅)</th>
<th>稅金</th>
<th>含稅金額</th>
<th>專案代碼</th>
<th>作番號</th>
<th>預計請款日</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<div style="overflow-x:auto;">
<form id='myForm' method='post' action='contract_b-index.php?<?= $token_link ?>'>
<table class='table query-table table-striped table-bordered display compact' style='width:98%;text-align:center;margin:0 auto'>
<thead>
<tr>
<td colspan="5">
<h3 style='text-align:center'>保養合約管理</h3>
</td>
</tr>
</thead>
<tbody>
<tr>
<th style='text-align:center;vertical-align: middle;'>合約號</th>
<td style='text-align:center;vertical-align: middle;'>
<input type="text" class='form-control' id='contractno' name='contractno' value="">
</td>
<td style='text-align:left;vertical-align: middle;'>
<button type="submit" style='text-align:center; margin:0 auto' class="btn btn-primary btn-sm">查詢</button>
</td>
</tr>
</tbody>
</table>
</form>
</div>
<div style="overflow-x:auto;">
<a href="contract/contract-input.php?function_name=contract-input&<?php echo $token_link; ?>" class="btn btn-info btn-sm">
<span class="glyphicon glyphicon-plus"></span>
</a>
<table id="table_index" class="table table-striped table-bordered" style="width:100%">
<thead>
<tr>
<th style='text-align:center;vertical-align: middle;width:120px;'>營業人員/契約人員</th>
<th style='text-align:center;vertical-align: middle;width:120px;'>部門</th>
<th style='text-align:center;vertical-align: middle;width:120px;'>合約號</th>
<th style='text-align:center;vertical-align: middle;width:120px;'>單據號</th>
<th style='text-align:center;vertical-align: middle;width:120px;'>客戶名稱</th>
<th style='text-align:center;vertical-align: middle;width:80px;'>單據日期</th>
<th style='text-align:center;vertical-align: middle;width:80px;'>最後收款日</th>
<th style='text-align:center;vertical-align: middle;width:120px;'>追蹤狀態</th>
<th style='text-align:center;vertical-align: middle;width:120px;'>金額</th>
<th style='text-align:center;vertical-align: middle;width:60px;'>明細</th>
</tr>
</thead>
<tbody>
<?php foreach ($data as $row) { ?>
<tr>
<td>
<?php
echo $row['PersonId'];
echo "<br/>";
echo $row['PersonName'];
?>
</td>
<td>
<?php echo $row['DeptName']; ?>
</td>
<td>
<?php echo $row['ProjectId']; ?>
</td>
<td>
<?php echo $row['BillNo']; ?>
</td>
<td>
<?php echo $row['BizPartnerName']; ?>
</td>
<td>
<?php echo date('Y/m/d', strtotime($row['BillDate'])); ?>
</td>
<td>
<?php echo empty($row['Max_CU_EstPayDate']) ? '' : date('Y/m/d', strtotime($row['Max_CU_EstPayDate'])); ?>
</td>
<td>
<?php
$date1 = new DateTime(date('Y-m-d', strtotime($row['Max_CU_EstPayDate'])));
$date2 = new DateTime(date('Y-m-d'));
$interval = $date1->diff($date2);
$months = $interval->m;
$months += $interval->y * 12;
if ($date1 <= $date2) {
echo "<span class=''>合約已過期</span>";
} else if ($months <= 2) {
echo "<span class='text-danger'>合約快到期</span>";
} else {
echo "<span class='text-success'>合約未到期</span>";
}
?>
</td>
<td>
<?php echo number_format(intval($row['UnTransAmount']), 0, '', ','); ?>
</td>
<td>
<button class="btn btn-primary myBtn" type="button" onclick="showDetail('<?php echo $row['BillNo']; ?>')">明細</button>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<script>
var modal = document.getElementById("myModal");
$(".myBtn").click(function() {
$("#myModal").show();
});
$("#myCloseBtn").click(function(e) {
$("#myModal").hide();
});
$(".back").click(function(e) {
$("#myModal").hide();
});
function showDetail(billno) {
$.ajax({
type: "POST",
dataType: "json",
url: "contract_b-index-model.php",
data: {
form_name: 'showDetail',
billno: billno
},
complete: function(data) {
var data = data.responseJSON
var str = "";
for (var i = 0; i < data.length; i++) {
str += "<tr>";
str += "<td>" + data[i]['IncomeId'] + "</td>";
str += "<td>" + data[i]['FeeTypeName'] + "</td>";
str += "<td>" + data[i]['SQuantity'] + "</td>";
str += "<td>" + data[i]['SPrice'] + "</td>";
str += "<td>" + data[i]['OAmount'] + "</td>";
str += "<td>" + data[i]['OTax'] + "</td>";
str += "<td>" + data[i]['OAmountWithTax'] + "</td>";
str += "<td>" + data[i]['ProjectId'] + "</td>";
str += "<td>" + data[i]['CU_MaterialId'] + "</td>";
str += "<td>" + data[i]['CU_EstPayDate'] + "</td>";
str += "</tr>";
}
if ($('#table_detail').hasClass('dataTable')) {
dttable = $('#table_detail').dataTable();
dttable.fnClearTable();
dttable.fnDestroy();
}
$("#table_detail").find("tbody").html(str);
$('#table_detail').dataTable();
}
})
}
</script>
<?php
else :
echo "<h2>There is no record!</h2>";
endif;
#代表結束連線
mysqli_close($link);
include "footer.php";
?>

2
wms/crm/crmm02-index.php

@ -170,7 +170,7 @@ if ($data) :
<span class="glyphicon glyphicon-pencil"></span>
</a>
<?php if ($user_name === $row['salesman'] || $user_id = 'M0225') : ?>
<a href="https://bpm.masada.com.tw/km/review/km_review_main/kmReviewMain.do?method=add&fdTemplateId=18cf68c8bc2a8ec3c80950e4e2389f0a&s_css=default&vol_no=<?= $row['vol_no'] ?>" class="btn btn-info btn-sm">
<a href="../mkt/pricereviewMaintainCreate.php?function_name=customer&token=<?= $token_link ?>&vol_no=<?= $row['vol_no'] ?>" class="btn btn-info btn-sm">
轉價審
</a>
<?php endif ?>

8
wms/crm/crmm03-edit.php

@ -348,7 +348,7 @@ function get_sequnece_no($seq_name = '', $p_yyyymm = '')
<textarea class='form-control textarea' id="progress_status" name="progress_status" value='' rows='6'></textarea>
</div>
</div>
<div id="elevator_list_area" class="row ">
<!-- <div id="elevator_list_area" class="row ">
<div class="col-12 form_row_header ">
<b>電梯規格信息</b>
</div>
@ -398,8 +398,8 @@ function get_sequnece_no($seq_name = '', $p_yyyymm = '')
</tbody>
</table>
</div>
<div id="option_list_area" class="row ">
</div> -->
<!-- <div id="option_list_area" class="row ">
<div class="col-12 form_row_header ">
<b>Option報價</b>
</div>
@ -452,7 +452,7 @@ function get_sequnece_no($seq_name = '', $p_yyyymm = '')
</tbody>
</table>
</div>
</div> -->
<button style='margin:20px auto;width:50px' type="submit" class="btn btn-primary btn-sm">保存</button>
</div>

8
wms/crm/crmm04-edit.php

@ -381,7 +381,7 @@ function base_url($url)
</div>
</div>
<div id="elevator_list_area" class="row ">
<!-- <div id="elevator_list_area" class="row ">
<div class="col-12 form_row_header ">
<b>電梯規格信息</b>
</div>
@ -431,8 +431,8 @@ function base_url($url)
</tbody>
</table>
</div>
<div id="option_list_area" class="row ">
</div> -->
<!-- <div id="option_list_area" class="row ">
<div class="col-12 form_row_header ">
<b>Option報價</b>
</div>
@ -486,7 +486,7 @@ function base_url($url)
</tbody>
</table>
</div>
</div> -->
<button style='margin:20px auto;width:50px' type="submit" class="btn btn-primary btn-sm">保存</button>
</div>

24
wms/mkt/assets/js/pricereviewAlpine.js

@ -122,11 +122,10 @@ const pricereviewCreate = ()=>{
try{
const res = await axios.get("./api/getElevatorPrice.php", {params: {model: model, kind: spec}})
console.log(res.data);
if(res.data.id == null || res.data.id == ""){
if (res.data == null || res.data == "") {
console.log("公司並無提供此規格!!");
}
this.elevators[idx].price = res.data.price
this.elevators[idx].facility_id = res.data.id
this.elevators[idx].price = res.data
} catch (error) {
console.error("Error fetching elevator price:", error);
}
@ -145,11 +144,10 @@ const pricereviewCreate = ()=>{
try{
const res = await axios.get("./api/getElevatorPrice.php", {params: {model: model, kind:kind}})
console.log(res.data);
if(res.data.id == null || res.data.id == ""){
if (res.data == null || res.data == "") {
console.log("公司並無提供此規格!!");
}
this.modalElevatorInfo.price = res.data.price
this.modalElevatorInfo.facility_id = res.data.id
this.modalElevatorInfo.price = res.data
} catch (error) {
console.error("Error fetching elevator price:", error);
}
@ -584,7 +582,8 @@ const pricereviewCreate = ()=>{
num: '',
}
this.otherOptionKey++;
this.hideCreateOtherOptionModal();
console.log(this.otherOptions);
this.$refs.closeCreateOtherOptionModalBtn.click();
},
totalOtherOptionsPrice() {
return this.otherOptions.reduce((total, option) => {
@ -610,7 +609,7 @@ const pricereviewCreate = ()=>{
memo: "",
}
this.maintainOptionKey++;
this.hideCreateMaintainModal();
this.$refs.closeCreateMaintainOptionModalBtn.click();
},
createDemolishOptionFn(){
this.demolishOptions.push({
@ -894,8 +893,6 @@ const pricereviewCreate = ()=>{
},
}
}
const pricereviewCheck = () => {
return {
init(){
@ -920,8 +917,8 @@ const pricereviewCheck = ()=>{
if(option.option_relate_spec == elevator.item_no){
elevator.optionsTotalPrice += option.option_mi * option.item_qty
this.elevators[idx].options.push({
'id': option.id, //&amp;lt;br&amp;gt;()
'item_spec': option.item_spec.trim().replaceAll('&amp;', '').replaceAll('lt;', '').replaceAll('br', '').replaceAll('gt;', '').replaceAll('()', ''),
'id': option.id,
'item_spec': option.item_spec.trim(),
'item_unit_price': option.item_unit_price,
'item_qty': option.item_qty,
'mi': Math.round(option.option_mi),
@ -1064,7 +1061,6 @@ const pricereviewCheck = ()=>{
demolishOptions:[],
mid: mid,
user_id: user_id,
reviewcomment:'',
optionsTotalPrice() {
return this.options.reduce((total, option) => {
return total + (option.item_qty * option.item_unit_price);
@ -1105,7 +1101,6 @@ const pricereviewCheck = ()=>{
form.append('mid', this.mid);
form.append('result', status);
form.append('user_id', this.user_id);
form.append('reviewcomment', this.reviewcomment);
axios.post('./api/postPricereviewSign.php', form).then(res => {
console.log(res.data);
if (res.data == 1) {
@ -1120,5 +1115,6 @@ const pricereviewCheck = ()=>{
const res = await axios.get('./api/getUsername.php', {params: {user_id: user_id}})
return res.data ;
},
}
}

134
wms/mkt/css/pricereview.css

@ -1,34 +1,58 @@
#pricereviewCreate input[type=text], #pricereviewCreate input[type=number], #pricereviewCreate select {
#pricereviewCreate input[type=text],
#pricereviewCreate input[type=number],
#pricereviewCreate select {
margin: 1px;
}
#pricereviewCreate textarea {
resize: vertical;
}
#pricereviewCreate>.modal {
padding: 20px;
}
#pricereviewCreate > .modal table, #pricereviewCreate > .modal th, #pricereviewCreate > .modal td {
#pricereviewCreate>.modal table,
#pricereviewCreate>.modal th,
#pricereviewCreate>.modal td {
border: 1px #ccc solid;
}
#pricereviewCreate>.modal table>thead tr th {
color: #A52A2A;
}
#pricereviewCreate>.modal table>tbody .selected {
background-color: #E7FEFB;
}
#pricereviewCreate .container table, #pricereviewCreate .container th, #pricereviewCreate .container td {
#pricereviewCreate .container table,
#pricereviewCreate .container th,
#pricereviewCreate .container td {
border: 1px #ccc solid;
padding: 15px;
}
#pricereviewCreate .container table.noborder, #pricereviewCreate .container table .noborder th, #pricereviewCreate .container table .noborder td, #pricereviewCreate .container th.noborder, #pricereviewCreate .container th .noborder th, #pricereviewCreate .container th .noborder td, #pricereviewCreate .container td.noborder, #pricereviewCreate .container td .noborder th, #pricereviewCreate .container td .noborder td {
#pricereviewCreate .container table.noborder,
#pricereviewCreate .container table .noborder th,
#pricereviewCreate .container table .noborder td,
#pricereviewCreate .container th.noborder,
#pricereviewCreate .container th .noborder th,
#pricereviewCreate .container th .noborder td,
#pricereviewCreate .container td.noborder,
#pricereviewCreate .container td .noborder th,
#pricereviewCreate .container td .noborder td {
border: none;
}
#pricereviewCreate .container table thead th {
background-color: #6D9EEB;
}
#pricereviewCreate .container table tbody td input {
font-size: 14px;
}
#pricereviewCreate .container table tbody th {
background-color: #CCE4F8;
font-size: 14px;
@ -36,15 +60,18 @@
min-width: 100px;
text-align: center;
}
#pricereviewCreate .container table input {
font-size: 13px;
}
#pricereviewCreate .container .pricreviewmain {
background-color: #F2F2F2;
padding: 20px;
border-radius: 6px;
margin: 30px 0;
}
#pricereviewCreate .container .pricreviewmain button {
color: #fff;
width: 55px;
@ -54,25 +81,30 @@
margin-bottom: 2px;
font-size: 13px;
}
#pricereviewCreate .container .pricreviewmain button.addbtn {
background-color: #337AB7;
width: 30px;
}
#pricereviewCreate .container .pricreviewmain button.deleteBtn {
background-color: #D9534F;
color: #fff;
font-size: 12px;
width: 30px;
}
#pricereviewCreate .container .pricreviewmain button.selectElevator {
background-color: #D9534F;
color: #fff;
}
#pricereviewCreate .container .pricreviewmain>.divitem {
border: 1px #ccc solid;
padding: 10px;
border-radius: 4px;
}
#pricereviewCreate .container .pricreviewmain>.divitem .title {
display: flex;
align-items: center;
@ -80,33 +112,57 @@
padding: 10px 0;
margin-bottom: 10px;
}
#pricereviewCreate .container .pricreviewmain>.divitem .title h6 {
font-weight: 600;
}
#pricereviewCreate .container .pricreviewmain > .divitem table, #pricereviewCreate .container .pricreviewmain > .divitem th, #pricereviewCreate .container .pricreviewmain > .divitem td {
#pricereviewCreate .container .pricreviewmain>.divitem table,
#pricereviewCreate .container .pricreviewmain>.divitem th,
#pricereviewCreate .container .pricreviewmain>.divitem td {
font-size: 14px;
background-color: transparent;
}
#pricereviewCreate .container .pricreviewmain > .divitem table input, #pricereviewCreate .container .pricreviewmain > .divitem table select, #pricereviewCreate .container .pricreviewmain > .divitem table textarea, #pricereviewCreate .container .pricreviewmain > .divitem th input, #pricereviewCreate .container .pricreviewmain > .divitem th select, #pricereviewCreate .container .pricreviewmain > .divitem th textarea, #pricereviewCreate .container .pricreviewmain > .divitem td input, #pricereviewCreate .container .pricreviewmain > .divitem td select, #pricereviewCreate .container .pricreviewmain > .divitem td textarea {
#pricereviewCreate .container .pricreviewmain>.divitem table input,
#pricereviewCreate .container .pricreviewmain>.divitem table select,
#pricereviewCreate .container .pricreviewmain>.divitem table textarea,
#pricereviewCreate .container .pricreviewmain>.divitem th input,
#pricereviewCreate .container .pricreviewmain>.divitem th select,
#pricereviewCreate .container .pricreviewmain>.divitem th textarea,
#pricereviewCreate .container .pricreviewmain>.divitem td input,
#pricereviewCreate .container .pricreviewmain>.divitem td select,
#pricereviewCreate .container .pricreviewmain>.divitem td textarea {
font-size: 13px;
}
#pricereviewCreate .container .pricreviewmain>.divitem table input[type=number]::-webkit-outer-spin-button,
#pricereviewCreate .container .pricreviewmain > .divitem table input[type=number]::-webkit-inner-spin-button, #pricereviewCreate .container .pricreviewmain > .divitem th input[type=number]::-webkit-outer-spin-button,
#pricereviewCreate .container .pricreviewmain > .divitem th input[type=number]::-webkit-inner-spin-button, #pricereviewCreate .container .pricreviewmain > .divitem td input[type=number]::-webkit-outer-spin-button,
#pricereviewCreate .container .pricreviewmain>.divitem table input[type=number]::-webkit-inner-spin-button,
#pricereviewCreate .container .pricreviewmain>.divitem th input[type=number]::-webkit-outer-spin-button,
#pricereviewCreate .container .pricreviewmain>.divitem th input[type=number]::-webkit-inner-spin-button,
#pricereviewCreate .container .pricreviewmain>.divitem td input[type=number]::-webkit-outer-spin-button,
#pricereviewCreate .container .pricreviewmain>.divitem td input[type=number]::-webkit-inner-spin-button {
-webkit-appearance: none;
margin: 0;
}
#pricereviewCreate .container .pricreviewmain > .divitem table tr:hover .deleteBtn, #pricereviewCreate .container .pricreviewmain > .divitem table tr:hover .copyBtn {
#pricereviewCreate .container .pricreviewmain>.divitem table tr:hover .deleteBtn,
#pricereviewCreate .container .pricreviewmain>.divitem table tr:hover .copyBtn {
opacity: 1;
}
<<<<<<< HEAD
#pricereviewCreate .container .pricreviewmain > .divitem table .copyBtn {
width: 30px;
height: 30px;
}
#pricereviewCreate .container .pricreviewmain > .divitem table .saletd {
=======
#pricereviewCreate .container .pricreviewmain>.divitem table .saletd {
>>>>>>> 3ca7276d197f3d77f11e3719294215e04a32dc62
position: relative;
}
#pricereviewCreate .container .pricreviewmain>.divitem table .saletd>.deleteBtn {
position: absolute;
top: 50%;
@ -115,6 +171,7 @@
opacity: 0;
transition: 0.3s;
}
#pricereviewCreate .container .pricreviewmain>.divitem table .saletd>.copyBtn {
position: absolute;
top: 50%;
@ -125,28 +182,34 @@
width: 30px;
height: 30px;
}
#pricereviewCreate .container .pricreviewmain>.divitem table textarea {
height: auto;
min-height: 50px;
}
#pricereviewCreate .container .pricreviewmain>.filediv {
display: flex;
flex-direction: column;
margin-top: 20px;
}
#pricereviewCreate .container .pricreviewmain>.filediv label {
display: flex;
align-items: center;
margin: 10px 0;
}
#pricereviewCreate .container .pricreviewmain>.filediv label p {
width: 100px;
font-size: 15px;
font-weight: 600;
}
#pricereviewCreate .container .pricreviewmain>.filediv label input[type=file] {
width: 400px;
}
#pricereviewCreate .container .pricreviewmain>.filediv label button {
width: 90px;
height: 35px;
@ -155,14 +218,19 @@
margin-top: 20px;
}
.container-fluid, .container {
.container-fluid,
.container {
max-width: 1400px !important;
width: 100%;
}
.container-fluid h4, .container h4 {
.container-fluid h4,
.container h4 {
font-weight: 600;
}
.container-fluid .btn-secondary, .container .btn-secondary {
.container-fluid .btn-secondary,
.container .btn-secondary {
background-color: #6C757D;
}
@ -177,39 +245,51 @@
padding: 20px;
display: none;
}
@keyframes fade-in {
0% {
transform: translate(-50%, -60%);
opacity: 0;
}
100% {
transform: translate(-50%, -55%);
opacity: 1;
}
}
.window-modal table, .window-modal th, .window-modal td {
.window-modal table,
.window-modal th,
.window-modal td {
border: 1px #ccc solid;
}
.window-modal table>thead tr th {
color: #A52A2A;
}
.window-modal table>tbody .selected {
background-color: #E7FEFB;
}
.window-modal#optionModal .window-modal-content {
max-height: 80vh;
}
.window-modal#optionModal .window-modal-content .window-modal-body {
height: 400px;
overflow-y: scroll;
}
.window-modal#toElevatorModal .window-modal-content {
min-height: 270px;
height: auto;
}
.window-modal#toElevatorModal .window-modal-content .window-modal-body {
height: auto;
}
.window-modal .window-modal-content {
z-index: 9;
background-color: #fff;
@ -223,19 +303,24 @@
box-shadow: 0 5px 5px #222;
animation: fade-in 0.2s linear;
}
.window-modal .window-modal-content.modal-xl {
max-width: 1200px;
}
.window-modal .window-modal-content.modal-lg {
max-width: 800px;
}
.window-modal .window-modal-content.modal-m {
max-width: 450px;
}
.window-modal .window-modal-content .window-modal-header {
display: flex;
flex-direction: column;
}
.window-modal .window-modal-content .window-modal-header button.btn-close {
position: absolute;
top: 10px;
@ -245,9 +330,11 @@
outline: none;
border-radius: 50%;
}
.window-modal .window-modal-content .window-modal-header>div>input {
width: 250px;
}
.window-modal .window-back {
position: absolute;
top: 0;
@ -262,40 +349,55 @@
border-radius: 15px;
padding: 20px;
}
#pricereviewCheck>.container textarea {
resize: vertical;
}
#pricereviewCheck > .container table, #pricereviewCheck > .container th, #pricereviewCheck > .container td {
#pricereviewCheck>.container table,
#pricereviewCheck>.container th,
#pricereviewCheck>.container td {
border: 1px #ccc solid;
}
#pricereviewCheck>.container table.noborder {
border: none !important;
}
#pricereviewCheck > .container table.noborder th, #pricereviewCheck > .container table.noborder td {
#pricereviewCheck>.container table.noborder th,
#pricereviewCheck>.container table.noborder td {
border: none !important;
}
#pricereviewCheck>.container .customerinfo-table input {
background-color: #EEE5E5;
}
#pricereviewCheck>.container .mi-table th {
font-weight: 600;
}
#pricereviewCheck>.container .mi-table input[type=text] {
background-color: #EEEEEE;
cursor: not-allowed;
padding: 6px 12px;
font-size: 14px;
}
#pricereviewCheck>.container .mi-table .mi-info {
font-size: 14px;
}
#pricereviewCheck>.container .mi-table .mi-info span {
font-size: 15px;
font-weight: 600;
}
#pricereviewCheck>.container .mi-table .mi-info .line {
width: 100%;
height: 0.5px;
margin: 30px 0;
background-color: #ccc;
}/*# sourceMappingURL=pricereview.css.map */
}
/*# sourceMappingURL=pricereview.css.map */

13
wms/mkt/css/pricereview.css.map

@ -1 +1,14 @@
<<<<<<< HEAD
{"version":3,"sources":["pricereview.scss","pricereview.css"],"names":[],"mappings":"AACI;EACI,WAAA;ACAR;ADEI;EACI,gBAAA;ACAR;ADEI;EACI,aAAA;ACAR;ADCQ;EACI,sBAAA;ACCZ;ADCQ;EACI,cAAA;ACCZ;ADCQ;EACI,yBAAA;ACCZ;ADKQ;EACI,sBAAA;EACA,aAAA;ACHZ;ADIY;EACI,YAAA;ACFhB;ADMY;EACI,yBAAA;ACJhB;ADOgB;EACI,eAAA;ACLpB;ADOgB;EACI,yBAAA;EACA,eAAA;EACA,iBAAA;EACA,gBAAA;EACA,kBAAA;ACLpB;ADQY;EACI,eAAA;ACNhB;ADSQ;EACI,yBAAA;EACA,aAAA;EACA,kBAAA;EACA,cAAA;ACPZ;ADQY;EACI,WAAA;EACA,WAAA;EACA,YAAA;EACA,UAAA;EACA,gBAAA;EACA,kBAAA;EACA,eAAA;ACNhB;ADOgB;EACI,yBAAA;EACA,WAAA;ACLpB;ADOgB;EACI,yBAAA;EACA,WAAA;EACA,eAAA;EACA,WAAA;ACLpB;ADOgB;EACI,yBAAA;EACA,WAAA;ACLpB;ADSY;EACI,sBAAA;EACA,aAAA;EACA,kBAAA;ACPhB;ADQgB;EACI,aAAA;EACA,mBAAA;EACA,6BAAA;EACA,eAAA;EACA,mBAAA;ACNpB;ADOoB;EACI,gBAAA;ACLxB;ADSgB;EACI,eAAA;EACA,6BAAA;ACPpB;ADQoB;EACI,eAAA;ACNxB;ADQoB;;;;EAEA,wBAAA;EACA,SAAA;ACJpB;ADQoB;EACI,UAAA;ACNxB;ADQoB;EACI,WAAA;EACA,YAAA;ACNxB;ADQoB;EACI,kBAAA;ACNxB;ADOwB;EACI,kBAAA;EACA,QAAA;EACA,2BAAA;EACA,UAAA;EACA,UAAA;EACA,gBAAA;ACL5B;ADOwB;EACI,kBAAA;EACA,QAAA;EACA,2BAAA;EACA,WAAA;EACA,UAAA;EACA,gBAAA;EACA,WAAA;EACA,YAAA;ACL5B;ADQoB;EACI,YAAA;EACA,gBAAA;ACNxB;ADUY;EACI,aAAA;EACA,sBAAA;EACA,gBAAA;ACRhB;ADSgB;EACI,aAAA;EACA,mBAAA;EACA,cAAA;ACPpB;ADQoB;EACI,YAAA;EACA,eAAA;EACA,gBAAA;ACNxB;ADQoB;EACI,YAAA;ACNxB;ADQoB;EACI,WAAA;EACA,YAAA;EACA,SAAA;EACA,kBAAA;EACA,gBAAA;ACNxB;;ADcA;EACI,4BAAA;EACA,WAAA;ACXJ;ADYI;EACI,gBAAA;ACVR;ADYI;EACI,yBAAA;ACVR;;ADcA;EACI,eAAA;EACA,MAAA;EACA,OAAA;EACA,WAAA;EACA,aAAA;EACA,oCAAA;EACA,UAAA;EACA,aAAA;EACA,aAAA;ACXJ;ADYI;EACI;IACI,gCAAA;IACA,UAAA;ECVV;EDYM;IACI,gCAAA;IACA,UAAA;ECVV;AACF;ADYI;EACI,sBAAA;ACVR;ADYI;EACI,cAAA;ACVR;ADYI;EACI,yBAAA;ACVR;ADYI;EACI,gBAAA;ACVR;ADWQ;EACI,aAAA;EACA,kBAAA;ACTZ;ADYI;EACI,iBAAA;EACA,YAAA;ACVR;ADWQ;EACI,YAAA;ACTZ;ADYI;EACI,UAAA;EACA,sBAAA;EACA,mBAAA;EACA,kBAAA;EACA,UAAA;EACA,aAAA;EACA,QAAA;EACA,SAAA;EACA,gCAAA;EACA,0BAAA;EACA,8BAAA;ACVR;ADWQ;EACI,iBAAA;ACTZ;ADWQ;EACI,gBAAA;ACTZ;ADWQ;EACI,gBAAA;ACTZ;ADWQ;EACI,aAAA;EACA,sBAAA;ACTZ;ADUY;EACI,kBAAA;EACA,SAAA;EACA,WAAA;EACA,6BAAA;EACA,YAAA;EACA,aAAA;EACA,kBAAA;ACRhB;ADUY;EACI,YAAA;ACRhB;ADYI;EACI,kBAAA;EACA,MAAA;EACA,OAAA;EACA,WAAA;EACA,YAAA;EACA,6BAAA;ACVR;;ADeI;EACI,yBAAA;EACA,mBAAA;EACA,aAAA;ACZR;ADaQ;EACI,gBAAA;ACXZ;ADaQ;EACI,sBAAA;ACXZ;ADaQ;EACI,uBAAA;ACXZ;ADYY;EACI,uBAAA;ACVhB;ADcY;EACI,yBAAA;ACZhB;ADgBY;EACI,gBAAA;ACdhB;ADgBY;EACI,yBAAA;EACA,mBAAA;EACA,iBAAA;EACA,eAAA;ACdhB;ADgBY;EACI,eAAA;ACdhB;ADegB;EACI,eAAA;EACA,gBAAA;ACbpB;ADegB;EACI,WAAA;EACA,aAAA;EACA,cAAA;EACA,sBAAA;ACbpB","file":"pricereview.css"}
=======
{
"version": 3,
"sources": [
"pricereview.scss",
"pricereview.css"
],
"names": [],
"mappings": "AACI;EACI,WAAA;ACAR;ADEI;EACI,gBAAA;ACAR;ADEI;EACI,aAAA;ACAR;ADCQ;EACI,sBAAA;ACCZ;ADCQ;EACI,cAAA;ACCZ;ADCQ;EACI,yBAAA;ACCZ;ADKQ;EACI,sBAAA;EACA,aAAA;ACHZ;ADIY;EACI,YAAA;ACFhB;ADMY;EACI,yBAAA;ACJhB;ADOgB;EACI,eAAA;ACLpB;ADOgB;EACI,yBAAA;EACA,eAAA;EACA,iBAAA;EACA,gBAAA;EACA,kBAAA;ACLpB;ADQY;EACI,eAAA;ACNhB;ADSQ;EACI,yBAAA;EACA,aAAA;EACA,kBAAA;EACA,cAAA;ACPZ;ADQY;EACI,WAAA;EACA,WAAA;EACA,YAAA;EACA,UAAA;EACA,iBAAA;EACA,eAAA;ACNhB;ADOgB;EACI,yBAAA;EACA,WAAA;ACLpB;ADOgB;EACI,yBAAA;EACA,WAAA;EACA,eAAA;EACA,WAAA;ACLpB;ADOgB;EACI,yBAAA;EACA,WAAA;ACLpB;ADSY;EACI,sBAAA;EACA,aAAA;EACA,kBAAA;ACPhB;ADQgB;EACI,aAAA;EACA,mBAAA;EACA,6BAAA;EACA,eAAA;EACA,mBAAA;ACNpB;ADOoB;EACI,gBAAA;ACLxB;ADSgB;EACI,eAAA;EACA,6BAAA;ACPpB;ADQoB;EACI,eAAA;ACNxB;ADQoB;;;;EAEA,wBAAA;EACA,SAAA;ACJpB;ADQoB;EACI,UAAA;ACNxB;ADQoB;EACI,kBAAA;ACNxB;ADOwB;EACI,kBAAA;EACA,QAAA;EACA,2BAAA;EACA,UAAA;EACA,UAAA;EACA,gBAAA;ACL5B;ADOwB;EACI,kBAAA;EACA,QAAA;EACA,2BAAA;EACA,WAAA;EACA,UAAA;EACA,gBAAA;EACA,WAAA;EACA,YAAA;ACL5B;ADQoB;EACI,YAAA;EACA,gBAAA;ACNxB;ADUY;EACI,aAAA;EACA,sBAAA;EACA,gBAAA;ACRhB;ADSgB;EACI,aAAA;EACA,mBAAA;EACA,cAAA;ACPpB;ADQoB;EACI,YAAA;EACA,eAAA;EACA,gBAAA;ACNxB;ADQoB;EACI,YAAA;ACNxB;ADQoB;EACI,WAAA;EACA,YAAA;EACA,SAAA;EACA,kBAAA;EACA,gBAAA;ACNxB;;ADcA;EACI,4BAAA;EACA,WAAA;ACXJ;ADYI;EACI,gBAAA;ACVR;ADYI;EACI,yBAAA;ACVR;;ADcA;EACI,eAAA;EACA,MAAA;EACA,OAAA;EACA,WAAA;EACA,aAAA;EACA,oCAAA;EACA,UAAA;EACA,aAAA;EACA,aAAA;ACXJ;ADYI;EACI;IACI,gCAAA;IACA,UAAA;ECVV;EDYM;IACI,gCAAA;IACA,UAAA;ECVV;AACF;ADYI;EACI,sBAAA;ACVR;ADYI;EACI,cAAA;ACVR;ADYI;EACI,yBAAA;ACVR;ADYI;EACI,gBAAA;ACVR;ADWQ;EACI,aAAA;EACA,kBAAA;ACTZ;ADYI;EACI,iBAAA;EACA,YAAA;ACVR;ADWQ;EACI,YAAA;ACTZ;ADYI;EACI,UAAA;EACA,sBAAA;EACA,mBAAA;EACA,kBAAA;EACA,aAAA;EACA,aAAA;EACA,QAAA;EACA,SAAA;EACA,gCAAA;EACA,0BAAA;EACA,8BAAA;ACVR;ADWQ;EACI,aAAA;ACTZ;ADWQ;EACI,YAAA;ACTZ;ADWQ;EACI,YAAA;ACTZ;ADWQ;EACI,aAAA;EACA,sBAAA;ACTZ;ADUY;EACI,kBAAA;EACA,SAAA;EACA,WAAA;EACA,6BAAA;EACA,YAAA;EACA,aAAA;EACA,kBAAA;ACRhB;ADUY;EACI,YAAA;ACRhB;ADYI;EACI,kBAAA;EACA,MAAA;EACA,OAAA;EACA,WAAA;EACA,YAAA;EACA,6BAAA;ACVR;;ADeI;EACI,yBAAA;EACA,mBAAA;EACA,aAAA;ACZR;ADaQ;EACI,gBAAA;ACXZ;ADaQ;EACI,sBAAA;ACXZ;ADaQ;EACI,uBAAA;ACXZ;ADYY;EACI,uBAAA;ACVhB;ADcY;EACI,yBAAA;ACZhB;ADgBY;EACI,gBAAA;ACdhB;ADgBY;EACI,yBAAA;EACA,mBAAA;EACA,iBAAA;EACA,eAAA;ACdhB;ADgBY;EACI,eAAA;ACdhB;ADegB;EACI,eAAA;EACA,gBAAA;ACbpB;ADegB;EACI,WAAA;EACA,aAAA;EACA,cAAA;EACA,sBAAA;ACbpB",
"file": "pricereview.css"
}
>>>>>>> 3ca7276d197f3d77f11e3719294215e04a32dc62

154
wms/mkt/css/pricereview.scss

@ -1,40 +1,60 @@
#pricereviewCreate {
input[type='text'], input[type='number'], select{
input[type='text'],
input[type='number'],
select {
margin: 1px;
}
textarea {
resize: vertical;
}
>.modal {
padding: 20px;
table, th, td{
table,
th,
td {
border: 1px #ccc solid;
}
table>thead tr th {
color: #A52A2A;
}
table>tbody .selected {
background-color: #E7FEFB;
}
table > tbody .selected td{
}
table>tbody .selected td {}
}
.container {
table, th, td{
table,
th,
td {
border: 1px #ccc solid;
padding: 15px;
&.noborder, .noborder th, .noborder td{
&.noborder,
.noborder th,
.noborder td {
border: none;
}
}
table {
thead th {
background-color: #6D9EEB;
}
tbody {
td input {
font-size: 14px;
}
th {
background-color: #CCE4F8;
font-size: 14px;
@ -43,15 +63,18 @@
text-align: center;
}
}
input {
font-size: 13px;
}
}
.pricreviewmain {
background-color: #F2F2F2;
padding: 20px;
border-radius: 6px;
margin: 30px 0;
button {
color: #fff;
width: 55px;
@ -60,16 +83,19 @@
margin-left: 6px;
margin-bottom: 2px;
font-size: 13px;
&.addbtn {
background-color: #337AB7;
width: 30px;
}
&.deleteBtn {
background-color: #D9534F;
color: #fff;
font-size: 12px;
width: 30px;
}
&.selectElevator {
background-color: #D9534F;
color: #fff;
@ -80,39 +106,57 @@
border: 1px #ccc solid;
padding: 10px;
border-radius: 4px;
.title {
display: flex;
align-items: center;
border-bottom: 1px #ccc solid;
padding: 10px 0;
margin-bottom: 10px;
h6 {
font-weight: 600;
}
}
table, th, td{
table,
th,
td {
font-size: 14px;
background-color: transparent;
input, select, textarea{
input,
select,
textarea {
font-size: 13px;
}
input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button {
-webkit-appearance: none;
margin: 0;
}
}
table {
tr:hover .deleteBtn ,tr:hover .copyBtn{
tr:hover .deleteBtn,
tr:hover .copyBtn {
opacity: 1;
}
<<<<<<< HEAD
.copyBtn{
width: 30px;
height: 30px;
}
.saletd{
=======
.saletd {
>>>>>>> 3ca7276d197f3d77f11e3719294215e04a32dc62
position: relative;
>.deleteBtn {
position: absolute;
top: 50%;
@ -121,6 +165,7 @@
opacity: 0;
transition: .3s;
}
>.copyBtn {
position: absolute;
top: 50%;
@ -132,28 +177,34 @@
height: 30px;
}
}
textarea {
height: auto;
min-height: 50px;
}
}
}
>.filediv {
display: flex;
flex-direction: column;
margin-top: 20px;
label {
display: flex;
align-items: center;
margin: 10px 0;
p {
width: 100px;
font-size: 15px;
font-weight: 600;
}
input[type="file"] {
width: 400px
}
button {
width: 90px;
height: 35px;
@ -167,12 +218,15 @@
}
}
.container-fluid, .container{
.container-fluid,
.container {
max-width: 1400px !important;
width: 100%;
h4 {
font-weight: 600;
}
.btn-secondary {
background-color: #6C757D;
}
@ -188,51 +242,49 @@
z-index: 9;
padding: 20px;
display: none;
@keyframes fade-in {
0% {
transform: translate(-50%, -60%);
transform: translate(-50%, -55%);
opacity: 0;
}
100% {
transform: translate(-50%, -55%);
transform: translate(-50%, -50%);
opacity: 1;
}
}
table, th, td{
table,
th,
td {
border: 1px #ccc solid;
}
table>thead tr th {
color: #A52A2A;
}
table>tbody .selected {
background-color: #E7FEFB;
}
&#optionModal .window-modal-content{
max-height: 80vh;
.window-modal-body{
height: 400px;
overflow-y: scroll;
}
}
&#toElevatorModal .window-modal-content{
min-height: 270px;
height: auto;
.window-modal-body{
height: auto;
}
}
.window-modal-content {
z-index: 9;
background-color: #fff;
border-radius: 10px;
position: absolute;
<<<<<<< HEAD
width:90%;
=======
width: 1200px;
>>>>>>> 3ca7276d197f3d77f11e3719294215e04a32dc62
padding: 30px;
top: 50%;
left: 50%;
transform: translate(-50%, -55%);
transform: translate(-50%, -50%);
box-shadow: 0 5px 5px #222;
animation: fade-in .2s linear;
<<<<<<< HEAD
&.modal-xl{
max-width:1200px;
}
@ -241,10 +293,25 @@
}
&.modal-m{
max-width:450px;
=======
&.modal-xl {
width: 1200px;
}
&.modal-lg {
width: 800px;
}
&.modal-m {
width: 400px;
>>>>>>> 3ca7276d197f3d77f11e3719294215e04a32dc62
}
.window-modal-header {
display: flex;
flex-direction: column;
button.btn-close {
position: absolute;
top: 10px;
@ -254,18 +321,16 @@
outline: none;
border-radius: 50%;
}
>div>input {
width: 250px;
}
}
.window-modal-body {
overflow-y: scroll;
height: 400px;
}
.window-back{
position: absolute;
top: 0;
left:0;
width: 100%;
height: 100%;
background-color: transparent;
}
}
@ -274,39 +339,52 @@
background-color: #F2F2F2;
border-radius: 15px;
padding: 20px;
textarea {
resize: vertical;
}
table, th, td{
table,
th,
td {
border: 1px #ccc solid;
}
table.noborder {
border: none !important;
th ,td{
th,
td {
border: none !important;
}
}
.customerinfo-table {
input {
background-color: #EEE5E5;
}
}
.mi-table {
th {
font-weight: 600;
}
input[type=text] {
background-color: #EEEEEE;
cursor: not-allowed;
padding: 6px 12px;
font-size: 14px;
}
.mi-info {
font-size: 14px;
span {
font-size: 15px;
font-weight: 600;
}
.line {
width: 100%;
height: .5px;

195
wms/mkt/pricereviewMaintainCreate.php

@ -0,0 +1,195 @@
<?php
include_once('../header.php');
require_once('./conn.php');
$vol_no = empty($_GET['vol_no']) ? '' : $_GET['vol_no'];
// 有望客戶
$sql = "SELECT a.*,b.content FROM hope_contract_customer AS a
LEFT JOIN code AS b ON a.source = b.code_name
WHERE a.vol_no = '$vol_no' AND b.field_name = 'customer_source'
";
$stmt = $conn->prepare($sql);
// $stmt->bindParam(':vol_no', $vol_no);
$stmt->execute();
$hope_contract = $stmt->fetch(PDO::FETCH_ASSOC);
$hope_customer_status = [
'A' => '有望簽約(已報價)',
'B' => '觀望考慮(等待時機報價)',
'C' => '在途合約',
'D' => '已簽約',
'N' => '無望簽約',
];
$salename = $hope_contract['salesman'];
$sql = "SELECT * FROM account WHERE accountid = :salename";
$stmt = $conn->prepare($sql);
$stmt->bindParam(':salename', $salename);
$stmt->execute();
$salename = $stmt->fetch(PDO::FETCH_ASSOC);
// echo '<pre>';
// print_r($hope_customer_status);
// echo '</pre>';
?>
<link rel="stylesheet" href="./css/pricereview.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/axios/1.5.0/axios.min.js" integrity="sha512-aoTNnqZcT8B4AmeCFmiSnDlc4Nj/KPaZyB5G7JnOnUEkdNpCZs1LCankiYi01sLTyWy+m2P+W4XM+BuQ3Q4/Dg==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script defer src="./assets/js/alpinejs/cdn.min.js"></script>
<script src="./assets/js/pricereviewAlpine.js"></script>
<div id="pricereviewMaintainCreate" x-data=pricereviewMaintainCreate()>
<div class="container">
<table class="table" border="1">
<thead>
<tr class=""></tr>
<th scope="col" class="text-center" colspan=8>有望客戶基本資料</th>
</thead>
<tbody>
<tr>
<th>卷號</th>
<td><input type="text" class="form-control" disabled value="<?= $hope_contract['vol_no'] ?>"></td>
<th>客戶名稱</th>
<td><input type="text" class="form-control" disabled value="<?= $hope_contract['customer'] ?>"></td>
<th>負責人</th>
<td><input type="text" class="form-control" disabled value="<?= $hope_contract['manager'] ?>"></td>
<th>客戶來源</th>
<td><input type="text" class="form-control" disabled value="<?= $hope_contract['content'] ?>"></td>
</tr>
<tr>
<th>地址</th>
<td><input type="text" class="form-control" disabled value="<?= $hope_contract['address'] ?>"></td>
<th>案件名稱</th>
<td><input type="text" class="form-control" disabled value="<?= $hope_contract['customer'] ?>"></td>
<th>市話 / 手機</th>
<td><input type="text" class="form-control" disabled value="<?= $hope_contract['tel'] ?>"></td>
<th>業主方聯繫人</th>
<td><input type="text" class="form-control" disabled value="<?= $hope_contract['linkman'] ?>"></td>
</tr>
<tr>
<th>營業員</th>
<td><input type="text" class="form-control" disabled value="<?= $salename['name'] ?>"></td>
<th>台數</th>
<td><input type="text" class="form-control" disabled value="<?= $hope_contract['num'] ?>"></td>
<th>預定成交日</th>
<td><input type="text" class="form-control" disabled value="<?= $hope_contract['pre_order_date'] ?>"></td>
<th>有望客戶狀態</th>
<td><input type="text" class="form-control" disabled value="<?= $hope_customer_status[$hope_contract['status']] ?>"></td>
</tr>
<tr>
<th>有望客戶狀態</th>
<td><input type="text" class="form-control" disabled value=""></td>
</tr>
</tbody>
</table>
<table class="table" border="1">
<thead>
<tr class=""></tr>
<th scope="col" class="text-center" colspan="8">洽商進度</th>
</thead>
<tbody>
<td colspan=8>
<textarea name="progress" class="form-control" id="progress" cols="20" rows="5" disabled><?= $hope_contract['progress_status'] ?></textarea>
</td>
</tbody>
</table>
<div class="pricreviewmain container">
<div class="divitem">
<div class="title">
<h4>整機單價</h4>
<button class="addbtn btn" x-ref="addElevatorBtn" data-bs-toggle="modal" data-bs-target="#createElevatorModal">+</button>
</div>
<table class="table" border=1>
<thead>
<tr>
<td>項次</td>
<td>電梯</td>
<td>人乘/<br>載重</td>
<td>停數</td>
<td>速度(m/min)</td>
<td>保養月數</td>
<td>保養次數(月)</td>
<td>保養方式</td>
<td>公司發布價(月)</td>
<td>數量</td>
<td>公司發布價(總價)</td>
<td>售價(月)</td>
<td>售價(總價)</td>
</tr>
</thead>
<tbody>
<template x-for="(elevator, idx) in elevator" :key="elevator.id">
<tr>
<td x-text="elevator.id"></td>
<td>
<select name="" id="" class="form-control" x-model="elevator.specifications" @change="getElevatorPrice(idx)">
<option value="">請選擇</option>
<option value="MAE100">MAE100有機房</option>
<option value="MAM200">MAM200無機房</option>
<option value="MAH100">MAH100小電梯</option>
<option value="MAF100">MAE100貨梯(有機房)</option>
<option value="MAQ100">MAQ100強趨梯</option>
<option value="MAP100">MAP100平台梯</option>
</select>
</td>
<td>
<select name="" id="" class="form-control" x-model=elevator.person" @change="getElevatorPrice(idx)">
<option value="">請選擇</option>
<option value="6">6</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
<option value="13">13</option>
<option value="15">15</option>
<option value="17">17</option>
<option value="20">20</option>
<option value="24">24</option>
</select>
</td>
<td>
<input type="number" class="form-control" style="width: 83px;" x-model="elevator.stop" @keyup="getElevatorPrice(idx)" ">
</td>
<td>
<select name="" id="" class=" form-control" x-model="elevator.speed" @change="getElevatorPrice(idx)"></select>
<option value="">請選擇</option>
<option value="9">9</option>
<option value="24">24</option>
<option value="30">30</option>
<option value="45">45</option>
<option value="60">60</option>
<option value="90">90</option>
<option value="105">105</option>
<option value="120">120</option>
<option value="150">150</option>
</td>
<td>
<input type="number" class="form-control" style="width: 63px;" x-model="maintain_month" @keyup="getElevatorPrice(idx)">
</td>
<td>
<input type="number" class="form-control" style="width: 63px;" x-model="maintain_times" @keyup="getElevatorPrice(idx)">
</td>
<td>
<select name="" id="" class="form-control" style="width: 63px" x-model="maintain_kind" @change="getElevatorPrice(idx)">
<option value="">請選擇</option>
<option value="2">半包</option>
<option value="3">全包</option>
<option value="4">清包</option>
</select>
</td>
</tr>
</template>
</tbody>
</table>
</div>
</div>
</div>
</div>
<script>
const body = document.querySelector('body');
// const elevator = [...<?= json_encode($hope_elevator) ?>];
</script>
Loading…
Cancel
Save