You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
local procedure ApplyCustomerLedgerEntry(var GenJnlLine: Record "Gen. Journal Line")
var
CustLedgEntry: Record "Cust. Ledger Entry";
TempCustLedgEntry: Record "Cust. Ledger Entry" temporary;
AppliedAmount: Decimal;
CustomAppliesToId: Code[50];
IsHandled: Boolean;
begin
GetAppliedCustomerEntries(TempCustLedgEntry, GenJnlLine);
EntrySelected := SelectCustLedgEntry(GenJnlLine, CustomAppliesToId);
if not EntrySelected then
exit;
CustLedgEntry.Reset();
CustLedgEntry.SetCurrentKey("Customer No.", Open, Positive);
CustLedgEntry.SetRange("Customer No.", AccNo);
CustLedgEntry.SetRange(Open, true);
CustLedgEntry.SetRange("Applies-to ID", GenJnlLine."Applies-to ID");
OnAfterCustLedgEntrySetFilters(CustLedgEntry, GenJnlLine, AccNo);
if CustLedgEntry.Find('-') then begin
CurrencyCode2 := CustLedgEntry."Currency Code";
if GenJnlLine.Amount = 0 then begin
repeat
if not TempCustLedgEntry.Get(CustLedgEntry."Entry No.") then begin
PaymentToleranceMgt.DelPmtTolApllnDocNo(GenJnlLine, CustLedgEntry."Document No.");
OnApplyCustomerLedgerEntryOnBeforeCheckAgainstApplnCurrency(GenJnlLine, CustLedgEntry);
CheckAgainstApplnCurrency(CurrencyCode2, CustLedgEntry."Currency Code", AccType::Customer, true);
UpdateCustLedgEntry(CustLedgEntry);
IsHandled := false;
OnBeforeFindCustApply(GenJnlLine, CustLedgEntry, GenJnlLine.Amount, IsHandled);
if not IsHandled then
if PaymentToleranceMgt.CheckCalcPmtDiscGenJnlCust(GenJnlLine, CustLedgEntry, 0, false) and
(Abs(CustLedgEntry."Amount to Apply") >=
Abs(CustLedgEntry."Remaining Amount" - CustLedgEntry.GetRemainingPmtDiscPossible(GenJnlLine."Posting Date")))
then
GenJnlLine.Amount := GenJnlLine.Amount - (CustLedgEntry."Amount to Apply" - CustLedgEntry.GetRemainingPmtDiscPossible(GenJnlLine."Posting Date"))
else
GenJnlLine.Amount := GenJnlLine.Amount - CustLedgEntry."Amount to Apply";
end else
GetAppliedAmountOnCustLedgerEntry(TempCustLedgEntry, AppliedAmount);
until CustLedgEntry.Next() = 0;
TempCustLedgEntry.DeleteAll();
if AppliedAmount <> 0 then
GenJnlLine.Amount += AppliedAmount;
if (GenJnlLine."Bal. Account Type" = GenJnlLine."Bal. Account Type"::Customer) or (GenJnlLine."Bal. Account Type" = GenJnlLine."Bal. Account Type"::Vendor) then
GenJnlLine.Amount := -GenJnlLine.Amount;
GenJnlLine.Validate(Amount);
//-----------------------------------------------OnApplyCustomerLedgerEntryOnAfterValidateAmount:BEGIN
OnApplyCustomerLedgerEntryOnAfterValidateAmount(GenJnlLine, CustLedgEntry);
//-----------------------------------------------OnApplyCustomerLedgerEntryOnAfterValidateAmount:END
end else
repeat
OnApplyCustomerLedgerEntryOnBeforeCheckAgainstApplnCurrencyCustomerAmountNotZero(GenJnlLine, CustLedgEntry);
CheckAgainstApplnCurrency(CurrencyCode2, CustLedgEntry."Currency Code", AccType::Customer, true);
until CustLedgEntry.Next() = 0;
if GenJnlLine."Currency Code" <> CurrencyCode2 then
if GenJnlLine.Amount = 0 then begin
IsHandled := false;
OnApplyCustomerLedgerEntryOnBeforeConfirmUpdateCurrency(GenJnlLine, CustLedgEntry."Currency Code", IsHandled);
if not IsHandled then begin
ConfirmCurrencyUpdate(GenJnlLine, CustLedgEntry."Currency Code");
GenJnlLine."Currency Code" := CustLedgEntry."Currency Code";
end;
end else begin
OnApplyCustomerLedgerEntryOnBeforeCheckAgainstApplnCurrencyCustomer(GenJnlLine, CustLedgEntry);
CheckAgainstApplnCurrency(GenJnlLine."Currency Code", CustLedgEntry."Currency Code", AccType::Customer, true);
end;
GenJnlLine."Applies-to Doc. Type" := GenJnlLine."Applies-to Doc. Type"::" ";
GenJnlLine."Applies-to Doc. No." := '';
OnApplyCustomerLedgerEntryOnAfterSetCustomerAppliesToDocNo(GenJnlLine, CustLedgEntry);
end else
GenJnlLine."Applies-to ID" := '';
if (GenJnlLine."Applies-to ID" = '') and (CustomAppliesToId <> '') then
GenJnlLine."Applies-to ID" := CustomAppliesToId;
GenJnlLine.SetJournalLineFieldsFromApplication();
OnApplyCustomerLedgerEntryOnBeforeModify(GenJnlLine, CustLedgEntry);
if GenJnlLine.Modify() then;
if GenJnlLine.Amount <> 0 then
if not PaymentToleranceMgt.PmtTolGenJnl(GenJnlLine) then
exit;
end;
//-----------------------------------------------OnApplyCustomerLedgerEntryOnAfterValidateAmount:BEGIN
[IntegrationEvent(true, false)]
local procedure OnApplyCustomerLedgerEntryOnAfterValidateAmount(var GenJnlLine: Record "Gen. Journal Line"; var CustLedgEntry: Record "Cust. Ledger Entry")
begin
end;
//-----------------------------------------------OnApplyCustomerLedgerEntryOnAfterValidateAmount:END
Additional context
We need work with Customer Ledger Entry and Gen. Journal Line after apply.
Internal work item: AB#562609
The text was updated successfully, but these errors were encountered:
Describe the request
Please add new parameter to event
Additional context
We need work with Customer Ledger Entry and Gen. Journal Line after apply.
Internal work item: AB#562609
The text was updated successfully, but these errors were encountered: