diff --git a/Apollo/api/application/models/DaybookMaster_model.php b/Apollo/api/application/models/DaybookMaster_model.php new file mode 100644 index 00000000..998d79a1 --- /dev/null +++ b/Apollo/api/application/models/DaybookMaster_model.php @@ -0,0 +1,118 @@ +db->select('TypeName'); + $this->db->where('TypeName', $arrayDetails['TypeName']); + $this->db->where('TypeID', $arrayDetails['TypeID']); + 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 details is 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) + { + $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->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_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 is updated"; + } + else { + $result['updateStatus'] = false; + $result['message'] = "Something went wrong.please try again"; + } + + } + + + + return $result; + + } + +} \ No newline at end of file