Difference between revisions of "Ledger Allocating Payments"
(→Ledger Examples) |
(→Ledger Examples) |
||
Line 506: | Line 506: | ||
<p> | <p> | ||
+ | </p> | ||
+ | </td> | ||
+ | </tr> | ||
+ | </table> | ||
+ | === Single Payment Allocation to invoice, but payment amount is higher than the invoice === | ||
+ | Account 123456 has 1 invoice outstanding for $100, but makes a $150 payment. | ||
+ | <table class="" style="background-color: transparent; width: 100%"> | ||
+ | <tr> | ||
+ | <td align="left" valign="top"> | ||
+ | <p> | ||
+ | '''Date''' | ||
+ | </p> | ||
+ | </td> | ||
+ | <td align="left" valign="top"> | ||
+ | <p> | ||
+ | '''Ledger Journal ID''' | ||
+ | </p> | ||
+ | </td> | ||
+ | <td align="left" valign="top"> | ||
+ | <p> | ||
+ | '''Transaction Type''' | ||
+ | </p> | ||
+ | </td> | ||
+ | <td align="left" valign="top"> | ||
+ | <p> | ||
+ | '''Handler Type''' | ||
+ | </p> | ||
+ | </td> | ||
+ | <td align="left" valign="top"> | ||
+ | <p> | ||
+ | '''Handler ID''' | ||
+ | </p> | ||
+ | </td> | ||
+ | <td align="left" valign="top"> | ||
+ | <p> | ||
+ | '''Amount''' | ||
+ | </p> | ||
+ | </td> | ||
+ | <td align="left" valign="top"> | ||
+ | <p> | ||
+ | '''Reference Key''' | ||
+ | </p> | ||
+ | </td> | ||
+ | <td align="left" valign="top"> | ||
+ | <p> | ||
+ | '''Description of Transaction''' | ||
+ | </p> | ||
+ | </td> | ||
+ | </tr> | ||
+ | |||
+ | <tr> | ||
+ | <td align="left" valign="top"> | ||
+ | <p> | ||
+ | 15/02/2017 | ||
+ | </p> | ||
+ | </td> | ||
+ | <td align="left" valign="top"> | ||
+ | <p> | ||
+ | 100000 | ||
+ | </p> | ||
+ | </td> | ||
+ | <td align="left" valign="top"> | ||
+ | <p> | ||
+ | invoice | ||
+ | </p> | ||
+ | </td> | ||
+ | <td align="left" valign="top"> | ||
+ | <p> | ||
+ | UmbrellaInvoiceId | ||
+ | </p> | ||
+ | </td> | ||
+ | <td align="left" valign="top"> | ||
+ | <p> | ||
+ | 987654 | ||
+ | </p> | ||
+ | </td> | ||
+ | <td align="left" valign="top"> | ||
+ | <p> | ||
+ | $100 | ||
+ | </p> | ||
+ | </td> | ||
+ | <td align="left" valign="top"> | ||
+ | <p> | ||
+ | |||
+ | </p> | ||
+ | </td> | ||
+ | <td align="left" valign="top"> | ||
+ | <p> | ||
+ | invoice issued to customer | ||
+ | </p> | ||
+ | </td> | ||
+ | </tr> | ||
+ | |||
+ | <tr> | ||
+ | <td align="left" valign="top"> | ||
+ | <p> | ||
+ | 17/02/2017 | ||
+ | </p> | ||
+ | </td> | ||
+ | <td align="left" valign="top"> | ||
+ | <p> | ||
+ | 100001 | ||
+ | </p> | ||
+ | </td> | ||
+ | <td align="left" valign="top"> | ||
+ | <p> | ||
+ | unallocatedPayment | ||
+ | </p> | ||
+ | </td> | ||
+ | <td align="left" valign="top"> | ||
+ | <p> | ||
+ | UmbrellaAccountId | ||
+ | </p> | ||
+ | </td> | ||
+ | <td align="left" valign="top"> | ||
+ | <p> | ||
+ | 123456 | ||
+ | </p> | ||
+ | </td> | ||
+ | <td align="left" valign="top"> | ||
+ | <p> | ||
+ | -$150 | ||
+ | </p> | ||
+ | </td> | ||
+ | <td align="left" valign="top"> | ||
+ | <p> | ||
+ | |||
+ | </p> | ||
+ | </td> | ||
+ | <td align="left" valign="top"> | ||
+ | <p> | ||
+ | payment received | ||
+ | </p> | ||
+ | </td> | ||
+ | </tr> | ||
+ | |||
+ | <tr> | ||
+ | <td align="left" valign="top"> | ||
+ | <p> | ||
+ | 17/02/2017 | ||
+ | </p> | ||
+ | </td> | ||
+ | <td align="left" valign="top"> | ||
+ | <p> | ||
+ | 100002 | ||
+ | </p> | ||
+ | </td> | ||
+ | <td align="left" valign="top"> | ||
+ | <p> | ||
+ | offsetUnallocatedPayment | ||
+ | </p> | ||
+ | </td> | ||
+ | <td align="left" valign="top"> | ||
+ | <p> | ||
+ | UmbrellaAccountId | ||
+ | </p> | ||
+ | </td> | ||
+ | <td align="left" valign="top"> | ||
+ | <p> | ||
+ | 123456 | ||
+ | </p> | ||
+ | </td> | ||
+ | <td align="left" valign="top"> | ||
+ | <p> | ||
+ | $150 | ||
+ | </p> | ||
+ | </td> | ||
+ | <td align="left" valign="top"> | ||
+ | <p> | ||
+ | unallocatedPaymentId:100001 | ||
+ | </p> | ||
+ | </td> | ||
+ | <td align="left" valign="top"> | ||
+ | <p> | ||
+ | Transaction is to 'cancel out' the payment so that it can be allocated to an invoice. | ||
+ | </p> | ||
+ | </td> | ||
+ | </tr> | ||
+ | |||
+ | <tr> | ||
+ | <td align="left" valign="top"> | ||
+ | <p> | ||
+ | 17/02/2017 | ||
+ | </p> | ||
+ | </td> | ||
+ | <td align="left" valign="top"> | ||
+ | <p> | ||
+ | 100003 | ||
+ | </p> | ||
+ | </td> | ||
+ | <td align="left" valign="top"> | ||
+ | <p> | ||
+ | allocateUnallocatedPayment | ||
+ | </p> | ||
+ | </td> | ||
+ | <td align="left" valign="top"> | ||
+ | <p> | ||
+ | UmbrellaAccountId | ||
+ | </p> | ||
+ | </td> | ||
+ | <td align="left" valign="top"> | ||
+ | <p> | ||
+ | 987654 | ||
+ | </p> | ||
+ | </td> | ||
+ | <td align="left" valign="top"> | ||
+ | <p> | ||
+ | -$100 | ||
+ | </p> | ||
+ | </td> | ||
+ | <td align="left" valign="top"> | ||
+ | <p> | ||
+ | offsetUnallocatedPaymentId:100001 | ||
+ | </p> | ||
+ | </td> | ||
+ | <td align="left" valign="top"> | ||
+ | <p> | ||
+ | Payment is allocated to an invoice | ||
+ | </p> | ||
+ | </td> | ||
+ | </tr> | ||
+ | |||
+ | <tr> | ||
+ | <td align="left" valign="top"> | ||
+ | <p> | ||
+ | 17/02/2017 | ||
+ | </p> | ||
+ | </td> | ||
+ | <td align="left" valign="top"> | ||
+ | <p> | ||
+ | 100004 | ||
+ | </p> | ||
+ | </td> | ||
+ | <td align="left" valign="top"> | ||
+ | <p> | ||
+ | unallocatedPayment | ||
+ | </p> | ||
+ | </td> | ||
+ | <td align="left" valign="top"> | ||
+ | <p> | ||
+ | UmbrellaAccountId | ||
+ | </p> | ||
+ | </td> | ||
+ | <td align="left" valign="top"> | ||
+ | <p> | ||
+ | 123456 | ||
+ | </p> | ||
+ | </td> | ||
+ | <td align="left" valign="top"> | ||
+ | <p> | ||
+ | -$50 | ||
+ | </p> | ||
+ | </td> | ||
+ | <td align="left" valign="top"> | ||
+ | <p> | ||
+ | unallocatedPaymentId:100001 | ||
+ | </p> | ||
+ | </td> | ||
+ | <td align="left" valign="top"> | ||
+ | <p> | ||
+ | Because the payment amount exceeded the outstanding amount of the invoice, the remainder of the payment is put in a new unallocated payment. | ||
</p> | </p> | ||
</td> | </td> | ||
</tr> | </tr> | ||
</table> | </table> |
Revision as of 09:54, 3 July 2017
Overview
One of the single most important functions of the system is how payments work and service providers need to have a good understanding of how Emersion's system operates in terms of payment handling. Specifically, there are rules around the critical task of the allocation of a payment to an invoice.
- An unallocated payment is a payment recorded against an account that has not yet been allocated to an invoice.
- An allocated payment is a payment that has been applied to an invoice to reduce the amount payable.
Users can enter payments and allocate them to specific invoices immediately, or allow the system to auto-allocate the payment to invoices using the default set of rules (see below). Payments can also be allocated to invoices at a later time. Regardless of the choice made by the user, and regardless of the method of payment (Credit card, BPAY, Cash, Bank Deposit, etc) the payment is recorded by the ledger journal in exactly the same way.
All payments in the system enter the system as unallocated.
How 'Auto-Allocate' Works
When users select to 'auto-allocate' the payment, the system will:
- Create an unallocated payment.
- Look for the oldest invoice with an amount still outstanding.
- Apply the payment to this invoice.
- If the payment was for an amount greater than the amount owing on the oldest invoice, the system will look for the next oldest invoice with an amount that is outstanding, and apply money from the payment to this invoice.
This cycle is repeated until all invoices are paid and none are outstanding. In the case of any surplus funds that are left, these will be stored as an unallocated payment.
The Ledger Journal and Payments
The sections from here down pertain to the
All payments in the system are initially entered as unallocated payments. When the payment is then allocated, the first step is to create an 'offsetUnallocatedPayment' transaction, which is the inverse of the payment amount. Then - the system will create an 'allocateUnallocatedPayment' transaction for any invoices that are outstanding, or invoices that are created in the initial payment's PAYMENT_DETAIL serialized array. Where there is an amount left over, the system will create another 'unallocatedPayment' for the remainder so it can be allocated when there is an outstanding invoice.
The various transactions that allocate the payment amount to an invoice are linked back to the original payment via a 'reference_key'.
Ledger Examples
Single Payment Allocation to single outstanding invoice
Account 123456 has 1 invoice for 100, and a $100 payment is made against that invoice.
Date |
Ledger Journal ID |
Transaction Type |
Handler Type |
Handler ID |
Amount |
Reference Key |
Description of Transaction |
15/02/2017 |
100000' |
invoice |
UmbrellaInvoiceId |
987654 |
$100 |
|
invoice issued to customer |
17/02/2017 |
100001 |
unallocatedPayment |
UmbrellaAccountId |
123456 |
-$100 |
|
payment received |
17/02/2017 |
100002 |
offsetUnallocatedPayment |
UmbrellaAccountId |
123456 |
$100 |
unallocatedPaymentId:100001 |
Transaction is to 'cancel out' the payment so that it can be allocated to an invoice. The reference_key references the original journal id of the unallocated payment |
17/02/2017 |
100003 |
allocateUnallocatedPayment |
UmbrellaInvoiceId |
987654 |
-$100 |
offsetUnallocatedPaymentId:100001 |
Payment is allocated to an invoice |
Single Payment Allocation to multiple outstanding invoices
Account 123456 has 2 invoices outstanding, 1 for $25 and 1 for $45, and a $70 payment is made against those invoices
Date |
Ledger Journal ID |
Transaction Type |
Handler Type |
Handler ID |
Amount |
Reference Key |
Description of Transaction |
15/01/2017 |
100000 |
invoice |
UmbrellaInvoiceId |
887445 |
$25 |
|
invoice issued to customer |
15/02/2017 |
104050 |
invoice |
UmbrellaInvoiceId |
971000 |
$45 |
|
invoice issued to customer |
17/02/2017 |
104100 |
unallocatedPayment |
UmbrellaAccountId |
123456 |
$-70 |
|
payment received |
17/02/2017 |
104101 |
offsetUnallocatedPayment |
UmbrellaAccountId |
123456 |
$70 |
unallocatedPayment:104100 |
Transaction to cancel out payment so that it can be allocated |
17/02/2017 |
104102 |
allocateUnallocatedPayment |
UmbrellaInvoiceId |
887445 |
$-25 |
offsetUnallocatedPaymentId:104100 |
|
Single Payment Allocation to invoice, but payment amount is higher than the invoice
Account 123456 has 1 invoice outstanding for $100, but makes a $150 payment.
Date |
Ledger Journal ID |
Transaction Type |
Handler Type |
Handler ID |
Amount |
Reference Key |
Description of Transaction |
15/02/2017 |
100000 |
invoice |
UmbrellaInvoiceId |
987654 |
$100 |
|
invoice issued to customer |
17/02/2017 |
100001 |
unallocatedPayment |
UmbrellaAccountId |
123456 |
-$150 |
|
payment received |
17/02/2017 |
100002 |
offsetUnallocatedPayment |
UmbrellaAccountId |
123456 |
$150 |
unallocatedPaymentId:100001 |
Transaction is to 'cancel out' the payment so that it can be allocated to an invoice. |
17/02/2017 |
100003 |
allocateUnallocatedPayment |
UmbrellaAccountId |
987654 |
-$100 |
offsetUnallocatedPaymentId:100001 |
Payment is allocated to an invoice |
17/02/2017 |
100004 |
unallocatedPayment |
UmbrellaAccountId |
123456 |
-$50 |
unallocatedPaymentId:100001 |
Because the payment amount exceeded the outstanding amount of the invoice, the remainder of the payment is put in a new unallocated payment. |