1<?php
2
3function ValidBundleRef ($StockID, $LocCode, $BundleRef){
4	$SQL = "SELECT quantity
5				FROM stockserialitems
6				WHERE stockid='" . $StockID . "'
7				AND loccode ='" . $LocCode . "'
8				AND serialno='" . $BundleRef . "'";
9	$Result = DB_query($SQL);
10	if (DB_num_rows($Result)==0){
11		return 0;
12	} else {
13		$myrow = DB_fetch_row($Result);
14		return $myrow[0]; /*The quantity in the bundle */
15	}
16}
17function GetExpiryDate ($StockID, $LocCode, $BundleRef){
18	$SQL = "SELECT expirationdate
19				FROM stockserialitems
20				WHERE stockid = '" . $StockID . "'
21				AND loccode = '" . $LocCode . "'
22				AND serialno = '" . $BundleRef . "'";
23	$Result = DB_query($SQL);
24	if (DB_num_rows($Result)==0){
25		return '0000-00-00';
26	} else {
27		$myrow = DB_fetch_row($Result);
28		return ConvertSQLDate($myrow[0]);
29	}
30}
31class SerialItem {
32
33	var $BundleRef;
34	var $BundleQty;
35	var $ExpiryDate;
36
37	//Constructor
38	function __construct($BundleRef, $BundleQty, $ExpiryDate='0000-00-00'){
39
40		$this->BundleRef = $BundleRef;
41		$this->BundleQty = $BundleQty;
42		$this->ExpiryDate = $ExpiryDate;
43	}
44
45	function SerialItem($BundleRef, $BundleQty, $ExpiryDate='0000-00-00'){
46		self::__construct($BundleRef, $BundleQty, $ExpiryDate='0000-00-00');
47	}
48
49
50}//class SerialItem
51?>
52