【发布时间】:2020-05-07 14:29:55
【问题描述】:
我有一个用于发票的图表覆盖
public class ARInvoiceEntry_Extension : PXGraphExtension<ARInvoiceEntry>
在其中一个事件处理程序中,我正在更新TaxZoneID,它工作正常。但是,税收不会更新或重新计算。我试过here提到的方法
cache.SetValueExt<SOOrder.taxZoneID>(order, branchLoc.VTaxZoneID);
但这对我不起作用。我已经在_FieldUpdating、_FieldUpdated 甚至ARInvoice_RowPersisting(PXCache cache, PXRowPersistingEventArgs e, PXRowPersisting InvokeBaseHandler) 事件中尝试过。关于为什么它不起作用的任何想法? TaxZone 和税率已经在数据库中(我们没有使用 Avatax)。
--- 编辑 1 ---
这是更新 TaxZoneID 的代码
namespace PX.Objects.AR
{
public class ARInvoiceEntry_Extension : PXGraphExtension<ARInvoiceEntry>
{
#region Event Handlers
protected void ARShippingAddress_PostalCode_FieldUpdated(PXCache sender, PXFieldUpdatedEventArgs e, PXFieldUpdated del)
{
// PXTrace.WriteInformation("ARShippingAddress_PostalCode_FieldUpdated");
ARShippingAddress row = e.Row as ARShippingAddress;
if (row != null) {
if (DoChangeTaxZone(row)) {
var invoice = Base.Document.Current;
if (invoice != null) {
invoice.TaxZoneID = GetTaxZoneId(row);
sender.SetValueExt<ARInvoice.taxZoneID>(invoice, invoice.TaxZoneID);
}
}
}
if (del != null)
{
del(sender, e);
}
}
#endregion
private bool DoChangeTaxZone(ARShippingAddress row)
{
// logic ...
return true;
}
private string GetTaxZoneId(ARShippingAddress row)
{
// logic ...
return "TAX-ZONE-ID";
}
}
}
【问题讨论】:
-
请将您更新 TaxZoneID 的代码添加到问题中
-
您使用的是
ARInvoiceEntryPXGraph 而不是SOOrderEntry,很可能税务引擎正在对ARInvoice的TaxZoneID而不是SOOrder的作出反应。在ARInvoice的TaxZoneID上尝试SetValueExt。 -
@SamvelPetrosov - 我添加了更新发生的代码。正如您在添加的代码中看到的那样,我确实尝试在
ARInvoice.taxZoneID上调用SetValueExt,但由于某种原因这似乎不起作用。也许我使用了错误的事件传播顺序? -
这样做并不简单,我正在四处询问我以前见过的示例。有人应该尽快发布答案。
标签: acumatica