diff --git a/application/models/costcenter_model.php b/application/models/costcenter_model.php index 258afd2c..168d0bdb 100644 --- a/application/models/costcenter_model.php +++ b/application/models/costcenter_model.php @@ -126,9 +126,73 @@ function addNewcost($Cost) $this->db->where('CostCentreID', $CostCenterID); $query = $this->db->get(); + return $query->result(); + } + /** + * This function used to get Cost center Master information by Cost center ID + * @param number $CostCenterCode : CostCenterCode as Parameter + * @return array $result : This is user information + */ + function GetCostCenterMaster($CostCenterCode) + { + $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 emp', 'emp.EmpID = Cost.ApprovedBy'); + + $this->db->where('Cost.CostCenterCode', $CostCenterCode); + $query = $this->db->get(); + return $query->result(); } + /** + * This function used to get Cost center Department information by Cost center ID + * @param number $CostCenterCode : CostCenterCode as Parameter + * @return array $result : This is user information + */ + function GetCostCenterDepartment($CostCenterCode) + { + $this->db->select('Dept.DEPCode,Det.DepartmentName'); + $this->db->from('T_CostCenter_Departments Dept'); + $this->db->join('T_DepartmentDetails Det', 'Det.DEPCode = Dept.DEPCode'); + + $this->db->where('Dept.CostCenterCode', $CostCenterCode); + $query = $this->db->get(); + + 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) + { + $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(); + + return $query->result(); + } + /** + * 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 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()); + return $query->result(); + } function editcost($Cost, $CostCenterID) {