cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

DI API Shipping Expense

Former Member
1,334

We have a custom program that allows our website to transmit orders through the DI API along with a shipping expense to the RDR3 table.  We have noticed that these orders are not closing out when they are being taken to a delivery if there is a shipping expense created.  The line level on the RDR1 table is being closed but the sales order document remains open and so does the line on the RDR3 table.

Below is the code that is generating the freight add amount.  I am wondering if we are missing a column that should be updated or maybe the RDR3 line should be closed when it is added (we have no one reviewing these orders, so no changes would be made to the RDR3 table).


if(order.TotalShippingCharged != "")

  {

  oOrder.Expenses.ExpenseCode = 1;

  oOrder.Expenses.LineTotal = Convert.ToDouble(order.TotalShippingCharged);

  oOrder.Expenses.Add();

  }

Accepted Solutions (1)

Accepted Solutions (1)

Johan_Hakkesteegt
Active Contributor
0 Kudos

Hi Tim,

This happens when the oOrder.Expenses.LineTotal is zero.

You need to extend your code to first check that Convert.ToDouble(order.TotalShippingCharged) > 0

If not, do not add expense at all.

Regards,

Johan

Answers (1)

Answers (1)

patrice_vigier
Participant
0 Kudos

I was looking for a way to insert freight value into a sales order, your question helped me to find the solution.