Select Issue-Select one Poline and automatically select all polines relate with same poorder number


Userlevel 3
Badge

HI,

I develop a custom smart panel for my custom screen. I need to add the purchase order lines data into my screen details section.

The issue is When I select one row and click the ADD button, all the polines related with the same PO number added to the details table.

Below I have added screen shots for your reference.

 

This is my graph extension code and InsertSelectedLines action is the Add purchase order action.

namespace GRIProformaInvoice.Extension

{

    // Acuminator disable once PX1016 ExtensionDoesNotDeclareIsActiveMethod extension should be constantly active

    public class APProformaEntry_Extension : PXGraphExtension<APProformaEntry>

    {

 

        public SelectFrom<POOrder>.InnerJoin<POLine>.

            On<POLine.orderNbr.IsEqual<POOrder.orderNbr>>.View POrdersView;

 

        public PXAction<APProforma> MyAction;

       

[PXUIField(DisplayName = "Add Purchase", MapEnableRights = PXCacheRights.Select, MapViewRights = PXCacheRights.Select)]

        [PXButton(CommitChanges = true)]

        public virtual IEnumerable myAction(PXAdapter adapter)

        {

 

            if (POrdersView.AskExt() == WebDialogResult.OK)

                {

                   

                    return InsertSelectedLines(adapter);


 

                }

                return adapter.Get();


 

        }

 

       public virtual IEnumerable InsertSelectedLines(PXAdapter adapter)

        {

 

            if (POrdersView != null)

            {

                int lineNbr = Base.APProformaItems.Select().Count + 1;

 

                foreach (PXResult<POOrder, POLine> result in POrdersView.Select())

                {

                    POOrder order = result;

                    POLine line = result;


 

                    if (order.Selected == false) continue;

 

                    {

                        APProformaItemList toBeInserted = new APProformaItemList();

                        toBeInserted.Ponbr = “aa”;

                        toBeInserted.LineNbr = lineNbr++;

                        toBeInserted.POLineNbr = line.LineNbr;

                        toBeInserted.POrderQty = 30;

                        toBeInserted.Itemid = 25;

                        toBeInserted = Base.APProformaItems.Insert(toBeInserted);

                        Base.APProformaItems.Update(toBeInserted);

 

                    }

                }

 

            }

            return adapter.Get();


 

    }

}

 


4 replies

Userlevel 5
Badge +1

Hi, I am not sure, but maybe try to swap POOrder and POLine tables in your view obj, like this:

  public SelectFrom<POLine>.InnerJoin<POOrder>.

            On<POLine.orderNbr.IsEqual<POOrder.orderNbr>>.View POrdersView;

 

Also, it could be needed to clear cache of pop up screen

Base.APProformaItems.Cache.Clear();

Userlevel 3
Badge

Hi @andriikravetskyi35 ,

I tried it and but it’s not working.

Thanks

Userlevel 7
Badge +5

I’ve noticed that you and this user are working on the exact same project with the exact same source code. Are you on the same team? It might be worth just having one thread.

 

Userlevel 3
Badge

Hi @Django ,

yes but we didn’t get any correct answer.That’s why I have uploaded this question again from my side

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