273 lines
11 KiB
PHP
Executable File
273 lines
11 KiB
PHP
Executable File
<?php
|
|
|
|
defined('BASEPATH') OR exit('No direct script access allowed');
|
|
|
|
// This can be removed if you use __autoload() in config.php OR use Modular Extensions
|
|
/** @noinspection PhpIncludeInspection */
|
|
require_once APPPATH . '/libraries/REST_Controller.php';
|
|
|
|
/**
|
|
* This is an example of a few basic user interaction methods you could use
|
|
* all done with a hardcoded array
|
|
*
|
|
* @package CodeIgniter
|
|
* @subpackage Rest Server
|
|
* @category Controller
|
|
* @author
|
|
* @license MIT
|
|
* @link
|
|
*/
|
|
class DayBook_Controller extends REST_Controller {
|
|
|
|
/*
|
|
* daybook updation details
|
|
* params:
|
|
* created by kdk
|
|
* */
|
|
function __construct()
|
|
{
|
|
// Construct the parent class
|
|
parent::__construct();
|
|
// load the university model
|
|
$this->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
|
|
}
|
|
}
|
|
|
|
|
|
public function empDayBookModuleAccessChk_post() {
|
|
$reqDataBy = $this->post('localReqDetails');
|
|
// print_r($reqDataBy);exit();
|
|
$empDayBkAccessChk = $this->daybook_model->emp_day_book_AccessChk($reqDataBy);// Check if the employee exist
|
|
if ($empDayBkAccessChk)
|
|
{
|
|
$empDayBkAccessChk['status'] = REST_Controller::HTTP_OK;
|
|
// Set the response and exit
|
|
$this->response($empDayBkAccessChk, 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 deleteDayBookFeePayableDetails_post() {
|
|
$reqData = $this->post('data');
|
|
$reqbyData = $this->post('requestDetails');
|
|
|
|
// print_r($reqbyData);exit();
|
|
$deletedayBookFeePayableDetails = $this->daybook_model->delete_dayBookFeePayableDetails($reqData);// Check if the employee exist
|
|
if ($deletedayBookFeePayableDetails)
|
|
{
|
|
$deletedayBookFeePayableDetails['status'] = REST_Controller::HTTP_OK;
|
|
// Set the response and exit
|
|
$this->response($deletedayBookFeePayableDetails, 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'];
|
|
$req['PaidTo'] = $reqData['paidTo'];
|
|
$req['PaidDescription'] = $reqData['description_paid'];
|
|
$req['VoucherNumber'] = $reqData['voucherNumber'];
|
|
$req['BranchCode'] = $reqData['branch'];
|
|
$req['Name'] = $reqData['name'];
|
|
$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'];
|
|
// $d = new DateTime($reqData['date']);
|
|
$req['Date'] = $reqData['date'];
|
|
$req['Status'] = $reqData['status'];
|
|
$req['Description'] = $reqData['description'];
|
|
$req['BranchCode'] = $reqbyData['localBranchID'];
|
|
$req['CreatedBy'] = $reqbyData['localUserID'];
|
|
$req['PaidTo'] = $reqData['paidTo'];
|
|
$req['PaidDescription'] = $reqData['description_paid'];
|
|
$req['VoucherNumber'] = $reqData['voucherNumber'];
|
|
$date = date('Y-m-d H:i:s');
|
|
$req['CreatedOn'] = $date;
|
|
// print_r($req);exit();
|
|
$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
|
|
}
|
|
}
|
|
|
|
}
|