From 89f160e722acffad9c830eddab5c02402a3ad248 Mon Sep 17 00:00:00 2001 From: Niklas Plakolb Date: Wed, 6 Nov 2024 08:46:52 +0100 Subject: [PATCH] added: paid status in posted service invoice api --- .../Pages/FSPostedServiceInvoiceAPI.Page.al | 25 +++++++++++++++++++ .../Permissions/FSObjects.PermissionSet.al | 1 - 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/Apps/W1/FieldServiceIntegration/app/src/Pages/FSPostedServiceInvoiceAPI.Page.al b/Apps/W1/FieldServiceIntegration/app/src/Pages/FSPostedServiceInvoiceAPI.Page.al index 8fa2842c85..0c41a84b4e 100644 --- a/Apps/W1/FieldServiceIntegration/app/src/Pages/FSPostedServiceInvoiceAPI.Page.al +++ b/Apps/W1/FieldServiceIntegration/app/src/Pages/FSPostedServiceInvoiceAPI.Page.al @@ -12,6 +12,8 @@ using Microsoft.Foundation.Shipping; using Microsoft.Integration.Graph; using Microsoft.Service.Document; using Microsoft.API.V2; +using Microsoft.Integration.Entity; +using Microsoft.Sales.Receivables; page 6618 "FS Posted Service Invoice API" { @@ -249,6 +251,11 @@ page 6618 "FS Posted Service Invoice API" Caption = 'Total Amount Including Tax'; Editable = false; } + field(status; Status) + { + Caption = 'Status'; + Editable = false; + } field(lastModifiedDateTime; Rec.SystemModifiedAt) { Caption = 'Last Modified Date'; @@ -297,6 +304,7 @@ page 6618 "FS Posted Service Invoice API" Clear(PaymentTerms); if not ShipmentMethod.Get(Rec."Shipment Method Code") then Clear(ShipmentMethod); + CalculateStatus(); end; var @@ -308,4 +316,21 @@ page 6618 "FS Posted Service Invoice API" ShipmentMethod: Record "Shipment Method"; CurrencyCode: Code[10]; CachedCurrencyCode: Code[10]; + Status: Enum "Invoice Entity Aggregate Status"; + + local procedure CalculateStatus() + var + CustLedgerEntry: Record "Cust. Ledger Entry"; + begin + CustLedgerEntry.SetCurrentKey("Document No."); + CustLedgerEntry.SetRange("Document No.", Rec."No."); + CustLedgerEntry.SetRange("Document Type", CustLedgerEntry."Document Type"::Invoice); + CustLedgerEntry.SetRange(Open, true); + + if CustLedgerEntry.IsEmpty() then + Status := Status::Paid + else + Status := Status::Open; + end; + } \ No newline at end of file diff --git a/Apps/W1/FieldServiceIntegration/app/src/Permissions/FSObjects.PermissionSet.al b/Apps/W1/FieldServiceIntegration/app/src/Permissions/FSObjects.PermissionSet.al index dd1135d0ae..f658f8093d 100644 --- a/Apps/W1/FieldServiceIntegration/app/src/Permissions/FSObjects.PermissionSet.al +++ b/Apps/W1/FieldServiceIntegration/app/src/Permissions/FSObjects.PermissionSet.al @@ -17,7 +17,6 @@ permissionset 6612 "FS - Objects" codeunit "FS Upgrade" = X, codeunit "FS Integration Mgt." = X, codeunit "FS Int. Table Subscriber" = X, - codeunit "FS Integration Mgt." = X, codeunit "FS Lookup FS Tables" = X, codeunit "FS Setup Defaults" = X, page "FS Bookable Resource List" = X,