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 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]