Skip to main content
Solved

Pulling Unit Cost from InventoryItemCurySettings for Sales Quotes

  • January 29, 2024
  • 1 reply
  • 52 views

Forum|alt.badge.img+8
  • Captain II
  • 357 replies

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);
}
}

 

View original
Did this topic help you find an answer to your question?

1 reply

Forum|alt.badge.img+8
  • Author
  • Captain II
  • 357 replies
  • Answer
  • May 22, 2024
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


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings