Browse Source

保養價審 做得好累 QQ

main
10994015 1 year ago
parent
commit
651fdebb23
  1. 85
      wms/cont/api/getElevatorPrice.php
  2. 101
      wms/cont/api/postElevatorPricereview.php
  3. 127
      wms/cont/api/postPricereviewSign.php
  4. 49
      wms/cont/conn.php
  5. 2
      wms/cont/js/axios.min.js
  6. 141
      wms/cont/js/pricereviewAlpine.js
  7. BIN
      wms/cont/pricereview-uploads/m20240312185746914784kobe.jpg
  8. BIN
      wms/cont/pricereview-uploads/m20240312185839177524curry.jpg
  9. BIN
      wms/cont/pricereview-uploads/m202403121858392743201.png
  10. BIN
      wms/cont/pricereview-uploads/m202403121903019998611074565_507619045984793_769543820_o.jpg
  11. BIN
      wms/cont/pricereview-uploads/m202403121903566135334OlaIEQjXAZDasK9Pd1Jxb.jpg
  12. BIN
      wms/cont/pricereview-uploads/m202403121905046665914OlaIEQjXAZDasK9Pd1Jxb.jpg
  13. BIN
      wms/cont/pricereview-uploads/m202403121907016007094OlaIEQjXAZDasK9Pd1Jxb.jpg
  14. BIN
      wms/cont/pricereview-uploads/m202403121907512357761048100_507643175982380_1454281158_o.jpg
  15. BIN
      wms/cont/pricereview-uploads/m202403121907573946501074565_507619045984793_769543820_o.jpg
  16. BIN
      wms/cont/pricereview-uploads/m20240312191226166002431968299_122131716218151547_1355033508899312082_n.jpg
  17. BIN
      wms/cont/pricereview-uploads/m202403121912261887281074565_507619045984793_769543820_o.jpg
  18. BIN
      wms/cont/pricereview-uploads/m202403121914471012954OlaIEQjXAZDasK9Pd1Jxb.jpg
  19. BIN
      wms/cont/pricereview-uploads/m202403121914476694521705368342957.jpg
  20. BIN
      wms/cont/pricereview-uploads/m20240312192346343561kobe.jpg
  21. BIN
      wms/cont/pricereview-uploads/m20240312192346755323curry.jpg
  22. 559
      wms/cont/pricereviewCheck.php
  23. 15
      wms/cont/pricereviewCreate.php
  24. 2
      wms/cont/sign_list.php
  25. 9
      wms/mkt/pricereviewCreate.php

85
wms/cont/api/getElevatorPrice.php

@ -1,42 +1,51 @@
<?php <?php
require_once "../../mkt/conn.php"; require_once "../../mkt/conn.php";
try{
$spec = $_GET['spec'] ?? '';
$person = $_GET['person'] ?? '';
$stop = $_GET['stop'] ?? '';
$weight = $_GET['weight'] ?? '';
$speed = $_GET['speed'] ?? '';
$m1 = $_GET['m1'] ?? '';
$method = $_GET['method'] ?? '';
$cycle = $_GET['cycle'] ?? '';
$specArr = [
"MAE100" => "A",
"MAF100" => "B",
"MAM200" => "D",
"MAH100" => "E",
];
// $elevator_type = match($spec){
// "MAE100" => "A",
// "MAF100" => "B",
// "MAM200" => "D",
// "MAH100" => "E",
// };
$elevator_type = $specArr[$spec];
$sql_str = "SELECT * FROM maintain_standard_option
WHERE elevator_type=:elevator_type AND min_speed<=:speed AND max_speed>=:speed AND min_persons <= :person AND max_persons >= :person AND is_m1_bundle=:m1
ORDER bY id DESC";
$stmt = $conn->prepare($sql_str);
$stmt->bindParam(':elevator_type', $elevator_type);
$stmt->bindParam(':person', $person);
$stmt->bindParam(':speed', $speed);
$stmt->bindParam(':m1', $m1);
$stmt->execute();
$result = $stmt->fetch(PDO::FETCH_ASSOC);
if(!$result){
echo 0;
exit;
}
$differ = $stop > $result['max_floors'] ? $result['max_floors'] - $result['min_floors'] : ($stop - $result['min_floors']);
$price = $result['base_price'] + $differ * $result['floors_price'] +$result['m1_bundle_fee'];
if($cycle == 2){
$price += $price * $result['maintenance_fee_coefficient'];
}
if($method == "A"){
$price += $result['all_inclusive_fee'];
}
$spec = $_GET['spec'] ?? ''; echo $price;
$person = $_GET['person'] ?? ''; }catch(PDOException $e){
$stop = $_GET['stop'] ?? ''; echo $e->getMessage();
$weight = $_GET['weight'] ?? '';
$speed = $_GET['speed'] ?? '';
$m1 = $_GET['m1'] ?? '';
$method = $_GET['method'] ?? '';
$cycle = $_GET['cycle'] ?? '';
$elevator_type = match($spec){
"MAE100" => "A",
"MAF100" => "B",
"MAM200" => "D",
"MAH100" => "E",
};
$sql_str = "SELECT * FROM maintain_standard_option
WHERE elevator_type=:elevator_type AND min_speed<=:speed AND max_speed>=:speed AND min_persons <= :person AND max_persons >= :person AND is_m1_bundle=:m1
ORDER bY id DESC";
$stmt = $conn->prepare($sql_str);
$stmt->bindParam(':elevator_type', $elevator_type);
$stmt->bindParam(':person', $person);
$stmt->bindParam(':speed', $speed);
$stmt->bindParam(':m1', $m1);
$stmt->execute();
$result = $stmt->fetch(PDO::FETCH_ASSOC);
if(!$result){
echo 0;
exit;
}
$differ = $stop > $result['max_floors'] ? $result['max_floors'] - $result['min_floors'] : ($stop - $result['min_floors']);
$price = $result['base_price'] + $differ * $result['floors_price'] +$result['m1_bundle_fee'];
if($cycle == 2){
$price += $price * $result['maintenance_fee_coefficient'];
} }
if($method == "A"){
$price += $result['all_inclusive_fee'];
}
echo $price;

101
wms/cont/api/postElevatorPricereview.php

@ -31,19 +31,106 @@ $current_date = date("Y-M-d H:i:s");
$total_price = $_POST['total_price']; $total_price = $_POST['total_price'];
$total_sale_price = $_POST['total_sale_price']; $total_sale_price = $_POST['total_sale_price'];
$sql_str = "SELECT status FROM con_maintance_examine_apply WHERE (vol_no, apply_key) = (:vol_no, :apply_key) "; $attatch1 = !empty($_FILES['attatch1']) ? $_FILES['attatch1'] : null;
$attatch2 = !empty($_FILES['attatch2']) ? $_FILES['attatch2'] : null;
$attatch1_src = null;
$attatch2_src = null;
$sql_str = "SELECT status, attatch1, attatch2 FROM con_maintance_examine_apply WHERE (vol_no, apply_key) = (:vol_no, :apply_key) ";
$stmt = $conn->prepare($sql_str); $stmt = $conn->prepare($sql_str);
$stmt->bindParam(':vol_no', $vol_no); $stmt->bindParam(':vol_no', $vol_no);
$stmt->bindParam(':apply_key', $apply_key); $stmt->bindParam(':apply_key', $apply_key);
$stmt->execute(); $stmt->execute();
$contract = $stmt->fetch(PDO::FETCH_ASSOC); $contract = $stmt->fetch(PDO::FETCH_ASSOC);
if(!empty($attatch1)){
$file = $attatch1;
$file_name = $file['name'];
$file_type = $file['type'];
$tmp_name = $file['tmp_name'];
$file_size = $file['size'];
$error = $file['error'];
$rand = strval(rand(1000,1000000));
$now = (string)date('YmdHis');
$imgsrc = 'm'.$now.$rand.$file_name;
$allow_ext = array('jpeg', 'jpg', 'png', 'gif','JPG','JPEG','PNG','pdf','PDF','docx', 'doc', 'DOCX', 'DOC', 'xlsx', 'xls', 'XLSX', 'XLS');
//設定上傳位置
$path = './pricereview-uploads/';
$attatch1_src = $path.$imgsrc;
if (!file_exists($path)) { mkdir($path); }
if ($error == 0) {
$ext = pathinfo($file_name, PATHINFO_EXTENSION);
if (!in_array($ext, $allow_ext)) {
echo "<script>alert('檔案類型不符合,請選擇 jpg、png、excel、word 、pdf檔案');window.history.go(-1);</script>";
exit('檔案類型不符合,請選擇 jpg、png、excel、word 、pdf檔案');
}
$result = move_uploaded_file($tmp_name, '.'.$attatch1_src);
} else {
//這裡表示上傳有錯誤, 匹配錯誤編號顯示對應的訊息
switch ($error) {
case 1: echo '上傳檔案超過 upload_max_filesize 容量最大值'; break;
case 2: echo '上傳檔案超過 post_max_size 總容量最大值'; break;
case 3: echo '檔案只有部份被上傳'; break;
case 4: echo '沒有檔案被上傳'; break;
case 6: echo '找不到主機端暫存檔案的目錄位置'; break;
case 7: echo '檔案寫入失敗'; break;
case 8: echo '上傳檔案被PHP程式中斷,表示主機端系統錯誤'; break;
}
}
}else{
if($contract){
$attatch1_src = $contract['attatch1'];
}
}
if(!empty($attatch2)){
$file = $attatch2;
$file_name = $file['name'];
$file_type = $file['type'];
$tmp_name = $file['tmp_name'];
$file_size = $file['size'];
$error = $file['error'];
$rand = strval(rand(1000,1000000));
$now = (string)date('YmdHis');
$imgsrc = 'm'.$now.$rand.$file_name;
$allow_ext = array('jpeg', 'jpg', 'png', 'gif','JPG','JPEG','PNG','pdf','PDF','docx', 'doc', 'DOCX', 'DOC', 'xlsx', 'xls', 'XLSX', 'XLS');
//設定上傳位置
$path = './pricereview-uploads/';
$attatch2_src = $path.$imgsrc;
if (!file_exists($path)) { mkdir($path); }
if ($error == 0) {
$ext = pathinfo($file_name, PATHINFO_EXTENSION);
if (!in_array($ext, $allow_ext)) {
echo "<script>alert('檔案類型不符合,請選擇 jpg、png、excel、word 、pdf檔案');window.history.go(-1);</script>";
exit('檔案類型不符合,請選擇 jpg、png、excel、word 、pdf檔案');
}
$result = move_uploaded_file($tmp_name, '.'.$attatch2_src);
} else {
//這裡表示上傳有錯誤, 匹配錯誤編號顯示對應的訊息
switch ($error) {
case 1: echo '上傳檔案超過 upload_max_filesize 容量最大值'; break;
case 2: echo '上傳檔案超過 post_max_size 總容量最大值'; break;
case 3: echo '檔案只有部份被上傳'; break;
case 4: echo '沒有檔案被上傳'; break;
case 6: echo '找不到主機端暫存檔案的目錄位置'; break;
case 7: echo '檔案寫入失敗'; break;
case 8: echo '上傳檔案被PHP程式中斷,表示主機端系統錯誤'; break;
}
}
}else{
if($contract){
$attatch2_src = $contract['attatch2'];
}
}
$conn->beginTransaction(); $conn->beginTransaction();
try{ try{
if(!$contract){ if(!$contract){
$sql_str = "INSERT INTO con_maintance_examine_apply (apply_key, vol_no, customer, address, case_name ,brand, num, salesman, maintain_kind, contract_begin_date, contract_end_date, contract_kind, payment_kind, progress_remark, service_fee, total_price, total_sale_price, penalty, deposit_rate, keep_rate, warranty_rate, memo, status, creater, create_at) $sql_str = "INSERT INTO con_maintance_examine_apply (apply_key, vol_no, customer, address, case_name ,brand, num, salesman, maintain_kind, contract_begin_date, contract_end_date, contract_kind, payment_kind, progress_remark, service_fee, total_price, total_sale_price, penalty, deposit_rate, keep_rate, warranty_rate, memo, status, attatch1, attatch2, creater, create_at)
VALUES (:apply_key, :vol_no, :customer, :address, :case_name ,:brand, :num, :salesman, :maintain_kind, :contract_begin_date, :contract_end_date, :contract_kind, :payment_kind, :progress_remark, :service_fee, :total_price, :total_sale_price, :penalty, :deposit_rate, :keep_rate, :warranty_rate, :memo, :status, :creater, :create_at)"; VALUES (:apply_key, :vol_no, :customer, :address, :case_name ,:brand, :num, :salesman, :maintain_kind, :contract_begin_date, :contract_end_date, :contract_kind, :payment_kind, :progress_remark, :service_fee, :total_price, :total_sale_price, :penalty, :deposit_rate, :keep_rate, :warranty_rate, :memo, :status, :attatch1, :attatch2, :creater, :create_at)";
$stmt = $conn->prepare($sql_str); $stmt = $conn->prepare($sql_str);
$stmt->bindParam(':apply_key', $apply_key); $stmt->bindParam(':apply_key', $apply_key);
$stmt->bindParam(':vol_no', $vol_no); $stmt->bindParam(':vol_no', $vol_no);
@ -68,6 +155,8 @@ try{
$stmt->bindParam(':warranty_rate', $warranty_rate); $stmt->bindParam(':warranty_rate', $warranty_rate);
$stmt->bindParam(':memo', $remark); $stmt->bindParam(':memo', $remark);
$stmt->bindParam(':status', $status); $stmt->bindParam(':status', $status);
$stmt->bindParam(':attatch1', $attatch1_src);
$stmt->bindParam(':attatch2', $attatch2_src);
$stmt->bindParam(':creater', $creater); $stmt->bindParam(':creater', $creater);
$stmt->bindParam(':create_at', $current_date); $stmt->bindParam(':create_at', $current_date);
$stmt->execute(); $stmt->execute();
@ -164,6 +253,8 @@ try{
memo=:memo, memo=:memo,
brand=:brand, brand=:brand,
status=:status, status=:status,
attatch1=:attatch1,
attatch2=:attatch2,
updated_at=:updated_at, updated_at=:updated_at,
progress_remark=:progress_remark progress_remark=:progress_remark
WHERE apply_key=:apply_key AND vol_no=:vol_no"; WHERE apply_key=:apply_key AND vol_no=:vol_no";
@ -188,6 +279,8 @@ try{
$stmt->bindParam(':memo', $remark); $stmt->bindParam(':memo', $remark);
$stmt->bindParam(':brand', $brand); $stmt->bindParam(':brand', $brand);
$stmt->bindParam(':status', $status); $stmt->bindParam(':status', $status);
$stmt->bindParam(':attatch1', $attatch1_src);
$stmt->bindParam(':attatch2', $attatch2_src);
$stmt->bindParam(':updated_at', $current_date); $stmt->bindParam(':updated_at', $current_date);
$stmt->execute(); $stmt->execute();
@ -469,7 +562,7 @@ try{
$permissions = [$manager]; $permissions = [$manager];
$creater = "system"; $creater = "system";
$create_at = $current_date; $create_at = $current_date;
$url = "cont/pricereviewCheck.php?id=" . $apply_key; $url = "cont/pricereviewCheck.php?apply_key=" . $apply_key;
sendSystemNotice($kind, $related_id, $title, $content, $havaread, $permissions, $creater, $create_at, $url); sendSystemNotice($kind, $related_id, $title, $content, $havaread, $permissions, $creater, $create_at, $url);
} }
echo "success"; echo "success";

127
wms/cont/api/postPricereviewSign.php

@ -0,0 +1,127 @@
<?php
require_once('../../mkt/conn.php');
date_default_timezone_set("Asia/Taipei");
$sign = $_POST['sign'];
$mid = $_POST['mid'];
$result = $_POST['result'];
$reviewcomment = $_POST['reviewcomment'];
$sign_id = $_POST['currentSignId'];
$token = $_POST['token'];
$form_key = $_POST['form_key'];
$signOff = '';
$updated_at = date("Y-m-d H:i:s");
if($result == 'YY' ){
$signOff = 'YY';
}elseif($result == 'YN'){
$signOff = 'N';
}elseif($result == 'YS'){
$signOff = 'Y';
}
try{
$user_id = $_POST['user_id'];
$sign_result = $user_id . "," . $signOff . "," . date("Y-m-d H:i:s");
$sql_str = "UPDATE pricereview_maintain_sign SET sign{$sign}=:sign, sign{$sign}_note = :reviewcomment WHERE mid = :mid AND id = :sign_id";
$stmt = $conn->prepare($sql_str);
$stmt->bindParam(':sign', $sign_result);
$stmt->bindParam(':mid', $mid);
$stmt->bindParam(':reviewcomment', $reviewcomment);
$stmt->bindParam(':sign_id', $sign_id);
$stmt->execute();
if($sign == 3){
$sql_str = "UPDATE con_maintance_examine_apply SET status=:status, updated_at=:updated_at WHERE apply_key = :apply_key ";
$stmt = $conn->prepare($sql_str);
$stmt->bindParam(':status', $result);
$stmt->bindParam(':apply_key', $mid);
$stmt->bindParam(':updated_at', $updated_at);
$stmt->execute();
}else{
$sql_str = "UPDATE con_maintance_examine_apply SET status=:status WHERE apply_key = :apply_key ";
$stmt = $conn->prepare($sql_str);
$stmt->bindParam(':status', $result);
$stmt->bindParam(':apply_key', $mid);
$stmt->execute();
}
include_once "./postSystemNotice.php";
$sql_str = "SELECT * FROM con_maintance_examine_apply WHERE apply_key = :apply_key ORDER BY create_at DESC LIMIT 1";
$stmt = $conn->prepare($sql_str);
$stmt->bindParam(':apply_key', $mid);
$stmt->execute();
$contract = $stmt->fetch(PDO::FETCH_ASSOC);
$ekind = "保養";
$sql_str = "SELECT * FROM pricereview_maintain_sign WHERE mid = :mid AND id = :sign_id";
$stmt = $conn->prepare($sql_str);
$stmt->bindParam(':mid', $mid);
$stmt->bindParam(':sign_id', $sign_id);
$stmt->execute();
$currentsign = $stmt->fetch(PDO::FETCH_ASSOC);
$permissions = [];
$content = "";
$url = "cont/pricereviewCheck.php?apply_key=" . $mid;
if($signOff == "YY"){
if($currentsign['sign1']!=NULL){ $permissions[] = explode(",", $currentsign['sign1'])[0] ; }
if($currentsign['sign2']!=NULL){ $permissions[] = explode(",", $currentsign['sign2'])[0] ; }
if($currentsign['sign3']!=NULL){ $permissions[] = explode(",", $currentsign['sign3'])[0] ; }
if($currentsign['sign4']!=NULL){ $permissions[] = explode(",", $currentsign['sign4'])[0] ; }
$permissions[] = $contract['salesman'];
$title = $ekind . "價審結案通知(".$contract['vol_no']."," .$contract['customer']. ")";
$content = "狀態:結案同意<br>";
$current_assigner = "00000";
}elseif($signOff == "Y"){
if($sign == 1 || $sign == 2 || $sign == 3){
$signer = $currentsign['sign'.($sign+1)];
if($signer == NULL){
$signer = $currentsign['sign'.($sign+2)];
}
$permissions[] = explode(",", $signer)[0];
$current_assigner = explode(",", $signer)[0];
$title = $ekind . "價審待簽通知(".$contract['vol_no']."," .$contract['customer']. ")";
$content = "狀態:待簽核<br>";
}
}elseif($signOff == "N"){
$signer = $contract['salesman'];
$permissions[] = $signer;
$title = $ekind . "價審退回通知(".$contract['vol_no']."," .$contract['customer']. ")";
$content = "狀態:退回<br>";
$url = "cont/pricereviewCreate.php?vol_no=" . $vol_no;
$current_assigner = "00000";
}
$kind = 1;
$related_id = $mid;
$content .= "合約號:".$contract['vol_no'] . "<br>";
$content .= "客戶名稱:" . $contract['customer'] . "<br>";
$content .= "案件名稱:" . $contract['case_name'] . "<br>";
$content .= "時間" . date("Y-m-d H:i:s");
// $content .= "<a href='./mkt/pricreviewCheck.php?id=".$mid.">前往查看</a>";
$havaread = null;
$creater = "system";
$create_at = date("Y-m-d H:i:s");
sendSystemNotice($kind, $related_id, $title, $content, $havaread, $permissions, $creater, $create_at, $url);
//待簽通知
if($form_key == null){
$sql_str = "SELECT form_key FROM flow WHERE form_id = :form_id AND system_id = 'prm' AND flow_id='prm04'";
$stmt = $conn->prepare($sql_str);
$stmt->bindParam(':form_id', $mid);
$stmt->execute();
$form_key = $stmt->fetch(PDO::FETCH_ASSOC)['form_key'];
}
include_once "./postFlow.php";
if($signOff == "YY") $flow_code = "Z";
if($signOff == "Y") $flow_code = "B";
if($signOff == "N") $flow_code = "A";
if($form_key == null){
throw new PDOException("form_key 不存在!");
}
createFlow($mid, $current_assigner, $flow_code, $ekind, $form_key);
echo 1;
}catch(PDOException $e){
echo $e->getMessage();
}

49
wms/cont/conn.php

@ -0,0 +1,49 @@
<?php
$envFile = __DIR__ . '/.env'; // .env 文件的路径
if (file_exists($envFile)) {
$lines = file($envFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
if ($lines !== false) {
foreach ($lines as $line) {
list($key, $value) = explode('=', $line, 2);
$key = trim($key);
$value = trim($value);
// 设置环境变量
putenv("$key=$value");
}
}
}
$db_hostname = getenv('DB_HOST'); //資料庫主機名稱
$db_username = getenv('DB_USERNAME'); //登入資料庫的管理者的帳號
$db_password = getenv('DB_PASSWORD'); //登入密碼
$db_name = getenv('DB_DATABASE'); //使用的資料庫
$db_charset = 'utf8'; //設定字元編碼
$db_hostname = 'localhost'; //資料庫主機名稱
$db_username = 'root'; //登入資料庫的管理者的帳號
$db_password = ''; //登入密碼
$db_name = 'appwms'; //使用的資料庫
$db_charset = 'utf8'; //設定字元編碼
//建立PDO的指定工作
$dsn = "mysql:host=$db_hostname;dbname=$db_name;charset=$db_charset";
try{
//使用PDO連接到MySQL資料庫,建立PDO物件
$conn = new PDO($dsn, $db_username, $db_password);
//當錯誤發生時會將錯誤資訊放到一個類物件裡(PDOException)
//PDO異常處理,PDO::ATTR_ERRMODE,有以下三種值的設定
//PDO::ERRMODE_SILENT: 預設模式,不主動報錯,需要以$conn->errorInfo()的形式獲取錯誤資訊
//PDO::ERRMODE_WARNING: 引發 E_WARNING 錯誤,主動報錯
//PDO::ERRMODE_EXCEPTION: 主動抛出 exceptions 異常,需要以try{}cath(){}輸出錯誤資訊。
//設定主動以警告的形式報錯
$conn->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION);
//如果連接錯誤,將抛出一個PDOException異常對象
}
catch ( PDOException $e ){
//如果連結資料庫失敗則顯示錯誤訊並停止本頁的工作
die("ERROR!!!: ". $e->getMessage());
}
//$conn = null; //關閉資料庫的連線

2
wms/cont/js/axios.min.js

File diff suppressed because one or more lines are too long

141
wms/cont/js/pricereviewAlpine.js

@ -61,6 +61,8 @@ const pricereviewCreate = ()=>{
deposit_rate: deposit_rate, deposit_rate: deposit_rate,
keep_rate: keep_rate, keep_rate: keep_rate,
warranty_rate: warranty_rate, warranty_rate: warranty_rate,
attatch1:'',
attatch2:'',
openCreateElevatorModal(){ openCreateElevatorModal(){
this.modalShow.elevator = true; this.modalShow.elevator = true;
body.style.overflow = 'hidden'; body.style.overflow = 'hidden';
@ -345,6 +347,8 @@ const pricereviewCreate = ()=>{
form.append('warranty_rate', this.warranty_rate); form.append('warranty_rate', this.warranty_rate);
form.append('remark', this.remark); form.append('remark', this.remark);
form.append('creater', user_id); form.append('creater', user_id);
form.append('attatch1', this.attatch1);
form.append('attatch2', this.attatch2);
form.append('pay_method', this.pay_method); form.append('pay_method', this.pay_method);
form.append('status', 'Y1'); form.append('status', 'Y1');
@ -384,6 +388,8 @@ const pricereviewCreate = ()=>{
form.append('warranty_rate', this.warranty_rate); form.append('warranty_rate', this.warranty_rate);
form.append('remark', this.remark); form.append('remark', this.remark);
form.append('creater', user_id); form.append('creater', user_id);
form.append('attatch1', this.attatch1);
form.append('attatch2', this.attatch2);
form.append('pay_method', this.pay_method); form.append('pay_method', this.pay_method);
form.append('status', 'YS'); form.append('status', 'YS');
@ -398,7 +404,7 @@ const pricereviewCreate = ()=>{
if(res.data == 'success'){ if(res.data == 'success'){
alert("送審成功!"); alert("送審成功!");
// window.location.reload(); // window.location.reload();
// window.location.href = './pricereview-index.php?' + token; window.location.href = '../index.php?' + token;
} }
}) })
}, },
@ -407,6 +413,14 @@ const pricereviewCreate = ()=>{
const res = await axios.get('./api/getUsername.php', {params: {user_id: user_id}}) const res = await axios.get('./api/getUsername.php', {params: {user_id: user_id}})
return res.data ; return res.data ;
}, },
uploadFiles(e, attatch){
if(attatch == 1){
this.attatch1 = e.target.files[0]
}
if(attatch == 2){
this.attatch2 = e.target.files[0]
}
}
} }
} }
@ -414,7 +428,130 @@ const pricereviewCheck = ()=>{
return { return {
init(){ init(){
console.log(123); console.log(123);
this.elevators = elevators;
this.otherOptions = otherOptions;
this.elevators.forEach(el=>{
el.otherOptions = []
el.otherOptionsTotalPrice = 0;
})
this.elevators.forEach((elevator, idx)=>{
this.elevators_total_price += elevator.stand_price*elevator.maintain_months
this.otherOptions.forEach(option=>{
if(option.option_relate_spec == elevator.item_no){
elevator.otherOptionsTotalPrice += option.item_unit_price * option.item_qty
this.elevators[idx].otherOptions.push({
'id': option.id,
'item_spec': option.item_spec,
'item_unit_price': option.item_unit_price,
'item_qty': option.item_qty,
'mi': Math.round(option.item_unit_price),
})
}
})
})
if(payment_kind == "A40006"){
this.payment_kind = "年繳";
}else if(payment_kind == "A40007"){
this.payment_kind = "季繳";
}else if(payment_kind == "A40003"){
this.payment_kind = "月繳";
}else if(payment_kind == "A40004"){
this.payment_kind = "雙月繳";
}else if(payment_kind == "A40005"){
this.payment_kind = "半年繳";
}
this.sign1 = this.getUsername(sign1)
this.sign2 = this.getUsername(sign2)
this.sign3 = this.getUsername(sign3)
this.sign4 = this.getUsername(sign4)
},
user_id:user_id,
apply_key:apply_key,
contractno: vol_no,
salesman: salesman,
customer: customer,
total_price: total_price,
total_sale_price: Number(total_sale_price),
elevators: [],
otherOptions:[],
elevators_total_price:0,
payment_kind: payment_kind,
memo: memo,
address: address,
case_name: case_name,
maintain_months: maintain_months,
service_fee: service_fee,
penalty: penalty,
deposit_rate: deposit_rate,
keep_rate: keep_rate,
warranty_rate: warranty_rate,
contract_begin_date: contract_begin_date,
contract_end_date: contract_end_date,
sign1:'',
sign2:'',
sign3:'',
sign4:'',
reviewcomment:'',
get single_amount(){
console.log(this.payment_kind);
let month_amount = Number(this.total_sale_price) / Number(this.maintain_months);
let pay_times = 0;
let amount_times = 0;
if(payment_kind == "A40006"){
amount_times = Math.round(month_amount*12)
pay_times = this.maintain_months / 12
}
if(payment_kind == "A40007"){
amount_times = Math.round(month_amount*3)
pay_times = this.maintain_months / 3
}
if(payment_kind == "A40003"){
amount_times = Math.round(month_amount)
pay_times = this.maintain_months / 1
}
if(payment_kind == "A40004"){
amount_times = Math.round(month_amount*2)
pay_times = this.maintain_months / 2
}
if(payment_kind == "A40005"){
amount_times = Math.round(month_amount*6)
pay_times = this.maintain_months / 6
}
return {
'amount_times': amount_times,
'pay_times': pay_times
}
},
get otherOptionsTotalPrice(){
return this.otherOptions.reduce((total, option) => {
return total + (option.item_qty * option.item_unit_price);
}, 0);
},
async getUsername(user_id){
if(user_id == '') return '---'
const res = await axios.get('./api/getUsername.php', {params: {user_id: user_id}})
return res.data ;
},
check(sign, status, user_id = this.user_id ){
console.log(sign);
const form = new FormData();
form.append('sign', sign);
form.append('mid', this.apply_key);
form.append('result', status);
form.append('user_id', user_id);
form.append('reviewcomment', this.reviewcomment);
form.append('currentSignId', currentSignId);
form.append('token', token);
form.append('form_key', form_key);
axios.post('./api/postPricereviewSign.php', form).then(res=>{
console.log(res.data);
if(res.data == 1){
alert("簽核成功!");
window.location.reload()
}
})
}, },
elevators: elevators,
} }
} }

BIN
wms/cont/pricereview-uploads/m20240312185746914784kobe.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

BIN
wms/cont/pricereview-uploads/m20240312185839177524curry.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

BIN
wms/cont/pricereview-uploads/m202403121858392743201.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

BIN
wms/cont/pricereview-uploads/m202403121903019998611074565_507619045984793_769543820_o.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 105 KiB

BIN
wms/cont/pricereview-uploads/m202403121903566135334OlaIEQjXAZDasK9Pd1Jxb.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

BIN
wms/cont/pricereview-uploads/m202403121905046665914OlaIEQjXAZDasK9Pd1Jxb.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

BIN
wms/cont/pricereview-uploads/m202403121907016007094OlaIEQjXAZDasK9Pd1Jxb.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

BIN
wms/cont/pricereview-uploads/m202403121907512357761048100_507643175982380_1454281158_o.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 256 KiB

BIN
wms/cont/pricereview-uploads/m202403121907573946501074565_507619045984793_769543820_o.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 105 KiB

BIN
wms/cont/pricereview-uploads/m20240312191226166002431968299_122131716218151547_1355033508899312082_n.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 614 KiB

BIN
wms/cont/pricereview-uploads/m202403121912261887281074565_507619045984793_769543820_o.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 105 KiB

BIN
wms/cont/pricereview-uploads/m202403121914471012954OlaIEQjXAZDasK9Pd1Jxb.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

BIN
wms/cont/pricereview-uploads/m202403121914476694521705368342957.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

BIN
wms/cont/pricereview-uploads/m20240312192346343561kobe.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

BIN
wms/cont/pricereview-uploads/m20240312192346755323curry.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

559
wms/cont/pricereviewCheck.php

@ -37,21 +37,246 @@ $stmt->bindParam(':apply_key', $apply_key);
$stmt->execute(); $stmt->execute();
$elevators = $stmt->fetchAll(PDO::FETCH_ASSOC); $elevators = $stmt->fetchAll(PDO::FETCH_ASSOC);
$sql_str = "SELECT * FROM pricereview_maintain_item WHERE (mid, item_group) = (:apply_key, 'E') ORDER BY item_no ASC";
$stmt = $conn->prepare($sql_str);
$stmt->bindParam(':apply_key', $apply_key);
$stmt->execute();
$otherOptions = $stmt->fetchAll(PDO::FETCH_ASSOC);
$contract_begin_date = new DateTime($contract['contract_begin_date']);
$contract_end_date = new DateTime($contract['contract_end_date']);
// 計算差異
$interval = $contract_begin_date->diff($contract_end_date);
// 獲取總月數
$contract_months = $interval->m + 12 * $interval->y + 1;
if($contract_months <= 0){ $contract_months = 1;}
$sql_str = "SELECT * FROM pricereview_maintain_sign WHERE mid = :apply_key ORDER BY id ASC";
$stmt = $conn->prepare($sql_str);
$stmt->bindParam(':apply_key', $apply_key);
$stmt->execute();
$sign_all = $stmt->fetchAll(PDO::FETCH_ASSOC);
$sign = $sign_all ? $sign_all[count($sign_all)-1] : [];
$currentSigner = '';
$currentSign = 0;
$currentSignId = $sign['id'] ?? '';
$historySign = [];
if($sign_all){
foreach($sign_all as $key=>$sign_item){
if($key == count($sign_all)-1){
break;
}
$signer1 = getSignerName(explode(",", $sign_item['sign1'])[0]);
$sign1_result = explode(",", $sign_item['sign1'])[1];
$sign1_date = explode(",", $sign_item['sign1'])[2];
$sign1_note = $sign_item['sign1_note'];
if($sign1_result == "Y"){
$sign1_result = "同意";
}elseif($sign1_result == "YY"){
$sign1_result = "結案同意";
}elseif($sign1_result == "N"){
$sign1_result = "不同意";
}else{
$sign1_result = "---";
}
if(!empty($sign_item['sign2'])){
$signer2 = getSignerName(explode(",", $sign_item['sign2'])[0]);
$sign2_result = explode(",", $sign_item['sign2'])[1];
$sign2_note = $sign_item['sign2_note'];
$sign2_date = explode(",", $sign_item['sign2'])[2];
if($sign2_result == "Y"){
$sign2_result = "同意";
}elseif($sign2_result == "YY"){
$sign2_result = "結案同意";
}elseif($sign2_result == "N"){
$sign2_result = "不同意";
}else{
$sign2_result = "---";
}
}else{
$signer2 = "---";
$sign2_result = "---";
$sign2_note = "---";
$sign2_date = "---";
$sign2_result = "---";
}
$signer3 = getSignerName(explode(",", $sign_item['sign3'])[0]);
$sign3_result = explode(",", $sign_item['sign3'])[1];
$sign3_note = $sign_item['sign3_note'];
$sign3_date = explode(",", $sign_item['sign3'])[2];
if($sign3_result == "Y"){
$sign3_result = "同意";
}elseif($sign3_result == "YY"){
$sign3_result = "結案同意";
}elseif($sign3_result == "N"){
$sign3_result = "不同意";
}else{
$sign3_result = "---";
}
if(!empty($sign_item['sign4'])){
$signer4 = getSignerName(explode(",", $sign_item['sign4'])[0]);
$sign4_result = explode(",", $sign_item['sign4'])[1];
$sign4_note = $sign_item['sign4_note'];
$sign4_date = explode(",", $sign_item['sign4'])[2];
if($sign4_result == "Y"){
$sign4_result = "同意";
}elseif($sign4_result == "YY"){
$sign4_result = "結案同意";
}elseif($sign4_result == "N"){
$sign4_result = "不同意";
}else{
$sign4_result = "---";
}
}else{
$signer4 = "---";
$sign4_result = "---";
$sign4_note = "---";
$sign4_date = "---";
$sign4_result = "---";
}
$historySign[] = [
'signer1'=>$signer1,
'sign1_result'=> $sign1_result,
'sign1_note'=>$sign1_note,
'sign1_date'=>$sign1_date,
'signer2'=>$signer2,
'sign2_result'=> $sign2_result,
'sign2_note'=>$sign2_note,
'sign2_date'=>$sign2_date,
'signer3'=>$signer3,
'sign3_result'=> $sign3_result,
'sign3_note'=>$sign3_note,
'sign3_date'=>$sign3_date,
'signer4'=>$signer4,
'sign4_result'=> $sign4_result,
'sign4_note'=>$sign4_note,
'sign4_date'=>$sign4_date,
];
}
}
if($sign){
// Y:已同意 N:不同意 W:待簽
// sign1 => 處長, sign2 => 業務承辦人, sign3 => 協理, sign4 => 總經理
if($sign['sign1'] == NULL || $sign['sign1'] ==''){
$sign1 = NULL;
}else{
if( explode(",", $sign['sign1'])[1] != ''){
$sign1 = explode(",", $sign['sign1'])[1] == 'Y' ? 'Y' : 'N';
}else{
$sign1 = 'W';
}
}
if($sign['sign2'] == NULL || $sign['sign2'] ==''){
$sign2 = NULL;
}else{
if( explode(",", $sign['sign2'])[1] != ''){
$sign2 = explode(",", $sign['sign2'])[1] == 'Y' ? 'Y' : 'N';
}else{
$sign2 = 'W';
}
}
if($sign['sign3'] == NULL || $sign['sign3'] ==''){
$sign3 = NULL;
}else{
if( explode(",", $sign['sign3'])[1] != ''){
// $sign3 = explode(",", $sign['sign3'])[1] == 'Y' ? 'Y' : 'N';
if(explode(",", $sign['sign3'])[1] == 'YY') $sign3 = 'YY';
if(explode(",", $sign['sign3'])[1] == 'Y') $sign3 = 'Y';
if(explode(",", $sign['sign3'])[1] == 'N') $sign3 = 'N';
}else{
$sign3 = 'W';
}
}
if($sign['sign4'] == NULL || $sign['sign4'] ==''){
$sign4 = NULL;
}else{
if( explode(",", $sign['sign4'])[1] != ''){
// $sign4 = explode(",", $sign['sign4'])[1] == 'Y' ? 'Y' : 'N';
if(explode(",", $sign['sign4'])[1] == 'YY') $sign4 = 'YY';
if(explode(",", $sign['sign4'])[1] == 'Y') $sign4 = 'Y';
if(explode(",", $sign['sign4'])[1] == 'N') $sign4 = 'N';
}else{
$sign4 = 'W';
}
}
if($sign1 == 'W'){
$currentSigner = explode(",", $sign['sign1'])[0];
$currentSign = 1;
}elseif($sign2 == 'W'){
$currentSigner = explode(",", $sign['sign2'])[0];
$currentSign = 2;
}elseif($sign3 == 'W'){
$currentSigner = explode(",", $sign['sign3'])[0];
$currentSign = 3;
}elseif($sign4 == 'W'){
$currentSigner = explode(",", $sign['sign4'])[0];
$currentSign = 4;
}
}else{
$sign1 = NULL;
$sign2 = NULL;
$sign3 = NULL;
$sign4 = NULL;
}
$permissions = false; $permissions = false;
//開啟工務權限 //開啟工務權限
if($user_id == "M0174" || $user_id == "M0008" || $user_id == "M0012"){ if($user_id == "M0174" || $user_id == "M0008" || $user_id == "M0012" || $user_id == "M0007"){
$permissions = true; $permissions = true;
} }
function getSignerName($signer){
if($signer == null || $signer == '') return "---";
global $conn;
$sql_str = "SELECT name FROM account WHERE accountid = :signer";
$stmt = $conn->prepare($sql_str);
$stmt->bindParam(':signer', $signer);
$stmt->execute();
$signer = $stmt->fetch(PDO::FETCH_ASSOC);
return $signer['name'];
}
?> ?>
<link rel="stylesheet" href="./css/pricereview.css"> <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 src="./js/axios.min.js" integrity="sha512-aoTNnqZcT8B4AmeCFmiSnDlc4Nj/KPaZyB5G7JnOnUEkdNpCZs1LCankiYi01sLTyWy+m2P+W4XM+BuQ3Q4/Dg==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script defer src="./js/alpinejs/cdn.min.js"></script> <script defer src="./js/alpinejs/cdn.min.js"></script>
<script src="./js/pricereviewAlpine.js"></script> <script src="./js/pricereviewAlpine.js"></script>
<div id="pricereviewCheck" x-data=pricereviewCheck> <div id="pricereviewCheck" x-data=pricereviewCheck>
<div class="container"> <div class="container">
<table class="table customerinfo-table" >
<tbody>
<tr>
<th>價審單號</th>
<th>卷號</th>
<th>營業員</th>
<th>客戶名稱</th>
<th>牌價總額(A)</th>
<th>售價總額(B)</th>
<th >破價總額(B-A)</th>
</tr>
<tr>
<td><input type="text" class="form-control" x-model="apply_key" disabled /></td>
<td><input type="text" class="form-control" x-model="contractno" disabled /></td>
<td><input type="text" class="form-control" x-model="salesman" disabled /></td>
<td><input type="text" class="form-control" x-model="customer" disabled /></td>
<td><input type="text" class="form-control" x-model="Number(total_price).toLocaleString()" disabled /></td>
<td><input type="text" class="form-control" x-model="Number(total_sale_price).toLocaleString()" disabled /></td>
<td><input type="text" class="form-control" x-model="(total_sale_price - total_price).toLocaleString()" disabled /></td>
</tr>
</tbody>
</table>
<table class="table mi-table" border=1> <table class="table mi-table" border=1>
<thead> <thead>
<tr> <tr>
@ -64,12 +289,12 @@ if($user_id == "M0174" || $user_id == "M0008" || $user_id == "M0012"){
<th>項次</th> <th>項次</th>
<th>規格</th> <th>規格</th>
<th>單價(月)</th> <th>單價(月)</th>
<th>月數</th> <th>保養月數</th>
<th>總價</th> <th>總價</th>
<?php if($permissions): ?> <?php if($permissions): ?>
<th>業務部MI</th> <th>成本(月)</th>
<th>售價(月)</th> <th>售價(月)</th>
<th>利潤</th> <th>利潤(月)</th>
<th>利潤率(%)</th> <th>利潤率(%)</th>
<?php endif; ?> <?php endif; ?>
</tr> </tr>
@ -78,17 +303,17 @@ if($user_id == "M0174" || $user_id == "M0008" || $user_id == "M0012"){
<tbody> <tbody>
<tr> <tr>
<td x-html="'<b>' + elevator.item_no + '</b>'"></td> <td x-html="'<b>' + elevator.item_no + '</b>'"></td>
<td > <a href="javascript:;" x-text="elevator.spec"></a></td> <td > <a href="javascript:;" x-text="elevator.spec + '-' + elevator.persons + '*' + elevator.stop + '-' + elevator.speed"></a></td>
<td><input type="text" class="form-control" x-model="Number(elevator.stand_price).toLocaleString()" disabled /></td> <td><input type="text" class="form-control" x-model="Number(elevator.stand_price).toLocaleString()" disabled /></td>
<td><input type="text" class="form-control" x-model="elevator.maintain_months" disabled /></td> <td><input type="text" class="form-control" x-model="elevator.maintain_months" disabled /></td>
<td><input type="text" class="form-control" x-model="Number(elevator.stand_price * elevator.maintain_months).toLocaleString()" disabled /></td> <td><input type="text" class="form-control" x-model="Number(elevator.stand_price * elevator.maintain_months).toLocaleString()" disabled /></td>
<?php if($permissions): ?> <?php if($permissions): ?>
<td> <td>
<input x-show="true" type="text" class="form-control" value="找不到此規格"> <input x-show="true" type="text" class="form-control" x-model="Number(elevator.stand_price).toLocaleString()">
</td> </td>
<td><input type="text" class="form-control" x-model="(Number(elevator.contract_price)).toLocaleString()" disabled /></td> <td><input type="text" class="form-control" x-model="(Number(elevator.contract_price)).toLocaleString()" disabled /></td>
<td><input type="text" class="form-control" x-model="(Number(elevator.contract_price) - Number(elevator.stand_price)).toLocaleString()" disabled /></td> <td><input type="text" class="form-control" x-model="(Number(elevator.contract_price) - Number(elevator.stand_price)).toLocaleString()" disabled /></td>
<td><input type="text" class="form-control" x-model="Math.round((Number(elevator.contract_price) - Number(elevator.stand_price) ) / Number(elevator.stand_price)) *100 + '%'" disabled /></td> <td><input type="text" class="form-control" x-model="((Number(elevator.contract_price) - Number(elevator.stand_price) ) / Number(elevator.stand_price) * 100).toFixed(1) + '%'" disabled /></td>
<?php endif; ?> <?php endif; ?>
</tr> </tr>
<?php if($permissions): ?> <?php if($permissions): ?>
@ -96,14 +321,17 @@ if($user_id == "M0174" || $user_id == "M0008" || $user_id == "M0012"){
<td colspan=5></td> <td colspan=5></td>
<td colspan=4 style="max-width:400px"> <td colspan=4 style="max-width:400px">
<div class="mi-info"> <div class="mi-info">
<span>電梯設備</span> <span>電梯規格</span>
<ul>
<li x-html="elevator.spec + '*'+elevator.maintain_months+':<b>' + (elevator.stand_price*elevator.maintain_months).toLocaleString() + '</b>'"></li>
</ul>
<span>除外項目</span> <span>除外項目</span>
<ul> <ul>
<template x-for="option in elevator.options"> <template x-for="option in elevator.otherOptions">
<li x-html="option.item_spec + (option.option_memo ? ('(' + option.option_memo + ')') : '') + '*' + option.item_qty + ':<b>' + (option.mi * option.item_qty).toLocaleString() + '</b>'"></li> <li x-html="option.item_spec + (option.option_memo ? ('(' + option.option_memo + ')') : '') + '*' + option.item_qty + ':<b>' + (option.mi * option.item_qty).toLocaleString() + '</b>'"></li>
</template> </template>
</ul> </ul>
<p x-html="'以上合計:<b>' + (Math.round(Number(elevator.optionsTotalPrice) + Number(elevator.otherOptionsTotalPrice) + Number(elevator.maintainOptionsTotalPrice)) + Number(elevator.demolishOptionsTotalPrice)).toLocaleString() + '</b>'"></p> <p x-html="'以上合計:<b>' + Math.round(Number(elevator.otherOptionsTotalPrice) + Number(elevator.stand_price*elevator.maintain_months)).toLocaleString() + '</b>'"></p>
</div> </div>
</td> </td>
@ -117,10 +345,317 @@ if($user_id == "M0174" || $user_id == "M0008" || $user_id == "M0012"){
<td><input type="text" class="form-control" x-model="elevators_total_price.toLocaleString()" disabled></td> <td><input type="text" class="form-control" x-model="elevators_total_price.toLocaleString()" disabled></td>
</tr> </tr>
</table> </table>
<table class="table mi-table" border=1>
<thead>
<tr>
<th colspan=8>除外項目</th>
</tr>
<tr>
<th>項次</th>
<th>詢價單號</th>
<th>名稱</th>
<th>單價</th>
<th>數量</th>
<th>複價</th>
<th>所屬電梯項次</th>
</tr>
</thead>
<tbody>
<template x-for="option in otherOptions">
<tr>
<td x-html="'<b>' + option.item_no + '</b>'"></td>
<td x-text="option.price_id"></td>
<td><input type="text" class="form-control" x-model="option.item_spec" disabled /></td>
<td><input type="text" class="form-control" x-model="Number(option.item_unit_price).toLocaleString()" disabled /></td>
<td><input type="text" class="form-control" x-model="option.item_qty" disabled /></td>
<td><input type="text" class="form-control" x-model="(option.item_unit_price * option.item_qty).toLocaleString()" disabled /></td>
<td x-text="option.option_relate_spec"></td>
</tr>
</template>
<template x-if="otherOptions.length > 0">
<tr>
<td colspan=5>小計</td>
<td >
<input type="text" x-model="otherOptionsTotalPrice.toLocaleString()" disabled class="form-control">
</td>
<td colspan=3></td>
</tr>
</template>
</tbody>
</table>
<table class="table mi-table" border=1 style="width:800px">
<thead>
<tr>
<th style="width:100px">付款方式</th>
<th>金額(次)</th>
<th>付款次數</th>
<th>總付款金額</th>
</tr>
</thead>
<tbody>
<tr>
<td x-text="payment_kind"></td>
<td><input type="text" class="form-control" x-model="single_amount.amount_times.toLocaleString()" disabled /></td>
<td><input type="text" class="form-control" :value="single_amount.pay_times.toLocaleString()" disabled /></td>
<td><input type="text" class="form-control" x-model="total_sale_price.toLocaleString()" disabled /></td>
</tr>
</tbody>
</table>
<table class="table customerinfo-table" >
<tbody>
<tr>
<th>卷號</th>
<th>營業員</th>
<th>客戶名稱</th>
<th>案件名稱</th>
<th colspan="2">地址</th>
</tr>
<tr>
<td><input type="text" class="form-control" x-model="contractno" disabled /></td>
<td><input type="text" class="form-control" x-model="salesman" disabled /></td>
<td><input type="text" class="form-control" x-model="customer" disabled /></td>
<td><input type="text" class="form-control" x-model="case_name" disabled /></td>
<td colspan="2"><input type="text" class="form-control" x-model="address" disabled /></td>
</tr>
<tr>
<th>牌價總額(A)</th>
<th>售價總額(B)</th>
<th>破價總額(B-A)</th>
<th>總台數</th>
<th>服務費(介紹費)</th>
<th>價率%(B/A)</th>
</tr>
<tr>
<td><input type="text" class="form-control" x-model="Number(total_price).toLocaleString()" disabled /></td>
<td><input type="text" class="form-control" x-model="Number(total_sale_price).toLocaleString()" disabled /></td>
<td><input type="text" class="form-control" x-model="(total_sale_price - total_price).toLocaleString()" disabled /></td>
<td><input type="text" class="form-control" x-model="elevators.length" disabled /></td>
<td><input type="text" class="form-control" x-model="service_fee.toLocaleString()" disabled /></td>
<td><input type="text" class="form-control" x-model="Math.round(total_sale_price/total_price * 1000)/10" disabled /></td>
</tr>
<tr>
<th>合約開始日</th>
<th>合約結束日</th>
<th></th>
<th></th>
<th></th>
<th></th>
</tr>
<tr>
<td><input type="date" disabled class="form-control" x-model="contract_begin_date" /></td>
<td><input type="date" disabled class="form-control" x-model="contract_end_date" /></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<th>罰則</th>
<th>訂金保證金(函)%</th>
<th>履約保證金(函)%</th>
<th>保固保證金(函)%</th>
<th></th>
<th></th>
</tr>
<tr>
<td><input type="text" disabled class="form-control" x-model="penalty"></td>
<td><input type="text" disabled class="form-control" x-model="deposit_rate"></td>
<td><input type="text" disabled class="form-control" x-model="keep_rate"></td>
<td><input type="text" disabled class="form-control" x-model="warranty_rate"></td>
<td></td>
<td></td>
</tr>
<tr>
<th colspan="6">特記事項</th>
</tr>
<tr>
<td colspan="6">
<textarea name="" id="" cols="30" rows="5" class="form-control" x-model="memo" disabled></textarea>
</td>
</tr>
</tbody>
</table>
<table class="table" style="width:700px">
<thead>
<tr>
<th style="width:150px">審核</th>
<th style="width:100px">審核人</th>
<th>結果</th>
<th>意見</th>
<th>時間</th>
</tr>
</thead>
<tbody>
<tr>
<td>區經理</td>
<td x-text="sign1"></td>
<td>
<?php
if($sign1 == 'Y'){
echo "同意";
}elseif($sign1 == 'N'){
echo "不同意";
}elseif($sign1 == 'W'){
echo "待簽核";
}else{
echo "---";
}
?>
</td>
<td><?php echo isset($sign['sign1_note']) ? $sign['sign1_note'] : "" ?></td>
<td><?php echo isset($sign['sign1']) ? explode(',', $sign['sign1'])[2] : "---" ?></td>
</tr>
<tr>
<td x-text="'服務助理'"></td>
<td x-text="sign2"></td>
<td>
<?php
if($sign2 == 'Y'){
echo "同意";
}elseif($sign2 == 'N'){
echo "不同意";
}elseif($sign2 == 'W' && $contract['status'] == 'YS'){
echo "待簽核";
}else{
echo "---";
}
?>
</td>
<td><?php echo (isset($sign['sign2']) && $sign['sign2']!=NULL) ? $sign['sign2_note'] : '---'?></td>
<td><?php echo (isset($sign['sign2']) && $sign['sign2']!=NULL) ? explode(',', $sign['sign2'])[2] : '---' ?></td>
</tr>
<tr>
<td x-text="'服務副總'"></td>
<td x-text="sign3"></td>
<td>
<?php
if($sign3 == 'Y'){
echo "同意";
}elseif($sign3 == 'YY'){
echo "結案同意";
}elseif($sign3 == 'N'){
echo "不同意";
}elseif($sign3 == 'W' && $contract['status'] == 'YS'){
echo "待簽核";
}else{
echo "---";
}
?>
</td>
<td><?php echo (isset($sign['sign3']) && $sign['sign3']!=NULL) ? $sign['sign3_note'] : '---'?></td>
<td><?php echo (isset($sign['sign3']) && $sign['sign3']!=NULL) ? explode(',', $sign['sign3'])[2] : '---' ?></td>
</tr>
<tr>
<td>總經理</td>
<td x-text="sign4"></td>
<td>
<?php
if($contract['status'] == 'YY'){
if($sign3 == 'YY'){
echo "---";
}elseif($sign3 == 'Y' && $sign4 == 'YY'){
echo "結案同意";
}
}else{
if($sign4 == 'Y' && $contract['status'] == 'YY'){
echo "同意";
}elseif($sign4 == 'N' && $contract['status'] == 'YN'){
echo "不同意";
}elseif($sign4 == 'W' && $contract['status'] == 'YS' ){
echo "待簽核";
}else{
echo "---";
}
}
?>
</td>
<td><?php echo (isset($sign['sign4']) && $sign['sign4']!=NULL) ? $sign['sign4_note'] : '---'?></td>
<td><?php echo (isset($sign['sign4']) && $sign['sign4']!=NULL) ? explode(',', $sign['sign4'])[2] : '---' ?></td>
</tr>
</tbody>
</table>
<table class="table" style="width:700px">
<thead>
<tr>
<th>審核意見</th>
<th>批示售價</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<textarea name="" <?php if($currentSigner != $user_id) echo "disabled" ?> class="form-control" id="" cols="40" rows="5" x-model="reviewcomment"></textarea>
</td>
<td>
<input type="text" class="form-control" disabled />
</td>
</tr>
</tbody>
</table>
<div>
<button class="btn btn-primary" @click="window.history.go(-1)">回上頁</button>
<?php if($contract['status'] == "YS"){ ?>
<?php if($currentSigner == "M0006" && $user_id == "M0008"): ?>
<button class="btn btn-primary" @click="check(<?php echo $currentSign; ?>, 'YN', 'M0006')">總經理權限(退回)</button>
<?php endif; ?>
<?php if($currentSigner == $user_id): ?>
<button class="btn btn-primary" @click="check(<?php echo $currentSign; ?>, 'YN')">不同意(退回)</button>
<?php if($sign1=='W' || ($sign1=='Y' && $sign2 =='W') || ($sign1 == 'Y' && ($sign2 == 'Y' || $sign2 == NULL) && $sign3 == 'W' && $sign4 == 'W')): ?>
<button class="btn btn-primary" @click="check(<?php echo $currentSign; ?>, 'YS')">同意(上呈)</button>
<?php endif ; ?>
<?php if(($sign3 == 'W' && $sign2 == 'Y') || ($sign3 == 'W' && $sign2 == null && $sign1 == 'Y') || ($sign3 == 'Y' && $sign4 == 'W') ): ?>
<button class="btn btn-primary" @click="check(<?php echo $currentSign; ?>, 'YY')">同意(結案)</button>
<?php endif ; ?>
<?php endif; ?>
<?php } ?>
<?php if($contract['attatch1']!=null): ?>
<a class="btn btn-primary" href="./<?php echo $contract['attatch1']; ?>" download="<?php echo $contract['vol_no'] . "報價單"; ?>">下載報價單</a>
<?php else: ?>
<a href="javascript:;" class="btn btn-primary" @click="alert('營業員未上傳報價單!')">下載報價單</a>
<?php endif; ?>
<?php if($contract['attatch2']!=null): ?>
<a class="btn btn-primary" href="./<?php echo $contract['attatch2']; ?>" download="<?php echo $contract['vol_no'] . "合約用印申請表"; ?>">下載合約用印申請表</a>
<?php else: ?>
<a href="javascript:;" style="width:180px" class="btn btn-primary" @click="alert('營業員未上傳合約用印申請表!')">下載合約用印申請表</a>
<?php endif; ?>
</div>
</div> </div>
</div> </div>
<script> <script>
const apply_key = '<?php echo $contract['apply_key']; ?>';
const vol_no = '<?php echo $contract['vol_no']; ?>';
const salesman = '<?php echo $contract['salesman']; ?>';
const customer = '<?php echo $contract['customer']; ?>';
const total_price = '<?php echo $contract['total_price']; ?>';
const total_sale_price = '<?php echo $contract['total_sale_price']; ?>';
const elevators = [...<?php echo json_encode($elevators) ?>]; const elevators = [...<?php echo json_encode($elevators) ?>];
const otherOptions = [...<?php echo json_encode($otherOptions) ?>];
const payment_kind = '<?php echo $contract['payment_kind']; ?>';
const case_name = '<?php echo $contract['case_name']; ?>';
const address = '<?php echo $contract['address']; ?>';
const service_fee = '<?php echo $contract['service_fee']; ?>';
const memo = `<?php echo $contract['memo']; ?>`;
const maintain_months = '<?php echo $contract_months; ?>';
const penalty = '<?php echo $contract['penalty']; ?>';
const deposit_rate = '<?php echo $contract['deposit_rate']; ?>';
const keep_rate = '<?php echo $contract['keep_rate']; ?>';
const warranty_rate = '<?php echo $contract['warranty_rate']; ?>';
const contract_begin_date = '<?php echo $contract['contract_begin_date']; ?>';
const contract_end_date = '<?php echo $contract['contract_end_date']; ?>';
const sign1 = '<?php echo ($sign) ? explode(',', $sign['sign1'])[0] : "---" ?>';
const sign2 = '<?php echo ($sign) ? explode(',', $sign['sign2'])[0] : "---" ?>';
const sign3 = '<?php echo ($sign) ? explode(',', $sign['sign3'])[0] : "---" ?>';
const sign4 = '<?php echo ($sign) ? explode(',', $sign['sign4'])[0] : "---" ?>';
const currentSignId = '<?php echo $currentSignId; ?>';
const token = '<?php echo $para = "function_name=pricereview&" . $token_link;; ?>';
const form_key = '<?php echo $form_key; ?>';
const user_id = '<?php echo $user_id; ?>';
</script> </script>

15
wms/cont/pricereviewCreate.php

@ -25,7 +25,7 @@ if($apply['status'] == 'D'){
if($apply['status'] == 'YS'){ if($apply['status'] == 'YS'){
echo "<script>alert('此單正在審核中!');window.history.go(-1);</script>"; echo "<script>alert('此單正在審核中!');window.history.go(-1);</script>";
} }
if($apply['status'] == 'YY' || $apply['status'] == 'YN'){ if($apply['status'] == 'YY'){
echo "<script>alert('此單已申請過!');window.history.go(-1);</script>"; echo "<script>alert('此單已申請過!');window.history.go(-1);</script>";
} }
@ -76,9 +76,6 @@ $otherOptionKey = 0;
foreach($items as $item){ foreach($items as $item){
if($item['item_no'] > $otherOptionKey){ if($item['item_no'] > $otherOptionKey){
$otherOptionKey = (int)$item['item_no']; $otherOptionKey = (int)$item['item_no'];
}
if($item['option_relate_spec']!= 0 ){
} }
$toElevator = $item['option_relate_spec']==0 ? [] : [[ $toElevator = $item['option_relate_spec']==0 ? [] : [[
'id'=>$item['option_relate_spec'], 'id'=>$item['option_relate_spec'],
@ -131,7 +128,7 @@ function getApplyKey($p_yyyymm, $seq_name){
} }
?> ?>
<link rel="stylesheet" href="./css/pricereview.css"> <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 src="./js/axios.min.js" integrity="sha512-aoTNnqZcT8B4AmeCFmiSnDlc4Nj/KPaZyB5G7JnOnUEkdNpCZs1LCankiYi01sLTyWy+m2P+W4XM+BuQ3Q4/Dg==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script defer src="./js/alpinejs/cdn.min.js"></script> <script defer src="./js/alpinejs/cdn.min.js"></script>
<script src="./js/pricereviewAlpine.js"></script> <script src="./js/pricereviewAlpine.js"></script>
<div id="pricereviewCreate" x-data=pricereviewCreate()> <div id="pricereviewCreate" x-data=pricereviewCreate()>
@ -547,11 +544,11 @@ function getApplyKey($p_yyyymm, $seq_name){
<input type="file" class="form-control" multiple draggable="true" @change="uploadFiles($event, 2)" /> <input type="file" class="form-control" multiple draggable="true" @change="uploadFiles($event, 2)" />
</label> </label>
<label for=""> <label for="">
<?php if(!empty($main) && $main['attatch1'] != null): ?> <?php if(!empty($apply) && $apply['attatch1'] != null): ?>
<a class="btn btn-primary" href="<?php echo $main['attatch1']; ?>" download="<?php echo $main['contractno']; ?>報價單">下載報價單</a> <a class="btn btn-primary" href="<?php echo $apply['attatch1']; ?>" download="<?php echo $apply['vol_no']; ?>報價單">下載報價單</a>
<?php endif; ?> <?php endif; ?>
<?php if(!empty($main) && $main['attatch2'] != null): ?> <?php if(!empty($apply) && $apply['attatch2'] != null): ?>
<a class="btn btn-primary" href="<?php echo $main['attatch2']; ?>" download="<?php echo $main['contractno']; ?>附表一">下載附表一</a> <a class="btn btn-primary" style="width:180px" href="<?php echo $apply['attatch2']; ?>" download="<?php echo $apply['vol_no']; ?>合約用印申請表">下載合約用印申請表</a>
<?php endif; ?> <?php endif; ?>
<button class="btn btn-primary" @click="save()">保存</button> <button class="btn btn-primary" @click="save()">保存</button>
<button class="btn btn-primary" @click="submit()">送審</button> <button class="btn btn-primary" @click="submit()">送審</button>

2
wms/cont/sign_list.php

@ -190,7 +190,7 @@ if ($data) :
<?php <?php
foreach ($editableColumn as $key => $val) { foreach ($editableColumn as $key => $val) {
if ($key == 'apply_key') { if ($key == 'apply_key') {
echo "<td> <a href='query_form.php?apply_key=$row[$key]&token=" . $_GET['token'] . "'>" . $row[$key] . "</td>"; echo "<td> <a href='pricereviewCheck.php?apply_key=$row[$key]&token=" . $_GET['token'] . "'>" . $row[$key] . "</td>";
} elseif ($key == 'brand') { } elseif ($key == 'brand') {
echo "<td>" . (!empty($row[$key]) ? $elevator_brand_arr[$row[$key]] : "") . "</td>"; echo "<td>" . (!empty($row[$key]) ? $elevator_brand_arr[$row[$key]] : "") . "</td>";
} else { } else {

9
wms/mkt/pricereviewCreate.php

@ -34,10 +34,13 @@ if(isset($_GET['id'])){
$main = $stmt->fetch(PDO::FETCH_ASSOC); $main = $stmt->fetch(PDO::FETCH_ASSOC);
$vol_no = $main['contractno']; $vol_no = $main['contractno'];
} }
if((!($main['status'] == 'Y1' || $main['status'] == 'YY')) ){ if($main){
echo "<script>alert('此單正在審核中!');window.history.go(-1);</script>"; if((!($main['status'] == 'Y1' || $main['status'] == 'YY' || $main['status'] == 'YN')) ){
exit; echo "<script>alert('此單正在審核中!');window.history.go(-1);</script>";
exit;
}
} }
$hope_status = [ $hope_status = [
'A'=>'有望簽約(已報價)', 'A'=>'有望簽約(已報價)',
'B'=>'觀望考慮(等待時機報價)', 'B'=>'觀望考慮(等待時機報價)',

Loading…
Cancel
Save