Aged Debtors User Defined Functions



Does any one have any user defined functions which can be used with
aged debtor calculations? i.e. Amount Owing after 30 days, 60days, 90
days, 120+ days?
Any code snippit examples (i.e. T-SQL) would be helpful.

.