public function indexAction()
 {
     $VTs = new clsSystem();
     $VTs->initialization();
     try {
         //-----BI開始-----
         if (empty($_SESSION)) {
             $pagePath = dirname(__DIR__) . "\\..\\..\\..\\..\\public\\include\\pageSetting\\index\\login_page.html";
             $pageContent = $VTs->GetHtmlContent($pagePath);
         } else {
             $pagePath = dirname(__DIR__) . "\\..\\..\\..\\..\\public\\include\\pageSetting\\receipt\\index.html";
             $pageContent = $VTs->GetHtmlContent($pagePath);
             $companyTitlePath = dirname(__DIR__) . "\\..\\..\\..\\..\\public\\include\\pageSetting\\receipt\\companyTitle.html";
             $companyTitle = $VTs->GetHtmlContent($companyTitlePath);
             $supplyInfoPath = dirname(__DIR__) . "\\..\\..\\..\\..\\public\\include\\pageSetting\\receipt\\supplyInfo.html";
             $supplyInfo = $VTs->GetHtmlContent($supplyInfoPath);
             $paymentDetialPath = dirname(__DIR__) . "\\..\\..\\..\\..\\public\\include\\pageSetting\\receipt\\paymentDetial.html";
             $paymentDetial = $VTs->GetHtmlContent($paymentDetialPath);
             $detialListPath = dirname(__DIR__) . "\\..\\..\\..\\..\\public\\include\\pageSetting\\receipt\\detialList.html";
             $detialList = $VTs->GetHtmlContent($detialListPath);
             //一個索引與內容等同一個 >> str_replace("@@userName@@",$_SESSION["userName"],$pageContent);
             $dataArr = ["userName" => $_SESSION["userName"], "companyTitle" => $companyTitle, "supplyInfo" => $supplyInfo, "paymentDetial" => $paymentDetial, "detialList" => $detialList];
             //內容取代
             $pageContent = $VTs->ContentReplace($dataArr, $pageContent);
         }
         //----BI結束----
     } catch (Exception $error) {
         //依據Controller, Action補上對應位置, $error->getMessage()為固定部份
         $VTs->WriteLog("ReceiptController", "indexAction", $error->getMessage());
     }
     $VTs = null;
     $this->viewContnet['pageContent'] = $pageContent;
     return new ViewModel($this->viewContnet);
 }
 public function getAddHtmlAction()
 {
     //session_start();
     $VTs = new clsSystem();
     $VTs->initialization();
     //-----BI開始----- typeunit 單位表IUD頁面
     $type = $_GET["type"];
     switch ($type) {
         case '0':
             $path = dirname(__DIR__) . "\\..\\..\\..\\..\\public\\include\\pageSetting\\styles\\editor\\typeunit_addlist.html";
             $html = $VTs->GetHtmlContent($path);
             $data = $VTs->json2data($VTs->UrlDataGet("http://127.0.0.1:88/editor/getdbdata?page=type_a"));
             $str = '';
             foreach ($data as $opData) {
                 $str .= '<option value=' . $opData->uid . '>' . $opData->name . '</option>';
             }
             $html = str_replace('@@select@@', $str, $html);
             break;
     }
     $pageContent = $html . $VTs->CreateFinishOptionBtn(["uid" => 1], 'test/tw', 'inputClass', 'contentClass');
     //-----BI結束-----
     //關閉資料庫連線
     $VTs->DBClose();
     //釋放
     $VTs = null;
     $this->viewContnet['pageContent'] = $pageContent;
     return new ViewModel($this->viewContnet);
 }
 public function SARReportAction()
 {
     //session_start();
     $VTs = new clsSystem();
     $VTs->initialization();
     try {
         //-----BI開始-----
         if (empty($_SESSION)) {
             $pagePath = dirname(__DIR__) . "\\..\\..\\..\\..\\public\\include\\pageSetting\\index\\login_page.html";
             $pageContent = $VTs->GetHtmlContent($pagePath);
         } else {
             $mpath = dirname(__DIR__) . "\\..\\..\\..\\..\\public\\include\\pageSetting\\sar\\report_index.html";
             $html = $VTs->GetHtmlContent($mpath);
             $reportPath = dirname(__DIR__) . "\\..\\..\\..\\..\\public\\include\\pageSetting\\sar\\report.html";
             $report = $VTs->GetHtmlContent($reportPath);
             $dataArr = ["userName" => $_SESSION["userName"], "report" => $report];
             $html = $VTs->ContentReplace($dataArr, $html);
             $pageContent = $html;
         }
         //-----BI結束-----
     } catch (Exception $error) {
         //依據Controller, Action補上對應位置, $error->getMessage()為固定部份
         $VTs->WriteLog("SARController", "SARReportAction", $error->getMessage());
     }
     //關閉資料庫連線
     $VTs->DBClose();
     //釋放
     $VTs = null;
     $this->viewContnet['pageContent'] = $pageContent;
     return new ViewModel($this->viewContnet);
 }
 public function indexAction()
 {
     $VTs = new clsSystem();
     //先初始化
     $VTs->initialization();
     try {
         //-----------BI開始------------
         //執行查詢
         $strSQL = "select * from account";
         $data = $VTs->QueryData($strSQL);
         //debug,印出資料用
         $VTs->debug($data);
         //日期轉換
         $date = date("Y-m-d");
         $changeDate = $VTs->DateTime("ADyyyyMMdd_RCyyyMMdd", $date);
         $this->viewContnet['pageContent'] = $changeDate;
         //-----------BI結束------------
     } catch (Exception $error) {
         //依據Controller, Action補上對應位置, $error->getMessage()為固定部份
         $VTs->WriteLog("IndexController", "indexAction", $error->getMessage());
     }
     //關閉資料庫連線
     $VTs->DBClose();
     //釋放
     $VTs = null;
     return new ViewModel($this->viewContnet);
 }
 public function indexAction()
 {
     $VTs = new clsSystem();
     $VTs->initialization();
     try {
         //-----BI開始-----
         //$HeadTitle = $this->getServiceLocator()->get('ViewHelperManager')->get('HeadTitle');
         //$VTs->debug($_SESSION);
         $isLogin = $VTs->CheckLogin();
         //----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 getInfoHtmlAction()
 {
     $VTs = new clsSystem();
     $VTs->initialization();
     try {
         //-----BI開始-----  
         //取得html
         $mpath = dirname(__DIR__) . "\\..\\..\\..\\..\\public\\include\\pageSetting\\supply\\info.html";
         $html = $VTs->GetHtmlContent($mpath);
         // $html='';
         $pageContent = $html;
         //-----BI結束-----
     } catch (Exception $error) {
         //依據Controller, Action補上對應位置, $error->getMessage()為固定部份
         $VTs->WriteLog("SupplyController", "getinfohtmlAction", $error->getMessage());
     }
     //關閉資料庫連線
     $VTs->DBClose();
     //釋放
     $VTs = null;
     $this->viewContnet['pageContent'] = $pageContent;
     return new ViewModel($this->viewContnet);
 }
Esempio n. 7
0
 public function indexAction()
 {
     $VTs = new clsSystem();
     //先初始化
     $VTs->initialization();
     //-----------BI開始------------
     //執行查詢
     $strSQL = "select * from account";
     $data = $VTs->QueryData($strSQL);
     //資料轉換
     $data = $VTs->Data2Array($data);
     //debug,印出資料用
     $VTs->debug($data);
     //日期轉換
     $date = date("Y-m-d");
     $changeDate = $VTs->DateTime("ADyyyyMMdd_RCyyyMMdd", $date);
     $this->viewContnet['pageContent'] = $changeDate;
     //-----------BI結束------------
     //關閉資料庫連線
     $VTs->DBClose();
     //釋放
     $VTs = null;
     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開始------------
     echo "test";
     //-----------BI結束------------
     //關閉資料庫連線
     $VTs->DBClose();
     //釋放
     $VTs = null;
     return new ViewModel($this->viewContnet);
 }
 public function pageAction()
 {
     $VTs = new clsSystem();
     $VTs->initialization();
     //-----BI開始-----
     $action = array();
     $action["status"] = false;
     if (!empty($_POST)) {
         switch ($_POST["type"]) {
             //取得語言
             case "getLan":
                 //如果未設定語系,先設定
                 if (!isset($_SESSION["lang"])) {
                     //先取得語系列表
                     $langListArr = $this->langList();
                     //取得伺服器本身的語言
                     $lang = strtolower(strtok(strip_tags($_SERVER['HTTP_ACCEPT_LANGUAGE']), ','));
                     $lang = str_replace("zh-", "", $lang);
                     if (!empty($langListArr)) {
                         if (!in_array($lang, $langListArr["list"])) {
                             $lang = 'tw';
                         }
                     } else {
                         $lang = 'tw';
                     }
                 }
                 //取得語言設定檔
                 $langPath = dirname(__DIR__) . "\\..\\..\\..\\..\\public\\include\\language\\";
                 $langPath .= !empty($_POST["selectLang"]) ? $_POST["selectLang"] : $lang;
                 $langPath .= ".ini";
                 if (!file_exists($langPath)) {
                     $langPath = str_replace("\\", "/", $langPath);
                 }
                 if (file_exists($langPath)) {
                     $action["langContent"] = $VTs->GetINIInfo($langPath, "", "", "", true);
                     $action["status"] = true;
                 } else {
                     $action["msg"] = 'Lang File is not Find';
                 }
                 $action["lang"] = $lang;
                 break;
                 //取得語言設定檔
             //取得語言設定檔
             case "getLanContent":
                 if (!empty($_POST["selectLang"])) {
                     $langPath = dirname(__DIR__) . "\\..\\..\\..\\..\\public\\include\\language\\" . $_POST["selectLang"] . ".ini";
                     if (!file_exists($langPath)) {
                         $langPath = str_replace("\\", "/", $langPath);
                     }
                     if (file_exists($langPath)) {
                         $action["langContent"] = $VTs->GetINIInfo($langPath, "", "", "", true);
                         $action["status"] = true;
                     } else {
                         $action["msg"] = 'Lang File is not Find';
                     }
                 } else {
                     $action["msg"] = 'Lang Select is Empty';
                 }
                 break;
         }
     }
     $pageContent = $VTs->Data2Json($action);
     //----BI結束----
     $VTs = null;
     $this->viewContnet['pageContent'] = $pageContent;
     return new ViewModel($this->viewContnet);
 }
 public function exitotherselectitemAction()
 {
     $VTs = new clsSystem();
     //先初始化
     $VTs->initialization();
     //-----------BI開始------------
     try {
         $action = [];
         $action["status"] = false;
         $petitionlist_id = "";
         $strSQL = "select * from el_exit_type where uid not in (3,5) order by uid asc";
         $data = $VTs->QueryData($strSQL);
         if (!empty($data)) {
             $action["list"] = $data;
             $action["status"] = true;
         } else {
             $action["msg"] = "select item is empty";
         }
     } 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 getlogoAction()
 {
     $VTs = new clsSystem();
     $VTs->initialization();
     try {
         //-----BI開始-----
         $action = array();
         $action["status"] = false;
         if (!empty($_SESSION["uuid"]) and !empty($_SESSION["userName"])) {
             $logoPath = dirname(__DIR__) . "\\..\\..\\..\\..\\public\\include\\pageSetting\\styles\\logo\\logoContent.html";
             $logoStyle = $VTs->GetHtmlContent($logoPath);
             $action["logoString"] = $logoStyle;
             $action["status"] = true;
         } else {
             $action["msg"] = 'Please Login Again!';
         }
         $pageContent = $VTs->Data2Json($action);
         //-----BI結束-----
     } catch (Exception $error) {
         //依據Controller, Action補上對應位置, $error->getMessage()為固定部份
         $VTs->WriteLog("PageactionController", "acinfoAction", $error->getMessage());
     }
     $VTs = null;
     $this->viewContnet['pageContent'] = $pageContent;
     return new ViewModel($this->viewContnet);
 }
 public function getcphotolisthtmlAction()
 {
     $VTs = new clsSystem();
     $VTs->initialization();
     try {
         //-----BI開始-----  index QC審查首頁
         //取得html
         // $mpath=dirname(__DIR__) . "\\..\\..\\..\\..\\public\\include\\pageSetting\\qc\\photolist.html";
         $trpath = dirname(__DIR__) . "\\..\\..\\..\\..\\public\\include\\pageSetting\\qc\\cphototr.html";
         // $html=$VTs->GetHtmlContent($mpath);
         $trhtml = $VTs->GetHtmlContent($trpath);
         //取得qc列表
         $data = $_POST["data"];
         $arr_list = $data["checklist"];
         $apurl = $_POST["apurl"];
         //解析列表
         $htmlstr = "";
         $i = 0;
         if (!empty($arr_list)) {
             foreach ($arr_list as $list) {
                 if (!empty($list['imgs'])) {
                     $trs = $trhtml;
                     $trs = str_replace('@@chkdate@@', $list['datec'], $trs);
                     $trs = str_replace('@@d64@@', $list['imgs']['img0'], $trs);
                     $trs = str_replace('@@remark@@', $list['remark'], $trs);
                     $trs = str_replace('@@uid@@', $list['uid'], $trs);
                     $trs = str_replace('@@fl@@', $list['fl'], $trs);
                     $trs = str_replace('@@typec@@', $list['typec'], $trs);
                     $trs = str_replace('@@model@@', $list['model'], $trs);
                     $trs = str_replace('@@area@@', $list['area'], $trs);
                     $trs = str_replace('@@typed@@', $list['typed'], $trs);
                     $htmlstr .= $trs;
                 }
             }
         }
         if ($htmlstr == '') {
             $htmlstr = '無資料';
         }
         $pageContent = $htmlstr;
         //-----BI結束-----
     } catch (Exception $error) {
         //依據Controller, Action補上對應位置, $error->getMessage()為固定部份
         $VTs->WriteLog("IndexController", "indexAction", $error->getMessage());
     }
     //關閉資料庫連線
     $VTs->DBClose();
     //釋放
     $VTs = null;
     $this->viewContnet['pageContent'] = $pageContent;
     return new ViewModel($this->viewContnet);
 }
 public function editPageAction()
 {
     $VTs = new clsSystem();
     $VTs->initialization();
     try {
         //-----BI開始-----
         $pathString = dirname(__DIR__) . "\\..\\..\\..\\..\\public\\include\\pageSetting";
         if (empty($_SESSION)) {
             $pagePath = $pathString . "\\index\\login_page.html";
             $pageContent = $VTs->GetHtmlContent($pagePath);
         } else {
             if (!empty($_POST)) {
                 $apurl = "http://211.21.170.18:99";
                 //$apurl = "http://127.0.0.1:99";
                 $action = $_POST["action"];
                 // echo $action;
                 $editPagePath = $pathString . "\\employeemanage\\newPage.html";
                 $editPage = $VTs->GetHtmlContent($editPagePath);
                 switch ($action) {
                     case "insertData":
                         $basicInfoPagePath = $pathString . "\\employeemanage\\basicInfo.html";
                         break;
                     case "updateData":
                         $basicInfoPagePath = $pathString . "\\employeemanage\\basicInfo_edit.html";
                         break;
                     default:
                 }
                 $basicInfoPage = $VTs->GetHtmlContent($basicInfoPagePath);
                 $addressPagePath = $pathString . "\\employeemanage\\address.html";
                 $addressPage = $VTs->GetHtmlContent($addressPagePath);
                 $communicationPagePath = $pathString . "\\employeemanage\\communication.html";
                 $communicationPage = $VTs->GetHtmlContent($communicationPagePath);
                 $dataArr = ["userName" => $_SESSION["userName"], "basicInfo" => $basicInfoPage, "address" => $addressPage, "communication" => $communicationPage];
                 $editPage = $VTs->ContentReplace($dataArr, $editPage);
                 switch ($action) {
                     case "insertData":
                         $optionData = $VTs->json2data($VTs->UrlDAtaGet($apurl . "/employeemanage/getdata?type=relationOption"));
                         // $VTs->debug($option);
                         $selectElement = "<select id='relation'><option value='0'>-請選擇-</option>";
                         if (!empty($optionData)) {
                             foreach ($optionData->dataList as $data) {
                                 $optionElement = "<option value='" . $data->uid . "'>" . $data->relation . "</option>";
                                 $selectElement .= $optionElement;
                             }
                         } else {
                             // echo "AP Action getdata has problem.";
                         }
                         $selectElement .= "</select>";
                         //basicInfo
                         $dataArr = ["name" => "", "sid" => "", "birthday" => ""];
                         $editPage = $VTs->ContentReplace($dataArr, $editPage);
                         //address
                         $dataArr = ["zip" => "", "city" => "", "area" => "", "vil" => "", "verge" => "", "road" => "", "addr" => ""];
                         $editPage = $VTs->ContentReplace($dataArr, $editPage);
                         //communication
                         $dataArr = ["belong" => "", "relation" => $selectElement, "relation1" => "", "mobile" => "", "tel_h" => "", "tel_o" => "", "tel_ext" => "", "email" => ""];
                         $editPage = $VTs->ContentReplace($dataArr, $editPage);
                         //function arg
                         $dataArr = ["action" => $action, "uid" => ""];
                         $editPage = $VTs->ContentReplace($dataArr, $editPage);
                         $pageContent = $editPage;
                         break;
                     case "updateData":
                         $uid = $_POST["uid"];
                         // echo "uid: ".$uid;
                         $arr = $VTs->json2data($VTs->UrlDataGet($apurl . "/employeemanage/getdata?uid=" . $uid . ""));
                         if ($arr->status) {
                             // $VTs->debug($arr);
                             $optionData = $VTs->json2data($VTs->UrlDAtaGet($apurl . "/employeemanage/getdata?type=relationOption"));
                             $selectElement = "<select id='relation'><option value='0'>-請選擇-</option>";
                             foreach ($optionData->dataList as $data) {
                                 if ($arr->dataList[0]->relation == $data->relation) {
                                     $optionElement = "<option value='" . $data->uid . "' selected>" . $data->relation . "</option>";
                                 } else {
                                     $optionElement = "<option value='" . $data->uid . "'>" . $data->relation . "</option>";
                                 }
                                 $selectElement .= $optionElement;
                             }
                             $selectElement .= "</select>";
                             //basicInfo
                             $basicDataArr = ["name" => $arr->dataList[0]->name, "sid" => $arr->dataList[0]->sid, "sex" => $arr->dataList[0]->sex, "birthday" => $arr->dataList[0]->birthday];
                             $editPage = $VTs->ContentReplace($basicDataArr, $editPage);
                             //address
                             $addressDataArr = ["zip" => $arr->dataList[0]->zip, "city" => $arr->dataList[0]->city, "area" => $arr->dataList[0]->area, "vil" => $arr->dataList[0]->vil, "verge" => $arr->dataList[0]->verge, "road" => $arr->dataList[0]->road, "addr" => $arr->dataList[0]->addr];
                             $editPage = $VTs->ContentReplace($addressDataArr, $editPage);
                             //commonication
                             $communicatonDataArr = ["belong" => $arr->dataList[0]->belong, "relation" => $selectElement, "relation1" => $arr->dataList[0]->relation1, "mobile" => $arr->dataList[0]->mobile, "tel_h" => $arr->dataList[0]->tel_h, "tel_o" => $arr->dataList[0]->tel_o, "tel_ext" => $arr->dataList[0]->tel_ext, "email" => $arr->dataList[0]->email];
                             $editPage = $VTs->ContentReplace($communicatonDataArr, $editPage);
                             //function arg
                             $dataArr = ["action" => $action, "uid" => ", '" . $uid . "'"];
                             $editPage = $VTs->ContentReplace($dataArr, $editPage);
                             $pageContent = $editPage;
                         } else {
                             $pageContent = "Query has error!";
                         }
                         break;
                     default:
                         $pageContent = "EditPage action has error!";
                 }
             }
         }
         //----BI結束----
     } catch (Exception $error) {
         //依據Controller, Action補上對應位置, $error->getMessage()為固定部份
         $VTs->WriteLog("EmployeemanageController", "editPageAction", $error->getMessage());
     }
     $VTs = null;
     $this->viewContnet['pageContent'] = $pageContent;
     return new ViewModel($this->viewContnet);
 }
 public function getpurchaseimgAction()
 {
     $VTs = new clsSystem();
     $VTs->initialization();
     try {
         //-----BI開始-----
         $action = [];
         $action["status"] = false;
         if ($_GET["uid"]) {
             //先取出照片檔名
             $strSQL = "select b.imgfile from el_petition as a ";
             $strSQL .= "left join el_purchase_img as b on a.purchase = b.uid ";
             $strSQL .= "where a.uid = '" . $_GET["uid"] . "'";
             $imgFileData = $VTs->QueryData($strSQL);
             $imgFileData = $imgFileData[0]["imgfile"];
             //CreateDirectory
             $filePath = dirname(__DIR__) . "\\..\\..\\..\\..\\public\\purchase_img\\";
             if (file_exists($filePath)) {
                 $filePath .= $imgFileData;
                 $imgArr = $VTs->GetINIInfo($filePath, "", "", "", true);
                 $action["imgs"] = $imgArr;
             } else {
                 $filePath = str_replace("\\", "/", $filePath);
                 if (file_exists($filePath)) {
                     $filePath .= $imgFileData;
                     $imgArr = $VTs->GetINIInfo($filePath, "", "", "", true);
                     $action["imgs"] = $imgArr;
                 } else {
                     $action["msg"] = 'Can not find img files';
                     //$action["test"] = $filePath;
                 }
             }
             //再取出對應說明
             $strSQL = "select uid,img_number,purchase_number,purchase_count from el_purchase where petition_id = '" . $_GET["uid"] . "'";
             $imgMemo = $VTs->QueryData($strSQL);
             $tmpImgMemo = [];
             foreach ($imgMemo as $content) {
                 $tmpImgMemo[$content["img_number"]] = ["uid" => $content["uid"], "purchase_number" => $content["purchase_number"], "purchase_count" => $content["purchase_count"]];
             }
             $action["imgMemo"] = (object) $tmpImgMemo;
             //$action["test"] = $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 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 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 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 indexAction()
 {
     $VTs = new clsSystem();
     $VTs->initialization();
     try {
         //-----BI開始-----
         $pathString = dirname(__DIR__) . "\\..\\..\\..\\..\\public\\include\\pageSetting";
         if (empty($_SESSION)) {
             $pagePath = $pathString . "\\index\\login_page.html";
             $pageContent = $VTs->GetHtmlContent($pagePath);
         } else {
             $indexPath = $pathString . "\\engineeringManage\\index.html";
             $index = $VTs->GetHtmlContent($indexPath);
             //登入者
             $dataArr = ["userName" => $_SESSION["userName"]];
             $index = $VTs->ContentReplace($dataArr, $index);
             //畫面
             $engIndexAreaPath = $pathString . "\\engineeringManage\\engIndexArea.html";
             $engIndexArea = $VTs->GetHtmlContent($engIndexAreaPath);
             $engEditAreaPath = $pathString . "\\engineeringManage\\engEditArea.html";
             $engEditArea = $VTs->GetHtmlContent($engEditAreaPath);
             $spaceIndexAreaPath = $pathString . "\\engineeringManage\\spaceIndexArea.html";
             $spaceIndexArea = $VTs->GetHtmlContent($spaceIndexAreaPath);
             $spaceEditAreaPath = $pathString . "\\engineeringManage\\spaceEditArea.html";
             $spaceEditArea = $VTs->GetHtmlContent($spaceEditAreaPath);
             $dataArr = ["eng_index_area" => $engIndexArea, "eng_edit_area" => $engEditArea, "space_index_area" => $spaceIndexArea, "space_edit_area" => $spaceEditArea];
             $index = $VTs->ContentReplace($dataArr, $index);
             $pageContent = $index;
         }
         //----BI結束----
     } catch (Exception $error) {
         //依據Controller, Action補上對應位置, $error->getMessage()為固定部份
         $VTs->WriteLog("EngineeringmanageController", "indexAction", $error->getMessage());
     }
     $VTs = null;
     $this->viewContnet['pageContent'] = $pageContent;
     return new ViewModel($this->viewContnet);
 }
 public function reportAction()
 {
     $VTs = new clsSystem();
     //先初始化
     $VTs->initialization('');
     try {
         //-----------BI開始------------
         $arr = array();
         $arr["status"] = false;
         // $nowDate = $VTs->DateTime("CTime");
         $nowDate = isset($_POST["date"]) ? $_POST["date"] : $VTs->DateTime("CTime");
         // $nowDate = "2015-12-02";
         $strSQL = "SELECT COUNT(DISTINCT a.suworkid) w_count, b.suid, b.worksid, c.name supply_name, d.name work_type \n\t\t\t\t\t\t\tFROM su_checktime AS a \n\t\t\t\t\t\t\t\tJOIN su_worker AS b ON a.suworkid=b.uid\n\t\t\t\t\t\t\t\tJOIN su_supply AS c ON b.suid=c.uid\n\t\t\t\t\t\t\t\tJOIN su_type_works AS d ON b.worksid=d.uid\n\t\t\t\t\t\t\tWHERE iotime LIKE '" . $nowDate . "%' \n\t\t\t\t\t\t\tGROUP BY b.suid, b.worksid\n\t\t\t\t\t\t\tORDER BY b.worksid";
         // echo $strSQL;
         // exit;
         $data = $VTs->QueryData($strSQL);
         if (!empty($data)) {
             $arr["status"] = true;
             $arr["data"] = $data;
         }
         $pageContent = $VTs->Data2Json($arr);
         // $pageContent = '[{"w_count":"10","suid":"1","worksid":"2","supply_name":"\u4e1e\u90b5\u71df\u5efa\u5de5\u7a0b\u516c\u53f8","work_type":"\u92fc\u7b4b"},
         // {"w_count":"8","suid":"2","worksid":"2","supply_name":"\u6b63\u4e2d\u71df\u5efa\u5de5\u7a0b\u516c\u53f8","work_type":"\u92fc\u7b4b"},
         // {"w_count":"5","suid":"2","worksid":"3","supply_name":"\u6b63\u4e2d\u71df\u5efa\u5de5\u7a0b\u516c\u53f8","work_type":"\u6df7\u6ce5\u571f"},
         // {"w_count":"20","suid":"1","worksid":"3","supply_name":"\u4e1e\u90b5\u71df\u5efa\u5de5\u7a0b\u516c\u53f8","work_type":"\u6df7\u6ce5\u571f"}]';
         //-----------BI結束------------
     } catch (Exception $error) {
         //依據Controller, Action補上對應位置, $error->getMessage()為固定部份
         $VTs->WriteLog("SARController", "reportAction", $error->getMessage());
     }
     //關閉資料庫連線
     $VTs->DBClose();
     //釋放
     $VTs = null;
     $this->viewContnet['pageContent'] = $pageContent;
     return new ViewModel($this->viewContnet);
 }
 public function photocountAction()
 {
     $VTs = new clsSystem();
     $VTs->initialization();
     try {
         //-----BI開始-----
         $action = [];
         $action["status"] = false;
         if (isset($_GET["datel"])) {
             $datel = $_GET['datel'];
             if ($datel == 0) {
                 $datel = date("Y-m-d");
             }
             $strSQL = "\n\t            \tSELECT count(t1.uid) AS count\n\t            \tFROM qc_checklist AS t1\n\t\t\t\t\tLEFT JOIN el_petition AS t2 ON t2.uid=t1.dataid\n\t\t\t\t\tLEFT JOIN prj_materiel AS t3 ON t2.prj_mid=t3.uid \n\t\t\t\t\tLEFT JOIN prj_materiel_items AS t4 ON t3.uid=t4.prj_mid\n\t\t\t\t\tLEFT JOIN el_materiel AS t5 ON t4.materielid=t5.uid\n\t\t\t\t\tLEFT JOIN img_picture AS t6 ON t1.imgid = t6.uid\n\t\t\t\t\twhere t1.imgid is not null AND t1.typeid=1\n\t\t\t\t\tAND to_days(t1.datec)=to_days('" . $datel . "')\n\t\t\t\t\torder by t1.uid desc;\n\t\t\t\t";
             $arr = $VTs->QueryData($strSQL);
             if ($arr[0]["count"]) {
                 $action["count"] = $arr[0]["count"];
             } else {
                 $action["count"] = 0;
             }
             $action["status"] = ture;
         } else {
             $action["msg"] = "尚未設定日期";
         }
         //-----BI結束-----
         $pageContent = $VTs->Data2Json($action);
     } catch (Exception $error) {
         //依據Controller, Action補上對應位置, $error->getMessage()為固定部份
         $VTs->WriteLog("IndexController", "indexAction", $error->getMessage());
     }
     //關閉資料庫連線
     $VTs->DBClose();
     //釋放
     $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);
 }
Esempio n. 23
0
<?php

//跨網域請求
header("Access-Control-Allow-Origin: *");
include "include/config.php";
use System_APService\clsSystem;
$VTs = new clsSystem();
//先初始化
$VTs->initialization('oauth');
$strSQL = "select * from token where access_token = '" . $_POST["access_token"] . "'";
$data = $VTs->QueryData($strSQL);
//從別的系統登入
if ($data[0]["login_type"] == 1) {
    $strSQL = "select a.uuid,a.userName,a.userMail,b.login_date from thirdparty_oauth a ";
    $strSQL .= "left join token b on a.uuid = b.uuid ";
    $strSQL .= "where a.uuid = '" . $data[0]["uuid"] . "'";
    $data = $VTs->QueryData($strSQL);
} else {
    if ($data[0]["login_type"] == 0) {
        $strSQL = "select b.uuid,b.userName,b.userMail,login_date from token a ";
        $strSQL .= "left join account b on a.uuid = b.uuid ";
        $strSQL .= " where a.uuid = '" . $data[0]["uuid"] . "'";
        $data = $VTs->QueryData($strSQL);
    }
}
//$basis->debug($data[0]);
echo $VTs->Data2Json($data[0]);
$VTs = null;
 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 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 sendemailAction()
 {
     //session_start();
     $VTs = new clsSystem();
     $VTs->initialization();
     try {
         $data = $_POST['data'];
         $str = "廠商資訊" . "\n";
         $str = "訂單編號:" . 'AA0000' . $data['uid'] . "\n";
         $str .= "公司名稱:" . $data['cpname'] . "\n";
         $str .= "品項:" . $data['mname'] . "\n";
         $str .= "數量:" . $data['count'] . "\n";
         $str .= "聯絡人:" . $data['keyman'] . "\n";
         $str .= "電話:" . $data['mobile'] . "\n";
         $str .= "===========================\n";
         $str .= "申請人資訊\n";
         $str .= "申請人:" . $data['aname'] . "\n";
         $str .= "電話:" . $data['amobile'] . "\n";
         $str .= "放置地點:" . $data['place'] . "\n";
         $str .= "施作部位:" . $data['place_work'] . "\n";
         $str .= "預計進場時間:" . $data['date'] . "\n";
         $VTs->Tomail("veracity.core.gmail.com", "*****@*****.**", "訂貨", $str);
         $html = 'sendEmail';
         //印出html
         $pageContent = $html;
         //-----BI結束-----
     } catch (Exception $error) {
         //依據Controller, Action補上對應位置, $error->getMessage()為固定部份
         $VTs->WriteLog("IndexController", "indexAction", $error->getMessage());
     }
     //關閉資料庫連線
     $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);
 }
 public function ListAction()
 {
     $VTs = new clsSystem();
     $VTs->initialization('oldhouseDB');
     try {
         //-----BI開始-----
         $strSQL = "SELECT t2.`hname`, t2.`htel`, t2.`hmobil`,\n                               t2.`ZipCode`, t2.`City`, t2.`Area`, t2.`Vil`, t2.`Verge`, t2.`Road`, t2.`addr`,\n                               t3.desc 'strType', t4.desc 'scale', t5.desc 'type', t1.date, t8.name 'ename', t7.`licenseid` 'license'\n                        FROM qc_info AS t1\n                            LEFT JOIN qc_house AS t2 ON t2.uid = t1.`huid`\n                            LEFT JOIN house_type AS t3 ON t3.`uid` = t1.htid\n                            LEFT JOIN house_type_model AS T4 ON t4.uid = t1.`htmid1`\n                            LEFT JOIN house_type_structure AS t5 ON t5.uid = t1.htsid\n                            LEFT JOIN `eng_engineer_city` AS t6 ON t6.uid = t2.`ecid`\n                            LEFT JOIN `eng_engineer` AS t7 ON t7.uid = t6.`eid`\n                            LEFT JOIN `ass_common` AS t8 ON t8.uid = t7.`cmid`";
         $data = $VTs->QueryData($strSQL);
         //$VTs->Debug($data);
         //$Path = "D:\\php_dev\\AP-Service\\public\\old_house_pdf\\";
         $Path = "..\\old_house_pdf\\";
         $link_html = "";
         if (!empty($data)) {
             foreach ($data as $key => $value) {
                 $mainFile = $Path . $value["hname"] . "-" . $value["htel"] . ".pdf";
                 $imgsFile = $Path . $value["hname"] . "-" . $value["htel"] . "-imgs.pdf";
                 //$link = $value["hname"]."-".$value["htel"]."<a href = '".$filePath."'>下載PDF</a><br>";
                 $link = $value["ZipCode"] . $value["City"] . $value["Area"] . $value["Vil"] . $value["Verge"] . $value["Road"] . $value["addr"] . "<a href = '" . $mainFile . "'>下載PDF</a>_<a href = '" . $imgsFile . "'>下載PDF</a><br>";
                 $link_html .= $link;
             }
         }
         //-----BI結束-----
     } catch (Exception $error) {
         //依據Controller, Action補上對應位置, $error->getMessage()為固定部份
         $VTs->WriteLog("IndexController", "indexAction", $error->getMessage());
     }
     //關閉資料庫連線
     $VTs->DBClose();
     //釋放
     $VTs = null;
     $this->viewContnet['pageContent'] = $link_html;
     return new ViewModel($this->viewContnet);
 }
 public function laborsafetyAction()
 {
     //session_start();
     $SysClass = new clsSystem();
     $SysClass->initialization();
     //-----BI開始-----  
     try {
         // $html_path=dirname(__DIR__) . "\\..\\..\\..\\..\\public\\include\\pageSetting\\logbook\\laborsafety.html";
         // $html=$SysClass->GetHtmlContent($html_path);
         $laborsafety = $_POST['data'];
         if (empty($laborsafety['dates'])) {
             if (empty($laborsafety['fifth']) && empty($laborsafety['seventh'])) {
                 $arrdata = ["isnew" => 1, "fifth" => '', "seventh" => ''];
             } else {
                 $arrdata['isnew'] = 0;
                 if (!empty($laborsafety['fifth'])) {
                     $arrdata['fifth'] = $laborsafety['fifth']['contents'];
                 } else {
                     $arrdata['fifth'] = '';
                 }
                 if (!empty($laborsafety['seventh'])) {
                     $arrdata['seventh'] = $laborsafety['seventh']['contents'];
                 } else {
                     $arrdata['seventh'] = '';
                 }
             }
             // $html=$SysClass->ContentReplace($arrdata,$html);
         } else {
             $html = "主任已確認,資料無法再進行修改";
         }
         // $pageContent = $
         // foreach($arr_data as  $data) {
         //      $trs=$tr;
         //     $trs=str_replace('@@no@@',$data['no'],$trs);
         //     $trs=str_replace('@@date@@',$data['date'],$trs);
         //     $trs=str_replace('@@uid@@',$data['uid'],$trs);
         //     $trstr.=$trs;
         // }
         // $html=str_replace('@@tr@@',$trstr,$html);
         $pageContent = $html;
         //-----BI結束-----
     } catch (Exception $error) {
         //依據Controller, Action補上對應位置, $error->getMessage()為固定部份
         $SysClass->WriteLog("IndexController", "indexAction", $error->getMessage());
     }
     //關閉資料庫連線
     $SysClass->DBClose();
     //釋放
     $SysClass = null;
     $this->viewContnet['pageContent'] = $pageContent;
     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);
 }