<?php
/**
 * Class that operate on table 'productrecieve'. Database Mysql.
 *
 * @author: http://phpdao.com
 * @date: 2013-09-29 12:04
 */
class ProductrecieveMySqlExtDAO extends ProductrecieveMySqlDAO{

	public function queryAllExt(){
		$sql = 'SELECT productrecieve.*, sparepart.sparepartname 
		FROM productrecieve
		JOIN sparepart
		ON sparepart.sparepartid = productrecieve.sparepartid
		ORDER BY recieptnum ASC';
		$sqlQuery = new SqlQuery($sql);
		return $this->getList($sqlQuery);
	}
	

	public function queryAllExtLimited($start, $end){
		$sql = 'SELECT productrecieve.*, sparepart.sparepartname 
		FROM productrecieve
		JOIN sparepart
		ON sparepart.sparepartid = productrecieve.sparepartid
		ORDER BY recieptnum ASC
		limit '.$start.', '.$end.'';
		$sqlQuery = new SqlQuery($sql);
		return $this->getList($sqlQuery);
	}
	
	public function queryWithSparePartIdExt($sparepartid){
		$sql = 'SELECT productrecieve.*, sparepart.sparepartname 
		FROM productrecieve
		JOIN sparepart
		ON sparepart.sparepartid = productrecieve.sparepartid
		WHERE productrecieve.sparepartid = '.$sparepartid.'
		ORDER BY recieptnum ASC';
		$sqlQuery = new SqlQuery($sql);
		return $this->getList($sqlQuery);
	}
	
	public function queryWithSparePartIdExtLimited($sparepartid, $start, $end){
		$sql = 'SELECT productrecieve.*, sparepart.sparepartname 
		FROM productrecieve
		JOIN sparepart
		ON sparepart.sparepartid = productrecieve.sparepartid
		WHERE productrecieve.sparepartid = '.$sparepartid.'
		ORDER BY recieptnum ASC
		limit '.$start.', '.$end.'';
		$sqlQuery = new SqlQuery($sql);
		return $this->getList($sqlQuery);
	}

}
?>