store stock updation
This commit is contained in:
parent
9355445e42
commit
b78adf1e67
@ -214,12 +214,20 @@ class storerequisitionlist extends BaseController
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function UpdateIssueRequistion()
|
function UpdateIssueRequistion()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
//echo 'ffd';
|
||||||
|
// die();
|
||||||
$ReqNO = $this->input->post('txtReqNo');
|
$ReqNO = $this->input->post('txtReqNo');
|
||||||
$RowCount = $this->input->post('txtRowCount');
|
$RowCount = $this->input->post('txtRowCount');
|
||||||
$dt = new DateTime('now', new DateTimeZone('Asia/Kolkata'));
|
$dt = new DateTime('now', new DateTimeZone('Asia/Kolkata'));
|
||||||
$createddt = $dt->format('Y-m-d H:i:s');
|
$createddt = $dt->format('Y-m-d H:i:s');
|
||||||
|
|
||||||
|
$UPdateby=$this->session->userdata('userId');
|
||||||
|
$date = new DateTime('now',new DateTimeZone('Asia/Kolkata'));
|
||||||
|
$UPdateon = $date->format('Y-m-d H:i:s');
|
||||||
|
|
||||||
|
|
||||||
$ItemStatus = STORE_ISSUSED;
|
$ItemStatus = STORE_ISSUSED;
|
||||||
|
|
||||||
@ -229,11 +237,13 @@ class storerequisitionlist extends BaseController
|
|||||||
$MaterialCode = $this->input->post('MaterialCode'.$i);
|
$MaterialCode = $this->input->post('MaterialCode'.$i);
|
||||||
// echo $MaterialCode;
|
// echo $MaterialCode;
|
||||||
$IssuedQuantity = $this->input->post('txtIssuedQuantity'.$i);
|
$IssuedQuantity = $this->input->post('txtIssuedQuantity'.$i);
|
||||||
|
|
||||||
|
|
||||||
// echo'Material issed';
|
// echo'Material issed';
|
||||||
if(strlen($IssuedQuantity)>0)
|
if(strlen($IssuedQuantity)>0)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
$Remarks = $this->input->post('txtRemarks'.$i);
|
$Remarks = $this->input->post('txtRemarks'.$i);
|
||||||
|
|
||||||
//echo $IssuedQuantity;
|
//echo $IssuedQuantity;
|
||||||
@ -243,14 +253,31 @@ class storerequisitionlist extends BaseController
|
|||||||
$storerequisition = array('StoreReqNo'=>$ReqNO,'MaterialCode'=>$MaterialCode,'QuantityIssued'=>$IssuedQuantity,'Status'=>$ItemStatus,'StoreComments'=>$Remarks,'UpdatedOn'=>$createddt,'UpdatedBy'=>$CreatedBy);
|
$storerequisition = array('StoreReqNo'=>$ReqNO,'MaterialCode'=>$MaterialCode,'QuantityIssued'=>$IssuedQuantity,'Status'=>$ItemStatus,'StoreComments'=>$Remarks,'UpdatedOn'=>$createddt,'UpdatedBy'=>$CreatedBy);
|
||||||
|
|
||||||
|
|
||||||
$this->storerequistion_model->UpdateStoreRequistionItem($storerequisition,$ReqNO,$MaterialCode);
|
$this->storerequistion_model->UpdateStoreRequistionItem($storerequisition,$ReqNO,$MaterialCode);
|
||||||
|
|
||||||
|
$getAvailableqty = $this->storerequistion_model->getItemQuantityFromStock(trim($MaterialCode));
|
||||||
|
|
||||||
|
if(count($getAvailableqty)>0)
|
||||||
|
{
|
||||||
|
$avlQty = $getAvailableqty[0]['Quantity'];
|
||||||
|
}
|
||||||
|
$BalanceQty=$avlQty-$IssuedQuantity;
|
||||||
|
// echo $BalanceQty;
|
||||||
|
// die();
|
||||||
|
$updatStock = array('Quantity'=>$BalanceQty,'Status'=>'0',
|
||||||
|
'Remarks'=>'Stock Deducted For'.$ReqNO,'UpdatedOn'=>$UPdateon,'UpdatedBy'=>$UPdateby);
|
||||||
|
|
||||||
|
$this->storerequistion_model->UpdateStock($updatStock,trim($MaterialCode));
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
//die();
|
||||||
|
echo "<script>alert('Updated Successfully!');</script>";
|
||||||
redirect('storerequisitionlisting','refresh');
|
redirect('storerequisitionlisting','refresh');
|
||||||
|
|
||||||
//echo 'Updated successfully';
|
|
||||||
|
|
||||||
}
|
}
|
||||||
/* this function use to search StoreRequistlist*/
|
/* this function use to search StoreRequistlist*/
|
||||||
|
|||||||
@ -446,4 +446,23 @@ $this->db->select('StoreReqNo,Sr.CostCenterCode,Cc.CostCenterName
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function getItemQuantityFromStock($MaterialCode)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
$subQuery = 'select Quantity from T_Store_Stockdetails where MaterialCode=?';
|
||||||
|
$query = $this->db->query($subQuery,array($MaterialCode));
|
||||||
|
return $query->result_array();
|
||||||
|
}
|
||||||
|
|
||||||
|
function UpdateStock($StockDetails,$MaterialCode)
|
||||||
|
{
|
||||||
|
|
||||||
|
$this->db->where('MaterialCode', $MaterialCode);
|
||||||
|
$this->db->update('T_Store_Stockdetails', $StockDetails);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue
Block a user