267 lines
8.4 KiB
PHP
267 lines
8.4 KiB
PHP
<?php if(!defined('BASEPATH')) exit('No direct script access allowed');
|
|
|
|
require APPPATH . '/libraries/BaseController.php';
|
|
|
|
/**
|
|
* Class : Cost Center (Cost Center Controller)
|
|
* User Class to control all user related operations.
|
|
* @author : VenbaMail Mali
|
|
* @version : 1.1
|
|
* @since : 15 Feb 2016
|
|
*/
|
|
class emppaydate extends BaseController
|
|
{
|
|
/**
|
|
* This is default constructor of the class
|
|
*/
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
//$this->load->model('');
|
|
$this->load->library('session');
|
|
$this->load->library('form_validation');
|
|
//$this->load->library('pagination');
|
|
|
|
$this->isLoggedIn();
|
|
}
|
|
/**
|
|
* This function used to load the first screen of the user
|
|
*/
|
|
public function index()
|
|
{
|
|
$this->global['pageTitle'] = 'Siddharth : Cost';
|
|
|
|
$this->loadViews("emppaydate", $this->global);
|
|
}
|
|
|
|
/**
|
|
* This function is used to load the Cost list
|
|
*/
|
|
/*function monthlypayListing()
|
|
{
|
|
|
|
|
|
|
|
$searchText = $this->input->post('searchText');
|
|
$data['searchText'] = $searchText;
|
|
|
|
|
|
$count = $this->emppaydate_model->CostListingCount($searchText);
|
|
|
|
$returns = $this->paginationCompress ( "monthlypayListing/", $count, 5 );
|
|
|
|
$data['userRecords'] = $this->emppaydate_model->monthlypayListing($searchText, $returns["page"], $returns["segment"]);
|
|
|
|
//print_r( $data) ;
|
|
$this->global['pageTitle'] = 'Siddharth : montlypay List';
|
|
|
|
$this->loadViews("emppaydateListing", $this->global, $data, NULL);
|
|
|
|
}
|
|
|
|
/**
|
|
* This function is used to load the add new cost Center */
|
|
function addemppaydate()
|
|
{
|
|
|
|
|
|
|
|
//$data['emp_id'] = $this->monthlypay_model->getmonthlypay();
|
|
|
|
$this->global['pageTitle'] = 'siddharth : Add Monthly Pay';
|
|
|
|
$this->loadViews("addemppaydate", $this->global);
|
|
|
|
}
|
|
|
|
|
|
/*
|
|
function addNewmonthly()
|
|
{
|
|
|
|
|
|
$this->form_validation->set_rules('pay_data_id','Pay_Data_ID','trim|required');
|
|
$this->form_validation->set_rules('emp_id','emp_id','trim|required');
|
|
$this->form_validation->set_rules('basic_Pay','basic_Pay','trim|required');
|
|
$this->form_validation->set_rules('hra_rate','hra_rate','trim|required');
|
|
$this->form_validation->set_rules('OT_Rate','OT_Rate','trim|required');
|
|
$this->form_validation->set_rules('allowances','allowances','trim|required');
|
|
$this->form_validation->set_rules('PF_Rate','PF_Rate','trim|required');
|
|
$this->form_validation->set_rules('ESI_Rate','ESI_Rate','trim|required');
|
|
$this->form_validation->set_rules('All','All','trim|required');
|
|
|
|
if($this->form_validation->run() == FALSE)
|
|
{
|
|
$this->addmonthly();
|
|
}
|
|
else
|
|
{
|
|
$pay_data_id = $this->input->post('pay_data_id');
|
|
$emp_id = $this->input->post('emp_id');
|
|
$LOP_days = $this->input->post('basic_Pay');
|
|
$basic_Pay = $this->input->post('hra_rate');
|
|
$OT_Rate = $this->input->post('OT_Rate');
|
|
$allowances = $this->input->post('allowances');
|
|
$PF_Rate = $this->input->post('PF_Rate');
|
|
$ESI_Rate = $this->input->post('ESI_Rate');
|
|
$All = $this->input->post('All');
|
|
|
|
$CreateBy = $this->session->userdata ( 'userId' );
|
|
|
|
$dt = new DateTime('now', new DateTimeZone('Asia/Kolkata'));
|
|
|
|
$createddt = $dt->format('Y-m-d H:i:s');
|
|
|
|
$emppayExists = $this->emppaydate_model->checkemppayExists( $emppay);
|
|
|
|
if(count($emppay) == 0)
|
|
{
|
|
$emppay = array('pay_data_id'=>$pay_data_id, 'emp_id'=>$emp_id,'basic_Pay'=>$basic_Pay,'hra_rate'=>$hra_rate,'OT_Rate'=>$OT_Rate,'allowances'=>$allowances,'PF_Rate'=>$PF_Rate,'ESI_Rate'=>$ESI_Rate,'All'=>$All,'CreatedBy'=>$CreateBy,'createdDate'=>$createddt);
|
|
$this->monthlypay_model->addNewcost($Cost);
|
|
}
|
|
|
|
|
|
|
|
Print_r('Successfully Created Monthly pay details');
|
|
|
|
}
|
|
|
|
}
|
|
/**
|
|
* This function is used load user edit information
|
|
* @param number $userId : Optional : This is user id
|
|
*/
|
|
/*function editOldcost($CostCode = NULL)
|
|
{
|
|
|
|
if($CostCode == '')
|
|
{
|
|
$CostCenterID = $_GET['CostCode'];
|
|
}
|
|
else
|
|
{
|
|
|
|
$CostCenterID = $CostCode; }
|
|
|
|
$data['CostMaster'] = $this->costcenter_model->GetCostCenterMaster($CostCenterID);
|
|
$data['CostDepts'] = $this->costcenter_model->GetCostCenterDepartment($CostCenterID);
|
|
$data['CostBudget'] = $this->costcenter_model->GetCostCenterBudget($CostCenterID);
|
|
// $data['DeptList'] = $this->costcenter_model->GetDepartmentNotinCostCenter($CostCenterID);
|
|
|
|
|
|
$this->global['pageTitle'] = 'Siddharth : Edit Cost';
|
|
|
|
$this->loadViews("editOldcost", $this->global, $data,NULL);
|
|
|
|
}
|
|
|
|
function ech()
|
|
{
|
|
|
|
echo $this->input->post('CostCentreID');
|
|
echo $this->input->post('CostName');
|
|
echo $this->input->post('Description');
|
|
|
|
}
|
|
|
|
/**
|
|
* This function is used to edit the user information
|
|
|
|
function editcost()
|
|
{
|
|
|
|
$this->load->library('form_validation');
|
|
|
|
$CostCenterID = $this->input->post('CostCentreID');
|
|
|
|
$this->form_validation->set_rules('CostName','Cost Name','trim|required|');
|
|
$this->form_validation->set_rules('Description','Description','trim|required|');
|
|
|
|
|
|
if($this->form_validation->run() == FALSE)
|
|
{
|
|
$this->editcost($CostCenterID);
|
|
}
|
|
else
|
|
{
|
|
$CostCenterID = $this->input->post('CostCentreID');
|
|
$CostName = ucwords(strtolower($this->input->post('CostName')));
|
|
$Description = $this->input->post('Description');
|
|
|
|
|
|
|
|
//$this->costcenter_model->editcost($Cost);
|
|
|
|
$cost = array();
|
|
|
|
|
|
|
|
$Cost = array('CostCentreID'=>$CostCenterID,'CostName'=>$CostName, 'Description'=>$Description,'createdDate'=>date('Y-m-d H:i:sa'));
|
|
|
|
|
|
|
|
|
|
$result = $this->costcenter_model->editcost($Cost, $CostCenterID);
|
|
|
|
if($result == true)
|
|
{
|
|
$this->session->set_flashdata('success', 'Cost updated successfully');
|
|
}
|
|
else
|
|
{
|
|
$this->session->set_flashdata('error', 'Cost updation failed');
|
|
}
|
|
|
|
redirect('costListing');
|
|
}
|
|
|
|
}
|
|
function viewcost($CostCenterID = NULL)
|
|
{
|
|
|
|
if($CostCenterID == null)
|
|
{
|
|
redirect('costListing');
|
|
}
|
|
|
|
$data['Cost'] = $this->costcenter_model->getuserinfo($CostCenterID);
|
|
//$data['users'] = $this->purchaseorder_model->getusers();
|
|
|
|
$this->global['pageTitle'] = 'Siddharth : View Cost';
|
|
|
|
$this->loadViews("viewcost", $this->global, $data,NULL);
|
|
|
|
}
|
|
|
|
/**
|
|
* This function is used to delete the user using userId
|
|
* @return boolean $result : TRUE / FALSE
|
|
|
|
function deletecost()
|
|
{
|
|
if($this->isAdmin() == TRUE)
|
|
{
|
|
echo(json_encode(array('status'=>'access')));
|
|
}
|
|
else
|
|
{
|
|
$CostCenterID = $this->input->Costst('CostCentreID');
|
|
$cost = array('CreateDate'=>date('Y-m-d H:i:sa'));
|
|
|
|
$result = $this->costcenter_model->deletecost($Cost, $CostCenterID);
|
|
|
|
if ($result > 0) { echo(json_encode(array('status'=>TRUE))); }
|
|
else { echo(json_encode(array('status'=>FALSE))); }
|
|
}
|
|
}
|
|
*/
|
|
|
|
function pageNotFound()
|
|
{
|
|
$this->global['pageTitle'] = 'CodeInsect : 404 - Page Not Found';
|
|
|
|
$this->loadViews("404", $this->global, NULL, NULL);
|
|
}
|
|
}
|
|
|
|
?>
|