<?php 
include_once "../class/Config.php";
include_once "../class/AssetType.php";
$showType = new AssetType();
$dbType = new config();
$arr = $showType->getAssetType();
?>
*
            <select id="addAssetType" onchange="changeType();">
            <option value="00">ประเภทครุภัณฑ์</option>
            <?php 
while ($row = $dbType->fetch_array($arr)) {
    ?>
            <?php 
    echo "<option value='" . $row['assetTypeCode'] . "'>";
    echo $row['assetTypeCode'] . " " . $row['assetTypeName'] . "</option>";
    ?>
      
                <?php 
}
?>
             </select>
           
<?php

include_once "../class/Config.php";
include_once "../class/AssetType.php";
$assType = new AssetType();
$db = new config();
?>
    <table class="table table-bordered">
        <thead>
            <tr>
            	<th style="width: 5%; text-align:center">ลำดับ</th>
                <th style="width: 28%; text-align:center">รหัสประเภทครุภัณฑ์</th>
                <th style="width: 28%; text-align:center">ชื่อประเภทครุภัณฑ์</th>
                <th style="width: 28%; text-align:center">วัน/เดือน/ปี ที่ได้มา</th>
                <th style="width: 10%; text-align:center">แก้ไข</th>
                <th style="width: 10%; text-align:center">ลบ</th>
            </tr>
        </thead>
            <tbody>
            
<?php 
$arr = $assType->getAssetType();
$no = 1;
while ($res = $db->fetch_array($arr)) {
    $datetime = DateTime::createFromFormat('Y-m-d', $res['assetTypeAddDate']);
    $dateT = $datetime->format('d/m/Y');
    $texts = substr($dateT, 6, 4);
    $dates = substr($dateT, 0, 6);
    $years = $texts + 543;
    $showdate = $dates . "" . $years;
    echo "<tr>";
<?php

include_once "../class/Config.php";
include_once "../class/AssetType.php";
$assType = new AssetType();
$db = new config();
?>
    <table class="table table-bordered">
        <thead>
            <tr>
            	<th style="width: 5%; text-align:center">ลำดับ</th>
                <th style="width: 20%; text-align:center">รหัสประเภทครุภัณฑ์</th>
                <th style="width: 55%; text-align:center">ชื่อประเภทครุภัณฑ์</th>
                <th style="width: 10%; text-align:center">แก้ไข</th>
                <th style="width: 10%; text-align:center">ลบ</th>
            </tr>
        </thead>
            <tbody>
            
<?php 
$searchName = $_GET["searchName"];
$arr = $assType->getAssetSearch($searchName);
$no = 1;
while ($res = $db->fetch_array($arr)) {
    echo "<tr>";
    echo "<td id='Uid" . $no . "' style='text-align:center'>" . $no . "</td>";
    echo "<td id='Uuname" . $no . "' style='text-align:center'>" . $res['assetTypeCode'] . "</td>";
    echo "<td id='Ufname" . $no . "'>" . $res['assetTypeName'] . "</td>";
    echo "<td id='Uedit" . $no . "' style='text-align:center'><a class='button icon edit' onClick='getEditType(" . $res['assetTypeId'] . ");'></a></td>";
    echo "<td id='Udel" . $no . "' style='text-align:center'><a class='button icon remove danger' onClick='delType(" . $res['assetTypeId'] . ");'></a></td>";
    echo "</tr>";
<?php

include_once "../class/AssetType.php";
$updateType = new AssetType();
$assetTypeId = $_GET["assetTypeId"];
$TypeName = $_GET["upTypeName"];
$updateType->setAssetTypeId($assetTypeId);
$updateType->setAssetTypeName($TypeName);
$updateType->editAssetType();
//** ชื่อไฟล์ : reqCheckType.php
//** คำอธิบาย : ไฟล์นี้ เป็นไฟล์เช็คค่าซ้ำ
//** Version : 1.0
//** CoddingDate : 13/08/2556
//** Credit : นัฐวุฒิ เผือกทอง
//****************************************************************//
//****************************************************************//
//*************** Check Seesion ****************
session_start();
include_once "../class/User.php";
$user = new User();
if (!$user->getSession()) {
    header("location: ../page/main.php");
}
//**********************************************
include_once "../class/Config.php";
include_once "../class/AssetType.php";
$chkType = new AssetType();
$dbCheck = new config();
$addTypeCode = $_GET["addTypeCode"];
$arr = $chkType->checkAssetType($addTypeCode);
$rows = $dbCheck->num_rows($arr);
$i = 0;
if ($rows > $i) {
    echo $rows;
} else {
    echo $i;
}
?>

<?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/AssetType.php";
$addType = new AssetType();
$addTcode = $_GET["addTypeCode"];
$addTname = $_GET["addTypeName"];
$addTdate = $_GET["addTypeAddDate"];
$dateM = substr($addTdate, 0, 6);
$text = substr($addTdate, 6, 4);
$year = $text - 543;
$dateType = $dateM . "" . $year;
$datetime = DateTime::createFromFormat('d/m/yy', $dateType);
$dateT = $datetime->format('Y-m-d');
$addType->setValues($addTcode, $addTname, $dateT);
$addType->addAssetType();
<?php

include 'class/AssetType.php';
$assettype = new AssetType();
$assettype->setAssetTypeCode('01');
$assettype->setAssetTypeName('sd');
$assettype->insertAssetType();
$assettype->getAssetTypeCode();
$assettype->getAssetTypeName();
<?php

include_once "../class/AssetType.php";
$delType = new AssetType();
$delId = $_GET["id"];
$delType->setId($delId);
$delType->delAssetType();
<?php

include_once "../class/Config.php";
include_once "../class/AssetType.php";
$editType = new AssetType();
$dbType = new config();
$assetTypeId = $_GET["assetTypeId"];
$editType->setAssetTypeId($assetTypeId);
$arr = $editType->getEditAssetType();
$data_array = array();
$no = 0;
$stat = 0;
while ($res = $dbType->fetch_object($arr)) {
    $data_array[$no]['assetTypeId'] = $res->assetTypeId;
    $data_array[$no]['assetTypeCode'] = $res->assetTypeCode;
    $data_array[$no]['assetTypeName'] = $res->assetTypeName;
    $no++;
}
echo json_encode($data_array);
<?php

include_once "../class/AssetType.php";
$updateType = new AssetType();
/*
$id = $_GET["id"];
$upTypeName = $_GET["upFname"];
$ypTypeDate = $_GET["upLname"];
*/
$id = $_GET["id"];
$TypeName = $_GET["upTypeName"];
$TypeDate = $_GET["upTypeDate"];
$dateM = substr($TypeDate, 0, 6);
$text = substr($TypeDate, 6, 4);
$year = $text - 543;
$dateType = $dateM . "" . $year;
$datetime = DateTime::createFromFormat('d/m/yy', $dateType);
$dateT = $datetime->format('Y-m-d');
$updateType->setId($id);
$updateType->setValues(null, $TypeName, $dateT);
$updateType->editAssetType();
<?php

include_once "../class/Config.php";
include_once "../class/AssetType.php";
$assType = new AssetType();
$db = new config();
?>
    <table class="table table-bordered">
        <thead>
            <tr>
            	<th style="width: 5%; text-align:center">ลำดับ</th>
                <th style="width: 20%; text-align:center">รหัสประเภทครุภัณฑ์</th>
                <th style="width: 55%; text-align:center">ชื่อประเภทครุภัณฑ์</th>
                <th style="width: 10%; text-align:center">แก้ไข</th>
                <th style="width: 10%; text-align:center">ลบ</th>
            </tr>
        </thead>
            <tbody>
            
<?php 
$searchName = $_GET["searchName"];
$arr = $assType->getAssetType($searchName);
$no = 1;
while ($res = $db->fetch_array($arr)) {
    echo "<tr>";
    echo "<td id='Uid" . $no . "' style='text-align:center'>" . $no . "</td>";
    echo "<td id='Uuname" . $no . "' style='text-align:center'>" . $res['assetTypeCode'] . "</td>";
    echo "<td id='Ufname" . $no . "'>" . $res['assetTypeName'] . "</td>";
    echo "<td id='Uedit" . $no . "' style='text-align:center'><a class='button icon edit' onClick='getEditType(" . $res['id'] . ");'></a></td>";
    echo "<td id='Udel" . $no . "' style='text-align:center'><a class='button icon remove danger' onClick='delType(" . $res['id'] . ");'></a></td>";
    echo "</tr>";
Example #13
0
                     $barcode = $_GET['barcode'];
                     echo "<br><center>Are you sure?<br>\n\t\t\t\t\t<a href=\"index.php?action=delete&type=asset&barcode={$barcode}&confirm=yes\">Yes</a> \n\t\t\t\t\t<a href=\"index.php\">No</a>\n\t\t\t\t\t</center>";
                 }
             } else {
                 if ($_GET['action'] == 'edit') {
                     $asset->loadEntry($_GET['barcode']);
                     $asset->printForm($_GET['action']);
                 } else {
                     $asset->printForm($_GET['action']);
                 }
             }
         }
     }
 }
 if ($_GET['type'] == 'assettype') {
     $assettype = new AssetType($connection);
     if (isset($_POST['submit'])) {
         if ($_GET['action'] == 'add') {
             $assettype->loadFromPage();
             $assettype->insert();
         } else {
             if ($_GET['action'] == 'edit') {
                 $assettype->loadFromPage();
                 $assettype->update();
             }
         }
     } else {
         if ($_GET['action'] == 'list') {
             $assettype->listAll();
         } else {
             if ($_GET['action'] == 'delete') {