OK.
Recurring invoices. Breath deep, breath deep...
They are set up to generate regular invoices - and these can be every certain number of days - or every certain number of months.
The 'Last Created' date is the key one here - badly named probably - it should be 'first day of next period to be charged'. It sets the date for the beginning of the 'period' being charged for.
When opening the recurring invoice page is opened FA looks through the recurring transactions - and looks at the Last Created date. It then adds the number of months or days to the Last Created date. If the current (today's date) is greater than what has been calculated then the system says - 'ha! I have to create an invoice'.
An invoice is then created (by clicking the button) with the current (today's) date as the invoice date - the 'Recurrent invoice covers period' set to show the period from the Last created date - it then adds the period months/days to the Last created date - and then outputs that date minus one day.
This is so that if you have 1st Feb - and it's a monthly transaction - the end date of the covered period is not 1st March - but 28th (or 29th possibly) of Feb. The Last Created date gets reset to the Last date plus the period - i.e. 1st March - and this makes sense again because it is the first day of the next period to be charged.
OK - so pretty much FA is set up to always generate invoices in arrears.
We need to charge in advance - and this is the only simple/easy way I've seen how to do this.
In create_recurrent_invoices.php there is a line which has:
$doc->Comments .= sprintf(_("Recurrent Invoice covers period %s - %s."), $from, add_days($to, -1));
In our install this is changed to:
$doc->Comments .= sprintf(_("\nRecurrent Invoice covers period from %s."), $to);
and this indicates that the period is being charged in advance.
I'm sure there must be a more comprehensive way to do this - but it may get messy as recurring invoices would need to be set up to indicate whether they are in arrears or in advance. It may be a global setting might be the way forward.
BTW - there are two buggy looking bit I saw.
1. If you fill in both days and months when setting up the recurrng transaction they will both be added to the Last date - all looks odd.
2. In the notes/wiki it says about setting days to -1 to get last day of previous month - I don't see this working at all.
HTH