<?php
require_once (PATH_TABLES . "activity/salesquotation/SalesQuotationTemplateTable.php") ;
require_once (PATH_TABLES . "activity/salesquotation/SalesQuotationAppendixTemplateTable.php") ;
require_once (PATH_MODELS . "base/MasterBase.php") ;

class SalesQuotationTemplateClass extends MasterBase {
	function __construct($db) {
		$this->db 		= $db ;
		$this->tbl 		= SalesQuotationTemplateTable::C_TABLE ;
		$this->fldid 	= SalesQuotationTemplateTable::C_ID ;
	}

	function __destruct() {
	}
	function getAllTemplate()
	{
		$sql = "SELECT * FROM ".SalesQuotationTemplateTable::C_TABLE." ORDER BY ".SalesQuotationTemplateTable::C_TEMP_NAME;

		return $rows=$this->db->getTable($sql);
	}

	function checkName($name)
	{
		$sql = "SELECT * FROM ".SalesQuotationTemplateTable::C_TABLE." WHERE ".SalesQuotationTemplateTable::C_TEMP_NAME." = '".$name."'";

		$rows=$this->db->getTable($sql);

		if(!is_null($rows) && count($rows)>0){
			return true;
		}else{
			return false;
		}
	}

}
?>