<?php

define("PURCHASING_MODULE_DIR","./modules/purchasing");
define("PURCHASING_MODULE_DIR_ADMIN","../modules/purchasing");

$action = $_REQUEST['a'];
$isAdmin = stripos($_SERVER['SCRIPT_NAME'],"/admin/")===false?false:true;

if($isAdmin && $action == "functions"){
	
	include_once(PURCHASING_MODULE_DIR_ADMIN . '/purchasing.functions.php');
}elseif($action == "functions"){
	include_once(PURCHASING_MODULE_DIR . '/purchasing.functions.php');	
}
elseif($action == "managesuppliers"){
	include_once(PURCHASING_MODULE_DIR_ADMIN . '/purchasing.managesuppliers.php');
}
elseif($action == "manage"){
	include_once(PURCHASING_MODULE_DIR_ADMIN . '/purchasing.manage.php');
}
elseif($isAdmin && $action == "viewpo"){
	include_once(PURCHASING_MODULE_DIR_ADMIN . '/purchasing.viewpo.php');
}elseif(!$isAdmin && $action == "viewpo"){
	include_once(PURCHASING_MODULE_DIR . '/purchasing.viewpo.php');
}
elseif($action == "poreview"){
	include_once(PURCHASING_MODULE_DIR_ADMIN . '/purchasing.poreview.php');
}elseif($action == "receive"){
	include_once(PURCHASING_MODULE_DIR_ADMIN . '/purchasing.receive.php');
}elseif($action == "receivelist"){
	include_once(PURCHASING_MODULE_DIR_ADMIN . '/purchasing.receivelist.php');
}else{
	include_once(PURCHASING_MODULE_DIR_ADMIN . '/purchasing.' . $action . '.php');
}

?>