R28499 AccountingVoucher - Recalculate Correspondant Amounts

Code R28499
Entity Finance.Accounting.AccountingVouchers Entity
Name RecalculateCorrespondantAmounts
Attribute CorrespondantAmount
Layer Back-End
Events Planning +
Priority Normal
Modify YES
Action

For every voucher line, the CorrespondantAmount is calculated as follows:

  1. The lines of each correspondence are divided into two lists "CorrespondanceDebitRows" and "CorrespondanceCreditRows" following these steps:

    - divide all non-zero rows into these lists, depending on whether (VoucherLine.Debit != 0 && VoucherLine.DebitBase != 0) OR (VoucherLine.Credit != 0 && VoucherLine.CreditBase != 0);

    - divide all zero lines (if any) according to the clauses:

    -- if in the correspondence (VoucherLines(VoucherLine.Debit != 0 &&  VoucherLine.DebitBase != 0).Count() == 0 || 1) - then the zero line is counted as credit;

    -- else if (VoucherLines(VoucherLine.Debit != 0 &&  VoucherLine.DebitBase != 0).Count() > 1), the zero line is also counted as debit.





    2. Calculate CorrespondantAmount:

    - if the correspondence's relationship is one-to-one, then in each of the two lines in the "VoucherLine.CorrespondantAmount = corresponding CreditAmount OR DebitAmount" of the other line, depending on its type.

    - else if the correspondence is one-to-many:

    -- a NULL value is set as a CorrespondantAmount for the single line;

    -- for the rest of the lines (the many) -- as a CorrespondantAmount is set the amount (credit or debit) of the current line converted to the currency of the "single line". The single-line amount has to be fully distributed between the rest of the lines. If there is a remainder because of the rounding, it is added in the CorrespondantAmount of the line with Max(Abs(CorrespondantAmount) so far, for more details, can be seen the RecalculateCorrespondantAmounts method of the entity Acc_Vouchers.
Description The field Correspondant Amount contains the amount or a part of the amount of the voucher line (in the currency of the corresponding line) to which the amount in this line is corresponding. This field has value only when the current line is corresponding to only one line (e.g. null means that the current line is corresponding to many lines).



The calculation is made in advance (when changing the state of the document). The result is stored in the Correspondant Amount and it is later used for the calculations of General Ledger and Correspondant Chronology reports.
Message -
Introduced In Version

2018.1



Revocable NO

* For more information about the Business Rules Documentation Template and a short explanation of each column, see topic System Business Rules.