"; echo "alert('資料錯誤!!');"; echo "window.history.go(-1);"; echo ""; exit; } } // 員工編號對應姓名表 $accountname_arr = accountid2name(); // 審核按鈕開關 $sign_on = 0; $data = $item_arr = $option_arr = $mn_arr = $ex_arr = $pay_arr = array(); $checker_1_result = $checker_2_result = $checker_3_result = $checker_4_result = ""; $db_query = "select * from pricereview_main where id = '$id'"; /* if ($res = mysqli_query($link, $db_query)) { while ($row = mysqli_fetch_row($res)) { list($id, $version, $company) } } */ $res = mysqli_query($link, $db_query); foreach ($res as $data) { // 上層主管 $sql = "select manager from account where accountid = '" . $data["person"] . "'"; $res_a = mysqli_query($link, $sql); $row_a = mysqli_fetch_row($res_a); $manager = $row_a[0]; mysqli_free_result($res_a); // 瀏覽MI權限 $depart_id = accountidToDepartId($user_id); if ($depart_id == "320" || $depart_id == "321" || $depart_id == "20" || $user_id == 'TEST04') $viewmi = 1; else $viewmi = 0; $sql = "select * from pricereview_sign where mid = '$id'"; $res_s = mysqli_query($link, $sql); $row_s = mysqli_fetch_assoc($res_s); mysqli_free_result($res_s); if (!empty($row_s["sign1"])) list($person1, $status1, $dtte1) = explode(",", $row_s["sign1"]); else $person1 = $status1 = $dtte1 = ""; if (!empty($row_s["sign2"])) { if ($user_id == "TEST02") { list($person2, $status2, $dtte2) = explode(",", $row_s["sign2"]); } else { if ($st == 2 && (preg_match("/Y/", $row_s["sign2"]) || preg_match("/N/", $row_s["sign2"]))) { echo ""; exit; } $sign2_arr = explode("<##>", $row_s["sign2"]); // M0024,,<##>M0175,, $person2_arr = []; foreach ($sign2_arr as $v) { list($person2, $status2, $dtte2) = explode(",", $v); if (strlen($v) == 7) { // 未審 $person2_arr[] = $person2; } else { unset($person2_arr); break; } } } } else $person2 = $status2 = $dtte2 = ""; if (!empty($row_s["sign3"])) list($person3, $status3, $dtte3) = explode(",", $row_s["sign3"]); else $person3 = $status3 = $dtte3 = ""; if (!empty($row_s["sign4"])) list($person4, $status4, $dtte4) = explode(",", $row_s["sign4"]); else $person4 = $status4 = $dtte4 = ""; $sign1_note = (empty($row_s["sign1_note"])) ? "" : $row_s["sign1_note"]; $sign2_note = (empty($row_s["sign2_note"])) ? "" : $row_s["sign2_note"]; $sign3_note = (empty($row_s["sign3_note"])) ? "" : $row_s["sign3_note"]; $sign4_note = (empty($row_s["sign4_note"])) ? "" : $row_s["sign4_note"]; if ($status1 == "Y") { $checker_1_result = "同意"; } elseif ($status1 == "N") { $checker_1_result = "不同意"; } if ($status2 == "Y") { $checker_2_result = "同意"; } elseif ($status2 == "N") { $checker_2_result = "不同意"; } if ($status3 == "Y" || $status3 == "YY") { $checker_3_result = "同意"; } elseif ($status3 == "N") { $checker_3_result = "不同意"; } if ($status4 == "Y") { $checker_4_result = "同意"; } elseif ($status4 == "N") { $checker_4_result = "不同意"; } if ($st == 1 && ($person1 == $user_id) && ($status1 == "") || $user_id == 'TEST04') { $sign_on = 1; } if ($st == 2 && ($person2 == $user_id || (isset($person2_arr) && in_array($user_id, $person2_arr))) && ($status2 == "") || $user_id == 'TEST02') { $sign_on = 1; } if ($st == 3 && ($person3 == $user_id) && ($status3 == "") || $user_id == 'TEST03') { $sign_on = 1; } if ($st == 4 && ($person4 == $user_id) && ($status4 == "") || $user_id == 'TEST05') { $sign_on = 1; } // $sign_total=關卡數 if ($person4 == "") { if ($person3 == "") { $sign_total = 2; } else { $sign_total = 3; } } else { $sign_total = 4; } /* if (!$data["checker_1"] && !$data["checker_2"] && !$data["checker_3"]) $allow_st = 1; else if (!$data["checker_2"] && !$data["checker_3"]) $allow_st = 2; else if (!$data["checker_3"]) $allow_st = 3; if ($data["checker_1_result"]) { if ($data["checker_1_result"] == "Y") $checker_1_result = "通過"; else if ($data["checker_1_result"] == "N") { $stopchk = 1; $checker_1_result = "拒絕"; } } if ($data["checker_2_result"]) { if ($data["checker_2_result"] == "Y") $checker_2_result = "通過"; else if ($data["checker_2_result"] == "N") { $stopchk = 1; $checker_2_result = "拒絕"; } } if ($data["checker_3_result"]) { if ($data["checker_3_result"] == "Y") $checker_3_result = "通過"; else if ($data["checker_3_result"] == "N") { $stopchk = 1; $checker_3_result = "拒絕"; } } */ /* if ($st != $allow_st) { mysqli_free_result($res); mysqli_close($link); echo ""; } */ $mid = $data["id"]; $data["qty_total"] = 0; $db_query = "select * from pricereview_item where mid = '$mid' order by item_group, item_no"; $res_i = mysqli_query($link, $db_query); while ($row = mysqli_fetch_assoc($res_i)) { if ($row['item_group'] == "A") { $item_arr[$row['item_no']]['item_spec'] = $row['item_spec']; $item_arr[$row['item_no']]['item_unit_price'] = $row['item_unit_price']; $item_arr[$row['item_no']]['item_qty'] = $row['item_qty']; $item_arr[$row['item_no']]['item_price_bp'] = $row['item_price_bp']; $item_arr[$row['item_no']]['item_price_ct'] = $row['item_price_ct']; $item_arr[$row['item_no']]['item_price'] = $row['item_price']; $item_arr[$row['item_no']]['pv_rate'] = $row['pv_rate']; $item_arr[$row['item_no']]['allocate'] = $row['allocate']; $item_arr[$row['item_no']]['gross_profit'] = $row['gross_profit']; $item_arr[$row['item_no']]['gross_profit_rate'] = $row['gross_profit_rate']; $item_arr[$row['item_no']]['note'] = $row['note']; $item_arr[$row['item_no']]['mi_fix'] = $row['mi_fix']; $data["qty_total"] += $row["item_qty"]; $sql_spec = "select sub_item_id from specsurvey_main where mid = '$mid' and pr_item_id = '" . $row['item_no'] . "' order by sub_item_id"; $res_spec = mysqli_query($link, $sql_spec); while ($row_spec = mysqli_fetch_row($res_spec)) { $item_arr[$row['item_no']]['sub_item_id'][] = $row_spec[0]; } mysqli_free_result($res_spec); } elseif ($row['item_group'] == "B") { $option_arr[$row['item_no']]['item_spec'] = $row['item_spec']; $option_arr[$row['item_no']]['item_unit_price'] = $row['item_unit_price']; $option_arr[$row['item_no']]['item_qty'] = $row['item_qty']; $option_arr[$row['item_no']]['item_price_bp'] = $row['item_price_bp']; $option_arr[$row['item_no']]['memo'] = $row['memo']; $option_arr[$row['item_no']]['option_relate_spec'] = $row['option_relate_spec']; } elseif ($row['item_group'] == "D") { $mn_arr[$row['item_no']]['item_spec'] = $row['item_spec']; $mn_arr[$row['item_no']]['item_unit_price'] = $row['item_unit_price']; $mn_arr[$row['item_no']]['item_qty'] = $row['item_qty']; $mn_arr[$row['item_no']]['item_price_bp'] = $row['item_price_bp']; $mn_arr[$row['item_no']]['note'] = $row['note']; $mn_arr[$row['item_no']]['memo'] = $row['memo']; $mn_arr[$row['item_no']]['option_relate_spec'] = $row['option_relate_spec']; } elseif ($row['item_group'] == "E") { $ex_arr[$row['item_no']]['item_spec'] = $row['item_spec']; $ex_arr[$row['item_no']]['item_unit_price'] = $row['item_unit_price']; $ex_arr[$row['item_no']]['item_qty'] = $row['item_qty']; $ex_arr[$row['item_no']]['item_price_bp'] = $row['item_price_bp']; $ex_arr[$row['item_no']]['note'] = $row['note']; } } mysqli_free_result($res_i); $data["price_total_broken"] = $data["price_total"] - $data["price_lowest"]; $data["price_broken"] = ($data["qty_total"]) ? round($data["price_total_broken"] / $data["qty_total"], 1) : 0; // 付款辦法 $pay_all_scale = $pay_all_amount = 0; $sql = "select * from pricereview_pay where mid = '$mid' order by pay_kind"; $res_p = mysqli_query($link, $sql); while ($row_p = mysqli_fetch_assoc($res_p)) { $pay_arr[$row_p["pay_kind"]]["pay_scale"] = $row_p["pay_scale"]; $pay_arr[$row_p["pay_kind"]]["pay_amount"] = $row_p["pay_amount"]; $pay_arr[$row_p["pay_kind"]]["pay_period"] = $row_p["pay_period"]; $pay_arr[$row_p["pay_kind"]]["pay_note"] = $row_p["pay_note"]; $pay_all_scale += $row_p["pay_scale"]; $pay_all_amount += $row_p["pay_amount"]; } mysqli_free_result($res_p); ?>
$val) { $item_amt_A_all += $val["item_price_bp"]; if ($viewmi) { for ($i = 0; $i < $val["item_qty"]; $i++) { ?>
整機單價 業務部作業區
項次 規格 單價 數量 複價 業務部MI 售價 利潤 利潤率(%)
"> [規調] "> "> " disabled> "> "> ">
"> [規調] "> "> ">
小計
$val) { if ($val['item_qty'] <= 0) { continue; } $total_qty = $total_qty + $val['item_qty']; $item_amt_B_all += $val["item_price_bp"]; ?> 0) : ?>
OPTION加價
項次 選配規格 單價 數量 複價 備註 所屬電梯項次
"> "> "> ">
小計
$val) { $item_amt_E_all += $val["item_price_bp"]; ?>
除外項目
項次 詢價單號 名稱 單價 數量 複價
"> "> ">
小計
$val) { $item_amt_D_all += $val["item_price_bp"]; if (!empty($val["note"])) list($mn_seat, $mn_numberofstop, $mn_speed) = explode(",", $val["note"]); else $mn_seat = $mn_numberofstop = $mn_speed = ""; ?>
保固延長
項次 電梯 人乘/載重 停數 速度 單價 數量(月) 複價 備註 所屬電梯項次
"> "> "> ">
小計
付款辦法 款別 比例% 金額 票期
材料 1、訂金
2、二次款
3、貨到工地款
4、其它
安裝 5、安裝完畢款
6、驗收款
7、其它
合計
備註
">
">
">
">
" size="46">
">
">
">
">
">
">
">

">

">
">
">
">
">
  • 營業權限85%以上;85-80%呈至區處長審核;80%以下呈至總經理審核。
審核 審核人 結果 意見 時間
區經理
業務承辦人
業務部協理
總經理
審核意見 批示售價
>
">