Skip to main content

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


Forum|alt.badge.img

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


 

    }

}

 

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

4 replies

andriikravetskyi35
Jr Varsity I
Forum|alt.badge.img+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();


Forum|alt.badge.img

Hi @andriikravetskyi35 ,

I tried it and but it’s not working.

Thanks


Forum|alt.badge.img+5
  • Captain II
  • 503 replies
  • March 6, 2023

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.

 


Forum|alt.badge.img

Hi @Django ,

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


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