<?php
require_once (PATH_TABLES . "admin/CompanyTable.php") ;
require_once (PATH_MODELS . "base/MasterBase.php") ;

class CompanyClass extends MasterBase {
	function __construct($db) {
		$this->db = $db ;
		$this->tbl = CompanyTable::C_TABLE ;
		$this->fldid = CompanyTable::C_COY_ID ;
		$this->fldorg = CompanyTable::C_ORG_ID ;
		$this->flddesc = CompanyTable::C_DESC ;
	}
	function __destruct() {
	}
	function getCompanyOptions($id){
		$sql = "SELECT " . CompanyTable::C_OPTIONS .
                " FROM " . CompanyTable::C_TABLE . "  " .
                " WHERE " . CompanyTable::C_COY_ID . " = " . $id;
        
        $result = null;
        try{
            $result = $this->db->getTable($sql);
        } catch (Exception $e){
            Log::write("[CompanyClass]" . $e->getMessage());
        }
        
        return $result;        
	}
	function updateQuotationRN($id, $options){
		$sql = "UPDATE " . CompanyTable::C_TABLE . 
				" SET " . CompanyTable::C_OPTIONS . " = '" . $options. "'";
                " WHERE " . CompanyTable::C_COY_ID . " = " . $id. "";
        
        try{
            $this->db->executeSql($sql);
        } catch (Exception $e){
            Log::write("[CompanyClass]" . $e->getMessage());
        }
	}
}
?>