Location: PHPKode > projects > CoreAsset > coreasset/view_asset.php
<?php
require_once("lib/inc.php");
require_once("lib/security.php");

$smarty = new Smarty;
$smarty->compile_check = true;
$smarty->debugging = false;
$title	  ="::: Showing Asset :::";
$smarty->assign('title',$title);
// 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
$u_id = "";
$asset_model = "";
$vendor_id = "";

$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);

//if($status < 4)
//{

/*// Getting User Lists *************************************************
  $res3          = $database->Execute("select * from asset_users");
  while($row3    = mysql_fetch_array($res3))
  {
   $userid[]                          = $row3['user_id'];
   $full_name[]                       = $row3['full_name'];
  }
  $smarty->assign("userid",$userid);
  $smarty->assign("full_name",$full_name);
// **********************************************************************/

  if(isset($_GET['hd83___2y8dh328f____8hhdiw___jd9']))
  {
   $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'];
   $row_user     		= $database->get_from_database("select * from asset_users where user_id='$u_id'");
   $user_name     		= $row_user['full_name'];
   // *******************  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']." [".$row4['equipment_model']."]";
	 $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',$manufacturer);
   $smarty->assign('asset_nickname',$asset_nickname);
   $smarty->assign('asset_model',$asset_model);
   $smarty->assign('serial_no',$serial_no);
   $smarty->assign('exp_date',$expiry_date);
   $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('u_name',$user_name);
  }
  //}
  

  /*if(isset($_GET['act']))
  {
   if($_GET['act']=="edit")
   {
   $asset_tag           = $_POST['asset_tag'];
   $asset_manufacturer  = $_POST['asset_manufacturer'];
   $asset_model         = $_POST['asset_model'];
   $po_no               = $_POST['po_no'];
   $asset_price         = $_POST['asset_price'];
   $asset_description   = $_POST['asset_description'];
   $receive_date        = $_POST['receive_date'];
   $vendorid            = $_POST['vendor_id'];
   $equip_id_arr        = explode(',',$_POST['equi_id']);
   $serial_no			= $_POST['serial'];
    if($database->update("update asset_assets set asset_manufacturer='$asset_manufacturer', asset_model='$asset_model',  asset_price='$asset_price', asset_description='$asset_description', receive_date='$receive_date' where asset_tag='$asset_tag'"))
    {
	for($i=0;$i<count($serial_no);$i++)
	  {
	   $database->update("UPDATE asset_serial_number SET serial_no='$serial_no[$i]' where equipment_id='$equip_id_arr[$i]'");
	   }
     redirect ("manage_asset.php","Edit");
    }
   }
  }
}

else
{
 $mes = "Sorry ! You have no such Privillage ...";
 $smarty->assign('mes',$mes);
}
$smarty->assign('name',$name);
$smarty->assign('status',$status);
*/
$smarty->display('view_asset.tpl');
?>
Return current item: CoreAsset