2262 lines
67 KiB
PHP
2262 lines
67 KiB
PHP
<?php
|
|
//echo $CId;
|
|
?>
|
|
|
|
|
|
<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 - </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/Final+Product/',$attributes);
|
|
?>
|
|
|
|
<div class="col-md-12">
|
|
<div class="col-md-3">
|
|
|
|
<label>Final Product</label>
|
|
|
|
<?php
|
|
|
|
$options2= array("0"=>'Select Material');
|
|
|
|
if(!empty($inv_final_product))
|
|
{
|
|
foreach ($inv_final_product as $SID):
|
|
|
|
|
|
$options2[$SID->product_id] = $SID->product_id.' '.' - '.' '.$SID->product_name;
|
|
|
|
endforeach;
|
|
}
|
|
|
|
echo form_dropdown('DEPTFN', $options2,set_value('DEPTFN',$SupId),'id="DEPTFN"' ,'required="true"' ,'class="form-control select2');
|
|
|
|
// $data = array('name' => 'Department','value' => set_value('Department'),'id'=>'Department', 'class' => 'form-control' ,'required' => 'true');
|
|
// echo form_input($data);
|
|
|
|
?>
|
|
|
|
</div>
|
|
|
|
<div class="col-md-3">
|
|
<label>Date</label>
|
|
<?php
|
|
$data = array('name' => 'Date','value' => set_value('Date',$CurrentDate),'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' => 'PlaceOforigin','value' => set_value('PlaceOforigin'),'id'=>'PlaceOforigin', 'class' => 'form-control' ,'required' => 'true', 'onkeypress'=>'return false;');
|
|
// echo form_input($data);
|
|
$data = array('name' => 'Quantity','value' => set_value('Quantity'),'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' => 'PlaceOforigin','value' => set_value('PlaceOforigin'),'id'=>'PlaceOforigin', 'class' => 'form-control' ,'required' => 'true', 'onkeypress'=>'return false;');
|
|
// echo form_input($data);
|
|
$data = array('name' => 'values','value' => set_value('values'),'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 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('Editrawmaterialcode', $options,set_value('MaterialCode'),'id="Editrawmaterialcode"' ,'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('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</th>
|
|
<th>Supplier</th>
|
|
<th>Quantity</th>
|
|
<th>Price</th>
|
|
<th>Action</th>
|
|
</thead>
|
|
<tbody id="rawappend">
|
|
<td></td>
|
|
<td></td>
|
|
<td></td>
|
|
<td></td>
|
|
|
|
</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 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('Editconsumaterialcode', $options,set_value('MaterialCode'),'id="Editconsumaterialcode"' ,'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('EditconsuSupplier', $options,set_value('SupplierID'),'id="EditconsuSupplier"' ,'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' => '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</th>
|
|
<th>Supplier</th>
|
|
<th>Quantity</th>
|
|
<th>Price</th>
|
|
<th>Action</th>
|
|
</thead>
|
|
<tbody id="consuappend">
|
|
<td></td>
|
|
<td></td>
|
|
<td></td>
|
|
<td></td>
|
|
|
|
|
|
</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 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('Editpackumaterialcode', $options,set_value('MaterialCode'),'id="Editpackumaterialcode"' ,'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('EditpackSupplier', $options,set_value('SupplierID'),'id="EditpackSupplier"' ,'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' => '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</th>
|
|
<th>Supplier</th>
|
|
<th>Quantity</th>
|
|
<th>Price</th>
|
|
<th>Action</th>
|
|
</thead>
|
|
<tbody id="packappend">
|
|
<td></td>
|
|
<td></td>
|
|
<td></td>
|
|
<td></td>
|
|
|
|
</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>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('Editcoproduct_id', $options,set_value('product_id'),'id="Editcoproduct_id"' ,'class="form-control select2"' , 'required="true"' );
|
|
?>
|
|
</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>Material</th>
|
|
<th>Date</th>
|
|
<th>Quantity</th>
|
|
<th>Price</th>
|
|
<th>Action</th>
|
|
</thead>
|
|
<tbody id="coproductappend">
|
|
<td></td>
|
|
<td></td>
|
|
<td></td>
|
|
<td></td>
|
|
|
|
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<input type="hidden" name="RawRow" id="RawRow">
|
|
<input type="hidden" name="ConsuRow" id="ConsuRow">
|
|
<input type="hidden" name="PkgRow" id="PkgRow">
|
|
<input type="hidden" name="CopRow" id="CopRow">
|
|
<input type="hidden" name="CId" id="CId" value="<?php echo $CId?>">
|
|
|
|
|
|
|
|
<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="<%=index%>">
|
|
<td align="left"><%=index%></td>
|
|
<td align="left" id="rawmaterial<%=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="<%=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="<%=counterindex%>">
|
|
<td align="left"><%=counterindex%></td>
|
|
<td align="left" id="packmaterial<%=rootindex%>"><%=Material%></td>
|
|
<td align="left" id="packsuppliername<%=rootindex%>"><%=Supplier%></td>
|
|
<td align="left" id="packQuantiy<%=rootindex%>"><%=Quantity%></td>
|
|
<td align="left" id="packmaterialPrice<%=rootindex%>"><%=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="<%=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=1;
|
|
var rootindex=1;
|
|
var counterindex=1;
|
|
var coproductindex=1;
|
|
var userid = '';
|
|
var rootuserid = '';
|
|
var counteruserid = '';
|
|
|
|
|
|
|
|
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;
|
|
var temp = index
|
|
//alert(rawsuppliername);
|
|
|
|
index = parseInt(index)+1;
|
|
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);
|
|
|
|
|
|
|
|
$('#Editrawmaterialcode').val($('#rawmaterialcode'+userid).val());
|
|
$('#EditrawSupplier').val($('#rawSupplierID'+userid).val());
|
|
$('#Editrawqty').val($('#rawQty'+userid).val());
|
|
$('#Editrawprice').val($('#rawprice'+userid).val());
|
|
|
|
|
|
});
|
|
|
|
|
|
$('.EditItem').click(function()
|
|
{
|
|
var rawmaterialcode= $('#Editrawmaterialcode').val();
|
|
var rawSupplierID = $('#EditrawSupplier').val();
|
|
var rawQty = $('#Editrawqty').val();
|
|
var rawprice = $('#Editrawprice').val();
|
|
|
|
var tr= document.getElementById(userid);
|
|
var cellval = tr.cells;
|
|
|
|
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;
|
|
var temp = rootindex
|
|
rootindex = parseInt(rootindex)+1;
|
|
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()
|
|
{
|
|
|
|
//alert()
|
|
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;
|
|
|
|
$('#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;
|
|
var temp = counterindex
|
|
counterindex = parseInt(counterindex)+1;
|
|
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;
|
|
var temp = coproductindex
|
|
coproductindex = parseInt(coproductindex)+1;
|
|
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()
|
|
{
|
|
|
|
|
|
$('#content').loader('show');
|
|
$.ajax({
|
|
|
|
data:$('.final_product').serialize(),
|
|
type:"POST",
|
|
url:"<?php echo base_url() ?>batchcard/Final_Product_Save",
|
|
success:function(data) {
|
|
if(data)
|
|
{
|
|
|
|
alert(data);
|
|
$('#content').loader('hide');
|
|
window.location = "FinalProductlisting";
|
|
|
|
}
|
|
else
|
|
{
|
|
alert("Error");
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
}
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|