From 4d7d3da97dacae7f7339a6dc1ee3596e728fce96 Mon Sep 17 00:00:00 2001 From: lars Date: Wed, 15 May 2019 18:01:34 +0200 Subject: [PATCH] =?UTF-8?q?D=C3=A9calage=20de=20la=20ligne=20TOTAL=20en=20?= =?UTF-8?q?raison=20de=20l'ajout=20d'une=20colonne=20demandeur?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- accred_list.php | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) 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