diff --git a/Apollo/api/application/controllers/DayBookMaster_Controller.php b/Apollo/api/application/controllers/DayBookMaster_Controller.php new file mode 100644 index 00000000..5704dc8a --- /dev/null +++ b/Apollo/api/application/controllers/DayBookMaster_Controller.php @@ -0,0 +1,134 @@ +methods['addDaybookMasterDetails_post']['limit'] = 100; // 50 requests per hour per user/key + $this->methods['getDayBookMasterDetails_post']['limit'] = 500; // 50 requests per hour per user/key + $this->methods['updateDayBookMasterDetails_post']['limit'] = 500; + // load the model + $this->load->model('DaybookMaster_model', 'daybookmaster_model'); + + } + + /* + * This method used to get day book master details + * created by kms + * */ + + public function addDaybookMasterDetails_post() + { + $now = new DateTime(); + $now->setTimezone(new DateTimezone('Asia/Kolkata')); + $details['TypeID'] = $this->post('type'); + $details['TypeName'] = $this->post('name'); + $details['IsActive'] = $this->post('status'); + $details['CreatedBy'] = $this->post('createdBy'); + $details['CreatedOn'] = $now->format('Y-m-d H:i:s'); + $addDetails = $this->daybookmaster_model->addDetails($details);// Check if the users data store contains users (in case the database result returns NULL) + if ($addDetails) + { + $addDetails['status'] = REST_Controller::HTTP_OK; + // Set the response and exit + $this->response($addDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code + } + else + { + // Set the response and exit + $this->response([ + 'message' => 'Something went wrong.please try again!', + 'status' => REST_Controller::HTTP_NOT_FOUND + ], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code + } + + + } + /* + * This method used to get day book master details + * created by kms + * */ + public function getDayBookMasterDetails_post() + { + $requestedBy = $this->post('requestedBy'); + $getdetails = $this->daybookmaster_model->getDayBookDetails($requestedBy); + + if ($getdetails) + { + $getdetails['status'] = REST_Controller::HTTP_OK; + // Set the response and exit + $this->response($getdetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code + } + else + { + // Set the response and exit + $this->response([ + 'message' => 'No records found!', + 'status' => REST_Controller::HTTP_NOT_FOUND + ], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code + } + + + } + + /* + * update the day book details + * created by kms + * */ + public function updateDayBookMasterDetails_post() + { + $now = new DateTime(); + $now->setTimezone(new DateTimezone('Asia/Kolkata')); + $details['ID'] = $this->post('ID'); + $details['TypeName'] = $this->post('TypeName'); + $details['TypeID'] = $this->post('TypeID'); + $details['IsActive'] = $this->post('status'); + $details['UpdatedBy'] = $this->post('updatedBy'); + $details['UpdatedOn'] = $now->format("Y-m-d H:i:s"); + $updateDetails = $this->daybookmaster_model->updateDayBook($details);// Check if the users data store contains users (in case the database result returns NULL) + + if ($updateDetails) + + { + $updateDetails['status'] = REST_Controller::HTTP_OK; + // Set the response and exit + $this->response($updateDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code + } + else + { + // Set the response and exit + $this->response([ + 'message' => 'Something went wrong.please try again!', + 'status' => REST_Controller::HTTP_NOT_FOUND + ], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code + } + + + } + + + +} \ No newline at end of file