If I understand the writeup correctly, the portion of the total that is not allocated to one of the contributing amounts is then allocated to just one of the records. If this is what is being done, it seems incorrect to me. I have seen plenty of situations where the unallocated portion is large enough that it is necessary to allocate the remainder across several rows, a penny at a time. Whether a cursor is needed for proper allocation or not, I do not know. However, one allocation method I find that yields good results is as follows:
For a set of records and an amount to be allocated.
Sum the records. Allocate to the first record (record amount/total_amount)*(amount_to_be_allocated) rounded to two decimal places.
Subtract the record amount from the total_amount. Subtract the amount allocated to the first record from amount_to_be_allocated.
Process each row in this manner.
On reaching the last row, the allocation is the remaining amount_to_be_allocated.