Formula for debts, court cases


request approval for amount_to_distribute = 10% of net profit




starting at oldest debt

	remaining_to_distribute = amount_to_distribute 

	amount_to_distribute_that_year = remaining_to_distribute * 0.9



	repeat for each year to current year
	
		for each debt that started in that year

			amount_for_that_debt = amount_to_distribute_that_year x (amount_outstanding_that_debt / total_outstanding_of_debts_for_that_year)
		
			remaining_to_distribute = remaining_to_distribute - amount_for_that_debt

		end for

		amount_to_distribute_that_year = remaining_to_distribute * 0.9

	end repeat


	In current year, pay any remaining to distribute to current debts





aims
----


TO clear the oldest debts first

To make some payment on all debts
