Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/design-patterns/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Acumatica 将ParentAccountId和名称添加到AR打印语句屏幕_Acumatica - Fatal编程技术网

Acumatica 将ParentAccountId和名称添加到AR打印语句屏幕

Acumatica 将ParentAccountId和名称添加到AR打印语句屏幕,acumatica,Acumatica,我正在努力解决这个问题,看起来很简单,我可能错过了一些愚蠢的事情,但我需要一些帮助 我试图在AR503500的打印语句屏幕下的详细信息网格中添加另一个字段。该字段只是客户上的parentAccountId。DetailsResult已包含CustomerID 我扩展了AR.ARStatementPrint.DetailsResult DAC并添加了以下内容 public abstract class parentAccountTest2 : IBqlField {

我正在努力解决这个问题,看起来很简单,我可能错过了一些愚蠢的事情,但我需要一些帮助

我试图在AR503500的打印语句屏幕下的详细信息网格中添加另一个字段。该字段只是客户上的parentAccountId。DetailsResult已包含CustomerID

我扩展了AR.ARStatementPrint.DetailsResult DAC并添加了以下内容

        public abstract class parentAccountTest2 : IBqlField
    {
    }

    #region Parent Account test 2
    [PXString]
    [PXUIField(DisplayName = "Parent Account test 2")]
    [PXDBScalar(typeof(Search<Customer.parentBAccountID,
                                 Where<Customer.bAccountID, Equal<DetailsResult.customerID>>>))]
    public string ParentAccountTest2 { get; set; }
    #endregion

“details”方法称为DataView委托。在它的定义中,返回DataView的记录列表。它通常用于不适合单个BQL查询的未绑定DAC和自定义逻辑。在“详细信息”DataView委托中,新记录创建为空,然后在其中复制值

我怀疑在执行PXDBScalar时CustomerID为null,因为DAC记录是空白的

对于在DataView委托而不是DAC中计算值的情况,可以使用FieldSelecting事件处理程序在执行委托后计算自定义字段的值

请注意,DAC扩展不包含BQL查询:

public class DetailsResultExt: PXCacheExtension<ARStatementPrint.DetailsResult>
{
    #region Parent Account  
    public abstract class parentAccount : IBqlField { }

    [PXString(60, IsUnicode = true)]
    [PXUIField(DisplayName = "Parent Account")]
    public virtual string ParentAccount { get; set; }
    #endregion
}
公共类详细信息结果文本:PXCacheExtension

自定义字段将显示父业务帐户名称:

有两个抽象类,它们是如何相互关联的。属性
ParentAccountTest2
属于哪个类?您能否共享
详细信息
复制
方法的代码?
DetailsResult
class在哪里?ParentAccountTest2是我添加到DetailsResult扩展中的字段。更新了这些方法的帖子。详情结果在PX.Objects.AR.AR.statementprint上。感谢您的详细回答。工作很愉快。
    public virtual void Copy(ARStatement aSrc, Customer cust)
{
    this.CustomerID = cust.BAccountID;
    this.UseCurrency = cust.PrintCuryStatements;
    this.StatementBalance = aSrc.EndBalance ?? decimal.Zero;
    this.AgeBalance00 = aSrc.AgeBalance00 ?? decimal.Zero;
    this.CuryID = aSrc.CuryID;
    this.CuryStatementBalance = aSrc.CuryEndBalance ?? decimal.Zero;
    this.CuryAgeBalance00 = aSrc.CuryAgeBalance00 ?? decimal.Zero;
    this.DontEmail = aSrc.DontEmail;
    this.DontPrint = aSrc.DontPrint;
    this.Emailed = aSrc.Emailed;
    this.Printed = aSrc.Printed;
            this.BranchID = aSrc.BranchID;
}
public class DetailsResultExt: PXCacheExtension<ARStatementPrint.DetailsResult>
{
    #region Parent Account  
    public abstract class parentAccount : IBqlField { }

    [PXString(60, IsUnicode = true)]
    [PXUIField(DisplayName = "Parent Account")]
    public virtual string ParentAccount { get; set; }
    #endregion
}
public class ARStatementPrint_Extension : PXGraphExtension<ARStatementPrint>
{
    #region Event Handlers
    protected virtual void DetailsResult_ParentAccount_FieldSelecting(PXCache sender, PXFieldSelectingEventArgs e)
    {
        ARStatementPrint.DetailsResult detailsResult = e.Row as ARStatementPrint.DetailsResult;

        if (detailsResult != null)
        {
            BAccount2 bAccount = PXSelectJoin<BAccount2,
                                 InnerJoin<Customer, On<Customer.bAccountID, Equal<Required<ARStatementPrint.DetailsResult.customerID>>>>,
                                 Where<BAccount2.bAccountID, Equal<Customer.parentBAccountID>>>.Select(Base, detailsResult.CustomerID);

            if (bAccount != null)
            {
                e.ReturnValue = bAccount.AcctName;
            }
        }
    }
    #endregion
}