we have a small ERP that we developped inhouse on cakePHP framework. We need to do small changes to the billing function that handles recurring services.
Every month we charge a subscription fee to our client for the service. Until now we were charging the service from the date it was installed for the next 30 days. Ex : service installed on 15th of june. Invoice 1 from 15/06/2010 to 14/07/2010 ; Invoice 2 from 15/07/2010 to 14/08/2010.
We want to change it so it will make a first invoice from the installation date until the end of the month. And then the other invoices will be from the first day of the month until the last day. Ex : Invoice 1 : 15/06/2010 to 30/06/2010 ; invoice 2 : 01/07/2010 to 31/07/2010
The new script should also take into account all the services that are currently running that need to be adapted to this new billing rule.
Also please note, that we want to generate the invoice at the end of the month for the next billing period. EX. We will generate the invoices the 25th of June for services from 01/07 to 31/07. I know right now the function takes into account only the services that need to be billed the month we run the function.
I attached the function so you can review it.
To start invoicing we call function invoiceALL in the controller on L197. It will then call the function "recurring" in the controller (L121). That will call the function "recurring" in the model(L187). It is this last function that need to be updated.
If you have any question about the work please let me know.
**IMPORTANT ** : we will need an invoice in English