What is min rate history Concept ?

Suggestion :-
System automatically fetch the lowest possible rate while performing a Sales return for an item+lot combination for a specific site+customer.
This information is stored in 4 Different Document Keys categorised as in order of priority

following are the dockey:-
i) Site+Customer+Item+Lot+Invoice (used Only in this case if there is a history of an invoice
will the invoice number get auto populated. Else it will set any of the next/below doc keys).
ii) Site+Customer+Item+Lot
iii) Site+Item+Lot
iv) Customer+Item

Each of the above combinations contains a history of the invoiced item+quantity which gets auto-adjusted/deducted
on every transaction. So if all invoiced items quantity against combination

If first dockey is exhausted/consumed then combination second dockey will be preferred automatically in the entry.
This cycle will complete until all quantity is completely exhausted till combination last

Note :- if these combinations do not exist then system will fetch the rate from Price List.