diff --git a/application/controllers/quality.php b/application/controllers/quality.php index 61ceeeaa..e23212df 100755 --- a/application/controllers/quality.php +++ b/application/controllers/quality.php @@ -76,36 +76,49 @@ class quality extends BaseController $type = $this->input->post('param4'); - + //echo $type;die(); $createdby = $this->session->userdata ( 'userId' ); - $phpdata = json_decode($jsondata); + $phpdata = json_decode($jsondata,true); $total = 0; // echo $product .'-'. $customer; - // print_r($phpdata);die(); + //print_r($phpdata);die(); foreach($phpdata as $data) { - $name = $data->Name; + $name = $data['Name']; $name = strtoupper($name); - $uom = $data->UOM; - $min = $data->Min; - $max = $data->Max; - $temp = $data->Temp; - $sub = $data->SubCatagory; + $uom = $data['UOM']; + $min = $data['Min']; + $max = $data['Max']; + $temp = $data['Temp']; + $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); //echo $isExist[0]->count;die(); 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); //echo 'i'.$res; } 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); //echo 'u'.$res; } @@ -223,6 +236,7 @@ class quality extends BaseController } else { + $res = $this->quality_model->getSpecifications($productid,$customerid); } diff --git a/application/models/quality_model.php b/application/models/quality_model.php index d36c1c1d..1305ae01 100755 --- a/application/models/quality_model.php +++ b/application/models/quality_model.php @@ -85,19 +85,20 @@ class Quality_model extends CI_Model $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_clients','T_Prodcut_Specification_Master.customer_id=ip_clients.client_id'); - $this->db->group_by('T_Prodcut_Specification_Master.type,product_id,customer_id'); - $result = $this->db->get(); - return $result->result(); + $this->db->group_by('product_id,customer_id,T_Prodcut_Specification_Master.type'); + $result = $this->db->get(); + return $result->result(); } + 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->from('T_Prodcut_Specification_Master'); $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->group_by('product_id,customer_id'); - $result = $this->db->get(); - return $result->result(); + $this->db->group_by('product_id,customer_id,T_Prodcut_Specification_Master.type'); + $result = $this->db->get(); + return $result->result(); } diff --git a/application/views/newinprocessreport.php b/application/views/newinprocessreport.php index baf3ced6..24ff5c0a 100755 --- a/application/views/newinprocessreport.php +++ b/application/views/newinprocessreport.php @@ -26,7 +26,7 @@ background-color:#ada5d2 ; $products = array(-1=>'Select Product'); foreach($productsoutward as $rec) { - $products[$rec->product_id] = $rec->product_name; + $products[$rec->product_id] = $rec->product_description; } $customers = array(-1=>'Select Customer'); diff --git a/application/views/newnissaninprocessreport.php b/application/views/newnissaninprocessreport.php index f16c033e..77531fa1 100755 --- a/application/views/newnissaninprocessreport.php +++ b/application/views/newnissaninprocessreport.php @@ -26,7 +26,7 @@ background-color:#ada5d2 ; $products = array(-1=>'Select Product'); foreach($productsoutward as $rec) { - $products[$rec->product_id] = $rec->product_name; + $products[$rec->product_id] = $rec->product_description; } $customers = array(-1=>'Select Customer'); diff --git a/application/views/qualitymaster.php b/application/views/qualitymaster.php index a204eece..f0e25b9a 100755 --- a/application/views/qualitymaster.php +++ b/application/views/qualitymaster.php @@ -10,6 +10,7 @@ th{ $products2=array(-1=>'Select Products'); +$mtypes = array(-1=>'Select Type','INWARD'=>'INWARD','OUTWARD'=>'OUTWARD','INPROCESS'=>'INPROCESS','RESINBATCHCARD'=>'RESIN BATCH CARD'); foreach($productsoutward as $product) { @@ -65,15 +66,19 @@ foreach($customersinward as $customer)
-
+
+ + +
+ +
@@ -85,7 +90,7 @@ foreach($customersinward as $customer)
-
+
@@ -97,17 +102,7 @@ foreach($customersinward as $customer)
-
-
- 'inprocess','value' => 'accept','checked' => false); - echo form_checkbox($data); - - ?> - -
-
InProcess
-
+
@@ -123,7 +118,8 @@ foreach($customersinward as $customer) Min Max Temp - SubCatagory + Raw Sand Test + @@ -188,6 +184,8 @@ foreach($customersinward as $customer) Sub Category    Raw Sand Test + + @@ -231,7 +229,8 @@ foreach($customersinward as $customer) <%=Min%> <%=Max%> <%=Temp%> - <%=SubCatagory%> + <%=RawSandTest%> + @@ -240,66 +239,68 @@ foreach($customersinward as $customer) $(document).ready(function() { //alert(); -$('#OutWard').attr('checked','true'); - $('#inwardarea').hide(); - $('#outwardarea').show(); +// $('#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(); + // 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(); - } - } + // } + // 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($('#OutWard').is(':checked')) + + if($('#mtype').val() != -1 ) { - var product = $('#product').val(); - var customer = $('#customer').val(); - if(product == -1 || customer == -1) + if($('#mtype').val() == 'INWARD') { - alert('Please Select Product and Customer.'); + if($('#productinward').val() == -1 || $('#customerinward').val() == -1 ) + { + alert('Please Select Product and Supplier..!'); + } + else + { + $("#specmodel").modal('show'); + } } else { - $('#specmodel').modal('show'); + if($('#product').val() == -1 || $('#customer').val() == -1 ) + { + alert('Please Select Product and Customer..!'); + } + else + { + $("#specmodel").modal('show'); + } } } - - else//if($('#InWard').is(':checked')) + else { - //alert('kj'); - 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'); + alert('Please Select Master Type..!'); } @@ -315,8 +316,10 @@ function addNewRow() var min = $('#min').val(); var max = $('#max').val(); var temp = $('#temp').val(); - var sub = 0; - if($('#subcata').is(':checked')){ sub = 1;} + var sub = 'NO'; + + if($('#subcata').is(':checked')){ sub = 'YES';} + if(sname == '' || uom =='' || min == '' || max == '' || temp == '') { @@ -328,7 +331,7 @@ function addNewRow() 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,SubCatagory:sub})); + $('#specAppend').append(_.template(template,{index:rows,Name:sname,UOM:uom,Min:min,Max:max,Temp:temp,RawSandTest:sub})); $('#spname').val(''); $('#uom').val(''); @@ -336,6 +339,7 @@ function addNewRow() $('#max').val(''); $('#temp').val(''); $('#subcata').attr('checked',false); + document.getElementById('spname').focus(); } } @@ -343,9 +347,10 @@ function addNewRow() $("#specmodel").on("shown.bs.modal", function(e) { $('#sub').hide(); - if($('#OutWard').is(':checked') && $('#inprocess').is(':checked')) + if($('#mtype').val() == 'INPROCESS') { $('#sub').show(); + } else{ $('#sub').hide(); } document.getElementById('spname').focus(); @@ -355,30 +360,25 @@ $("#specmodel").on("shown.bs.modal", function(e) { function getAllData() { - var type = ''; + var type = $('#mtype').val(); var product = ''; var customer = ''; // var subtype = ''; - if($('#OutWard').is(':checked')) - { - type = 'OUTWARD'; - if($('#inprocess').is(':checked')) + if(type != -1) + { + if(type == 'INWARD') { - type = 'INPROCESS'; - // if($('#subcata').is(':checked')) - // { - // subtype = 1; - // } + product = $('#productinward').val(); + customer = $('#customerinward').val(); + } - product = $('#product').val(); - customer = $('#customer').val(); - } - else - { - type = 'INWARD'; - product = $('#productinward').val(); - customer = $('#customerinward').val(); - } + else + { + product = $('#product').val(); + customer = $('#customer').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) { diff --git a/application/views/qualityreport.php b/application/views/qualityreport.php index a709b37e..4d8cbb8a 100755 --- a/application/views/qualityreport.php +++ b/application/views/qualityreport.php @@ -313,9 +313,10 @@ $(document).ready(function(){ var productid = $('#productid').val(); var customerid = $('#customerid').val(); + var type = 'OUTWARD'; $('#content').loader('show'); $.ajax({ - data:{param1:productid,param2:customerid}, + data:{param1:productid,param2:customerid,param3:type}, type:"POST", url:"quality/getAllSpecforReport", success:function(data) { diff --git a/application/views/viewIndSpec.php b/application/views/viewIndSpec.php index f9af81ab..b5e5dd4e 100755 --- a/application/views/viewIndSpec.php +++ b/application/views/viewIndSpec.php @@ -82,7 +82,8 @@ foreach($specifications as $s) Min Max Temp - SubCatagory + Raw Sand Test + Action @@ -93,12 +94,14 @@ foreach($specifications as $s) $index = 0; if(!empty($specifications)) { + foreach($specifications as $data) { + //print_r($data); $index++; ?> testtype?> uom?> min?> max?> temp)){ echo $data->temp; } else { echo "-"; }?> - style="text-align:center;">subtype;?> + style="text-align:center;">subtype == 0){echo 'NO';}else {echo 'YES';}?> Sub Category    Raw Sand Test + + + @@ -194,7 +200,8 @@ foreach($specifications as $s) <%=Min%> <%=Max%> <%=Temp%> - <%=SubCatagory%> + <%=RawSandTest%> + @@ -224,8 +231,10 @@ function addNewRow() var min = $('#min').val(); var max = $('#max').val(); var temp = $('#temp').val(); - var sub = 0; - if($('#subcata').is(':checked')){sub = 1;} + var sub = 'NO'; + + if($('#subcata').is(':checked')){ sub = 'YES';} + if(sname == '' || uom =='' || min == '' || max == '' || temp == '') { alert('Please Enter all specification'); @@ -237,7 +246,7 @@ function addNewRow() //rows = rows-1; //alert(rows); 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(''); $('#uom').val(''); @@ -255,8 +264,9 @@ $("#specmodel").on("shown.bs.modal", function(e) { if(type == 'INPROCESS') { $('#sub').show(); + } - else {$('#sub').hide();} + else {$('#sub').hide(); } document.getElementById('spname').focus(); }); @@ -340,6 +350,24 @@ $("#specmodel").on("shown.bs.modal", function(e) { //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'); } + + });