Page 61 Applied Customer Entries
- App
- Base Application
- Namespace
- Microsoft.Sales.Receivables
- Versions
- 17-28
- Source table
- 21
Versions171819202122232425262728
Source29
Source in 29
src/Layers/W1/BaseApp/Sales/Receivables/AppliedCustomerEntries.Page.al417 lines, Copyright (c) Microsoft Corporation. MIT
// ------------------------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
// ------------------------------------------------------------------------------------------------
namespace Microsoft.Sales.Receivables;
using Microsoft.Finance.Dimension;
using Microsoft.Finance.GeneralLedger.Setup;
using Microsoft.Foundation.Navigate;
using Microsoft.Sales.FinanceCharge;
using System.Security.User;
/// <summary>
/// Displays customer ledger entries that have been applied to a specific entry, showing the application history and closed amounts.
/// </summary>
page 61 "Applied Customer Entries"
{
Caption = 'Applied Customer Entries';
DataCaptionExpression = Heading;
Editable = false;
PageType = List;
SourceTable = "Cust. Ledger Entry";
layout
{
area(content)
{
repeater(Control1)
{
ShowCaption = false;
field("Posting Date"; Rec."Posting Date")
{
ApplicationArea = Basic, Suite;
}
field("Document Type"; Rec."Document Type")
{
ApplicationArea = Basic, Suite;
}
field("Document No."; Rec."Document No.")
{
ApplicationArea = Basic, Suite;
}
field(Description; Rec.Description)
{
ApplicationArea = Basic, Suite;
}
field("Global Dimension 1 Code"; Rec."Global Dimension 1 Code")
{
ApplicationArea = Dimensions;
Visible = DimVisible1;
}
field("Global Dimension 2 Code"; Rec."Global Dimension 2 Code")
{
ApplicationArea = Dimensions;
Visible = DimVisible2;
}
field("Salesperson Code"; Rec."Salesperson Code")
{
ApplicationArea = Suite;
Visible = false;
}
field("Currency Code"; Rec."Currency Code")
{
ApplicationArea = Suite;
}
field("Original Amount"; Rec."Original Amount")
{
ApplicationArea = Basic, Suite;
}
field(Amount; Rec.Amount)
{
ApplicationArea = Basic, Suite;
Visible = AmountVisible;
}
field("Debit Amount"; Rec."Debit Amount")
{
ApplicationArea = Basic, Suite;
Visible = DebitCreditVisible;
}
field("Credit Amount"; Rec."Credit Amount")
{
ApplicationArea = Basic, Suite;
Visible = DebitCreditVisible;
}
field("Closed by Amount"; Rec."Closed by Amount")
{
ApplicationArea = Basic, Suite;
}
field("Closed by Currency Code"; Rec."Closed by Currency Code")
{
ApplicationArea = Suite;
Visible = false;
}
field("Closed by Currency Amount"; Rec."Closed by Currency Amount")
{
ApplicationArea = Suite;
AutoFormatExpression = Rec."Closed by Currency Code";
AutoFormatType = 1;
Visible = false;
}
field("User ID"; Rec."User ID")
{
ApplicationArea = Basic, Suite;
Visible = false;
trigger OnDrillDown()
var
UserMgt: Codeunit "User Management";
begin
UserMgt.DisplayUserInformation(Rec."User ID");
end;
}
field("Source Code"; Rec."Source Code")
{
ApplicationArea = Suite;
Visible = false;
}
field("Reason Code"; Rec."Reason Code")
{
ApplicationArea = Suite;
Visible = false;
}
field("External Document No."; Rec."External Document No.")
{
ApplicationArea = Basic, Suite;
Visible = false;
}
field("Your Reference"; Rec."Your Reference")
{
ApplicationArea = Basic, Suite;
Visible = false;
}
field("Entry No."; Rec."Entry No.")
{
ApplicationArea = Basic, Suite;
}
}
}
area(factboxes)
{
systempart(Control1900383207; Links)
{
ApplicationArea = RecordLinks;
Visible = false;
}
systempart(Control1905767507; Notes)
{
ApplicationArea = Notes;
Visible = false;
}
}
}
actions
{
area(navigation)
{
group("Ent&ry")
{
Caption = 'Ent&ry';
Image = Entry;
action("Reminder/Fin. Charge Entries")
{
ApplicationArea = Suite;
Caption = 'Reminder/Fin. Charge Entries';
Image = Reminder;
RunObject = Page "Reminder/Fin. Charge Entries";
RunPageLink = "Customer Entry No." = field("Entry No.");
RunPageView = sorting("Customer Entry No.");
ToolTip = 'View entries that were created when reminders and finance charge memos were issued.';
}
action(Dimensions)
{
AccessByPermission = TableData Dimension = R;
ApplicationArea = Dimensions;
Caption = 'Dimensions';
Image = Dimensions;
ShortCutKey = 'Alt+D';
ToolTip = 'View or edit dimensions, such as area, project, or department, that you can assign to sales and purchase documents to distribute costs and analyze transaction history.';
trigger OnAction()
begin
Rec.ShowDimensions();
end;
}
action("Detailed &Ledger Entries")
{
ApplicationArea = Basic, Suite;
Caption = 'Detailed &Ledger Entries';
Image = View;
RunObject = Page "Detailed Cust. Ledg. Entries";
RunPageLink = "Cust. Ledger Entry No." = field("Entry No."),
"Customer No." = field("Customer No.");
RunPageView = sorting("Cust. Ledger Entry No.", "Posting Date");
ShortCutKey = 'Ctrl+F7';
ToolTip = 'View a summary of the all posted entries and adjustments related to a specific customer ledger entry.';
}
}
}
area(processing)
{
action("&Navigate")
{
ApplicationArea = Basic, Suite;
Caption = 'Find entries...';
Image = Navigate;
ShortCutKey = 'Ctrl+Alt+Q';
ToolTip = 'Find entries and documents that exist for the document number and posting date on the selected document. (Formerly this action was named Navigate.)';
trigger OnAction()
begin
Navigate.SetDoc(Rec."Posting Date", Rec."Document No.");
Navigate.Run();
end;
}
action("Show Posted Document")
{
ApplicationArea = Basic, Suite;
Caption = 'Show Posted Document';
Image = Document;
ToolTip = 'Show details for the posted payment, invoice, or credit memo.';
trigger OnAction()
begin
Rec.ShowDoc();
end;
}
action(ShowDocumentAttachment)
{
ApplicationArea = Basic, Suite;
Caption = 'Show Document Attachment';
Enabled = HasDocumentAttachment;
Image = Attach;
ToolTip = 'View documents or images that are attached to the posted invoice or credit memo.';
trigger OnAction()
begin
Rec.ShowPostedDocAttachment();
end;
}
}
area(Promoted)
{
group(Category_Process)
{
Caption = 'Process';
actionref("&Navigate_Promoted"; "&Navigate")
{
}
}
group(Category_Category4)
{
Caption = 'Line', Comment = 'Generated from the PromotedActionCategories property index 3.';
ShowAs = SplitButton;
actionref("Show Posted Document_Promoted"; "Show Posted Document")
{
}
actionref(ShowDocumentAttachment_Promoted; ShowDocumentAttachment)
{
}
}
group(Category_Category5)
{
Caption = 'Entry', Comment = 'Generated from the PromotedActionCategories property index 4.';
actionref(Dimensions_Promoted; Dimensions)
{
}
actionref("Reminder/Fin. Charge Entries_Promoted"; "Reminder/Fin. Charge Entries")
{
}
actionref("Detailed &Ledger Entries_Promoted"; "Detailed &Ledger Entries")
{
}
}
group(Category_Report)
{
Caption = 'Report', Comment = 'Generated from the PromotedActionCategories property index 2.';
}
}
}
trigger OnAfterGetCurrRecord()
begin
HasDocumentAttachment := Rec.HasPostedDocAttachment();
end;
trigger OnInit()
begin
AmountVisible := true;
end;
trigger OnOpenPage()
begin
Rec.Reset();
SetControlVisibility();
if Rec."Entry No." <> 0 then begin
CreateCustLedgEntry := Rec;
if CreateCustLedgEntry."Document Type" = CreateCustLedgEntry."Document Type"::" " then
Heading := Text000
else
Heading := Format(CreateCustLedgEntry."Document Type");
Heading := Heading + ' ' + CreateCustLedgEntry."Document No.";
FindApplnEntriesDtldtLedgEntry();
Rec.SetCurrentKey("Entry No.");
Rec.SetRange("Entry No.");
if CreateCustLedgEntry."Closed by Entry No." <> 0 then begin
Rec."Entry No." := CreateCustLedgEntry."Closed by Entry No.";
Rec.Mark(true);
end;
Rec.SetCurrentKey("Closed by Entry No.");
Rec.SetRange("Closed by Entry No.", CreateCustLedgEntry."Entry No.");
if Rec.Find('-') then
repeat
Rec.Mark(true);
until Rec.Next() = 0;
Rec.SetCurrentKey("Entry No.");
Rec.SetRange("Closed by Entry No.");
end;
Rec.MarkedOnly(true);
end;
var
CreateCustLedgEntry: Record "Cust. Ledger Entry";
Navigate: Page Navigate;
Heading: Text[50];
AmountVisible: Boolean;
DebitCreditVisible: Boolean;
DimVisible1: Boolean;
DimVisible2: Boolean;
HasDocumentAttachment: Boolean;
#pragma warning disable AA0074
Text000: Label 'Document';
#pragma warning restore AA0074
local procedure FindApplnEntriesDtldtLedgEntry()
var
DtldCustLedgEntry1: Record "Detailed Cust. Ledg. Entry";
DtldCustLedgEntry2: Record "Detailed Cust. Ledg. Entry";
begin
DtldCustLedgEntry1.SetCurrentKey("Cust. Ledger Entry No.");
DtldCustLedgEntry1.SetRange("Cust. Ledger Entry No.", CreateCustLedgEntry."Entry No.");
DtldCustLedgEntry1.SetRange(Unapplied, false);
if DtldCustLedgEntry1.Find('-') then
repeat
if DtldCustLedgEntry1."Cust. Ledger Entry No." =
DtldCustLedgEntry1."Applied Cust. Ledger Entry No."
then begin
DtldCustLedgEntry2.Init();
DtldCustLedgEntry2.SetCurrentKey("Applied Cust. Ledger Entry No.", "Entry Type");
DtldCustLedgEntry2.SetRange(
"Applied Cust. Ledger Entry No.", DtldCustLedgEntry1."Applied Cust. Ledger Entry No.");
DtldCustLedgEntry2.SetRange("Entry Type", DtldCustLedgEntry2."Entry Type"::Application);
DtldCustLedgEntry2.SetRange(Unapplied, false);
if DtldCustLedgEntry2.Find('-') then
repeat
if DtldCustLedgEntry2."Cust. Ledger Entry No." <>
DtldCustLedgEntry2."Applied Cust. Ledger Entry No."
then begin
Rec.SetCurrentKey("Entry No.");
Rec.SetRange("Entry No.", DtldCustLedgEntry2."Cust. Ledger Entry No.");
if Rec.Find('-') then
Rec.Mark(true);
end;
until DtldCustLedgEntry2.Next() = 0;
end else begin
Rec.SetCurrentKey("Entry No.");
Rec.SetRange("Entry No.", DtldCustLedgEntry1."Applied Cust. Ledger Entry No.");
if Rec.Find('-') then
Rec.Mark(true);
end;
until DtldCustLedgEntry1.Next() = 0;
end;
/// <summary>
/// Filters the page to show a specific customer ledger entry by entry number.
/// </summary>
/// <param name="NewTempCustLedgEntryNo">The entry number of the customer ledger entry to filter to.</param>
procedure SetTempCustLedgEntry(NewTempCustLedgEntryNo: Integer)
begin
if NewTempCustLedgEntryNo <> 0 then begin
Rec.SetRange("Entry No.", NewTempCustLedgEntryNo);
Rec.Find('-');
end;
end;
/// <summary>
/// Gets the customer ledger entry that was set when the page was opened.
/// </summary>
/// <returns>The customer ledger entry record used to create the applied entries view.</returns>
procedure GetCreateCustLedgerEntry(): Record "Cust. Ledger Entry"
begin
exit(CreateCustLedgEntry);
end;
local procedure SetControlVisibility()
var
GLSetup: Record "General Ledger Setup";
begin
GLSetup.Get();
AmountVisible := not (GLSetup."Show Amounts" = GLSetup."Show Amounts"::"Debit/Credit Only");
DebitCreditVisible := not (GLSetup."Show Amounts" = GLSetup."Show Amounts"::"Amount Only");
DimVisible1 := GLSetup."Global Dimension 1 Code" <> '';
DimVisible2 := GLSetup."Global Dimension 2 Code" <> '';
end;
}