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 @@ -542,9 +542,7 @@ codeunit 8063 "Sales Documents"
SubscriptionLine.Validate("Calculation Base Amount", SubscriptionLine."Calculation Base Amount" * -1);

SubscriptionLine.UpdateNextPriceUpdate();
SubscriptionLine.CalculateInitialTermUntilDate();
SubscriptionLine.CalculateInitialServiceEndDate();
SubscriptionLine.CalculateInitialCancellationPossibleUntilDate();
SubscriptionLine.CalculateInitialSubscriptionDates();
SubscriptionLine.SetCurrencyData(SalesHeader."Currency Factor", SalesHeader."Posting Date", SalesHeader."Currency Code");
SubscriptionLine.SetLCYFields(true);
if SalesLine."No." = SubscriptionLine."Invoicing Item No." then begin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,7 @@ codeunit 8004 "Post Sub. Contract Renewal"
TempServiceCommitment."Subscription Line End Date" := CalcDate('<-1D>', TempServiceCommitment."Subscription Line End Date");
end;
TempServiceCommitment.CopyFromSalesServiceCommitment(SalesServiceCommitment);
TempServiceCommitment.CalculateInitialTermUntilDate();
TempServiceCommitment.CalculateInitialServiceEndDate();
TempServiceCommitment.CalculateInitialCancellationPossibleUntilDate();
TempServiceCommitment.CalculateInitialSubscriptionDates();
TempServiceCommitment.SetCurrencyData(SalesHeader."Currency Factor", SalesHeader."Posting Date", SalesHeader."Currency Code");
TempServiceCommitment.SetLCYFields(true);
TempServiceCommitment.SetDefaultDimensions(true);
Expand Down Expand Up @@ -274,7 +272,7 @@ codeunit 8004 "Post Sub. Contract Renewal"
end;

/// <summary>
/// Updates the existing subscription line from planned subscription line. It is used for subscription renewal.
/// Updates the existing subscription line from planned subscription line. It is used for subscription renewal.
/// </summary>
/// <param name="PlannedServiceCommitment">Record "Planned Subscription Line".</param>
procedure ProcessPlannedServiceCommitment(PlannedServiceCommitment: Record "Planned Subscription Line")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ page 8004 "Planned Service Commitments"
}
field("Extension Term"; Rec."Extension Term")
{
ToolTip = 'Specifies a date formula for automatic renewal after initial term and the rhythm of the update of "Notice possible to" and "Term Until". If the field is empty and the initial term or notice period is filled, the end of Subscription Line is automatically set to the end of the initial term or notice period.';
ToolTip = 'Specifies a date formula for automatic renewal after initial term and the rhythm of the update of "Notice possible to" and "Term Until".';
}
field("Cancellation Possible Until"; Rec."Cancellation Possible Until")
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ page 8090 "Contract Analysis Entries"
}
field("Extension Term"; Rec."Extension Term")
{
ToolTip = 'Specifies a date formula for automatic renewal after initial term and the rhythm of the update of "Notice possible to" and "Term Until". If the field is empty and the initial term or notice period is filled, the end of Subscription Line is automatically set to the end of the initial term or notice period.';
ToolTip = 'Specifies a date formula for automatic renewal after initial term and the rhythm of the update of "Notice possible to" and "Term Until".';
}
field("Billing Rhythm"; Rec."Billing Rhythm")
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,7 @@ table 8019 "Sub. Contr. Analysis Entry"
Rec."Currency Factor Date" := ServiceCommitment."Currency Factor Date";
Rec."Extension Term" := ServiceCommitment."Extension Term";
Rec."Initial Term" := ServiceCommitment."Initial Term";
Rec."Renewal Term" := ServiceCommitment."Renewal Term";
Rec."Invoicing Item No." := ServiceCommitment."Invoicing Item No.";
Rec."Next Billing Date" := ServiceCommitment."Next Billing Date";
Rec."Notice Period" := ServiceCommitment."Notice Period";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ page 8080 "Closed Cust. Cont. Line Subp."
field("Extension Term"; ServiceCommitment."Extension Term")
{
Caption = 'Subsequent Term';
ToolTip = 'Specifies a date formula for automatic renewal after initial term and the rhythm of the update of "Notice possible to" and "Term Until". If the field is empty and the initial term or notice period is filled, the end of Subscription Line is automatically set to the end of the initial term or notice period.';
ToolTip = 'Specifies a date formula for automatic renewal after initial term and the rhythm of the update of "Notice possible to" and "Term Until".';
Editable = false;
Visible = false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ page 8068 "Customer Contract Line Subp."
field("Extension Term"; ServiceCommitment."Extension Term")
{
Caption = 'Subsequent Term';
ToolTip = 'Specifies a date formula for automatic renewal after initial term and the rhythm of the update of "Notice possible to" and "Term Until". If the field is empty and the initial term or notice period is filled, the end of Subscription Line is automatically set to the end of the initial term or notice period.';
ToolTip = 'Specifies a date formula for automatic renewal after initial term and the rhythm of the update of "Notice possible to" and "Term Until".';
Editable = false;
Visible = false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ page 8075 "Customer Contract Lines"
field("Extension Term"; ServiceCommitment."Extension Term")
{
Caption = 'Subsequent Term';
ToolTip = 'Specifies a date formula for automatic renewal after initial term and the rhythm of the update of "Notice possible to" and "Term Until". If the field is empty and the initial term or notice period is filled, the end of Subscription Line is automatically set to the end of the initial term or notice period.';
ToolTip = 'Specifies a date formula for automatic renewal after initial term and the rhythm of the update of "Notice possible to" and "Term Until".';
}
field("Billing Rhythm"; ServiceCommitment."Billing Rhythm")
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,10 @@ codeunit 8006 "Create Subscription Line"
if ImportedServiceCommitment."Calculation Base Amount (LCY)" <> 0 then
ServiceCommitment."Calculation Base Amount (LCY)" := ImportedServiceCommitment."Calculation Base Amount (LCY)";

ServiceCommitment.CalculateInitialTermUntilDate();
if ServiceCommitment."Subscription Line End Date" = 0D then
ServiceCommitment.CalculateInitialServiceEndDate();
ServiceCommitment.CalculateInitialCancellationPossibleUntilDate();
ServiceCommitment.CalculateInitialSubscriptionDates()
else
ServiceCommitment.CalculateInitialTermUntilDate();

ServiceCommitment.SetDefaultDimensions(true);
ServiceCommitment."Renewal Term" := ServiceCommitment."Initial Term";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ page 8009 "Imported Service Commitments"
}
field("Extension Term"; Rec."Extension Term")
{
ToolTip = 'Specifies a date formula for automatic renewal after initial term and the rhythm of the update of "Notice possible to" and "Term Until". If the field is empty and the initial term or notice period is filled, the end of Subscription Line is automatically set to the end of the initial term or notice period.';
ToolTip = 'Specifies a date formula for automatic renewal after initial term and the rhythm of the update of "Notice possible to" and "Term Until".';
}
field("Billing Rhythm"; Rec."Billing Rhythm")
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ page 8083 "Sales Serv. Comm. Archive List"
}
field("Extension Term"; Rec."Extension Term")
{
ToolTip = 'Specifies a date formula for automatic renewal after initial term and the rhythm of the update of "Notice possible to" and "Term Until". If the field is empty and the initial term or notice period is filled, the end of Subscription Line is automatically set to the end of the initial term or notice period.';
ToolTip = 'Specifies a date formula for automatic renewal after initial term and the rhythm of the update of "Notice possible to" and "Term Until".';
}
field("Billing Base Period"; Rec."Billing Base Period")
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ page 8082 "Sales Service Commitments"
}
field("Extension Term"; Rec."Extension Term")
{
ToolTip = 'Specifies a date formula for automatic renewal after initial term and the rhythm of the update of "Notice possible to" and "Term Until". If the field is empty and the initial term or notice period is filled, the end of Subscription Line is automatically set to the end of the initial term or notice period.';
ToolTip = 'Specifies a date formula for automatic renewal after initial term and the rhythm of the update of "Notice possible to" and "Term Until".';
}
field("Billing Base Period"; Rec."Billing Base Period")
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ page 8015 "Sales Service Commitments List"
}
field("Extension Term"; Rec."Extension Term")
{
ToolTip = 'Specifies a date formula for automatic renewal after initial term and the rhythm of the update of "Notice possible to" and "Term Until". If the field is empty and the initial term or notice period is filled, the end of Subscription Line is automatically set to the end of the initial term or notice period.';
ToolTip = 'Specifies a date formula for automatic renewal after initial term and the rhythm of the update of "Notice possible to" and "Term Until".';
}
field(Price; Rec.Price)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ page 8058 "Service Comm. Package Lines"
{
Style = Strong;
StyleExpr = Bold;
ToolTip = 'Specifies a date formula for automatic renewal after initial term and the rhythm of the update of "Notice possible to" and "Term Until". If the field is empty and the initial term or notice period is filled, the end of Subscription Line is automatically set to the end of the initial term or notice period.';
ToolTip = 'Specifies a date formula for automatic renewal after initial term and the rhythm of the update of "Notice possible to" and "Term Until".';
}
field("Notice Period"; Rec."Notice Period")
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ page 8094 "Service Commitment Archive"
}
field("Extension Term"; Rec."Extension Term")
{
ToolTip = 'Specifies a date formula for automatic renewal after initial term and the rhythm of the update of "Notice possible to" and "Term Until". If the field is empty and the initial term or notice period is filled, the end of Subscription Line is automatically set to the end of the initial term or notice period.';
ToolTip = 'Specifies a date formula for automatic renewal after initial term and the rhythm of the update of "Notice possible to" and "Term Until".';
}
field("Cancellation Possible Until"; Rec."Cancellation Possible Until")
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ page 8064 "Service Commitments"
}
field("Extension Term"; Rec."Extension Term")
{
ToolTip = 'Specifies a date formula for automatic renewal after initial term and the rhythm of the update of "Notice possible to" and "Term Until". If the field is empty and the initial term or notice period is filled, the end of Subscription Line is automatically set to the end of the initial term or notice period.';
ToolTip = 'Specifies a date formula for automatic renewal after initial term and the rhythm of the update of "Notice possible to" and "Term Until".';
}
field("Renewal Term"; Rec."Renewal Term")
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ page 8014 "Service Commitments List"
}
field("Extension Term"; Rec."Extension Term")
{
ToolTip = 'Specifies a date formula for automatic renewal after initial term and the rhythm of the update of "Notice possible to" and "Term Until". If the field is empty and the initial term or notice period is filled, the end of Subscription Line is automatically set to the end of the initial term or notice period.';
ToolTip = 'Specifies a date formula for automatic renewal after initial term and the rhythm of the update of "Notice possible to" and "Term Until".';
Visible = false;
}
field("Billing Rhythm"; Rec."Billing Rhythm")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ table 8059 "Subscription Line"
CheckServiceDates();
RecalculateHarmonizedBillingFieldsOnCustomerContract();
UpdateNextPriceUpdate();
CalculateInitialSubscriptionDates();
end;
}
field(7; "Subscription Line End Date"; Date)
Expand Down Expand Up @@ -739,56 +740,34 @@ table 8059 "Subscription Line"
end;
end;

internal procedure CalculateInitialSubscriptionDates()
begin
CalculateInitialServiceEndDate();
CalculateInitialTermUntilDate();
end;

internal procedure CalculateInitialServiceEndDate()
begin
if IsInitialTermEmpty() then
exit;
if not IsExtensionTermEmpty() then
exit;

TestField("Subscription Line Start Date");
"Subscription Line End Date" := CalcDate("Initial Term", "Subscription Line Start Date");
"Subscription Line End Date" := CalcDate('<-1D>', "Subscription Line End Date");
RefreshRenewalTerm();
end;

internal procedure CalculateInitialCancellationPossibleUntilDate()
begin
if IsExtensionTermEmpty() then
exit;
if IsNoticePeriodEmpty() then
exit;
if IsInitialTermEmpty() then
exit;

TestField("Subscription Line Start Date");
"Cancellation Possible Until" := CalcDate("Initial Term", "Subscription Line Start Date");
CalendarManagement.ReverseDateFormula(NegativeDateFormula, "Notice Period");
"Cancellation Possible Until" := CalcDate(NegativeDateFormula, "Cancellation Possible Until");
"Cancellation Possible Until" := CalcDate('<-1D>', "Cancellation Possible Until");
end;

internal procedure CalculateInitialTermUntilDate()
begin
if "Subscription Line End Date" <> 0D then begin
"Term Until" := "Subscription Line End Date";
exit;
end;

if IsExtensionTermEmpty() then
exit;
if IsNoticePeriodEmpty() and IsInitialTermEmpty() then
exit;

TestField("Subscription Line Start Date");
if IsInitialTermEmpty() then begin
"Term Until" := CalcDate("Notice Period", "Subscription Line Start Date");
"Term Until" := CalcDate('<-1D>', "Term Until");
UpdateCancellationPossibleUntil();
end else begin
"Term Until" := CalcDate("Initial Term", "Subscription Line Start Date");
"Term Until" := CalcDate('<-1D>', "Term Until");
end;
if "Subscription Line End Date" <> 0D then
"Term Until" := "Subscription Line End Date"
else
if not IsNoticePeriodEmpty() then begin
TestField("Subscription Line Start Date");
"Term Until" := CalcDate("Notice Period", "Subscription Line Start Date");
"Term Until" := CalcDate('<-1D>', "Term Until");
end;
UpdateCancellationPossibleUntil();
end;

internal procedure GetReferenceDate(): Date
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1802,12 +1802,11 @@ table 8057 "Subscription Header"
ServiceCommitment.Validate("Notice Period", ServiceCommPackageLine."Notice Period");
ServiceCommitment.Validate("Initial Term", ServiceCommPackageLine."Initial Term");

if ServiceEndDate <> 0D then
ServiceCommitment."Subscription Line End Date" := ServiceEndDate
else
ServiceCommitment.CalculateInitialServiceEndDate();
ServiceCommitment.CalculateInitialCancellationPossibleUntilDate();
ServiceCommitment.CalculateInitialTermUntilDate();
if ServiceEndDate <> 0D then begin
ServiceCommitment."Subscription Line End Date" := ServiceEndDate;
ServiceCommitment.CalculateInitialTermUntilDate();
end else
ServiceCommitment.CalculateInitialSubscriptionDates();
ServiceCommitment.ClearTerminationPeriodsWhenServiceEnded();
ServiceCommitment.UpdateNextBillingDate(ServiceCommitment."Subscription Line Start Date" - 1);
OnAfterDatesCalculatedOnInsertSubscriptionLinesFromSubscriptionPackage(ServiceCommitment, ServiceCommPackageLine);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ page 8089 "Closed Vend. Cont. Line Subp."
field("Extension Term"; ServiceCommitment."Extension Term")
{
Caption = 'Subsequent Term';
ToolTip = 'Specifies a date formula for automatic renewal after initial term and the rhythm of the update of "Notice possible to" and "Term Until". If the field is empty and the initial term or notice period is filled, the end of Subscription Line is automatically set to the end of the initial term or notice period.';
ToolTip = 'Specifies a date formula for automatic renewal after initial term and the rhythm of the update of "Notice possible to" and "Term Until".';
Editable = false;
Visible = false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ page 8078 "Vendor Contract Line Subpage"
field("Extension Term"; ServiceCommitment."Extension Term")
{
Caption = 'Subsequent Term';
ToolTip = 'Specifies a date formula for automatic renewal after initial term and the rhythm of the update of "Notice possible to" and "Term Until". If the field is empty and the initial term or notice period is filled, the end of Subscription Line is automatically set to the end of the initial term or notice period.';
ToolTip = 'Specifies a date formula for automatic renewal after initial term and the rhythm of the update of "Notice possible to" and "Term Until".';
Editable = false;
Visible = false;
}
Expand Down
Loading
Loading