diff --git a/src/Apps/W1/Subscription Billing/App/Contract Renewal/Pages/ContractRenewalSelection.Page.al b/src/Apps/W1/Subscription Billing/App/Contract Renewal/Pages/ContractRenewalSelection.Page.al index 45ce17eaf8..dbc7e37933 100644 --- a/src/Apps/W1/Subscription Billing/App/Contract Renewal/Pages/ContractRenewalSelection.Page.al +++ b/src/Apps/W1/Subscription Billing/App/Contract Renewal/Pages/ContractRenewalSelection.Page.al @@ -23,7 +23,7 @@ page 8006 "Contract Renewal Selection" field(AddVendorServicesCtrl; AddVendorServices) { CaptionClass = GetAddVendorServicesCaption(); -#pragma warning disable AA0219 +#pragma warning disable AA0219 ToolTip = 'Selecting this Option will also select and add the related Vendor Subscription Contract Lines.'; #pragma warning restore AA0219 trigger OnValidate() @@ -279,10 +279,13 @@ page 8006 "Contract Renewal Selection" trigger OnAfterGetRecord() begin - InitializePageVariables(); + Rec.GetServiceObject(ServiceObject); Rec.LoadServiceCommitmentForContractLine(TempServiceCommitment); + RenewalTerm := TempServiceCommitment."Renewal Term"; + RenewalTermEnabled := TempServiceCommitment."Subscription Header No." <> ''; LineCheckText := ''; + LineFormatStyleExpression := ''; if not CheckContractLine(Rec) then begin LineCheckText := CopyStr(GetLastErrorText(), 1, MaxStrLen(LineCheckText)); LineFormatStyleExpression := 'Attention'; @@ -347,17 +350,6 @@ page 8006 "Contract Renewal Selection" exit(ServiceCommitment."Renewal Term" <> EmptyDateFormula); end; - - local procedure InitializePageVariables() - begin - if not TempServiceCommitment.Get(Rec."Subscription Line Entry No.") then - Clear(TempServiceCommitment); - RenewalTerm := TempServiceCommitment."Renewal Term"; - RenewalTermEnabled := TempServiceCommitment."Subscription Header No." <> ''; - if not ServiceObject.Get(Rec."Subscription Header No.") then - Clear(ServiceObject); - end; - local procedure AddVendorServicesToBuffer() var ServiceCommitmentVend: Record "Subscription Line"; @@ -368,8 +360,7 @@ page 8006 "Contract Renewal Selection" repeat if not TempServiceCommitmentVend.Get(ServiceCommitmentVend."Entry No.") then begin TempServiceCommitmentVend := ServiceCommitmentVend; - TempServiceCommitmentVend.Insert(false) - ; + TempServiceCommitmentVend.Insert(false); end; until ServiceCommitmentVend.Next() = 0; end; diff --git a/src/Apps/W1/Subscription Billing/App/Customer Contracts/Pages/ClosedCustContLineSubp.Page.al b/src/Apps/W1/Subscription Billing/App/Customer Contracts/Pages/ClosedCustContLineSubp.Page.al index bf69325b64..ae39b25e71 100644 --- a/src/Apps/W1/Subscription Billing/App/Customer Contracts/Pages/ClosedCustContLineSubp.Page.al +++ b/src/Apps/W1/Subscription Billing/App/Customer Contracts/Pages/ClosedCustContLineSubp.Page.al @@ -327,7 +327,7 @@ page 8080 "Closed Cust. Cont. Line Subp." trigger OnAfterGetRecord() begin - InitializePageVariables(); + Rec.GetServiceObject(ServiceObject); Rec.LoadServiceCommitmentForContractLine(ServiceCommitment); LoadQuantityForContractLine(); VariantCode := ServiceObject."Variant Code"; @@ -346,12 +346,6 @@ page 8080 "Closed Cust. Cont. Line Subp." ContractLineQty: Decimal; VariantCode: Code[10]; - local procedure InitializePageVariables() - begin - Rec.GetServiceCommitment(ServiceCommitment); - Rec.GetServiceObject(ServiceObject); - end; - local procedure LoadQuantityForContractLine() begin ContractLineQty := ServiceObject.Quantity; diff --git a/src/Apps/W1/Subscription Billing/App/Customer Contracts/Pages/CustomerContractLineSubp.Page.al b/src/Apps/W1/Subscription Billing/App/Customer Contracts/Pages/CustomerContractLineSubp.Page.al index 4e367daa87..379b25e4f0 100644 --- a/src/Apps/W1/Subscription Billing/App/Customer Contracts/Pages/CustomerContractLineSubp.Page.al +++ b/src/Apps/W1/Subscription Billing/App/Customer Contracts/Pages/CustomerContractLineSubp.Page.al @@ -106,8 +106,10 @@ page 8068 "Customer Contract Line Subp." trigger OnValidate() begin - if not Rec.IsCommentLine() then + if not Rec.IsCommentLine() then begin + Rec.GetServiceObject(ServiceObject); CurrPage.Update(false); + end; end; trigger OnAssistEdit() @@ -134,8 +136,10 @@ page 8068 "Customer Contract Line Subp." ToolTip = 'Specifies the description of the Subscription Line.'; trigger OnValidate() begin - if not Rec.IsCommentLine() then + if not Rec.IsCommentLine() then begin + Rec.GetServiceCommitment(ServiceCommitment); CurrPage.Update(false); + end; end; } field("Service Object Quantity"; ContractLineQty) @@ -308,6 +312,8 @@ page 8068 "Customer Contract Line Subp." { Caption = 'Billing Base Period'; ToolTip = 'Specifies for which period the Amount is valid. If you enter 1M here, a period of one month, or 12M, a period of 1 year, to which Amount refers to.'; + Editable = not IsCommentLineEditable; + Enabled = not IsCommentLineEditable; trigger OnValidate() begin @@ -593,9 +599,9 @@ page 8068 "Customer Contract Line Subp." trigger OnAfterGetRecord() begin - InitializePageVariables(); - SetNextBillingDateStyle(); + Rec.GetServiceObject(ServiceObject); Rec.LoadServiceCommitmentForContractLine(ServiceCommitment); + SetNextBillingDateStyle(); LoadQuantityForContractLine(); VariantCode := ServiceObject."Variant Code"; end; @@ -627,15 +633,10 @@ page 8068 "Customer Contract Line Subp." ServiceObject: Record "Subscription Header"; ServiceCommitment: Record "Subscription Line"; - local procedure InitializePageVariables() - var - begin - Rec.GetServiceCommitment(ServiceCommitment); - Rec.GetServiceObject(ServiceObject); - end; - local procedure UpdateServiceCommitmentOnPage(CalledByFieldNo: Integer) begin + if Rec.IsCommentLine() then + exit; ServiceCommitment.UpdateServiceCommitment(CalledByFieldNo); CurrPage.Update(); end; diff --git a/src/Apps/W1/Subscription Billing/App/Customer Contracts/Pages/CustomerContractLines.Page.al b/src/Apps/W1/Subscription Billing/App/Customer Contracts/Pages/CustomerContractLines.Page.al index f4f5476778..6dd4bcef9a 100644 --- a/src/Apps/W1/Subscription Billing/App/Customer Contracts/Pages/CustomerContractLines.Page.al +++ b/src/Apps/W1/Subscription Billing/App/Customer Contracts/Pages/CustomerContractLines.Page.al @@ -205,9 +205,9 @@ page 8075 "Customer Contract Lines" trigger OnAfterGetRecord() begin - InitializePageVariables(); - SetNextBillingDateStyle(); + Rec.GetServiceObject(ServiceObject); Rec.LoadServiceCommitmentForContractLine(ServiceCommitment); + SetNextBillingDateStyle(); LoadQuantityForContractLine(); end; @@ -224,13 +224,6 @@ page 8075 "Customer Contract Lines" ContractLineQty: Decimal; VariantCode: Code[10]; - local procedure InitializePageVariables() - var - begin - Rec.GetServiceCommitment(ServiceCommitment); - Rec.GetServiceObject(ServiceObject); - end; - local procedure SetNextBillingDateStyle() begin if (ServiceCommitment."Next Billing Date" > ServiceCommitment."Subscription Line End Date") and (ServiceCommitment."Subscription Line End Date" <> 0D) then diff --git a/src/Apps/W1/Subscription Billing/App/Customer Contracts/Pages/SelectCustContractLines.Page.al b/src/Apps/W1/Subscription Billing/App/Customer Contracts/Pages/SelectCustContractLines.Page.al index 943a4d5b36..bc2317f2a4 100644 --- a/src/Apps/W1/Subscription Billing/App/Customer Contracts/Pages/SelectCustContractLines.Page.al +++ b/src/Apps/W1/Subscription Billing/App/Customer Contracts/Pages/SelectCustContractLines.Page.al @@ -57,14 +57,8 @@ page 8091 "Select Cust. Contract Lines" } trigger OnAfterGetRecord() begin - InitializePageVariables(); - end; - - local procedure InitializePageVariables() - var - begin - ServiceObject.Get(Rec."Subscription Header No."); - ServiceCommitment.Get(Rec."Subscription Line Entry No."); + Rec.GetServiceObject(ServiceObject); + Rec.LoadServiceCommitmentForContractLine(ServiceCommitment); end; local procedure ErrorIfMoreThanOneLineIsSelected(var CustomerContractLine: Record "Cust. Sub. Contract Line") diff --git a/src/Apps/W1/Subscription Billing/App/Customer Contracts/Tables/CustSubContractLine.Table.al b/src/Apps/W1/Subscription Billing/App/Customer Contracts/Tables/CustSubContractLine.Table.al index d5cbfb6bc5..73b5e34f38 100644 --- a/src/Apps/W1/Subscription Billing/App/Customer Contracts/Tables/CustSubContractLine.Table.al +++ b/src/Apps/W1/Subscription Billing/App/Customer Contracts/Tables/CustSubContractLine.Table.al @@ -284,7 +284,7 @@ table 8062 "Cust. Sub. Contract Line" procedure LoadServiceCommitmentForContractLine(var ServiceCommitment: Record "Subscription Line") var - LocalServiceCommitment: Record "Subscription Line"; //in case the parameter is passed as temporary table + LocalServiceCommitment: Record "Subscription Line"; begin ServiceCommitment.Init(); if "Subscription Contract No." = '' then @@ -292,10 +292,14 @@ table 8062 "Cust. Sub. Contract Line" case "Contract Line Type" of Enum::"Contract Line Type"::Item, Enum::"Contract Line Type"::"G/L Account": - if GetServiceCommitment(LocalServiceCommitment) then begin - LocalServiceCommitment.CalcFields(Quantity); - ServiceCommitment.TransferFields(LocalServiceCommitment); - end; + if ServiceCommitment.IsTemporary then begin + if GetServiceCommitment(LocalServiceCommitment) then begin + LocalServiceCommitment.CalcFields(Quantity); + ServiceCommitment.TransferFields(LocalServiceCommitment); + end; + end else + if GetServiceCommitment(ServiceCommitment) then + ServiceCommitment.CalcFields(Quantity); end; OnAfterLoadAmountsForContractLine(Rec, ServiceCommitment); end; diff --git a/src/Apps/W1/Subscription Billing/App/Vendor Contracts/Pages/ClosedVendContLineSubp.Page.al b/src/Apps/W1/Subscription Billing/App/Vendor Contracts/Pages/ClosedVendContLineSubp.Page.al index ecf555e19a..881c67e514 100644 --- a/src/Apps/W1/Subscription Billing/App/Vendor Contracts/Pages/ClosedVendContLineSubp.Page.al +++ b/src/Apps/W1/Subscription Billing/App/Vendor Contracts/Pages/ClosedVendContLineSubp.Page.al @@ -317,7 +317,7 @@ page 8089 "Closed Vend. Cont. Line Subp." trigger OnAfterGetRecord() begin - InitializePageVariables(); + Rec.GetServiceObject(ServiceObject); Rec.LoadServiceCommitmentForContractLine(ServiceCommitment); end; @@ -331,10 +331,4 @@ page 8089 "Closed Vend. Cont. Line Subp." ServiceCommitment: Record "Subscription Line"; ServiceObject: Record "Subscription Header"; ContractsGeneralMgt: Codeunit "Sub. Contracts General Mgt."; - - local procedure InitializePageVariables() - begin - Rec.GetServiceCommitment(ServiceCommitment); - Rec.GetServiceObject(ServiceObject); - end; } \ No newline at end of file diff --git a/src/Apps/W1/Subscription Billing/App/Vendor Contracts/Pages/SelectVendContractLines.Page.al b/src/Apps/W1/Subscription Billing/App/Vendor Contracts/Pages/SelectVendContractLines.Page.al index e6cf303e05..5e933dfda7 100644 --- a/src/Apps/W1/Subscription Billing/App/Vendor Contracts/Pages/SelectVendContractLines.Page.al +++ b/src/Apps/W1/Subscription Billing/App/Vendor Contracts/Pages/SelectVendContractLines.Page.al @@ -57,14 +57,8 @@ page 8092 "Select Vend. Contract Lines" } trigger OnAfterGetRecord() begin - InitializePageVariables(); - end; - - local procedure InitializePageVariables() - var - begin - ServiceObject.Get(Rec."Subscription Header No."); - ServiceCommitment.Get(Rec."Subscription Line Entry No."); + Rec.GetServiceObject(ServiceObject); + Rec.LoadServiceCommitmentForContractLine(ServiceCommitment); end; local procedure ErrorIfMoreThanOneLineIsSelected(var VendorContractLine: Record "Vend. Sub. Contract Line") diff --git a/src/Apps/W1/Subscription Billing/App/Vendor Contracts/Pages/VendorContractLineSubpage.Page.al b/src/Apps/W1/Subscription Billing/App/Vendor Contracts/Pages/VendorContractLineSubpage.Page.al index 871b25f096..fe6f9cc5ea 100644 --- a/src/Apps/W1/Subscription Billing/App/Vendor Contracts/Pages/VendorContractLineSubpage.Page.al +++ b/src/Apps/W1/Subscription Billing/App/Vendor Contracts/Pages/VendorContractLineSubpage.Page.al @@ -91,8 +91,10 @@ page 8078 "Vendor Contract Line Subpage" trigger OnValidate() begin - if not Rec.IsCommentLine() then + if not Rec.IsCommentLine() then begin + Rec.GetServiceObject(ServiceObject); CurrPage.Update(false); + end; end; trigger OnAssistEdit() @@ -119,8 +121,10 @@ page 8078 "Vendor Contract Line Subpage" ToolTip = 'Specifies the description of the Subscription Line.'; trigger OnValidate() begin - if not Rec.IsCommentLine() then + if not Rec.IsCommentLine() then begin + Rec.GetServiceCommitment(ServiceCommitment); CurrPage.Update(false); + end; end; } field("Service Object Quantity"; ServiceCommitment.Quantity) @@ -276,6 +280,8 @@ page 8078 "Vendor Contract Line Subpage" { Caption = 'Billing Base Period'; ToolTip = 'Specifies for which period the Amount is valid. If you enter 1M here, a period of one month, or 12M, a period of 1 year, to which Amount refers to.'; + Editable = not IsCommentLineEditable; + Enabled = not IsCommentLineEditable; trigger OnValidate() begin @@ -561,9 +567,9 @@ page 8078 "Vendor Contract Line Subpage" trigger OnAfterGetRecord() begin - InitializePageVariables(); - SetNextBillingDateStyle(); + Rec.GetServiceObject(ServiceObject); Rec.LoadServiceCommitmentForContractLine(ServiceCommitment); + SetNextBillingDateStyle(); end; trigger OnAfterGetCurrRecord() @@ -591,15 +597,10 @@ page 8078 "Vendor Contract Line Subpage" ServiceObject: Record "Subscription Header"; ServiceCommitment: Record "Subscription Line"; - local procedure InitializePageVariables() - var - begin - Rec.GetServiceCommitment(ServiceCommitment); - Rec.GetServiceObject(ServiceObject); - end; - local procedure UpdateServiceCommitmentOnPage(CalledByFieldNo: Integer) begin + if Rec.IsCommentLine() then + exit; ServiceCommitment.UpdateServiceCommitment(CalledByFieldNo); CurrPage.Update(); end; diff --git a/src/Apps/W1/Subscription Billing/App/Vendor Contracts/Tables/VendSubContractLine.Table.al b/src/Apps/W1/Subscription Billing/App/Vendor Contracts/Tables/VendSubContractLine.Table.al index 3753080ca1..ea4a446f25 100644 --- a/src/Apps/W1/Subscription Billing/App/Vendor Contracts/Tables/VendSubContractLine.Table.al +++ b/src/Apps/W1/Subscription Billing/App/Vendor Contracts/Tables/VendSubContractLine.Table.al @@ -269,7 +269,7 @@ table 8065 "Vend. Sub. Contract Line" internal procedure LoadServiceCommitmentForContractLine(var ServiceCommitment: Record "Subscription Line") var - LocalServiceCommitment: Record "Subscription Line"; //in case the parameter is passed as temporary table + LocalServiceCommitment: Record "Subscription Line"; begin ServiceCommitment.Init(); if "Subscription Contract No." = '' then @@ -277,12 +277,15 @@ table 8065 "Vend. Sub. Contract Line" case "Contract Line Type" of Enum::"Contract Line Type"::Item, Enum::"Contract Line Type"::"G/L Account": - begin - GetServiceCommitment(LocalServiceCommitment); - LocalServiceCommitment.CalcFields(Quantity); - ServiceCommitment.TransferFields(LocalServiceCommitment); - end; - end + if ServiceCommitment.IsTemporary then begin + if GetServiceCommitment(LocalServiceCommitment) then begin + LocalServiceCommitment.CalcFields(Quantity); + ServiceCommitment.TransferFields(LocalServiceCommitment); + end; + end else + if GetServiceCommitment(ServiceCommitment) then + ServiceCommitment.CalcFields(Quantity); + end; end; internal procedure GetServiceCommitment(var ServiceCommitment: Record "Subscription Line"): Boolean