Interest charge on Purchase Orders

Hi- looking for help from ERPNext experts.

We have a multi tenant setup . One of the setups is our central warehouse which ships products to other tenants on our setup.

Location 1 is given a line of credit by the Central Warehouse
Location 1 will place an order for product eg for $100
Warehouse ships on Net 30 terms however charges interest there after x% per month on unsold product. so e.g if on day 30, they have sold 60% inventory, on day 31, we need to charge x% interest.

From the central warehouse as the lender, we need to see stock, remaining stock, what was sold, and calculate interest charged on the 31st etc.

This customer can access his line of credit and repeat the same cycle so at some point there may be several entries "loan’ entries eg.

Loan entry 001- day 35- balance on inventory 100 widgets, promotional interest charged x% - current amount due $432.00

Loan entry 002- day 29- Net 30

Loan entry 003 - day 31 balance on inventory 200 widgets, promotional interest charged y% current amount due $275

What is the best way to set this up?