PRODUCT SPEC MASTER CHANGED AND PRODUCTION ISSUES FIXED

This commit is contained in:
velz2020 2018-03-13 11:35:33 +05:30
parent a34d74c50a
commit 8ef801e084
7 changed files with 179 additions and 110 deletions

View File

@ -76,36 +76,49 @@ class quality extends BaseController
$type = $this->input->post('param4'); $type = $this->input->post('param4');
//echo $type;die();
$createdby = $this->session->userdata ( 'userId' ); $createdby = $this->session->userdata ( 'userId' );
$phpdata = json_decode($jsondata); $phpdata = json_decode($jsondata,true);
$total = 0; $total = 0;
// echo $product .'-'. $customer; // echo $product .'-'. $customer;
// print_r($phpdata);die(); //print_r($phpdata);die();
foreach($phpdata as $data) foreach($phpdata as $data)
{ {
$name = $data->Name; $name = $data['Name'];
$name = strtoupper($name); $name = strtoupper($name);
$uom = $data->UOM; $uom = $data['UOM'];
$min = $data->Min; $min = $data['Min'];
$max = $data->Max; $max = $data['Max'];
$temp = $data->Temp; $temp = $data['Temp'];
$sub = $data->SubCatagory; $rawsandtest = $data['Raw Sand Test'];
$res = 0;
if(strtolower($rawsandtest) == 'yes')
{
$rawsandtest = 1;
}
else
{
$rawsandtest = 0;
}
$isExist = $this->quality_model->checkExist($product,$customer,$name,$type); $isExist = $this->quality_model->checkExist($product,$customer,$name,$type);
//echo $isExist[0]->count;die(); //echo $isExist[0]->count;die();
if($isExist[0]->count == 0) if($isExist[0]->count == 0)
{ {
$tostore = array('customer_id'=>$customer,'product_id'=>$product,'testtype'=>$name,'uom'=>$uom,'min'=>$min,'max'=>$max,'temp'=>$temp,'type'=>$type,'subtype' => $sub,'created_by'=>$createdby); $tostore = array('customer_id'=>$customer,'product_id'=>$product,'testtype'=>$name,'uom'=>$uom,'min'=>$min,'max'=>$max,'temp'=>$temp,'type'=>$type,'subtype' => $rawsandtest,'created_by'=>$createdby);
//print_r($tostore);
$res = $this->quality_model->addSpecMast($tostore); $res = $this->quality_model->addSpecMast($tostore);
//echo 'i'.$res; //echo 'i'.$res;
} }
else if($isExist[0]->count == 1) else if($isExist[0]->count == 1)
{ {
$tostore = array('uom'=>$uom,'min'=>$min,'max'=>$max,'temp'=>$temp,'type'=>$type,'subtype'=>$sub,'updated_by'=>$createdby); $tostore = array('uom'=>$uom,'min'=>$min,'max'=>$max,'temp'=>$temp,'type'=>$type,'subtype' => $rawsandtest,'updated_by'=>$createdby);
$res = $this->quality_model->updateSpecMast($tostore,$product,$customer,$name,$type); $res = $this->quality_model->updateSpecMast($tostore,$product,$customer,$name,$type);
//echo 'u'.$res; //echo 'u'.$res;
} }
@ -223,6 +236,7 @@ class quality extends BaseController
} }
else else
{ {
$res = $this->quality_model->getSpecifications($productid,$customerid); $res = $this->quality_model->getSpecifications($productid,$customerid);
} }

View File

@ -85,19 +85,20 @@ class Quality_model extends CI_Model
$this->db->from('T_Prodcut_Specification_Master'); $this->db->from('T_Prodcut_Specification_Master');
$this->db->join('ip_products','T_Prodcut_Specification_Master.product_id=ip_products.product_id'); $this->db->join('ip_products','T_Prodcut_Specification_Master.product_id=ip_products.product_id');
$this->db->join('ip_clients','T_Prodcut_Specification_Master.customer_id=ip_clients.client_id'); $this->db->join('ip_clients','T_Prodcut_Specification_Master.customer_id=ip_clients.client_id');
$this->db->group_by('T_Prodcut_Specification_Master.type,product_id,customer_id'); $this->db->group_by('product_id,customer_id,T_Prodcut_Specification_Master.type');
$result = $this->db->get(); $result = $this->db->get();
return $result->result(); return $result->result();
} }
function getAllspecInward() function getAllspecInward()
{ {
$this->db->select('T_Prodcut_Specification_Master.*,T_MaterialMaster.MaterialCode,T_MaterialMaster.MaterialName,T_SupplierDetailsN.SupplierID,T_SupplierDetailsN.SupplierName,count(*) as count'); $this->db->select('T_Prodcut_Specification_Master.*,T_MaterialMaster.MaterialCode,T_MaterialMaster.MaterialName,T_SupplierDetailsN.SupplierID,T_SupplierDetailsN.SupplierName,count(*) as count');
$this->db->from('T_Prodcut_Specification_Master'); $this->db->from('T_Prodcut_Specification_Master');
$this->db->join('T_MaterialMaster','T_Prodcut_Specification_Master.product_id=T_MaterialMaster.MaterialCode'); $this->db->join('T_MaterialMaster','T_Prodcut_Specification_Master.product_id=T_MaterialMaster.MaterialCode');
$this->db->join('T_SupplierDetailsN','T_Prodcut_Specification_Master.customer_id=T_SupplierDetailsN.SupplierID'); $this->db->join('T_SupplierDetailsN','T_Prodcut_Specification_Master.customer_id=T_SupplierDetailsN.SupplierID');
$this->db->group_by('product_id,customer_id'); $this->db->group_by('product_id,customer_id,T_Prodcut_Specification_Master.type');
$result = $this->db->get(); $result = $this->db->get();
return $result->result(); return $result->result();
} }

View File

@ -26,7 +26,7 @@ background-color:#ada5d2 ;
$products = array(-1=>'Select Product'); $products = array(-1=>'Select Product');
foreach($productsoutward as $rec) foreach($productsoutward as $rec)
{ {
$products[$rec->product_id] = $rec->product_name; $products[$rec->product_id] = $rec->product_description;
} }
$customers = array(-1=>'Select Customer'); $customers = array(-1=>'Select Customer');

View File

@ -26,7 +26,7 @@ background-color:#ada5d2 ;
$products = array(-1=>'Select Product'); $products = array(-1=>'Select Product');
foreach($productsoutward as $rec) foreach($productsoutward as $rec)
{ {
$products[$rec->product_id] = $rec->product_name; $products[$rec->product_id] = $rec->product_description;
} }
$customers = array(-1=>'Select Customer'); $customers = array(-1=>'Select Customer');

View File

@ -10,6 +10,7 @@ th{
$products2=array(-1=>'Select 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) foreach($productsoutward as $product)
{ {
@ -65,15 +66,19 @@ foreach($customersinward as $customer)
<div class="box-body"> <div class="box-body">
<div class="row"> <div class="row">
<div class="col-md-1"> <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);"/>&nbsp;&nbsp;OutWard <input type="radio" value="1" name="type" id="OutWard" onclick="changeType(this.value);"/>&nbsp;&nbsp;OutWard
</div> </div>
<div class="col-md-1"> <div class="col-md-1">
<input type="radio" value="0" name="type" id="Inward" onclick="changeType(this.value);"/>&nbsp;&nbsp;InWard <input type="radio" value="0" name="type" id="Inward" onclick="changeType(this.value);"/>&nbsp;&nbsp;InWard
</div> </div> -->
<div class="col-md-4" id='outwardarea' > <div class="col-md-4" id='outwardarea'>
<div class="col-md-6"> <div class="col-md-6">
@ -85,7 +90,7 @@ foreach($customersinward as $customer)
</div> </div>
</div> </div>
<div class="col-md-4" id='inwardarea' > <div class="col-md-4" id='inwardarea'>
<div class="col-md-6"> <div class="col-md-6">
@ -97,17 +102,7 @@ foreach($customersinward as $customer)
</div> </div>
</div> </div>
<div class="col-md-2" id="inprocessarea">
<div class="col-md-1">
<?php
$data = array('id'=> 'inprocess','value' => 'accept','checked' => false);
echo form_checkbox($data);
?>
</div>
<div class="col-md-1">InProcess</div>
</div>
<div class="col-md-2"> <div class="col-md-2">
<input type="button" id="addspec" class="btn btn-primary" value = "Add New Specification"> <input type="button" id="addspec" class="btn btn-primary" value = "Add New Specification">
</div> </div>
@ -123,7 +118,8 @@ foreach($customersinward as $customer)
<th>Min</th> <th>Min</th>
<th>Max</th> <th>Max</th>
<th>Temp</th> <th>Temp</th>
<th>SubCatagory</th> <th>Raw Sand Test</th>
<!-- <th>Action</th> --> <!-- <th>Action</th> -->
@ -188,6 +184,8 @@ foreach($customersinward as $customer)
<td style="text-align:center;padding:10px;;">Sub Category</td><td style="padding:10px;"><input type="checkbox" name="subcata" id="subcata"/>&nbsp;&nbsp;&nbsp; Raw Sand Test</td> <td style="text-align:center;padding:10px;;">Sub Category</td><td style="padding:10px;"><input type="checkbox" name="subcata" id="subcata"/>&nbsp;&nbsp;&nbsp; Raw Sand Test</td>
</tr> </tr>
</table> </table>
</center> </center>
</form> </form>
@ -231,7 +229,8 @@ foreach($customersinward as $customer)
<td align="right" contenteditable="true"><%=Min%></td> <td align="right" contenteditable="true"><%=Min%></td>
<td align="right" contenteditable="true"><%=Max%></td> <td align="right" contenteditable="true"><%=Max%></td>
<td align="right" contenteditable="true"><%=Temp%></td> <td align="right" contenteditable="true"><%=Temp%></td>
<td align="center" contenteditable="true"><%=SubCatagory%></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">&nbsp;&nbsp;&nbsp;</a> <a href='#' onclick = "DeleteRow(<%=index%>)" class="link" data-id="<%=index%>" data-userid="<%=index%>" id="Del" ><span class="glyphicon glyphicon-trash"></span></a></td> --> <!-- <td align="center" contenteditable="false"><a data-target='#specmodel' data-id="<%=index%>" data-userid="<%=index%>" data-toggle="modal" href="#specmodel">&nbsp;&nbsp;&nbsp;</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> --> </tr> <!-- <i class="fa fa-pencil" data-toggle="tooltip" title="Click here to view/Edit <%=index%> "></i> -->
</script> </script>
@ -240,66 +239,68 @@ foreach($customersinward as $customer)
$(document).ready(function() { $(document).ready(function() {
//alert(); //alert();
$('#OutWard').attr('checked','true'); // $('#OutWard').attr('checked','true');
$('#inwardarea').hide(); $('#inwardarea').hide();
$('#outwardarea').show(); $('#outwardarea').show();
}); });
function changeType(v) // function changeType(v)
{ // {
var val = v // var val = v
// alert(val); // // alert(val);
if(val == 0) // if(val == 0)
{ // {
//alert('InWard'); // //alert('InWard');
$('#inwardarea').show(); // $('#inwardarea').show();
$('#outwardarea').hide(); // $('#outwardarea').hide();
$('#inprocessarea').hide(); // $('#inprocessarea').hide();
} // }
else if(val == 1) // else if(val == 1)
{ // {
//alert('OutWard'); // //alert('OutWard');
$('#inwardarea').hide(); // $('#inwardarea').hide();
$('#outwardarea').show(); // $('#outwardarea').show();
$('#inprocessarea').show(); // $('#inprocessarea').show();
} // }
} // }
$('#product').select2(); $('#product').select2();
$('#customer').select2(); $('#customer').select2();
$('#productinward').select2(); $('#productinward').select2();
$('#customerinward').select2(); $('#customerinward').select2();
$('#mtype').select2();
$('#addspec').click(function(){ $('#addspec').click(function(){
if($('#OutWard').is(':checked'))
if($('#mtype').val() != -1 )
{ {
var product = $('#product').val(); if($('#mtype').val() == 'INWARD')
var customer = $('#customer').val();
if(product == -1 || customer == -1)
{ {
alert('Please Select Product and Customer.'); if($('#productinward').val() == -1 || $('#customerinward').val() == -1 )
{
alert('Please Select Product and Supplier..!');
}
else
{
$("#specmodel").modal('show');
}
} }
else else
{ {
$('#specmodel').modal('show'); if($('#product').val() == -1 || $('#customer').val() == -1 )
{
alert('Please Select Product and Customer..!');
}
else
{
$("#specmodel").modal('show');
}
} }
} }
else
else//if($('#InWard').is(':checked'))
{ {
//alert('kj'); alert('Please Select Master Type..!');
var productinward = $('#productinward').val();
var customerinward = $('#customerinward').val();
if(productinward == -1 || customerinward == -1)
{
alert('Please Select Product and Customer.');
}
else
{
$('#specmodel').modal('show');
}
//alert('kj');
} }
@ -315,8 +316,10 @@ function addNewRow()
var min = $('#min').val(); var min = $('#min').val();
var max = $('#max').val(); var max = $('#max').val();
var temp = $('#temp').val(); var temp = $('#temp').val();
var sub = 0; var sub = 'NO';
if($('#subcata').is(':checked')){ sub = 1;}
if($('#subcata').is(':checked')){ sub = 'YES';}
if(sname == '' || uom =='' || min == '' || max == '' || temp == '') if(sname == '' || uom =='' || min == '' || max == '' || temp == '')
{ {
@ -328,7 +331,7 @@ function addNewRow()
var rows = document.getElementById('testspecifications').rows.length; var rows = document.getElementById('testspecifications').rows.length;
//rows = rows-1; //rows = rows-1;
var template = jQuery("#addList").html(); var template = jQuery("#addList").html();
$('#specAppend').append(_.template(template,{index:rows,Name:sname,UOM:uom,Min:min,Max:max,Temp:temp,SubCatagory:sub})); $('#specAppend').append(_.template(template,{index:rows,Name:sname,UOM:uom,Min:min,Max:max,Temp:temp,RawSandTest:sub}));
$('#spname').val(''); $('#spname').val('');
$('#uom').val(''); $('#uom').val('');
@ -336,6 +339,7 @@ function addNewRow()
$('#max').val(''); $('#max').val('');
$('#temp').val(''); $('#temp').val('');
$('#subcata').attr('checked',false); $('#subcata').attr('checked',false);
document.getElementById('spname').focus(); document.getElementById('spname').focus();
} }
} }
@ -343,9 +347,10 @@ function addNewRow()
$("#specmodel").on("shown.bs.modal", function(e) { $("#specmodel").on("shown.bs.modal", function(e) {
$('#sub').hide(); $('#sub').hide();
if($('#OutWard').is(':checked') && $('#inprocess').is(':checked')) if($('#mtype').val() == 'INPROCESS')
{ {
$('#sub').show(); $('#sub').show();
} }
else{ $('#sub').hide(); } else{ $('#sub').hide(); }
document.getElementById('spname').focus(); document.getElementById('spname').focus();
@ -355,30 +360,25 @@ $("#specmodel").on("shown.bs.modal", function(e) {
function getAllData() function getAllData()
{ {
var type = ''; var type = $('#mtype').val();
var product = ''; var product = '';
var customer = ''; var customer = '';
// var subtype = ''; // var subtype = '';
if($('#OutWard').is(':checked')) if(type != -1)
{ {
type = 'OUTWARD'; if(type == 'INWARD')
if($('#inprocess').is(':checked'))
{ {
type = 'INPROCESS'; product = $('#productinward').val();
// if($('#subcata').is(':checked')) customer = $('#customerinward').val();
// {
// subtype = 1;
// }
} }
product = $('#product').val(); else
customer = $('#customer').val(); {
} product = $('#product').val();
else customer = $('#customer').val();
{ }
type = 'INWARD'; }
product = $('#productinward').val();
customer = $('#customerinward').val();
}
@ -414,6 +414,31 @@ $("#specmodel").on("shown.bs.modal", function(e) {
} }
} }
$('#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) function DeleteRow(rowid)
{ {

View File

@ -313,9 +313,10 @@ $(document).ready(function(){
var productid = $('#productid').val(); var productid = $('#productid').val();
var customerid = $('#customerid').val(); var customerid = $('#customerid').val();
var type = 'OUTWARD';
$('#content').loader('show'); $('#content').loader('show');
$.ajax({ $.ajax({
data:{param1:productid,param2:customerid}, data:{param1:productid,param2:customerid,param3:type},
type:"POST", type:"POST",
url:"<?php echo base_url() ?>quality/getAllSpecforReport", url:"<?php echo base_url() ?>quality/getAllSpecforReport",
success:function(data) { success:function(data) {

View File

@ -82,7 +82,8 @@ foreach($specifications as $s)
<th>Min</th> <th>Min</th>
<th>Max</th> <th>Max</th>
<th>Temp</th> <th>Temp</th>
<th style="width:100px;">SubCatagory</th> <th style="width:100px;">Raw Sand Test</th>
<th>Action</th> <th>Action</th>
@ -93,12 +94,14 @@ foreach($specifications as $s)
$index = 0; $index = 0;
if(!empty($specifications)) if(!empty($specifications))
{ {
foreach($specifications as $data) foreach($specifications as $data)
{ {
//print_r($data);
$index++; $index++;
?> ?>
<tr id="<?php echo $index;?>"> <td><?php echo $data->testtype?></td> <td contenteditable="true"><?php echo $data->uom?></td> <td contenteditable="true" style="text-align:right;"><?php echo $data->min?></td> <td contenteditable="true" style="text-align:right;"><?php echo $data->max?></td> <td contenteditable="true" style="text-align:right;"><?php if(!empty($data->temp)){ echo $data->temp; } else { echo "-"; }?></td> <tr id="<?php echo $index;?>"> <td><?php echo $data->testtype?></td> <td contenteditable="true"><?php echo $data->uom?></td> <td contenteditable="true" style="text-align:right;"><?php echo $data->min?></td> <td contenteditable="true" style="text-align:right;"><?php echo $data->max?></td> <td contenteditable="true" style="text-align:right;"><?php if(!empty($data->temp)){ echo $data->temp; } else { echo "-"; }?></td>
<td <?php if($type == 'INPROCESS'){ echo "contenteditable='true'";}else {echo "contenteditable='false'";}?> style="text-align:center;"><?php echo $data->subtype;?> <td style="text-align:center;"><a href='#' onclick = "DeleteRow(this.parentNode.parentNode.id);"> <span class="glyphicon glyphicon-trash"></span></td> </tr> <td <?php if($type == 'INPROCESS'){ echo "contenteditable='true'";}else {echo "contenteditable='false'";}?> style="text-align:center;"><?php if($data->subtype == 0){echo 'NO';}else {echo 'YES';}?> <td style="text-align:center;"><a href='#' onclick = "DeleteRow(this.parentNode.parentNode.id);"> <span class="glyphicon glyphicon-trash"></span></td> </tr>
<?php <?php
} }
} }
@ -148,6 +151,9 @@ foreach($specifications as $s)
<tr id="sub"> <tr id="sub">
<td style="text-align:center;padding:10px;;">Sub Category</td><td style="padding:10px;"><input type="checkbox" name="subcata" id="subcata"/>&nbsp;&nbsp;&nbsp; Raw Sand Test</td> <td style="text-align:center;padding:10px;;">Sub Category</td><td style="padding:10px;"><input type="checkbox" name="subcata" id="subcata"/>&nbsp;&nbsp;&nbsp; Raw Sand Test</td>
</tr> </tr>
</table> </table>
</center> </center>
</form> </form>
@ -194,7 +200,8 @@ foreach($specifications as $s)
<td align="right" contenteditable="true"><%=Min%></td> <td align="right" contenteditable="true"><%=Min%></td>
<td align="right" contenteditable="true"><%=Max%></td> <td align="right" contenteditable="true"><%=Max%></td>
<td align="right" contenteditable="true"><%=Temp%></td> <td align="right" contenteditable="true"><%=Temp%></td>
<td align="center" contenteditable="true"><%=SubCatagory%></td> <td align="center" contenteditable="true"><%=RawSandTest%></td>
<td align="center" contenteditable="false"> <a href='#' onclick = "DeleteRow(<%=index%>)" class="link" data-id="<%=index%>" data-userid="<%=index%>" id="Del" ><span class="glyphicon glyphicon-trash"></span></a></td> <td align="center" contenteditable="false"> <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> --> </tr> <!-- <i class="fa fa-pencil" data-toggle="tooltip" title="Click here to view/Edit <%=index%> "></i> -->
</script> </script>
@ -224,8 +231,10 @@ function addNewRow()
var min = $('#min').val(); var min = $('#min').val();
var max = $('#max').val(); var max = $('#max').val();
var temp = $('#temp').val(); var temp = $('#temp').val();
var sub = 0; var sub = 'NO';
if($('#subcata').is(':checked')){sub = 1;}
if($('#subcata').is(':checked')){ sub = 'YES';}
if(sname == '' || uom =='' || min == '' || max == '' || temp == '') if(sname == '' || uom =='' || min == '' || max == '' || temp == '')
{ {
alert('Please Enter all specification'); alert('Please Enter all specification');
@ -237,7 +246,7 @@ function addNewRow()
//rows = rows-1; //rows = rows-1;
//alert(rows); //alert(rows);
var template = jQuery("#addList").html(); var template = jQuery("#addList").html();
$('#specAppend').append(_.template(template,{index:rows,Name:sname,UOM:uom,Min:min,Max:max,Temp:temp,SubCatagory:sub})); $('#specAppend').append(_.template(template,{index:rows,Name:sname,UOM:uom,Min:min,Max:max,Temp:temp,RawSandTest:sub}));
$('#spname').val(''); $('#spname').val('');
$('#uom').val(''); $('#uom').val('');
@ -255,8 +264,9 @@ $("#specmodel").on("shown.bs.modal", function(e) {
if(type == 'INPROCESS') if(type == 'INPROCESS')
{ {
$('#sub').show(); $('#sub').show();
} }
else {$('#sub').hide();} else {$('#sub').hide(); }
document.getElementById('spname').focus(); document.getElementById('spname').focus();
}); });
@ -340,6 +350,24 @@ $("#specmodel").on("shown.bs.modal", function(e) {
//document.getElementById('#testspecifications').removeChild(document.getElementById('#'+rowid)); //document.getElementById('#testspecifications').removeChild(document.getElementById('#'+rowid));
} }
} }
$('#resbatch').change(function(){
var curstatus = $('#resbatch').is(':checked');
if(curstatus == true)
{
document.getElementById('resintext').textContent='YES';
}
else
{
document.getElementById('resintext').textContent='NO';
}
//else{ $('#resintext').val('NO'); }
});
</script> </script>