From 66037a03f76a8f9a79214a63fb4c36fea59b31c4 Mon Sep 17 00:00:00 2001 From: Frank Cools Date: Thu, 2 Oct 2025 20:39:48 +0200 Subject: [PATCH] Replace quarter-based declaration numbering with month-based Declaration Numbering Changes: - Replace 'Q2' (quarter) with month numbers (2 characters) - Single month: 'CA3-2024-05-20241002123456' - Multiple months: 'CA3-2024-05-07-20241002123456' (May to July) - Updated both generateDeclarationNumber() and generateDeclarationNumberFromDates() - More precise period identification in declaration numbers --- core/class/declarationtva.class.php | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/core/class/declarationtva.class.php b/core/class/declarationtva.class.php index 244e6de..7e75f07 100644 --- a/core/class/declarationtva.class.php +++ b/core/class/declarationtva.class.php @@ -354,9 +354,16 @@ class DeclarationTVA public function generateDeclarationNumber($period) { $year = date('Y', strtotime($period['start_date'])); - $quarter = ceil(date('n', strtotime($period['start_date'])) / 3); + $start_month = date('m', strtotime($period['start_date'])); + $end_month = date('m', strtotime($period['end_date'])); - return 'CA3-' . $year . '-Q' . $quarter . '-' . date('YmdHis'); + if ($start_month == $end_month) { + $month_part = $start_month; + } else { + $month_part = $start_month . '-' . $end_month; + } + + return 'CA3-' . $year . '-' . $month_part . '-' . date('YmdHis'); } /** @@ -369,9 +376,16 @@ class DeclarationTVA public function generateDeclarationNumberFromDates($start_date, $end_date) { $year = date('Y', strtotime($start_date)); - $quarter = ceil(date('n', strtotime($start_date)) / 3); + $start_month = date('m', strtotime($start_date)); + $end_month = date('m', strtotime($end_date)); - return 'CA3-' . $year . '-Q' . $quarter . '-' . date('YmdHis'); + if ($start_month == $end_month) { + $month_part = $start_month; + } else { + $month_part = $start_month . '-' . $end_month; + } + + return 'CA3-' . $year . '-' . $month_part . '-' . date('YmdHis'); } /**