diff --git a/application/models/costcenter_model.php b/application/models/costcenter_model.php index 71ca880d..af6c03a8 100644 --- a/application/models/costcenter_model.php +++ b/application/models/costcenter_model.php @@ -271,9 +271,6 @@ function addNewcost($Cost) return TRUE; } - - - function EditBudget($Budget) diff --git a/application/models/requistion_model.php b/application/models/requistion_model.php new file mode 100644 index 00000000..769c2fbf --- /dev/null +++ b/application/models/requistion_model.php @@ -0,0 +1,159 @@ +db->select('SupplierID, SupplierName,Address'); + $this->db->from('T_SupplierDetailsN'); + //$this->db->where('roleId !=', 1); + $query = $this->db->get(); + + return $query->result(); + } + /** + * This function is used to get the userId information + * @return array $result : This is result of the query + */ + function getusers() + { + $this->db->select('userId, name'); + $this->db->from('tbl_users'); + //$this->db->where('roleId !=', 1); + $query = $this->db->get(); + + return $query->result(); + } + + + + function GetEmployeeDetails($EmpID) + { + + $this->db->select(' EMP.EmpID,EMP.Designation,DEPT.DEPCode,DEPT.DepartmentName'); + $this->db->from('T_Employee_Details EMP'); + $this->db->join('T_DepartmentDetails DEPT', 'EMP.Departmentcode = DEPT.DEPCode'); + $this->db->where('EMP.EmpID ',$EmpID ); + $query = $this->db->get(); + + return $query->result_array(); + } + + function GetCostCenterByDept($DeptId) + { + + $this->db->select('Mast.CostCenterCode,Mast.CostCenterName'); + $this->db->from('T_CostCenter_Master Mast '); + $this->db->join('T_CostCenter_Departments COST', 'COST.CostCenterCode = Mast.CostCenterCode'); + $this->db->where('COST.DEPCode ',$DeptId ); + $query = $this->db->get(); + // print_r( $this->db->last_query()); + return $query->result_array(); + } + + function GetAvailableBudgetAmount($CostCode,$Year,$BudgetType) + { + $this->db->select('BudgetAmount'); + $this->db->from('T_CostCenter_Budget'); + $this->db->where('CostCenterCode',$CostCode ); + $this->db->where('BudgetYear',$Year ); + $this->db->where('BudgetType',$BudgetType ); + $query = $this->db->get(); + + return $query->result_array(); + } + + + function GetMaterialCode($ReqType) + { + $this->db->select('MaterialCode, MaterialName,UOM'); + $this->db->from('T_MaterialMaster'); + $this->db->where('MaterialType',$ReqType ); + + $query = $this->db->get(); + + return $query->result_array(); + } + /** + * This function is used to get the Raw Material information + * @return array $result : This is result of the query + */ + function getRawMaterialList($MaterialCode) + { + $this->db->select('MaterialName,UOM'); + $this->db->from('T_MaterialMaster'); + $this->db->where('MaterialCode',$MaterialCode ); + $query = $this->db->get(); + + return $query->result_array(); + } + + /** + * This function is used to get the Config value from configuration table + * @return array $result : This is result of the query + */ + function getConfigValue($ConfigID ,$ConfigValue = '') + { + + $this->db->select('ConfigValue'); + $this->db->from('T_ConfigDetails'); + $this->db->where('Config_id ',$ConfigID ); + if($ConfigValue != '') + { + $this->db->where('ConfigValue != ',$ConfigValue ); + } + $query = $this->db->get(); + + return $query->result(); + } + + + /** + * This function is used to get the Purchase order Type + * @return array $result : This is result of the query + */ + function getAllEmployees() + { + $this->db->select('EmpID,FirstName,LastName'); + $this->db->from('T_Employee_Details'); + $query = $this->db->get(); + + return $query->result(); + } + + function addRequistion($Requistion) + { + $this->db->trans_start(); + $this->db->insert('T_Requestion_Master', $Requistion); + $insert_id = $this->db->affected_rows(); + $this->db->trans_complete(); + if($insert_id>0) + { + $subQuery = 'select max(ReqNo) as ReqNo from T_Requestion_Master'; + + $query = $this->db->query($subQuery); + + return $query->result_array(); + } + + } + function addRequistionDetails($Requistion) + { + $this->db->trans_start(); + $this->db->insert('T_Requestion_Details', $Requistion); + $insert_id = $this->db->affected_rows(); + $this->db->trans_complete(); + print_r($this->db->last_query()); + return $insert_id; + + } + + +} + + \ No newline at end of file