0
votes

I'm trying to simply add a new total field to the Purchase Receipts screen header (the Total Amt that was removed in a more recent release of Acumatica for some reason). It seems like this should have been pretty straightforward, but I haven't been able to get any method I've tried to work; and before I try to manually total all of the detail lines myself in custom code when any change is made in the detail lines, I wanted to find out how to do this the proper way. I've tried the following methods so far that just don't seem to work and my total field remains at zero:

1.) PXFormula on the new custom field on a POReceipt DAC extension (I also tried using PXUnboundFormula since this is an unbound field):

    [PXFormula(typeof(Mult<POReceiptLine.unitCost, POReceiptLine.receiptQty>), typeof(SumCalc<POReceiptExt.usrTotalAmt>))]

2.) PXFormula on a new custom field on a POReceiptLine DAC extension (I also tried using PXUnboundFormula since this is an unbound field):

    [PXFormula(typeof(Mult<POReceiptLine.unitCost, POReceiptLine.receiptQty>), typeof(SumCalc<POReceiptExt.usrTotalAmt>))]

3.) PXDBCalced on a new custom field on a POReceiptLine DAC extension to perform the calc on each line:

    [PXDBCalced(typeof(Mult<POReceiptLine.unitCost, POReceiptLine.receiptQty>), typeof(decimal))]

then try to total that with a new view

    public PXSelectGroupBy<POReceiptLine, Where<POReceiptLine.receiptNbr, Equal<Required<POReceipt.receiptNbr>>>,Aggregate<GroupBy<POReceiptLine.receiptNbr, Sum<POReceiptLineExtension.usrLineAmt>>>> Totals;

4.) Defining a dataview method to build the view contents and total manually.

What is the proper method? Or, even if you could point me to the code from the previous release that calculated this total, I can possibly use that.

1
"manually total all of the detail lines myself in custom code", this is unfortunately often required to workaround refresh issues where the DAC attributes don't update properly - Hugues Beauséjour
That didn't work either unfortunately, because the cache doesn't have the changed values in it. Even if I try to look at the Inserted and Updated collections. - Tony Lanzer
Acumatica support sent me this link --> asiablog.acumatica.com/2019/06/… but my code never makes it past the first line of code because Base.Document.Current is always null. - Tony Lanzer
Wrong approach, you're reading document from document delegate. Try in RowSelected event. - Hugues Beauséjour

1 Answers

0
votes

The following post finally led me to a solution that worked for me --> https://stackoverflow.com/a/36870660/7376238 by summing the total manually in the RowSelected event handler.