VirtueMart Forum

VirtueMart 2 + 3 + 4 => Administration & Configuration => Topic started by: jlabuelo_sm on December 04, 2016, 21:17:25 PM

Title: Invoice numbers only in orders with status "Completed" or "Sent"
Post by: jlabuelo_sm on December 04, 2016, 21:17:25 PM
Good afternoon all

I have a question here regarding the generation of invoice numbers. I have configured Virtuemart 3.0.18 over Joomla 3.5 so that only Invoice PDF documents are created when the order is moved to status "Sent" or "Completed".

With this configuration I can see that it works fine, and only Invoice PDF documents are created for orders with this state, however the issue here is that reviewing the invoice table "virtuemart_invoices", I can see that Virtuemart is creating Invoice Numbers for orders that are "Pending" for example, when the PDF Invoice document is not created.

The problem for us is that in Spain, the invoice numbers must be consecutive, so I need to stop virtuemart to give invoice numbers to orders that have not status = 'Completed' or 'Sent'.

For example, I have a customer A, that makes an order and pays for it. Then we send him the product and order moves to status "Completed". Virtuemart Creates a PDF Invoice document, and assigns also an Invoice Number. Just as we need it

If a customer B, makes an order, but somehow they call us to cancell it, this order never gets to status "Completed" so no PDF Invoice document is generated, but in the virtuemart_invoices table a new entry is created, and an invoice number has been assigned to it.

At the end of the month when we make a summary of our invoice documents we can find this secuence of invoice numbers: 1,2,4,6,8,9.......... and this is not legal for our tax  national system.

Is there any way to prevent  virtuemart to assign an invoice number, if the invoice PDF document has not been created??

Thanks a lot in advance!!
Title: Re: Invoice numbers only in orders with status "Completed" or "Sent"
Post by: jlabuelo_sm on December 21, 2016, 13:03:22 PM
Sorry to ask again.. but is there any way to avoid virtuemart to produce invoice numbers when no invoice document is produced??

Thanks a lot!!
Title: Re: Invoice numbers only in orders with status "Completed" or "Sent"
Post by: GJC Web Design on December 21, 2016, 13:07:51 PM
Have you tried one of the order/invoice numbering plugins -- there are 2 I think

I don't know but maybe you can consecutively number just the invoices themselves

VM will always create an order in sequence when the cart confirm is clicked
Title: Re: Invoice numbers only in orders with status "Completed" or "Sent"
Post by: jabba on July 17, 2017, 15:52:17 PM
Hello jlabuelo_sm, have you find an answer to your question? I have the same problem.. i need the invoice to be generated only with completed orders. I also need the invoices to be sequentials number (i use Advanced Ordernumbers for VirtueMart) but the system keeps creating them also when it should not.
Thank you!
Gianluca
Title: Re: Invoice numbers only in orders with status "Completed" or "Sent"
Post by: Jose M. on July 18, 2017, 19:17:13 PM
Hello,
In the documentation of this plugin it seems that you can have a different invoice counter for each country:

http://open-tools.net/documentation/ordernumber-plugin-for-virtuemart.html

Greetings!
Jose
Title: Re: Invoice numbers only in orders with status "Completed" or "Sent"
Post by: its4yougr on November 02, 2017, 08:25:03 AM
Hello to all
   Yes this is indeed a problem here in Greece too. We need to have consecutive invoice numbering only for the paid orders.
i.e.
1. Customer A makes a purchase (confirmed order - paid through paypal) and gets an invoice # 009
2. Customer B makes a purchase (non-confirmed  - bank transfer) and the invoice number becomes 010
3. Customer C makes a purchase (confirmed - paid through paypal) and gets an invoice# 011

In the above example according to Greek Tax Law we should have for Customer A invoice# 009 and for Customer C invoice#010 and not 011.

At the end if Customer B makes the bank transfer and we change the order status to confirmed, after Customer C makes his purchase, he should get invoice# 011 and not invoice# 010. That number should be assigned to Customer C anyway since he paid first ! ! !

I think the whole process should be implemented using another db field invoice_number_sequence in _virtuemart_invoices table which will get populated sequentially whenever the invoice status becomes confirmed.

I don't know any php programming and / or sql manipulation and I don't know which are the files that are involved to be able to do that.

Is it possible that someone can write down the steps needed as well as the code for that?

Thank you in advance
George