'Newscreenaddedandissuefixed'

This commit is contained in:
gandhimathi Bharathirajan 2017-07-07 17:48:41 +05:30
parent c4e53a937d
commit c0df33bd76
2 changed files with 72 additions and 84 deletions

View File

@ -6,9 +6,9 @@ class store_model extends CI_Model
function viewStock()
{
$this->db->select('*');
$this->db->from('T_Store_Stockdetails ');
$this->db->select('st.*,MM.*');
$this->db->from('T_Store_Stockdetails st ');
$this->db->join('T_MaterialMaster MM','st.MaterialCode=MM.MaterialCode');
$query = $this->db->get();

View File

@ -21,9 +21,7 @@ class storerequistion_model extends CI_Model
return $result;
}
}
function getRawMaterialList($MaterialCode='')
@ -77,15 +75,18 @@ class storerequistion_model extends CI_Model
function getRequistionList()
{
$this->db->select('Sm.StoreReqNo,Sm.Requestedby,Sm.ReqDate,Sm.Status,Sd.Remarks,Sd.QuantityRequired,Sd.QuantityIssued,St.StatusName ');
$this->db->select('Sm.StoreReqNo, Emp.FirstName as Requestedby,Sm.ReqDate,Sm.Status,Sm.Comments as Remarks,St.StatusName,Dept.DepartmentName ');
$this->db->from ('T_Store_Requestion_Master Sm');
$this->db->join('T_Store_Requestion_Details Sd ',' Sd.StoreReqNo = Sm.StoreReqNo');
$this->db->join('tbl_users user','Sm.CreatedBy = user.userId ');
$this->db->join('T_Employee_Details Emp','Emp.EmpID= user.EmpID');
$this->db->join('T_DepartmentDetails Dept','Dept.DEPCode = Sm.DepartmentCode');
$this->db->join('T_Status St','St.StatusCode = Sm.Status');
// $this->db->where('Sm.Status ','ST036');
$this->db->where('Sm.Status ',STORE_APPROVAL);
$query = $this->db->get();
$result = $query->result();
// print_r($this->db->last_query());
//print_r($this->db->last_query());
//print_r($result);
return $result;
@ -127,7 +128,23 @@ class storerequistion_model extends CI_Model
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($StoreReqNo,$MaterialCode)
{
$this->db->select('StoreReqNo');
$this->db->from('T_Store_Requestion_Details');
$this->db->where('StoreReqNo ',$StoreReqNo );
$this->db->where('MaterialCode ',$MaterialCode );
$query = $this->db->get();
if ($query->num_rows > 0) {
//echo $result->num_rows;
return $query->result_array();
}
}
}
@ -284,75 +301,46 @@ class storerequistion_model extends CI_Model
* This function is used to get the List of Store Requist details to the approver
* @return array $result : This is result of the query
*/
function getApproverRequistList($UserID,$Status = '',$FromDate='' ,$ToDate='')
function getApproverRequistList($UserID)
{
// echo 'UserId: '.$UserID . 'From: '.$FromDate .'TO: '. $ToDate. 'Status: '. $Status;
$subQuery = ' select distinct Str.StoreReqNo,Str.Requestedby,Str.ReqDate,Str.Status,Str.CreatedDate,Str.Comments,St.StatusName
$subQuery = 'select distinct Str.StoreReqNo,Str.Requestedby,Str.ReqDate,Str.Status,Str.CreatedDate,Str.Comments,St.StatusName
from T_Store_Requestion_Master Str
join T_Status St on St.StatusCode = Str.Status
join T_Employee_Details Emp on Emp.Departmentcode =Str.DepartmentCode
join T_DepartmentDetails Dept on Dept.DEPCode = Emp.Departmentcode
where Str.Status not in(?,?) and Emp.Departmentcode in (select DEPCode from T_DepartmentDetails where HeadDept=
where Str.Status not in(?,?,?) and Emp.Departmentcode in (select DEPCode from T_DepartmentDetails where HeadDept=
(select HeadDept from T_DepartmentDetails where DEPCode = (select Departmentcode from T_Employee_Details where
EmpID=(select EmpID from tbl_users where userId=?))))';
$subQuery1 = $subQuery;
$query ='';
if($FromDate != '' && $ToDate != '' && $Status !='' )
{
$Where = 'and Str.CreatedDate >= ? and Str.CreatedDate <= ? and Status=?';
$subQuery1 .= $Where;
$query = $this->db->query($subQuery1, array(STORE_REJECT,STORE_DRAFT,$UserID,$FromDate,$ToDate,$Status));
}
else if($FromDate != '' && $ToDate != '' && $Status =='')
{
$Where = 'and Str.CreatedDate >= ? and Str.CreatedDate <= ? ';
$subQuery1 .= $Where;
$query = $this->db->query($subQuery1, array(STORE_REJECT,STORE_DRAFT,$UserID,$FromDate,$ToDate));
}
else if($Status != '' && $FromDate == '' && $ToDate == '')
{
$Where = 'and Status = ?';
$subQuery1 .= $Where;
$query = $this->db->query($subQuery1, array(STORE_REJECT,STORE_DRAFT,$UserID,$Status));
}
else
{
$query = $this->db->query($subQuery, array(STORE_REJECT,STORE_DRAFT,$UserID));
}
$query = $this->db->query($subQuery, array(STORE_REJECT,STORE_DRAFT,REQ_DELETED,$UserID));
//print_r($this->db->last_query());
//print_r($this->db->last_query());
return $query->result();
}
/**
* This function is used to get the Store Requsition List for the login user
* @return array $result : This is result of the query
*/
function getRequistDetails($StoreReqNo='',$NoArray='')
function getRequistDetails($StoreReqNo='')
{
$subQuery = 'select StoreReqNo,Str.Requestedby,Str.ReqDate,Dept.DepartmentName,Cm.CostCenterName,Bud.BudgetAmount,Bud.BudgetType from T_Store_Requestion_Master Str
$subQuery = 'select Str.StoreReqNo,Str.Requestedby,Str.ReqDate,Dept.DEPCode,Dept.DepartmentName,Cm.CostCenterCode,Cm.CostCenterName from T_Store_Requestion_Master Str
join T_DepartmentDetails Dept on Dept.DEPCode = Str.DepartmentCode
join T_CostCenter_Master Cm on Cm.CostCenterCode =Str.CostCenterCode
join T_CostCenter_Budget Bud on Bud.CostCenterCode =Cm.CostCenterCode
where StoreReqNo =? ';
where StoreReqNo =? ';
// print_r($this->db->last_subquery());
$query = $this->db->query($subQuery, array($StoreReqNo));
if($NoArray == '')
{
return $query->result_array();
}
else
{
// print_r($this->db->last_query());
return $query->result();
}
}
function editRequistDetails($StoreReqNo)
@ -367,30 +355,12 @@ $this->db->select('StoreReqNo,Sr.CostCenterCode,Cc.CostCenterName
}
// function editRequistItemList($StoreReqNo)
// {
// $this->db->select('StoreReqNo,Mat.MaterialCode,Str.QuantityRequired,Str.Remarks,Mat.MaterialName,Mat.UOM
// ');
// $this->db->from('T_Store_Requestion_Details Str');
// $this->db->join('T_MaterialMaster Mat ',' Mat.MaterialCode = Str.MaterialCode');
// $this->db->where('StoreReqNo',$StoreReqNo);
// $query = $this->db->get();
// return $query->result();
// }
/**
/**
* This function is used to get the Store Requsition List for the login user
* @return array $result : This is result of the query
*/
function getRequistItemList($StoreReqNo,$NoArray='')
function getRequistItemListApproval($StoreReqNo,$NoArray='')
{
$subQuery = ' select Str.StoreReqNo,Str.MaterialCode,Str.QuantityRequired,Str.Remarks,Mat.MaterialName,Mat.UOM,Ss.StatusName
@ -412,23 +382,41 @@ $this->db->select('StoreReqNo,Sr.CostCenterCode,Cc.CostCenterName
return $query->result();
}
}
/**
* This function is used to get the Available BudgetAmount for the Cost center
/**
* This function is used to get the Store Requsition List for the login user
* @return array $result : This is result of the query
*/
function GetAvailableBudgetAmount($CostCode,$Year,$BudgetType)
function getRequistItemList($StoreReqNo)
{
$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();
$subQuery = ' select Str.StoreReqNo,Str.MaterialCode,Str.QuantityRequired,Str.QuantityIssued,Str.Remarks,Str.StoreComments,Mat.MaterialName,Mat.UOM,Ss.StatusName
from T_Store_Requestion_Details Str
join T_MaterialMaster Mat on Mat.MaterialCode = Str.MaterialCode
join T_Status Ss on Ss.StatusCode = Str.Status
where Str.StoreReqNo =?';
$query = $this->db->query($subQuery, array($StoreReqNo));
// print_r($this->db->last_query());
return $query->result();
}
function UpdateStoreRequistionItem($Items,$ReqNo,$MaterialCode)
{
$this->db->where('StoreReqNo', $ReqNo);
$this->db->where('MaterialCode', $MaterialCode);
$this->db->update('T_Store_Requestion_Details', $Items);
return TRUE;
}
/*this function used to get the all store requistion list view*/
function Storeall($StoreReqNo,$IsArray='')