Topic: Recurring Invoices ... A Problem

I have a hosting business. My standard hosting price is say Rs. 3500 for 2 GB Hosting Package. I have created this Item and set the Item Price in the Prices section to 3500.

While negotiating with a customer I had to offer him the same package for Rs. 3000.

So I created a sales order with the revised price Rs. 3000 and selected that as a template

Then I created Recurring Invoice definition.

When I executed the recurring invoice the Price defined in the Sales Order was ignored and the price defined in the Prices i.e. Rs. 3500 was picked by the system.

@Joe, @apmuthu don't you think that the Prices defined in the price section is a general reference price for the product but the Price defined in the Sales Order Template is specific for this Particular Customer or Group. So System shall pick the specifically defined price OR discount instead of general price definition.

www.boxygen.pk

Re: Recurring Invoices ... A Problem

Consider that the price of an item changes over time. The approach hitherto has been to use the price prevailing at the time the invoice is generated.

@joe: A field for dynamic / static pricing may be included in the recurrent invoices table/form to accommodate both situations.

Re: Recurring Invoices ... A Problem

@boxygen You might be interested in my sales module https://github.com/saygoweb/frontaccounting-module-sgw_sales This provides an alternative recurring invoicing system that integrates with the recurring entry with the sales order entry screen.  I use this for a hosting business.

Cambell https://github.com/cambell-prince

Re: Recurring Invoices ... A Problem

@Apmuthu your suggestion is optimal to incorporate both situations. While defining Recurring Invoice use can select whether to pick Item price from Prices or From Template Sales Order.

@cambell I got following error when accessing your module after activation

Warning: include_once(C:\xampp\htdocs\bx242\modules\sgw_sales/vendor/autoload.php): failed to open stream: No such file or directory in C:\xampp\htdocs\bx242\modules\sgw_sales\generate_recurring_invoices.php on line 18

Warning: include_once(): Failed opening 'C:\xampp\htdocs\bx242\modules\sgw_sales/vendor/autoload.php' for inclusion (include_path='C:\xampp\php\PEAR') in C:\xampp\htdocs\bx242\modules\sgw_sales\generate_recurring_invoices.php on line 18
Class 'SGW_Sales\controller\GenerateRecurring' not found in C:\xampp\htdocs\bx242\modules\sgw_sales\generate_recurring_invoices.php on line 132

www.boxygen.pk

Re: Recurring Invoices ... A Problem

This is a composer issue. @cambell can provide an initial one so that users with no composer installed can still partake of it. Standard FA does not use composer.

Re: Recurring Invoices ... A Problem

I suggest you download one of the released versions:

https://github.com/saygoweb/frontaccounting-module-sgw_sales/releases

They have all the needed files.  The source code repo does not have the composer install files.

Cambell https://github.com/cambell-prince

Re: Recurring Invoices ... A Problem

I just published v1.3 which has a 'show all' feature.  This brings it up to date with the current master branch.

Cambell https://github.com/cambell-prince

Re: Recurring Invoices ... A Problem

Added to the FA24Extensions repo.

Re: Recurring Invoices ... A Problem

The Recurring Order has an option Auto Create:

Is this controlled through Cron Job? When and how it is executed.

www.boxygen.pk

Re: Recurring Invoices ... A Problem

I create a Sales Order and then Generated the Invoice against it from the Top Button. The invoice was generated but the rep107 gives following error

include_once(../includes/session.inc): failed to open stream: No such file or directory in file: C:\xampp\htdocs\bx242\reporting\rep107.php at line 22
C:\xampp\htdocs\bx242\reporting\rep107.php:22:    include_once()
C:\xampp\htdocs\bx242\modules\sgw_sales\includes\controller\GenerateRecurring.php:81:    require_once('C:\xampp\htdocs\bx242\reporting\rep107.php')
C:\xampp\htdocs\bx242\modules\sgw_sales\includes\controller\GenerateRecurring.php:42:    (SGW_Sales\controller\GenerateRecurring Object)->emailInvoice('23')
C:\xampp\htdocs\bx242\modules\sgw_sales\generate_recurring_invoices.php:144:    (SGW_Sales\controller\GenerateRecurring Object)->run()
include_once(): Failed opening '../includes/session.inc' for inclusion (include_path='C:\xampp\php\PEAR') in file: C:\xampp\htdocs\bx242\reporting\rep107.php at line 22
C:\xampp\htdocs\bx242\reporting\rep107.php:22:    include_once()
C:\xampp\htdocs\bx242\modules\sgw_sales\includes\controller\GenerateRecurring.php:81:    require_once('C:\xampp\htdocs\bx242\reporting\rep107.php')
C:\xampp\htdocs\bx242\modules\sgw_sales\includes\controller\GenerateRecurring.php:42:    (SGW_Sales\controller\GenerateRecurring Object)->emailInvoice('23')
C:\xampp\htdocs\bx242\modules\sgw_sales\generate_recurring_invoices.php:144:    (SGW_Sales\controller\GenerateRecurring Object)->run()
include_once(../includes/date_functions.inc): failed to open stream: No such file or directory in file: C:\xampp\htdocs\bx242\reporting\rep107.php at line 23
C:\xampp\htdocs\bx242\reporting\rep107.php:23:    include_once()
C:\xampp\htdocs\bx242\modules\sgw_sales\includes\controller\GenerateRecurring.php:81:    require_once('C:\xampp\htdocs\bx242\reporting\rep107.php')
C:\xampp\htdocs\bx242\modules\sgw_sales\includes\controller\GenerateRecurring.php:42:    (SGW_Sales\controller\GenerateRecurring Object)->emailInvoice('23')
C:\xampp\htdocs\bx242\modules\sgw_sales\generate_recurring_invoices.php:144:    (SGW_Sales\controller\GenerateRecurring Object)->run()
include_once(): Failed opening '../includes/date_functions.inc' for inclusion (include_path='C:\xampp\php\PEAR') in file: C:\xampp\htdocs\bx242\reporting\rep107.php at line 23
C:\xampp\htdocs\bx242\reporting\rep107.php:23:    include_once()
C:\xampp\htdocs\bx242\modules\sgw_sales\includes\controller\GenerateRecurring.php:81:    require_once('C:\xampp\htdocs\bx242\reporting\rep107.php')
C:\xampp\htdocs\bx242\modules\sgw_sales\includes\controller\GenerateRecurring.php:42:    (SGW_Sales\controller\GenerateRecurring Object)->emailInvoice('23')
C:\xampp\htdocs\bx242\modules\sgw_sales\generate_recurring_invoices.php:144:    (SGW_Sales\controller\GenerateRecurring Object)->run()
include_once(../includes/data_checks.inc): failed to open stream: No such file or directory in file: C:\xampp\htdocs\bx242\reporting\rep107.php at line 24
C:\xampp\htdocs\bx242\reporting\rep107.php:24:    include_once()
C:\xampp\htdocs\bx242\modules\sgw_sales\includes\controller\GenerateRecurring.php:81:    require_once('C:\xampp\htdocs\bx242\reporting\rep107.php')
C:\xampp\htdocs\bx242\modules\sgw_sales\includes\controller\GenerateRecurring.php:42:    (SGW_Sales\controller\GenerateRecurring Object)->emailInvoice('23')
C:\xampp\htdocs\bx242\modules\sgw_sales\generate_recurring_invoices.php:144:    (SGW_Sales\controller\GenerateRecurring Object)->run()
include_once(): Failed opening '../includes/data_checks.inc' for inclusion (include_path='C:\xampp\php\PEAR') in file: C:\xampp\htdocs\bx242\reporting\rep107.php at line 24
C:\xampp\htdocs\bx242\reporting\rep107.php:24:    include_once()
C:\xampp\htdocs\bx242\modules\sgw_sales\includes\controller\GenerateRecurring.php:81:    require_once('C:\xampp\htdocs\bx242\reporting\rep107.php')
C:\xampp\htdocs\bx242\modules\sgw_sales\includes\controller\GenerateRecurring.php:42:    (SGW_Sales\controller\GenerateRecurring Object)->emailInvoice('23')
C:\xampp\htdocs\bx242\modules\sgw_sales\generate_recurring_invoices.php:144:    (SGW_Sales\controller\GenerateRecurring Object)->run()
include_once(../sales/includes/sales_db.inc): failed to open stream: No such file or directory in file: C:\xampp\htdocs\bx242\reporting\rep107.php at line 25
C:\xampp\htdocs\bx242\reporting\rep107.php:25:    include_once()
C:\xampp\htdocs\bx242\modules\sgw_sales\includes\controller\GenerateRecurring.php:81:    require_once('C:\xampp\htdocs\bx242\reporting\rep107.php')
C:\xampp\htdocs\bx242\modules\sgw_sales\includes\controller\GenerateRecurring.php:42:    (SGW_Sales\controller\GenerateRecurring Object)->emailInvoice('23')
C:\xampp\htdocs\bx242\modules\sgw_sales\generate_recurring_invoices.php:144:    (SGW_Sales\controller\GenerateRecurring Object)->run()
include_once(): Failed opening '../sales/includes/sales_db.inc' for inclusion (include_path='C:\xampp\php\PEAR') in file: C:\xampp\htdocs\bx242\reporting\rep107.php at line 25
C:\xampp\htdocs\bx242\reporting\rep107.php:25:    include_once()
C:\xampp\htdocs\bx242\modules\sgw_sales\includes\controller\GenerateRecurring.php:81:    require_once('C:\xampp\htdocs\bx242\reporting\rep107.php')
C:\xampp\htdocs\bx242\modules\sgw_sales\includes\controller\GenerateRecurring.php:42:    (SGW_Sales\controller\GenerateRecurring Object)->emailInvoice('23')
C:\xampp\htdocs\bx242\modules\sgw_sales\generate_recurring_invoices.php:144:    (SGW_Sales\controller\GenerateRecurring Object)->run()
www.boxygen.pk

Re: Recurring Invoices ... A Problem

Your $module_path may be wrong.
The file ../includes/session.inc should be include-able from there.
Check if DIRECTORY_SEPARATOR issue is involved.

Re: Recurring Invoices ... A Problem

The error says that included files on Lines 22, 23, 24 and 25 in rep107 couldn't be find.

rep107 is working fine from core FA. So I can't make any changes in this report.

As far as module is concerned I have not made any changes to it. Just copied, installed and activated.

So @cambell if this module is working fine with you then please suggest the solution for me. The only problem is in Auto Sending of Email to Customer when Recurring Invoice is Created.


Also can you please elaborate the functionality behind Auto Create: check in Sales Order Definition.

www.boxygen.pk

Re: Recurring Invoices ... A Problem

You are using an old version of the module. Get the new release from cambell's repo or take it from mine linked above. Also attached herewith.

Post's attachments

sgw_sales.zip 95 kb, 2 downloads since 2017-09-30 

You don't have the permssions to download the attachments of this post.

Re: Recurring Invoices ... A Problem

Although the Error is still showing but Email is sent perfectly. So I assume the problem is solved.

Thanks for your support.

www.boxygen.pk

Re: Recurring Invoices ... A Problem

Clear the cache and close all instance of the browser, flush the dns cache (windows: ipconfig /flushdns). Clear the errors file in both apache (webserver) and in the FA tmp/errors.log file.

Re: Recurring Invoices ... A Problem

You will also need this patch to FA core for it to work properly:

https://github.com/cambell-prince/frontaccounting/commit/f9bee2f78bb6881cecc93b47145d9cf70345dca7

The PR queue remains too long to submit a new one.

Cambell https://github.com/cambell-prince

Re: Recurring Invoices ... A Problem

The intention with the auto create checkbox is that some other cron job could auto post sales orders marked with the auto create flag.  I've not integrated that with FA cron processing yet.

Cambell https://github.com/cambell-prince

Re: Recurring Invoices ... A Problem

@joe: is this the acceptable way to code the $path_to_root in all repXXX.php files?

Re: Recurring Invoices ... A Problem

@apmuthu , I guess this is acceptable way.

  $path_to_root=".."; 

if you are using it from within your custom module

 $path_to_root="../../..";

include_once($path_to_root . "/includes/session.inc"); 
Subscription service based on FA
HRM CRM POS batch Themes

Re: Recurring Invoices ... A Problem

The idea is to make it usable in a uniform way without different hardcoded values.

Re: Recurring Invoices ... A Problem

That's fine. But in entire FA we are using it like hard coded And you are thinking about the reports i guess. So the hardcoded method wont be a problem I thought and answered it .

Subscription service based on FA
HRM CRM POS batch Themes

Re: Recurring Invoices ... A Problem

@kvvaradha your method doesn't work if you are wanting to use a standard report from within a custom module.  The $path_to_root should be set only once, the report never checks if its defined and overwrites it with an incorrect value.  The __DIR__ is correct in both cases.

Personally, I don't think that the path to root is robust (given that it should be set only once from the point of entry), I'd love to see things switch to a more modern class auto load system, and would be happy to code that for the project.  It would probably take a few weeks if it was just me.

Cambell https://github.com/cambell-prince

Re: Recurring Invoices ... A Problem

Making it an absolute config constant value would avoid having to set and overwrite is everywhere in erroneous relative path method that prevails now. I do not want autoload composerisation as it come with other issues.

Re: Recurring Invoices ... A Problem

I need more help over FA Cron Processing so that Auto Create shall work for this module at least.
Thanks in advance.

www.boxygen.pk

Re: Recurring Invoices ... A Problem

@cambell, that's great to hear.

Subscription service based on FA
HRM CRM POS batch Themes