Solved

How to get the sum of a field in the line level of the grid and show in a header level field

  • 28 August 2023
  • 2 replies
  • 129 views

Userlevel 4
Badge

As shown in the above screenshot, I want to get the total of the “Line Volume” in the detail section and show in the field of Total Volume in the header level. This Line Volume is a newly added customized field in to the ARTran DAC. Relevant code for the Line Volume as follows.  

Guys, If you can give me a guidance, it is highly appreciated. 

icon

Best answer by KumarDighe 28 August 2023, 13:34

View original

2 replies

Badge +11

You are supposed to be able to use PXFormula to accomplish this, but according to this article, there may be an issue with that. I would try the PXFormula, and if it still hasn’t been fixed, use one of the other events.

Hi @malinthawarnakulasooriya08,

I have similar requirement before to get the Invoice amount total on Project billing screen

I did the following code on row selected event to get the same.

  var getBugetLines = PXSelect<PMRevenueBudget, Where<PMRevenueBudget.projectID, Equal<@P.AsInt>>>.Select(Base, row.ProjectID);

if (getBugetLines == null) return;

// Loop through the budget records and sum up the invoiced amounts
foreach (PMBudget budgetRecord in getBugetLines)
{
// Retrieve the invoiced amount from the CuryAmountToInvoice field
decimal invoicedAmount = budgetRecord.CuryAmountToInvoice.GetValueOrDefault();



// Add the invoiced amount to the total
invoicedAmountTotal += invoicedAmount;
}
e.Cache.SetValueExt<ProjectsListExt.usrInvoiceAmountToPay>(row, invoicedAmountTotal);

You just need to use your DAC and Fields to get the Total Volume.

Let us know this will help you or not.

Regards,
Kumar

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved