From 12f6cd87956780b30511b9d2b328753c0ab3c408 Mon Sep 17 00:00:00 2001 From: v-dhavalmore Date: Wed, 21 Jan 2026 20:31:45 +0530 Subject: [PATCH 1/2] Changes --- .../Tables/SubscriptionLine.Table.al | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/Apps/W1/Subscription Billing/App/Service Commitments/Tables/SubscriptionLine.Table.al b/src/Apps/W1/Subscription Billing/App/Service Commitments/Tables/SubscriptionLine.Table.al index 451fda6dd2..905da5bb9f 100644 --- a/src/Apps/W1/Subscription Billing/App/Service Commitments/Tables/SubscriptionLine.Table.al +++ b/src/Apps/W1/Subscription Billing/App/Service Commitments/Tables/SubscriptionLine.Table.al @@ -1917,7 +1917,10 @@ table 8059 "Subscription Line" until LastDayInNextPeriod >= EndDate; if FollowUpDaysExist then begin FollowUpDays := EndDate - LastDayInPreviousPeriod; - FollowUpPeriodDays := LastDayInNextPeriod - LastDayInPreviousPeriod; + if SinglePeriodDaysCount(StartDate, EndDate, PeriodFormula) then + FollowUpPeriodDays := Date2DMY(CalcDate('', EndDate), 1) + else + FollowUpPeriodDays := LastDayInNextPeriod - LastDayInPreviousPeriod; end; end; @@ -2035,6 +2038,15 @@ table 8059 "Subscription Line" end; end; + local procedure SinglePeriodDaysCount(StartDate: Date; EndDate: Date; PeriodFormula: DateFormula): Boolean + begin + if Format(PeriodFormula) <> '1M' then + exit(false); + + if (Date2DMY(StartDate, 2) = Date2DMY(EndDate, 2)) and (Date2DMY(StartDate, 3) = Date2DMY(EndDate, 3)) then + exit(true); + end; + [IntegrationEvent(false, false)] local procedure OnAfterUpdateNextBillingDate(var SubscriptionLine: Record "Subscription Line"; LastBillingToDate: Date) begin From a1b3c714e81b77a50737b0a2f98bacfc59095536 Mon Sep 17 00:00:00 2001 From: v-dhavalmore Date: Thu, 22 Jan 2026 15:07:34 +0530 Subject: [PATCH 2/2] Automation --- .../Test/Billing/RecurringBillingTest.Codeunit.al | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Apps/W1/Subscription Billing/Test/Billing/RecurringBillingTest.Codeunit.al b/src/Apps/W1/Subscription Billing/Test/Billing/RecurringBillingTest.Codeunit.al index 21467af7ad..badeab23a1 100644 --- a/src/Apps/W1/Subscription Billing/Test/Billing/RecurringBillingTest.Codeunit.al +++ b/src/Apps/W1/Subscription Billing/Test/Billing/RecurringBillingTest.Codeunit.al @@ -289,6 +289,9 @@ codeunit 139688 "Recurring Billing Test" CreateBillingProposalForCustomerContractUsingTempTemplate("Period Calculation"::"Align to End of Month", '<1Y>', '<1Q>', 20230228D, 20230614D); CheckBillingLineAmountAndPrice(116.304); + + CreateBillingProposalForCustomerContractUsingTempTemplate("Period Calculation"::"Align to End of Month", '<3M>', '<1M>', 20250226D, 20250228D); + CheckBillingLineAmountAndPrice(10.714); end; [Test]