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 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 editorAction()
 {
     $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 {
             //取得html
             $mpath = dirname(__DIR__) . "\\..\\..\\..\\..\\public\\include\\pageSetting\\supply\\editor.html";
             $html = $VTs->GetHtmlContent($mpath);
             $arrdata["userName"] = $_SESSION['userName'];
             $html = $VTs->ContentReplace($arrdata, $html);
             // $html='';
             $pageContent = $html;
         }
         //-----BI結束-----
     } catch (Exception $error) {
         //依據Controller, Action補上對應位置, $error->getMessage()為固定部份
         $VTs->WriteLog("SupplyController", "editorAction", $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開始-----
         $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 setcontentAction()
 {
     //session_start();
     $SysClass = new clsSystem();
     $SysClass->initialization();
     try {
         //-----BI開始-----  get prjuid 傳入廠商ID 回傳品項html option內容
         //取得主頁html
         $mpath = dirname(__DIR__) . "\\..\\..\\..\\..\\public\\include\\pageSetting\\logbook\\setcontent.html";
         $html = $SysClass->GetHtmlContent($mpath);
         $data = $_POST['data'];
         $content = $data['content'];
         if (empty($content)) {
             $weekarray = array("日", "一", "二", "三", "四", "五", "六");
             $arrdata = ["no" => '', "today" => date("Y") . "-" . date("m") . "-" . date("d"), "isnew" => 1, "week" => $weekarray[date("w")], "div_inphid" => ''];
             //取得天氣列表
             $arr_weather = $data['weather'];
             $whtml = '';
             foreach ($arr_weather as $weather) {
                 $whtml .= "<option value=" . $weather['uid'] . ">" . $weather['name'] . "</option>";
             }
             $arrdata['amoption'] = $whtml;
             $arrdata['pmoption'] = $whtml;
             $html = $SysClass->ContentReplace($arrdata, $html);
         } else {
             if (!empty($content['dates'])) {
                 $arrdata['div_inphid'] = 'none';
                 $arrdata['disabled'] = 'disabled';
             } else {
                 $arrdata['div_inphid'] = '';
                 $arrdata['disabled'] = '';
             }
             $html = $SysClass->ContentReplace($arrdata, $html);
             $weekarray = array("日", "一", "二", "三", "四", "五", "六");
             $arrdata = ["no" => '表單編號:' . $content['no'], "today" => $content['date'], "isnew" => 0, "week" => $content['week']];
             //取得天氣列表
             $arr_weather = $data['weather'];
             $amhtml = '';
             foreach ($arr_weather as $weather) {
                 if ($content['am_wthid'] == $weather['uid']) {
                     $amhtml .= "<option value=" . $weather['uid'] . " selected>" . $weather['name'] . "</option>";
                 } else {
                     $amhtml .= "<option value=" . $weather['uid'] . ">" . $weather['name'] . "</option>";
                 }
             }
             $pmhtml = '';
             foreach ($arr_weather as $weather) {
                 if ($content['pm_wthid'] == $weather['uid']) {
                     $pmhtml .= "<option value=" . $weather['uid'] . " selected>" . $weather['name'] . "</option>";
                 } else {
                     $pmhtml .= "<option value=" . $weather['uid'] . ">" . $weather['name'] . "</option>";
                 }
             }
             $arrdata['amoption'] = $amhtml;
             $arrdata['pmoption'] = $pmhtml;
             $html = $SysClass->ContentReplace($arrdata, $html);
         }
         //表頭資訊project
         $project = $data["project"];
         // print_r($project);
         $aday = round((strtotime(date('Y-m-d')) - strtotime($project["start"])) / 3600 / 24);
         $sday = $project["pday"] - $aday + $project["cday"];
         $arrdata = ["prjname" => $project["prjname"], "supplyname" => $project["supplyname"], "pday" => $project["pday"], "aday" => $aday, "sday" => $sday, "cday" => $project["cday"], "start" => $project["start"], "end" => $project["end"]];
         $html = $SysClass->ContentReplace($arrdata, $html);
         //進度
         $project = $data["schedule"];
         if (!empty($project['price_tbp'])) {
             $arrdata['tbp'] = $project['price_tbp'] . "%";
         } else {
             $arrdata['tbp'] = '';
         }
         // if(!empty($project['price_twp'])){
         //     $arrdata['twp']=$project['price_twp']."%";
         // }else{
         $arrdata['twp'] = '';
         // }
         //進度管理tr1
         $trpath = dirname(__DIR__) . "\\..\\..\\..\\..\\public\\include\\pageSetting\\logbook\\tr1.html";
         $trhtml = $SysClass->GetHtmlContent($trpath);
         $arr_construction = $data["construction"];
         $strhtml1 = '';
         if (!empty($arr_construction)) {
             foreach ($arr_construction as $construction) {
                 $tr = $trhtml;
                 $tr = str_replace("@@name@@", $construction["n1"], $tr);
                 $tr = str_replace("@@unit@@", $construction["unit1"], $tr);
                 $tr = str_replace("@@pcount@@", number_format($construction["qty_work"], 2), $tr);
                 $tr = str_replace("@@fcount@@", number_format($construction["qty_budget"], 2), $tr);
                 $tr = str_replace("@@qty_s@@", number_format($construction["qty_s"], 2), $tr);
                 $strhtml1 .= $tr;
             }
         }
         $arrdata["tr1"] = $strhtml1;
         $html = $SysClass->ContentReplace($arrdata, $html);
         //材料管理tr2
         $trpath = dirname(__DIR__) . "\\..\\..\\..\\..\\public\\include\\pageSetting\\logbook\\tr2.html";
         $trhtml = $SysClass->GetHtmlContent($trpath);
         $materielcount = $data["materielcount"];
         $strhtml2 = '';
         if (!empty($materielcount)) {
             foreach ($materielcount as $materiel) {
                 $tr = $trhtml;
                 $tr = str_replace("@@name@@", $materiel["name"], $tr);
                 $tr = str_replace("@@unit@@", $materiel["unit"], $tr);
                 $tr = str_replace("@@pcount@@", $materiel["pcount"], $tr);
                 $tr = str_replace("@@incount@@", $materiel["incount"], $tr);
                 $tr = str_replace("@@count@@", $materiel["count"], $tr);
                 $strhtml2 .= $tr;
             }
             //
         }
         $arrdata["tr2"] = $strhtml2;
         $html = $SysClass->ContentReplace($arrdata, $html);
         //取得人員機具管理tr3
         $trpath = dirname(__DIR__) . "\\..\\..\\..\\..\\public\\include\\pageSetting\\logbook\\tr3.html";
         $trhtml = $SysClass->GetHtmlContent($trpath);
         $arr_workcount = $data["workcount"];
         //        print_r($arr_workcount);
         $strhtml3 = '';
         if (!$arr_workcount == null) {
             foreach ($arr_workcount as $workcount) {
                 $tr = $trhtml;
                 $tr = str_replace("@@name@@", $workcount["wtypename"], $tr);
                 $tr = str_replace("@@count@@", $workcount["count"], $tr);
                 // $tr=str_replace("@@count_s@@",$workcount["count_s"],$tr);
                 $tr = str_replace("@@count_s@@", '', $tr);
                 $strhtml3 .= $tr;
             }
         }
         $arrdata["tr3"] = $strhtml3;
         $html = $SysClass->ContentReplace($arrdata, $html);
         //日誌內容content
         $content = $data["fifth"];
         $arrdata = ["fifth" => '', "seventh" => '', "fourth" => $data["fifth"], "sixth" => $data["seventh"]];
         $html = $SysClass->ContentReplace($arrdata, $html);
         //印出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 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 reportAction()
 {
     //echo "targetid:".$_GET["targetid"];
     $VTs = new clsSystem();
     $VTs->initialization('oldhouseDB');
     //-----BI開始-----  
     try {
         $page = $_GET["page"];
         #序號
         $no = 1;
         switch ($page) {
             case "main_page":
                 $html_path = dirname(__DIR__) . "\\..\\..\\..\\..\\public\\include\\pageSetting\\oldhouse\\table-2.html";
                 #主頁面
                 $html = $VTs->GetHtmlContent($html_path);
                 #檢驗基本資料
                 $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', t1.`htmid1`, t1.`htmid2`, 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_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`\n                               where huid = " . $_GET["targetid"] . "\n                               limit 1";
                 $data = $VTs->QueryData($strSQL);
                 //$VTs->Debug($data);
                 $scale1 = !empty($data[0]["htmid1"]) ? " " . $data[0]["htmid1"] . " " : " _ ";
                 $scale2 = !empty($data[0]["htmid2"]) ? " " . $data[0]["htmid2"] . " " : " _ ";
                 #主頁面基本資料置換
                 $dataArr = ["owner" => $data[0]["hname"], "tel" => $data[0]["htel"], "mobile" => $data[0]["hmobil"], "addr" => $data[0]["ZipCode"] . " " . $data[0]["City"] . " " . $data[0]["Area"] . " " . $data[0]["Vil"] . " " . $data[0]["Verge"] . " " . $data[0]["Road"] . " " . $data[0]["addr"], "strType" => $data[0]["strType"], "scale" => "地上" . $scale1 . "層  地下" . $scale2 . "層", "type" => $data[0]["type"], "date" => $data[0]["date"], "ename" => $data[0]["ename"], "license" => $data[0]["license"]];
                 $html = $VTs->ContentReplace($dataArr, $html);
                 //print_r($html);
                 #主頁面量化資料欄位
                 $quantity_tr_path = dirname(__DIR__) . "\\..\\..\\..\\..\\public\\include\\pageSetting\\oldhouse\\tr1.html";
                 $quantity_tr = $VTs->GetHtmlContent($quantity_tr_path);
                 $strSQL = "SELECT t1.uid,\n                            t10.`desc` as eng_str, t11.`desc` as problem, t1.`length`, t1.`width`, t1.`depth`, t1.`area`,\n                             t1.`remark`, t13.`imgfile`, t12.unit1 level\n                            FROM qc_item AS t1\n                             LEFT JOIN qc_info AS t2 ON t2.uid = t1.ifid\n                             LEFT JOIN qc_house AS t3 ON t3.uid = t2.huid\n                              LEFT JOIN house_type AS t4 ON t4.uid = t2.htid\n                             LEFT JOIN house_type_model AS t5 ON t5.uid = t2.htmid1 OR t5.uid = t2.htmid2\n                             LEFT JOIN house_type_structure AS t6 ON t6.uid = t2.htsid\n                             LEFT JOIN eng_engineer_city AS t7 ON t7.uid = t3.ecid\n                             LEFT JOIN eng_engineer AS t8 ON t8.uid = t7.eid\n                             LEFT JOIN ass_common AS t9 ON t9.uid = t8.cmid\n                             LEFT JOIN eng_str AS t10 ON t10.`uid` = t1.`strid`\n                             LEFT JOIN qc_checkitem AS t11 ON t11.uid = t1.ciid\n                             LEFT JOIN eng_unit AS t12 ON t12.uid = t1.val\n                             LEFT JOIN img_picture AS t13 ON t13.`uid` = t1.`imgids`\n                            WHERE t2.huid = " . $_GET["targetid"] . " AND (t1.`length` > 0 OR t1.width > 0 OR t1.depth > 0 OR t1.`area` > 0)\n                            ORDER BY t1.val DESC, t1.uid ASC";
                 $data = $VTs->QueryData($strSQL);
                 //$VTs->Debug($data[0]);
                 //print_r(count($data));
                 $quantity_html = "";
                 for ($i = 0; $i < count($data); $i++) {
                     //$VTs->Debug($data[$i]);
                     $tr = $quantity_tr;
                     if ($data[$i]["area"] != 0) {
                         $value = "面積:" . $data[$i]["area"];
                     } else {
                         $value = "長:" . $data[$i]["length"] . " 寬:" . $data[$i]["width"] . " 高:" . $data[$i]["depth"];
                     }
                     #讀圖檔
                     $filePath = "C:\\xampp\\htdocs\\AP-Service\\public\\old_house_img\\";
                     //$filePath = "D:\\php_dev\\AP-Service\\public\\old_house_img\\";
                     $filePath .= $data[$i]["imgfile"];
                     //print_r($filePath);
                     if (file_exists($filePath)) {
                         $imgArr = $VTs->GetINIInfo($filePath, "", "", "", true);
                         //$VTs->debug($imgArr["img0"]);
                         // $img = "<img src='".$imgArr["img0"]."' width='60%' />
                         //         <img src='".$imgArr["img1"]."' width='60%' />
                         //         <img src='".$imgArr["img2"]."' width='60%' />";
                         $img = count($imgArr) . "張";
                     } else {
                         $img = "0張";
                     }
                     #替換@@
                     $dataArr = ["no" => $no++, "eng_str" => $data[$i]["eng_str"], "problem" => $data[$i]["problem"], "value" => $value, "remark" => $data[$i]["remark"], "photo" => $img, "level" => $data[$i]["level"]];
                     $tr = $VTs->ContentReplace($dataArr, $tr);
                     $quantity_html .= $tr;
                 }
                 #量化資料End
                 #質化資料
                 $quality_tr_path = dirname(__DIR__) . "\\..\\..\\..\\..\\public\\include\\pageSetting\\oldhouse\\tr2.html";
                 $quality_tr = $VTs->GetHtmlContent($quality_tr_path);
                 $strSQL = "SELECT t1.uid,\n                                    t10.`desc` as eng_str, t11.`desc` as problem, t1.`length`, t1.`width`, t1.`depth`, t1.`area`,\n                                    t1.`remark`, t13.`imgfile`, t12.unit1 level\n                                FROM qc_item AS t1\n                                    LEFT JOIN qc_info AS t2 ON t2.uid = t1.ifid\n                                    LEFT JOIN qc_house AS t3 ON t3.uid = t2.huid\n                                    LEFT JOIN house_type AS t4 ON t4.uid = t2.htid\n                                    LEFT JOIN house_type_model AS t5 ON t5.uid = t2.htmid1 OR t5.uid = t2.htmid2\n                                    LEFT JOIN house_type_structure AS t6 ON t6.uid = t2.htsid\n                                    LEFT JOIN eng_engineer_city AS t7 ON t7.uid = t3.ecid\n                                    LEFT JOIN eng_engineer AS t8 ON t8.uid = t7.eid\n                                    LEFT JOIN ass_common AS t9 ON t9.uid = t8.cmid\n                                    LEFT JOIN eng_str AS t10 ON t10.`uid` = t1.`strid`\n                                    LEFT JOIN qc_checkitem AS t11 ON t11.uid = t1.ciid\n                                    LEFT JOIN eng_unit AS t12 ON t12.uid = t1.val\n                                    LEFT JOIN img_picture AS t13 ON t13.`uid` = t1.`imgids`\n                                WHERE t2.huid = " . $_GET["targetid"] . " AND (t1.`length` = 0 and t1.width = 0 and t1.depth = 0 and t1.`area` = 0)\n                                ORDER BY t1.val DESC, t1.uid ASC";
                 $data = $VTs->QueryData($strSQL);
                 //$VTs->Debug($data);
                 $quality_html = "";
                 for ($i = 0; $i < count($data); $i++) {
                     //$VTs->Debug($data[$i]);
                     $tr = $quality_tr;
                     #讀圖檔
                     $filePath = "C:\\xampp\\htdocs\\AP-Service\\public\\old_house_img\\";
                     //$filePath = "D:\\php_dev\\AP-Service\\public\\old_house_img\\";
                     $filePath .= $data[$i]["imgfile"];
                     //print_r($filePath);
                     if (file_exists($filePath)) {
                         $imgArr = $VTs->GetINIInfo($filePath, "", "", "", true);
                         //$VTs->debug($imgArr["img0"]);
                         // $img = "<img src='".$imgArr["img0"]."' width='60%' />
                         //         <img src='".$imgArr["img1"]."' width='60%' />
                         //         <img src='".$imgArr["img2"]."' width='60%' />";
                         $img = count($imgArr) . "張";
                     } else {
                         $img = "0張";
                     }
                     $dataArr = ["no" => $no++, "eng_str" => $data[$i]["eng_str"], "problem" => $data[$i]["problem"], "value" => $value, "remark" => $data[$i]["remark"], "photo" => $img, "level" => $data[$i]["level"]];
                     $tr = $VTs->ContentReplace($dataArr, $tr);
                     $quality_html .= $tr;
                 }
                 #值化資料End
                 $dataArr = ["quantity" => $quantity_html, "quality" => $quality_html];
                 $html = $VTs->ContentReplace($dataArr, $html);
                 //print_r($html);
                 //$pageContent=$VTs->Data2Json($d);
                 $pageContent = $html;
                 break;
             case "img_page":
                 #圖片頁面
                 $img_html_path = dirname(__DIR__) . "\\..\\..\\..\\..\\public\\include\\pageSetting\\oldhouse\\table-3.html";
                 $img_html = $VTs->GetHtmlContent($img_html_path);
                 $img_page_path = dirname(__DIR__) . "\\..\\..\\..\\..\\public\\include\\pageSetting\\oldhouse\\img_page.html";
                 $img_page = $VTs->GetHtmlContent($img_page_path);
                 #表頭資料
                 $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', t1.`htmid1`, t1.`htmid2`, 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_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`\n                               where huid = " . $_GET["targetid"] . "\n                               limit 1";
                 $data = $VTs->QueryData($strSQL);
                 #圖片頁面header置換
                 $img_header_path = dirname(__DIR__) . "\\..\\..\\..\\..\\public\\include\\pageSetting\\oldhouse\\img_header.html";
                 $img_header = $VTs->GetHtmlContent($img_header_path);
                 $dataArr = ["addr" => $data[0]["ZipCode"] . " " . $data[0]["City"] . " " . $data[0]["Area"] . " " . $data[0]["Vil"] . " " . $data[0]["Verge"] . " " . $data[0]["Road"] . " " . $data[0]["addr"], "date" => $data[0]["date"], "ename" => $data[0]["ename"], "license" => $data[0]["license"]];
                 $img_header = $VTs->ContentReplace($dataArr, $img_header);
                 //print_r($img_header);
                 #量化資料
                 #主頁面量化資料欄位
                 $img_content_path = dirname(__DIR__) . "\\..\\..\\..\\..\\public\\include\\pageSetting\\oldhouse\\img_content.html";
                 $img_content = $VTs->GetHtmlContent($img_content_path);
                 //print_r($img_content);
                 $strSQL = "SELECT t1.uid,\n                            t10.`desc` as eng_str, t11.`desc` as problem, t1.`length`, t1.`width`, t1.`depth`, t1.`area`,\n                             t1.`remark`, t13.`imgfile`, t12.unit1 level\n                            FROM qc_item AS t1\n                             LEFT JOIN qc_info AS t2 ON t2.uid = t1.ifid\n                             LEFT JOIN qc_house AS t3 ON t3.uid = t2.huid\n                              LEFT JOIN house_type AS t4 ON t4.uid = t2.htid\n                             LEFT JOIN house_type_model AS t5 ON t5.uid = t2.htmid1 OR t5.uid = t2.htmid2\n                             LEFT JOIN house_type_structure AS t6 ON t6.uid = t2.htsid\n                             LEFT JOIN eng_engineer_city AS t7 ON t7.uid = t3.ecid\n                             LEFT JOIN eng_engineer AS t8 ON t8.uid = t7.eid\n                             LEFT JOIN ass_common AS t9 ON t9.uid = t8.cmid\n                             LEFT JOIN eng_str AS t10 ON t10.`uid` = t1.`strid`\n                             LEFT JOIN qc_checkitem AS t11 ON t11.uid = t1.ciid\n                             LEFT JOIN eng_unit AS t12 ON t12.uid = t1.val\n                             LEFT JOIN img_picture AS t13 ON t13.`uid` = t1.`imgids`\n                            WHERE t2.huid = " . $_GET["targetid"] . " AND (t1.`length` > 0 OR t1.width > 0 OR t1.depth > 0 OR t1.`area` > 0)\n                            ORDER BY t1.val DESC, t1.uid ASC";
                 $data = $VTs->QueryData($strSQL);
                 //$VTs->Debug($data);
                 $quantity_page = "";
                 for ($i = 0; $i < count($data); $i++) {
                     //$VTs->Debug($data[$i]);
                     $content = $img_content;
                     //print_r($content);
                     if ($data[$i]["area"] != 0) {
                         $value = "面積:" . $data[$i]["area"];
                     } else {
                         $value = "長:" . $data[$i]["length"] . " 寬:" . $data[$i]["width"] . " 高:" . $data[$i]["depth"];
                     }
                     #讀圖檔
                     $filePath = "C:\\xampp\\htdocs\\AP-Service\\public\\old_house_img\\";
                     //$filePath = "D:\\php_dev\\AP-Service\\public\\old_house_img\\";
                     $filePath .= $data[$i]["imgfile"];
                     //print_r("量化圖檔:".$filePath);
                     if (file_exists($filePath)) {
                         $imgArr = $VTs->GetINIInfo($filePath, "", "", "", true);
                         //$VTs->debug($imgArr["img0"]);
                         $img0 = $imgArr["img0"];
                         $img1 = $imgArr["img1"];
                         $img2 = $imgArr["img2"];
                     } else {
                         $img0 = "";
                         $img1 = "";
                         $img2 = "";
                     }
                     #替換@@
                     $dataArr = ["no" => $no++, "eng_str" => $data[$i]["eng_str"], "problem" => $data[$i]["problem"], "value" => $value, "remark" => $data[$i]["remark"], "level" => $data[$i]["level"], "img0" => $img0, "img1" => $img1, "img2" => $img2];
                     $content = $VTs->ContentReplace($dataArr, $content);
                     //print_r($content);
                     $quantity_page .= $img_header . $content;
                 }
                 //print_r($quantity_page);
                 #量化資料End
                 #質化資料
                 $strSQL = "SELECT t1.uid,\n                                    t10.`desc` as eng_str, t11.`desc` as problem, t1.`length`, t1.`width`, t1.`depth`, t1.`area`,\n                                    t1.`remark`, t13.`imgfile`, t12.unit1 level\n                                FROM qc_item AS t1\n                                    LEFT JOIN qc_info AS t2 ON t2.uid = t1.ifid\n                                    LEFT JOIN qc_house AS t3 ON t3.uid = t2.huid\n                                    LEFT JOIN house_type AS t4 ON t4.uid = t2.htid\n                                    LEFT JOIN house_type_model AS t5 ON t5.uid = t2.htmid1 OR t5.uid = t2.htmid2\n                                    LEFT JOIN house_type_structure AS t6 ON t6.uid = t2.htsid\n                                    LEFT JOIN eng_engineer_city AS t7 ON t7.uid = t3.ecid\n                                    LEFT JOIN eng_engineer AS t8 ON t8.uid = t7.eid\n                                    LEFT JOIN ass_common AS t9 ON t9.uid = t8.cmid\n                                    LEFT JOIN eng_str AS t10 ON t10.`uid` = t1.`strid`\n                                    LEFT JOIN qc_checkitem AS t11 ON t11.uid = t1.ciid\n                                    LEFT JOIN eng_unit AS t12 ON t12.uid = t1.val\n                                    LEFT JOIN img_picture AS t13 ON t13.`uid` = t1.`imgids`\n                                WHERE t2.huid = " . $_GET["targetid"] . " AND (t1.`length` = 0 and t1.width = 0 and t1.depth = 0 and t1.`area` = 0)\n                                ORDER BY t1.val DESC, t1.uid ASC";
                 $data = $VTs->QueryData($strSQL);
                 //$VTs->Debug($data);
                 $quality_page = "";
                 for ($i = 0; $i < count($data); $i++) {
                     //$VTs->Debug($data[$i]);
                     $content = $img_content;
                     #讀圖檔
                     $filePath = "C:\\xampp\\htdocs\\AP-Service\\public\\old_house_img\\";
                     //$filePath = "D:\\php_dev\\AP-Service\\public\\old_house_img\\";
                     $filePath .= $data[$i]["imgfile"];
                     //print_r("質化圖檔:".$filePath);
                     if (file_exists($filePath)) {
                         $imgArr = $VTs->GetINIInfo($filePath, "", "", "", true);
                         //$VTs->debug($imgArr["img0"]);
                         $img0 = $imgArr["img0"];
                         $img1 = $imgArr["img1"];
                         $img2 = $imgArr["img2"];
                     } else {
                         $img0 = "";
                         $img1 = "";
                         $img2 = "";
                     }
                     $dataArr = ["no" => $no++, "eng_str" => $data[$i]["eng_str"], "problem" => $data[$i]["problem"], "value" => $value, "remark" => $data[$i]["remark"], "photo" => $img, "level" => $data[$i]["level"], "img0" => $img0, "img1" => $img1, "img2" => $img2];
                     $content = $VTs->ContentReplace($dataArr, $content);
                     $quality_page .= $img_header . $content;
                 }
                 #值化資料End
                 // $dataArr = [
                 //     "img_header" => $img_header,
                 //     "img_content" => $img_content
                 // ];
                 // $img_page = $VTs->ContentReplace($dataArr,$img_page);
                 $dataArr = ["img_page" => $quantity_page . $quality_page];
                 $img_html = $VTs->ContentReplace($dataArr, $img_html);
                 $pageContent = $img_html;
                 break;
         }
         //-----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 chkinfoAction()
 {
     //session_start();
     $VTs = new clsSystem();
     $VTs->initialization();
     try {
         //取得list_info原始html
         $path = dirname(__DIR__) . "\\..\\..\\..\\..\\public\\include\\pageSetting\\material\\list_info.html";
         $html = $VTs->GetHtmlContent($path);
         //接資料
         $data = $_POST['data'];
         //塞資料
         $arrdata = array("uid" => $data['uid'], "no" => 'AA0000' . $data['uid'], "cpname" => $data['cpname'], "keyman" => $data['keyman'], "phone" => $data['mobile'], "mname" => $data['mname'], "count" => $data['count'], "date" => $data['date'], "aname" => $data['aname'], "place" => $data['place'], "mplace" => $data['place_work'], "aphone" => $data['amobile'], "quid" => $data['quid']);
         if ($data['check']) {
             if (!empty($data['datein'])) {
                 $arrdata['btn_check'] = 'none';
                 $arrdata['btn_in'] = 'none';
             } else {
                 $arrdata['btn_check'] = 'none';
                 $arrdata['btn_in'] = '';
             }
         } else {
             $arrdata['btn_check'] = '';
             $arrdata['btn_in'] = 'none';
         }
         $pageContent = $html = $VTs->ContentReplace($arrdata, $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);
 }