load->model('DayBook_model', 'daybook_model'); } //get income expese type, name details public function getIncomeExpenseTypeState_post() { $reqData = $this->post('data'); $getIncomeExpenseTypeState = $this->daybook_model->get_Income_Expense_typeState();// Check if the employee exist if ($getIncomeExpenseTypeState) { $getIncomeExpenseTypeState['status'] = REST_Controller::HTTP_OK; // Set the response and exit $this->response($getIncomeExpenseTypeState, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code } else { // Set the response and exit $this->response([ 'message' => 'No list were found', 'status' => REST_Controller::HTTP_NOT_FOUND ], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code } } // {"data":{"date":"22-12-2017"},"localReqDetails":{"localUserID":"137","localBranchID":"001","localType":"R002","localOn":"2017-12-22T12:45:19.688Z","status":"active"}} // get all daybook details public function getDayBookDetails_post() { $reqData = $this->post('data'); $reqDataBy = $this->post('localReqDetails'); $getDayBookDetails = $this->daybook_model->get_Daybook_Details_List($reqData, $reqDataBy);// Check if the employee exist if ($getDayBookDetails) { $getDayBookDetails['status'] = REST_Controller::HTTP_OK; // Set the response and exit $this->response($getDayBookDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code } else { // Set the response and exit $this->response([ 'message' => 'No list were found', 'status' => REST_Controller::HTTP_NOT_FOUND ], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code } } public function deleteDayBookDetails_post() { $reqData = $this->post('data'); $reqbyData = $this->post('localReqDetails'); $deletedayBookDetails = $this->daybook_model->delete_dayBookDetails($reqData);// Check if the employee exist if ($deletedayBookDetails) { $deletedayBookDetails['status'] = REST_Controller::HTTP_OK; // Set the response and exit $this->response($deletedayBookDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code } else { // Set the response and exit $this->response([ 'message' => 'No list were found', 'status' => REST_Controller::HTTP_NOT_FOUND ], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code } } public function updateDayBookDetails_post() { $reqData = $this->post('data'); $reqbyData = $this->post('localReqDetails'); $updateFor = $reqData['id']; $req['Type'] = $reqData['type']; $req['Amount'] = $reqData['amount']; $req['Description'] = $reqData['description']; $req['UpdatedBy'] = $reqbyData['localUserID']; $date = date('Y-m-d H:i:s'); $req['UpdatedOn'] = $date; $updatedayBookDetails = $this->daybook_model->update_dayBookDetails($req , $updateFor);// Check if the employee exist if ($updatedayBookDetails) { $updatedayBookDetails['status'] = REST_Controller::HTTP_OK; // Set the response and exit $this->response($updatedayBookDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code } else { // Set the response and exit $this->response([ 'message' => 'No list were found', 'status' => REST_Controller::HTTP_NOT_FOUND ], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code } } // add details daybook public function adddaybook_post() { $reqData = $this->post('data'); $reqbyData = $this->post('localReqDetails'); $req['Name'] = $reqData['name']; $req['Type'] = $reqData['type']; $req['Amount'] = $reqData['amount']; $req['Date'] = $reqData['date']; $req['Status'] = $reqData['status']; $req['Description'] = $reqData['description']; $req['BranchCode'] = $reqbyData['localBranchID']; $req['CreatedBy'] = $reqbyData['localUserID']; $date = date('Y-m-d H:i:s'); $req['CreatedOn'] = $date; $addDayBookDetails = $this->daybook_model->add_dayBook($req);// Check if the employee exist if ($addDayBookDetails) { $addDayBookDetails['status'] = REST_Controller::HTTP_OK; // Set the response and exit $this->response($addDayBookDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code } else { // Set the response and exit $this->response([ 'message' => 'No list were found', 'status' => REST_Controller::HTTP_NOT_FOUND ], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code } } public function updateDayBookStatusAdmin_post() { $reqData = $this->post('data'); $reqDetails = $this->post('requestDetails'); $time = date('Y-m-d H:i:s'); $dateTime = $time; $count = count($reqData); for($i=0; $i < $count; $i++) { $data[] = array( 'ID' => $reqData[$i]['dabookListId'], 'Approval_By' => $reqDetails['localUserID'], 'Status' => $reqData[$i]['ListCodeStatus'], 'Approval_Comments' => $reqData[$i]['comments'], 'UpdatedBy' => $reqDetails['localUserID'], 'UpdatedOn' => $dateTime, ); } $updateStatusAdminDetails = $this->daybook_model->update_status_admin($data);// Check if the employee exist if ($updateStatusAdminDetails) { $updateStatusAdminDetails['status'] = REST_Controller::HTTP_OK; // Set the response and exit $this->response($updateStatusAdminDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code } else { // Set the response and exit $this->response([ 'message' => 'No list were found', 'status' => REST_Controller::HTTP_NOT_FOUND ], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code } } public function getDayBookDetailsSuperAdmin_post() { $reqData = $this->post('data'); $reqDataBy = $this->post('localReqDetails'); $getDayBookDetails = $this->daybook_model->get_Daybook_Details_List_superAdmin($reqData, $reqDataBy);// Check if the employee exist if ($getDayBookDetails) { $getDayBookDetails['status'] = REST_Controller::HTTP_OK; // Set the response and exit $this->response($getDayBookDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code } else { // Set the response and exit $this->response([ 'message' => 'No list were found', 'status' => REST_Controller::HTTP_NOT_FOUND ], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code } } }