478 lines
14 KiB
PHP
478 lines
14 KiB
PHP
<?php
|
|
|
|
$date ='';
|
|
$edit_Qty_aspersystem='';
|
|
$edit_Actual_Qty= '';
|
|
$edit_Adjustable_qty= '';
|
|
$edit_Description='';
|
|
$editquantity='';
|
|
$editid='';
|
|
$latestupdate='';
|
|
$type= '';
|
|
|
|
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;
|
|
$editquantity= $mat->Quantity;
|
|
$edit_Actual_Qty= $mat->ActualQuantity;
|
|
|
|
// $edit_Adjustable_qty= '';
|
|
$edit_Description= $mat->Description;
|
|
$edit_reason= $mat->Reason;
|
|
$type = $mat->Transaction_type;
|
|
}
|
|
}
|
|
|
|
$as_per_system = '';
|
|
$value_to_display= '';
|
|
if($type == "Add")
|
|
{
|
|
// $as_per_system = $editquantity - $edit_Actual_Qty;
|
|
|
|
$as_per_system = $edit_Actual_Qty-$editquantity;
|
|
$value_to_display = $editquantity;
|
|
}
|
|
|
|
else if($type == "Reduce")
|
|
{
|
|
// $as_per_system = $editquantity + $edit_Actual_Qty;
|
|
|
|
$as_per_system=$edit_Actual_Qty+$editquantity;
|
|
$value_to_display = "-".$editquantity;
|
|
}
|
|
|
|
|
|
//$latestupdate=parseFloat($Addqty)-parseFloat($reduceqty);
|
|
//print_r($latestupdate);
|
|
?>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
|
$(function() {
|
|
//Initialize Select2 Elements
|
|
$("#MaterialCode").select2();
|
|
$('#supplier').select2();
|
|
$('#reason').select2();
|
|
|
|
$("#date").datepicker({
|
|
|
|
//maxDate : 'now',
|
|
dateFormat: 'dd-mm-yy',changeMonth: true, changeYear: true,yearRange: '-100:+0'
|
|
});
|
|
|
|
});
|
|
</script>
|
|
<style>
|
|
.content {
|
|
Padding:0% ! important;
|
|
}
|
|
|
|
.num{
|
|
text-align:right;
|
|
}
|
|
</style>
|
|
<div class="content-wrapper" style="min-height:537">
|
|
<!-- Content Header (Page header) -->
|
|
<section class="content-header">
|
|
|
|
<h1>
|
|
<center>Siddharth Industries - Material Adjustment</center>
|
|
|
|
</h1>
|
|
</section>
|
|
|
|
</br>
|
|
</br>
|
|
<section class="content">
|
|
<div id="content"></div>
|
|
<?php
|
|
$attributes = array('class' => 'form-label-left materialadjustment','name' => 'materialadjustment','id' => 'materialadjustment');
|
|
|
|
echo form_open($this->config->base_url().'batchcard/addmaterialadjustment',$attributes);
|
|
|
|
|
|
|
|
?>
|
|
|
|
<div class="row" style="padding:0% 2%">
|
|
<div class="col-md-12" >
|
|
<div class="col-md-3">
|
|
<label>Material Code</label>
|
|
<?php
|
|
|
|
if(!empty($materiallist))
|
|
{
|
|
|
|
foreach ($materiallist as $material)
|
|
{
|
|
if($materialcode==$material->MaterialCode)
|
|
{
|
|
$options1[$material->MaterialCode] = $material->MaterialCode.' '.' - '.' '.$material->MaterialName;
|
|
}
|
|
}
|
|
|
|
|
|
foreach ($materiallist as $materiall)
|
|
{
|
|
if($materialcode != $material->MaterialCode)
|
|
{
|
|
|
|
$options1[$materiall->MaterialCode] = $materiall->MaterialCode.' '.' - '.' '.$materiall->MaterialName;
|
|
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
|
|
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">
|
|
|
|
<?php
|
|
$data = array('name' => 'date','value' => set_value('date',$date),'id'=>'date', 'class' => 'form-control' ,'required' => 'true', 'onkeypress'=>'return false;');
|
|
echo form_input($data);
|
|
?>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div class="col-md-3">
|
|
<label>Supplier</label>
|
|
<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);
|
|
|
|
?>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
<!--<div class="col-md-offset-8">
|
|
|
|
<a class="btn btn-primary font getdetails" ID="getdetails" > <span class="bold">Get Details</span></a>-->
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div class="col-md-8">
|
|
|
|
<div class="col-md-12">
|
|
<div class="col-md-6">
|
|
|
|
<label><?php echo "Quantity As Per System";?></label>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<div class="form-group">
|
|
<?php
|
|
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', $as_per_system),'id'=>'Qty_aspersystem', 'class' => 'form-control num' ,'onkeypress'=>'return isNumberKey(event);');
|
|
echo form_input($data);
|
|
|
|
?>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="col-md-12">
|
|
<div class="col-md-6">
|
|
|
|
<label><?php echo "Actual Quantity";?></label>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<div class="form-group">
|
|
<?php
|
|
$data = array('name' => 'ActualQty','value' => set_value('ActualQty',$edit_Actual_Qty),'id'=>'ActualQty', 'class' => 'form-control num' ,'onchange'=>'calculateamount()');
|
|
echo form_input($data);
|
|
|
|
?>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
<div class="col-md-12">
|
|
<div class="col-md-6">
|
|
|
|
<label><?php echo "Adjustable Quantity";?></label>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<div class="form-group">
|
|
<?php
|
|
$data = array('name' => 'AdjustableQty','value' => set_value('AdjustableQty',$value_to_display),'id'=>'AdjustableQty', 'class' => 'form-control num' ,'onkeypress'=>'return isNumberKey(event);','onchange'=>'', 'readonly'=>'true');
|
|
echo form_input($data);
|
|
|
|
?>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div class="col-md-12">
|
|
<div class="col-md-6">
|
|
|
|
<label><?php echo "Reason";?></label>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<div class="form-group">
|
|
<?php
|
|
|
|
$options = array("0"=>'Select',"1"=>'Stock on fire',"2"=>'Stolen goods',"3"=>'Damaged Goods',"4"=>'Stock written off',"5"=>'Stock taking results',"6"=>'Inventory revaluation');
|
|
|
|
// if(!empty($PONO))
|
|
// {
|
|
// foreach ($PONO as $PO):
|
|
// $options[$PO->PONO] =$PO->PONO.' '.' - '.' '.$PO->POType;
|
|
|
|
|
|
// //$RL[$SID->ReqNo] = $SID->ReqNo.' '.' - '.' '.$SID->DepartmentName;
|
|
// endforeach;
|
|
// }
|
|
|
|
|
|
|
|
|
|
echo form_dropdown('reason', $options,set_value('reason'),'id="reason"' ,'class="form-control select2"' , 'required="true"' );
|
|
?>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="col-md-12">
|
|
<div class="col-md-6">
|
|
|
|
<label><?php echo "Description";?></label>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<div class="form-group">
|
|
<?php
|
|
$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> -->
|
|
|
|
<a href="<?php echo base_url() ?>MaterailAdjustmentlist" class="btn btn-primary" id="back" value="Back">OK</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> -->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</section>
|
|
</div>
|
|
|
|
<script type="text/javascript">
|
|
|
|
var reas= <?php echo json_encode($edit_reason, JSON_PRETTY_PRINT) ?>;
|
|
//alert(reas)
|
|
$('#reason').val(reas);
|
|
|
|
|
|
$('.getdetails').click(function()
|
|
{
|
|
var materialcode =$('#materialcode').val();
|
|
var date = $('#date').val();
|
|
var Supplier = $('#supplier').val();
|
|
$('#content').loader('show');
|
|
$.ajax({
|
|
|
|
data:{materialcode:materialcode,date:date,Supplier:Supplier},
|
|
type:"POST",
|
|
url:"<?php echo base_url();?>batchcard/getQuantity",
|
|
success:function(data)
|
|
{
|
|
$('#content').loader('hide');
|
|
//console.log(data);
|
|
var addqty = '';
|
|
var reduceqty = '';
|
|
$.each(JSON.parse(data),function(i,obj)
|
|
{
|
|
addqty = obj.Addqty;
|
|
reduceqty = obj.ReduceQty;
|
|
|
|
if(addqty == null)
|
|
{
|
|
adjustQty =0;
|
|
}
|
|
|
|
if(reduceqty == null)
|
|
{
|
|
reduceqty=0;
|
|
}
|
|
});
|
|
|
|
var resultantqty = parseFloat(addqty)- parseFloat(reduceqty);
|
|
|
|
if(isNaN(resultantqty))
|
|
{
|
|
$('#Qty_aspersystem').val(0);
|
|
}
|
|
else
|
|
{
|
|
|
|
$('#Qty_aspersystem').val(resultantqty);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
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)
|
|
{
|
|
var status = "Reduce";
|
|
}
|
|
else
|
|
{
|
|
var status = "Add";
|
|
}
|
|
|
|
var absalutevale = Math.abs(adjustQty);
|
|
|
|
$('#transtatus').val(status);
|
|
|
|
if(isNaN(adjustQty))
|
|
{
|
|
$('#AdjustableQty').val(0);
|
|
}
|
|
else
|
|
{
|
|
|
|
//$('#AdjustableQty').val(status+" "+absalutevale);
|
|
|
|
//$('#AdjustableQty').val(adjustQty);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
$('.Save').click(function()
|
|
{
|
|
|
|
// 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:{editquantity:actualqty,description:desc,adid:adjid,adjquantity:adquantity,reason:reason},
|
|
// type:"POST",
|
|
// url:"<?php echo base_url() ?>batchcard/UpdateQuantity",
|
|
// // url:"<?php echo base_url() ?>batchcard/addNewMaterialHistory",
|
|
|
|
// success:function(data)
|
|
// {
|
|
// if(data)
|
|
// {
|
|
// $('#content').loader('hide');
|
|
// alert('saved successfully');
|
|
// window.location.href="MaterailAdjustmentlist";
|
|
// }
|
|
// }
|
|
|
|
// });
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
</script>
|
|
|