The document type is hard coded by the system. Look at UDC table 00/DT for the document types in your system. Notice that some of those are marked as hard coded/reserved by JDE. You may wish to dowload the Accounts Receivable manual and read that to learn more about the document types.
Not sure what you mean by algorithm, unless you are looking for how the system determines what document type to assign on invoice entry.
These comments apply to accounts receivable and to JDE World, since you posted in the JDE World forum and are talking about the customer ledger inquiry. If you are in Enterprise One and asking about Accounts Payable, then this reply can be ignored (though Enterprise One works pretty similar to World in this respect).
What is the use of the Customer Ledger Inquiry. To view accounts receivable detail history for a given customer, viewing on line. Whomever works in the accounts receivable department will likely use the Customer Ledger Inquiry quite a bit.
Hope this helps a bit.