DefaultReceiptDataFetch

Revised: 10Apr2013

Fetching data is the first step in building a receipt. Modules implementing DefaultReceiptDataFetch are responsible for retreiving transaction data from the database. Unless you provide replacement modules for every stage, the data should be based on localtemptrans but you can join in data from other tables so that modules in later steps don't need to issue additional queries.

Subclasses must implement one method, fetch. This method takes three optional arguments and returns an SQL result. If the employee number, register number, and transaction number are provided the subclass should fetch reprint data for that transaction. If the arguments are omitted, the subclass should fetch data for the current transaction.

Example:

class ExampleFetchData extends DefaultReceiptDataFetch {
	function fetch($empNo=False,$laneNo=False,$transNo=False){
		$db = Database::tDataConnect();
		if ($empNo && $laneNo && $transNo){
			return $db->query("SELECT * FROM localtranstoday
				WHERE emp_no=$empNo AND
				register_no=$laneNo AND
				trans_no=$transNo");
		}
		else {
			return $db->query('SELECT * FROM localtemptrans');
		}
	}
}


Change Log:

10Apr13 Andy Theuninck - Created document