<?php 

function getOrderListTree(){
	global $db;
	$group_id = $_SESSION['group_id'];
	$company_id = $_SESSION['company_id'];
	$branch_id = $_SESSION['branch_id'];
	$tree = "";
	if($group_id == 1){
		$db->bind("forwarder_id", $company_id);
		$data = $db->query("SELECT * FROM shipping_orders WHERE forwarder_id = :forwarder_id");
	}else{
		$db->bind("company_id", $company_id);
		$db->bind("branch_id", $branch_id);
		$data = $db->query("SELECT * FROM shipping_orders WHERE company_id = :company_id and branch_id = :branch_id");
	}
	
	foreach ($data as $key => $value){
		$pieces = substr($value['marking_no'], -5);
		$tree .= "<li><a href='/track-order?id=".$value['so_id']."'>"
					. $pieces
				."</a></li>"; 
	}
	return $tree;
	
}