Discounts not showing on ARInvoices

Hello everyone,

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.

Here’s an example:

Order:
image

Invoice:
image

Does anyone have experience with this?

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.

2 Likes

Thank you for the reply!

The lines look like the lines on the sales order.
Here’s the invoice line:

Here’s the sales order line:

The discounts are not on the line, they’re on the OrderHed as far as I know

The misc charges include a shipping charge that was discounted for the customer.

1 Like

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

1 Like

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.

2 Likes

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?

Thank you very much for your time!

1 Like

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.

2 Likes

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.

2 Likes

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.

Thank you very much!

I’m misunderstanding, is this a custom API (not Epicor’s REST Services)?

1 Like

Sorry, I wasn’t clear. It seems to use UpdateExt

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.

3 Likes

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.

1 Like

^-THIS!!! I wish we’d done it when we made our ecom site… maybe next time.

2 Likes

Okay, so I can confirm that this approach doesn’t work.
Unless I need to run another Update after running this method, it doesn’t work.

I will try applying the discount to the first OrderDtl.DocDiscount and see what happens.

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.

1 Like

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. :person_shrugging:

Can I ask why you would add the discount only to the first line? Is it not a percentage discount?

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.

3 Likes