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

124 lines
4.1 KiB
PHP
Executable File

<?php if(!defined('BASEPATH')) exit('No direct script access allowed');
class monthlypay_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 monthlyListingCount($searchText = ''){
$this->db->select('*');
$this->db->from('T_Monthly_Pay_Inputs');
if(!empty($searchText)) {
$likeCriteria = "(Month_Year LIKE '%".$searchText."%'
OR EmpID LIKE '%".$searchText."%'
OR LOP_Days LIKE '%".$searchText."%'
OR OT_Hrs_Worked LIKE '%".$searchText."%'
OR Loan_Recovered LIKE '%".$searchText."%'
OR Loan_Balance LIKE '%".$searchText."%'
OR Incentives LIKE '%".$searchText."%'
OR Other_Deductions 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 monthlyListing($searchText = '', $page, $segment)
{
$this->db->select('*');
$this->db->from('T_Monthly_Pay_Inputs');
$this->db->order_by("Month_Year", "desc");
if(!empty($searchText)) {
$likeCriteria = "(Month_Year LIKE '%".$searchText."%'
OR EmpID LIKE '%".$searchText."%'
OR LOP_Days LIKE '%".$searchText."%'
OR OT_Hrs_Worked LIKE '%".$searchText."%'
OR Loan_Recovered LIKE '%".$searchText."%'
OR Loan_Balance LIKE '%".$searchText."%'
OR Incentives LIKE '%".$searchText."%'
OR Other_Deductions LIKE '%".$searchText."%'
)";
$this->db->where($likeCriteria);
}
$this->db->limit($page, $segment);
$query = $this->db->get();
$result = $query->result();
return $result;
}
function addNewmonthlisting($m_list)
{
$this->db->trans_start();
$this->db->insert('T_Monthly_Pay_Inputs', $asset);
$Asset_Code = $this->db->insert_id();
$this->db->trans_complete();
return $m_list;
}
function getUserInfo($EmpID,$month_year)
{
$this->db->select('Month_Year, EmpID, LOP_Days, OT_Hrs_Worked, Loan_Recovered, Loan_Balance, Incentives, Other_Deductions, Created_By, Created_Time, Last_Mod_By, Last_Mod_Time');
$this->db->from('T_Monthly_Pay_Inputs');
//$this->db->where('isDeleted', 0);
//$this->db->where('roleId !=', 1);
$this->db->where('EmpID', $EmpID);
$this->db->where('Month_Year', $month_year);
$query = $this->db->get();
return $query->result();
}
function editmonth($monthdata, $EmpID)
{
$monthyear=$monthdata['Month_Year'];
//$this->db->where('EmpID',$employeeid);
$this->db->where('EmpID' ,$EmpID);
//$this->db->where('Month_Year' ,$EmpID);
$this->db->where('Month_Year',$monthyear);
$this->db->update('T_Monthly_Pay_Inputs',$monthdata);
return TRUE;
}
function viewmonth($monthdata, $employeeid)
{
$this->db->order_by('Month_Year');
$this->db->where('EmpID', $employeeid);
$this->db->update('T_Monthly_Pay_Inputs', $monthdata);
return TRUE;
}
}
?>