Sales order total different with actual total

254 views Asked by At

Just need to know any one of you experiencing this issue with sales order document in acumatica ERP 4.2,

The header level total is wrong when compared to the total of lines. Is there any way we can recalculate the totals in code as i couldn't find fix from acumatica yet?

2

There are 2 answers

1
srodionov On

If document is not yet closed, you can just modify qty or add/remove line. If document is closed i do not see any possible ways except changing data in DB.

0
FarmerJohn On

I am adding my recent experience to this topic in hopes it might help others. Months ago, I wrote the code shown below anticipating its need when called by RESTful services. It was clearly not needed, and even worse, merely written and forgotten...

The code was from a SalesOrderEntryExt graph extension. By removing the code block, the doubling of Order Total was resolved.

It's also an example of backing out custom code until finding the problem.

    protected void _(Events.RowInserted<SOLine> e, PXRowInserted del)
    {
        // call the base BLC event handler...
        del?.Invoke(e.Cache, e.Args);

        SOLine row = e.Row;

        if (!Base.IsExport) return;

        if (row != null && row.OrderQty > 0m)
        {
            // via RESTful API, raise event
            SOLine copy = Base.Transactions.Cache.CreateCopy(row) as SOLine;
            copy.OrderQty = 0m;
            Base.Transactions.Cache.RaiseRowUpdated(row, copy);
        }
    }