-
Notifications
You must be signed in to change notification settings - Fork 267
Description
Describe the issue
Backport of #4401
There is a bug filed to Microsoft under ID 581883 titled:
Incorrect Billing-To Date calculation for quarterly contracts starting late in the month with "Align to End of Month" setting.
The "Align to End of Month" option is intended to adjust the end date of the subscription so that if the subscription starts within the last 3 days of a month, the subscription end date will maintain the same delta from the end of the month, plus one additional day only if the full billing period is being billed.
However, this behavior is not consistent in the system. Below are examples of how the end dates should be calculated for quarterly subscriptions when a full Quarter is being billed:
| Start Date | Delta to End of Month | Calculated End Date | Delta to End of Month |
|---|---|---|---|
| 27.02.2020 | 1 day | 28.05.2020 | 2 days |
| 29.03.2020 | 1 day | 28.06.2020 | 2 days |
| 26.02.2020 | 2 days | 27.05.2020 | 3 days |
Expected behavior
For a contract starting on 27.02.2020, billed quarterly with "Align to End of Month" enabled:
- When the first billing period is split manually as 27.02.2020–29.02.2020, and the next period starts from 01.03.2020, the system should calculate the Billing To date as 31.05.2020 (i.e., 3 months forward, aligned to the fact that Start of Billing Period has been moved to the first of the month).
- Instead, the system incorrectly calculates it as 27.06.2020.
- Manual adjustment of the start date does not produce a correct end date, nor does it correctly calculate the amount.
Steps to reproduce
- Set up a Subscription Package with the following line:
- Partner = Customer
- Template = Quarterly
- Invoicing via = Subscription Contract
- Calculation Base % = 100
- Billing Base Period = 1M
- Billing Rhythm = 3M or 1Q
- Period Calculation = Align to End of Month
- Initial Term = 12M
- Subsequent Term = 12M
- Notice Period = 3M or 1Q
- Create an Item and enable the "Subscription Item" option.
- Assign the Subscription Package to this Item.
- Create a new Subscription and select the created Item.
- Create a Customer Subscription Contract.
- Fetch the Subscription Lines into the contract.
- Set the Subscription Line Start Date to 27.02.2020.
- Navigate to Recurring Billing and set:
- Billing Date = 27.02.2020
- Billing To Date = 29.02.2020
- Run the action "Create Billing Proposal" → A line is created for 27.02.2020–29.02.2020.
- Update the Billing Date to 01.03.2020 and leave Billing To Date empty.
- Run "Create Billing Proposal" again → A line is created for 01.03.2020–27.06.2020
- ❌ This is incorrect.
- ✅ Expected: 01.03.2020–31.05.2020.
Additional context
No response
I will provide a fix for a bug
- I will provide a fix for a bug