简体   繁体   English

使用 Acumatica 以编程方式重新计算税收

[英]Programmatically recalculate taxes with Acumatica

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.我们在 SOOrderEntry 屏幕上有一个自定义复选框,我们希望在有人输入行项目后使用它来更改销售订单的税收管辖权。 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.我们遇到的问题是,当我们在输入行项目之前设置税区 ID 时,它可以正常工作并创建正确的税。 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.我们在 SOOrderEntry 图中发现了一些似乎用于重新计算税收的方法,但它们用于 Avalara 并且如果调用则会引发异常,因为我们在此系统中没有使用 Avalara,仅使用 Acumatica 的内部税收引擎。

Is there a way to have Acumatica recalculate the taxes when the tax zone changes on the order?当订单上的税区发生变化时,有没有办法让 Acumatica 重新计算税费?

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);

TaxAttrbibute adds ZoneUpdated event handler to the TaxZoneID_FieldUpdated event of the Sales Order. TaxAttrbibute 将 ZoneUpdated 事件处理程序添加到销售订单的 TaxZoneID_FieldUpdated 事件。 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.与 SetValue 方法不同,SetValueExt 方法在设置字段值时会引发事件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM