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

How to set Order Lines cost price

0

I am creating order line using .net api provided by e-conomic.

I am using following code snipet.

 var tmpline = _session.OrderLine.Create(order);
            var lineData = _session.OrderLineData.GetData(tmpline);
            var units = GetAllUnits().ToArray();
            var UnitsData = GetAllUnitsData(units).ToArray();
 
            if (product != null)
            {
                product.SalesPrice = line.SalesPrice;
                product.CostPrice = line.CostPrice;
                
                var unitData = UnitsData.FirstOrDefault(x => x.Name == line.Unit);
                if(unitData!=null)
                {
                    var unit = units.ElementAt(UnitsData.ToList().IndexOf(unitData));
                    product.Unit = unit;
                }
                lineData.Product = product;
                lineData.Unit = product.Unit;
            } 
            lineData.Quantity = line.Quantity;
            lineData.UnitNetPrice = line.SalesPrice;//.Price.SalesPrice;
            lineData.UnitCostPrice = line.CostPrice;
            
            lineData.Description = line.Name;
           
            _session.OrderLine.UpdateFromData(lineData);
 
But i am unable to set cost price for an order. i checked some posts here but i did not get clear about my issue please help me for this issue. thanks
created Nov 10, 2015 by anonymous

1 Answer

0
Hi Zulqanain,

Do you by any chance have the inventory module enabled on this agreement? If the inventory module is enabled, then the cost price is read only.
answered Nov 18, 2015 by rbb
how can i check for inventory module enabled or disabled.
sorry i was not working on that module and was unable to follow the answer. thanks for your answer.
Visma e-conomic A/S
...