[Skip to main content](#vessel-content)

#   Vendor paid directly wrong Invoice for customer

##

- **[filiar](/forum/user/33070-filiar "View filiar's Profile")**
- [![filiar's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/33070-filiar "View filiar's Profile") Topic Author
- [ Offline](/forum/user/33070-filiar)

Less More

- Posts: 134
- Thank you received: 6
-
-
-
- [](https://madein-bg.com)
-

10 years 9 months ago -  10 years 9 months ago [\#229283](#229283) by [filiar](/forum/user/33070-filiar "View filiar's Profile")  Replied by *[filiar](/forum/user/33070-filiar "View filiar's Profile")* on topic *[Vendor paid directly wrong Invoice for customer](/forum/19-hikamarket/882053-vendor-paid-directly-wrong-invoice-for-customer?start=20#229283 "-- HikaShop version -- : 2.6.1 -- HikaMarket version -- : 1.6.7  This is the threat about the invoice that should not be generated if Vendor paid directly is set.  First shortly what happens now when vendor sells is that three (3) Invoices are generated: 1. Invoice from shop to Customer () 2. Invoice from Vendor to Customer - 3. Invoice from shop to Vendor (when generated) -  Here in details:  I've set Numbering format in HS according to our legislation rule (and as I know not only ours). It says that Invoice number should be formated as consecutive numbers without gaps.  When shop sells everithing is OK and our (looking in HS-&gt;Orders) Invoice format is correct ... until vendor sells something and p.1 happens.  I think that two things should be changed: 1. No Invoice should be generated in HS when vendors sells (as shop don't sell here and this breaks the no gap consecutive number rule) 2. Invoice from shop to vendor should take the next number according to rule format (again this rule). And now totaly different number is assigned (C2)  I've put some configuration screenshots also. , but I think deltafidesign explains the same issue  Regards!")*

Hi, Jerome.

I really don't want to imagine the whole bunch of topics you go through every day. So I will do my best to be clear enough.

**After implementin the two patches and testing:**
1. Extra Invoice issue - still not fixed by the patch
2. Wrong Invoice number - FIXED (by the last code change)

About the extra Invoice number patch what I did: I replaced the code bellow in Admin/HM/order.php

> Jerome wrote: You have to modify HikaShop to not generate the invoice id when it already have an invoice number.
> Replacing
>
> Code:
>
> if(!empty($order-&gt;order_status) &amp;&amp; empty($order-&gt;order_invoice_id) &amp;&amp; empty($order-&gt;old-&gt;order_invoice_id) &amp;&amp; $order_type == 'sale') {
>
>
>
> By Code:
>
> $already_invoice_number = ((!empty($order-&gt;order_invoice_number) &amp;&amp; !empty($order-&gt;order_invoice_created)) &#124;&#124; (!empty($order-&gt;old-&gt;order_invoice_number) &amp;&amp; !empty($order-&gt;old-&gt;order_invoice_created))); if(!empty($order-&gt;order_status) &amp;&amp; empty($order-&gt;order_invoice_id) &amp;&amp; empty($order-&gt;old-&gt;order_invoice_id) &amp;&amp; $order_type == 'sale' &amp;&amp; !$already_invoice_number) {
>
>
>
> Then, you can see to copy the "order\_invoice\_number" and "order\_invoice\_created" from the HikaMarket subsale into the HikaShop sale (I don't have yet the code for HikaMarket ; I'll need more time for that).
> Only in that case, you can stop HikaShop to generate invoice number for all "sales".

**Test Result**: Generating of invoice for suborder in HM still leads to generating of Invoice Number in HS.

**HM Configuration:**
- One Vendor
- Vendor paid directly

**The process**:
1. **Customer buys directly from Vendor** (he receives money, not we)
2. **Order** in HS **and suborder** in HM are generated
3. Changing the **suborder status** in HM to "**shipped**" leads to:
- Generating **suborder Invoice** in HM - That's OK
- Generating of **main order Invoice** - That is Not OK (as we don't sell here)

I hope it is well structured this time.

Regards!

Last edit: 10 years 9 months ago by [filiar](/forum/user/33070-filiar "View filiar's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzE5LWhpa2FtYXJrZXQvODgyMDUzLXZlbmRvci1wYWlkLWRpcmVjdGx5LXdyb25nLWludm9pY2UtZm9yLWN1c3RvbWVyP3N0YXJ0PTIwJnRtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Jerome](/forum/user/80-jerome "View Jerome's Profile")**
- [![Jerome's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar80.png)](/forum/user/80-jerome "View Jerome's Profile")
- [ Offline](/forum/user/80-jerome)
- HikaShop core developer

Less More

- Posts: 26400
- Thank you received: 4080
-
- [](http://obsi.dev)
-

10 years 9 months ago [\#229295](#229295) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[Vendor paid directly wrong Invoice for customer](/forum/19-hikamarket/882053-vendor-paid-directly-wrong-invoice-for-customer?start=20#229295 "-- HikaShop version -- : 2.6.1 -- HikaMarket version -- : 1.6.7  This is the threat about the invoice that should not be generated if Vendor paid directly is set.  First shortly what happens now when vendor sells is that three (3) Invoices are generated: 1. Invoice from shop to Customer () 2. Invoice from Vendor to Customer - 3. Invoice from shop to Vendor (when generated) -  Here in details:  I've set Numbering format in HS according to our legislation rule (and as I know not only ours). It says that Invoice number should be formated as consecutive numbers without gaps.  When shop sells everithing is OK and our (looking in HS-&gt;Orders) Invoice format is correct ... until vendor sells something and p.1 happens.  I think that two things should be changed: 1. No Invoice should be generated in HS when vendors sells (as shop don't sell here and this breaks the no gap consecutive number rule) 2. Invoice from shop to vendor should take the next number according to rule format (again this rule). And now totaly different number is assigned (C2)  I've put some configuration screenshots also. , but I think deltafidesign explains the same issue  Regards!")*

Hi,

I guess that you missed one part of my message :

> Then, you can see to copy the "order\_invoice\_number" and "order\_invoice\_created" from the HikaMarket subsale into the HikaShop sale (**I don't have yet the code for HikaMarket ; I'll need more time for that**).

That message indicates what you have to do to fix the issue and I also add that I cannot provide any code for the moment.
Which also mean that I'm working on it and that I hope that it will be include in the next release.

Regards,

---

Jerome - Obsidev.com
HikaMarket &amp; HikaSerial developer / HikaShop core dev team.

The following user(s) said Thank You: [filiar](/forum/user/33070-filiar "View filiar's Profile")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzE5LWhpa2FtYXJrZXQvODgyMDUzLXZlbmRvci1wYWlkLWRpcmVjdGx5LXdyb25nLWludm9pY2UtZm9yLWN1c3RvbWVyP3N0YXJ0PTIwJnRtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[filiar](/forum/user/33070-filiar "View filiar's Profile")**
- [![filiar's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/33070-filiar "View filiar's Profile") Topic Author
- [ Offline](/forum/user/33070-filiar)

Less More

- Posts: 134
- Thank you received: 6
-
-
-
- [](https://madein-bg.com)
-

10 years 9 months ago [\#229338](#229338) by [filiar](/forum/user/33070-filiar "View filiar's Profile")  Replied by *[filiar](/forum/user/33070-filiar "View filiar's Profile")* on topic *[Vendor paid directly wrong Invoice for customer](/forum/19-hikamarket/882053-vendor-paid-directly-wrong-invoice-for-customer?start=20#229338 "-- HikaShop version -- : 2.6.1 -- HikaMarket version -- : 1.6.7  This is the threat about the invoice that should not be generated if Vendor paid directly is set.  First shortly what happens now when vendor sells is that three (3) Invoices are generated: 1. Invoice from shop to Customer () 2. Invoice from Vendor to Customer - 3. Invoice from shop to Vendor (when generated) -  Here in details:  I've set Numbering format in HS according to our legislation rule (and as I know not only ours). It says that Invoice number should be formated as consecutive numbers without gaps.  When shop sells everithing is OK and our (looking in HS-&gt;Orders) Invoice format is correct ... until vendor sells something and p.1 happens.  I think that two things should be changed: 1. No Invoice should be generated in HS when vendors sells (as shop don't sell here and this breaks the no gap consecutive number rule) 2. Invoice from shop to vendor should take the next number according to rule format (again this rule). And now totaly different number is assigned (C2)  I've put some configuration screenshots also. , but I think deltafidesign explains the same issue  Regards!")*

Hi, Jerome.

I really missed that. I thought it was for the other issue.

Thank you again!

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzE5LWhpa2FtYXJrZXQvODgyMDUzLXZlbmRvci1wYWlkLWRpcmVjdGx5LXdyb25nLWludm9pY2UtZm9yLWN1c3RvbWVyP3N0YXJ0PTIwJnRtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

Moderators: [Obsidev](/forum/user/7040-obsidev "View Obsidev's Profile")

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.063 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
