Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
806 views
in Technique[技术] by (71.8m points)

acumatica - Prepare Payments page not showing PayDate after adding a filter

I added a new filter to Prepare payment(AP503000). The filter works as expected.

After testing I realized that the Pay Date(APInvoice.PayDate) doesn't show data in the grid How can I make the paydate data show?

enter image description here

I see that a lot of the data comes from APAdjust and the data missing comes from APInvoice.

CODE:

namespace PX.Objects.AP
{
    // Acuminator disable once PX1016 ExtensionDoesNotDeclareIsActiveMethod extension should be constantly active
    public class APPayBills_Extension : PXGraphExtension<APPayBills>
    {
        #region Event Handlers

        [PXFilterable]
        public PXFilteredProcessingJoin<
            APAdjust, PayBillsFilter,
            InnerJoin<APInvoice,
                On<APInvoice.docType, Equal<APAdjust.adjdDocType>,
                And<APInvoice.refNbr, Equal<APAdjust.adjdRefNbr>>>,
            LeftJoin<APTran,
                On<APInvoice.paymentsByLinesAllowed, Equal<True>,
                And<APTran.tranType, Equal<APAdjust.adjdDocType>,
                And<APTran.refNbr, Equal<APAdjust.adjdRefNbr>,
                And<APTran.lineNbr, Equal<APAdjust.adjdLineNbr>>>>>>>>
            APDocumentList;

        protected virtual IEnumerable apdocumentlist()
        {
            PayBillsFilter row;

            row = Base.Filter.Select();

            PayBillsFilterExt payBillsFilterExt = row.GetExtension<PayBillsFilterExt>();


            foreach (APAdjust item in Base.APDocumentList.Select())
            {

                if (!string.IsNullOrEmpty(payBillsFilterExt.UsrEPEmployee))
                {
                    //To test remove all code and only leave the else ( yield return item;)
                    BAccount bAccount = PXSelect<
                        BAccount,
                        Where<BAccount.bAccountID, Equal<Required<APAdjust.vendorID>>>>
                        .Select(Base, item.VendorID);
                    BAccountExt bAccountExt = bAccount.GetExtension<BAccountExt>();

                    if (bAccountExt.UsrEmployeeID == payBillsFilterExt.UsrEPEmployee)
                    {
                        yield return item;
                    }
                }
                else
                {                    
                     yield return item;
                }
            }    
        }

        #endregion
    }
}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You're yielding an APADjust record when your view is a join between the two tables APAdjust & APInvoice. Try something like this:

 protected virtual IEnumerable apdocumentlist()
 {
    var sel = new PXSelectJoin<APAdjust... (view definition) 
    foreach( var rec in sel.Select()) 
    {  
      Check your field;    
      yield rec; 
    }
  }

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...