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 @@ -34,6 +34,8 @@ codeunit 8067 "Customer Deferrals Mngmt."
GeneralPostingSetup.TestField("Cust. Sub. Contr. Def Account");
SalesAccount := GeneralPostingSetup."Cust. Sub. Contr. Def Account";
end else begin
if SalesLine.Type = SalesLine.Type::"G/L Account" then
exit; // post directly to the G/L account selected on the contract line
GeneralPostingSetup.TestField("Cust. Sub. Contract Account");
SalesAccount := GeneralPostingSetup."Cust. Sub. Contract Account";
end;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ codeunit 8068 "Vendor Deferrals Mngmt."
GeneralPostingSetup.TestField("Vend. Sub. Contr. Def. Account");
SalesAccount := GeneralPostingSetup."Vend. Sub. Contr. Def. Account";
end else begin
if PurchLine.Type = PurchLine.Type::"G/L Account" then
exit; // post directly to the G/L account selected on the contract line
GeneralPostingSetup.TestField("Vend. Sub. Contract Account");
SalesAccount := GeneralPostingSetup."Vend. Sub. Contract Account";
end;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ page 8079 "Customer Contract Deferrals"
field("Gen. Prod. Posting Group"; Rec."Gen. Prod. Posting Group")
{
}
field("G/L Account No."; Rec."G/L Account No.")
{
}
field("G/L Entry No."; Rec."G/L Entry No.")
{
ToolTip = 'Specifies the number of the G/L item with which the deferral was released.';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ page 8081 "Vendor Contract Deferrals"
field("Gen. Prod. Posting Group"; Rec."Gen. Prod. Posting Group")
{
}
field("G/L Account No."; Rec."G/L Account No.")
{
}
field("G/L Entry No."; Rec."G/L Entry No.")
{
ToolTip = 'Specifies the number of the G/L item with which the deferral was released.';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ report 8051 "Contract Deferrals Release"
end;

if (CustomerContractDeferral.Amount <> 0) or (CustomerContractDeferral."Discount Amount" <> 0) then
CheckGenPostingSetup(CustomerContractDeferral."Gen. Bus. Posting Group", CustomerContractDeferral."Gen. Prod. Posting Group", Enum::"Service Partner"::Customer);
CheckGenPostingSetup(CustomerContractDeferral."Gen. Bus. Posting Group", CustomerContractDeferral."Gen. Prod. Posting Group", Enum::"Service Partner"::Customer, CustomerContractDeferral."G/L Account No." <> '');

CustomerContractDeferral.Released := true;
CustomerContractDeferral."Release Posting Date" := PostingDate;
Expand All @@ -164,7 +164,7 @@ report 8051 "Contract Deferrals Release"
CustomerContractDeferral."Subscription Contract No.",
CustomerContractDeferral."Entry No.",
CustomerContractDeferral."Dimension Set ID",
GenPostingSetup."Cust. Sub. Contract Account",
GetContractAccount(CustomerContractDeferral."G/L Account No.", GenPostingSetup."Cust. Sub. Contract Account"),
GenPostingSetup."Cust. Sub. Contr. Def Account",
CustomerContractDeferral."Gen. Bus. Posting Group",
CustomerContractDeferral."Gen. Prod. Posting Group",
Expand Down Expand Up @@ -206,7 +206,7 @@ report 8051 "Contract Deferrals Release"
end;

if (VendorContractDeferral.Amount <> 0) or (VendorContractDeferral."Discount Amount" <> 0) then
CheckGenPostingSetup(VendorContractDeferral."Gen. Bus. Posting Group", VendorContractDeferral."Gen. Prod. Posting Group", Enum::"Service Partner"::Vendor);
CheckGenPostingSetup(VendorContractDeferral."Gen. Bus. Posting Group", VendorContractDeferral."Gen. Prod. Posting Group", Enum::"Service Partner"::Vendor, VendorContractDeferral."G/L Account No." <> '');

VendorContractDeferral.Released := true;
VendorContractDeferral."Release Posting Date" := PostingDate;
Expand All @@ -219,7 +219,7 @@ report 8051 "Contract Deferrals Release"
VendorContractDeferral."Subscription Contract No.",
VendorContractDeferral."Entry No.",
VendorContractDeferral."Dimension Set ID",
GenPostingSetup."Vend. Sub. Contract Account",
GetContractAccount(VendorContractDeferral."G/L Account No.", GenPostingSetup."Vend. Sub. Contract Account"),
GenPostingSetup."Vend. Sub. Contr. Def. Account",
VendorContractDeferral."Gen. Bus. Posting Group",
VendorContractDeferral."Gen. Prod. Posting Group",
Expand Down Expand Up @@ -256,25 +256,34 @@ report 8051 "Contract Deferrals Release"
end;
end;

local procedure CheckGenPostingSetup(GenBusPostingGroup: Code[20]; GenProdPostingGroup: Code[20]; Partner: Enum "Service Partner")
local procedure CheckGenPostingSetup(GenBusPostingGroup: Code[20]; GenProdPostingGroup: Code[20]; Partner: Enum "Service Partner"; ContractAccountTakenFromDeferral: Boolean)
begin
GenPostingSetup.Get(GenBusPostingGroup, GenProdPostingGroup);
case Partner of
Enum::"Service Partner"::Customer:
begin
GenPostingSetup.TestField("Cust. Sub. Contract Account");
if not ContractAccountTakenFromDeferral then
GenPostingSetup.TestField("Cust. Sub. Contract Account");
if LineDiscountPosting then
GenPostingSetup.TestField("Sales Line Disc. Account");
end;
Enum::"Service Partner"::Vendor:
begin
GenPostingSetup.TestField("Vend. Sub. Contract Account");
if not ContractAccountTakenFromDeferral then
GenPostingSetup.TestField("Vend. Sub. Contract Account");
if LineDiscountPosting then
GenPostingSetup.TestField("Purch. Line Disc. Account");
end;
end;
end;

local procedure GetContractAccount(DeferralGLAccountNo: Code[20]; GenPostingSetupContractAccount: Code[20]): Code[20]
begin
if DeferralGLAccountNo <> '' then
exit(DeferralGLAccountNo);
exit(GenPostingSetupContractAccount);
end;

local procedure GetPostingAmount(Amount: Decimal; DiscountAmount: Decimal): Decimal
begin
if LineDiscountPosting then
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
namespace Microsoft.SubscriptionBilling;

using Microsoft.Finance.Dimension;
using Microsoft.Finance.GeneralLedger.Account;
using Microsoft.Finance.GeneralLedger.Ledger;
using Microsoft.Finance.GeneralLedger.Setup;
using Microsoft.Sales.Customer;
Expand Down Expand Up @@ -135,6 +136,14 @@ table 8066 "Cust. Sub. Contract Deferral"
{
Caption = 'Currency Code';
}
field(27; "G/L Account No."; Code[20])
{
Caption = 'G/L Account No.';
ToolTip = 'Specifies the G/L account selected on the Subscription Contract line. If it is filled, releasing the deferral posts to this account instead of the Customer Subscription Contract Account from the General Posting Setup.';
DataClassification = CustomerContent;
Editable = false;
TableRelation = "G/L Account";
}
field(74; "Gen. Bus. Posting Group"; Code[20])
{
Caption = 'Gen. Bus. Posting Group';
Expand Down Expand Up @@ -195,6 +204,8 @@ table 8066 "Cust. Sub. Contract Deferral"
Rec."Currency Code" := SalesLine."Currency Code";
Rec."Gen. Bus. Posting Group" := SalesLine."Gen. Bus. Posting Group";
Rec."Gen. Prod. Posting Group" := SalesLine."Gen. Prod. Posting Group";
if SalesLine.Type = SalesLine.Type::"G/L Account" then
Rec."G/L Account No." := SalesLine."No.";
OnAfterInitFromSalesLine(Rec, SalesLine, Sign);
end;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
namespace Microsoft.SubscriptionBilling;

using Microsoft.Finance.Dimension;
using Microsoft.Finance.GeneralLedger.Account;
using Microsoft.Finance.GeneralLedger.Ledger;
using Microsoft.Finance.GeneralLedger.Setup;
using Microsoft.Purchases.Document;
Expand Down Expand Up @@ -136,6 +137,14 @@ table 8072 "Vend. Sub. Contract Deferral"
{
Caption = 'Currency Code';
}
field(27; "G/L Account No."; Code[20])
{
Caption = 'G/L Account No.';
ToolTip = 'Specifies the G/L account selected on the Subscription Contract line. If it is filled, releasing the deferral posts to this account instead of the Vendor Subscription Contract Account from the General Posting Setup.';
DataClassification = CustomerContent;
Editable = false;
TableRelation = "G/L Account";
}
field(74; "Gen. Bus. Posting Group"; Code[20])
{
Caption = 'Gen. Bus. Posting Group';
Expand Down Expand Up @@ -198,6 +207,8 @@ table 8072 "Vend. Sub. Contract Deferral"
Rec."Currency Code" := PurchaseLine."Currency Code";
Rec."Gen. Bus. Posting Group" := PurchaseLine."Gen. Bus. Posting Group";
Rec."Gen. Prod. Posting Group" := PurchaseLine."Gen. Prod. Posting Group";
if PurchaseLine.Type = PurchaseLine.Type::"G/L Account" then
Rec."G/L Account No." := PurchaseLine."No.";
OnAfterInitFromPurchaseLine(Rec, PurchaseLine, Sign);
end;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -732,35 +732,41 @@ codeunit 139685 "Contract Test Library"

procedure CreateServiceObjectForGLAccountWithServiceCommitments(var ServiceObject: Record "Subscription Header"; var GLAccount: Record "G/L Account";
NoOfCustomerServCommLinesToCreate: Integer; NoOfVendorServCommLinesToCreate: Integer; BillingBasePeriodText: Text; BillingRhythmText: Text)
begin
CreateServiceObjectForGLAccountWithServiceCommitments(ServiceObject, GLAccount, NoOfCustomerServCommLinesToCreate, NoOfVendorServCommLinesToCreate, BillingBasePeriodText, BillingRhythmText, WorkDate(), 0);
end;

procedure CreateServiceObjectForGLAccountWithServiceCommitments(var ServiceObject: Record "Subscription Header"; var GLAccount: Record "G/L Account";
NoOfCustomerServCommLinesToCreate: Integer; NoOfVendorServCommLinesToCreate: Integer; BillingBasePeriodText: Text; BillingRhythmText: Text;
SubscriptionLineStartDate: Date; CalculationBaseAmount: Decimal)
var
ServiceCommitment: Record "Subscription Line";
i: Integer;
begin
CreateServiceObjectForGLAccount(ServiceObject, GLAccount);
for i := 1 to NoOfCustomerServCommLinesToCreate do begin
ServiceCommitment.Init();
ServiceCommitment."Subscription Header No." := ServiceObject."No.";
ServiceCommitment."Entry No." := 0;
ServiceCommitment.Description := ServiceObject.Description;
ServiceCommitment."Invoicing via" := ServiceCommitment."Invoicing via"::Contract;
ServiceCommitment.Partner := ServiceCommitment.Partner::Customer;
ServiceCommitment.Validate("Subscription Line Start Date", WorkDate());
Evaluate(ServiceCommitment."Billing Base Period", BillingBasePeriodText);
Evaluate(ServiceCommitment."Billing Rhythm", BillingRhythmText);
ServiceCommitment.Insert(false);
end;
for i := 1 to NoOfVendorServCommLinesToCreate do begin
ServiceCommitment.Init();
ServiceCommitment."Subscription Header No." := ServiceObject."No.";
ServiceCommitment."Entry No." := 0;
ServiceCommitment.Description := ServiceObject.Description;
ServiceCommitment."Invoicing via" := ServiceCommitment."Invoicing via"::Contract;
ServiceCommitment.Partner := ServiceCommitment.Partner::Vendor;
ServiceCommitment.Validate("Subscription Line Start Date", WorkDate());
Evaluate(ServiceCommitment."Billing Base Period", BillingBasePeriodText);
Evaluate(ServiceCommitment."Billing Rhythm", BillingRhythmText);
ServiceCommitment.Insert(false);
for i := 1 to NoOfCustomerServCommLinesToCreate do
InsertSubscriptionLineForServiceObject(ServiceObject, Enum::"Service Partner"::Customer, BillingBasePeriodText, BillingRhythmText, SubscriptionLineStartDate, CalculationBaseAmount);
for i := 1 to NoOfVendorServCommLinesToCreate do
InsertSubscriptionLineForServiceObject(ServiceObject, Enum::"Service Partner"::Vendor, BillingBasePeriodText, BillingRhythmText, SubscriptionLineStartDate, CalculationBaseAmount);
end;

local procedure InsertSubscriptionLineForServiceObject(ServiceObject: Record "Subscription Header"; ServicePartner: Enum "Service Partner"; BillingBasePeriodText: Text; BillingRhythmText: Text; SubscriptionLineStartDate: Date; CalculationBaseAmount: Decimal)
var
ServiceCommitment: Record "Subscription Line";
begin
ServiceCommitment.Init();
ServiceCommitment."Subscription Header No." := ServiceObject."No.";
ServiceCommitment."Entry No." := 0;
ServiceCommitment.Description := ServiceObject.Description;
ServiceCommitment."Invoicing via" := ServiceCommitment."Invoicing via"::Contract;
ServiceCommitment.Partner := ServicePartner;
ServiceCommitment.Validate("Subscription Line Start Date", SubscriptionLineStartDate);
Evaluate(ServiceCommitment."Billing Base Period", BillingBasePeriodText);
Evaluate(ServiceCommitment."Billing Rhythm", BillingRhythmText);
if CalculationBaseAmount <> 0 then begin
ServiceCommitment.Validate("Calculation Base %", 100);
ServiceCommitment.Validate("Calculation Base Amount", CalculationBaseAmount);
end;
ServiceCommitment.Insert(false);
end;

procedure CreateServiceObjectForItem(var ServiceObject: Record "Subscription Header"; ItemNo: Code[20])
Expand Down
Loading
Loading