![](https://uploads-us-west-2.insided.com/acumatica-en/attachment/76ad109c-f232-4874-9340-5b91709b8d16.png)
In sales quotes screen I am updating the ExtPrice of the non stock items based on some other fields by calculations. But the Amount is not changing as it does when we normally change the ExtPrice of the item. Can anyone help me here with this.
In sales quotes screen I am updating the ExtPrice of the non stock items based on some other fields by calculations. But the Amount is not changing as it does when we normally change the ExtPrice of the item. Can anyone help me here with this.
Hi
Ext.Price = Qty * Unit Price
Amount = Qty * Unit Prie - Discount Amount
CROpportunityProducts row = (CROpportunityProducts)e.Row;
CROpportunityProductsExt rowExtension = row.GetExtension<CROpportunityProductsExt>();
row.CuryExtPrice = rowExtension.UsrInternalExtCost + (data * rowExtension.UsrInternalExtCost);
protected void CROpportunityProducts_RowUpdated(PXCache cache, PXRowUpdatedEventArgs e)
{
CROpportunityProducts row = (CROpportunityProducts)e.Row;
CROpportunityProductsExt rowExtension = row.GetExtension<CROpportunityProductsExt>();
if (row is null) return;
InventoryItem inventoryItem = PXSelectorAttribute.Select<CROpportunityProducts.inventoryID>(cache, row) as InventoryItem;
if (inventoryItem is null) return;
InventoryItemCurySettings curySettings =
InventoryItemCurySettings.PK.Find(
this.Base, inventoryItem.InventoryID, rowExtension.UsrInventoryCuryId ?? "USD");
bool isStkItem = inventoryItem.StkItem ?? false;
if (!isStkItem)
{
// get inventoryItemCurySettings extension
InventoryItemCurySettingsExt inventoryItemCurySettingsExt = curySettings.GetExtension<InventoryItemCurySettingsExt>();
if (rowExtension.UsrSelectedPriceModifier != 0 || rowExtension.UsrSelectedPriceModifier != null)
{
PriceModifier priceModifier = PXSelectorAttribute.Select<CROpportunityProductsExt.usrSelectedPriceModifier>(cache, row) as PriceModifier;
if (priceModifier != null)
{
decimal data = (decimal)priceModifier.Percentage / 100;
row.CuryExtPrice = rowExtension.UsrInternalExtCost + (data * rowExtension.UsrInternalExtCost);
row.ExtPrice = rowExtension.UsrInternalExtCost + (data * rowExtension.UsrInternalExtCost);
}
}
}
}
Hi
protected void CROpportunityProducts_RowUpdated(PXCache cache, PXRowUpdatedEventArgs e)
{
CROpportunityProducts row = (CROpportunityProducts)e.Row;
CROpportunityProductsExt rowExtension = row.GetExtension<CROpportunityProductsExt>();
if (row is null) return;
InventoryItem inventoryItem = PXSelectorAttribute.Select<CROpportunityProducts.inventoryID>(cache, row) as InventoryItem;
if (inventoryItem is null) return;
InventoryItemCurySettings curySettings =
InventoryItemCurySettings.PK.Find(
this.Base, inventoryItem.InventoryID, rowExtension.UsrInventoryCuryId ?? "USD");
bool isStkItem = inventoryItem.StkItem ?? false;
if (!isStkItem)
{
// get inventoryItemCurySettings extension
InventoryItemCurySettingsExt inventoryItemCurySettingsExt = curySettings.GetExtension<InventoryItemCurySettingsExt>();
if (rowExtension.UsrSelectedPriceModifier != 0 || rowExtension.UsrSelectedPriceModifier != null)
{
PriceModifier priceModifier = PXSelectorAttribute.Select<CROpportunityProductsExt.usrSelectedPriceModifier>(cache, row) as PriceModifier;
if (priceModifier != null)
{
var extPrice = row.CuryExtPrice;
decimal data = (decimal)priceModifier.Percentage / 100;
row.CuryExtPrice = rowExtension.UsrInternalExtCost + (data * rowExtension.UsrInternalExtCost);
cache.RaiseFieldUpdated<CROpportunityProducts.curyExtPrice>(row, extPrice);
}
}
}
}
Glad that I helped you with the above code and thanks for sharing the update!
Hi
We want to update some incorrect Ext. Price on the Sales Order with already completed status.
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.