AddInventoryItem setting SellPriceExGST  Topic is solved

Discussions relating to plugin development, and the Jiwa API.

AddInventoryItem setting SellPriceExGST

Postby neil.interactit » Wed May 15, 2024 7:56 pm

Hi guys,

I'm stuck on a simple issue. The SellPriceExGST set for an AddInventoryItem salesOrderLine is getting overidden with the inventory item pricing. I have tried setting a few differing properties and looked through the avilable salesOrderLine methods, but can't spot the solution.

Here's the code:

Code: Select all
            foreach (var item in items)
            {
                var inventory = _salesOrder.Manager.EntityFactory.CreateEntity<JiwaFinancials.Jiwa.JiwaApplication.Entities.Inventory.Inventory>();
                try { inventory.ReadRecordFromPartNo(item.ManufacturerPart); }
                catch (Exception) { warnings.Add("Part not found: " + item.ManufacturerPart); continue; }
                if (string.IsNullOrEmpty(inventory.InventoryID)) { warnings.Add("Part not found: " + item.ManufacturerPart); continue; }
                object newKey = "";
                _salesOrder.SalesOrderLines.AddInventoryItem(inventory.InventoryID, SalesOrderLineCollection.SalesOrderLineInventorySeedTypes.e_SalesOrderLineInventoryID, ref newKey);
                var salesOrderLine = _salesOrder.SalesOrderLines[newKey.ToString()];
                salesOrderLine.SellPriceExGST = item.SellEx;
                salesOrderLine.QuantityOrdered = item.Quantity ?? 0;
            }

Could you advise?

Cheers,
Neil
neil.interactit
Kohai
Kohai
 
Posts: 232
Joined: Wed Dec 03, 2014 2:36 pm
Topics Solved: 6

Re: AddInventoryItem setting SellPriceExGST  Topic is solved

Postby SBarnes » Thu May 16, 2024 12:11 am

This works for me

Code: Select all
                            salesorder.SalesOrderLines[(KeyToGetBackHere as string)].FixPrice = true;
                            salesorder.SalesOrderLines[(KeyToGetBackHere as string)].FixSellPrice = true;
                            salesorder.SalesOrderLines[(KeyToGetBackHere as string)].DiscountedPrice = (decimal)DiscountValue;


Although I'll admit Mike keeps telling me the setting the fix properties shouldn't be necessary but see if that resolves it.
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1646
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 182

Re: AddInventoryItem setting SellPriceExGST

Postby neil.interactit » Thu May 16, 2024 9:59 am

Perfect! Many thanks Stuart.

Cheers,
Neil.
neil.interactit
Kohai
Kohai
 
Posts: 232
Joined: Wed Dec 03, 2014 2:36 pm
Topics Solved: 6


Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 4 guests