|
|
@ -1,7 +1,7 @@ |
|
|
|
<?php |
|
|
|
include "../header.php"; |
|
|
|
|
|
|
|
if(isset($_POST['pmstatus'])) { |
|
|
|
if (isset($_POST['pmstatus'])) { |
|
|
|
//print_r($_POST);exit; |
|
|
|
foreach ($_POST as $k => $v) { |
|
|
|
$$k = htmlspecialchars(stripslashes(trim($v))); |
|
|
@ -52,9 +52,9 @@ if(isset($_POST['pmstatus'])) { |
|
|
|
$temp_file_name = $_FILES["attatch1"]["tmp_name"]; |
|
|
|
$file_size = $_FILES["attatch1"]["size"]; |
|
|
|
$img_file_type = pathinfo($file_name, PATHINFO_EXTENSION); |
|
|
|
$target_file1 = $target_dir.$contractno."-price-".$tds.".".$img_file_type; |
|
|
|
$target_file1 = $target_dir . $contractno . "-price-" . $tds . "." . $img_file_type; |
|
|
|
$upload_ok = 1; |
|
|
|
foreach (glob($target_dir.$contractno."-price-*") as $todelfile) { |
|
|
|
foreach (glob($target_dir . $contractno . "-price-*") as $todelfile) { |
|
|
|
unlink($todelfile); |
|
|
|
} |
|
|
|
$upload_res_1 = move_uploaded_file($temp_file_name, $target_file1); |
|
|
@ -62,7 +62,7 @@ if(isset($_POST['pmstatus'])) { |
|
|
|
} else { |
|
|
|
$target_file1 = ""; |
|
|
|
if ($file_price_del == 1) { |
|
|
|
foreach (glob($target_dir.$contractno."-price-*") as $todelfile) { |
|
|
|
foreach (glob($target_dir . $contractno . "-price-*") as $todelfile) { |
|
|
|
unlink($todelfile); |
|
|
|
} |
|
|
|
$sql_atta = "attatch1 = NULL, "; |
|
|
@ -75,9 +75,9 @@ if(isset($_POST['pmstatus'])) { |
|
|
|
$temp_file_name = $_FILES["attatch2"]["tmp_name"]; |
|
|
|
$file_size = $_FILES["attatch2"]["size"]; |
|
|
|
$img_file_type = pathinfo($file_name, PATHINFO_EXTENSION); |
|
|
|
$target_file2 = $target_dir.$contractno."-appendix-".$tds.".".$img_file_type; |
|
|
|
$target_file2 = $target_dir . $contractno . "-appendix-" . $tds . "." . $img_file_type; |
|
|
|
$upload_ok = 1; |
|
|
|
foreach (glob($target_dir.$contractno."-appendix-*") as $todelfile) { |
|
|
|
foreach (glob($target_dir . $contractno . "-appendix-*") as $todelfile) { |
|
|
|
unlink($todelfile); |
|
|
|
} |
|
|
|
$upload_res_2 = move_uploaded_file($temp_file_name, $target_file2); |
|
|
@ -85,7 +85,7 @@ if(isset($_POST['pmstatus'])) { |
|
|
|
} else { |
|
|
|
$target_file2 = ""; |
|
|
|
if ($file_appendix_del == 1) { |
|
|
|
foreach (glob($target_dir.$contractno."-appendix-*") as $todelfile) { |
|
|
|
foreach (glob($target_dir . $contractno . "-appendix-*") as $todelfile) { |
|
|
|
unlink($todelfile); |
|
|
|
} |
|
|
|
$sql_atta = "attatch2 = NULL, "; |
|
|
@ -169,7 +169,7 @@ if(isset($_POST['pmstatus'])) { |
|
|
|
$fp_seat_arr[$k] = (isset($fp_seat_arr[$k])) ? $fp_seat_arr[$k] : ""; |
|
|
|
$fp_numberofstop_arr[$k] = (isset($fp_numberofstop_arr[$k])) ? $fp_numberofstop_arr[$k] : ""; |
|
|
|
$fp_speed_arr[$k] = (isset($fp_speed_arr[$k])) ? $fp_speed_arr[$k] : ""; |
|
|
|
$note = $fp_kind_arr[$k].",".$fp_seat_arr[$k].",".$fp_numberofstop_arr[$k].",".$fp_speed_arr[$k]; |
|
|
|
$note = $fp_kind_arr[$k] . "," . $fp_seat_arr[$k] . "," . $fp_numberofstop_arr[$k] . "," . $fp_speed_arr[$k]; |
|
|
|
$db_query = "update pricereview_item set item_unit_price = '$item_unit_price_arr[$k]', item_qty = '$item_qty_arr[$k]', "; |
|
|
|
$db_query .= "item_price_bp = '$item_price_bp_arr[$k]', item_price_ct = '$item_price_ct_arr[$k]', note = '$note', "; |
|
|
|
$db_query .= "item_spec = '$item_spec_arr[$k]', item_weight = '$item_weight_arr[$k]', item_op = '$item_op_arr[$k]' "; |
|
|
@ -192,7 +192,7 @@ if(isset($_POST['pmstatus'])) { |
|
|
|
$nextno = $row[0] + 1; |
|
|
|
foreach ($to_ins_arr as $v) { |
|
|
|
if (!$fp_id_arr[$v]) $fp_id_arr[$v] = 0; |
|
|
|
$note = $fp_kind_arr[$v].",".$fp_seat_arr[$v].",".$fp_numberofstop_arr[$v].",".$fp_speed_arr[$v]; |
|
|
|
$note = $fp_kind_arr[$v] . "," . $fp_seat_arr[$v] . "," . $fp_numberofstop_arr[$v] . "," . $fp_speed_arr[$v]; |
|
|
|
$db_query = "insert into pricereview_item (mid, price_id, item_no, item_spec, item_weight, item_op, item_group, item_unit_price, item_qty, item_price_bp, "; |
|
|
|
$db_query .= "item_price_ct, item_price, gross_profit, gross_profit_rate, note) values ("; |
|
|
|
$db_query .= "'$id', '$fp_id_arr[$v]', '$nextno', '$item_spec_arr[$v]', '$item_weight_arr[$v]', '$item_op_arr[$v]', 'A', '$item_unit_price_arr[$v]', '$item_qty_arr[$v]', '$item_price_bp_arr[$v]', "; |
|
|
@ -223,7 +223,7 @@ if(isset($_POST['pmstatus'])) { |
|
|
|
$option_relate_spec = ""; |
|
|
|
$tmp_arr = explode("<br>", $option_relate_facil_arr[$k]); |
|
|
|
foreach ($tmp_arr as $val) { |
|
|
|
$option_relate_spec .= substr($val, 0, strpos($val, ".")).","; |
|
|
|
$option_relate_spec .= substr($val, 0, strpos($val, ".")) . ","; |
|
|
|
} |
|
|
|
$option_relate_spec = rtrim($option_relate_spec, ","); |
|
|
|
$db_query = "update pricereview_item set item_unit_price = '$option_unit_price_arr[$k]', item_qty = '$option_qty_arr[$k]', "; |
|
|
@ -251,7 +251,7 @@ if(isset($_POST['pmstatus'])) { |
|
|
|
$option_relate_spec = ""; |
|
|
|
$tmp_arr = explode("<br>", $option_relate_facil_arr[$k]); |
|
|
|
foreach ($tmp_arr as $val) { |
|
|
|
$option_relate_spec .= substr($val, 0, strpos($val, ".")).","; |
|
|
|
$option_relate_spec .= substr($val, 0, strpos($val, ".")) . ","; |
|
|
|
} |
|
|
|
$option_relate_spec = rtrim($option_relate_spec, ","); |
|
|
|
$db_query = "insert into pricereview_item (mid, price_id, item_no, item_spec, option_relate_spec, item_group, item_unit_price, item_qty, item_price_bp, memo) values ("; |
|
|
@ -284,11 +284,11 @@ if(isset($_POST['pmstatus'])) { |
|
|
|
$mn_seat_arr[$k] = (isset($mn_seat_arr[$k])) ? $mn_seat_arr[$k] : ""; |
|
|
|
$mn_numberofstop_arr[$k] = (isset($mn_numberofstop_arr[$k])) ? $mn_numberofstop_arr[$k] : ""; |
|
|
|
$mn_speed_arr[$k] = (isset($mn_speed_arr[$k])) ? $mn_speed_arr[$k] : ""; |
|
|
|
$note = $mn_seat_arr[$k].",".$mn_numberofstop_arr[$k].",".$mn_speed_arr[$k]; |
|
|
|
$note = $mn_seat_arr[$k] . "," . $mn_numberofstop_arr[$k] . "," . $mn_speed_arr[$k]; |
|
|
|
$option_relate_spec = ""; |
|
|
|
$tmp_arr = explode("<br>", $mn_relate_facil_arr[$k]); |
|
|
|
foreach ($tmp_arr as $val) { |
|
|
|
$option_relate_spec .= substr($val, 0, strpos($val, ".")).","; |
|
|
|
$option_relate_spec .= substr($val, 0, strpos($val, ".")) . ","; |
|
|
|
} |
|
|
|
$option_relate_spec = rtrim($option_relate_spec, ","); |
|
|
|
$db_query = "update pricereview_item set item_unit_price = '$mn_unit_price_arr[$k]', item_qty = '$mn_qty_arr[$k]', "; |
|
|
@ -313,11 +313,11 @@ if(isset($_POST['pmstatus'])) { |
|
|
|
$nextno = $row[0] + 1; |
|
|
|
foreach ($to_ins_arr as $v) { |
|
|
|
if (!$mn_id_arr[$v]) $mn_id_arr[$v] = 0; |
|
|
|
$note = $mn_seat_arr[$v].",".$mn_numberofstop_arr[$v].",".$mn_speed_arr[$v]; |
|
|
|
$note = $mn_seat_arr[$v] . "," . $mn_numberofstop_arr[$v] . "," . $mn_speed_arr[$v]; |
|
|
|
$option_relate_spec = ""; |
|
|
|
$tmp_arr = explode("<br>", $mn_relate_facil_arr[$v]); |
|
|
|
foreach ($tmp_arr as $val) { |
|
|
|
$option_relate_spec .= substr($val, 0, strpos($val, ".")).","; |
|
|
|
$option_relate_spec .= substr($val, 0, strpos($val, ".")) . ","; |
|
|
|
} |
|
|
|
$option_relate_spec = rtrim($option_relate_spec, ","); |
|
|
|
$db_query = "insert into pricereview_item (mid, price_id, item_no, item_spec, option_relate_spec, item_group, item_unit_price, item_qty, item_price_bp, note, memo) values ("; |
|
|
@ -376,7 +376,7 @@ if(isset($_POST['pmstatus'])) { |
|
|
|
$pay_scale_arr = explode(",", $pay_scale_all); |
|
|
|
$pay_amount_arr = explode(",", $pay_amount_all); |
|
|
|
$pay_period_arr = explode(",", $pay_period_all); |
|
|
|
for ($i=0; $i<7; $i++) { |
|
|
|
for ($i = 0; $i < 7; $i++) { |
|
|
|
$sql = "update pricereview_pay set pay_kind = '$pay_kind_arr[$i]', pay_scale = '$pay_scale_arr[$i]', pay_amount = '$pay_amount_arr[$i]', "; |
|
|
|
$sql .= "pay_period = '$pay_period_arr[$i]', pay_note = '$pay_note' "; |
|
|
|
$sql .= "where id = '$pay_id_arr[$i]'"; |
|
|
@ -387,7 +387,7 @@ if(isset($_POST['pmstatus'])) { |
|
|
|
// 小於80%呈至總經理審核. ($price_rate) |
|
|
|
// 上級主管 > 伃廷 > MAX > 總經理 |
|
|
|
if ($status == "YS") { |
|
|
|
$manager_arr = pricereview_class($price_rate, $user_id); |
|
|
|
$manager_arr = pricereview_class($price_rate, $user_id, $ret, $special_fee); |
|
|
|
if ($manager_arr) { |
|
|
|
$sign1 = $sign2 = $sign3 = $sign4 = ""; |
|
|
|
foreach ($manager_arr as $k => $v) { |
|
|
@ -396,7 +396,7 @@ if(isset($_POST['pmstatus'])) { |
|
|
|
elseif ($k == 3) $sign3 = $v; |
|
|
|
else $sign4 = $v; |
|
|
|
} |
|
|
|
$sql = "insert into pricereview_sign (mid, sign1, sign2, sign3, sign4, sign_total) values ('$id', '$sign1', '$sign2', '$sign3', '$sign4', '".count($manager_arr)."')"; |
|
|
|
$sql = "insert into pricereview_sign (mid, sign1, sign2, sign3, sign4, sign_total) values ('$id', '$sign1', '$sign2', '$sign3', '$sign4', '" . count($manager_arr) . "')"; |
|
|
|
mysqli_query($link, $sql); |
|
|
|
// 寫入待簽表 |
|
|
|
if (strlen($sign1) == 7) $next_signer = str_replace(",", "", $sign1); |
|
|
@ -415,9 +415,9 @@ if(isset($_POST['pmstatus'])) { |
|
|
|
foreach ($ret as $uid => $uemail) { |
|
|
|
$mail_list[] = [$uid, $uemail]; |
|
|
|
} |
|
|
|
include dirname(__DIR__)."/class/Cmail.php"; |
|
|
|
include dirname(__DIR__) . "/class/Cmail.php"; |
|
|
|
$sendmail = new Cmail; |
|
|
|
$title = "【新梯價審通知】卷號:".$contractno; |
|
|
|
$title = "【新梯價審通知】卷號:" . $contractno; |
|
|
|
$content = "<p>您有待簽核案件,請至<a href=\"http://oa.masada.com.tw\">客戶管理 > 價格審查_新梯</a>,點擊「待簽核」進行作業,謝謝!</p>"; |
|
|
|
$sendmail->sendx($title, $content, $mail_list); |
|
|
|
} |
|
|
@ -428,14 +428,13 @@ if(isset($_POST['pmstatus'])) { |
|
|
|
mysqli_close($link); |
|
|
|
if ($affected > 0) { |
|
|
|
echo "<script type = 'text/JavaScript'>"; |
|
|
|
echo "alert('".$st_str."成功');"; |
|
|
|
echo "location.href='pricereview-index.php?function_name=pricereview&".$token_link."';"; |
|
|
|
echo "alert('" . $st_str . "成功');"; |
|
|
|
echo "location.href='pricereview-index.php?function_name=pricereview&" . $token_link . "';"; |
|
|
|
echo "</script>"; |
|
|
|
} else { |
|
|
|
echo "<script type = 'text/JavaScript'>"; |
|
|
|
echo "alert('".$st_str."失敗,請重新操作');"; |
|
|
|
echo "location.href='pricereview-index.php?function_name=pricereview&".$token_link."';"; |
|
|
|
echo "alert('" . $st_str . "失敗,請重新操作');"; |
|
|
|
echo "location.href='pricereview-index.php?function_name=pricereview&" . $token_link . "';"; |
|
|
|
echo "</script>"; |
|
|
|
} |
|
|
|
} |
|
|
|
?> |