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'); } /**