<?php
require_once("lib/inc.php");
require_once("lib/security.php");
$smarty = new Smarty;
$smarty->compile_check = true;
$smarty->debugging = false;
$title ="::: Show Asset History :::";
$smarty->assign('title',$title);
//echo "bunti";
$date = date("Y-m-d");
$status = $_SESSION['status'];
$user_id = $_SESSION['user_id'];
$smarty->assign('user_id',$user_id);
$row = $database->get_from_database("select * from asset_users where user_id='$user_id'");
$name = $row['full_name'];
$rw = $database->get_from_database("select * from asset_users where user_id='$_SESSION[user_id]'");
$last_login = $rw['last_login'];
$last_logout = $rw['last_logout'];
$smarty->assign('last_login',$last_login);
$smarty->assign('last_logout',$last_logout);
// Date & Time to be dispalyed on the header
$date_time = date("h:i:s A")." ".date("d-m-Y");
$smarty->assign('date_time',$date_time);
// Done
$asset_tag = $_GET['hd83___2y8dh328f____8hhdiw___jd9'];
$result = $database->Execute("select * from asset_history where asset_tag='$asset_tag' ORDER BY serial_id");
$count = mysql_num_rows($result);
if($count > 0)
{
while($row = mysql_fetch_array($result))
{
$eq_id = $row['equipment_id'];
$eq = $database->get_from_database("SELECT * FROM asset_equipment WHERE equipment_id = '$eq_id'");
$eq_name[] = $eq['equipment_name'];
$old_stat = $row['old_status'];
$new_stat = $row['new_status'];
$comment[] = $row['reason'];
switch($old_stat)
{
case 1: $old_status[] = "OK"; break;
case 2: $old_status[] = "Repairing"; break;
case 3: $old_status[] = "Obsolete"; break;
default : $old_status[] = "NA"; break;
}
switch($new_stat)
{
case 1: $new_status[] = "OK"; break;
case 2: $new_status[] = "Repairing"; break;
case 3: $new_status[] = "Obsolete"; break;
default : $new_status[] = "NA"; break;
}
}
}
$smarty->assign('count',$count);
$smarty->assign('eq_name',$eq_name);
$smarty->assign('old_status',$old_status);
$smarty->assign('new_status',$new_status);
$smarty->assign('comment',$comment);
$smarty->display('show_asset_history.tpl');
?>