Add guard to not recalculate periods that are before the start date of the term
Add script to retro run invoices; refactoring