Cost center
This commit is contained in:
parent
dff4fb7bc7
commit
b3cccd4ab5
@ -36,8 +36,7 @@ class costcenter_model extends CI_Model
|
|||||||
{
|
{
|
||||||
$this->db->select('BaseT.CostCentreID, BaseT.CostName, BaseT.Description,BaseT.CreatedDate');
|
$this->db->select('BaseT.CostCentreID, BaseT.CostName, BaseT.Description,BaseT.CreatedDate');
|
||||||
$this->db->from('T_CostCentre as BaseT');
|
$this->db->from('T_CostCentre 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)) {
|
if(!empty($searchText)) {
|
||||||
$likeCriteria = "(BaseT.CostCentreID LIKE '%".$searchText."%'
|
$likeCriteria = "(BaseT.CostCentreID LIKE '%".$searchText."%'
|
||||||
OR BaseT.CostName LIKE '%".$searchText."%'
|
OR BaseT.CostName LIKE '%".$searchText."%'
|
||||||
@ -62,13 +61,50 @@ class costcenter_model extends CI_Model
|
|||||||
function addNewcost($Cost)
|
function addNewcost($Cost)
|
||||||
{
|
{
|
||||||
$this->db->trans_start();
|
$this->db->trans_start();
|
||||||
$this->db->insert('T_CostCentre', $Cost);
|
$this->db->insert('T_CostCenter_Master', $Cost);
|
||||||
|
|
||||||
$insert_id = $this->db->insert_id();
|
$insert_id = $this->db->affected_rows();
|
||||||
|
|
||||||
$this->db->trans_complete();
|
$this->db->trans_complete();
|
||||||
|
|
||||||
return $insert_id;
|
return $insert_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function addCostCenterDepartment($Dept)
|
||||||
|
{
|
||||||
|
$this->db->trans_start();
|
||||||
|
$this->db->insert('T_CostCenter_Departments', $Dept);
|
||||||
|
|
||||||
|
$insert_id = $this->db->affected_rows();
|
||||||
|
|
||||||
|
$this->db->trans_complete();
|
||||||
|
// print_r( $this->db->last_query());
|
||||||
|
return $insert_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function addBudget($Budget)
|
||||||
|
{
|
||||||
|
$this->db->trans_start();
|
||||||
|
$this->db->insert('T_CostCenter_Budget', $Budget);
|
||||||
|
|
||||||
|
$insert_id = $this->db->affected_rows();
|
||||||
|
|
||||||
|
$this->db->trans_complete();
|
||||||
|
// print_r( $this->db->last_query());
|
||||||
|
return $insert_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getApproverName()
|
||||||
|
{
|
||||||
|
$this->db->select('EmpID,FirstName,LastName,Designation');
|
||||||
|
$this->db->from('T_Employee_Details');
|
||||||
|
$this->db->where('Departmentcode ', 'DEP13');
|
||||||
|
|
||||||
|
$query = $this->db->get();
|
||||||
|
|
||||||
|
return $query->result();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -96,17 +132,77 @@ function addNewcost($Cost)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
function DeleteBudget($BudgetType='',$BudgetYear='',$CostCenterCode ='')
|
||||||
* This function is used to delete the user information
|
|
||||||
* @param number $userId : This is user id
|
|
||||||
* @return boolean $result : TRUE / FALSE
|
|
||||||
*/
|
|
||||||
function deletecost($Cost, $CostCenterID)
|
|
||||||
{
|
{
|
||||||
$this->db->where('CostCentreID', $CostCenterID);
|
$this->db->where("BudgetType", $BudgetType);
|
||||||
$this->db->update('T_CostCentre', $Cost);
|
$this->db->where("BudgetYear", $BudgetYear);
|
||||||
|
$this->db->where("CostCenterCode", $CostCenterCode);
|
||||||
|
$this->db->delete('T_CostCenter_Budget');
|
||||||
|
//print_r( $this->db->last_query());
|
||||||
|
}
|
||||||
|
|
||||||
return $this->db->affected_rows();
|
function DeleteDepartment($DepCode='',$CostCode='')
|
||||||
|
{
|
||||||
|
$this->db->where("DEPCode", $DepCode);
|
||||||
|
$this->db->where("CostCenterCode", $CostCode);
|
||||||
|
$this->db->delete('T_CostCenter_Departments');
|
||||||
|
//print_r( $this->db->last_query());
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkDeptCostExists($DepCode='',$CostCode='')
|
||||||
|
{
|
||||||
|
$this->db->select('CostCenterCode,DEPCode');
|
||||||
|
$this->db->from('T_CostCenter_Departments');
|
||||||
|
$this->db->where('DEPCode',$DepCode);
|
||||||
|
$this->db->where('CostCenterCode',$CostCode);
|
||||||
|
|
||||||
|
$query = $this->db->get();
|
||||||
|
|
||||||
|
if ($query->num_rows > 0) {
|
||||||
|
return $query->result_array();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function checkCostDetailsExists($Code='',$CostName='')
|
||||||
|
{
|
||||||
|
$this->db->select('CostCenterCode');
|
||||||
|
$this->db->from('T_CostCenter_Master');
|
||||||
|
$this->db->where('CostCenterCode',$Code);
|
||||||
|
if ($CostName != '')
|
||||||
|
{
|
||||||
|
$this->db->where('CostCenterName !=',$CostName);
|
||||||
|
}
|
||||||
|
$query = $this->db->get();
|
||||||
|
|
||||||
|
if ($query->num_rows > 0) {
|
||||||
|
return $query->result_array();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* *//**
|
||||||
|
* This function is used to get the Department details from T_DepartmentDetails
|
||||||
|
* @return array $result : This is result of the query
|
||||||
|
*/
|
||||||
|
function getDepartment()
|
||||||
|
{
|
||||||
|
$this->db->select('DEPCode, DepartmentName');
|
||||||
|
$this->db->from('T_DepartmentDetails');
|
||||||
|
$this->db->where('IsActive =', 1);
|
||||||
|
$query = $this->db->get();
|
||||||
|
|
||||||
|
return $query->result();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* This function is used to get the Config value from configuration table
|
||||||
|
* @return array $result : This is result of the query
|
||||||
|
*/
|
||||||
|
function getConfigValue($ConfigID )
|
||||||
|
{
|
||||||
|
|
||||||
|
$this->db->select('ConfigValue');
|
||||||
|
$this->db->from('T_ConfigDetails');
|
||||||
|
$this->db->where('Config_id ',$ConfigID );
|
||||||
|
$query = $this->db->get();
|
||||||
|
|
||||||
|
return $query->result();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
Loading…
Reference in New Issue
Block a user