<?php
/**********************************************************************
***********************************************************************/

 
function display_assets_file_data()
{    
    start_table(TABLESTYLE, "width=98%");    
    $th = array("Asset ID", "Asset Code", "Description", "Long Description", "Multiple Items", "Asset Type",
                "Asset Group", "Asset Subgroup", "Asset Category", "Hired", "Rate Category",
                "Serial/Plate Number", "Make", "Model", "Useful Life (Years)", "Extended Life (Years)",
                "PO Number", "Cost", "Current Value", "Owner Project", "Message");                  

    table_header($th);
    
    $result = get_assets_data();
     
    $k = $i = 0;
    
    while($row = db_fetch($result)){
        
        if($i == 12){
            table_header($th);
            $i = 0;
        }

        
        alt_table_row_color($k);
        
        label_cell($row['asset_id']);
        label_cell($row['asset_code']);
        label_cell($row['description']);
        label_cell($row['long_description']);
        label_cell($row['multiple_items']);
        label_cell($row['asset_type_name']);
        label_cell($row['asset_group_name']);
        label_cell($row['asset_subgroup_name']);
        label_cell($row['asset_category_name']);
        
        if($row['hired'] == 0){
            $hired = "No";
        }else{
            $hired = "Yes";
        }
        label_cell($hired);
        label_cell($row['rate_category_name']);
        label_cell($row['asset_serial']);
        label_cell($row['make']);
        label_cell($row['model']);
        label_cell($row['useful_life']);
        label_cell($row['extended_life']);
        label_cell($row['po_number']);
        label_cell($row['purchase_value']);
        label_cell($row['current_value']);
        label_cell($row['owner_project_name']);
        
        if($row['message'] == "Record Added" || $row['message'] == "Record Updated" || $row['message'] == "Can import"){
            $message = $row['message'];
        }
        else{
            $message = "<font color='red'>".$row['message']."</font>";
        }
     
        label_cell($message);
        
        end_row();
        
        $i++;
    }
  
    end_table();
}


function read_asset_details_import_file_data(&$file_data, $line)
{
    $asset_id = str_replace('"', '', $line[0]);
    $asset_code = str_replace('"', '', $line[1]);
    $description = str_replace('"', '', $line[2]);
    $long_description = str_replace('"', '', $line[3]);  
    $multiple_items = str_replace('"', '', $line[4]); 
    $asset_type_name = str_replace('"', '', $line[5]);
    $asset_group_name = str_replace('"', '', $line[6]);
    $asset_subgroup_name = str_replace('"', '', $line[7]);
    $asset_category_name = str_replace('"', '', $line[8]);        
   
    $hired = str_replace('"', '', $line[9]);
    $rate_category_name = str_replace('"', '', $line[10]);
    $asset_serial = str_replace('"', '', $line[11]);                    
    $make = str_replace('"', '', $line[12]);
    $model = str_replace('"', '', $line[13]);
    $owner_project_name = str_replace('"', '', $line[14]);
    $useful_life = str_replace('"', '', $line[15]);
    $extended_life = str_replace('"', '', $line[16]);
    $inactive = str_replace('"', '', $line[17]);
    $po_number = str_replace('"', '', $line[18]);
    $purchase_value = str_replace('"', '', $line[19]);     
    $current_value = str_replace('"', '', $line[20]);     

//    $message = str_replace('"', '', $line[20]);  
    $message = "";
    
    save_asset_details($asset_id, $asset_code, $description, $long_description, $multiple_items, $asset_type_name,
                        $asset_group_name, $asset_subgroup_name, $asset_category_name, $hired, $rate_category_name,
                        $asset_serial, $make, $model, $useful_life, $extended_life, 
                        $po_number, input_num2($purchase_value), 
                        input_num2($current_value), $owner_project_name, $inactive, $message);

}



?>
