3
votes

I am trying to create a smart panel on the Sales Order screen that will show related items to the SOLine inventory item.

I have added a tab and grid on the stock item page and created a table with DAC of CFBSUPSale to create this relationship. All of this is working as expected.

I have the smart panel opening and all columns are showing, but no data is displayed. I know that additional code will be needed to get the data from the smart panel to the SOLine, but at this point all I am trying to do is get the related items to show in panel.

Here is the html for the smart panel:

<px:PXSmartPanel runat="server" ID="UpSalePanel" Caption="Supplemental Items" Height="500px" Width="1100px" Key="UpSaleData1" CaptionVisible="True" LoadOnDemand="True">
    <px:PXGrid runat="server" ID="UpSaleGrid" AdjustPageSize="Auto" SkinID="Inquire" Width="100%" Height="250px" DataSourceID="ds">
      <Levels>
        <px:PXGridLevel DataMember="UpSaleData1">
          <Columns>
            <px:PXGridColumn DataField="UpSaleID" Width="70" />
            <px:PXGridColumn DataField="UsrSelected" Width="60" />
            <px:PXGridColumn DataField="UpInvID" Width="70" />
            <px:PXGridColumn DataField="UpInvDescr" Width="200" />
            <px:PXGridColumn DataField="RequiredItem" Width="60" />
            <px:PXGridColumn DataField="RequiredQty" Width="70" /></Columns></px:PXGridLevel></Levels></px:PXGrid>
    <px:PXPanel runat="server" ID="PXUpSalePnl">
      <px:PXButton runat="server" ID="CstButton4" Text="Add" />
      <px:PXButton runat="server" ID="CstButton5" Text="Add &amp; Close" DialogResult="OK" />
      <px:PXButton runat="server" ID="CstButton6" Text="Cancel" DialogResult="Cancel" /></px:PXPanel></px:PXSmartPanel>

Here is the SOOrderEntry code:

//Retreiving data from CFBSregistrationGroup table and creating RegistrationGroup view.
public PXSelect<CFBSUpSale, Where<CFBSUpSale.invID, Equal<Current<SOLine.inventoryID>>>> UpSaleData1; 
public PXFilter<UpSalePnlDAC> UpSaleData2;

public PXAction<SOOrder> cMDUpSale;
[PXUIField(DisplayName = "Supplemental Items", MapViewRights = PXCacheRights.Select)]
[PXButton(ImageKey = PX.Web.UI.Sprite.Main.DataEntryF)]
protected virtual IEnumerable CMDUpSale(PXAdapter adapter)
{
    if (Base.Transactions.Current != null &&
        UpSaleData1.AskExt() == WebDialogResult.OK)
    {
        //Stuff goes here to move data from panel back to SOLine
    }

    return adapter.Get();
}

One other issue that I am having is that I believe that the the PXAction line should not be using SOOrder but should be SOLine line, but when I modify this the smart panel will not show at all. With the code as it is now, the button shows on the SOOrder header as well as on the SOLine grid header. This is the only way I have been able to get the panel to show when button is pushed.

Any help would be greatly appreciated.

2

2 Answers

3
votes

The issue ended up being that we did not have the AutoCallBack-Target and AutoCallBack-Command set correctly. The items displayed in the grid if we manually hit the refresh button, but were not being displayed automatically. This led us to believe that the code was not working.

<px:PXSmartPanel runat="server" ID="UpSalePanel" Caption="Supplemental Items" Height="500px" Width="1100px" Key="UpSaleData1" CaptionVisible="True" AutoCallBack-Target="UpSaleGrid" AutoCallBack-Command="Refresh">
1
votes

Consider reviewing how the Allocations popup is implemented on SOOrderEnty, ScreenID = SO301000. A PXAction is not involved, but instead an ActionBar markup is found within the px:PXTabItem:

  <px:PXTabItem Text="Document Details"> 

and then a px:PXToolBarButton which calls the BinLotSerial method of LSSOLine class:

<px:PXToolBarButton Text="Allocations" Key="cmdLS" CommandName="LSSOLine_binLotSerial" CommandSourceID="ds" DependOnGrid="grid"> 

It is the LSSOLine class which defines the BQL Select statement using a PXSelectBase:

public class LSSOLine : LSSelectSOBase<SOLine, SOLineSplit, 
Where<SOLineSplit.orderType, Equal<Current<SOOrder.orderType>>,
And<SOLineSplit.orderNbr, Equal<Current<SOOrder.orderNbr>>>>>

The BinLotSerial method in turn calls the PXSelectBase's View.Ask() to offer the popup.