<?php

function display_asset_depreciation_inquiry_selecting_parameters() {
    start_table();
        start_row();    
            asset_depreciation_run_list_cells("Asset Depreciation Run:", 'asset_run_id', false,"", true,"all");
            asset_list_cells("Asset:", 'asset_id', null, 'Select an asset', true, null);  

            submit_cells('Search', _("Search"),'',_('Search'), 'default');
        end_row();
    end_table(2);
}

function display_asset_depreciation_inquiry($asset_run_id, $asset_id) {
    start_table(TABLESTYLE, "width=75%"); 
        $th = array(_('Trans. Date'), _('Asset Depreciation Run'), _('Asset'), _('Purchased Value'), _('Starting Value'), _('Depreciation'), _("Current Value"));              
            table_header($th);

            $k = 0;
            $result = get_asset_depreciation_inquiry($asset_run_id, $asset_id);  
                while ($myrow = db_fetch($result)) {
                    alt_table_row_color($k);

                        label_cell(sql2date($myrow['processed_on']), "align=center");
                        $run_name = get_asset_depreciation_run_formatted_name($myrow['asset_run_id']);
                        label_cell($run_name);
                        $asset_name = get_asset_formatted_name($myrow['asset_id']);
                        label_cell($asset_name);
                        label_cell(number_format($myrow['purchased_value'], 2), "align=right");
                        label_cell(number_format($myrow['starting_value'], 2), "align=right");
                        label_cell(number_format($myrow['depreciation_value'], 2), "align=right");
                        
                        $current_value = $myrow['starting_value'] - $myrow['depreciation_value'];
                        label_cell(text_bold(number_format($current_value, 2)), "align=right");
                        
                    end_row();
            }    
    
    end_table(2);
}

?>