Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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('<CM>', EndDate), 1)
else
FollowUpPeriodDays := LastDayInNextPeriod - LastDayInPreviousPeriod;
end;
end;

Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down