Does it make it easier for you if we just called it a "redraw" (although technically not the same)?
Let's start backwards.
Say you had a loan for $50k @ 5% interest.
You paid interest on the $50k as normal ($50,000 x 5% / 365) = $6.84 per day.
You had some cash so you paid off $30k...