public function exitotherapplyAction()
 {
     $VTs = new clsSystem();
     //先初始化
     $VTs->initialization();
     //-----------BI開始------------
     try {
         $action = [];
         $action["status"] = false;
         //一定需要有type id才可以
         if ($_POST["typeID"] and $_POST["uuid"] and $_POST["prj_mid"] and $_POST["quantity"]) {
             $quantity = $_POST["quantity"];
             $strSQL = "insert into el_exit_petition_other(prj_mid, petitionid, type, datep, date, count) ";
             $strSQL .= "values('" . $_POST["prj_mid"] . "','" . $_POST["uuid"] . "','" . $_POST["typeID"] . "','" . $VTs->DateTime("CTime") . "','" . $_POST["exit_date"] . "', " . $quantity . ");";
             $data = $VTs->ExecuteNonQuery($strSQL);
             //$action["sql"] = $strSQL;
             if ($data) {
                 $action["status"] = true;
             } else {
                 $action["msg"] = "目前無資料";
             }
         } else {
             $action["msg"] = "data is error";
         }
     } catch (Exception $error) {
         //依據Controller, Action補上對應位置, $error->getMessage()為固定部份
         $VTs->WriteLog("IndexController", "indexAction", $error->getMessage());
     }
     $pageContent = $VTs->Data2Json($action);
     //-----------BI結束------------
     //關閉資料庫連線
     $VTs->DBClose();
     //釋放
     $VTs = null;
     $this->viewContnet['pageContent'] = $pageContent;
     return new ViewModel($this->viewContnet);
 }
 public function insertDataAction()
 {
     $VTs = new clsSystem();
     //先初始化
     $VTs->initialization();
     try {
         //-----------BI開始------------
         //echo "Receipt insertData.";
         $arr = array();
         $arr["status"] = false;
         if (!empty($_POST)) {
             $dates = isset($_POST["dates"]) ? $_POST["dates"] : "";
             $datee = isset($_POST["datee"]) ? $_POST["datee"] : "";
             $amount = isset($_POST["amount"]) ? $_POST["amount"] : "";
             $prjid_su = isset($_POST["prjid_su"]) ? $_POST["prjid_su"] : "";
             $suid = isset($_POST["suid"]) ? $_POST["suid"] : "";
             $date_pay = isset($_POST["date_pay"]) ? $_POST["date_pay"] : "";
             //取得目前單號
             $date = date("Ym");
             $date = substr($date, 1);
             $strSQL = "SELECT voucher FROM acc_payment WHERE voucher like '%" . $date . "%' ORDER BY uid desc LIMIT 1";
             $data = $VTs->QueryData($strSQL);
             if (!empty($data)) {
                 $voucher = getVoucher($data[0]["voucher"]);
             } else {
                 $voucher = "A" . $date . "0001";
             }
             //新增資料
             $strSQL = "INSERT INTO acc_payment (voucher, dates, datee, amount, prjid_su, suid, date_pay)\n\t\t\t\t\t VALUES ('" . $voucher . "', '" . $dates . "', '" . $datee . "', '" . $amount . "', '" . $prjid_su . "', '" . $suid . "', '" . $date_pay . "')";
             $VTs->ExecuteNonQuery($strSQL);
             //確認是否新增成功
             $strSQL = "SELECT * FROM acc_payment WHERE voucher = '" . $voucher . "'";
             $data = $VTs->QueryData($strSQL);
             if (!empty($data)) {
                 $strSQL = "UPDATE acc_schedule\n\t\t\t\t\t\t SET payid = '" . $data[0]["uid"] . " '\n\t\t\t\t\t\t WHERE prjid_su = '" . $data[0]["prjid_su"] . "'";
                 $VTs->ExecuteNonQuery($strSQL);
                 $arr["status"] = true;
             } else {
                 $arr["msg"] = "Data does not insert into table.";
             }
         } else {
             $arr["msg"] = "No insert data.";
         }
         $pageContent = $VTs->Data2Json($arr);
         //-----------BI結束------------
     } catch (Exception $error) {
         //依據Controller, Action補上對應位置, $error->getMessage()為固定部份
         $VTs->WriteLog("ReceiptController", "insertDataAction", $error->getMessage());
     }
     //關閉資料庫連線
     $VTs->DBClose();
     //釋放
     $VTs = null;
     $this->viewContnet['pageContent'] = $pageContent;
     return new ViewModel($this->viewContnet);
 }
Пример #3
0
 public function DBinsertAction()
 {
     $VTs = new clsSystem();
     //先初始化
     $VTs->initialization();
     //-----------BI開始------------
     //        $type='el_petition';
     $type = $_POST['type'];
     switch ($type) {
         case "qc_checklist":
             $strSQL = '';
             $arr_list = $_POST['arr'];
             foreach ($arr_list as $list) {
                 $strSQL .= "INSERT INTO `qc_checklist`( `typeid`, `dataid`, `date`) VALUES (" . $list["type"] . "," . $list["dataid"] . ",'" . $list["date"] . "');";
             }
             $VTs->ExecuteNonQuery($strSQL);
             break;
     }
     //-----------BI結束------------
     //關閉資料庫連線
     $VTs->DBClose();
     //釋放
     $VTs = null;
     return new ViewModel($this->viewContnet);
 }
 public function examinerecordAction()
 {
     $VTs = new clsSystem();
     $VTs->initialization("oldhouseDB");
     //-----BI開始-----
     $action = array();
     $action["status"] = false;
     //$VTs->debug($_POST["record"]);
     if (!empty($_POST)) {
         $TargetID = !empty($_POST["record"]["TargetID"]) ? $_POST["record"]["TargetID"] : 0;
         $TypeID = !empty($_POST["record"]["TypeID"]) ? $_POST["record"]["TypeID"] : 0;
         $ScaleID1 = !empty($_POST["record"]["ScaleID1"]) ? $_POST["record"]["ScaleID1"] : null;
         $ScaleID2 = !empty($_POST["record"]["ScaleID2"]) ? $_POST["record"]["ScaleID2"] : null;
         $StructID = !empty($_POST["record"]["StructID"]) ? $_POST["record"]["StructID"] : 0;
         //新增qc_info
         $date = date("Y-m-d");
         //echo $date;
         if ($ScaleID2 != null) {
             $strSQL = "insert into qc_info (huid, htid, htmid1, htmid2, htsid, `date`)\n                     values(" . $TargetID . ", " . $TypeID . ", " . $ScaleID1 . ", " . $ScaleID2 . ", " . $StructID . ", '" . $date . "')";
             //"insert into qc_info (huid, htid, htmid1, htmid2, htsid, `date`)
             // values(".$_POST["record"]["TargetID"].", ".$_POST["record"]["TypeID"].", ".$_POST["record"]["ScaleID1"].", ".$_POST["record"]["ScaleID2"].", ".$_POST["record"]["StructID"].", '".$date."')";
         } else {
             $strSQL = "insert into qc_info (huid, htid, htmid1, htsid, `date`)\n                     values(" . $TargetID . ", " . $TypeID . ", " . $ScaleID1 . ", " . $StructID . ", '" . $date . "')";
         }
         //print_r("qc_info:  " . $strSQL . "<br><br>");
         $VTs->ExecuteNonQuery($strSQL);
         $strSQL = "select uid from qc_info order by uid desc Limit 1";
         //print_r("qc_info_uid:  " . $strSQL . "<br><br>");
         $data = $VTs->QueryData($strSQL);
         $ifid = $data[0]["uid"];
         //新增照片
         $datas = $_POST["record"]["RecordDatas"];
         //print_r("Datas:");
         //$VTs->debug($datas);
         foreach ($datas as $i => $content) {
             //print_r("Imgs:");
             //$VTs->debug($content["imgs"]);
             //圖片存檔
             $Imgs = $content["imgs"];
             $imgId = ImgSet($Imgs);
             //print_r("照片ID:".$imgId);
             //echo "imgID: ". $imgId;
             //計算危險等級
             //$VTs->Debug($content);
             //量化資料才需計算等級,質化資料之Val即為危險等級。
             if ($content["Length"] > 0 || $content["Width"] > 0 || $content["Depth"] > 0 || $content["Area"] > 0) {
                 $content = Quality2Amount($content);
             }
             //$VTs->Debug($content);
             //新增qc_item
             $Length = !empty($content["Length"]) ? $content["Length"] : 0;
             $Width = !empty($content["Width"]) ? $content["Width"] : 0;
             $Depth = !empty($content["Depth"]) ? $content["Depth"] : 0;
             $Area = !empty($content["Area"]) ? $content["Area"] : 0;
             $ValID = !empty($content["ValID"]) ? $content["ValID"] : 0;
             $strSQL = "insert into qc_item (ifid, strid, ciid, `length`, width, depth, `area`, val, imgids, remark) ";
             $strSQL .= "values (" . $ifid . ", " . $content["PlaceID"] . ", " . $content["ProblemID"] . ", " . $Length . ", " . $Width . ", " . $Depth . ", " . $Area . ", " . $ValID . ", " . $imgId . ", '" . $content["Remark"] . "')";
             //print_r("qc_item:  " . $strSQL . "<br><br>");
             $VTs->ExecuteNonQuery($strSQL);
         }
         $action["status"] = true;
     } else {
         $action["msg"] = '新增失敗';
     }
     #產PDF
     $strSQL = "select hname, htel from qc_house where uid = " . $TargetID;
     //print_r($strSQL);
     $data = $VTs->QueryData($strSQL);
     if (!empty($data)) {
         //print_r("產生PDF");
         //print_r("http://211.21.170.18/Oldhouse/report?targetid=".$TargetID."&page=main_page");
         //$VTs->Page2PDF("http://127.0.0.1:200/Oldhouse/report?targetid=".$TargetID, "D:\\php_dev\\AP-Service\\public\\old_house_pdf\\".md5($data[0]["hname"])."-".$data[0]["htel"]);
         //$VTs->Page2PDF("http://192.168.0.188/Oldhouse/report?targetid=".$TargetID, "C:\\xampp\\htdocs\\Construct-Management\\public\\old_house_pdf\\".iconv("utf-8", "big5", $data[0]["hname"])."-".$data[0]["htel"]);
         echo $VTs->Page2PDF("http://211.21.170.18/Oldhouse/report?targetid=" . $TargetID . "&page=main_page", "C:\\xampp\\htdocs\\Construct-Management\\public\\old_house_pdf\\" . iconv("utf-8", "big5", $data[0]["hname"]) . "-" . $data[0]["htel"]);
         echo "<br/>";
         echo $VTs->Page2PDF("http://211.21.170.18/Oldhouse/report?targetid=" . $TargetID . "&page=img_page", "C:\\xampp\\htdocs\\Construct-Management\\public\\old_house_pdf\\" . iconv("utf-8", "big5", $data[0]["hname"]) . "-" . $data[0]["htel"] . "-imgs");
         echo "<br/>";
         // $VTs->Page2PDF("http://127.0.0.1:200/Oldhouse/report?targetid=".$TargetID."&page=main_page", "D:\\php_dev\\Construct-Management\\public\\old_house_pdf\\".iconv("utf-8", "big5", $data[0]["hname"])."-".$data[0]["htel"]);
         // $VTs->Page2PDF("http://127.0.0.1:200/Oldhouse/report?targetid=".$TargetID."&page=img_page", "D:\\php_dev\\Construct-Management\\public\\old_house_pdf\\".iconv("utf-8", "big5", $data[0]["hname"])."-".$data[0]["htel"]."-imgs");
     }
     $pageContent = $VTs->Data2Json($action);
     //-----BI結束-----
     $VTs = null;
     $this->viewContnet['pageContent'] = $pageContent;
     return new ViewModel($this->viewContnet);
 }
 public function modifytmpuserdataAction()
 {
     $VTs = new clsSystem();
     $VTs->initialization("tmpCardDB");
     try {
         //-----BI開始-----
         $action = array();
         $action["status"] = false;
         if ($_POST["uid"]) {
             $strSQL = "update tc_user_info set user_id = '" . $_POST["user_id"] . "', name = '" . $_POST["name"] . "', company='" . $_POST["company"] . "', phone='" . $_POST["phone"] . "',admin_edit_date='" . $VTs->DateTime("CTime_Now") . "' where uid =" . $_POST["uid"];
             $VTs->ExecuteNonQuery($strSQL);
             $action["status"] = true;
         } else {
             $action["msg"] = "id or value is empty";
         }
         $pageContent = $VTs->Data2Json($action);
         //----BI結束----
     } catch (Exception $error) {
         //依據Controller, Action補上對應位置, $error->getMessage()為固定部份
         $VTs->WriteLog("IndexController", "indexAction", $error->getMessage());
     }
     $VTs = null;
     $this->viewContnet['pageContent'] = $pageContent;
     return new ViewModel($this->viewContnet);
 }
 public function dbmodifyAction()
 {
     $VTs = new clsSystem();
     //先初始化
     $VTs->initialization('');
     //-----------BI開始------------
     $type = $_POST['type'];
     switch ($type) {
         case "chkorder":
             $strSQL = '';
             $ls_uid = $_POST['id'];
             $arr_uid = explode(",", $ls_uid);
             foreach ($arr_uid as $uid) {
                 $strSQL .= "UPDATE `el_petition` SET `check`=1,`datel`='" . $VTs->DateTime("CTime_Now") . "' WHERE uid=" . $uid . ";";
             }
             $VTs->ExecuteNonQuery($strSQL);
             break;
         case "chkin":
             $uid = $_POST['id'];
             $count = $_POST['count'];
             $strSQL = "UPDATE `el_petition` SET `datein`='" . $VTs->DateTime("CTime_Now") . "' WHERE uid=" . $uid . ";";
             $VTs->ExecuteNonQuery($strSQL);
             $quid = $_POST['quid'];
             $count = $_POST['count'];
             $strSQL = "SELECT count_order,count_in FROM `el_quantity` WHERE uid=" . $quid . ";";
             $d = $VTs->QueryData($strSQL);
             $data = $d[0];
             $count_order = $data['count_order'] - $count;
             $count_in = $data['count_in'] + $count;
             $strSQL = "UPDATE el_quantity SET count_order=" . $count_order . ", count_in =" . $count_in . " WHERE uid=" . $quid . ";";
             $VTs->ExecuteNonQuery($strSQL);
             break;
     }
     //-----------BI結束------------
     //關閉資料庫連線
     $VTs->DBClose();
     //釋放
     $VTs = null;
     return new ViewModel($this->viewContnet);
 }
 public function updateDataAction()
 {
     $VTs = new clsSystem();
     //先初始化
     $VTs->initialization();
     try {
         //-----------BI開始------------
         $arr = array();
         $arr["status"] = false;
         if (!empty($_POST)) {
             $table = isset($_POST["table"]) ? $_POST["table"] : "";
             switch ($table) {
                 case "eng_type_a":
                 case "eng_type_b":
                 case "eng_type_c":
                 case "eng_type_d":
                     $ori_name = isset($_POST["ori_name"]) ? $_POST["ori_name"] : "";
                     $code = isset($_POST["code"]) ? $_POST["code"] : "";
                     $name = isset($_POST["name"]) ? $_POST["name"] : "";
                     $unit = isset($_POST["unit"]) ? $_POST["unit"] : "";
                     if ($table != "eng_type_d") {
                         $strSQL = "UPDATE " . $table . "\n\t\t\t\t\t\t\t\t SET name = '" . $name . "'\n\t\t\t\t\t\t\t\t WHERE name = '" . $ori_name . "' AND code = '" . $code . "'";
                     } else {
                         $strSQL = "UPDATE " . $table . "\n\t\t\t\t\t\t\t\t SET name = '" . $name . "', typeid_u = '" . $unit . "'\n\t\t\t\t\t\t\t\t WHERE name = '" . $ori_name . "' AND code = '" . $code . "'";
                     }
                     $VTs->ExecuteNonQuery($strSQL);
                     $strSQL = "SELECT * FROM " . $table . " WHERE name = '" . $name . "' AND code = '" . $code . "'";
                     $data = $VTs->QueryData($strSQL);
                     if (!empty($data)) {
                         $arr["status"] = true;
                         $arr["data"] = $data;
                     } else {
                         $arr["msg"] = "update error.";
                     }
                     break;
                 case "eng_str_b":
                 case "eng_str_e":
                     $ori_code = isset($_POST["ori_code"]) ? $_POST["ori_code"] : "";
                     $ori_name = isset($_POST["ori_name"]) ? $_POST["ori_name"] : "";
                     $code = isset($_POST["code"]) ? $_POST["code"] : "";
                     $name = isset($_POST["name"]) ? $_POST["name"] : "";
                     $ismodel = isset($_POST["ismodel"]) ? $_POST["ismodel"] : "";
                     $strSQL = "UPDATE " . $table . " ";
                     if ($table == "eng_str_b") {
                         $strSQL .= "SET code = '" . $code . "', name = '" . $name . "', ismodel = '" . $ismodel . "'";
                     } else {
                         $strSQL .= "SET code = '" . $code . "', name = '" . $name . "'";
                     }
                     $strSQL .= "WHERE name = '" . $ori_name . "' AND code = '" . $ori_code . "'";
                     $VTs->ExecuteNonQuery($strSQL);
                     $arr["updateSQL"] = $strSQL;
                     $strSQL = "SELECT * FROM " . $table . " WHERE code = '" . $code . "' AND name = '" . $name . "'";
                     $data = $VTs->QueryData($strSQL);
                     if (!empty($data)) {
                         $arr["status"] = true;
                         $arr["msg"] = "修改成功";
                     } else {
                         $arr["msg"] = "修改失敗";
                     }
                     break;
                 default:
             }
         }
         $pageContent = $VTs->Data2Json($arr);
         $this->viewContnet['pageContent'] = $pageContent;
         //-----------BI結束------------
     } catch (Exception $error) {
         //依據Controller, Action補上對應位置, $error->getMessage()為固定部份
         $VTs->WriteLog("EngineeringmanageController", "updateDataAction", $error->getMessage());
     }
     //關閉資料庫連線
     $VTs->DBClose();
     //釋放
     $VTs = null;
     return new ViewModel($this->viewContnet);
 }
 public function DBinsertAction()
 {
     $VTs = new clsSystem();
     //先初始化
     $VTs->initialization();
     //-----------BI開始------------
     $type = $_POST["unit1"];
     $type = "typeunit";
     switch ($type) {
         case "typeunit":
             $strSQL = "INSERT INTO `el_type_unit` ( `unit1`, `unit2`, `typeid_a`) VALUES ('t1', 't2', '2');";
             $VTs->ExecuteNonQuery($strSQL);
             //$strSQL = "SELECT @@IDENTITY;";
             $data = $VTs->NewInsertID();
             $VTs->debug($data);
             break;
     }
     //-----------BI結束------------
     //關閉資料庫連線
     $VTs->DBClose();
     //釋放
     $VTs = null;
     return new ViewModel($this->viewContnet);
 }
 public function recordAttendanceAction()
 {
     $VTs = new clsSystem();
     //先初始化
     $VTs->initialization('');
     try {
         //-----------BI開始------------
         $arr = array();
         $arr["status"] = false;
         $ID = isset($_POST['ID']) ? $_POST["ID"] : "";
         $check_type = isset($_POST["check_type"]) ? $_POST["check_type"] : "";
         // $ID = "S121654987";
         // $check_type ="1";
         //取出廠商工人ID
         $strSQL = "SELECT T1.uid, T3.uid AS prjid, T3.faid\n\t\t\t\t\t\t\tFROM su_worker AS T1\n\t\t\t\t\t\t\t\tJOIN su_worker_common AS T2 ON T1.workerid=T2.uid\n\t\t\t\t\t\t\t\tJOIN prj_project AS T3 ON T3.suid = T1.suid\n\t\t\t\t\t\t\tWHERE T2.sid='" . $ID . "'";
         $data = $VTs->QueryData($strSQL);
         if (!empty($data)) {
             //寫入出勤紀錄
             if ($data[0]["faid"] == 0) {
                 $prjid = $data[0]["prjid"];
             } else {
                 $prjid = $data[0]["faid"];
             }
             $strSQL = "INSERT INTO su_checktime (suworkid,typeid,prjid) \n\t\t\t\t\t\t\tVALUES (" . $data[0]["uid"] . ", " . $check_type . ", " . $prjid . ")";
             $VTs->ExecuteNonQuery($strSQL);
             $strSQL = "SELECT * \n\t\t\t\t\t\t\t\tFROM su_checktime\n\t\t\t\t\t\t\t\tWHERE suworkid='" . $data[0]["uid"] . "'";
             $data = $VTs->QueryData($strSQL);
             $arr["status"] = true;
             $arr["insertData"] = $data;
             /* }else{
             				
             					//取出員工ID
             					$strSQL = "SELECT T1.uid
             								FROM emp_employee AS T1
             									JOIN emp_common AS T2 ON T1.memid=T2.uid
             								WHERE T2.sid='".$ID."'";
             					//echo $strSQL;
             					$data = $VTs->QueryData($strSQL);
             					//$VTs->debug($data);
             					if(!empty($data)){
             						//寫入出勤紀錄
             						$strSQL = "INSERT INTO emp_checktime (empid,typeid) 
             							VALUES (".$data[0]["uid"].", ".$check_type.")";
             						//echo $strSQL;
             						$VTs->ExecuteNonQuery($strSQL);
             
             						$strSQL = "";
             						$data = $VTs->QueryData($strSQL);
             						//$VTs->debug($data);
             					} */
         } else {
             $arr["msg"] = "無寫入出勤紀錄";
         }
         $pageContent = $VTs->Data2Json($data);
         //-----------BI結束------------
     } catch (Exception $error) {
         //依據Controller, Action補上對應位置, $error->getMessage()為固定部份
         $VTs->WriteLog("SARController", "recordAttendanceAction", $error->getMessage());
     }
     //關閉資料庫連線
     $VTs->DBClose();
     //釋放
     $VTs = null;
     $this->viewContnet['pageContent'] = $pageContent;
     return new ViewModel($this->viewContnet);
 }
 public function facebooksigninAction()
 {
     $VTs = new clsSystem();
     //先初始化
     $VTs->initialization('oauth');
     //-----------BI開始------------
     //設定資訊陣列
     $uidInfo = array();
     $uidInfo["status"] = false;
     //接收已於Google驗證好的資料
     if ($_POST["authResponse"]["accessToken"]) {
         //1. 先與Google做AccessToken的認證
         $url = "https://graph.facebook.com/v2.5/me?access_token=" . $_POST["authResponse"]["accessToken"];
         $facebookLoginInfo = $VTs->Json2Data($VTs->UrlDataGet($url));
         $facebookUserID = $facebookLoginInfo->id;
         $facebookUserName = $facebookLoginInfo->name;
         //$VTs->debug($facebookLoginInfo);
         //exit();
         //1-1. 確認認證無誤
         if ($facebookUserID) {
             //2. 執行查詢看資料庫是否已有新增過
             //執行查詢
             $strSQL = "select * from thirdparty_oauth where thirdparty_uid = '" . $facebookUserID . "'";
             $data = $VTs->QueryData($strSQL);
             //2-1. 沒有新增過,準備新增
             if (empty($data)) {
                 //執行新增
                 $strSQL = "insert into thirdparty_oauth(thirdparty_uid,userName,oauth_type, approveCode, approveStatus) values('" . $facebookUserID . "','" . $facebookUserName . "',1,'1234',0)";
                 $VTs->ExecuteNonQuery($strSQL);
                 //2-2. 重新執行查詢,並取得UUID
                 $strSQL = "select * from thirdparty_oauth where thirdparty_uid='" . $facebookUserID . "'";
                 $data = $VTs->QueryData($strSQL);
             }
             $uuid = $data[0]["uuid"];
             //驗證USER是否已存在Token
             $strSQL = "select uuid from token where uuid='" . $uuid . "'";
             $TokenData = $VTs->QueryData($strSQL);
             //產生Token,會回傳Login_Code、Access_Token
             $loginArr = $VTs->CreatLoginCodeAndToken($uuid);
             //存到Token資料表中,以供後續Oauth使用
             if ($uuid) {
                 if (empty($TokenData)) {
                     $strSQL = "insert into token(uuid,login_code,access_token,login_from,login_type) values('" . $uuid . "','" . $loginArr["Login_Code"] . "','" . $loginArr["Access_Token"] . "','" . $_SERVER["REMOTE_ADDR"] . "',1)";
                 } else {
                     $strSQL = "update token set login_code='" . $loginArr["Login_Code"] . "',access_token='" . $loginArr["Access_Token"] . "',login_from='" . $_SERVER["REMOTE_ADDR"] . "',login_date='" . date("Y-m-d H:i:s") . "' where uuid='" . $uuid . "'";
                 }
             } else {
                 echo "System error";
                 exit;
             }
             //確定存取Token到資料表中
             $VTs->QueryData($strSQL);
             //紀錄SESSION
             $_SESSION["uuid"] = $uuid;
             $_SESSION["name"] = $data[0]["userName"];
             $_SESSION["mail"] = $data[0]["userMail"];
             $_SESSION["LoginCode"] = $loginArr["Login_Code"];
             $uidInfo["LoginCode"] = $loginArr["Login_Code"];
             $uidInfo["status"] = true;
         } else {
             //1-2. 未通過驗證
             $uidInfo["error"] = 'The Accound is not Sing up!';
             $uidInfo["code"] = '6';
         }
     } else {
         $uidInfo["error"] = 'You did not have Facebook access token!';
         $uidInfo["code"] = '5';
     }
     $this->viewContnet['pageContent'] = $VTs->Data2Json($uidInfo);
     //-----------BI結束------------
     //關閉資料庫連線
     $VTs->DBClose();
     //釋放
     $VTs = null;
     return new ViewModel($this->viewContnet);
 }
 public function settingmenuAction()
 {
     $VTs = new clsSystem();
     $VTs->initialization();
     //-----BI開始-----
     $action["status"] = false;
     if (@$_POST["uuid"]) {
         $strSQL = "select * from acl_account_position_list where uuid = '" . $_POST["uuid"] . "'";
         $data = $VTs->QueryData($strSQL);
         $position = '';
         if (!empty($data)) {
             foreach ($data as $content) {
                 $position .= $content["position_uid"] . ',';
             }
             $position = substr($position, 0, strlen($position) - 1);
         } else {
             $position = 0;
         }
         if (strpos($position, '99999') >= 0) {
             $uid = $_POST["uid"];
             $click_action = $_POST["click_action"][$uid];
             $click_action = $click_action == 'null' ? "click_action=null, " : "click_action='" . $click_action . "', ";
             $strSQL = "update sys_menu set href='" . $_POST["href"][$uid] . "', ";
             $strSQL .= $click_action;
             $strSQL .= " nid='" . $_POST["nid"][$uid] . "', parent_layer='" . $_POST["parent_layer"][$uid] . "' where uid = " . $uid;
             $action["status"] = true;
             //$action["msg"] = $strSQL;
             $VTs->ExecuteNonQuery($strSQL);
         } else {
             $action["msg"] = 'You Can not Change Menu';
         }
     } else {
         $action["msg"] = 'You Can not Change Menu';
     }
     $pageContent = $VTs->Data2Json($action);
     //-----BI結束-----
     $VTs = null;
     $this->viewContnet['pageContent'] = $pageContent;
     return new ViewModel($this->viewContnet);
 }
 public function dbmodifyAction()
 {
     $VTs = new clsSystem();
     //先初始化
     $VTs->initialization('');
     //-----------BI開始------------
     $strSQL = '';
     $data = $_POST;
     $type = $data['type'];
     switch ($type) {
         case 'laborsafety':
             $strSQL = "UPDATE `eng_diary_contents` SET `contents` = '" . $data["fifth"] . "' WHERE type=2 AND date = '" . date('Y-m-d') . "';";
             $VTs->ExecuteNonQuery($strSQL);
             $strSQL = "UPDATE `eng_diary_contents` SET `contents` = '" . $data["seventh"] . "' WHERE type=4 AND date = '" . date('Y-m-d') . "';";
             $VTs->ExecuteNonQuery($strSQL);
             break;
         case 'diary_info':
             $strSQL = "UPDATE `eng_diary_info` SET `am_wthid` = '" . $data["amwather"] . "', `pm_wthid` = '" . $data["pmwather"] . " WHERE `date` = '" . date('Y-m-d') . ";";
             $VTs->ExecuteNonQuery($strSQL);
             break;
         case 'infocheck':
             $strSQL = "UPDATE `eng_diary_info` SET `dates` = '" . $VTs->DateTime("CTime_Now") . "' WHERE `date` = '" . date('Y/m/d') . "';";
             $VTs->ExecuteNonQuery($strSQL);
             break;
     }
     //       $data=$_POST;
     //       $strSQL="UPDATE `eng_diary_info` SET `am_wthid` = '".$data["amwather"]."', `pm_wthid` = '".$data["pmwather"]." WHERE `date` = '".date('Y-m-d').";";
     //       $VTs->ExecuteNonQuery($strSQL);
     //       $strSQL="SELECT uid FROM eng_diary_info WHERE date='".date("Y")."-".date("m")."-".date("d")."';";
     //       $d = $VTs->QueryData($strSQL);
     //       $iuid=$d[0]['uid'];
     //       $strSQL="UPDATE `eng_diary_contents` SET `fourth` = '".$data["fourth"]."', `fifth` = '".$data["fifth"]."', `sixth` = '".$data["sixth"]."', `seventh` = '".$data["seventh"]."', `eighth` = '".$data["eighth"]."' WHERE iuid = ".$iuid.";";
     // $VTs->ExecuteNonQuery($strSQL);
     //-----------BI結束------------
     //關閉資料庫連線
     $VTs->DBClose();
     //釋放
     $VTs = null;
     return new ViewModel($this->viewContnet);
 }
 public function updateDataAction()
 {
     $VTs = new clsSystem();
     //先初始化
     $VTs->initialization();
     try {
         //-----------BI開始------------
         $arr = $_POST;
         $uid = $_GET["uid"];
         if (!empty($arr)) {
             //update basicInfo
             $strSQL = "UPDATE emp_common \n\t\t\t\t\t\t\tSET name = '" . $arr["name"] . "', sid = '" . $arr["sid"] . "', sex = '" . $arr["sex"] . "', birthday = '" . $arr["birthday"] . "'\n\t\t\t\t\t\t\tWHERE uid = '" . $uid . "'";
             $VTs->ExecuteNonQuery($strSQL);
             //update address
             $strSQL = "UPDATE emp_common_address\n\t\t\t\t\t\t\tSET zip = '" . $arr["zip"] . "', city = '" . $arr["city"] . "', area = '" . $arr["area"] . "', vil = '" . $arr["vil"] . "', verge = '" . $arr["verge"] . "', road = '" . $arr["road"] . "', addr = '" . $arr["addr"] . "'\n\t\t\t\t\t\t\tWHERE memid = '" . $uid . "'";
             $VTs->ExecuteNonQuery($strSQL);
             //get belong id
             $strSQL = "SELECT uid FROM emp_common WHERE name = '" . $arr["belong"] . "'";
             $belongUid = $VTs->QueryData($strSQL);
             //update communication
             if (!empty($belongUid)) {
                 $strSQL = "UPDATE emp_common_communication\n\t\t\t\t\t\t\t\tSET belong = '" . $belongUid[0]["uid"] . "', relationid = '" . $arr["relation"] . "', mobile = '" . $arr["mobile"] . "', tel_h = '" . $arr["tel_h"] . "', tel_o = '" . $arr["tel_o"] . "', tel_ext = '" . $arr["tel_ext"] . "', email = '" . $arr["email"] . "'\n\t\t\t\t\t\t\t\tWHERE memid = '" . $uid . "'";
                 $VTs->ExecuteNonQuery($strSQL);
             } else {
                 $strSQL = "UPDATE emp_common_communication\n\t\t\t\t\t\t\t\tSET relationid = '" . $arr["relation"] . "', mobile = '" . $arr["mobile"] . "', tel_h = '" . $arr["tel_h"] . "', tel_o = '" . $arr["tel_o"] . "', tel_ext = '" . $arr["tel_ext"] . "', email = '" . $arr["email"] . "'\n\t\t\t\t\t\t\t\tWHERE memid = '" . $uid . "'";
                 $VTs->ExecuteNonQuery($strSQL);
             }
             $pageContent = $VTs->Data2Json($arr);
         } else {
             $pageContent = "Error";
         }
         //-----------BI結束------------
     } catch (Exception $error) {
         //依據Controller, Action補上對應位置, $error->getMessage()為固定部份
         $VTs->WriteLog("EmployeemanageController", "updateDataAction", $error->getMessage());
     }
     //關閉資料庫連線
     $VTs->DBClose();
     //釋放
     $VTs = null;
     $this->viewContnet['pageContent'] = $pageContent;
     return new ViewModel($this->viewContnet);
 }