<?php include_once "../class/Config.php"; include_once "../class/AssetType.php"; $editType = new AssetType(); $dbType = new config(); $editId = $_GET["id"]; //$editId = "14"; $editType->setId($editId); $arr = $editType->getEditAssetType(); $data_array = array(); $no = 1; $stat = 0; while ($res = $dbType->fetch_object($arr)) { /* $selDate = $res->assetTypeAddDate; $dateM = substr($selDate,4,6); $text = substr($selDate,0,4); $year = $text+543; $dateType = $year."".$dateM; $datetime = DateTime::createFromFormat('Y-m-d',$dateType); $dateT = $datetime->format('d/m/Y'); */ $data_array[$res->id]['id'] = $res->id; $data_array[$res->id]['assetTypeCode'] = $res->assetTypeCode; $data_array[$res->id]['assetTypeName'] = $res->assetTypeName; } echo json_encode($data_array);
<?php include_once "../class/Config.php"; include_once "../class/CheckAsset.php"; $checkAsset = new CheckAsset(); $dbAsset = new config(); $checkId = $_GET["checkId"]; //$checkId = "6"; $checkAsset->setCheckId($checkId); $arr = $checkAsset->getCheckAssetById(); $data_array = array(); $no = 0; while ($res = $dbAsset->fetch_object($arr)) { if ($res->checkStatus == "Y") { $stat = "ใช้งานได้"; } else { if ($res->checkStatus == "N") { $stat = "ชำรุด"; } else { if ($res->checkStatus == "D") { $stat = "เสื่อมสภาพ"; } else { if ($res->checkStatus == null) { $stat = "-"; } } } } $selDate = $res->assetAddDate; $newYear = $res->assetYear; $dateM = substr($selDate, 4, 6);
<?php include_once "../class/Config.php"; include_once "../class/AssetGroup.php"; $editGroup = new AssetGroup(); $dbGroup = new config(); $editId = $_GET["id"]; //$editId = "01"; $editGroup->setId($editId); $arr = $editGroup->getEditAssetGroup(); $data_array = array(); $no = 1; $stat = 0; while ($res = $dbGroup->fetch_object($arr)) { $data_array[$res->id]['id'] = $res->id; $data_array[$res->id]['assetGroupCode'] = $res->assetGroupCode; $data_array[$res->id]['assetGroupName'] = $res->assetGroupName; $data_array[$res->id]['assetTypeCode'] = $res->assetTypeCode; } echo json_encode($data_array);
<?php include_once "../class/Config.php"; include_once "../class/User.php"; $editUser = new User(); $dbss = new config(); $editId = $_GET["id"]; $arr = $editUser->getEditUser($editId); $data_array = array(); $no = 1; $stat = 0; while ($res = $dbss->fetch_object($arr)) { $data_array[$res->id]['id'] = $res->id; $data_array[$res->id]['username'] = $res->username; $data_array[$res->id]['firstName'] = $res->firstName; $data_array[$res->id]['lastName'] = $res->lastName; $data_array[$res->id]['position'] = $res->position; if ($res->status == "Administrator") { $stat = 1; $data_array[$res->id]['status'] = $stat; } else { if ($res->status == "Officer") { $stat = 2; $data_array[$res->id]['status'] = $stat; } else { $stat = 0; $data_array[$res->id]['status'] = $stat; } } //$data_array[$res->id]['status'] = $res->status; }