2341 lines
74 KiB
PHP
2341 lines
74 KiB
PHP
<?php
|
|
|
|
$date = '';
|
|
$qty = '';
|
|
$value = '';
|
|
$finProduct = '';
|
|
$FPId= '';
|
|
if(!empty($masterproduct))
|
|
{
|
|
foreach($masterproduct as $ma)
|
|
{
|
|
//$date = $ma->ProductDate;
|
|
$Ddt = new DateTime($ma->ProductDate);
|
|
$date = $Ddt->format('d-m-Y');
|
|
$qty = $ma->Quantity;
|
|
$value = $ma->Price;
|
|
$finProduct = $ma->MaterialCode;
|
|
$FPId = $ma->FPId;
|
|
}
|
|
}
|
|
|
|
|
|
//echo $finProduct;
|
|
|
|
?>
|
|
|
|
|
|
<style type="text/css">
|
|
[contenteditable=true]:empty:before{
|
|
content: attr(placeholder);
|
|
display: block; /* For Firefox */
|
|
|
|
}
|
|
</style>
|
|
|
|
<script>
|
|
$(function() {
|
|
|
|
var MaxDate = '<?php echo $MaxPoDate;?>';
|
|
var d = new Date(MaxDate);
|
|
var t='<?php echo $CurrentDate;?>';
|
|
var m=new Date(t);
|
|
|
|
$("#Date").datepicker({
|
|
minDate : d,
|
|
//maxDate : 'now',
|
|
dateFormat: 'dd-mm-yy',changeMonth: true, changeYear: true,yearRange: '-100:+0'
|
|
});
|
|
|
|
|
|
$("#CopDate").datepicker({
|
|
minDate : d,
|
|
//maxDate : 'now',
|
|
dateFormat: 'dd-mm-yy',changeMonth: true, changeYear: true,yearRange: '-100:+0'
|
|
});
|
|
|
|
|
|
$("#EditCopDate").datepicker({
|
|
minDate : d,
|
|
//maxDate : 'now',
|
|
dateFormat: 'dd-mm-yy',changeMonth: true, changeYear: true,yearRange: '-100:+0'
|
|
});
|
|
|
|
|
|
});
|
|
</script>
|
|
|
|
|
|
|
|
<div class="content-wrapper">
|
|
<section class="content" style="font-size: 12px;">
|
|
<div id="content"></div>
|
|
|
|
<div class="box">
|
|
<div class="box-header">
|
|
<center><h3 class="box-title">Siddharth Industries - <?php echo "FP".$FPId?></h3></center>
|
|
</div>
|
|
<!-- /.box-header -->
|
|
<div class="box-body">
|
|
|
|
|
|
<div class="container-fluid">
|
|
|
|
<div id="content"></div>
|
|
|
|
<div class="row">
|
|
|
|
<?php
|
|
$attributes = array('class' => 'form-label-left final_product ','name' => 'final_product','id' => 'final_product');
|
|
|
|
echo form_open($this->config->base_url().'/batchcard/FinalProduct/',$attributes);
|
|
?>
|
|
|
|
<div class="col-md-12">
|
|
<div class="col-md-3">
|
|
|
|
<label>Final Product</label>
|
|
|
|
<?php
|
|
|
|
|
|
if(!empty($inv_final_product))
|
|
{
|
|
|
|
foreach ($inv_final_product as $material)
|
|
{
|
|
|
|
|
|
if($finProduct==$material->product_id)
|
|
{
|
|
$options1[$material->product_id] = $material->product_id.' '.' - '.' '.$material->product_name;
|
|
}
|
|
}
|
|
|
|
|
|
// foreach ($inv_final_product as $materiall)
|
|
// {
|
|
// if($finProduct != $material->product_id)
|
|
// {
|
|
|
|
// $options1[$materiall->product_id] = $materiall->product_id.' '.' - '.' '.$materiall->product_name;
|
|
|
|
// }
|
|
// }
|
|
|
|
|
|
}
|
|
|
|
echo form_dropdown('DEPTFN', $options1,set_value('DEPTFN',$product_id),'id="DEPTFN"' ,'required="true"' ,'class="form-control select2');
|
|
|
|
?>
|
|
|
|
</div>
|
|
|
|
<div class="col-md-3">
|
|
<label>Date</label>
|
|
<?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 class="col-md-3">
|
|
|
|
<label>Quantity </label>
|
|
<div class="form-group">
|
|
<?php
|
|
|
|
$data = array('name' => 'Quantity','value' => set_value('Quantity',$qty),'id'=>'Quantity', 'class' => 'form-control' ,'required' => 'true');
|
|
echo form_input($data);
|
|
?>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="col-md-3">
|
|
|
|
<label>Value</label>
|
|
<div class="form-group">
|
|
<?php
|
|
|
|
$data = array('name' => 'values','value' => set_value('values',$value),'id'=>'values', 'class' => 'form-control' ,'required' => 'true');
|
|
echo form_input($data);
|
|
?>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div class="container-fluid">
|
|
<div><legend>Raw Materials</legend></div>
|
|
<table class="table table-bordered" style="border:1px solid #333">
|
|
<div align="right" style="padding-right:10px">
|
|
<div align="right">
|
|
|
|
|
|
<a type="button" class="btn btn-primary btn-md" data-toggle="modal" data-target="#myModal">Raw Materials</a>
|
|
<!-- Add line Item -->
|
|
<div class="modal fade" id="myModal" role="dialog">
|
|
<div class="modal-dialog">
|
|
|
|
<!-- Modal content-->
|
|
<div class="modal-content">
|
|
<div class="modal-header" style="background-color: #3c8dbc;color:#fff;">
|
|
<button type="button" class="close" data-dismiss="modal">×</button>
|
|
<center><h4>Add Line Item </h4></center>
|
|
</div>
|
|
<div align="left">
|
|
|
|
|
|
|
|
<div class="col-md-12">
|
|
<div class="col-md-6">
|
|
<label>Material Name</label>
|
|
<div class="form-group">
|
|
<?php
|
|
|
|
$options = array("0"=>'Select Material Code');
|
|
|
|
if(!empty($Raw_material))
|
|
{
|
|
foreach ($Raw_material as $mat):
|
|
$options[$mat->MaterialCode] =$mat->MaterialCode.' '.' - '.' '.$mat->MaterialName;
|
|
|
|
|
|
//$RL[$SID->ReqNo] = $SID->ReqNo.' '.' - '.' '.$SID->DepartmentName;
|
|
endforeach;
|
|
}
|
|
|
|
|
|
|
|
|
|
echo form_dropdown('rawmaterialcode', $options,set_value('MaterialCode'),'id="rawmaterialcode"' ,'class="form-control select2"' , 'required="true"' );
|
|
?>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="col-md-6">
|
|
<label>Supplier Name</label>
|
|
<div class="form-group">
|
|
<?php
|
|
|
|
$options = array("0"=>'Select Supplier');
|
|
|
|
if(!empty($supplier))
|
|
{
|
|
foreach ($supplier as $mat):
|
|
$options[$mat->SupplierID] =$mat->SupplierID.' '.' - '.' '.$mat->SupplierName;
|
|
|
|
|
|
//$RL[$SID->ReqNo] = $SID->ReqNo.' '.' - '.' '.$SID->DepartmentName;
|
|
endforeach;
|
|
}
|
|
|
|
|
|
|
|
|
|
echo form_dropdown('rawSupplier', $options,set_value('SupplierID'),'id="rawSupplier"' ,'class="form-control select2"' ,'required="true"' );
|
|
?>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="col-md-12">
|
|
|
|
<div class="col-md-6">
|
|
<label>Quantity</label>
|
|
<div>
|
|
<?php
|
|
$data = array('name' => 'rawqty','value' => set_value('rawqty'),'id'=>'rawqty', 'class' => 'form-control');
|
|
echo form_input($data);
|
|
?>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div class="col-md-6">
|
|
<label>Price</label>
|
|
<div>
|
|
<?php
|
|
$data = array('name' => 'rawprice','value' => set_value('rawprice'),'id'=>'rawprice', 'class' => 'form-control');
|
|
echo form_input($data);
|
|
?>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</br>
|
|
</br>
|
|
<div class="modal-footer">
|
|
<a class="btn btn-primary font addraw" ID="addraw" > <span class="bold">Add</span></a>
|
|
<a class="btn btn-primary" data-dismiss="modal" value="Cancel">Cancel</a>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Edit Line Item -->
|
|
|
|
<div class="modal fade" id="EditItem" role="dialog">
|
|
<div class="modal-dialog">
|
|
|
|
<!-- Modal content-->
|
|
<div class="modal-content">
|
|
<div class="modal-header" style="background-color: #3c8dbc;color:#fff;">
|
|
<button type="button" class="close" data-dismiss="modal">×</button>
|
|
<center><h4>Edit Line Item </h4></center>
|
|
</div>
|
|
<div align="left">
|
|
|
|
<div class="col-md-12">
|
|
<div class="col-md-6">
|
|
<label>Material Code</label>
|
|
<div class="form-group">
|
|
<?php
|
|
|
|
|
|
|
|
$data = array('name' => 'Editrawmaterialcode','value' => set_value('Editrawmaterialcode'),'id'=>'Editrawmaterialcode', 'class' => 'form-control' , 'readonly'=>'true');
|
|
echo form_input($data);
|
|
|
|
|
|
|
|
?>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="col-md-6">
|
|
<label>Supplier Code</label>
|
|
<div class="form-group">
|
|
<?php
|
|
|
|
$data = array('name' => 'EditrawSupplier','value' => set_value('EditrawSupplier'),'id'=>'EditrawSupplier', 'class' => 'form-control','readonly'=>'true');
|
|
echo form_input($data);
|
|
|
|
|
|
|
|
// echo form_dropdown('EditrawSupplier', $options,set_value('SupplierID'),'id="EditrawSupplier"' ,'class="form-control select2"' , 'required="true"' );
|
|
?>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="col-md-12">
|
|
|
|
<div class="col-md-6">
|
|
<label>Quantity</label>
|
|
<div>
|
|
<?php
|
|
$data = array('name' => 'Editrawqty','value' => set_value('Editrawqty'),'id'=>'Editrawqty', 'class' => 'form-control');
|
|
echo form_input($data);
|
|
?>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div class="col-md-6">
|
|
<label>Price</label>
|
|
<div>
|
|
<?php
|
|
$data = array('name' => 'Editrawprice','value' => set_value('Editrawprice'),'id'=>'Editrawprice', 'class' => 'form-control');
|
|
echo form_input($data);
|
|
?>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
<div class="modal-footer">
|
|
<a class="btn btn-primary font EditItem" ID="EditItem" > <span class="bold">Edit</span></a>
|
|
<a class="btn btn-primary" data-dismiss="modal" value="Cancel">Cancel</a>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="row" style="padding: 0px 15px 0px 10px;">
|
|
<table id="mytable" class="table table-bordered table-hover editableTable" style="background-color:#fff;font-size:12px;">
|
|
<thead style="background-color: #CFCFCF;">
|
|
<th>S.No</th>
|
|
|
|
<th>Material Code</th>
|
|
<!-- <th>Material Name</th> -->
|
|
<th>Supplier</th>
|
|
<th>Quantity</th>
|
|
<th>Price</th>
|
|
<th>Action</th>
|
|
</thead>
|
|
<tbody id="rawappend">
|
|
<?php if(!empty($rawmaterial)){
|
|
$index=0;
|
|
foreach($rawmaterial as $raw){
|
|
$index= $index+1; ?>
|
|
<tr id="rawmat<?php echo $index ; ?>">
|
|
<td><?php echo $index;?></td>
|
|
<td id="rawmaterialedit<?php echo $index?>"><?php echo $raw->MaterialCode?></td>
|
|
<!-- <td id="rawmaterialnameedit<?php echo $index?>"><?php echo $raw->MaterialName?></td> -->
|
|
<td id="rawsuppliername<?php echo $index?>"><?php echo $raw->SupplierID."-".$raw->SupplierName?></td>
|
|
<td id="rawQuantiy<?php echo $index?>"><?php echo $raw->Quantity;?></td>
|
|
<td id="rawmaterialPrice<?php echo $index?>"><?php echo $raw->Price?></td>
|
|
|
|
<input type="hidden" name="<?php echo 'RawId'.$index ?>" id="<?php echo 'RawId'.$index ?>" value="<?php echo $raw->RawId ; ?>" readonly/>
|
|
|
|
<input type="hidden" name="<?php echo 'rawmaterialcode'.$index ?>" id="<?php echo 'rawmaterialcode'.$index ?>" value="<?php echo $raw->MaterialCode ; ?>" readonly/>
|
|
|
|
<input type="hidden" name="<?php echo 'rawSupplierID'.$index ?>" id="<?php echo 'rawSupplierID'.$index ?>" value="<?php echo $raw->SupplierID ; ?>" readonly/>
|
|
|
|
<input type="hidden" name="<?php echo 'rawQty'.$index ?>" id="<?php echo 'rawQty'.$index ?>" value="<?php echo $raw->Quantity ; ?>" readonly/>
|
|
|
|
|
|
<input type="hidden" name="<?php echo 'rawprice'.$index ?>" id="<?php echo 'rawprice'.$index ?>" value="<?php echo $raw->Price ; ?>" readonly/>
|
|
|
|
<td> <a data-target='#EditItem' data-id="<?php echo $index ; ?>" data-userid="<?php echo $index ; ?>" data-toggle="modal" href="#EditItem"><i class="fa fa-pencil" data-toggle="tooltip" title="Click here to view/Edit;"></i> </a> <a href='#' onclick = "DeleteactionRow(<?php echo $index?>);" class="link" data-id="<?php echo $index ; ?>" data-userid="<?php echo $index ; ?>" id="Del" ><span class="glyphicon glyphicon-trash"></span></a></td>
|
|
</tr>
|
|
<?php }} ?>
|
|
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<!--second table-->
|
|
<div class="container-fluid">
|
|
<div><legend>Consumables</legend></div>
|
|
<table class="table table-bordered" style="border:1px solid #333">
|
|
<div align="right" style="padding-right:10px">
|
|
<div align="right">
|
|
<a type="button" class="btn btn-primary btn-md" data-toggle="modal" data-target="#RootCausemodal">Add Consumable Materials</a><!-- Add line Item -->
|
|
<div class="modal fade" id="RootCausemodal" role="dialog">
|
|
<div class="modal-dialog">
|
|
|
|
<!-- Modal content-->
|
|
<div class="modal-content">
|
|
<div class="modal-header" style="background-color: #3c8dbc;color:#fff;">
|
|
<button type="button" class="close" data-dismiss="modal">×</button>
|
|
<center><h4>Add Line Item </h4></center>
|
|
</div>
|
|
<div align="left">
|
|
|
|
|
|
|
|
<div class="col-md-12">
|
|
<div class="col-md-6">
|
|
<label>Material Name</label>
|
|
<div class="form-group">
|
|
<?php
|
|
|
|
$options = array("0"=>'Select Material Code');
|
|
|
|
if(!empty($consumable_material))
|
|
{
|
|
foreach ($consumable_material as $mat):
|
|
$options[$mat->MaterialCode] =$mat->MaterialCode.' '.' - '.' '.$mat->MaterialName;
|
|
|
|
|
|
//$RL[$SID->ReqNo] = $SID->ReqNo.' '.' - '.' '.$SID->DepartmentName;
|
|
endforeach;
|
|
}
|
|
|
|
|
|
|
|
|
|
echo form_dropdown('consumaterialcode', $options,set_value('MaterialCode'),'id="consumaterialcode"' ,'class="form-control select2"' , 'required="true"' );
|
|
?>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="col-md-6">
|
|
<label>Supplier Name</label>
|
|
<div class="form-group">
|
|
<?php
|
|
|
|
$options = array("0"=>'Select Supplier');
|
|
|
|
if(!empty($supplier))
|
|
{
|
|
foreach ($supplier as $mat):
|
|
$options[$mat->SupplierID] =$mat->SupplierID.' '.' - '.' '.$mat->SupplierName;
|
|
|
|
|
|
//$RL[$SID->ReqNo] = $SID->ReqNo.' '.' - '.' '.$SID->DepartmentName;
|
|
endforeach;
|
|
}
|
|
|
|
|
|
|
|
|
|
echo form_dropdown('consuSupplier', $options,set_value('SupplierID'),'id="consuSupplier"' ,'class="form-control select2"' , 'required="true"' );
|
|
?>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="col-md-12">
|
|
|
|
<div class="col-md-6">
|
|
<label>Quantity</label>
|
|
<div>
|
|
<?php
|
|
$data = array('name' => 'consuqty','value' => set_value('consuqty'),'id'=>'consuqty', 'class' => 'form-control');
|
|
echo form_input($data);
|
|
?>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div class="col-md-6">
|
|
<label>Price</label>
|
|
<div>
|
|
<?php
|
|
$data = array('name' => 'consuprice','value' => set_value('consuprice'),'id'=>'consuprice', 'class' => 'form-control');
|
|
echo form_input($data);
|
|
?>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<div class="modal-footer">
|
|
<a class="btn btn-primary font rootaddClick" ID="rootaddClick" > <span class="bold">Add</span></a>
|
|
<a class="btn btn-primary" data-dismiss="modal" value="Cancel">Cancel</a>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Edit Line Item -->
|
|
|
|
<div class="modal fade" id="EditRootCausemodal" role="dialog">
|
|
<div class="modal-dialog">
|
|
|
|
<!-- Modal content-->
|
|
<div class="modal-content">
|
|
<div class="modal-header" style="background-color: #3c8dbc;color:#fff;">
|
|
<button type="button" class="close" data-dismiss="modal">×</button>
|
|
<center><h4>Edit Line Item </h4></center>
|
|
</div>
|
|
<div align="left">
|
|
|
|
<div class="col-md-12">
|
|
<div class="col-md-6">
|
|
<label>Material Code</label>
|
|
<div class="form-group">
|
|
<?php
|
|
|
|
$data = array('name' => 'Editconsumaterialcode','value' => set_value('Editconsumaterialcode'),'id'=>'Editconsumaterialcode', 'class' => 'form-control','readonly'=>'true');
|
|
echo form_input($data);
|
|
?>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="col-md-6">
|
|
<label>Supplier Code</label>
|
|
<div class="form-group">
|
|
<?php
|
|
|
|
$data = array('name' => 'EditconsuSupplier','value' => set_value('EditconsuSupplier'),'id'=>'EditconsuSupplier', 'class' => 'form-control','readonly'=>'true');
|
|
echo form_input($data);
|
|
?>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="col-md-12">
|
|
|
|
<div class="col-md-6">
|
|
<label>Quantity</label>
|
|
<div>
|
|
<?php
|
|
$data = array('name' => 'Editconsuqty','value' => set_value('Editconsuqty'),'id'=>'Editconsuqty', 'class' => 'form-control',);
|
|
echo form_input($data);
|
|
?>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div class="col-md-6">
|
|
<label>Price</label>
|
|
<div>
|
|
<?php
|
|
$data = array('name' => 'Editconsuprice','value' => set_value('Editconsuprice'),'id'=>'Editconsuprice', 'class' => 'form-control');
|
|
echo form_input($data);
|
|
?>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<div class="modal-footer">
|
|
<a class="btn btn-primary font rootEditItem" ID="rootEditItem" > <span class="bold">Edit</span></a>
|
|
<a class="btn btn-primary" data-dismiss="modal" value="Cancel">Cancel</a>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="row" style="padding: 0px 15px 0px 10px;">
|
|
<table id="rootmytable" class="table table-bordered table-hover editableTable" style="background-color:#fff;font-size:12px;">
|
|
<thead style="background-color: #CFCFCF;">
|
|
<!-- <thead style="background-color: #CFCFCF;"> -->
|
|
<th>S.No</th>
|
|
<th>Material Code</th>
|
|
<!-- <th>Material Name</th> -->
|
|
<th>Supplier</th>
|
|
<th>Quantity</th>
|
|
<th>Price</th>
|
|
<th>Action</th>
|
|
</thead>
|
|
<tbody id="consuappend">
|
|
<?php if(!empty($consumaterial)){
|
|
$inde=0;
|
|
foreach($consumaterial as $cou){
|
|
$inde=$inde+1;?>
|
|
<tr id="consumable<?php echo $inde;?>">
|
|
<td ><?php echo $inde?></td>
|
|
<td id="consumaterial<?php echo $inde?>"><?php echo $cou->MaterialCode?></td>
|
|
<!-- <td id="consumaterialname<?php echo $inde?>"><?php echo $cou->MaterialName?></td> -->
|
|
<td id="consusuppliername<?php echo $inde?>"><?php echo $cou->SupplierID."-".$cou->SupplierName?></td>
|
|
<td id="consuQuantiy<?php echo $inde?>"><?php echo $cou->Quantity?></td>
|
|
<td id="consumaterialPrice<?php echo $inde?>"><?php echo $cou->Price?></td>
|
|
<td>
|
|
|
|
<a data-target='#EditRootCausemodal' data-id="<?php echo $inde ; ?>" data-userid="<?php echo $inde ; ?>" data-toggle="modal" href="#EditRootCausemodal"><i class="fa fa-pencil" data-toggle="tooltip" title="Click here to view/Edit;"></i> </a> <a href='#' onclick = "DeleteCounterRow(<?php echo $in ; ?>)" class="link" data-id="<?php echo $inde ; ?>" data-userid="<?php echo $in ; ?>" id="Del" ><span class="glyphicon glyphicon-trash"></span></a>
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<input type="hidden" name="<?php echo 'Consumable'.$inde ?>" id="<?php echo 'Consumable'.$inde ?>" value="<?php echo $cou->ConId ; ?>" />
|
|
|
|
<input type="hidden" name="<?php echo 'consumematerialcode'.$inde ?>" id="<?php echo 'consumematerialcode'.$inde ?>" value="<?php echo $cou->MaterialCode ; ?>" />
|
|
|
|
<input type="hidden" name="<?php echo 'consumeSupplierID'.$inde ?>" id="<?php echo 'consumeSupplierID'.$inde ?>" value="<?php echo $cou->SupplierID ; ?>" />
|
|
|
|
<input type="hidden" name="<?php echo 'consumeQty'.$inde ?>" id="<?php echo 'consumeQty'.$inde ?>" value="<?php echo $cou->Quantity ; ?>" />
|
|
|
|
<input type="hidden" name="<?php echo 'consumeprice'.$inde ?>" id="<?php echo 'consumeprice'.$inde ?>" value="<?php echo $cou->Price ; ?>" />
|
|
|
|
<?php }}?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<!--third table-->
|
|
<div class="container-fluid">
|
|
<div><legend>Packing Material</legend></div>
|
|
<table class="table table-bordered" style="border:1px solid #333">
|
|
<div align="right" style="padding-right:10px">
|
|
<div align="right">
|
|
<a type="button" class="btn btn-primary btn-md" data-toggle="modal" data-target="#Counter">Add Packing Materials</a>
|
|
<!-- Add line Item -->
|
|
<div class="modal fade" id="Counter" role="dialog">
|
|
<div class="modal-dialog">
|
|
|
|
<!-- Modal content-->
|
|
<div class="modal-content">
|
|
<div class="modal-header" style="background-color: #3c8dbc;color:#fff;">
|
|
<button type="button" class="close" data-dismiss="modal">×</button>
|
|
<center><h4>Add Line Item </h4></center>
|
|
</div>
|
|
<div align="left">
|
|
|
|
|
|
<div class="col-md-12">
|
|
<div class="col-md-6">
|
|
<label>Material Name</label>
|
|
<div class="form-group">
|
|
<?php
|
|
|
|
$options = array("0"=>'Select Material Code');
|
|
|
|
if(!empty($Pack_material))
|
|
{
|
|
foreach ($Pack_material as $mat):
|
|
$options[$mat->MaterialCode] =$mat->MaterialCode.' '.' - '.' '.$mat->MaterialName;
|
|
|
|
|
|
//$RL[$SID->ReqNo] = $SID->ReqNo.' '.' - '.' '.$SID->DepartmentName;
|
|
endforeach;
|
|
}
|
|
|
|
|
|
|
|
|
|
echo form_dropdown('packumaterialcode', $options,set_value('MaterialCode'),'id="packumaterialcode"' ,'class="form-control select2"' , 'required="true"' );
|
|
?>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="col-md-6">
|
|
<label>Supplier Name</label>
|
|
<div class="form-group">
|
|
<?php
|
|
|
|
$options = array("0"=>'Select Material Code');
|
|
|
|
if(!empty($supplier))
|
|
{
|
|
foreach ($supplier as $mat):
|
|
$options[$mat->SupplierID] =$mat->SupplierID.' '.' - '.' '.$mat->SupplierName;
|
|
|
|
|
|
//$RL[$SID->ReqNo] = $SID->ReqNo.' '.' - '.' '.$SID->DepartmentName;
|
|
endforeach;
|
|
}
|
|
|
|
|
|
|
|
|
|
echo form_dropdown('packSupplier', $options,set_value('SupplierID'),'id="packSupplier"' ,'class="form-control select2"' , 'required="true"' );
|
|
?>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="col-md-12">
|
|
|
|
<div class="col-md-6">
|
|
<label>Quantity</label>
|
|
<div>
|
|
<?php
|
|
$data = array('name' => 'packqty','value' => set_value('packqty'),'id'=>'packqty', 'class' => 'form-control');
|
|
echo form_input($data);
|
|
?>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div class="col-md-6">
|
|
<label>Price</label>
|
|
<div>
|
|
<?php
|
|
$data = array('name' => 'packprice','value' => set_value('packprice'),'id'=>'packprice', 'class' => 'form-control');
|
|
echo form_input($data);
|
|
?>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<div class="modal-footer">
|
|
<a class="btn btn-primary font CounteraddClick" ID="CounteraddClick" > <span class="bold">Add</span></a>
|
|
<a class="btn btn-primary" data-dismiss="modal" value="Cancel">Cancel</a>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Edit Line Item -->
|
|
|
|
<div class="modal fade" id="EditCounter" role="dialog">
|
|
<div class="modal-dialog">
|
|
|
|
<!-- Modal content-->
|
|
<div class="modal-content">
|
|
<div class="modal-header" style="background-color: #3c8dbc;color:#fff;">
|
|
<button type="button" class="close" data-dismiss="modal">×</button>
|
|
<center><h4>Edit Line Item </h4></center>
|
|
</div>
|
|
<div align="left">
|
|
|
|
<div class="col-md-12">
|
|
<div class="col-md-6">
|
|
<label>Material Code</label>
|
|
<div class="form-group">
|
|
<?php
|
|
|
|
|
|
$data = array('name' => 'Editpackumaterialcode','value' => set_value('Editpackumaterialcode'),'id'=>'Editpackumaterialcode', 'class' => 'form-control','readonly'=>'true');
|
|
echo form_input($data);
|
|
?>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="col-md-6">
|
|
<label>Supplier Code</label>
|
|
<div class="form-group">
|
|
<?php
|
|
|
|
$data = array('name' => 'EditpackSupplier','value' => set_value('EditpackSupplier'),'id'=>'EditpackSupplier', 'class' => 'form-control','readonly'=>'true');
|
|
echo form_input($data);
|
|
?>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="col-md-12">
|
|
|
|
<div class="col-md-6">
|
|
<label>Quantity</label>
|
|
<div>
|
|
<?php
|
|
$data = array('name' => 'Editpackqty','value' => set_value('Editpackqty'),'id'=>'Editpackqty', 'class' => 'form-control');
|
|
echo form_input($data);
|
|
?>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div class="col-md-6">
|
|
<label>Price</label>
|
|
<div>
|
|
<?php
|
|
$data = array('name' => 'Editpackprice','value' => set_value('Editpackprice'),'id'=>'Editpackprice', 'class' => 'form-control');
|
|
echo form_input($data);
|
|
?>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
<div class="modal-footer">
|
|
<a class="btn btn-primary font CounterEditItem" ID="CounterEditItem" > <span class="bold">Edit</span></a>
|
|
<a class="btn btn-primary" data-dismiss="modal" value="Cancel">Cancel</a>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="row" style="padding: 0px 15px 0px 10px;">
|
|
<table id="mycountertable" class="table table-bordered table-hover editableTable" style="background-color:#fff;font-size:12px;">
|
|
<thead style="background-color: #CFCFCF;">
|
|
<th>S.No</th>
|
|
<th>Material Code</th>
|
|
<!-- <th>Material Name</th> -->
|
|
<th>Supplier</th>
|
|
<th>Quantity</th>
|
|
<th>Price</th>
|
|
<th>Action</th>
|
|
</thead>
|
|
<?php if(!empty($packagematerial)){
|
|
$intt=0;
|
|
foreach($packagematerial as $pac){
|
|
$intt=$intt+1;?>
|
|
<tbody id="packappend">
|
|
<tr id="pack<?php echo $intt;?>">
|
|
<td><?php echo $intt;?></td>
|
|
<td id="packmaterial<?php echo $intt?>"><?php echo $pac->MaterialCode?></td>
|
|
<!-- <td><?php echo $pac->MaterialName?></td> -->
|
|
<td id="packsuppliername<?php echo $intt?>"><?php echo $pac->SupplierID."-".$pac->SupplierName?></td>
|
|
<td id="packQuantiy<?php echo $intt?>"><?php echo $pac->Quantity?></td>
|
|
<td id="packmaterialPrice<?php echo $intt?>"><?php echo $pac->Price?></td>
|
|
<td>
|
|
|
|
<a data-target='#EditCounter' data-id="<?php echo $intt ; ?>" data-userid="<?php echo $intt ; ?>" data-toggle="modal" href="#EditCounter"><i class="fa fa-pencil" data-toggle="tooltip" title="Click here to view/Edit;"></i> </a> <a href='#' onclick = "DeleteCounterRow(<?php echo $intt ; ?>)" class="link" data-id="<?php echo $intt ; ?>" data-userid="<?php echo $intt ; ?>" id="Del" ><span class="glyphicon glyphicon-trash"></span></a>
|
|
</td>
|
|
</tr>
|
|
|
|
<input type="hidden" name="<?php echo 'packId'.$intt ?>" id="<?php echo 'packId'.$intt ?>" value="<?php echo $pac->PackId ; ?>" />
|
|
|
|
<input type="hidden" name="<?php echo 'packmaterialcode'.$intt ?>" id="<?php echo 'packmaterialcode'.$intt ?>" value="<?php echo $pac->MaterialCode ; ?>" />
|
|
|
|
<input type="hidden" name="<?php echo 'packSupplierID'.$intt ?>" id="<?php echo 'packSupplierID'.$intt ?>" value="<?php echo $pac->SupplierID ; ?>" />
|
|
|
|
<input type="hidden" name="<?php echo 'packQty'.$intt ?>" id="<?php echo 'packQty'.$intt ?>" value="<?php echo $pac->Quantity ; ?>" />
|
|
|
|
<input type="hidden" name="<?php echo 'packprice'.$intt ?>" id="<?php echo 'packprice'.$intt ?>" value="<?php echo $pac->Price ; ?>" />
|
|
|
|
<?php }}?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!--third table-->
|
|
<div class="container-fluid">
|
|
<div><legend>Co-Products</legend></div>
|
|
<table class="table table-bordered" style="border:1px solid #333">
|
|
<div align="right" style="padding-right:10px">
|
|
<div align="right">
|
|
<a type="button" class="btn btn-primary btn-md" data-toggle="modal" data-target="#Coproduct">Add Co-Products</a>
|
|
<!-- Add line Item -->
|
|
<div class="modal fade" id="Coproduct" role="dialog">
|
|
<div class="modal-dialog">
|
|
|
|
<!-- Modal content-->
|
|
<div class="modal-content">
|
|
<div class="modal-header" style="background-color: #3c8dbc;color:#fff;">
|
|
<button type="button" class="close" data-dismiss="modal">×</button>
|
|
<center><h4>Add Line Item </h4></center>
|
|
</div>
|
|
<div align="left">
|
|
|
|
|
|
<div class="col-md-12">
|
|
<div class="col-md-6">
|
|
<label>Material Name</label>
|
|
<div class="form-group">
|
|
<?php
|
|
|
|
$options = array("0"=>'Select Material Code');
|
|
|
|
if(!empty($inv_final_product))
|
|
{
|
|
foreach ($inv_final_product as $mat):
|
|
$options[$mat->product_id] =$mat->product_id.' '.' - '.' '.$mat->product_name;
|
|
|
|
|
|
//$RL[$SID->ReqNo] = $SID->ReqNo.' '.' - '.' '.$SID->DepartmentName;
|
|
endforeach;
|
|
}
|
|
|
|
|
|
|
|
|
|
echo form_dropdown('coproduct_id', $options,set_value('product_id'),'id="coproduct_id"' ,'class="form-control select2"' , 'required="true"' );
|
|
?>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="col-md-6">
|
|
<label>Date</label>
|
|
<?php
|
|
$data = array('name' => 'CopDate','value' => set_value('CopDate',$CurrentDate),'id'=>'CopDate', 'class' => 'form-control' ,'required' => 'true', 'onkeypress'=>'return false;');
|
|
echo form_input($data);
|
|
?>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="col-md-12">
|
|
|
|
<div class="col-md-6">
|
|
<label>Quantity</label>
|
|
<div>
|
|
<?php
|
|
$data = array('name' => 'Coqty','value' => set_value('Coqty'),'id'=>'Coqty', 'class' => 'form-control');
|
|
echo form_input($data);
|
|
?>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div class="col-md-6">
|
|
<label>Price</label>
|
|
<div>
|
|
<?php
|
|
$data = array('name' => 'Coprice','value' => set_value('Coprice'),'id'=>'Coprice', 'class' => 'form-control');
|
|
echo form_input($data);
|
|
?>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<div class="modal-footer">
|
|
<a class="btn btn-primary font CoaddClick" ID="CoaddClick" > <span class="bold">Add</span></a>
|
|
<a class="btn btn-primary" data-dismiss="modal" value="Cancel">Cancel</a>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Edit Line Item -->
|
|
|
|
<div class="modal fade" id="EditCoproduct" role="dialog">
|
|
<div class="modal-dialog">
|
|
|
|
<!-- Modal content-->
|
|
<div class="modal-content">
|
|
<div class="modal-header" style="background-color: #3c8dbc;color:#fff;">
|
|
<button type="button" class="close" data-dismiss="modal">×</button>
|
|
<center><h4>Edit Line Item </h4></center>
|
|
</div>
|
|
<div align="left">
|
|
|
|
<div class="col-md-12">
|
|
<div class="col-md-6">
|
|
<label>CoProduct Id</label>
|
|
<div class="form-group">
|
|
<?php
|
|
|
|
$data = array('name' => 'Editcoproduct_id','value' => set_value('Editcoproduct_id'),'id'=>'Editcoproduct_id', 'class' => 'form-control','readonly'=>'true');
|
|
echo form_input($data);
|
|
?>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="col-md-6">
|
|
<label>Date</label>
|
|
<?php
|
|
$data = array('name' => 'EditCopDate','value' => set_value('EditCopDate',$CurrentDate),'id'=>'EditCopDate', 'class' => 'form-control' ,'required' => 'true', 'onkeypress'=>'return false;');
|
|
echo form_input($data);
|
|
?>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="col-md-12">
|
|
|
|
<div class="col-md-6">
|
|
<label>Quantity</label>
|
|
<div>
|
|
<?php
|
|
$data = array('name' => 'EditCoqty','value' => set_value('EditCoqty'),'id'=>'EditCoqty', 'class' => 'form-control');
|
|
echo form_input($data);
|
|
?>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div class="col-md-6">
|
|
<label>Price</label>
|
|
<div>
|
|
<?php
|
|
$data = array('name' => 'EditCoprice','value' => set_value('EditCoprice'),'id'=>'EditCoprice', 'class' => 'form-control');
|
|
echo form_input($data);
|
|
?>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
<div class="modal-footer">
|
|
<a class="btn btn-primary font CoEditItem" ID="CoEditItem" > <span class="bold">Edit</span></a>
|
|
<a class="btn btn-primary" data-dismiss="modal" value="Cancel">Cancel</a>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
</table>
|
|
</div>
|
|
|
|
|
|
|
|
<div class="row" style="padding: 0px 15px 0px 10px;">
|
|
<table id="coproductmytable" class="table table-bordered table-hover editableTable" style="background-color:#fff;font-size:12px;">
|
|
<thead style="background-color: #CFCFCF;">
|
|
<!-- <thead style="background-color: #CFCFCF;"> -->
|
|
<th>S.No</th>
|
|
<th>Product Id</th>
|
|
<!-- <th>Product Name</th> -->
|
|
<th>Date</th>
|
|
<th>Quantity</th>
|
|
<th>Price</th>
|
|
<th>Action</th>
|
|
</thead>
|
|
<tbody id="coproductappend">
|
|
|
|
<?php
|
|
if(!empty($coproductmaterial)){
|
|
$ind=0;
|
|
foreach($coproductmaterial as $dis){//print_r($dis);
|
|
$ind= $ind+1;
|
|
|
|
|
|
?>
|
|
<tr id="copr<?php echo $ind ; ?>">
|
|
<td id="<?php echo $ind?>"><?php echo $ind?></td>
|
|
<td id="Copmaterial<?php echo $ind?>"><?php echo $dis['MaterialCode'];?></td>
|
|
<!-- <td id="Copmaterial<?php echo $ind?>"><?php echo $dis['product_name'];?></td> -->
|
|
<td id="Copsuppliername<?php echo $ind?>"><?php echo $dis['CoDate']?></td>
|
|
<td id="CopQuantiy<?php echo $ind?>"><?php echo $dis['Quantity']?></td>
|
|
<td id="CopmaterialPrice<?php echo $ind?>"><?php echo $dis['Price']?></td>
|
|
|
|
|
|
<input type="hidden" name="<?php echo 'CopId'.$ind ?>" id="<?php echo 'CopId'.$ind ?>" value="<?php echo $dis['CoId'] ; ?>" readonly/>
|
|
|
|
|
|
<input type="hidden" name="<?php echo 'Copmaterialcode'.$ind ?>" id="<?php echo 'Copmaterialcode'.$ind ?>" value="<?php echo $dis['MaterialCode'] ; ?>" readonly/>
|
|
|
|
<input type="hidden" name="<?php echo 'CopDate'.$ind ?>" id="<?php echo 'CopDate'.$ind ?>" value="<?php echo $dis['CoDate'] ; ?>" readonly/>
|
|
|
|
|
|
<input type="hidden" name="<?php echo 'CopQty'.$ind ?>" id="<?php echo 'CopQty'.$ind ?>" value="<?php echo $dis['Quantity'] ; ?>" readonly/>
|
|
|
|
<input type="hidden" name="<?php echo 'Copprice'.$ind ?>" id="<?php echo 'Copprice'.$ind ?>" value="<?php echo $dis['Price'] ; ?>" readonly/>
|
|
|
|
|
|
<td> <a data-target='#EditCoproduct' data-id="<?php echo $ind ; ?>" data-userid="<?php echo $ind ; ?>" data-toggle="modal" href="#EditCoproduct"><i class="fa fa-pencil" data-toggle="tooltip" title="Click here to view/Edit;"></i> </a> <a href='#' onclick = "DeleteactionRow(<?php echo $ind?>);" class="link" data-id="<?php echo $ind ; ?>" data-userid="<?php echo $ind ; ?>" id="Del" ><span class="glyphicon glyphicon-trash"></span></a></td>
|
|
</tr>
|
|
<?php } }?>
|
|
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<input type="hidden" name="RawRow" id="RawRow" value="<?php echo $index?>"">
|
|
<input type="hidden" name="ConsuRow" id="ConsuRow" value="<?php echo $inde?>">
|
|
<input type="hidden" name="PkgRow" id="PkgRow" value="<?php echo $intt?>">
|
|
<input type="hidden" name="CopRow" id="CopRow" value="<?php echo $ind?>">
|
|
<input type="hidden" name="CId" id="CId" value="<?php echo $CId?>">
|
|
|
|
<input type="hidden" name="FPId" id="FPId" value="<?php echo $FPId?>">
|
|
|
|
|
|
|
|
<div class="col-md-2 col-md-offset-11">
|
|
<a class="btn btn-primary Save" ID="Save" onclick="Save()" > <span class="bold">Save</span></a>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div><!--end box-->
|
|
</section>
|
|
</div>
|
|
|
|
<script type="text/html" id="rawmateriallist">
|
|
<tr id="rawmat<%=index%>">
|
|
<td align="left"><%=index%></td>
|
|
<td align="left" id="rawmaterialedit<%=index%>"><%=Material%></td>
|
|
<td align="left" id="rawsuppliername<%=index%>"><%=Supplier%></td>
|
|
<td align="left" id="rawQuantiy<%=index%>"><%=Quantity%></td>
|
|
<td align="left" id="rawmaterialPrice<%=index%>"><%=Price%></td>
|
|
|
|
|
|
<td>
|
|
<a data-target='#EditItem' data-id="<%=index%>" data-userid="<%=index%>" data-toggle="modal" href="#editimportpomodel"><i class="fa fa-pencil" data-toggle="tooltip" title="Click here to view/Edit details"></i> </a></span></a>
|
|
|
|
|
|
</td>
|
|
</tr>
|
|
</script>
|
|
|
|
|
|
<script type="text/html" id="consumable">
|
|
<tr id="consumable<%=rootindex%>">
|
|
<td align="left"><%=rootindex%></td>
|
|
|
|
<td align="left" id="consumaterial<%=rootindex%>"><%=Material%></td>
|
|
<td align="left" id="consusuppliername<%=rootindex%>"><%=Supplier%></td>
|
|
<td align="left" id="consuQuantiy<%=rootindex%>"><%=Quantity%></td>
|
|
<td align="left" id="consumaterialPrice<%=rootindex%>"><%=Price%></td>
|
|
|
|
<td>
|
|
<a data-target='#EditRootCausemodal' data-id="<%=rootindex%>" data-userid="<%=rootindex%>" data-toggle="modal" href="#EditRootCausemodal"><i class="fa fa-pencil" data-toggle="tooltip" title="Click here to view/Edit the details"></i> </a> </span></a>
|
|
|
|
|
|
</td>
|
|
</tr>
|
|
</script>
|
|
|
|
<script type="text/html" id="packable">
|
|
<tr id="pack<%=counterindex%>">
|
|
<td align="left"><%=counterindex%></td>
|
|
<td align="left" id="packmaterial<%=counterindex%>"><%=Material%></td>
|
|
<td align="left" id="packsuppliername<%=counterindex%>"><%=Supplier%></td>
|
|
<td align="left" id="packQuantiy<%=counterindex%>"><%=Quantity%></td>
|
|
<td align="left" id="packmaterialPrice<%=counterindex%>"><%=Price%></td>
|
|
|
|
|
|
<td>
|
|
<a data-target='#EditCounter' data-id="<%=counterindex%>" data-userid="<%=counterindex%>" data-toggle="modal" href="#editimportpomodel"><i class="fa fa-pencil" data-toggle="tooltip" title="Click here to view/Edit details"></i> </a></span></a>
|
|
|
|
|
|
</td>
|
|
</tr>
|
|
</script>
|
|
|
|
|
|
<script type="text/html" id="coproduct">
|
|
<tr id="copr<%=coproductindex%>">
|
|
<td align="left"><%=coproductindex%></td>
|
|
<td align="left" id="Copmaterial<%=coproductindex%>"><%=Material%></td>
|
|
<td align="left" id="Copsuppliername<%=coproductindex%>"><%=Date%></td>
|
|
<td align="left" id="CopQuantiy<%=coproductindex%>"><%=Quantity%></td>
|
|
<td align="left" id="CopmaterialPrice<%=coproductindex%>"><%=Price%></td>
|
|
|
|
|
|
<td>
|
|
<a data-target='#EditCoproduct' data-id="<%=coproductindex%>" data-userid="<%=coproductindex%>" data-toggle="modal" href="#editimportpomodel"><i class="fa fa-pencil" data-toggle="tooltip" title="Click here to view/Edit details"></i> </a></span></a>
|
|
|
|
|
|
</td>
|
|
</tr>
|
|
</script>
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
|
|
var index= '<?php echo $index; ?>';
|
|
var rootindex = '<?php echo $inde?>';
|
|
var counterindex = '<?php echo $intt?>';
|
|
var coproductindex ='<?php echo $ind?>' ;
|
|
|
|
//alert(index)
|
|
// var index=1;
|
|
// var rootindex=1;
|
|
// var counterindex=1;
|
|
// var coproductindex=1;
|
|
var userid = '';
|
|
var conuserid = '';
|
|
var packuserid = '';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function addHidden(theForm, key, value)
|
|
{
|
|
// Create a hidden input element, and append it to the form:
|
|
var input = document.createElement('input');
|
|
input.type = 'hidden';
|
|
input.name = key;'name-as-seen-at-the-server';
|
|
input.id = key;'name-as-seen-at-the-server';
|
|
input.value = value;
|
|
theForm.append(input);
|
|
}
|
|
|
|
|
|
$('.addraw').click(function()
|
|
{
|
|
var rawmaterialcode= $('#rawmaterialcode').val();
|
|
var rawSupplierID = $('#rawSupplier').val();
|
|
var rawQty = $('#rawqty').val();
|
|
var rawprice = $('#rawprice').val();
|
|
var rawsuppliername = rawSupplier.options[rawSupplier.selectedIndex].text;
|
|
|
|
//alert(rawsuppliername);
|
|
|
|
index = parseInt(index)+1;
|
|
var temp = index
|
|
|
|
// alert(index)
|
|
var template = jQuery("#rawmateriallist").html();
|
|
|
|
// alert(template)
|
|
$('#rawappend').append(_.template(template,{index:temp,Material:rawmaterialcode,Supplier:rawsuppliername,Quantity:rawQty,Price:rawprice}));
|
|
|
|
var theForm = $(".final_product");
|
|
|
|
addHidden(theForm,"rawmaterialcode"+temp,rawmaterialcode);
|
|
addHidden(theForm,"rawSupplierID"+temp,rawSupplierID);
|
|
addHidden(theForm,"rawQty"+temp,rawQty);
|
|
addHidden(theForm,"rawprice"+temp,rawprice);
|
|
addHidden(theForm,"type"+temp,"Raw Material");
|
|
|
|
$('#rawmaterialcode').val('');
|
|
$('#rawSupplier').val('');
|
|
$('#rawqty').val('');
|
|
$('#rawprice').val('')
|
|
$('#RawRow').val(temp)
|
|
|
|
|
|
});
|
|
|
|
$("#EditItem").on("shown.bs.modal", function(e)
|
|
{
|
|
|
|
userid = $(e.relatedTarget).data('userid');
|
|
|
|
var tr= document.getElementById(userid);
|
|
//alert(userid)
|
|
|
|
//document.getElementById('rawmateriallist'+userid).innerHTML = editroot;
|
|
$('#Editrawmaterialcode').val($('#rawmaterialcode'+userid).val());
|
|
$('#EditrawSupplier').val($('#rawSupplierID'+userid).val());
|
|
$('#Editrawqty').val($('#rawQty'+userid).val());
|
|
$('#Editrawprice').val($('#rawprice'+userid).val());
|
|
|
|
|
|
});
|
|
|
|
|
|
$('.EditItem').click(function()
|
|
{
|
|
// alert(userid)
|
|
|
|
var rawmaterialcode= $('#Editrawmaterialcode').val();
|
|
var rawSupplierID = $('#EditrawSupplier').val();
|
|
var rawQty = $('#Editrawqty').val();
|
|
var rawprice = $('#Editrawprice').val();
|
|
|
|
var tr= document.getElementById(userid);
|
|
//alert("tr"+tr)
|
|
//var cellval = tr.cells;
|
|
|
|
document.getElementById('rawmaterialedit'+userid).innerHTML = rawmaterialcode;
|
|
document.getElementById('rawsuppliername'+userid).innerHTML = rawSupplierID;
|
|
document.getElementById('rawQuantiy'+userid).innerHTML = rawQty;
|
|
document.getElementById('rawmaterialPrice'+userid).innerHTML = rawprice;
|
|
|
|
// cellval[1].innerHTML = rawmaterialcode;
|
|
// cellval[2].innerHTML = rawSupplierID;
|
|
// cellval[3].innerHTML = rawQty;
|
|
// cellval[4].innerHTML = rawprice;
|
|
|
|
|
|
$('#rawmaterialcode'+userid).val(rawmaterialcode);
|
|
$('#rawSupplierID'+userid).val(rawSupplierID);
|
|
$('#rawQty'+userid).val(rawQty);
|
|
$('#rawprice'+userid).val(rawprice);
|
|
|
|
|
|
});
|
|
|
|
|
|
$('.rootaddClick').click(function()
|
|
{
|
|
|
|
var consumaterialcode= $('#consumaterialcode').val();
|
|
var consuSupplierID = $('#consuSupplier').val();
|
|
var consuQty = $('#consuqty').val();
|
|
var consuprice = $('#consuprice').val();
|
|
var rawsuppliername = consuSupplier.options[consuSupplier.selectedIndex].text;
|
|
|
|
rootindex = parseInt(rootindex)+1;
|
|
var temp = rootindex
|
|
var template = jQuery("#consumable").html();
|
|
//alert(template)
|
|
$('#consuappend').append(_.template(template,{rootindex:temp,Material:consumaterialcode,Supplier:rawsuppliername,Quantity:consuQty,Price:consuprice}));
|
|
|
|
var theForm = $(".final_product");
|
|
|
|
addHidden(theForm,"consumematerialcode"+temp,consumaterialcode);
|
|
addHidden(theForm,"consumeSupplierID"+temp,consuSupplierID);
|
|
addHidden(theForm,"consumeQty"+temp,consuQty);
|
|
addHidden(theForm,"consumeprice"+temp,consuprice);
|
|
addHidden(theForm,"consumetype"+temp,"Consumable");
|
|
|
|
$('#consumaterialcode').val('');
|
|
$('#consuSupplier').val('');
|
|
$('#consuqty').val('');
|
|
$('#consuprice').val('');
|
|
$('#ConsuRow').val(temp);
|
|
|
|
});
|
|
|
|
|
|
$("#EditRootCausemodal").on("shown.bs.modal", function(e)
|
|
{
|
|
|
|
//alert(JSON.stringify(e))
|
|
rootuserid = $(e.relatedTarget).data('userid');
|
|
var tr= document.getElementById(rootuserid);
|
|
$('#Editconsumaterialcode').val($('#consumematerialcode'+rootuserid).val());
|
|
$('#EditconsuSupplier').val($('#consumeSupplierID'+rootuserid).val());
|
|
$('#Editconsuqty').val($('#consumeQty'+rootuserid).val());
|
|
$('#Editconsuprice').val($('#consumeprice'+rootuserid).val());
|
|
|
|
});
|
|
|
|
|
|
$('.rootEditItem').click(function()
|
|
{
|
|
var editconsumaterialcode= $('#Editconsumaterialcode').val();
|
|
var editconsuSupplierID = $('#EditconsuSupplier').val();
|
|
var editconsuQty = $('#Editconsuqty').val();
|
|
var editrawprice = $('#Editconsuprice').val();
|
|
|
|
var tr= document.getElementById(rootuserid);
|
|
// var cellval = tr.cells;
|
|
// cellval[1].innerHTML = editconsumaterialcode;
|
|
// cellval[2].innerHTML = editconsuSupplierID;
|
|
// cellval[3].innerHTML = editconsuQty;
|
|
// cellval[4].innerHTML = editrawprice;
|
|
|
|
|
|
document.getElementById('consumaterial'+rootuserid).innerHTML = editconsumaterialcode;
|
|
document.getElementById('consusuppliername'+rootuserid).innerHTML = editconsuSupplierID;
|
|
document.getElementById('consuQuantiy'+rootuserid).innerHTML = editconsuQty;
|
|
document.getElementById('consumaterialPrice'+rootuserid).innerHTML = editrawprice;
|
|
|
|
// document.getElementById('rootcause'+rootuserid).innerHTML = editroot;
|
|
|
|
$('#consumematerialcode'+rootuserid).val(editconsumaterialcode);
|
|
$('#consumeSupplierID'+rootuserid).val(editconsuSupplierID);
|
|
$('#consumeQty'+rootuserid).val(editconsuQty);
|
|
$('#consumeprice'+rootuserid).val(editrawprice);
|
|
});
|
|
|
|
|
|
$('.CounteraddClick').click(function()
|
|
{
|
|
|
|
var packmaterialcode= $('#packumaterialcode').val();
|
|
var packSupplierID = $('#packSupplier').val();
|
|
var packQty = $('#packqty').val();
|
|
var packprice = $('#packprice').val();
|
|
var packsuppliername = packSupplier.options[packSupplier.selectedIndex].text;
|
|
|
|
counterindex = parseInt(counterindex)+1;
|
|
var temp = counterindex
|
|
var template = jQuery("#packable").html();
|
|
//alert(template)
|
|
$('#packappend').append(_.template(template,{counterindex:temp,Material:packmaterialcode,Supplier:packsuppliername,Quantity:packQty,Price:packprice}));
|
|
|
|
var theForm = $(".final_product");
|
|
|
|
addHidden(theForm,"packmaterialcode"+temp,packmaterialcode);
|
|
addHidden(theForm,"packSupplierID"+temp,packSupplierID);
|
|
addHidden(theForm,"packQty"+temp,packQty);
|
|
addHidden(theForm,"packprice"+temp,packprice);
|
|
addHidden(theForm,"packtype"+temp,"Packaging");
|
|
|
|
$('#packumaterialcode').val('');
|
|
$('#packSupplier').val('');
|
|
$('#packqty').val('');
|
|
$('#packprice').val('');
|
|
$('#PkgRow').val(temp);
|
|
|
|
});
|
|
|
|
|
|
$("#EditCounter").on("shown.bs.modal", function(e)
|
|
{
|
|
|
|
//alert()
|
|
cuserid = $(e.relatedTarget).data('userid');
|
|
|
|
var tr= document.getElementById(cuserid);
|
|
|
|
$('#Editpackumaterialcode').val($('#packmaterialcode'+cuserid).val());
|
|
$('#EditpackSupplier').val($('#packSupplierID'+cuserid).val());
|
|
$('#Editpackqty').val($('#packQty'+cuserid).val());
|
|
$('#Editpackprice').val($('#packprice'+cuserid).val());
|
|
|
|
|
|
});
|
|
|
|
|
|
$('.CounterEditItem').click(function()
|
|
{
|
|
|
|
var editpackmaterialcode= $('#Editpackumaterialcode').val();
|
|
var editpackSupplierID = $('#EditpackSupplier').val();
|
|
var editpackQty = $('#Editpackqty').val();
|
|
var editpackprice = $('#Editpackprice').val();
|
|
//var editpacksuppliername = EditpackSupplier.options[EditpackSupplier.selectedIndex].text;
|
|
|
|
var tr= document.getElementById(cuserid);
|
|
//var cellval = tr.cells;
|
|
//alert(cuserid)
|
|
|
|
// cellval[1].innerHTML = editpackmaterialcode;
|
|
// cellval[2].innerHTML = editpacksuppliername;
|
|
// cellval[3].innerHTML = editpackQty;
|
|
// cellval[4].innerHTML = editpackprice;
|
|
|
|
|
|
|
|
document.getElementById('packmaterial'+cuserid).innerHTML = editpackmaterialcode;
|
|
document.getElementById('packsuppliername'+cuserid).innerHTML = editpackSupplierID;
|
|
document.getElementById('packQuantiy'+cuserid).innerHTML = editpackQty;
|
|
document.getElementById('packmaterialPrice'+cuserid).innerHTML = editpackprice;
|
|
|
|
$('#packmaterialcode'+cuserid).val(editpackmaterialcode);
|
|
$('#packSupplierID'+cuserid).val(editpackSupplierID);
|
|
$('#packQty'+cuserid).val(editpackQty);
|
|
$('#packprice'+cuserid).val(editpackprice);
|
|
|
|
|
|
});
|
|
|
|
|
|
$('.CoaddClick').click(function()
|
|
{
|
|
|
|
var copmaterialcode= $('#coproduct_id').val();
|
|
var copDate = $('#CopDate').val();
|
|
var newdate = copDate.split("-").reverse().join("-");
|
|
var copQty = $('#Coqty').val();
|
|
var copprice = $('#Coprice').val();
|
|
var copsuppliername = coproduct_id.options[coproduct_id.selectedIndex].text;
|
|
|
|
coproductindex = parseInt(coproductindex)+1;
|
|
var temp = coproductindex
|
|
var template = jQuery("#coproduct").html();
|
|
//alert(copsuppliername)
|
|
$('#coproductappend').append(_.template(template,{coproductindex:temp,Material:copsuppliername,Date:copDate,Quantity:copQty,Price:copprice}));
|
|
|
|
var theForm = $(".final_product");
|
|
|
|
addHidden(theForm,"Copmaterialcode"+temp,copmaterialcode);
|
|
addHidden(theForm,"CopDate"+temp,newdate);
|
|
addHidden(theForm,"CopQty"+temp,copQty);
|
|
addHidden(theForm,"Copprice"+temp,copprice);
|
|
addHidden(theForm,"Coptype"+temp,"CoProduct");
|
|
|
|
$('#coproduct_id').val('');
|
|
$('#CopDate').val('');
|
|
$('#Coqty').val('');
|
|
$('#Coprice').val('');
|
|
$('#CopRow').val(temp);
|
|
|
|
});
|
|
|
|
|
|
|
|
$("#EditCoproduct").on("shown.bs.modal", function(e)
|
|
{
|
|
|
|
//alert()
|
|
cuserid = $(e.relatedTarget).data('userid');
|
|
|
|
var tr= document.getElementById(cuserid);
|
|
|
|
$('#Editcoproduct_id').val($('#Copmaterialcode'+cuserid).val());
|
|
$('#EditCopDate').val($('#CopDate'+cuserid).val());
|
|
$('#EditCoqty').val($('#CopQty'+cuserid).val());
|
|
$('#EditCoprice').val($('#Copprice'+cuserid).val());
|
|
|
|
|
|
});
|
|
|
|
|
|
$('.CoEditItem').click(function()
|
|
{
|
|
|
|
var editcoproductid = $('#Editcoproduct_id').val();
|
|
var editcopdate = $('#EditCopDate').val();
|
|
var newdate = editcopdate.split("-").reverse().join("-");
|
|
var editcopqty = $('#EditCoqty').val();
|
|
var editcopprice = $('#EditCoprice').val();
|
|
// var editcopproduct = Editcoproduct_id.options[Editcoproduct_id.selectedIndex].text;
|
|
|
|
var tr= document.getElementById(cuserid);
|
|
//var cellval = tr.cells;
|
|
//alert(cuserid)
|
|
|
|
// cellval[1].innerHTML = editcopproduct;
|
|
// cellval[2].innerHTML = editcopdate;
|
|
// cellval[3].innerHTML = editcopqty;
|
|
// cellval[4].innerHTML = editcopprice;
|
|
|
|
|
|
document.getElementById('Copmaterial'+cuserid).innerHTML = editcoproductid;
|
|
document.getElementById('Copsuppliername'+cuserid).innerHTML = newdate;
|
|
document.getElementById('CopQuantiy'+cuserid).innerHTML = editcopqty;
|
|
document.getElementById('CopmaterialPrice'+cuserid).innerHTML = editcopprice;
|
|
|
|
$('#Copmaterialcode'+cuserid).val(editcoproductid);
|
|
$('#CopDate'+cuserid).val(newdate);
|
|
$('#CopQty'+cuserid).val(editcopqty);
|
|
$('#Copprice'+cuserid).val(editcopprice);
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
$('#rawmaterialcode').change(function()
|
|
{
|
|
var type = "rawmaterial";
|
|
ResultantQty(type);
|
|
|
|
});
|
|
|
|
$('#rawSupplier').change(function()
|
|
{
|
|
var type = "rawmaterial";
|
|
ResultantQty(type);
|
|
|
|
});
|
|
|
|
$('#consumaterialcode').change(function()
|
|
{
|
|
var type = "consumables";
|
|
ResultantQty(type);
|
|
|
|
});
|
|
|
|
$('#consuSupplier').change(function()
|
|
{
|
|
var type = "consumables";
|
|
ResultantQty(type);
|
|
|
|
});
|
|
|
|
|
|
|
|
$('#packumaterialcode').change(function()
|
|
{
|
|
var type = "packing";
|
|
ResultantQty(type);
|
|
|
|
});
|
|
|
|
$('#packSupplier').change(function()
|
|
{
|
|
var type = "packing";
|
|
ResultantQty(type);
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
$('#Editrawmaterialcode').change(function()
|
|
{
|
|
|
|
var type = "rawmaterial";
|
|
EditResultantQty(type);
|
|
|
|
});
|
|
|
|
$('#EditrawSupplier').change(function()
|
|
{
|
|
|
|
|
|
var type = "rawmaterial";
|
|
EditResultantQty(type);
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function ResultantQty(materialtype)
|
|
{
|
|
//alert(materialtype);
|
|
|
|
if(materialtype == 'rawmaterial')
|
|
{
|
|
var materialcode = $('#rawmaterialcode').val();
|
|
var supplier =$('#rawSupplier').val();
|
|
var editmaterialcode = $('#Editrawmaterialcode').val();
|
|
var editsupplier = $('#EditrawSupplier').val();
|
|
|
|
// alert("add"+materialcode);
|
|
// alert("add"+supplier);
|
|
|
|
if(((materialcode != 0)&&(supplier != 0)))
|
|
{
|
|
|
|
//alert("add");
|
|
//alert(supplier);
|
|
// die();
|
|
var date = new Date();
|
|
|
|
var dd = date.getDate();
|
|
var mm = date.getMonth()+1;
|
|
var yyyy = date.getFullYear();
|
|
if(dd<10)
|
|
{
|
|
dd='0'+dd;
|
|
}
|
|
|
|
if(mm<10)
|
|
{
|
|
mm='0'+mm;
|
|
}
|
|
|
|
today = yyyy+'-'+mm+'-'+dd;
|
|
|
|
//alert(today)
|
|
//today = mm+'-'+dd+'-'+yyyy;
|
|
|
|
$('#content').loader('show');
|
|
$.ajax({
|
|
|
|
data:{materialcode:materialcode,Supplier:supplier,date:today},
|
|
type:"POST",
|
|
url:"<?php echo base_url() ?>batchcard/getQuantity",
|
|
success:function(data) {
|
|
if(data)
|
|
{
|
|
$('#content').loader('hide');
|
|
// alert(data);
|
|
var qty= '';
|
|
var addqty = 0;
|
|
var reduceqty = 0;
|
|
|
|
$.each(JSON.parse(data),function(i,obj)
|
|
{
|
|
addqty = obj.Addqty;
|
|
reduceqty = obj.ReduceQty;
|
|
|
|
// console.log(addqty);
|
|
// console.log(reduceqty)
|
|
|
|
if(addqty == null)
|
|
{
|
|
addqty =0;
|
|
}
|
|
|
|
if(reduceqty == null)
|
|
{
|
|
reduceqty=0;
|
|
}
|
|
});
|
|
|
|
// console.log(addqty);
|
|
// console.log(reduceqty)
|
|
|
|
var resultantqty = parseFloat(addqty)- parseFloat(reduceqty);
|
|
|
|
//console.log(resultantqty);
|
|
|
|
if(isNaN(resultantqty))
|
|
{
|
|
$('#rawqty').val(0);
|
|
}
|
|
else
|
|
{
|
|
|
|
$('#rawqty').val(resultantqty);
|
|
|
|
}
|
|
|
|
|
|
}
|
|
else
|
|
{
|
|
alert("Error");
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
if(materialtype == 'consumables')
|
|
{
|
|
var materialcode = $('#consumaterialcode').val();
|
|
var supplier =$('#consuSupplier').val();
|
|
|
|
if(((materialcode != 0)&&(supplier != 0)))
|
|
{
|
|
|
|
// alert("add");
|
|
//alert(supplier);
|
|
// die();
|
|
var date = new Date();
|
|
|
|
var dd = date.getDate();
|
|
var mm = date.getMonth()+1;
|
|
var yyyy = date.getFullYear();
|
|
if(dd<10)
|
|
{
|
|
dd='0'+dd;
|
|
}
|
|
|
|
if(mm<10)
|
|
{
|
|
mm='0'+mm;
|
|
}
|
|
|
|
today = yyyy+'-'+mm+'-'+dd;
|
|
|
|
//alert(today)
|
|
//today = mm+'-'+dd+'-'+yyyy;
|
|
|
|
$('#content').loader('show');
|
|
$.ajax({
|
|
|
|
data:{materialcode:materialcode,Supplier:supplier,date:today},
|
|
type:"POST",
|
|
url:"<?php echo base_url() ?>batchcard/getQuantity",
|
|
success:function(data) {
|
|
if(data)
|
|
{
|
|
$('#content').loader('hide');
|
|
// alert(data);
|
|
var qty= '';
|
|
var addqty = 0;
|
|
var reduceqty = 0;
|
|
|
|
|
|
$.each(JSON.parse(data),function(i,obj)
|
|
{
|
|
addqty = obj.Addqty;
|
|
reduceqty = obj.ReduceQty;
|
|
|
|
if(addqty == null)
|
|
{
|
|
addqty =0;
|
|
}
|
|
|
|
if(reduceqty == null)
|
|
{
|
|
reduceqty=0;
|
|
}
|
|
});
|
|
|
|
var resultantqty = parseFloat(addqty)- parseFloat(reduceqty);
|
|
|
|
if(isNaN(resultantqty))
|
|
{
|
|
$('#consuqty').val(0);
|
|
}
|
|
else
|
|
{
|
|
|
|
$('#consuqty').val(resultantqty);
|
|
|
|
}
|
|
|
|
|
|
}
|
|
else
|
|
{
|
|
alert("Error");
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(materialtype == 'packing')
|
|
{
|
|
var materialcode = $('#packumaterialcode').val();
|
|
var supplier =$('#packSupplier').val();
|
|
|
|
if(((materialcode != 0)&&(supplier != 0)))
|
|
{
|
|
|
|
//alert("add");
|
|
//alert(supplier);
|
|
// die();
|
|
var date = new Date();
|
|
|
|
var dd = date.getDate();
|
|
var mm = date.getMonth()+1;
|
|
var yyyy = date.getFullYear();
|
|
if(dd<10)
|
|
{
|
|
dd='0'+dd;
|
|
}
|
|
|
|
if(mm<10)
|
|
{
|
|
mm='0'+mm;
|
|
}
|
|
|
|
today = yyyy+'-'+mm+'-'+dd;
|
|
|
|
//alert(today)
|
|
//today = mm+'-'+dd+'-'+yyyy;
|
|
|
|
$('#content').loader('show');
|
|
$.ajax({
|
|
|
|
data:{materialcode:materialcode,Supplier:supplier,date:today},
|
|
type:"POST",
|
|
url:"<?php echo base_url() ?>batchcard/getQuantity",
|
|
success:function(data) {
|
|
if(data)
|
|
{
|
|
$('#content').loader('hide');
|
|
// alert(data);
|
|
var qty= '';
|
|
var addqty = 0;
|
|
var reduceqty = 0;
|
|
|
|
|
|
$.each(JSON.parse(data),function(i,obj)
|
|
{
|
|
addqty = obj.Addqty;
|
|
reduceqty = obj.ReduceQty;
|
|
|
|
if(addqty == null)
|
|
{
|
|
addqty =0;
|
|
}
|
|
|
|
if(reduceqty == null)
|
|
{
|
|
reduceqty=0;
|
|
}
|
|
});
|
|
|
|
var resultantqty = parseFloat(addqty)- parseFloat(reduceqty);
|
|
|
|
if(isNaN(resultantqty))
|
|
{
|
|
$('#packqty').val(0);
|
|
}
|
|
else
|
|
{
|
|
|
|
$('#packqty').val(resultantqty);
|
|
|
|
}
|
|
|
|
|
|
}
|
|
else
|
|
{
|
|
alert("Error");
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function EditResultantQty(materialtype)
|
|
{
|
|
// alert(materialtype);
|
|
|
|
if(materialtype == 'rawmaterial')
|
|
{
|
|
var editmaterialcode = $('#Editrawmaterialcode').val();
|
|
var editsupplier = $('#EditrawSupplier').val();
|
|
|
|
// alert("add"+materialcode);
|
|
// alert("add"+supplier);
|
|
|
|
if(((editmaterialcode != 0)&&(editsupplier != 0)))
|
|
{
|
|
|
|
//alert("add");
|
|
//alert(supplier);
|
|
// die();
|
|
var date = new Date();
|
|
|
|
var dd = date.getDate();
|
|
var mm = date.getMonth()+1;
|
|
var yyyy = date.getFullYear();
|
|
if(dd<10)
|
|
{
|
|
dd='0'+dd;
|
|
}
|
|
|
|
if(mm<10)
|
|
{
|
|
mm='0'+mm;
|
|
}
|
|
|
|
today = yyyy+'-'+mm+'-'+dd;
|
|
|
|
//alert(today)
|
|
//today = mm+'-'+dd+'-'+yyyy;
|
|
|
|
$('#content').loader('show');
|
|
$.ajax({
|
|
|
|
data:{materialcode:editmaterialcode,Supplier:editsupplier,date:today},
|
|
type:"POST",
|
|
url:"<?php echo base_url() ?>batchcard/getQuantity",
|
|
success:function(data) {
|
|
if(data)
|
|
{
|
|
$('#content').loader('hide');
|
|
// alert(data);
|
|
var qty= '';
|
|
var addqty = 0;
|
|
var reduceqty = 0;
|
|
|
|
$.each(JSON.parse(data),function(i,obj)
|
|
{
|
|
addqty = obj.Addqty;
|
|
reduceqty = obj.ReduceQty;
|
|
|
|
|
|
|
|
if(addqty == null)
|
|
{
|
|
addqty =0;
|
|
}
|
|
|
|
if(reduceqty == null)
|
|
{
|
|
reduceqty=0;
|
|
}
|
|
});
|
|
|
|
var resultantqty = parseFloat(addqty)- parseFloat(reduceqty);
|
|
|
|
if(isNaN(resultantqty))
|
|
{
|
|
$('#Editrawqty').val(0);
|
|
}
|
|
else
|
|
{
|
|
|
|
$('#Editrawqty').val(resultantqty);
|
|
|
|
}
|
|
|
|
|
|
}
|
|
else
|
|
{
|
|
alert("Error");
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
if(materialtype == 'consumables')
|
|
{
|
|
var editmaterialcode = $('#Editconsumaterialcode').val();
|
|
var editsupplier =$('#EditconsuSupplier').val();
|
|
|
|
if(((editmaterialcode != 0)&&(editsupplier != 0)))
|
|
{
|
|
|
|
// alert("add");
|
|
//alert(supplier);
|
|
// die();
|
|
var date = new Date();
|
|
|
|
var dd = date.getDate();
|
|
var mm = date.getMonth()+1;
|
|
var yyyy = date.getFullYear();
|
|
if(dd<10)
|
|
{
|
|
dd='0'+dd;
|
|
}
|
|
|
|
if(mm<10)
|
|
{
|
|
mm='0'+mm;
|
|
}
|
|
|
|
today = yyyy+'-'+mm+'-'+dd;
|
|
|
|
//alert(today)
|
|
//today = mm+'-'+dd+'-'+yyyy;
|
|
|
|
$('#content').loader('show');
|
|
$.ajax({
|
|
|
|
data:{materialcode:editmaterialcode,Supplier:editsupplier,date:today},
|
|
type:"POST",
|
|
url:"<?php echo base_url() ?>batchcard/getQuantity",
|
|
success:function(data) {
|
|
if(data)
|
|
{
|
|
$('#content').loader('hide');
|
|
// alert(data);
|
|
var qty= '';
|
|
var addqty = 0;
|
|
var reduceqty = 0;
|
|
|
|
$.each(JSON.parse(data),function(i,obj)
|
|
{
|
|
addqty = obj.Addqty;
|
|
reduceqty = obj.ReduceQty;
|
|
|
|
if(addqty == null)
|
|
{
|
|
addqty =0;
|
|
}
|
|
|
|
if(reduceqty == null)
|
|
{
|
|
reduceqty=0;
|
|
}
|
|
});
|
|
|
|
var resultantqty = parseFloat(addqty)- parseFloat(reduceqty);
|
|
|
|
if(isNaN(resultantqty))
|
|
{
|
|
$('#Editconsuqty').val(0);
|
|
}
|
|
else
|
|
{
|
|
|
|
$('#Editconsuqty').val(resultantqty);
|
|
|
|
}
|
|
|
|
|
|
}
|
|
else
|
|
{
|
|
alert("Error");
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(materialtype == 'packing')
|
|
{
|
|
var editmaterialcode = $('#Editpackumaterialcode').val();
|
|
var editsupplier =$('#EditpackSupplier').val();
|
|
|
|
if(((editmaterialcode != 0)&&(editsupplier != 0)))
|
|
{
|
|
|
|
//alert("add");
|
|
//alert(supplier);
|
|
// die();
|
|
var date = new Date();
|
|
|
|
var dd = date.getDate();
|
|
var mm = date.getMonth()+1;
|
|
var yyyy = date.getFullYear();
|
|
if(dd<10)
|
|
{
|
|
dd='0'+dd;
|
|
}
|
|
|
|
if(mm<10)
|
|
{
|
|
mm='0'+mm;
|
|
}
|
|
|
|
today = yyyy+'-'+mm+'-'+dd;
|
|
|
|
//alert(today)
|
|
//today = mm+'-'+dd+'-'+yyyy;
|
|
|
|
$('#content').loader('show');
|
|
$.ajax({
|
|
|
|
data:{materialcode:editmaterialcode,Supplier:editsupplier,date:today},
|
|
type:"POST",
|
|
url:"<?php echo base_url() ?>batchcard/getQuantity",
|
|
success:function(data) {
|
|
if(data)
|
|
{
|
|
$('#content').loader('hide');
|
|
// alert(data);
|
|
var qty= '';
|
|
var addqty = 0;
|
|
var reduceqty = 0;
|
|
|
|
$.each(JSON.parse(data),function(i,obj)
|
|
{
|
|
addqty = obj.Addqty;
|
|
reduceqty = obj.ReduceQty;
|
|
|
|
if(addqty == null)
|
|
{
|
|
addqty =0;
|
|
}
|
|
|
|
if(reduceqty == null)
|
|
{
|
|
reduceqty=0;
|
|
}
|
|
});
|
|
|
|
var resultantqty = parseFloat(addqty)- parseFloat(reduceqty);
|
|
|
|
if(isNaN(resultantqty))
|
|
{
|
|
$('#Editpackqty').val(0);
|
|
}
|
|
else
|
|
{
|
|
|
|
$('#Editpackqty').val(resultantqty);
|
|
|
|
}
|
|
|
|
|
|
}
|
|
else
|
|
{
|
|
alert("Error");
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function Save()
|
|
{
|
|
|
|
var date=$('#Date').val();
|
|
var newdate = date.split("-").reverse().join("-");
|
|
|
|
$('#content').loader('show');
|
|
$.ajax({
|
|
|
|
data:$('.final_product').serialize()+"&Date="+newdate,
|
|
type:"POST",
|
|
url:"<?php echo base_url() ?>batchcard/UpdateFinal_Product_Save",
|
|
success:function(data) {
|
|
if(data)
|
|
{
|
|
|
|
alert(data);
|
|
$('#content').loader('hide');
|
|
window.location = "FinalProductlisting";
|
|
|
|
}
|
|
else
|
|
{
|
|
alert("Error");
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
}
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|