diff --git a/accred_list.php b/accred_list.php index 12733c38..275fe268 100644 --- a/accred_list.php +++ b/accred_list.php @@ -145,13 +145,16 @@ foreach (range('A','E') as $col) { // Add totals // $highestRow = $spreadsheet->getActiveSheet()->getHighestRow(); -$coord = 'N' . ($highestRow+2); +$coord = 'O' . ($highestRow+2); $spreadsheet->getActiveSheet()->setCellValue($coord, 'TOTAL'); -foreach(range('O','Z') as $col) { +foreach(range('P','Z') as $col) { $spreadsheet->getActiveSheet()->setCellValue($col.($highestRow+2), '=SUM('.$col.'2:'.$col.($highestRow).')'); } -// Do AA -$spreadsheet->getActiveSheet()->setCellValue('AA'.($highestRow+2), '=SUM(AA2:AA'.($highestRow).')'); +foreach(range('A','B') as $col) { + $spreadsheet->getActiveSheet()->setCellValue('A'.$col.($highestRow+2), '=SUM(A'.$col.'2:A'.$col.($highestRow).')'); +} +// Do AA and AB +// $spreadsheet->getActiveSheet()->setCellValue('AA'.($highestRow+2), '=SUM(AA2:AA'.($highestRow).')'); // Format the total $spreadsheet->getActiveSheet()->getStyle($coord.':AA'.($highestRow+2))->getFill() ->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID) @@ -199,13 +202,17 @@ if ($result = $mysqli->query($query)) { // Add totals // // $highestRow = $prevSheet->getHighestRow(); - $coord = 'N' . ($highestRow+2); + $coord = 'O' . ($highestRow+2); $prevSheet->setCellValue($coord, 'TOTAL'); - foreach(range('O','Z') as $col) { + foreach(range('P','Z') as $col) { $prevSheet->setCellValue($col.($highestRow+2), '=SUM('.$col.'2:'.$col.($highestRow).')'); } // Do AA - $prevSheet->setCellValue('AA'.($highestRow+2), '=SUM(AA2:AA'.($highestRow).')'); + foreach(range('A','B') as $col) { + $prevSheet->setCellValue('A'.$col.($highestRow+2), '=SUM(A'.$col.'2:A'.$col.($highestRow).')'); + } + +// $prevSheet->setCellValue('AA'.($highestRow+2), '=SUM(AA2:AA'.($highestRow).')'); // Format the total $prevSheet->getStyle($coord.':AA'.($highestRow+2))->getFill() ->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID) @@ -250,9 +257,9 @@ foreach (range('A','E') as $col) { // Add totals // // $highestRow = $spreadsheet->getActiveSheet()->getHighestRow(); -$coord = 'N' . ($highestRow+2); +$coord = 'O' . ($highestRow+2); $spreadsheet->getActiveSheet()->setCellValue($coord, 'TOTAL'); -foreach(range('O','Z') as $col) { +foreach(range('P','Z') as $col) { $spreadsheet->getActiveSheet()->setCellValue($col.($highestRow+2), '=SUM('.$col.'2:'.$col.($highestRow).')'); } // Do AA