select('workstation.*, department.DepartmentName, wst1.WorkstationName as LinkToName') ->join('workstation wst1', 'workstation.LinkTo=wst1.WorkstationID', 'left') ->join('department', 'department.DepartmentID=workstation.DepartmentID', 'left'); if (!empty($filter['WorkstationCode'])) { $this->like('workstation.WorkstationCode', $filter['WorkstationCode'], 'both'); } if (!empty($filter['WorkstationName'])) { $this->like('workstation.WorkstationName', $filter['WorkstationName'], 'both'); } $rows = $this->findAll(); return $rows; } public function getWorkstation($WorkstationID) { $rows = $this->select("workstation.*, department.DepartmentName, wst1.WorkstationName as LinkToName,enable.VDesc as EnableName, wstype.VDesc as TypeName") ->join('workstation wst1', 'workstation.LinkTo=wst1.WorkstationID', 'left') ->join('department', 'department.DepartmentID=workstation.DepartmentID', 'left') ->join('valueset wstype', 'wstype.VID=workstation.Type', 'left') ->join('valueset enable', 'enable.VID=workstation.Enable', 'left') ->where('workstation.WorkstationID', $WorkstationID) ->findAll(); return $rows; } }