Topic: Recurring Invoices

HI there,

I was having some issues with recurring invoices not being due so I could post them, and figured out the problem.  The date that FA is calculating that the recurring invoice is due is after the fact.  An example so you understand what I am going on about:

Recurring invoice for $100, set for every month on the 18th.  I create last months, and today is 19/10, my next invoice to send out is the 18/10, but its not marked as being due.... until the 18/11.. 

I invoice my clients in advanced.  They pay upfront on a new account.  And then every month after.  FA seems to invoice after that month, which isn't good for service work and hosting..

So a modification, very simple to make it work the way I want, which is on the 19/10, an invoice for 18/10 is marked as due and you can click the invoice icon to create an invoice.. is as below..

/directory_to_FA_root/sales/create_recurrent_invoices.php

CHANGE Line 145:

$overdue = date1_greater_date2($today, $due_date) && date1_greater_date2($today, $begin) && date1_greater_date2($end, $today);

TO:

$overdue = date1_greater_date2($today, $last_sent) && date1_greater_date2($today, $begin) && date1_greater_date2($end, $today);

Could we have that as an option in the settings?  Ie:  Invoice in Advance = yes or no..??

Anyhow, thought I would put that up here in case someone wants the invoice in advance thing like I did.

Regards
Wayne

Re: Recurring Invoices

Sorry I am using version 2.3.12 by the way smile

3 (edited by apmuthu 10/19/2012 04:25:40 am)

Re: Recurring Invoices

Based on the value of a config variable say $Advance_Recurring_Invoice = false; in config.default.php or a sys_prefs table value settable in Company Setup (preferable), we choose to have Line 145 in sales/create_recurrent_invoices.php as:

$overdue = date1_greater_date2($today, 
            ((isset($Advance_Recurring_Invoice) &&  $
              AdvanceRecurringInvoice) ? $last_sent : $due_date)) && 
         date1_greater_date2($today, $begin) && 
         date1_greater_date2($end, $today);

This may have to reflect in some reports as well........

May need a check to see if $last_sent exists in the first place.....

Re: Recurring Invoices

There already is a check for $last_sent, if its empty it sets it to 0000-00-00 date.  But yeah thats exactly it.