How does the table 21 Cust. Ledger Entry work??

I am working with report 10041 Cash Receipts Report. Under the Customer Ledger Entry table there are Invoice and Payments under Document Type. What links these 2 together for the report?? How does Navision know which Payment goes to which Invoice???

Thanks in advance.

Greg

In Customer Ledger Entries you have the option to see applied invoice to a payment by clicking in Applied Entries menu option.

To see the relation between a payment and a invoice you can see the code in Form Applied Customer Entries in function FindApplnEntriesDtldtLedgEntry

Thanks Nuno.

Greg