134 lines
5.2 KiB
PHP
Executable File
134 lines
5.2 KiB
PHP
Executable File
<?php if(!defined('BASEPATH')) exit('No direct script access allowed');
|
|
|
|
class department_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 departmentListingCount($searchText = '')
|
|
// {
|
|
// $this->db->select('BaseT.DepartmentID, BaseT.SupplierName, BaseT.Address, BaseT.ContactNumber, BaseT.AlternateContactNumber,BaseT.EmailAddress,BaseT.Exiseregistration,BaseT.TIN,BaseT.PAN,BaseT.GSTNO,BaseT.GSTRange,BaseT.CollectrateAddress,BaseT.UANumber,BaseT.PaymentTerms,BaseT.PaymentDays,BaseT.PayableAT');
|
|
// $this->db->from('T_DepartmentDetails as BaseT');
|
|
// //$this->db->join('tbl_users as users', 'users.userId = BaseT.userId','left');
|
|
// //$this->db->join('T_SupplierDetails as ID', 'ID.DepartmentID = BaseT.DepartmentID','left');
|
|
// if(!empty($searchText)) {
|
|
// $likeCriteria = "(BaseT.DepartmentID LIKE '%".$searchText."%'
|
|
// OR BaseT.SupplierName LIKE '%".$searchText."%'
|
|
// OR BaseT.Address LIKE '%".$searchText."%'
|
|
// OR BaseT.ContactNumber LIKE '%".$searchText."%'
|
|
// OR BaseT.AlternateContactNumber LIKE '%".$searchText."%'
|
|
// OR BaseT.EmailAddress LIKE '%".$searchText."%'
|
|
// OR BaseT.Exiseregistration LIKE '%".$searchText."%'
|
|
// OR BaseT.TIN LIKE '%".$searchText."%'
|
|
// OR BaseT.PAN LIKE '%".$searchText."%'
|
|
// OR BaseT.GSTNO LIKE '%".$searchText."%'
|
|
// OR BaseT.GSTRange LIKE '%".$searchText."%'
|
|
// OR BaseT.CollectrateAddress LIKE '%".$searchText."%'
|
|
// OR BaseT.UANumber LIKE '%".$searchText."%'
|
|
// OR BaseT.PaymentTerms LIKE '%".$searchText."%'
|
|
// OR BaseT.PaymentDays LIKE '%".$searchText."%'
|
|
// OR BaseT.PayableAT LIKE '%".$searchText."%')";
|
|
// $this->db->where($likeCriteria);
|
|
// }
|
|
// //$this->db->where('BaseT.isDeleted', 0);
|
|
// //$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 departmentListing()
|
|
{
|
|
$this->db->select('BaseT.DepartmentName, BaseT.DEPCode, BaseT.HeadDept, BaseT.IsActive');
|
|
$this->db->from('T_DepartmentDetails as BaseT');
|
|
$this->db->order_by("BaseT.DEPCode", "asc");
|
|
$query = $this->db->get();
|
|
$result = $query->result();
|
|
return $result;
|
|
}
|
|
|
|
// function ($searchText = '')
|
|
// {
|
|
// if(!empty($searchText)) {
|
|
// $likeCriteria = "(BaseT.DepartmentName LIKE '%".$searchText."%'
|
|
// OR BaseT.DEPCode LIKE '%".$searchText."%'
|
|
// OR BaseT.HeadDept LIKE '%".$searchText."%'
|
|
// OR BaseT.IsActive LIKE '%".$searchText."%')";
|
|
// $this->db->where($likeCriteria);
|
|
// }
|
|
// //$this->db->where('BaseT.isDeleted', 0);
|
|
// //$this->db->where('BaseT.userId !=', 1);
|
|
// // $this->db->limit($page, $segment);
|
|
// $query = $this->db->get();
|
|
|
|
// $result = $query->result();
|
|
// return $result;
|
|
// }
|
|
/**
|
|
* This function used to get user information by id
|
|
* @param number $userId : This is user id
|
|
* @return array $result : This is user information
|
|
*/
|
|
|
|
function addNewdepartment($department)
|
|
{
|
|
|
|
$this->db->insert('T_DepartmentDetails', $department);
|
|
|
|
$SID = $this->db->affected_rows();
|
|
|
|
return $SID;
|
|
|
|
}
|
|
|
|
function getdepcode()
|
|
{
|
|
//$limit = 12;
|
|
$this->db->distinct();
|
|
$this->db->select('DEPCode, DepartmentName');
|
|
$this->db->from('T_DepartmentDetails');
|
|
$this->db->where('IsActive =', 1);
|
|
//$this->db->limit($limit);
|
|
$query = $this->db->get();
|
|
|
|
return $query->result();
|
|
}
|
|
|
|
/**
|
|
* This function used to get user information by id
|
|
* @param number $userId : This is user id
|
|
* @return array $result : This is user information
|
|
*/
|
|
function getDeptInfo($DEPCode='')
|
|
{
|
|
$this->db->select('*');
|
|
$this->db->from('T_DepartmentDetails');
|
|
$this->db->where('DEPCode', $DEPCode);
|
|
$query = $this->db->get();
|
|
// print_r($this->db->last_query());
|
|
return $query->result();
|
|
}
|
|
/* This function to get the Supplier Address on respective Supplier ID */
|
|
|
|
function Updatedepartment($department, $DEPCode)
|
|
{
|
|
$this->db->where('DEPCode', $DEPCode);
|
|
$this->db->update('T_DepartmentDetails', $department);
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
?>
|