Requistion Flow
This commit is contained in:
parent
0510719349
commit
ad8f5fe3a1
@ -126,6 +126,67 @@ class requistion_model extends CI_Model
|
|||||||
return $query->result();
|
return $query->result();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function is used to get the Employee Details
|
||||||
|
* @return array $result : This is result of the query
|
||||||
|
*/
|
||||||
|
function getEmpIdByUserID($UserID)
|
||||||
|
{
|
||||||
|
$subQuery ='SELECT EMP.EmpID,EMP.FirstName,EMP.Designation,DEPT.DEPCode,DEPT.DepartmentName
|
||||||
|
FROM T_Employee_Details EMP JOIN T_DepartmentDetails DEPT ON
|
||||||
|
EMP.Departmentcode = DEPT.DEPCode
|
||||||
|
WHERE EMP.EmpID=(select EmpID from tbl_users where userId=?)';
|
||||||
|
|
||||||
|
$query = $this->db->query($subQuery, array($UserID));
|
||||||
|
|
||||||
|
|
||||||
|
return $query->result();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function is used to get the CostCenter for the Selected Employee
|
||||||
|
* @return array $result : This is result of the query
|
||||||
|
*/
|
||||||
|
function getCostCenterUserID($UserID)
|
||||||
|
{
|
||||||
|
$subQuery ='SELECT Mast.CostCenterCode,Mast.CostCenterName from T_CostCenter_Master Mast
|
||||||
|
LEFT JOIN T_CostCenter_Departments COST ON COST.CostCenterCode = Mast.CostCenterCode
|
||||||
|
WHERE COST.DEPCode=(select Departmentcode from T_Employee_Details where EmpID = (select EmpID from tbl_users where userId=?))';
|
||||||
|
|
||||||
|
$query = $this->db->query($subQuery, array($UserID));
|
||||||
|
//print_r($this->db->last_query());
|
||||||
|
return $query->result();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function is used to get the Purchase order Type
|
||||||
|
* @return array $result : This is result of the query
|
||||||
|
*/
|
||||||
|
function CheckDraftStatus($UserID)
|
||||||
|
{
|
||||||
|
$Status = 'Draft';
|
||||||
|
$subQuery = 'select count(ReqNo) as cnt from T_Requestion_Master where
|
||||||
|
Requestedby= ( select EmpID from tbl_users where userId=?) and status=?';
|
||||||
|
|
||||||
|
$query = $this->db->query($subQuery, array($UserID,$Status));
|
||||||
|
|
||||||
|
return $query->result();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* This function is used to get the Purchase order Type
|
||||||
|
* @return array $result : This is result of the query
|
||||||
|
*/
|
||||||
|
function getRequistListUserID($UserID)
|
||||||
|
{
|
||||||
|
|
||||||
|
$subQuery = 'select ReqNo, ReqType ,Status,CreatedDate from T_Requestion_Master where
|
||||||
|
Requestedby= ( select EmpID from tbl_users where userId=?)';
|
||||||
|
|
||||||
|
$query = $this->db->query($subQuery, array($UserID));
|
||||||
|
|
||||||
|
return $query->result();
|
||||||
|
}
|
||||||
|
|
||||||
function addRequistion($Requistion)
|
function addRequistion($Requistion)
|
||||||
{
|
{
|
||||||
$this->db->trans_start();
|
$this->db->trans_start();
|
||||||
@ -141,6 +202,20 @@ class requistion_model extends CI_Model
|
|||||||
return $query->result_array();
|
return $query->result_array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function RequistionIsExists($ReqBy)
|
||||||
|
{
|
||||||
|
$this->db->select('ReqNo');
|
||||||
|
$this->db->from('T_Requestion_Master');
|
||||||
|
$this->db->where('Status ','Draft' );
|
||||||
|
$this->db->where('Requestedby ',$ReqBy );
|
||||||
|
$query = $this->db->get();
|
||||||
|
|
||||||
|
if ($query->num_rows > 0) {
|
||||||
|
//echo $result->num_rows;
|
||||||
|
return $query->result_array();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
function addRequistionDetails($Requistion)
|
function addRequistionDetails($Requistion)
|
||||||
{
|
{
|
||||||
@ -148,11 +223,18 @@ class requistion_model extends CI_Model
|
|||||||
$this->db->insert('T_Requestion_Details', $Requistion);
|
$this->db->insert('T_Requestion_Details', $Requistion);
|
||||||
$insert_id = $this->db->affected_rows();
|
$insert_id = $this->db->affected_rows();
|
||||||
$this->db->trans_complete();
|
$this->db->trans_complete();
|
||||||
print_r($this->db->last_query());
|
// print_r($this->db->last_query());
|
||||||
return $insert_id;
|
return $insert_id;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function UpdateRequistion($Requistion, $ReqNo)
|
||||||
|
{
|
||||||
|
$this->db->where('ReqNo', $ReqNo);
|
||||||
|
$this->db->update('T_Requestion_Master', $Requistion);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user