486 lines
13 KiB
PHP
486 lines
13 KiB
PHP
|
|
<style>
|
|
th{
|
|
text-align:center ! important;
|
|
}
|
|
</style>
|
|
<?php
|
|
//print_r($products);
|
|
|
|
|
|
|
|
$products2=array(-1=>'Select Products');
|
|
$mtypes = array(-1=>'Select Type','INWARD'=>'INWARD','OUTWARD'=>'OUTWARD','INPROCESS'=>'INPROCESS','RESINBATCHCARD'=>'RESIN BATCH CARD');
|
|
|
|
foreach($productsoutward as $product)
|
|
{
|
|
$products2[$product->product_id] =$product->product_id.'-'.$product->product_name.'-'.$product->product_description;
|
|
}
|
|
|
|
$customers2 = array(-1 => 'Select Customer');
|
|
foreach($customersoutward as $customer)
|
|
{
|
|
$customers2[$customer->client_id] = $customer->client_name;
|
|
}
|
|
|
|
$productsinward1=array(-1=>'Select Products');
|
|
|
|
foreach($productsinward as $product)
|
|
{
|
|
$productsinward1[$product->MaterialCode] =$product->MaterialCode.'-'.$product->MaterialName;
|
|
}
|
|
|
|
$customersinward1 = array(-1 => 'Select Supplier');
|
|
foreach($customersinward as $customer)
|
|
{
|
|
$customersinward1[$customer->SupplierID] = $customer->SupplierName;
|
|
}
|
|
?>
|
|
<script src="<?php echo base_url()?>assets/lightswitch/lightswitch/lib/jquery.tabletojson.js"></script>
|
|
<script src="<?php echo base_url()?>assets/lightswitch/lightswitch/lib/jquery.tabletojson.min.js"></script>
|
|
<div class="content-wrapper">
|
|
<!-- Content Header (Page header) -->
|
|
<section class="content-header">
|
|
<h1>
|
|
<center>Product Test Specification Master Screen</center>
|
|
</h1>
|
|
</section>
|
|
<section class="content">
|
|
|
|
|
|
<div class="row">
|
|
<div class="col-xs-12">
|
|
<div class="box">
|
|
<div class="box-header">
|
|
<!--<center><h3 class="box-title">-->
|
|
<div class="box-tools">
|
|
<!-- <form action="<?php echo base_url() ?>assetListing" method="POST" id="searchList">-->
|
|
|
|
|
|
</form>
|
|
</div><!--</h3></center>-->
|
|
|
|
</div><!-- /.box-header -->
|
|
|
|
|
|
<div class="box-body">
|
|
|
|
<div class="row">
|
|
<div class="col-md-2">
|
|
|
|
<?php echo form_dropdown('name="product"',$mtypes,set_value('product',$mtypes[-1]),'id="mtype"' ,'class="form-control select2','style="width:200px;"');?>
|
|
</div>
|
|
<!-- <div class="col-md-1">
|
|
|
|
<input type="radio" value="1" name="type" id="OutWard" onclick="changeType(this.value);"/> OutWard
|
|
|
|
</div>
|
|
<div class="col-md-1">
|
|
<input type="radio" value="0" name="type" id="Inward" onclick="changeType(this.value);"/> InWard
|
|
</div> -->
|
|
<div class="col-md-4" id='outwardarea'>
|
|
|
|
<div class="col-md-6">
|
|
|
|
<?php echo form_dropdown('name="product"',$products2,set_value('product',$products2[-1]),'id="product"' ,'class="form-control select2','style="width:200px;"');?>
|
|
</div>
|
|
|
|
<div class="col-md-6">
|
|
<?php echo form_dropdown('name="customer"',$customers2,set_value('customer',$customers2[-1]),'id="customer"' ,'class="form-control select2');?>
|
|
</div>
|
|
|
|
</div>
|
|
<div class="col-md-4" id='inwardarea'>
|
|
|
|
<div class="col-md-6">
|
|
|
|
<?php echo form_dropdown('name="productinward"',$productsinward1,set_value('productinward',$productsinward1[-1]),'id="productinward"' ,'class="form-control select2');?>
|
|
</div>
|
|
|
|
<div class="col-md-6">
|
|
<?php echo form_dropdown('name="customerinward"',$customersinward1,set_value('customerinward',$customersinward1[-1]),'id="customerinward"' ,'class="form-control select2');?>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="col-md-2">
|
|
<input type="button" id="addspec" class="btn btn-primary" value = "Add New Specification">
|
|
</div>
|
|
|
|
</div>
|
|
<br/>
|
|
<table id="testspecifications" class="table table-bordered table-hover" style="background-color:#fff;font-size:12px;">
|
|
<thead style="background-color:#ddf">
|
|
<tr>
|
|
|
|
<th>Name</th>
|
|
<th>UOM</th>
|
|
<th>Min</th>
|
|
<th>Max</th>
|
|
<th>Temp</th>
|
|
<th>Raw Sand Test</th>
|
|
|
|
<!-- <th>Action</th> -->
|
|
|
|
|
|
</tr>
|
|
</thead>
|
|
<tbody id="specAppend">
|
|
<?php
|
|
if(!empty($existspec))
|
|
{
|
|
foreach($existspec as $data)
|
|
{
|
|
?>
|
|
<!-- <tr> <td><?php echo $data->testtype?></td> <td contenteditable="true"><?php echo $data->uom?></td> <td contenteditable="true"><?php echo $data->min?></td> <td contenteditable="true"><?php echo $data->max?></td></tr> -->
|
|
<?php
|
|
}
|
|
}
|
|
?>
|
|
</tbody>
|
|
</table>
|
|
<p> </p>
|
|
<div class="row">
|
|
<div class="col-md-3" id="savebutton">
|
|
<input type="button" id="submit" value = "Save" class="btn btn-primary" onclick="getAllData();">
|
|
</div>
|
|
</div>
|
|
</div><!-- /.box-body -->
|
|
<!-- <div class="box-footer clearfix">
|
|
|
|
</div> -->
|
|
</div><!-- /.box -->
|
|
|
|
<div id="specmodel" class="modal fade" data-backdrop-limit="1" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" >
|
|
<div class="modal-dialog">
|
|
|
|
<!-- Modal content-->
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<button type="button" class="close" data-dismiss="modal">×</button>
|
|
<h4 class="modal-title">Add New Specification</h4>
|
|
</div>
|
|
<div class="modal-body">
|
|
<form>
|
|
<center>
|
|
<table >
|
|
<tr>
|
|
<td style="text-align:center;padding:10px;">Specification Name</td><td style="padding:10px;"><input type="text" name="spname" id="spname"/> </td>
|
|
</tr>
|
|
<tr>
|
|
<td style="text-align:center;padding:10px;">UOM</td><td style="padding:10px;"><input type="text" name="uom" id="uom"/> </td>
|
|
</tr>
|
|
<tr>
|
|
<td style="text-align:center;padding:10px;">Min</td><td style="padding:10px;"><input type="text" name="min`" id="min"/> </td>
|
|
</tr>
|
|
<tr>
|
|
<td style="text-align:center;padding:10px;;">Max</td><td style="padding:10px;"><input type="text" name="max" id="max"/></td>
|
|
</tr>
|
|
<tr>
|
|
<td style="text-align:center;padding:10px;;">Temp</td><td style="padding:10px;"><input type="text" name="temp" id="temp"/></td>
|
|
</tr>
|
|
|
|
<tr id="sub">
|
|
<td style="text-align:center;padding:10px;;">Sub Category</td><td style="padding:10px;"><input type="checkbox" name="subcata" id="subcata"/> Raw Sand Test</td>
|
|
</tr>
|
|
|
|
|
|
|
|
</table>
|
|
</center>
|
|
</form>
|
|
|
|
</div>
|
|
<div class="modal-footer">
|
|
|
|
<button class="btn btn-primary" ID="addNewRow" onclick="addNewRow();" style="margin-top:-10px;">OK</button>
|
|
<button class="btn btn-primary" data-dismiss="modal" style="margin-top: -10px;" value="Cancel">Cancel</button>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
</div>
|
|
<script type="text/javascript" src="<?php echo base_url(); ?>assets/js/common.js" charset="utf-8"></script>
|
|
<script type="text/javascript">
|
|
$(function () {
|
|
|
|
$('#monthlylisting').DataTable({
|
|
"paging": true,
|
|
"lengthChange": true,
|
|
"searching": true,
|
|
"ordering": true,
|
|
"aaSorting": [[ 0, "asc" ]],
|
|
"info": true,
|
|
"autoWidth": true
|
|
|
|
});
|
|
});
|
|
|
|
</script>
|
|
|
|
<script type="text/html" id="addList">
|
|
<tr id=<%=index%>>
|
|
<td align="left" contenteditable="false"><%=Name%></td>
|
|
<td align="left"contenteditable="true"><%=UOM%></td>
|
|
<td align="right" contenteditable="true"><%=Min%></td>
|
|
<td align="right" contenteditable="true"><%=Max%></td>
|
|
<td align="right" contenteditable="true"><%=Temp%></td>
|
|
<td align="center" contenteditable="true"><%=RawSandTest%></td>
|
|
|
|
<!-- <td align="center" contenteditable="false"><a data-target='#specmodel' data-id="<%=index%>" data-userid="<%=index%>" data-toggle="modal" href="#specmodel"> </a> <a href='#' onclick = "DeleteRow(<%=index%>)" class="link" data-id="<%=index%>" data-userid="<%=index%>" id="Del" ><span class="glyphicon glyphicon-trash"></span></a></td> -->
|
|
</tr> <!-- <i class="fa fa-pencil" data-toggle="tooltip" title="Click here to view/Edit <%=index%> "></i> -->
|
|
</script>
|
|
|
|
<script>
|
|
|
|
$(document).ready(function() {
|
|
//alert();
|
|
// $('#OutWard').attr('checked','true');
|
|
$('#inwardarea').hide();
|
|
$('#outwardarea').show();
|
|
});
|
|
|
|
// function changeType(v)
|
|
// {
|
|
// var val = v
|
|
// // alert(val);
|
|
// if(val == 0)
|
|
// {
|
|
// //alert('InWard');
|
|
// $('#inwardarea').show();
|
|
// $('#outwardarea').hide();
|
|
// $('#inprocessarea').hide();
|
|
|
|
// }
|
|
// else if(val == 1)
|
|
// {
|
|
// //alert('OutWard');
|
|
// $('#inwardarea').hide();
|
|
// $('#outwardarea').show();
|
|
// $('#inprocessarea').show();
|
|
// }
|
|
// }
|
|
$('#product').select2();
|
|
$('#customer').select2();
|
|
$('#productinward').select2();
|
|
$('#customerinward').select2();
|
|
$('#mtype').select2();
|
|
|
|
$('#addspec').click(function(){
|
|
|
|
|
|
if($('#mtype').val() != -1 )
|
|
{
|
|
if($('#mtype').val() == 'INWARD')
|
|
{
|
|
if($('#productinward').val() == -1 || $('#customerinward').val() == -1 )
|
|
{
|
|
alert('Please Select Product and Supplier..!');
|
|
}
|
|
else
|
|
{
|
|
$("#specmodel").modal('show');
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if($('#product').val() == -1 || $('#customer').val() == -1 )
|
|
{
|
|
alert('Please Select Product and Customer..!');
|
|
}
|
|
else
|
|
{
|
|
$("#specmodel").modal('show');
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
alert('Please Select Master Type..!');
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
function addNewRow()
|
|
{
|
|
var sname = $('#spname').val();
|
|
sname = sname.toUpperCase();
|
|
var uom = $('#uom').val();
|
|
var min = $('#min').val();
|
|
var max = $('#max').val();
|
|
var temp = $('#temp').val();
|
|
var sub = 'NO';
|
|
|
|
if($('#subcata').is(':checked')){ sub = 'YES';}
|
|
|
|
|
|
if(sname == '' || uom =='' || min == '' || max == '' || temp == '')
|
|
{
|
|
alert('Please Enter all specification');
|
|
}
|
|
else
|
|
{
|
|
|
|
var rows = document.getElementById('testspecifications').rows.length;
|
|
//rows = rows-1;
|
|
var template = jQuery("#addList").html();
|
|
$('#specAppend').append(_.template(template,{index:rows,Name:sname,UOM:uom,Min:min,Max:max,Temp:temp,RawSandTest:sub}));
|
|
|
|
$('#spname').val('');
|
|
$('#uom').val('');
|
|
$('#min').val('');
|
|
$('#max').val('');
|
|
$('#temp').val('');
|
|
$('#subcata').attr('checked',false);
|
|
|
|
document.getElementById('spname').focus();
|
|
}
|
|
}
|
|
|
|
$("#specmodel").on("shown.bs.modal", function(e) {
|
|
|
|
$('#sub').hide();
|
|
if($('#mtype').val() == 'INPROCESS')
|
|
{
|
|
$('#sub').show();
|
|
|
|
}
|
|
else{ $('#sub').hide(); }
|
|
document.getElementById('spname').focus();
|
|
|
|
});
|
|
|
|
function getAllData()
|
|
{
|
|
|
|
var type = $('#mtype').val();
|
|
var product = '';
|
|
var customer = '';
|
|
// var subtype = '';
|
|
if(type != -1)
|
|
{
|
|
if(type == 'INWARD')
|
|
{
|
|
product = $('#productinward').val();
|
|
customer = $('#customerinward').val();
|
|
|
|
}
|
|
else
|
|
{
|
|
product = $('#product').val();
|
|
customer = $('#customer').val();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
var alldata = $("#testspecifications").tableToJSON();
|
|
//alert(JSON.stringify(alldata));
|
|
alldata=JSON.stringify(alldata)
|
|
// alert(customer);exit();
|
|
if(product == -1 || customer == -1)
|
|
{
|
|
alert('Please Select Product and Customer.');
|
|
}
|
|
else{
|
|
$('#content').loader('show');
|
|
$.ajax({
|
|
data:{param1:alldata,param2:product,param3:customer,param4:type},
|
|
//dataType:"json",
|
|
type:"POST",
|
|
url:"<?php echo base_url() ?>quality/saveSpectficationData",
|
|
success:function(data) {
|
|
if(data)
|
|
{
|
|
|
|
alert(data);
|
|
//console.log(data);
|
|
window.location = "<?php echo base_url().'quality';?>";
|
|
$('#content').loader('hide');
|
|
|
|
|
|
}
|
|
|
|
}
|
|
});
|
|
}
|
|
}
|
|
|
|
$('#mtype').change(function(){
|
|
|
|
var curstatus = $('#mtype').val();
|
|
//alert(curstatus);
|
|
if(curstatus == -1)
|
|
{
|
|
alert("Please Select Master Type...!");
|
|
}
|
|
else
|
|
{
|
|
if(curstatus == 'INWARD')
|
|
{
|
|
$('#inwardarea').show();
|
|
$('#outwardarea').hide();
|
|
}
|
|
else
|
|
{
|
|
$('#inwardarea').hide();
|
|
$('#outwardarea').show();
|
|
}
|
|
|
|
|
|
}
|
|
|
|
});
|
|
|
|
function DeleteRow(rowid)
|
|
{
|
|
var product = $('#product').val();
|
|
var customer = $('#customer').val();
|
|
if(product == -1 || customer == -1)
|
|
{
|
|
alert('Please Select Product and Customer.');
|
|
}
|
|
else{
|
|
var rowid = rowid;
|
|
var d='';
|
|
|
|
var Row = $('#testspecifications').find('tr').eq(rowid).find('td');
|
|
$.each(Row,function(index,value){
|
|
if(index == 0 ){
|
|
|
|
d = value.textContent
|
|
}
|
|
});
|
|
|
|
|
|
$('#content').loader('show');
|
|
$.ajax({
|
|
data:{param1:d,param2:product,param3:customer},
|
|
type:"POST",
|
|
url:"<?php echo base_url() ?>quality/deleteSpecification",
|
|
|
|
success:function(data){
|
|
$('#content').loader('hide');
|
|
alert(data);
|
|
}
|
|
|
|
});
|
|
//rowid.parentNode.removeChild(rowid);
|
|
$('#testspecifications').find('tr').eq(rowid).remove();
|
|
}
|
|
}
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|