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
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
Best answer by aiwan
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);
}
}
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.