FIX_SELF_ORDERED_AS_FIRST_IN_FAMILIY_ARRAY

This commit is contained in:
velz 2024-04-25 19:17:12 +05:30
parent 680dd166b4
commit c2c3229f45

View File

@ -247,22 +247,33 @@ if (!function_exists('data_group_by_family'))
function data_group_by_family($emp_data,$data_source = 'excel')
{
$result = [];
// dd($emp_data);
foreach ($emp_data as $rkey => $row)
{
if($data_source == 'excel')
{
if(!check_row_is_empty_or_null($row))
{
$result[$row[1]][] = $row;
if(strtolower($row[5]) == 'self' && isset($result[$row[1]]))
{
array_unshift($result[$row[1]],$row);
}else
{
$result[$row[1]][] = $row;
}
}
}else if($data_source = 'db')
{
$result[$row['emp_code']][] = $row;
if(strtolower($row['relationship']) == 'self' && isset($result[$row['emp_code']]))
{
array_unshift($result[$row['emp_code']],$row);
}else
{
$result[$row['emp_code']][] = $row;
}
}
}
return $result;
}
}