<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class purchase_model extends MY_Model{
	function __construct(){
		parent::__construct();
		
		$this->table = "PURCHASE";
		$this->pk = "REFNO";
		$this->created_by = "NEWUSER";
		$this->date_created = "NEWTIME";
		$this->modified_by = "MODIFYUSER";
		$this->date_modified = "MODIFYTIME";
	}

	function save_before($post, $save_mode){
		$this->load->model("ticketno_model");
		$pk = $this->sql_get_pk();
		$record_set = "PURCHASE";
		
		if($save_mode == "INSERT"){
			
			$post['REFNO'] = $this->ticketno_model->get_next_no($this->table, $pk, $record_set);
	
		}
	return $post;
	}
}