<?php

if (empty($$class->fa_asset_retirement_id) && !empty($_GET['fa_asset_book_id']) && !empty($_GET['fa_asset_id'])) {
 $$class->fa_asset_book_id = $_GET['fa_asset_book_id'];
 $$class->fa_asset_id = $_GET['fa_asset_id'];
 $fa_abi_i = $$class->findBy_assetId_bookId();
 
 if ($fa_abi_i) {
  foreach ($fa_abi_i as $key => $val) {
//   $$class->$Key = $Val;
  if(property_exists($$class, $key)){
   $$class->$key = $val;
  }
  }
 }
}
if (!empty($$class->fa_asset_book_id)) {
 $$class->asset_book_name = fa_asset_book::find_by_id($$class->fa_asset_book_id)->asset_book_name;
}

if (!empty($$class->fa_asset_id)) {
 $$class->asset_number = fa_asset::find_by_id($$class->fa_asset_id)->asset_number;
}

if (!empty($$class->fa_asset_book_id) && !empty($$class->fa_asset_id))  {
 $ass_book_i = fa_asset_book_info::find_by_assetId_bookId($$class->fa_asset_book_id, $$class->fa_asset_id);
 $$class->original_cost = $ass_book_i->original_cost;
 $$class->current_cost = $ass_book_i->current_cost;
 $$class->ytd_depreciation = $ass_book_i->ytd_depreciation;
 $$class->accumulated_depreciation = $ass_book_i->accumulated_depreciation;
}else{
 $$class->original_cost = $$class->current_cost = $$class->ytd_depreciation = $$class->accumulated_depreciation = null;
}
?>