<?php session_start(); include_once "../class/CheckAsset.php"; $updateChk = new CheckAsset(); $checkId = $_GET["checkId"]; $status = $_GET["status"]; $userId = $_SESSION["id"]; if ($status == "ใช้งานได้") { $stat = "Y"; } else { if ($status == "ชำรุด") { $stat = "N"; } else { if ($status == "เสื่อมสภาพ") { $stat = "D"; } else { $stat = null; } } } $updateChk->setCheckId($checkId); $updateChk->setCheckStatus($stat); $updateChk->setUserId($userId); $updateChk->checkAssetStatus();
$assYear = $yearD + 543; $year = $text - 543; $dateType = $dateM . "" . $year; $datetime = DateTime::createFromFormat('d/m/yy', $dateType); $dateT = $datetime->format('Y-m-d'); if ($assetNum == "") { $addAsset->setValues($assetCode, $assetName, $assetPrice, $assetTypeId, $assetGroupId, $yearD, $assetLocation, $dateT, $remark, $userId); $addAsset->addAsset(); $arr = $addAsset->getAssetIdToCheck($assetTypeId, $assetGroupId, $assetCode); $result = $db->fetch_array($arr); $addCheck->setAssetTypeId($assetTypeId); $addCheck->setAssetGroupId($assetGroupId); $addCheck->setAssetId($result['assetId']); $addCheck->setAssetYear($yearD); $addCheck->setAssetAddDate($dateT); $addCheck->setUserId($userId); $addCheck->addCheckAsset(); } else { if ($assetNum > 1) { $i = 1; $gens = $assetCode; $gen = $gens - 1; while ($i <= $assetNum) { $genCode = str_pad($gen + 1, 3, "0", STR_PAD_LEFT); $addAsset->setValues($genCode, $assetName, $assetPrice, $assetTypeId, $assetGroupId, $yearD, $assetLocation, $dateT, $remark, $userId); $addAsset->addAsset(); $arr = $addAsset->getAssetIdToCheck($assetTypeId, $assetGroupId, $genCode); $result = $db->fetch_array($arr); $addCheck->setAssetTypeId($assetTypeId); $addCheck->setAssetGroupId($assetGroupId); $addCheck->setAssetId($result['assetId']);