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)