<?php

function display_asset_expense_details_inquiry_selecting_parameters() {
    global $Ajax;
    
    $Ajax->activate('sm_filter');
    div_start('sm_filter');

        start_table(TABLESTYLE_NOBORDER);
            start_row();
                project_list_cells(_("Project:"), 'project_id', null, _('Select a project'), true);   
                date_cells(_("From:"), 'from_date', '', null, -30);
                date_cells(_("To:"), 'to_date', '', null, 0);
                asset_list_cells("Asset:", 'asset_id', null, '', true);
//                vehicles_list_cells('Vehicle:', 'vehecle_id', null, '', true);
                submit_cells('SearchItemTrans', _("Search"),'', _('Refresh Inquiry'), 'process');
            end_row();
        end_table(2);

    div_end();
}

function display_asset_expense_details_inquiry_details($project_id, $from_date, $to_date, $asset_id) {
    display_heading('Item Transaction Details');    
    
    $item_trans_total = display_item_transactions_inquiry_details('', '', $to_date, $from_date, $project_id, $type=0, 0, IMLF_ASSET, $asset_id); 
    
    br(4);   display_heading('I Owe You Expense Details');    
    
    $iou_total = display_i_owe_you_expense_details_inquiry(0, 0, 0, '', $project_id, '', '', $from_date, $to_date, EC_ASSET_MAINTENANCE, $asset_id); 
    
    br(2);   display_heading('Utility Bill Expense Details');   
    
    $u_bil_total = display_utility_bill_expense_details_inquiry(0, 0, 0, '', $project_id, $from_date, $to_date, EC_ASSET_MAINTENANCE, $asset_id); 
    
        display_heading('Total Expense Details');    

            $a = 0;
            start_table(TABLESTYLE2, "width=30%");
                $th = array(_("Section / Category"), _("Total"));
                table_header($th);

                    alt_table_row_color($a); 
                        label_cell('Item Transactions');
                        label_cell(number_format($item_trans_total, 2), 'align=right');
                    end_row();
                    alt_table_row_color($a); 
                        label_cell('I Owe You Expenses');
                        label_cell(number_format($iou_total, 2), 'align=right');
                    end_row();
                    alt_table_row_color($a); 
                        label_cell('Utility Bill Expenses');
                        label_cell(number_format($u_bil_total, 2), 'align=right');
                    end_row();
                    
                    $total_expenses = $item_trans_total + $iou_total + $u_bil_total;
                    alt_table_row_color($a); 
                        label_cell(text_bold('Total Expense:'), 'align=right');
                        label_cell(text_bold(number_format($total_expenses, 2)), 'align=right');
                    end_row();
            end_table(2);
}

?>