diff --git a/wms/wipwhole-rec-invoice-edit-submit.php b/wms/wipwhole-rec-invoice-edit-submit.php index 14803ce7..e3e07ea5 100644 --- a/wms/wipwhole-rec-invoice-edit-submit.php +++ b/wms/wipwhole-rec-invoice-edit-submit.php @@ -543,25 +543,25 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") { // $tryrun_end_date = $_POST['tryrun_end_date2'] ?: $row['tryrun_end_date']; // $tryrun_end_date_owner = $_POST['tryrun_end_date2_owner'] ?: $row['tryrun_end_date_owner']; - $outsourcer_type = isset($_POST['outsourcer_type'])? $_POST['outsourcer_type'] : $row['outsourcer_type']; - $qc_official_type = isset($_POST['qc_official_type2'])? $_POST['qc_official_type2'] : $row['qc_official_type']; - $qc_date = isset($_POST['qc_date2'])? $_POST['qc_date2'] : $row['qc_date']; - $qc_date_owner = isset($_POST['qc_date2_owner'])? $_POST['qc_date2_owner'] : $row['qc_date_owner']; - $end_qc_date = isset($_POST['end_qc_date2'])? $_POST['end_qc_date2'] : $row['end_qc_date']; - $end_qc_date_owner = isset($_POST['end_qc_date2_owner'])? $_POST['end_qc_date2_owner'] : $row['end_qc_date_owner']; - $official_check_date = isset($_POST['official_check_date2'])? $_POST['official_check_date2'] : $row['official_check_date']; - $old_official_check_date = isset($_POST['old_official_check_date2'])? $_POST['old_official_check_date2'] : $row['old_official_check_date']; - $official_check_date_owner = isset($_POST['official_check_date2_owner'])? $_POST['official_check_date2_owner'] : $row['official_check_date_owner']; - $delivery_date = isset($_POST['delivery_date2'])? $_POST['delivery_date2'] : $row['delivery_date']; - $delivery_date_owner = isset($_POST['delivery_date2_owner'])? $_POST['delivery_date2_owner'] : $row['delivery_date_owner']; - $install_start_date = isset($_POST['install_start_date2'])? $_POST['install_start_date2'] : $row['install_start_date']; - $install_start_date_owner = isset($_POST['install_start_date2_owner'])? $_POST['install_start_date2_owner'] : $row['install_start_date_owner']; - $install_end_date = isset($_POST['install_end_date2'])? $_POST['install_end_date2'] : $row['install_end_date']; - $install_end_date_owner = isset($_POST['install_end_date2_owner'])? $_POST['install_end_date2_owner'] : $row['install_end_date_owner']; - $tryrun_start_date = isset($_POST['tryrun_start_date2'])? $_POST['tryrun_start_date2'] : $row['tryrun_start_date']; - $tryrun_start_date_owner = isset($_POST['tryrun_start_date2_owner'])? $_POST['tryrun_start_date2_owner'] : $row['tryrun_start_date_owner']; - $tryrun_end_date = isset($_POST['tryrun_end_date2'])? $_POST['tryrun_end_date2'] : $row['tryrun_end_date']; - $tryrun_end_date_owner = isset($_POST['tryrun_end_date2_owner'])? $_POST['tryrun_end_date2_owner'] : $row['tryrun_end_date_owner']; + $outsourcer_type = isset($_POST['outsourcer_type']) ? $_POST['outsourcer_type'] : $row['outsourcer_type']; + $qc_official_type = isset($_POST['qc_official_type2']) ? $_POST['qc_official_type2'] : $row['qc_official_type']; + $qc_date = isset($_POST['qc_date2']) ? $_POST['qc_date2'] : $row['qc_date']; + $qc_date_owner = isset($_POST['qc_date2_owner']) ? $_POST['qc_date2_owner'] : $row['qc_date_owner']; + $end_qc_date = isset($_POST['end_qc_date2']) ? $_POST['end_qc_date2'] : $row['end_qc_date']; + $end_qc_date_owner = isset($_POST['end_qc_date2_owner']) ? $_POST['end_qc_date2_owner'] : $row['end_qc_date_owner']; + $official_check_date = isset($_POST['official_check_date2']) ? $_POST['official_check_date2'] : $row['official_check_date']; + $old_official_check_date = isset($_POST['old_official_check_date2']) ? $_POST['old_official_check_date2'] : $row['old_official_check_date']; + $official_check_date_owner = isset($_POST['official_check_date2_owner']) ? $_POST['official_check_date2_owner'] : $row['official_check_date_owner']; + $delivery_date = isset($_POST['delivery_date2']) ? $_POST['delivery_date2'] : $row['delivery_date']; + $delivery_date_owner = isset($_POST['delivery_date2_owner']) ? $_POST['delivery_date2_owner'] : $row['delivery_date_owner']; + $install_start_date = isset($_POST['install_start_date2']) ? $_POST['install_start_date2'] : $row['install_start_date']; + $install_start_date_owner = isset($_POST['install_start_date2_owner']) ? $_POST['install_start_date2_owner'] : $row['install_start_date_owner']; + $install_end_date = isset($_POST['install_end_date2']) ? $_POST['install_end_date2'] : $row['install_end_date']; + $install_end_date_owner = isset($_POST['install_end_date2_owner']) ? $_POST['install_end_date2_owner'] : $row['install_end_date_owner']; + $tryrun_start_date = isset($_POST['tryrun_start_date2']) ? $_POST['tryrun_start_date2'] : $row['tryrun_start_date']; + $tryrun_start_date_owner = isset($_POST['tryrun_start_date2_owner']) ? $_POST['tryrun_start_date2_owner'] : $row['tryrun_start_date_owner']; + $tryrun_end_date = isset($_POST['tryrun_end_date2']) ? $_POST['tryrun_end_date2'] : $row['tryrun_end_date']; + $tryrun_end_date_owner = isset($_POST['tryrun_end_date2_owner']) ? $_POST['tryrun_end_date2_owner'] : $row['tryrun_end_date_owner']; $updatesql .= " @@ -873,11 +873,13 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") { if ($_SERVER["REQUEST_METHOD"] == "POST") { if ($_POST['form_name'] == 'update_install_date_form') { + include "./class/Cmail.php"; + $cmail = new Cmail(); foreach ($_POST as $k => $v) $$k = htmlspecialchars(stripslashes(trim($v))); $change_all_contractno = $_POST['change_all_contractno']; - $contractno = $_POST['contractno2']; + $contractno2 = $_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']; @@ -886,6 +888,42 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") { $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']; + $old_delivery_date = $_POST['old_delivery_date']; + $delivery_date = $_POST['delivery_date']; + $delivery_date_owner = $_POST['delivery_date_owner']; + $contractno = $_POST['contractno']; + $facilityno = $_POST['facilityno']; + $salesid = $_POST['salesid']; + + $salesname = accountid2name($salesid)[$salesid]; + $salesmail = accountid2email([$salesid])[$salesid]; + + if ($old_delivery_date !== $delivery_date) { + + if (empty($change_all_contractno)) { + $mail_title = "作番大日程(新梯)合約號:" . $contractno . "-移交日變更通知"; + $mail_content = "作番大日程(新梯) + 合約號:" . $contractno + . " + 移交日:" . $old_delivery_date . " => " . $delivery_date; + } else { + $mail_title = "作番大日程(新梯)合約號:" . $contractno . "作番號:" . $facilityno . "-移交日變更通知"; + $mail_content = "作番大日程(新梯) + 合約號:" . $contractno + . " + 作番號:" . $facilityno + . " + 移交日:" . $old_delivery_date . " => " . $delivery_date; + } + $cmail->sendx( + $mail_title, + $mail_content, + [ + [$salesname, $salesmail] + ], + "永佳捷科技" + ); + } $updatesql = " UPDATE wipwholestatus @@ -897,12 +935,14 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") { 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' + tryrun_end_date_owner = '$tryrun_end_date_owner', + delivery_date = '$delivery_date', + delivery_date_owner = '$delivery_date_owner' "; if (empty($change_all_contractno)) { $updatesql .= "WHERE id = '$id' "; } else { - $updatesql .= "WHERE contractno = '$contractno' "; + $updatesql .= "WHERE contractno = '$contractno2' "; } // echo $updatesql; // exit; diff --git a/wms/wipwhole-rec-invoice-edit.php b/wms/wipwhole-rec-invoice-edit.php index a8346328..e458cb2d 100644 --- a/wms/wipwhole-rec-invoice-edit.php +++ b/wms/wipwhole-rec-invoice-edit.php @@ -497,7 +497,7 @@ include "wipwhole-rec-invoice-edit-submit.php"; -