<?php
require_once (PATH_TABLES . "activity/invoice/InvoiceTitleTable.php") ;
require_once (PATH_MODELS . "base/MasterBase.php") ;

class InvoiceTitleClass extends MasterBase {
	function __construct($db) {
		$this->db = $db ;
		$this->tbl = InvoiceTitleTable::C_TABLE ;
		$this->fldid = InvoiceTitleTable::C_ID ;
		$this->flddesc = InvoiceTitleTable::C_DESC ;
	}
	function __destruct() {
	}
	function getInvoiceTitleList($id){
		$sql = "SELECT * ". 
                " FROM " . InvoiceTitleTable::C_TABLE . "  " .
                " WHERE " . InvoiceTitleTable::C_COY_ID . " = " . $id . " " .
                " ORDER BY " . InvoiceTitleTable::C_DESC . " ";
        
        $result = null;
        try{
            $result = $this->db->getTable($sql);
        } catch (Exception $e){
            Log::write("[InvoiceTitleClass]" . $e->getMessage());
        }
        
        return $result;        
	}
    function deleteAllByCoyId($id){
		$sql = "DELETE FROM " . InvoiceTitleTable::C_TABLE . 
                " WHERE " . InvoiceTitleTable::C_COY_ID . " = " . $id. "";
        
        try{
            $this->db->executeSql($sql);
        } catch (Exception $e){
            Log::write("[InvoiceTitleClass]" . $e->getMessage());
        }
	}	
}
?>