I have a few sales orders set up as auto-invoice and so invoices are generated automatically from Sales Orders.
However, occasionally, orders have discounts applied to them. These discounts are not on the invoice for some reason.
The Subtotal field at the top should be the discounted amount on the order. Can you show what the line(s) on that invoice look like? It should show the Extended Price and Discount amount on the line.
It’s possible that the issue is that I am applying the discount to the orderhed record rather than applying a misc charge or similar. When an invoice is generated from this order, it might not check the discount field
So when Discount % is added to a Sales Order (Header), it asks if you want the discount applied to the lines. It looks like it wasn’t applied to the lines. It’s very strange to me that the summary fields on the order do show that it’s discounted though. It shouldn’t do that.
That said, the invoice will look specifically at the order lines, so if there’s no discount on the lines, they won’t pull through to the invoice.
This is very useful information, thank you for sharing.
I am creating the orders via REST API. That means I’m inserting an OrderHed record with the discount field already filled out.
Then I’m adding lines individually with no discounts on them.
I did this because we figured there should only be one discount and it isn’t line specific, so it should technically go on the header.
You’re saying that the discount(s) should be on the lines. Do you think it’s a good approach to add all of my (header-level) discounts to the first line instead? This way they’ll later also go on the invoice?
If you’re creating the OrderHed first, with the discount, the lines should pick that discount up by default, unless you’re specifically specifying $0 for OrderDtl.TotalDiscount or 0% for OrderDtl.DiscountPercent.
Are you using the UpdateExt method in your API calls? If so, you should be able to leave those fields out of your payload, and it should bring that discount in.
Or, even simpler, you can leave everything as you have it, but do an additional call to SalesOrderSvc.ApplyOrderHedDiscountToLines( int OrderNum ) after you’re done.
I am using the rest api to straight up create an OrderHed record, not via any business methods. I am also not passing the discount into the OrderHed.TotalDiscount, but rather the OrderHed.DocTotalDiscount (since we’re dealing with 2 currencies - it uses the right currency).
I will try running SalesOrderSvc.ApplyOrderHedDiscountToLines( int OrderNum ) as you suggested, let’s see if it can fix my approach.
May I suggest doing all of the work in a Function and call that function via REST? It reduces the coupling with your REST client since it won’t need to know Kinetic details. It will also limit the number of calls making it faster. It also makes testing easier as you only need one call. All the BO calls are the same but occur at the server. Just a thought.
You’re right, that’s on the horizon. For now, I have to bandaid production processes.
Thank you for your suggestion, I’ll keep it in mind. I was planning on doing everything in Epicor functions. Good to see others would do the same thing.
Interesting. You call that method after all the lines are added? I did it in Epicor and ran a trace, and that was the only method after MasterUpdate. Ill do some more testing as soon as I get a chance.
Yes, I had the order header and lines all created, then applied a discount to the OrderHed row. Following that, I ran this method, created a shipment, shipped the shipment, closed the order, and printed out the invoice, but no discount showed up on the invoice.
For now, I’m applying a negative misc charge to the orderhed.
I tried adding a discount to the first line, but the reports don’t look very nice when only the first line is discounted, it doesn’t really make sense either.
Can I ask why you would add the discount only to the first line? Is it not a percentage discount?
No, it’s not a percentage. Sometimes customers get a one-time discount like $25 for an order or something like that. In this case, I don’t think it makes sense to apply a percentage discount when it’s just a general discount that doesn’t really depend on the lines.
I understand now. Yes that wouldn’t work with the ApplyOrderHedDiscountToLines as that method is looking for the OrderHed.DiscountPercent field.
What field are you actually putting the discount in? Is it DocTotalDiscount? That field should not be updated manually, as it is supposed to be an aggregate of discounts on the lines, calculated by the system. There isn’t really a mechanism for adding a fixed discount amount at the header level.
Your negative misc charge should work. If the order doesn’t ship complete, the value selected in the Misc Charge “frequency” field will determine which invoice it pulls through to. E.G. If you select “First” then the misc charge will go to the first invoice generated for the order, etc.