Page 128 Vend. Ledg. Entries Preview, source in 29
Source29
src/Layers/W1/BaseApp/Purchases/Payables/VendLedgEntriesPreview.Page.al484 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.Purchases.Payables;
using Microsoft.Finance.Dimension;
using Microsoft.Finance.GeneralLedger.Preview;
page 128 "Vend. Ledg. Entries Preview"
{
Caption = 'Vendor Entries Preview';
DataCaptionFields = "Vendor No.";
Editable = false;
PageType = List;
SourceTable = "Vendor Ledger Entry";
SourceTableTemporary = true;
layout
{
area(content)
{
repeater(Control1)
{
ShowCaption = false;
field("Posting Date"; Rec."Posting Date")
{
ApplicationArea = Basic, Suite;
Editable = false;
}
field("Document Type"; Rec."Document Type")
{
ApplicationArea = Basic, Suite;
Editable = false;
StyleExpr = StyleTxt;
}
field("Document No."; Rec."Document No.")
{
ApplicationArea = Basic, Suite;
Editable = false;
StyleExpr = StyleTxt;
}
field("External Document No."; Rec."External Document No.")
{
ApplicationArea = Basic, Suite;
Editable = false;
}
field("Vendor No."; Rec."Vendor No.")
{
ApplicationArea = Basic, Suite;
Editable = false;
}
field("Message to Recipient"; Rec."Message to Recipient")
{
ApplicationArea = Basic, Suite;
}
field(Description; Rec.Description)
{
ApplicationArea = Basic, Suite;
Editable = false;
}
field("Global Dimension 1 Code"; Rec."Global Dimension 1 Code")
{
ApplicationArea = Dimensions;
Editable = false;
Visible = Dim1Visible;
}
field("Global Dimension 2 Code"; Rec."Global Dimension 2 Code")
{
ApplicationArea = Dimensions;
Editable = false;
Visible = Dim2Visible;
}
field("Vendor Posting Group"; Rec."Vendor Posting Group")
{
ApplicationArea = Basic, Suite;
Editable = false;
Visible = false;
}
field("IC Partner Code"; Rec."IC Partner Code")
{
ApplicationArea = Intercompany;
Editable = false;
Visible = false;
}
field("Purchaser Code"; Rec."Purchaser Code")
{
ApplicationArea = Suite;
Editable = false;
Visible = false;
}
field("Currency Code"; Rec."Currency Code")
{
ApplicationArea = Suite;
}
field("Payment Method Code"; Rec."Payment Method Code")
{
ApplicationArea = Basic, Suite;
}
field("Payment Reference"; Rec."Payment Reference")
{
ApplicationArea = Basic, Suite;
}
field("Creditor No."; Rec."Creditor No.")
{
ApplicationArea = Basic, Suite;
}
field(OriginalAmountFCY; OriginalAmountFCY)
{
ApplicationArea = Basic, Suite;
Caption = 'Original Amount';
Editable = false;
ToolTip = 'Specifies the amount on the vendor ledger entry before you post.';
AutoFormatExpression = Rec."Currency Code";
AutoFormatType = 1;
trigger OnDrillDown()
begin
DrilldownAmounts(2);
end;
}
field(OriginalAmountLCY; OriginalAmountLCY)
{
ApplicationArea = Basic, Suite;
AutoFormatType = 1;
AutoFormatExpression = '';
Caption = 'Original Amount (LCY)';
Editable = false;
ToolTip = 'Specifies the original amount linked to the vendor ledger entry, in local currency.';
Visible = false;
trigger OnDrillDown()
begin
DrilldownAmounts(2);
end;
}
field(AmountFCY; AmountFCY)
{
ApplicationArea = Basic, Suite;
Caption = 'Amount';
Editable = false;
ToolTip = 'Specifies the net amount of all the lines in the vendor entry.';
AutoFormatExpression = Rec."Currency Code";
AutoFormatType = 1;
trigger OnDrillDown()
begin
DrilldownAmounts(0);
end;
}
field(AmountLCY; AmountLCY)
{
ApplicationArea = Basic, Suite;
AutoFormatType = 1;
AutoFormatExpression = '';
Caption = 'Amount (LCY)';
Editable = false;
ToolTip = 'Specifies the amount of the ledger entry, in the local currency.';
Visible = false;
trigger OnDrillDown()
begin
DrilldownAmounts(0);
end;
}
field("Debit Amount"; Rec."Debit Amount")
{
ApplicationArea = Basic, Suite;
Visible = false;
}
field("Debit Amount (LCY)"; Rec."Debit Amount (LCY)")
{
ApplicationArea = Basic, Suite;
ToolTip = 'Specifies the total of the ledger entries that represent debits, expressed in LCY.';
Visible = false;
}
field("Credit Amount"; Rec."Credit Amount")
{
ApplicationArea = Basic, Suite;
Visible = false;
}
field("Credit Amount (LCY)"; Rec."Credit Amount (LCY)")
{
ApplicationArea = Basic, Suite;
ToolTip = 'Specifies the total of the ledger entries that represent credits, expressed in LCY.';
Visible = false;
}
field(RemainingAmountFCY; RemainingAmountFCY)
{
ApplicationArea = Basic, Suite;
Caption = 'Remaining Amount';
Editable = false;
ToolTip = 'Specifies the remaining amount on the vendor ledger entry before you post.';
AutoFormatExpression = Rec."Currency Code";
AutoFormatType = 1;
trigger OnDrillDown()
begin
DrilldownAmounts(1);
end;
}
field(RemainingAmountLCY; RemainingAmountLCY)
{
ApplicationArea = Basic, Suite;
AutoFormatType = 1;
AutoFormatExpression = '';
Caption = 'Remaining Amount (LCY)';
Editable = false;
ToolTip = 'Specifies the remaining amount linked to the vendor ledger entry on the line, in local currency. ';
Visible = false;
trigger OnDrillDown()
begin
DrilldownAmounts(1);
end;
}
field("Bal. Account Type"; Rec."Bal. Account Type")
{
ApplicationArea = Basic, Suite;
Editable = false;
Visible = false;
}
field("Bal. Account No."; Rec."Bal. Account No.")
{
ApplicationArea = Basic, Suite;
Editable = false;
Visible = false;
}
field("Due Date"; Rec."Due Date")
{
ApplicationArea = Basic, Suite;
StyleExpr = StyleTxt;
}
field("Pmt. Discount Date"; Rec."Pmt. Discount Date")
{
ApplicationArea = Basic, Suite;
}
field("Pmt. Disc. Tolerance Date"; Rec."Pmt. Disc. Tolerance Date")
{
ApplicationArea = Basic, Suite;
}
field("Original Pmt. Disc. Possible"; Rec."Original Pmt. Disc. Possible")
{
ApplicationArea = Basic, Suite;
}
field("Remaining Pmt. Disc. Possible"; Rec."Remaining Pmt. Disc. Possible")
{
ApplicationArea = Basic, Suite;
}
field("Max. Payment Tolerance"; Rec."Max. Payment Tolerance")
{
ApplicationArea = Basic, Suite;
}
field(Open; Rec.Open)
{
ApplicationArea = Basic, Suite;
}
field("On Hold"; Rec."On Hold")
{
ApplicationArea = Basic, Suite;
}
field("Exported to Payment File"; Rec."Exported to Payment File")
{
ApplicationArea = Basic, Suite;
}
field("Source Code"; Rec."Source Code")
{
ApplicationArea = Suite;
Editable = false;
Visible = false;
}
field("Reason Code"; Rec."Reason Code")
{
ApplicationArea = Suite;
Editable = false;
Visible = false;
}
field("Dimension Set ID"; Rec."Dimension Set ID")
{
ApplicationArea = Dimensions;
Visible = false;
}
field("Shortcut Dimension 3 Code"; Rec."Shortcut Dimension 3 Code")
{
ApplicationArea = Dimensions;
Editable = false;
Visible = Dim3Visible;
}
field("Shortcut Dimension 4 Code"; Rec."Shortcut Dimension 4 Code")
{
ApplicationArea = Dimensions;
Editable = false;
Visible = Dim4Visible;
}
field("Shortcut Dimension 5 Code"; Rec."Shortcut Dimension 5 Code")
{
ApplicationArea = Dimensions;
Editable = false;
Visible = Dim5Visible;
}
field("Shortcut Dimension 6 Code"; Rec."Shortcut Dimension 6 Code")
{
ApplicationArea = Dimensions;
Editable = false;
Visible = Dim6Visible;
}
field("Shortcut Dimension 7 Code"; Rec."Shortcut Dimension 7 Code")
{
ApplicationArea = Dimensions;
Editable = false;
Visible = Dim7Visible;
}
field("Shortcut Dimension 8 Code"; Rec."Shortcut Dimension 8 Code")
{
ApplicationArea = Dimensions;
Editable = false;
Visible = Dim8Visible;
}
}
}
}
actions
{
area(navigation)
{
group("Ent&ry")
{
Caption = 'Ent&ry';
Image = Entry;
action(Dimensions)
{
ApplicationArea = Dimensions;
Caption = 'Dimensions';
Ellipsis = true;
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()
var
GenJnlPostPreview: Codeunit "Gen. Jnl.-Post Preview";
begin
GenJnlPostPreview.ShowDimensions(DATABASE::"Vendor Ledger Entry", Rec."Entry No.", Rec."Dimension Set ID");
end;
}
action(SetDimensionFilter)
{
ApplicationArea = Dimensions;
Caption = 'Set Dimension Filter';
Ellipsis = true;
Image = "Filter";
ToolTip = 'Limit the entries according to the dimension filters that you specify. NOTE: If you use a high number of dimension combinations, this function may not work and can result in a message that the SQL server only supports a maximum of 2100 parameters.';
trigger OnAction()
begin
Rec.SetFilter("Dimension Set ID", DimensionSetIDFilter.LookupFilter());
end;
}
}
}
area(Promoted)
{
group(Category_Process)
{
Caption = 'Process';
actionref(Dimensions_Promoted; Dimensions)
{
}
actionref(SetDimensionFilter_Promoted; SetDimensionFilter)
{
}
}
}
}
trigger OnAfterGetRecord()
begin
StyleTxt := Rec.SetStyle();
CalcAmounts(AmountFCY, AmountLCY, RemainingAmountFCY, RemainingAmountLCY, OriginalAmountFCY, OriginalAmountLCY);
end;
trigger OnOpenPage()
begin
SetDimVisibility();
end;
var
TempDetailedVendLedgEntry: Record "Detailed Vendor Ledg. Entry" temporary;
DimensionSetIDFilter: Page "Dimension Set ID Filter";
StyleTxt: Text;
AmountFCY: Decimal;
AmountLCY: Decimal;
RemainingAmountFCY: Decimal;
RemainingAmountLCY: Decimal;
OriginalAmountLCY: Decimal;
OriginalAmountFCY: Decimal;
protected var
Dim1Visible: Boolean;
Dim2Visible: Boolean;
Dim3Visible: Boolean;
Dim4Visible: Boolean;
Dim5Visible: Boolean;
Dim6Visible: Boolean;
Dim7Visible: Boolean;
Dim8Visible: Boolean;
local procedure SetDimVisibility()
var
DimensionManagement: Codeunit DimensionManagement;
begin
DimensionManagement.UseShortcutDims(Dim1Visible, Dim2Visible, Dim3Visible, Dim4Visible, Dim5Visible, Dim6Visible, Dim7Visible, Dim8Visible);
end;
procedure Set(var TempVendLedgerEntry: Record "Vendor Ledger Entry" temporary; var TempDetailedVendLedgEntry2: Record "Detailed Vendor Ledg. Entry" temporary)
begin
if TempVendLedgerEntry.FindSet() then
repeat
Rec := TempVendLedgerEntry;
Rec.Insert();
until TempVendLedgerEntry.Next() = 0;
if TempDetailedVendLedgEntry2.FindSet() then
repeat
TempDetailedVendLedgEntry := TempDetailedVendLedgEntry2;
TempDetailedVendLedgEntry.Insert();
until TempDetailedVendLedgEntry2.Next() = 0;
end;
local procedure CalcAmounts(var AmountFCY: Decimal; var AmountLCY: Decimal; var RemainingAmountFCY: Decimal; var RemainingAmountLCY: Decimal; var OriginalAmountFCY: Decimal; var OriginalAmountLCY: Decimal)
begin
AmountFCY := 0;
AmountLCY := 0;
RemainingAmountLCY := 0;
RemainingAmountFCY := 0;
OriginalAmountLCY := 0;
OriginalAmountFCY := 0;
TempDetailedVendLedgEntry.SetRange("Vendor Ledger Entry No.", Rec."Entry No.");
if TempDetailedVendLedgEntry.FindSet() then
repeat
if TempDetailedVendLedgEntry."Entry Type" = TempDetailedVendLedgEntry."Entry Type"::"Initial Entry" then begin
OriginalAmountFCY += TempDetailedVendLedgEntry.Amount;
OriginalAmountLCY += TempDetailedVendLedgEntry."Amount (LCY)";
end;
if not (TempDetailedVendLedgEntry."Entry Type" in [TempDetailedVendLedgEntry."Entry Type"::Application,
TempDetailedVendLedgEntry."Entry Type"::"Appln. Rounding"])
then begin
AmountFCY += TempDetailedVendLedgEntry.Amount;
AmountLCY += TempDetailedVendLedgEntry."Amount (LCY)";
end;
RemainingAmountFCY += TempDetailedVendLedgEntry.Amount;
RemainingAmountLCY += TempDetailedVendLedgEntry."Amount (LCY)";
until TempDetailedVendLedgEntry.Next() = 0;
OnAfterCalcAmounts(Rec, TempDetailedVendLedgEntry, AmountFCY, AmountLCY, RemainingAmountFCY, RemainingAmountLCY, OriginalAmountFCY, OriginalAmountLCY);
end;
local procedure DrilldownAmounts(AmountType: Option Amount,"Remaining Amount","Original Amount")
var
DetailedVendEntriesPreview: Page "Detailed Vend. Entries Preview";
begin
case AmountType of
AmountType::Amount:
TempDetailedVendLedgEntry.SetFilter("Entry Type", '<>%1&<>%2',
TempDetailedVendLedgEntry."Entry Type"::Application, TempDetailedVendLedgEntry."Entry Type"::"Appln. Rounding");
AmountType::"Original Amount":
TempDetailedVendLedgEntry.SetRange("Entry Type", TempDetailedVendLedgEntry."Entry Type"::"Initial Entry");
AmountType::"Remaining Amount":
TempDetailedVendLedgEntry.SetRange("Entry Type");
end;
DetailedVendEntriesPreview.Set(TempDetailedVendLedgEntry);
DetailedVendEntriesPreview.RunModal();
Clear(DetailedVendEntriesPreview);
end;
[IntegrationEvent(false, false)]
local procedure OnAfterCalcAmounts(VendorLedgerEntry: Record "Vendor Ledger Entry"; var TempDetailedVendorLedgEntry: Record "Detailed Vendor Ledg. Entry" temporary; var AmountFCY: Decimal; var AmountLCY: Decimal; var RemainingAmountFCY: Decimal; var RemainingAmountLCY: Decimal; var OriginalAmountFCY: Decimal; var OriginalAmountLCY: Decimal)
begin
end;
}