<?php
/**********************************************************************
***********************************************************************/
$page_security = 'SA_I_OWE_YOU_INQ';
if (!@$_GET['popup'])
	$path_to_root = "../..";
else	
	$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 . "/includes/inventory.inc");
include_once($path_to_root . "/includes/data_checks.inc");
include_once($path_to_root . "/petty_cash/includes/db/i_owe_you_db.inc");
include_once($path_to_root . "/petty_cash/includes/ui/float_transactions_inquiry_ui.inc");
include_once($path_to_root . "/petty_cash/includes/db/petty_cash_adjustments_inquiry_db.inc");
include_once($path_to_root . "/includes/db/group_companies_db.inc");
include_once($path_to_root . "/includes/common_functions.inc");
include_once($path_to_root . "/includes/ui/ui_lists_group_companies.inc");


$js = '';

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

if (user_use_date_picker()) {
	$js .= get_js_date_picker();
}

page(_($help_context = "Float Transactions Inquiry"), false, false, "", $js);

//----------------------------------------------------------------------------------------
simple_page_mode(true);

/*

if (isset($_GET['from_date']))
{
	$_POST['from_date'] = $_GET['from_date'];
}
if (isset($_GET['to_date']))
{
	$_POST['to_date'] = $_GET['to_date'];
}

function edit_link($row) 
{
    if($row['approval_status'] != AS_NEW){
        return null;    
    }
    
    switch ($row['type']) {
        case ST_FLOAT_PAYMENT:
            return pager_link( _("Edit"),"/petty_cash/float_payment.php?type=".$row['type']."&trans_no=".$row['trans_no'], ICON_EDIT);       
            
        case ST_FLOAT_RECEIPT:
            return pager_link( _("Edit"),"/petty_cash/float_receipt.php?type=".$row['type']."&trans_no=".$row['trans_no'], ICON_EDIT);         
            
        case ST_PETTY_CASH_FLOAT_ADJ:
            return pager_link( _("Edit"),"/petty_cash/petty_cash_float_adjustments.php?type=".$row['type']."&trans_no=".$row['trans_no'], ICON_EDIT);           

        default:
            break;
    }
     
}

function _type_id($row)
{
    global $systypes_array;
    
    return $systypes_array[$row['type']];

}

function _trans_no($row)
{
    if($row['trans_no'] > 0){
        return get_petty_cash_trans_view_str($row['type'], $row['trans_no']);
    }else{
        return "";    
    }
}

function _reference($row)
{
    return $row['reference'];
    
}

function _float_name($row)
{
    return $row['float_name'];
    
}

function _is_return($row)
{
    return get_yes_no_name($row['is_return']);
    
}


function _tran_date($row)
{
   return sql2date($row['tran_date']);
}



function _amount($row)
{
   return number_format($row['amount'],2);
}

function _comment($row)
{
   return $row['comment'];
}

function _approval_status($row)
{
    global $approval_statuses;
    
   return $approval_statuses[$row['approval_status']];
}


//--------------------------------------------------------------------------------------------------

if ($Mode == 'Delete')
{
        $recs = delete_i_owe_u($selected_id, $_POST['employee_code']);
        
        if($recs == 1){
                display_notification(_("Salary advance has been deleted."));
        }
        else{
                display_error(_("Salary advance could not be deleted."));
        }

	$Mode = 'RESET';
}

if ($Mode == 'RESET')
{
	$selected_id = -1;
}

if (isset($_POST['_selected_id_update']) )
{
	$selected_id = $_POST['selected_id'];
	//$Ajax->activate('_page_body');
}

//if (list_updated('employee_code')) 
	$Ajax->activate('_page_body');
//--------------------------------------------------------------------------------------------------
*/



start_form();

global $systypes_array, $Ajax;

display_petty_cash_transaction_filtering_controls();

$Ajax->activate('petty_cash_trans_table');

div_start('petty_cash_trans_table');

display_petty_cash_transaction_inquiry();
    
div_end();

//if (get_post('StockLocation') != $all_items) {
//	$cols[_("Location")] = 'skip';
//}
//---------------------------------------------------------------------------------------------------




	end_form();
	end_page();
	

?>
