Cost center
This commit is contained in:
parent
ad96335580
commit
89aa1d2846
@ -135,10 +135,10 @@ function addNewcost($Cost)
|
||||
*/
|
||||
function GetCostCenterMaster($CostCenterCode)
|
||||
{
|
||||
$this->db->select('Cost.CostCenterCode,Cost.CostCenterName,Cost.ApprovedBy,emp.FirstName,emp.Designation' );
|
||||
$this->db->select('Cost.CostCenterCode,Cost.CostCenterName,Cost.ApprovedBy,emp.FirstName,emp.Designation,max(BudgetYear) as BudYear' );
|
||||
$this->db->from('T_CostCenter_Master Cost');
|
||||
$this->db->join('T_Employee_Details emp', 'emp.EmpID = Cost.ApprovedBy');
|
||||
|
||||
$this->db->join('T_CostCenter_Budget Bud', ' Bud.CostCenterCode = Cost.CostCenterCode');
|
||||
$this->db->where('Cost.CostCenterCode', $CostCenterCode);
|
||||
$query = $this->db->get();
|
||||
|
||||
@ -166,16 +166,66 @@ function addNewcost($Cost)
|
||||
* @param number $CostCenterCode : CostCenterCode as Parameter
|
||||
* @return array $result : This is user information
|
||||
*/
|
||||
function GetCostCenterBudget($CostCenterCode)
|
||||
function GetBudgetYear($CostCenterCode)
|
||||
{
|
||||
$this->db->select('Bud.BudgetType,Bud.BudgetYear,Bud.BudgetAmount,Bud.Remarks' );
|
||||
$this->db->from('T_CostCenter_Budget Bud');
|
||||
|
||||
$this->db->where('Bud.CostCenterCode', $CostCenterCode);
|
||||
$query = $this->db->get();
|
||||
|
||||
$subQuery = 'select BudgetYear from T_CostCenter_Budget where CostCenterCode=? ';
|
||||
|
||||
|
||||
$query = $this->db->query($subQuery, array($CostCenterCode));
|
||||
|
||||
return $query->result();
|
||||
}
|
||||
/**
|
||||
* This function used to get Cost center Budget information by Cost center ID
|
||||
* @param number $CostCenterCode : CostCenterCode as Parameter
|
||||
* @return array $result : This is user information
|
||||
*/
|
||||
function GetCostCenterBudget($CostCenterCode)
|
||||
{
|
||||
|
||||
$subQuery = 'select BudgetType,BudgetYear,BudgetAmount,Remarks from T_CostCenter_Budget where CostCenterCode=? and
|
||||
BudgetYear=(select max(BudgetYear) from T_CostCenter_Budget where CostCenterCode=?)';
|
||||
|
||||
|
||||
$query = $this->db->query($subQuery, array($CostCenterCode,$CostCenterCode));
|
||||
|
||||
return $query->result();
|
||||
}
|
||||
/**
|
||||
* This function used to get Cost center Budget information by Cost center ID
|
||||
* @param number $CostCenterCode : CostCenterCode as Parameter
|
||||
* @return array $result : This is user information
|
||||
*/
|
||||
function GetCostBudgetTypeByYear($CostCenterCode,$ConfigID,$Year)
|
||||
{
|
||||
|
||||
$subQuery = 'select ConfigValue from T_ConfigDetails Bud where ConfigValue not in
|
||||
(select BudgetType from T_CostCenter_Budget where CostCenterCode=? and BudgetYear=?) and Config_ID=? ';
|
||||
|
||||
$query = $this->db->query($subQuery, array($CostCenterCode,$Year,$ConfigID));
|
||||
|
||||
|
||||
return $query->result_array();
|
||||
|
||||
}
|
||||
/**
|
||||
* This function used to get Cost center Budget information by Cost center ID
|
||||
* @param number $CostCenterCode : CostCenterCode as Parameter
|
||||
* @return array $result : This is user information
|
||||
*/
|
||||
function GetCostCenterBudgetByYear($CostCenterCode,$Year)
|
||||
{
|
||||
|
||||
$subQuery = 'select BudgetType,BudgetYear,BudgetAmount,Remarks from T_CostCenter_Budget where CostCenterCode=? and
|
||||
budgetyear=?';
|
||||
|
||||
|
||||
$query = $this->db->query($subQuery, array($CostCenterCode,$Year));
|
||||
|
||||
return $query->result_array();
|
||||
}
|
||||
|
||||
/**
|
||||
* This function used to Department list which is not available in the Costcenter master
|
||||
* @param number $CostCenterCode : CostCenterCode as Parameter
|
||||
@ -183,24 +233,60 @@ function addNewcost($Cost)
|
||||
*/
|
||||
function GetDepartmentNotinCostCenter($CostCenterCode)
|
||||
{
|
||||
$code = ''.$CostCenterCode.'';
|
||||
echo $code ;
|
||||
$this->db->select('Dept.DEPCode,Dept.DepartmentName');
|
||||
$this->db->from('T_DepartmentDetails Dept');
|
||||
// $this->db->where_not_in('Dept.DEPCode','(select DEPCode from T_CostCenter_Departments where CostCenterCode = ''T0001'')');
|
||||
$query = $this->db->get();
|
||||
// $query = $this->db->get();
|
||||
print_r( $this->db->last_query());
|
||||
|
||||
$subQuery = 'select Dept.DEPCode,Dept.DepartmentName from T_DepartmentDetails Dept
|
||||
where Dept.DEPCode not in
|
||||
(select DEPCode from T_CostCenter_Departments where CostCenterCode=?) order by Dept.DEPCode asc';
|
||||
|
||||
$query = $this->db->query($subQuery, array($CostCenterCode));
|
||||
|
||||
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
function editcost($Cost, $CostCenterID)
|
||||
|
||||
/**
|
||||
* This function used to Department list which is not available in the Costcenter master
|
||||
* @param number $CostCenterCode : CostCenterCode as Parameter
|
||||
* @return array $result : This is user information
|
||||
*/
|
||||
function GetBudgetTypeNotinCostCenter($CostCenterCode,$ConfigID)
|
||||
{
|
||||
$this->db->where('CostCentreID', $CostCenterID);
|
||||
$this->db->update('T_CostCentre', $Cost);
|
||||
|
||||
|
||||
$subQuery = 'select ConfigValue from T_ConfigDetails Bud where ConfigValue not in
|
||||
(select BudgetType from T_CostCenter_Budget where CostCenterCode=? and BudgetYear=(select max(BudgetYear) from T_CostCenter_Budget)) and Config_ID=?';
|
||||
|
||||
$query = $this->db->query($subQuery, array($CostCenterCode,$ConfigID));
|
||||
|
||||
// print_r($this->db->last_query());
|
||||
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
function EditCost($Cost,$CostCenterCode)
|
||||
{
|
||||
$this->db->where('CostCenterCode', $CostCenterCode);
|
||||
|
||||
$this->db->update('T_CostCenter_Master', $Cost);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function EditBudget($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 DeleteBudget($BudgetType='',$BudgetYear='',$CostCenterCode ='')
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user