Skip to content

Commit 13bd8cb

Browse files
committed
Add documentation for reconciliation related Workflow classes
1 parent b7d8b49 commit 13bd8cb

File tree

2 files changed

+97
-0
lines changed

2 files changed

+97
-0
lines changed

lib/LedgerSMB/Workflow/Action/Reconciliation.pm

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,41 @@ LedgerSMB::Workflow::Action::Reconciliation - Collection of actions for reconcil
2222
2323
=head1 DESCRIPTION
2424
25+
This action holds all functionality required to run a (basic) reconciliation
26+
process: matching of (bank) statement lines against what is recorded in the
27+
books.
28+
29+
=head2 Book-side algorithm
30+
31+
In some cases, it's required or desirable to combine multiple journal lines
32+
into a single line to be matched with the (bank) statement. One case concerns
33+
payments; these are recorded as multiple journal lines when they are used to
34+
clear multiple invoices, however in practice there's only a single payment.
35+
36+
A special case is where a payment is combined with transaction costs; the payment
37+
is recorded in the cash screen and the transaction costs (or other correction) is
38+
recorded using a general journal, using the same C< source >.
39+
40+
Last, all general journal lines with the same C< source > are combined into a
41+
single line; except where the C< source > is an empty string or C< NULL > value.
42+
43+
44+
=head2 Reconciliation algorithm
45+
46+
Items are taken from the C< _stmt_todo > context parameter in the order given.
47+
Handling of items differs between the cases where the statement item has a
48+
C< source > specified or not.
49+
50+
If there B<is> a C<source>, the algorithm finds items in the books which have
51+
the same posting date I<and> C<source> value. If there is only one, it's a
52+
match. If there are multiple, the search is repeated; this time the C<amount>
53+
is included. If there is exactly one resulting item, it's a match. Otherwise
54+
the algorithm fails.
55+
56+
If there is B<no> C<source>, the algorithm searches items in the books where
57+
C<amount> and C<post_date> match and the book item does not have a C<source>
58+
value. The first of all matching items is considered a match.
59+
2560
=head1 PROPERTIES
2661
2762
=head2 entrypoint
@@ -34,12 +69,24 @@ Available values:
3469
3570
=item * add_pending_items
3671
72+
Processes payments and general journal lines, combining them into
73+
lines which are eligible for inclusion into the reconciliation report.
74+
75+
The C<_book_todo> context parameter is modified to include the result.
76+
3777
=item * approve
3878
3979
=item * delete
4080
4181
=item * reconcile
4282
83+
Processes the items in the C<_book_todo> and C<_stmt_todo> context
84+
parameters. Matched items are moved to the C<_recon_done> context
85+
parameter.
86+
87+
The C<_stmt_todo> parameter needs to be set up in the context based
88+
on an imported statement file before invoking this action.
89+
4390
=item * reject
4491
4592
=item * submit

lib/LedgerSMB/Workflow/Persister/Reconciliation.pm

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,56 @@ This module provides e-mail attachment metadata to e-mail workflow.
1111
The class inherits from LedgerSMB::Workflow::Persister::ExtraData; users are
1212
expected to declare the email table and fields as "ExtraData" configuration.
1313
14+
=head1 CONTEXT VARIABLES
15+
16+
=head2 Persisted variables
17+
18+
=over 8
19+
20+
=item * account_id
21+
22+
=item * ending_balance
23+
24+
=item * end_date
25+
26+
=item * recon_fx
27+
28+
=back
29+
30+
=head2 Non-persisted variables
31+
32+
=over 8
33+
34+
=item * _book_todo
35+
36+
An array of items (payments, journal lines) represented as hashes with
37+
keys C<source>, C<post_date>, C<amount>, C<links>; where C<links> is
38+
an array of journal lines.
39+
40+
=item * _pending_items
41+
42+
An array of journal lines before the report end date which are available
43+
for merging into the report (that is, lines which are not already part of
44+
the report).
45+
46+
=item * _preceeding_draft_count
47+
48+
Number of draft transactions before the end date of the report.
49+
50+
=item * _recon_done
51+
52+
An array of hashes with the keys C<book> and C<stmt>; each a hash with
53+
the same content as described under C<book_todo> and C<stmt_todo> respectively.
54+
55+
=item * _starting_cleared_balance
56+
57+
=item * _stmt_todo
58+
59+
An array of statement lines that have not been matched; hashes with at least
60+
the keys C<post_date>, C<amount>, C<source>.
61+
62+
=back
63+
1464
=head1 METHODS
1565
1666
=cut

0 commit comments

Comments
 (0)