使用 Acumatica 以编程方式重新计算税收 [英] Programmatically recalculate taxes with Acumatica

查看:32
本文介绍了使用 Acumatica 以编程方式重新计算税收的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们在 SOOrderEntry 屏幕上有一个自定义复选框,我们希望在有人输入行项目后使用它来更改销售订单的税收管辖区.这样做的原因是,如果客户不在州内,但要亲自到商店取货,他们将需要在商店所在地缴纳地方税,而不是州税.如果订单已发货,则税费将是客户所在位置的税费.

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.

我们遇到的问题是,当我们在输入行项目之前设置税区 ID 时,它可以正常工作并创建正确的税.如果用户更改复选框值,税款仍将是来自原始税区的税款,而不是当前反映在屏幕上的税款.

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.

我们在 SOOrderEntry 图中发现了一些似乎用于重新计算税收的方法,但它们适用于 Avalara,并且如果在调用时抛出异常,因为我们在此系统中未使用 Avalara,仅使用 Acumatica 的内部税收引擎.

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.

当订单上的税区发生变化时,有没有办法让 Acumatica 重新计算税费?

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

推荐答案

TaxAttrbibute 将 ZoneUpdated 事件处理程序添加到销售订单的 TaxZoneID_FieldUpdated 事件.要触发此事件,您应该使用

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

与 SetValue 方法不同,SetValueExt 方法在设置字段值时会引发事件.

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

这篇关于使用 Acumatica 以编程方式重新计算税收的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆