currentstock
This commit is contained in:
parent
bf72ad8fca
commit
c42f6120cf
@ -252,6 +252,7 @@ else
|
|||||||
$RawMaterialID = $_GET['RID'];
|
$RawMaterialID = $_GET['RID'];
|
||||||
$MaterialType = $_GET['MType'];
|
$MaterialType = $_GET['MType'];
|
||||||
$UOM = $_GET['UOM'];
|
$UOM = $_GET['UOM'];
|
||||||
|
$currentdate=$_GET['date1'];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -259,7 +260,7 @@ else
|
|||||||
}
|
}
|
||||||
|
|
||||||
$data['materialDetails'] = $this->rawmaterialdetails_model->getMaterialDetails($RawMaterialID);
|
$data['materialDetails'] = $this->rawmaterialdetails_model->getMaterialDetails($RawMaterialID);
|
||||||
$data['currentstock'] = $this->rawmaterialdetails_model->getMaterialstock($RawMaterialID);
|
$data['currentstock'] = $this->rawmaterialdetails_model->getMaterialstock($RawMaterialID, $currentdate);
|
||||||
$data['materialType'] = $this->rawmaterialdetails_model->getmaterialType($MaterialType );
|
$data['materialType'] = $this->rawmaterialdetails_model->getmaterialType($MaterialType );
|
||||||
$data['materialCategory'] = $this->rawmaterialdetails_model->getmaterialCategory($MaterialCategory);
|
$data['materialCategory'] = $this->rawmaterialdetails_model->getmaterialCategory($MaterialCategory);
|
||||||
$data['UOMList'] = $this->rawmaterialdetails_model->getUOM($UOM);
|
$data['UOMList'] = $this->rawmaterialdetails_model->getUOM($UOM);
|
||||||
|
|||||||
@ -109,26 +109,61 @@ class rawmaterialdetails_model extends CI_Model
|
|||||||
* @param number $userId : This is user id
|
* @param number $userId : This is user id
|
||||||
* @return array $result : This is user information
|
* @return array $result : This is user information
|
||||||
*/
|
*/
|
||||||
function getMaterialDetails($MaterialCode)
|
function getMaterialDetails($MaterialCode)
|
||||||
{
|
{
|
||||||
$this->db->select('*');
|
|
||||||
$this->db->from('T_MaterialMaster');
|
|
||||||
$this->db->where('MaterialCode', $MaterialCode);
|
$sql=" SELECT * FROM T_MaterialMaster WHERE MaterialCode =$MaterialCode";
|
||||||
$query = $this->db->get();
|
$query = $this->db->query( $sql);
|
||||||
//sprint_r($this->db->last_query());
|
return $query->result();
|
||||||
return $query->result();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getMaterialstock($MaterialCode)
|
|
||||||
|
function getMaterialstock($MaterialCode, $currentdate)
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
|
$dt = date('d',strtotime($currentdate));
|
||||||
|
$year = date('Y', strtotime($currentdate));
|
||||||
|
$month = date('m', strtotime($currentdate));
|
||||||
|
|
||||||
|
if($month<04)
|
||||||
|
{
|
||||||
|
//echo "b4finance";
|
||||||
|
$newyr = $year - 1;
|
||||||
|
$startdate = $newyr.'-'.'04'.'-'.'01';
|
||||||
|
// print_r( $startdate);die();
|
||||||
|
|
||||||
|
//echo $startdate;
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//echo "after Finance";
|
||||||
|
$startdate = $year.'-'.'04'.'-'.'01';
|
||||||
|
// print_r( $startdate);die();
|
||||||
|
// echo $startdate;
|
||||||
|
}
|
||||||
|
|
||||||
|
$nedt= $dt+1;
|
||||||
|
|
||||||
|
$newdate=$year.'-'.$month.'-'.$nedt;
|
||||||
|
|
||||||
|
|
||||||
$subquery="SELECT SUM(IF(Transaction_type='Add',Quantity,0)) - SUM(IF(Transaction_type='Reduce',Quantity,0))as remainingqty
|
$subquery="SELECT SUM(IF(Transaction_type='Add',Quantity,0)) - SUM(IF(Transaction_type='Reduce',Quantity,0))as remainingqty
|
||||||
FROM T_Material_stock_history
|
FROM T_Material_stock_history
|
||||||
where MaterialCode='$MaterialCode'";
|
WHERE MaterialCode=? AND CreatedOn >=? AND CreatedOn <=? ";
|
||||||
$query = $this->db->query($subquery);
|
$query = $this->db->query($subquery,array($MaterialCode,$startdate,$newdate));
|
||||||
return $query->result();
|
|
||||||
|
return $query->result_array();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function getAssetcode()
|
function getAssetcode()
|
||||||
{
|
{
|
||||||
$this->db->select('AssetCode,AssetName');
|
$this->db->select('AssetCode,AssetName');
|
||||||
|
|||||||
@ -53,19 +53,21 @@ if(!empty($materialDetails))
|
|||||||
|
|
||||||
if(!empty($currentstock))
|
if(!empty($currentstock))
|
||||||
{
|
{
|
||||||
foreach ($currentstock as $MC)
|
|
||||||
{
|
$currentstock =$currentstock[0]['remainingqty'];
|
||||||
// print_r($currentstock);
|
|
||||||
// die();
|
$x = $openstock;
|
||||||
$currentstock =$MC->remainingqty;
|
$y = $currentstock;
|
||||||
}
|
$total= $x + $y;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
if($currentstock <= $reorder){
|
if( $total <= $reorder){
|
||||||
|
|
||||||
echo '<script type="text/javascript">alert("Current Stock Low ");</script>';
|
echo '<script type="text/javascript">alert("Current Stock Low ");</script>';
|
||||||
|
|
||||||
@ -287,7 +289,7 @@ $("#Date").datepicker({
|
|||||||
<div class="col-md-3">
|
<div class="col-md-3">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="conversionfactor">Current Stock</label>
|
<label for="conversionfactor">Current Stock</label>
|
||||||
<input type="text" class="form-control" id="currentstock" readonly value="<?php echo $currentstock; ?>" name="currentstock" maxlength="255">
|
<input type="text" class="form-control" id="currentstock" readonly value="<?php echo $total; ?>" name="currentstock" maxlength="255">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@ -40,11 +40,12 @@
|
|||||||
{
|
{
|
||||||
foreach($userRecords as $record)
|
foreach($userRecords as $record)
|
||||||
{
|
{
|
||||||
|
$date=date("Y-m-d");
|
||||||
?>
|
?>
|
||||||
<tr>
|
<tr>
|
||||||
|
|
||||||
|
|
||||||
<td style="width:9%;"><u><a href="<?php echo base_url().'rawmaterialdetails/viewRawmaterial?RID='.$record->MaterialCode.'&MType='.$record->MaterialType.'&UOM='.$record->UOM ?>" data-toggle="tooltip" title="<?php echo $record->MaterialCode; ?> - Click here to view Material details"><?php echo $record->MaterialCode ?> </a></u></td>
|
<td style="width:9%;"><u><a href="<?php echo base_url().'rawmaterialdetails/viewRawmaterial?RID='.$record->MaterialCode.'&MType='.$record->MaterialType.'&UOM='.$record->UOM.'&date1='.$date ?>" data-toggle="tooltip" title="<?php echo $record->MaterialCode; ?> - Click here to view Material details"><?php echo $record->MaterialCode ?> </a></u></td>
|
||||||
<!--<td><u><a href="<?php echo base_url().'rawmaterialdetails/viewRawmaterial?RID='.$record->RMCode.'&MType='.$record->MaterialType.'&UOM='.$record->UOM ?>" data-toogle="tooltip" title="<?php echo $record->RMCode; ?> - Click here to view Material details"><?php echo $record->RMCode ?> </a></u></td>-->
|
<!--<td><u><a href="<?php echo base_url().'rawmaterialdetails/viewRawmaterial?RID='.$record->RMCode.'&MType='.$record->MaterialType.'&UOM='.$record->UOM ?>" data-toogle="tooltip" title="<?php echo $record->RMCode; ?> - Click here to view Material details"><?php echo $record->RMCode ?> </a></u></td>-->
|
||||||
<td style="width:12%;"><?php echo $record->MaterialName ?></td>
|
<td style="width:12%;"><?php echo $record->MaterialName ?></td>
|
||||||
<td style="width:10%;"><?php echo $record->MaterialType ?></td>
|
<td style="width:10%;"><?php echo $record->MaterialType ?></td>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user