从 Shipment 创建发票时更新 UnitPrice 时税收计算错误,TaxAttribute.Calculate 使用旧的 extprice
Tax calculation is wrong when updating UnitPrice while creating the Invoice from Shipment, TaxAttribute.Calculate uses the old extprice
在我们的附加组件中,我们根据自己使用 Regex 表达式的计算从装运中创建发票时修改单价。对于所有领域来说一切似乎都很好,除了总是接受 SOOrder 税的税。
我们创建了一个 PXGraphExtension 并使用了以下内容:
public void InvoiceOrder(DateTime invoiceDate, PXResult<SOOrderShipment, SOOrder, CurrencyInfo, SOAddress, SOContact, SOOrderType> order, PXResultset<SOShipLine, SOLine> details, Customer customer, DocumentList<ARInvoice, SOInvoice> list,
Action<DateTime, PXResult<SOOrderShipment, SOOrder, CurrencyInfo, SOAddress, SOContact, SOOrderType>, PXResultset<SOShipLine, SOLine>, Customer, DocumentList<ARInvoice, SOInvoice>> method)
{
using (var scope = new PXTransactionScope())
{
method(invoiceDate, order, details, customer, list);
LookupBalesFromOrderAndShipment();
scope.Complete();
}
}
在 LookupBalesFromOrderAndShipment() 中;是我们根据计算修改 UnitPrice 的地方,并调用 Base.Transactions.Update(updatedLine);使用我们的新值,然后 Base.Persist();
除了“税务详细信息”选项卡外,所有数据似乎都很好,它仍然使用旧的 CuryLineAmt 而不是新创建的发票的新 CuryLineAmt。
我已经尝试在 RowUpdated 事件中强制重新计算税收,但它似乎没有任何作用。
protected virtual void ARTran_RowUpdated(PXCache cache, PXRowUpdatedEventArgs e, PXRowUpdated InvokeBaseHandler)
{
if (InvokeBaseHandler != null)
InvokeBaseHandler(cache, e);
TaxAttribute.Calculate<ARTran.taxCategoryID>(cache, e);
}
正在声明 var row = (ARTran)e.Row;并检查变量告诉我正确的新 CuryLineAmt,但税收似乎仍然是根据来自 SOOrder 的内容计算的。
是否有任何其他方法可以在没有任何风险的情况下强制进行税金计算或更新 ARTax 和 ARTaxTran table?
基本函数 InvoiceOrder 更改了税收计算方法以适应初始 SalesInvoice 创建:
TaxAttribute.SetTaxCalc<ARTran.taxCategoryID>(this.Transactions.Cache, null, TaxCalc.ManualCalc);
每次访问此页面时,所使用的计税方法都是在 SOInvoiceEntry 的构造函数中设置的方法:
TaxAttribute.SetTaxCalc<ARTran.taxCategoryID>(Transactions.Cache, null, TaxCalc.ManualLineCalc);
您的解决方案是在调用您的基本委托后设置适当的税收计算方法:
public delegate void InvoiceOrderDelegate(DateTime invoiceDate, PXResult<SOOrderShipment,SOOrder,CurrencyInfo,SOAddress,SOContact,SOOrderType> order, PXResultset<SOShipLine,SOLine> details, Customer customer, DocumentList<ARInvoice,SOInvoice> list);
[PXOverride]
public void InvoiceOrder(DateTime invoiceDate, PXResult<SOOrderShipment,SOOrder,CurrencyInfo,SOAddress,SOContact,SOOrderType> order, PXResultset<SOShipLine,SOLine> details, Customer customer, DocumentList<ARInvoice,SOInvoice> list, InvoiceOrderDelegate baseMethod)
{
baseMethod(invoiceDate,order,details,customer,list);
TaxAttribute.SetTaxCalc<ARTran.taxCategoryID>(Base.Transactions.Cache, null, TaxCalc.ManualLineCalc);
var tran = Base.Transactions.Current;
tran.CuryUnitPrice = tran.CuryUnitPrice + 10m;
Base.Transactions.Update(tran);
Base.Actions.PressSave();
}
在我们的附加组件中,我们根据自己使用 Regex 表达式的计算从装运中创建发票时修改单价。对于所有领域来说一切似乎都很好,除了总是接受 SOOrder 税的税。
我们创建了一个 PXGraphExtension 并使用了以下内容:
public void InvoiceOrder(DateTime invoiceDate, PXResult<SOOrderShipment, SOOrder, CurrencyInfo, SOAddress, SOContact, SOOrderType> order, PXResultset<SOShipLine, SOLine> details, Customer customer, DocumentList<ARInvoice, SOInvoice> list,
Action<DateTime, PXResult<SOOrderShipment, SOOrder, CurrencyInfo, SOAddress, SOContact, SOOrderType>, PXResultset<SOShipLine, SOLine>, Customer, DocumentList<ARInvoice, SOInvoice>> method)
{
using (var scope = new PXTransactionScope())
{
method(invoiceDate, order, details, customer, list);
LookupBalesFromOrderAndShipment();
scope.Complete();
}
}
在 LookupBalesFromOrderAndShipment() 中;是我们根据计算修改 UnitPrice 的地方,并调用 Base.Transactions.Update(updatedLine);使用我们的新值,然后 Base.Persist();
除了“税务详细信息”选项卡外,所有数据似乎都很好,它仍然使用旧的 CuryLineAmt 而不是新创建的发票的新 CuryLineAmt。
我已经尝试在 RowUpdated 事件中强制重新计算税收,但它似乎没有任何作用。
protected virtual void ARTran_RowUpdated(PXCache cache, PXRowUpdatedEventArgs e, PXRowUpdated InvokeBaseHandler)
{
if (InvokeBaseHandler != null)
InvokeBaseHandler(cache, e);
TaxAttribute.Calculate<ARTran.taxCategoryID>(cache, e);
}
正在声明 var row = (ARTran)e.Row;并检查变量告诉我正确的新 CuryLineAmt,但税收似乎仍然是根据来自 SOOrder 的内容计算的。
是否有任何其他方法可以在没有任何风险的情况下强制进行税金计算或更新 ARTax 和 ARTaxTran table?
基本函数 InvoiceOrder 更改了税收计算方法以适应初始 SalesInvoice 创建:
TaxAttribute.SetTaxCalc<ARTran.taxCategoryID>(this.Transactions.Cache, null, TaxCalc.ManualCalc);
每次访问此页面时,所使用的计税方法都是在 SOInvoiceEntry 的构造函数中设置的方法:
TaxAttribute.SetTaxCalc<ARTran.taxCategoryID>(Transactions.Cache, null, TaxCalc.ManualLineCalc);
您的解决方案是在调用您的基本委托后设置适当的税收计算方法:
public delegate void InvoiceOrderDelegate(DateTime invoiceDate, PXResult<SOOrderShipment,SOOrder,CurrencyInfo,SOAddress,SOContact,SOOrderType> order, PXResultset<SOShipLine,SOLine> details, Customer customer, DocumentList<ARInvoice,SOInvoice> list);
[PXOverride]
public void InvoiceOrder(DateTime invoiceDate, PXResult<SOOrderShipment,SOOrder,CurrencyInfo,SOAddress,SOContact,SOOrderType> order, PXResultset<SOShipLine,SOLine> details, Customer customer, DocumentList<ARInvoice,SOInvoice> list, InvoiceOrderDelegate baseMethod)
{
baseMethod(invoiceDate,order,details,customer,list);
TaxAttribute.SetTaxCalc<ARTran.taxCategoryID>(Base.Transactions.Cache, null, TaxCalc.ManualLineCalc);
var tran = Base.Transactions.Current;
tran.CuryUnitPrice = tran.CuryUnitPrice + 10m;
Base.Transactions.Update(tran);
Base.Actions.PressSave();
}