stock adjustments
This commit is contained in:
parent
69efd99d28
commit
1f86b079f3
@ -1352,6 +1352,7 @@ class batchcard extends BaseController
|
||||
$status = $this->input->post('transtatus');
|
||||
$CreatedBy = $this->session->userdata('userId');
|
||||
$absaluteQty = abs($Qty);
|
||||
$Isactive=1;
|
||||
|
||||
// echo $Qty;
|
||||
// echo "abs";
|
||||
@ -1366,7 +1367,8 @@ class batchcard extends BaseController
|
||||
// echo $createddt;
|
||||
// die();
|
||||
|
||||
$adjustmentaarray = array('MaterialCode'=>$materialcode,'ActualQuantity'=>$ActualQty,'Quantity'=>$absaluteQty,'SupplierID'=>$supplier,'Reason'=>$reason,'Description'=>$Description,'CreatedOn'=>$createddt,'CreatedBy'=>$CreatedBy);
|
||||
$adjustmentaarray = array('MaterialCode'=>$materialcode,'ActualQuantity'=>$ActualQty,'Quantity'=>$absaluteQty,'SupplierID'=>$supplier,'Reason'=>$reason,'Description'=>$Description,'CreatedOn'=>$createddt,
|
||||
'CreatedBy'=>$CreatedBy,'Isactive'=>$Isactive);
|
||||
|
||||
$materialadjust = $this->batchcard_model->AddmaterialAdjustment($adjustmentaarray);
|
||||
|
||||
@ -1381,7 +1383,7 @@ class batchcard extends BaseController
|
||||
}
|
||||
|
||||
|
||||
$historytable = array('SupplierID'=>$supplier,'MaterialCode'=>$materialcode,'Transaction_type'=>$status,'Ref_Type'=>'Adjust','Quantity'=>$absaluteQty,'CreatedBy'=>$CreatedBy,'CreatedOn'=>$createddt,'Ref_No'=>$adjustId);
|
||||
$historytable = array('SupplierID'=>$supplier,'MaterialCode'=>$materialcode,'Transaction_type'=>$status,'Ref_Type'=>'Adjust','Quantity'=>$absaluteQty,'CreatedBy'=>$CreatedBy,'CreatedOn'=>$createddt,'Ref_No'=>$adjustId,'Isactive'=>$Isactive);
|
||||
|
||||
$historyadd = $this->batchcard_model->AddMaterialHistory($historytable);
|
||||
|
||||
@ -1710,25 +1712,6 @@ class batchcard extends BaseController
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
echo "Updated";
|
||||
|
||||
|
||||
|
||||
|
||||
@ -1740,18 +1723,56 @@ class batchcard extends BaseController
|
||||
{
|
||||
|
||||
$AdjustmentId = $_GET['AdjustmentId'];
|
||||
$Supplier = $_GET['sn'];
|
||||
$date =$_GET['date'];
|
||||
$MaterialCode =$_GET['mc'];
|
||||
$this->global['pageTitle'] = 'Siddharth : Material Adjustment';
|
||||
$data['netQuantityarray'] = $this->batchcard_model->GetNetQty($MaterialCode,$date,$Supplier);
|
||||
//print_r($data['netQuantityarray']);
|
||||
$data['materailAdjustmentlist'] = $this->batchcard_model->getEditMaterialAdjustments($AdjustmentId);
|
||||
|
||||
$data['materiallist'] = $this->batchcard_model->getMaterial();
|
||||
|
||||
$data['getSupplierlist'] = $this->batchcard_model->getSupplierlist();
|
||||
|
||||
// print_r($data['materailAdjustmentlist']);
|
||||
|
||||
|
||||
|
||||
$this->global['pageTitle'] = 'Siddharth : Material Adjustment';
|
||||
$this->loadViews("editmaterialadjustment", $this->global,$data,NULL);
|
||||
$this->loadViews("editmaterialadjustment", $this->global,$data,NULL);
|
||||
|
||||
//return true;
|
||||
}
|
||||
function UpdateQuantity()
|
||||
{
|
||||
$adjquantity =$this->input->post('adjquantity');
|
||||
$reason =$this->input->post('reason');
|
||||
$id = $this->input->post('adid');
|
||||
//echo $id;
|
||||
$adjustquantity = $this->input->post('editquantity');
|
||||
$description = $this->input->post('desc');
|
||||
$updatequantitydes = array('Quantity'=>$adjustquantity,'Description'=>$description,'Reason'=>$reason,'ActualQuantity'=>$adjquantity);
|
||||
//print_r($updatequantitydes);
|
||||
$updatequantity=array('Quantity'=>$adjustquantity);
|
||||
$UpdateQuantityHistory = $this->batchcard_model->updateQuantityStockHistory($updatequantity,$id);
|
||||
$UpdateQuantityAdj = $this->batchcard_model->updateQuantityAdjusment($updatequantitydes,$id);
|
||||
|
||||
// print_r($updatequantityadj);
|
||||
|
||||
if((count($updatequantityadj)>0) &&(count($updatequantityhistory)))
|
||||
{
|
||||
echo "Details Added Successfully";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "Something Went Wrong,Please Try Again";
|
||||
}
|
||||
//$this->loadViews("editmaterialadjustment", $this->global,$data,NULL);
|
||||
}
|
||||
function Deletequantity()
|
||||
{
|
||||
$AdjustmentId = $_GET['AdjustmentId'];
|
||||
$Isactive=0;
|
||||
$Updateactive =array('Isactive'=>$Isactive);
|
||||
$this->batchcard_model->updateisactiveadjusment($Updateactive,$AdjustmentId);
|
||||
$this->batchcard_model->updateisactiveastockhistory($Updateactive,$AdjustmentId);
|
||||
$this->loadViews("editmaterialadjustment", $this->global,$data,NULL);
|
||||
}
|
||||
|
||||
|
||||
|
||||
4
application/logs/log-2018-05-31.php
Normal file
4
application/logs/log-2018-05-31.php
Normal file
@ -0,0 +1,4 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); ?>
|
||||
|
||||
ERROR - 2018-05-31 11:30:40 --> Severity: Notice --> Use of undefined constant Adjust - assumed 'Adjust' C:\xampp\htdocs\siddharth_application\application\models\batchcard_model.php 781
|
||||
ERROR - 2018-05-31 11:30:41 --> Severity: Notice --> Undefined variable: updatequantityadj C:\xampp\htdocs\siddharth_application\application\controllers\batchcard.php 1507
|
||||
@ -758,18 +758,7 @@ and CreatedOn >= ? and CreatedOn<=? and SupplierID=? group by Addqty';
|
||||
}
|
||||
|
||||
|
||||
function getEditMaterialAdjustments($AdjustmentId)
|
||||
{
|
||||
|
||||
$this->db->select('T_Material_Adjustment.*,SupplierName,MaterialName');
|
||||
$this->db->from('T_Material_Adjustment');
|
||||
$this->db->join('T_SupplierDetailsN', 'T_Material_Adjustment.SupplierID = T_SupplierDetailsN.SupplierID');
|
||||
$this->db->join('T_MaterialMaster', 'T_MaterialMaster.MaterialCode = T_Material_Adjustment.MaterialCode');
|
||||
$this->db->where('T_Material_Adjustment.AdjustmentId',$AdjustmentId);
|
||||
$res = $this->db->get();
|
||||
return $res->result();
|
||||
}
|
||||
|
||||
|
||||
|
||||
function save_rawmaterialto_materialHistory($materialhistory)
|
||||
{
|
||||
@ -971,6 +960,65 @@ and CreatedOn >= ? and CreatedOn<=? and SupplierID=? group by Addqty';
|
||||
$this->db->update('T_FinalProduct_CoProduct_Materials', $coparray);
|
||||
return TRUE;
|
||||
}
|
||||
function getEditMaterialAdjustments($AdjustmentId)
|
||||
{
|
||||
|
||||
$this->db->select('T_Material_Adjustment.*,SupplierName,MaterialName,Description,AdjustmentId,ActualQuantity,T_Material_stock_history.Quantity');
|
||||
$this->db->from('T_Material_Adjustment');
|
||||
$this->db->join('T_Material_stock_history', 'T_Material_Adjustment.AdjustmentId = T_Material_stock_history.Ref_No');
|
||||
$this->db->join('T_SupplierDetailsN', 'T_Material_Adjustment.SupplierID = T_SupplierDetailsN.SupplierID');
|
||||
$this->db->join('T_MaterialMaster', 'T_MaterialMaster.MaterialCode = T_Material_Adjustment.MaterialCode');
|
||||
$this->db->where('T_Material_Adjustment.AdjustmentId',$AdjustmentId);
|
||||
$res = $this->db->get();
|
||||
return $res->result();
|
||||
}
|
||||
//created by TamilBala
|
||||
//for update quantity stockhistory
|
||||
function updateQuantityStockHistory($updatequantity,$id)
|
||||
{
|
||||
|
||||
$this->db->where('Ref_No',$id);
|
||||
$this->db->where('Ref_Type',Adjust);
|
||||
$this->db->update('T_Material_stock_history',$updatequantity);
|
||||
$r = $this->db->affected_rows();
|
||||
//return $r->result();
|
||||
//echo "HIS";
|
||||
|
||||
}
|
||||
|
||||
//created by TamilBala
|
||||
//for update quantity T_Material_Adjustment
|
||||
|
||||
function updateQuantityAdjusment($updatequantitydes,$id)
|
||||
{
|
||||
$this->db->where('AdjustmentId',$id);
|
||||
$this->db->update('T_Material_Adjustment',$updatequantitydes);
|
||||
$r = $this->db->affected_rows();
|
||||
return $r;
|
||||
|
||||
}
|
||||
//created by TamilBala
|
||||
//for update isactive T_Material_Adjustment
|
||||
function updateisactiveadjusment($Updateactive,$AdjustmentId)
|
||||
{
|
||||
$this->db->where('AdjustmentId',$AdjustmentId);
|
||||
$this->db->update('T_Material_Adjustment',$Updateactive);
|
||||
$r = $this->db->affected_rows();
|
||||
return $r;
|
||||
|
||||
}
|
||||
|
||||
//created by TamilBala
|
||||
//for update isactive stockhistory
|
||||
function updateisactiveastockhistory($Updateactive,$AdjustmentId)
|
||||
{
|
||||
$this->db->where('Ref_No',$AdjustmentId);
|
||||
$this->db->where('Ref_Type',Adjust);
|
||||
$this->db->update('T_Material_stock_history',$Updateactive);
|
||||
$r = $this->db->affected_rows();
|
||||
return $r;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -5,24 +5,31 @@ $edit_Qty_aspersystem='';
|
||||
$edit_Actual_Qty= '';
|
||||
$edit_Adjustable_qty= '';
|
||||
$edit_Description='';
|
||||
$editquantity='';
|
||||
$editid='';
|
||||
$latestupdate='';
|
||||
|
||||
if(!empty($materailAdjustmentlist))
|
||||
{
|
||||
//print_r($materailAdjustmentlist);
|
||||
foreach($materailAdjustmentlist as $mat)
|
||||
{
|
||||
|
||||
$editid = $mat->AdjustmentId;
|
||||
$supplier = $mat->SupplierID;
|
||||
$suppliername=$mat->SupplierName;
|
||||
$materialcode = $mat->MaterialCode;
|
||||
$date = $mat->CreatedOn;
|
||||
// $edit_Qty_aspersystem= $mat->;
|
||||
$editquantity= $mat->Quantity;
|
||||
$edit_Actual_Qty= $mat->ActualQuantity;
|
||||
$edit_Adjustable_qty= '';
|
||||
$edit_Description='';
|
||||
|
||||
// $edit_Adjustable_qty= '';
|
||||
$edit_Description= $mat->Description;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//$latestupdate=parseFloat($Addqty)-parseFloat($reduceqty);
|
||||
//print_r($latestupdate);
|
||||
?>
|
||||
|
||||
|
||||
@ -78,7 +85,7 @@ $(function() {
|
||||
|
||||
<div class="row" style="padding:0% 2%">
|
||||
<div class="col-md-12" >
|
||||
<div class="col-md-3">
|
||||
<div class="col-md-3">
|
||||
<label>Material Code</label>
|
||||
<?php
|
||||
|
||||
@ -110,7 +117,8 @@ $(function() {
|
||||
echo form_dropdown('MaterialCode', $options1,set_value('MaterialCode',$materialcode),'id="MaterialCode"','class="form-control select2"' , 'required="true"');
|
||||
?>
|
||||
</div>
|
||||
|
||||
<input type="hidden" name="Recid" id="adjusmentid" value="<?php echo $editid ?> " readonly>
|
||||
<input type="hidden" name="ActualQuantity" id="ActualQuantity" value="<?php echo $editquantity ?> " readonly>
|
||||
<div class="col-md-3">
|
||||
<label>Date</label>
|
||||
<div class="form-group">
|
||||
@ -125,40 +133,27 @@ $(function() {
|
||||
|
||||
<div class="col-md-3">
|
||||
<label>Supplier</label>
|
||||
<?php
|
||||
|
||||
$options = array("0"=>'Select Supplier');
|
||||
|
||||
if(!empty($Supplier))
|
||||
{
|
||||
foreach ($Supplier as $PO):
|
||||
$options[$PO->SupplierID] =$PO->SupplierID.' '.' - '.' '.$PO->SupplierName;
|
||||
<div class="form-group">
|
||||
<?php
|
||||
$data = array('name' => 'Supplier','value' => set_value('Supplier',$suppliername),'id'=>'Supplier', 'class' => 'form-control num','readonly'=>'true' );
|
||||
echo form_input($data);
|
||||
|
||||
|
||||
//$RL[$SID->ReqNo] = $SID->ReqNo.' '.' - '.' '.$SID->DepartmentName;
|
||||
endforeach;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
echo form_dropdown('supplier', $options,set_value('SupplierID'),'id="supplier"' ,'class="form-control select2"' , 'required="true"' );
|
||||
?>
|
||||
?>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="col-md-offset-8">
|
||||
<!--<div class="col-md-offset-8">
|
||||
|
||||
<a class="btn btn-primary font getdetails" ID="getdetails" > <span class="bold">Get Details</span></a>
|
||||
<a class="btn btn-primary font getdetails" ID="getdetails" > <span class="bold">Get Details</span></a>-->
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</br>
|
||||
</br>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -174,7 +169,16 @@ $(function() {
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<?php
|
||||
$data = array('name' => 'Qty_aspersystem','value' => set_value('Qty_aspersystem',0),'id'=>'Qty_aspersystem', 'class' => 'form-control num' ,'onkeypress'=>'return isNumberKey(event);','onchange'=>'', 'readonly'=>'true');
|
||||
if(!empty($netQuantityarray))
|
||||
{
|
||||
|
||||
$Addqty=$netQuantityarray[0]['Addqty'];//->AddQty;
|
||||
|
||||
$reduceqty=$netQuantityarray[0]['ReduceQty'];
|
||||
}
|
||||
|
||||
$latestupdate=$Addqty-$reduceqty;
|
||||
$data = array('name' => 'Qty_aspersystem','value' => set_value('Qty_aspersystem', $latestupdate),'id'=>'Qty_aspersystem', 'class' => 'form-control num' ,'onkeypress'=>'return isNumberKey(event);');
|
||||
echo form_input($data);
|
||||
|
||||
?>
|
||||
@ -193,7 +197,7 @@ $(function() {
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<?php
|
||||
$data = array('name' => 'ActualQty','value' => set_value('ActualQty',0),'id'=>'ActualQty', 'class' => 'form-control num' ,'onchange'=>'calculateamount()');
|
||||
$data = array('name' => 'ActualQty','value' => set_value('ActualQty',$editquantity),'id'=>'ActualQty', 'class' => 'form-control num' ,'onchange'=>'calculateamount()');
|
||||
echo form_input($data);
|
||||
|
||||
?>
|
||||
@ -220,9 +224,6 @@ $(function() {
|
||||
</div>
|
||||
|
||||
|
||||
</br>
|
||||
</br>
|
||||
</br>
|
||||
|
||||
|
||||
|
||||
@ -269,28 +270,31 @@ $(function() {
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<?php
|
||||
$data = array('name' => 'Description','value' => set_value('Description'),'id'=>'Description', 'class' => 'form-control' ,'rows' => '5', 'cols' => '100','maxlength' => '250');
|
||||
$data = array('name' => 'Description','value' => set_value('Description',$edit_Description),'id'=>'Description', 'class' => 'form-control' ,'rows' => '5', 'cols' => '100','maxlength' => '250');
|
||||
echo Form_textarea($data);
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<input type="hidden" name="transtatus" id="transtatus">
|
||||
|
||||
|
||||
</div>
|
||||
<div class="col-md-1 col-md-offset-10" id="save">
|
||||
<a class="btn btn-primary Save" ID="Save" onclick="Save" > <span class="bold">Save</span></a>
|
||||
</div>
|
||||
|
||||
<!-- <div class="col-md-9" align = "right"><br/>
|
||||
<input type="Submit" class="btn btn-primary" value="Save" style="margin-right:28px" onclick="validate();" />
|
||||
</div> -->
|
||||
|
||||
<div class="col-md-1 col-md-offset-8" id="save"><br><br><br>
|
||||
<a class="btn btn-primary Save" ID="Save" onclick="Save" > <span class="bold">Save</span></a>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -357,7 +361,13 @@ $('.getdetails').click(function()
|
||||
|
||||
function calculateamount()
|
||||
{
|
||||
var quapersystem=$('#Qty_aspersystem').val();
|
||||
var aq=$('#ActualQuantity').val();
|
||||
var actualqty = $('#ActualQty').val();
|
||||
var updatequantity=parseFloat(quapersystem) - parseFloat(actualqty);
|
||||
|
||||
$('#AdjustableQty').val(updatequantity);
|
||||
|
||||
var resultant = $('#Qty_aspersystem').val();
|
||||
var adjustQty = parseFloat(actualqty) - parseFloat(resultant);
|
||||
if(adjustQty<0)
|
||||
@ -382,7 +392,7 @@ function calculateamount()
|
||||
|
||||
//$('#AdjustableQty').val(status+" "+absalutevale);
|
||||
|
||||
$('#AdjustableQty').val(adjustQty);
|
||||
//$('#AdjustableQty').val(adjustQty);
|
||||
|
||||
}
|
||||
}
|
||||
@ -393,47 +403,41 @@ function calculateamount()
|
||||
$('.Save').click(function()
|
||||
{
|
||||
|
||||
if($('#materialcode').val()==0)
|
||||
{
|
||||
alert("Please Select Material");
|
||||
}
|
||||
|
||||
else if($('#date').val()=="")
|
||||
{
|
||||
alert("Please Select Date");
|
||||
}
|
||||
|
||||
else if($('#supplier').val()==0)
|
||||
{
|
||||
alert("Please Select Supplier");
|
||||
}
|
||||
|
||||
else if($('#ActualQty').val()=="")
|
||||
{
|
||||
alert("Please Enter the Quantity to Adjust")
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
// if($('#ActualQty').val()=="")
|
||||
// {
|
||||
// alert("Please Enter the Quantity to Adjust")
|
||||
// }
|
||||
|
||||
|
||||
var quapersystem=$('#Qty_aspersystem').val();
|
||||
//console.log(quapersystem);
|
||||
var reason = $('#reason').val();
|
||||
var adquantity = $('#AdjustableQty').val();
|
||||
//alert(adquantity);
|
||||
var actualqty = $('#ActualQty').val();
|
||||
var desc = $('#Description').val();
|
||||
var adjid=$('#adjusmentid').val();
|
||||
$('#content').loader('show');
|
||||
$.ajax({
|
||||
|
||||
data:$('.materialadjustment').serialize(),
|
||||
data:{editquantity:actualqty,description:desc,adid:adjid,adjquantity:adquantity,reason:reason},
|
||||
type:"POST",
|
||||
url:"<?php echo base_url() ?>batchcard/addNewMaterialHistory",
|
||||
url:"<?php echo base_url() ?>batchcard/UpdateQuantity",
|
||||
// url:"<?php echo base_url() ?>batchcard/addNewMaterialHistory",
|
||||
|
||||
success:function(data)
|
||||
{
|
||||
if(data)
|
||||
{
|
||||
$('#content').loader('hide');
|
||||
alert(data);
|
||||
location.reload();
|
||||
|
||||
alert('saved successfully');
|
||||
window.location.href="MaterailAdjustmentlist";
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -52,7 +52,10 @@
|
||||
|
||||
|
||||
|
||||
<td> <a data-toggle="tooltip" href="<?php echo base_url().'EditMaterialAdjustment?AdjustmentId='.$record->AdjustmentId; ?>" ><i class="fa fa-pencil" data-toggle="tooltip" title="<?php echo $record->AdjustmentId; ?> - Click here to Edit details"></i> </a> </td>
|
||||
<td> <a data-toggle="tooltip" href="<?php echo base_url().'EditMaterialAdjustment?AdjustmentId='.$record->AdjustmentId;?>&date=<?php echo $record->CreatedOn?>&mc=<?php echo $record->MaterialCode?>
|
||||
&sn=<?php echo $record->SupplierID?>" ><i class="fa fa-pencil" data-toggle="tooltip" title="<?php echo $record->AdjustmentId; ?> - Click here to Edit details"></i> </a>
|
||||
<a data-toggle="tooltip" href="<?php echo base_url().'batchcard/Deletequantity?AdjustmentId='.$record->AdjustmentId; ?>" ><i class="fa fa-trash" data-toggle="tooltip" title="<?php echo $record->AdjustmentId; ?> - Click here to Delete details"></i> </a>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
<?php
|
||||
|
||||
Loading…
Reference in New Issue
Block a user