Browse Source

更改大日程申請計畫圖上傳簽核流程

gary
gary_chen\gary_chen 1 year ago
parent
commit
11abc3ceef
  1. 13
      wms/wipwhole-change-planning-customer-name-function.php
  2. 187
      wms/wipwhole-change-planning-customer-name-submit.php
  3. 34
      wms/wipwhole-change-planning-customer-name.php
  4. 30
      wms/wipwhole-rec-invoice-edit.php

13
wms/wipwhole-change-planning-customer-name-function.php

@ -33,6 +33,8 @@ function isLeader($link, $user_id)
return true;
if (getDepartmentId($link, $user_id) == '315' && getRoleId($link, $user_id) == '1')
return true;
if (getDepartmentId($link, $user_id) == '220' && getRoleId($link, $user_id) == '1')
return true;
return false;
}
@ -426,10 +428,8 @@ function getChangeStatus($link, $cid)
function getChangeStatusName($link, $cid)
{
$dataArr = array(
'A' => '申請中',
'B' => '申請中',
'C' => '已取消',
'D' => '工務已通過',
'Z' => '已通過',
);
$sql = "
@ -628,19 +628,14 @@ function getAssignStatusSelect($link, $user_id, $nowFormStatus)
$options_str = "<select name='assign_status' id='assign_status'>";
if (empty($nowFormStatus)) {
if (isLeader($link, $user_id)) {
$options_str .= "<option value='A'>提出申請</option>";
$options_str .= "<option value='Z'>提出申請</option>";
} else {
$options_str .= "<option value='B'>提出申請</option>";
}
}
if (in_array(checkNowFormStatus($link), ['A', 'D'])) {
if ($user_id == 'M0060')
$options_str .= "<option value='Z'>通過</option>";
$options_str .= "<option value='C'>取消</option>";
}
if (checkNowFormStatus($link) == 'B') {
if (isLeader($link, $user_id))
$options_str .= "<option value='D'>通過</option>";
$options_str .= "<option value='Z'>通過</option>";
$options_str .= "<option value='C'>取消</option>";
}
$options_str .= "</select>";

187
wms/wipwhole-change-planning-customer-name-submit.php

@ -13,7 +13,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
$tds = date("Y-m-d H:i:s");
// 單次申請
if (($_POST['assign_status'] == 'A' || $_POST['assign_status'] == 'B') && empty($all_contractno_change)) {
if (($_POST['assign_status'] == 'B') && empty($all_contractno_change)) {
$data_arr = array(
'id' => $id,
'all_contractno_change' => $all_contractno_change,
@ -40,7 +40,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
}
// 批次申請
if (($_POST['assign_status'] == 'A' || $_POST['assign_status'] == 'B') && !empty($all_contractno_change)) {
if (($_POST['assign_status'] == 'B') && !empty($all_contractno_change)) {
$wipwholestatus_id_arr = getWipwholestatusIdByConstractNo($link, $contractno);
$customer_planning_verify_file = fileIUpload("customer_planning_verify_file");
@ -74,71 +74,45 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
}
}
// 單次申請 營業
if ($_POST['assign_status'] == 'D') {
$tds = date("Y-m-d H:i:s");
$next_users = $_POST['next_users'];
$seq = $_POST['seq'];
$sql = "
UPDATE wipwhole_change_planning_customer_details
SET change_status = 'D'
WHERE id = '$cid'
";
mysqli_query($link, $sql);
$sql = "
UPDATE flow
SET flow_code = 'D'
WHERE form_key = '$form_key'
";
mysqli_query($link, $sql);
$sql = "
INSERT into subflow (
form_key,
seq,
current_assigner,
create_date
) VALUES (
'$form_key',
'2',
'$next_users',
'$tds'
)
";
mysqli_query($link, $sql);
}
// // 單次申請 營業
// if ($_POST['assign_status'] == 'B') {
// $tds = date("Y-m-d H:i:s");
// $next_users = $_POST['next_users'];
// $seq = $_POST['seq'];
// $sql = "
// UPDATE wipwhole_change_planning_customer_details
// SET change_status = 'D'
// WHERE id = '$cid'
// ";
// mysqli_query($link, $sql);
// $sql = "
// UPDATE flow
// SET flow_code = 'D'
// WHERE form_key = '$form_key'
// ";
// mysqli_query($link, $sql);
// $sql = "
// INSERT into subflow (
// form_key,
// seq,
// current_assigner,
// create_date
// ) VALUES (
// '$form_key',
// '2',
// '$next_users',
// '$tds'
// )
// ";
// mysqli_query($link, $sql);
// }
// 取消
if ($_POST['assign_status'] == 'C') {
$tds = date("Y-m-d H:i:s");
$next_users = "00000";
if ($user_id == 'M0060') {
if (getChangeStatus($link, $cid) == 'D' || getChangeStatus($link, $cid) == 'A') {
$seq = $_POST['seq'];
}
$sql = "
INSERT into subflow (
form_key,
seq,
current_assigner,
create_date
) VALUES (
'$form_key',
'$seq',
'$next_users',
'$tds'
)
";
mysqli_query($link, $sql);
} else if (isLeader($link, $user_id)) {
if (getChangeStatus($link, $cid) == 'D') {
$sql = "
UPDATE subflow
SET current_assigner = '$next_users',
create_date = '$tds'
WHERE form_key = '$form_key'
AND seq = '$seq'
";
mysqli_query($link, $sql);
} else if (getChangeStatus($link, $cid) == 'A') {
if (isLeader($link, $user_id)) {
if (getChangeStatus($link, $cid) == 'B') {
$seq = $_POST['seq'];
$sql = "
UPDATE subflow
@ -192,10 +166,41 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
// 通過
if ($_POST['assign_status'] == 'Z') {
if ($user_id == 'M0060') {
$tds = date("Y-m-d H:i:s");
$next_users = $_POST['next_users'];
$seq = $_POST['seq'] + 1;
$customer_planning_verify_file = fileIUpload("customer_planning_verify_file");
$all_contractno_change = empty($_POST['all_contractno_change']) ? null : $_POST['all_contractno_change'];
$custom_name = $_POST['custom_name'];
$contractno = $_POST['contractno'];
if (isLeader($link, $user_id)){
$data_arr = array(
'id' => $id,
'all_contractno_change' => $all_contractno_change,
'custom_name' => $custom_name,
'contractno' => $contractno,
'tds' => $tds,
'form_key' => getFomkeySeq($link),
'user_id' => $user_id,
'customer_planning_verify_file' => $customer_planning_verify_file,
'change_status' => $_POST['assign_status']
);
addWipwholeChangeContractdateDetails($link, $data_arr);
// 取得寫入後表單seq
$data_arr['last_id'] = $link->insert_id;
// 寫入待簽
addFlow($link, $data_arr);
$data_arr['seq'] = '0';
$data_arr['current_assigner'] = $user_id;
addSubflow($link, $data_arr);
$data_arr['seq'] = '1';
$data_arr['current_assigner'] = $next_users;
addSubflow($link, $data_arr);
}
$form_key = getFomkeySeq($link);
$sql = "
UPDATE wipwhole_change_planning_customer_details
SET change_status = 'Z'
@ -222,59 +227,5 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
)
";
mysqli_query($link, $sql);
// // 發送系統通知
// $contractno = $_POST['contractno'];
// $facilityno = $_POST['facilityno'];
// $real_contract_arrival_date = $_POST['real_contract_arrival_date'];
// $salesid = $_POST['salesid'];
// $gongWuokid = $_POST['gongWuokid'];
// $old_real_address = $_POST['old_real_address'];
// $real_address = $_POST['real_address'];
// $content = "合約號 : $contractno
// 作番號 : $facilityno
// 出貨日期微調: " . substr($real_contract_arrival_date, 0, 10) . " => " . substr($contract_arrival_date_tmp, 0, 10) . "
// 工地地址微調: " . $old_real_address . " => " . $real_address_tmp;
// // 大日程出貨日調整 通知營業人員
// $noticeData = array(
// 'related_id' => $cid,
// 'title' => '作番大日程(新梯)出貨日調整通知 > ' . $facilityno,
// 'content' => $content,
// 'permission' => $salesid,
// );
// addNotice($link, $noticeData);
// // 大日程出貨日調整 通知工務人員
// $noticeData = array(
// 'related_id' => $cid,
// 'title' => '作番大日程(新梯)出貨日調整通知 > ' . $facilityno,
// 'content' => $content,
// 'permission' => $gongWuokid,
// );
// addNotice($link, $noticeData);
// $shengguano_arr = getShengguanokOptions($link);
// foreach ($shengguano_arr as $row) :
// $contractno = $_POST['contractno'];
// $facilityno = $_POST['facilityno'];
// $real_contract_arrival_date = $_POST['real_contract_arrival_date'];
// $gongWuokid = $_POST['gongWuokid'];
// $old_real_address = $_POST['old_real_address'];
// $real_address = $_POST['real_address'];
// $content = "合約號 : $contractno
// 作番號 : $facilityno
// 出貨日期微調: " . substr($real_contract_arrival_date, 0, 10) . " => " . substr($contract_arrival_date_tmp, 0, 10) . "
// 工地地址微調: " . $old_real_address . " => " . $real_address_tmp;
// // 大日程出貨日調整 通知營業人員
// $noticeData = array(
// 'related_id' => $cid,
// 'title' => '作番大日程(新梯)出貨日調整通知 > ' . $facilityno,
// 'content' => $content,
// 'permission' => $row['val'],
// );
// addNotice($link, $noticeData);
// endforeach;
}
}
}

34
wms/wipwhole-change-planning-customer-name.php

@ -326,7 +326,11 @@ if (!empty(checkNowFormStatus($link)))
if (empty(checkNowFormStatus($link))) {
if (isLeader($link, $user_id)) {
echoMaxSelect($max_options);
echo "
<select name='next_users' id='next_users'>
<option value='00000'>00000</option>
</select>
";
} else if (in_array(getDepartmentId($link, $user_id), [
'311', '312', '313', '314', '315',
'501', '511', '512', '513', '514',
@ -340,16 +344,8 @@ if (!empty(checkNowFormStatus($link)))
endforeach;
echo "</select>";
}
} else if (checkNowFormStatus($link) == 'A' || checkNowFormStatus($link) == 'D') {
echo "
<select name='next_users' id='next_users'>
<option value='00000'>00000</option>
</select>
";
} else if (checkNowFormStatus($link) == 'B') {
if (isLeader($link, $user_id)) {
echoMaxSelect($max_options);
} else {
echo "
<select name='next_users' id='next_users'>
<option value='00000'>00000</option>
@ -365,29 +361,9 @@ if (!empty(checkNowFormStatus($link)))
if (empty(checkNowFormStatus($link))) {
echo "<input type='hidden' name='seq' value = '0' />";
echo "<button class='btn btn-primary'>提交</button>";
} else if (checkNowFormStatus($link) == 'A') {
if ($user_id == 'M0060') {
echo "<input type='hidden' name='seq' value = '2' />";
} else if (isLeader($link, $user_id)) {
echo "<input type='hidden' name='seq' value = '1' />";
} else {
echo "<input type='hidden' name='seq' value = '0' />";
}
echo "<button class='btn btn-primary'>提交</button>";
} else if (checkNowFormStatus($link) == 'B') {
if (isLeader($link, $user_id)) {
echo "<input type='hidden' name='seq' value = '1' />";
} else if ($user_id == 'M0060') {
echo "<input type='hidden' name='seq' value = '2' />";
} else {
echo "<input type='hidden' name='seq' value = '0' />";
}
echo "<button class='btn btn-primary'>提交</button>";
} else if (checkNowFormStatus($link) == 'D') {
if (isLeader($link, $user_id)) {
echo "<input type='hidden' name='seq' value = '1' />";
} else if ($user_id == 'M0060') {
echo "<input type='hidden' name='seq' value = '2' />";
} else {
echo "<input type='hidden' name='seq' value = '0' />";
}

30
wms/wipwhole-rec-invoice-edit.php

@ -1334,7 +1334,7 @@ include "wipwhole-rec-invoice-edit-submit.php";
(工務助理項目)
</td>
</tr>
<!-- <tr>
<tr>
<td style="vertical-align: middle">發包類型</td>
<td>
<input type='radio' name='outsourcer_type' id='outsourcer_type_I' value='I' />
@ -1352,7 +1352,7 @@ include "wipwhole-rec-invoice-edit-submit.php";
}
?>
</td>
</tr> -->
</tr>
<tr>
<td style="vertical-align: middle">安裝發包廠商</td>
<td>
@ -1913,7 +1913,6 @@ include "wipwhole-rec-invoice-edit-submit.php";
// 發包類型
let outsourcer_type = $("input[name^='outsourcer_type']:checked").val();
// 預計出貨日(到工地)
let real_contract_arrival_date = $("#real_contract_arrival_date").val();
// 樓停
@ -1921,6 +1920,7 @@ include "wipwhole-rec-invoice-edit-submit.php";
// 目前操作者
let user_id = '<?php echo $user_id; ?>';
if (getSetOutSourcerDateStatus() == '1') {
if (outsourcer_type === 'I') {
resetTOutSourcerDate();
$("#estimate_install_start_date").val(dateAddDays(real_contract_arrival_date, 5));
@ -1953,6 +1953,30 @@ include "wipwhole-rec-invoice-edit-submit.php";
);
$("#estimate_tryrun_end_date_owner").val(user_id);
}
} else {
const errrMessage = {
'2': '請選擇發包種類'
}
if ((errrMessage[getSetOutSourcerDateStatus()] !== 'undefined')) {
alert(errrMessage[getSetOutSourcerDateStatus()]);
} else {
alert("不明錯誤");
}
}
}
function getSetOutSourcerDateStatus() {
let outsourcer_type = $("input[name^='outsourcer_type']:checked").val();
let real_contract_arrival_date = $("#real_contract_arrival_date").val();
let numberofstop = $("#numberofstop").val();
let user_id = '<?php echo $user_id; ?>';
if (typeof outsourcer_type == 'undefined')
return 2;
return 0;
}
function resetIOutSourcerDate() {

Loading…
Cancel
Save