From b57108a664eb9202e2f89937758deee4f89cf1d8 Mon Sep 17 00:00:00 2001 From: vgreb Date: Sun, 21 Dec 2025 19:06:16 +0100 Subject: [PATCH] Tresorerie > Suppression des pages legacy "comptes banque" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A merger après la #2040 --- htdocs/pages/administration/compta_banque.php | 224 ------------------ .../administration/compta_banque.html | 147 ------------ 2 files changed, 371 deletions(-) delete mode 100644 htdocs/pages/administration/compta_banque.php delete mode 100644 htdocs/templates/administration/compta_banque.html diff --git a/htdocs/pages/administration/compta_banque.php b/htdocs/pages/administration/compta_banque.php deleted file mode 100644 index 1c91aeb7f..000000000 --- a/htdocs/pages/administration/compta_banque.php +++ /dev/null @@ -1,224 +0,0 @@ -assign('action', $action); - -$compte = isset($_GET['compte']) && $_GET['compte'] ? $_GET['compte'] : 1; - -$compta = new Comptabilite($bdd); - -$id_periode = isset($_GET['id_periode']) && $_GET['id_periode'] ? $_GET['id_periode'] : ""; - -$id_periode = $compta->obtenirPeriodeEnCours($id_periode); -$smarty->assign('id_periode', $id_periode); - -$listPeriode = $compta->obtenirListPeriode(); -$smarty->assign('listPeriode', $listPeriode); - -$listeComptes = $compta->obtenirListeComptesActifs(); -$smarty->assign('listeComptes', $listeComptes); -$smarty->assign('compte_id', $compte); - -if ($action == 'lister') { - $periode_debut = $listPeriode[$id_periode - 1]['date_debut']; - $periode_fin = $listPeriode[$id_periode - 1]['date_fin']; - - $smarty->assign('compteurLigne', 1); - - $journal = $compta->obtenirJournalBanque($compte, $periode_debut, $periode_fin); - $smarty->assign('journal', $journal); - - $sousTotal = $compta->obtenirSousTotalJournalBanque($periode_debut, $periode_fin, $compte); - $smarty->assign('sousTotal', $sousTotal); - - $total = $compta->obtenirTotalJournalBanque($periode_debut, $periode_fin, $compte); - $smarty->assign('total', $total); -} elseif ($action == 'exporter') { - $periode_debut = $listPeriode[$id_periode - 1]['date_debut']; - $periode_fin = $listPeriode[$id_periode - 1]['date_fin']; - - $journal = $compta->obtenirJournalBanque($compte, $periode_debut, $periode_fin); - $sousTotal = $compta->obtenirSousTotalJournalBanque($periode_debut, $periode_fin, $compte); - setlocale(LC_TIME, 'fr_FR.utf8', 'fra'); - - //require_once 'PEAR/PHPExcel.php'; - $workbook = new Spreadsheet(); - - for ($i = 1; $i < 13; $i++) { - $compteurLigne[$i] = 4; - $sheet = $workbook->createSheet($i); - $sheet->setTitle('Mois de ' . strftime('%B %Y', mktime(0, 0, 0, $i, 1, (int) date('Y', strtotime((string) $periode_debut))))); - $sheet->setCellValue('A1', - 'Mois de ' . strftime('%B %Y', mktime(0, 0, 0, $i, 1, (int) date('Y', strtotime((string) $periode_debut))))); - $sheet->setCellValue('A3', 'Date'); - $sheet->setCellValue('B3', 'Opération'); - $sheet->setCellValue('C3', 'Description'); - $sheet->setCellValue('D3', 'Événement'); - $sheet->setCellValue('E3', 'Catégorie'); - $sheet->setCellValue('F3', 'Dépense'); - $sheet->setCellValue('G3', 'Recette'); - $sheet->setCellValue('H3', 'Commentaire'); - $sheet->setCellValue('I3', 'Justificatif'); - $sheet->setCellValue('J3', 'Nom du justificatif'); - $sheet->setCellValue('K3', 'Nom du compte'); - } - foreach ($journal as $ecriture) { - $sheet = $workbook->getSheet($ecriture['mois']); - $sheet->setCellValue('A' . $compteurLigne[$ecriture['mois']], date('d/m/Y', strtotime((string) $ecriture['date_regl']))); - $sheet->setCellValue('B' . $compteurLigne[$ecriture['mois']], $ecriture['reglement']); - $sheet->setCellValue('C' . $compteurLigne[$ecriture['mois']], $ecriture['description']); - $sheet->setCellValue('D' . $compteurLigne[$ecriture['mois']], $ecriture['evenement']); - $sheet->setCellValue('E' . $compteurLigne[$ecriture['mois']], $ecriture['categorie']); - if ($ecriture['idoperation'] == 1) { - $sheet->setCellValue('F' . $compteurLigne[$ecriture['mois']], $ecriture['montant']); - } else { - $sheet->setCellValue('G' . $compteurLigne[$ecriture['mois']], $ecriture['montant']); - } - $sheet->setCellValue('H' . $compteurLigne[$ecriture['mois']], $ecriture['comment']); - $sheet->setCellValue('I' . $compteurLigne[$ecriture['mois']], $ecriture['attachment_required'] ? 'Oui' : 'Non'); - $sheet->setCellValue('J' . $compteurLigne[$ecriture['mois']], $ecriture['attachment_filename']); - $sheet->setCellValue('K' . $compteurLigne[$ecriture['mois']], $ecriture['compta_compte_nom_compte']); - $compteurLigne[$ecriture['mois']]++; - } - for ($i = 1; $i < 13; $i++) { - $sheet = $workbook->getSheet($i); - - $sheet->getStyle('A1')->applyFromArray([ - 'font' => [ - 'size' => 12, - 'bold' => true, - 'name' => 'Ubuntu', - ], - ]); - $sheet->getStyle('A3:K3')->applyFromArray([ - 'font' => [ - 'size' => 10, - 'bold' => true, - 'name' => 'Ubuntu', - ], - 'alignment' => ['horizontal' => Alignment::HORIZONTAL_CENTER], - 'borders' => [ - 'allborders' => [ - 'style' => Border::BORDER_THIN, - 'color' => ['rgb' => 'FF666666'], - ], - ], - ]); - $sheet->getStyle('A4:K' . ($compteurLigne[$i] + 1))->applyFromArray([ - 'font' => [ - 'size' => 10, - 'name' => 'Ubuntu', - ], - 'borders' => [ - 'allborders' => [ - 'style' => Border::BORDER_THIN, - 'color' => ['rgb' => 'FF666666'], - ], - ], - ]); - $sheet->getStyle('J3:I200')->applyFromArray(['alignment' => ['horizontal' => Alignment::HORIZONTAL_CENTER]]); - - $sheet->setCellValue('E' . $compteurLigne[$i], 'TOTAL'); - $sheet->setCellValue('F' . $compteurLigne[$i], $sousTotal[$i]['debit']); - $sheet->setCellValue('G' . $compteurLigne[$i], $sousTotal[$i]['credit']); - $sheet->setCellValue('E' . ($compteurLigne[$i] + 1), 'SOLDE'); - $sheet->setCellValue('F' . ($compteurLigne[$i] + 1), $sousTotal[$i]['dif']); - $sheet->mergeCells('F' . ($compteurLigne[$i] + 1) . ':G' . ($compteurLigne[$i] + 1)); - - $sheet->getStyle('A' . $compteurLigne[$i] . ':J' . ($compteurLigne[$i] + 1))->applyFromArray([ - 'font' => [ - 'size' => 10, - 'bold' => true, - 'name' => 'Ubuntu', - ], - ]); - $sheet->getStyle('F' . ($compteurLigne[$i] + 1))->getAlignment()->applyFromArray(['horizontal' => Alignment::HORIZONTAL_CENTER]); - - $sheet->getStyle('F4:G200')->applyFromArray(['numberformat' => ['code' => NumberFormat::FORMAT_NUMBER_00]]); - - $sheet->getColumnDimension('A')->setWidth(8); - $sheet->getColumnDimension('C')->setWidth(36); - $sheet->getColumnDimension('D')->setWidth(12); - $sheet->getColumnDimension('E')->setWidth(12); - $sheet->getPageSetup()->setPaperSize(PageSetup::PAPERSIZE_A4); - $sheet->getPageSetup()->setOrientation(PageSetup::ORIENTATION_LANDSCAPE); - $sheet->getPageSetup()->setRowsToRepeatAtTopByStartAndEnd(1, 3); - $sheet->getHeaderFooter()->setOddFooter('&CPage &P de &N'); - - $objDrawing = new Drawing(); - $objDrawing->setName('Logo_AFUP'); - $objDrawing->setDescription('Logo_AFUP'); - $objDrawing->setPath(__DIR__ . '/../../templates/administration/images/logo_afup.png'); - $objDrawing->setCoordinates('H1'); - $objDrawing->setHeight(35); - $objDrawing->setWidth(70); - $objDrawing->setWorksheet($sheet); - } - //$workbook->removeSheetByIndex(0); - - header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); - header('Content-Disposition: attachment;filename="compta_afup_' . date('Y', strtotime((string) $periode_debut)) . '.xlsx"'); - header('Cache-Control: max-age=0'); - - $writer = new Xlsx($workbook); - $writer->save('php://output'); - exit(); -} elseif ($action === 'download_attachments') { - /** - * Export all attachments in a zipball - */ - - try { - // Get the year - $year = date('Y', strtotime((string) $listPeriode[$id_periode - 1]['date_debut'])); - - // Create the zip - $zipFilename = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'afup_justificatifs-' . $year . '.zip'; - $zip = new ZipArchive(); - $ret = $zip->open($zipFilename, ZipArchive::CREATE); - if ($ret !== true) { - throw new RuntimeException("Impossible to open the Zip archive."); - } else { - for ($month = 1; $month <= 12; $month++) { - $searchDir = sprintf('%d%02d', $year, $month); - $zipDir = sprintf('%d%02d', $year, $month); - $options = [ - 'add_path' => 'afup_justificatifs-' . $year . '/' . $zipDir . '/', - 'remove_all_path' => true, - ]; - $zip->addGlob(AFUP_CHEMIN_RACINE . '/uploads/' . $searchDir . '/*.*', 0, $options); - } - $zip->close(); - - // Download it - header('Content-Type: application/zip'); - header("Content-Transfer-Encoding: Binary"); - header("Content-disposition: attachment; filename=\"" . basename($zipFilename) . "\""); - readfile($zipFilename); - unlink($zipFilename); - exit; - } - } catch (Exception $e) { - header('HTTP/1.1 400 Bad Request'); - header('X-Info: ' . $e->getMessage()); - exit; - } -} diff --git a/htdocs/templates/administration/compta_banque.html b/htdocs/templates/administration/compta_banque.html deleted file mode 100644 index e96fc3058..000000000 --- a/htdocs/templates/administration/compta_banque.html +++ /dev/null @@ -1,147 +0,0 @@ -{if $action == 'lister'} -

Journal de banque

- - - -
- - -
-
- - -
-
-
- - -
-
-
-
-
- - - - - - - - - - - - - - - - {assign var=compteurLigne value=1} - {foreach from=$journal item=ecriture} - - - - - {if $ecriture.idoperation == 1} - - - {else} - - - {/if} - - - {foreach from=$sousTotal item=txt} - {if $ecriture.mois == $txt.mois && $compteurLigne == $txt.nligne } - - - - - - - {assign var=compteurLigne value=0} - {/if} - {/foreach} - - {assign var=compteurLigne value=$compteurLigne+1} - - {foreachelse} - - - - {/foreach} - - - - - - - - - - - - - -
DateOperationDescriptionDépenseRecette 
{$ecriture.date_regl|date_format:"%d/%m/%Y"}{$ecriture.reglement}{$ecriture.description}{$ecriture.montant|floatval|number_format:2:',':' '} {$ecriture.montant|floatval|number_format:2:',':' '} - - - -
- Sous Total - - {if $txt.debit}{$txt.debit|floatval|number_format:2:',':' '}{else}0,00{/if} - - {if $txt.credit}{$txt.credit|floatval|number_format:2:',':' '}{else}0,00{/if} - - {$txt.dif|floatval|number_format:2:',':' '} -
Aucune ecriture actuellement
- -
-
- {$total.debit|floatval|number_format:2:',':' '} -
- - Total débit - -
-
-
-
- {$total.credit|floatval|number_format:2:',':' '} -
- - Total crédit - -
-
 
-
-
- {$total.dif|floatval|number_format:2:',':' '} -
- - Solde - -
-
 
- -
-{/if}