<?php
require_once (PATH_TABLES . "activity/template/JobQuotationTemplateTable.php") ;
require_once (PATH_TABLES . "activity/template/JobQuotationTaskTemplateTable.php") ;
require_once (PATH_MODELS . "base/MasterBase.php") ;

class JobQuotationTaskTemplateClass extends MasterBase {
	function __construct($db) {
		$this->db 		= $db ;
		$this->tbl	 	= JobQuotationTaskTemplateTable::C_TABLE ;
		$this->fldid 	= JobQuotationTaskTemplateTable::C_DETAIL_ID ;
	}

	function __destruct() {
	}

	function getJobQuotationTasktemplate($id){

        $sql = "SELECT * FROM " ;
        $sql .= JobQuotationTaskTemplateTable::C_TABLE . " WHERE " . JobQuotationTaskTemplateTable::C_ID . " = " . $id;
        $sql .= "ORDER BY " . JobQuotationTaskTemplateTable::C_PHASE ." ASC";
        
        $rows = $this->db->getTable($sql);

        if(!is_null($rows) && count($rows) > 0){
            return $rows;
        }
        
        return null;
    }

    function deleteTask($id)
    {
        $sql = "DELETE FROM " . JobQuotationTaskTemplateTable::C_TABLE . 
                " WHERE " . JobQuotationTaskTemplateTable::C_ID . " = " . $id. "";
        
        try{
            $this->db->executeSql($sql);
        } catch (Exception $e){
            Log::write("[ChecklistDetailClass]" . $e->getMessage());
        }
    }

}
?>