-
-
-
+
+0) {
+ header('location:custom-create-contract.php?accountid='.$accountid);
+ exit();
+ }
+ elseif(mysqli_affected_rows($link)==0) {
+
+ }
+ }
+ else{
+ echo "
+
合約資料添加
+
+
+
+
+
+
diff --git a/wms/data_collection_merge_export_submit.php b/wms/data_collection_merge_export_submit.php
index fb64e9c1..401e9a39 100644
--- a/wms/data_collection_merge_export_submit.php
+++ b/wms/data_collection_merge_export_submit.php
@@ -1,111 +1,111 @@
-load($target_file); //读取上传到服务器的文件
- $sheet = $objPHPExcel->getSheet(0); //拿到第一个sheet数据
- $highestRow = $sheet->getHighestRow(); // 取得总行数
- $highestColumn = $sheet->getHighestColumn(); // 取得总列数
- $highestColumn = PHPExcel_Cell::columnIndexFromString($highestColumn); // 转换字母为对应的统计数字;
- $excelArray = array();
- $data = [];
- $data['yyyymm'] = $_POST['yyyymm'];
- $i = 2;
- $sql_get = "select *From ec_purchase_order where yyyymm='" . $data['yyyymm'] . "' ";
- $res_get = mysqli_fetch_all(mysqli_query($link, $sql_get), MYSQLI_ASSOC);
- #excel 第一行 从B3-H3
- foreach ($res_get as $key => $val) {
- // var_dump( $key);
- // $_val = $sheet->getCellByColumnAndRow(0, $i++)->getCalculatedValue();
- //if ($_val == "") return;
- // $value = $sheet->getCell($key)->getValue();
- // var_dump( $val);
- # 1 銀行編碼
- $sheet->setCellValueExplicit('A' . ($key + 2), '', \PHPExcel_Cell_DataType::TYPE_STRING);
- #2 繳款帳號
- $sheet->setCellValueExplicit('B' . ($key + 2), date("Y-m-d"), \PHPExcel_Cell_DataType::TYPE_STRING);
- #3 客戶屬性
- $sheet->setCellValueExplicit('C' . ($key + 2), '', \PHPExcel_Cell_DataType::TYPE_STRING);
- #4 幣別
- $sheet->setCellValueExplicit('D' . ($key + 2), 'TWD', \PHPExcel_Cell_DataType::TYPE_STRING);
- #5 客戶代號
- $sheet->setCellValueExplicit('E' . ($key + 2), substr($val['customerid'], 1), \PHPExcel_Cell_DataType::TYPE_STRING);
- # 6客戶名稱
- $sheet->setCellValueExplicit('F' . ($key + 2), $val['customer_name'], \PHPExcel_Cell_DataType::TYPE_STRING);
- # 7 繳費說明1
- $sheet->setCellValueExplicit('G' . ($key + 2), '', \PHPExcel_Cell_DataType::TYPE_STRING);
- # 8 繳費說明2
- $sheet->setCellValueExplicit('H' . ($key + 2), '', \PHPExcel_Cell_DataType::TYPE_STRING);
- #9 繳費說明3
- $sheet->setCellValueExplicit('I' . ($key + 2), '', \PHPExcel_Cell_DataType::TYPE_STRING);
- #10 繳費說明3
- $sheet->setCellValueExplicit('J' . ($key + 2), '', \PHPExcel_Cell_DataType::TYPE_STRING);
- #11 繳費說明4
- $sheet->setCellValueExplicit('K' . ($key + 2), '', \PHPExcel_Cell_DataType::TYPE_STRING);
- #12繳費說明5
- $sheet->setCellValueExplicit('L' . ($key + 2), '', \PHPExcel_Cell_DataType::TYPE_STRING);
- #13 繳款截止日
- $sheet->setCellValueExplicit('M' . ($key + 2), '', \PHPExcel_Cell_DataType::TYPE_STRING);
- #14 期別說明
- $sheet->setCellValueExplicit('N' . ($key + 2), '', \PHPExcel_Cell_DataType::TYPE_STRING);
- #15 繳費通路別-銀行
- $sheet->setCellValueExplicit('O' . ($key + 2), '', \PHPExcel_Cell_DataType::TYPE_STRING);
- #16 繳費通路別-郵局
- $sheet->setCellValueExplicit('P' . ($key + 2), '', \PHPExcel_Cell_DataType::TYPE_STRING);
- #17 應繳總額
- $sheet->setCellValueExplicit('Q' . ($key + 2), $val['summary_price'], \PHPExcel_Cell_DataType::TYPE_STRING);
- #18 保留欄1
- $sheet->setCellValueExplicit('R' . ($key + 2), '', \PHPExcel_Cell_DataType::TYPE_STRING);
- #19 保留欄2
- $sheet->setCellValueExplicit('S' . ($key + 2), '', \PHPExcel_Cell_DataType::TYPE_STRING);
- #20 收費項目
- $sheet->setCellValueExplicit('T' . ($key + 2), '', \PHPExcel_Cell_DataType::TYPE_STRING);
- #21 應繳金額
- $sheet->setCellValueExplicit('U' . ($key + 2), '', \PHPExcel_Cell_DataType::TYPE_STRING);
- #22 說明
- $sheet->setCellValueExplicit('V' . ($key + 2), '', \PHPExcel_Cell_DataType::TYPE_STRING);
- #23 收費項目
- $sheet->setCellValueExplicit('W' . ($key + 2), '', \PHPExcel_Cell_DataType::TYPE_STRING);
- #24 應繳金額
- $sheet->setCellValueExplicit('X' . ($key + 2), '', \PHPExcel_Cell_DataType::TYPE_STRING);
- #25 說明
- $sheet->setCellValueExplicit('Y' . ($key + 2), '', \PHPExcel_Cell_DataType::TYPE_STRING);
- #26 結尾符號
- $sheet->setCellValueExplicit('Z' . ($key + 2), '', \PHPExcel_Cell_DataType::TYPE_STRING);
- // $data[$excel_field_mapping[$key]] = (empty($value) || $value == '') ? 'null' : "'" . $value . "'"; //读取excel数据到数组
- }
-
- //页面导出
- header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
- //设置下载的文件名称
- header('Content-Disposition: attachment;filename=' . urlencode('代收資料匯入檔') . '.xlsx');
- header('Cache-Control: max-age=0');
- header('Cache-Control: max-age=1');
- header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
- header('Cache-Control: cache, must-revalidate');
- header('Pragma: public');
- $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
- $objWriter->save('php://output');
-}
+load($target_file); //读取上传到服务器的文件
+ $sheet = $objPHPExcel->getSheet(0); //拿到第一个sheet数据
+ $highestRow = $sheet->getHighestRow(); // 取得总行数
+ $highestColumn = $sheet->getHighestColumn(); // 取得总列数
+ $highestColumn = PHPExcel_Cell::columnIndexFromString($highestColumn); // 转换字母为对应的统计数字;
+ $excelArray = array();
+ $data = [];
+ $data['yyyymm'] = $_POST['yyyymm'];
+ $i = 2;
+ $sql_get = "select *From ec_purchase_order where yyyymm='" . $data['yyyymm'] . "' ";
+ $res_get = mysqli_fetch_all(mysqli_query($link, $sql_get), MYSQLI_ASSOC);
+ #excel 第一行 从B3-H3
+ foreach ($res_get as $key => $val) {
+ // var_dump( $key);
+ // $_val = $sheet->getCellByColumnAndRow(0, $i++)->getCalculatedValue();
+ //if ($_val == "") return;
+ // $value = $sheet->getCell($key)->getValue();
+ // var_dump( $val);
+ # 1 銀行編碼
+ $sheet->setCellValueExplicit('A' . ($key + 2), '', \PHPExcel_Cell_DataType::TYPE_STRING);
+ #2 繳款帳號
+ $sheet->setCellValueExplicit('B' . ($key + 2), date("Y-m-d"), \PHPExcel_Cell_DataType::TYPE_STRING);
+ #3 客戶屬性
+ $sheet->setCellValueExplicit('C' . ($key + 2), '', \PHPExcel_Cell_DataType::TYPE_STRING);
+ #4 幣別
+ $sheet->setCellValueExplicit('D' . ($key + 2), 'TWD', \PHPExcel_Cell_DataType::TYPE_STRING);
+ #5 客戶代號
+ $sheet->setCellValueExplicit('E' . ($key + 2), substr($val['customerid'], 1), \PHPExcel_Cell_DataType::TYPE_STRING);
+ # 6客戶名稱
+ $sheet->setCellValueExplicit('F' . ($key + 2), $val['customer_name'], \PHPExcel_Cell_DataType::TYPE_STRING);
+ # 7 繳費說明1
+ $sheet->setCellValueExplicit('G' . ($key + 2), '', \PHPExcel_Cell_DataType::TYPE_STRING);
+ # 8 繳費說明2
+ $sheet->setCellValueExplicit('H' . ($key + 2), '', \PHPExcel_Cell_DataType::TYPE_STRING);
+ #9 繳費說明3
+ $sheet->setCellValueExplicit('I' . ($key + 2), '', \PHPExcel_Cell_DataType::TYPE_STRING);
+ #10 繳費說明3
+ $sheet->setCellValueExplicit('J' . ($key + 2), '', \PHPExcel_Cell_DataType::TYPE_STRING);
+ #11 繳費說明4
+ $sheet->setCellValueExplicit('K' . ($key + 2), '', \PHPExcel_Cell_DataType::TYPE_STRING);
+ #12繳費說明5
+ $sheet->setCellValueExplicit('L' . ($key + 2), '', \PHPExcel_Cell_DataType::TYPE_STRING);
+ #13 繳款截止日
+ $sheet->setCellValueExplicit('M' . ($key + 2), '', \PHPExcel_Cell_DataType::TYPE_STRING);
+ #14 期別說明
+ $sheet->setCellValueExplicit('N' . ($key + 2), '', \PHPExcel_Cell_DataType::TYPE_STRING);
+ #15 繳費通路別-銀行
+ $sheet->setCellValueExplicit('O' . ($key + 2), '', \PHPExcel_Cell_DataType::TYPE_STRING);
+ #16 繳費通路別-郵局
+ $sheet->setCellValueExplicit('P' . ($key + 2), '', \PHPExcel_Cell_DataType::TYPE_STRING);
+ #17 應繳總額
+ $sheet->setCellValueExplicit('Q' . ($key + 2), $val['summary_price'], \PHPExcel_Cell_DataType::TYPE_STRING);
+ #18 保留欄1
+ $sheet->setCellValueExplicit('R' . ($key + 2), '', \PHPExcel_Cell_DataType::TYPE_STRING);
+ #19 保留欄2
+ $sheet->setCellValueExplicit('S' . ($key + 2), '', \PHPExcel_Cell_DataType::TYPE_STRING);
+ #20 收費項目
+ $sheet->setCellValueExplicit('T' . ($key + 2), '', \PHPExcel_Cell_DataType::TYPE_STRING);
+ #21 應繳金額
+ $sheet->setCellValueExplicit('U' . ($key + 2), '', \PHPExcel_Cell_DataType::TYPE_STRING);
+ #22 說明
+ $sheet->setCellValueExplicit('V' . ($key + 2), '', \PHPExcel_Cell_DataType::TYPE_STRING);
+ #23 收費項目
+ $sheet->setCellValueExplicit('W' . ($key + 2), '', \PHPExcel_Cell_DataType::TYPE_STRING);
+ #24 應繳金額
+ $sheet->setCellValueExplicit('X' . ($key + 2), '', \PHPExcel_Cell_DataType::TYPE_STRING);
+ #25 說明
+ $sheet->setCellValueExplicit('Y' . ($key + 2), '', \PHPExcel_Cell_DataType::TYPE_STRING);
+ #26 結尾符號
+ $sheet->setCellValueExplicit('Z' . ($key + 2), '', \PHPExcel_Cell_DataType::TYPE_STRING);
+ // $data[$excel_field_mapping[$key]] = (empty($value) || $value == '') ? 'null' : "'" . $value . "'"; //读取excel数据到数组
+ }
+
+ //页面导出
+ header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
+ //设置下载的文件名称
+ header('Content-Disposition: attachment;filename=' . urlencode('代收資料匯入檔') . '.xlsx');
+ header('Cache-Control: max-age=0');
+ header('Cache-Control: max-age=1');
+ header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
+ header('Cache-Control: cache, must-revalidate');
+ header('Pragma: public');
+ $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
+ $objWriter->save('php://output');
+}
diff --git a/wms/database.php b/wms/database.php
index 2311059e..88d5ebe9 100644
--- a/wms/database.php
+++ b/wms/database.php
@@ -1,42 +1,42 @@
-setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
- }
-} catch (PDOException $e) {
- echo "fail";
- echo $e->getMessage();
-}
-if ($link) {
- mysqli_query($link, 'SET NAMES utf8');
- // echo "正確連接資料庫";
-} else {
- echo "不正確連接資料庫" . mysqli_connect_error();
-}
\ No newline at end of file
+setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
+ }
+} catch (PDOException $e) {
+ echo "fail";
+ echo $e->getMessage();
+}
+if ($link) {
+ mysqli_query($link, 'SET NAMES utf8');
+ // echo "正確連接資料庫";
+} else {
+ echo "不正確連接資料庫" . mysqli_connect_error();
+}
diff --git a/wms/delivery_info-create.php b/wms/delivery_info-create.php
index dc66fa39..ceec1ab7 100644
--- a/wms/delivery_info-create.php
+++ b/wms/delivery_info-create.php
@@ -1,92 +1,92 @@
-
-
-
-
- Please fill up the required field!";
- } else {
- echo "
Record has added successfully
";
- }
- }
- */
- ?>
-
-
-
-
-
-
-
+
+
+
+
+ Please fill up the required field!";
+ } else {
+ echo "
Record has added successfully
";
+ }
+ }
+ */
+ ?>
+
+
+
+
+
+
+
diff --git a/wms/delivery_info-delete.php b/wms/delivery_info-delete.php
index 462714e3..5e5eacc4 100644
--- a/wms/delivery_info-delete.php
+++ b/wms/delivery_info-delete.php
@@ -1,12 +1,12 @@
-
\ No newline at end of file
diff --git a/wms/delivery_info-edit.php b/wms/delivery_info-edit.php
index 04341dbe..88e5b07e 100644
--- a/wms/delivery_info-edit.php
+++ b/wms/delivery_info-edit.php
@@ -1,104 +1,104 @@
-getMessage(), "\n";
- }
-*/
- foreach($data as $data) :
-?>
-
-
-
-
-
+getMessage(), "\n";
+ }
+*/
+ foreach($data as $data) :
+?>
+
+
+
+
+
diff --git a/wms/delivery_info-index.php b/wms/delivery_info-index.php
index f5cc85bd..df0faee5 100644
--- a/wms/delivery_info-index.php
+++ b/wms/delivery_info-index.php
@@ -1,147 +1,147 @@
-
-
-
-
-
-
-
-
-
-
-Please fill up the required field!";
- } else {
- header("Location:delivery_info-index.php");
- }
- }
-
-?>
-
-
-
-
-
-
-
- 項次
- 貨運單號
- 訂購人編號
- 訂購人姓名
- 收件聯繫人
- 連絡電話
- 收件地址
- 物料總價
- 運費
- 稅金
- 合計
- 建檔日
-
- 修改
- 刪除
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-There is no record!";
-endif;
-
-#代表結束連線
-mysqli_close($link);
-
-include "footer.php";
-
+
+
+
+
+
+
+
+
+
+
+Please fill up the required field!";
+ } else {
+ header("Location:delivery_info-index.php");
+ }
+ }
+
+?>
+
+
+
+
+
+
+
+ 項次
+ 貨運單號
+ 訂購人編號
+ 訂購人姓名
+ 收件聯繫人
+ 連絡電話
+ 收件地址
+ 物料總價
+ 運費
+ 稅金
+ 合計
+ 建檔日
+
+ 修改
+ 刪除
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+There is no record!";
+endif;
+
+#代表結束連線
+mysqli_close($link);
+
+include "footer.php";
+
?>
\ No newline at end of file
diff --git a/wms/delivery_info-record-submit.php b/wms/delivery_info-record-submit.php
index 8095d0e2..e137ff20 100644
--- a/wms/delivery_info-record-submit.php
+++ b/wms/delivery_info-record-submit.php
@@ -1,49 +1,49 @@
- 0) {
- echo "";
- } elseif ($affected == 0) {
- echo "";
- } else {
- echo "{$db_query} 語法執行失敗,錯誤訊息SSS: " . mysqli_error($link);
- }
-}
-?>
+ 0) {
+ echo "";
+ } elseif ($affected == 0) {
+ echo "";
+ } else {
+ echo "{$db_query} 語法執行失敗,錯誤訊息SSS: " . mysqli_error($link);
+ }
+}
+?>
diff --git a/wms/delivery_info-record-update.php b/wms/delivery_info-record-update.php
index 3c04a926..45befd4a 100644
--- a/wms/delivery_info-record-update.php
+++ b/wms/delivery_info-record-update.php
@@ -1,44 +1,44 @@
- 0) {
- echo "";
- } elseif ($affected == 0) {
- echo "";
- } else {
- echo "{$db_query} 語法執行失敗,錯誤訊息SSS: " . mysqli_error($link);
- }
-}
+ 0) {
+ echo "";
+ } elseif ($affected == 0) {
+ echo "";
+ } else {
+ echo "{$db_query} 語法執行失敗,錯誤訊息SSS: " . mysqli_error($link);
+ }
+}
?>
\ No newline at end of file
diff --git a/wms/delivery_info-user-input.php b/wms/delivery_info-user-input.php
index 9a78ebd9..b8c4aec9 100644
--- a/wms/delivery_info-user-input.php
+++ b/wms/delivery_info-user-input.php
@@ -1,58 +1,58 @@
-
-
+
+
diff --git a/wms/delivery_log-create.php b/wms/delivery_log-create.php
index a8cd1042..bf85f7bf 100644
--- a/wms/delivery_log-create.php
+++ b/wms/delivery_log-create.php
@@ -1,66 +1,66 @@
-
-
-
-
- Please fill up the required field!";
- } else {
- echo "
Record has added successfully
";
- }
- }
- */
- ?>
-
-
-
-
-
-
-
+
+
+
+
+ Please fill up the required field!";
+ } else {
+ echo "
Record has added successfully
";
+ }
+ }
+ */
+ ?>
+
+
+
+
+
+
+
diff --git a/wms/delivery_log-delete.php b/wms/delivery_log-delete.php
index b1e23338..9512bfd9 100644
--- a/wms/delivery_log-delete.php
+++ b/wms/delivery_log-delete.php
@@ -1,12 +1,12 @@
-
\ No newline at end of file
diff --git a/wms/delivery_log-edit.php b/wms/delivery_log-edit.php
index c69dd25a..c096eeaf 100644
--- a/wms/delivery_log-edit.php
+++ b/wms/delivery_log-edit.php
@@ -1,75 +1,75 @@
-getMessage(), "\n";
- }
-*/
- foreach($data as $data) :
-?>
-
-
-
-
-
+getMessage(), "\n";
+ }
+*/
+ foreach($data as $data) :
+?>
+
+
+
+
+
diff --git a/wms/delivery_log-index.php b/wms/delivery_log-index.php
index bfa64956..d94d9c3e 100644
--- a/wms/delivery_log-index.php
+++ b/wms/delivery_log-index.php
@@ -1,137 +1,137 @@
-
-
-
-
-
-
-
-
-
-
-Please fill up the required field!";
- } else {
- header("Location:delivery_log-index.php");
- }
- }
-
-?>
-
-
-
-
-
-
-
- 項次
- 貨運單號
- 實際抵達時間
- 地點
- 備註
- 建檔人
- 建檔時間
-
- 修改
- 刪除
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-There is no record!";
-endif;
-
-#代表結束連線
-mysqli_close($link);
-
-include "footer.php";
-
+
+
+
+
+
+
+
+
+
+
+Please fill up the required field!";
+ } else {
+ header("Location:delivery_log-index.php");
+ }
+ }
+
+?>
+
+
+
+
+
+
+
+ 項次
+ 貨運單號
+ 實際抵達時間
+ 地點
+ 備註
+ 建檔人
+ 建檔時間
+
+ 修改
+ 刪除
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+There is no record!";
+endif;
+
+#代表結束連線
+mysqli_close($link);
+
+include "footer.php";
+
?>
\ No newline at end of file
diff --git a/wms/delivery_log-record-submit.php b/wms/delivery_log-record-submit.php
index 040cb275..3f97abee 100644
--- a/wms/delivery_log-record-submit.php
+++ b/wms/delivery_log-record-submit.php
@@ -1,38 +1,38 @@
- 0) {
- echo "";
- } elseif ($affected == 0) {
- echo "";
- } else {
- echo "{$db_query} 語法執行失敗,錯誤訊息SSS: " . mysqli_error($link);
- }
-}
-?>
+ 0) {
+ echo "";
+ } elseif ($affected == 0) {
+ echo "";
+ } else {
+ echo "{$db_query} 語法執行失敗,錯誤訊息SSS: " . mysqli_error($link);
+ }
+}
+?>
diff --git a/wms/delivery_log-record-update.php b/wms/delivery_log-record-update.php
index 5d3c4fc5..561b3ec5 100644
--- a/wms/delivery_log-record-update.php
+++ b/wms/delivery_log-record-update.php
@@ -1,38 +1,38 @@
- 0) {
- echo "";
- } elseif ($affected == 0) {
- echo "";
- } else {
- echo "{$db_query} 語法執行失敗,錯誤訊息SSS: " . mysqli_error($link);
- }
-}
+ 0) {
+ echo "";
+ } elseif ($affected == 0) {
+ echo "";
+ } else {
+ echo "{$db_query} 語法執行失敗,錯誤訊息SSS: " . mysqli_error($link);
+ }
+}
?>
\ No newline at end of file
diff --git a/wms/delivery_log-user-input.php b/wms/delivery_log-user-input.php
index 0bfb6ec0..921880f4 100644
--- a/wms/delivery_log-user-input.php
+++ b/wms/delivery_log-user-input.php
@@ -1,53 +1,53 @@
-
-
+
+
diff --git a/wms/demo.dart b/wms/demo.dart
index 593a71bc..213ba8c0 100644
--- a/wms/demo.dart
+++ b/wms/demo.dart
@@ -1,4 +1,4 @@
-void main() {
- String name="测试";
- print("1231v\${name}/${name}");
-}
+void main() {
+ String name="测试";
+ print("1231v\${name}/${name}");
+}
diff --git a/wms/ec_purchase_order_submit.php b/wms/ec_purchase_order_submit.php
index 227a34c2..e97eb315 100644
--- a/wms/ec_purchase_order_submit.php
+++ b/wms/ec_purchase_order_submit.php
@@ -1,188 +1,188 @@
- "date_seq",
- 1 => "customerid",
- 2 => "inv_customer_id",
- 3 => "inv_customer_name",
- 4 => "customer_name",
- 5 => "item_no",
- 6 => "item_name",
- 7 => "num",
- 8 => "unit_price",
- 9 => "pre_tax_price",
- 10 => "business_tax",
- 11 => "summary_price",
- 12 => "delivery_date",
- 13 => "summary",
- 14 => "contract_begin_date",
- 15 => "contract_end_date",
- 16 => "salesman",
- 17 => "operator_name",
- 18 => "enter_date",
-];
-
-if ($_SERVER["REQUEST_METHOD"] == "POST") {
- include "header.php";
- // 载入db.php来连结资料库
- require_once "../database.php";
- require_once '../PHPExcel/PHPExcel.php';
- require_once '../PHPExcel/IOFactory.php';
-
- $file_name = $_FILES["file"]["name"];
- $temp_file_name = $_FILES["file"]["tmp_name"];
- //$target_dir = "../inv-uploads/ec/" . $_POST['yyyymm'] . "/";
-
- //if (is_dir($target_dir) || mkdir($target_dir, '0777'));
- $target_dir = "../inv-uploads/";
-
- $target_file = strtolower($target_dir . strtotime("now") . "." . pathinfo($file_name, PATHINFO_EXTENSION));
- $EXTENSION = pathinfo($target_file, PATHINFO_EXTENSION);
- if (move_uploaded_file($temp_file_name, $target_file)) {
- if ($EXTENSION == 'xls') {
- $objReader = PHPExcel_IOFactory::createReader('Excel5'); //支持xls
- } else {
- $objReader = PHPExcel_IOFactory::createReader('Excel2007'); //支持xlsx是
- }
- $objPHPExcel = $objReader->load($target_file); //读取上传到服务器的文件
- $sheet = $objPHPExcel->getSheet(0); //拿到第一个sheet数据
- $highestRow = $sheet->getHighestRow(); // 取得总行数
- $highestColumn = $sheet->getHighestColumn(); // 取得总列数
- $highestColumn = PHPExcel_Cell::columnIndexFromString($highestColumn); // 转换字母为对应的统计数字;
- $excelArray = array();
- $success_in = 0;
- $fail_in = 0;
- #循環讀取excel ec_purchase_order
- /**
- * 1.将表格存放在 ec_purchase_order_tmp表,group by 是否有重复记录,有则定向到ec_purchase_order_import显示
- * 2.ec_purchase_order_tmp表group by 后无重复, 则union ec_purchase_order 是否有重复记录,有则定向到ec_purchase_order_import显示
- * 3.如果没有重复资料,则重定向到ec_purchase_order页面
- */
- # 1.将表格存放在 ec_purchase_order_tmp表,group by 是否有重复记录,有则定向到ec_purchase_order_import显示
- mysqli_query($link, "delete from ec_purchase_order_tmp where form_key='" . $_POST['form_key'] . "'");
-
- for ($row = 3; $row <= $highestRow - 3; $row++) {
- $val = $sheet->getCellByColumnAndRow(0, $row)->getCalculatedValue();
- if ($val == "") return;
- $data = [];
- for ($column = 0; $column < $highestColumn; $column++) {
- $val = $sheet->getCellByColumnAndRow($column, $row)->getCalculatedValue();
- //上午 오전 am 下午 오후 pm 2023-03-06 오후 12:47:28
- #包含上午 오전
- if ($column == 18 && mb_strpos($val, '오전')) {
- $_am = str_replace('오전', "", $val);
- //echo "_A:" . $_am . 'AM';
- $val = date("Y-m-d G:i:s", strtotime($_am . 'AM'));
- } elseif ($column == 18 && mb_strpos($val, '오후')) {
- $_pm = str_replace('오후', "", $val);
- $val = date("Y-m-d G:i:s", strtotime($_pm . 'PM'));
- }
- $data[$excel_field_mapping[$column]] = (empty($val) || $val == '') ? 'null' : "'" . $val . "'"; //读取excel数据到数组
- }
- $data['yyyymm'] = $_POST['yyyymm'];
- $data['form_key'] = $_POST['form_key'];
- $db_query1 = 'insert into ec_purchase_order_tmp(' . implode(array_keys($data), ',') . ') values (' . implode(array_values($data), ',') . ')';
- mysqli_query($link, $db_query1);
- }
-
- #ec_purchase_order_tmp表group by 是否有重复记录,有则定向到ec_purchase_order_import显示
- #gorup by
-
- $sql_group_epot = "
- SELECT count(*) cnt,
- date_seq,
- customerid,
- item_no,
- num,
- unit_price,
- pre_tax_price,
- business_tax,
- summary_price,
- enter_date From ec_purchase_order_tmp
- WHERE form_key = '" . $_POST['form_key'] . "'
- GROUP BY date_Seq, customerid, item_no, num, unit_price, pre_tax_price, business_tax, summary_price, enter_date
- HAVING COUNT(*) > 1";
-
- $res_group_epot = mysqli_fetch_row(mysqli_query($link, $sql_group_epot));
- #存在重复的记录ec_purchase_order_import
- if (!empty($res_group_epot)) {
- header("location: ec_purchase_order_import.php?error_form_key=" . $_POST['form_key']);
- exit();
- }
- $sql_group_epo = "
- SELECT
- count(*) cnt,
- a.date_seq,
- a.customerid,
- a.item_no,
- a.num,
- a.unit_price,
- a.pre_tax_price,
- a.business_tax,
- a.summary_price,
- a.enter_date
- FROM
- ec_purchase_order a,
- ec_purchase_order_tmp b
- WHERE
- a.date_seq = b.date_seq
- AND a.customerid = b.customerid
- AND a.item_no = b.item_no
- AND a.num = b.num
- AND a.unit_price = b.unit_price
- AND a.pre_tax_price = b.pre_tax_price
- AND a.business_tax = b.business_tax
- AND a.summary_price = b.summary_price
- AND a.enter_date = b.enter_date
- GROUP BY a.date_seq, a.customerid, a.item_no, a.num, a.unit_price,
- a.pre_tax_price, a.business_tax, a.summary_price, a.enter_date";
-
- $res_group_epo = mysqli_fetch_row(mysqli_query($link, $sql_group_epo));
- // echo $sql_group_epo;
- // exit();
- #存在重复的记录ec_purchase_order_import
- if (!empty($res_group_epo)) {
- header("location: ec_purchase_order_import.php?error_form_key=" . $_POST['form_key']);
- exit();
- }
- #不存在重复记录则插入到ec_purchase_order
- $sql_ins_epo = "insert into ec_purchase_order(id,date_seq,customerid,inv_customer_id,inv_customer_name,customer_name,item_no,item_name,num,unit_price,pre_tax_price,business_tax,summary_price,delivery_date,summary,contract_begin_date,contract_end_date,salesman,operator_name,enter_date,yyyymm,form_key,creater,create_at )
- select id,date_seq,customerid,inv_customer_id,inv_customer_name,customer_name,item_no,item_name,num,unit_price,pre_tax_price,business_tax,summary_price,delivery_date,summary,contract_begin_date,contract_end_date,salesman,operator_name,enter_date,yyyymm,form_key,creater,create_at From
- ec_purchase_order_tmp
- where form_key='" . $_POST['form_key'] . "'";
- mysqli_query($link, $sql_ins_epo);
- mysqli_query($link, "delete from ec_purchase_order_tmp where form_key='" . $_POST['form_key'] . "' ");
-
- mysqli_close($link);
- }
-}
-#echo $fail_in;
-header("location: ec_purchase_order.php");
-
-die();
+ "date_seq",
+ 1 => "customerid",
+ 2 => "inv_customer_id",
+ 3 => "inv_customer_name",
+ 4 => "customer_name",
+ 5 => "item_no",
+ 6 => "item_name",
+ 7 => "num",
+ 8 => "unit_price",
+ 9 => "pre_tax_price",
+ 10 => "business_tax",
+ 11 => "summary_price",
+ 12 => "delivery_date",
+ 13 => "summary",
+ 14 => "contract_begin_date",
+ 15 => "contract_end_date",
+ 16 => "salesman",
+ 17 => "operator_name",
+ 18 => "enter_date",
+];
+
+if ($_SERVER["REQUEST_METHOD"] == "POST") {
+ include "header.php";
+ // 载入db.php来连结资料库
+ require_once "../database.php";
+ require_once '../PHPExcel/PHPExcel.php';
+ require_once '../PHPExcel/IOFactory.php';
+
+ $file_name = $_FILES["file"]["name"];
+ $temp_file_name = $_FILES["file"]["tmp_name"];
+ //$target_dir = "../inv-uploads/ec/" . $_POST['yyyymm'] . "/";
+
+ //if (is_dir($target_dir) || mkdir($target_dir, '0777'));
+ $target_dir = "../inv-uploads/";
+
+ $target_file = strtolower($target_dir . strtotime("now") . "." . pathinfo($file_name, PATHINFO_EXTENSION));
+ $EXTENSION = pathinfo($target_file, PATHINFO_EXTENSION);
+ if (move_uploaded_file($temp_file_name, $target_file)) {
+ if ($EXTENSION == 'xls') {
+ $objReader = PHPExcel_IOFactory::createReader('Excel5'); //支持xls
+ } else {
+ $objReader = PHPExcel_IOFactory::createReader('Excel2007'); //支持xlsx是
+ }
+ $objPHPExcel = $objReader->load($target_file); //读取上传到服务器的文件
+ $sheet = $objPHPExcel->getSheet(0); //拿到第一个sheet数据
+ $highestRow = $sheet->getHighestRow(); // 取得总行数
+ $highestColumn = $sheet->getHighestColumn(); // 取得总列数
+ $highestColumn = PHPExcel_Cell::columnIndexFromString($highestColumn); // 转换字母为对应的统计数字;
+ $excelArray = array();
+ $success_in = 0;
+ $fail_in = 0;
+ #循環讀取excel ec_purchase_order
+ /**
+ * 1.将表格存放在 ec_purchase_order_tmp表,group by 是否有重复记录,有则定向到ec_purchase_order_import显示
+ * 2.ec_purchase_order_tmp表group by 后无重复, 则union ec_purchase_order 是否有重复记录,有则定向到ec_purchase_order_import显示
+ * 3.如果没有重复资料,则重定向到ec_purchase_order页面
+ */
+ # 1.将表格存放在 ec_purchase_order_tmp表,group by 是否有重复记录,有则定向到ec_purchase_order_import显示
+ mysqli_query($link, "delete from ec_purchase_order_tmp where form_key='" . $_POST['form_key'] . "'");
+
+ for ($row = 3; $row <= $highestRow - 3; $row++) {
+ $val = $sheet->getCellByColumnAndRow(0, $row)->getCalculatedValue();
+ if ($val == "") return;
+ $data = [];
+ for ($column = 0; $column < $highestColumn; $column++) {
+ $val = $sheet->getCellByColumnAndRow($column, $row)->getCalculatedValue();
+ //上午 오전 am 下午 오후 pm 2023-03-06 오후 12:47:28
+ #包含上午 오전
+ if ($column == 18 && mb_strpos($val, '오전')) {
+ $_am = str_replace('오전', "", $val);
+ //echo "_A:" . $_am . 'AM';
+ $val = date("Y-m-d G:i:s", strtotime($_am . 'AM'));
+ } elseif ($column == 18 && mb_strpos($val, '오후')) {
+ $_pm = str_replace('오후', "", $val);
+ $val = date("Y-m-d G:i:s", strtotime($_pm . 'PM'));
+ }
+ $data[$excel_field_mapping[$column]] = (empty($val) || $val == '') ? 'null' : "'" . $val . "'"; //读取excel数据到数组
+ }
+ $data['yyyymm'] = $_POST['yyyymm'];
+ $data['form_key'] = $_POST['form_key'];
+ $db_query1 = 'insert into ec_purchase_order_tmp(' . implode(array_keys($data), ',') . ') values (' . implode(array_values($data), ',') . ')';
+ mysqli_query($link, $db_query1);
+ }
+
+ #ec_purchase_order_tmp表group by 是否有重复记录,有则定向到ec_purchase_order_import显示
+ #gorup by
+
+ $sql_group_epot = "
+ SELECT count(*) cnt,
+ date_seq,
+ customerid,
+ item_no,
+ num,
+ unit_price,
+ pre_tax_price,
+ business_tax,
+ summary_price,
+ enter_date From ec_purchase_order_tmp
+ WHERE form_key = '" . $_POST['form_key'] . "'
+ GROUP BY date_Seq, customerid, item_no, num, unit_price, pre_tax_price, business_tax, summary_price, enter_date
+ HAVING COUNT(*) > 1";
+
+ $res_group_epot = mysqli_fetch_row(mysqli_query($link, $sql_group_epot));
+ #存在重复的记录ec_purchase_order_import
+ if (!empty($res_group_epot)) {
+ header("location: ec_purchase_order_import.php?error_form_key=" . $_POST['form_key']);
+ exit();
+ }
+ $sql_group_epo = "
+ SELECT
+ count(*) cnt,
+ a.date_seq,
+ a.customerid,
+ a.item_no,
+ a.num,
+ a.unit_price,
+ a.pre_tax_price,
+ a.business_tax,
+ a.summary_price,
+ a.enter_date
+ FROM
+ ec_purchase_order a,
+ ec_purchase_order_tmp b
+ WHERE
+ a.date_seq = b.date_seq
+ AND a.customerid = b.customerid
+ AND a.item_no = b.item_no
+ AND a.num = b.num
+ AND a.unit_price = b.unit_price
+ AND a.pre_tax_price = b.pre_tax_price
+ AND a.business_tax = b.business_tax
+ AND a.summary_price = b.summary_price
+ AND a.enter_date = b.enter_date
+ GROUP BY a.date_seq, a.customerid, a.item_no, a.num, a.unit_price,
+ a.pre_tax_price, a.business_tax, a.summary_price, a.enter_date";
+
+ $res_group_epo = mysqli_fetch_row(mysqli_query($link, $sql_group_epo));
+ // echo $sql_group_epo;
+ // exit();
+ #存在重复的记录ec_purchase_order_import
+ if (!empty($res_group_epo)) {
+ header("location: ec_purchase_order_import.php?error_form_key=" . $_POST['form_key']);
+ exit();
+ }
+ #不存在重复记录则插入到ec_purchase_order
+ $sql_ins_epo = "insert into ec_purchase_order(id,date_seq,customerid,inv_customer_id,inv_customer_name,customer_name,item_no,item_name,num,unit_price,pre_tax_price,business_tax,summary_price,delivery_date,summary,contract_begin_date,contract_end_date,salesman,operator_name,enter_date,yyyymm,form_key,creater,create_at )
+ select id,date_seq,customerid,inv_customer_id,inv_customer_name,customer_name,item_no,item_name,num,unit_price,pre_tax_price,business_tax,summary_price,delivery_date,summary,contract_begin_date,contract_end_date,salesman,operator_name,enter_date,yyyymm,form_key,creater,create_at From
+ ec_purchase_order_tmp
+ where form_key='" . $_POST['form_key'] . "'";
+ mysqli_query($link, $sql_ins_epo);
+ mysqli_query($link, "delete from ec_purchase_order_tmp where form_key='" . $_POST['form_key'] . "' ");
+
+ mysqli_close($link);
+ }
+}
+#echo $fail_in;
+header("location: ec_purchase_order.php");
+
+die();
diff --git a/wms/equipment-create.php b/wms/equipment-create.php
index 00ff8931..9b007127 100644
--- a/wms/equipment-create.php
+++ b/wms/equipment-create.php
@@ -1,100 +1,100 @@
-
-
-
-
- Please fill up the required field!";
- } else {
- echo "
Record has added successfully
";
- }
- }
- */
- ?>
-
-
-
-
-
-
-
+
+
+
+
+ Please fill up the required field!";
+ } else {
+ echo "
Record has added successfully
";
+ }
+ }
+ */
+ ?>
+
+
+
+
+
+
+
diff --git a/wms/equipment-delete.php b/wms/equipment-delete.php
index b4ab8e3d..d305d257 100644
--- a/wms/equipment-delete.php
+++ b/wms/equipment-delete.php
@@ -1,12 +1,12 @@
-
\ No newline at end of file
diff --git a/wms/equipment-edit.php b/wms/equipment-edit.php
index fafd9839..caab6f63 100644
--- a/wms/equipment-edit.php
+++ b/wms/equipment-edit.php
@@ -1,113 +1,113 @@
-getMessage(), "\n";
- }
-*/
- foreach($data as $data) :
-?>
-
-
-
-
-
+getMessage(), "\n";
+ }
+*/
+ foreach($data as $data) :
+?>
+
+
+
+
+
diff --git a/wms/equipment-index.php b/wms/equipment-index.php
index 7027b33c..083a8701 100644
--- a/wms/equipment-index.php
+++ b/wms/equipment-index.php
@@ -1,151 +1,151 @@
-
-
-
-
-
-
-
-
-
-
-Please fill up the required field!";
- } else {
- header("Location:equipment-index.php");
- }
- }
-
-?>
-
-
-
-
-
-
-
- 項次
- 類別
- 部品號
- 部品名稱
- 照片
- 廠牌
- 規格
- 計量單位
- 庫存數
- 牌價
- 折扣
- 最後售價
- 建檔人
- 建檔時間
-
- 修改
- 刪除
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-There is no record!";
-endif;
-
-#代表結束連線
-mysqli_close($link);
-
-include "footer.php";
-
+
+
+
+
+
+
+
+
+
+
+Please fill up the required field!";
+ } else {
+ header("Location:equipment-index.php");
+ }
+ }
+
+?>
+
+
+
+
+
+
+
+ 項次
+ 類別
+ 部品號
+ 部品名稱
+ 照片
+ 廠牌
+ 規格
+ 計量單位
+ 庫存數
+ 牌價
+ 折扣
+ 最後售價
+ 建檔人
+ 建檔時間
+
+ 修改
+ 刪除
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+There is no record!";
+endif;
+
+#代表結束連線
+mysqli_close($link);
+
+include "footer.php";
+
?>
\ No newline at end of file
diff --git a/wms/equipment-record-submit.php b/wms/equipment-record-submit.php
index 7f621f0b..d5a40dd3 100644
--- a/wms/equipment-record-submit.php
+++ b/wms/equipment-record-submit.php
@@ -1,123 +1,123 @@
-File is not an image";
- $upload_ok = 0;
- } else {
- //echo "File is an image - " . $check_img["mime"];
- $upload_ok = 1;
-
- //Check if file already exists
- if(file_exists($target_file)) {
- echo "
File is already uploaded! ";
- $upload_ok = 0;
- } else {
- //Check file size
- if($file_size > 500000) {
- echo "
Please enter a file size between 5mb ";
- $upload_ok = 0;
- } else {
- //Allow certain file formats
- if($img_file_type != "jpg" && $img_file_type != "png" && $img_file_type != "jpeg" && $img_file_type != "gif") {
- echo "
JPG, PNG, JPEG and GIF files are allowed ";
- $upload_ok = 0;
- } else {
- //Check if $upload_ok is set to 0 by an error
- if($upload_ok === 0) {
- echo "
File has not been uploaded ";
- } else {
- if(move_uploaded_file($temp_file_name, $target_file)){
-
-
- // sql語法存在變數中
- // $db_query = "INSERT INTO expert (id, expert_id, personal_id, name, title, picture, major, tel, tel_count, chat_id, chat_count, video_call, video_count, onsite_call, onsite_count, creater, create_at) VALUE (`$id`, `$expert_id`, `$personal_id`, `$name`, `$title`, `$target_file`, `$major`, `$tel`, `$tel_count`, `$chat_id`, `$chat_count`, `$video_call`, `$video_count`, `$onsite_call`, `$onsite_count`, `$creater`, `$create_at`)";
- $db_query = "INSERT INTO equipment(equipment_id, equipment_name, brand,spec, count_type,inventory,list_price,discount,final_price,picture,creater, create_at) VALUES ('$equipment_id', '$equipment_name', '$brand','$spec', '$count_type','$inventory','$list_price','$discount','$final_price','$target_file','$creater', '$create_at')";
-
- // 用mysqli_query方法執行(sql語法)將結果存在變數中
- $result = mysqli_query($link,$db_query);
-
- }
- }
- }
- }
- }
- }
- }
- $affected = mysqli_affected_rows($link);
- mysqli_close($link);
- if ($affected > 0) {
- echo "";
- } elseif ($affected == 0) {
- echo "";
- } else {
- echo "{$db_query} 語法執行失敗,錯誤訊息SSS: " . mysqli_error($link);
- }
-}
+File is not an image";
+ $upload_ok = 0;
+ } else {
+ //echo "File is an image - " . $check_img["mime"];
+ $upload_ok = 1;
+
+ //Check if file already exists
+ if(file_exists($target_file)) {
+ echo "
File is already uploaded! ";
+ $upload_ok = 0;
+ } else {
+ //Check file size
+ if($file_size > 500000) {
+ echo "
Please enter a file size between 5mb ";
+ $upload_ok = 0;
+ } else {
+ //Allow certain file formats
+ if($img_file_type != "jpg" && $img_file_type != "png" && $img_file_type != "jpeg" && $img_file_type != "gif") {
+ echo "
JPG, PNG, JPEG and GIF files are allowed ";
+ $upload_ok = 0;
+ } else {
+ //Check if $upload_ok is set to 0 by an error
+ if($upload_ok === 0) {
+ echo "
File has not been uploaded ";
+ } else {
+ if(move_uploaded_file($temp_file_name, $target_file)){
+
+
+ // sql語法存在變數中
+ // $db_query = "INSERT INTO expert (id, expert_id, personal_id, name, title, picture, major, tel, tel_count, chat_id, chat_count, video_call, video_count, onsite_call, onsite_count, creater, create_at) VALUE (`$id`, `$expert_id`, `$personal_id`, `$name`, `$title`, `$target_file`, `$major`, `$tel`, `$tel_count`, `$chat_id`, `$chat_count`, `$video_call`, `$video_count`, `$onsite_call`, `$onsite_count`, `$creater`, `$create_at`)";
+ $db_query = "INSERT INTO equipment(equipment_id, equipment_name, brand,spec, count_type,inventory,list_price,discount,final_price,picture,creater, create_at) VALUES ('$equipment_id', '$equipment_name', '$brand','$spec', '$count_type','$inventory','$list_price','$discount','$final_price','$target_file','$creater', '$create_at')";
+
+ // 用mysqli_query方法執行(sql語法)將結果存在變數中
+ $result = mysqli_query($link,$db_query);
+
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ $affected = mysqli_affected_rows($link);
+ mysqli_close($link);
+ if ($affected > 0) {
+ echo "";
+ } elseif ($affected == 0) {
+ echo "";
+ } else {
+ echo "{$db_query} 語法執行失敗,錯誤訊息SSS: " . mysqli_error($link);
+ }
+}
?>
\ No newline at end of file
diff --git a/wms/equipment-record-update.php b/wms/equipment-record-update.php
index bad238a6..2673d8ef 100644
--- a/wms/equipment-record-update.php
+++ b/wms/equipment-record-update.php
@@ -1,80 +1,80 @@
- 500000) {
- echo "
Please enter a file size between 5mb ";
- $upload_ok = 0;
- } else { //
- //Allow certain file formats
- if($img_file_type != "jpg" && $img_file_type != "png" && $img_file_type != "jpeg" && $img_file_type != "gif") {
- //echo "JPG, PNG, JPEG and GIF files are allowed";
- $upload_ok = 0;
- } else {
- //Check if $upload_ok is set to 0 by an error
- if($upload_ok === 0) {
- echo "
File has not been uploaded ";
- } else {
- if(move_uploaded_file($temp_file_name, $target_file)){
- $db_query = "UPDATE equipment set category = '$category', equipment_id = '$equipment_id', equipment_name = '$equipment_name', brand = '$brand', spec = '$spec', count_type = '$count_type',inventory = '$inventory',list_price = '$list_price',discount = '$discount',final_price = '$final_price',picture = '$target_file',create_at = '$create_at' WHERE id='$id'";
- mysqli_query($link, $db_query);
- header("location: equipment-index.php");
- }
- }
- }
- }
-
- }
- $affected = mysqli_affected_rows($link);
- mysqli_close($link);
- if ($affected > 0) {
- echo "";
- } elseif ($affected == 0) {
- echo "";
- } else {
- echo "{$db_query} 語法執行失敗,錯誤訊息SSS: " . mysqli_error($link);
- }
-}
+ 500000) {
+ echo "
Please enter a file size between 5mb ";
+ $upload_ok = 0;
+ } else { //
+ //Allow certain file formats
+ if($img_file_type != "jpg" && $img_file_type != "png" && $img_file_type != "jpeg" && $img_file_type != "gif") {
+ //echo "JPG, PNG, JPEG and GIF files are allowed";
+ $upload_ok = 0;
+ } else {
+ //Check if $upload_ok is set to 0 by an error
+ if($upload_ok === 0) {
+ echo "
File has not been uploaded ";
+ } else {
+ if(move_uploaded_file($temp_file_name, $target_file)){
+ $db_query = "UPDATE equipment set category = '$category', equipment_id = '$equipment_id', equipment_name = '$equipment_name', brand = '$brand', spec = '$spec', count_type = '$count_type',inventory = '$inventory',list_price = '$list_price',discount = '$discount',final_price = '$final_price',picture = '$target_file',create_at = '$create_at' WHERE id='$id'";
+ mysqli_query($link, $db_query);
+ header("location: equipment-index.php");
+ }
+ }
+ }
+ }
+
+ }
+ $affected = mysqli_affected_rows($link);
+ mysqli_close($link);
+ if ($affected > 0) {
+ echo "";
+ } elseif ($affected == 0) {
+ echo "";
+ } else {
+ echo "{$db_query} 語法執行失敗,錯誤訊息SSS: " . mysqli_error($link);
+ }
+}
?>
\ No newline at end of file
diff --git a/wms/equipment-user-input.php b/wms/equipment-user-input.php
index 458d7ccb..1a9a46ef 100644
--- a/wms/equipment-user-input.php
+++ b/wms/equipment-user-input.php
@@ -1,57 +1,57 @@
-
-
+
+
diff --git a/wms/estimated_shipping_date_report.php b/wms/estimated_shipping_date_report.php
index a428e639..3b0db952 100644
--- a/wms/estimated_shipping_date_report.php
+++ b/wms/estimated_shipping_date_report.php
@@ -1,1339 +1,1339 @@
-= '$start_y-$start_m-1'
- AND real_contract_arrival_date <= '$end_y-$end_m-31'
- ) AS this_order
- WHERE 1 = 1
- GROUP BY this_order.contract_type,
- this_order.sub_address,
- this_order.date_year,
- this_order.date_month
-";
-$result = mysqli_query($link, $sql);
-$data = [];
-while ($row = $result->fetch_assoc()) {
- $data[] = $row;
-}
-
-function findData($data, $searchData)
-{
- foreach ($data as $item) {
- if (
- $item['contract_type'] == $searchData['contract_type']
- && $item['sub_address'] == $searchData['sub_address']
- && $item['date_year'] == $searchData['date_year']
- && $item['date_month'] == $searchData['date_month']
- ) {
- return $item['facility_count'];
- }
- }
- return 0;
-}
-
-function findDataByCity($data, $searchData)
-{
- $count = 0;
- $start_y = $searchData['start_y'];
- $start_m = $searchData['start_m'];
- $end_y = $searchData['end_y'];
- $end_m = $searchData['end_m'];
- for ($i = $start_y; $i <= $end_y; $i++) {
- $this_start_m = $i == $start_y ? $start_m : 1;
- $this_end_m = $i == $start_y ? 12 : $end_m;
- for ($j = $this_start_m; $j <= $this_end_m; $j++) {
- foreach ($data as $item) {
- if (
- $item['contract_type'] == $searchData['contract_type']
- && $item['sub_address'] == $searchData['sub_address']
- && $item['date_year'] == $i
- && $item['date_month'] == str_pad($j, 2, '0', STR_PAD_LEFT)
- ) {
- $count += $item['facility_count'];
- }
- }
- }
- }
- return $count;
-}
-
-function findDataByYearMonth($data, $searchData)
-{
- $count = 0;
- foreach ($data as $item) {
- if (
- $item['contract_type'] == $searchData['contract_type']
- && $item['date_year'] == $searchData['date_year']
- && $item['date_month'] == $searchData['date_month']
- ) {
- $count += $item['facility_count'];
- }
- }
- return $count;
-}
-
-function findAllDataByYearMonth($data, $searchData)
-{
- $count = 0;
- $start_y = $searchData['start_y'];
- $start_m = $searchData['start_m'];
- $end_y = $searchData['end_y'];
- $end_m = $searchData['end_m'];
- for ($i = $start_y; $i <= $end_y; $i++) {
- $this_start_m = $i == $start_y ? $start_m : 1;
- $this_end_m = $i == $start_y ? 12 : $end_m;
- for ($j = $this_start_m; $j <= $this_end_m; $j++) {
- foreach ($data as $item) {
- if (
- $item['contract_type'] == $searchData['contract_type']
- && $item['date_year'] == $i
- && $item['date_month'] == str_pad($j, 2, '0', STR_PAD_LEFT)
- ) {
- $count += $item['facility_count'];
- }
- }
- }
- }
- return $count;
-}
-
-$sql = "
- SELECT
- new_order.facility_kind,
- COUNT(new_order.facility_kind) AS facility_count
- FROM(
- SELECT
- w.facility_kind
- FROM wipwholestatus AS w
- WHERE 1=1
- AND status = '1'
- AND contract_type = 'A'
- AND real_contract_arrival_date >= '$start_y-$start_m-1'
- AND real_contract_arrival_date <= '$end_y-$end_m-31'
- ) AS new_order
- WHERE 1 = 1
- GROUP BY new_order.facility_kind
-";
-$result = mysqli_query($link, $sql);
-$data2 = [];
-while ($row = $result->fetch_assoc()) {
- $data2[] = $row;
-}
-
-function findFacilityTypeAllCount($data2)
-{
- $count = 0;
- foreach ($data2 as $row) {
- $count += $row['facility_count'];
- }
- return $count;
-}
-
-function getFacilityNamebyType($facility_kind)
-{
- $arr = array(
- 'MAE100' => '小機房',
- 'MAM200' => '無機房',
- 'MAH100' => '小電梯',
- 'MAQ100' => '強驅梯',
- 'MAF100' => '貨梯',
- 'MAP100' => '平台梯',
- '' => '未分類'
- );
- return isset($arr[$facility_kind]) ? $arr[$facility_kind] : "";
-}
-
-$sql = "
- SELECT
- w.renovate_type
- FROM wipwholestatus AS w
- WHERE 1=1
- AND status = '1'
- AND real_contract_arrival_date >= '$start_y-$start_m-1'
- AND real_contract_arrival_date <= '$end_y-$end_m-31'
- AND contract_type = 'B'
-";
-$result = mysqli_query($link, $sql);
-$data3 = [];
-while ($row = $result->fetch_assoc()) {
- $data3[] = $row;
-}
-
-// 分開計算
-
-// $M1 = 0;
-// $M2 = 0;
-// $M3 = 0;
-// $M4 = 0;
-// $MA = 0;
-// $M_count = 0;
-// foreach ($data3 as $row) {
-// $renovate_type_arr = json_decode($row['renovate_type']);
-// foreach ($renovate_type_arr as $row2) {
-// if ($row2 == 'M1')
-// $M1++;
-// if ($row2 == 'M2')
-// $M2++;
-// if ($row2 == 'M3')
-// $M3++;
-// if ($row2 == 'M4')
-// $M4++;
-// if ($row2 == 'MA')
-// $MA++;
-// }
-// }
-// $M_count = $M1 + $M2 + $M3 + $M4 + $MA;
-
-$M_count = count($data3);
-$m_type_arr = [];
-$m_type_arr[''] = 0;
-foreach ($data3 as $row) {
- $m_type_arr[implode("+", json_decode($row['renovate_type']))] = 0;
-}
-foreach ($data3 as $row) {
- $m_type_arr[implode("+", json_decode($row['renovate_type']))]++;
-}
-
-
-//數字轉英文(0=>A、1=>B、26=>AA...以此類推)
-function num2alpha($n)
-{
- for ($r = ""; $n >= 0; $n = intval($n / 26) - 1)
- $r = chr($n % 26 + 0x41) . $r;
- return $r;
-}
-
-//英文轉數字(A=>0、B=>1、AA=>26...以此類推)
-function alpha2num($a)
-{
- $l = strlen($a);
- $n = 0;
- for ($i = 0; $i < $l; $i++)
- $n = $n * 26 + ord($a[$i]) - 0x40;
- return $n - 1;
-}
-if($_SERVER["REQUEST_METHOD"] == 'POST'){
- if ($_POST['excel_output'] == 'excel_output') {
- $spreadsheet = new Spreadsheet();
- $sheet = $spreadsheet->getActiveSheet();
- $sheet->setTitle('出貨總表');
-
- $title_col_num = 3;
- for ($i = $start_y; $i <= $end_y; $i++) {
- $this_start_m = $i == $start_y ? $start_m : 1;
- $this_end_m = $i == $start_y ? 12 : $end_m;
- for ($j = $this_start_m; $j <= $this_end_m; $j++) {
- $title_col_num += 2;
- if ($i == $end_y && $j == ($end_m + 1)) {
- break;
- }
- }
- }
- $sheet->mergeCells('A1:' . num2alpha($title_col_num) . '1');
- $sheet->setCellValue('A1', '出貨地區預定明細');
-
- $title_col_num = 0;
- $sheet->setCellValue(num2alpha($title_col_num) . '2', '');
- $title_col_num++;
- $sheet->setCellValue(num2alpha($title_col_num) . '2', '');
- $title_col_num++;
-
- for ($i = $start_y; $i <= $end_y; $i++) {
- $this_start_m = $i == $start_y ? $start_m : 1;
- $this_end_m = $i == $start_y ? 12 : $end_m;
- for ($j = $this_start_m; $j <= $this_end_m; $j++) {
- if ($i == $end_y && $j == ($end_m + 1))
- break;
- $sheet->mergeCells(num2alpha($title_col_num) . '2:' . num2alpha($title_col_num + 1) . '2');
- $sheet->setCellValue(num2alpha($title_col_num) . '2', $i . '年' . $j . '月');
- $title_col_num += 2;
- }
- }
-
- $sheet->setCellValue(num2alpha($title_col_num) . '2', '累計台數');
- $title_col_num++;
- $sheet->setCellValue(num2alpha($title_col_num) . '2', '累計台數');
- $title_col_num++;
-
- $title_col_num = 0;
- $sheet->setCellValue(num2alpha($title_col_num) . '3', '區域');
- $title_col_num = 2;
-
- for ($i = $start_y; $i <= $end_y; $i++) {
- $this_start_m = $i == $start_y ? $start_m : 1;
- $this_end_m = $i == $start_y ? 12 : $end_m;
- for ($j = $this_start_m; $j <= $this_end_m; $j++) {
- if ($i == $end_y && $j == ($end_m + 1)) {
- break;
- }
- $sheet->setCellValue(num2alpha($title_col_num) . '3', '新梯');
- $title_col_num++;
- $sheet->setCellValue(num2alpha($title_col_num) . '3', '汰改');
- $title_col_num++;
- }
- }
- $sheet->setCellValue(num2alpha($title_col_num) . '3', '新梯');
- $title_col_num++;
- $sheet->setCellValue(num2alpha($title_col_num) . '3', '汰改');
- $title_col_num++;
-
- $area_arr = [
- [4, 6, '台北'],
- [7, 9, '桃竹苗'],
- [10, 13, '中部'],
- [14, 17, '南部'],
- [18, 20, '宜花東'],
- [21, 21, '未分類']
- ];
- foreach ($area_arr as $row) {
- $title_col_num = 0;
- $sheet->mergeCells(num2alpha($title_col_num) . $row[0] . ':' . num2alpha($title_col_num) . $row[1]);
- $sheet->setCellValue(num2alpha($title_col_num) . $row[0], $row[2]);
- }
-
- $area_arr = [
- [4, '台北'],
- [5, '新北'],
- [6, '基隆'],
- [7, '桃園'],
- [8, '新竹'],
- [9, '苗栗'],
- [10, '台中'],
- [11, '南投'],
- [12, '彰化'],
- [13, '雲林'],
- [14, '嘉義'],
- [15, '台南'],
- [16, '高雄'],
- [17, '屏東'],
- [18, '宜蘭'],
- [19, '花蓮'],
- [20, '台東'],
- [21, '']
- ];
- foreach ($area_arr as $row) {
- $title_col_num = 0;
- $title_col_num++;
- $sheet->setCellValue(num2alpha($title_col_num) . $row[0], $row[1]);
- for ($i = $start_y; $i <= $end_y; $i++) {
- $this_start_m = $i == $start_y ? $start_m : 1;
- $this_end_m = $i == $start_y ? 12 : $end_m;
- for ($j = $this_start_m; $j <= $this_end_m; $j++) {
- if ($i == $end_y && $j == ($end_m + 1)) {
- break;
- }
- $tmp_arr = array(
- 'date_year' => $i,
- 'date_month' => str_pad($j, 2, '0', STR_PAD_LEFT),
- 'sub_address' => $row[1],
- 'contract_type' => 'A',
- );
- $title_col_num++;
- $sheet->setCellValue(num2alpha($title_col_num) . $row[0], findData($data, $tmp_arr));
- $tmp_arr['contract_type'] = 'B';
- $title_col_num++;
- $sheet->setCellValue(num2alpha($title_col_num) . $row[0], findData($data, $tmp_arr));
- }
- }
- $tmp_arr = array(
- 'start_y' => $start_y,
- 'end_y' => $end_y,
- 'start_m' => $start_m,
- 'end_m' => $end_m,
- 'sub_address' => $row[1],
- 'contract_type' => 'A',
- );
- $title_col_num++;
- $sheet->setCellValue(num2alpha($title_col_num) . $row[0], findDataByCity($data, $tmp_arr));
- $tmp_arr['contract_type'] = 'B';
- $title_col_num++;
- $sheet->setCellValue(num2alpha($title_col_num) . $row[0], findDataByCity($data, $tmp_arr));
- }
-
-
- $title_col_num = 0;
- $title_col_num++;
- $sheet->setCellValue(num2alpha($title_col_num) . '22', "合計");
- for ($i = $start_y; $i <= $end_y; $i++) {
- $this_start_m = $i == $start_y ? $start_m : 1;
- $this_end_m = $i == $start_y ? 12 : $end_m;
- for ($j = $this_start_m; $j <= $this_end_m; $j++) {
- if ($i == $end_y && $j == ($end_m + 1))
- break;
- $tmp_arr = array(
- 'date_year' => $i,
- 'date_month' => str_pad($j, 2, '0', STR_PAD_LEFT),
- 'contract_type' => 'A',
- );
- $title_col_num++;
- $sheet->setCellValue(num2alpha($title_col_num) . '22', findDataByYearMonth($data, $tmp_arr));
- $tmp_arr['contract_type'] = 'B';
- $title_col_num++;
- $sheet->setCellValue(num2alpha($title_col_num) . '22', findDataByYearMonth($data, $tmp_arr));
- }
- }
- $tmp_arr = array(
- 'start_y' => $start_y,
- 'end_y' => $end_y,
- 'start_m' => $start_m,
- 'end_m' => $end_m,
- 'contract_type' => 'A',
- );
- $title_col_num++;
- $sheet->setCellValue(num2alpha($title_col_num) . '22', findAllDataByYearMonth($data, $tmp_arr));
- $tmp_arr['contract_type'] = 'B';
- $title_col_num++;
- $sheet->setCellValue(num2alpha($title_col_num) . '22', findAllDataByYearMonth($data, $tmp_arr));
-
-
-
-
- $sheet->mergeCells('A25:I25');
- $sheet->setCellValue('A25', '受定規格分析');
-
- $title_col_num = 0;
- $sheet->setCellValue(num2alpha($title_col_num) . '26', "代碼");
- foreach ($data2 as $row) {
- $title_col_num++;
- $sheet->setCellValue(num2alpha($title_col_num) . '26', $row['facility_kind']);
- }
-
- $title_col_num = 0;
- $sheet->setCellValue(num2alpha($title_col_num) . '27', "機種");
- foreach ($data2 as $row) {
- $title_col_num++;
- $sheet->setCellValue(num2alpha($title_col_num) . '27', getFacilityNamebyType($row['facility_kind']));
- }
- $title_col_num++;
- $sheet->setCellValue(num2alpha($title_col_num) . '27', "合計");
-
- $title_col_num = 0;
- $sheet->setCellValue(num2alpha($title_col_num) . '28', "數量");
- foreach ($data2 as $row) {
- $title_col_num++;
- $sheet->setCellValue(num2alpha($title_col_num) . '28', $row['facility_count']);
- }
- $title_col_num++;
- $sheet->setCellValue(num2alpha($title_col_num) . '28', findFacilityTypeAllCount($data2));
-
- $title_col_num = 0;
- $sheet->setCellValue(num2alpha($title_col_num) . '29', "百分比");
- foreach ($data2 as $row) {
- $title_col_num++;
- $sheet->setCellValue(num2alpha($title_col_num) . '29', (round($row['facility_count'] / findFacilityTypeAllCount($data2), 4) * 100) . "%");
- }
- $title_col_num++;
- $sheet->setCellValue(num2alpha($title_col_num) . '29', "100%");
-
-
- $sheet->mergeCells('A32:G32');
- $sheet->setCellValue('G25', '舊改受訂規格分析');
-
- $title_col_num = 0;
- $sheet->setCellValue(num2alpha($title_col_num++) . '33', "類型");
- foreach ($m_type_arr as $key => $val) {
- $title_tmp = empty($key) ? '未分類' : $key;
- $sheet->setCellValue(num2alpha($title_col_num++) . '33', $title_tmp);
- }
- $sheet->setCellValue(num2alpha($title_col_num++) . '33', "合計");
-
- $title_col_num = 0;
- $sheet->setCellValue(num2alpha($title_col_num++) . '34', "數量");
- foreach ($m_type_arr as $key => $val) {
- $sheet->setCellValue(num2alpha($title_col_num++) . '34', $val);
- }
- $sheet->setCellValue(num2alpha($title_col_num++) . '34', $M_count);
-
- $title_col_num = 0;
- $sheet->setCellValue(num2alpha($title_col_num++) . '35', "百分比");
- foreach ($m_type_arr as $key => $val) {
- $sheet->setCellValue(num2alpha($title_col_num++) . '35', (round($val / $M_count, 4) * 100) . "%");
- }
- $sheet->setCellValue(num2alpha($title_col_num++) . '35', "100%");
-
-
- $writer = new Xlsx($spreadsheet);
- $file_path = dirname(__DIR__) . '/wms/excel/' . 'estimated_shipping_date_report.xlsx';
- try {
- $writer->save($file_path);
- // 回傳檔案路徑給 JavaScript
- echo $file_path;
- } catch (Exception $e) {
- echo 'Error: ' . $e->getMessage();
- }
- exit();
- }
-}
-
-?>
-
-
出貨地區預定明細
-
-
-
-
-
-
-
-
-
-
-
-
- 受定規格分析
-
-
-
-
- 代碼
- " . $row['facility_kind'] . "";
- }
- ?>
-
-
-
- 機種
- " . getFacilityNamebyType($row['facility_kind']) . "";
- }
- ?>
- 合計
-
-
- 數量
- " . $row['facility_count'] . "";
- }
- ?>
-
-
-
- 百分比
- " . (round($row['facility_count'] / findFacilityTypeAllCount($data2), 4) * 100) . "%" . "";
- }
- ?>
-
-
-
-
-
-
-
-
-
-
-
-
- 舊改受訂規格分析
-
-
-
-
- 類型
- $val) {
- $title_tmp = empty($key) ? '未分類' : $key;
- echo "" . $title_tmp . " ";
- }
- ?>
- 合計
-
-
- 數量
- $val) {
- echo "" . $val . " ";
- }
- ?>
-
-
-
- 百分比
- $val) {
- echo "" . round($val / $M_count, 4) * 100 . "%" . " ";
- }
- ?>
- 100%
-
-
-
-
-
\ No newline at end of file
diff --git a/wms/excel-upload.php b/wms/excel-upload.php
index 1a9d842d..bb2c5fe1 100644
--- a/wms/excel-upload.php
+++ b/wms/excel-upload.php
@@ -1,244 +1,244 @@
-
-load($target_file); //读取上传到服务器的文件
- $sheet = $objPHPExcel->getSheet(0);//拿到第一个sheet数据
- $highestRow = $sheet->getHighestRow(); // 取得总行数
- $highestColumn = $sheet->getHighestColumn(); // 取得总列数
- $highestColumn = PHPExcel_Cell::columnIndexFromString($highestColumn); // 转换字母为对应的统计数字;
- $excelArray = array();
- for ($row = 2; $row <= $highestRow; $row++) {
- $val = $sheet->getCellByColumnAndRow(0, $row)->getCalculatedValue();
- if ($val == "") return;
- for ($column = 1; $column < $highestColumn; $column++) {
- $val = $sheet->getCellByColumnAndRow($column, $row)->getCalculatedValue();
- $excelArray[$row][] = $val; //读取excel数据到数组
- }
- /*
- (
- [2] => Array
- (
- [0] => M230875
- [1] => 3TX23001
- [2] => 桃園市中壢區榮民南路81巷8號
- [3] => 121.25820796563
- [4] => 24.955059621474
- [5] => 梁智芳
- [6] =>
- [7] => 921389826
- [8] => M0089
- [9] => 郭玠德
- [10] => 0905-378-991
- [11] => 2023/07/14
- [12] => BW002
- [13] =>
- [14] => 45108
- [15] => 45473
- [16] =>
- )
- )*/
- //print_r($excelArray);exit;
- echo "第".$row;
-
- // excel欄位名稱
- list($contractno, $facilityno, $address, $longitude, $latitude, $name, $customerid, $tel, $repairerid, $repairer_name, $repairer_tel, $duedate, $combono, $receivable_date, $c_start_date, $c_end_date) = $excelArray[$row];
- $customerid = (!$customerid) ? $contractno : $customerid;
- $repairer_tel = str_pad(str_replace("-", "", $repairer_tel), 10, "0", STR_PAD_LEFT); // 保養員手机号
- $combono = substr($combono,-5);//套餐编码
- $area = mb_substr($address, 0, 3);
- if (is_numeric($duedate)) $duedate = date("Y-m-d", ($duedate-25569)*24*60*60); // 預保養日
- if (is_numeric($c_start_date)) $c_start_date = date("Y-m-d", ($c_start_date-25569)*24*60*60); // 合約起始日
- if (is_numeric($c_end_date)) $c_end_date = date("Y-m-d", ($c_end_date-25569)*24*60*60); // 合約終止日
-
- // 创建客户信息
- $accountid= $contractno; //账户id
- //判断账户是否存在
- $sql = "select * from account where accountid = '$accountid'";
- $data = mysqli_query($link,$sql);
- $nums_rows = mysqli_num_rows($data);
- if($nums_rows==0){
- //添加用户
- $accounttype = "A"; //账户类型
- $pwd = "123";//账户默认密码
-
- //查询保养员电话
- $sqlfre = "SELECT name, tel FROM account where accountid = '$repairerid' and accounttype = 'B'";
- $repairerdata = mysqli_query($link, $sqlfre); # 用mysqli_query方法执行(sql语法)将结果存在变数中
- if ($rowdata = mysqli_fetch_assoc($repairerdata)) {
- $db_repair_name = $rowdata['name'];
- $db_repair_tel = $rowdata['tel'];
- }
- mysqli_free_result($repairerdata);
-
- if ($db_repair_name == $repairer_name && (str_pad(str_replace("-", "", $db_repair_tel), 10, "0", STR_PAD_LEFT)) == $repairer_tel) {
- $create_at = date('Y/m/d H:i:s');//账户创建时间
- $db_query1 = "insert into account(accounttype, accountid, pwd, name, tel, address,phone_call_help, repairerid, creater, create_at) values (";
- $db_query1 .= "'$accounttype', '$accountid', '$pwd', '$name', '$tel', '$address', '$repairer_tel', '$repairerid','$user_id', '$create_at')";
- mysqli_query($link,$db_query1);
- if (mysqli_affected_rows($link) > 0) {
- echo "客户账户新增成功\r\n";
- $repair_right = 1;
- }
- elseif(mysqli_affected_rows($link)==0) {
- echo "无新增资料";
- }
- } else {
- echo "保養員姓名或電話有誤";
- }
- } else {
- echo "账户已经存在";
- $repair_right = 1;
- }
-
- if ($repair_right) {
- //创建合约信息
- //判断合约是否存在
- $contractsql = "select * from contract where contractno = '$contractno'";
- $contract_nums_rows=mysqli_num_rows(mysqli_query($link,$contractsql));
- if($contract_nums_rows==0){
- $contracttype= "A";
- $company= $name;//公司名称默认客户姓名
- $taxid= " ";//统一编码
- $promiser= $name;//契约人,个人客户默认客户姓名
- $contractperson= $name;//联系人
- $contractaddress= $address;//联系地址
- $contracttel= $tel;//联络电话
- $contractemail= "";
- $contract_employee= "";//契约员工号
- $create_at = date('Y/m/d H:i:s');//合同创建时间
- $db_query2 = "INSERT INTO contract(contracttype, contractno, company, taxid, address, tel, promiser, customerid, contractperson, contractaddress, contracttel, contractemail,contract_employee,start_date,end_date, creater, create_at) VALUES ('$contracttype', '$contractno', '$company', '$taxid', '$address', '$tel', '$promiser', '$customerid', '$contractperson', '$contractaddress', '$contracttel', '$contractemail','$contract_employee','$c_start_date','$c_end_date', '$user_id', '$create_at')";
- mysqli_query($link,$db_query2);
- if (mysqli_affected_rows($link)>0) {
- echo "合约新增成功\r\n";
- }
- elseif(mysqli_affected_rows($link)==0) {
- echo "无新增资料";
- }
- }else{
- echo "合约已经存在";
- }
-
- //创建作番信息
- switch ($facilityno) {
- case (preg_match('/TX/', $facilityno) ? true : false):
- case (preg_match('/JX/', $facilityno) ? true : false):
- $facility_kind = "MAE100";
- break;
- case (preg_match('/TW/', $facilityno) ? true : false):
- $facility_kind = "MAM200";
- break;
- case (preg_match('/TH/', $facilityno) ? true : false):
- $facility_kind = "MAH100";
- break;
- case (preg_match('/TZ/', $facilityno) ? true : false):
- $facility_kind = "MAZ100";
- break;
- case (preg_match('/TH/', $facilityno) ? true : false):
- $facility_kind = "MAQ100";
- break;
- default:
- $facility_kind = "";
- }
- $facilitsql = "SELECT * FROM facility where facilityno='$facilityno' and contractno='$contractno'";
- $facilit_nums_rows=mysqli_num_rows(mysqli_query($link,$facilitsql));
- if($facilit_nums_rows==0){
- $weight= "450";//重量
- $numberofpassenger = "6"; // 人乘
- $numberofstop= "2";//停数
- $numberoffloor= "2";//楼层数
- $opentype= "CO-SO";//开门方式
- $speed= "60";//速度
- $repairtype= "A";//维护类型
- $create_at = date('Y/m/d H:i:s');//作番创建时间
-
- $db_query3 = "INSERT INTO facility(contractno, facilityno, customerid, weight,numberofpassenger,numberofstop, numberoffloor,opentype,speed,repairtype,facility_kind,longitude, latitude, address,repairerid,repairername,area,creater, create_at) VALUES ('$contractno', '$facilityno', '$customerid', '$weight','$numberofpassenger','$numberofstop', '$numberoffloor','$opentype','$speed','$repairtype','$facility_kind','$longitude', '$latitude', '$address','$repairerid','$repairer_name','$area','$user_id', '$create_at')";
- mysqli_query($link,$db_query3);
- if (mysqli_affected_rows($link)>0) {
- echo "作番新增成功\n";
- }
- elseif(mysqli_affected_rows($link)==0) {
- echo "无新增资料";
- }
- }else{
- echo "作番已经存在";
- }
- //创建保养计划
- echo "保养日期";
- $schedulesql = "SELECT * FROM schedule where facilityno='$facilityno' and duedate='$duedate'";
- $schedule_nums_rows=mysqli_num_rows(mysqli_query($link,$schedulesql));
- if($schedule_nums_rows==0){
- $create_at = date('Y/m/d H:i:s');//作番创建时间
- $db_query4 = "INSERT INTO schedule(contractno, facilityno, combono, repairerid, repairername, duedate, creater, create_at) VALUES ('$contractno', '$facilityno', '$combono', '$repairerid', '$repairer_name', '$duedate', '$user_id', '$create_at')";
- $resiult=mysqli_query($link,$db_query4);
-
- if (mysqli_affected_rows($link)>0) {
- echo $combono."作番保养计划新增成功\r\n";
- }
- elseif(mysqli_affected_rows($link)==0) {
- echo "无新增资料";
- }
- }else{
- echo "作番保养计划已经存在";
- }
- }
- }
- mysqli_close($link);
-}
-
-//for ($i = 0; $i <= sizeof($excelArray); $i++) {
-// //处理数据
-//// 创建客户信息
-// echo "循环读取数据插入数据库---".$row."---";
-// echo$accounttype= "A"; //账户类型
-// echo$accountid= $excelArray[$row][6]; //账户id
-// echo$pwd= "123";//账户默认密码
-// echo$name= $excelArray[$row][5];//账户姓名
-// echo$address= $excelArray[$row][2];//账户地址
-// echo$phone_call_help=$excelArray[$row][7];//联络手机号
-// echo$repairerid=$excelArray[$row][8];//服务与支持人员工号
-// echo$creater = 'vensen';//建档人
-// echo$create_at = date('Y/m/d H:i:s');//账户创建时间
-////判断账户是否存在
-// $sqlselect='select * from account where accountid='.$accountid;
-// $res = mysqli_query($link,$sqlselect);
-// echo "------结果".'
';
-// print_r($res);
-//
-// echo "------".'
';
-//}
-//
-// var_dump($excelArray);
-
-?>
-
-
-
-
+
+load($target_file); //读取上传到服务器的文件
+ $sheet = $objPHPExcel->getSheet(0);//拿到第一个sheet数据
+ $highestRow = $sheet->getHighestRow(); // 取得总行数
+ $highestColumn = $sheet->getHighestColumn(); // 取得总列数
+ $highestColumn = PHPExcel_Cell::columnIndexFromString($highestColumn); // 转换字母为对应的统计数字;
+ $excelArray = array();
+ for ($row = 2; $row <= $highestRow; $row++) {
+ $val = $sheet->getCellByColumnAndRow(0, $row)->getCalculatedValue();
+ if ($val == "") return;
+ for ($column = 1; $column < $highestColumn; $column++) {
+ $val = $sheet->getCellByColumnAndRow($column, $row)->getCalculatedValue();
+ $excelArray[$row][] = $val; //读取excel数据到数组
+ }
+ /*
+ (
+ [2] => Array
+ (
+ [0] => M230875
+ [1] => 3TX23001
+ [2] => 桃園市中壢區榮民南路81巷8號
+ [3] => 121.25820796563
+ [4] => 24.955059621474
+ [5] => 梁智芳
+ [6] =>
+ [7] => 921389826
+ [8] => M0089
+ [9] => 郭玠德
+ [10] => 0905-378-991
+ [11] => 2023/07/14
+ [12] => BW002
+ [13] =>
+ [14] => 45108
+ [15] => 45473
+ [16] =>
+ )
+ )*/
+ //print_r($excelArray);exit;
+ echo "第".$row;
+
+ // excel欄位名稱
+ list($contractno, $facilityno, $address, $longitude, $latitude, $name, $customerid, $tel, $repairerid, $repairer_name, $repairer_tel, $duedate, $combono, $receivable_date, $c_start_date, $c_end_date) = $excelArray[$row];
+ $customerid = (!$customerid) ? $contractno : $customerid;
+ $repairer_tel = str_pad(str_replace("-", "", $repairer_tel), 10, "0", STR_PAD_LEFT); // 保養員手机号
+ $combono = substr($combono,-5);//套餐编码
+ $area = mb_substr($address, 0, 3);
+ if (is_numeric($duedate)) $duedate = date("Y-m-d", ($duedate-25569)*24*60*60); // 預保養日
+ if (is_numeric($c_start_date)) $c_start_date = date("Y-m-d", ($c_start_date-25569)*24*60*60); // 合約起始日
+ if (is_numeric($c_end_date)) $c_end_date = date("Y-m-d", ($c_end_date-25569)*24*60*60); // 合約終止日
+
+ // 创建客户信息
+ $accountid= $contractno; //账户id
+ //判断账户是否存在
+ $sql = "select * from account where accountid = '$accountid'";
+ $data = mysqli_query($link,$sql);
+ $nums_rows = mysqli_num_rows($data);
+ if($nums_rows==0){
+ //添加用户
+ $accounttype = "A"; //账户类型
+ $pwd = "123";//账户默认密码
+
+ //查询保养员电话
+ $sqlfre = "SELECT name, tel FROM account where accountid = '$repairerid' and accounttype = 'B'";
+ $repairerdata = mysqli_query($link, $sqlfre); # 用mysqli_query方法执行(sql语法)将结果存在变数中
+ if ($rowdata = mysqli_fetch_assoc($repairerdata)) {
+ $db_repair_name = $rowdata['name'];
+ $db_repair_tel = $rowdata['tel'];
+ }
+ mysqli_free_result($repairerdata);
+
+ if ($db_repair_name == $repairer_name && (str_pad(str_replace("-", "", $db_repair_tel), 10, "0", STR_PAD_LEFT)) == $repairer_tel) {
+ $create_at = date('Y/m/d H:i:s');//账户创建时间
+ $db_query1 = "insert into account(accounttype, accountid, pwd, name, tel, address,phone_call_help, repairerid, creater, create_at) values (";
+ $db_query1 .= "'$accounttype', '$accountid', '$pwd', '$name', '$tel', '$address', '$repairer_tel', '$repairerid','$user_id', '$create_at')";
+ mysqli_query($link,$db_query1);
+ if (mysqli_affected_rows($link) > 0) {
+ echo "客户账户新增成功\r\n";
+ $repair_right = 1;
+ }
+ elseif(mysqli_affected_rows($link)==0) {
+ echo "无新增资料";
+ }
+ } else {
+ echo "保養員姓名或電話有誤";
+ }
+ } else {
+ echo "账户已经存在";
+ $repair_right = 1;
+ }
+
+ if ($repair_right) {
+ //创建合约信息
+ //判断合约是否存在
+ $contractsql = "select * from contract where contractno = '$contractno'";
+ $contract_nums_rows=mysqli_num_rows(mysqli_query($link,$contractsql));
+ if($contract_nums_rows==0){
+ $contracttype= "A";
+ $company= $name;//公司名称默认客户姓名
+ $taxid= " ";//统一编码
+ $promiser= $name;//契约人,个人客户默认客户姓名
+ $contractperson= $name;//联系人
+ $contractaddress= $address;//联系地址
+ $contracttel= $tel;//联络电话
+ $contractemail= "";
+ $contract_employee= "";//契约员工号
+ $create_at = date('Y/m/d H:i:s');//合同创建时间
+ $db_query2 = "INSERT INTO contract(contracttype, contractno, company, taxid, address, tel, promiser, customerid, contractperson, contractaddress, contracttel, contractemail,contract_employee,start_date,end_date, creater, create_at) VALUES ('$contracttype', '$contractno', '$company', '$taxid', '$address', '$tel', '$promiser', '$customerid', '$contractperson', '$contractaddress', '$contracttel', '$contractemail','$contract_employee','$c_start_date','$c_end_date', '$user_id', '$create_at')";
+ mysqli_query($link,$db_query2);
+ if (mysqli_affected_rows($link)>0) {
+ echo "合约新增成功\r\n";
+ }
+ elseif(mysqli_affected_rows($link)==0) {
+ echo "无新增资料";
+ }
+ }else{
+ echo "合约已经存在";
+ }
+
+ //创建作番信息
+ switch ($facilityno) {
+ case (preg_match('/TX/', $facilityno) ? true : false):
+ case (preg_match('/JX/', $facilityno) ? true : false):
+ $facility_kind = "MAE100";
+ break;
+ case (preg_match('/TW/', $facilityno) ? true : false):
+ $facility_kind = "MAM200";
+ break;
+ case (preg_match('/TH/', $facilityno) ? true : false):
+ $facility_kind = "MAH100";
+ break;
+ case (preg_match('/TZ/', $facilityno) ? true : false):
+ $facility_kind = "MAZ100";
+ break;
+ case (preg_match('/TH/', $facilityno) ? true : false):
+ $facility_kind = "MAQ100";
+ break;
+ default:
+ $facility_kind = "";
+ }
+ $facilitsql = "SELECT * FROM facility where facilityno='$facilityno' and contractno='$contractno'";
+ $facilit_nums_rows=mysqli_num_rows(mysqli_query($link,$facilitsql));
+ if($facilit_nums_rows==0){
+ $weight= "450";//重量
+ $numberofpassenger = "6"; // 人乘
+ $numberofstop= "2";//停数
+ $numberoffloor= "2";//楼层数
+ $opentype= "CO-SO";//开门方式
+ $speed= "60";//速度
+ $repairtype= "A";//维护类型
+ $create_at = date('Y/m/d H:i:s');//作番创建时间
+
+ $db_query3 = "INSERT INTO facility(contractno, facilityno, customerid, weight,numberofpassenger,numberofstop, numberoffloor,opentype,speed,repairtype,facility_kind,longitude, latitude, address,repairerid,repairername,area,creater, create_at) VALUES ('$contractno', '$facilityno', '$customerid', '$weight','$numberofpassenger','$numberofstop', '$numberoffloor','$opentype','$speed','$repairtype','$facility_kind','$longitude', '$latitude', '$address','$repairerid','$repairer_name','$area','$user_id', '$create_at')";
+ mysqli_query($link,$db_query3);
+ if (mysqli_affected_rows($link)>0) {
+ echo "作番新增成功\n";
+ }
+ elseif(mysqli_affected_rows($link)==0) {
+ echo "无新增资料";
+ }
+ }else{
+ echo "作番已经存在";
+ }
+ //创建保养计划
+ echo "保养日期";
+ $schedulesql = "SELECT * FROM schedule where facilityno='$facilityno' and duedate='$duedate'";
+ $schedule_nums_rows=mysqli_num_rows(mysqli_query($link,$schedulesql));
+ if($schedule_nums_rows==0){
+ $create_at = date('Y/m/d H:i:s');//作番创建时间
+ $db_query4 = "INSERT INTO schedule(contractno, facilityno, combono, repairerid, repairername, duedate, creater, create_at) VALUES ('$contractno', '$facilityno', '$combono', '$repairerid', '$repairer_name', '$duedate', '$user_id', '$create_at')";
+ $resiult=mysqli_query($link,$db_query4);
+
+ if (mysqli_affected_rows($link)>0) {
+ echo $combono."作番保养计划新增成功\r\n";
+ }
+ elseif(mysqli_affected_rows($link)==0) {
+ echo "无新增资料";
+ }
+ }else{
+ echo "作番保养计划已经存在";
+ }
+ }
+ }
+ mysqli_close($link);
+}
+
+//for ($i = 0; $i <= sizeof($excelArray); $i++) {
+// //处理数据
+//// 创建客户信息
+// echo "循环读取数据插入数据库---".$row."---";
+// echo$accounttype= "A"; //账户类型
+// echo$accountid= $excelArray[$row][6]; //账户id
+// echo$pwd= "123";//账户默认密码
+// echo$name= $excelArray[$row][5];//账户姓名
+// echo$address= $excelArray[$row][2];//账户地址
+// echo$phone_call_help=$excelArray[$row][7];//联络手机号
+// echo$repairerid=$excelArray[$row][8];//服务与支持人员工号
+// echo$creater = 'vensen';//建档人
+// echo$create_at = date('Y/m/d H:i:s');//账户创建时间
+////判断账户是否存在
+// $sqlselect='select * from account where accountid='.$accountid;
+// $res = mysqli_query($link,$sqlselect);
+// echo "------结果".'
';
+// print_r($res);
+//
+// echo "------".'
';
+//}
+//
+// var_dump($excelArray);
+
+?>
+
+
+
+
diff --git a/wms/expert-create.php b/wms/expert-create.php
index 3c24d689..2b8379d6 100644
--- a/wms/expert-create.php
+++ b/wms/expert-create.php
@@ -1,131 +1,131 @@
-
-
-
-
- Please fill up the required field!";
- } else {
- echo "
Record has added successfully
";
- }
- }
- */
- ?>
-
-
-
-
-
-
-
+
+
+
+
+ Please fill up the required field!";
+ } else {
+ echo "
Record has added successfully
";
+ }
+ }
+ */
+ ?>
+
+
+
+
+
+
+
diff --git a/wms/expert-delete.php b/wms/expert-delete.php
index 6bc526e6..697bc1ce 100644
--- a/wms/expert-delete.php
+++ b/wms/expert-delete.php
@@ -1,12 +1,12 @@
-
\ No newline at end of file
diff --git a/wms/expert-edit.php b/wms/expert-edit.php
index 9400e6f2..3d81d910 100644
--- a/wms/expert-edit.php
+++ b/wms/expert-edit.php
@@ -1,126 +1,126 @@
-getMessage(), "\n";
- }
-*/
- foreach($data as $data) :
-?>
-
-
-
-
+getMessage(), "\n";
+ }
+*/
+ foreach($data as $data) :
+?>
+
+
+
+
diff --git a/wms/expert-index.php b/wms/expert-index.php
index 367a15b4..34925839 100644
--- a/wms/expert-index.php
+++ b/wms/expert-index.php
@@ -1,154 +1,154 @@
-
-
-
-
-
-
-
-
-
-
-Please fill up the required field!";
- } else {
- header("Location:expert-index.php");
- }
- }
-
-?>
-
-
-
-
-
- 項次
- 專家ID
- 身分證字號
- 顯示姓名
- 稱謂
- 頭像
- 專長
- 電話
- 電話支援次數
- Chat帳號
- Chat支援次數
- Video帳號
- 遠程視頻次數
- 現場支援客服窗口
- 現場支援次數
- 建檔人
- 建檔時間
-
- 修改
- 刪除
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 連結
-
- 連結
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-There is no record!";
-endif;
-
-#代表結束連線
-mysqli_close($link);
-
-include "footer.php";
-
-?>
+
+
+
+
+
+
+
+
+
+
+Please fill up the required field!";
+ } else {
+ header("Location:expert-index.php");
+ }
+ }
+
+?>
+
+
+
+
+
+ 項次
+ 專家ID
+ 身分證字號
+ 顯示姓名
+ 稱謂
+ 頭像
+ 專長
+ 電話
+ 電話支援次數
+ Chat帳號
+ Chat支援次數
+ Video帳號
+ 遠程視頻次數
+ 現場支援客服窗口
+ 現場支援次數
+ 建檔人
+ 建檔時間
+
+ 修改
+ 刪除
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 連結
+
+ 連結
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+There is no record!";
+endif;
+
+#代表結束連線
+mysqli_close($link);
+
+include "footer.php";
+
+?>
diff --git a/wms/expert-record-submit.php b/wms/expert-record-submit.php
index 11fb7ba7..7c58ad4e 100644
--- a/wms/expert-record-submit.php
+++ b/wms/expert-record-submit.php
@@ -1,136 +1,136 @@
-File is not an image";
- $upload_ok = 0;
- } else {
- //echo "File is an image - " . $check_img["mime"];
- $upload_ok = 1;
-
- //Check if file already exists
- if(file_exists($target_file)) {
- echo "
File is already uploaded! ";
- $upload_ok = 0;
- } else {
- //Check file size
- if($file_size > 500000) {
- echo "
Please enter a file size between 5mb ";
- $upload_ok = 0;
- } else {
- //Allow certain file formats
- if($img_file_type != "jpg" && $img_file_type != "png" && $img_file_type != "jpeg" && $img_file_type != "gif") {
- echo "
JPG, PNG, JPEG and GIF files are allowed ";
- $upload_ok = 0;
- } else {
- //Check if $upload_ok is set to 0 by an error
- if($upload_ok === 0) {
- echo "
File has not been uploaded ";
- } else {
- if(move_uploaded_file($temp_file_name, $target_file)){
-
-
- // sql語法存在變數中
- // $db_query = "INSERT INTO expert (id, expert_id, personal_id, name, title, picture, major, tel, tel_count, chat_id, chat_count, video_call, video_count, onsite_call, onsite_count, creater, create_at) VALUE (`$id`, `$expert_id`, `$personal_id`, `$name`, `$title`, `$target_file`, `$major`, `$tel`, `$tel_count`, `$chat_id`, `$chat_count`, `$video_call`, `$video_count`, `$onsite_call`, `$onsite_count`, `$creater`, `$create_at`)";
- $db_query = "INSERT INTO expert(expert_id, personal_id, name, title, picture, major, tel, tel_count, chat_id, chat_count, video_call, video_count, onsite_call, onsite_count, creater) VALUES ('$expert_id', '$personal_id', '$name', '$title', '$target_file', '$major', '$tel', '$tel_count', '$chat_id', '$chat_count', '$video_call', '$video_count', '$onsite_call', '$onsite_count', '$creater')";
-
- // 用mysqli_query方法執行(sql語法)將結果存在變數中
- $result = mysqli_query($link,$db_query);
-
- }
- }
- }
- }
- }
- }
- }
-
- $affected = mysqli_affected_rows($link);
- mysqli_close($link);
-
- if ($affected > 0) {
- echo "";
- } elseif ($affected == 0) {
- echo "";
- } else {
- echo "{$db_query} 語法執行失敗,錯誤訊息SSS: " . mysqli_error($link);
- }
-}
-?>
+File is not an image";
+ $upload_ok = 0;
+ } else {
+ //echo "File is an image - " . $check_img["mime"];
+ $upload_ok = 1;
+
+ //Check if file already exists
+ if(file_exists($target_file)) {
+ echo "
File is already uploaded! ";
+ $upload_ok = 0;
+ } else {
+ //Check file size
+ if($file_size > 500000) {
+ echo "
Please enter a file size between 5mb ";
+ $upload_ok = 0;
+ } else {
+ //Allow certain file formats
+ if($img_file_type != "jpg" && $img_file_type != "png" && $img_file_type != "jpeg" && $img_file_type != "gif") {
+ echo "
JPG, PNG, JPEG and GIF files are allowed ";
+ $upload_ok = 0;
+ } else {
+ //Check if $upload_ok is set to 0 by an error
+ if($upload_ok === 0) {
+ echo "
File has not been uploaded ";
+ } else {
+ if(move_uploaded_file($temp_file_name, $target_file)){
+
+
+ // sql語法存在變數中
+ // $db_query = "INSERT INTO expert (id, expert_id, personal_id, name, title, picture, major, tel, tel_count, chat_id, chat_count, video_call, video_count, onsite_call, onsite_count, creater, create_at) VALUE (`$id`, `$expert_id`, `$personal_id`, `$name`, `$title`, `$target_file`, `$major`, `$tel`, `$tel_count`, `$chat_id`, `$chat_count`, `$video_call`, `$video_count`, `$onsite_call`, `$onsite_count`, `$creater`, `$create_at`)";
+ $db_query = "INSERT INTO expert(expert_id, personal_id, name, title, picture, major, tel, tel_count, chat_id, chat_count, video_call, video_count, onsite_call, onsite_count, creater) VALUES ('$expert_id', '$personal_id', '$name', '$title', '$target_file', '$major', '$tel', '$tel_count', '$chat_id', '$chat_count', '$video_call', '$video_count', '$onsite_call', '$onsite_count', '$creater')";
+
+ // 用mysqli_query方法執行(sql語法)將結果存在變數中
+ $result = mysqli_query($link,$db_query);
+
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ $affected = mysqli_affected_rows($link);
+ mysqli_close($link);
+
+ if ($affected > 0) {
+ echo "";
+ } elseif ($affected == 0) {
+ echo "";
+ } else {
+ echo "{$db_query} 語法執行失敗,錯誤訊息SSS: " . mysqli_error($link);
+ }
+}
+?>
diff --git a/wms/expert-record-update.php b/wms/expert-record-update.php
index 43c98238..ab4eb021 100644
--- a/wms/expert-record-update.php
+++ b/wms/expert-record-update.php
@@ -1,85 +1,85 @@
- 500000) {
- echo "
Please enter a file size between 5mb ";
- $upload_ok = 0;
- } else { //
- //Allow certain file formats
- if($img_file_type != "jpg" && $img_file_type != "png" && $img_file_type != "jpeg" && $img_file_type != "gif") {
- //echo "JPG, PNG, JPEG and GIF files are allowed";
- $upload_ok = 0;
- } else {
- //Check if $upload_ok is set to 0 by an error
- if($upload_ok === 0) {
- echo "
File has not been uploaded ";
- } else {
- if(move_uploaded_file($temp_file_name, $target_file)){
- $db_query = "UPDATE expert set expert_id = '$expert_id', personal_id = '$personal_id', name = '$name', title = '$title', picture = '$target_file', major = '$major', tel = '$tel', tel_count = '$tel_count', chat_id = '$chat_id', chat_count = '$chat_count', video_call = '$video_call', video_count = '$video_count', onsite_call = '$onsite_call', onsite_count = '$onsite_count', create_at = '$create_at' WHERE id='$id'";
- mysqli_query($link, $db_query);
- }
- }
- }
- }
-
- }
-
- $affected = mysqli_affected_rows($link);
- mysqli_close($link);
-
- if ($affected > 0) {
- echo "";
- } elseif ($affected == 0) {
- echo "";
- } else {
- echo "{$db_query} 語法執行失敗,錯誤訊息SSS: " . mysqli_error($link);
- }
-}
+ 500000) {
+ echo "
Please enter a file size between 5mb ";
+ $upload_ok = 0;
+ } else { //
+ //Allow certain file formats
+ if($img_file_type != "jpg" && $img_file_type != "png" && $img_file_type != "jpeg" && $img_file_type != "gif") {
+ //echo "JPG, PNG, JPEG and GIF files are allowed";
+ $upload_ok = 0;
+ } else {
+ //Check if $upload_ok is set to 0 by an error
+ if($upload_ok === 0) {
+ echo "
File has not been uploaded ";
+ } else {
+ if(move_uploaded_file($temp_file_name, $target_file)){
+ $db_query = "UPDATE expert set expert_id = '$expert_id', personal_id = '$personal_id', name = '$name', title = '$title', picture = '$target_file', major = '$major', tel = '$tel', tel_count = '$tel_count', chat_id = '$chat_id', chat_count = '$chat_count', video_call = '$video_call', video_count = '$video_count', onsite_call = '$onsite_call', onsite_count = '$onsite_count', create_at = '$create_at' WHERE id='$id'";
+ mysqli_query($link, $db_query);
+ }
+ }
+ }
+ }
+
+ }
+
+ $affected = mysqli_affected_rows($link);
+ mysqli_close($link);
+
+ if ($affected > 0) {
+ echo "";
+ } elseif ($affected == 0) {
+ echo "";
+ } else {
+ echo "{$db_query} 語法執行失敗,錯誤訊息SSS: " . mysqli_error($link);
+ }
+}
?>
\ No newline at end of file
diff --git a/wms/expert-user-input.php b/wms/expert-user-input.php
index aff20bd4..2a442c3b 100644
--- a/wms/expert-user-input.php
+++ b/wms/expert-user-input.php
@@ -1,59 +1,59 @@
-
+
diff --git a/wms/facility-create.php b/wms/facility-create.php
index 5e5a58fa..6551104c 100644
--- a/wms/facility-create.php
+++ b/wms/facility-create.php
@@ -1,126 +1,126 @@
-
-
-
-
- Please fill up the required field!";
- } else {
- echo "
Record has added successfully
";
- }
- }
- */
- ?>
-
-
-
-
-
-
-
+
+
+
+
+ Please fill up the required field!";
+ } else {
+ echo "
Record has added successfully
";
+ }
+ }
+ */
+ ?>
+
+
+
+
+
+
+
diff --git a/wms/facility-delete.php b/wms/facility-delete.php
index a41ba6a2..37a25785 100644
--- a/wms/facility-delete.php
+++ b/wms/facility-delete.php
@@ -1,12 +1,12 @@
-
\ No newline at end of file
diff --git a/wms/facility-edit.php b/wms/facility-edit.php
index a2c3f5b7..9abbcd8e 100644
--- a/wms/facility-edit.php
+++ b/wms/facility-edit.php
@@ -1,153 +1,153 @@
-getMessage(), "\n";
- }
-*/
- foreach($data as $data) :
-?>
-
-
-
-
-
+getMessage(), "\n";
+ }
+*/
+ foreach($data as $data) :
+?>
+
+
+
+
+
diff --git a/wms/facility-excel-upload.php b/wms/facility-excel-upload.php
index d43b5f0a..5c07d1db 100644
--- a/wms/facility-excel-upload.php
+++ b/wms/facility-excel-upload.php
@@ -1,115 +1,115 @@
- load($target_file); //读取上传到服务器的文件
- $sheet = $objPHPExcel->getSheet(0);//拿到第一个sheet数据
- $highestRow = $sheet->getHighestRow(); // 取得总行数
- $highestColumn = $sheet->getHighestColumn(); // 取得总列数
- $highestColumn = PHPExcel_Cell::columnIndexFromString($highestColumn); // 转换字母为对应的统计数字;
- $excelArray = array();
- for ($row = 2; $row <= $highestRow; $row++) {
- $val = $sheet->getCellByColumnAndRow(0, $row)->getCalculatedValue();
-
- if ($val == "") return;
- for ($column = 1; $column < $highestColumn; $column++) {
- $val = $sheet->getCellByColumnAndRow($column, $row)->getCalculatedValue();
- $excelArray[$row][] = $val; //读取excel数据到数组
- }
-
- $facilityno = $excelArray[$row][1]; //作番id
- $facilitsql = "SELECT * FROM facility where facilityno='$facilityno'";
- $facilit_nums_rows = mysqli_num_rows(mysqli_query($link, $facilitsql));
- if ($facilit_nums_rows == 0) {
- echo $row;
- $contractno = $excelArray[$row][0]?:'null'; //合约号
- $facilityno = $excelArray[$row][1]?:'null'; //作番号
- $address = $excelArray[$row][2]?:'null'; //作番安装地址
- $longitude = $excelArray[$row][3]?:'null';//纬度
- $latitude = $excelArray[$row][4]?:'null';//经度
- $customerid = $excelArray[$row][5]?:'null'; //客户/业主名称
- $customercode = $excelArray[$row][6]?:'null'; //业主ID或统一信用代码
- $customerlinknumber = $excelArray[$row][7]?:'null'; //业主联络电话或手机
- $repairerid = $excelArray[$row][8]?:'null'; //保养员工号
- $repairername = $excelArray[$row][9]?:'null'; //保养员姓名
- $repairerphonenumber = $excelArray[$row][10]?:'null'; //保养员手机号
- $baoyangdate= $excelArray[$row][11]?:'null'; //保养日期
- $maintainance= $excelArray[$row][12]?:'null'; //保养计划类别.保養別\r\nA=全包\r\nB=半包\r\nC=清包\r\nD=半包:2個月保養一次
- $yingshoukuandate= $excelArray[$row][13]?:'null'; //应收款日期
- $contractstartdate= $excelArray[$row][14]?:'null'; //合约起始年月日
- $contractenddate= $excelArray[$row][15]?:'null'; //合约终止年月日
- $facilitychuchangno= $excelArray[$row][16]?:'null'; //原作番出厂编号
- $contractpersonid= $excelArray[$row][17]?:'null'; //契约人员工号
- $contractpersonname= $excelArray[$row][18]?:'null'; //契约人员姓名
- $weight= $excelArray[$row][19]?:'null'; //载重/输送能力
- $numberoffloor= $excelArray[$row][20]?:'null'; //层站,停数/提升高度
- $speed= $excelArray[$row][21]?:'null'; //速度
- $brand= $excelArray[$row][22]?:'null'; //品牌,型号
- $officialregistrationcode= $excelArray[$row][13]?:'null'; //官方注册代码
- $manufacturedate= $excelArray[$row][24]?:'null'; //制造日期
- $creater = "batch";
- $create_at = date('Y/m/d H:i:s');
- //无效字段
- $numberofstop='0';
- $opentype='0';
- $repairtype='0';
- echo $db_query1 = "INSERT INTO facility(contractno, facilityno, customerid, weight,numberofstop, numberoffloor,opentype,speed,repairtype,longitude, latitude, address,repairerid,repairername,creater, create_at) VALUES ('$contractno', '$facilityno', '$customerid', '$weight','$numberofstop', '$numberoffloor','$opentype','$speed','$repairtype','$longitude', '$latitude', '$address','$repairerid','$repairername','$creater', '$create_at')";
-
- mysqli_query($link, $db_query1);
- if (mysqli_affected_rows($link) > 0) {
- echo "作番新增成功\n";
- //添加作番拓展字段
- $facilityid=mysqli_insert_id($link);
- $db_query2 = "INSERT INTO facility_extends(facilityid,facilitychuchangno,contractpersonid,contractpersonname,brand,officialregistrationcode,manufacturedate,creater, create_at) VALUES (";
- $db_query2.=" '$facilityid', '$facilitychuchangno','$contractpersonid','$contractpersonname','$brand','$officialregistrationcode','$manufacturedate','$creater', '$create_at')";
-
-
- mysqli_query($link, $db_query2);
- if (mysqli_affected_rows($link) > 0) {
- echo '扩展添加成功';
- }
-
- } elseif (mysqli_affected_rows($link) == 0) {
- echo "无新增资料";
- }
- } else {
- echo "作番已经存在";
- echo $facilityno;
- }
-
- //print_r($excelArray);
- }
- mysqli_close($link);
- }
-
- ?>
-
-
+ load($target_file); //读取上传到服务器的文件
+ $sheet = $objPHPExcel->getSheet(0);//拿到第一个sheet数据
+ $highestRow = $sheet->getHighestRow(); // 取得总行数
+ $highestColumn = $sheet->getHighestColumn(); // 取得总列数
+ $highestColumn = PHPExcel_Cell::columnIndexFromString($highestColumn); // 转换字母为对应的统计数字;
+ $excelArray = array();
+ for ($row = 2; $row <= $highestRow; $row++) {
+ $val = $sheet->getCellByColumnAndRow(0, $row)->getCalculatedValue();
+
+ if ($val == "") return;
+ for ($column = 1; $column < $highestColumn; $column++) {
+ $val = $sheet->getCellByColumnAndRow($column, $row)->getCalculatedValue();
+ $excelArray[$row][] = $val; //读取excel数据到数组
+ }
+
+ $facilityno = $excelArray[$row][1]; //作番id
+ $facilitsql = "SELECT * FROM facility where facilityno='$facilityno'";
+ $facilit_nums_rows = mysqli_num_rows(mysqli_query($link, $facilitsql));
+ if ($facilit_nums_rows == 0) {
+ echo $row;
+ $contractno = $excelArray[$row][0]?:'null'; //合约号
+ $facilityno = $excelArray[$row][1]?:'null'; //作番号
+ $address = $excelArray[$row][2]?:'null'; //作番安装地址
+ $longitude = $excelArray[$row][3]?:'null';//纬度
+ $latitude = $excelArray[$row][4]?:'null';//经度
+ $customerid = $excelArray[$row][5]?:'null'; //客户/业主名称
+ $customercode = $excelArray[$row][6]?:'null'; //业主ID或统一信用代码
+ $customerlinknumber = $excelArray[$row][7]?:'null'; //业主联络电话或手机
+ $repairerid = $excelArray[$row][8]?:'null'; //保养员工号
+ $repairername = $excelArray[$row][9]?:'null'; //保养员姓名
+ $repairerphonenumber = $excelArray[$row][10]?:'null'; //保养员手机号
+ $baoyangdate= $excelArray[$row][11]?:'null'; //保养日期
+ $maintainance= $excelArray[$row][12]?:'null'; //保养计划类别.保養別\r\nA=全包\r\nB=半包\r\nC=清包\r\nD=半包:2個月保養一次
+ $yingshoukuandate= $excelArray[$row][13]?:'null'; //应收款日期
+ $contractstartdate= $excelArray[$row][14]?:'null'; //合约起始年月日
+ $contractenddate= $excelArray[$row][15]?:'null'; //合约终止年月日
+ $facilitychuchangno= $excelArray[$row][16]?:'null'; //原作番出厂编号
+ $contractpersonid= $excelArray[$row][17]?:'null'; //契约人员工号
+ $contractpersonname= $excelArray[$row][18]?:'null'; //契约人员姓名
+ $weight= $excelArray[$row][19]?:'null'; //载重/输送能力
+ $numberoffloor= $excelArray[$row][20]?:'null'; //层站,停数/提升高度
+ $speed= $excelArray[$row][21]?:'null'; //速度
+ $brand= $excelArray[$row][22]?:'null'; //品牌,型号
+ $officialregistrationcode= $excelArray[$row][13]?:'null'; //官方注册代码
+ $manufacturedate= $excelArray[$row][24]?:'null'; //制造日期
+ $creater = "batch";
+ $create_at = date('Y/m/d H:i:s');
+ //无效字段
+ $numberofstop='0';
+ $opentype='0';
+ $repairtype='0';
+ echo $db_query1 = "INSERT INTO facility(contractno, facilityno, customerid, weight,numberofstop, numberoffloor,opentype,speed,repairtype,longitude, latitude, address,repairerid,repairername,creater, create_at) VALUES ('$contractno', '$facilityno', '$customerid', '$weight','$numberofstop', '$numberoffloor','$opentype','$speed','$repairtype','$longitude', '$latitude', '$address','$repairerid','$repairername','$creater', '$create_at')";
+
+ mysqli_query($link, $db_query1);
+ if (mysqli_affected_rows($link) > 0) {
+ echo "作番新增成功\n";
+ //添加作番拓展字段
+ $facilityid=mysqli_insert_id($link);
+ $db_query2 = "INSERT INTO facility_extends(facilityid,facilitychuchangno,contractpersonid,contractpersonname,brand,officialregistrationcode,manufacturedate,creater, create_at) VALUES (";
+ $db_query2.=" '$facilityid', '$facilitychuchangno','$contractpersonid','$contractpersonname','$brand','$officialregistrationcode','$manufacturedate','$creater', '$create_at')";
+
+
+ mysqli_query($link, $db_query2);
+ if (mysqli_affected_rows($link) > 0) {
+ echo '扩展添加成功';
+ }
+
+ } elseif (mysqli_affected_rows($link) == 0) {
+ echo "无新增资料";
+ }
+ } else {
+ echo "作番已经存在";
+ echo $facilityno;
+ }
+
+ //print_r($excelArray);
+ }
+ mysqli_close($link);
+ }
+
+ ?>
+
+
diff --git a/wms/facility-index.php b/wms/facility-index.php
index 0458a6e5..8815b5c8 100644
--- a/wms/facility-index.php
+++ b/wms/facility-index.php
@@ -1,161 +1,161 @@
-
-
-
-
-
-
-
-
-
-Please fill up the required field!";
- } else {
- header("Location:facility-index.php");
- }
- }
-
-?>
-
-
-
-
-
-
-
- 項次
- 合約號
- 作番號
- 客戶編號
- 重量
- 停數
- 樓層數
- 開門方式
- 速度
- 維修型態
- 經度
- 緯度
- 地址
- 維修人員工號
- 維修人員姓名
- 建檔人
- 建檔時間
-
- 修改
- 刪除
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-There is no record!";
-endif;
-
-#代表結束連線
-mysqli_close($link);
-
-include "footer.php";
-
+
+
+
+
+
+
+
+
+
+Please fill up the required field!";
+ } else {
+ header("Location:facility-index.php");
+ }
+ }
+
+?>
+
+
+
+
+
+
+
+ 項次
+ 合約號
+ 作番號
+ 客戶編號
+ 重量
+ 停數
+ 樓層數
+ 開門方式
+ 速度
+ 維修型態
+ 經度
+ 緯度
+ 地址
+ 維修人員工號
+ 維修人員姓名
+ 建檔人
+ 建檔時間
+
+ 修改
+ 刪除
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+There is no record!";
+endif;
+
+#代表結束連線
+mysqli_close($link);
+
+include "footer.php";
+
?>
\ No newline at end of file
diff --git a/wms/facility-record-submit.php b/wms/facility-record-submit.php
index 2388acd4..506b4aff 100644
--- a/wms/facility-record-submit.php
+++ b/wms/facility-record-submit.php
@@ -1,59 +1,59 @@
- 0) {
- echo "";
- } elseif ($affected == 0) {
- echo "";
- } else {
- echo "{$db_query} 語法執行失敗,錯誤訊息SSS: " . mysqli_error($link);
- }
-}
-?>
+ 0) {
+ echo "";
+ } elseif ($affected == 0) {
+ echo "";
+ } else {
+ echo "{$db_query} 語法執行失敗,錯誤訊息SSS: " . mysqli_error($link);
+ }
+}
+?>
diff --git a/wms/facility-record-update.php b/wms/facility-record-update.php
index efd415c4..15275bd9 100644
--- a/wms/facility-record-update.php
+++ b/wms/facility-record-update.php
@@ -1,49 +1,49 @@
- 0) {
- echo "";
- } elseif ($affected == 0) {
- echo "";
- } else {
- echo "{$db_query} 語法執行失敗,錯誤訊息SSS: " . mysqli_error($link);
- }
-}
+ 0) {
+ echo "";
+ } elseif ($affected == 0) {
+ echo "";
+ } else {
+ echo "{$db_query} 語法執行失敗,錯誤訊息SSS: " . mysqli_error($link);
+ }
+}
?>
\ No newline at end of file
diff --git a/wms/facility-user-input.php b/wms/facility-user-input.php
index 15cfa191..b9d0b7c2 100644
--- a/wms/facility-user-input.php
+++ b/wms/facility-user-input.php
@@ -1,61 +1,61 @@
-
-
+
+
diff --git a/wms/facility_current_status-create.php b/wms/facility_current_status-create.php
index f50317a4..0ad86577 100644
--- a/wms/facility_current_status-create.php
+++ b/wms/facility_current_status-create.php
@@ -1,65 +1,65 @@
-
-
-
-
- Please fill up the required field!";
- } else {
- echo "
Record has added successfully
";
- }
- }
- */
- ?>
-
-
-
-
-
-
-
+
+
+
+
+ Please fill up the required field!";
+ } else {
+ echo "
Record has added successfully
";
+ }
+ }
+ */
+ ?>
+
+
+
+
+
+
+
diff --git a/wms/facility_current_status-delete.php b/wms/facility_current_status-delete.php
index 88ad8d71..e3f6ffd2 100644
--- a/wms/facility_current_status-delete.php
+++ b/wms/facility_current_status-delete.php
@@ -1,12 +1,12 @@
-
\ No newline at end of file
diff --git a/wms/facility_current_status-edit.php b/wms/facility_current_status-edit.php
index aa82e8dd..4ad5b98b 100644
--- a/wms/facility_current_status-edit.php
+++ b/wms/facility_current_status-edit.php
@@ -1,73 +1,73 @@
-getMessage(), "\n";
- }
-*/
- foreach($data as $data) :
-?>
-
-
-
-
-
+getMessage(), "\n";
+ }
+*/
+ foreach($data as $data) :
+?>
+
+
+
+
+
diff --git a/wms/facility_current_status-index.php b/wms/facility_current_status-index.php
index 8937d7d1..4ea1f57f 100644
--- a/wms/facility_current_status-index.php
+++ b/wms/facility_current_status-index.php
@@ -1,136 +1,136 @@
-
-
-
-
-
-
-
-
-
-
-Please fill up the required field!";
- } else {
- header("Location:facility_current_status-index.php");
- }
- }
-
-?>
-
-
-
-
-
-
-
- 項次
- 合約號
- 顧客編號
- 作番號
- 運轉時數
- 運轉次數
- 建檔時間
-
- 修改
- 刪除
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-There is no record!";
-endif;
-
-#代表結束連線
-mysqli_close($link);
-
-include "footer.php";
-
+
+
+
+
+
+
+
+
+
+
+Please fill up the required field!";
+ } else {
+ header("Location:facility_current_status-index.php");
+ }
+ }
+
+?>
+
+
+
+
+
+
+
+ 項次
+ 合約號
+ 顧客編號
+ 作番號
+ 運轉時數
+ 運轉次數
+ 建檔時間
+
+ 修改
+ 刪除
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+There is no record!";
+endif;
+
+#代表結束連線
+mysqli_close($link);
+
+include "footer.php";
+
?>
\ No newline at end of file
diff --git a/wms/facility_current_status-record-submit.php b/wms/facility_current_status-record-submit.php
index 48e3416b..f3eb5013 100644
--- a/wms/facility_current_status-record-submit.php
+++ b/wms/facility_current_status-record-submit.php
@@ -1,38 +1,38 @@
- 0) {
- echo "";
- } elseif ($affected == 0) {
- echo "";
- } else {
- echo "{$db_query} 語法執行失敗,錯誤訊息SSS: " . mysqli_error($link);
- }
-}
-?>
+ 0) {
+ echo "";
+ } elseif ($affected == 0) {
+ echo "";
+ } else {
+ echo "{$db_query} 語法執行失敗,錯誤訊息SSS: " . mysqli_error($link);
+ }
+}
+?>
diff --git a/wms/facility_current_status-record-update.php b/wms/facility_current_status-record-update.php
index 82d6b12c..9a465fb2 100644
--- a/wms/facility_current_status-record-update.php
+++ b/wms/facility_current_status-record-update.php
@@ -1,38 +1,38 @@
- 0) {
- echo "";
- } elseif ($affected == 0) {
- echo "";
- } else {
- echo "{$db_query} 語法執行失敗,錯誤訊息SSS: " . mysqli_error($link);
- }
-}
+ 0) {
+ echo "";
+ } elseif ($affected == 0) {
+ echo "";
+ } else {
+ echo "{$db_query} 語法執行失敗,錯誤訊息SSS: " . mysqli_error($link);
+ }
+}
?>
\ No newline at end of file
diff --git a/wms/facility_current_status-user-input.php b/wms/facility_current_status-user-input.php
index 0ed578cb..ece78d34 100644
--- a/wms/facility_current_status-user-input.php
+++ b/wms/facility_current_status-user-input.php
@@ -1,52 +1,52 @@
-
-
+
+
diff --git a/wms/facilityapi.php b/wms/facilityapi.php
index 75b0d8b0..2355786a 100644
--- a/wms/facilityapi.php
+++ b/wms/facilityapi.php
@@ -1,56 +1,56 @@
-
-0) {
- $num++;
- }
- }
-
- }
- if ($num>0) {
- $jsonres['code']='200';
- $jsonres['num']=$num;
- echo json_encode($jsonres);
- }else{
- $jsonres['code']='1';
- $jsonres['num']=0;
- echo json_encode($jsonres);
-
- }
-
-
-
-}
-
-?>
-
-
+
+0) {
+ $num++;
+ }
+ }
+
+ }
+ if ($num>0) {
+ $jsonres['code']='200';
+ $jsonres['num']=$num;
+ echo json_encode($jsonres);
+ }else{
+ $jsonres['code']='1';
+ $jsonres['num']=0;
+ echo json_encode($jsonres);
+
+ }
+
+
+
+}
+
+?>
+
+
diff --git a/wms/footer.php b/wms/footer.php
index 8bb6f616..6313ddfa 100644
--- a/wms/footer.php
+++ b/wms/footer.php
@@ -1,6 +1,6 @@
-
-
-