diff --git a/wms/contract/api/postContractNewApplyData.php b/wms/contract/api/postContractNewApplyData.php index e5b500fb..3d47b856 100644 --- a/wms/contract/api/postContractNewApplyData.php +++ b/wms/contract/api/postContractNewApplyData.php @@ -9,7 +9,7 @@ if ($_SERVER['REQUEST_METHOD'] != 'POST') { exit(); } //暫存、送審 -if (isset($_POST['vol_no']) && !empty($_POST['vol_no']) && ($_POST['status'] == 0 || $_POST['status'] == 1)) { +if (isset($_POST['vol_no']) && !empty($_POST['vol_no']) && ($_POST['status'] == 0 || $_POST['status'] == 1) && $_POST['progress'] <= 1) { if ($_POST['regulations'] < 10) { header("HTTP/1.1 500 傳送失敗!!試車時間不得低於10天"); exit; @@ -37,6 +37,7 @@ if (isset($_POST['vol_no']) && !empty($_POST['vol_no']) && ($_POST['status'] == $tradedeadline = $_POST['tradedeadline']; $secondPayDeadline = $_POST['secondPayDeadline']; $pays = $_POST['pays']; + $description = $_POST['description']; $status = $_POST['status']; // 0:暫存 1:送審 2:退回 3:完成 $pays = json_decode($pays, true); @@ -55,7 +56,7 @@ if (isset($_POST['vol_no']) && !empty($_POST['vol_no']) && ($_POST['status'] == $conn->beginTransaction(); try { if ($isFirst == 1) { - $sql_str = "INSERT INTO contract_new_apply (mid, contractno, sales_man, apply_date, apply_type, case_name, customer, manager, vat, total_price, total_items, buy_fee, install_fee, contact_address, workdeadline_a, workdeadline_b, test_time, freedeadline, trade_address, tradedeadline, secondPayDeadline, progress, status, person, personname, submit_date, created_at, created_by) VALUES (:mid, :contractno, :sales_man, :apply_date, :apply_type, :case_name, :customer, :manager, :vat, :total_price, :total_items, :buy_fee, :install_fee, :contact_address, :workdeadline_a, :workdeadline_b, :test_time, :freedeadline, :trade_address, :tradedeadline, :secondPayDeadline, :progress, :status, :person, :personname, :submit_date, :created_at, :created_by)"; + $sql_str = "INSERT INTO contract_new_apply (mid, contractno, sales_man, apply_date, apply_type, case_name, customer, manager, vat, total_price, total_items, buy_fee, install_fee, contact_address, workdeadline_a, workdeadline_b, test_time, freedeadline, trade_address, tradedeadline, secondPayDeadline, progress, status, person, personname, submit_date, created_at, created_by, description) VALUES (:mid, :contractno, :sales_man, :apply_date, :apply_type, :case_name, :customer, :manager, :vat, :total_price, :total_items, :buy_fee, :install_fee, :contact_address, :workdeadline_a, :workdeadline_b, :test_time, :freedeadline, :trade_address, :tradedeadline, :secondPayDeadline, :progress, :status, :person, :personname, :submit_date, :created_at, :created_by, :description)"; $stmt = $conn->prepare($sql_str); $stmt->bindParam(':mid', $mid); $stmt->bindParam(':contractno', $vol_no); @@ -85,6 +86,7 @@ if (isset($_POST['vol_no']) && !empty($_POST['vol_no']) && ($_POST['status'] == $stmt->bindParam(':submit_date', $submit_date); $stmt->bindParam(':created_at', $created_at); $stmt->bindParam(':created_by', $created_by); + $stmt->bindParam(':description', $description); $stmt->execute(); $contract_apply_id = $conn->lastInsertId(); foreach ($pays as $idx => $pay) { @@ -160,7 +162,7 @@ if (isset($_POST['vol_no']) && !empty($_POST['vol_no']) && ($_POST['status'] == header("HTTP/1.1 201 success!"); $conn->commit(); } else { - $sql_str = "UPDATE contract_new_apply SET status = :status, apply_date=:apply_date, apply_type=:apply_type, case_name=:case_name, customer=:customer, manager=:manager, vat=:vat, total_price=:total_price, total_items=:total_items, buy_fee=:buy_fee, install_fee=:install_fee, contact_address=:contact_address, trade_address=:trade_address, workdeadline_a=:workdeadline_a, workdeadline_b=:workdeadline_b, test_time=:test_time, freedeadline=:freedeadline, trade_address=:trade_address, trade_address=:trade_address, tradedeadline=:tradedeadline, secondPayDeadline=:secondPayDeadline, progress=:progress, person=:person, personname=:personname, submit_date=:submit_date, updated_at=:updated_at, updated_by=:updated_by WHERE mid = :mid"; + $sql_str = "UPDATE contract_new_apply SET status = :status, apply_date=:apply_date, apply_type=:apply_type, case_name=:case_name, customer=:customer, manager=:manager, vat=:vat, total_price=:total_price, total_items=:total_items, buy_fee=:buy_fee, install_fee=:install_fee, contact_address=:contact_address, trade_address=:trade_address, workdeadline_a=:workdeadline_a, workdeadline_b=:workdeadline_b, test_time=:test_time, freedeadline=:freedeadline, trade_address=:trade_address, trade_address=:trade_address, tradedeadline=:tradedeadline, secondPayDeadline=:secondPayDeadline, progress=:progress, person=:person, personname=:personname, submit_date=:submit_date, updated_at=:updated_at, updated_by=:updated_by, description=:description WHERE mid = :mid"; $stmt = $conn->prepare($sql_str); $stmt->bindParam(':mid', $mid); $stmt->bindParam(':status', $status); @@ -188,6 +190,7 @@ if (isset($_POST['vol_no']) && !empty($_POST['vol_no']) && ($_POST['status'] == $stmt->bindParam(':submit_date', $submit_date); $stmt->bindParam(':updated_at', $updated_at); $stmt->bindParam(':updated_by', $updated_by); + $stmt->bindParam(':description', $description); $stmt->execute(); foreach ($pays as $idx => $pay) { @@ -205,7 +208,7 @@ if (isset($_POST['vol_no']) && !empty($_POST['vol_no']) && ($_POST['status'] == $stmt->execute(); } $deleted_at = date("Y-m-d H:i:s"); - $removefiles = json_decode($_POST['removefiles'], true); + $removefiles = isset($_POST['removefiles']) ? json_decode($_POST['removefiles'], true) : []; print_r($removefiles); if(count($removefiles) > 0){ foreach($removefiles as $file){ @@ -216,10 +219,6 @@ if (isset($_POST['vol_no']) && !empty($_POST['vol_no']) && ($_POST['status'] == $stmt ->execute(); } } - - - - header("HTTP/1.1 201 success!"); $conn->commit(); } @@ -230,6 +229,35 @@ if (isset($_POST['vol_no']) && !empty($_POST['vol_no']) && ($_POST['status'] == die('Error!:' . $e->getMessage()); } } +//業務部承辦人同意 +if (isset($_POST['vol_no']) && !empty($_POST['vol_no']) && ($_POST['status'] == 1) && $_POST['progress'] == 2) { + $status = $_POST['status']; + $vol_no = $_POST['vol_no']; + $contract_new_apply_id = $_POST['contract_new_apply_id']; + $progress = $_POST['progress']; + $review_comment = $_POST['review_comment']; + $user_id = $_POST['review_person_id']; + $review_date = date('Y-m-d H:i:s'); + $conn->beginTransaction(); + try { + $sql_str = "UPDATE contract_new_apply SET status = :status, progress = :progress, review_comment=:review_comment, review_person_id=:review_person_id, review_date=:review_date WHERE id = :contract_new_apply_id"; + $stmt = $conn->prepare($sql_str); + $stmt->bindParam(':status', $status); + $stmt->bindParam(':progress', $progress); + $stmt->bindParam(':contract_new_apply_id', $contract_new_apply_id); + $stmt->bindParam(':review_comment', $review_comment); + $stmt->bindParam(':review_person_id', $user_id); + $stmt->bindParam(':review_date', $review_date); + $stmt->execute(); + header("HTTP/1.1 200 success!"); + $conn->commit(); + } catch (PDOException $e) { + $conn->rollback(); + header("HTTP/1.1 500 failed!"); + echo $e->getMessage(); + die('Error!:' . $e->getMessage()); + } +} //結案同意 if (isset($_POST['vol_no']) && !empty($_POST['vol_no']) && ($_POST['status'] == 3)) { $status = $_POST['status']; @@ -241,7 +269,7 @@ if (isset($_POST['vol_no']) && !empty($_POST['vol_no']) && ($_POST['status'] == $review_date = date('Y-m-d H:i:s'); $conn->beginTransaction(); try { - $sql_str = "UPDATE contract_new_apply SET status = :status, progress = :progress, review_comment=:review_comment, review_person_id=:review_person_id, review_date=:review_date WHERE id = :contract_new_apply_id"; + $sql_str = "UPDATE contract_new_apply SET status = :status, progress = :progress, review_final_comment=:review_comment, review_final_person_id=:review_person_id, review_final_date=:review_date WHERE id = :contract_new_apply_id"; $stmt = $conn->prepare($sql_str); $stmt->bindParam(':status', $status); $stmt->bindParam(':progress', $progress); diff --git a/wms/contract/contract-new-apply.php b/wms/contract/contract-new-apply.php index 960a05ce..1bdeef66 100644 --- a/wms/contract/contract-new-apply.php +++ b/wms/contract/contract-new-apply.php @@ -9,9 +9,10 @@ if(!(isset($_GET['id']) && !empty($_GET['id']))){ } $id = $_GET["id"]; -$sql_str = "SELECT contract_new_apply.*, account.name as review_person_name +$sql_str = "SELECT contract_new_apply.*, person_account.name AS review_person_name, person_final_account.name AS review_final_person_name FROM contract_new_apply -LEFT JOIN account ON contract_new_apply.review_person_id = account.accountid +LEFT JOIN account AS person_account ON contract_new_apply.review_person_id = person_account.accountid +LEFT JOIN account AS person_final_account ON contract_new_apply.review_final_person_id = person_final_account.accountid WHERE contract_new_apply.mid = :mid"; $stmt = $conn->prepare($sql_str); $stmt->bindParam(':mid',$id); @@ -101,6 +102,7 @@ if(empty($contract_new_apply)){ } $secondPayDeadline = $contract['secondPayDeadline'] ?? 0; $status = isset($contract['status']) ? $contract['status'] : -1; +$progress = isset($contract['progress']) ? $contract['progress'] : 0; $person = $contract['person']; ?> @@ -140,12 +142,12 @@ $person = $contract['person']; 統一編號 - +

未填寫

合約書申請日期 - +

未填寫

申請類別 @@ -159,17 +161,17 @@ $person = $contract['person']; 案件名稱 - +

未填寫

立約人 - +

未填寫

負責人 - +

未填寫

@@ -193,7 +195,7 @@ $person = $contract['person']; 聯絡地址 - +

未填寫

完工期限 @@ -407,7 +409,7 @@ $person = $contract['person'];
- +
@@ -415,7 +417,7 @@ $person = $contract['person'];
- +
@@ -448,13 +450,17 @@ $person = $contract['person']; -

附件上傳

+

其他

- 附件上傳 + 說明 + + + + 附件上傳 @@ -463,7 +469,9 @@ $person = $contract['person']; @@ -487,7 +495,7 @@ $person = $contract['person']; 結果 意見 時間 - 審核意見 + 審核意見 營業員 @@ -499,8 +507,8 @@ $person = $contract['person']; --- - - + + @@ -509,13 +517,24 @@ $person = $contract['person']; 業務承辦人 - 結案同意 + = 2): ?>已同意 結案不同意 - --- + --- + + 業務部協理 + + + 結案同意 + 結案不同意 + --- + + + +