Solved

Ext price not updating

  • 18 November 2022
  • 7 replies
  • 87 views

Userlevel 2
Badge

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.

icon

Best answer by Naveen Boga 18 November 2022, 10:49

View original

7 replies

Userlevel 7
Badge +17

Hi @param2022  Can you please try with the below code?

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

 

Userlevel 7
Badge +17

Hi @param2022  Yes

Ext.Price = Qty * Unit Price

Amount = Qty * Unit Prie - Discount Amount 

  1. Do you have any customization with those fields? if yes, please unpublish and check to identify the root cause
  2. I see there are no line level discounts but any Document level discount applied
Userlevel 2
Badge

@Naveen Boga that worked thank you.

 

Userlevel 2
Badge

@Naveen Boga I have customization that updates the Ext.Price for the Non Stock Items. Here is the code snippet. The Ext.price is updated but not the Amount.


 

CROpportunityProducts row = (CROpportunityProducts)e.Row;

CROpportunityProductsExt rowExtension = row.GetExtension<CROpportunityProductsExt>();

row.CuryExtPrice = rowExtension.UsrInternalExtCost + (data * rowExtension.UsrInternalExtCost);

 

Userlevel 7
Badge +17

Hi @param2022  Can you share the complete event code?

Userlevel 2
Badge

@Naveen Boga plz see it below

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

 

Userlevel 7
Badge +17

Glad that I helped you with the above code and thanks for sharing the update! @param2022 

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved