function getNextPayStubAccountOrderByTypeId($type_id) { global $current_company; Debug::Text('Type ID: ' . $type_id, __FILE__, __LINE__, __METHOD__, 10); if (!is_object($current_company)) { return FALSE; } if ($type_id == '') { return FALSE; } $psealf = new PayStubEntryAccountListFactory(); $psealf->getHighestOrderByCompanyIdAndTypeId($current_company->getId(), $type_id); if ($psealf->getRecordCount() > 0) { foreach ($psealf as $psea_obj) { return $psea_obj->getOrder() + 1; } } return FALSE; }