Location: PHPKode > projects > CoreAsset > coreasset/show_asset_history.php
<?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           = $_REQUEST['hd83___2y8dh328f____8hhdiw___jd9'];

/*
$data				 = $database->get_from_database("SELECT equipment_id from asset_assets WHERE asset_tag='$asset_tag'");
$eq_id_list			 = explode(',',$data['equipment_id']); 

$count_equip		 = count($eq_id_list);
//print_r($eq_id_list);
for($i=0 ; $i<$count_equip ; $i++)
{
 	$serial_list	= $database->get_from_database("SELECT * from asset_serial_number WHERE equipment_id = '$eq_id_list[$i]' AND asset_id='$asset_tag'");
	$eq_serial[]	= $serial_list['serial_no'];
	$eq_manufac[]	= $serial_list['manufacturer'];
	$eq_warranty[]	= $serial_list['expiry_date'];
	$eq				= $database->get_from_database("SELECT * FROM asset_equipment WHERE equipment_id = '$eq_id_list[$i]'");
	$eq_name[]		= $eq['equipment_name'];
	$result         = $database->Execute("select * from asset_history where asset_tag='$asset_tag' AND equipment_id = '$eq_id_list[$i]'");
	$count			= mysql_num_rows($result);
	if($count > 0)
	{
	  $count_inner[]		=$count;
	  while($row = mysql_fetch_array($result))
		{
			$eq_id[]							= $row['equipment_id'];
			$old_stat							= $row['old_status'];
			$new_stat							= $row['new_status'];
			$comment[$i][]						= $row['reason'];
			$change_date[$i][]                  = $row['change_date'];
			switch($old_stat)
			{
				case 1: $old_status[$i][]			= "OK"; break;
				case 2: $old_status[$i][]			= "Repairing"; break;
				case 3: $old_status[$i][]			= "Obsolete"; break;
				default : $old_status[$i][]			= "NA"; break;
			}
			switch($new_stat)
			{
				case 1: $new_status[$i][]			= "OK"; break;
				case 2: $new_status[$i][]			= "Repairing"; break;
				case 3: $new_status[$i][]			= "Obsolete"; break;
				default : $new_status[$i][]			= "NA"; break;
			}
		
		}
	}
	else
	{
		$count_inner[]		= 0;
	}

}
*/


   $asset_tag           = $_GET['hd83___2y8dh328f____8hhdiw___jd9'];
   $row                 = $database->get_from_database("select * from asset_assets where asset_tag='$asset_tag'");

   $asset_manufacturer  = $row['asset_manufacturer'];
   $asset_nickname      = $row['asset_nickname'];
   $po_no               = $row['po_no'];
   $asset_price         = $row['asset_price'];
   $asset_description   = $row['asset_description'];
   $receive_date        = $row['receive_date'];
   $vendorid            = $row['vendor_id'];
   $equipmentid         = $row['equipment_id'];
   $u_id                = $row['issued_userid'];
   
   
   // *******************  GETTING VENDOR INFORMATION ***********************************************************
   $vend_id               = $row['vendor_id'];
   $row3                  = $database->get_from_database("select * from asset_vendor where vendor_id='$vend_id'");
   $vendor_name           = $row3['vendor_name'];

   // *******************  GETTING EQUIPMENT INFORMATION *********************************************************
   $eq_id                 = $row['equipment_id'];
   $eq                    = explode(",",$eq_id);

   $manufacturer		= array();
   $expiry_date			= array();
   $depreciation    	= array();
   $eq_price            = array();
   $eq_status           = array();

   foreach($eq as $n=>$v)
   {
    if($v!="")
    {
     $row4				= $database->get_from_database("select * from asset_equipment where equipment_id='$v'");
     $equipment_name[]	= $row4['equipment_name'];
	 $equipment_model[] = $row4['equipment_model'];
	}
   }
	 $res5			   = $database->Execute("select * from asset_serial_number where asset_id='$asset_tag'");
     while($row5	   = mysql_fetch_array($res5))
     {
		 $serial_no[]		= $row5['serial_no'];
		 $manufacturer[]	= $row5['manufacturer']; 
		 $serial_id[]		= $row5['serial_id'];
		 $expiry_date[]		= $row5['expiry_date'];
		 $depreciation[]	= $row5['depreciation'];
		 $eq_price[]		= $row5['equip_price'];
		 $eq_status[]		= $row5['status'];
		 $issud_userid[]	= $row5['issud_userid'];
	 }
	 
   $smarty->assign('asset_tag',$asset_tag);
   $smarty->assign('asset_manufacturer',$asset_manufacturer);
   $smarty->assign('asset_nickname',$asset_nickname);
   $smarty->assign('serial_no',$serial_no);
   $smarty->assign('serial_id',$serial_id);
   $smarty->assign('man',$manufacturer);
   $smarty->assign('expiry_date',$expiry_date);
   $smarty->assign('depreciation',$depreciation);
   $smarty->assign('eq_price',$eq_price);
   $smarty->assign('eq_status',$eq_status);

   //$smarty_assign('manufacturer',$manufacturer);
   $smarty->assign('po_no',$po_no);
   $smarty->assign('asset_price',$asset_price);
   $smarty->assign('asset_description',$asset_description);
   $smarty->assign('receive_date',$receive_date);
   $smarty->assign('vendor_id',$vendor_id);
   $smarty->assign('equi_id',$eq_id);
   $smarty->assign('vendor_name',$vendor_name);
   $smarty->assign('equipment_name',$equipment_name);
   $smarty->assign('issud_userid',$issud_userid);
   $smarty->assign('equipment_model',$equipment_model);
   $smarty->assign('u_id',$u_id);
  

/*
$smarty->assign('count_inner',$count_inner);
$smarty->assign('eq_name',$eq_name);
$smarty->assign('eq_id',$eq_id);
$smarty->assign('old_status',$old_status);
$smarty->assign('new_status',$new_status);
$smarty->assign('comment',$comment);
$smarty->assign('change_date',$change_date);
$smarty->assign('eq_serial',$eq_serial);
$smarty->assign('eq_manufac',$eq_manufac);
$smarty->assign('eq_warranty',$eq_warranty);
*/
$smarty->display('show_asset_history.tpl');
?>
Return current item: CoreAsset