Questions about Payment Form extension

Change invoice number

  • gasoline
  • Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 1 day ago #143154 by gasoline
Change invoice number was created by gasoline
We want to use a new event, the old one is finished and the form worked really well.
Now we added new event and we want the invoice numbering start from a choosen number. But when I change that in the configuration the new invoices just keep on counting from the last number that we had in the old event.

How can we change that?

Please Log in or Create an account to join the conversation.

More
3 years 1 day ago #143158 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Change invoice number
Hello

The invoice start number will only be used if there is no invoice generated in the system before

If there is existing invoice numbers, the system will use the next number (from previous invoice) to generate the invoice number of new payment

In your case, the next invoice number is greater than previous one? Or how you want to change it?

Tuan

Please Log in or Create an account to join the conversation.

  • gasoline
  • Topic Author
  • Offline
  • New Member
  • New Member
More
2 years 11 months ago #143282 by gasoline
Replied by gasoline on topic Change invoice number
The invoices were ended with something like HN-1343.

Client want to start the new forminvoice with a round number, something like HN-1500

It's not super important but that is something he wants.

Marc

Please Log in or Create an account to join the conversation.

More
2 years 11 months ago #143290 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Change invoice number
You can try to modify code as instructed below:

1. Open the file components/com_pmform/Helper/Helper.php
2. Find the method getInvoiceNumber
3. And replace it with below code:
Code:
public static function getInvoiceNumber() { $db = JFactory::getDbo(); $sql = 'SELECT MAX(invoice_number) FROM #__pf_payments'; $db->setQuery($sql); $invoiceNumber = (int) $db->loadResult(); if ($invoiceNumber < (int) self::getConfigValue('invoice_start_number')) { $invoiceNumber = (int) self::getConfigValue('invoice_start_number') ?: 1; } else { $invoiceNumber++; } return $invoiceNumber; }
The following user(s) said Thank You: gasoline

Please Log in or Create an account to join the conversation.

  • gasoline
  • Topic Author
  • Offline
  • New Member
  • New Member
More
2 years 11 months ago #143313 by gasoline
Replied by gasoline on topic Change invoice number
Thanks,
I will do that. Awesome and fast support. Very much appreciated.
Marc

Please Log in or Create an account to join the conversation.

More
2 years 11 months ago #143319 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Change invoice number
Your welcome. If it works, you can submit a support ticket next week (or better next two weeks). I will help implement that using override so that it won't be lost when you update to future releases of the extension

Regards,

Tuan

Please Log in or Create an account to join the conversation.

Moderators: Tuan Pham Ngoc