Skip to main content

Hello everyone,

 

I am attempting to pull the unit cost for Sales Quotes from InventoryItemCurySettings to automate our gross profit calculations.

Has anyone had any luck doing so?

 

Thanks,

Aleks

protected virtual void _(Events.FieldUpdated<CROpportunityProducts, CROpportunityProducts.inventoryID> e)
{
CROpportunityProducts row = e.Row;
if(row.InventoryID == null) return;

if(row.InventoryID != null)
{
InventoryItemCurySettings curySettings = SelectFrom<InventoryItemCurySettings>.
Where<InventoryItemCurySettings.inventoryID.IsEqual<@P.AsInt>>.View.Select(Base, row.InventoryID);

var unitCost = curySettings.StdCost;

e.Cache.SetValueExt<CROpportunityProducts.unitCost>(row, unitCost);
}
}

 


Reply