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.
![](https://uploads-us-west-2.insided.com/acumatica-en/attachment/3ce6f597-57cf-42f6-9a5d-1882cce4da58.png)
![](https://uploads-us-west-2.insided.com/acumatica-en/attachment/1c65397c-de10-4029-8db0-e0ac864aa02d.png)
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)]
tPXButton(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();
}
}