Skip to main content
Answer

Can I put customer balance on SO screen(SO301000) without writing code

  • October 11, 2020
  • 2 replies
  • 310 views

Forum|alt.badge.img+6

Hello,

      I know a little about customization projects but I am still afraid of writing code. I have a requirement that to display customer credit limit and customer balance on SO screen (SO301000) .

         For customer credit limit, the SO screen already have “cusotmer” Data view, and that view has customer credit limit, so I can simply use it.

         However customer balance exists in “customerbalance”  view, and this view does NOT associate with SO screen right now. SO I can not use it directly.

       I know probably with code writing that as BQL or something, I can get the customer balance.

But I am wondering is there a better/easier way I can achieve this requirement.

      Thank you in advance. If I have to use code, can somebody give me a sample for reference?

Best answer by Nayan Vadher

Yes it will require writing code.  The approach will require one to create similar customerbalance view in Sales Order screen.  e.g. code would be:

namespace PX.Objects.SO
{
using PX.Objects.AR;
using System.Collections;

public class SOOrderEntryExt : PXGraphExtension<SOOrderEntry>
{
protected Lazy<CustomerMaint> lazyCustomerMaint =
new Lazy<CustomerMaint>(() => PXGraph.CreateInstance<CustomerMaint>());

public PXFilter<CustomerMaint.CustomerBalanceSummary> CustomerBalance;
protected virtual IEnumerable customerBalance()
{
Customer customer = Base.customer.Current;
if (customer != null && customer.BAccountID > 0L)
{
var g = lazyCustomerMaint.Value;
g.BAccount.Current = g.BAccount.Search<BAccount.bAccountID>(customer.BAccountID);
g.CustomerBalance.Current = g.CustomerBalance.Select();
yield return g.CustomerBalance.Current;

}
}

}
}

 

2 replies

Nayan Vadher
Community Manager
Forum|alt.badge.img+2
  • Acumatica Developer Support
  • Answer
  • October 13, 2020

Yes it will require writing code.  The approach will require one to create similar customerbalance view in Sales Order screen.  e.g. code would be:

namespace PX.Objects.SO
{
using PX.Objects.AR;
using System.Collections;

public class SOOrderEntryExt : PXGraphExtension<SOOrderEntry>
{
protected Lazy<CustomerMaint> lazyCustomerMaint =
new Lazy<CustomerMaint>(() => PXGraph.CreateInstance<CustomerMaint>());

public PXFilter<CustomerMaint.CustomerBalanceSummary> CustomerBalance;
protected virtual IEnumerable customerBalance()
{
Customer customer = Base.customer.Current;
if (customer != null && customer.BAccountID > 0L)
{
var g = lazyCustomerMaint.Value;
g.BAccount.Current = g.BAccount.Search<BAccount.bAccountID>(customer.BAccountID);
g.CustomerBalance.Current = g.CustomerBalance.Select();
yield return g.CustomerBalance.Current;

}
}

}
}

 


purwandaruw
Freshman II
Forum|alt.badge.img
  • Freshman II
  • October 14, 2020

 Interesting Nayan,

Will inform this also to my team to pull out data for vendor tab. 

Yes it will require writing code.  The approach will require one to create similar customerbalance view in Sales Order screen.  e.g. code would be:

namespace PX.Objects.SO
{
using PX.Objects.AR;
using System.Collections;

public class SOOrderEntryExt : PXGraphExtension<SOOrderEntry>
{
protected Lazy<CustomerMaint> lazyCustomerMaint =
new Lazy<CustomerMaint>(() => PXGraph.CreateInstance<CustomerMaint>());

public PXFilter<CustomerMaint.CustomerBalanceSummary> CustomerBalance;
protected virtual IEnumerable customerBalance()
{
Customer customer = Base.customer.Current;
if (customer != null && customer.BAccountID > 0L)
{
var g = lazyCustomerMaint.Value;
g.BAccount.Current = g.BAccount.Search<BAccount.bAccountID>(customer.BAccountID);
g.CustomerBalance.Current = g.CustomerBalance.Select();
yield return g.CustomerBalance.Current;

}
}

}
}