db->select('TypeName'); $this->db->where('TypeName', $arrayDetails['TypeName']); $this->db->where('TypeID', $arrayDetails['TypeID']); $this->db->where('BranchCode', $arrayDetails['BranchCode']); if($this->db->get(INCOMEOUTCOMEMASTER)->first_row()){ $result['addStatus'] = false; $result['message'] = "Name is already exist!"; } else { $this->db->insert(INCOMEOUTCOMEMASTER, $arrayDetails); if($this->db->affected_rows() == '1'){ $result['addStatus'] = true; $result['message'] = "Successfully Day Book Master Details Added"; } else { $result['addStatus'] = false; $result['message'] = "Something went wrong.please try again"; } } return $result; } /* * get day book details * created by kms * */ public function getDayBookDetails($requestedBy=null, $requestedBranch = null) { $this->db->select('IOM.ID,IOM.TypeName,IOM.TypeID,IOM.IsActive,PLD.ListName'); $this->db->from(INCOMEOUTCOMEMASTER .' as IOM'); $this->db->join(PICK_LIST_DETAILS.' as PLD', 'PLD.ListCode = IOM.TypeID'); $this->db->where('IOM.BranchCode', $requestedBranch); $this->db->order_by('IOM.ID','DESC'); $details = $this->db->get(); if($details->result()){ $result['daybookStatus'] = true; $result['details'] = $details->result(); } else { $result['daybookStatus'] = false; $result['message'] = "No records found!"; } $result['getDayBooktype'] = $this->getDayBookType('10'); return $result; } /* * get day book type * created by kms * */ public function getDayBookType($typeID=null){ $this->db->select('ListCode,ListName'); $this->db->where('ListGroup', $typeID); $typeDetails=$this->db->get(PICK_LIST_DETAILS); return $typeDetails->result(); } /* * update day book details * created by kms * */ public function updateDayBook($arrayDetails=null) { $this->db->select('TypeName'); $this->db->where('TypeName', $arrayDetails['TypeName']); $this->db->where('TypeID', $arrayDetails['TypeID']); $this->db->where('BranchCode', $arrayDetails['BranchCode']); $this->db->where_not_in('ID', $arrayDetails['ID']); if($this->db->get(INCOMEOUTCOMEMASTER)->first_row()){ $result['updateStatus'] = false; $result['message'] = "Name is already exist!"; } else { $this->db->where('ID',$arrayDetails['ID']); $this->db->update(INCOMEOUTCOMEMASTER, $arrayDetails); if($this->db->affected_rows() == '1'){ $result['updateStatus'] = true; $result['message'] = "Successfully Day Book Details Updated"; } else { $result['updateStatus'] = false; $result['message'] = "Something went wrong.please try again"; } } return $result; } }