API Forum

This forum is in read-only mode.
Please refer to our API support in case you have any questions.
We can be reached at api@e-conomic.com
e-conomic API developer forum

Creating Order_lines for Order in .net


Hi ,

My sample code for creating Orderline:

IOrder _order = session.Order.Create(debtor);
 IOrderLineData _orderLine = session.OrderLineData.Create(_order);
_orderLine.Product = prodct;
                   _orderLine.Description = prodName;
                   _orderLine.Quantity = 1;
                   _orderLine.Product.SalesPrice = saleprice;
it creates orderline with unitcose price as 0.How to set unit cost price of orderline.
created Jun 6, 2013 by kalpana
100% Accept Rate
Q 1 A 0 C 2

1 Answer

Best answer
Hi Kalpana,

You cannot set the cost price on the order line explicitly - it's automatically determined by your product's cost price (Product.CostPrice). That, however, you are free to change - that is, unless you're using our Stock Management add-on module, in which case product cost prices are maintained automatically (in connection with purchases being registered).

As a comment to your code, I believe you're setting the wrong sales price: You're setting the ('default') sales price of the product, rather than the unit net price on the order line. What you'd probably like to do is something like:

_orderLine.UnitNetPrice = Product.SalesPrice
_orderLine.UnitNetPrice = saleprice

- depending on whether you wish to explicitly set a specific sales price, or pick up the default sales price set up on the product master information.


Best regards,
answered Jun 11, 2013 by Christian Estrup
selected Oct 5, 2013 by kalpana
Hi Christian Estrup,

Thanks for your reply.

I implemented the process as you suggested(_orderLine.UnitNetPrice = Product.SalesPrice),it won't shows any error but the value of UnitPrice was not inserted in Orders of Orderline.

Hi Christian Estrup,

Sorry for the above comment,

_orderLine.UnitNetPrice = Product.SalesPrice;

 this line of code sets the unit cost price of the order line.

Thank you so much.
Visma e-conomic A/S