diff --git a/Modules/Internal/Http/Controllers/Api/LivechatController.php b/Modules/Internal/Http/Controllers/Api/LivechatController.php index 6723f6aa..6955ca1e 100755 --- a/Modules/Internal/Http/Controllers/Api/LivechatController.php +++ b/Modules/Internal/Http/Controllers/Api/LivechatController.php @@ -74,8 +74,8 @@ class LivechatController extends Controller return $this->exportMonthly($startDate, $endDate); } else { $liveChats = Livechat::with('userInsurance', - 'user:nID,sFirstName,sLastName,sEmail,sPhone,nIDUser,nIDHubunganKeluarga', - 'doctor:nID,nIDSpesialis,nIDUser', 'doctor.user:nID,sFirstName,sLastName', + 'user:nID,sFirstName,sLastName,sEmail,sPhone,nIDUser,nIDHubunganKeluarga', 'user.detail:dTanggalLahir,nIDJenisKelamin', + 'doctor:nID,nIDSpesialis,nIDUser', 'doctor.user:nID,sFirstName,sLastName', 'appointment:nID,sPaymentStatus,sPaymentMethod', 'appointment.appointmentDetail:nID,nIDAppointment,dTanggalAppointment,tTimeAppointment', 'healthCare:nID,sHealthCare', @@ -164,6 +164,11 @@ class LivechatController extends Controller $startFrom = 3; foreach ($liveChats as $indexLiveChat => $liveChat) { + if ( $liveChat->user->nID == 109370 || $liveChat->nIDDokter == 100120) { + continue; // user testing / dokter testing + } + $summary = $liveChat->summary; + $user = $liveChat->user; $phone = $liveChat->user->sPhone ?? '-'; $status = $liveChat->sStatus; $nIDUser = $liveChat->user->nIDUser ?? 0; // Principal or Dependent @@ -237,22 +242,31 @@ class LivechatController extends Controller $chatTime = $chatTimeDiff; + // $diagnosa = '-'; + // $diagnosaCode = '-'; + // if($liveChat->summary){ + // $diagnosis = explode(', ', $liveChat->summary->sAssessment); + + // if ($diagnosis) { + // $diagnosaArray = []; + // $diagnosaCodeArray = []; + // foreach($diagnosis as $data){ + // $diagnosaArray[] = Helper::diagnosisName($data); // Tambahkan diagnosis ke array + // $diagnosaCodeArray[] = $data; // Tambahkan diagnosis ke array + // } + + // $diagnosa = implode('; ', $diagnosaArray); // Gabungkan array dengan tanda koma + // $diagnosaCode = implode('; ', $diagnosaCodeArray); // Gabungkan array dengan tanda koma + // } + // } + $diagnosa = '-'; $diagnosaCode = '-'; - if($liveChat->summary){ - $diagnosis = explode(', ', $liveChat->summary->sAssessment); - - if ($diagnosis) { - $diagnosaArray = []; - $diagnosaCodeArray = []; - foreach($diagnosis as $data){ - $diagnosaArray[] = Helper::diagnosisName($data); // Tambahkan diagnosis ke array - $diagnosaCodeArray[] = $data; // Tambahkan diagnosis ke array - } - - $diagnosa = implode('; ', $diagnosaArray); // Gabungkan array dengan tanda koma - $diagnosaCode = implode('; ', $diagnosaCodeArray); // Gabungkan array dengan tanda koma - } + if ($summary && $summary->sAssessment) { + $diagnosisCodes = explode(', ', $summary->sAssessment); + $diagnosaArray = array_map(fn($code) => Helper::diagnosisName($code), $diagnosisCodes); + $diagnosa = implode('; ', $diagnosaArray); + $diagnosaCode = implode('; ', $diagnosisCodes); } $tebusResep = 'Belum Ditebus'; @@ -283,23 +297,15 @@ class LivechatController extends Controller $tebusResep = '-'; } - switch ($liveChat->user->nIDHubunganKeluarga) { - case 9: - $nIDHubunganKeluarga = "Peserta"; // Parent - break; - case 4: - $nIDHubunganKeluarga = 'Istri'; // Spouse - break; - case 5: - $nIDHubunganKeluarga = 'Anak'; // Child - break; - case 3: - $nIDHubunganKeluarga = 'Suami'; // Husband - break; - default: - $nIDHubunganKeluarga = '-'; // No need to set $nIDHubunganKeluarga as it's already set to default value - break; - } + // switc + + $nIDHubunganKeluarga = match($user->nIDHubunganKeluarga) { + 9 => "Peserta", + 4 => "Istri", + 5 => "Anak", + 3 => "Suami", + default => $user->relation->sHubunganKeluarga ?? '-' + }; if ($liveChat->user->relation && $nIDHubunganKeluarga == '-'){ $nIDHubunganKeluarga = $liveChat->user->relation->sHubunganKeluarga; @@ -397,7 +403,7 @@ class LivechatController extends Controller { $liveChats = Livechat::with('userInsurance', 'user:nID,sFirstName,sLastName,sEmail,sPhone,nIDUser,nIDHubunganKeluarga', - 'doctor:nID,nIDSpesialis,nIDUser', 'doctor.user:nID,sFirstName,sLastName', + 'doctor:nID,nIDSpesialis,nIDUser', 'doctor.user:nID,sFirstName,sLastName', 'appointment:nID,sPaymentStatus,sPaymentMethod', 'appointment.appointmentDetail:nID,nIDAppointment,dTanggalAppointment,tTimeAppointment', 'healthCare:nID,sHealthCare', @@ -447,13 +453,14 @@ class LivechatController extends Controller ['value' => 'Nama Dokter', 'cell' => 'V1', 'mergeCell' => false, 'mergeToCell' => ''], ['value' => 'Jenis Dokter', 'cell' => 'W1', 'mergeCell' => false, 'mergeToCell' => ''], ['value' => 'Rujuk (Ya/Tidak)', 'cell' => 'X1', 'mergeCell' => false, 'mergeToCell' => ''], - ['value' => 'Poli', 'cell' => 'Y1', 'mergeCell' => false, 'mergeToCell' => ''], - ['value' => 'Total', 'cell' => 'Z1', 'mergeCell' => false, 'mergeToCell' => ''], - ['value' => 'Obat', 'cell' => 'AA1', 'mergeCell' => false, 'mergeToCell' => ''], - ['value' => 'Apotek', 'cell' => 'AB1', 'mergeCell' => false, 'mergeToCell' => ''], - ['value' => 'Nama Obat', 'cell' => 'AC1', 'mergeCell' => false, 'mergeToCell' => ''], - ['value' => 'Jumlah Obat', 'cell' => 'AD1', 'mergeCell' => false, 'mergeToCell' => ''], - ['value' => 'By', 'cell' => 'AE1', 'mergeCell' => false, 'mergeToCell' => ''], + ['value' => 'Provider Rujukan', 'cell' => 'Y1', 'mergeCell' => true, 'mergeToCell' => ''], + ['value' => 'Poli', 'cell' => 'Z1', 'mergeCell' => false, 'mergeToCell' => ''], + ['value' => 'Total', 'cell' => 'AA1', 'mergeCell' => false, 'mergeToCell' => ''], + ['value' => 'Obat', 'cell' => 'AB1', 'mergeCell' => false, 'mergeToCell' => ''], + ['value' => 'Apotek', 'cell' => 'AC1', 'mergeCell' => false, 'mergeToCell' => ''], + ['value' => 'Nama Obat', 'cell' => 'AD1', 'mergeCell' => false, 'mergeToCell' => ''], + ['value' => 'Jumlah Obat', 'cell' => 'AE1', 'mergeCell' => false, 'mergeToCell' => ''], + ['value' => 'By', 'cell' => 'AF1', 'mergeCell' => false, 'mergeToCell' => ''], ]; $spreadsheet = new Spreadsheet(); @@ -479,29 +486,34 @@ class LivechatController extends Controller $startFromSheet1 = 2; $startFromSheet2 = 2; + $apotekList = Organization::pluck('name', 'id'); // Ambil semua nama apotek dulu (1 query) + // dd('test'); foreach ($liveChats as $indexLiveChat => $liveChat) { //###################### SHEET 1 ########## $phone = $liveChat->user->sPhone ?? '-'; $status = $liveChat->sStatus; $nIDUser = $liveChat->user->nIDUser ?? 0; // Principal or Dependent $paymentMethod = $liveChat->appointment ? Helper::sPaymentMethod($liveChat->appointment->sPaymentMethod) : 'N/A'; + $summary = $liveChat->summary; + $user = $liveChat->user; + $fullNameDoctor = '-'; if (!empty($liveChat->doctor->user)) { - $fullNameDoctor = ''; + $fullNameDoctor = 'dr. '; - if ($liveChat->doctor->user->detail !== null) { - if ($liveChat->doctor->user->detail->sTitlePrefix !== null) { - $fullNameDoctor .= $liveChat->doctor->user->detail->sTitlePrefix . '. '; - } + // if ($liveChat->doctor->user->detail !== null) { + // if ($liveChat->doctor->user->detail->sTitlePrefix !== null) { + // $fullNameDoctor .= $liveChat->doctor->user->detail->sTitlePrefix . '. '; + // } if ($liveChat->doctor->user->full_name !== null) { $fullNameDoctor .= $liveChat->doctor->user->full_name . ' '; } - if ($liveChat->doctor->user->detail->sTitleSuffix !== null) { - $fullNameDoctor .= $liveChat->doctor->user->detail->sTitleSuffix; - } - } + // if ($liveChat->doctor->user->detail->sTitleSuffix !== null) { + // $fullNameDoctor .= $liveChat->doctor->user->detail->sTitleSuffix; + // } + // } } $recordType = 'P'; @@ -554,22 +566,31 @@ class LivechatController extends Controller $chatTime = $chatTimeDiff; + // $diagnosa = '-'; + // $diagnosaCode = '-'; + // if($liveChat->summary){ + // $diagnosis = explode(', ', $liveChat->summary->sAssessment); + + // if ($diagnosis) { + // $diagnosaArray = []; + // $diagnosaCodeArray = []; + // foreach($diagnosis as $data){ + // $diagnosaArray[] = Helper::diagnosisName($data); // Tambahkan diagnosis ke array + // $diagnosaCodeArray[] = $data; // Tambahkan diagnosis ke array + // } + + // $diagnosa = implode('; ', $diagnosaArray); // Gabungkan array dengan tanda koma + // $diagnosaCode = implode('; ', $diagnosaCodeArray); // Gabungkan array dengan tanda koma + // } + // } + $diagnosa = '-'; $diagnosaCode = '-'; - if($liveChat->summary){ - $diagnosis = explode(', ', $liveChat->summary->sAssessment); - - if ($diagnosis) { - $diagnosaArray = []; - $diagnosaCodeArray = []; - foreach($diagnosis as $data){ - $diagnosaArray[] = Helper::diagnosisName($data); // Tambahkan diagnosis ke array - $diagnosaCodeArray[] = $data; // Tambahkan diagnosis ke array - } - - $diagnosa = implode('; ', $diagnosaArray); // Gabungkan array dengan tanda koma - $diagnosaCode = implode('; ', $diagnosaCodeArray); // Gabungkan array dengan tanda koma - } + if ($summary && $summary->sAssessment) { + $diagnosisCodes = explode(', ', $summary->sAssessment); + $diagnosaArray = array_map(fn($code) => Helper::diagnosisName($code), $diagnosisCodes); + $diagnosa = implode('; ', $diagnosaArray); + $diagnosaCode = implode('; ', $diagnosisCodes); } $tebusResep = 'Belum Ditebus'; @@ -597,12 +618,14 @@ class LivechatController extends Controller } if($liveChat->prescription->payment){ $tebusResep = 'Online'; - $apotek = Organization::where('code', $liveChat->prescription->payment->nIDApotek)->first(); - if ($apotek){ - $apotek = $apotek->name; - } else { - $apotek = '-'; - } + // $apotek = Organization::where('code', $liveChat->prescription->payment->nIDApotek)->first(); + // if ($apotek){ + // $apotek = $apotek->name; + // } else { + // $apotek = '-'; + // } + + $apotek = $apotekList[$liveChat->prescription->payment->nIDApotek] ?? '-'; if ($liveChat->prescription->payment->sPaymentStatus == 'paid'){ $paymentTebus = Carbon::parse($liveChat->prescription->payment->dCreateOn)->format('d-m-Y H:i:s'); @@ -626,38 +649,29 @@ class LivechatController extends Controller $tebusResep = '-'; } - switch ($liveChat->user->nIDHubunganKeluarga) { - case 9: - $nIDHubunganKeluarga = "Peserta"; // Parent - break; - case 4: - $nIDHubunganKeluarga = 'Istri'; // Spouse - break; - case 5: - $nIDHubunganKeluarga = 'Anak'; // Child - break; - case 3: - $nIDHubunganKeluarga = 'Suami'; // Husband - break; - default: - $nIDHubunganKeluarga = '-'; // No need to set $nIDHubunganKeluarga as it's already set to default value - break; - } + $nIDHubunganKeluarga = match($user->nIDHubunganKeluarga) { + 9 => "Peserta", + 4 => "Istri", + 5 => "Anak", + 3 => "Suami", + default => $user->relation->sHubunganKeluarga ?? '-' + }; if ($liveChat->user->relation && $nIDHubunganKeluarga == '-'){ $nIDHubunganKeluarga = $liveChat->user->relation->sHubunganKeluarga; } + + $sheet->setCellValue('A' . $startFromSheet1, $liveChat->nID ?? '-'); $sheet->setCellValue('B' . $startFromSheet1, $liveChat->sNoSpj ?? '-'); $sheet->setCellValue('C' . $startFromSheet1, (string)($liveChat->userInsurance->sCorporateCode ?? '-')); $sheet->setCellValue('D' . $startFromSheet1, (string)($liveChat->userInsurance->sCorporateName ?? '-')); $sheet->setCellValue('E' . $startFromSheet1, (string)($liveChat->userInsurance->sNoPolis ?? '-')); $sheet->setCellValue('F' . $startFromSheet1, $liveChat->user->full_name ?? '-'); - $sheet->setCellValue('G' . $startFromSheet1, $liveChat->user->detail->dTanggalLahir ?? '-'); - $sheet->setCellValue('H' . $startFromSheet1, $liveChat->user->detail->nIDJenisKelamin == 1 ? 'Laki-laki' : 'Wanita'); - $sheet->setCellValue('I' . $startFromSheet1, Helper::calculateAge($liveChat->user->detail->dTanggalLahir) ?? '-'); - $sheet->setCellValue('J' . $startFromSheet1, (string)($liveChat->userInsurance->sProductCode ?? '-')); + $sheet->setCellValue('G' . $startFromSheet1, $liveChat->user->detail->nIDJenisKelamin == 1 ? 'Laki-laki' : 'Wanita'); + $sheet->setCellValue('H' . $startFromSheet1, $liveChat->user->detail->dTanggalLahir ?? '-'); + $sheet->setCellValue('I' . $startFromSheet1, Helper::calculateAge($liveChat->user->detail->dTanggalLahir, true) ?? '-'); $sheet->setCellValue('J' . $startFromSheet1, (string)($liveChat->userInsurance->sProductCode ?? '-')); $sheet->setCellValue('K' . $startFromSheet1, (string)($liveChat->userInsurance->sPlanCode ?? '-')); $sheet->setCellValue('L' . $startFromSheet1, $nIDHubunganKeluarga ?? '-'); $sheet->setCellValue('M' . $startFromSheet1, $requestTime->format('Y-m-d')); @@ -675,15 +689,16 @@ class LivechatController extends Controller $sheet->setCellValue('V' . $startFromSheet1, $fullNameDoctor); $sheet->setCellValue('W' . $startFromSheet1, $liveChat->doctor->speciality->sSpesialis ?? '-'); $sheet->setCellValue('X' . $startFromSheet1, $liveChat->rujukan ? 'Ya' : 'Tidak'); - $sheet->setCellValue('Y' . $startFromSheet1, $liveChat->rujukan->sDepartement ?? '-' ); + $sheet->setCellValue('Y' . $startFromSheet1, $liveChat->rujukan->nIDHealthcare ?? '-'); + $sheet->setCellValue('Z' . $startFromSheet1, $liveChat->rujukan->sDepartement ?? '-' ); - $sheet->setCellValue('Z' . $startFromSheet1, $qtyTotal); - $sheet->setCellValue('AA' . $startFromSheet1, $tebusResep); + $sheet->setCellValue('AA' . $startFromSheet1, $qtyTotal); + $sheet->setCellValue('AB' . $startFromSheet1, $tebusResep); - $sheet->setCellValue('AB' . $startFromSheet1, $apotek); - $sheet->setCellValue('AC' . $startFromSheet1, $obat); - $sheet->setCellValue('AD' . $startFromSheet1, $obatQty); - $sheet->setCellValue('AE' . $startFromSheet1, 'LMS'); + $sheet->setCellValue('AC' . $startFromSheet1, $apotek); + $sheet->setCellValue('AD' . $startFromSheet1, $obat); + $sheet->setCellValue('AE' . $startFromSheet1, $obatQty); + $sheet->setCellValue('AF' . $startFromSheet1, 'LMS'); // $sheet->setCellValue('AC' . $startFrom, $liveChat->prescription->dCreateOn ?? '-'); // $sheet->setCellValue('AD' . $startFrom, $obat); // $sheet->setCellValue('AE' . $startFrom, $tebusResep); @@ -695,8 +710,8 @@ class LivechatController extends Controller // $sheet->setCellValue('AJ' . $startFrom, $liveChat->sNoSpj ?? '-'); $startFromSheet1++; //###################### END SHEET 1 ########## - if (!$liveChat->prescription) { - + if (!$liveChat->prescription || !$liveChat->prescription->items) { + continue; } else { if ($liveChat->prescription->items){ $obatArray = []; @@ -730,7 +745,6 @@ class LivechatController extends Controller $recordType = 'D'; } - switch ($status) { case 0: $statusLivechat = "Request TC"; @@ -777,23 +791,32 @@ class LivechatController extends Controller $chatTime = $chatTimeDiff; + // $diagnosa = '-'; + // $diagnosaCode = '-'; + + // if($liveChat->summary){ + // $diagnosis = explode(', ', $liveChat->summary->sAssessment); + + // if ($diagnosis) { + // $diagnosaArray = []; + // $diagnosaCodeArray = []; + // foreach($diagnosis as $dataDiagnosa){ + // $diagnosaArray[] = Helper::diagnosisName($dataDiagnosa); // Tambahkan diagnosis ke array + // $diagnosaCodeArray[] = $dataDiagnosa; // Tambahkan diagnosis ke array + // } + + // $diagnosa = implode('; ', $diagnosaArray); // Gabungkan array dengan tanda koma + // $diagnosaCode = implode('; ', $diagnosaCodeArray); // Gabungkan array dengan tanda koma + // } + // } + $diagnosa = '-'; $diagnosaCode = '-'; - - if($liveChat->summary){ - $diagnosis = explode(', ', $liveChat->summary->sAssessment); - - if ($diagnosis) { - $diagnosaArray = []; - $diagnosaCodeArray = []; - foreach($diagnosis as $dataDiagnosa){ - $diagnosaArray[] = Helper::diagnosisName($dataDiagnosa); // Tambahkan diagnosis ke array - $diagnosaCodeArray[] = $dataDiagnosa; // Tambahkan diagnosis ke array - } - - $diagnosa = implode('; ', $diagnosaArray); // Gabungkan array dengan tanda koma - $diagnosaCode = implode('; ', $diagnosaCodeArray); // Gabungkan array dengan tanda koma - } + if ($summary && $summary->sAssessment) { + $diagnosisCodes = explode(', ', $summary->sAssessment); + $diagnosaArray = array_map(fn($code) => Helper::diagnosisName($code), $diagnosisCodes); + $diagnosa = implode('; ', $diagnosaArray); + $diagnosaCode = implode('; ', $diagnosisCodes); } @@ -817,12 +840,13 @@ class LivechatController extends Controller } if($liveChat->prescription->payment){ $tebusResep = 'Online'; - $apotek = Organization::where('id', $liveChat->prescription->payment->nIDApotek)->first(); - if ($apotek){ - $apotek = $apotek->name; - } else { - $apotek = '-'; - } + // $apotek = Organization::where('id', $liveChat->prescription->payment->nIDApotek)->first(); + // if ($apotek){ + // $apotek = $apotek->name; + // } else { + // $apotek = '-'; + // } + $apotek = $apotekList[$liveChat->prescription->payment->nIDApotek] ?? '-'; if ($liveChat->prescription->payment->sPaymentStatus == 'paid'){ $paymentTebus = Carbon::parse($liveChat->prescription->payment->dCreateOn)->format('d-m-Y H:i:s'); @@ -832,23 +856,31 @@ class LivechatController extends Controller $tebusResep = '-'; } - switch ($liveChat->user->nIDHubunganKeluarga) { - case 9: - $nIDHubunganKeluarga = "Peserta"; // Parent - break; - case 4: - $nIDHubunganKeluarga = 'Istri'; // Spouse - break; - case 5: - $nIDHubunganKeluarga = 'Anak'; // Child - break; - case 3: - $nIDHubunganKeluarga = 'Suami'; // Husband - break; - default: - $nIDHubunganKeluarga = '-'; // No need to set $nIDHubunganKeluarga as it's already set to default value - break; - } + // switch ($liveChat->user->nIDHubunganKeluarga) { + // case 9: + // $nIDHubunganKeluarga = "Peserta"; // Parent + // break; + // case 4: + // $nIDHubunganKeluarga = 'Istri'; // Spouse + // break; + // case 5: + // $nIDHubunganKeluarga = 'Anak'; // Child + // break; + // case 3: + // $nIDHubunganKeluarga = 'Suami'; // Husband + // break; + // default: + // $nIDHubunganKeluarga = '-'; // No need to set $nIDHubunganKeluarga as it's already set to default value + // break; + // } + + $nIDHubunganKeluarga = match($user->nIDHubunganKeluarga) { + 9 => "Peserta", + 4 => "Istri", + 5 => "Anak", + 3 => "Suami", + default => $user->relation->sHubunganKeluarga ?? '-' + }; if ($liveChat->user->relation && $nIDHubunganKeluarga == '-'){ $nIDHubunganKeluarga = $liveChat->user->relation->sHubunganKeluarga; @@ -885,15 +917,16 @@ class LivechatController extends Controller $sheet2->setCellValue('V' . $startFromSheet2, $fullNameDoctor); $sheet2->setCellValue('W' . $startFromSheet2, $liveChat->doctor->speciality->sSpesialis ?? '-'); $sheet2->setCellValue('X' . $startFromSheet2, $liveChat->rujukan ? 'Ya' : 'Tidak'); - $sheet2->setCellValue('Y' . $startFromSheet2, $liveChat->rujukan->sDepartement ?? '-' ); + $sheet2->setCellValue('Y' . $startFromSheet2, $liveChat->rujukan->nIDHealthcare ?? '-' ); + $sheet2->setCellValue('Z' . $startFromSheet2, $liveChat->rujukan->sDepartement ?? '-' ); - $sheet2->setCellValue('Z' . $startFromSheet2, '-'); - $sheet2->setCellValue('AA' . $startFromSheet2, $tebusResep); + $sheet2->setCellValue('AA' . $startFromSheet2, '-'); + $sheet2->setCellValue('AB' . $startFromSheet2, $tebusResep); - $sheet2->setCellValue('AB' . $startFromSheet2, $apotek ); - $sheet2->setCellValue('AC' . $startFromSheet2, $obat); - $sheet2->setCellValue('AD' . $startFromSheet2, $obatQty); - $sheet2->setCellValue('AE' . $startFromSheet2, 'LMS'); + $sheet2->setCellValue('AC' . $startFromSheet2, $apotek ); + $sheet2->setCellValue('AD' . $startFromSheet2, $obat); + $sheet2->setCellValue('AE' . $startFromSheet2, $obatQty); + $sheet2->setCellValue('AF' . $startFromSheet2, 'LMS'); // $sheet->setCellValue('AC' . $startFromSheet2, $liveChat->prescription->dCreateOn ?? '-'); // $sheet->setCellValue('AD' . $startFromSheet2, $obat); // $sheet->setCellValue('AE' . $startFromSheet2, $tebusResep); @@ -909,7 +942,7 @@ class LivechatController extends Controller } } - foreach (['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J','K', 'L', 'M', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'AA', 'AB', 'AC', 'AD'] as $header) { + foreach (['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J','K', 'L', 'M', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'AA', 'AB', 'AC', 'AD', 'AE', 'AF'] as $header) { // if ($header === 'A') { // $spreadsheet->getActiveSheet()->getColumnDimension($header)->setWidth(35, 'px'); // } elseif ($header === 'H' || $header === 'I') {