diff --git a/wms/T8_Authorization_curl_ver.php b/wms/T8_Authorization_curl_ver.php index 9a6beb45..fb12f4c4 100644 --- a/wms/T8_Authorization_curl_ver.php +++ b/wms/T8_Authorization_curl_ver.php @@ -1,21 +1,50 @@ $user_id, + 'user_password' => $user_password, + 'api_key' => $api_key, + 'GroupId' => $GroupId, + 'apiurl' => $apiurl +); +echo $validation = get_Auth($data); + +function get_Auth($data) { + $user_id = $data['user_id']; + $user_password = $data['user_password']; + $api_key = $data['api_key']; + $GroupId = $data['GroupId']; + $apiurl = $data['apiurl']; + + // 伺服器時間扣兩分鐘會比較穩定 // $now = gmdate("YmdHis"); $now = gmdate("YmdHis", strtotime("-2 minutes")); - $data = "$user_id." . $now; - $sign = hash_hmac('SHA256', $data, 'B2D6395D2883E26C', false); + $data = "$user_id." . $now; + $sign = hash_hmac('SHA256', $data, $api_key, false); + // 各種API連線網址 // $apiurl = 'https://erp.masada.com.tw:780/twWebAPI/GetAuth'; $apiurl = 'http://60.244.87.101:880//twWebAPI/GetAuth'; // $apiurl = 'http://10.10.145.2:880//twWebAPI/GetAuth'; @@ -25,7 +54,8 @@ function get_Auth($user_id = "M0000", $user_password = "M012290493119") "UserId: $user_id", "Pwd: $user_password", "TimestampUTC: $now", - "Sign: $sign" + "Sign: $sign", + "GroupId: $GroupId" ]; $ch = curl_init(); @@ -42,6 +72,8 @@ function get_Auth($user_id = "M0000", $user_password = "M012290493119") return $result['Data']['CHI_Authorization']; if ($result['Status'] == 'Error') return $result['ErrorMsg']; + + print_r($result); } curl_close($ch); diff --git a/wms/contract_b-index.php b/wms/contract_b-index.php index 521302b4..52fa8551 100644 --- a/wms/contract_b-index.php +++ b/wms/contract_b-index.php @@ -25,8 +25,8 @@ $sql = " cp.PersonId, -- 業務人員 cgp.PersonName, -- 業務人員名稱 cd.DeptName, -- 業務人員部門 - siam.UnTransAmount -- 合約金額 - -- siad_tmp2.Max_CU_EstPayDate -- 最後收款日期 + siam.UnTransAmount, -- 合約金額 + siad_tmp2.Max_CU_EstPayDate -- 最後收款日期 FROM salIncomeApplyMaster AS siam LEFT JOIN ( SELECT @@ -61,7 +61,7 @@ $sql = " FROM salIncomeApplyDetail AS siad GROUP BY siad.BillNo )AS siad_tmp2 -- 合約明細2 - ON siam.BillNo = siad_tmp.BillNo + ON siam.BillNo = siad_tmp2.BillNo $sql_cmd AND siam.CurrentState = '2' "; @@ -185,7 +185,8 @@ if ($data) : 單據號 客戶名稱 單據日期 - + 最後收款日 + 追蹤狀態 金額 明細 @@ -215,9 +216,26 @@ if ($data) : - + + + + + diff($date2); + $months = $interval->m; + $months += $interval->y * 12; + if ($date1 <= $date2) { + echo "合約已過期"; + } else if ($months <= 2) { + echo "合約快到期"; + } else { + echo "合約未到期"; + } + ?> + diff --git a/wms/img/mail001.jpg b/wms/img/mail001.jpg new file mode 100644 index 00000000..63f66ecd Binary files /dev/null and b/wms/img/mail001.jpg differ diff --git a/wms/ship_run_chart-model.php b/wms/ship_run_chart-model.php index 07c2bfcf..167b099b 100644 --- a/wms/ship_run_chart-model.php +++ b/wms/ship_run_chart-model.php @@ -9,6 +9,8 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") { $mtype = $_POST['mtype']; $year = $_POST['year']; $month = $_POST['month']; + if (in_array($type, ['M1', 'MA'])) + $type = null; if ($form_name == 'getShipping') { echo getShipping($type, $mtype, $year, $month); } @@ -40,16 +42,16 @@ function getShipping($type, $mtype, $year, $month) AND real_arrival_date != '' ) "; - if(!empty($month)){ + if (!empty($month)) { $sql .= " AND real_arrival_date BETWEEN '$year-$month-01' AND '$year-$month-31'"; - }else{ + } else { $sql .= " AND real_arrival_date BETWEEN '$year-01-01' AND '$year-12-31'"; } $sql .= !empty($type) ? " AND contract_type = '$type'" : ""; $sql .= !empty($mtype) ? " AND renovate_type Like '%$mtype%'" : ""; $result = mysqli_query($link, $sql); $data = mysqli_fetch_all($result, MYSQLI_ASSOC); - return json_encode($data, JSON_UNESCAPED_UNICODE); + return json_encode($data, JSON_UNESCAPED_UNICODE); } // 在裝台數 @@ -62,24 +64,20 @@ function getInstalling($type, $mtype, $year, $month) FROM wipwholestatus WHERE status = '1' AND ( - install_start_date IS NOT NULL - OR install_start_date != '' - ) - AND ( - install_end_date IS NULL - OR install_end_date = '' + tryrun_end_date = '' + OR tryrun_end_date IS NULL ) "; - if(!empty($month)){ + if (!empty($month)) { $sql .= " AND real_arrival_date BETWEEN '$year-$month-01' AND '$year-$month-31'"; - }else{ + } else { $sql .= " AND real_arrival_date BETWEEN '$year-01-01' AND '$year-12-31'"; } $sql .= !empty($type) ? " AND contract_type = '$type'" : ""; $sql .= !empty($mtype) ? " AND renovate_type Like '%$mtype%'" : ""; $result = mysqli_query($link, $sql); $data = mysqli_fetch_all($result, MYSQLI_ASSOC); - return json_encode($data, JSON_UNESCAPED_UNICODE); + return json_encode($data, JSON_UNESCAPED_UNICODE); } // 完工台數 @@ -91,21 +89,17 @@ function getInstalling2($type, $mtype, $year, $month) * FROM wipwholestatus WHERE status = '1' - AND install_start_date IS NOT NULL - AND install_start_date != '' - AND install_end_date IS NOT NULL - AND install_end_date != '' "; - if(!empty($month)){ - $sql .= " AND real_arrival_date BETWEEN '$year-$month-01' AND '$year-$month-31'"; - }else{ - $sql .= " AND real_arrival_date BETWEEN '$year-01-01' AND '$year-12-31'"; + if (!empty($month)) { + $sql .= " AND tryrun_end_date BETWEEN '$year-$month-01' AND '$year-$month-31'"; + } else { + $sql .= " AND tryrun_end_date BETWEEN '$year-01-01' AND '$year-12-31'"; } $sql .= !empty($type) ? " AND contract_type = '$type'" : ""; $sql .= !empty($mtype) ? " AND renovate_type Like '%$mtype%'" : ""; $result = mysqli_query($link, $sql); $data = mysqli_fetch_all($result, MYSQLI_ASSOC); - return json_encode($data, JSON_UNESCAPED_UNICODE); + return json_encode($data, JSON_UNESCAPED_UNICODE); } // QC台數 @@ -117,19 +111,17 @@ function getQCing($type, $mtype, $year, $month) * FROM wipwholestatus WHERE status = '1' - AND end_qc_date IS NOT NULL - AND end_qc_date != '' "; - if(!empty($month)){ - $sql .= " AND real_arrival_date BETWEEN '$year-$month-01' AND '$year-$month-31'"; - }else{ - $sql .= " AND real_arrival_date BETWEEN '$year-01-01' AND '$year-12-31'"; + if (!empty($month)) { + $sql .= " AND end_qc_date BETWEEN '$year-$month-01' AND '$year-$month-31'"; + } else { + $sql .= " AND end_qc_date BETWEEN '$year-01-01' AND '$year-12-31'"; } $sql .= !empty($type) ? " AND contract_type = '$type'" : ""; $sql .= !empty($mtype) ? " AND renovate_type Like '%$mtype%'" : ""; $result = mysqli_query($link, $sql); $data = mysqli_fetch_all($result, MYSQLI_ASSOC); - return json_encode($data, JSON_UNESCAPED_UNICODE); + return json_encode($data, JSON_UNESCAPED_UNICODE); } // 移交台數 @@ -141,17 +133,15 @@ function getDeliverying($type, $mtype, $year, $month) * FROM wipwholestatus WHERE status = '1' - AND delivery_date IS NOT NULL - AND delivery_date != '' "; - if(!empty($month)){ - $sql .= " AND real_arrival_date BETWEEN '$year-$month-01' AND '$year-$month-31'"; - }else{ - $sql .= " AND real_arrival_date BETWEEN '$year-01-01' AND '$year-12-31'"; + if (!empty($month)) { + $sql .= " AND delivery_date BETWEEN '$year-$month-01' AND '$year-$month-31'"; + } else { + $sql .= " AND delivery_date BETWEEN '$year-01-01' AND '$year-12-31'"; } $sql .= !empty($type) ? " AND contract_type = '$type'" : ""; $sql .= !empty($mtype) ? " AND renovate_type Like '%$mtype%'" : ""; $result = mysqli_query($link, $sql); $data = mysqli_fetch_all($result, MYSQLI_ASSOC); - return json_encode($data, JSON_UNESCAPED_UNICODE); + return json_encode($data, JSON_UNESCAPED_UNICODE); } diff --git a/wms/ship_run_chart-model_BK.php b/wms/ship_run_chart-model_BK.php new file mode 100644 index 00000000..07c2bfcf --- /dev/null +++ b/wms/ship_run_chart-model_BK.php @@ -0,0 +1,157 @@ + '新梯+汰改', 'A' => '新梯', - 'B' => '汰改' + 'B' => '汰改 M1+MA', + 'M1' => '汰改 M1', + 'MA' => '汰改 MA' ]; foreach ($contract_type as $c_val => $c_key) { - + $mtype = null; + if ($c_val == "M1") + $mtype = "M1"; + if ($c_val == "MA") + $mtype = "MA"; ?>