Requistion Code

This commit is contained in:
gandhimathi Bharathirajan 2017-05-13 11:07:05 +05:30
parent 42fdd77ec0
commit 7a044c02a9

View File

@ -92,6 +92,21 @@ class requistion_model extends CI_Model
return $query->result_array();
}
function EditMaterialCode($ReqNo,$ReqType)
{
$subQuery ='SELECT Mat.MaterialCode,Mat.MaterialName,Mat.UOM
from T_MaterialMaster Mat where Mat.MaterialCode not in (select Req.MaterialCode from T_Requestion_Details Req
join T_Requestion_Master mast on Req.ReqNo = mast.ReqNo where mast.ReqNo=? and mast.ReqType=?
) and Mat.MaterialType=?';
$query = $this->db->query($subQuery, array($ReqNo,$ReqType,$ReqType));
return $query->result();
}
/**
* This function is used to get the Material details for the Request type
* @return array $result : This is result of the query
@ -198,7 +213,7 @@ class requistion_model extends CI_Model
function CheckDraftStatus($UserID)
{
$subQuery = 'select count(ReqNo) as cnt from T_Requestion_Master where
$subQuery = 'select count(ReqNo) as cnt,ReqNo from T_Requestion_Master where
Requestedby= ( select EmpID from tbl_users where userId=?) and status=?';
$query = $this->db->query($subQuery, array($UserID,REQ_DRAFT));
@ -212,7 +227,7 @@ class requistion_model extends CI_Model
function getRequistDetails($ReqID,$NoArray='')
{
$subQuery = 'select distinct ReqNo,ReqType,Requestedby,mast.CreatedDate,emp.FirstName,emp.EmpID,emp.Designation, Dept.DEPCode,Dept.DepartmentName
$subQuery = 'select distinct ReqNo,ReqType,Status,Requestedby,mast.CreatedDate,emp.FirstName,emp.EmpID,emp.Designation, Dept.DEPCode,Dept.DepartmentName
from T_Requestion_Master mast
join T_Employee_Details emp on mast.Requestedby = emp.EmpID
join T_DepartmentDetails Dept on emp.Departmentcode = Dept.DEPCode
@ -237,9 +252,9 @@ class requistion_model extends CI_Model
$subQuery = 'select ReqNo, ReqType ,Status,CreatedDate ,StatusName from T_Requestion_Master mast
join T_Status st on st.StatusCode= mast.Status where
Requestedby = ( select EmpID from tbl_users where userId=?)';
Requestedby = ( select EmpID from tbl_users where userId=?) and Status != ? ';
$query = $this->db->query($subQuery, array($UserID));
$query = $this->db->query($subQuery, array($UserID,REQ_DELETED));
return $query->result();
}
@ -297,6 +312,23 @@ class requistion_model extends CI_Model
$this->db->where('Requestedby ',$ReqBy );
$query = $this->db->get();
if ($query->num_rows > 0) {
//echo $result->num_rows;
return $query->result_array();
}
}
/**
* This function is used to check the Request Line Item is in Draft status
* @return array $result : This is result of the query
*/
function LineItemIsExists($ReqNo,$MaterialCode)
{
$this->db->select('ReqNo');
$this->db->from('T_Requestion_Details');
$this->db->where('ReqNo ',$ReqNo );
$this->db->where('MaterialCode ',$MaterialCode );
$query = $this->db->get();
if ($query->num_rows > 0) {
//echo $result->num_rows;
return $query->result_array();
@ -316,6 +348,32 @@ class requistion_model extends CI_Model
return $insert_id;
}
/**
* This function is used to delete the Line item from details into Database
* @return array $result : This is result of the query
*/
function DeleteRequistionLineItem( $ReqNo,$MaterialCode)
{
$this->db->where('ReqNo', $ReqNo);
$this->db->where('MaterialCode', $MaterialCode);
$this->db->delete('T_Requestion_Details');
return TRUE;
}
/**
* This function is used to update the details into Database
* @return array $result : This is result of the query
*/
function UpdateRequistionLineItem($Requist, $ReqNo,$MaterialCode)
{
$this->db->where('ReqNo', $ReqNo);
$this->db->where('MaterialCode', $MaterialCode);
$this->db->update('T_Requestion_Details',$Requist);
return TRUE;
}
/**
* This function is used to update the details into Database
* @return array $result : This is result of the query
@ -328,6 +386,8 @@ class requistion_model extends CI_Model
return TRUE;
}
/**
* This function is used to get the List of Requist details to the approver
* @return array $result : This is result of the query