/** * get branch select form * @return array */ public function getBranchList() { $where = array('branch_no <> 0'); $db = new BranchTable(); return $db->getPairs(null, null, 0, $where); }
/** * separated to avoid complexity, (Spaghetti Code !!! ) * @return string */ private function createRefNumber() { $branchTable = new BranchTable(); $userBranch = $branchTable->getRecord($this->auth()->get('branch_no')); //generate id $rNumber = new RequestNumberTable(); $id = $rNumber->generateNumber($this->auth()->get('branch_no')); $sequence_no = $rNumber->getRecord($id); $approval_id = \strtoupper($userBranch['abbr_name']) . "-" . date("md") . "-" . $sequence_no['sequence_no']; return $approval_id; }