Programmatically recalculate taxes with Acumatica

余生长醉 提交于 2021-01-29 10:58:45

问题


We have a custom checkbox on the SOOrderEntry screen which we'd like to use to change the tax jurisdiction on the sales order after somebody has entered line items. The reason for this is that if the customer is out of state but will be picking up the order at the store in person, they will need to pay the local taxes at the store location and not their state taxes. If the order was shipped, the taxes would be those for the customer's location.

The issue we're having is that when we set the Tax Zone ID before line items are entered, it works correctly and the right taxes are created. If the user changes the checkbox value, the taxes will still be the ones from the original tax zone and not the one currently reflected on the screen.

We found a few methods on the SOOrderEntry graph that appear to be for recalculating taxes but their for Avalara and thow an exception if called because we're not using Avalara in this system, only Acumatica's internal tax engine.

Is there a way to have Acumatica recalculate the taxes when the tax zone changes on the order?

Any help would be very appreciated, we haven't made much headway with help documentation or trial and error.

There's not much code to it, but here's the few lines that we have:

// Customer Pickup, update sales tax on the order
Location branchLoc = PXSelectJoin<Location,
                    InnerJoin<Branch, On<Location.bAccountID, Equal<Branch.bAccountID>>>,
                     Where<Branch.branchID, Equal<Required<SOOrder.branchID>>>>
                       .Select(Base, order.BranchID);

cache.SetValue<SOOrder.overrideTaxZone>(order, true);
cache.SetValue<SOOrder.taxZoneID>(order, branchLoc.VTaxZoneID);

回答1:


TaxAttrbibute adds ZoneUpdated event handler to the TaxZoneID_FieldUpdated event of the Sales Order. To trigger this event, you should use

cache.SetValueExt<SOOrder.taxZoneID>(order, branchLoc.VTaxZoneID);

The SetValueExt method raises events when setting field value unlike SetValue method.



来源:https://stackoverflow.com/questions/51844292/programmatically-recalculate-taxes-with-acumatica

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!