Cost center
This commit is contained in:
parent
ad96335580
commit
89aa1d2846
@ -135,10 +135,10 @@ function addNewcost($Cost)
|
|||||||
*/
|
*/
|
||||||
function GetCostCenterMaster($CostCenterCode)
|
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->from('T_CostCenter_Master Cost');
|
||||||
$this->db->join('T_Employee_Details emp', 'emp.EmpID = Cost.ApprovedBy');
|
$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);
|
$this->db->where('Cost.CostCenterCode', $CostCenterCode);
|
||||||
$query = $this->db->get();
|
$query = $this->db->get();
|
||||||
|
|
||||||
@ -166,16 +166,66 @@ function addNewcost($Cost)
|
|||||||
* @param number $CostCenterCode : CostCenterCode as Parameter
|
* @param number $CostCenterCode : CostCenterCode as Parameter
|
||||||
* @return array $result : This is user information
|
* @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);
|
$subQuery = 'select BudgetYear from T_CostCenter_Budget where CostCenterCode=? ';
|
||||||
$query = $this->db->get();
|
|
||||||
|
|
||||||
|
$query = $this->db->query($subQuery, array($CostCenterCode));
|
||||||
|
|
||||||
return $query->result();
|
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
|
* This function used to Department list which is not available in the Costcenter master
|
||||||
* @param number $CostCenterCode : CostCenterCode as Parameter
|
* @param number $CostCenterCode : CostCenterCode as Parameter
|
||||||
@ -183,25 +233,61 @@ function addNewcost($Cost)
|
|||||||
*/
|
*/
|
||||||
function GetDepartmentNotinCostCenter($CostCenterCode)
|
function GetDepartmentNotinCostCenter($CostCenterCode)
|
||||||
{
|
{
|
||||||
$code = ''.$CostCenterCode.'';
|
|
||||||
echo $code ;
|
$subQuery = 'select Dept.DEPCode,Dept.DepartmentName from T_DepartmentDetails Dept
|
||||||
$this->db->select('Dept.DEPCode,Dept.DepartmentName');
|
where Dept.DEPCode not in
|
||||||
$this->db->from('T_DepartmentDetails Dept');
|
(select DEPCode from T_CostCenter_Departments where CostCenterCode=?) order by Dept.DEPCode asc';
|
||||||
// $this->db->where_not_in('Dept.DEPCode','(select DEPCode from T_CostCenter_Departments where CostCenterCode = ''T0001'')');
|
|
||||||
$query = $this->db->get();
|
$query = $this->db->query($subQuery, array($CostCenterCode));
|
||||||
// $query = $this->db->get();
|
|
||||||
print_r( $this->db->last_query());
|
|
||||||
return $query->result();
|
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;
|
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 ='')
|
function DeleteBudget($BudgetType='',$BudgetYear='',$CostCenterCode ='')
|
||||||
{
|
{
|
||||||
$this->db->where("BudgetType", $BudgetType);
|
$this->db->where("BudgetType", $BudgetType);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user