diff --git a/app/Controllers/EmployeeServiceController.php b/app/Controllers/EmployeeServiceController.php index fbe7bd89..ac99a890 100644 --- a/app/Controllers/EmployeeServiceController.php +++ b/app/Controllers/EmployeeServiceController.php @@ -372,6 +372,17 @@ class EmployeeServiceController extends AdminController } } } + + if($file['action'] == 'inception') + { + $res = check_self_available_in_family($family,$file['action']); + // dd($res); + if(!$res['is_self_found']) + { + array_push($result['error_summary'],14); // Self not found + $result['error_data'][ $res['emp_code'] ]['name_of_emp_dep']['error'][] = "Self not found "; + } + } if($file['action'] == 'dependent_addition' || $file['action'] == 'addition' || $file['action'] == 'inception') @@ -935,7 +946,7 @@ class EmployeeServiceController extends AdminController try { $file = $this->fileModel->find($file_id); $error_data = json_decode($file['reason']); - + // dd($error_data); // return $error_data; $file_name_with_path = WRITEPATH."/uploads/excel/".$file['file_name']; @@ -955,7 +966,7 @@ class EmployeeServiceController extends AdminController $excelErrorData['excel_header'] = $excel_data[0]; unset($excel_data[0]); // echo '
';
-
+         // Kint::dump($excel_data);
          if($error_data->error_type == 1){
 
             $finalArray = [];
@@ -998,13 +1009,24 @@ class EmployeeServiceController extends AdminController
                 }
             }
 
-
+            // dd(array_keys($allErrors));
             foreach ($allErrors as $key => $value){
-                $data = ['value' => $excel_data[$key][1], 'error'=>$value,];
-                $excel_data[$key][1] = $data;
-                array_push($typeTowArray, $excel_data[$key]);
+                // echo $key;
+                // print_r($value);
+                foreach($excel_data as $excel_data_index => $excel_data_value)
+                {
+                    if($excel_data_value[0] == $key)
+                    {
+                        $data = ['value' => $excel_data[$excel_data_index][1], 'error'=>$value,];
+                        $excel_data[$excel_data_index][1] = $data;
+                        array_push($typeTowArray, $excel_data[$excel_data_index]);
+                        break;
+                    }
+                }
+               
+                
             }
-
+            // dd($data);
             foreach ($typeTowArray as $fkey => $value){
                 foreach ($value as $vkey => $arrayData){
                     if(!is_array($arrayData)){
@@ -1021,7 +1043,7 @@ class EmployeeServiceController extends AdminController
 
         }catch (\Exception $e) {
             // Handle any exceptions
-            $errorMessage = $e->getMessage();
+            $errorMessage = $e->getMessage();//die();
             $this->myLogger->logme('error', $errorMessage);
             return false; // You can return an error response here
         }
diff --git a/app/Helpers/excel_util_helper.php b/app/Helpers/excel_util_helper.php
index a77d1e02..3d8b9421 100644
--- a/app/Helpers/excel_util_helper.php
+++ b/app/Helpers/excel_util_helper.php
@@ -290,6 +290,26 @@ if (!function_exists('name_dup_check_within_family'))
     }
 }
 
+if (!function_exists('check_self_available_in_family')) 
+{
+    function check_self_available_in_family($family_data)
+    {
+        
+        $is_self_found = false;
+        foreach ($family_data as $rkey => $row) 
+        {
+           if($row[5] != null && strtolower($row[5]) == 'self')//$row[5]  = relationship $row[4] = Gender
+            {
+                $is_self_found = true;
+                break;
+            }
+            
+        }
+
+        return ['is_self_found' => $is_self_found,'emp_code' => $family_data[0][1]];
+    }
+}
+
 
 
 if (!function_exists('name_and_empid_check_in_db')) 
diff --git a/app/Views/employee_upload.php b/app/Views/employee_upload.php
index f068f4cc..33714097 100644
--- a/app/Views/employee_upload.php
+++ b/app/Views/employee_upload.php
@@ -329,7 +329,7 @@ function fetchFileError(file_id) {
                                     file_error_html += "Duplicate entry " + err_count + "";
                                     break;
                                 case 10:
-                                    file_error_html += "Duplicate entry in file " + err_count + "";
+                                    file_error_html += "Record Not Found " + err_count + "";
                                     break;
                                 case 11:
                                     file_error_html += "Rule conflict: Dependents not allowed " + err_count + "";
@@ -340,6 +340,9 @@ function fetchFileError(file_id) {
                                 case 13:
                                     file_error_html += "Rule conflict: Twofold relationship found within family " + err_count + "";
                                     break;
+                                 case 14:
+                                    file_error_html += "Self Not found " + err_count + "";
+                                    break;
 
                                 default:
                                     file_error_html += "";