//**********************************************
include_once "../class/Asset.php";
include_once "../class/CheckAsset.php";
$updateAsset = new Asset();
$updateChk = new CheckAsset();
$assetId = $_GET["assetId"];
$upAssName = $_GET["upAssName"];
$upAssPrice = $_GET["upAssPrice"];
$upRemark = $_GET["upRemark"];
$upAssAddDate = $_GET["upAddDate"];
$dateM = substr($upAssAddDate, 0, 6);
$month = substr($upAssAddDate, 3, 2);
$text = substr($upAssAddDate, 6, 4);
$YearD = substr($upAssAddDate, 6, 4);
if ($month >= 10 && $month <= 12) {
    $YearD++;
}
$year = $text - 543;
$dateType = $dateM . "" . $year;
$datetime = DateTime::createFromFormat('d/m/yy', $dateType);
$dateT = $datetime->format('Y-m-d');
$updateAsset->setAssetId($assetId);
$updateAsset->setAssetName($upAssName);
$updateAsset->setAssetPrice($upAssPrice);
$updateAsset->setRemark($upRemark);
$updateAsset->setAssetAddDate($dateT);
$updateAsset->setAssetYear($YearD);
$updateAsset->editAsset();
$updateChk->setAssetId($assetId);
$updateChk->setAssetAddDate($dateT);
$updateChk->editCheckAsset();
<?php

include_once "../class/Config.php";
include_once "../class/Asset.php";
$chkAsset = new Asset();
$dbCheck = new config();
//$addGroupCode = $_GET["addGroupCode"];
//$addTypeCode = $_GET["addTypeCode"];
$addYear = $_GET["addYear"];
$addTypeCode = $_GET["addTypeCode"];
$addGroupCode = $_GET["addGroupCode"];
$addAssetCode = $_GET["addAssetCode"];
$chkAsset->setAssetYear($addYear);
$chkAsset->setAssetTypeCode($addTypeCode);
$chkAsset->setAssetGroupCode($addGroupCode);
$chkAsset->setAssetCode($addAssetCode);
$arr = $chkAsset->checkAsset();
$rows = $dbCheck->num_rows($arr);
$i = 0;
if ($rows > $i) {
    echo $rows;
} else {
    echo $i;
}
?>

<?php

include_once "../class/Asset.php";
$updateAsset = new Asset();
$id = $_GET["id"];
$upAssName = $_GET["upAssName"];
$upAssPrice = $_GET["upAssPrice"];
$upRemark = $_GET["upRemark"];
$upAssAddDate = $_GET["upAddDate"];
//$upAssAddDate =  "01/10/2556";
$dateM = substr($upAssAddDate, 0, 6);
$month = substr($upAssAddDate, 3, 2);
$text = substr($upAssAddDate, 6, 4);
$text2 = substr($upAssAddDate, 6, 4);
if ($month >= 10 && $month <= 12) {
    $text2++;
}
$year = $text - 543;
$dateType = $dateM . "" . $year;
$datetime = DateTime::createFromFormat('d/m/yy', $dateType);
$dateT = $datetime->format('Y-m-d');
$updateAsset->setId($id);
$updateAsset->setAssetName($upAssName);
$updateAsset->setAssetPrice($upAssPrice);
$updateAsset->setRemark($upRemark);
$updateAsset->setAssetAddDate($dateT);
$updateAsset->setAssetYear($text2);
$updateAsset->editAsset();
<?php

include_once "../class/Config.php";
include_once "../class/Asset.php";
$genAsset = new Asset();
$db = new config();
$year = $_GET["addYear"];
$type = $_GET["addType"];
$group = $_GET["addGroup"];
/*
	$editId = $_GET["id"];
	$editId = $_GET["id"];
	$editId = $_GET["id"];
	$editId = $_GET["id"];
*/
$genAsset->setAssetYear($year);
$genAsset->setAssetTypeCode($type);
$genAsset->setAssetGroupCode($group);
$arr = $genAsset->getAssetMax();
$data_array = array();
$no = 1;
$stat = 0;
$res = $db->fetch_array($arr);
$code = $res['assetCode'];
$genCode = str_pad($code + 1, 3, "0", STR_PAD_LEFT);
echo $genCode;
include_once "../class/Config.php";
include_once "../class/Asset.php";
$chkAsset = new Asset();
$dbCheck = new config();
$addTypeId = $_GET["assetTypeId"];
$addGroupId = $_GET["assetGroupId"];
$addAssetAddDate = $_GET["assetAddDate"];
$addAssetCode = $_GET["assetCode"];
$dateM = substr($addAssetAddDate, 0, 6);
$day = substr($addAssetAddDate, 0, 2);
$month = substr($addAssetAddDate, 3, 2);
$text = substr($addAssetAddDate, 6, 4);
$text2 = substr($addAssetAddDate, 6, 4);
if ($month >= 10 && $month <= 12) {
    $text2++;
}
$chkAsset->setAssetTypeId($addTypeId);
$chkAsset->setAssetGroupId($addGroupId);
$chkAsset->setAssetCode($addAssetCode);
$chkAsset->setAssetYear($text2);
$arr = $chkAsset->checkAsset();
$rows = $dbCheck->num_rows($arr);
$i = 0;
if ($rows > $i) {
    echo $rows;
} else {
    echo $i;
}
?>