What I think is being overlooked is not so much this is an EU requirement, but also a national requirement that varies by country. There are people from different EU countries asking for ALMOST the same thing. But each country has a variation.
I would suggest a new thread asking users to let you know their local requirements. Not personal wish list stuff, but what is legally required in specific countries. It may end up having a variety of small mods to be in compliance.
Personally, I have never seen this subject even mentioned on other cart forums. I visit many, asking about things for my hosting clients, who have a wide variety of carts in use. I have never seen this at all. I have seen no other cart offer anything special for EU invoicing, yet the carts are used all over.
Again, I am not there. I am not under any such rules. But I do know many other carts are being used throughout the EU, many developed by EU citizens, and I have never noticed anything at all about this. There must be some way to sell from a cart, using the default numbering system and still be in compliance.
I did suggest earlier to call the OC docs Packing Lists or Acknowledgments or some other term and then issue an "Official Invoice" from a bookkeeping program, since sales will have to be entered into some sort of accounting setup for tax records.
It seems like this could become a pit of quicksand, trying to come up with a setup that will comply with every possible users' country when simply setting things up for a country by country mod / patch / snippet would be a better solution than trying to incorporate a "one-size-fits-all" directly into the main script.
A Trusted Wholesale Dropshipper
Web Hosting Under $ 5.00 Month! FREE Shopping Carts!
25,000+ Real Wholesale & Dropship Sources!
See section 1.4 What information must an invoice contain?
Greetings,
24-7-open
1.4.1 Obligatory information for all invoices
An invoice must contain the following information:
1. the date of issue;
2. a sequential number that uniquely identifies the invoice;
It says nothing about starting over each year or anything else mentioned as far as prefixes or suffixes. Just sequential numbers.
It is the individual countries that impose these further regulations, so you will end up with something different for virtually all countries.
Please don't spend a lot of time on this "customization for specific users" and concentrate on the issues common to all users at this point. While there is a lot of talk about this, no other cart offers this sort of thing and thousands still manage to do business online.
Please don't get sidetracked on this.
A Trusted Wholesale Dropshipper
Web Hosting Under $ 5.00 Month! FREE Shopping Carts!
25,000+ Real Wholesale & Dropship Sources!
In this topic we are discussing the Invoicenumbers, how the invoice should look is a completly differend balgame and that is mostly done by a template.
Norman in 't Veldt
Moderator OpenCart Forums
_________________ READ and Search BEFORE POSTING _________________
Our FREE search: Find your answer FAST!.
[How to] BTW + Verzend + betaal setup.
Greetings,
24-7-open
What are you planning to implement with the next version?You ate mixing Invoices with Invoicenumbers.
In this topic we are discussing the Invoicenumbers, how the invoice should look is a completly differend balgame and that is mostly done by a template.
Greetings,
24-7-open
I'm not planning anything, Daniel is24-7-open wrote:What are you planning to implement with the next version?You ate mixing Invoices with Invoicenumbers.
In this topic we are discussing the Invoicenumbers, how the invoice should look is a completly differend balgame and that is mostly done by a template.
Greetings,
24-7-open

Norman in 't Veldt
Moderator OpenCart Forums
_________________ READ and Search BEFORE POSTING _________________
Our FREE search: Find your answer FAST!.
[How to] BTW + Verzend + betaal setup.
I'm working on openCart 1.2.x (I can't remember the exact version number... where can I find it???)...
I live in Italy so I have the same problem as all other italian users: I need to give a progressive, sequential and year-based ID to every invoice.
So I made this fix to create invoice ids like 2010-00001, 2010-0002, etc. for EVERY ORDER (even for cancelled or reversed ones).
I hope this can help someone!
In admin/model/customer/order.php I modified getOrder() and getOrders() functions:
GET_ORDER:
Code: Select all
public function getOrder($order_id) {
$query = $this->db->query("SELECT *, (SELECT CONCAT(YEAR(o.date_added),'-',LPAD(COUNT(*)+1,5,'0')) FROM `" . DB_PREFIX . "order` ordcount WHERE ordcount.order_status_id > 0 and ordcount.order_id < o.order_id AND YEAR(ordcount.date_added) = YEAR(o.date_added)) AS invoice_id FROM `" . DB_PREFIX . "order` o WHERE order_id = '" . (int)$order_id . "'");
return $query->row;
}
Code: Select all
public function getOrders($data = array()) {
$sql = "SELECT o.order_id, CONCAT(o.firstname, ' ', o.lastname) AS name, (SELECT os.name FROM " . DB_PREFIX . "order_status os WHERE os.order_status_id = o.order_status_id AND os.language_id = '" . (int)$this->language->getId() . "') AS status, ";
$sql .= "(SELECT CONCAT(YEAR(o.date_added),'-',LPAD(COUNT(*)+1,5,'0')) FROM `" . DB_PREFIX . "order` ordcount WHERE ordcount.order_status_id > 0 and ordcount.order_id < o.order_id AND YEAR(ordcount.date_added) = YEAR(o.date_added)) AS invoice_id, ";
$sql .= "o.date_added, o.total, o.currency, o.value FROM `" . DB_PREFIX . "order` o";
...
Code: Select all
$this->data['order_id'] = $order_info['order_id'];
Code: Select all
$this->data['invoice_id'] = $order_info['invoice_id'];
Code: Select all
$this->data['orders'][] = array(
'order_id' => $result['order_id'],
'name' => $result['name'],
'status' => $result['status'],
'date_added' => date($this->language->get('date_format_short'), strtotime($result['date_added'])),
'total' => $this->currency->format($result['total'], $result['currency'], $result['value']),
'action' => $action
);
Code: Select all
$this->data['orders'][] = array(
'order_id' => $result['order_id'],
'invoice_id' => $result['invoice_id'],
'name' => $result['name'],
'status' => $result['status'],
'date_added' => date($this->language->get('date_format_short'), strtotime($result['date_added'])),
'total' => $this->currency->format($result['total'], $result['currency'], $result['value']),
'action' => $action
);
If you don't want to count all orders you can modify the two queries I wrote at the beginning... e.g. if you want to issue an invoice only for shipped orders you can change
Code: Select all
WHERE ordcount.order_status_id > 0
Code: Select all
WHERE ordcount.order_status_id = 3
Happy hacking!

When should the invoice number be generated?
1. When the order has been confirmed by the payment gateway?
2. When the order status is set to complete or shipped?
3. When the admin clicks a generate invoice button on the order page?
Attachments
invoice.jpg (137.91 KiB) Viewed 5919 times
OpenCart®
Project Owner & Developer.
Daniel wrote:The invoice number will be in the next version. Its nearly finished. I just need some inpout from you guys.
When should the invoice number be generated?
1. When the order has been confirmed by the payment gateway?
2. When the order status is set to complete or shipped?
3. When the admin clicks a generate invoice button on the order page?
1. No, because the customer can still cancel his order.
2 + 3 When the order changes to complete the generate Invoice-number Button changes from grayed out to actif.
Looks great Daniel, much appreciated!
Norman in 't Veldt
Moderator OpenCart Forums
_________________ READ and Search BEFORE POSTING _________________
Our FREE search: Find your answer FAST!.
[How to] BTW + Verzend + betaal setup.
#1 should be better, canceled orders is a non-issue as unpaid invoices are voided all the timeDaniel wrote:The invoice number will be in the next version. Its nearly finished. I just need some inpout from you guys.
When should the invoice number be generated?
1. When the order has been confirmed by the payment gateway?
2. When the order status is set to complete or shipped?
3. When the admin clicks a generate invoice button on the order page?
#2 if store owner click on "print invoice" before set status to complete, would it cause a error? it's hard to enforce people to follow the exact sequence when processing orders
#3 the problem is that the owner cannot see invoice number before manually generate one, so it would be better to automate this process by using method #1
#1 No, never auto-generate!. There is no invoice-number only a proforma (ergo: the order-number) during ordering. If a customer cancels his order then I have to regenerate a second invoice-number where I refund the amount payed. This is the Law and if you manualy generate the Invoice-number there is less hassle.maomaox wrote:#1 should be better, canceled orders is a non-issue as unpaid invoices are voided all the timeDaniel wrote:The invoice number will be in the next version. Its nearly finished. I just need some inpout from you guys.
When should the invoice number be generated?
1. When the order has been confirmed by the payment gateway?
2. When the order status is set to complete or shipped?
3. When the admin clicks a generate invoice button on the order page?
#2 if store owner click on "print invoice" before set status to complete, would it cause a error? it's hard to enforce people to follow the exact sequence when processing orders
#3 the problem is that the owner cannot see invoice number before manually generate one, so it would be better to automate this process by using method #1
Plus when someone pays with "bank transfer" and he never pays I have an Invoice-number + a second "refund' Invoice-number. Useless.
#2 Then there should be a message saying 'Generate Invoice-number"
3# Again: No! It is to much work to create refund Invoices when using this Auto-generate setup. PrestaShop had it this way to and they changed it.
The owner does not have to see the invoice-number, he will see it when he prints the actual Invoice.
Norman in 't Veldt
Moderator OpenCart Forums
_________________ READ and Search BEFORE POSTING _________________
Our FREE search: Find your answer FAST!.
[How to] BTW + Verzend + betaal setup.
As a plus I would appreciate the possibility to change manually the auto-generated invoice number. The system should read the latest invoice number and add 1 to that number.
Another plus would be the possibility to use the actual year as prefix (maybe using a code like "{YEAR}" or something similar):
Thanks!!!
you can just manually ad the change the prefix at the end of the year. i don;t thinkits that much trouble.palicao wrote:IMHO, the right way is #3.
As a plus I would appreciate the possibility to change manually the auto-generated invoice number. The system should read the latest invoice number and add 1 to that number.
Another plus would be the possibility to use the actual year as prefix (maybe using a code like "{YEAR}" or something similar):
Thanks!!!
OpenCart®
Project Owner & Developer.
Who's number 3?palicao wrote:IMHO, the right way is #3.
This you can do via your phpMyAdminAs a plus I would appreciate the possibility to change manually the auto-generated invoice number.

That is what it does.The system should read the latest invoice number and add 1 to that number.
Did you look at the image provided by Daniel?Another plus would be the possibility to use the actual year as prefix (maybe using a code like "{YEAR}" or something similar
Norman in 't Veldt
Moderator OpenCart Forums
_________________ READ and Search BEFORE POSTING _________________
Our FREE search: Find your answer FAST!.
[How to] BTW + Verzend + betaal setup.
#3 is:Who's number 3?
3. When the admin clicks a generate invoice button on the order page?
I know that there will be surely the opportunity to do this using phpMyAdmin, but I (and I don't think I'm the only one) am going to use openCart for my clients. I cannot ask them to log into phpMyAdmin and hack tablesThis you can do via your phpMyAdmin

Surely I did, and I didn't find anything like "fill the prefix field with "{YEAR}" to have all your invoice number prefixed with the current year number"...Did you look at the image provided by Daniel?
The reasons why I expressed my preferences in this way are:
1. If you generate invoices manually you can address all kind of requirements: either if you need to generate an invoice only for shipped items or if you need to generate for every order.
2. My request for a default invoice number and the possibility to change it is for the store owner who sells both online and offline. In this way they can have a consistent invoice numbering. This is also useful in countries like Italy where you have to start a new numbering each year
3. Also the "YEAR" request is for that purpose, it's useful to distinguish between the first invoice of (2009-0001) and 2010 (2010-0001).
1. The invoicenumber is always generated, every order that goes thru needs an invoicenumber, not just the once you feel like.
2. The storeowner will mess up when he can change the invoicenumber when he feels like it. The invoicenumber system should be closed, secure and safe. The same way as it is with an accountand program.
3. That is possible, look at the image provided by Daniel, there you see a Prefix field, add anything you like, 2010, IT-, whatever....
And yes, #3 is the best. But, the button should only by accessable when the order has the status of completed. This to prevend accidentical generating of the invoicenumber.
Norman in 't Veldt
Moderator OpenCart Forums
_________________ READ and Search BEFORE POSTING _________________
Our FREE search: Find your answer FAST!.
[How to] BTW + Verzend + betaal setup.
#1 make no sense. agree with i2paqDaniel wrote:When should the invoice number be generated?
1. When the order has been confirmed by the payment gateway?
2. When the order status is set to complete or shipped?
3. When the admin clicks a generate invoice button on the order page?
#2 also difficult to handle, agree with i2paq, too. Also think about downloadable products: the have not the "complete" or "shipped" status.
#3 this seems to be the only working solution, I think.
btw. the Invoice Number shouldn't be generated by / connected with the auto increment. If you use the "year" as prefix and want to restart the No. in 2011 you have a BIG problem with the database.
Order ID and Invoice number is never the same thing... then please don't handle it like the same.
Users browsing this forum: No registered users and 41 guests