siddharth_application/application/models/emppaydate_model.php
venbatechnologies@gmail.com 3650012dcb capital po updates done
2017-06-30 20:49:26 +05:30

126 lines
3.9 KiB
PHP
Executable File

<?php if(!defined('BASEPATH')) exit('No direct script access allowed');
class emppaydate_model extends CI_Model
{
/**
* This function is used to get the user listing count
* @param string $searchText : This is optional search text
* @return number $count : This is row count
*/
function emppayListingCount($searchText = ''){
$this->db->select('*');
$this->db->from('T_Emp_Pay_Data');
if(!empty($searchText)) {
$likeCriteria = "(Pay_Data_ID LIKE '%".$searchText."%'
OR EmpID LIKE '%".$searchText."%'
OR Basic_Pay LIKE '%".$searchText."%'
OR HRA_Rate LIKE '%".$searchText."%'
OR OT_Rate LIKE '%".$searchText."%'
OR Allowances LIKE '%".$searchText."%'
OR PF_Rate LIKE '%".$searchText."%'
OR ESI_Rate LIKE '%".$searchText."%'
OR is_Active LIKE '%".$searchText."%'
OR Food_Allowances LIKE '%".$searchText."%'
)";
$this->db->where($likeCriteria);
}
//$this->db->where('BaseT.userId !=', 1);
$query = $this->db->get();
return count($query->result());
}
/**
* This function is used to get the user listing count
* @param string $searchText : This is optional search text
* @param number $page : This is pagination offset
* @param number $segment : This is pagination limit
* @return array $result : This is result
*/
function emppayListing($searchText = '', $page, $segment)
{
$this->db->select('*');
$this->db->from('T_Emp_Pay_Data');
if(!empty($searchText)) {
$likeCriteria = "(Pay_Data_ID LIKE '%".$searchText."%'
OR EmpID LIKE '%".$searchText."%'
OR Basic_Pay LIKE '%".$searchText."%'
OR HRA_Rate LIKE '%".$searchText."%'
OR OT_Rate LIKE '%".$searchText."%'
OR Allowances LIKE '%".$searchText."%'
OR PF_Rate LIKE '%".$searchText."%'
OR ESI_Rate LIKE '%".$searchText."%'
OR is_Active LIKE '%".$searchText."%'
OR Food_Allowances LIKE '%".$searchText."%'
)";
$this->db->where($likeCriteria);
}
$this->db->limit($page, $segment);
$query = $this->db->get();
$result = $query->result();
return $result;
}
function addNewemppay($emppay)
{
$this->db->trans_start();
$this->db->insert('T_Emp_Pay_Data', $emppay);
$paydataid = $this->db->insert_id();
$this->db->trans_complete();
return $emppay;
}
function getUserInfo($paydataid)
{
$this->db->select();
$this->db->from('T_Emp_Pay_Data');
//$this->db->where('isDeleted', 0);
//$this->db->where('roleId !=', 1);
$this->db->where('Pay_Data_ID', $paydataid);
$query = $this->db->get();
return $query->result();
}
function editemppay($emppaydatas)
{
$paydateid=$emppaydatas['Pay_Data_ID'];
$this->db->where('Pay_Data_ID' ,$paydateid);
$this->db->update('T_Emp_Pay_Data',$emppaydatas);
return TRUE;
}
function viewemppay($emppaydata, $paydateid)
{
$this->db->where('Pay_Data_ID', $paydateid);
$this->db->update('T_Emp_Pay_Data', $emppaydata);
return TRUE;
}
}
?>