diff --git a/src/Layers/APAC/BaseApp/Bank/Check/CheckManagement.Codeunit.al b/src/Layers/APAC/BaseApp/Bank/Check/CheckManagement.Codeunit.al
index b0626937079..7c6ca14dd4a 100644
--- a/src/Layers/APAC/BaseApp/Bank/Check/CheckManagement.Codeunit.al
+++ b/src/Layers/APAC/BaseApp/Bank/Check/CheckManagement.Codeunit.al
@@ -284,13 +284,38 @@ codeunit 367 CheckManagement
GenJnlLine2.Validate("Currency Code", BankAcc."Currency Code");
GenJnlLine2."Allow Zero-Amount Posting" := true;
OnFinancialVoidCheckOnBeforeCheckBalAccountType(GenJnlLine2, CheckLedgEntry, BankAccLedgEntry3);
+ IsHandled := false;
+ OnFinancialVoidCheckOnBeforePostBalanceAccount(GenJnlLine2, CheckLedgEntry, BankAccLedgEntry3, BalanceAmountLCY, IsHandled);
+ if not IsHandled then
+ FinancialVoidPostBalanceAccount(CheckLedgEntry, ConfirmFinancialVoid.GetVoidType(), ConfirmFinancialVoid.GetVoidDate(), BalanceAmountLCY);
+
+ if ConfirmFinancialVoid.GetVoidDate() = CheckLedgEntry."Check Date" then begin
+ BankAccLedgEntry2.Open := false;
+ BankAccLedgEntry2."Remaining Amount" := 0;
+ BankAccLedgEntry2."Statement Status" := BankAccLedgEntry2."Statement Status"::Closed;
+ BankAccLedgEntry2.Modify();
+ end;
+
+ // rounding error from currency conversion
+ if CheckAmountLCY + BalanceAmountLCY <> 0 then
+ PostRoundingAmount(BankAcc, CheckLedgEntry, ConfirmFinancialVoid.GetVoidDate(), -(CheckAmountLCY + BalanceAmountLCY));
+
+ MarkCheckEntriesVoid(CheckLedgEntry, ConfirmFinancialVoid.GetVoidDate());
+ Commit();
+ UpdateAnalysisView.UpdateAll(0, true);
+
+ OnAfterFinancialVoidCheck(CheckLedgEntry);
+ end;
+
+ local procedure FinancialVoidPostBalanceAccount(var CheckLedgEntry: Record "Check Ledger Entry"; VoidType: Integer; VoidDate: Date; var BalanceAmountLCY: Decimal)
+ begin
case CheckLedgEntry."Bal. Account Type" of
CheckLedgEntry."Bal. Account Type"::"G/L Account":
FinancialVoidPostGLAccount(GenJnlLine2, BankAccLedgEntry2, CheckLedgEntry, BalanceAmountLCY);
CheckLedgEntry."Bal. Account Type"::Customer:
begin
- if ConfirmFinancialVoid.GetVoidType() = 0 then // Unapply entry
- if UnApplyCustInvoices(CheckLedgEntry, ConfirmFinancialVoid.GetVoidDate()) then
+ if VoidType = 0 then // Unapply entry
+ if UnApplyCustInvoices(CheckLedgEntry, VoidDate) then
GenJnlLine2."Applies-to ID" := CheckLedgEntry."Document No.";
CustLedgEntry.SetCurrentKey("Transaction No.");
CustLedgEntry.SetRange("Transaction No.", BankAccLedgEntry2."Transaction No.");
@@ -313,8 +338,8 @@ codeunit 367 CheckManagement
end;
CheckLedgEntry."Bal. Account Type"::Vendor:
begin
- if ConfirmFinancialVoid.GetVoidType() = 0 then // Unapply entry
- if UnApplyVendInvoices(CheckLedgEntry, ConfirmFinancialVoid.GetVoidDate()) then
+ if VoidType = 0 then // Unapply entry
+ if UnApplyVendInvoices(CheckLedgEntry, VoidDate) then
GenJnlLine2."Applies-to ID" := CheckLedgEntry."Document No.";
VendorLedgEntry.SetCurrentKey("Transaction No.");
VendorLedgEntry.SetRange("Transaction No.", BankAccLedgEntry2."Transaction No.");
@@ -394,8 +419,8 @@ codeunit 367 CheckManagement
end;
CheckLedgEntry."Bal. Account Type"::Employee:
begin
- if ConfirmFinancialVoid.GetVoidType() = 0 then // Unapply entry
- if UnApplyEmpInvoices(CheckLedgEntry, ConfirmFinancialVoid.GetVoidDate()) then
+ if VoidType = 0 then // Unapply entry
+ if UnApplyEmpInvoices(CheckLedgEntry, VoidDate) then
GenJnlLine2."Applies-to ID" := CheckLedgEntry."Document No.";
EmployeeLedgerEntry.SetCurrentKey("Transaction No.");
EmployeeLedgerEntry.SetRange("Transaction No.", BankAccLedgEntry2."Transaction No.");
@@ -429,23 +454,6 @@ codeunit 367 CheckManagement
OnFinancialVoidCheckOnAfterPostBalAccLine(GenJnlLine2, CheckLedgEntry, GenJnlPostLine);
end;
end;
-
- if ConfirmFinancialVoid.GetVoidDate() = CheckLedgEntry."Check Date" then begin
- BankAccLedgEntry2.Open := false;
- BankAccLedgEntry2."Remaining Amount" := 0;
- BankAccLedgEntry2."Statement Status" := BankAccLedgEntry2."Statement Status"::Closed;
- BankAccLedgEntry2.Modify();
- end;
-
- // rounding error from currency conversion
- if CheckAmountLCY + BalanceAmountLCY <> 0 then
- PostRoundingAmount(BankAcc, CheckLedgEntry, ConfirmFinancialVoid.GetVoidDate(), -(CheckAmountLCY + BalanceAmountLCY));
-
- MarkCheckEntriesVoid(CheckLedgEntry, ConfirmFinancialVoid.GetVoidDate());
- Commit();
- UpdateAnalysisView.UpdateAll(0, true);
-
- OnAfterFinancialVoidCheck(CheckLedgEntry);
end;
procedure GenJournalLineGetSystemIdFromRecordId(GenJournalLineRecordId: RecordId): Guid
@@ -1216,6 +1224,23 @@ codeunit 367 CheckManagement
begin
end;
+ ///
+ /// Integration event raised before posting the balance account entries during a financial void operation.
+ /// Enables subscribers to replace the standard balance account type posting.
+ ///
+ /// General journal line for the void operation
+ /// Check ledger entry being voided
+ /// Bank account ledger entry associated with the check
+ /// Running balancing amount in LCY. A subscriber that sets IsHandled must add the LCY amounts it posts so the caller's currency-rounding calculation stays balanced.
+ /// Set to true to skip the standard balance account type posting
+ ///
+ /// Raised from FinancialVoidCheck procedure after OnFinancialVoidCheckOnBeforeCheckBalAccountType and before the balance account type posting.
+ ///
+ [IntegrationEvent(false, false)]
+ local procedure OnFinancialVoidCheckOnBeforePostBalanceAccount(var GenJournalLine: Record "Gen. Journal Line"; var CheckLedgerEntry: Record "Check Ledger Entry"; var BankAccountLedgerEntry: Record "Bank Account Ledger Entry"; var BalanceAmountLCY: Decimal; var IsHandled: Boolean)
+ begin
+ end;
+
///
/// Integration event raised before posting bank account entries during financial void operation.
/// Enables custom processing or validation before bank account ledger entries are posted.
diff --git a/src/Layers/NA/BaseApp/Bank/Check/CheckManagement.Codeunit.al b/src/Layers/NA/BaseApp/Bank/Check/CheckManagement.Codeunit.al
index 63920f33f04..0eac22b05b2 100644
--- a/src/Layers/NA/BaseApp/Bank/Check/CheckManagement.Codeunit.al
+++ b/src/Layers/NA/BaseApp/Bank/Check/CheckManagement.Codeunit.al
@@ -260,13 +260,38 @@ codeunit 367 CheckManagement
GenJnlLine2.Validate("Currency Code", BankAcc."Currency Code");
GenJnlLine2."Allow Zero-Amount Posting" := true;
OnFinancialVoidCheckOnBeforeCheckBalAccountType(GenJnlLine2, CheckLedgEntry, BankAccLedgEntry3);
+ IsHandled := false;
+ OnFinancialVoidCheckOnBeforePostBalanceAccount(GenJnlLine2, CheckLedgEntry, BankAccLedgEntry3, BalanceAmountLCY, IsHandled);
+ if not IsHandled then
+ FinancialVoidPostBalanceAccount(CheckLedgEntry, ConfirmFinancialVoid.GetVoidType(), ConfirmFinancialVoid.GetVoidDate(), BalanceAmountLCY);
+
+ if ConfirmFinancialVoid.GetVoidDate() = CheckLedgEntry."Check Date" then begin
+ BankAccLedgEntry2.Open := false;
+ BankAccLedgEntry2."Remaining Amount" := 0;
+ BankAccLedgEntry2."Statement Status" := BankAccLedgEntry2."Statement Status"::Closed;
+ BankAccLedgEntry2.Modify();
+ end;
+
+ // rounding error from currency conversion
+ if CheckAmountLCY + BalanceAmountLCY <> 0 then
+ PostRoundingAmount(BankAcc, CheckLedgEntry, ConfirmFinancialVoid.GetVoidDate(), -(CheckAmountLCY + BalanceAmountLCY));
+
+ MarkCheckEntriesVoid(CheckLedgEntry, ConfirmFinancialVoid.GetVoidDate());
+ Commit();
+ UpdateAnalysisView.UpdateAll(0, true);
+
+ OnAfterFinancialVoidCheck(CheckLedgEntry);
+ end;
+
+ local procedure FinancialVoidPostBalanceAccount(var CheckLedgEntry: Record "Check Ledger Entry"; VoidType: Integer; VoidDate: Date; var BalanceAmountLCY: Decimal)
+ begin
case CheckLedgEntry."Bal. Account Type" of
CheckLedgEntry."Bal. Account Type"::"G/L Account":
FinancialVoidPostGLAccount(GenJnlLine2, BankAccLedgEntry2, CheckLedgEntry, BalanceAmountLCY);
CheckLedgEntry."Bal. Account Type"::Customer:
begin
- if ConfirmFinancialVoid.GetVoidType() = 0 then // Unapply entry
- if UnApplyCustInvoices(CheckLedgEntry, ConfirmFinancialVoid.GetVoidDate()) then
+ if VoidType = 0 then // Unapply entry
+ if UnApplyCustInvoices(CheckLedgEntry, VoidDate) then
GenJnlLine2."Applies-to ID" := CheckLedgEntry."Document No.";
CustLedgEntry.SetCurrentKey(CustLedgEntry."Transaction No.");
CustLedgEntry.SetRange(CustLedgEntry."Transaction No.", BankAccLedgEntry2."Transaction No.");
@@ -295,8 +320,8 @@ codeunit 367 CheckManagement
end;
CheckLedgEntry."Bal. Account Type"::Vendor:
begin
- if ConfirmFinancialVoid.GetVoidType() = 0 then // Unapply entry
- if UnApplyVendInvoices(CheckLedgEntry, ConfirmFinancialVoid.GetVoidDate()) then
+ if VoidType = 0 then // Unapply entry
+ if UnApplyVendInvoices(CheckLedgEntry, VoidDate) then
GenJnlLine2."Applies-to ID" := CheckLedgEntry."Document No.";
VendorLedgEntry.SetCurrentKey(VendorLedgEntry."Transaction No.");
VendorLedgEntry.SetRange(VendorLedgEntry."Transaction No.", BankAccLedgEntry2."Transaction No.");
@@ -371,8 +396,8 @@ codeunit 367 CheckManagement
end;
CheckLedgEntry."Bal. Account Type"::Employee:
begin
- if ConfirmFinancialVoid.GetVoidType() = 0 then // Unapply entry
- if UnApplyEmpInvoices(CheckLedgEntry, ConfirmFinancialVoid.GetVoidDate()) then
+ if VoidType = 0 then // Unapply entry
+ if UnApplyEmpInvoices(CheckLedgEntry, VoidDate) then
GenJnlLine2."Applies-to ID" := CheckLedgEntry."Document No.";
EmployeeLedgerEntry.SetCurrentKey("Transaction No.");
EmployeeLedgerEntry.SetRange("Transaction No.", BankAccLedgEntry2."Transaction No.");
@@ -406,23 +431,6 @@ codeunit 367 CheckManagement
OnFinancialVoidCheckOnAfterPostBalAccLine(GenJnlLine2, CheckLedgEntry, GenJnlPostLine);
end;
end;
-
- if ConfirmFinancialVoid.GetVoidDate() = CheckLedgEntry."Check Date" then begin
- BankAccLedgEntry2.Open := false;
- BankAccLedgEntry2."Remaining Amount" := 0;
- BankAccLedgEntry2."Statement Status" := BankAccLedgEntry2."Statement Status"::Closed;
- BankAccLedgEntry2.Modify();
- end;
-
- // rounding error from currency conversion
- if CheckAmountLCY + BalanceAmountLCY <> 0 then
- PostRoundingAmount(BankAcc, CheckLedgEntry, ConfirmFinancialVoid.GetVoidDate(), -(CheckAmountLCY + BalanceAmountLCY));
-
- MarkCheckEntriesVoid(CheckLedgEntry, ConfirmFinancialVoid.GetVoidDate());
- Commit();
- UpdateAnalysisView.UpdateAll(0, true);
-
- OnAfterFinancialVoidCheck(CheckLedgEntry);
end;
procedure GenJournalLineGetSystemIdFromRecordId(GenJournalLineRecordId: RecordId): Guid
@@ -1189,6 +1197,23 @@ codeunit 367 CheckManagement
begin
end;
+ ///
+ /// Integration event raised before posting the balance account entries during a financial void operation.
+ /// Enables subscribers to replace the standard balance account type posting.
+ ///
+ /// General journal line for the void operation
+ /// Check ledger entry being voided
+ /// Bank account ledger entry associated with the check
+ /// Running balancing amount in LCY. A subscriber that sets IsHandled must add the LCY amounts it posts so the caller's currency-rounding calculation stays balanced.
+ /// Set to true to skip the standard balance account type posting
+ ///
+ /// Raised from FinancialVoidCheck procedure after OnFinancialVoidCheckOnBeforeCheckBalAccountType and before the balance account type posting.
+ ///
+ [IntegrationEvent(false, false)]
+ local procedure OnFinancialVoidCheckOnBeforePostBalanceAccount(var GenJournalLine: Record "Gen. Journal Line"; var CheckLedgerEntry: Record "Check Ledger Entry"; var BankAccountLedgerEntry: Record "Bank Account Ledger Entry"; var BalanceAmountLCY: Decimal; var IsHandled: Boolean)
+ begin
+ end;
+
///
/// Integration event raised before posting bank account entries during financial void operation.
/// Enables custom processing or validation before bank account ledger entries are posted.
diff --git a/src/Layers/RU/BaseApp/Bank/Check/CheckManagement.Codeunit.al b/src/Layers/RU/BaseApp/Bank/Check/CheckManagement.Codeunit.al
index 61c83653173..910a6ecb838 100644
--- a/src/Layers/RU/BaseApp/Bank/Check/CheckManagement.Codeunit.al
+++ b/src/Layers/RU/BaseApp/Bank/Check/CheckManagement.Codeunit.al
@@ -266,13 +266,38 @@ codeunit 367 CheckManagement
GenJnlLine2."Allow Zero-Amount Posting" := true;
CheckUnpostedVendor(CheckLedgEntry, GenJnlLine2);
OnFinancialVoidCheckOnBeforeCheckBalAccountType(GenJnlLine2, CheckLedgEntry, BankAccLedgEntry3);
+ IsHandled := false;
+ OnFinancialVoidCheckOnBeforePostBalanceAccount(GenJnlLine2, CheckLedgEntry, BankAccLedgEntry3, BalanceAmountLCY, IsHandled);
+ if not IsHandled then
+ FinancialVoidPostBalanceAccount(CheckLedgEntry, ConfirmFinancialVoid.GetVoidType(), ConfirmFinancialVoid.GetVoidDate(), BalanceAmountLCY);
+
+ if ConfirmFinancialVoid.GetVoidDate() = CheckLedgEntry."Check Date" then begin
+ BankAccLedgEntry2.Open := false;
+ BankAccLedgEntry2."Remaining Amount" := 0;
+ BankAccLedgEntry2."Statement Status" := BankAccLedgEntry2."Statement Status"::Closed;
+ BankAccLedgEntry2.Modify();
+ end;
+
+ // rounding error from currency conversion
+ if CheckAmountLCY + BalanceAmountLCY <> 0 then
+ PostRoundingAmount(BankAcc, CheckLedgEntry, ConfirmFinancialVoid.GetVoidDate(), -(CheckAmountLCY + BalanceAmountLCY));
+
+ MarkCheckEntriesVoid(CheckLedgEntry, ConfirmFinancialVoid.GetVoidDate());
+ Commit();
+ UpdateAnalysisView.UpdateAll(0, true);
+
+ OnAfterFinancialVoidCheck(CheckLedgEntry);
+ end;
+
+ local procedure FinancialVoidPostBalanceAccount(var CheckLedgEntry: Record "Check Ledger Entry"; VoidType: Integer; VoidDate: Date; var BalanceAmountLCY: Decimal)
+ begin
case CheckLedgEntry."Bal. Account Type" of
CheckLedgEntry."Bal. Account Type"::"G/L Account":
FinancialVoidPostGLAccount(GenJnlLine2, BankAccLedgEntry2, CheckLedgEntry, BalanceAmountLCY);
CheckLedgEntry."Bal. Account Type"::Customer:
begin
- if ConfirmFinancialVoid.GetVoidType() = 0 then // Unapply entry
- if UnApplyCustInvoices(CheckLedgEntry, ConfirmFinancialVoid.GetVoidDate()) then
+ if VoidType = 0 then // Unapply entry
+ if UnApplyCustInvoices(CheckLedgEntry, VoidDate) then
GenJnlLine2."Applies-to ID" := CheckLedgEntry."Document No.";
CustLedgEntry.SetCurrentKey("Transaction No.");
CustLedgEntry.SetRange("Transaction No.", BankAccLedgEntry2."Transaction No.");
@@ -300,8 +325,8 @@ codeunit 367 CheckManagement
end;
CheckLedgEntry."Bal. Account Type"::Vendor:
begin
- if ConfirmFinancialVoid.GetVoidType() = 0 then // Unapply entry
- if UnApplyVendInvoices(CheckLedgEntry, ConfirmFinancialVoid.GetVoidDate()) then
+ if VoidType = 0 then // Unapply entry
+ if UnApplyVendInvoices(CheckLedgEntry, VoidDate) then
GenJnlLine2."Applies-to ID" := CheckLedgEntry."Document No.";
VendorLedgEntry.SetCurrentKey("Transaction No.");
VendorLedgEntry.SetRange("Transaction No.", BankAccLedgEntry2."Transaction No.");
@@ -379,8 +404,8 @@ codeunit 367 CheckManagement
end;
CheckLedgEntry."Bal. Account Type"::Employee:
begin
- if ConfirmFinancialVoid.GetVoidType() = 0 then // Unapply entry
- if UnApplyEmpInvoices(CheckLedgEntry, ConfirmFinancialVoid.GetVoidDate()) then
+ if VoidType = 0 then // Unapply entry
+ if UnApplyEmpInvoices(CheckLedgEntry, VoidDate) then
GenJnlLine2."Applies-to ID" := CheckLedgEntry."Document No.";
EmployeeLedgerEntry.SetCurrentKey("Transaction No.");
EmployeeLedgerEntry.SetRange("Transaction No.", BankAccLedgEntry2."Transaction No.");
@@ -414,23 +439,6 @@ codeunit 367 CheckManagement
OnFinancialVoidCheckOnAfterPostBalAccLine(GenJnlLine2, CheckLedgEntry, GenJnlPostLine);
end;
end;
-
- if ConfirmFinancialVoid.GetVoidDate() = CheckLedgEntry."Check Date" then begin
- BankAccLedgEntry2.Open := false;
- BankAccLedgEntry2."Remaining Amount" := 0;
- BankAccLedgEntry2."Statement Status" := BankAccLedgEntry2."Statement Status"::Closed;
- BankAccLedgEntry2.Modify();
- end;
-
- // rounding error from currency conversion
- if CheckAmountLCY + BalanceAmountLCY <> 0 then
- PostRoundingAmount(BankAcc, CheckLedgEntry, ConfirmFinancialVoid.GetVoidDate(), -(CheckAmountLCY + BalanceAmountLCY));
-
- MarkCheckEntriesVoid(CheckLedgEntry, ConfirmFinancialVoid.GetVoidDate());
- Commit();
- UpdateAnalysisView.UpdateAll(0, true);
-
- OnAfterFinancialVoidCheck(CheckLedgEntry);
end;
procedure GenJournalLineGetSystemIdFromRecordId(GenJournalLineRecordId: RecordId): Guid
@@ -1257,6 +1265,23 @@ codeunit 367 CheckManagement
begin
end;
+ ///
+ /// Integration event raised before posting the balance account entries during a financial void operation.
+ /// Enables subscribers to replace the standard balance account type posting.
+ ///
+ /// General journal line for the void operation
+ /// Check ledger entry being voided
+ /// Bank account ledger entry associated with the check
+ /// Running balancing amount in LCY. A subscriber that sets IsHandled must add the LCY amounts it posts so the caller's currency-rounding calculation stays balanced.
+ /// Set to true to skip the standard balance account type posting
+ ///
+ /// Raised from FinancialVoidCheck procedure after OnFinancialVoidCheckOnBeforeCheckBalAccountType and before the balance account type posting.
+ ///
+ [IntegrationEvent(false, false)]
+ local procedure OnFinancialVoidCheckOnBeforePostBalanceAccount(var GenJournalLine: Record "Gen. Journal Line"; var CheckLedgerEntry: Record "Check Ledger Entry"; var BankAccountLedgerEntry: Record "Bank Account Ledger Entry"; var BalanceAmountLCY: Decimal; var IsHandled: Boolean)
+ begin
+ end;
+
///
/// Integration event raised before posting bank account entries during financial void operation.
/// Enables custom processing or validation before bank account ledger entries are posted.
diff --git a/src/Layers/W1/BaseApp/Bank/Check/CheckManagement.Codeunit.al b/src/Layers/W1/BaseApp/Bank/Check/CheckManagement.Codeunit.al
index 9c70c5a73a0..a278d18c484 100644
--- a/src/Layers/W1/BaseApp/Bank/Check/CheckManagement.Codeunit.al
+++ b/src/Layers/W1/BaseApp/Bank/Check/CheckManagement.Codeunit.al
@@ -253,13 +253,38 @@ codeunit 367 CheckManagement
GenJnlLine2.Validate("Currency Code", BankAcc."Currency Code");
GenJnlLine2."Allow Zero-Amount Posting" := true;
OnFinancialVoidCheckOnBeforeCheckBalAccountType(GenJnlLine2, CheckLedgEntry, BankAccLedgEntry3);
+ IsHandled := false;
+ OnFinancialVoidCheckOnBeforePostBalanceAccount(GenJnlLine2, CheckLedgEntry, BankAccLedgEntry3, BalanceAmountLCY, IsHandled);
+ if not IsHandled then
+ FinancialVoidPostBalanceAccount(CheckLedgEntry, ConfirmFinancialVoid.GetVoidType(), ConfirmFinancialVoid.GetVoidDate(), BalanceAmountLCY);
+
+ if ConfirmFinancialVoid.GetVoidDate() = CheckLedgEntry."Check Date" then begin
+ BankAccLedgEntry2.Open := false;
+ BankAccLedgEntry2."Remaining Amount" := 0;
+ BankAccLedgEntry2."Statement Status" := BankAccLedgEntry2."Statement Status"::Closed;
+ BankAccLedgEntry2.Modify();
+ end;
+
+ // rounding error from currency conversion
+ if CheckAmountLCY + BalanceAmountLCY <> 0 then
+ PostRoundingAmount(BankAcc, CheckLedgEntry, ConfirmFinancialVoid.GetVoidDate(), -(CheckAmountLCY + BalanceAmountLCY));
+
+ MarkCheckEntriesVoid(CheckLedgEntry, ConfirmFinancialVoid.GetVoidDate());
+ Commit();
+ UpdateAnalysisView.UpdateAll(0, true);
+
+ OnAfterFinancialVoidCheck(CheckLedgEntry);
+ end;
+
+ local procedure FinancialVoidPostBalanceAccount(var CheckLedgEntry: Record "Check Ledger Entry"; VoidType: Integer; VoidDate: Date; var BalanceAmountLCY: Decimal)
+ begin
case CheckLedgEntry."Bal. Account Type" of
CheckLedgEntry."Bal. Account Type"::"G/L Account":
FinancialVoidPostGLAccount(GenJnlLine2, BankAccLedgEntry2, CheckLedgEntry, BalanceAmountLCY);
CheckLedgEntry."Bal. Account Type"::Customer:
begin
- if ConfirmFinancialVoid.GetVoidType() = 0 then // Unapply entry
- if UnApplyCustInvoices(CheckLedgEntry, ConfirmFinancialVoid.GetVoidDate()) then
+ if VoidType = 0 then // Unapply entry
+ if UnApplyCustInvoices(CheckLedgEntry, VoidDate) then
GenJnlLine2."Applies-to ID" := CheckLedgEntry."Document No.";
CustLedgEntry.SetCurrentKey("Transaction No.");
CustLedgEntry.SetRange("Transaction No.", BankAccLedgEntry2."Transaction No.");
@@ -282,8 +307,8 @@ codeunit 367 CheckManagement
end;
CheckLedgEntry."Bal. Account Type"::Vendor:
begin
- if ConfirmFinancialVoid.GetVoidType() = 0 then // Unapply entry
- if UnApplyVendInvoices(CheckLedgEntry, ConfirmFinancialVoid.GetVoidDate()) then
+ if VoidType = 0 then // Unapply entry
+ if UnApplyVendInvoices(CheckLedgEntry, VoidDate) then
GenJnlLine2."Applies-to ID" := CheckLedgEntry."Document No.";
VendorLedgEntry.SetCurrentKey("Transaction No.");
VendorLedgEntry.SetRange("Transaction No.", BankAccLedgEntry2."Transaction No.");
@@ -352,8 +377,8 @@ codeunit 367 CheckManagement
end;
CheckLedgEntry."Bal. Account Type"::Employee:
begin
- if ConfirmFinancialVoid.GetVoidType() = 0 then // Unapply entry
- if UnApplyEmpInvoices(CheckLedgEntry, ConfirmFinancialVoid.GetVoidDate()) then
+ if VoidType = 0 then // Unapply entry
+ if UnApplyEmpInvoices(CheckLedgEntry, VoidDate) then
GenJnlLine2."Applies-to ID" := CheckLedgEntry."Document No.";
EmployeeLedgerEntry.SetCurrentKey("Transaction No.");
EmployeeLedgerEntry.SetRange("Transaction No.", BankAccLedgEntry2."Transaction No.");
@@ -387,23 +412,6 @@ codeunit 367 CheckManagement
OnFinancialVoidCheckOnAfterPostBalAccLine(GenJnlLine2, CheckLedgEntry, GenJnlPostLine);
end;
end;
-
- if ConfirmFinancialVoid.GetVoidDate() = CheckLedgEntry."Check Date" then begin
- BankAccLedgEntry2.Open := false;
- BankAccLedgEntry2."Remaining Amount" := 0;
- BankAccLedgEntry2."Statement Status" := BankAccLedgEntry2."Statement Status"::Closed;
- BankAccLedgEntry2.Modify();
- end;
-
- // rounding error from currency conversion
- if CheckAmountLCY + BalanceAmountLCY <> 0 then
- PostRoundingAmount(BankAcc, CheckLedgEntry, ConfirmFinancialVoid.GetVoidDate(), -(CheckAmountLCY + BalanceAmountLCY));
-
- MarkCheckEntriesVoid(CheckLedgEntry, ConfirmFinancialVoid.GetVoidDate());
- Commit();
- UpdateAnalysisView.UpdateAll(0, true);
-
- OnAfterFinancialVoidCheck(CheckLedgEntry);
end;
procedure GenJournalLineGetSystemIdFromRecordId(GenJournalLineRecordId: RecordId): Guid
@@ -1150,6 +1158,23 @@ codeunit 367 CheckManagement
begin
end;
+ ///
+ /// Integration event raised before posting the balance account entries during a financial void operation.
+ /// Enables subscribers to replace the standard balance account type posting.
+ ///
+ /// General journal line for the void operation
+ /// Check ledger entry being voided
+ /// Bank account ledger entry associated with the check
+ /// Running balancing amount in LCY. A subscriber that sets IsHandled must add the LCY amounts it posts so the caller's currency-rounding calculation stays balanced.
+ /// Set to true to skip the standard balance account type posting
+ ///
+ /// Raised from FinancialVoidCheck procedure after OnFinancialVoidCheckOnBeforeCheckBalAccountType and before the balance account type posting.
+ ///
+ [IntegrationEvent(false, false)]
+ local procedure OnFinancialVoidCheckOnBeforePostBalanceAccount(var GenJournalLine: Record "Gen. Journal Line"; var CheckLedgerEntry: Record "Check Ledger Entry"; var BankAccountLedgerEntry: Record "Bank Account Ledger Entry"; var BalanceAmountLCY: Decimal; var IsHandled: Boolean)
+ begin
+ end;
+
///
/// Integration event raised before posting bank account entries during financial void operation.
/// Enables custom processing or validation before bank account ledger entries are posted.