diff --git a/application/models/assetdetails_model.php b/application/models/assetdetails_model.php index b79724fc..ba9bf629 100755 --- a/application/models/assetdetails_model.php +++ b/application/models/assetdetails_model.php @@ -2,38 +2,7 @@ class assetdetails_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 assetListingCount($searchText = ''){ - - $this->db->select('*'); - $this->db->from('T_Asset_Details'); - - - if(!empty($searchText)) { - $likeCriteria = "(AssetCode LIKE '%".$searchText."%' - OR AssetName LIKE '%".$searchText."%' - OR Description LIKE '%".$searchText."%' - OR Description LIKE '%".$searchText."%' - OR DEPCode LIKE '%".$searchText."%' - OR Location LIKE '%".$searchText."%' - OR UserName LIKE '%".$searchText."%' - OR SupplierCode LIKE '%".$searchText."%' - OR DateOfPurchase LIKE '%".$searchText."%' - OR DateOfCommison LIKE '%".$searchText."%' - OR AssetStatus 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 @@ -41,30 +10,12 @@ class assetdetails_model extends CI_Model * @param number $segment : This is pagination limit * @return array $result : This is result */ - function assetListing($searchText = '', $page, $segment) + function assetListing() { $this->db->select('*'); $this->db->from('T_Asset_Details'); + - - if(!empty($searchText)) { - $likeCriteria = "(AssetCode LIKE '%".$searchText."%' - OR AssetName LIKE '%".$searchText."%' - OR Description LIKE '%".$searchText."%' - OR Description LIKE '%".$searchText."%' - OR DEPCode LIKE '%".$searchText."%' - OR Location LIKE '%".$searchText."%' - OR UserName LIKE '%".$searchText."%' - OR SupplierCode LIKE '%".$searchText."%' - OR DateOfPurchase LIKE '%".$searchText."%' - OR DateOfCommison LIKE '%".$searchText."%' - OR AssetStatus LIKE '%".$searchText."%' - - )"; - $this->db->where($likeCriteria); - } - - $this->db->limit($page, $segment); $query = $this->db->get(); $result = $query->result(); diff --git a/application/models/costcenter_model.php b/application/models/costcenter_model.php index 8cd8492b..ebb5f2a8 100755 --- a/application/models/costcenter_model.php +++ b/application/models/costcenter_model.php @@ -2,32 +2,7 @@ class costcenter_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 CostListingCount($searchText = '') - { - $this->db->select('Cost.CostCenterCode,Cost.CostCenterName, Cost.ApprovedBy,Emp.FirstName,Emp.Designation '); - $this->db->from('T_CostCenter_Master Cost'); - $this->db->join('T_Employee_Details as Emp', 'Emp.EmpID=Cost.ApprovedBy'); - - if(!empty($searchText)) { - $likeCriteria = "( Cost.CostCenterCode LIKE '%".$searchText."%' - OR Cost.CostCenterName LIKE '%".$searchText."%' - OR Cost.ApprovedBy LIKE '%".$searchText."%' - OR Emp.FirstName LIKE '%".$searchText."%' - OR Emp.Designation LIKE '%".$searchText."%' - )"; - $this->db->where($likeCriteria); - } - //$this->db->where('BaseT.isDeleted', 0); - //$this->db->where('BaseT.userId !=', 1); - $query = $this->db->get(); - //print_r($this->db->last_query()); - return count($query->result()); - } + /** * This function is used to get the user listing count * @param string $searchText : This is optional search text @@ -35,27 +10,16 @@ class costcenter_model extends CI_Model * @param number $segment : This is pagination limit * @return array $result : This is result */ - function CostListing($searchText = '', $page, $segment) + function CostListing() { $this->db->select('Cost.CostCenterCode as code,Cost.CostCenterName as CostCenterName , Cost.ApprovedBy as ApprovedBy,Emp.FirstName as FirstName,Emp.Designation as Designation '); $this->db->from('T_CostCenter_Master as Cost'); $this->db->join('T_Employee_Details as Emp', 'Emp.EmpID=Cost.ApprovedBy'); - if(!empty($searchText)) { - $likeCriteria = "( Cost.CostCenterCode LIKE '%".$searchText."%' - OR Cost.CostCenterName LIKE '%".$searchText."%' - OR Cost.ApprovedBy LIKE '%".$searchText."%' - OR Emp.FirstName LIKE '%".$searchText."%' - OR Emp.Designation 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(); - // print_r($this->db->last_query()); + return $result; } /** diff --git a/application/models/employeedetails_model.php b/application/models/employeedetails_model.php index 0420a629..776b62bc 100755 --- a/application/models/employeedetails_model.php +++ b/application/models/employeedetails_model.php @@ -2,38 +2,7 @@ class employeedetails_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 employeeListingCount($searchText = ''){ - - $this->db->select('count(*) as Count'); - $this->db->from('T_Employee_Details Emp'); - //$likeCriteria = ''; - $this->db->join('T_DepartmentDetails Dep', 'Emp.Departmentcode = Dep.DEPCode','left'); - if(!empty($searchText)) { - $likeCriteria = "(Emp.EmpID LIKE '%".$searchText."%' - OR Emp.FirstName LIKE '%".$searchText."%' - OR Emp.LastName LIKE '%".$searchText."%' - OR Emp.ContactNumber LIKE '%".$searchText."%' - OR Emp.EmailId LIKE '%".$searchText."%' - OR Emp.Designation LIKE '%".$searchText."%' - OR Dep.DepartmentName LIKE '%".$searchText."%' - - )"; - - $this->db->where($likeCriteria); - } - - - // print_r( $this->db->last_query()); - - $query = $this->db->get(); - // print_r( $this->db->last_query()); - return $query->result_array(); - } + /** @@ -43,29 +12,19 @@ class employeedetails_model extends CI_Model * @param number $segment : This is pagination limit * @return array $result : This is result */ - function employeeListing($searchText = '', $page, $segment) + function employeeListing() { $this->db->select(' Emp.*,Dep.DepartmentName as DepartmentName'); $this->db->from('T_Employee_Details Emp'); $this->db->join('T_DepartmentDetails Dep', 'Emp.Departmentcode = Dep.DEPCode','left'); - if(!empty($searchText)) { - $likeCriteria = "(Emp.EmpID LIKE '%".$searchText."%' - OR Emp.FirstName LIKE '%".$searchText."%' - OR Emp.LastName LIKE '%".$searchText."%' - OR Emp.ContactNumber LIKE '%".$searchText."%' - OR Emp.EmailId LIKE '%".$searchText."%' - OR Emp.Designation LIKE '%".$searchText."%' - OR Dep.DepartmentName LIKE '%".$searchText."%' - )"; - $this->db->where($likeCriteria); - } + $this->db->order_by("Emp.EmpID", "asc"); - $this->db->limit($page, $segment); + $query = $this->db->get(); - //print_r( $this->db->last_query()); + $result = $query->result(); return $result; } diff --git a/application/models/rawmaterialdetails_model.php b/application/models/rawmaterialdetails_model.php index 642281ce..4ed5ff59 100755 --- a/application/models/rawmaterialdetails_model.php +++ b/application/models/rawmaterialdetails_model.php @@ -2,28 +2,7 @@ class rawmaterialdetails_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 rawmaterialListingCount($searchText = '') - { - $this->db->select('*'); - $this->db->from('T_MaterialMaster'); - - if(!empty($searchText)) { - $likeCriteria = "(MaterialCode LIKE '%".$searchText."%' - OR MaterialName LIKE '%".$searchText."%' - OR MaterialType LIKE '%".$searchText."%' OR UOM 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 @@ -31,20 +10,12 @@ class rawmaterialdetails_model extends CI_Model * @param number $segment : This is pagination limit * @return array $result : This is result */ - function rawmaterialListing($searchText = '', $page, $segment) + function rawmaterialListing() { $this->db->select('*'); $this->db->from('T_MaterialMaster'); - if(!empty($searchText)) { - $likeCriteria = "(MaterialCode LIKE '%".$searchText."%' - OR MaterialName LIKE '%".$searchText."%' - OR MaterialType LIKE '%".$searchText."%' OR UOM LIKE '%".$searchText."%')"; - - $this->db->where($likeCriteria); - } - - $this->db->limit($page, $segment); + $query = $this->db->get(); $result = $query->result(); diff --git a/application/models/supplier_model.php b/application/models/supplier_model.php index 98c6593b..dc2f9554 100755 --- a/application/models/supplier_model.php +++ b/application/models/supplier_model.php @@ -2,42 +2,7 @@ class supplier_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 supplierListingCount($searchText = '') - { - $this->db->select('BaseT.SupplierID, 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_SupplierDetailsN as BaseT'); - //$this->db->join('tbl_users as users', 'users.userId = BaseT.userId','left'); - //$this->db->join('T_SupplierDetails as ID', 'ID.SupplierID = BaseT.SupplierID','left'); - if(!empty($searchText)) { - $likeCriteria = "(BaseT.SupplierID 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 @@ -45,35 +10,12 @@ class supplier_model extends CI_Model * @param number $segment : This is pagination limit * @return array $result : This is result */ - function supplierListing($searchText = '', $page, $segment) + function supplierListing() { $this->db->select('BaseT.SupplierID, 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,BaseT.CreatedOn'); $this->db->from('T_SupplierDetailsN as BaseT'); - //$this->db->join('tbl_users as users', 'users.userId = BaseT.userId','left'); - //$this->db->join('T_SupplierDetails as ID', 'ID.SupplierID = BaseT.SupplierID','left'); - if(!empty($searchText)) { - $likeCriteria = "(BaseT.SupplierID 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.CreatedOn 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); - $this->db->limit($page, $segment); + + $query = $this->db->get(); $result = $query->result(); diff --git a/application/models/user_model.php b/application/models/user_model.php index 160727fc..6cd0bc60 100755 --- a/application/models/user_model.php +++ b/application/models/user_model.php @@ -2,36 +2,7 @@ class User_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 userListingCount($searchText = '') - { - $this->db->select('EMP.EmpID,EMP.FirstName,EMP.LastName,EMP.Designation,EMP.EmailId,EMP.ContactNumber, - DEPT.DEPCode,DEPT.DepartmentName,role.role,user.userId'); - $this->db->from('T_Employee_Details EMP'); - $this->db->join('T_DepartmentDetails DEPT', 'EMP.Departmentcode = DEPT.DEPCode'); - $this->db->join('tbl_users user', 'user.EmpID = EMP.EmpID'); - $this->db->join('tbl_roles role', 'user.roleId = role.roleId'); - if(!empty($searchText)) { - $likeCriteria = "(EMP.FirstName LIKE '%".$searchText."%' - OR EMP.LastName LIKE '%".$searchText."%' - OR EMP.EmailId LIKE '%".$searchText."%' - OR EMP.ContactNumber LIKE '%".$searchText."%' - OR EMP.Designation LIKE '%".$searchText."%' - OR DEPT.DepartmentName LIKE '%".$searchText."%' - OR role.role LIKE '%".$searchText."%' - OR EMP.Designation LIKE '%".$searchText."%')"; - $this->db->where($likeCriteria); - } - $this->db->where('user.isDeleted !=', 1); - - $query = $this->db->get(); - - return count($query->result()); - } + /** * This function is used to get the user listing count @@ -40,7 +11,7 @@ class User_model extends CI_Model * @param number $segment : This is pagination limit * @return array $result : This is result */ - function userListing($searchText = '', $page, $segment) + function userListing() { $this->db->select('EMP.EmpID,EMP.FirstName,EMP.LastName,EMP.Designation,EMP.EmailId,EMP.ContactNumber, DEPT.DEPCode,DEPT.DepartmentName,role.role,user.userId'); @@ -48,21 +19,10 @@ class User_model extends CI_Model $this->db->join('T_DepartmentDetails DEPT', 'EMP.Departmentcode = DEPT.DEPCode'); $this->db->join('tbl_users user', 'user.EmpID = EMP.EmpID'); $this->db->join('tbl_roles role', 'user.roleId = role.roleId'); - if(!empty($searchText)) { - $likeCriteria = "(EMP.FirstName LIKE '%".$searchText."%' - OR EMP.LastName LIKE '%".$searchText."%' - OR EMP.EmailId LIKE '%".$searchText."%' - OR EMP.ContactNumber LIKE '%".$searchText."%' - OR EMP.Designation LIKE '%".$searchText."%' - OR DEPT.DepartmentName LIKE '%".$searchText."%' - OR role.role LIKE '%".$searchText."%' - OR EMP.Designation LIKE '%".$searchText."%')"; - $this->db->where($likeCriteria); - } - + $this->db->where('user.isDeleted !=', 1); - $this->db->limit($page, $segment); + $query = $this->db->get(); $result = $query->result();