<?php
/**********************************************************************
***********************************************************************/
$page_security = 'SA_PETTYCASH_TRANSVIEW';
$path_to_root = "../..";

include_once($path_to_root . "/includes/session.inc");
include_once($path_to_root . "/includes/date_functions.inc");
include_once($path_to_root . "/includes/ui.inc");
include_once($path_to_root . "/gl/includes/gl_db.inc");
include_once($path_to_root . "/petty_cash/includes/db/approve_i_owe_you_enties_db.inc");
include_once($path_to_root . "/petty_cash/includes/db/petty_cash_payments_db.inc");
include_once($path_to_root . "/petty_cash/includes/db/i_owe_you_expenses_db.inc");
include_once($path_to_root . "/petty_cash/includes/db/i_owe_you_db.inc");
include_once($path_to_root . "/petty_cash/includes/ui/petty_cash_ui.inc");
include_once($path_to_root . "/includes/common_functions.inc");
include_once($path_to_root . "/includes/db/group_companies_db.inc");
include_once($path_to_root . "/petty_cash/includes/db/petty_cash_expenses_entry_db.inc");
include_once($path_to_root . "/admin/db/list_values_db.inc");
include_once($path_to_root . "/transport/includes/db/vehicles_db.inc");
include_once($path_to_root . "/assets/includes/db/assets_db.inc");
include_once($path_to_root . "/petty_cash/includes/db/i_owe_you_advances_inquiry_db.inc");
include_once($path_to_root . "/inventory/includes/db/petty_cash_item_receive_db.inc");



$js = "";
if ($SysPrefs->use_popup_windows)
	$js .= get_js_open_window(900, 500);

page(_($help_context = "View Expenses Batch"), true, false, "", $js);

if (isset($_GET["trans_no"]))
{
	$trans_no = $_GET["trans_no"];
}

function display_iou_expense_batch($batch_no){ 
    global $Ajax;
    
    $Ajax->activate('leaves1');

    div_start('leaves1');
    
    display_heading2("Expenses Batch No:".$batch_no);
    br();
//        $total_paid = display_expense_batch_ious($batch_no);
    $pceh = get_petty_cash_expenses_header_by_batch_no($batch_no);
    if($pceh){
        display_petty_cash_header($pceh['id']);
        $total_paid = display_petty_cash_payments(ST_PETTY_CASH, $pceh['id'], false);
    }
    else{
        $total_paid = display_batch_i_owe_yous($batch_no, 0);
    }
//        display_expense_batch_summary($batch_no);

    display_i_owe_you_batch_expences($batch_no, $total_paid);

//        br();

    hidden('BatchNo', $batch_no);
        
    div_end();
}


display_iou_expense_batch($trans_no);

end_page(true, false, false, ST_BANKPAYMENT, $trans_no);
?>