<?php


function set_global_list_code($list_id) 
{
	$_SESSION['wa_global_list_id'] = $list_id;
}


function get_global_list_code() 
{
	if (!isset($_SESSION['wa_global_list_id']))
		return "";
	return $_SESSION['wa_global_list_id'];
}

function set_global_loyalty_card_no($loyalty_card_no) 
{
	$_SESSION['wa_global_loyalty_card_no'] = $loyalty_card_no;
}

function get_global_loyalty_card_no() 
{
	if (!isset($_SESSION['wa_global_loyalty_card_no']))
		return "";
	return $_SESSION['wa_global_loyalty_card_no'];
}

function set_global_loyalty_member($member_no) 
{
	$_SESSION['wa_global_member_no'] = $member_no; 
}

function get_global_loyalty_member($return_all=true) 
{
	if (!isset($_SESSION['wa_global_member_no']) || 
		($return_all == false && $_SESSION['wa_global_member_no'] == ALL_TEXT))
		return "";		

	return $_SESSION['wa_global_member_no'];
}

function set_global_promotion_code($promotion_code) 
{
	$_SESSION['wa_global_promotion_code'] = $promotion_code; 
}

function get_global_promotion_code($return_all=true) 
{
	if (!isset($_SESSION['wa_global_promotion_code']) || 
		($return_all == false && $_SESSION['wa_global_promotion_code'] == ALL_TEXT))
		return "";		

	return $_SESSION['wa_global_promotion_code'];
}

function set_global_report_id($report_id) 
{
	$_SESSION['wa_global_report_id'] = $report_id;
}



function get_global_report_id() 
{
	if (!isset($_SESSION['wa_global_report_id']))
		return "";

	return $_SESSION['wa_global_report_id'];
}

function set_global_table_id($tabel_id) 
{
	$_SESSION['wa_global_tabel_id'] = $tabel_id;
}



function get_global_table_id() 
{
	if (!isset($_SESSION['wa_global_tabel_id']))
		return "";

	return $_SESSION['wa_global_tabel_id'];
}

function set_global_payroll_id($tabel_id) 
{
	$_SESSION['wa_global_payroll_id'] = $tabel_id;
}

function get_global_payroll_id() 
{
	if (!isset($_SESSION['wa_global_payroll_id']))
		return "";
	return $_SESSION['wa_global_payroll_id'];
}

function set_session_variable($name, $value) 
{
	$_SESSION[$name] = $value; 
}

function get_session_variable($name) 
{
	if (!isset($_SESSION[$name])){
		return "";
    }
    else{
        return $_SESSION[$name];
    }
}

function clear_session_variable($name) 
{
	unset($_SESSION[$name]); 
}


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

function set_global_employee_code($employee_code) 
{
	$_SESSION['wa_global_employee_code'] = $employee_code; 
}

function get_global_employee_code($return_all=true) 
{
	if (!isset($_SESSION['wa_global_employee_code']) || 
		($return_all == false && $_SESSION['wa_global_employee_code'] == ALL_TEXT))
		return "";		
	return $_SESSION['wa_global_employee_code'];
}

function set_global_bank_account($bank_account) 
{
	$_SESSION['wa_global_bank_account'] = $bank_account; 
}



function get_global_bank_account() 
{

	if (!isset($_SESSION['wa_global_bank_account']))

		return "";

	return $_SESSION['wa_global_bank_account'];
}

function set_global_asset_group($asset_group_id) 
{
	$_SESSION['wa_global_asset_group_id'] = $asset_group_id;
}

function get_global_asset_group() 
{
	if (!isset($_SESSION['wa_global_asset_group_id']))
		return "";
	return $_SESSION['wa_global_asset_group_id'];
}

function set_global_project_id($project_id) 
{
	$_SESSION['wa_global_project_id'] = $project_id;
}


function get_global_dashboard_from_month() 
{
	if (!isset($_SESSION['wa_global_dashboard_from_month_id']))
		return "";

	return $_SESSION['wa_global_dashboard_from_month_id'];
}

function set_global_dashboard_from_month($month_id) 
{
	$_SESSION['wa_global_dashboard_from_month_id'] = $month_id;
}

function get_global_dashboard_to_month() 
{
	if (!isset($_SESSION['wa_global_dashboard_to_month_id']))
		return "";

	return $_SESSION['wa_global_dashboard_to_month_id'];
}

function set_global_dashboard_to_month($month_id) 
{
	$_SESSION['wa_global_dashboard_to_month_id'] = $month_id;
}

function get_global_project_id() 
{
	if (!isset($_SESSION['wa_global_project_id']))
		return "";

	return $_SESSION['wa_global_project_id'];
}


function set_global_page_name($page_name) 
{
	$_SESSION['wa_global_page_name'] = $page_name;
}

function get_global_page_name() 
{
	if (!isset($_SESSION['wa_global_page_name']))
		return "";
	return $_SESSION['wa_global_page_name'];
}



function set_global_gl_batch_date($gl_batch_date) 
{
	$_SESSION['wa_global_gl_batch_date'] = $gl_batch_date;
}



function get_global_gl_batch_date() 
{
	if (!isset($_SESSION['wa_global_gl_batch_date']))
		return sql2date(date('Y-m-d'));
	return $_SESSION['wa_global_gl_batch_date'];

}



