diff --git a/.gitignore b/.gitignore index 74665935..c01e362a 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,4 @@ wms/excel/gary_test.xlsx wms/excel/wipwholeintall.xlsx wms/excel/estimated_shipping_date_report.xlsx *.docx +wms/mkt/WriteOffRepair.xlsx \ No newline at end of file diff --git a/wms/mkt/assets/img/image001.png b/wms/mkt/assets/img/image001.png new file mode 100644 index 00000000..3cee3340 Binary files /dev/null and b/wms/mkt/assets/img/image001.png differ diff --git a/wms/mkt/assets/img/stamp.png b/wms/mkt/assets/img/stamp.png new file mode 100644 index 00000000..c108a496 Binary files /dev/null and b/wms/mkt/assets/img/stamp.png differ diff --git a/wms/mkt/pricereview_contractno-api.php b/wms/mkt/pricereview_contractno-api.php new file mode 100644 index 00000000..2c33004b --- /dev/null +++ b/wms/mkt/pricereview_contractno-api.php @@ -0,0 +1,63 @@ + "ok", "err" => ""); + +try { + if (empty($_POST) || empty($_POST["pa"])) throw new \Exception("parameter empty"); + + foreach ($_POST as $k => $v) { + $$k = htmlspecialchars(stripslashes(trim($v))); + } + + // 基本資料 + $db_query = "select a.address, a.repairerid, c.contractno, c.company, c.taxid from account a, contract c "; + $db_query .= "where a.accountid = c.customerid and c.contractno = '$pa'"; + $res = mysqli_query($link, $db_query); + if ($row = mysqli_fetch_row($res)) { + $rarr["address"] = $row[0]; + $rarr["repairerid"] = $row[1]; + $rarr["contractno"] = $row[2]; + $rarr["company"] = $row[3]; + $rarr["taxid"] = $row[4]; + } + mysqli_free_result($res); + + // 電梯編號 + $db_query = "select facilityno from facility where contractno = '$pa' order by facilityno"; + $res = mysqli_query($link, $db_query); + while ($row = mysqli_fetch_row($res)) { + $rarr["faci"][] = $row[0]; + } + mysqli_free_result($res); + + if (!isset($rarr["contractno"])) { + $rarr["st"] = "err"; + $rarr["err"] = "無資料!"; + } +}catch(\Exception $e) { + $rarr["st"] = "err"; + $rarr["err"] = $e->getMessage(); +} +//print_r($rarr);exit; +echo json_encode($rarr, JSON_UNESCAPED_UNICODE); +exit; +?> \ No newline at end of file diff --git a/wms/mkt/pricereview_mi-api.php b/wms/mkt/pricereview_mi-api.php index 098064f7..931f22e4 100644 --- a/wms/mkt/pricereview_mi-api.php +++ b/wms/mkt/pricereview_mi-api.php @@ -71,6 +71,7 @@ try { $elev_arr[$row[5]]["floors"] = $floors; $elev_arr[$row[5]]["speed"] = $speed; $elev_arr[$row[5]]["option"] = []; + $elev_arr[$row[5]]["mn"] = []; $elev_qty_all += $row[1]; } mysqli_free_result($res); @@ -108,20 +109,22 @@ try { mysqli_free_result($res); $opt_nosel_id_arr = array_diff(array_keys($opt_elev_arr), $opt_sel_id_arr); - // 保固延長<->電梯項次 - $mn_arr = []; - $sql = "select id, item_spec, item_qty, option_relate_spec from pricereview_item where mid = '$id' and item_group = 'D'"; + // 電梯所屬保固延長 + $mn_elev_arr = $mn_sel_id_arr = []; + $sql = "select id, item_spec, item_price_bp, option_relate_spec from pricereview_item where mid = '$id' and item_group = 'D'"; $res = mysqli_query($link, $sql); while ($row = mysqli_fetch_row($res)) { - $mn_arr[$row[0]]["item_spec"] = $row[1]; - $mn_arr[$row[0]]["item_qty"] = $row[2]; + $mn_elev_arr[$row[0]]["item_spec"] = $row[1]; + $mn_elev_arr[$row[0]]["item_price_bp"] = $row[2]; $tmp_arr = explode(",", $row[3]); - $mn_arr[$row[0]]["elev_no"] = $tmp_arr; + $mn_elev_arr[$row[0]]["elev_no"] = $tmp_arr; foreach ($tmp_arr as $v) { $elev_arr[$v]["mn"][] = $row[0]; + $mn_sel_id_arr[] = $row[0]; } } mysqli_free_result($res); + $mn_nosel_id_arr = array_diff(array_keys($mn_elev_arr), $mn_sel_id_arr); // 除外項目平均分到每台電梯 $exarr = []; @@ -160,7 +163,7 @@ try { //print_r($elev_arr); //print_r($opt_elev_arr); //print_r($opt_nosel_id_arr); - //print_r($mn_arr); + //print_r($mn_elev_arr); //print_r($ex_arr);exit; foreach ($elev_arr as $item_no => $v) { @@ -243,8 +246,10 @@ try { if (empty($todo_opt_arr)) $todo_opt_arr = $opt_nosel_id_arr; if (!empty($todo_opt_arr)) { foreach ($todo_opt_arr as $val) { - $sql4 = "select o.base_floor, o.base_floor_plus, o.price, r.equipment from option_mi o, elevator_quotation_rule r "; - $sql4 .= "where o.quotation_no = r.quotation_no and o.option_price_id = ".$opt_elev_arr[$val]["price_id"]." "; + $sql4 = "select o.base_floor, o.base_floor_plus, o.price, r.equipment, p.price 'OP' "; + $sql4 .= "from option_mi o, elevator_quotation_rule r, option_price p "; + $sql4 .= "where o.quotation_no = r.quotation_no and o.option_price_id = p.id "; + $sql4 .= "and o.option_price_id = ".$opt_elev_arr[$val]["price_id"]." "; $sql4 .= "and ($v[item_weight] between o.min_weight and o.max_weight) and o.open_kind = '".$v["item_op"]."'"; $res_om = mysqli_query($link, $sql4); if ($row_om = mysqli_fetch_assoc($res_om)) { @@ -252,6 +257,7 @@ try { // 特例 if ($opt_elev_arr[$val]["price_id"] == "256" && ($v["floors"] < $row_om["base_floor"])) $row_om["price"] = 9815; if ($opt_elev_arr[$val]["price_id"] == "266" && $v["floors"] >= 20) $plus += 44.8; // 15层,14.6元/层(19层内,跳20层再追加44.8元) + if ($row_om["price"] == 0) $row_om["price"] = $row_om["OP"]*0.6; // 實體且沒成本的:抓牌價6成 // 含此option的電梯總台數 $myelev_qty = 0; foreach ($opt_elev_arr[$val]["elev_no"] as $pval) { @@ -273,10 +279,18 @@ try { // 保固延長 $mnarr = []; $mn_fee = $j = 0; - if (!empty($v["mn"][0])) { - foreach ($v["mn"] as $val) { + $todo_mn_arr = $v["mn"]; + if (!empty($todo_mn_arr[0])) { + foreach ($todo_mn_arr as $val) { $mn_amt = 0; - $mnarr[$j][0] = $mn_arr[$val]["item_spec"]."保養費"; + // 含此保延的電梯總台數 + $myelev_qty = 0; + foreach ($mn_elev_arr[$val]["elev_no"] as $pval) { + $myelev_qty += $elev_arr[$pval]["item_qty"]; + } + // 分配:延保總價除以電梯總台數 + $mn_amt += round(0+($mn_elev_arr[$val]["item_price_bp"]/$myelev_qty), 0); + $mnarr[$j][0] = $mn_elev_arr[$val]["item_spec"]."保養費"; $mnarr[$j][1] = $mn_amt; $mn_fee += $mn_amt; $j++; diff --git a/wms/mkt/pricereview_repair-check.php b/wms/mkt/pricereview_repair-check.php new file mode 100644 index 00000000..011a6869 --- /dev/null +++ b/wms/mkt/pricereview_repair-check.php @@ -0,0 +1,268 @@ +"; + echo "alert('請勿重覆簽核!!');"; + echo "window.close();"; + echo ""; + exit; + } +} + +$assign_status = ''; + +$data = []; +$db_query = "select * from pricereview_repair_main where id = '$id'"; +$data = mysqli_query($link, $db_query); + +foreach($data as $data) : + // 公司站點 + $sql = "select content from code where field_name = 'masada_addr' and code_name = '".$data["masada_addr"]."'"; + $res = mysqli_query($link, $sql); + if ($row = mysqli_fetch_row($res)) { + $data["maddr"] = $row[0]; + } + mysqli_free_result($res); + + // 保養人員 + $repairer_arr = []; + $sql = "select name from account where accounttype = 'B' and accountid = '".$data["repairerid"]."'"; + $res = mysqli_query($link, $sql); + if ($row = mysqli_fetch_row($res)) { + $data["repair"] = $row[0]; + } + mysqli_free_result($res); + + // 價審明細 + $item_arr = []; + $sql = "select * from pricereview_repair_item where rid = '$id' order by item_no"; + $res = mysqli_query($link, $sql); + while ($row = mysqli_fetch_assoc($res)) { + $item_arr[$row["item_no"]]["title"] = $row["title"]; + $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"]]["memo"] = $row["memo"]; + } + mysqli_free_result($res); + + // get form_key + $sql = "select max(form_key) from assign where assign_opinion = '".$data["repair_no"]."'"; + $res = mysqli_query($link, $sql); + $row = mysqli_fetch_row($res); + $form_key = $row[0]; + mysqli_free_result($res); +?> + + + +
+
+
+ + "> +
+
+ + "> +
+
+
+
+ "> +
+
+ + "> +
+
+ + "> +
+
+ + "> +
+
+
+ + "> +
+
+ + "> +
+
+ + "> +
+
+ + "> +
+
+
+
+ +
+ +
+
+ +
+ + + + + + + + + + + + + $v) { + ?> + + + + + + + + + + + + + + + + + + + + +
項次名稱數量單價合計備註
+ + + "> + + "> + + "> + + "> + + "> +
營業稅
+ "> +
總價
+ "> +
+
+ +
+ +
+ + + + + + + + + + + + + + + +
簽核操作
簽核狀態 + + 下位簽核者 + + + +
+
+ + + + +
+
+ + \ No newline at end of file diff --git a/wms/mkt/pricereview_repair-create.php b/wms/mkt/pricereview_repair-create.php new file mode 100644 index 00000000..b8fd4938 --- /dev/null +++ b/wms/mkt/pricereview_repair-create.php @@ -0,0 +1,514 @@ +'; +$item_str .= ' + + 序號 + 名稱 + 類別 + 單位 + 售價 + 備註 + '; +foreach ($item_arr as $k => $v) { + $item_str .= ""; + $item_str .= "".$k.""; + $item_str .= "".$v["title"].""; + $item_str .= "".$v["stype"].""; + $item_str .= "".$v["unit"].""; + $item_str .= "".number_format($v["price"]).""; + $item_str .= "".$v["memo"].""; + $item_str .= ""; +} +$item_str .= ""; + +/* +#獲取簽核意見 +$assign_opinions = Assign::get_records($form_key); +$assigner = $wf->getAssignerList(); +$assign_status = $wf->getAssignStatus($assigner); +*/ +$assign_status = '' +?> + + + + + + + + +
+Please fill up the required field!

"; + } else { + echo "

Record has added successfully

"; + } +} +*/ +?> +
" enctype="multipart/form-data"> +
+ + +
+
+
+ +
+
+
+ + +
+
+
+
+ +
+
+ + +
+
+ + +
+
+ + + +
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+
+
+ +
+ +
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
新增
名稱數量單價合計備註操作
+ 點選 + + + + + + + + + + + + X +
營業稅
+ +
總價
+ +
+
+ +
+ +
+ + + + + + + + + + + + + + + +
簽核操作
簽核狀態 + + 下位簽核者 + + + +
+
+ + + + + + + + +
+
+ + \ No newline at end of file diff --git a/wms/mkt/pricereview_repair-download.php b/wms/mkt/pricereview_repair-download.php new file mode 100644 index 00000000..63a04ae5 --- /dev/null +++ b/wms/mkt/pricereview_repair-download.php @@ -0,0 +1,185 @@ +load("repair-sample.xlsx"); + $sheet = $spreadsheet->getActiveSheet(); + $sheet->getProtection()->setSheet(true); + $sheet->getStyle('A5:J10')->getFont()->setSize(14); + $sheet->setCellValue('C5', $data["maddr"]); + $sheet->setCellValue('C6', $data["company"]); + $sheet->setCellValue('J6', $data["invoice"]); + $sheet->setCellValue('C7', $data["facilityno"]); + $sheet->setCellValue('C8', $data["address"]); + $sheet->setCellValue('J8', $data["taxid"]); + $sheet->setCellValue('C10', substr($data["sign_date"], 0, 10)); + $sheet->setCellValue('J10', $data["repair_no"]); + $st = 12; + foreach ($item_arr as $k => $v) { + //$sheet->setCellValue('A'.$st, $k); + $sheet->setCellValue('B'.$st, $v["title"]); + $sheet->setCellValue('H'.$st, $v["item_qty"]); + $sheet->setCellValue('I'.$st, $v["item_unit_price"]); + $sheet->setCellValue('J'.$st, $v["item_price_bp"]); + $sheet->setCellValue('M'.$st, $v["memo"]); + $st++; + } + $sheet->setCellValue('J18', $data["sales_tax"]); + $sheet->setCellValue('J19', $data["total_price"]); + $sheet->setCellValue('A20', "合計:新台幣 ".numberToChinese($data["total_price"])." 整(含稅)"); + $sheet->setCellValue('B23', $data["memo"]); + $sheet->setCellValue('M36', $data["repair"]); + //$sheet->setCellValue('I35', mb_substr($accountname_arr[$data["checker"]],0,1).mb_substr($accountname_arr[$data["checker"]],1)); + + $writer = new Xls($spreadsheet); + $file_path = 'WriteOffRepair.xlsx'; + $writer->save('WriteOffRepair.xlsx'); + echo $file_path; +endforeach; + +function numberToChinese($num) { + $chineseNumbers = ['零', '壹', '貮', '參', '肆', '伍', '陸', '㭍', '捌', '玖','拾']; + $units = [' 元', ' 拾 ', ' 佰 ', ' 仟 ', ' 萬 ', ' 拾 ']; + + $num = str_pad($num, 6, "0", STR_PAD_LEFT); + if ($num <= 10) { + return $chineseNumbers[$num]; + } elseif ($num < 20) { + return $units[1] . $chineseNumbers[$num % 10]; + } elseif ($num < 100) { + return $chineseNumbers[intval($num / 10)] . $units[1] . ($num % 10 > 0 ? $chineseNumbers[$num % 10] : ''); + } else { + $result = ''; + $strNum = strval($num); + $length = strlen($strNum); + for ($i = 0; $i < $length; $i++) { + $currentDigit = intval($strNum[$i]); + $result .= $chineseNumbers[$currentDigit] . $units[$length - $i - 1]; + /* + if ($currentDigit > 0) { + $result .= $chineseNumbers[$currentDigit] . $units[$length - $i - 1]; + } else { + $result .= $chineseNumbers[$currentDigit]; + } + */ + } + return $result; + } +} + +exit; + +if ($_SERVER["REQUEST_METHOD"] == "POST") { + //print_r($_POST);exit; + foreach ($_POST as $k => $v) { + $$k = htmlspecialchars(stripslashes(trim($v))); + } + + if ($assign_status == "F6") $pstatus = "B1"; + elseif ($assign_status == "Y1") $pstatus = "X"; + $tds = date("Y-m-d H:i:s"); + + /* + // 檢查報價單編號 + $sql = "select count(*) from pricereview_main where contractno = '$contractno' and status in ('Y1', 'YS', 'YY')"; + $res = mysqli_query($link, $sql); + $row = mysqli_fetch_row($res); + if ($row[0] > 0) { + echo ""; + exit; + } + */ + + // 更新狀態 + $db_query = "update pricereview_repair_main set pstatus = '$pstatus', check_date = '$tds' "; + $db_query .= "where id = '$id'"; + $result = mysqli_query($link, $db_query); + $affected = mysqli_affected_rows($link); + if ($affected > 0) { + // 更新待簽表 + $sql = "update subflow set current_assigner = '00000', update_date = '$tds' where form_key = '$form_key'"; + mysqli_query($link, $sql); + $sql = "update flow set flow_code = 'Z' where system_id = 'prm' and flow_id = 'prm03' and form_id = '$id' and form_key = '$form_key'"; + mysqli_query($link, $sql); + + /* + // 寄信給下位簽核人 + $mail_list = []; + $ret = accountid2email($next_signer); + if (!empty($ret)) { + foreach ($ret as $uid => $uemail) { + $mail_list[] = [$uid, $uemail]; + } + $mail_list[] = ['M0044', 'jrbin@masada.com.tw']; + include dirname(__DIR__)."/class/Cmail.php"; + $sendmail = new Cmail; + $title = "【新梯價審通知】卷號:".$contractno; + $content = "

您有待簽核案件,請至客戶管理 > 價格審查_新梯,點擊「待簽核」進行作業,謝謝!

"; + $sendmail->sendx($title, $content, $mail_list); + } + */ + } + + mysqli_close($link); + if ($affected > 0) { + echo ""; + } else { + echo ""; + } +} +?> \ No newline at end of file diff --git a/wms/mkt/pricereview_repair-index.php b/wms/mkt/pricereview_repair-index.php new file mode 100644 index 00000000..e9908255 --- /dev/null +++ b/wms/mkt/pricereview_repair-index.php @@ -0,0 +1,272 @@ + "簽核中", "B1" => "已同意", "B2" => "已完工", "X" => "不同意"]; + +// 設置一個空陣列來放資料 +$data = array(); +// sql語法存在變數中 +$sql_cmd = sql_myself($user_id, "repairerid"); +$is_manager = 0; +// 宜:M0054-陳志文 +$repman_arr[0] = ["M0177"]; +// 北:M0137-劉永德 +$repman_arr[1] = ["M0059","M0083","M0084","M0090","M0064","M0106","M0092","M0120","M0147","M0139","M0194","M0210"]; +// 桃:M0026-張莉凱 +$repman_arr[2] = ["M0018", "M0045","M0089","M0104","M0111"]; +// 中:M0086-李烘銘 +$repman_arr[3] = ["M0148","M0114","M0161"]; +// 南:M0033-吳育宗 +$repman_arr[4] = ["M0196","M0195","M0190","M0094","M0123","M0124"]; +if ($user_id == "M0054") { $is_manager = 1; $sql_cmd = "where repairerid in ('".implode("','", $repman_arr[0])."')"; } +elseif ($user_id == "M0137") { $is_manager = 1; $sql_cmd = "where repairerid in ('".implode("','", $repman_arr[1])."')"; } +elseif ($user_id == "M0026") { $is_manager = 1; $sql_cmd = "where repairerid in ('".implode("','", $repman_arr[2])."')"; } +elseif ($user_id == "M0086") { $is_manager = 1; $sql_cmd = "where repairerid in ('".implode("','", $repman_arr[3])."')"; } +elseif ($user_id == "M0033") { $is_manager = 1; $sql_cmd = "where repairerid in ('".implode("','", $repman_arr[4])."')"; } +elseif ($user_id == "M0012") $sql_cmd = ""; +$sql = "select * from pricereview_repair_main $sql_cmd order by id"; +$data = mysqli_query($link,$sql); +$para = "function_name=pricereview_repair&".$token_link; +?> + + + + +

+ + + +

+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
項次報價單編號卷號客戶名稱電梯編號總價簽訂日完工日申請人簽核主管狀態簽核時間建立時間操作
+ 0) echo number_format($data['final_price'])."
(".number_format($data['total_price']).")"; + else echo number_format($data['total_price']); + ?> +
+ 簽核"; + } else $str .= "&view=1\" class=\"btn btn-warning btn-sm\">檢視"; + //if ($data['pstatus'][0] == 'B') $str .= "
列印"; + if ($data['pstatus'][0] == 'B') $str .= "
下載"; + if (($user_id=="M0012" || $user_id=="M0105") && $data['pstatus'] == 'B1') $str .= "
結案"; + echo $str; + ?> +
+
+There is no record!"; +endif; + +#代表結束連線 +mysqli_close($link); + +include "../footer.php"; +?> \ No newline at end of file diff --git a/wms/mkt/pricereview_repair-record-check.php b/wms/mkt/pricereview_repair-record-check.php new file mode 100644 index 00000000..e0441123 --- /dev/null +++ b/wms/mkt/pricereview_repair-record-check.php @@ -0,0 +1,40 @@ + $v) { + $$k = htmlspecialchars(stripslashes(trim($v))); + } + + if ($assign_status == "F6") $pstatus = "B1"; + elseif ($assign_status == "Y1") $pstatus = "X"; + $tds = date("Y-m-d H:i:s"); + + // 更新狀態 + $db_query = "update pricereview_repair_main set pstatus = '$pstatus', check_date = '$tds' "; + $db_query .= "where id = '$id'"; + $result = mysqli_query($link, $db_query); + $affected = mysqli_affected_rows($link); + if ($affected > 0) { + // 更新待簽表 + $sql = "update subflow set current_assigner = '00000', update_date = '$tds' where form_key = '$form_key'"; + mysqli_query($link, $sql); + $sql = "update flow set flow_code = 'Z' where system_id = 'prm' and flow_id = 'prm03' and form_id = '$id' and form_key = '$form_key'"; + mysqli_query($link, $sql); + } + + mysqli_close($link); + if ($affected > 0) { + echo ""; + } else { + echo ""; + } +} +?> \ No newline at end of file diff --git a/wms/mkt/pricereview_repair-record-submit.php b/wms/mkt/pricereview_repair-record-submit.php new file mode 100644 index 00000000..ced4dfe0 --- /dev/null +++ b/wms/mkt/pricereview_repair-record-submit.php @@ -0,0 +1,78 @@ + $v) { + $$k = htmlspecialchars(stripslashes(trim($v))); + } + + $sales_tax = str_replace(",", "", $sales_tax); + $total_price = str_replace(",", "", $total_price); + $item_memo_arr = explode("@@,", rtrim($item_memo_all, "@@")); + $create_at = date("Y-m-d H:i:s"); + + // 避免報價單編號重覆 + $repair_no_a = date("Ymd"); + $sql = "select max(repair_no) from pricereview_repair_main where SUBSTRING(repair_no, 1, 8) = '$repair_no_a'"; + $res = mysqli_query($link, $sql); + $row = mysqli_fetch_row($res); + if (empty($row[0])) $serial = "001"; + else $serial = str_pad(substr($row[0]+1, -3), 3, 0, STR_PAD_LEFT); + $new_repair_no = $repair_no_a.$serial; + if ($new_repair_no != $repair_no) $repair_no = $new_repair_no; + + // 價審單-主文 pricereview_repair_main + $db_query = "insert into pricereview_repair_main(repair_no, contractno, masada_addr, company, taxid, invoice, facilityno, "; + $db_query .= "address, sales_tax, total_price, sign_date, memo, repairerid, pstatus, checker, creater, create_at) values ("; + $db_query .= "'$repair_no', '$contractno', '$masada_addr', '$company', '$taxid', '$invoice', '$facilityno', "; + $db_query .= "'$address', $sales_tax, $total_price, '$sign_date', '$memo', '$repairerid', 'A', '$next_users', '$user_id', '$create_at')"; + $result = mysqli_query($link, $db_query); + $affected = mysqli_affected_rows($link); + if ($rid = mysqli_insert_id($link)) { + // 價審單-明細項目 pricereview_repair_item + $item_title_all = str_replace("點選", "", $item_title_all); + $item_title_arr = explode(",", $item_title_all); + $item_qty_arr = explode(",", $item_qty_all); + $item_unit_price_arr = explode(",", $item_unit_price_all); + $item_price_bp_arr = explode(",", $item_price_bp_all); + $item_memo_arr = explode("@@,", rtrim($item_memo_all, "@@")); + $item_no = 1; + for ($i=0; $iinitWorkFlow($user_id); + $form_key = $wf->flowContext->getFormKey(); + $sql = "insert into assign (form_key, seq, assigner, assign_opinion) values ('$form_key', 1, '$next_users', '$repair_no')"; + mysqli_query($link, $sql); + $sql = "update subflow set seq = seq+1, current_assigner = '$next_users', update_date = '$create_at' where form_key = '$form_key'"; + mysqli_query($link, $sql); + } + + mysqli_close($link); + if ($affected > 0) { + echo ""; + } else { + echo ""; + } +} +?> \ No newline at end of file diff --git a/wms/mkt/pricereview_repair_end-api.php b/wms/mkt/pricereview_repair_end-api.php new file mode 100644 index 00000000..829dc321 --- /dev/null +++ b/wms/mkt/pricereview_repair_end-api.php @@ -0,0 +1,56 @@ + 'ok', 'err' => ''); + +try { + if (empty($_POST) || empty($_POST["pa"])) throw new \Exception("parameter empty"); + + foreach ($_POST as $k => $v) { + $$k = htmlspecialchars(stripslashes(trim($v))); + } + + list($id, $total_price, $final_price, $finish_date) = explode("##", $pa); + if (!$id || !$final_price || !$finish_date) throw new \Exception("parameter empty[2]"); + $create_at = date("Y-m-d H:i:s"); + + $final_price = str_replace(",", "", $final_price); + $sql = "update pricereview_repair_main set final_price = '$final_price', finish_date = '$finish_date', pstatus = 'B2', "; + $sql .= "creater = '$user_id', create_at = '$create_at' where id = '$id'"; + $res = mysqli_query($link, $sql); + $affected = mysqli_affected_rows($link); + if ($affected > 0) { + $rarr['tp'] = $total_price; + $rarr['fp'] = number_format($final_price); + $rarr['fp'] = number_format($final_price); + $rarr['fd'] = $finish_date; + } else { + $rarr['st'] = 'err'; + $rarr['err'] = '無更新'; + } +}catch(\Exception $e) { + $rarr['st'] = 'err'; + $rarr['err'] = $e->getMessage(); +} + +echo json_encode($rarr, JSON_UNESCAPED_UNICODE); +exit; +?> \ No newline at end of file diff --git a/wms/mkt/repair-sample.xlsx b/wms/mkt/repair-sample.xlsx new file mode 100644 index 00000000..d3d61718 Binary files /dev/null and b/wms/mkt/repair-sample.xlsx differ diff --git a/wms/mkt/specsurvey-create.php b/wms/mkt/specsurvey-create.php index 36ad2a30..d3e5d170 100644 --- a/wms/mkt/specsurvey-create.php +++ b/wms/mkt/specsurvey-create.php @@ -260,7 +260,7 @@ C:當天第3版,依次類推……" readonly> -->
- +

diff --git a/wms/mkt/specsurvey-edit.php b/wms/mkt/specsurvey-edit.php index 7772cd38..e6d7977a 100644 --- a/wms/mkt/specsurvey-edit.php +++ b/wms/mkt/specsurvey-edit.php @@ -176,7 +176,7 @@ C:當天第3版,依次類推……" readonly>
- +
重選號機 @@ -1514,7 +1514,7 @@ C:當天第3版,依次類推……" readonly> @@ -1627,7 +1627,7 @@ C:當天第3版,依次類推……" readonly> @@ -1888,7 +1888,7 @@ C:當天第3版,依次類推……" readonly>
- + @@ -1609,7 +1609,7 @@ C:當天第3版,依次類推……"> diff --git a/wms/mkt/specsurvey_renovate-create.php b/wms/mkt/specsurvey_renovate-create.php index 414854a5..9063dc4c 100644 --- a/wms/mkt/specsurvey_renovate-create.php +++ b/wms/mkt/specsurvey_renovate-create.php @@ -260,7 +260,7 @@ C:當天第3版,依次類推……" readonly> -->
- +

diff --git a/wms/mkt/specsurvey_renovate-edit.php b/wms/mkt/specsurvey_renovate-edit.php index 2a010c2b..4926ae75 100644 --- a/wms/mkt/specsurvey_renovate-edit.php +++ b/wms/mkt/specsurvey_renovate-edit.php @@ -176,7 +176,7 @@ C:當天第3版,依次類推……" readonly>
- +
重選號機 @@ -1514,7 +1514,7 @@ C:當天第3版,依次類推……" readonly> @@ -1627,7 +1627,7 @@ C:當天第3版,依次類推……" readonly> @@ -1888,7 +1888,7 @@ C:當天第3版,依次類推……" readonly>
- + @@ -1608,7 +1608,7 @@ C:當天第3版,依次類推……">