Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Event Request] at codeunit 699 "Exch. Rate Adjmt. Process" #26689

Closed
Sameer-Utekar opened this issue Jun 18, 2024 · 1 comment
Closed

[Event Request] at codeunit 699 "Exch. Rate Adjmt. Process" #26689

Sameer-Utekar opened this issue Jun 18, 2024 · 1 comment
Labels
event-request Request for adding an event SCM GitHub request for SCM area ships-in-future-update Fix ships in a future update

Comments

@Sameer-Utekar
Copy link

Sameer-Utekar commented Jun 18, 2024

Describe the request

Hello! We are requesting the implementation of integration events at codeunit 699 "Exch. Rate Adjmt. Process" as per below

  1. Could we please have a new event OnBeforePrepareTempCustLedgEntry in the function PrepareTempCustLedgEntry from codeunit 699 "Exch. Rate Adjmt. Process"

Code:

local procedure PrepareTempCustLedgEntry(var Customer: Record Customer; var TempCustLedgerEntry: Record "Cust. Ledger Entry" temporary)
   var
       CustLedgerEntry2: Record "Cust. Ledger Entry";
       DtldCustLedgEntry2: Record "Detailed Cust. Ledg. Entry";
       isHandled: Boolean;
   begin
   
   	//>>>>
       isHandled := false;
       OnBeforePrepareTempCustLedgEntry(CustLedgerEntry2, TempCustLedgerEntry, Customer, isHandled);
       if isHandled then
           exit;
   	//<<<<

       TempCustLedgerEntry.DeleteAll();

       Currency.CopyFilter(Code, CustLedgerEntry2."Currency Code");
       CustLedgerEntry2.FilterGroup(2);
       CustLedgerEntry2.SetFilter("Currency Code", '<>%1', '');
       OnPrepareTempCustLedgEntryOnAfterSetCustLedgerEntryFilters(CustLedgerEntry2);
       CustLedgerEntry2.FilterGroup(0);

       DtldCustLedgEntry2.Reset();
       DtldCustLedgEntry2.SetCurrentKey("Customer No.", "Posting Date", "Entry Type");
       DtldCustLedgEntry2.SetRange("Customer No.", Customer."No.");
       DtldCustLedgEntry2.SetRange("Posting Date", CalcDate('<+1D>', ExchRateAdjmtParameters."End Date"), DMY2Date(31, 12, 9999));
       OnPrepareTempCustLedgEntryOnAfterSetDtldCustLedgerEntryFilters(DtldCustLedgEntry2);
       if DtldCustLedgEntry2.Find('-') then
           repeat
               CustLedgerEntry2."Entry No." := DtldCustLedgEntry2."Cust. Ledger Entry No.";
               if CustLedgerEntry2.Find('=') then
                   if (CustLedgerEntry2."Posting Date" >= ExchRateAdjmtParameters."Start Date") and
                       (CustLedgerEntry2."Posting Date" <= ExchRateAdjmtParameters."End Date")
                   then begin
                       TempCustLedgerEntry."Entry No." := CustLedgerEntry2."Entry No.";
                       if TempCustLedgerEntry.Insert() then;
                   end;
           until DtldCustLedgEntry2.Next() = 0;

       CustLedgerEntry2.SetCurrentKey("Customer No.", Open);
       CustLedgerEntry2.SetRange("Customer No.", Customer."No.");
       CustLedgerEntry2.SetRange(Open, true);
       CustLedgerEntry2.SetRange("Posting Date", 0D, ExchRateAdjmtParameters."End Date");
       OnPrepareTempCustLedgEntryOnAfterSetCustLedgerEntryFilters(CustLedgerEntry2);
       if CustLedgerEntry2.Find('-') then
           repeat
               TempCustLedgerEntry."Entry No." := CustLedgerEntry2."Entry No.";
               if TempCustLedgerEntry.Insert() then;
           until CustLedgerEntry2.Next() = 0;
       CustLedgerEntry2.Reset();
   end;

Event signature:

 [IntegrationEvent(false, false)]
    local procedure OnBeforePrepareTempCustLedgEntry(var CustLedgerEntry: Record "Cust. Ledger Entry"; var TempCustLedgerEntry: Record "Cust. Ledger Entry" temporary; Customer: Record Customer; var isHandled: Boolean)
    begin
    end;
  1. Could we please have a new event OnBeforePrepareTempVendLedgEntry in the function PrepareTempVendLedgEntry from codeunit 699 "Exch. Rate Adjmt. Process"

Code:

local procedure PrepareTempVendLedgEntry(var Vendor: Record Vendor; var TempVendorLedgerEntry: Record "Vendor Ledger Entry" temporary);
   var
       DtldVendLedgEntry2: Record "Detailed Vendor Ledg. Entry";
       VendorLedgerEntry2: Record "Vendor Ledger Entry";
       IsHandled: Boolean;
   begin
   	//>>>>
       IsHandled := false;
       OnBeforePrepareTempVendLedgEntry(VendorLedgerEntry2, TempVendorLedgerEntry, Vendor, IsHandled);
       if IsHandled then
           exit;
   	//<<<<
   	
       TempVendorLedgerEntry.DeleteAll();

       Currency.CopyFilter(Code, VendorLedgerEntry2."Currency Code");
       VendorLedgerEntry2.FilterGroup(2);
       VendorLedgerEntry2.SetFilter("Currency Code", '<>%1', '');
       OnPrepareTempVendLedgEntryOnAfterSetVendLedgerEntryFilters(VendorLedgerEntry2);
       VendorLedgerEntry2.FilterGroup(0);

       DtldVendLedgEntry2.Reset();
       DtldVendLedgEntry2.SetCurrentKey("Vendor No.", "Posting Date", "Entry Type");
       DtldVendLedgEntry2.SetRange("Vendor No.", Vendor."No.");
       DtldVendLedgEntry2.SetRange("Posting Date", CalcDate('<+1D>', ExchRateAdjmtParameters."End Date"), DMY2Date(31, 12, 9999));
       OnPrepareTempVendLedgEntryOnAfterSetDtldVendLedgerEntryFilters(DtldVendLedgEntry2);
       if DtldVendLedgEntry2.Find('-') then
           repeat
               VendorLedgerEntry2."Entry No." := DtldVendLedgEntry2."Vendor Ledger Entry No.";
               if VendorLedgerEntry2.Find('=') then
                   if (VendorLedgerEntry2."Posting Date" >= ExchRateAdjmtParameters."Start Date") and
                       (VendorLedgerEntry2."Posting Date" <= ExchRateAdjmtParameters."End Date")
                   then begin
                       TempVendorLedgerEntry."Entry No." := VendorLedgerEntry2."Entry No.";
                       if TempVendorLedgerEntry.Insert() then;
                   end;
           until DtldVendLedgEntry2.Next() = 0;

       VendorLedgerEntry2.SetCurrentKey("Vendor No.", Open);
       VendorLedgerEntry2.SetRange("Vendor No.", Vendor."No.");
       VendorLedgerEntry2.SetRange(Open, true);
       VendorLedgerEntry2.SetRange("Posting Date", 0D, ExchRateAdjmtParameters."End Date");
       OnPrepareTempVendLedgEntryOnAfterSetVendLedgerEntryFilters(VendorLedgerEntry2);
       if VendorLedgerEntry2.Find('-') then
           repeat
               TempVendorLedgerEntry."Entry No." := VendorLedgerEntry2."Entry No.";
               if TempVendorLedgerEntry.Insert() then;
           until VendorLedgerEntry2.Next() = 0;
       VendorLedgerEntry2.Reset();
   end;

Event signature:

[IntegrationEvent(false, false)]
  local procedure OnBeforePrepareTempVendLedgEntry(var VendorLedgerEntry: Record "Vendor Ledger Entry"; var TempVendorLedgerEntry: Record "Vendor Ledger Entry" temporary; Vendor: Record Vendor; var IsHandled: Boolean)
  begin
  end;

Additional context

These events are useful for anyone who wants to filter or modify the filters on the Ledger Entries before executing the logic.
Internal work item: AB#538784

@JesperSchulz JesperSchulz added event-request Request for adding an event SCM GitHub request for SCM area ships-in-future-update Fix ships in a future update labels Jun 18, 2024
@JesperSchulz
Copy link
Contributor

Thanks for reporting this. We agree, and we’ll publish a fix asap, either in an update for the current version or in the next major release. Please do not reply to this, as we do not monitor closed issues. If you have follow-up questions or requests, please create a new issue where you reference this one.

Build ID: 21140.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
event-request Request for adding an event SCM GitHub request for SCM area ships-in-future-update Fix ships in a future update
Projects
None yet
Development

No branches or pull requests

2 participants