You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1037 lines
49 KiB
1037 lines
49 KiB
<?php
|
|
// ini_set('display_errors', 'on');
|
|
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
|
if ($_POST['form_name'] == 'main_form') {
|
|
|
|
foreach ($_POST as $k => $v) {
|
|
if ($k !== 'renovate_type' && $k !== 'desin_taiwan_items_no' && $k !== 'desin_taiwan_items_name')
|
|
$$k = htmlspecialchars(stripslashes(trim($v)));
|
|
}
|
|
|
|
// 時間戳記
|
|
$datetime = date("Y-m-d H:i:s");
|
|
$create_at = date("Y-m-d H:i:s");
|
|
|
|
// 合約號
|
|
$contractno = $_POST['contractno'];
|
|
// 號機
|
|
$facility_temp_no = $_POST['facility_temp_no'];
|
|
// 汰改方案 B
|
|
$renovate_type = json_encode($_POST['renovate_type'], JSON_UNESCAPED_UNICODE);
|
|
// 作番號
|
|
$facilityno = $_POST['facilityno'];
|
|
// 客戶名稱
|
|
$custom = $_POST['custom'];
|
|
// 工地負責人
|
|
$site_manager = $_POST['site_manager'];
|
|
// 緯度
|
|
$latitude = $_POST['latitude'];
|
|
// 經度
|
|
$longitude = $_POST['longitude'];
|
|
$weight = $_POST['weight'];
|
|
|
|
$numberofpassenger = $_POST['numberofpassenger'];
|
|
$numberofstop = $_POST['numberofstop'];
|
|
$numberoffloor = $_POST['numberoffloor'];
|
|
$opentype = $_POST['opentype'];
|
|
$speed = $_POST['speed'];
|
|
$facility_kind = $_POST['facility_kind'];
|
|
$address = $_POST['address'];
|
|
$real_address = $_POST['real_address'];
|
|
|
|
//合約到貨日
|
|
$contract_arrival_date = $_POST['contract_arrival_date'];
|
|
//合約到貨日
|
|
$real_contract_arrival_date = $_POST['real_contract_arrival_date'];
|
|
|
|
//营业规格确认
|
|
$sales_spec_verify = $_POST['sales_spec_verify'];
|
|
$sales_spec_verify_at = $_POST['sales_spec_verify_at'] ?: $row['sales_spec_verify_at'];
|
|
$sales_spec_verify_owner = $_POST['sales_spec_verify_owner'] ?: $row['sales_spec_verify_owner'];
|
|
//客户颜色确认
|
|
$customer_color_verify = $_POST['customer_color_verify'];
|
|
$customer_color_verify_at = $_POST['customer_color_verify_at'] ?: $row['customer_color_verify_at'];
|
|
$customer_color_verify_owner = $_POST['customer_color_verify_owner'] ?: $row['customer_color_verify_owner'];
|
|
//客户颜色确认
|
|
$customer_style_verify = $_POST['customer_style_verify'];
|
|
$customer_style_verify_at = $_POST['customer_style_verify_at'] ?: $row['customer_style_verify_at'];
|
|
$customer_style_verify_owner = $_POST['customer_style_verify_owner'] ?: $row['customer_style_verify_owner'];
|
|
//工勘聯絡表
|
|
$site_survey_contact_form_verify = $_POST['site_survey_contact_form_verify'];
|
|
$site_survey_contact_form_verify_at = $_POST['site_survey_contact_form_verify_at'] ?: $row['site_survey_contact_form_verify_at'];
|
|
$site_survey_contact_form_verify_owner = $_POST['site_survey_contact_form_verify_owner'] ?: $row['site_survey_contact_form_verify_owner'];
|
|
|
|
//设计规格确认
|
|
$desin_spec_verify = $_POST['desin_spec_verify'];
|
|
$desin_spec_verify_at = $_POST['desin_spec_verify_at'] ?: $row['desin_spec_verify_at'];
|
|
$desin_spec_verify_owner = $_POST['desin_spec_verify_owner'] ?: $row['desin_spec_verify_owner'];
|
|
//设计计划图确认
|
|
$desin_planning_verify = $_POST['desin_planning_verify'];
|
|
$desin_planning_verify_at = $_POST['desin_planning_verify_at'] ?: $row['desin_planning_verify_at'];
|
|
$desin_planning_verify_owner = $_POST['desin_planning_verify_owner'] ?: $row['desin_planning_verify_owner'];
|
|
//设计颜色确认
|
|
$desin_color_verify = $_POST['desin_color_verify'];
|
|
$desin_color_verify_at = $_POST['desin_color_verify_at'] ?: $row['desin_color_verify_at'];
|
|
$desin_color_verify_owner = $_POST['desin_color_verify_owner'] ?: $row['desin_color_verify_owner'];
|
|
//设计仕样确认
|
|
$desin_style_verify = $_POST['desin_style_verify'];
|
|
$desin_style_verify_at = $_POST['desin_style_verify_at'] ?: $row['desin_style_verify_at'];
|
|
$desin_style_verify_owner = $_POST['desin_style_verify_owner'] ?: $row['desin_style_verify_owner'];
|
|
//设计主管確認
|
|
$desin_leader_verify = $_POST['desin_leader_verify'];
|
|
$desin_leader_verify_at = $_POST['desin_leader_verify_at'] ?: $row['desin_leader_verify_at'];
|
|
$desin_leader_verify_owner = $_POST['desin_leader_verify_owner'] ?: $row['desin_leader_verify_owner'];
|
|
//楼高通报
|
|
$building_heigh_verify = $_POST['building_heigh_verify'];
|
|
$building_heigh_verify_at = $_POST['building_heigh_verify_at'] ?: $row['building_heigh_verify_at'];
|
|
$building_heigh_verify_owner = $_POST['building_heigh_verify_owner'] ?: $row['building_heigh_verify_owner'];
|
|
//客户计划图确认
|
|
$customer_planning_verify = $_POST['customer_planning_verify'];
|
|
$customer_planning_verify_at = $_POST['customer_planning_verify_at'] ?: $row['customer_planning_verify_at'];
|
|
$customer_planning_verify_owner = $_POST['customer_planning_verify_owner'] ?: $row['customer_planning_verify_owner'];
|
|
//工勘
|
|
$site_survey_contact_verify = $_POST['site_survey_contact_verify'];
|
|
$site_survey_contact_verify_at = $_POST['site_survey_contact_verify_at'] ?: $row['site_survey_contact_verify_at'];
|
|
$site_survey_contact_verify_owner = $_POST['site_survey_contact_verify_owner'] ?: $row['site_survey_contact_verify_owner'];
|
|
$old_site_survey_contact_verify = $_POST['old_site_survey_contact_verify'];
|
|
|
|
// 工務助理
|
|
$outsourcer_type = $_POST['outsourcer_type'];
|
|
$install_outsourcer = $_POST['install_outsourcer'];
|
|
$install_outsourcer_owner = $_POST['install_outsourcer_owner'];
|
|
$install_outsourcer_date = $_POST['install_outsourcer_date'];
|
|
$install_outsourcer_date_owner = $_POST['install_outsourcer_date_owner'];
|
|
$estimate_install_start_date = $_POST['estimate_install_start_date'];
|
|
$estimate_install_start_date_owner = $_POST['estimate_install_start_date_owner'];
|
|
$estimate_install_end_date = $_POST['estimate_install_end_date'];
|
|
$estimate_install_end_date_owner = $_POST['estimate_install_end_date_owner'];
|
|
$tryrun_outsourcer = $_POST['tryrun_outsourcer'];
|
|
$tryrun_outsourcer_owner = $_POST['tryrun_outsourcer_owner'];
|
|
$tryrun_outsourcer_date = $_POST['tryrun_outsourcer_date'];
|
|
$tryrun_outsourcer_date_owner = $_POST['tryrun_outsourcer_date_owner'];
|
|
$estimate_tryrun_start_date = $_POST['estimate_tryrun_start_date'];
|
|
$estimate_tryrun_start_date_owner = $_POST['estimate_tryrun_start_date_owner'];
|
|
$estimate_tryrun_end_date = $_POST['estimate_tryrun_end_date'];
|
|
$estimate_tryrun_end_date_owner = $_POST['estimate_tryrun_end_date_owner'];
|
|
$warehouse_assistant_remark = $_POST['warehouse_assistant_remark'];
|
|
|
|
// 工勘變更通知繪圖人員
|
|
if ($site_survey_contact_verify !== $old_site_survey_contact_verify) {
|
|
$site_survey_status = array(
|
|
"1" => "請選擇",
|
|
"0" => "已確認",
|
|
"2" => "無工勘需求",
|
|
"A" => "未動工",
|
|
"B" => "地下室施工",
|
|
"C" => "打樁",
|
|
"D" => "地基",
|
|
"E" => "挖土",
|
|
"G" => "機房",
|
|
"H" => "機械式淨高",
|
|
"M" => "樓中樓",
|
|
"OH" => "最高層(頂樓高度)",
|
|
"P" => "PIT(機坑深度)",
|
|
"R" => "R 樓",
|
|
"S" => "停工",
|
|
"T" => "TOP",
|
|
"TC" => "頂部間隙",
|
|
"TS" => "行程",
|
|
"TH" => "全高",
|
|
"Y" => "已搭、已出",
|
|
"YB" => "退購結案",
|
|
"YF" => "既有建物",
|
|
"YN" => "已搭、未出"
|
|
);
|
|
$sql = "
|
|
SELECT accountid
|
|
FROM account
|
|
WHERE department_id = '321'
|
|
AND role_id IN ('2','3','5');
|
|
";
|
|
$result = mysqli_query($link, $sql);
|
|
foreach ($result as $row) {
|
|
$permission = $row["accountid"];
|
|
$title = "客戶:$custom 作番:$facilityno 工勘狀態更改";
|
|
$content = "客戶:$custom
|
|
作番:$facilityno
|
|
工勘狀態 $site_survey_status[$old_site_survey_contact_verify] => $site_survey_status[$site_survey_contact_verify]";
|
|
|
|
$sql = "
|
|
INSERT INTO notice(
|
|
kind,
|
|
related_id,
|
|
title,
|
|
content,
|
|
haveread,
|
|
permission,
|
|
creater,
|
|
create_at
|
|
)VALUES(
|
|
'1',
|
|
'$id',
|
|
'$title',
|
|
'$content',
|
|
null,
|
|
'$permission',
|
|
'$creater',
|
|
'$create_at'
|
|
);
|
|
";
|
|
mysqli_query($link, $sql);
|
|
}
|
|
}
|
|
|
|
//是否齊備
|
|
$shengguanok_status = $_POST['shengguanok_status'];
|
|
$shengguanok_status_at = $_POST['shengguanok_status_at'];
|
|
$shengguanok_status_owner = $_POST['shengguanok_status_owner'] ?: $row['shengguanok_status_owner'];
|
|
//下單日(普萊特富)
|
|
$prattford_order_date_verify = $_POST['prattford_order_date_verify'];
|
|
$prattford_order_date = $_POST['prattford_order_date'];
|
|
$prattford_order_date_owner = $_POST['prattford_order_date_owner'] ?: $row['prattford_order_date_owner'];
|
|
// 預計發貨日(到港日)
|
|
$estimated_shipping_date_verify = $_POST['estimated_shipping_date_verify'];
|
|
$estimated_shipping_date = $_POST['estimated_shipping_date'];
|
|
$estimated_shipping_date_owner = $_POST['estimated_shipping_date_owner'] ?: $row['estimated_shipping_date_owner'];
|
|
// 預計船期(改成預計到廠日)
|
|
$estimated_shipping_schedule_date_verify = $_POST['estimated_shipping_schedule_date_verify'];
|
|
$estimated_shipping_schedule_date = $_POST['estimated_shipping_schedule_date'];
|
|
$estimated_shipping_schedule_date_owner = $_POST['estimated_shipping_schedule_date_owner'] ?: $row['estimated_shipping_schedule_date_owner'];
|
|
// 普來特富發貨類別
|
|
$goods_type = $_POST['goods_type'] ?: $row['goods_type'];
|
|
$goods_type_date = $_POST['goods_type_date'];
|
|
$goods_type_owner = $_POST['goods_type_owner'] ?: $row['goods_type_owner'];
|
|
// 台灣自理發貨類別
|
|
$taiwan_goods_type = $_POST['taiwan_goods_type'] ?: $row['taiwan_goods_type'];
|
|
$taiwan_goods_type_date = $_POST['taiwan_goods_type_date'];
|
|
$taiwan_goods_type_owner = $_POST['taiwan_goods_type_owner'] ?: $row['taiwan_goods_type_owner'];
|
|
// 實際到貨日
|
|
$arrival_date_verify = $_POST['arrival_date_verify'] ?: $row['arrival_date_verify'];
|
|
$actual_tofactory_date = $_POST['actual_tofactory_date'];
|
|
$arrival_date_owner = $_POST['arrival_date_owner'] ?: $row['arrival_date_owner'];
|
|
|
|
// 各部門備註
|
|
$marketing_remark = $_POST['marketing_remark'] ?: $row['marketing_remark'];
|
|
$desin_remark = $_POST['desin_remark'] ?: $row['desin_remark'];
|
|
$desin_leader_remark = $_POST['desin_leader_remark'] ?: $row['desin_leader_remark'];
|
|
$warehouse_remark = $_POST['warehouse_remark'] ?: $row['warehouse_remark'];
|
|
$yewu_remark = $_POST['yewu_remark'] ?: $row['yewu_remark'];
|
|
$shengguan_remark = $_POST['shengguan_remark'] ?: $row['shengguan_remark'];
|
|
|
|
// 台製件
|
|
$desin_taiwan_items_no = json_encode($_POST['desin_taiwan_items_no'], JSON_UNESCAPED_UNICODE);
|
|
$desin_taiwan_items_name = json_encode($_POST['desin_taiwan_items_name'], JSON_UNESCAPED_UNICODE);
|
|
$desin_taiwan_items_no = $desin_taiwan_items_no == 'null' ? null : $desin_taiwan_items_no;
|
|
$desin_taiwan_items_name = $desin_taiwan_items_name == 'null' ? null : $desin_taiwan_items_name;
|
|
|
|
// 品証部
|
|
$qc_date = $_POST['qc_date'] ?: $row['qc_date'];
|
|
$qc_date_owner = $_POST['qc_date_owner'] ?: $row['qc_date_owner'];
|
|
$end_qc_date = $_POST['end_qc_date'] ?: $row['end_qc_date'];
|
|
$end_qc_date_owner = $_POST['end_qc_date_owner'] ?: $row['end_qc_date_owner'];
|
|
$official_check_date = $_POST['official_check_date'] ?: $row['official_check_date'];
|
|
$old_official_check_date = $_POST['old_official_check_date'] ?: $row['old_official_check_date'];
|
|
$official_check_date_owner = $_POST['official_check_date_owner'] ?: $row['official_check_date_owner'];
|
|
$delivery_date = $_POST['delivery_date'] ?: $row['delivery_date'];
|
|
$delivery_date_owner = $_POST['delivery_date_owner'] ?: $row['delivery_date_owner'];
|
|
|
|
$creater = $_POST['creater'];
|
|
$create_at = date("Y-m-d H:i:s");
|
|
|
|
// 上傳附件
|
|
include "wipwhole-rec-invoice-edit-fileupload.php";
|
|
|
|
// 工勘變更通知繪圖人員
|
|
if ($official_check_date !== $old_official_check_date) {
|
|
$sql = "
|
|
SELECT accountid
|
|
FROM account
|
|
WHERE department_id = '250'
|
|
AND role_id IN ('1','2','3','4');
|
|
";
|
|
$result = mysqli_query($link, $sql);
|
|
foreach ($result as $row) {
|
|
$permission = $row["accountid"];
|
|
$title = "客戶:$custom 作番:$facilityno 官檢日變更";
|
|
$content = "客戶:$custom
|
|
作番:$facilityno
|
|
官檢日 $old_official_check_date => $official_check_date";
|
|
|
|
$sql = "
|
|
INSERT INTO notice(
|
|
kind,
|
|
related_id,
|
|
title,
|
|
content,
|
|
haveread,
|
|
permission,
|
|
creater,
|
|
create_at
|
|
)VALUES(
|
|
'1',
|
|
'$id',
|
|
'$title',
|
|
'$content',
|
|
null,
|
|
'$permission',
|
|
'$creater',
|
|
'" . date("Y-m-d H:i:s") . "'
|
|
);
|
|
";
|
|
mysqli_query($link, $sql);
|
|
}
|
|
}
|
|
|
|
$updatesql = "update wipwholestatus set ";
|
|
|
|
if (in_array($user_department_id, [521, 531, 541, 542, 543, 544, 545]) || $user_id == 'M0054') {
|
|
// 工務更新;
|
|
$updatesql .= "
|
|
building_heigh_verify = '$building_heigh_verify',
|
|
building_heigh_verify_at = '$building_heigh_verify_at',
|
|
building_heigh_verify_owner = '$building_heigh_verify_owner',
|
|
site_survey_contact_verify = '$site_survey_contact_verify',
|
|
site_survey_contact_verify_at = '$site_survey_contact_verify_at',
|
|
site_survey_contact_verify_owner = '$site_survey_contact_verify_owner',
|
|
customer_planning_verify = '$customer_planning_verify',
|
|
customer_planning_verify_at = '$customer_planning_verify_at',
|
|
customer_planning_verify_owner = '$customer_planning_verify_owner',
|
|
";
|
|
$updatesql .= "warehouse_remark = '', ";
|
|
if (!empty(trim($warehouse_remark))) {
|
|
$updatesql .= "
|
|
all_remark = CONCAT('" . $user_id . accountidToName($user_id) . "_" . $datetime . "<br/>" . $warehouse_remark . "<br/><br/>',IF(all_remark IS NULL,'',all_remark)),
|
|
";
|
|
}
|
|
$updatesql .= empty($building_heigh_verify_file) ? "" : "building_heigh_verify_file = '$building_heigh_verify_file',";
|
|
$updatesql .= empty($site_survey_contact_verify_file) ? "" : "site_survey_contact_verify_file = '$site_survey_contact_verify_file',";
|
|
$updatesql .= empty($customer_planning_verify_file) ? "" : "customer_planning_verify_file = '$customer_planning_verify_file',";
|
|
} else if (in_array($user_department_id, [311, 312, 313, 314, 315, 511, 512, 513, 514])) {
|
|
// 契約更新;
|
|
$updatesql .= "
|
|
sales_spec_verify = '$sales_spec_verify',
|
|
sales_spec_verify_at = '$sales_spec_verify_at',
|
|
sales_spec_verify_owner = '$sales_spec_verify_owner',
|
|
customer_color_verify = '$customer_color_verify',
|
|
customer_color_verify_at = '$customer_color_verify_at',
|
|
customer_color_verify_owner = '$customer_color_verify_owner',
|
|
customer_style_verify = '$customer_style_verify',
|
|
customer_style_verify_at = '$customer_style_verify_at',
|
|
customer_style_verify_owner = '$customer_style_verify_owner',
|
|
site_survey_contact_form_verify = '$site_survey_contact_form_verify',
|
|
site_survey_contact_form_verify_at = '$site_survey_contact_form_verify_at',
|
|
site_survey_contact_form_verify_owner = '$site_survey_contact_form_verify_owner',
|
|
delivery_date = '$delivery_date',
|
|
delivery_date_owner = '$delivery_date_owner',
|
|
marketing_remark = '',
|
|
";
|
|
if (!empty(trim($marketing_remark))) {
|
|
$updatesql .= "
|
|
all_remark = CONCAT('" . $user_id . accountidToName($user_id) . "_" . $datetime . "<br/>" . $marketing_remark . "<br/><br/>',IF(all_remark IS NULL,'',all_remark)),
|
|
";
|
|
}
|
|
$updatesql .= empty($sales_spec_verify_file) ? "" : "sales_spec_verify_file = '$sales_spec_verify_file',";
|
|
$updatesql .= empty($customer_color_verify_file) ? "" : "customer_color_verify_file = '$customer_color_verify_file',";
|
|
$updatesql .= empty($customer_style_verify_file) ? "" : "customer_style_verify_file = '$customer_style_verify_file',";
|
|
$updatesql .= empty($site_survey_contact_form_verify_file) ? "" : "site_survey_contact_form_verify_file = '$site_survey_contact_form_verify_file',";
|
|
} else if ($user_department_id == 911) {
|
|
// 設計主管
|
|
if ($role_id == 1) {
|
|
$updatesql .= "
|
|
desin_leader_verify = '$desin_leader_verify',
|
|
desin_leader_verify_at = '$desin_leader_verify_at',
|
|
desin_leader_verify_owner = '$desin_leader_verify_owner',
|
|
desin_leader_remark = '',
|
|
";
|
|
if (!empty(trim($desin_leader_remark))) {
|
|
$updatesql .= "
|
|
all_remark = CONCAT('" . $user_id . accountidToName($user_id) . "_" . $datetime . "<br/>" . $desin_leader_remark . "<br/><br/>',IF(all_remark IS NULL,'',all_remark)),
|
|
";
|
|
}
|
|
if (!empty($desin_leader_verify_file))
|
|
$updatesql .= "desin_leader_verify_file = '$desin_leader_verify_file', ";
|
|
} else {
|
|
// 設計更新
|
|
$updatesql .= "
|
|
desin_spec_verify = '$desin_spec_verify',
|
|
desin_spec_verify_at = '$desin_spec_verify_at',
|
|
desin_spec_verify_owner = '$desin_spec_verify_owner',
|
|
desin_planning_verify = '$desin_planning_verify',
|
|
desin_planning_verify_at = '$desin_planning_verify_at',
|
|
desin_planning_verify_owner = '$desin_planning_verify_owner',
|
|
desin_color_verify = '$desin_color_verify',
|
|
desin_color_verify_at = '$desin_color_verify_at',
|
|
desin_color_verify_owner = '$desin_color_verify_owner',
|
|
desin_style_verify = '$desin_style_verify',
|
|
desin_style_verify_at = '$desin_style_verify_at',
|
|
desin_style_verify_owner = '$desin_style_verify_owner',
|
|
desin_taiwan_items_no = '$desin_taiwan_items_no',
|
|
desin_taiwan_items_name = '$desin_taiwan_items_name',
|
|
desin_remark = '',
|
|
";
|
|
if (!empty(trim($desin_remark))) {
|
|
$updatesql .= "
|
|
all_remark = CONCAT('" . $user_id . accountidToName($user_id) . "_" . $datetime . "<br/>" . $desin_remark . "<br/><br/>',IF(all_remark IS NULL,'',all_remark)),
|
|
";
|
|
}
|
|
$updatesql .= empty($desin_spec_verify_file) ? "" : "desin_spec_verify_file = '$desin_spec_verify_file',";
|
|
$updatesql .= empty($desin_planning_verify_file) ? "" : "desin_planning_verify_file = '$desin_planning_verify_file',";
|
|
$updatesql .= empty($desin_color_verify_file) ? "" : "desin_color_verify_file = '$desin_color_verify_file',";
|
|
$updatesql .= empty($desin_style_verify_file) ? "" : "desin_style_verify_file = '$desin_style_verify_file',";
|
|
$updatesql .= empty($desin_documents_verify_file) ? "" : "desin_documents_verify_file = '$desin_documents_verify_file',";
|
|
}
|
|
} else if ($user_department_id == 321) {
|
|
// 共用更新
|
|
// $updatesql .= "
|
|
// contractno = '$contractno',
|
|
// facility_temp_no = '$facility_temp_no',
|
|
// renovate_type = '$renovate_type',
|
|
// facilityno = '$facilityno',
|
|
// custom='$custom' ,
|
|
// latitude = '$latitude',
|
|
// longitude = '$longitude',
|
|
// weight = '$weight',
|
|
// numberofpassenger = '$numberofpassenger',
|
|
// numberofstop = '$numberofstop',
|
|
// numberoffloor = '$numberoffloor',
|
|
// opentype = '$opentype',
|
|
// speed = '$speed',
|
|
// site_manager = '$site_manager',
|
|
// address = '$address',
|
|
// real_address = '$real_address',
|
|
// contract_arrival_date = '$contract_arrival_date',
|
|
// facility_kind = '$facility_kind',
|
|
// ";
|
|
|
|
// 業務更新
|
|
$updatesql .= "
|
|
prattford_order_date_verify = '$prattford_order_date_verify' ,
|
|
prattford_order_date = '$prattford_order_date',
|
|
prattford_order_date_owner = '$prattford_order_date_owner',
|
|
estimated_shipping_date_verify = '$estimated_shipping_date_verify',
|
|
estimated_shipping_date = '$estimated_shipping_date',
|
|
estimated_shipping_date_owner = '$estimated_shipping_date_owner',
|
|
estimated_shipping_schedule_date_verify = '$estimated_shipping_schedule_date_verify',
|
|
estimated_shipping_schedule_date = '$estimated_shipping_schedule_date',
|
|
estimated_shipping_schedule_date_owner = '$estimated_shipping_schedule_date_owner',
|
|
goods_type = '$goods_type',
|
|
goods_type_date = '$goods_type_date',
|
|
goods_type_owner = '$goods_type_owner',
|
|
taiwan_goods_type = '$taiwan_goods_type',
|
|
taiwan_goods_type_date = '$taiwan_goods_type_date',
|
|
taiwan_goods_type_owner = '$taiwan_goods_type_owner',
|
|
shengguanok_status = '$shengguanok_status',
|
|
shengguanok_status_at = '$shengguanok_status_at',
|
|
shengguanok_status_owner = '$shengguanok_status_owner',
|
|
";
|
|
$updatesql .= empty($shengguanok_status_file) ? "" : "shengguanok_status_file = '$shengguanok_status_file',";
|
|
$updatesql .= "yewu_remark = '', ";
|
|
if (!empty(trim($yewu_remark))) {
|
|
$updatesql .= "
|
|
all_remark = CONCAT('" . $user_id . accountidToName($user_id) . "_" . $datetime . "<br/>" . $yewu_remark . "<br/><br/>',IF(all_remark IS NULL,'',all_remark)),
|
|
";
|
|
}
|
|
} else if ($user_department_id == 220) {
|
|
// 共用更新
|
|
$updatesql .= "
|
|
contractno = '$contractno',
|
|
facility_temp_no = '$facility_temp_no',
|
|
renovate_type = '$renovate_type',
|
|
facilityno = '$facilityno',
|
|
custom='$custom' ,
|
|
latitude = '$latitude',
|
|
longitude = '$longitude',
|
|
weight = '$weight',
|
|
numberofpassenger = '$numberofpassenger',
|
|
numberofstop = '$numberofstop',
|
|
numberoffloor = '$numberoffloor',
|
|
opentype = '$opentype',
|
|
speed = '$speed',
|
|
site_manager = '$site_manager',
|
|
address = '$address',
|
|
real_address = '$real_address',
|
|
contract_arrival_date = '$contract_arrival_date',
|
|
real_contract_arrival_date = '$real_contract_arrival_date',
|
|
facility_kind = '$facility_kind',
|
|
";
|
|
} else if ($user_department_id == 912) {
|
|
// 品證部
|
|
$updatesql .= "
|
|
qc_date = '$qc_date',
|
|
qc_date_owner = '$qc_date_owner',
|
|
end_qc_date = '$end_qc_date',
|
|
end_qc_date_owner = '$end_qc_date_owner',
|
|
official_check_date = '$official_check_date',
|
|
official_check_date_owner = '$official_check_date_owner',
|
|
";
|
|
if (!empty($official_check_file))
|
|
$updatesql .= "official_check_file = '$official_check_file', ";
|
|
}
|
|
|
|
if (in_array($user_id, ['M0175', 'M0079', 'M0060'])) {
|
|
// 暫時可編輯及刪除權限
|
|
$updatesql .= "
|
|
contractno = '$contractno',
|
|
facility_temp_no = '$facility_temp_no',
|
|
renovate_type = '$renovate_type',
|
|
facilityno = '$facilityno',
|
|
custom='$custom' ,
|
|
latitude = '$latitude',
|
|
longitude = '$longitude',
|
|
weight = '$weight',
|
|
numberofpassenger = '$numberofpassenger',
|
|
numberofstop = '$numberofstop',
|
|
numberoffloor = '$numberoffloor',
|
|
opentype = '$opentype',
|
|
speed = '$speed',
|
|
site_manager = '$site_manager',
|
|
address = '$address',
|
|
contract_arrival_date = '$contract_arrival_date',
|
|
facility_kind = '$facility_kind',
|
|
";
|
|
}
|
|
|
|
// 工務助理
|
|
if (in_array($user_id, ['M0164', 'M0165', 'M0127', 'M0193', 'M0170', 'M0188', 'M0117'])) {
|
|
$updatesql .= "
|
|
outsourcer_type = '$outsourcer_type',
|
|
install_outsourcer = '$install_outsourcer',
|
|
install_outsourcer_owner = '$install_outsourcer_owner',
|
|
install_outsourcer_date = '$install_outsourcer_date',
|
|
install_outsourcer_date_owner = '$install_outsourcer_date_owner',
|
|
estimate_install_start_date = '$estimate_install_start_date',
|
|
estimate_install_start_date_owner = '$estimate_install_start_date_owner',
|
|
estimate_install_end_date = '$estimate_install_end_date',
|
|
estimate_install_end_date_owner = '$estimate_install_end_date_owner',
|
|
tryrun_outsourcer = '$tryrun_outsourcer',
|
|
tryrun_outsourcer_owner = '$tryrun_outsourcer_owner',
|
|
tryrun_outsourcer_date = '$tryrun_outsourcer_date',
|
|
tryrun_outsourcer_date_owner = '$tryrun_outsourcer_date_owner',
|
|
estimate_tryrun_start_date = '$estimate_tryrun_start_date',
|
|
estimate_tryrun_start_date_owner = '$estimate_tryrun_start_date_owner',
|
|
estimate_tryrun_end_date = '$estimate_tryrun_end_date',
|
|
estimate_tryrun_end_date_owner = '$estimate_tryrun_end_date_owner',
|
|
warehouse_assistant_remark = '$warehouse_assistant_remark',
|
|
";
|
|
if (!empty($plan_diagram_file)) {
|
|
$updatesql .= "plan_diagram_file = '$plan_diagram_file', ";
|
|
$updatesql .= "
|
|
all_remark = CONCAT('" . $user_id . accountidToName($user_id) . "_" . $datetime . "<br/>上傳了安裝圖附件<br/><br/>',IF(all_remark IS NULL,'',all_remark)),
|
|
";
|
|
}
|
|
if (!empty($completion_acceptance_file)) {
|
|
$updatesql .= "completion_acceptance_file = '$completion_acceptance_file', ";
|
|
$updatesql .= "
|
|
all_remark = CONCAT('" . $user_id . accountidToName($user_id) . "_" . $datetime . "<br/>上傳了完工驗收單附件<br/><br/>',IF(all_remark IS NULL,'',all_remark)),
|
|
";
|
|
}
|
|
if (!empty($outsourcer_contract_file)) {
|
|
$updatesql .= "outsourcer_contract_file = '$outsourcer_contract_file', ";
|
|
}
|
|
}
|
|
|
|
// 許協更新業務確認項目權限
|
|
if ($user_id == 'M0060') {
|
|
$updatesql .= "
|
|
prattford_order_date_verify = '$prattford_order_date_verify' ,
|
|
prattford_order_date = '$prattford_order_date',
|
|
prattford_order_date_owner = '$prattford_order_date_owner',
|
|
estimated_shipping_date_verify = '$estimated_shipping_date_verify',
|
|
estimated_shipping_date = '$estimated_shipping_date',
|
|
estimated_shipping_date_owner = '$estimated_shipping_date_owner',
|
|
estimated_shipping_schedule_date_verify = '$estimated_shipping_schedule_date_verify',
|
|
estimated_shipping_schedule_date = '$estimated_shipping_schedule_date',
|
|
estimated_shipping_schedule_date_owner = '$estimated_shipping_schedule_date_owner',
|
|
goods_type = '$goods_type',
|
|
goods_type_date = '$goods_type_date',
|
|
goods_type_owner = '$goods_type_owner',
|
|
taiwan_goods_type = '$taiwan_goods_type',
|
|
taiwan_goods_type_date = '$taiwan_goods_type_date',
|
|
taiwan_goods_type_owner = '$taiwan_goods_type_owner',
|
|
shengguanok_status = '$shengguanok_status',
|
|
shengguanok_status_at = '$shengguanok_status_at',
|
|
shengguanok_status_owner = '$shengguanok_status_owner',
|
|
yewu_remark = '',
|
|
";
|
|
}
|
|
|
|
// 生管 小雯 預計到貨日(到觀音廠日)權限
|
|
if ($user_id == 'M0168') {
|
|
$updatesql .= "
|
|
estimated_shipping_schedule_date_verify = '$estimated_shipping_schedule_date_verify',
|
|
estimated_shipping_schedule_date = '$estimated_shipping_schedule_date',
|
|
estimated_shipping_schedule_date_owner = '$estimated_shipping_schedule_date_owner',
|
|
";
|
|
}
|
|
|
|
$updatesql .= "
|
|
creater = '$creater',
|
|
create_at = '$create_at'
|
|
WHERE 1=1
|
|
AND id = '$id'
|
|
";
|
|
// echo $updatesql;
|
|
// exit;
|
|
mysqli_query($link, $updatesql);
|
|
echo "
|
|
<script type ='text/JavaScript'>
|
|
alert('資料更新成功');
|
|
location.href='wipwhole-renovate-rec-invoice-edit.php?function_name=wipwholerenstatus&id=$id&$token_link';
|
|
</script>
|
|
";
|
|
}
|
|
}
|
|
|
|
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
|
if ($_POST['form_name'] == 'assign_form') {
|
|
foreach ($_POST as $k => $v)
|
|
$$k = htmlspecialchars(stripslashes(trim($v)));
|
|
// 檢查簽核狀態
|
|
checkWwsAssianStatus($link, $user_id);
|
|
echo "
|
|
<script type ='text/JavaScript'>
|
|
alert('此表單已進入下個階段');
|
|
location.href='wipwhole-renovate-rec-invoice-edit.php?function_name=pricereview&id=$id&$token_link';
|
|
</script>
|
|
";
|
|
}
|
|
}
|
|
|
|
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
|
if ($_POST['form_name'] == 'back_marketing_assign_form') {
|
|
foreach ($_POST as $k => $v)
|
|
$$k = htmlspecialchars(stripslashes(trim($v)));
|
|
backMarketingSssign($link, $salesid, $user_id);
|
|
echo "
|
|
<script type ='text/JavaScript'>
|
|
alert('此表單已退回至營業階段');
|
|
location.href='wipwhole-renovate-rec-invoice-edit.php?function_name=pricereview&id=$id&$token_link';
|
|
</script>
|
|
";
|
|
}
|
|
}
|
|
|
|
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
|
if ($_POST['form_name'] == 'back_design_assign_form') {
|
|
foreach ($_POST as $k => $v)
|
|
$$k = htmlspecialchars(stripslashes(trim($v)));
|
|
backDesignssign($link, $user_id);
|
|
echo "
|
|
<script type ='text/JavaScript'>
|
|
alert('此表單已退回至設計階段');
|
|
location.href='wipwhole-renovate-rec-invoice-edit.php?function_name=pricereview&id=$id&$token_link';
|
|
</script>
|
|
";
|
|
}
|
|
}
|
|
|
|
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
|
if ($_POST['form_name'] == 'warehouse_assign_form') {
|
|
foreach ($_POST as $k => $v)
|
|
$$k = htmlspecialchars(stripslashes(trim($v)));
|
|
backWarehouse($link, $user_id);
|
|
echo "
|
|
<script type ='text/JavaScript'>
|
|
alert('此表單已退回至設計階段');
|
|
location.href='wipwhole-renovate-rec-invoice-edit.php?function_name=pricereview&id=$id&$token_link';
|
|
</script>
|
|
";
|
|
}
|
|
}
|
|
|
|
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
|
if ($_POST['form_name'] == 'update_contract_date_form') {
|
|
foreach ($_POST as $k => $v)
|
|
$$k = htmlspecialchars(stripslashes(trim($v)));
|
|
|
|
$contractno = $_POST['contractno'];
|
|
$facilityno = $_POST['facilityno'];
|
|
$custom = $_POST['custom'];
|
|
$creater = $_POST['creater'];
|
|
$create_at = $_POST['create_at'];
|
|
$old_real_contract_arrival_date = $_POST['old_real_contract_arrival_date'];
|
|
$real_contract_arrival_date = $_POST['real_contract_arrival_date'];
|
|
$salesid = $_POST['salesid'];
|
|
$gongWuokid = $_POST['gongWuokid'];
|
|
$updatesql = "
|
|
UPDATE wipwholestatus
|
|
SET
|
|
real_contract_arrival_date = '$real_contract_arrival_date',
|
|
creater = '$creater',
|
|
create_at = '$create_at'
|
|
WHERE id = '$id'
|
|
";
|
|
mysqli_query($link, $updatesql);
|
|
|
|
$content = "合約號 : $contractno
|
|
作番號 : $facilityno
|
|
出貨日期微調: " . substr($old_real_contract_arrival_date, 0, 10) . " => " . substr($real_contract_arrival_date, 0, 10);
|
|
|
|
$sql = "
|
|
INSERT INTO notice (
|
|
kind,
|
|
related_id,
|
|
title,
|
|
content,
|
|
haveread,
|
|
permission,
|
|
creater,
|
|
create_at
|
|
) VALUES(
|
|
'1',
|
|
'$id',
|
|
'作番大日程(汰改)出貨日調整通知 > " . $facilityno . "',
|
|
'$content',
|
|
NULL,
|
|
'$salesid',
|
|
'system',
|
|
'" . date("Y-m-d H:i:s") . "'
|
|
)
|
|
";
|
|
mysqli_query($link, $sql);
|
|
$sql = "
|
|
INSERT INTO notice (
|
|
kind,
|
|
related_id,
|
|
title,
|
|
content,
|
|
haveread,
|
|
permission,
|
|
creater,
|
|
create_at
|
|
) VALUES(
|
|
'1',
|
|
'$id',
|
|
'作番大日程(汰改)出貨日調整通知 > " . $facilityno . "',
|
|
'$content',
|
|
NULL,
|
|
'$gongWuokid',
|
|
'system',
|
|
'" . date("Y-m-d H:i:s") . "'
|
|
)
|
|
";
|
|
mysqli_query($link, $sql);
|
|
|
|
$sql = "
|
|
INSERT INTO wipwhole_change_contractdate_details (
|
|
creater,
|
|
create_at,
|
|
wipwholestatus_id,
|
|
change_status,
|
|
old_change_date,
|
|
change_date
|
|
) VALUES(
|
|
'$creater',
|
|
'$create_at',
|
|
'$id',
|
|
'Z',
|
|
'$old_real_contract_arrival_date',
|
|
'$real_contract_arrival_date'
|
|
)
|
|
";
|
|
mysqli_query($link, $sql);
|
|
|
|
// 檢查簽核狀態
|
|
echo "<script type ='text/JavaScript'>";
|
|
echo "alert('已更新日期且通知營業人員及工務人員');";
|
|
echo "location.href='wipwhole-renovate-rec-invoice-edit.php?function_name=pricereview&id=$id&" . $token_link . "';";
|
|
echo "</script>";
|
|
}
|
|
}
|
|
|
|
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
|
if ($_POST['form_name'] == 'update_date_form') {
|
|
|
|
$creater = $user_id;
|
|
|
|
foreach ($_POST as $k => $v)
|
|
$$k = htmlspecialchars(stripslashes(trim($v)));
|
|
|
|
$real_arrival_date = $_POST['real_arrival_date'];
|
|
$updatesql = "
|
|
UPDATE wipwholestatus
|
|
SET
|
|
real_arrival_date = '$real_arrival_date'
|
|
WHERE id = '$id'
|
|
";
|
|
mysqli_query($link, $updatesql);
|
|
|
|
$sql = "
|
|
SELECT
|
|
`custom`,
|
|
`facilityno`,
|
|
`salesid`
|
|
FROM `wipwholestatus`
|
|
where `id` = '$id'
|
|
";
|
|
$result = mysqli_query($link, $sql);
|
|
foreach ($result as $row) {
|
|
$permission = $row["salesid"];
|
|
$title = "客戶:$custom 作番:$facilityno 實際出貨日變更";
|
|
$content = "客戶:$custom
|
|
作番:$facilityno
|
|
實際出貨日(到工地):$real_arrival_date";
|
|
|
|
$sql = "
|
|
INSERT INTO notice(
|
|
kind,
|
|
related_id,
|
|
title,
|
|
content,
|
|
haveread,
|
|
permission,
|
|
creater,
|
|
create_at
|
|
)VALUES(
|
|
'1',
|
|
'$id',
|
|
'$title',
|
|
'$content',
|
|
null,
|
|
'$permission',
|
|
'$creater',
|
|
'" . date("Y-m-d H:i:s") . "'
|
|
);
|
|
";
|
|
mysqli_query($link, $sql);
|
|
}
|
|
|
|
|
|
echo "<script type ='text/JavaScript'>";
|
|
echo "alert('已更新日期');";
|
|
echo "location.href='wipwhole-renovate-rec-invoice-edit.php?function_name=pricereview&id=$id&" . $token_link . "';";
|
|
echo "</script>";
|
|
}
|
|
}
|
|
|
|
|
|
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
|
if ($_POST['form_name'] == 'update_install_date_form') {
|
|
foreach ($_POST as $k => $v)
|
|
$$k = htmlspecialchars(stripslashes(trim($v)));
|
|
|
|
$change_all_contractno = $_POST['change_all_contractno'];
|
|
$contractno = $_POST['contractno2'];
|
|
$install_start_date = $_POST['install_start_date'];
|
|
$install_start_date_owner = $_POST['install_start_date_owner'];
|
|
$install_end_date = $_POST['install_end_date'];
|
|
$install_end_date_owner = $_POST['install_end_date_owner'];
|
|
$tryrun_start_date = $_POST['tryrun_start_date'];
|
|
$tryrun_start_date_owner = $_POST['tryrun_start_date_owner'];
|
|
$tryrun_end_date = $_POST['tryrun_end_date'];
|
|
$tryrun_end_date_owner = $_POST['tryrun_end_date_owner'];
|
|
|
|
$updatesql = "
|
|
UPDATE wipwholestatus
|
|
SET
|
|
install_start_date = '$install_start_date',
|
|
install_start_date_owner = '$install_start_date_owner',
|
|
install_end_date = '$install_end_date',
|
|
install_end_date_owner = '$install_end_date_owner',
|
|
tryrun_start_date = '$tryrun_start_date',
|
|
tryrun_start_date_owner = '$tryrun_start_date_owner',
|
|
tryrun_end_date = '$tryrun_end_date',
|
|
tryrun_end_date_owner = '$tryrun_end_date_owner'
|
|
";
|
|
if (empty($change_all_contractno)) {
|
|
$updatesql .= "WHERE id = '$id' ";
|
|
} else {
|
|
$updatesql .= "WHERE contractno = '$contractno' ";
|
|
}
|
|
// echo $updatesql;
|
|
// exit;
|
|
mysqli_query($link, $updatesql);
|
|
|
|
echo "<script type ='text/JavaScript'>";
|
|
echo "alert('已更新日期');";
|
|
echo "location.href='wipwhole-renovate-rec-invoice-edit.php?function_name=pricereview&id=$id&" . $token_link . "';";
|
|
echo "</script>";
|
|
}
|
|
}
|
|
|
|
|
|
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
|
if ($_POST['form_name'] == 'update_shengguan_form') {
|
|
foreach ($_POST as $k => $v)
|
|
$$k = htmlspecialchars(stripslashes(trim($v)));
|
|
|
|
$creater = $_POST['creater'];
|
|
$datetime = date("Y-m-d H:i:s");
|
|
$shengguan_remark = $_POST['shengguan_remark'];
|
|
$updatesql = "
|
|
UPDATE wipwholestatus
|
|
SET shengguan_remark = '$shengguan_remark',
|
|
arrival_date_verify = '$arrival_date_verify',
|
|
actual_tofactory_date = '$actual_tofactory_date',
|
|
arrival_date_owner = '$arrival_date_owner',
|
|
";
|
|
if (!empty(trim($shengguan_remark))) {
|
|
$updatesql .= "
|
|
all_remark = CONCAT('" . $user_id . accountidToName($user_id) . "_" . $datetime . "<br/>" . $shengguan_remark . "<br/><br/>',IF(all_remark IS NULL,'',all_remark)),
|
|
";
|
|
}
|
|
$updatesql .= "
|
|
creater = '$creater',
|
|
create_at = '$datetime'
|
|
WHERE id = '$id'
|
|
";
|
|
mysqli_query($link, $updatesql);
|
|
echo "<script type ='text/JavaScript'>";
|
|
echo "alert('已存檔');";
|
|
echo "location.href='wipwhole-renovate-rec-invoice-edit.php?function_name=pricereview&id=$id&" . $token_link . "';";
|
|
echo "</script>";
|
|
}
|
|
}
|
|
|
|
// 退回至工務階段
|
|
function backWarehouse($link, $user_id)
|
|
{
|
|
if (isset($_GET['id']) || isset($_GET['form_key'])) {
|
|
$id = isset($_GET['id']) ? $_GET['id'] : getId($link, $_GET['form_key']);
|
|
$form_key = isset($_GET['form_key']) ? $_GET['form_key'] : getForm_key($link, $id);
|
|
write_note($link, $id, $user_id, "<em>退回至工務階段</em>");
|
|
do_wws_next_assign(getGongWuokNo($link), $form_key, 'A');
|
|
}
|
|
}
|
|
|
|
|
|
// 退回至營業階段
|
|
function backMarketingSssign($link, $salesid, $user_id)
|
|
{
|
|
if (isset($_GET['id']) || isset($_GET['form_key'])) {
|
|
$id = isset($_GET['id']) ? $_GET['id'] : getId($link, $_GET['form_key']);
|
|
$form_key = isset($_GET['form_key']) ? $_GET['form_key'] : getForm_key($link, $id);
|
|
write_note($link, $id, $user_id, "<em>退回至營業階段</em>");
|
|
do_wws_next_assign($salesid, $form_key, 'B');
|
|
}
|
|
}
|
|
|
|
// 退回至設計階段
|
|
function backDesignssign($link, $user_id)
|
|
{
|
|
if (isset($_GET['id']) || isset($_GET['form_key'])) {
|
|
$id = isset($_GET['id']) ? $_GET['id'] : getId($link, $_GET['form_key']);
|
|
$form_key = isset($_GET['form_key']) ? $_GET['form_key'] : getForm_key($link, $id);
|
|
write_note($link, $id, $user_id, "<em>退回至設計階段</em>");
|
|
do_wws_next_assign("M0173", $form_key, 'C');
|
|
}
|
|
}
|
|
|
|
function write_note($link, $id, $user_id, $content)
|
|
{
|
|
$datetime = date("Y-m-d H:i:s");
|
|
$updatesql = "
|
|
UPDATE wipwholestatus
|
|
SET
|
|
all_remark = CONCAT('" . $user_id . accountidToName($user_id) . "_" . $datetime . "<br/>" . $content . "<br/><br/>', IF(all_remark IS NULL,'',all_remark))
|
|
WHERE id = '$id'
|
|
";
|
|
mysqli_query($link, $updatesql);
|
|
}
|
|
|
|
// 表單簽核狀態檢查主程式
|
|
function checkWwsAssianStatus($link, $user_id)
|
|
{
|
|
if (isset($_GET['id']) || isset($_GET['form_key'])) {
|
|
$id = isset($_GET['id']) ? $_GET['id'] : getId($link, $_GET['form_key']);
|
|
$form_key = isset($_GET['form_key']) ? $_GET['form_key'] : getForm_key($link, $id);
|
|
}
|
|
|
|
include "./class/Cmail.php";
|
|
$cmail = new Cmail();
|
|
$data = getWipwholestatusDetail($link, $id);
|
|
$data['salesname'] = accountid2name($data['salesid'])[$data['salesid']];
|
|
$data['salesmail'] = accountid2email([$data['salesid']])[$data['salesid']];
|
|
|
|
$data['salesmanagername'] = accountid2name(manage_class($data['salesid'])[0])[manage_class($data['salesid'])[0]];
|
|
$data['salesmanagermail'] = accountid2email([manage_class($data['salesid'])[0]])[manage_class($data['salesid'])[0]];
|
|
$data['designname'] = accountid2name("M0023")["M0023"];
|
|
$data['designmail'] = accountid2email(["M0023"])["M0023"];
|
|
$data['designleadername'] = accountid2name(getSheJiokLeaderNo($link))[getSheJiokLeaderNo($link)];
|
|
$data['designleadermail'] = accountid2email([getSheJiokLeaderNo($link)])[getSheJiokLeaderNo($link)];
|
|
$data['gongwokname'] = accountid2name(getGongWuokNo($link))[getGongWuokNo($link)];
|
|
$data['gongwokmail'] = accountid2email([getGongWuokNo($link)])[getGongWuokNo($link)];
|
|
$data['shengguanname'] = accountid2name(getShengGuanokLeaderNo($link))[getShengGuanokLeaderNo($link)];
|
|
$data['shengguanmail'] = accountid2email([getShengGuanokLeaderNo($link)])[getShengGuanokLeaderNo($link)];
|
|
|
|
// 確認工務階段 進入營業階段
|
|
if (checkNowFormStatus($link) == 'A' && checkGongWuok($link, $id) == '0') {
|
|
write_note($link, $id, $user_id, "<em>工務提交至營業階段</em>");
|
|
do_wws_next_assign(getYingYeokNo($link), $form_key, 'B');
|
|
return;
|
|
}
|
|
|
|
// 確認營業階段 進入設計人員(汰改:林坤翰 M0052 改 林昭翰 M0173)階段
|
|
if (checkNowFormStatus($link) == 'B' && checkYingYeok($link, $id) == '0') {
|
|
if (checkUseridIsManager($user_id)) {
|
|
write_note($link, $id, $user_id, "<em>營業提交至設計階段</em>");
|
|
$mail_title = "作番大日程(汰改)合約號:" . $data['contractno'] . "作番號:" . $data['facilityno'] . "-營業提交至設計階段";
|
|
$mail_content = "作番大日程(汰改)合約號:" . $data['contractno'] . "作番號:" . $data['facilityno'] . "-營業提交至設計階段";
|
|
$cmail->sendx(
|
|
$mail_title,
|
|
$mail_content,
|
|
[
|
|
[$data['salesname'], $data['salesmail']],
|
|
[$data['designname'], $data['designmail']]
|
|
],
|
|
"永佳捷科技"
|
|
);
|
|
do_wws_next_assign("M0173", $form_key, 'C');
|
|
return;
|
|
} else {
|
|
write_note($link, $id, $user_id, "<em>營業提交至營業經理階段</em>");
|
|
$mail_title = "作番大日程(汰改)合約號:" . $data['contractno'] . "作番號:" . $data['facilityno'] . "-營業提交至營業經理階段";
|
|
$mail_content = "作番大日程(汰改)合約號:" . $data['contractno'] . "作番號:" . $data['facilityno'] . "-營業提交至營業經理階段";
|
|
$cmail->sendx(
|
|
$mail_title,
|
|
$mail_content,
|
|
[
|
|
[$data['salesname'], $data['salesmail']],
|
|
[$data['salesmanagername'], $data['salesmanagermail']]
|
|
],
|
|
"永佳捷科技"
|
|
);
|
|
do_wws_next_assign(manage_class($data['salesid'])[0], $form_key, 'F');
|
|
}
|
|
}
|
|
|
|
// 確認營業主管階段 進入設計人員(汰改:林昭翰 M0173)階段
|
|
if (checkNowFormStatus($link) == 'F' && checkYingYeok($link, $id) == '0') {
|
|
if (checkUseridIsManager($user_id)) {
|
|
write_note($link, $id, $user_id, "<em>營業經理提交至設計階段</em>");
|
|
$mail_title = "作番大日程(汰改)合約號:" . $data['contractno'] . "作番號:" . $data['facilityno'] . "-營業經理提交至設計階段";
|
|
$mail_content = "作番大日程(汰改)合約號:" . $data['contractno'] . "作番號:" . $data['facilityno'] . "-營業經理提交至設計階段";
|
|
$cmail->sendx(
|
|
$mail_title,
|
|
$mail_content,
|
|
[
|
|
[$data['salesname'], $data['salesmail']],
|
|
[$data['designname'], $data['designmail']]
|
|
],
|
|
"永佳捷科技"
|
|
);
|
|
do_wws_next_assign("M0173", $form_YD_key, 'C');
|
|
return true;
|
|
}
|
|
}
|
|
|
|
// 確認設計人員(汰改:林坤翰 M0052 改 林昭翰 M0173)階段 進入設計主管階段
|
|
if (checkNowFormStatus($link) == 'C' && checkSheJiok($link, $id) == '0') {
|
|
write_note($link, $id, $user_id, "<em>設計提交至設計主管階段</em>");
|
|
do_wws_next_assign(getSheJiokLeaderNo($link), $form_key, 'D');
|
|
return;
|
|
}
|
|
// 確認設計主管(江京鴻 M0019)階段 進入生管階段
|
|
if (checkNowFormStatus($link) == 'D' && checkSheJiokLeader($link, $id) == '0') {
|
|
write_note($link, $id, $user_id, "<em>設計主管提交至生管階段</em>");
|
|
do_wws_next_assign(getShengGuanokLeaderNo($link), $form_key, 'E');
|
|
return;
|
|
}
|
|
|
|
// 確認生管階段(營業部及設計部) 結束簽核流程
|
|
if (checkNowFormStatus($link) == 'E' && checkShengGuanok($link, $id) == '0') {
|
|
write_note($link, $id, $user_id, "<em>進入結案階段</em>");
|
|
do_wws_next_assign('00000', $form_key, 'Z');
|
|
return;
|
|
}
|
|
}
|
|
|