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);
 }
Esempio n. 2
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 exitotherapplyAction()
 {
     $VTs = new clsSystem();
     //先初始化
     $VTs->initialization();
     //-----------BI開始------------
     try {
         $action = [];
         $action["status"] = false;
         //一定需要有type id才可以
         if ($_POST["typeID"] and $_POST["uuid"] and $_POST["prj_mid"] and $_POST["quantity"]) {
             $quantity = $_POST["quantity"];
             $strSQL = "insert into el_exit_petition_other(prj_mid, petitionid, type, datep, date, count) ";
             $strSQL .= "values('" . $_POST["prj_mid"] . "','" . $_POST["uuid"] . "','" . $_POST["typeID"] . "','" . $VTs->DateTime("CTime") . "','" . $_POST["exit_date"] . "', " . $quantity . ");";
             $data = $VTs->ExecuteNonQuery($strSQL);
             //$action["sql"] = $strSQL;
             if ($data) {
                 $action["status"] = true;
             } else {
                 $action["msg"] = "目前無資料";
             }
         } else {
             $action["msg"] = "data is error";
         }
     } catch (Exception $error) {
         //依據Controller, Action補上對應位置, $error->getMessage()為固定部份
         $VTs->WriteLog("IndexController", "indexAction", $error->getMessage());
     }
     $pageContent = $VTs->Data2Json($action);
     //-----------BI結束------------
     //關閉資料庫連線
     $VTs->DBClose();
     //釋放
     $VTs = null;
     $this->viewContnet['pageContent'] = $pageContent;
     return new ViewModel($this->viewContnet);
 }
 public function dbmodifyAction()
 {
     $VTs = new clsSystem();
     //先初始化
     $VTs->initialization('');
     //-----------BI開始------------
     $type = $_POST['type'];
     switch ($type) {
         case "chkorder":
             $strSQL = '';
             $ls_uid = $_POST['id'];
             $arr_uid = explode(",", $ls_uid);
             foreach ($arr_uid as $uid) {
                 $strSQL .= "UPDATE `el_petition` SET `check`=1,`datel`='" . $VTs->DateTime("CTime_Now") . "' WHERE uid=" . $uid . ";";
             }
             $VTs->ExecuteNonQuery($strSQL);
             break;
         case "chkin":
             $uid = $_POST['id'];
             $count = $_POST['count'];
             $strSQL = "UPDATE `el_petition` SET `datein`='" . $VTs->DateTime("CTime_Now") . "' WHERE uid=" . $uid . ";";
             $VTs->ExecuteNonQuery($strSQL);
             $quid = $_POST['quid'];
             $count = $_POST['count'];
             $strSQL = "SELECT count_order,count_in FROM `el_quantity` WHERE uid=" . $quid . ";";
             $d = $VTs->QueryData($strSQL);
             $data = $d[0];
             $count_order = $data['count_order'] - $count;
             $count_in = $data['count_in'] + $count;
             $strSQL = "UPDATE el_quantity SET count_order=" . $count_order . ", count_in =" . $count_in . " WHERE uid=" . $quid . ";";
             $VTs->ExecuteNonQuery($strSQL);
             break;
     }
     //-----------BI結束------------
     //關閉資料庫連線
     $VTs->DBClose();
     //釋放
     $VTs = null;
     return new ViewModel($this->viewContnet);
 }
 public function 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 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 getdailycontentAction()
 {
     $VTs = new clsSystem();
     $VTs->initialization();
     //-----BI開始-----
     $action = array();
     $action["status"] = false;
     $type = $_POST["type"];
     if ($type) {
         switch ($type) {
             case "floor":
                 $strSQL = "select t1.uid,concat(t1.name,'(',t1.code,')') Name ";
                 $strSQL .= "from  eng_str_b t1 ";
                 $strSQL .= "left join eng_set_floor t2 on t2.strid_b=t1.uid ";
                 $strSQL .= "where t2.prjid=" . $_POST["puid"];
                 break;
             case "workitem":
                 $strSQL = "select t2.uid,concat(t2.name,'(',t2.code,')') Name ";
                 $strSQL .= "from eng_worklist_workitem t1 ";
                 $strSQL .= "left join eng_type_c t2 on t2.uid=t1.typeid_c ";
                 $strSQL .= "where t1.strid_b=" . $_POST["floorid"] . " group by t2.code";
                 break;
             case "pacemodel":
                 $strSQL = "select uid,concat(NAME,'(',CODE,')') Name ";
                 $strSQL .= "from eng_pace_model ";
                 $strSQL .= "where typeid_c=" . $_POST["workitemid"];
                 break;
             case "area":
                 $strSQL = "select t2.uid,CONCAT(t2.name,'(',t2.code,')') Name ";
                 $strSQL .= "from eng_worklist_areaitem t1 ";
                 $strSQL .= "left join eng_set_area t2 on t2.uid=t1.areaid ";
                 $strSQL .= "left join eng_worklist_workitem t3 on t3.uid=t1.wl_wiid ";
                 $strSQL .= "where t3.strid_b=" . $_POST["floorid"] . " and t3.p_modelid=" . $_POST["pacemodelid"] . " and t1.datee IS NULL group by t1.areaid";
                 break;
             case "alllist":
                 $strSQL = "select t1.uid,concat(t3.name,' ',t4.name) Name ";
                 $strSQL .= "from eng_worklist_areaitem t1 ";
                 $strSQL .= "left join eng_worklist_workitem t2 ON t2.uid=t1.wl_wiid ";
                 $strSQL .= "left join eng_str_e t3 ON t3.uid=t1.strid_e ";
                 $strSQL .= "left join eng_pace_model t5 ON t5.uid=t2.p_modelid ";
                 $strSQL .= "left join eng_pace_modelitems t6 on t6.uid=t1.p_miid ";
                 $strSQL .= "left join eng_type_d t4 on t4.uid=t6.type_d ";
                 $strSQL .= "where t2.strid_b=" . $_POST["floorid"] . " and t2.typeid_c=" . $_POST["workitemid"] . " and t1.areaid=" . $_POST["areaid"] . " and t6.typeid=0 and t1.datee IS NULL";
                 break;
             case "checkData":
                 if (!empty($_POST["alllistid"])) {
                     $uidStr = "";
                     $strSQL = "";
                     foreach ($_POST["alllistid"] as $content) {
                         $uidStr .= $content . ",";
                         $strSQL .= "insert into qc_checklist (typeid, dataid)VALUES(2, " . $content . ");";
                     }
                     $uidStr = substr($uidStr, 0, strlen($uidStr) - 1);
                     $strSQL .= "update eng_worklist_areaitem SET datee='" . $VTs->DateTime("CTime_Now") . "' WHERE uid in (" . $uidStr . ")";
                     $VTs->ExecuteNonQuery($strSQL);
                     $action["status"] = true;
                 } else {
                     $action["msg"] = 'checkData is Empty';
                     $action["status"] = false;
                 }
                 break;
             case "checkAllListData":
                 if (!empty($_POST["alllistid"])) {
                     $uidStr = "";
                     $strSQL = "";
                     $tmpAllListIDArr = explode(",", $_POST["alllistid"]);
                     foreach ($tmpAllListIDArr as $content) {
                         $strSQL .= "insert into qc_checklist (typeid, dataid)VALUES(2, " . $content . ");";
                     }
                     $uidStr = $_POST["alllistid"];
                     $strSQL .= "update eng_worklist_areaitem SET datee='" . $VTs->DateTime("CTime_Now") . "' WHERE uid in (" . $uidStr . ")";
                     $VTs->ExecuteNonQuery($strSQL);
                     $action["status"] = true;
                 } else {
                     $action["msg"] = 'checkData is Empty';
                     $action["status"] = false;
                 }
                 break;
         }
         if ($type != "checkData") {
             $data = $VTs->QueryData($strSQL);
             $action["daily"] = $data;
             $action["status"] = true;
         }
     } else {
         $action["msg"] = 'type is Empty';
     }
     $pageContent = $VTs->Data2Json($action);
     //-----BI結束-----
     $VTs = null;
     $this->viewContnet['pageContent'] = $pageContent;
     return new ViewModel($this->viewContnet);
 }
 public function dbmodifyAction()
 {
     $VTs = new clsSystem();
     //先初始化
     $VTs->initialization('');
     //-----------BI開始------------
     $strSQL = '';
     $data = $_POST;
     $type = $data['type'];
     switch ($type) {
         case 'laborsafety':
             $strSQL = "UPDATE `eng_diary_contents` SET `contents` = '" . $data["fifth"] . "' WHERE type=2 AND date = '" . date('Y-m-d') . "';";
             $VTs->ExecuteNonQuery($strSQL);
             $strSQL = "UPDATE `eng_diary_contents` SET `contents` = '" . $data["seventh"] . "' WHERE type=4 AND date = '" . date('Y-m-d') . "';";
             $VTs->ExecuteNonQuery($strSQL);
             break;
         case 'diary_info':
             $strSQL = "UPDATE `eng_diary_info` SET `am_wthid` = '" . $data["amwather"] . "', `pm_wthid` = '" . $data["pmwather"] . " WHERE `date` = '" . date('Y-m-d') . ";";
             $VTs->ExecuteNonQuery($strSQL);
             break;
         case 'infocheck':
             $strSQL = "UPDATE `eng_diary_info` SET `dates` = '" . $VTs->DateTime("CTime_Now") . "' WHERE `date` = '" . date('Y/m/d') . "';";
             $VTs->ExecuteNonQuery($strSQL);
             break;
     }
     //       $data=$_POST;
     //       $strSQL="UPDATE `eng_diary_info` SET `am_wthid` = '".$data["amwather"]."', `pm_wthid` = '".$data["pmwather"]." WHERE `date` = '".date('Y-m-d').";";
     //       $VTs->ExecuteNonQuery($strSQL);
     //       $strSQL="SELECT uid FROM eng_diary_info WHERE date='".date("Y")."-".date("m")."-".date("d")."';";
     //       $d = $VTs->QueryData($strSQL);
     //       $iuid=$d[0]['uid'];
     //       $strSQL="UPDATE `eng_diary_contents` SET `fourth` = '".$data["fourth"]."', `fifth` = '".$data["fifth"]."', `sixth` = '".$data["sixth"]."', `seventh` = '".$data["seventh"]."', `eighth` = '".$data["eighth"]."' WHERE iuid = ".$iuid.";";
     // $VTs->ExecuteNonQuery($strSQL);
     //-----------BI結束------------
     //關閉資料庫連線
     $VTs->DBClose();
     //釋放
     $VTs = null;
     return new ViewModel($this->viewContnet);
 }