Skip to main content
Solved

Ext price not updating


param2022
Jr Varsity II
Forum|alt.badge.img

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.

Best answer by Naveen Boga

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

 

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

10 replies

Naveen Boga
Captain II
Forum|alt.badge.img+19
  • Captain II
  • 3381 replies
  • November 18, 2022

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

param2022
Jr Varsity II
Forum|alt.badge.img
  • Author
  • Jr Varsity II
  • 94 replies
  • November 18, 2022

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

 


Naveen Boga
Captain II
Forum|alt.badge.img+19
  • Captain II
  • 3381 replies
  • November 18, 2022

Hi @param2022  Can you share the complete event code?


param2022
Jr Varsity II
Forum|alt.badge.img
  • Author
  • Jr Varsity II
  • 94 replies
  • November 18, 2022

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

 


Naveen Boga
Captain II
Forum|alt.badge.img+19
  • Captain II
  • 3381 replies
  • Answer
  • November 18, 2022

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

 


param2022
Jr Varsity II
Forum|alt.badge.img
  • Author
  • Jr Varsity II
  • 94 replies
  • November 18, 2022

@Naveen Boga that worked thank you.

 


Naveen Boga
Captain II
Forum|alt.badge.img+19
  • Captain II
  • 3381 replies
  • November 18, 2022

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


Hi @param2022 and @Naveen Boga, do you have a code that updates the Ext.Price for the Stock Items? Tia.


Naveen Boga
Captain II
Forum|alt.badge.img+19
  • Captain II
  • 3381 replies
  • May 22, 2024

@sharmaineongyaco56  Can you please let us know when you wanted to update Ext  Price field?


We want to update some incorrect Ext. Price on the Sales Order with already completed status.


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