<?php
	/*
	** File: 
	** Description: calculate shipping
	** Up to $15.99	$  4.95
	** $  16 to $  30.99	$  5.95
	** $  31 to $  50.99	$  7.50
	** $  51 to $  75.99	$  9.95
	** $  76 to $100.99	$12.50
	** $101 to $150.99	$15.00
	** $151 and over	10% of merchandise total
	**
	** Version: $Revision: 1.4 $
	** Created: 06/23/98
	** Author: Leon Atkinson
	** Email: leon@clearink.com
	** CVS Author: $Author: leon $
	** Last Revised: $Date: 1999/10/26 17:31:35 $
	**
	** Log : $Log: ShippingByTotal,v $
	** Log : Revision 1.4  1999/10/26 17:31:35  leon
	** Log : Removed constants defining variations.  Instead functions wrap the tables.
	** Log : They use caching to reduce the number of database queries.
	** Log :
	** Log : Revision 1.3  1999/10/11 23:04:02  leon
	** Log : Removed all require()'s, added block to stop double include()'s
	** Log :
	** Log : Require wasn't giving any performance advantage because it was always
	** Log : being called with a variable.  Futhermore, using return inside a
	** Log : require()'d file does not work in PHP4.
	** Log :
	** Log : Revision 1.2  1999/08/18 22:32:03  leon
	** Log : Returning opening PHP tag to XML-friendly tag
	** Log :
	** Log : Revision 1.1  1999/07/28 21:18:33  leon
	** Log : New include modules based on code donation from a live project
	** Log :
	**
	** Copyright (c) 1999 Working Dogs.  All rights reserved.
	*/

	/*
	** Ensure that module isn't included twice
	*/

	$included_flag = 'INCLUDE_' . basename(__FILE__);
	
	if(defined($included_flag))
		//if this module has been included already, then the
		//constant will be defined.  Note the unusual use of
		//the return statement here.  Control will return to
		//the file that included it.
		return;
	
	define($included_flag, TRUE);	



	function ShippingByTotal($Total)
	{
		if($Total <= 0.00)
		{
			$Shipping = 0.00;
		}
		elseif($Total <= 15.99)
		{
			$Shipping = 4.95;
		}
		elseif($Total <= 30.99)
		{
			$Shipping = 5.95;
		}
		elseif($Total <= 50.99)
		{
			$Shipping = 7.50;
		}
		elseif($Total <= 75.99)
		{
			$Shipping = 9.95;
		}
		elseif($Total <= 100.99)
		{
			$Shipping = 12.50;
		}
		elseif($Total <= 150.99)
		{
			$Shipping = 15.00;
		}
		else
		{
			$Shipping = $Total * 0.15;
		}
	
		return($Shipping);
	}

?>