<?php
require_once (PATH_TABLES . "activity/salesquotation/SalesQuotationMaintenanceTemplateTable.php") ;
require_once (PATH_TABLES . "activity/salesquotation/SalesQuotationMaintenanceHeaderTemplateTable.php") ;
require_once (PATH_TABLES . "activity/salesquotation/SalesQuotationMaintenanceDetailTemplateTable.php") ;
require_once (PATH_MODELS . "base/MasterBase.php") ;

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

	function __destruct() {
	}

	function getSalesQuotationMaintenanceDetailTemplate($id){

        $sql = "SELECT * FROM " ;
        $sql .= SalesQuotationMaintenanceDetailTemplateTable::C_TABLE . " WHERE " . SalesQuotationMaintenanceDetailTemplateTable::C_QUOTATION_ID . " = " . $id;
        $sql .= "ORDER BY " . SalesQuotationMaintenanceDetailTemplateTable::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 " . SalesQuotationMaintenanceDetailTemplateTable::C_TABLE . 
                " WHERE " . SalesQuotationMaintenanceDetailTemplateTable::C_QUOTATION_ID . " = " . $id. "";
        
        try{
            $this->db->executeSql($sql);
        } catch (Exception $e){
            Log::write("[ChecklistDetailClass]" . $e->getMessage());
        }
    }
}
?>