select('report') ->where('companyId = ?', $companyId); $result = $this->getAdapter()->fetchAll($sql); return ($result); } public function getReportByIdAndType($companyId, $type) { if($type == 'CR') { $where = 'type="FU" or type="CO"'; } else $where = 'type = "FU"'; $sql = $this->select() ->where('companyId = ? and '.$where, $companyId); $result = $this->getAdapter()->fetchRow($sql); if($type == 'FU') { $where = $this->getAdapter()->quoteInto('companyId = ? AND type = "CR" OR type = "CO"' , $companyId); //var_dump($where);exit; $this->delete($where); } else if($type == 'CO') { $where = $this->getAdapter()->quoteInto('companyId = ? and type = "CR"', $companyId); $this->delete($where); } return ($result['report']); } public function getReportDate($companyId, $type) { $sql = $this->select('date') ->where('companyId = ?', $companyId) ->where('type = ?', $type); $result = $this->getAdapter()->fetchAll($sql); return ($result); } } ?>