diff --git a/wms/api/bpm/draw_update.php b/wms/api/bpm/draw_update.php new file mode 100644 index 00000000..f22bbc31 --- /dev/null +++ b/wms/api/bpm/draw_update.php @@ -0,0 +1,8 @@ + true +], JSON_UNESCAPED_UNICODE); + + +?> diff --git a/wms/contract-repair/insertFacility.php b/wms/contract-repair/insertFacility.php index 788976f3..c15206f1 100644 --- a/wms/contract-repair/insertFacility.php +++ b/wms/contract-repair/insertFacility.php @@ -5,7 +5,7 @@ ini_set('data.timezone', 'Asia/Taipei'); use PhpOffice\PhpSpreadsheet\IOFactory; -$filePath = './facility/facility.xlsx'; +// $filePath = './facility/facility.xlsx'; try { $spreadsheet = IOFactory::load($filePath); diff --git a/wms/contract/contract-download.php b/wms/contract/contract-download.php index 3693ab7d..3ae40fa2 100644 --- a/wms/contract/contract-download.php +++ b/wms/contract/contract-download.php @@ -24,6 +24,7 @@ if (isset($_GET['id']) && $_GET['id'] != "") { $stmt->bindParam(':id', $id); $stmt->execute(); $contracts = $stmt->fetchAll(PDO::FETCH_ASSOC); + $contract = $contracts[0]; $contract_apply_id = $contract['id']; if (($contract['status'] !== "YY" && $user_id != 'M0107' && $user_id != "TEST02" && $user_id == "TEST01") && $user_id != 'M0174' && $user_id != 'M0225') { @@ -52,7 +53,8 @@ if (isset($_GET['id']) && $_GET['id'] != "") { $install_total_price = 0; // $noteArr = explode(",", $contracts[0]['note']); $noteArr = array(1, 1, 1, 1, 1); - $qty = $contracts[0]['total_items']; + // $qty = $contracts[0]['total_items']; + $qty = 1; foreach ($contracts as $idx => $amount) { $isset = false; if ($amount['pay_kind'] == 5 || $amount['pay_kind'] == 6) { @@ -413,8 +415,8 @@ if (isset($_GET['id']) && $_GET['id'] != "") { - - + + diff --git a/wms/contract/contract-maintainance-management.php b/wms/contract/contract-maintainance-management.php new file mode 100644 index 00000000..c0f94479 --- /dev/null +++ b/wms/contract/contract-maintainance-management.php @@ -0,0 +1,114 @@ +prepare($sql_str); +$stmt->execute(); +$contracts= $stmt->fetchAll(PDO::FETCH_ASSOC); + +?> + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
項次合約號客戶名稱統編營業員合約開始時間合約終止時間狀態建檔者建立時間操作
+ diff($endDate); + if ($interval->days <= 60) { + echo "60天以內。"; + } else { + echo "指定日期與當前日期相差超過60天。"; + } + + ?> + +

+ + + + + + +

+
+
+ + + \ No newline at end of file diff --git a/wms/contract/contract-new-apply.php b/wms/contract/contract-new-apply.php index 8c8d4628..c6e8ee2c 100644 --- a/wms/contract/contract-new-apply.php +++ b/wms/contract/contract-new-apply.php @@ -97,13 +97,14 @@ if (empty($contract_new_apply)) { $stmt->bindParam(':contract_id', $id); $stmt->execute(); $files = $stmt->fetchAll(PDO::FETCH_ASSOC); - print_r($files); + // print_r($files); } $secondPayDeadline = $contract['secondPayDeadline'] ?? 0; $status = isset($contract['status']) ? $contract['status'] : -1; $progress = isset($contract['progress']) ? $contract['progress'] : 0; $person = $contract['person']; +$para = "function_name=pricereview&" . $token_link; ?> @@ -129,7 +130,8 @@ $person = $contract['person']; - + + @@ -702,4 +704,14 @@ $person = $contract['person']; } - \ No newline at end of file + + + \ No newline at end of file diff --git a/wms/contract/js/alpine.js b/wms/contract/js/alpine.js index c93e56a0..d13d8389 100644 --- a/wms/contract/js/alpine.js +++ b/wms/contract/js/alpine.js @@ -1381,6 +1381,7 @@ const contractNewApply = () => { form.append('status', 1); form.append('review_comment', this.data.review_comment); form.append('description', this.data.description); + form.append('progress', 0); for (var i = 0; i < this.data.files.length; i++) { form.append('files[]', this.data.files[i]); } diff --git a/wms/contract/option/facility.xlsx b/wms/contract/option/facility.xlsx index 929a328d..f51a3944 100644 Binary files a/wms/contract/option/facility.xlsx and b/wms/contract/option/facility.xlsx differ diff --git a/wms/contract/prviewPdf.php b/wms/contract/prviewPdf.php index 6c57d5e9..1d311b0a 100644 --- a/wms/contract/prviewPdf.php +++ b/wms/contract/prviewPdf.php @@ -19,6 +19,7 @@ if($_POST['list']){ $total_price = $_POST['total_price']; $person = $_POST['person']; $personid = $_POST['personid']; + echo "----->" . $personid; $delivery_term = $_POST['delivery_term']; $install_period = $_POST['install_period']; $free_maintainance = $_POST['free_maintainance']; @@ -45,6 +46,10 @@ if($_POST['list']){ $stmt->bindParam(':vol_no', $partyAcontractno); $stmt->execute(); $customer = $stmt->fetch(PDO::FETCH_ASSOC); + if(empty($customer)){ + echo "有望客戶資料有誤!"; + exit; + } if(count($customer) <= 0 ){ echo " +There is no record!"; +endif; + +#代表結束連線 +mysqli_close($link); + +include "footer.php"; +?> \ No newline at end of file diff --git a/wms/mkt/assets/js/alpine.js b/wms/mkt/assets/js/alpine.js index d28a3f3f..85f3c5a4 100644 --- a/wms/mkt/assets/js/alpine.js +++ b/wms/mkt/assets/js/alpine.js @@ -297,6 +297,7 @@ const pricereviewOptionSelect = () => { this.options = this.orioptions this.reloadOptions(); let val = (e== null) ? this.searchtext.toLowerCase() : e.target.value.toLowerCase() + console.log(val); this.options.forEach(option=>{ if(option.group_name == null) option.group_name = '' if(option.spec == null) option.spec = '' diff --git a/wms/mkt/pricereview-index.php b/wms/mkt/pricereview-index.php index ec517324..8ee8b81d 100644 --- a/wms/mkt/pricereview-index.php +++ b/wms/mkt/pricereview-index.php @@ -125,6 +125,14 @@ if (!empty($res_get) || (!empty($_GET['check']) && $_GET['check'] == 1)) { // echo $sql; } +if($user_id === "M0137"){ + $sql = "SELECT pricereview_main.*,contract_new_apply.status as applystatus, contract_new_apply.progress as applyprogress + FROM pricereview_main + left join contract_new_apply on contract_new_apply.mid = pricereview_main.id + JOIN account ON account.accountid = pricereview_main.creater + WHERE (account.manager = 'M0029' OR account.manager='M0137') AND pricereview_main.status <> 'D' AND pricereview_main.ekind = '新梯' order by pricereview_main.id"; +} + $data = mysqli_query($link, $sql); // 若結案不同意 @@ -323,9 +331,11 @@ function get_pending($token) } $result = get_pending($token); -print_r($result); -$result[1]['sid'] = !empty($result) ? $result[1]['sid'] : 'prm'; -$result[1]['fid'] = !empty($result) ? $result[1]['fid'] : 'prm01'; +// print_r($result); +if(count($result) > 0){ + $result[1]['sid'] = !empty($result) ? $result[1]['sid'] : 'prm'; + $result[1]['fid'] = !empty($result) ? $result[1]['fid'] : 'prm01'; +} if ($data) : /* @@ -348,9 +358,13 @@ if ($data) :
- + btn-sm categoryBtn"> 所有價審 + 0): ?> btn-sm categoryBtn"> 待我簽核 + + btn-sm categoryBtn"> 待我簽核 + btn-sm categoryBtn"> 簽核完畢 btn-sm categoryBtn"> 結案同意 btn-sm categoryBtn"> 結案不同意 @@ -698,13 +712,15 @@ if ($data) : 待申請 - +
+ + 審請已通過
@@ -720,9 +736,6 @@ if ($data) : 下載 - - 下載草稿 - diff --git a/wms/mkt/pricereview_mi-api.php b/wms/mkt/pricereview_mi-api.php index 0d8438c4..3784957b 100644 --- a/wms/mkt/pricereview_mi-api.php +++ b/wms/mkt/pricereview_mi-api.php @@ -167,6 +167,7 @@ try { $ex_fee += $exarr[$j][1]; $j++; } + // print_r($exarr); mysqli_free_result($res); // 拆梯&美容平均分到每台電梯 @@ -326,14 +327,14 @@ try { LEFT JOIN option_mi ON option_price.id = option_mi.option_price_id LEFT JOIN elevator_quotation_rule ON option_mi.quotation_no = elevator_quotation_rule.quotation_no WHERE option_price.status = 'Y' "; -$sql4 = "SELECT option_price.id, elevator_quotation_rule.equipment, option_mi.base_floor, option_mi.quotation_no, option_mi.base_floor_plus, option_mi.price, option_price.price as OP -FROM option_price -LEFT JOIN option_mi ON option_price.id = option_mi.option_price_id -LEFT JOIN elevator_quotation_rule ON option_mi.quotation_no = elevator_quotation_rule.quotation_no -WHERE option_mi.option_price_id = " . $opt_elev_arr[$val]["price_id"] . " -AND (" . $v["item_weight"] . " BETWEEN option_mi.min_weight AND option_mi.max_weight) -AND option_mi.open_kind = '" . $v["item_op"] . "'"; - + //新的SQL + $sql4 = "SELECT option_price.id, elevator_quotation_rule.equipment, option_mi.base_floor, option_mi.quotation_no, option_mi.base_floor_plus, option_mi.price, option_price.price as OP + FROM option_price + LEFT JOIN option_mi ON option_price.id = option_mi.option_price_id + LEFT JOIN elevator_quotation_rule ON option_mi.quotation_no = elevator_quotation_rule.quotation_no + WHERE option_mi.option_price_id = " . $opt_elev_arr[$val]["price_id"] . " + AND (" . $v["item_weight"] . " BETWEEN option_mi.min_weight AND option_mi.max_weight) + AND option_mi.open_kind = '" . $v["item_op"] . "'"; $res_om = mysqli_query($link, $sql4); if ($row_om = mysqli_fetch_assoc($res_om)) { @@ -449,6 +450,79 @@ AND option_mi.open_kind = '" . $v["item_op"] . "'"; } $rarr["content"] = $mi_arr; + $sql_str = "SELECT * FROM pricereview_item WHERE mid = :mid AND item_group = 'E'"; + $stmt = $conn->prepare($sql_str); + $stmt->bindParam(':mid', $id); + $stmt->execute(); + $items = $stmt->fetchAll(PDO::FETCH_ASSOC); + + $sql_str = "SELECT pricereview_item.*,option_mi.price as option_mi FROM pricereview_item LEFT JOIN option_mi ON pricereview_item.price_id = option_mi.option_price_id WHERE pricereview_item.mid = :mid AND pricereview_item.item_group = 'B'"; + $sql_str = "SELECT + pricereview_item.*, + (SELECT option_mi.price + FROM option_mi + WHERE pricereview_item.price_id = option_mi.option_price_id + ORDER BY option_mi.id ASC LIMIT 1) AS option_mi + FROM + pricereview_item + WHERE + pricereview_item.mid = :mid + AND pricereview_item.item_group = 'B'"; + $stmt = $conn->prepare($sql_str); + $stmt->bindParam(':mid', $id); + $stmt->execute(); + $itemoptions = $stmt->fetchAll(PDO::FETCH_ASSOC); + + + + $exceptArr = []; + foreach($items as $item){ + if($item['option_relate_spec'] != NULL){ + $exceptArr[] = [ + 'option_relate_spec'=> $item['option_relate_spec'], + 'item_spec'=>$item['item_spec'], + 'item_unit_price'=>$item['item_unit_price'], + 'item_qty'=>$item['item_qty'], + 'item_price_bp'=> $item['item_price_bp'], + ]; + } + } + // $rarr["content"][] = $exceptArr; + foreach($rarr["content"] as $idx=>&$item){ + $newTotal = 0; + $item[16] = []; + $item[14] = []; + foreach($exceptArr as $except){ + if($idx+1 == $except['option_relate_spec']){ + $item[16][] = [ + $except['item_spec'], + $except['item_unit_price']* $except['item_qty'] + ]; + } + } + foreach($itemoptions as $itemoption){ + + if($idx+1 == $itemoption['option_relate_spec']){ + $item[14][] = [ + $itemoption['item_spec'], + round($itemoption['option_mi'] * $itemoption['item_qty'], 0), + ]; + } + + } + + foreach($item[14] as $option){ + $newTotal += $option[1]; + } + foreach($item[16] as $ex){ + $newTotal += $ex[1]; + } + $newTotal += $item[17]; + $newTotal += $item[19][1]; + + $item[13] = $newTotal; + } + } catch (\Exception $e) { $rarr['st'] = 'err'; $rarr['err'] = $e->getMessage(); diff --git a/wms/wipwhole-index-function.php b/wms/wipwhole-index-function.php index f1dba89d..af5a1964 100644 --- a/wms/wipwhole-index-function.php +++ b/wms/wipwhole-index-function.php @@ -1337,8 +1337,8 @@ function checkUseridIsManager($user_id) // 中區 李烘銘 if (in_array($user_id, ['M0086'])) return true; - // 桃竹 張莉凱 - if (in_array($user_id, ['M0026'])) + // 桃竹 張莉凱 改 陳家文 + if (in_array($user_id, ['M0029'])) return true; // 宜花東 陳志文 if (in_array($user_id, ['M0054'])) @@ -1348,3 +1348,20 @@ function checkUseridIsManager($user_id) return true; return false; } + +function manage_class_gary_ver($user_id) +{ + global $link; + + $sql = " + SELECT manager + FROM account + WHERE accountid = '$user_id'"; + $res = mysqli_query($link, $sql); + $row = mysqli_fetch_assoc($res); + $manager = $row["manager"]; + mysqli_free_result($res); + if ($manager == "M0001") + return ""; // 董事長略過 + return $manager; +} diff --git a/wms/wipwhole-rec-invoice-edit-submit.php b/wms/wipwhole-rec-invoice-edit-submit.php index a75b65b8..28512a7e 100644 --- a/wms/wipwhole-rec-invoice-edit-submit.php +++ b/wms/wipwhole-rec-invoice-edit-submit.php @@ -140,6 +140,7 @@ 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']; + $association_check_type = $_POST['association_check_type']; $salesname = accountid2name($salesid)[$salesid]; $salesmail = accountid2email([$salesid])[$salesid]; @@ -378,6 +379,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") { delivery_date_owner = '$delivery_date_owner', marketing_remark = '', real_custom_name = '$real_custom_name', + association_check_type = '$association_check_type', "; if (!empty(trim($marketing_remark))) { $updatesql .= " @@ -1018,7 +1020,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") { // 外示系統寄信 if ($_SERVER["REQUEST_METHOD"] == "POST") { if ($_POST['form_name'] == 'send_expression_mail_to_platform_form') { - + include "./class/Cmail.php"; $cmail = new Cmail(); @@ -1080,8 +1082,8 @@ function checkWwsAssianStatus($link, $user_id, $id = null) $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['salesmanagername'] = accountid2name(manage_class_gary_ver($data['salesid']))[manage_class_gary_ver($data['salesid'])]; + $data['salesmanagermail'] = accountid2email([manage_class_gary_ver($data['salesid'])])[manage_class_gary_ver($data['salesid'])]; $data['designname'] = accountid2name("M0023")["M0023"]; $data['designmail'] = accountid2email(["M0023"])["M0023"]; $data['designleadername'] = accountid2name(getSheJiokLeaderNo($link))[getSheJiokLeaderNo($link)]; @@ -1123,7 +1125,12 @@ function checkWwsAssianStatus($link, $user_id, $id = null) ], "永佳捷科技" ); - do_wws_next_assign(manage_class($data['salesid'])[0], $form_YD_key, 'I'); + // 如果是桃竹區 主管是家文的新梯 簽到劉永德經理那 + if (manage_class_gary_ver($data['salesid']) == 'M0029') { + do_wws_next_assign("M0137", $form_YD_key, 'I'); + } else { + do_wws_next_assign(manage_class_gary_ver($data['salesid']), $form_YD_key, 'I'); + } return true; } } diff --git a/wms/wipwhole-rec-invoice-edit.php b/wms/wipwhole-rec-invoice-edit.php index e764404f..4cc4847c 100644 --- a/wms/wipwhole-rec-invoice-edit.php +++ b/wms/wipwhole-rec-invoice-edit.php @@ -300,18 +300,27 @@ include "wipwhole-rec-invoice-edit-submit.php"; 營業人員確認項 - +
+ + 官檢類型 + + /> + + /> + + + 營業/契約確認規格 @@ -384,7 +393,7 @@ include "wipwhole-rec-invoice-edit-submit.php"; 附件 - 客戶姓名:" placeholder="輸入後即可上傳附件" /> + 客戶姓名:" placeholder="輸入後即可上傳附件" />
)" style="margin-left:3px;">寄送普來特富外示系統信件 @@ -1437,12 +1446,12 @@ include "wipwhole-rec-invoice-edit-submit.php"; QC及官檢類型 - /> - - /> - - /> - + /> + + /> + + /> + @@ -1467,9 +1476,9 @@ include "wipwhole-rec-invoice-edit-submit.php"; QC合格日
- > + > - +
@@ -1485,10 +1494,10 @@ include "wipwhole-rec-invoice-edit-submit.php"; 官檢日
- > - + > + > - +
@@ -1503,7 +1512,7 @@ include "wipwhole-rec-invoice-edit-submit.php"; 官檢附件 - > + > 下載附件" : ""; ?> diff --git a/wms/wipwhole-renovate-index-function.php b/wms/wipwhole-renovate-index-function.php index 628649c9..e3b997d6 100644 --- a/wms/wipwhole-renovate-index-function.php +++ b/wms/wipwhole-renovate-index-function.php @@ -1279,8 +1279,8 @@ function checkUseridIsManager($user_id) // 中區 李烘銘 if (in_array($user_id, ['M0086'])) return true; - // 桃竹 張莉凱 - if (in_array($user_id, ['M0026'])) + // 桃竹 張莉凱 改 陳家文 + if (in_array($user_id, ['M0029'])) return true; // 宜花東 陳志文 if (in_array($user_id, ['M0054'])) @@ -1290,3 +1290,20 @@ function checkUseridIsManager($user_id) return true; return false; } + +function manage_class_gary_ver($user_id) +{ + global $link; + + $sql = " + SELECT manager + FROM account + WHERE accountid = '$user_id'"; + $res = mysqli_query($link, $sql); + $row = mysqli_fetch_assoc($res); + $manager = $row["manager"]; + mysqli_free_result($res); + if ($manager == "M0001") + return ""; // 董事長略過 + return $manager; +} diff --git a/wms/wipwhole-renovate-rec-invoice-edit-submit.php b/wms/wipwhole-renovate-rec-invoice-edit-submit.php index 30ea4047..f5f56830 100644 --- a/wms/wipwhole-renovate-rec-invoice-edit-submit.php +++ b/wms/wipwhole-renovate-rec-invoice-edit-submit.php @@ -128,9 +128,13 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") { $delivery_date = $_POST['delivery_date'] ?: $row['delivery_date']; $old_delivery_date = $_POST['old_delivery_date'] ?: $row['old_delivery_date']; $delivery_date_owner = $_POST['delivery_date_owner'] ?: $row['delivery_date_owner']; - + $salesid = $_POST['salesid'] ?: $row['salesid']; $warehouseid = $_POST['warehouseid'] ?: $row['warehouseid']; $old_warehouseid = $_POST['old_warehouseid'] ?: $row['warehouseid']; + $association_check_type = $_POST['association_check_type'] ?: $row['association_check_type']; + + $salesname = accountid2name($salesid)[$salesid]; + $salesmail = accountid2email([$salesid])[$salesid]; $creater = $_POST['creater']; $create_at = date("Y-m-d H:i:s"); @@ -328,11 +332,12 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") { . " 移交日:" . $old_delivery_date . " => " . $delivery_date; } + $cmail->sendx( $mail_title, $mail_content, [ - [$salesname, $salesmail] + [$salesname, $salesmail], // ['gary', 'gary_chen@masada.com.tw'] ], "永佳捷科技" @@ -382,6 +387,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") { customer_planning_verify = '$customer_planning_verify', customer_planning_verify_at = '$customer_planning_verify_at', customer_planning_verify_owner = '$customer_planning_verify_owner', + association_check_type = '$association_check_type', marketing_remark = '', "; if (!empty(trim($marketing_remark))) { @@ -1149,8 +1155,8 @@ function checkWwsAssianStatus($link, $user_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['salesmanagername'] = accountid2name(manage_class_gary_ver($data['salesid']))[manage_class_gary_ver($data['salesid'])]; + $data['salesmanagermail'] = accountid2email([manage_class_gary_ver($data['salesid'])])[manage_class_gary_ver($data['salesid'])]; $data['designname'] = accountid2name("M0023")["M0023"]; $data['designmail'] = accountid2email(["M0023"])["M0023"]; $data['designleadername'] = accountid2name(getSheJiokLeaderNo($link))[getSheJiokLeaderNo($link)]; @@ -1197,7 +1203,7 @@ function checkWwsAssianStatus($link, $user_id) ], "永佳捷科技" ); - do_wws_next_assign(manage_class($data['salesid'])[0], $form_key, 'F'); + do_wws_next_assign(manage_class_gary_ver($data['salesid']), $form_key, 'F'); } } diff --git a/wms/wipwhole-renovate-rec-invoice-edit.php b/wms/wipwhole-renovate-rec-invoice-edit.php index 2af5e630..6e149369 100644 --- a/wms/wipwhole-renovate-rec-invoice-edit.php +++ b/wms/wipwhole-renovate-rec-invoice-edit.php @@ -613,11 +613,21 @@ include "wipwhole-renovate-rec-invoice-edit-submit.php";
+ + + 官檢類型 + + /> + + /> + + + 營業確認規格 @@ -693,7 +703,7 @@ include "wipwhole-renovate-rec-invoice-edit-submit.php"; 附件 - 客戶姓名:" placeholder="輸入後即可上傳附件" /> + 客戶姓名:" placeholder="輸入後即可上傳附件" />
QC及官檢類型 - /> - - /> - - /> - + /> + + /> + + /> + @@ -1478,10 +1488,10 @@ include "wipwhole-renovate-rec-invoice-edit-submit.php"; 官檢日
- > - > + > + > - +
@@ -1496,7 +1506,7 @@ include "wipwhole-renovate-rec-invoice-edit-submit.php"; 官檢附件 - > + > 下載附件" : ""; ?> @@ -2054,6 +2064,11 @@ include "wipwhole-renovate-rec-invoice-edit-submit.php"; 'install_end_date2', 'tryrun_start_date2', 'tryrun_end_date2', + 'install_start_date', + 'install_end_date', + 'tryrun_start_date', + 'tryrun_end_date', + 'delivery_date' ] for (var i = 0; i < catchTime_input_arr.length; i++) { inputChangeCatchTime(catchTime_input_arr[i]); @@ -2369,7 +2384,7 @@ include "wipwhole-renovate-rec-invoice-edit-submit.php"; } } - function sendExpressionMailToPlatform(id){ + function sendExpressionMailToPlatform(id) { if (confirm('確定要發送郵件嗎?') == true) { $("#wipwholestatusid").val(id); $('#send_expression_mail_to_platform_form').submit(); diff --git a/wms/wipwhole-wipinstallstatus-index-modal.php b/wms/wipwhole-wipinstallstatus-index-modal.php index 38f61862..42fa0027 100644 --- a/wms/wipwhole-wipinstallstatus-index-modal.php +++ b/wms/wipwhole-wipinstallstatus-index-modal.php @@ -19,7 +19,14 @@ if ($method == 'getInstallingDetails') if ($method == 'getInstalling2Details') echo getInstalling2Details($type, $mtype, $radsY, $radsM, $year, $month); - +if ($method == 'getShippingDetailsSql') + echo getShippingDetailsSql($type, $mtype, $radsY, $radsM, $year, $month); +if ($method == 'getEndingDetailsSql') + echo getEndingDetailsSql($type, $mtype, $radsY, $radsM, $year, $month); +if ($method == 'getInstallingDetailsSql') + echo getInstallingDetailsSql($type, $mtype, $radsY, $radsM, $year, $month); +if ($method == 'getInstalling2DetailsSql') + echo getInstalling2DetailsSql($type, $mtype, $radsY, $radsM, $year, $month); // 出貨台數 @@ -44,6 +51,25 @@ function getShippingDetails($type, $mtype, $radsY, $radsM, $year, $month) return json_encode($data, JSON_UNESCAPED_UNICODE); } +function getShippingDetailsSql($type, $mtype, $radsY, $radsM, $year, $month) +{ + global $link; + $sql = " + SELECT + * + FROM wipwholestatus + WHERE status = '1' + AND ( + real_arrival_date IS NOT NULL + AND real_arrival_date != '' + ) + AND real_arrival_date BETWEEN '$radsY-$radsM-01' AND '$year-$month-31' + "; + $sql .= !empty($type) ? " AND contract_type = '$type'" : ""; + $sql .= !empty($mtype) ? " AND renovate_type Like '%$mtype%'" : ""; + return $sql; +} + // 工收台數 function getEndingDetails($type, $mtype, $radsY, $radsM, $year, $month) @@ -67,6 +93,24 @@ function getEndingDetails($type, $mtype, $radsY, $radsM, $year, $month) return json_encode($data, JSON_UNESCAPED_UNICODE); } +function getEndingDetailsSql($type, $mtype, $radsY, $radsM, $year, $month) +{ + global $link; + $sql = " + SELECT + * + FROM wipwholestatus + WHERE status = '1' + AND real_arrival_date BETWEEN '$radsY-$radsM-01' AND '$year-$month-31' + AND (delivery_date BETWEEN '$radsY-$radsM-01' AND '$year-$month-31' + OR + official_check_date BETWEEN '$radsY-$radsM-01' AND '$year-$month-31' + ) + "; + $sql .= !empty($type) ? " AND contract_type = '$type'" : ""; + $sql .= !empty($mtype) ? " AND renovate_type Like '%$mtype%'" : ""; + return $sql; +} // 試車完台數 function getInstallingDetails($type, $mtype, $radsY, $radsM, $year, $month) @@ -93,6 +137,27 @@ function getInstallingDetails($type, $mtype, $radsY, $radsM, $year, $month) return json_encode($data, JSON_UNESCAPED_UNICODE); } +function getInstallingDetailsSql($type, $mtype, $radsY, $radsM, $year, $month) +{ + global $link; + $sql = " + SELECT + * + FROM wipwholestatus + WHERE status = '1' + AND ( + real_arrival_date IS NOT NULL + AND real_arrival_date != '' + ) + AND real_arrival_date BETWEEN '$radsY-$radsM-01' AND '$year-$month-31' + AND tryrun_end_date <= '$year-$month-31' + AND tryrun_end_date != '' + AND tryrun_end_date IS NOT NULL + "; + $sql .= !empty($type) ? " AND contract_type = '$type'" : ""; + $sql .= !empty($mtype) ? " AND renovate_type Like '%$mtype%'" : ""; + return $sql; +} // 在裝中台數 function getInstalling2Details($type, $mtype, $radsY, $radsM, $year, $month) @@ -121,3 +186,28 @@ function getInstalling2Details($type, $mtype, $radsY, $radsM, $year, $month) $data = mysqli_fetch_all($result, MYSQLI_ASSOC); return json_encode($data, JSON_UNESCAPED_UNICODE); } + +function getInstalling2DetailsSql($type, $mtype, $radsY, $radsM, $year, $month) +{ + global $link; + $sql = " + SELECT + * + FROM wipwholestatus + WHERE status = '1' + AND real_arrival_date BETWEEN '$radsY-$radsM-01' AND '$year-$month-31' + AND ( + delivery_date IS NULL + OR delivery_date = '' + OR delivery_date >= '$year-$month-31' + ) + AND( + official_check_date IS NULL + OR official_check_date = '' + OR official_check_date >= '$year-$month-31' + ) + "; + $sql .= !empty($type) ? " AND contract_type = '$type'" : ""; + $sql .= !empty($mtype) ? " AND renovate_type Like '%$mtype%'" : ""; + return $sql; +} diff --git a/wms/wipwhole-wipinstallstatus-index.php b/wms/wipwhole-wipinstallstatus-index.php index eb35d2c3..a8f0e15f 100644 --- a/wms/wipwhole-wipinstallstatus-index.php +++ b/wms/wipwhole-wipinstallstatus-index.php @@ -617,6 +617,29 @@ if ((int)$radsY . $radsM > (int)$radeY . $radeM) { function showDetails(method, contract_type, renovate_type, radsY, radsM, radsYi, start_month) { $("#myModal").show(); + + $.ajax({ + type: "POST", + dataType: "html", + url: "wipwhole-wipinstallstatus-index-modal.php", + data: { + method: method+'Sql', + contract_type: contract_type, + renovate_type: renovate_type, + radsY: radsY, + radsM: radsM, + radsYi: radsYi, + start_month: start_month + }, + success: function(data) { + console.log(data); + }, + error: function(data) { + console.log(data); + } + }) + + $.ajax({ type: "POST", dataType: "json", diff --git a/wms/wipwholeinstall-index-export-excel.php b/wms/wipwholeinstall-index-export-excel.php index f47ffa72..c3a0b4ea 100644 --- a/wms/wipwholeinstall-index-export-excel.php +++ b/wms/wipwholeinstall-index-export-excel.php @@ -175,7 +175,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") { substr($row['tryrun_end_date'], 0, 10), substr($row['qc_date'], 0, 10), substr($row['end_qc_date'], 0, 10), - substr($row['official_check_date'], 0, 10), + $row['association_check_type'] == '1' ? "-" : substr($row['official_check_date'], 0, 10), substr($row['delivery_date'], 0, 10), accountidToName($row['salesid']) ]; diff --git a/wms/wipwholeinstall-index-table-html.php b/wms/wipwholeinstall-index-table-html.php index 2311eca7..b5c9bcda 100644 --- a/wms/wipwholeinstall-index-table-html.php +++ b/wms/wipwholeinstall-index-table-html.php @@ -172,8 +172,12 @@ diff --git a/wms/wipwholeinstall-renovate-index-export-excel.php b/wms/wipwholeinstall-renovate-index-export-excel.php index 41342d30..a5598afa 100644 --- a/wms/wipwholeinstall-renovate-index-export-excel.php +++ b/wms/wipwholeinstall-renovate-index-export-excel.php @@ -177,7 +177,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") { substr($row['tryrun_end_date'], 0, 10), substr($row['qc_date'], 0, 10), substr($row['end_qc_date'], 0, 10), - substr($row['official_check_date'], 0, 10), + $row['association_check_type'] == '1' ? "-" : substr($row['official_check_date'], 0, 10), substr($row['delivery_date'], 0, 10), accountidToName($row['salesid']) ]; diff --git a/wms/wipwholeinstall-renovate-index-table-html.php b/wms/wipwholeinstall-renovate-index-table-html.php index 2f3dc8f4..7a9715ea 100644 --- a/wms/wipwholeinstall-renovate-index-table-html.php +++ b/wms/wipwholeinstall-renovate-index-table-html.php @@ -155,8 +155,12 @@