<?php
require_once (PATH_TABLES . "activity/salesquotation/SalesQuotationProjectPlanTemplateTable.php") ;
require_once (PATH_TABLES . "activity/salesquotation/SalesQuotationProjectPlanHeaderTemplateTable.php") ;
require_once (PATH_TABLES . "activity/salesquotation/SalesQuotationProjectPlanDetailTemplateTable.php") ;
require_once (PATH_MODELS . "base/MasterBase.php") ;

class SalesQuotationProjectPlanDetailTemplateClass extends MasterBase {
	function __construct($db) {
		$this->db 		= $db ;
		$this->tbl 		= SalesQuotationProjectPlanDetailTemplateTable::C_TABLE ;
		$this->fldid 	= SalesQuotationProjectPlanDetailTemplateTable::C_QUOTATION_ID ;
	}

	function __destruct() {
	}

	function getSalesQuotationProjectPlanDetailTemplate($id){

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

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

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