Author Topic: Invoice numbers only in orders with status "Completed" or "Sent"  (Read 763 times)

jlabuelo_sm

  • Beginner
  • *
  • Posts: 17
  • A beginner
Invoice numbers only in orders with status "Completed" or "Sent"
« 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!!

jlabuelo_sm

  • Beginner
  • *
  • Posts: 17
  • A beginner
Re: Invoice numbers only in orders with status "Completed" or "Sent"
« Reply #1 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!!

GJC Web Design

  • 3rd party VirtueMart Developer
  • Super Hero
  • *
  • Posts: 7596
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 2.6.22 & 3.2.2
Re: Invoice numbers only in orders with status "Completed" or "Sent"
« Reply #2 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
GJC Web Design
VirtueMart and Joomla Developers - php developers http://www.gjcwebdesign.com
VM3 AusPost Shipping Plugin - e-go Shipping Plugin - VM3 Postcode Shipping Plugin - Radius Shipping Plugin - VM3 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
http://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

jabba

  • Beginner
  • *
  • Posts: 16
    • Pixed - Web Store Assistance
Re: Invoice numbers only in orders with status "Completed" or "Sent"
« Reply #3 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
Gianluca Gabella - CEO & Web Developer @ Pixed s.n.c.b - www.pixed.it

Jose M.

  • Beginner
  • *
  • Posts: 47
Re: Invoice numbers only in orders with status "Completed" or "Sent"
« Reply #4 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

its4yougr

  • Beginner
  • *
  • Posts: 36
    • Κατασκευή ιστοσελίδων Θεσσαλονίκη - Web Design
  • VirtueMart Version: VM3
Re: Invoice numbers only in orders with status "Completed" or "Sent"
« Reply #5 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
Κατασκευή Ιστοσελίδων Θεσσαλονίκη - http://www.its4you.gr/
WebDesign Internet Marketing - http://www.webdesign-internetmarketing.com/