<?php

class ProductionStock {

	/*************************************************
	/ This function add new ProductionStock Setup
	*************************************************/
	
	public static function AddProductionStockSetup($data) {
		global $db;
				
		$id = $db->query_insert(TABLE_BATCH_STOCK, $data);
		if($db->affected_rows > 0){
			//$db->query_insert("vrs_logs", $data);
			return $id;
		}else{
			return false;
		}
	
	} // AddProductionStock

	/*************************************************
	/ This function update ProductionStock
	*************************************************/
	
	public static function UpdateProductionStockSetup($pid,$data) {
		global $db;
				
		$id = $db->query_update(TABLE_BATCH_STOCK,$data,"id='$pid'");
		
		if($db->affected_rows > 0){
			//$db->query_insert("vrs_logs", $data);
			
			return $id;
		}else{
			return $id;
		}
	
	} // UpdateProductionStock


	public static function GetProductionStockSetupById($id) {
	
		global $db;
		$query = "SELECT * from ".TABLE_BATCH_STOCK." WHERE id ='$id'";
		//print($query);exit;
		$rows = $db->query_first($query);
	
                if($db->affected_rows > 0){
			
                        return $rows;
                }else{
			
                        return false;
                }
	}//ProductionStock
	
	/**********************************************************
	/ This function will return ProductionStockSetup
	**********************************************************/
		
	public static function GetProductionStockSetupList($filter="",$pageno="null",$pagesize="null") {
	
		global $db;
		$query = "SELECT * from ".TABLE_BATCH_STOCK." ". $filter;
		//print($query);exit;
		$rows = $db->fetch_all_array($query,$pageno,$pagesize);
	
			if($db->affected_rows > 0){
			
                        return $rows;
                }else{
			
                        return false;
                }
	}//ProductionStockSetup

	public static function GetNumRows() { global $db; return $db->GetNumRows(); }
	public static function GetNumberOfPages() { global $db; return $db->GetNumberOfPages(); }
		
	
}

?>
